diff --git a/android/app/build.gradle b/android/app/build.gradle index 1f71421f..9640ea61 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,7 +27,7 @@ apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 28 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -41,7 +41,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.cloud.diplomaticquarterapp" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f1a5a3f8..8c32edfd 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -17,6 +17,9 @@ + + + + + diff --git a/android/gradle.properties b/android/gradle.properties index 3f45ee5b..9c0729c9 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,4 +2,4 @@ android.enableR8=true android.useAndroidX=true android.enableJetifier=true -org.gradle.jvmargs=-Xmx4608m \ No newline at end of file +org.gradle.jvmargs=-Xmx4608m diff --git a/assets/images/CloseIcon.png b/assets/images/CloseIcon.png new file mode 100644 index 00000000..b8e68fea Binary files /dev/null and b/assets/images/CloseIcon.png differ diff --git a/assets/images/Wifi-AR.png b/assets/images/Wifi-AR.png new file mode 100644 index 00000000..a8e2d9af Binary files /dev/null and b/assets/images/Wifi-AR.png differ diff --git a/assets/images/covid-car.png b/assets/images/covid-car.png new file mode 100644 index 00000000..01090b74 Binary files /dev/null and b/assets/images/covid-car.png differ diff --git a/assets/images/covid_bg_transparent.png b/assets/images/covid_bg_transparent.png new file mode 100644 index 00000000..cd5f12f1 Binary files /dev/null and b/assets/images/covid_bg_transparent.png differ diff --git a/assets/images/home_health_care_icon.png b/assets/images/home_health_care_icon.png new file mode 100644 index 00000000..d80ec015 Binary files /dev/null and b/assets/images/home_health_care_icon.png differ diff --git a/assets/images/medical/BMR_calculator.png b/assets/images/medical/BMR_calculator.png new file mode 100644 index 00000000..2c32b80d Binary files /dev/null and b/assets/images/medical/BMR_calculator.png differ diff --git a/assets/images/medical/bmi_health_calculator.png b/assets/images/medical/bmi_health_calculator.png new file mode 100644 index 00000000..2eb49440 Binary files /dev/null and b/assets/images/medical/bmi_health_calculator.png differ diff --git a/assets/images/medical/body_fat.png b/assets/images/medical/body_fat.png new file mode 100644 index 00000000..3dd36150 Binary files /dev/null and b/assets/images/medical/body_fat.png differ diff --git a/assets/images/medical/body_weight.png b/assets/images/medical/body_weight.png new file mode 100644 index 00000000..d1f0b324 Binary files /dev/null and b/assets/images/medical/body_weight.png differ diff --git a/assets/images/medical/calories-calculator.png b/assets/images/medical/calories-calculator.png new file mode 100644 index 00000000..e9d72554 Binary files /dev/null and b/assets/images/medical/calories-calculator.png differ diff --git a/assets/images/medical/carb_protein.png b/assets/images/medical/carb_protein.png new file mode 100644 index 00000000..eb6c6640 Binary files /dev/null and b/assets/images/medical/carb_protein.png differ diff --git a/assets/images/medical/delivery_date_icon.png b/assets/images/medical/delivery_date_icon.png new file mode 100644 index 00000000..d578be34 Binary files /dev/null and b/assets/images/medical/delivery_date_icon.png differ diff --git a/assets/images/medical/ovulation_period_icon.png b/assets/images/medical/ovulation_period_icon.png new file mode 100644 index 00000000..c9a075d3 Binary files /dev/null and b/assets/images/medical/ovulation_period_icon.png differ diff --git a/assets/images/new-design/calendar.png b/assets/images/new-design/calendar.png new file mode 100644 index 00000000..ac72b030 Binary files /dev/null and b/assets/images/new-design/calendar.png differ diff --git a/assets/images/new-design/calender-secondary.png b/assets/images/new-design/calender-secondary.png new file mode 100644 index 00000000..a790849d Binary files /dev/null and b/assets/images/new-design/calender-secondary.png differ diff --git a/assets/images/new-design/covid-19-big-banner-bg.png b/assets/images/new-design/covid-19-big-banner-bg.png new file mode 100644 index 00000000..a66d6815 Binary files /dev/null and b/assets/images/new-design/covid-19-big-banner-bg.png differ diff --git a/assets/images/new-design/covid_bg_transparent.png b/assets/images/new-design/covid_bg_transparent.png new file mode 100644 index 00000000..cd5f12f1 Binary files /dev/null and b/assets/images/new-design/covid_bg_transparent.png differ diff --git a/assets/images/new-design/female.png b/assets/images/new-design/female.png new file mode 100644 index 00000000..29cf8c98 Binary files /dev/null and b/assets/images/new-design/female.png differ diff --git a/assets/images/new-design/garbage.png b/assets/images/new-design/garbage.png new file mode 100644 index 00000000..b0d48797 Binary files /dev/null and b/assets/images/new-design/garbage.png differ diff --git a/assets/images/new-design/hmg_full_logo_hd_white.png b/assets/images/new-design/hmg_full_logo_hd_white.png new file mode 100644 index 00000000..e4d7ae60 Binary files /dev/null and b/assets/images/new-design/hmg_full_logo_hd_white.png differ diff --git a/assets/images/new-design/male.png b/assets/images/new-design/male.png new file mode 100644 index 00000000..e957df70 Binary files /dev/null and b/assets/images/new-design/male.png differ diff --git a/assets/images/new-design/waiting_for_doctor.png b/assets/images/new-design/waiting_for_doctor.png new file mode 100644 index 00000000..c330c25a Binary files /dev/null and b/assets/images/new-design/waiting_for_doctor.png differ diff --git a/assets/images/robort.png b/assets/images/robort.png new file mode 100644 index 00000000..320afcbc Binary files /dev/null and b/assets/images/robort.png differ diff --git a/assets/images/svg/robort_svg.svg b/assets/images/svg/robort_svg.svg new file mode 100644 index 00000000..07d3d4b4 --- /dev/null +++ b/assets/images/svg/robort_svg.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/svg/symptom.svg b/assets/images/svg/symptom.svg new file mode 100644 index 00000000..aa670da1 --- /dev/null +++ b/assets/images/svg/symptom.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/wifi-EN.png b/assets/images/wifi-EN.png new file mode 100644 index 00000000..5711925c Binary files /dev/null and b/assets/images/wifi-EN.png differ diff --git a/ios/Podfile b/ios/Podfile index 9712eaff..c2702b3e 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '9.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -10,6 +10,9 @@ project 'Runner', { 'Release' => :release, } +# pod 'FBSDKCoreKit' +# pod 'FBSDKLoginKit' + def parse_KV_file(file, separator='=') file_abs_path = File.expand_path(file) if !File.exists? file_abs_path @@ -85,3 +88,4 @@ post_install do |installer| end end end + diff --git a/ios/Podfile.lock b/ios/Podfile.lock deleted file mode 100644 index 005fe83c..00000000 --- a/ios/Podfile.lock +++ /dev/null @@ -1,310 +0,0 @@ -PODS: - - barcode_scan (0.0.1): - - Flutter - - MTBBarcodeScanner - - SwiftProtobuf - - connectivity (0.0.1): - - Flutter - - Reachability - - connectivity_for_web (0.1.0): - - Flutter - - connectivity_macos (0.0.1): - - Flutter - - device_info (0.0.1): - - Flutter - - Firebase/Core (6.23.0): - - Firebase/CoreOnly - - FirebaseAnalytics (= 6.4.2) - - Firebase/CoreOnly (6.23.0): - - FirebaseCore (= 6.6.7) - - Firebase/Messaging (6.23.0): - - Firebase/CoreOnly - - FirebaseMessaging (~> 4.3.1) - - firebase_messaging (0.0.1): - - Firebase/Core - - Firebase/Messaging - - Flutter - - FirebaseAnalytics (6.4.2): - - FirebaseCore (~> 6.6) - - FirebaseInstallations (~> 1.2) - - GoogleAppMeasurement (= 6.4.2) - - GoogleUtilities/AppDelegateSwizzler (~> 6.0) - - GoogleUtilities/MethodSwizzler (~> 6.0) - - GoogleUtilities/Network (~> 6.0) - - "GoogleUtilities/NSData+zlib (~> 6.0)" - - nanopb (= 0.3.9011) - - FirebaseAnalyticsInterop (1.5.0) - - FirebaseCore (6.6.7): - - FirebaseCoreDiagnostics (~> 1.2) - - FirebaseCoreDiagnosticsInterop (~> 1.2) - - GoogleUtilities/Environment (~> 6.5) - - GoogleUtilities/Logger (~> 6.5) - - FirebaseCoreDiagnostics (1.2.4): - - FirebaseCoreDiagnosticsInterop (~> 1.2) - - GoogleDataTransportCCTSupport (~> 3.0) - - GoogleUtilities/Environment (~> 6.5) - - GoogleUtilities/Logger (~> 6.5) - - nanopb (~> 0.3.901) - - FirebaseCoreDiagnosticsInterop (1.2.0) - - FirebaseInstallations (1.2.0): - - FirebaseCore (~> 6.6) - - GoogleUtilities/Environment (~> 6.6) - - GoogleUtilities/UserDefaults (~> 6.6) - - PromisesObjC (~> 1.2) - - FirebaseInstanceID (4.3.4): - - FirebaseCore (~> 6.6) - - FirebaseInstallations (~> 1.0) - - GoogleUtilities/Environment (~> 6.5) - - GoogleUtilities/UserDefaults (~> 6.5) - - FirebaseMessaging (4.3.1): - - FirebaseAnalyticsInterop (~> 1.5) - - FirebaseCore (~> 6.6) - - FirebaseInstanceID (~> 4.3) - - GoogleUtilities/AppDelegateSwizzler (~> 6.5) - - GoogleUtilities/Environment (~> 6.5) - - GoogleUtilities/Reachability (~> 6.5) - - GoogleUtilities/UserDefaults (~> 6.5) - - Protobuf (>= 3.9.2, ~> 3.9) - - Flutter (1.0.0) - - flutter_flexible_toast (0.0.1): - - Flutter - - flutter_inappwebview (0.0.1): - - Flutter - - flutter_local_notifications (0.0.1): - - Flutter - - flutter_plugin_android_lifecycle (0.0.1): - - Flutter - - GoogleAppMeasurement (6.4.2): - - GoogleUtilities/AppDelegateSwizzler (~> 6.0) - - GoogleUtilities/MethodSwizzler (~> 6.0) - - GoogleUtilities/Network (~> 6.0) - - "GoogleUtilities/NSData+zlib (~> 6.0)" - - nanopb (= 0.3.9011) - - GoogleDataTransport (6.0.0) - - GoogleDataTransportCCTSupport (3.0.0): - - GoogleDataTransport (~> 6.0) - - nanopb (~> 0.3.901) - - GoogleUtilities/AppDelegateSwizzler (6.6.0): - - GoogleUtilities/Environment - - GoogleUtilities/Logger - - GoogleUtilities/Network - - GoogleUtilities/Environment (6.6.0): - - PromisesObjC (~> 1.2) - - GoogleUtilities/Logger (6.6.0): - - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (6.6.0): - - GoogleUtilities/Logger - - GoogleUtilities/Network (6.6.0): - - GoogleUtilities/Logger - - "GoogleUtilities/NSData+zlib" - - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (6.6.0)" - - GoogleUtilities/Reachability (6.6.0): - - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (6.6.0): - - GoogleUtilities/Logger - - hexcolor (0.0.1): - - Flutter - - image_cropper (0.0.2): - - Flutter - - TOCropViewController (~> 2.5.2) - - image_picker (0.0.1): - - Flutter - - local_auth (0.0.1): - - Flutter - - manage_calendar_events (0.0.1): - - Flutter - - map_launcher (0.0.1): - - Flutter - - MTBBarcodeScanner (5.0.11) - - nanopb (0.3.9011): - - nanopb/decode (= 0.3.9011) - - nanopb/encode (= 0.3.9011) - - nanopb/decode (0.3.9011) - - nanopb/encode (0.3.9011) - - path_provider_linux (0.0.1): - - Flutter - - "permission_handler (5.0.1+1)": - - Flutter - - PromisesObjC (1.2.8) - - Protobuf (3.11.4) - - Reachability (3.2) - - shared_preferences (0.0.1): - - Flutter - - shared_preferences_linux (0.0.1): - - Flutter - - shared_preferences_macos (0.0.1): - - Flutter - - shared_preferences_web (0.0.1): - - Flutter - - SwiftProtobuf (1.10.2) - - TOCropViewController (2.5.4) - - url_launcher (0.0.1): - - Flutter - - url_launcher_linux (0.0.1): - - Flutter - - url_launcher_macos (0.0.1): - - Flutter - - url_launcher_web (0.0.1): - - Flutter - -DEPENDENCIES: - - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) - - connectivity (from `.symlinks/plugins/connectivity/ios`) - - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - - device_info (from `.symlinks/plugins/device_info/ios`) - - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - - Flutter (from `Flutter`) - - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) - - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - - image_cropper (from `.symlinks/plugins/image_cropper/ios`) - - image_picker (from `.symlinks/plugins/image_picker/ios`) - - local_auth (from `.symlinks/plugins/local_auth/ios`) - - manage_calendar_events (from `.symlinks/plugins/manage_calendar_events/ios`) - - map_launcher (from `.symlinks/plugins/map_launcher/ios`) - - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) - - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) - - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) - - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) - -SPEC REPOS: - trunk: - - Firebase - - FirebaseAnalytics - - FirebaseAnalyticsInterop - - FirebaseCore - - FirebaseCoreDiagnostics - - FirebaseCoreDiagnosticsInterop - - FirebaseInstallations - - FirebaseInstanceID - - FirebaseMessaging - - GoogleAppMeasurement - - GoogleDataTransport - - GoogleDataTransportCCTSupport - - GoogleUtilities - - MTBBarcodeScanner - - nanopb - - PromisesObjC - - Protobuf - - Reachability - - SwiftProtobuf - - TOCropViewController - -EXTERNAL SOURCES: - barcode_scan: - :path: ".symlinks/plugins/barcode_scan/ios" - connectivity: - :path: ".symlinks/plugins/connectivity/ios" - connectivity_for_web: - :path: ".symlinks/plugins/connectivity_for_web/ios" - connectivity_macos: - :path: ".symlinks/plugins/connectivity_macos/ios" - device_info: - :path: ".symlinks/plugins/device_info/ios" - firebase_messaging: - :path: ".symlinks/plugins/firebase_messaging/ios" - Flutter: - :path: Flutter - flutter_flexible_toast: - :path: ".symlinks/plugins/flutter_flexible_toast/ios" - flutter_inappwebview: - :path: ".symlinks/plugins/flutter_inappwebview/ios" - flutter_local_notifications: - :path: ".symlinks/plugins/flutter_local_notifications/ios" - flutter_plugin_android_lifecycle: - :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" - hexcolor: - :path: ".symlinks/plugins/hexcolor/ios" - image_cropper: - :path: ".symlinks/plugins/image_cropper/ios" - image_picker: - :path: ".symlinks/plugins/image_picker/ios" - local_auth: - :path: ".symlinks/plugins/local_auth/ios" - manage_calendar_events: - :path: ".symlinks/plugins/manage_calendar_events/ios" - map_launcher: - :path: ".symlinks/plugins/map_launcher/ios" - path_provider_linux: - :path: ".symlinks/plugins/path_provider_linux/ios" - permission_handler: - :path: ".symlinks/plugins/permission_handler/ios" - shared_preferences: - :path: ".symlinks/plugins/shared_preferences/ios" - shared_preferences_linux: - :path: ".symlinks/plugins/shared_preferences_linux/ios" - shared_preferences_macos: - :path: ".symlinks/plugins/shared_preferences_macos/ios" - shared_preferences_web: - :path: ".symlinks/plugins/shared_preferences_web/ios" - url_launcher: - :path: ".symlinks/plugins/url_launcher/ios" - url_launcher_linux: - :path: ".symlinks/plugins/url_launcher_linux/ios" - url_launcher_macos: - :path: ".symlinks/plugins/url_launcher_macos/ios" - url_launcher_web: - :path: ".symlinks/plugins/url_launcher_web/ios" - -SPEC CHECKSUMS: - barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 - connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 - connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b - connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 - device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 - Firebase: 585ae467b3edda6a5444e788fda6888f024d8d6f - firebase_messaging: 21344b3b3a7d9d325d63a70e3750c0c798fe1e03 - FirebaseAnalytics: 558f7a03d19de451093032c806f39d5f9dff096e - FirebaseAnalyticsInterop: 3f86269c38ae41f47afeb43ebf32a001f58fcdae - FirebaseCore: a2788a0d5f6c1dff17b8f79b4a73654a8d4bfdbd - FirebaseCoreDiagnostics: b59c024493a409f8aecba02c99928d0d8431d159 - FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850 - FirebaseInstallations: 2119fb3e46b0a88bfdbf12562f855ee3252462fa - FirebaseInstanceID: cef67c4967c7cecb56ea65d8acbb4834825c587b - FirebaseMessaging: 828e66eb357a893e3cebd9ee0f6bc1941447cc94 - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 - flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189 - flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 - flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 - GoogleAppMeasurement: 2253e99c1f22638cf234c059144660c338ad76c3 - GoogleDataTransport: 061fe7d9b476710e3cd8ea51e8e07d8b67c2b420 - GoogleDataTransportCCTSupport: 0f39025e8cf51f168711bd3fb773938d7e62ddb5 - GoogleUtilities: 39530bc0ad980530298e9c4af8549e991fd033b1 - hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 - image_cropper: 3c16d7651730ffe85897f5a1c4e2547e6b54989a - image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 - local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd - manage_calendar_events: 0338d505ea26cdfd20cd883279bc28afa11eca34 - map_launcher: e325db1261d029ff33e08e03baccffe09593ffea - MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd - path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 - permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 - PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6 - Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7 - Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 - shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 - shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 - shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 - SwiftProtobuf: bec1ae7d686ff73dd09d79866154f4970b891410 - TOCropViewController: 2a1ae1242600b1f2d996fd91a5268b2309a33b5c - url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 - url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 - url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c - -PODFILE CHECKSUM: 2609452b760cd11039b14039a86564367a3d8ab9 - -COCOAPODS: 1.9.1 diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..a28140cf --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift new file mode 100644 index 00000000..70693e4a --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +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/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard index f3c28516..00abc512 100644 --- a/ios/Runner/Base.lproj/Main.storyboard +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -1,8 +1,10 @@ - - + + + - + + @@ -14,13 +16,14 @@ - + - + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 792eb95e..b807d9c6 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -22,12 +22,22 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS - NSCalendarsUsageDescription - We Need to access the calender to add reminder for you + io.flutter.embedded_views_preview + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main + NSMicrophoneUsageDescription + Need microphone access for uploading videos + NSCameraUsageDescription + Need camera access for uploading images + NSLocationUsageDescription + Need location access for updating nearby friends + NSLocationWhenInUseUsageDescription + This app will use your location to show cool stuffs near you. + NSPhotoLibraryUsageDescription + Need photo library access for uploading images UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000..308a2a56 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 0c67376e..903def2a 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -1,5 +1,8 @@ - + + aps-environment + development + diff --git a/lib/config/config.dart b/lib/config/config.dart index 70c0d2fa..2ec511c9 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; const MAX_SMALL_SCREEN = 660; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; @@ -29,8 +29,10 @@ const GET_PRESCRIPTION_REPORT_ENH = ///Lab Order const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; -const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; -const GET_Patient_LAB_RESULT = '/Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_SPECIAL_RESULT = + 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; +const GET_Patient_LAB_RESULT = + '/Services/Patients.svc/REST/GetPatientLabResults'; /// const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; @@ -43,8 +45,7 @@ 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' +const GET_PATIENT_AppointmentHistory = 'Services' '/Doctors.svc/REST/PateintHasAppoimentHistory'; ///VITAL SIGN @@ -52,31 +53,50 @@ const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; ///Er Nearest -const GET_NEAREST_HOSPITAL= +const GET_NEAREST_HOSPITAL = 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; ///Er Nearest -const GET_AMBULANCE_REQUEST= - 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; - +const GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; +const GET_PATIENT_ALL_PRES_ORDERS= 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID= 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; ///FindUs -const GET_FINDUS_REQUEST= - 'Services/Lists.svc/REST/Get_HMG_Locations'; - +const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; ///LiveChat -const GET_LIVECHAT_REQUEST= - 'Services/Patients.svc/REST/GetPatientICProjects'; +const GET_LIVECHAT_REQUEST = 'Services/Patients.svc/REST/GetPatientICProjects'; + +///babyInformation +const GET_BABYINFORMATION_REQUEST = + 'Services/Community.svc/REST/GetBabyByUserID'; + +///Get Baby By User ID +const GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID'; + +///userInformation +const GET_USERINFORMATION_REQUEST = + 'Services/Community.svc/REST/GetUserInformation_New'; + +///addNewChild +const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby'; + +///newUserId +const GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New'; + +///delteChild +const DELETE_CHILD_REQUEST = 'Services/Community.svc/REST/DeleteBaby'; + +///addNewTABLE +const GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable'; + ///BloodDenote -const GET_CITIES_REQUEST= - 'Services/Lists.svc/REST/GetAllCities'; +const GET_CITIES_REQUEST = 'Services/Lists.svc/REST/GetAllCities'; ///BloodDetails -const GET_BLOOD_REQUEST= +const GET_BLOOD_REQUEST = 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails'; - ///Reports const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; const INSERT_REQUEST_FOR_MEDICAL_REPORT = @@ -104,7 +124,8 @@ const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime"; //URL to dental doctors list -const GET_DENTAL_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping"; +const GET_DENTAL_DOCTORS_LIST_URL = + "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping"; //URL to get doctor free slots const GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots"; @@ -118,8 +139,7 @@ const GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; //URL to get patient appointment history -const GET_PATIENT_APPOINTMENT_HISTORY = - "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; +const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; //URL to get patient appointment curfew history const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = @@ -129,6 +149,9 @@ const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = const CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment"; +const INSERT_VIDA_REQUEST = + "Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart"; + //URL to cancel appointment const CANCEL_APPOINTMENT = "Services/Doctors.svc/REST/CancelAppointment"; @@ -158,6 +181,22 @@ const SEND_CALL_REQUEST = 'Services/Doctors.svc/REST/InsertCallInfo'; const GET_LIVECARE_CLINICS = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinics'; + +const GET_LIVECARE_SCHEDULE_CLINICS = + 'Services/Doctors.svc/REST/PatientER_GetClinicsHaveSchedule'; + +const GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST = + 'Services/Doctors.svc/REST/PatientER_GetDoctorByClinicID'; + +const GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS = + 'Services/Doctors.svc/REST/PatientER_GetDoctorFreeSlots'; + +const INSERT_LIVECARE_SCHEDULE_APPOINTMENT = + 'Services/Doctors.svc/REST/InsertSpecificAppoitmentForSchedule'; + +const GET_PATIENT_SHARE_LIVECARE = + "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare"; + const GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; @@ -175,16 +214,16 @@ const CANCEL_LIVECARE_REQUEST = const SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; - -const GET_USER_TERMS ='/Services/Patients.svc/REST/GetUserTermsAndConditions'; -const UPDATE_HEALTH_TERMS ='/services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; +const GET_USER_TERMS = '/Services/Patients.svc/REST/GetUserTermsAndConditions'; +const UPDATE_HEALTH_TERMS = + '/services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; const IP_ADDRESS = '10.20.10.20'; const VERSION_ID = 5.6; -const SETUP_ID = '91877'; +const SETUP_ID = '91877'; const LANGUAGE = 2; const PATIENT_OUT_SA = 0; const SESSION_ID = 'TMRhVmkGhOsvamErw'; @@ -212,54 +251,74 @@ const GET_PATIENT_SICK_LEAVE = 'Services/Patients.svc/REST/GetPatientSickLeave'; const SendSickLeaveEmail = 'Services/Notifications.svc/REST/SendSickLeaveEmail'; -const GET_PATIENT_AdVANCE_BALANCE_AMOUNT = 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount'; -const GET_PATIENT_INFO_BY_ID = 'Services/Doctors.svc/REST/GetPatientInfoByPatientID'; -const GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber'; -const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment'; -const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; - -///My Trackers -const GET_DIABETIC_RESULT_AVERAGE='Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; -const GET_DIABTEC_RESULT='Services/Patients.svc/REST/Patient_GetDiabtecResults'; -const ADD_DIABTEC_RESULT='Services/Patients.svc/REST/Patient_AddDiabtecResult'; +const GET_PATIENT_AdVANCE_BALANCE_AMOUNT = + 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount'; +const GET_PATIENT_INFO_BY_ID = + 'Services/Doctors.svc/REST/GetPatientInfoByPatientID'; +const GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = + 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber'; +const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = + 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment'; +const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = + 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; -const GET_BLOOD_PRESSURE_RESULT_AVERAGE='Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage'; -const GET_BLOOD_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_GetBloodPressureResult'; -const ADD_BLOOD_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_AddBloodPressureResult'; +const GET_COVID_DRIVETHRU_PROJECT_LIST = 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; -const GET_WEIGHT_PRESSURE_RESULT_AVERAGE='Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage'; -const GET_WEIGHT_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; -const ADD_WEIGHT_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; +const GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; +const GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; -const ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID='Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID'; -const GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; -const GET_CALL_REQUEST_TYPE_LOV = 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; +///My Trackers +const GET_DIABETIC_RESULT_AVERAGE = + 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; +const GET_DIABTEC_RESULT = + 'Services/Patients.svc/REST/Patient_GetDiabtecResults'; +const ADD_DIABTEC_RESULT = + 'Services/Patients.svc/REST/Patient_AddDiabtecResult'; + +const GET_BLOOD_PRESSURE_RESULT_AVERAGE = + 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage'; +const GET_BLOOD_PRESSURE_RESULT = + 'Services/Patients.svc/REST/Patient_GetBloodPressureResult'; +const ADD_BLOOD_PRESSURE_RESULT = + 'Services/Patients.svc/REST/Patient_AddBloodPressureResult'; + +const GET_WEIGHT_PRESSURE_RESULT_AVERAGE = + 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage'; +const GET_WEIGHT_PRESSURE_RESULT = + 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; +const ADD_WEIGHT_PRESSURE_RESULT = + 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; + +const ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = + 'Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID'; + +const GET_CALL_INFO_HOURS_RESULT = + 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; +const GET_CALL_REQUEST_TYPE_LOV = + 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; const GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse'; const UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus'; const INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; const GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; - - - - // H2O -const H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; -const H2O_INSERT_USER_ACTIVITY="Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; - - - - +const H2O_GET_USER_PROGRESS = + "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; +const H2O_INSERT_USER_ACTIVITY = + "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; //E_Referral Services -const GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes"; -const SEND_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/SendActivationCodeForEReferral'; -const CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral'; +const GET_ALL_RELATIONSHIP_TYPES = + "Services/Patients.svc/REST/GetAllRelationshipTypes"; +const SEND_ACTIVATION_CODE_FOR_E_REFERRAL = + 'Services/Authentication.svc/REST/SendActivationCodeForEReferral'; +const CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = + 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral'; const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities'; const CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral"; const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; @@ -291,6 +350,7 @@ class AppGlobal { request.TokenID = "@dm!n"; request.isDentalAllowedBackend = false; request.DeviceTypeID = Platform.isIOS ? 1 : 2; + request.DeviceType = Platform.isIOS ? "iOS" : "Android"; return request; } diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 40840423..81f8a3d4 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -47,6 +47,8 @@ const Map> localizedValues = { }, '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': 'تأكيد لاحقا'}, 'todoList': {'en': 'Todo List', 'ar': 'مهامي'}, @@ -58,6 +60,7 @@ const Map> localizedValues = { 'viewQR': {'en': 'View QR Code', 'ar': 'عرض رمز الاستجابة السريعة'}, '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': 'هل أنت متأكد أنك تريد إلغاء هذا الموعد؟' @@ -376,6 +379,16 @@ const Map> localizedValues = { "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": { @@ -566,6 +579,15 @@ const Map> localizedValues = { "All":{"en":"All","ar":"الكل"}, "QuestionHere":{"en":"Enter the question here...","ar":"اضف الاستفسار هنا"}, "ViewDoctorResponses":{"en":"View Doctor Responses","ar":"الاطلاع على ردود الأطباء"}, - + "ServiceInformationButton":{"en":"LOGIN / REGISTER","ar":"دخول / تسجيل"}, + "ServiceInformationTitle":{"en":"Service Information","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": "خدمة نتائج المختبر: هذه الخدمة تمكنك من الاطلاع على نتائج جميع الفحوصات المخبرية التي تمت في مجموعة الحبيب الطبية." + }, + "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": "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." + }, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 61e36022..7422052d 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -14,3 +14,5 @@ const FAMILY_FILE = 'family-file'; const USER_LAT = 'user-lat'; const USER_LONG = 'user-long'; const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING'; +const IS_SEARCH_APPO = 'is-search-appo'; +const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; diff --git a/lib/core/enum/Ambulate.dart b/lib/core/enum/Ambulate.dart new file mode 100644 index 00000000..f8b2e8be --- /dev/null +++ b/lib/core/enum/Ambulate.dart @@ -0,0 +1,60 @@ +import 'package:flutter/cupertino.dart'; + +enum Ambulate { Wheelchair, Walker, Stretcher, None } + +extension SelectedAmbulate on Ambulate { + String getAmbulateTitle(BuildContext context) { + switch (this) { + case Ambulate.Wheelchair: + return 'Wheelchair'; + break; + case Ambulate.Walker: + return 'Walker'; + break; + case Ambulate.Stretcher: + return 'Stretcher'; + break; + case Ambulate.None: + return 'None'; + break; + } + return 'None'; + } + + int selectAmbulateNumber() { + switch (this) { + case Ambulate.Wheelchair: + return 0; + break; + case Ambulate.Walker: + return 1; + break; + case Ambulate.Stretcher: + return 2; + break; + case Ambulate.None: + return 3; + break; + } + return 3; + } + + Ambulate getAmbulateById(int id) { + switch (id) { + case 0: + return Ambulate.Wheelchair; + break; + case 1: + return Ambulate.Walker; + break; + case 2: + return Ambulate.Stretcher; + break; + case 3: + return Ambulate.None; + break; + } + + return Ambulate.None; + } +} diff --git a/lib/core/enum/OrderService.dart b/lib/core/enum/OrderService.dart new file mode 100644 index 00000000..e6ce24eb --- /dev/null +++ b/lib/core/enum/OrderService.dart @@ -0,0 +1,22 @@ +enum OrderService { AMBULANCE } + +extension SelectedOrderService on OrderService { + int getIdOrderService() { + switch (this) { + case OrderService.AMBULANCE: + return 4; + break; + } + return 4; + } + + OrderService getOrderServiceById(int id) { + switch (id) { + case 4: + return OrderService.AMBULANCE; + break; + } + + return OrderService.AMBULANCE; + } +} diff --git a/lib/core/model/childvaccines/List_BabyInformationModel.dart b/lib/core/model/childvaccines/List_BabyInformationModel.dart new file mode 100644 index 00000000..0711b8a2 --- /dev/null +++ b/lib/core/model/childvaccines/List_BabyInformationModel.dart @@ -0,0 +1,45 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +class List_BabyInformationModel { + int alertBy; + int babyID; + String babyName; + DateTime dOB; + int gender; + String genderDescription; + int patientID; + int userID; + + List_BabyInformationModel( + {this.alertBy, + this.babyID, + this.babyName, + this.dOB, + this.gender, + this.genderDescription, + this.patientID, + this.userID}); + + List_BabyInformationModel.fromJson(Map json) { + alertBy = json['AlertBy']; + babyID = json['BabyID']; + babyName = json['BabyName']; + dOB = DateUtil.convertStringToDate(json['DOB']); + gender = json['Gender']; + genderDescription = json['GenderDescription']; + patientID = json['PatientID']; + userID = json['UserID']; + } + + Map toJson() { + final Map data = new Map(); + data['AlertBy'] = this.alertBy; + data['BabyID'] = this.babyID; + data['BabyName'] = this.babyName; + data['DOB'] = this.dOB; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['PatientID'] = this.patientID; + data['UserID'] = this.userID; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/add_newchild_model.dart b/lib/core/model/childvaccines/add_newchild_model.dart new file mode 100644 index 00000000..9bbfe6ad --- /dev/null +++ b/lib/core/model/childvaccines/add_newchild_model.dart @@ -0,0 +1,100 @@ +class CreateNewBaby { + String babyName; + String gender; + String strDOB; + int editedBy; + int createdBy; + bool tempValue; + int userID; + bool isLogin; + int alertBy; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + + CreateNewBaby( + {this.babyName, + this.gender, + this.strDOB, + this.editedBy, + this.createdBy, + this.tempValue, + this.userID, + this.isLogin, + this.alertBy, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + CreateNewBaby.fromJson(Map json) { + babyName = json['BabyName']; + gender = json['Gender']; + strDOB = json['StrDOB']; + editedBy = json['EditedBy']; + createdBy = json['CreatedBy']; + tempValue = json['TempValue']; + userID = json['UserID']; + isLogin = json['IsLogin']; + alertBy = json['AlertBy']; + 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']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['BabyName'] = this.babyName; + data['Gender'] = this.gender; + data['StrDOB'] = this.strDOB; + data['EditedBy'] = this.editedBy; + data['CreatedBy'] = this.createdBy; + data['TempValue'] = this.tempValue; + data['UserID'] = this.userID; + data['IsLogin'] = this.isLogin; + data['AlertBy'] = this.alertBy; + 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['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/create_new_user_model.dart b/lib/core/model/childvaccines/create_new_user_model.dart new file mode 100644 index 00000000..980567e2 --- /dev/null +++ b/lib/core/model/childvaccines/create_new_user_model.dart @@ -0,0 +1,165 @@ +class CreateNewUser_New { + Null date; + int languageID; + int serviceName; + Null time; + Null androidLink; + Null authenticationTokenID; + Null data; + bool dataw; + int dietType; + Null errorCode; + Null errorEndUserMessage; + Null errorEndUserMessageN; + Null errorMessage; + int errorType; + int foodCategory; + Null iOSLink; + bool isAuthenticated; + int mealOrderStatus; + int mealType; + int messageStatus; + int numberOfResultRecords; + Null patientBlodType; + Null successMsg; + Null successMsgN; + Null htmlResult; + bool isHMGPatient; + bool isRegister; + bool isSendSMS; + Null listBabyInformationModel; + Null listBabyNeedReminderModel; + Null listCreateVaccinationTableModel; + Null listHisPatientModel; + Null listUserInformationModel; + Null listUserInformationModelNew; + Null listVaccinationTableModel; + Null tokinID; + int userID; + Null verificationCode; + + CreateNewUser_New( + {this.date, + this.languageID, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenID, + this.data, + this.dataw, + this.dietType, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iOSLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.htmlResult, + this.isHMGPatient, + this.isRegister, + this.isSendSMS, + this.listBabyInformationModel, + this.listBabyNeedReminderModel, + this.listCreateVaccinationTableModel, + this.listHisPatientModel, + this.listUserInformationModel, + this.listUserInformationModelNew, + this.listVaccinationTableModel, + this.tokinID, + this.userID, + this.verificationCode}); + + CreateNewUser_New.fromJson(Map json) { + date = json['Date']; + languageID = json['LanguageID']; + serviceName = json['ServiceName']; + time = json['Time']; + androidLink = json['AndroidLink']; + authenticationTokenID = json['AuthenticationTokenID']; + data = json['Data']; + dataw = json['Dataw']; + dietType = json['DietType']; + errorCode = json['ErrorCode']; + errorEndUserMessage = json['ErrorEndUserMessage']; + errorEndUserMessageN = json['ErrorEndUserMessageN']; + errorMessage = json['ErrorMessage']; + errorType = json['ErrorType']; + foodCategory = json['FoodCategory']; + iOSLink = json['IOSLink']; + isAuthenticated = json['IsAuthenticated']; + mealOrderStatus = json['MealOrderStatus']; + mealType = json['MealType']; + messageStatus = json['MessageStatus']; + numberOfResultRecords = json['NumberOfResultRecords']; + patientBlodType = json['PatientBlodType']; + successMsg = json['SuccessMsg']; + successMsgN = json['SuccessMsgN']; + htmlResult = json['HtmlResult']; + isHMGPatient = json['IsHMGPatient']; + isRegister = json['IsRegister']; + isSendSMS = json['IsSendSMS']; + listBabyInformationModel = json['List_BabyInformationModel']; + listBabyNeedReminderModel = json['List_BabyNeedReminderModel']; + listCreateVaccinationTableModel = json['List_CreateVaccinationTableModel']; + listHisPatientModel = json['List_His_PatientModel']; + listUserInformationModel = json['List_UserInformationModel']; + listUserInformationModelNew = json['List_UserInformationModel_New']; + listVaccinationTableModel = json['List_VaccinationTableModel']; + tokinID = json['TokinID']; + userID = json['UserID']; + verificationCode = json['VerificationCode']; + } + + Map toJson() { + final Map data = new Map(); + data['Date'] = this.date; + data['LanguageID'] = this.languageID; + data['ServiceName'] = this.serviceName; + data['Time'] = this.time; + data['AndroidLink'] = this.androidLink; + data['AuthenticationTokenID'] = this.authenticationTokenID; + data['Data'] = this.data; + data['Dataw'] = this.dataw; + data['DietType'] = this.dietType; + data['ErrorCode'] = this.errorCode; + data['ErrorEndUserMessage'] = this.errorEndUserMessage; + data['ErrorEndUserMessageN'] = this.errorEndUserMessageN; + data['ErrorMessage'] = this.errorMessage; + data['ErrorType'] = this.errorType; + data['FoodCategory'] = this.foodCategory; + data['IOSLink'] = this.iOSLink; + data['IsAuthenticated'] = this.isAuthenticated; + data['MealOrderStatus'] = this.mealOrderStatus; + data['MealType'] = this.mealType; + data['MessageStatus'] = this.messageStatus; + data['NumberOfResultRecords'] = this.numberOfResultRecords; + data['PatientBlodType'] = this.patientBlodType; + data['SuccessMsg'] = this.successMsg; + data['SuccessMsgN'] = this.successMsgN; + data['HtmlResult'] = this.htmlResult; + data['IsHMGPatient'] = this.isHMGPatient; + data['IsRegister'] = this.isRegister; + data['IsSendSMS'] = this.isSendSMS; + data['List_BabyInformationModel'] = this.listBabyInformationModel; + data['List_BabyNeedReminderModel'] = this.listBabyNeedReminderModel; + data['List_CreateVaccinationTableModel'] = + this.listCreateVaccinationTableModel; + data['List_His_PatientModel'] = this.listHisPatientModel; + data['List_UserInformationModel'] = this.listUserInformationModel; + data['List_UserInformationModel_New'] = this.listUserInformationModelNew; + data['List_VaccinationTableModel'] = this.listVaccinationTableModel; + data['TokinID'] = this.tokinID; + data['UserID'] = this.userID; + data['VerificationCode'] = this.verificationCode; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/create_vaccination_table.dart b/lib/core/model/childvaccines/create_vaccination_table.dart new file mode 100644 index 00000000..d39f2a64 --- /dev/null +++ b/lib/core/model/childvaccines/create_vaccination_table.dart @@ -0,0 +1,25 @@ +class CreateVaccinationTable { + String givenAt; + String status; + String vaccinesDescription; + String visit; + + CreateVaccinationTable( + {this.givenAt, this.status, this.vaccinesDescription, this.visit}); + + CreateVaccinationTable.fromJson(Map json) { + givenAt = json['GivenAt']; + status = json['Status']; + vaccinesDescription = json['VaccinesDescription']; + visit = json['Visit']; + } + + Map toJson() { + final Map data = new Map(); + data['GivenAt'] = this.givenAt; + data['Status'] = this.status; + data['VaccinesDescription'] = this.vaccinesDescription; + data['Visit'] = this.visit; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/delete_baby_model.dart b/lib/core/model/childvaccines/delete_baby_model.dart new file mode 100644 index 00000000..9274b1e8 --- /dev/null +++ b/lib/core/model/childvaccines/delete_baby_model.dart @@ -0,0 +1,76 @@ +class DeleteBaby { + bool isLogin; + int babyID; + int editedBy; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + + DeleteBaby( + {this.isLogin, + this.babyID, + this.editedBy, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + DeleteBaby.fromJson(Map json) { + isLogin = json['IsLogin']; + babyID = json['BabyID']; + editedBy = json['EditedBy']; + 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']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['IsLogin'] = this.isLogin; + data['BabyID'] = this.babyID; + data['EditedBy'] = this.editedBy; + 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['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/get_vacainations_itemsmodel.dart b/lib/core/model/childvaccines/get_vacainations_itemsmodel.dart new file mode 100644 index 00000000..14891852 --- /dev/null +++ b/lib/core/model/childvaccines/get_vacainations_itemsmodel.dart @@ -0,0 +1,18 @@ +class GET_VACCINATIONS_ITEMSMODEL { + String dESCRIPTION; + String iTEMCODE; + + GET_VACCINATIONS_ITEMSMODEL({this.dESCRIPTION, this.iTEMCODE}); + + GET_VACCINATIONS_ITEMSMODEL.fromJson(Map json) { + dESCRIPTION = json['DESCRIPTION']; + iTEMCODE = json['ITEM_CODE']; + } + + Map toJson() { + final Map data = new Map(); + data['DESCRIPTION'] = this.dESCRIPTION; + data['ITEM_CODE'] = this.iTEMCODE; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/user_information_model.dart b/lib/core/model/childvaccines/user_information_model.dart new file mode 100644 index 00000000..9e1687d3 --- /dev/null +++ b/lib/core/model/childvaccines/user_information_model.dart @@ -0,0 +1,48 @@ +class List_UserInformationModel { + int userID; + String mobileNumber; + String nationalID; + String emailAddress; + int patientID; + int patientType; + bool patientOutSA; + int createdBy; + int editedBy; + + List_UserInformationModel( + {this.userID, + this.mobileNumber, + this.nationalID, + this.emailAddress, + this.patientID, + this.patientType, + this.patientOutSA, + this.createdBy, + this.editedBy}); + + List_UserInformationModel.fromJson(Map json) { + userID = json['UserID']; + mobileNumber = json['MobileNumber']; + nationalID = json['NationalID']; + emailAddress = json['EmailAddress']; + patientID = json['PatientID']; + patientType = json['PatientType']; + patientOutSA = json['PatientOutSA']; + createdBy = json['CreatedBy']; + editedBy = json['EditedBy']; + } + + Map toJson() { + final Map data = new Map(); + data['UserID'] = this.userID; + data['MobileNumber'] = this.mobileNumber; + data['NationalID'] = this.nationalID; + data['EmailAddress'] = this.emailAddress; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['PatientOutSA'] = this.patientOutSA; + data['CreatedBy'] = this.createdBy; + data['EditedBy'] = this.editedBy; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/er/PatientAllPresOrders.dart b/lib/core/model/er/PatientAllPresOrders.dart new file mode 100644 index 00000000..90ce074a --- /dev/null +++ b/lib/core/model/er/PatientAllPresOrders.dart @@ -0,0 +1,132 @@ +class PatientAllPresOrders { + int iD; + String patientID; + bool patientOutSA; + bool isOutPatient; + int projectID; + int nearestProjectID; + double longitude; + double latitude; + String appointmentNo; + String dischargeID; + int lineItemNo; + int status; + String description; + String descriptionN; + String createdOn; + int serviceID; + int createdBy; + String editedOn; + int editedBy; + int channel; + dynamic clientRequestID; + bool returnedToQueue; + dynamic pickupDateTime; + dynamic pickupLocationName; + dynamic dropoffLocationName; + int realRRTHaveTransactions; + String nearestProjectDescription; + String nearestProjectDescriptionN; + String projectDescription; + String projectDescriptionN; + + PatientAllPresOrders( + {this.iD, + this.patientID, + this.patientOutSA, + this.isOutPatient, + this.projectID, + this.nearestProjectID, + this.longitude, + this.latitude, + this.appointmentNo, + this.dischargeID, + this.lineItemNo, + this.status, + this.description, + this.descriptionN, + this.createdOn, + this.serviceID, + this.createdBy, + this.editedOn, + this.editedBy, + this.channel, + this.clientRequestID, + this.returnedToQueue, + this.pickupDateTime, + this.pickupLocationName, + this.dropoffLocationName, + this.realRRTHaveTransactions, + this.nearestProjectDescription, + this.nearestProjectDescriptionN, + this.projectDescription, + this.projectDescriptionN}); + + PatientAllPresOrders.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']; + lineItemNo = json['LineItemNo']; + status = json['Status']; + description = json['Description']; + descriptionN = json['DescriptionN']; + createdOn = json['CreatedOn']; + serviceID = json['ServiceID']; + createdBy = json['CreatedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; + channel = json['Channel']; + clientRequestID = json['ClientRequestID']; + returnedToQueue = json['ReturnedToQueue']; + pickupDateTime = json['PickupDateTime']; + pickupLocationName = json['PickupLocationName']; + dropoffLocationName = json['DropoffLocationName']; + realRRTHaveTransactions = json['RealRRT_HaveTransactions']; + nearestProjectDescription = json['NearestProjectDescription']; + nearestProjectDescriptionN = json['NearestProjectDescriptionN']; + projectDescription = json['ProjectDescription']; + projectDescriptionN = json['ProjectDescriptionN']; + } + + 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['LineItemNo'] = this.lineItemNo; + data['Status'] = this.status; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['CreatedOn'] = this.createdOn; + data['ServiceID'] = this.serviceID; + data['CreatedBy'] = this.createdBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['Channel'] = this.channel; + data['ClientRequestID'] = this.clientRequestID; + data['ReturnedToQueue'] = this.returnedToQueue; + data['PickupDateTime'] = this.pickupDateTime; + data['PickupLocationName'] = this.pickupLocationName; + data['DropoffLocationName'] = this.dropoffLocationName; + data['RealRRT_HaveTransactions'] = this.realRRTHaveTransactions; + data['NearestProjectDescription'] = this.nearestProjectDescription; + data['NearestProjectDescriptionN'] = this.nearestProjectDescriptionN; + data['ProjectDescription'] = this.projectDescription; + data['ProjectDescriptionN'] = this.projectDescriptionN; + return data; + } +} diff --git a/lib/core/model/er/PatientER.dart b/lib/core/model/er/PatientER.dart new file mode 100644 index 00000000..d0827311 --- /dev/null +++ b/lib/core/model/er/PatientER.dart @@ -0,0 +1,207 @@ +import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; + +import 'get_all_transportation_method_list_model.dart'; + +class PatientER { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + int orderServiceID; + String patientIdentificationID; + int direction; + bool haveAppointment; + int tripType; + int pickupUrgency; + int pickupSpot; + String pickupDateTime; + int transportationMethodId; + int selectedAmbulate; + String requesterNote; + int requesterFileNo; + String requesterMobileNo; + bool requesterIsOutSA; + int isOutPatient; + String pickupLocationName; + String dropoffLocationName; + int projectID; + int createdBy; + int lineItemNo; + int cost; + double vAT; + double totalPrice; + String pickupLocationLattitude; + String pickupLocationLongitude; + String dropoffLocationLattitude; + String dropoffLocationLongitude; + String latitude; + String longitude; + String appointmentNo; + dynamic appointmentClinicName; + dynamic appointmentDoctorName; + dynamic appointmentBranch; + dynamic appointmentTime; + PatientERTransportationMethod patientERTransportationMethod; + Ambulate ambulate; + PatientER( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.orderServiceID = 4, + this.patientIdentificationID, + this.direction, + this.haveAppointment, + this.tripType, + this.pickupUrgency, + this.pickupSpot, + this.pickupDateTime, + this.transportationMethodId, + this.selectedAmbulate, + this.requesterNote, + this.requesterFileNo, + this.requesterMobileNo, + this.requesterIsOutSA, + this.isOutPatient, + this.pickupLocationName, + this.dropoffLocationName, + this.projectID, + this.createdBy, + this.lineItemNo, + this.cost, + this.vAT, + this.totalPrice, + this.pickupLocationLattitude, + this.pickupLocationLongitude, + this.dropoffLocationLattitude, + this.dropoffLocationLongitude, + this.latitude, + this.longitude, + this.appointmentNo, + this.appointmentClinicName, + this.appointmentDoctorName, + this.appointmentBranch, + this.appointmentTime, + this.patientERTransportationMethod, + this.ambulate}); + + PatientER.fromJson(Map json) { + 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']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + orderServiceID = json['OrderServiceID']; + patientIdentificationID = json['PatientIdentificationID']; + direction = json['Direction']; + haveAppointment = json['HaveAppointment']; + tripType = json['TripType']; + pickupUrgency = json['PickupUrgency']; + pickupSpot = json['PickupSpot']; + pickupDateTime = json['PickupDateTime']; + transportationMethodId = json['TransportationMethodId']; + selectedAmbulate = json['SelectedAmbulate']; + requesterNote = json['RequesterNote']; + requesterFileNo = json['RequesterFileNo']; + requesterMobileNo = json['RequesterMobileNo']; + requesterIsOutSA = json['RequesterIsOutSA']; + isOutPatient = json['IsOutPatient']; + pickupLocationName = json['PickupLocationName']; + dropoffLocationName = json['DropoffLocationName']; + projectID = json['ProjectID']; + createdBy = json['CreatedBy']; + lineItemNo = json['LineItemNo']; + cost = json['Cost']; + vAT = json['VAT']; + totalPrice = json['TotalPrice']; + pickupLocationLattitude = json['PickupLocationLattitude']; + pickupLocationLongitude = json['PickupLocationLongitude']; + dropoffLocationLattitude = json['DropoffLocationLattitude']; + dropoffLocationLongitude = json['DropoffLocationLongitude']; + latitude = json['Latitude']; + longitude = json['Longitude']; + appointmentNo = json['AppointmentNo']; + appointmentClinicName = json['AppointmentClinicName']; + appointmentDoctorName = json['AppointmentDoctorName']; + appointmentBranch = json['AppointmentBranch']; + appointmentTime = json['AppointmentTime']; + } + + Map toJson() { + final Map data = new Map(); + 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['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['OrderServiceID'] = this.orderServiceID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['Direction'] = this.direction; + data['HaveAppointment'] = this.haveAppointment; + data['TripType'] = this.tripType; + data['PickupUrgency'] = this.pickupUrgency; + data['PickupSpot'] = this.pickupSpot; + data['PickupDateTime'] = this.pickupDateTime; + data['TransportationMethodId'] = this.transportationMethodId; + data['SelectedAmbulate'] = this.selectedAmbulate; + data['RequesterNote'] = this.requesterNote; + data['RequesterFileNo'] = this.requesterFileNo; + data['RequesterMobileNo'] = this.requesterMobileNo; + data['RequesterIsOutSA'] = this.requesterIsOutSA; + data['IsOutPatient'] = this.isOutPatient; + data['PickupLocationName'] = this.pickupLocationName; + data['DropoffLocationName'] = this.dropoffLocationName; + data['ProjectID'] = this.projectID; + data['CreatedBy'] = this.createdBy; + data['LineItemNo'] = this.lineItemNo; + data['Cost'] = this.cost; + data['VAT'] = this.vAT; + data['TotalPrice'] = this.totalPrice; + data['PickupLocationLattitude'] = this.pickupLocationLattitude; + data['PickupLocationLongitude'] = this.pickupLocationLongitude; + data['DropoffLocationLattitude'] = this.dropoffLocationLattitude; + data['DropoffLocationLongitude'] = this.dropoffLocationLongitude; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentClinicName'] = this.appointmentClinicName; + data['AppointmentDoctorName'] = this.appointmentDoctorName; + data['AppointmentBranch'] = this.appointmentBranch; + data['AppointmentTime'] = this.appointmentTime; + return data; + } +} diff --git a/lib/core/model/er/PickUpRequestPresOrder.dart b/lib/core/model/er/PickUpRequestPresOrder.dart new file mode 100644 index 00000000..9ce3e678 --- /dev/null +++ b/lib/core/model/er/PickUpRequestPresOrder.dart @@ -0,0 +1,204 @@ +class PickUpRequestPresOrder { + int id; + int presOrderID; + String createDate; + String lastEditDate; + int createdBy; + int lastEditBy; + bool isActive; + String requestNo; + int requesterId; + int direction; + bool haveAppointment; + dynamic appointmentId; + int tripType; + int pickupUrgency; + String pickupDateTime; + dynamic pickupLocationId; + int pickupSpot; + dynamic dropoffLocationId; + int transportationMethodId; + int cost; + double vAT; + double totalPrice; + int amountCollected; + int selectedAmbulate; + String requesterNote; + int status; + int paymentStatus; + dynamic rejectReason; + int visibility; + dynamic durationId; + dynamic imageId; + String requesterFileNo; + String requesterMobileNo; + bool requesterIsOutSA; + String pickupLocationLongitude; + String pickupLocationLattitude; + String dropoffLocationLongitude; + String dropoffLocationLattitude; + dynamic appointmentClinicName; + dynamic appointmentDoctorName; + dynamic appointmentBranch; + dynamic appointmentTime; + String pickupLocationName; + String dropoffLocationName; + String title; + String titleAR; + String ambulateDescription; + String ambulateDescriptionN; + + PickUpRequestPresOrder( + {this.id, + this.presOrderID, + this.createDate, + this.lastEditDate, + this.createdBy, + this.lastEditBy, + this.isActive, + this.requestNo, + this.requesterId, + this.direction, + this.haveAppointment, + this.appointmentId, + this.tripType, + this.pickupUrgency, + this.pickupDateTime, + this.pickupLocationId, + this.pickupSpot, + this.dropoffLocationId, + this.transportationMethodId, + this.cost, + this.vAT, + this.totalPrice, + this.amountCollected, + this.selectedAmbulate, + this.requesterNote, + this.status, + this.paymentStatus, + this.rejectReason, + this.visibility, + this.durationId, + this.imageId, + this.requesterFileNo, + this.requesterMobileNo, + this.requesterIsOutSA, + this.pickupLocationLongitude, + this.pickupLocationLattitude, + this.dropoffLocationLongitude, + this.dropoffLocationLattitude, + this.appointmentClinicName, + this.appointmentDoctorName, + this.appointmentBranch, + this.appointmentTime, + this.pickupLocationName, + this.dropoffLocationName, + this.title, + this.titleAR, + this.ambulateDescription, + this.ambulateDescriptionN}); + + PickUpRequestPresOrder.fromJson(Map json) { + id = json['Id']; + presOrderID = json['PresOrderID']; + createDate = json['CreateDate']; + lastEditDate = json['LastEditDate']; + createdBy = json['CreatedBy']; + lastEditBy = json['LastEditBy']; + isActive = json['IsActive']; + requestNo = json['RequestNo']; + requesterId = json['RequesterId']; + direction = json['Direction']; + haveAppointment = json['HaveAppointment']; + appointmentId = json['AppointmentId']; + tripType = json['TripType']; + pickupUrgency = json['PickupUrgency']; + pickupDateTime = json['PickupDateTime']; + pickupLocationId = json['PickupLocationId']; + pickupSpot = json['PickupSpot']; + dropoffLocationId = json['DropoffLocationId']; + transportationMethodId = json['TransportationMethodId']; + cost = json['Cost']; + vAT = json['VAT']; + totalPrice = json['TotalPrice']; + amountCollected = json['AmountCollected']; + selectedAmbulate = json['SelectedAmbulate']; + requesterNote = json['RequesterNote']; + status = json['Status']; + paymentStatus = json['PaymentStatus']; + rejectReason = json['RejectReason']; + visibility = json['Visibility']; + durationId = json['DurationId']; + imageId = json['ImageId']; + requesterFileNo = json['RequesterFileNo']; + requesterMobileNo = json['RequesterMobileNo']; + requesterIsOutSA = json['RequesterIsOutSA']; + pickupLocationLongitude = json['PickupLocationLongitude']; + pickupLocationLattitude = json['PickupLocationLattitude']; + dropoffLocationLongitude = json['DropoffLocationLongitude']; + dropoffLocationLattitude = json['DropoffLocationLattitude']; + appointmentClinicName = json['AppointmentClinicName']; + appointmentDoctorName = json['AppointmentDoctorName']; + appointmentBranch = json['AppointmentBranch']; + appointmentTime = json['AppointmentTime']; + pickupLocationName = json['PickupLocationName']; + dropoffLocationName = json['DropoffLocationName']; + title = json['Title']; + titleAR = json['TitleAR']; + ambulateDescription = json['AmbulateDescription']; + ambulateDescriptionN = json['AmbulateDescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['Id'] = this.id; + data['PresOrderID'] = this.presOrderID; + data['CreateDate'] = this.createDate; + data['LastEditDate'] = this.lastEditDate; + data['CreatedBy'] = this.createdBy; + data['LastEditBy'] = this.lastEditBy; + data['IsActive'] = this.isActive; + data['RequestNo'] = this.requestNo; + data['RequesterId'] = this.requesterId; + data['Direction'] = this.direction; + data['HaveAppointment'] = this.haveAppointment; + data['AppointmentId'] = this.appointmentId; + data['TripType'] = this.tripType; + data['PickupUrgency'] = this.pickupUrgency; + data['PickupDateTime'] = this.pickupDateTime; + data['PickupLocationId'] = this.pickupLocationId; + data['PickupSpot'] = this.pickupSpot; + data['DropoffLocationId'] = this.dropoffLocationId; + data['TransportationMethodId'] = this.transportationMethodId; + data['Cost'] = this.cost; + data['VAT'] = this.vAT; + data['TotalPrice'] = this.totalPrice; + data['AmountCollected'] = this.amountCollected; + data['SelectedAmbulate'] = this.selectedAmbulate; + data['RequesterNote'] = this.requesterNote; + data['Status'] = this.status; + data['PaymentStatus'] = this.paymentStatus; + data['RejectReason'] = this.rejectReason; + data['Visibility'] = this.visibility; + data['DurationId'] = this.durationId; + data['ImageId'] = this.imageId; + data['RequesterFileNo'] = this.requesterFileNo; + data['RequesterMobileNo'] = this.requesterMobileNo; + data['RequesterIsOutSA'] = this.requesterIsOutSA; + data['PickupLocationLongitude'] = this.pickupLocationLongitude; + data['PickupLocationLattitude'] = this.pickupLocationLattitude; + data['DropoffLocationLongitude'] = this.dropoffLocationLongitude; + data['DropoffLocationLattitude'] = this.dropoffLocationLattitude; + data['AppointmentClinicName'] = this.appointmentClinicName; + data['AppointmentDoctorName'] = this.appointmentDoctorName; + data['AppointmentBranch'] = this.appointmentBranch; + data['AppointmentTime'] = this.appointmentTime; + data['PickupLocationName'] = this.pickupLocationName; + data['DropoffLocationName'] = this.dropoffLocationName; + data['Title'] = this.title; + data['TitleAR'] = this.titleAR; + data['AmbulateDescription'] = this.ambulateDescription; + data['AmbulateDescriptionN'] = this.ambulateDescriptionN; + return data; + } +} 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 3402873e..ebc9caf7 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,23 +1,23 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -class PatientER_RRT_GetAllTransportationMethodListModel { - int id; +class PatientERTransportationMethod { + dynamic id; DateTime createDate; DateTime lastEditDate; - int createdBy; - int lastEditBy; + dynamic createdBy; + dynamic lastEditBy; bool isActive; String title; String titleAR; - int price; - Null isDefault; - int visibility; - Null durationId; + dynamic price; + dynamic isDefault; + dynamic visibility; + dynamic durationId; String description; String descriptionAR; - int totalPrice; - int vAT; + dynamic totalPrice; + dynamic vAT; - PatientER_RRT_GetAllTransportationMethodListModel( + PatientERTransportationMethod( { this.id, this.createDate, @@ -36,7 +36,7 @@ class PatientER_RRT_GetAllTransportationMethodListModel { this.totalPrice, this.vAT}); - PatientER_RRT_GetAllTransportationMethodListModel.fromJson( + PatientERTransportationMethod.fromJson( Map json) { id = json['Id']; createDate = DateUtil.convertStringToDate(json['CreateDate']); diff --git a/lib/core/service/AuthenticatedUserObject.dart b/lib/core/service/AuthenticatedUserObject.dart index 1aaa4755..600e17e1 100644 --- a/lib/core/service/AuthenticatedUserObject.dart +++ b/lib/core/service/AuthenticatedUserObject.dart @@ -2,16 +2,17 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -class AuthenticatedUserObject{ +class AuthenticatedUserObject { AuthenticatedUser user; AppSharedPreferences sharedPref = AppSharedPreferences(); bool isLogin = false; - AuthenticatedUserObject(){ + + AuthenticatedUserObject() { getUser(); } getUser() async { - if (user==null) { + if (user == null) { var userData = await sharedPref.getObject(USER_PROFILE); if (userData != null) user = AuthenticatedUser.fromJson(userData); } @@ -20,4 +21,7 @@ class AuthenticatedUserObject{ this.isLogin = isLogin != null; } + logout() async { + isLogin = false; + } } diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index f2820dc1..fdb80604 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -17,6 +17,7 @@ class BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); BaseService() { + authenticatedUserObject.getUser(); user = authenticatedUserObject.user; // getUser(); } diff --git a/lib/core/service/childvaccines/add_new_child_service.dart b/lib/core/service/childvaccines/add_new_child_service.dart new file mode 100644 index 00000000..5e4a4d86 --- /dev/null +++ b/lib/core/service/childvaccines/add_new_child_service.dart @@ -0,0 +1,41 @@ +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/create_new_user_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import '../base_service.dart'; + +class CreteNewBabyService extends BaseService { + List createNewBabyModelList = List(); + List userModelList = List(); + List newUserModelList = List(); + + + + Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { + hasError = false; + await getUser(); + Map body = Map.from(newChild.toJson()); + body['CreatedBy'] = 102; + body['EditedBy'] = 102; + body['UserID'] = userID; + body['AlertBy'] = 2; + body['EmailAddress'] = user.emailAddress; + body['IsLogin'] = true; + body['LogInTokenID'] = await sharedPref.getString(TOKEN); + body['MobileNumber'] = user.mobileNumber; + body['NationalID'] = user.nationalityID; + body['ZipCode'] = user.zipCode; + + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(GET_NEWCHILD_REQUEST, + onSuccess: (dynamic response, int statusCode) { + var asd =""; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/childvaccines/child_vaccines_service.dart b/lib/core/service/childvaccines/child_vaccines_service.dart new file mode 100644 index 00000000..09256f47 --- /dev/null +++ b/lib/core/service/childvaccines/child_vaccines_service.dart @@ -0,0 +1,56 @@ +import 'dart:convert'; + +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 { + List babyInformationModelList = List(); + List userInformationModelList = List(); + int userID = 0; + + Future getAllBabyInformationOrders() async { + Map body = Map(); + hasError = false; + body['isDentalAllowedBackend'] = false; + body['IsLogin'] = true; + body['UserID'] = userID; + await baseAppClient.post(GET_BABY_BY_USER_ID, + onSuccess: (dynamic response, int statusCode) { + babyInformationModelList.clear(); + response['List_BabyInformationModel'].forEach((vital) { + babyInformationModelList.add(List_BabyInformationModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getNewUserOrders() async { + Map body = Map(); + hasError = false; + await getUser(); + body['CreatedBy'] = 102; + body['EditedBy'] = 102; + body['UserID'] = userID; + body['AlertBy'] = 2; + body['EmailAddress'] = user.emailAddress; + body['IsLogin'] = true; + body['LogInTokenID'] = await sharedPref.getString(TOKEN); + body['MobileNumber'] = user.mobileNumber; + body['NationalID'] = user.nationalityID; + body['ZipCode'] = user.zipCode; + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(GET_NEW_USER_REQUEST, + onSuccess: (dynamic response, int statusCode) { + userID = response['UserID']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/childvaccines/delete_baby_service.dart b/lib/core/service/childvaccines/delete_baby_service.dart new file mode 100644 index 00000000..115d13c5 --- /dev/null +++ b/lib/core/service/childvaccines/delete_baby_service.dart @@ -0,0 +1,75 @@ +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/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'; + + + +class DeleteBabyService extends BaseService{ + + List createNewBabyModelList = List(); + List userModelList = List(); + List newUserModelList = List(); + + List deleteBabyModelList= List(); + + + Future getDeleteBabyOrder({DeleteBaby deleteChild,int babyID}) async { + hasError = false; + await getUser(); + Map body = Map.from(deleteChild.toJson()); + // body['CreatedBy'] = 102; + body['EditedBy'] = 102; + //body['BabyID'] = babyID; + //body['BabyID'] = createNewBabyModelList ; + // body['AlertBy'] = 2; + // body['EmailAddress'] = user.emailAddress; + body['IsLogin'] = true; + body['LogInTokenID'] = await sharedPref.getString(TOKEN); + body['MobileNumber'] = user.mobileNumber; + body['NationalID'] = user.nationalityID; + body['ZipCode'] = user.zipCode; + + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(DELETE_CHILD_REQUEST, + onSuccess: (dynamic response, int statusCode) { + var asd =""; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + // Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { + // hasError = false; + // await getUser(); + // Map body = Map.from(newChild.toJson()); + // body['CreatedBy'] = 102; + // body['EditedBy'] = 102; + // body['UserID'] = userID; + // body['AlertBy'] = 2; + // body['EmailAddress'] = user.emailAddress; + // body['IsLogin'] = true; + // body['LogInTokenID'] = await sharedPref.getString(TOKEN); + // body['MobileNumber'] = user.mobileNumber; + // body['NationalID'] = user.nationalityID; + // body['ZipCode'] = user.zipCode; + // + // body['isDentalAllowedBackend'] = false; + // + // await baseAppClient.post(GET_NEWCHILD_REQUEST, + // onSuccess: (dynamic response, int statusCode) { + // var asd =""; + // }, + // onFailure: (String error, int statusCode) { + // hasError = true; + // super.error = error; + // }, body: body); + // } + +} \ No newline at end of file diff --git a/lib/core/service/childvaccines/get_vaccinations_item_services.dart b/lib/core/service/childvaccines/get_vaccinations_item_services.dart new file mode 100644 index 00000000..5ff936af --- /dev/null +++ b/lib/core/service/childvaccines/get_vaccinations_item_services.dart @@ -0,0 +1,27 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/get_vacainations_itemsmodel.dart'; + +import '../base_service.dart'; + +class GetVccinationsItemsService extends BaseService { + List getVaccinationsItemModelList = List(); + Map body = Map(); + + + + Future getaccinationsitemOrders() async { + hasError = false; + await baseAppClient.post(GET_TABLE_REQUEST, + onSuccess: (dynamic response, int statusCode) { + getVaccinationsItemModelList.clear(); + response['List_CreateVaccinationTableModel'].forEach((vital) { + getVaccinationsItemModelList.add( + GET_VACCINATIONS_ITEMSMODEL.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + +} \ No newline at end of file diff --git a/lib/core/service/childvaccines/user_information_service.dart b/lib/core/service/childvaccines/user_information_service.dart new file mode 100644 index 00000000..0628920c --- /dev/null +++ b/lib/core/service/childvaccines/user_information_service.dart @@ -0,0 +1,35 @@ +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 { + List userInformationModelList = List(); + Map body = Map(); + + Future getUserInformationOrders() async { + hasError = false; + await getUser(); + body['CreatedBy'] = 102; + body['EditedBy'] = 102; + body['EmailAddress'] = user.emailAddress; + body['IsLogin'] = true; + body['LogInTokenID'] = await sharedPref.getString(TOKEN); + body['MobileNumber'] = user.mobileNumber; + body['NationalID'] = user.nationalityID; + body['ZipCode'] = user.zipCode; + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(GET_USERINFORMATION_REQUEST, + onSuccess: (dynamic response, int statusCode) { + userInformationModelList.clear(); + + response['List_UserInformationModel_New'].forEach((vital) { + userInformationModelList.add(List_UserInformationModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/childvaccines/vaccination_table_service.dart b/lib/core/service/childvaccines/vaccination_table_service.dart new file mode 100644 index 00000000..7f987b76 --- /dev/null +++ b/lib/core/service/childvaccines/vaccination_table_service.dart @@ -0,0 +1,39 @@ +import 'package:diplomaticquarterapp/config/config.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 '../base_service.dart'; + +class VaccinationTableService extends BaseService { + List createVaccinationTableModelList = List(); + Map body = Map(); + + + + Future getCreateVaccinationTableOrders() async { + hasError = false; + await getUser(); + body['BabyName']="fffffffffff eeeeeeeeeeeeee"; + body['DOB'] = "/Date(1585774800000+0300)/"; + body['EmailAddress'] = user.emailAddress; + body['isDentalAllowedBackend'] = false; + body['SendEmail'] = false; + body['IsLogin'] =true; + + + + + await baseAppClient.post(GET_TABLE_REQUEST, + onSuccess: (dynamic response, int statusCode) { + createVaccinationTableModelList.clear(); + response['List_CreateVaccinationTableModel'].forEach((vital) { + createVaccinationTableModelList.add( + CreateVaccinationTable.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + +} \ No newline at end of file diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 5bb50b0a..f5725e5c 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -15,7 +15,7 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); ///await BaseAppClient.post('', /// onSuccess: (dynamic response, int statusCode) {}, /// onFailure: (String error, int statusCode) {}, -/// body: null); +/// body: Map(); class BaseAppClient { post(String endPoint, @@ -32,7 +32,9 @@ class BaseAppClient { var user = await sharedPref.getObject(USER_PROFILE); if (body.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') - ? body['SetupID'] != null ? body['SetupID'] : SETUP_ID + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID : SETUP_ID; } body['VersionID'] = VERSION_ID; @@ -41,7 +43,9 @@ class BaseAppClient { body['IPAdress'] = IP_ADDRESS; body['generalid'] = GENERAL_ID; body['PatientOutSA'] = body.containsKey('PatientOutSA') - ? body['PatientOutSA'] != null ? body['PatientOutSA'] : PATIENT_OUT_SA + ? body['PatientOutSA'] != null + ? body['PatientOutSA'] + : PATIENT_OUT_SA : PATIENT_OUT_SA; if (body.containsKey('isDentalAllowedBackend')) { @@ -55,30 +59,31 @@ class BaseAppClient { body['DeviceTypeID'] = DeviceTypeID; - if(!body.containsKey('IsPublicRequest')) { + if (!body.containsKey('IsPublicRequest')) { body['PatientType'] = body.containsKey('PatientType') - ? body['PatientType'] != null ? body['PatientType'] : PATIENT_TYPE + ? body['PatientType'] != null + ? body['PatientType'] + : PATIENT_TYPE : PATIENT_TYPE; body['PatientTypeID'] = body.containsKey('PatientTypeID') ? body['PatientTypeID'] != null - ? body['PatientTypeID'] - : PATIENT_TYPE_ID + ? body['PatientTypeID'] + : PATIENT_TYPE_ID : PATIENT_TYPE_ID; if (user != null) { body['TokenID'] = token; body['PatientID'] = - body['PatientID'] != null ? body['PatientID'] : user['PatientID']; + body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; - body['SessionID'] = getSessionId(token); + body['SessionID'] = SESSION_ID;//getSessionId(token); } } print("URL : $url"); print("Body : ${json.encode(body)}"); - var asd=""; if (await Utils.checkConnection()) { final response = await http.post(url.trim(), body: json.encode(body), @@ -169,6 +174,7 @@ class BaseAppClient { } String getSessionId(String id) { - return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); + ///return id.replaceAll(RegExp('/[^\w\s]/'), ''); + // return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); } } diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart index 181ad37b..b654e0eb 100644 --- a/lib/core/service/er/am_service.dart +++ b/lib/core/service/er/am_service.dart @@ -1,25 +1,76 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; +import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import '../base_service.dart'; class AmService extends BaseService { - List AmModelList = List(); - Map body = Map(); + List amModelList = List(); + List patientAllPresOrdersList = List(); + bool hasPendingOrder = false; + int pendingOrderID = 0; + String pendingOrderStatus = ""; + String pendingOrderStatusAR = ""; + PickUpRequestPresOrder pickUpRequestPresOrder; Future getAllTransportationOrders() async { hasError = false; - + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['IdentificationNo'] = user.patientIdentificationNo; await baseAppClient.post(GET_AMBULANCE_REQUEST, onSuccess: (dynamic response, int statusCode) { - AmModelList.clear(); - response['AmModelList'].forEach((vital) { - AmModelList.add( - PatientER_RRT_GetAllTransportationMethodListModel.fromJson(vital)); + amModelList.clear(); + response['PatientER_RRT_GetAllTransportationMethodList'].forEach((item) { + amModelList.add(PatientERTransportationMethod.fromJson(item)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } + + Future getPatientAllPresOrdersList() async { + hasError = false; + hasPendingOrder = false; + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, + onSuccess: (dynamic response, int statusCode) { + patientAllPresOrdersList.clear(); + response['PatientER_GetPatientAllPresOrdersList'].forEach((item) { + if (item['ServiceID'] == OrderService.AMBULANCE.getIdOrderService()) { + var order = PatientAllPresOrders.fromJson(item); + patientAllPresOrdersList.add(order); + if (order.status == 1) { + hasPendingOrder = true; + pendingOrderID = order.iD; + pendingOrderStatus = order.description; + pendingOrderStatusAR = order.descriptionN; + } + } + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } + + Future getOrderDetails() async { + hasError = false; + hasPendingOrder = false; + Map body = Map(); + body['PresOrderID'] = pendingOrderID; + await baseAppClient.post(GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID, + onSuccess: (dynamic response, int statusCode) { + patientAllPresOrdersList.clear(); + response['PatientER_RRT_GetPickUpRequestByPresOrderIDList'] + .forEach((item) { + pickUpRequestPresOrder = PickUpRequestPresOrder.fromJson(item); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } } diff --git a/lib/core/service/medical/medical_service.dart b/lib/core/service/medical/medical_service.dart index 90230f6d..f90280cf 100644 --- a/lib/core/service/medical/medical_service.dart +++ b/lib/core/service/medical/medical_service.dart @@ -1,13 +1,20 @@ import 'package:diplomaticquarterapp/config/config.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'; class MedicalService extends BaseService { List appoitmentAllHistoryResultList = List(); - getAppointmentHistory() async { + getAppointmentHistory({bool isActiveAppointment = false}) async { hasError = false; super.error = ""; + Map body = Map(); + if(isActiveAppointment) { + body['IsActiveAppointment'] = true; + body['isDentalAllowedBackend'] = false; + } await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async { @@ -19,6 +26,23 @@ class MedicalService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: Map()); + }, body: body); + } + + addAmbulanceRequest({@required PatientER patientER}) async { + hasError = false; + super.error = ""; + Map body = Map(); + 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) { + hasError = true; + super.error = error; + }, body: body); } } diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index 7e16d22d..18ab02e3 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -18,6 +18,7 @@ class BaseViewModel extends ChangeNotifier { AuthenticatedUser user; AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUserObject authenticatedUserObject = locator(); void setState(ViewState viewState) { _state = viewState; 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 new file mode 100644 index 00000000..eebaca02 --- /dev/null +++ b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart @@ -0,0 +1,42 @@ +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'; + + +class AddNewChildViewModel extends BaseViewModel { + + CreteNewBabyService _creteNewBabyService = locator(); + ChildVaccinesService _childVaccinesService = locator(); + // DeleteBabyService _deleteBabyService = locator(); + bool isAdded = false; + ///create new baby + createNewBabyOrders({ CreateNewBaby newChild}) async { + setState(ViewState.Busy); + await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID); + if (_creteNewBabyService.hasError) { + error = _creteNewBabyService.error; + setState(ViewState.Error); + } else { + isAdded = true; + setState(ViewState.Idle); + await _childVaccinesService.getAllBabyInformationOrders(); + if (_childVaccinesService.hasError) { + error = _childVaccinesService.error; + setState(ViewState.Error); + } else{ + + } + } + } + + + + + +} diff --git a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart new file mode 100644 index 00000000..7c4af285 --- /dev/null +++ b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart @@ -0,0 +1,73 @@ +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'; +import 'package:diplomaticquarterapp/core/service/childvaccines/delete_baby_service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class ChildVaccinesViewModel extends BaseViewModel{ + ChildVaccinesService _childVaccinesService = locator(); + + List get babyInformationModelList=> _childVaccinesService.babyInformationModelList; + + +//=========== + CreteNewBabyService _creteNewBabyService = locator(); + + DeleteBabyService _deleteBabyService = locator(); + bool isAdded = false; + bool isDeleted = false; + //============ + + + getNewUserOrders() async { + setState(ViewState.Busy); + await _childVaccinesService.getNewUserOrders(); + if (_childVaccinesService.hasError) { + error = _childVaccinesService.error; + setState(ViewState.Error); + } else + getBabyInformatioRequestOrders(); + } + + getBabyInformatioRequestOrders() async { + await _childVaccinesService.getAllBabyInformationOrders(); + if (_childVaccinesService.hasError) { + error = _childVaccinesService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + + + ///delete baby + deleteBabyOrders({ DeleteBaby newChild}) async { + setState(ViewState.Busy); + //await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID); + await _deleteBabyService.getDeleteBabyOrder(deleteChild: newChild,babyID: newChild.babyID); + //getDeleteBabyOrder(deleteChild: newChild,); + // getDeleteBabyOrder + if (_creteNewBabyService.hasError) { + error = _creteNewBabyService.error; + setState(ViewState.Error); + } else { + isDeleted = true; + setState(ViewState.Idle); + await _childVaccinesService.getAllBabyInformationOrders(); + if (_childVaccinesService.hasError) { + error = _childVaccinesService.error; + setState(ViewState.Error); + } else{ + + } + } + } + +} \ No newline at end of file diff --git a/lib/core/viewModels/child_vaccines/user_information_view_model.dart b/lib/core/viewModels/child_vaccines/user_information_view_model.dart new file mode 100644 index 00000000..43269f42 --- /dev/null +++ b/lib/core/viewModels/child_vaccines/user_information_view_model.dart @@ -0,0 +1,23 @@ +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 = + locator(); + + List get userInformationModelList => + _userInformationService.userInformationModelList; + + getUserInformationRequestOrders() async { + setState(ViewState.Busy); + await _userInformationService.getUserInformationOrders(); + if (_userInformationService.hasError) { + error = _userInformationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart new file mode 100644 index 00000000..3b72dd50 --- /dev/null +++ b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart @@ -0,0 +1,30 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.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'; +import '../base_view_model.dart'; + + +class VaccinationTableViewModel extends BaseViewModel{ + + VaccinationTableService _creteVaccinationTableService = locator(); + + // String get creteVaccinationTableContent => _creteVaccinationTableService.userAgreementContent; + //String get userAgreementContent => _creteNewBabyService.v//_reportsService.userAgreementContent; + List get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;//.createNewBabyModelList; + getCreateVaccinationTable() async { + setState(ViewState.Busy); + + await _creteVaccinationTableService.getCreateVaccinationTableOrders();//getCreateNewBabyOrders(); + + if ( _creteVaccinationTableService.hasError) { + error = _creteVaccinationTableService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + +} diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index db1acbf0..fbd3d95d 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -1,32 +1,82 @@ - import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/service/er/am_service.dart'; +import 'package:diplomaticquarterapp/core/service/hospital_service.dart'; +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 '../base_view_model.dart'; import '../../../locator.dart'; -class AmRequestViewModel extends BaseViewModel{ +class AmRequestViewModel extends BaseViewModel { + AmService _amService = locator(); + HospitalService _hospitalService = locator(); + MedicalService _medicalService = locator(); + List get amRequestModeList => + _amService.amModelList; - AmService _amService = locator(); + List get patientAllPresOrdersList => + _amService.patientAllPresOrdersList; - List get AmRequestModeList=> - _amService.AmModelList; + List get appoitmentAllHistoryResultList => + _medicalService.appoitmentAllHistoryResultList; - getAmRequestOrders({int id, int projectID}) async { - setState(ViewState.Busy); + List get hospitals => _hospitalService.hospitals; + bool get hasPendingOrder =>_amService.hasPendingOrder; - await _amService.getAllTransportationOrders(); + Future getAppointmentHistory() async { + setState(ViewState.BusyLocal); + await _medicalService.getAppointmentHistory(isActiveAppointment: true); + if (_medicalService.hasError) { + error = _medicalService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } - if ( _amService.hasError) { - error = _amService.error; + Future getAmRequestOrders() async { + setState(ViewState.Busy); + await _amService.getAllTransportationOrders(); + if (_amService.hasError) { + error = _amService.error; setState(ViewState.Error); } else - setState(ViewState.Idle); + getHospitals(); } + Future getHospitals() async { + setState(ViewState.Busy); + await _hospitalService.getHospitals(); + if (_hospitalService.hasError) { + error = _hospitalService.error; + setState(ViewState.Error); + } else + getPatientAllPresOrdersList(); + } + Future getPatientAllPresOrdersList() async { + setState(ViewState.Busy); + await _amService.getPatientAllPresOrdersList(); + if (_hospitalService.hasError) { + error = _hospitalService.error; + setState(ViewState.Error); + } else if (_amService.hasPendingOrder) { + getOrderDetails(); + } else + setState(ViewState.Idle); + } -} \ No newline at end of file + Future getOrderDetails() async { + setState(ViewState.Busy); + await _amService.getOrderDetails(); + if (_hospitalService.hasError) { + error = _hospitalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 032aeb1e..8cbf0efc 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -21,52 +21,54 @@ class LabsViewModel extends BaseViewModel { : _patientLabOrdersListHospital; void getLabs() async { - setState(ViewState.Busy); - await _labsService.getPatientLabOrdersList(); - if (_labsService.hasError) { - error = _labsService.error; - setState(ViewState.Error); - } else { - _labsService.patientLabOrdersList.forEach((element) { - List patientLabOrdersClinic = - _patientLabOrdersListClinic - .where((elementClinic) => - elementClinic.filterName == element.clinicDescription) - .toList(); + if (authenticatedUserObject.isLogin) { + setState(ViewState.Busy); + await _labsService.getPatientLabOrdersList(); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + _labsService.patientLabOrdersList.forEach((element) { + List patientLabOrdersClinic = + _patientLabOrdersListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicDescription) + .toList(); - if (patientLabOrdersClinic.length != 0) { - _patientLabOrdersListClinic[_patientLabOrdersListClinic - .indexOf(patientLabOrdersClinic[0])] - .patientLabOrdersList - .add(element); - } else { - _patientLabOrdersListClinic.add(PatientLabOrdersList( - filterName: element.clinicDescription, - patientDoctorAppointment: element)); - } + if (patientLabOrdersClinic.length != 0) { + _patientLabOrdersListClinic[_patientLabOrdersListClinic + .indexOf(patientLabOrdersClinic[0])] + .patientLabOrdersList + .add(element); + } else { + _patientLabOrdersListClinic.add(PatientLabOrdersList( + filterName: element.clinicDescription, + patientDoctorAppointment: element)); + } - // doctor list sort via project - List patientLabOrdersHospital = - _patientLabOrdersListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + // doctor list sort via project + List patientLabOrdersHospital = + _patientLabOrdersListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); - if (patientLabOrdersHospital.length != 0) { - _patientLabOrdersListHospital[_patientLabOrdersListHospital - .indexOf(patientLabOrdersHospital[0])] - .patientLabOrdersList - .add(element); - } else { - _patientLabOrdersListHospital.add(PatientLabOrdersList( - filterName: element.projectName, - patientDoctorAppointment: element)); - } - }); + if (patientLabOrdersHospital.length != 0) { + _patientLabOrdersListHospital[_patientLabOrdersListHospital + .indexOf(patientLabOrdersHospital[0])] + .patientLabOrdersList + .add(element); + } else { + _patientLabOrdersListHospital.add(PatientLabOrdersList( + filterName: element.projectName, + patientDoctorAppointment: element)); + } + }); - setState(ViewState.Idle); + setState(ViewState.Idle); + } } } diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart index fa330aad..f8b14c6e 100644 --- a/lib/core/viewModels/medical/medical_view_model.dart +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -1,4 +1,5 @@ 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'; @@ -11,13 +12,15 @@ class MedicalViewModel extends BaseViewModel { _medicalService.appoitmentAllHistoryResultList; getAppointmentHistory() async { - setState(ViewState.Busy); - if (_medicalService.appoitmentAllHistoryResultList.length == 0) - await _medicalService.getAppointmentHistory(); - if (_medicalService.hasError) { - error = _medicalService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); + if (authenticatedUserObject.isLogin) { + setState(ViewState.Busy); + if (_medicalService.appoitmentAllHistoryResultList.length == 0) + await _medicalService.getAppointmentHistory(); + if (_medicalService.hasError) { + error = _medicalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } } diff --git a/lib/locator.dart b/lib/locator.dart index 8a7022c6..e6140ce1 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_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/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:get_it/get_it.dart'; @@ -10,6 +11,11 @@ import 'core/service/AuthenticatedUserObject.dart'; import 'core/service/appointment_rate_service.dart'; import 'core/service/blood/blood_details_servies.dart'; import 'core/service/blood/blood_donation_service.dart'; +import 'core/service/childvaccines/add_new_child_service.dart'; +import 'core/service/childvaccines/child_vaccines_service.dart'; +import 'core/service/childvaccines/delete_baby_service.dart'; +import 'core/service/childvaccines/user_information_service.dart'; +import 'core/service/childvaccines/vaccination_table_service.dart'; import 'core/service/contactus/finadus_service.dart'; import 'core/service/contactus/livechat_service.dart'; import 'core/service/dashboard_service.dart'; @@ -37,6 +43,9 @@ import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; import 'core/viewModels/blooddonation/blood_details_view_model.dart'; import 'core/viewModels/blooddonation/booddonation_view_model.dart'; +import 'core/viewModels/child_vaccines/add_new_child_view_model.dart'; +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/am_request_view_model.dart'; @@ -112,6 +121,15 @@ void setupLocator() { locator.registerLazySingleton(() => BloodDonationService()); locator.registerLazySingleton(() => BloodDetailsService()); + locator.registerLazySingleton(() => ChildVaccinesService()); + locator.registerLazySingleton(() => UserInformationService()); + locator.registerLazySingleton(() => CreteNewBabyService()); + locator.registerLazySingleton(() => DeleteBabyService()); + + + + locator.registerLazySingleton(() => VaccinationTableService()); + /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -139,6 +157,13 @@ void setupLocator() { locator.registerFactory(() => LiveChatViewModel()); locator.registerFactory(() => BloodDonationViewModel()); locator.registerFactory(() => BloodDeatailsViewModel()); + locator.registerFactory(() => ChildVaccinesViewModel()); + locator.registerFactory(() => UserInformationViewModel()); + locator.registerFactory(() => VaccinationTableViewModel()); + + + + locator.registerFactory(() => AddNewChildViewModel()); locator.registerFactory(() => H2OViewModel()); locator.registerFactory(() => BloodSugarViewMode()); diff --git a/lib/main.dart b/lib/main.dart index ec42e7a3..d8e3307d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -66,7 +66,8 @@ class MyApp extends StatelessWidget { hintColor: Colors.grey[400], disabledColor: Colors.grey[300], errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor:Hexcolor('#E9E9E9'),// Colors.grey[100], + scaffoldBackgroundColor: + HexColor('#E9E9E9'), // Colors.grey[100], textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, @@ -74,9 +75,8 @@ class MyApp extends StatelessWidget { highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Colors.grey, - bottomSheetTheme:BottomSheetThemeData( - backgroundColor: Hexcolor('#E0E0E0') - ) , + bottomSheetTheme: BottomSheetThemeData( + backgroundColor: HexColor('#E0E0E0')), cursorColor: Colors.grey, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( diff --git a/lib/models/Appointments/AppoimentAllHistoryResultList.dart b/lib/models/Appointments/AppoimentAllHistoryResultList.dart index 9ba1fb8e..20eace25 100644 --- a/lib/models/Appointments/AppoimentAllHistoryResultList.dart +++ b/lib/models/Appointments/AppoimentAllHistoryResultList.dart @@ -64,73 +64,75 @@ class AppoitmentAllHistoryResultList { String qR; int remaniningHoursTocanPay; bool sMSButtonVisable; + int serviceID; AppoitmentAllHistoryResultList( {this.setupID, - this.projectID, - this.appointmentNo, - this.appointmentDate, - this.appointmentDateN, - this.appointmentType, - this.bookDate, - this.patientType, - this.patientID, - this.clinicID, - this.doctorID, - this.endDate, - this.startTime, - this.endTime, - this.status, - this.visitType, - 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.projectID, + this.appointmentNo, + this.appointmentDate, + this.appointmentDateN, + this.appointmentType, + this.bookDate, + this.patientType, + this.patientID, + this.clinicID, + this.doctorID, + this.endDate, + this.startTime, + this.endTime, + this.status, + this.visitType, + 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.serviceID}); AppoitmentAllHistoryResultList.fromJson(Map json) { setupID = json['SetupID']; @@ -173,7 +175,9 @@ class AppoitmentAllHistoryResultList { doctorImageURL = json['DoctorImageURL']; doctorNameObj = json['DoctorNameObj']; doctorRate = json['DoctorRate']; - doctorSpeciality = json['DoctorSpeciality'] != null ?json['DoctorSpeciality'].cast() : ["null"]; + doctorSpeciality = json['DoctorSpeciality'] != null + ? json['DoctorSpeciality'].cast() + : ["null"]; doctorTitle = json['DoctorTitle']; gender = json['Gender']; genderDescription = json['GenderDescription']; @@ -188,7 +192,7 @@ class AppoitmentAllHistoryResultList { isOnlineCheckedIN = json['IsOnlineCheckedIN']; latitude = json['Latitude']; listHISGetContactLensPerscription = - json['List_HIS_GetContactLensPerscription']; + json['List_HIS_GetContactLensPerscription']; listHISGetGlassPerscription = json['List_HIS_GetGlassPerscription']; longitude = json['Longitude']; nextAction = json['NextAction']; @@ -199,6 +203,7 @@ class AppoitmentAllHistoryResultList { qR = json['QR']; remaniningHoursTocanPay = json['RemaniningHoursTocanPay']; sMSButtonVisable = json['SMSButtonVisable']; + serviceID = json['ServiceID']; } Map toJson() { @@ -269,6 +274,7 @@ class AppoitmentAllHistoryResultList { data['QR'] = this.qR; data['RemaniningHoursTocanPay'] = this.remaniningHoursTocanPay; data['SMSButtonVisable'] = this.sMSButtonVisable; + data['ServiceID'] = this.serviceID; return data; } } @@ -278,7 +284,8 @@ class PatientAppointmentList { List patientDoctorAppointmentList = List(); PatientAppointmentList( - {this.filterName, AppoitmentAllHistoryResultList patientDoctorAppointment}) { + {this.filterName, + AppoitmentAllHistoryResultList patientDoctorAppointment}) { patientDoctorAppointmentList.add(patientDoctorAppointment); } } diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 65d28910..4c7241c8 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -174,7 +174,9 @@ class PatientDoctorAppointmentList { List patientDoctorAppointmentList = List(); PatientDoctorAppointmentList( - {this.filterName, this.distanceInKMs, DoctorList patientDoctorAppointment}) { + {this.filterName, + this.distanceInKMs, + DoctorList patientDoctorAppointment}) { patientDoctorAppointmentList.add(patientDoctorAppointment); } } diff --git a/lib/models/Appointments/InsertAppointmentRequest.dart b/lib/models/Appointments/InsertAppointmentRequest.dart index badbb6a7..383e2eb5 100644 --- a/lib/models/Appointments/InsertAppointmentRequest.dart +++ b/lib/models/Appointments/InsertAppointmentRequest.dart @@ -13,7 +13,6 @@ class InsertAppointmentRequest extends Request { bool IsVirtual; List GeneralProcedureList; String DeviceToken; - String DeviceType; bool IsForLiveCare; String OriginalClinicID; String OriginalProjectID; diff --git a/lib/models/Appointments/PatientShareResposne.dart b/lib/models/Appointments/PatientShareResposne.dart index e4a05e04..40670990 100644 --- a/lib/models/Appointments/PatientShareResposne.dart +++ b/lib/models/Appointments/PatientShareResposne.dart @@ -1,104 +1,108 @@ class PatientShareResponse { int advanceNumber; - String appointmentDate; + dynamic appointmentDate; int appointmentNo; int cashPrice; int cashPriceTax; int cashPriceWithTax; int clinicID; - String clinicName; + dynamic clinicName; int companyId; - String companyName; + dynamic companyName; int companyShareWithTax; - String doctorImageURL; - String doctorNameObj; - List doctorSpeciality; - Null errCode; + dynamic doctorImageURL; + dynamic doctorNameObj; + int doctorID; + List doctorSpeciality; + dynamic errCode; int groupID; bool iSAllowOnlineCheckedIN; - Null insurancePolicyNo; + dynamic insurancePolicyNo; bool isExcludedForOnlineCheckin; int isFollowup; bool isLiveCareAppointment; bool isOnlineCheckedIN; - String message; + dynamic message; int nextAction; - Null patientCardID; + dynamic patientCardID; int patientID; dynamic patientShare; dynamic patientShareWithTax; int patientStatusType; dynamic patientTaxAmount; - String patientType; + dynamic patientType; int paymentAmount; - String paymentDate; - Null paymentMethodName; - Null paymentReferenceNumber; + dynamic paymentDate; + dynamic paymentMethodName; + dynamic paymentReferenceNumber; int policyId; - String policyName; - String procedureName; + dynamic policyName; + dynamic procedureName; int projectID; - String projectName; - Null setupID; + dynamic projectName; + dynamic setupID; int sourceType; - String startTime; + dynamic startTime; int status; int statusCode; - Null statusDesc; - Null subPolicyNo; + dynamic statusDesc; + dynamic subPolicyNo; int userID; + int serviceID; PatientShareResponse( {this.advanceNumber, - this.appointmentDate, - this.appointmentNo, - this.cashPrice, - this.cashPriceTax, - this.cashPriceWithTax, - this.clinicID, - this.clinicName, - this.companyId, - this.companyName, - this.companyShareWithTax, - this.doctorImageURL, - this.doctorNameObj, - this.doctorSpeciality, - this.errCode, - this.groupID, - this.iSAllowOnlineCheckedIN, - this.insurancePolicyNo, - this.isExcludedForOnlineCheckin, - this.isFollowup, - this.isLiveCareAppointment, - this.isOnlineCheckedIN, - this.message, - this.nextAction, - this.patientCardID, - this.patientID, - this.patientShare, - this.patientShareWithTax, - this.patientStatusType, - this.patientTaxAmount, - this.patientType, - this.paymentAmount, - this.paymentDate, - this.paymentMethodName, - this.paymentReferenceNumber, - this.policyId, - this.policyName, - this.procedureName, - this.projectID, - this.projectName, - this.setupID, - this.sourceType, - this.startTime, - this.status, - this.statusCode, - this.statusDesc, - this.subPolicyNo, - this.userID}); + this.appointmentDate, + this.appointmentNo, + this.cashPrice, + this.cashPriceTax, + this.cashPriceWithTax, + this.clinicID, + this.clinicName, + this.companyId, + this.companyName, + this.companyShareWithTax, + this.doctorID, + this.doctorImageURL, + this.doctorNameObj, + this.doctorSpeciality, + this.errCode, + this.groupID, + this.iSAllowOnlineCheckedIN, + this.insurancePolicyNo, + this.isExcludedForOnlineCheckin, + this.isFollowup, + this.isLiveCareAppointment, + this.isOnlineCheckedIN, + this.message, + this.nextAction, + this.patientCardID, + this.patientID, + this.patientShare, + this.patientShareWithTax, + this.patientStatusType, + this.patientTaxAmount, + this.patientType, + this.paymentAmount, + this.paymentDate, + this.paymentMethodName, + this.paymentReferenceNumber, + this.policyId, + this.policyName, + this.procedureName, + this.projectID, + this.projectName, + this.setupID, + this.sourceType, + this.startTime, + this.status, + this.statusCode, + this.statusDesc, + this.subPolicyNo, + this.userID, + this.serviceID}); - PatientShareResponse.fromJson(Map json) { + PatientShareResponse.fromJson(Map json) { advanceNumber = json['AdvanceNumber']; appointmentDate = json['AppointmentDate']; appointmentNo = json['AppointmentNo']; @@ -110,9 +114,10 @@ class PatientShareResponse { companyId = json['CompanyId']; companyName = json['CompanyName']; companyShareWithTax = json['CompanyShareWithTax']; + doctorID = json['DoctorID']; doctorImageURL = json['DoctorImageURL']; doctorNameObj = json['DoctorNameObj']; - doctorSpeciality = json['DoctorSpeciality'].cast(); +// doctorSpeciality = json['DoctorSpeciality'].cast(); errCode = json['ErrCode']; groupID = json['GroupID']; iSAllowOnlineCheckedIN = json['ISAllowOnlineCheckedIN']; @@ -147,10 +152,11 @@ class PatientShareResponse { statusDesc = json['StatusDesc']; subPolicyNo = json['SubPolicyNo']; userID = json['UserID']; + serviceID = json['ServiceID']; } - Map toJson() { - final Map data = new Map(); + Map toJson() { + final Map data = new Map(); data['AdvanceNumber'] = this.advanceNumber; data['AppointmentDate'] = this.appointmentDate; data['AppointmentNo'] = this.appointmentNo; @@ -162,6 +168,7 @@ class PatientShareResponse { data['CompanyId'] = this.companyId; data['CompanyName'] = this.companyName; data['CompanyShareWithTax'] = this.companyShareWithTax; + data['DoctorID'] = this.doctorID; data['DoctorImageURL'] = this.doctorImageURL; data['DoctorNameObj'] = this.doctorNameObj; data['DoctorSpeciality'] = this.doctorSpeciality; @@ -199,6 +206,7 @@ class PatientShareResponse { data['StatusDesc'] = this.statusDesc; data['SubPolicyNo'] = this.subPolicyNo; data['UserID'] = this.userID; + data['ServiceID'] = this.serviceID; return data; } } diff --git a/lib/models/CovidDriveThru/CovidPaymentInfoResponse.dart b/lib/models/CovidDriveThru/CovidPaymentInfoResponse.dart new file mode 100644 index 00000000..a1290e4d --- /dev/null +++ b/lib/models/CovidDriveThru/CovidPaymentInfoResponse.dart @@ -0,0 +1,96 @@ +class CovidPaymentInfoResponse { + dynamic propertyChanged; + dynamic cashPriceField; + dynamic cashPriceTaxField; + dynamic cashPriceWithTaxField; + dynamic companyIdField; + String companyNameField; + dynamic companyShareWithTaxField; + dynamic errCodeField; + dynamic groupIDField; + dynamic insurancePolicyNoField; + String messageField; + dynamic patientCardIDField; + dynamic patientShareField; + dynamic patientShareWithTaxField; + dynamic patientTaxAmountField; + dynamic policyIdField; + dynamic policyNameField; + String procedureNameField; + dynamic setupIDField; + dynamic statusCodeField; + dynamic subPolicyNoField; + + CovidPaymentInfoResponse( + {this.propertyChanged, + this.cashPriceField, + this.cashPriceTaxField, + this.cashPriceWithTaxField, + this.companyIdField, + this.companyNameField, + this.companyShareWithTaxField, + this.errCodeField, + this.groupIDField, + this.insurancePolicyNoField, + this.messageField, + this.patientCardIDField, + this.patientShareField, + this.patientShareWithTaxField, + this.patientTaxAmountField, + this.policyIdField, + this.policyNameField, + this.procedureNameField, + this.setupIDField, + this.statusCodeField, + this.subPolicyNoField}); + + CovidPaymentInfoResponse.fromJson(Map json) { + propertyChanged = json['PropertyChanged']; + cashPriceField = json['cashPriceField']; + cashPriceTaxField = json['cashPriceTaxField']; + cashPriceWithTaxField = json['cashPriceWithTaxField']; + companyIdField = json['companyIdField']; + companyNameField = json['companyNameField']; + companyShareWithTaxField = json['companyShareWithTaxField']; + errCodeField = json['errCodeField']; + groupIDField = json['groupIDField']; + insurancePolicyNoField = json['insurancePolicyNoField']; + messageField = json['messageField']; + patientCardIDField = json['patientCardIDField']; + patientShareField = json['patientShareField']; + patientShareWithTaxField = json['patientShareWithTaxField']; + patientTaxAmountField = json['patientTaxAmountField']; + policyIdField = json['policyIdField']; + policyNameField = json['policyNameField']; + procedureNameField = json['procedureNameField']; + setupIDField = json['setupIDField']; + statusCodeField = json['statusCodeField']; + subPolicyNoField = json['subPolicyNoField']; + } + + Map toJson() { + final Map data = new Map(); + data['PropertyChanged'] = this.propertyChanged; + data['cashPriceField'] = this.cashPriceField; + data['cashPriceTaxField'] = this.cashPriceTaxField; + data['cashPriceWithTaxField'] = this.cashPriceWithTaxField; + data['companyIdField'] = this.companyIdField; + data['companyNameField'] = this.companyNameField; + data['companyShareWithTaxField'] = this.companyShareWithTaxField; + data['errCodeField'] = this.errCodeField; + data['groupIDField'] = this.groupIDField; + data['insurancePolicyNoField'] = this.insurancePolicyNoField; + data['messageField'] = this.messageField; + data['patientCardIDField'] = this.patientCardIDField; + data['patientShareField'] = this.patientShareField; + data['patientShareWithTaxField'] = this.patientShareWithTaxField; + data['patientTaxAmountField'] = this.patientTaxAmountField; + data['policyIdField'] = this.policyIdField; + data['policyNameField'] = this.policyNameField; + data['procedureNameField'] = this.procedureNameField; + data['setupIDField'] = this.setupIDField; + data['statusCodeField'] = this.statusCodeField; + data['subPolicyNoField'] = this.subPolicyNoField; + return data; + } +} diff --git a/lib/models/CovidDriveThru/DriveThroughTestingCenterModel.dart b/lib/models/CovidDriveThru/DriveThroughTestingCenterModel.dart new file mode 100644 index 00000000..c85a06b3 --- /dev/null +++ b/lib/models/CovidDriveThru/DriveThroughTestingCenterModel.dart @@ -0,0 +1,68 @@ +class DriveThroughTestingCenterModel { + int rowID; + int iD; + int projectID; + String setupID; + double longitude; + double latitude; + int numberOfTracks; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedON; + dynamic projectName; + dynamic projectNameN; + + DriveThroughTestingCenterModel( + {this.rowID, + this.iD, + this.projectID, + this.setupID, + this.longitude, + this.latitude, + this.numberOfTracks, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedON, + this.projectName, + this.projectNameN}); + + DriveThroughTestingCenterModel.fromJson(Map json) { + rowID = json['RowID']; + iD = json['ID']; + projectID = json['ProjectID']; + setupID = json['SetupID']; + longitude = json['Longitude']; + latitude = json['Latitude']; + numberOfTracks = json['NumberOfTracks']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedON = json['EditedON']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['ID'] = this.iD; + data['ProjectID'] = this.projectID; + data['SetupID'] = this.setupID; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['NumberOfTracks'] = this.numberOfTracks; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedON'] = this.editedON; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; + return data; + } +} diff --git a/lib/models/LiveCare/LiveCareScheduleClinicsListResponse.dart b/lib/models/LiveCare/LiveCareScheduleClinicsListResponse.dart new file mode 100644 index 00000000..8951370c --- /dev/null +++ b/lib/models/LiveCare/LiveCareScheduleClinicsListResponse.dart @@ -0,0 +1,64 @@ +class LiveCareScheduleClinicsListResponse { + List clinicsHaveScheduleList; + + LiveCareScheduleClinicsListResponse({this.clinicsHaveScheduleList}); + + LiveCareScheduleClinicsListResponse.fromJson(Map json) { + if (json['ClinicsHaveScheduleList'] != null) { + clinicsHaveScheduleList = new List(); + json['ClinicsHaveScheduleList'].forEach((v) { + clinicsHaveScheduleList.add(new ClinicsHaveScheduleList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.clinicsHaveScheduleList != null) { + data['ClinicsHaveScheduleList'] = + this.clinicsHaveScheduleList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ClinicsHaveScheduleList { + int clinicID; + int serviceID; + int projectID; + String clinicDesc; + String clinicDescN; + String projectDesc; + String projectDescN; + + ClinicsHaveScheduleList( + {this.clinicID, + this.serviceID, + this.projectID, + this.clinicDesc, + this.clinicDescN, + this.projectDesc, + this.projectDescN}); + + ClinicsHaveScheduleList.fromJson(Map json) { + clinicID = json['ClinicID']; + serviceID = json['ServiceID']; + projectID = json['ProjectID']; + clinicDesc = json['ClinicDesc']; + clinicDescN = json['ClinicDescN']; + projectDesc = json['ProjectDesc']; + projectDescN = json['ProjectDescN']; + } + + Map toJson() { + final Map data = new Map(); + data['ClinicID'] = this.clinicID; + data['ServiceID'] = this.serviceID; + data['ProjectID'] = this.projectID; + data['ClinicDesc'] = this.clinicDesc; + data['ClinicDescN'] = this.clinicDescN; + data['ProjectDesc'] = this.projectDesc; + data['ProjectDescN'] = this.projectDescN; + return data; + } +} diff --git a/lib/models/LiveCare/insertVIDARequest.dart b/lib/models/LiveCare/insertVIDARequest.dart new file mode 100644 index 00000000..938ca102 --- /dev/null +++ b/lib/models/LiveCare/insertVIDARequest.dart @@ -0,0 +1,92 @@ +class insertVIDARequest { + int patientID; + int acceptedBy; + int appointmentNo; + String deviceToken; + double latitude; + double longitude; + int serviceID; + int projectID; + int clinicID; + String deviceType; + String voipToken; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + insertVIDARequest( + {this.patientID, + this.acceptedBy, + this.appointmentNo, + this.deviceToken, + this.latitude, + this.longitude, + this.serviceID, + this.projectID, + this.clinicID, + this.deviceType, + this.voipToken, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + insertVIDARequest.fromJson(Map json) { + patientID = json['PatientID']; + acceptedBy = json['AcceptedBy']; + appointmentNo = json['AppointmentNo']; + deviceToken = json['DeviceToken']; + latitude = json['Latitude']; + longitude = json['Longitude']; + serviceID = json['ServiceID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + deviceType = json['DeviceType']; + voipToken = json['VoipToken']; + 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']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['AcceptedBy'] = this.acceptedBy; + data['AppointmentNo'] = this.appointmentNo; + data['DeviceToken'] = this.deviceToken; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['ServiceID'] = this.serviceID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DeviceType'] = this.deviceType; + data['VoipToken'] = this.voipToken; + 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; + return data; + } +} diff --git a/lib/models/Request.dart b/lib/models/Request.dart index 03aa7760..a4cef77b 100644 --- a/lib/models/Request.dart +++ b/lib/models/Request.dart @@ -5,6 +5,7 @@ class Request { var ProjectID; var LanguageID; var DeviceTypeID; + var DeviceType; var AppointmentNo; var IPAdress; var VersionID; diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart index 00148889..ef0be383 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart @@ -17,66 +17,63 @@ import 'e_referral_page.dart'; class EReferralIndexPage extends StatelessWidget { @override Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle: "Service Information", - body: SingleChildScrollView( + return AppScaffold( + isShowAppBar: true, + appBarTitle: "Service Information", + body: SingleChildScrollView( padding: EdgeInsets.all(12), - child: - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "E-Referral: ", - fontWeight: FontWeight.normal, - fontSize: 25, - color: Hexcolor("#60686b"), - ), - SizedBox( - height: 12, - ), - Texts( - "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)", - fontWeight: FontWeight.normal, - fontSize: 17, - ), - SizedBox( - height: 22, - ), - Center( - child: SizedBox( - height: MediaQuery.of(context).size.height * 0.55, - width: MediaQuery.of(context).size.width * 0.50, - child: CarouselSlider( - imagesUrlList: [ - "https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/0.png", - "https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/1.png" - ], - ), - ), - ), - SizedBox( - height: 77, - ), - ], - ) - - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: ()=> Navigator.push(context, FadePage(page: EReferralPage())), - label: "E-Referral", - textColor: Theme.of(context).backgroundColor), + Texts( + "E-Referral: ", + fontWeight: FontWeight.normal, + fontSize: 25, + color: HexColor("#60686b"), + ), + SizedBox( + height: 12, + ), + Texts( + "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)", + fontWeight: FontWeight.normal, + fontSize: 17, + ), + SizedBox( + height: 22, + ), + Center( + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.55, + width: MediaQuery.of(context).size.width * 0.50, + child: CarouselSlider( + imagesUrlList: [ + "https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/0.png", + "https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/1.png" + ], + ), + ), + ), + SizedBox( + height: 77, ), ], - ), - - )); + )), + 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( + onTap: () => Navigator.push( + context, FadePage(page: EReferralPage())), + label: "E-Referral", + textColor: Theme.of(context).backgroundColor), + ), + ], + ), + )); } } diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 3fa2aeab..f717ba8e 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.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'; @@ -7,6 +8,7 @@ import 'package:diplomaticquarterapp/pages/Blood/advance_payment_page.dart'; import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/family/my-family.dart'; @@ -15,6 +17,7 @@ import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dar import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; +import 'package:diplomaticquarterapp/routes.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'; @@ -39,6 +42,7 @@ class _AllHabibMedicalServiceState extends State { return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).alhabiServices, + isShowDecPage: false, body: Column( children: [ Expanded( @@ -192,7 +196,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(), + FadePage(page: ChildVaccinesPage()), ), imageLocation: 'assets/images/new-design/children_vaccines_icon.png', @@ -210,16 +214,15 @@ class _AllHabibMedicalServiceState extends State { title: TranslationBase.of(context).todoList, ), ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(), + onTap: () => Navigator.of(context).pushNamed( + SYMPTOM_CHECKER, ), imageLocation: 'assets/images/new-design/body_icon.png', title: 'Symptom Checker'), ServicesContainer( onTap: () => Navigator.push( context, - FadePage(page:BloodDonationPage()), + FadePage(page: BloodDonationPage()), ), imageLocation: 'assets/images/new-design/blood_icon.png', title: 'Blood Donation', @@ -227,7 +230,9 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(), + FadePage( + page: (HealthCalculators()), + ), ), imageLocation: 'assets/images/new-design/health_calculator_icon.png', @@ -285,7 +290,8 @@ class _AllHabibMedicalServiceState extends State { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => MyWebView( title: "HMG News", - selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + selectedUrl: + "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", ))); }, imageLocation: diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart index 9ce35d27..68ce1936 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart @@ -23,7 +23,7 @@ class H2OPageIndexPage extends StatelessWidget { "Water Tracker:", fontWeight: FontWeight.normal, fontSize: 25, - color: Hexcolor("#60686b"), + color: HexColor("#60686b"), ), SizedBox( height: 12, diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index 55767e5a..b92efc9e 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -6,10 +6,11 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; + class TodayPage extends StatelessWidget { @override Widget build(BuildContext context) { - return BaseView( + return BaseView( onModelReady: (model) => model.getUserProgressForTodayData(), builder: (_, model, widget) => AppScaffold( isShowAppBar: false, @@ -27,11 +28,11 @@ class TodayPage extends StatelessWidget { animation: true, animationDuration: 1200, lineWidth: 15.0, - percent:model.userProgressData ==null ?0.0: - (model.userProgressData.percentageConsumed / - 100) >= 1 ? 1 : (model.userProgressData - .percentageConsumed / - 100), + percent: model.userProgressData == null + ? 0.0 + : (model.userProgressData.percentageConsumed / 100) >= 1 + ? 1 + : (model.userProgressData.percentageConsumed / 100), //, center: Center( child: Column( @@ -46,13 +47,16 @@ class TodayPage extends StatelessWidget { SizedBox( height: 4, ), - Text(model.userProgressData ==null ?"0.0": - model.userProgressData.quantityConsumed - .toString() + 'ml', + Text( + model.userProgressData == null + ? "0.0" + : model.userProgressData.quantityConsumed + .toString() + + 'ml', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20.0, - color: Hexcolor("#60BCF9")), + color: HexColor("#60BCF9")), ), SizedBox( height: 4, @@ -60,9 +64,7 @@ class TodayPage extends StatelessWidget { SizedBox( height: 5, width: 50, - child: Container( - - ), + child: Container(), ), SizedBox( height: 4, @@ -74,23 +76,28 @@ class TodayPage extends StatelessWidget { SizedBox( height: 4, ), - Text(model.userProgressData ==null ?"0.0": - (model.userProgressData.quantityLimit - - model.userProgressData - .quantityConsumed) < 0 ? "0 ml" : - (model.userProgressData.quantityLimit - - model.userProgressData - .quantityConsumed).toString() + ' ml', + Text( + model.userProgressData == null + ? "0.0" + : (model.userProgressData.quantityLimit - + model.userProgressData + .quantityConsumed) < + 0 + ? "0 ml" + : (model.userProgressData.quantityLimit - + model.userProgressData + .quantityConsumed) + .toString() + + ' ml', style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0), + fontWeight: FontWeight.bold, fontSize: 18.0), ), ], ), ), circularStrokeCap: CircularStrokeCap.butt, - backgroundColor: Hexcolor("#D1E3F6"), - progressColor: Hexcolor("#60BCF9"), + backgroundColor: HexColor("#D1E3F6"), + progressColor: HexColor("#60BCF9"), ), ), Row( @@ -105,9 +112,9 @@ class TodayPage extends StatelessWidget { height: 30, width: 70, decoration: BoxDecoration( - color: Hexcolor("#D1E3F6"), - borderRadius: BorderRadius.all( - Radius.circular(30))), + color: HexColor("#D1E3F6"), + borderRadius: + BorderRadius.all(Radius.circular(30))), ), ), Text( @@ -125,9 +132,9 @@ class TodayPage extends StatelessWidget { height: 30, width: 70, decoration: BoxDecoration( - color: Hexcolor("#60BCF9"), - borderRadius: BorderRadius.all( - Radius.circular(30))), + color: HexColor("#60BCF9"), + borderRadius: + BorderRadius.all(Radius.circular(30))), ), ), Text( @@ -143,10 +150,7 @@ class TodayPage extends StatelessWidget { ), SizedBox( height: 0.5, - width: MediaQuery - .of(context) - .size - .width, + width: MediaQuery.of(context).size.width, child: Container( color: Colors.grey, ), @@ -163,4 +167,3 @@ class TodayPage extends StatelessWidget { ); } } - diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart new file mode 100644 index 00000000..c84053c5 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart @@ -0,0 +1,522 @@ +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:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'dart:math'; + +import 'result_page.dart'; + +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class BMICalculator extends StatefulWidget { + @override + _BMICalculatorState createState() => _BMICalculatorState(); +} + +class _BMICalculatorState extends State { + TextEditingController textController = new TextEditingController(); + 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; + } + } + } + + 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; + } + } + } + + double convertToCm(double number) { + return number * 30.48; + } + + double convertToKg(double number) { + return number / 2.205; + } + + double calculateBMI() { + if (ftCard == activeCardColor) { + convertToCm(height.toDouble()); + } + bmiResult = weight / pow(height / 100, 2); + + return bmiResult; + } + + void showTextResult() { + if (bmiResult >= 30) { + textResult = 'Obese'; + } else if (bmiResult < 30 && bmiResult >= 25) { + textResult = 'OverWeight'; + } else if (bmiResult < 25 && bmiResult >= 18.5) { + textResult = 'Healthy'; + } else if (bmiResult < 18.5) { + textResult = 'UnderWeight'; + } + } + + void showMsg() { + if (bmiResult >= 30) { + msg = + '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.'; + } else if (bmiResult < 30 && bmiResult >= 25) { + msg = + 'A BMI of 25 - 30 indicates that are slightly overweight. May be advised to lose some weight for health reasons. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get '; + } else if (bmiResult < 25 && bmiResult >= 18.5) { + msg = + '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.'; + } else if (bmiResult < 18.5) { + msg = + 'A BMI of less than 18.5 indicates that are underweight, so may need to put on some weight. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get started.'; + } + } + + @override + void initState() { + super.initState(); + textController.text = '0'; // Setting the initial value for the field. + } + + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'BMI Calculator', + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Container( + width: 350.0, + child: Padding( + padding: EdgeInsets.symmetric(vertical: 15.0), + child: Text( + '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', + style: TextStyle(fontSize: 18.0), + ), + ), + ), + ), + Container( + height: 200.0, + width: 350.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + ), + child: Column( + children: [ + Row( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts('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('Select Unit'), + ), + ], + ), + 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('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('FT')), + ), + ), + ), + ], + ), + ], + ), + ), + SizedBox( + height: 25.0, + ), + Container( + height: 200.0, + width: 350.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + ), + child: Column( + children: [ + Row( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts('Weight'), + ), + ], + ), + 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), + ), + ], + ), + Row( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts('Select Unit'), + ), + ], + ), + 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: 25.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + calculateBMI(); + showTextResult(); + showMsg(); + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ResultPage( + finalResult: bmiResult, + textResult: textResult, + msg: msg, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart new file mode 100644 index 00000000..bfbd10b7 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart @@ -0,0 +1,101 @@ +import 'dart:ffi'; + +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:flutter/material.dart'; +import 'package:percent_indicator/percent_indicator.dart'; + +class ResultPage extends StatelessWidget { + final double finalResult; + final String textResult; + final String msg; + + ResultPage({this.finalResult, this.textResult, this.msg}); + Color inductorColor; + double percent; + + Color colorInductor() { + if (finalResult >= 30) { + inductorColor = Color(0xffC70D00); + } else if (finalResult < 30 && finalResult >= 25) { + inductorColor = Color(0xffC25400); + } else if (finalResult < 25 && finalResult >= 18.5) { + inductorColor = Color(0xff36D600); + } else if (finalResult < 18.5) { + inductorColor = Color(0xff1BE0EE); + } + return inductorColor; + } + + double percentInductor() { + if (finalResult >= 30) { + percent = 1.0; + } else if (finalResult < 30 && finalResult >= 25) { + percent = 0.73; + } else if (finalResult < 25 && finalResult >= 18.5) { + percent = 0.5; + } else if (finalResult < 18.5) { + percent = 0.25; + } + return percent; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "BMI Calculator", + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + // height: 40.0, + ), + 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, + ), + ), + Container( + height: 120, + width: 280.0, + child: Texts(msg), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart new file mode 100644 index 00000000..1af0f949 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -0,0 +1,722 @@ +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:flutter/material.dart'; +import 'dart:math'; + +import 'bmr_result_page.dart'; + +const activeCardColorGender = Color(0xffC5272D); +const inactiveCardColorGender = Color(0xffFAFAFd); +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class BmrCalculator extends StatefulWidget { + @override + _BmrCalculatorState createState() => _BmrCalculatorState(); +} + +class _BmrCalculatorState extends State { + bool isMale = false; + bool isHeightCm = true; + 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; + double bmrResult = 0; + String dropdownValue = 'Lighty Active (1-3) days per week'; + double calories = 0; + + void updateColor(int type) { + //MG/DLT card + if (type == 1) { + if (maleCard == inactiveCardColorGender) { + maleCard = activeCardColorGender; + femaleCard = inactiveCardColorGender; + } else { + maleCard = inactiveCardColorGender; + } + } + if (type == 2) { + if (femaleCard == inactiveCardColorGender) { + femaleCard = activeCardColorGender; + maleCard = inactiveCardColorGender; + } else { + femaleCard = inactiveCardColorGender; + } + } + } + + 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 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 calculateBmr() { + if (isMale == true) { + bmrResult = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age); + } else if (isMale == false) { + bmrResult = + 655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age); + } + + bmrResult = bmrResult.roundToDouble(); + } + + void calculateCalories() { + if (dropdownValue == "Almost Inactive(Little or no exercises)") { + calories = bmrResult * 1.2; + } else if (dropdownValue == "Lighty Active (1-3) days per week") { + calories = bmrResult * 1.375; + } else if (dropdownValue == "very Active(6-7) days per week") { + calories = bmrResult * 1.55; + } else if (dropdownValue == "Super Active(very hard exercises)") { + calories = bmrResult * 1.725; + } else if (dropdownValue == "") { + calories = bmrResult * 10.725; + } + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Bmr Calculator', + 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, + 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')), + ), + ), + ], + ), + ), + 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, + ), + 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(age.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 (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( + '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, + ), + ), + 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), + ), + ), + ], + ), + ), + ], + ), + 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: 5.0, + ), + Texts( + 'Weight', + ), + SizedBox( + height: 5.0, + ), + 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, + ), + ), + 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 > 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), + ), + ), + ], + ), + ), + ], + ), + 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, + ), + 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(), + ), + ), + SizedBox( + height: 30.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + calculateBmr(); + calculateCalories(); + + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => BmrResultPage( + bmrResult: bmrResult, + calories: calories, + )), + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + ), + ), + ); + } +} 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 new file mode 100644 index 00000000..a3fdb5f7 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart @@ -0,0 +1,65 @@ +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:flutter/material.dart'; +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, + appBarTitle: 'BMR Calculator', + 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, + ), + ), + SizedBox( + height: 5.0, + ), + Text( + 'Calories/Day', + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + 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.'), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart new file mode 100644 index 00000000..91847e37 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -0,0 +1,1017 @@ +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:flutter/material.dart'; +import 'dart:math'; + +import 'body_fat_result_page.dart'; + +const activeCardColorGender = Color(0xffC5272D); +const inactiveCardColorGender = Color(0xffFAFAFd); +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class BodyFat extends StatefulWidget { + @override + _BodyFatState createState() => _BodyFatState(); +} + +class _BodyFatState extends State { + bool isMale = false; + bool isHeightCm = true; + Color maleCard = activeCardColorGender; + Color femaleCard = inactiveCardColorGender; + 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; + double heightInches; + double minRange; + double maxRange; + double overWeightBy; + int waist = 5; + double bodyFat = 0; + double fat = 0; + String dropdownValue; + double calories = 0; + String textResult = ''; + + 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 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) { + if (waistCmCard == inactiveCardColor) { + waistCmCard = activeCardColor; + waistFtCard = inactiveCardColor; + } else { + waistCmCard = inactiveCardColor; + } + } + if (type == 2) { + if (waistFtCard == inactiveCardColor) { + waistFtCard = activeCardColor; + waistCmCard = inactiveCardColor; + } else { + waistFtCard = inactiveCardColor; + } + } + } + + void updateColorHip(int type) { + //MG/DLT card + if (type == 1) { + if (hipCmCard == inactiveCardColor) { + hipCmCard = activeCardColor; + hipFtCard = inactiveCardColor; + } else { + hipCmCard = inactiveCardColor; + } + } + if (type == 2) { + if (hipFtCard == inactiveCardColor) { + hipFtCard = activeCardColor; + hipCmCard = inactiveCardColor; + } else { + hipFtCard = inactiveCardColor; + } + } + } + + void updateColor(int type) { + //MG/DLT card + if (type == 1) { + if (maleCard == inactiveCardColorGender) { + maleCard = activeCardColorGender; + femaleCard = inactiveCardColorGender; + } else { + maleCard = inactiveCardColorGender; + } + } + if (type == 2) { + if (femaleCard == inactiveCardColorGender) { + femaleCard = activeCardColorGender; + maleCard = inactiveCardColorGender; + } else { + femaleCard = inactiveCardColorGender; + } + } + } + + void calculateBodyFat() { + if (isMale == true) { + bodyFat = 495 / + (1.0324 - + 0.19077 * (log(waist - neck) / ln10) + + 0.15456 * (log(heightCm) / 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; + fat = (bodyFat * 10) / 10.round(); + } + if (fat <= 0) { + fat = 0; + } + } + + void showTextResult() { + if (isMale == false) { + if (bodyFat > 9 && bodyFat <= 13) { + textResult = 'The category falls under essential'; + } else if (bodyFat > 13 && bodyFat <= 20) { + textResult = 'The category falls under athlete'; + } else if (bodyFat > 20 && bodyFat <= 24) { + textResult = 'The category falls under fitness'; + } else if (bodyFat > 24 && bodyFat <= 31) { + textResult = 'The category falls under acceptable'; + } else if (bodyFat > 31 && bodyFat <= 60) { + textResult = 'The category falls under obese'; + } else if (bodyFat > 60) { + textResult = + 'Please check the value you have entered, since the body fat percentage has crosed the limits.'; + } else if (bodyFat <= 9) { + textResult = + 'Please check the value you have entered, since the body fat percentage cannot be this low.'; + } + } else { + if (bodyFat > 5 && fat <= 13) { + textResult = 'The category falls under essential'; + } else if (bodyFat > 13 && bodyFat <= 17) { + textResult = 'The category falls under athlete'; + } else if (bodyFat > 17 && bodyFat <= 24) { + textResult = 'The category falls under fitness'; + } else if (bodyFat > 24 && bodyFat <= 45) { + textResult = 'The category falls under obese'; + } else if (bodyFat > 45) { + textResult = + 'Please check the value you have entered, since the body fat percentage has crosed the limits.'; + } else if (bodyFat <= 5) { + textResult = + 'Please check the value you have entered, since the body fat percentage cannot be this low.'; + } + } + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Body Fat', + 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( + 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, + 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( + 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(heightCm.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 (heightCm < 250) + heightCm++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (heightCm > 0) + heightCm--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: heightCm.toDouble(), + min: 0, + max: 250, + onChanged: (double newValue) { + setState(() { + heightCm = 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: 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( + 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(neck.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 (neck < 60) neck++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (neck > 5) neck--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: neck.toDouble(), + min: 5, + max: 60, + onChanged: (double newValue) { + setState(() { + neck = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ), + ], + ), + 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', + ), + 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(waist.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 (waist < 200) + waist++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (waist > 5) waist--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: waist.toDouble(), + min: 5, + max: 200, + onChanged: (double newValue) { + setState(() { + waist = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.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')), + ), + ), + ), + ], + ), + SizedBox( + height: 10.0, + ), + Texts( + 'Hip', + ), + 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(hip.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 (hip < 140) hip++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (hip > 5) hip--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: hip.toDouble(), + min: 5, + max: 140, + onChanged: (double newValue) { + setState(() { + hip = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.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')), + ), + ), + ), + ], + ), + SizedBox( + height: 35.0, + ), + ], + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + calculateBodyFat(); + showTextResult(); + + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FatResult( + bodyFat: bodyFat, + fat: fat, + textResult: textResult, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } +} 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 new file mode 100644 index 00000000..c8c5476e --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart @@ -0,0 +1,77 @@ +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:flutter/material.dart'; +import 'package:percent_indicator/circular_percent_indicator.dart'; + +class FatResult extends StatelessWidget { + final double bodyFat; + final double fat; + final String textResult; + + FatResult({this.bodyFat, this.fat, this.textResult = ''}); + Color inductorColor; + Color colorInductor() { + if (bodyFat >= 17) { + inductorColor = Color(0xffC70D00); + } else if (bodyFat < 20 && bodyFat >= 24) { + inductorColor = Color(0xffC25400); + } else if (bodyFat < 24 && bodyFat >= 31) { + inductorColor = Color(0xff36D600); + } else if (bodyFat > 45) { + inductorColor = Color(0xff1BE0EE); + } + return inductorColor; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Body Fat', + 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, + ), + ), + SizedBox( + height: 5.0, + ), + ], + ), + progressColor: inductorColor, + backgroundColor: Colors.white, + ), + ), + Container( + height: 120, + width: 280.0, + child: Texts(textResult), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart new file mode 100644 index 00000000..4361425a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -0,0 +1,677 @@ +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:flutter/material.dart'; + +import 'calorie_result_page.dart'; + +const activeCardColorGender = Color(0xffC5272D); +const inactiveCardColorGender = Color(0xffFAFAFd); +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class CalorieCalculator extends StatefulWidget { + @override + _CalorieCalculatorState createState() => _CalorieCalculatorState(); +} + +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; + double calories; + String dropdownValue; + void updateColor(int type) { + //MG/DLT card + if (type == 1) { + if (maleCard == inactiveCardColorGender) { + maleCard = activeCardColorGender; + femaleCard = inactiveCardColorGender; + } else { + maleCard = inactiveCardColorGender; + } + } + if (type == 2) { + if (femaleCard == inactiveCardColorGender) { + femaleCard = activeCardColorGender; + maleCard = inactiveCardColorGender; + } else { + femaleCard = inactiveCardColorGender; + } + } + } + + 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); + } else if (isMale == false) { + calories = + 655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age); + } + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Calorie Calculator', + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), + child: SingleChildScrollView( + child: Container( + height: 890.0, + child: Column( + //mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(10.0), + child: Texts( + 'Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity rate', + ), + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 10.0, vertical: 15.0), + child: Texts('Gender'), + ), + 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')), + ), + ), + ], + ), + ), + SizedBox( + height: 15.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, + ), + 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(age.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 (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( + '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, + ), + ), + 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), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(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('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(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('Ft')), + ), + ), + ), + ], + ), + SizedBox( + height: 5.0, + ), + Texts( + 'Weight', + ), + 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, + ), + ), + 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 > 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), + ), + ), + ], + ), + ), + ], + ), + 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: 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(), + ), + ), + SizedBox( + height: 25.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + calculateCalories(); + print(calories); + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CalorieResultPage( + calorie: calories, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } +} 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 new file mode 100644 index 00000000..5c52ecb0 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart @@ -0,0 +1,59 @@ +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:flutter/material.dart'; +import 'package:percent_indicator/circular_percent_indicator.dart'; + +class CalorieResultPage extends StatelessWidget { + final double calorie; + + CalorieResultPage({this.calorie}); + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: 'Calorie Calculator', + isShowAppBar: true, + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + 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, + ), + ), + SizedBox( + height: 5.0, + ), + Texts('Calories'), + ], + ), + progressColor: Color(0xff3C3939), + backgroundColor: Colors.white, + ), + ), + Container( + child: + Texts('Daily intake is ${calorie.toStringAsFixed(1)} calories'), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart new file mode 100644 index 00000000..e273b075 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -0,0 +1,367 @@ +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:flutter/material.dart'; +import 'dart:math'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; +import 'package:flutter/services.dart'; + +import 'carbs_result_page.dart'; + +class Carbs extends StatefulWidget { + @override + _CarbsState createState() => _CarbsState(); +} + +class _CarbsState extends State { + TextEditingController textController = new TextEditingController(); + int calories; + String dropdownValue; + bool _visible = false; + int meals; + int protein; + int carbs; + + int fat; + double pCal; + double cCal; + double fCal; + double pCalGram; + double cCalGram; + double fCalGram; + double pCalMeal; + double cCalMeal; + double fCalMeal; + + void calculateDietRatios() { + if (dropdownValue == 'Very Low Carb') { + meals = 3; + protein = 45; + carbs = 10; + fat = 45; + } else if (dropdownValue == 'Low Carb') { + meals = 3; + protein = 40; + carbs = 30; + fat = 30; + } else if (dropdownValue == 'Moderate Carb') { + meals = 3; + protein = 25; + carbs = 50; + fat = 25; + } else if (dropdownValue == 'USDA Gudilines') { + meals = 3; + protein = 15; + carbs = 55; + fat = 30; + } else if (dropdownValue == 'Zone Diet') { + meals = 3; + protein = 30; + carbs = 40; + fat = 30; + } + } + + 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; + pCalMeal = pCalGram / meals.ceil(); + cCalMeal = cCalGram / meals.ceil(); + fCalMeal = fCalGram / meals.ceil(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Carb Protein Fat', + 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( + 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(); + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + SizedBox( + height: 20.0, + ), + Button( + backgroundColor: Color(0xffC5272D), + label: 'NOT SURE? CLICK HERE ', + onTap: () { + setState(() { + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CalorieCalculator()), + ); + } + }); + }, + ), + ], + ), + 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(), + ), + ), + Visibility( + visible: _visible, + child: Container( + height: 170.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + 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), + children: [ + TextSpan( + text: 'Protein ', + ), + TextSpan( + text: '$protein%', + style: TextStyle(color: Color(0xffC5272D)), + ) + ], + ), + ), + RichText( + text: TextSpan( + style: TextStyle(color: Colors.black), + children: [ + TextSpan( + text: 'Carbohydrate ', + ), + TextSpan( + text: '$carbs%', + style: TextStyle(color: Color(0xffC5272D)), + ) + ], + ), + ), + RichText( + text: TextSpan( + style: TextStyle(color: Colors.black), + children: [ + TextSpan( + text: 'Fat ', + ), + TextSpan( + text: '$fat%', + style: TextStyle(color: Color(0xffC5272D)), + ) + ], + ), + ), + ], + ), + ), + ) + ], + ), + SizedBox( + height: 55.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + { + calculate(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CarbsResult( + cCal: cCal, + pCal: pCal, + fCal: fCal, + pCalGram: pCalGram, + pCalMeal: pCalMeal, + fCalGram: fCalGram, + fCalMeal: fCalMeal, + cCalGram: cCalGram, + cCalMeal: cCalMeal, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart new file mode 100644 index 00000000..f8d0815a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart @@ -0,0 +1,175 @@ +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:flutter/material.dart'; +import 'dart:math'; + +import 'package:flutter/painting.dart'; + +class CarbsResult extends StatelessWidget { + double pCal; + double cCal; + double fCal; + double pCalGram; + double cCalGram; + double fCalGram; + double pCalMeal; + double cCalMeal; + double fCalMeal; + + CarbsResult( + {this.pCal, + this.cCal, + this.fCal, + this.pCalGram, + this.cCalGram, + this.fCalGram, + this.fCalMeal, + this.cCalMeal, + this.pCalMeal}); + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Carb Protein Fat', + 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), + ), + 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'), + ), + ), + ), + 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'), + ), + ), + ]), + ], + ), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + + // 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()), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart new file mode 100644 index 00000000..c9993b95 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart @@ -0,0 +1,146 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.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:flutter/material.dart'; +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; +import 'package:intl/intl.dart'; + +import 'delivery_due_result_page.dart'; + +class DeliveryDue extends StatefulWidget { + @override + _DeliveryDueState createState() => _DeliveryDueState(); +} + +class _DeliveryDueState extends State { + DateTime bloodSugarDate = DateTime.now(); + DateTime timeSugarDate = DateTime.now(); + var dateFrom = DateTime.now(); + var dateTo = DateTime.now(); + var conceivedDate = DateTime.now(); + var deliveryDue = DateTime.now(); + var firstTrimester = DateTime.now(); + var secondTrimester = DateTime.now(); + var thirdTrimester = DateTime.now(); + var dt = DateTime.now(); + var newFormat = DateFormat("yy-MM-dd"); + + String getDate() { + return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}"; + } + + String getTime() { + return " ${timeSugarDate.hour}:${timeSugarDate.minute}"; + } + + @override + 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( + children: [ + Texts( + 'What was the date of the first day of the last period?', + ), + 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 + ? null + : bloodSugarDate = DateTime.now(); + 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)); + }); + }, + 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( + children: [ + Icon(Icons.date_range), + Texts('Date'), + ], + ), + Texts(getDate()), + ], + ), + ), + ), + ], + ), + SizedBox( + height: 280.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => 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 new file mode 100644 index 00000000..fc53b044 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart @@ -0,0 +1,106 @@ +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:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class DeliveryDueResult extends StatelessWidget { + var dateFrom; + var dateTo; + var conceivedDate; + var deliveryDue; + var firstTrimester; + var secondTrimester; + var 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', + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart new file mode 100644 index 00000000..9bdbfb36 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -0,0 +1,557 @@ +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:flutter/material.dart'; +import 'dart:math'; + +import 'ideal_body_result_page.dart'; + +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class IdealBody extends StatefulWidget { + @override + _IdealBodyState createState() => _IdealBodyState(); +} + +class _IdealBodyState extends State { + bool isMale = false; + bool isHeightCm = true; + + Color kgCard = activeCardColor; + Color lbCard = inactiveCardColor; + Color cmCard = activeCardColor; + Color ftCard = inactiveCardColor; + 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)'; + 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; + } + } + } + + 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; + heightFeet = heightInches / 12; + idealWeight = (50 + 2.3 * (heightInches - 60)); + if (dropdownValue == 'Small(fingers overlap)') { + idealWeight = idealWeight - 10; + } else if (dropdownValue == 'Medium(fingers touch)') { + idealWeight = idealWeight; + } else if (dropdownValue == 'Large(fingers don\'n touch)') { + idealWeight = idealWeight + 10; + } + + maxIdealWeight = (((idealWeight) * 1.1).round() * 100) / 100; + overWeightBy = weight - maxIdealWeight.roundToDouble(); + minRange = ((idealWeight / 1.1) * 10).round() / 10; + maxRange = maxIdealWeight; + idealWeight = idealWeight; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Ideal Body Weight', + 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, + 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), + ), + ), + ], + ), + ), + ), + ], + ), + 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: 45.0, + ), + Divider( + thickness: 2.0, + ), + Texts( + 'Weight', + ), + SizedBox( + height: 5.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: 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 > 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), + ), + ), + ], + ), + ), + ), + ], + ), + 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, + ), + SizedBox( + height: 5.0, + ), + 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(), + ), + ), + SizedBox( + height: 30.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + // calculateBmr(); + // calculateCalories(); + calculateIdealWeight(); + + print(idealWeight); + //print(overWeightBy); + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => IdealBodyResult( + idealBodyWeight: idealWeight, + minRange: minRange, + mixRange: maxRange, + overWeightBy: overWeightBy, + textResult: textResult, + )), + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + ), + ), + ); + } +} 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 new file mode 100644 index 00000000..605e499a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart @@ -0,0 +1,170 @@ +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:flutter/material.dart'; +import 'dart:math'; + +class IdealBodyResult extends StatelessWidget { + final double idealBodyWeight; + final double minRange; + final double mixRange; + final double overWeightBy; + 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', + body: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + 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), + ), + ), + ], + ), + ], + ), + overWeightBy >= 0 && overWeightBy <= 10 + ? Column( + children: [ + Texts( + 'Congratulations! The current weight is\n perfect and considered healthy', + fontSize: 20.0, + ), + ], + ) + : overWeightBy > 10 && overWeightBy < 17 + ? Column( + 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'), + ], + ) + : overWeightBy >= 18 + ? Container( + height: 250.0, + width: 350, + child: 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'), + ], + ), + ) + : 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, + ), + ], + ) + : 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, + ), + Texts( + 'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), + ], + ), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart new file mode 100644 index 00000000..1a272c11 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart @@ -0,0 +1,351 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.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:flutter/material.dart'; +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; +import 'package:intl/intl.dart'; + +import 'ovulation_result_page.dart'; + +class OvulationPeriod extends StatefulWidget { + @override + _OvulationPeriodState createState() => _OvulationPeriodState(); +} + +class _OvulationPeriodState extends State { + DateTime bloodSugarDate = DateTime.now(); + DateTime timeSugarDate = DateTime.now(); + int cycleLength = 0; + int lutealPhaseLength = 0; + String selectedDate; + var dateFrom = DateTime.now(); + var dateTo = DateTime.now(); + var conceivedDate = DateTime.now(); + var deliveryDue = DateTime.now(); + var dt = DateTime.now(); + var newFormat = DateFormat("yy-MM-dd"); + String updatedDt; + + String getTime() { + return " ${timeSugarDate.hour}:${timeSugarDate.minute}"; + } + + String getDate() { + return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}"; + } + + // void calculate() {} + // + // void calculateFertility(DateTime selectedDate) {const diff = Date.} + + @override + 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(() { + bloodSugarDate = date; + dateFrom = date.add(Duration(days: 10)); + updatedDt = DateFormat.yMMMEd().format(dateFrom); + + dateTo = date.add(Duration(days: 20)); + conceivedDate = date.add(Duration(days: 14)); + deliveryDue = date.add(Duration(days: 280)); + }); + }, + 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( + 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, + ), + ), + 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), + ), + ), + ], + ), + ), + ], + ), + 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, + ), + 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--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: lutealPhaseLength.toDouble(), + min: 0, + max: 15, + onChanged: (double newValue) { + setState(() { + lutealPhaseLength = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + SizedBox( + height: 220.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OvulationResult( + conceivedDate: conceivedDate, + dateFrom: dateFrom, + dateTo: dateTo, + deliveryDue: deliveryDue, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } +} 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 new file mode 100644 index 00000000..6669bf75 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart @@ -0,0 +1,96 @@ +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:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class OvulationResult extends StatelessWidget { + var dateFrom; + var dateTo; + var conceivedDate; + var deliveryDue; + OvulationResult( + {this.dateFrom, this.dateTo, this.deliveryDue, this.conceivedDate}); + //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( + '5 Weeks, 2', + 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', + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index 7a48cf9b..58caee36 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -96,7 +96,7 @@ class _BloodCholesterolState extends State { children: [ Texts( 'Convert from', - ) + ), ], ), ), @@ -190,7 +190,7 @@ class _BloodCholesterolState extends State { child: TextFormField( controller: textController, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly +// FilteringTextInputFormatter.digitsOnly ], keyboardType: TextInputType.number, decoration: InputDecoration( diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart index a90a5bbb..f5d66ccf 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart @@ -192,7 +192,7 @@ class _BloodSugarState extends State { child: TextFormField( controller: textController, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly +// FilteringTextInputFormatter.digitsOnly ], keyboardType: TextInputType.number, decoration: InputDecoration( diff --git a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart index fdf8d191..a86fdb88 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart @@ -188,7 +188,7 @@ class _TriglyceridesState extends State { child: TextFormField( controller: textController, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly +// FilteringTextInputFormatter.digitsOnly ], keyboardType: TextInputType.number, decoration: InputDecoration( diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart new file mode 100644 index 00000000..d3bd4bed --- /dev/null +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -0,0 +1,283 @@ +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/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.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'; + +class HealthCalculators extends StatefulWidget { + @override + _HealthCalculatorsState createState() => _HealthCalculatorsState(); +} + +class _HealthCalculatorsState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Health 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).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('General Health'), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: Center( + child: Texts("Women's Health"), + ), + ), + ], + ), + ), + ), + ) + ], + ), + ), + 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: 'BMI', + imagePath: 'bmi_health_calculator.png', + subTitle: 'Calculators', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: CalorieCalculator(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Calories', + imagePath: 'calories-calculator.png', + subTitle: 'Calculators', + ), + ), + ), + ], + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: BmrCalculator(), + ), + ); + }, + child: MedicalProfileItem( + title: 'BMR', + imagePath: 'BMR_calculator.png', + subTitle: 'Calculators', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: IdealBody(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Ideal Body', + imagePath: 'body_weight.png', + subTitle: 'Weight', + ), + ), + ), + ], + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: BodyFat(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Body', + imagePath: 'body_fat.png', + subTitle: 'Fat', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: Carbs(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Carbohydrate', + imagePath: 'carb_protein.png', + subTitle: 'Protein Fat', + ), + ), + ), + ], + ), + ], + ), + ), + 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: 'Ovulation', + imagePath: 'ovulation_period_icon.png', + subTitle: 'Period', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: DeliveryDue(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Delivery', + imagePath: 'delivery_date_icon.png', + subTitle: 'Due Date', + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 6132e38c..99e5242e 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -87,7 +87,7 @@ class _BloodDonationPageState extends State { children: [ Texts( // TranslationBase.of(context).advancePaymentLabel, - "Enter the required information, In order to register for Blood Donation Service", + "Enter the required information, In order to register for Blood Donation Service",//+model.user.firstName, textAlign: TextAlign.center, ), SizedBox( diff --git a/lib/pages/Blood/my_balance_page.dart b/lib/pages/Blood/my_balance_page.dart index 07d27e2d..26665c2b 100644 --- a/lib/pages/Blood/my_balance_page.dart +++ b/lib/pages/Blood/my_balance_page.dart @@ -39,7 +39,7 @@ class MyBalancePage extends StatelessWidget { width: double.infinity, height: 65, decoration: BoxDecoration( - color: Hexcolor('#B61422'), + color: HexColor('#B61422'), shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(7), ), @@ -97,7 +97,8 @@ class MyBalancePage extends StatelessWidget { textColor: Colors.white, label: TranslationBase.of(context).createAdvancedPayment, onTap: () { - Navigator.push(context, + Navigator.push( + context, //FadePage(page: AdvancePaymentPage())); FadePage(page: BloodDonationPage())); }, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 88ecdb6b..b0110d2b 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -24,10 +24,12 @@ class BookConfirm extends StatefulWidget { String appoDateFormatted = ""; String appoTimeFormatted = ""; + bool isLiveCareAppointment; BookConfirm( {@required this.doctor, @required this.selectedDate, + @required this.isLiveCareAppointment, @required this.selectedTime}); DoctorsListService service; @@ -208,11 +210,13 @@ class _BookConfirmState extends State { "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], @@ -338,6 +342,9 @@ class _BookConfirmState extends State { ), ), ), + SizedBox( + height: 120.0, + ), ], ), ), @@ -358,7 +365,11 @@ class _BookConfirmState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { - insertAppointment(context, widget.doctor); + if (!widget.isLiveCareAppointment) { + insertAppointment(context, widget.doctor); + } else { + insertLiveCareScheduledAppointment(context, widget.doctor); + } }, child: Text(TranslationBase.of(context).bookNow, style: TextStyle(fontSize: 18.0)), @@ -375,7 +386,11 @@ class _BookConfirmState extends State { service.cancelAppointment(appo, context).then((res) { if (res['MessageStatus'] == 1) { Future.delayed(new Duration(milliseconds: 1500), () { - insertAppointment(context, docObject); + if (!widget.isLiveCareAppointment) { + insertAppointment(context, widget.doctor); + } else { + insertLiveCareScheduledAppointment(context, widget.doctor); + } }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -434,6 +449,55 @@ class _BookConfirmState extends State { text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } + insertLiveCareScheduledAppointment(context, DoctorList docObject) { + AppoitmentAllHistoryResultList appo; + 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"); + print(res['AppointmentNo']); + + Future.delayed(new Duration(milliseconds: 1800), () { + getLiveCareAppointmentPatientShare(context, res['AppointmentNo'], + docObject.clinicID, docObject.projectID, docObject); + }); + } else { + appo = new AppoitmentAllHistoryResultList(); + appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; + appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; + appo.projectID = res['SameClinicApptList'][0]['ProjectID']; + appo.endTime = res['SameClinicApptList'][0]['EndTime']; + appo.startTime = res['SameClinicApptList'][0]['StartTime']; + appo.doctorID = res['SameClinicApptList'][0]['DoctorID']; + appo.isLiveCareAppointment = true; + appo.originalClinicID = 0; + appo.originalProjectID = 0; + appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate']; + + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {cancelAppointment(docObject, appo, context)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + }).catchError((err) { + AppToast.showErrorToast(message: err); + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { widget.service @@ -448,6 +512,21 @@ class _BookConfirmState extends State { text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } + 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); + navigateToBookSuccess(context, docObject, widget.patientShareResponse); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + String getTime(DateTime dateTime) { final DateFormat formatter = DateFormat('HH:mm'); setState(() { @@ -502,7 +581,6 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { - Navigator.push( context, MaterialPageRoute( diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 7a19ea28..34dbdc2f 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -39,12 +39,6 @@ class _BookSuccessState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; - @override - void initState() { - // TODO: implement initState - super.initState(); - } - @override Widget build(BuildContext context) { return Scaffold( @@ -184,6 +178,9 @@ class _BookSuccessState extends State { case 30: return _getQRAppo(); break; + case 50: + return _getConfirmAppo(); + break; } } @@ -204,6 +201,9 @@ class _BookSuccessState extends State { case 30: return 'QR Code'; break; + case 50: + return 'Confirm LiveCare'; + break; } } @@ -286,8 +286,24 @@ class _BookSuccessState extends State { textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), - onPressed: () {}, - child: Text(TranslationBase.of(context).confirm.toUpperCase(), + 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)), ), ), @@ -321,6 +337,50 @@ class _BookSuccessState extends State { return Container(); } + confirmAppointment(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .confirmAppointment( + appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + if (appo.isLiveCareAppointment) { + insertLiveCareVIDARequest(appo); + } else { + navigateToHome(context); + } + }); + } + + insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, + appo.serviceID, appo.doctorID, context) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + navigateToHome(context); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + Widget _getPayNowAppo() { return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -543,7 +603,8 @@ class _BookSuccessState extends State { } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { @@ -560,22 +621,12 @@ class _BookSuccessState extends State { appo.appointmentNo.toString()); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } -// -// Future navigateToQR( -// context, String appoQR, PatientShareResponse patientShareResponse) async { -// Navigator.push( -// context, -// MaterialPageRoute( -// builder: (context) => QRCode( -// patientShareResponse: patientShareResponse, -// appoQR: appoQR, -// ))).then((value) {}); -// } - - addAdvancedNumberRequest(String advanceNumber, String paymentReference, - String appointmentID) { + + addAdvancedNumberRequest( + String advanceNumber, String paymentReference, String appointmentID) { DoctorsListService service = new DoctorsListService(); service .addAdvancedNumberRequest( @@ -585,7 +636,8 @@ class _BookSuccessState extends State { getAppoQR(context); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Widget _getQRAppo() { @@ -730,7 +782,7 @@ class _BookSuccessState extends State { } Future navigateToHome(context) async { - Navigator.of(context).pushNamed(HOME); + Navigator.of(context).popAndPushNamed(HOME); } getAppoQR(context) { @@ -742,7 +794,8 @@ class _BookSuccessState extends State { navigateToQR(context, res['AppointmentQR']); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToQR(context, String appoQR) async { diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index d3b6fc7c..d6986f6f 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -10,7 +11,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; + import 'BookConfirm.dart'; import 'components/DocAvailableAppointments.dart'; import 'components/DocInfo.dart'; @@ -19,9 +20,12 @@ class DoctorProfile extends StatefulWidget { DoctorList doctor; DoctorProfileList docProfileList; final bool isOpenAppt; + bool isLiveCareAppointment; + DoctorProfile( {@required this.doctor, @required this.docProfileList, + @required this.isLiveCareAppointment, this.isOpenAppt = false}); AuthenticatedUser authUser; @@ -35,6 +39,7 @@ class _DoctorProfileState extends State TabController _tabController; bool showFooterButton = false; var event = RobotProvider(); + @override void initState() { _tabController = new TabController( @@ -42,18 +47,19 @@ class _DoctorProfileState extends State vsync: this, initialIndex: widget.isOpenAppt == true ? 1 : 0); - event.controller.stream.listen((p) { - if (p['clinic_id'] != null && - p['doctor_id'] != null && - p['project_id'] != null) { - setState(() { - // need to take the data from here - // dropdownValue = p['clinic_id']; - }); - } - }); + // event.controller.stream.listen((p) { + // if (p['clinic_id'] != null && + // p['doctor_id'] != null && + // p['project_id'] != null) { + // setState(() { + // // need to take the data from here + // // dropdownValue = p['clinic_id']; + // }); + // } + // }); _tabController = new TabController(length: 2, vsync: this); widget.authUser = new AuthenticatedUser(); + widget.doctor.speciality = widget.docProfileList.specialty; getPatientData(); super.initState(); } @@ -190,7 +196,9 @@ class _DoctorProfileState extends State physics: NeverScrollableScrollPhysics(), children: [ DoctorInformation(docProfileList: widget.docProfileList), - DocAvailableAppointments(doctor: widget.doctor) + DocAvailableAppointments( + doctor: widget.doctor, + isLiveCareAppointment: widget.isLiveCareAppointment) ], controller: _tabController, ), @@ -245,6 +253,7 @@ class _DoctorProfileState extends State MaterialPageRoute( builder: (context) => BookConfirm( doctor: widget.doctor, + isLiveCareAppointment: widget.isLiveCareAppointment, selectedDate: DocAvailableAppointments.selectedDate, selectedTime: DocAvailableAppointments.selectedTime))); } diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 08b49462..095d72a6 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,17 +1,18 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; class Search extends StatefulWidget { final int type; - - Search({this.type = 0}); - + final List clnicIds; + Search({this.type = 0, this.clnicIds}); @override _SearchState createState() => _SearchState(); } @@ -29,24 +30,35 @@ class _SearchState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { + AppGlobal.context = context; return Scaffold( - appBar: AppBar( - bottom: TabBar( - tabs: [ - Tab(text: TranslationBase.of(context).clinicName), - Tab( - text: TranslationBase.of(context).doctorName, - ) - ], - controller: _tabController, - ), - title: Text(TranslationBase.of(context).bookAppo, - style: TextStyle(color: Colors.white)), + appBar: AppBar( + bottom: TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).clinicName), + Tab( + text: TranslationBase.of(context).doctorName, + ) + ], + controller: _tabController, + ), + title: Text(TranslationBase.of(context).bookAppo, + style: TextStyle(color: Colors.white)), + leading: Builder( + builder: (BuildContext context) { + return ArrowBack(); + }, ), - body: TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [SearchByClinic(), SearchByDoctor()], - controller: _tabController), - bottomNavigationBar: BottomBarSearch()); + ), + body: 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 2b5fac17..055b0c41 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; -import 'package:diplomaticquarterapp/services/robo_search/event_provider.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'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -9,24 +9,19 @@ import 'package:flutter/material.dart'; class SearchResults extends StatefulWidget { List doctorsList = []; List patientDoctorAppointmentListHospital; + bool isLiveCareAppointment; SearchResults( - {@required this.doctorsList, this.patientDoctorAppointmentListHospital}); + {@required this.doctorsList, this.patientDoctorAppointmentListHospital, @required this.isLiveCareAppointment}); @override _SearchResultsState createState() => _SearchResultsState(); } class _SearchResultsState extends State { - var event = RobotProvider(); + // var event = RobotProvider(); List tempList = []; - @override - void initState() { - event.controller.stream.listen((p) {}); - super.initState(); - } - @override Widget build(BuildContext context) { return AppScaffold( @@ -41,9 +36,14 @@ class _SearchResultsState extends State { ...List.generate( widget.patientDoctorAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget - .patientDoctorAppointmentListHospital[index].filterName + " - " +widget - .patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km, + isExpand: index == 1 ? true : false, + title: widget.patientDoctorAppointmentListHospital[index] + .filterName + + " - " + + widget.patientDoctorAppointmentListHospital[index] + .distanceInKMs + + " " + + TranslationBase.of(context).km, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -53,6 +53,7 @@ class _SearchResultsState extends State { .map((doctor) { return DoctorView( doctor: doctor, + isLiveCareAppointment: widget.isLiveCareAppointment, ); }).toList(), )), diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 3c5e49ff..74cba568 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -2,12 +2,13 @@ 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/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.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:smart_progress_bar/smart_progress_bar.dart'; +import 'package:table_calendar/table_calendar.dart'; import '../../../uitl/date_uitl.dart'; @@ -17,8 +18,10 @@ class DocAvailableAppointments extends StatefulWidget { static DateTime selectedAppoDateTime; static String selectedDate; static String selectedTime; + bool isLiveCareAppointment; - DocAvailableAppointments({@required this.doctor}); + DocAvailableAppointments( + {@required this.doctor, @required this.isLiveCareAppointment}); @override _DocAvailableAppointmentsState createState() => @@ -31,6 +34,8 @@ class _DocAvailableAppointmentsState extends State AnimationController _animationController; CalendarController _calendarController; + AppSharedPreferences sharedPref = new AppSharedPreferences(); + var selectedDate = ""; dynamic selectedDateJSON; dynamic jsonFreeSlots; @@ -56,8 +61,13 @@ class _DocAvailableAppointmentsState extends State _selectedDay: ['Event A0'] }; - WidgetsBinding.instance - .addPostFrameCallback((_) => getDoctorFreeSlots(context, widget.doctor)); + WidgetsBinding.instance.addPostFrameCallback((_) async { + if (widget.isLiveCareAppointment) + getDoctorScheduledFreeSlots(context, widget.doctor); + else { + getDoctorFreeSlots(context, widget.doctor); + } + }); _calendarController = CalendarController(); _animationController = AnimationController( @@ -225,7 +235,7 @@ class _DocAvailableAppointmentsState extends State return children; }, ), - onDaySelected: (date, events) { + onDaySelected: (date, events,holidays) { _onDaySelected(date, events); _animationController.forward(from: 0.0); }, @@ -323,8 +333,8 @@ class _DocAvailableAppointmentsState extends State getDoctorFreeSlots(context, DoctorList docObject) { DoctorsListService service = new DoctorsListService(); service - .getDoctorFreeSlots( - docObject.doctorID, docObject.clinicID, docObject.projectID, context) + .getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, + docObject.projectID, context) .then((res) { if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { @@ -340,7 +350,32 @@ class _DocAvailableAppointmentsState extends State } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + getDoctorScheduledFreeSlots(context, DoctorList docObject) { + DoctorsListService service = new DoctorsListService(); + service + .getDoctorScheduledFreeSlots(docObject.doctorID, docObject.clinicID, + docObject.projectID, docObject.serviceID, context) + .then((res) { + if (res['MessageStatus'] == 1) { + if (res['PatientER_DoctorFreeSlots'].length != 0) { + freeSlotsResponse = res['PatientER_DoctorFreeSlots']; + print("res['PatientER_DoctorFreeSlots']"); + print(res['PatientER_DoctorFreeSlots'].length); + _getJSONSlots().then((value) => { + setState(() => {_events.clear(), _events = value}) + }); + } else {} + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Widget _buildEventsMarker(DateTime date, List events) { @@ -350,8 +385,8 @@ class _DocAvailableAppointmentsState extends State color: _calendarController.isSelected(date) ? Colors.green[400] : _calendarController.isToday(date) - ? Colors.brown[300] - : Colors.blue[400], + ? Colors.brown[300] + : Colors.blue[400], ), width: 40.0, height: 40.0, diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 9c4d778f..9d833db1 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -11,10 +11,13 @@ import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; class SearchByClinic extends StatefulWidget { + final List clnicIds; + SearchByClinic({this.clnicIds}); @override _SearchByClinicState createState() => _SearchByClinicState(); } @@ -23,11 +26,11 @@ class _SearchByClinicState extends State { bool nearestAppo = false; String dropdownValue; String projectDropdownValue; - var event = RobotProvider(); + // var event = RobotProvider(); List clinicsList = []; List projectsList = []; bool isMobileAppDentalAllow = false; - + bool isLoaded = false; @override void initState() { WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList()); @@ -56,40 +59,70 @@ class _SearchByClinicState extends State { style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), ], ), - 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("Select Clinic"), - value: dropdownValue, - items: clinicsList.map((item) { - return new DropdownMenuItem( - value: item.clinicID.toString(), - child: new Text(item.clinicDescription), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - dropdownValue = newValue; - if (!isDentalSelectedAndSupported() && !nearestAppo) { - projectDropdownValue = ""; - getDoctorsList(context); - } - }); - }, - ), - )), + 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); + } + }); + }, + // trailing: Icon(TranslationBase.of(AppGlobal.context) + // .locale + // .languageCode == + // 'en' + // ? Icons.keyboard_arrow_right + // : Icons.keyboard_arrow_left), + 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("Select Clinic"), + value: dropdownValue, + items: clinicsList.map((item) { + return new DropdownMenuItem( + value: item.clinicID.toString(), + child: new Text(item.clinicDescription), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + dropdownValue = newValue; + if (!isDentalSelectedAndSupported() && !nearestAppo) { + projectDropdownValue = ""; + getDoctorsList(context); + } + }); + }, + ), + )), isDentalSelectedAndSupported() == true || nearestAppo ? Container( height: 60.0, @@ -168,6 +201,7 @@ class _SearchByClinicState extends State { }); print(projectsList.length); }); + filterClinic(); } else {} }).catchError((err) { print(err); @@ -254,4 +288,17 @@ class _SearchByClinicState extends State { getProjectsList(); }); } + + filterClinic() { + setState(() { + if (widget.clnicIds.length > 0) { + clinicsList = clinicsList + .where((i) => widget.clnicIds.indexOf(i.clinicID) > -1) + .toList(); + isLoaded = true; + + ///print(clinicsList); + } + }); + } } diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 1e7deb38..80288085 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -162,6 +162,7 @@ class _SearchByDoctorState extends State { context, MaterialPageRoute( builder: (context) => SearchResults( + isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 88912a3f..4ba5a9d3 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -27,9 +27,11 @@ class _BranchViewState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, + isBottomBar: false, body: new ListView.builder( itemBuilder: (BuildContext context, int index) { return new ExpandableListView( + isExpanded: index == 0 ? true : false, result2: widget.result, resultDistance: widget.resultDistance, val: index, @@ -46,9 +48,15 @@ class ExpandableListView extends StatefulWidget { final List resultDistance; final List doctorsList2; final val; - + static int doctorListheight = 0; + final bool isExpanded; const ExpandableListView( - {Key key, this.result2, this.resultDistance, this.val, this.doctorsList2}) + {Key key, + this.result2, + this.resultDistance, + this.val, + this.doctorsList2, + this.isExpanded}) : super(key: key); @override @@ -57,9 +65,17 @@ class ExpandableListView extends StatefulWidget { class _ExpandableListViewState extends State { bool expandFlag = false; - + @override + void initState() { + setState(() { + expandFlag = widget.isExpanded; + setDoctorViewHeight(widget.result2[widget.val].toString()); + }); + super.initState(); + } @override Widget build(BuildContext context) { + return new Container( width: MediaQuery.of(context).size.width * 0.6, margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0), @@ -109,6 +125,10 @@ class _ExpandableListViewState extends State { onPressed: () { setState(() { expandFlag = !expandFlag; + if (expandFlag == true) { + setDoctorViewHeight( + widget.result2[widget.val].toString()); + } }); }), ], @@ -128,8 +148,8 @@ class _ExpandableListViewState extends State { widget.doctorsList2[index].projectName.toString() ? DoctorView( //AJ note - doctor: widget.doctorsList2[index] - + doctor: widget.doctorsList2[index], + isLiveCareAppointment: false, // widget.doctorsList2[index] ) : Container(); @@ -143,6 +163,11 @@ class _ExpandableListViewState extends State { ); } + setDoctorViewHeight(name) { + ExpandableListView.doctorListheight = + widget.doctorsList2.where((e) => e.projectName == name).toList().length; + } + String getProjectDistance(String distance) { if (distance != "0") return " - " + distance + " " + TranslationBase.of(context).km; @@ -150,6 +175,9 @@ class _ExpandableListViewState extends State { return ""; } } + + sortByProject() {} + sortByClinic() {} } class ExpandableContainer extends StatelessWidget { @@ -172,9 +200,12 @@ class ExpandableContainer extends StatelessWidget { duration: new Duration(milliseconds: 500), curve: Curves.easeInOut, width: screenWidth, - height: expanded ? MediaQuery.of(context).size.height : collapsedHeight, + height: expanded + ? (ExpandableListView.doctorListheight * 160).toDouble() + : collapsedHeight, child: new Container( child: child, + padding: EdgeInsets.only(bottom: 30), decoration: new BoxDecoration( border: new Border.all(width: 1.0, color: Colors.white)), ), diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index cad9da25..40c0e2fc 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -11,10 +11,11 @@ import '../DoctorProfile.dart'; class DoctorView extends StatelessWidget { final DoctorList doctor; + bool isLiveCareAppointment; - DoctorView({@required this.doctor}); + DoctorView({@required this.doctor, @required this.isLiveCareAppointment}); @override Widget build(BuildContext context) { @@ -186,6 +187,7 @@ class DoctorView extends StatelessWidget { MaterialPageRoute( builder: (context) => DoctorProfile( doctor: docObject, + isLiveCareAppointment: isLiveCareAppointment, docProfileList: docProfile, isOpenAppt: isAppo, ))); diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart new file mode 100644 index 00000000..51b89f98 --- /dev/null +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -0,0 +1,322 @@ +import 'package:device_calendar/device_calendar.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_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/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/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 } + +class AddNewChildPage extends StatefulWidget { + final int frequency; + final int days; + final String itemDescription; + String dateAdd; + + List _scheduleList = List(); + List daysOfWeek = [ + DayOfWeek.Monday, + DayOfWeek.Tuesday, + DayOfWeek.Wednesday, + DayOfWeek.Thursday, + DayOfWeek.Friday, + DayOfWeek.Saturday, + DayOfWeek.Sunday + ]; + + DateTime startDay; + DateTime endDay; + + //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)); + 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))); + } + } + + @override + _AddNewChildPageState createState() => _AddNewChildPageState(); +} + +class _AddNewChildPageState extends State { + int tappedIndex; + int checkedValue; + + @override + void initState() { + super.initState(); + tappedIndex = -1; + } + + TextEditingController _firstTextController = TextEditingController(); + TextEditingController _secondTextController = TextEditingController(); + TextEditingController _notesTextController = TextEditingController(); + BeneficiaryType beneficiaryType = BeneficiaryType.NON; + Gender gender = Gender.Male; + CreateNewUser_New newUserChild = CreateNewUser_New(); + + //ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel(); + List_BabyInformationModel addvancedModel = List_BabyInformationModel(); + CreateNewBaby newChild = CreateNewBaby(); + List_UserInformationModel informationModel = List_UserInformationModel(); + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: "Vaccintion", + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Column( + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 50, + ), + Texts( + "Add the child's information below to recieve the schedule of vaccinations.", + //+model.user.firstName, + textAlign: TextAlign.center, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: "First Name", + controller: _firstTextController, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: "Second Name", + controller: _secondTextController, + ), + SizedBox( + height: 12, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Gender:", + textAlign: TextAlign.end, + ), + ], + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + padding: EdgeInsets.all(12), + + + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: 175, + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 1 ? Colors.white : Colors.black, + color: checkedValue == 1 ? Colors.red : Colors.white, + + label: "Male", + // + onTap: () { + + setState(() { + checkedValue = 1; + print("checkedValue=" + checkedValue.toString()); + }); + + // bloodDetails. + }, + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: 175, + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 2 ? Colors.white : Colors.black, + color: checkedValue == 2 ? Colors.red : Colors.white, + label: "Female", + // + onTap: () { + setState(() { + checkedValue = 2; + print("checkedValue=" + checkedValue.toString()); + }); + // bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, + ), + ) + ], + ), + ), + //========== + SizedBox( + height: 6, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Date Of Birth::", + 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: "Add", + // + onTap: () 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: "Record Added"); + Navigator.pop(context,model.isAdded); + }else{ + + //TODO handling error + } + + }, + ), + ), + //========= + ], + ), + ), + ), + // bottomSheet: + ), + ); + } + + String getStartDay() { + return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}"; + } + + String getEndDay() { + return "${DateUtil.getMonth(widget.endDay.month)} ${widget.endDay.day}, ${widget.endDay.year}"; + } + + String getDateTime(DateTime dateTime) { + return '${dateTime.hour}:${dateTime.minute}'; + } + + String getDays() { + String days = ""; + widget.daysOfWeek.forEach((element) { + days += "${DateUtil.getDay(element)},"; + }); + return days; + } + + void confirmSelectDayDialog() { + showDialog( + context: context, + child: DayCheckBoxDialog( + title: 'Select Day', + selectedDaysOfWeek: widget.daysOfWeek, + onValueSelected: (value) { + setState(() { + widget.daysOfWeek = value; + }); + }, + ), + ); + } +} diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart new file mode 100644 index 00000000..806a5b71 --- /dev/null +++ b/lib/pages/ChildVaccines/child_page.dart @@ -0,0 +1,202 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; +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/ChildVaccines/add_newchild_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.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/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +import 'dialogs/delete_child.dart'; + +class ChildPage extends StatefulWidget { + @override + _ChildPageState createState() => _ChildPageState(); +} + +class _ChildPageState extends State + with SingleTickerProviderStateMixin { + + DeleteBaby deleteBaby = DeleteBaby(); + + @override + Widget build(BuildContext context) { + var checkedValue = true; + return BaseView( + onModelReady: (model) => model.getNewUserOrders(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: " Vaccination", + baseViewModel: model, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 15, right: 15, top: 70), + child: Column( + children: [ + ...List.generate( + model.babyInformationModelList.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: Colors.white, + ), + padding: EdgeInsets.all(12), + width: 200,//double.infinity, + child: Column( + children: [ + Row(children: [ + Texts("CHILD NAME"), + ]), + Row(children: [ + Texts(model + .babyInformationModelList[index] + .babyName + .trim()), + ]), + Row(children: [ + IconButton( + icon: Image.asset(model + .babyInformationModelList[ + index] + .gender == + 1 + ? 'assets/images/new-design/male.png' + : 'assets/images/new-design/female.png'), + tooltip: '', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts(model + .babyInformationModelList[index] + .genderDescription), + IconButton( + icon: Icon( + Icons.remove_red_eye, + color: Colors.red, + ), + tooltip: '', + onPressed: () { + Navigator.push( + context, + FadePage( + + + page: VaccinationTablePage(), + + + ), + ); + + }, + ) + ]), + Row(children: [ + Texts("Birthday"), + ]), + Row(children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/calender-secondary.png'), + tooltip: '', + onPressed: () { + setState(() { + + }); + }, + ), + Texts(DateUtil.yearMonthDay(model + .babyInformationModelList[index] + .dOB)), + ]), + Row(children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/garbage.png'), + tooltip: '', + onPressed: ()async { + + //===================== + await model.deleteBabyOrders(newChild:deleteBaby ); + + + deleteBaby.babyID=model.babyInformationModelList[index] + .babyID; + + await model.deleteBabyOrders(newChild:deleteBaby ); + if(model.isDeleted){ + AppToast.showSuccessToast(message: "Record Deleted"); + Navigator.pop(context,model.isDeleted); + }else{ + + //TODO handling error + } + + + + + + }, + ), + Texts("Delete"), + ]), + SizedBox( + height: 12, + ), + ], + ), + + ), + + + ) + ], + )) + ), + bottomSheet: 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: "ADD NEW CHILD ", + // + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddNewChildPage(), + ), + ).then((value) { + if (value) model.getNewUserOrders(); + }); + }, + ), + ), + )); + } +} diff --git a/lib/pages/ChildVaccines/child_vaccines_page.dart b/lib/pages/ChildVaccines/child_vaccines_page.dart new file mode 100644 index 00000000..92f3a0be --- /dev/null +++ b/lib/pages/ChildVaccines/child_vaccines_page.dart @@ -0,0 +1,226 @@ + +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.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'; + + + +class ChildVaccinesPage 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, + baseViewModel: model, + appBarTitle: " Vaccination",//TranslationBase.of(context).advancePayment, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox( + height: 20, + ), + + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + child: Texts("Welcome back",fontSize: 20,), + ) , + ), + Divider(color:Colors.black , indent: 10, + endIndent: 10,), + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + child: Texts("Please ensure that the email address is up-to-date and process to view the schedule",fontSize: 20,), + ) , + ), + + Divider(color:Colors.black , indent: 10, + endIndent: 10,), + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + fillColor: Colors.red, + + hintText: model.user.emailAddress, + controller: titleController, + fontSize: 20, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + 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;} + }, + ), + ), + ), + 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: "UPDATE EMAIL", + // + onTap: (){ + model.user.emailAddress=addEmail.toString(); + AppToast.showSuccessToast( + message: "Email updated"); + // bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, + + + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + + padding: EdgeInsets.all(15), + child: SecondaryButton( + textColor: Colors.white, + color: Color.fromRGBO(63, 72, 74, 1,), + label: " VIEW LIST OF CHILDREN", + // + onTap: () => Navigator.push( + context, + FadePage( + page: ChildPage(), + + + + ), + ), + + + ), + ), + + // Texts( + // // TranslationBase.of(context).advancePaymentLabel, + // model.user.emailAddress, + // textAlign: TextAlign.center, + // ), + SizedBox( + height: 12, + ), + SizedBox( + height: 12, + ), + SizedBox( + height: 12, + ), + + SizedBox( + height: 12, + ), + + SizedBox( + height: 12, + ), + + SizedBox( + height: 10, + ), + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Center( + // child: Container( + // color: Colors.white, + // 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('cancel'), + // buttonCancelColor: + // Colors.grey, + // onlyCancelButton: true, + // )); + // }, + // child: Container( + // width: 250, + // height: 200, + // child:Image.asset( + // 'assets/images/BloodChrt_EN.png')), + // ), + // ), + // ), + // ], + // ), + + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), + + ), + ), + ); + } +} + diff --git a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart new file mode 100644 index 00000000..259bbdb7 --- /dev/null +++ b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart @@ -0,0 +1,111 @@ +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'; +import 'package:flutter/material.dart'; + +class SelectGenderDialog extends StatefulWidget { + final Email; + + const SelectGenderDialog({Key key, this.Email}) : super(key: key); + @override + _SelectGenderDialogState createState() => _SelectGenderDialogState(); +} + +class _SelectGenderDialogState extends State { + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Container( + child: Column( + children: [ + Divider(), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + //beneficiaryType = Gender.Male; + }); + }, + child: ListTile( + title: Text("Send the child's schedule to the email\n Tamer.dasdasdas@gmail.com "), + + + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + + 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: () { + AppToast.showSuccessToast(message: "Email Sended"); + // 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/ChildVaccines/dialogs/delete_child.dart b/lib/pages/ChildVaccines/dialogs/delete_child.dart new file mode 100644 index 00000000..250f40d3 --- /dev/null +++ b/lib/pages/ChildVaccines/dialogs/delete_child.dart @@ -0,0 +1,103 @@ +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 DeleteChild extends StatefulWidget { + @override + _DeleteChildState createState() => _DeleteChildState(); +} + +class _DeleteChildState extends State { + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Container( + child: Column( + children: [ + Divider(), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + //beneficiaryType = Gender.Male; + }); + }, + child: ListTile( + title: Text("Delete the child "), + + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + + 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(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/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart new file mode 100644 index 00000000..c160acfb --- /dev/null +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -0,0 +1,104 @@ +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/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/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 'dialogs/SelectGenderDialog.dart'; + +class VaccinationTablePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + var checkedValue; + return BaseView( + onModelReady: (model) => model.getCreateVaccinationTable(),//getUserTermsAndConditions(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + baseViewModel: model, + appBarTitle: "Vaccination", + body: SingleChildScrollView( + child:Container( + margin: EdgeInsets.only(left: 15,right: 15,top: 70), + child: Column( + children: [//babyInformationModelList.length + ...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, + + ), + padding: EdgeInsets.all(12), + width: double.infinity, + child: Column( + + children: [ + Row(children: [ + Text(model.creteVaccinationTableModelList[index].visit), + SizedBox(width: 10,), + + 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(model.creteVaccinationTableModelList[index].givenAt), + + + ],), + Divider(color:Colors.black ,), + + ], + ) + + + ) + + ) + ], + ), + + ), + ), + 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 ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), + label: "Send Email ", + // + onTap: () { + //SelectGenderDialog(); +//=============== + showDialog( + context: context, + child: SelectGenderDialog( + ), + ); + //========= + } + + + ), + ), + ), + ); + } +} diff --git a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart index 65e2d7b2..5bffe17c 100644 --- a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart @@ -138,8 +138,7 @@ class _HospitalsLiveChatPageState extends State { ))), //model.cOCItemList[index].cOCTitl IconButton( icon: Icon( - Icons - .arrow_forward, + Icons.arrow_forward_ios, color: tappedIndex == index ? Colors.white diff --git a/lib/pages/ContactUs/hmg_service.dart b/lib/pages/ContactUs/contact_us_page.dart similarity index 93% rename from lib/pages/ContactUs/hmg_service.dart rename to lib/pages/ContactUs/contact_us_page.dart index 4f19e8f8..7d2192f9 100644 --- a/lib/pages/ContactUs/hmg_service.dart +++ b/lib/pages/ContactUs/contact_us_page.dart @@ -6,12 +6,12 @@ import 'package:flutter/material.dart'; import '../../uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/card_common.dart'; -class HmgServicePage extends StatefulWidget { +class ContactUsPage extends StatefulWidget { @override - _HmgServicePageState createState() => _HmgServicePageState(); + _ContactUsPageState createState() => _ContactUsPageState(); } -class _HmgServicePageState extends State { +class _ContactUsPageState extends State { LocationUtils locationUtils; @@ -29,6 +29,7 @@ class _HmgServicePageState extends State { return AppScaffold( isShowAppBar: true,//widget.isAppbar, appBarTitle: "HMG Services",//TranslationBase.of(context).bookAppo, + isShowDecPage: false, body: Container( margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), child: Column( diff --git a/lib/pages/ContactUs/findus/hospitrals_page.dart b/lib/pages/ContactUs/findus/hospitrals_page.dart index b883ae41..d8d898e3 100644 --- a/lib/pages/ContactUs/findus/hospitrals_page.dart +++ b/lib/pages/ContactUs/findus/hospitrals_page.dart @@ -115,7 +115,7 @@ class _HospitalsPageState extends State { CrossAxisAlignment.center, children: [ IconButton( - // icon: Icon(Icons.person_pin_circle_outlined,color: Colors.red,), + // icon: Icon(Icons.location_on,color: Colors.red,), icon: new Image.asset( 'assets/images/new-design/navigate.png'), tooltip: '', diff --git a/lib/pages/ContactUs/findus/pharmacies_page.dart b/lib/pages/ContactUs/findus/pharmacies_page.dart index 5dc44019..663bd3ec 100644 --- a/lib/pages/ContactUs/findus/pharmacies_page.dart +++ b/lib/pages/ContactUs/findus/pharmacies_page.dart @@ -141,7 +141,7 @@ class _PharmaciesPageState extends State { IconButton( // icon: Icon( // Icons - // .person_pin_circle_outlined, + // .location_on, // color: Colors.red, // ), icon: new Image.asset( diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart new file mode 100644 index 00000000..264f828a --- /dev/null +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -0,0 +1,599 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +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/pages/Covid-DriveThru/covid-payment-alert.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.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/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:intl/intl.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; +import 'package:table_calendar/table_calendar.dart'; + +class CovidTimeSlots extends StatefulWidget { + int projectID; + static bool areSlotsAvailable = false; + static DateTime selectedAppoDateTime; + static String selectedDate; + static String selectedTime; + + int selectedClinicID; + int selectedDoctorID; + + PatientShareResponse patientShareResponse; + + CovidTimeSlots({@required this.projectID}); + + @override + _CovidTimeSlotsState createState() => _CovidTimeSlotsState(); +} + +class _CovidTimeSlotsState extends State + with TickerProviderStateMixin { + Map _events; + AnimationController _animationController; + CalendarController _calendarController; + + AppSharedPreferences sharedPref = new AppSharedPreferences(); + + var selectedDate = ""; + dynamic selectedDateJSON; + dynamic jsonFreeSlots; + + List docFreeSlots = []; + List dayEvents = []; + + int selectedButtonIndex = 0; + + dynamic freeSlotsResponse; + + ScrollController _scrollController; + + @override + void initState() { + final _selectedDay = DateTime.now(); + + widget.patientShareResponse = new PatientShareResponse(); + + _scrollController = new ScrollController(); + + _events = { + _selectedDay: ['Event A0'] + }; + + WidgetsBinding.instance.addPostFrameCallback( + (_) => getCovidFreeSlots(context, widget.projectID)); + + _calendarController = CalendarController(); + _animationController = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 50), + ); + + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + _animationController.dispose(); + _calendarController.dispose(); + super.dispose(); + } + + void _onDaySelected(DateTime day, List events) { + final DateFormat formatter = DateFormat('yyyy-MM-dd'); + setState(() { + this.selectedDate = DateUtil.getMonthDayYearDateFormatted(day); + openTimeSlotsPickerForDate(day, docFreeSlots); + CovidTimeSlots.selectedDate = formatter.format(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) { + return AppScaffold( + appBarTitle: "COVID-19 TEST", + 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: 40.0), + child: Text("COVID-19 TEST", + 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("Drive-Thru", + 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(20.0, 0.0, 20.0, 20.0), + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.65, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "Kindly select one of the available appointments from below: ", + 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 + ), + ), + minWidth: + MediaQuery.of(context).size.width * 0.2, + child: index == selectedButtonIndex + ? getSelectedButton(index) + : getNormalButton(index)), + ); + }, + ), + ), + _buildTableCalendarWithBuilders(), + ], + ), + ), + 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("BOOK", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ); + } + + Widget _buildTableCalendarWithBuilders() { + return TableCalendar( + locale: '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, events,holidays) { + _onDaySelected(date, events); + _animationController.forward(from: 0.0); + }, + onVisibleDaysChanged: _onVisibleDaysChanged, + onCalendarCreated: _onCalendarCreated, + ); + } + + openTimeSlotsPickerForDate(DateTime dateStart, List freeSlots) { + dayEvents.clear(); + 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) + CovidTimeSlots.areSlotsAvailable = true; + else + CovidTimeSlots.areSlotsAvailable = false; + + selectedButtonIndex = 0; + + CovidTimeSlots.selectedTime = dayEvents[selectedButtonIndex].isoTime; + }); + } + + Future> _getJSONSlots() async { + Map _eventsParsed; + List slotsList = []; + DateTime date; + 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']); + slotsList.add(FreeSlot(date, ['slot'])); + docFreeSlots.add(TimeSlot( + isoTime: formatter.format(date), + start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), + end: date)); + } + _eventsParsed = + Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); + setState(() { + 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)); + 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 getNormalButton(int index) { + return RaisedButton( + color: Colors.white, + textColor: new Color(0xFF60686b), + onPressed: () { + setState(() { + selectedButtonIndex = index; + CovidTimeSlots.selectedTime = dayEvents[index].isoTime; + print(CovidTimeSlots.selectedTime); + }); + }, + child: Text(dayEvents[index].isoTime, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + ); + } + + Widget getSelectedButton(int index) { + return RaisedButton( + color: Colors.blue[400], + textColor: Colors.white, + onPressed: () { + setState(() { + selectedButtonIndex = index; + CovidTimeSlots.selectedTime = dayEvents[index].isoTime; + print(CovidTimeSlots.selectedTime); + }); + }, + child: Text(dayEvents[index].isoTime, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + ); + } + + bookCovidTestAppointment() { +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => CovidPaymentAlert())); + + DoctorList docObject = new DoctorList(); + docObject.doctorID = widget.selectedDoctorID; + docObject.clinicID = widget.selectedClinicID; + docObject.projectID = widget.projectID; + insertAppointmentCovidTest(context, docObject); + } + + insertAppointmentCovidTest(context, DoctorList docObject) { + DoctorsListService service = new DoctorsListService(); + AppoitmentAllHistoryResultList appo; + service + .insertAppointment( + docObject.doctorID, + docObject.clinicID, + docObject.projectID, + CovidTimeSlots.selectedTime, + CovidTimeSlots.selectedDate, + context) + .then((res) { + print(res); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: "Appointment Booked Successfully"); + Future.delayed(new Duration(milliseconds: 1800), () { + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, + docObject.projectID, docObject); + }); + } else { + appo = new AppoitmentAllHistoryResultList(); + appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; + appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; + appo.projectID = res['SameClinicApptList'][0]['ProjectID']; + appo.endTime = res['SameClinicApptList'][0]['EndTime']; + appo.startTime = res['SameClinicApptList'][0]['StartTime']; + appo.doctorID = res['SameClinicApptList'][0]['DoctorID']; + appo.isLiveCareAppointment = false; + appo.originalClinicID = 0; + appo.originalProjectID = 0; + appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate']; + + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {cancelAppointment(docObject, appo, context)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + }).catchError((err) { + AppToast.showErrorToast(message: err); + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, + BuildContext context) { + ConfirmDialog.closeAlertDialog(context); + DoctorsListService service = new DoctorsListService(); + service.cancelAppointment(appo, context).then((res) { + if (res['MessageStatus'] == 1) { + Future.delayed(new Duration(milliseconds: 1500), () { + insertAppointmentCovidTest(context, docObject); + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + getPatientShare(context, String appointmentNo, int clinicID, int projectID, + DoctorList docObject) { + DoctorsListService service = new DoctorsListService(); + service + .getPatientShare(appointmentNo, clinicID, projectID, context) + .then((res) { + print(res); + widget.patientShareResponse = new PatientShareResponse.fromJson(res); + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + navigateToPaymentAlert(); + }); + } + + navigateToPaymentAlert() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CovidPaymentAlert( + patientShareResponse: widget.patientShareResponse))); + } + + getCovidFreeSlots(BuildContext context, int projectID) { + CovidDriveThruService service = new CovidDriveThruService(); + service.getCovidFreeSlots(context, projectID).then((res) { + print(res['COVID19_FreeTimeSlots']); + if (res['MessageStatus'] == 1) { + if (res['COVID19_FreeTimeSlots'].length != 0) { + freeSlotsResponse = res['COVID19_FreeTimeSlots']; + print(res['COVID19_FreeTimeSlots'].length); + _getJSONSlots().then((value) => { + setState(() => { + widget.selectedClinicID = + freeSlotsResponse[0]['ClinicID'], + widget.selectedDoctorID = + freeSlotsResponse[0]['DoctorID'], + _events.clear(), + _events = value + }) + }); + } else {} + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } +} diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart new file mode 100644 index 00000000..0563c4bd --- /dev/null +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -0,0 +1,305 @@ +import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoResponse.dart'; +import 'package:diplomaticquarterapp/models/CovidDriveThru/DriveThroughTestingCenterModel.dart'; +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/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class CovidDrivethruLocation extends StatefulWidget { + @override + _CovidDrivethruLocationState createState() => _CovidDrivethruLocationState(); +} + +class _CovidDrivethruLocationState extends State { + String projectDropdownValue; + List projectsList = []; + bool isLocationSelected = false; + String projectLat = ""; + String projectLong = ""; + String projectName = ""; + String projectID = ""; + + @override + void initState() { + WidgetsBinding.instance + .addPostFrameCallback((_) => getProjectsList(context)); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "COVID-19 TEST", + isShowAppBar: true, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + child: Text("Get The Result During 8 Hours", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 22.0, + color: Colors.black)), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text( + "We are using the advance technology to test COVID-19, The sample for examination is taking between the nose and mouth (nasopharyngeal swab), the examination is done by ELITE In Genius of the company ELITECH GROUP MOLECULAR DIAGNOSTICS, Note that the device belongs to an Italian company and is manufactured in Japan with RC- PCR​", + style: TextStyle(fontSize: 16.0, color: Colors.black)), + ), + Container( + margin: EdgeInsets.only(top: 20.0), + alignment: Alignment.centerLeft, + child: Text("Select Location", + 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("Select Address"), + value: projectDropdownValue, + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item.iD.toString(), + child: new Text(item.projectName), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + projectDropdownValue = newValue; + setProjectLocation(newValue); + }); + }, + ), + )), + isLocationSelected + ? Container( + margin: EdgeInsets.only(top: 15.0), + alignment: Alignment.centerLeft, + child: Text("Selected Location", + 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"), + ) + : Container(), + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.15, + width: double.infinity, + child: Column( + 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("GET DIRECTIONS", 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("BACK", 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: () { + next(); + }, + child: Text("NEXT", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ); + } + + getDirections() { + if (isLocationSelected) { + MapsLauncher.launchCoordinates(double.parse(projectLat), + double.parse(projectLong), this.projectName); + } else { + Utils.showErrorToast( + "Please select address from the dropdown menu to get directions"); + } + } + + next() { + if (isLocationSelected) { + getPaymentInfo(context, projectID); + } else { + Utils.showErrorToast( + "Please select address from the dropdown menu to continue"); + } + } + + back() { + Navigator.of(context).popAndPushNamed(HOME); + } + + setProjectLocation(newValue) { + print(newValue); + setState(() { + this.projectLat = + projectsList[(int.parse(newValue) - 1)].latitude.toString(); + this.projectLong = + projectsList[(int.parse(newValue) - 1)].longitude.toString(); + this.projectName = projectsList[(int.parse(newValue) - 1)].projectName; + this.projectID = + projectsList[(int.parse(newValue) - 1)].projectID.toString(); + isLocationSelected = true; + }); + } + + getPaymentInfo(BuildContext context, String projectID) { + CovidDriveThruService service = new CovidDriveThruService(); + + CovidPaymentInfoResponse covidPaymentInfoResponse = + new CovidPaymentInfoResponse(); + + service + .getCovidPaymentInformation(context, int.parse(projectID)) + .then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + covidPaymentInfoResponse = CovidPaymentInfoResponse.fromJson( + res['COVID19_PatientShare']); + print(covidPaymentInfoResponse.procedureNameField); + }); + } else {} + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CovidPaymentDetails( + covidPaymentInfoResponse: covidPaymentInfoResponse, + projectID: int.parse(projectID), + ))); + }); + } + + getProjectsList(BuildContext context) { + CovidDriveThruService service = new CovidDriveThruService(); + service.getCovidProjectsList(context).then((res) { + print(res); + if (res['MessageStatus'] == 1) { + print(res); + setState(() { + res['List_COVID19_ProjectDriveThroughTestingCenter'].forEach((v) { + projectsList.add(new DriveThroughTestingCenterModel.fromJson(v)); + }); + }); + } else {} + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } +} diff --git a/lib/pages/Covid-DriveThru/covid-payment-alert.dart b/lib/pages/Covid-DriveThru/covid-payment-alert.dart new file mode 100644 index 00000000..ac5f45fc --- /dev/null +++ b/lib/pages/Covid-DriveThru/covid-payment-alert.dart @@ -0,0 +1,288 @@ +import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.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'; + +class CovidPaymentAlert extends StatefulWidget { + PatientShareResponse patientShareResponse; + + CovidPaymentAlert({@required this.patientShareResponse}); + + @override + _CovidPaymentAlertState createState() => _CovidPaymentAlertState(); +} + +class _CovidPaymentAlertState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "COVID-19 TEST", + isShowAppBar: true, + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 200.0, + color: new Color(0xFFc5272d), + child: Row( + 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, + children: [ + Container( + margin: EdgeInsets.only(left: 30.0, right: 20.0), + child: Text("Alert", + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 24.0)), + ), + Container( + width: MediaQuery.of(context).size.width * 0.55, + margin: EdgeInsets.only( + left: 30.0, right: 20.0, top: 5.0), + child: Text( + "Pay With-in 15 mins to confirm the appointment", + overflow: TextOverflow.clip, + style: TextStyle( + color: Colors.white, fontSize: 20.0)), + ), + ], + ), + ), + ], + ), + ), + 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("Pay With-in 15 mins", + 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( + "Payment for Covid-19 Test should Be made with-in 15 mins otherwise The system will Cancel the Scheduled appointment automatically​.", + 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), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only( + top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), + child: Text("COVID-19 TEST", + 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])), + ), + ], + ), + ), + 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])), + ), + ], + ), + ), + 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", + style: TextStyle( + fontSize: 18.0, color: Colors.grey[700])), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + 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("NEXT", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ); + } + + String getDate(String appoDate) { + var appoDateFormatted = ""; + + var dateObj = DateUtil.convertStringToDate(appoDate); + + setState(() { + appoDateFormatted = DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString() + + " " + + dateObj.hour.toString() + + ":" + + dateObj.minute.toString() + + ":00"; + }); + return appoDateFormatted; + } +} diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart new file mode 100644 index 00000000..1254997d --- /dev/null +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -0,0 +1,257 @@ +import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoResponse.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/Covid-TimeSlots.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'; + +class CovidPaymentDetails extends StatefulWidget { + CovidPaymentInfoResponse covidPaymentInfoResponse; + int projectID; + + CovidPaymentDetails( + {@required this.covidPaymentInfoResponse, @required this.projectID}); + + @override + _CovidPaymentDetailsState createState() => _CovidPaymentDetailsState(); +} + +class _CovidPaymentDetailsState extends State { + bool isAgree = false; + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "COVID-19 TEST", + 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: 40.0), + child: Text("COVID-19 TEST", + 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("Drive-Thru", + 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(20.0, 0.0, 20.0, 20.0), + child: Column( + children: [ + Container( + alignment: Alignment.center, + margin: + EdgeInsets.only(left: 0.0, right: 20.0, top: 30.0), + child: Text("Test Fees", + style: TextStyle( + color: Colors.black, + fontSize: 22.0, + fontWeight: FontWeight.bold)), + ), + 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, 15.0, 0.0, 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Checkbox( + value: isAgree, + onChanged: (value) { + setState(() { + isAgree = !isAgree; + }); + }, + activeColor: Colors.blue, + ), + Texts(TranslationBase.of(context) + .iAgreeToTheTermsAndConditions), + ], + ), + ), + Divider( + color: Colors.grey, + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(20.0, 15.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), + ), + ], + ), + ), + ), + 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("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("NEXT", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ); + } + + void next() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CovidTimeSlots( + projectID: widget.projectID, + ))); + } + + cancel() { + Navigator.pop(context); + } + + _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])), + ); + } +} diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index 9c4dfa29..ec96f482 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; @@ -9,6 +10,9 @@ 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 'AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart'; +import 'OrderLogPage.dart'; + class AmbulanceReq extends StatefulWidget { @override _AmbulanceReqState createState() => _AmbulanceReqState(); @@ -23,18 +27,21 @@ class _AmbulanceReqState extends State super.initState(); _tabController = TabController(length: 2, vsync: this); } + @override void dispose() { super.dispose(); _tabController.dispose(); } + @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getPrescriptions(), + return BaseView( + onModelReady: (model) => model.getAmRequestOrders(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, appBarTitle: "Ambulance Request", + baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -76,13 +83,14 @@ class _AmbulanceReqState extends State indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + 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("Ambulance Request"),//TranslationBase.of(context).prescriptions + child: Texts( + "Ambulance Request"), //TranslationBase.of(context).prescriptions ), ), Container( @@ -106,11 +114,13 @@ class _AmbulanceReqState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - PrescriptionsPage( - prescriptionsViewModel: model, - ), - PrescriptionsHistoryPage( - prescriptionsViewModel: model, + model.hasPendingOrder + ? Container() + : AmbulanceRequestIndexPage( + amRequestViewModel: model, + ), + OrderLogPage( + amRequestViewModel: model, ) ], ), @@ -121,5 +131,4 @@ class _AmbulanceReqState extends State ), ); } - } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart new file mode 100644 index 00000000..55e75e22 --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -0,0 +1,87 @@ +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/pages/ErService/widgets/StepsWidget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; + +import 'BillAmount.dart'; +import 'PickupLocation.dart'; +import 'SelectTransportationMethod.dart'; +import 'Summary.dart'; + +class AmbulanceRequestIndexPage extends StatefulWidget { + final AmRequestViewModel amRequestViewModel; + + AmbulanceRequestIndexPage({Key key, this.amRequestViewModel}); + + @override + _AmbulanceRequestIndexPageState createState() => _AmbulanceRequestIndexPageState(); +} + +class _AmbulanceRequestIndexPageState extends State { + int currentIndex = 0; + PageController pageController; + PatientER _patientER = PatientER(); + + _changeCurrentTab(int tab) { + setState(() { + currentIndex = tab; + }); + pageController.animateToPage(tab, + duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); + } + + @override + void initState() { + super.initState(); + pageController = new PageController(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + body: Column( + children: [ + SizedBox( + height: 80, + ), + Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: StepsWidget( + index: currentIndex, + changeCurrentTab: _changeCurrentTab, + )), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + //Container(), + SelectTransportationMethod( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + PickupLocation( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + BillAmount( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + Summary( + changeCurrentTab: _changeCurrentTab, + patientER: _patientER, + amRequestViewModel: widget.amRequestViewModel, + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart new file mode 100644 index 00000000..cc6af0f2 --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart @@ -0,0 +1,351 @@ +import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +class BillAmount extends StatefulWidget { + final Function changeCurrentTab; + final PatientER patientER; + final AmRequestViewModel amRequestViewModel; + + BillAmount( + {Key key, + this.changeCurrentTab, + this.patientER, + this.amRequestViewModel}); + + @override + _BillAmountState createState() => _BillAmountState(); +} + +class _BillAmountState extends State { + Ambulate _ambulate = Ambulate.None; + String note =""; + + + @override + void initState() { + + if(widget.patientER.ambulate!=null) + { + setState(() { + _ambulate = widget.patientER.ambulate; + note = widget.patientER.requesterNote; + }); + } + super.initState(); + } + + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Bill Amount '), + 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( + 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( + 'Amount before tax: ', + textAlign: TextAlign.start, + color: Colors.black, + fontSize: 15, + ), + ), + ), + 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( + 'SR ${widget.patientER.patientERTransportationMethod.price}', + color: Colors.black, + textAlign: TextAlign.start, + fontSize: 15, + ), + ), + ), + ], + ), + TableRow( + children: [ + Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.09, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'Tax amount :', + 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( + 'SR ${widget.patientER.patientERTransportationMethod.vAT}', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), + ), + ), + ], + ), + 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( + 'Total amount payable', + 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( + 'SR ${widget.patientER.patientERTransportationMethod.totalPrice}', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), + ), + ), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Texts('Select Ambulate',bold: true,), + 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('Wheelchair'), + leading: Radio( + value: Ambulate.Wheelchair, + groupValue: _ambulate, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + ), + ), + ), + ), + 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('Walker'), + leading: Radio( + value: Ambulate.Walker, + groupValue: _ambulate, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + ), + ), + ), + ), + ], + ), + 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('Stretcher'), + leading: Radio( + value: Ambulate.Stretcher, + groupValue: _ambulate, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + ), + ), + ), + ), + 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('None'), + leading: Radio( + value: Ambulate.None, + groupValue: _ambulate, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + ), + ), + ), + ), + ], + ), + SizedBox(height: 12,), + NewTextFields( + hintText: 'Note', + initialValue: note, + onChanged: (value){ + setState(() { + note = value; + }); + }, + ), + + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 76, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientER.ambulate = _ambulate; + widget.patientER.requesterNote = note; + widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); + widget.changeCurrentTab(3); + }); + }, + label: 'Next', + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart new file mode 100644 index 00000000..795f4dcc --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -0,0 +1,473 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.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/pages/landing/home_page.dart'; +import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.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'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +import '../AmbulanceReq.dart'; +import '../AvailableAppointmentsPage.dart'; + +enum HaveAppointment { YES, NO } + +class PickupLocation extends StatefulWidget { + final Function changeCurrentTab; + final PatientER patientER; + final AmRequestViewModel amRequestViewModel; + + PickupLocation( + {Key key, + this.changeCurrentTab, + this.patientER, + this.amRequestViewModel}); + + @override + _PickupLocationState createState() => _PickupLocationState(); +} + +class _PickupLocationState extends State { + bool _isInsideHome = false; + HaveAppointment _haveAppointment = HaveAppointment.NO; + double _latitude; + double _longitude; + AppoitmentAllHistoryResultList myAppointment; + HospitalsModel _selectedHospital; + PickResult _result; + + @override + void initState() { + super.initState(); + _getCurrentLocation(); + } + + _getCurrentLocation() async { + await getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); + // currentLocation = LatLng(position.latitude, position.longitude); + } + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.patientER.direction == 1) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Pickup Location'), + SizedBox( + height: 15, + ), + 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, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts('Select From Map'), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], + ), + ), + SizedBox( + height: 12, + ), + Texts('Pickup Spot'), + SizedBox( + height: 5, + ), + InkWell( + onTap: () { + setState(() { + _isInsideHome = !_isInsideHome; + }); + }, + 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('Inside Home'), + leading: Checkbox( + activeColor: Colors.red[800], + value: _isInsideHome, + onChanged: (value) { + setState(() { + _isInsideHome = value; + }); + }, + ), + ), + ), + ), + SizedBox( + height: 12, + ), + Texts('Do you have an appointment ?'), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = HaveAppointment.YES; + }); + } + }, + 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('Yes'), + leading: Radio( + value: HaveAppointment.YES, + groupValue: _haveAppointment, + activeColor: Colors.red[800], + onChanged: (value) { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = value; + }); + } + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + _haveAppointment = HaveAppointment.NO; + myAppointment = null; + }); + }, + 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('No'), + leading: Radio( + value: HaveAppointment.NO, + groupValue: _haveAppointment, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _haveAppointment = value; + myAppointment = null; + }); + }, + ), + ), + ), + ), + ), + ], + ), + if (myAppointment != null) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + AppointmentCard( + appointment: myAppointment, + ) + ], + ), + SizedBox( + height: 12, + ), + Texts('Drop off Location'), + 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, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName('Pickup Location')), + Icon( + Icons.arrow_drop_down, + size: 24, + color: Colors.black, + ) + ], + ), + ), + ), + ], + ), + if (widget.patientER.direction == 1) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Pickup Location'), + 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, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName('Pickup Location')), + Icon( + Icons.arrow_drop_down, + size: 24, + color: Colors.black, + ) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + Texts('Drop off Location'), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PlacePicker( + apiKey: 'AIzaSyCiD4YqVqLNYbt8-htvFy4Wp8XSph9E3wM​', + // Put YOUR OWN KEY here. + onPlacePicked: (PickResult result) { + print(result.adrAddress); + setState(() { + _result = result; + }); + Navigator.of(context).pop(); + }, + initialPosition: LatLng(_latitude, _longitude), + useCurrentLocation: true, + ), + ), + ); + }, + 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, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts('Select From Map'), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], + ), + ), + ), + ], + ), + //TODO show dialog projects + + SizedBox( + height: 45, + ), + Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 76, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + if(_result==null || _selectedHospital == null) + AppToast.showErrorToast(message: 'please select all fields'); + else + setState(() { + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + if (widget.patientER.direction == 0) { + widget.patientER.pickupLocationLattitude = _result.geometry.location.lat.toString(); + widget.patientER.pickupLocationLongitude = _result.geometry.location.lng.toString(); + widget.patientER.dropoffLocationLattitude = _selectedHospital.latitude; + widget.patientER.dropoffLocationLongitude = _selectedHospital.longitude; + + } else { + widget.patientER.pickupLocationLattitude = _selectedHospital.latitude; + widget.patientER.pickupLocationLongitude = _selectedHospital.longitude; + widget.patientER.dropoffLocationLattitude = _result.geometry.location.lat.toString(); + widget.patientER.dropoffLocationLongitude = _result.geometry.location.lng.toString(); + } + + widget.patientER.latitude = widget.patientER.pickupLocationLattitude; + widget.patientER.longitude = widget.patientER.pickupLocationLongitude; + + if(_haveAppointment == HaveAppointment.YES){ + widget.patientER.appointmentNo = myAppointment.appointmentNo.toString(); + widget.patientER.appointmentClinicName = myAppointment.clinicName; + widget.patientER.appointmentDoctorName = myAppointment.doctorNameObj; + widget.patientER.appointmentBranch = myAppointment.projectName; + widget.patientER.appointmentTime = myAppointment.appointmentDate; + }else{ + widget.patientER.appointmentNo ="0"; + widget.patientER.appointmentClinicName = null; + widget.patientER.appointmentDoctorName = null; + widget.patientER.appointmentBranch = null; + widget.patientER.appointmentTime = null; + } + + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + widget.changeCurrentTab(2); + }); + }, + label: 'Next', + ), + ) + ], + ), + ), + ); + } + + void confirmSelectHospitalDialog(List hospitals) { + showDialog( + context: context, + child: SelectHospitalDialog( + hospitals: hospitals, + selectedHospital: _selectedHospital, + onValueSelected: (value) { + setState(() { + _selectedHospital = value; + }); + }, + ), + ); + } + + String getHospitalName(String title) { + return _selectedHospital == null ? title : _selectedHospital.name; + } + + getAppointment() { + ProgressDialogUtil.showProgressDialog(context); + widget.amRequestViewModel.getAppointmentHistory().then((value) { + if (widget.amRequestViewModel.state == ViewState.Error || + widget.amRequestViewModel.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: widget.amRequestViewModel.error); + } else if (widget + .amRequestViewModel.appoitmentAllHistoryResultList.length > + 0) { + ProgressDialogUtil.hideProgressDialog(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AvailableAppointmentsPage( + appointmentsAllHistoryList: + widget.amRequestViewModel.appoitmentAllHistoryResultList, + ), + ), + ).then((value) { + if (value != null) + setState(() { + myAppointment = value; + }); + else { + ProgressDialogUtil.hideProgressDialog(context); + setState(() { + _haveAppointment = HaveAppointment.NO; + }); + } + }); + } else { + ProgressDialogUtil.hideProgressDialog(context); + setState(() { + _haveAppointment = HaveAppointment.NO; + }); + AppToast.showErrorToast(message: 'You don\'t have any appointment'); + } + }).catchError((e) { + ProgressDialogUtil.hideProgressDialog(context); + AppToast.showErrorToast(message: e); + }); + } +} diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart new file mode 100644 index 00000000..59c3b85c --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -0,0 +1,309 @@ +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +enum Direction { ToHospital, FromHospital } +enum Way { OneWay, TwoWays } + +class SelectTransportationMethod extends StatefulWidget { + final Function changeCurrentTab; + final PatientER patientER; + final AmRequestViewModel amRequestViewModel; + + SelectTransportationMethod( + {Key key, + this.changeCurrentTab, + this.patientER, + this.amRequestViewModel}); + + @override + _SelectTransportationMethodState createState() => + _SelectTransportationMethodState(); +} + +class _SelectTransportationMethodState + extends State { + PatientERTransportationMethod _erTransportationMethod = + PatientERTransportationMethod(); + Direction _direction = Direction.FromHospital; + Way _way = Way.OneWay; + + OrderService _orderService = OrderService.AMBULANCE; + + @override + void initState() { + super.initState(); + if (widget.patientER.direction != null) { + _direction = widget.patientER.direction == 0 + ? Direction.ToHospital + : Direction.FromHospital; + _way = widget.patientER.tripType == 1 ? Way.OneWay : Way.TwoWays; + _erTransportationMethod = widget.amRequestViewModel + .amRequestModeList[(widget.patientER.selectedAmbulate - 1)]; + } else { + if (widget.amRequestViewModel.amRequestModeList.length != 0) + _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[ + widget.amRequestViewModel.amRequestModeList.length - 1]; + } + } + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Texts('Select Transportation Method'), + ...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: Text(widget.amRequestViewModel + .amRequestModeList[index].title), + leading: Radio( + value: widget + .amRequestViewModel.amRequestModeList[index], + groupValue: _erTransportationMethod, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _erTransportationMethod = value; + }); + }, + ), + ), + ), + Expanded( + flex: 1, + child: Texts( + 'SR ${widget.amRequestViewModel.amRequestModeList[index].price}'), + ) + ], + ), + ), + ), + ), + SizedBox( + height: 12, + ), + Texts('Select Direction'), + SizedBox( + height: 5, + ), + Container( + width: double.maxFinite, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _direction = Direction.ToHospital; + }); + }, + 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: Text('To Hospital'), + leading: Radio( + value: Direction.ToHospital, + groupValue: _direction, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + _direction = Direction.FromHospital; + }); + }, + 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: Text('Form Hospital'), + leading: Radio( + value: Direction.FromHospital, + groupValue: _direction, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), + ), + ), + ), + ), + ], + ), + ), + if (_direction == Direction.ToHospital) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, + ), + Texts('Select Direction'), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _way = Way.OneWay; + }); + }, + 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('One Way'), + leading: Radio( + value: Way.OneWay, + groupValue: _way, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + setState(() { + _way = Way.TwoWays; + }); + }, + 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('Two Ways'), + leading: Radio( + value: Way.TwoWays, + groupValue: _way, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), + ), + ), + ), + ), + ], + ), + ], + ), + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 76, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientER.direction = _direction == Direction.ToHospital ? 0 : 1; + widget.patientER.tripType = _way == Way.TwoWays ? 2 : 1; + widget.patientER.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); + widget.patientER.patientERTransportationMethod = _erTransportationMethod; + widget.patientER.orderServiceID = _orderService.getIdOrderService(); + widget.patientER.pickupUrgency = 1; + widget.patientER.lineItemNo = 1; + widget.patientER.cost = _erTransportationMethod.price; + widget.patientER.vAT = _erTransportationMethod.vAT ?? 0; + widget.patientER.totalPrice = _erTransportationMethod.totalPrice; + + widget.changeCurrentTab(1); + }); + }, + label: 'Next', + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart new file mode 100644 index 00000000..4c189707 --- /dev/null +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -0,0 +1,105 @@ +import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; + +class Summary extends StatefulWidget { + final Function changeCurrentTab; + final PatientER patientER; + final AmRequestViewModel amRequestViewModel; + + Summary({Key key, this.changeCurrentTab, this.patientER, this.amRequestViewModel}); + + @override + _SummaryState createState() => _SummaryState(); +} + +class _SummaryState extends State { + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Summary'), + SizedBox(height: 5,), + Container( + width: double.infinity, + + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Transportation Method',color: Colors.grey,), + Texts('${widget.patientER.patientERTransportationMethod.title}',bold: true,), + SizedBox(height: 8,), + + Texts('Direction',color: Colors.grey,), + Texts('From Hospital',bold: true,), + SizedBox(height: 8,), + + Texts('Pickup Location',color: Colors.grey,), + Texts('SZR Medical Center',bold: true,), + SizedBox(height: 8,), + + Texts('Drop off location',color: Colors.grey,), + Texts('6199, Al Ameen wlfn nif',bold: true,), + SizedBox(height: 8,), + + Texts('Select Ambulate',color: Colors.grey,), + Texts('${widget.patientER.ambulate.getAmbulateTitle(context)}',bold: true,), + SizedBox(height: 8,), + + Texts('Note',color: Colors.grey,), + Texts('${widget.patientER.requesterNote?? '---'}',bold: true,), + SizedBox(height: 8,), + ], + ), + ), + SizedBox(height: 20,), + Texts('Bill Amount',textAlign: TextAlign.start,), + SizedBox(height: 5,), + Container( + height: 55, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts('Total amount payable:'), + Texts('SR ${widget.patientER.patientERTransportationMethod.totalPrice}') + ], + ), + ), + + SizedBox(height: 45,), + Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 76, + child:SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + label: 'Next', + + // onTap: ()=> widget.changeCurrentTab(2), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/ErService/AvailableAppointmentsPage.dart b/lib/pages/ErService/AvailableAppointmentsPage.dart new file mode 100644 index 00000000..7180d5dd --- /dev/null +++ b/lib/pages/ErService/AvailableAppointmentsPage.dart @@ -0,0 +1,45 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.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'; + +class AvailableAppointmentsPage extends StatelessWidget { + final List appointmentsAllHistoryList; + + const AvailableAppointmentsPage({Key key, this.appointmentsAllHistoryList}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Available Appointments', + body: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts('Available Appointments'), + SizedBox( + height: 12, + ), + ...List.generate( + appointmentsAllHistoryList.length, + (index) => InkWell( + onTap: (){ + Navigator.pop(context, appointmentsAllHistoryList[index]); + }, + child: AppointmentCard(appointment: appointmentsAllHistoryList[index],), + ), + ) + ], + ), + ), + ), + ); + } +} + + diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart new file mode 100644 index 00000000..cbb508e5 --- /dev/null +++ b/lib/pages/ErService/OrderLogPage.dart @@ -0,0 +1,62 @@ +import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class OrderLogPage extends StatelessWidget { + final AmRequestViewModel amRequestViewModel; + + OrderLogPage({Key key, @required this.amRequestViewModel}); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(8), + child: ListView.builder( + itemCount: amRequestViewModel.patientAllPresOrdersList.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: 'Request ID', + value: amRequestViewModel.patientAllPresOrdersList[index].iD + .toString(), + ), + OrderLogItem( + title: 'Status', + value: amRequestViewModel + .patientAllPresOrdersList[index].description, + ), + OrderLogItem( + title: 'Pickup Date', + value: DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(amRequestViewModel + .patientAllPresOrdersList[index].createdOn)), + ), + OrderLogItem( + title: 'Pickup Location', + value: amRequestViewModel + .patientAllPresOrdersList[index].pickupLocationName, + ), + OrderLogItem( + title: 'Drop off Location', + value: amRequestViewModel + .patientAllPresOrdersList[index].dropoffLocationName, + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/ErService/widgets/AppointmentCard.dart b/lib/pages/ErService/widgets/AppointmentCard.dart new file mode 100644 index 00000000..0437c32f --- /dev/null +++ b/lib/pages/ErService/widgets/AppointmentCard.dart @@ -0,0 +1,47 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AppointmentCard extends StatelessWidget { + final AppoitmentAllHistoryResultList appointment; + + const AppointmentCard({Key key, this.appointment}) : super(key: key); + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + margin: EdgeInsets.all(8), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + LargeAvatar( + url: appointment.doctorImageURL, + name: appointment.doctorNameObj, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(appointment.doctorNameObj,bold: true,), + SizedBox(height: 4,), + Texts(appointment.projectName), + Texts(appointment.clinicName), + Texts(DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(appointment.bookDate))), + ], + ), + ), + ) + ], + ), + ); + } +} diff --git a/lib/pages/ErService/widgets/StepsWidget.dart b/lib/pages/ErService/widgets/StepsWidget.dart new file mode 100644 index 00000000..c5864710 --- /dev/null +++ b/lib/pages/ErService/widgets/StepsWidget.dart @@ -0,0 +1,226 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class StepsWidget extends StatelessWidget { + final int index; + final Function changeCurrentTab; + + StepsWidget({Key key, this.index, this.changeCurrentTab}); + + @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.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], + ), + ), + ), + ), + ), + ], + ):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], + ), + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index dc6fc65c..379c6e71 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -1,7 +1,9 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.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/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; @@ -30,7 +32,7 @@ class _MyAppointmentsState extends State TabController _tabController; bool isDataLoaded = false; - + var sharedPref = new AppSharedPreferences(); @override void initState() { _tabController = new TabController(length: 3, vsync: this); @@ -203,100 +205,114 @@ class _MyAppointmentsState extends State }); } - openAppointmentsTab() { - if (widget._patientBookedAppointmentListHospital.length != 0) { + openAppointmentsTab() async { + var flag = await this.sharedPref.getInt(IS_SEARCH_APPO); + + if (flag == 1) { _tabController.index = 0; - } else if (widget._patientConfirmedAppointmentListHospital.length != 0) { + } else if (flag == 2) { _tabController.index = 1; - } else if (widget._patientArrivedAppointmentListHospital.length != 0) { + } else if (flag == 3) { _tabController.index = 2; - return; + } else { + if (widget._patientBookedAppointmentListHospital.length != 0) { + _tabController.index = 0; + } else if (widget._patientConfirmedAppointmentListHospital.length != 0) { + _tabController.index = 1; + } else if (widget._patientArrivedAppointmentListHospital.length != 0) { + _tabController.index = 2; + return; + } } } Widget getBookedAppointments() { return Container( - child: widget.bookedAppoList.length != 0 - ? new ListView.builder( - itemCount: widget.bookedAppoList.length, - itemBuilder: (context, i) { - return AppointmentCard( - appo: widget.bookedAppoList[i], - onReloadAppointmentHistory: getPatientAppointmentHistory, - ); - }, - ) - : 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).noBookedAppointments, - style: TextStyle( - fontSize: 16.0, - )), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Container( - child: widget.bookedAppoList.length != 0 - ? SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - ...List.generate( - widget._patientBookedAppointmentListHospital.length, + child: widget.bookedAppoList.length != 0 + ? new ListView.builder( + itemCount: widget.bookedAppoList.length, + itemBuilder: (context, i) { + return AppointmentCard( + appo: widget.bookedAppoList[i], + onReloadAppointmentHistory: getPatientAppointmentHistory, + ); + }, + ) + : 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).noBookedAppointments, + // style: TextStyle( + // fontSize: 16.0, + // )), + // ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Container( + child: widget.bookedAppoList.length != 0 + ? SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + ...List.generate( + widget._patientBookedAppointmentListHospital + .length, (index) => AppExpandableNotifier( - title: widget - ._patientBookedAppointmentListHospital[index] - .filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientBookedAppointmentListHospital[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("No Booked Appointments", - style: TextStyle( - fontSize: 16.0, - )), + title: widget + ._patientBookedAppointmentListHospital[ + index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: widget + ._patientBookedAppointmentListHospital[ + 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("No Booked Appointments", + style: TextStyle( + fontSize: 16.0, + )), + ), + ], ), - ], + ), ), - ), - ), - ), - ) - ], - - )))); + ), + ) + ], + )))); } Widget getConfirmedAppointments() { @@ -341,7 +357,8 @@ class _MyAppointmentsState extends State Image.asset("assets/images/new-design/noAppointmentIcon.png"), Container( margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noConfirmedAppointments , + child: Text( + TranslationBase.of(context).noConfirmedAppointments, style: TextStyle( fontSize: 16.0, )), @@ -363,23 +380,24 @@ class _MyAppointmentsState extends State ...List.generate( widget._patientArrivedAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget + title: widget + ._patientArrivedAppointmentListHospital[index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget ._patientArrivedAppointmentListHospital[index] - .filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientArrivedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), - )), + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), + ), + ), ) ], ), @@ -394,10 +412,11 @@ class _MyAppointmentsState extends State Image.asset("assets/images/new-design/noAppointmentIcon.png"), Container( margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noArrivedAppointments, - style: TextStyle( - fontSize: 16.0, - )), + child: + Text(TranslationBase.of(context).noArrivedAppointments, + style: TextStyle( + fontSize: 16.0, + )), ), ], ), diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 19e82086..18740ce7 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -352,18 +352,24 @@ class _AppointmentActionsState extends State { cancelAppointment() { ConfirmDialog.closeAlertDialog(context); DoctorsListService service = new DoctorsListService(); - service.cancelAppointment(widget.appo, context).then((res) { - print(res); - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - Navigator.of(context).pop(); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + service + .cancelAppointment(widget.appo, context) + .then((res) { + print(res); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + Navigator.of(context).pop(); + }); } openAppointmentRadiology() { @@ -468,8 +474,7 @@ class _AppointmentActionsState extends State { } }).catchError((err) { print(err); - AppToast.showErrorToast( - message: err); + AppToast.showErrorToast(message: err); }).showProgressBar( text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } @@ -540,7 +545,7 @@ class _AppointmentActionsState extends State { DoctorsListService service = new DoctorsListService(); service .confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, - widget.appo.projectID, context) + widget.appo.projectID, widget.appo.isLiveCareAppointment, context) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index b64bd232..71bde484 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -24,7 +24,7 @@ class _ApointmentCardState extends State { navigateToAppointmentDetails(context, widget.appo); }, child: Card( - margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0), + // margin: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 8.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -95,7 +95,8 @@ class _ApointmentCardState extends State { emptyIcon: Icons.star, ), Container( - transform: Matrix4.translationValues(15.0, -40.0, 0.0), + transform: + Matrix4.translationValues(15.0, -40.0, 0.0), child: Image.asset( "assets/images/new-design/arrow.png", width: 25.0, diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index dc96864a..7c20b53d 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -37,8 +38,6 @@ class _ToDoState extends State { @override void initState() { -// authUser = authProvider.getAuthenticatedUser(); - print("initState!!!!!"); widget.patientShareResponse = new PatientShareResponse(); WidgetsBinding.instance .addPostFrameCallback((_) => getPatientAppointmentHistory()); @@ -50,205 +49,230 @@ class _ToDoState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, body: SingleChildScrollView( - child: Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: widget.appoList.length, - itemBuilder: (context, index) { - 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), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Row( + child: Column( + children: [ + Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: widget.appoList.length, + itemBuilder: (context, index) { + 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), + ), + child: Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + 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: 30.0), - child: Text( - getDate( - widget.appoList[index].appointmentDate), - style: TextStyle(fontSize: 12.0)), + Row( + children: [ + Image.asset( + "assets/images/new-design/time_icon.png", + width: 20.0, + height: 20.0), + Container( + margin: + EdgeInsets.only(left: 5.0, right: 25.0), + child: Text( + getDate(widget + .appoList[index].appointmentDate), + style: TextStyle(fontSize: 11.0)), + ), + widget.appoList[index].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: 5.0, right: 5.0), + child: widget + .appoList[index].isLiveCareAppointment + ? Text( + TranslationBase.of(context) + .liveCareAppo, + style: TextStyle(fontSize: 12.0)) + : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", + style: TextStyle(fontSize: 11.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: Text(widget.appoList[index].projectName, - style: TextStyle(fontSize: 12.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), - ), + margin: EdgeInsets.only(top: 5.0), + child: Divider( + color: Colors.grey[500], ), ), - 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.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)), + 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), ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, + ), + ), + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 20.0, left: 20.0, right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, 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, + 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, + ), + ], ), ], ), - ], + ), ), - ), + 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)), + ) + ], + ), + ), + ), + ) + ], ), - 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])), ), ), - ), - ) - ], - ), - 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: Colors.red[600], + decoration: + TextDecoration.underline)), + ), + ), + ) + ], ), - 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: Colors.red[600], - decoration: - TextDecoration.underline)), - ), - ), - ) ], ), - ], + ), ), - ), - ), - ); - }, - ), + ); + }, + ), + ), + SizedBox( + height: 120.0, + ), + ], ), ), ); @@ -284,7 +308,11 @@ class _ToDoState extends State { break; case 50: - return "assets/images/new-design/liveCare_logo_icon.png"; + return "assets/images/new-design/confirm_button.png"; + break; + + case 60: + return "assets/images/new-design/waiting_for_doctor.png"; break; default: @@ -297,14 +325,17 @@ class _ToDoState extends State { case 10: confirmAppointment(appo); break; - case 20: getPatientShare(context, appo); break; - case 30: getAppoQR(context, appo); break; + case 50: + confirmAppointment(appo); + break; + case 60: + break; } } @@ -334,7 +365,11 @@ class _ToDoState extends State { break; case 50: - return TranslationBase.of(context).livecare; + return TranslationBase.of(context).confirmLiveCare; + break; + + case 60: + return TranslationBase.of(context).waitingForDoctor; break; default: @@ -371,6 +406,10 @@ class _ToDoState extends State { return TranslationBase.of(context).upcomingLivecare; break; + case 60: + return TranslationBase.of(context).waitingForDoctor; + break; + default: return ""; } @@ -427,7 +466,6 @@ class _ToDoState extends State { getPatientAppointmentHistory() { DoctorsListService service = new DoctorsListService(); service.getPatientAppointmentHistory(true, context).then((res) { - print(res['AppoimentAllHistoryResultList']); if (res['MessageStatus'] == 1) { setState(() { if (res['AppoimentAllHistoryResultList'].length != 0) { @@ -438,13 +476,18 @@ class _ToDoState extends State { }); } else {} }); + widget.appoList.forEach((element) { + print(element.isLiveCareAppointment); + print(element.nextAction); + }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { print(err); AppToast.showErrorToast(message: err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getPatientShare(context, AppoitmentAllHistoryResultList appo) { @@ -457,7 +500,8 @@ class _ToDoState extends State { openPaymentDialog(appo, widget.patientShareResponse); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getAppoQR(context, AppoitmentAllHistoryResultList appo) { @@ -478,7 +522,8 @@ class _ToDoState extends State { navigateToQR(context, res['AppointmentQR'], patientShareResponse); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToQR( @@ -592,7 +637,8 @@ class _ToDoState extends State { } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { @@ -610,7 +656,8 @@ class _ToDoState extends State { appo); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } addAdvancedNumberRequest(String advanceNumber, String paymentReference, @@ -624,7 +671,8 @@ class _ToDoState extends State { getAppoQR(context, appo); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToPaymentMethod( @@ -659,17 +707,49 @@ class _ToDoState extends State { confirmAppointment(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); service - .confirmAppointment( - appo.appointmentNo, appo.clinicID, appo.projectID, context) + .confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, + appo.isLiveCareAppointment, context) .then((res) { - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - getPatientAppointmentHistory(); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + getPatientAppointmentHistory(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + if (appo.isLiveCareAppointment) { + insertLiveCareVIDARequest(appo); + } else { + getPatientAppointmentHistory(); + } + }); + } + + insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, + appo.serviceID, appo.doctorID, context) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + getPatientAppointmentHistory(); + }); } } diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 1b4a4cc3..c1d1b546 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -5,6 +5,7 @@ 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:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; class TodoListCard extends StatefulWidget { @@ -12,7 +13,6 @@ class TodoListCard extends StatefulWidget { var languageID; final VoidCallback onListUpdated; - TodoListCard({@required this.appo, this.onListUpdated}); @override @@ -54,14 +54,22 @@ class _TodoListCardState extends State { child: Text(getDate(widget.appo.appointmentDate), style: TextStyle(fontSize: 12.0)), ), - Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), + 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: Text(widget.appo.projectName, - style: TextStyle(fontSize: 12.0)), + child: widget.appo.isLiveCareAppointment + ? Text(TranslationBase.of(context).upcomingLivecare, + style: TextStyle(fontSize: 12.0)) + : Text(widget.appo.projectName, + style: TextStyle(fontSize: 12.0)), ), ], ), @@ -105,7 +113,10 @@ class _TodoListCardState extends State { letterSpacing: 1.0)), Container( margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDoctorSpeciality(widget.appo.doctorSpeciality).trim(), + child: Text( + getDoctorSpeciality( + widget.appo.doctorSpeciality) + .trim(), style: TextStyle( fontSize: 12.0, color: Colors.grey[600], @@ -323,14 +334,13 @@ class _TodoListCardState extends State { } String getMinute(DateTime dateObj) { - if(dateObj.minute == 0) { + if (dateObj.minute == 0) { return dateObj.minute.toString() + "0"; } else { return dateObj.minute.toString(); } } - String getDoctorSpeciality(List docSpecial) { String docSpeciality = ""; docSpecial.forEach((v) { diff --git a/lib/pages/base/base_view.dart b/lib/pages/base/base_view.dart index 6014b6c3..f5311aae 100644 --- a/lib/pages/base/base_view.dart +++ b/lib/pages/base/base_view.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -19,10 +20,11 @@ class BaseView extends StatefulWidget { class _BaseViewState extends State> { T model = locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override void initState() { - if (widget.onModelReady != null) { + if (widget.onModelReady != null && authenticatedUserObject.isLogin) { widget.onModelReady(model); } super.initState(); diff --git a/lib/pages/family/my-family.dart b/lib/pages/family/my-family.dart index b2757514..b4024b0a 100644 --- a/lib/pages/family/my-family.dart +++ b/lib/pages/family/my-family.dart @@ -1,114 +1,358 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.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: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'; -class MyFamily extends StatelessWidget { - //bool isLoading = true; +class MyFamily extends StatefulWidget { + @override + _MyFamily createState() => _MyFamily(); +} + +class _MyFamily extends State with TickerProviderStateMixin { final familyFileProvider = FamilyFilesProvider(); AppSharedPreferences sharedPref = new AppSharedPreferences(); var userID; + TabController _tabController; + + @override + void initState() { + _tabController = new TabController(length: 2, vsync: this, initialIndex: 0); + + super.initState(); + } + bool expandFlag = false; Widget build(BuildContext context) { - return AppScaffold( - appBarTitle: TranslationBase.of(context).myFamilyFiles, - isShowAppBar: true, - body: DefaultTabController( - length: 2, - child: SingleChildScrollView( - padding: EdgeInsets.all(20), - child: Container( - height: SizeConfig.realScreenHeight, - width: SizeConfig.realScreenWidth, - child: Stack( - children: [ - TabBar( - indicatorColor: Colors.red, - tabs: [ - Padding( - padding: EdgeInsets.all(6), - child: - Text(TranslationBase.of(context).family)), - Padding( - padding: EdgeInsets.all(6), - child: - Text(TranslationBase.of(context).request)), - ], - ), - TabBarView( - children: [ - myFamilyDetails(context), - myFamilyRequest(context) - ], - ) - ], - ))))); + return Scaffold( + appBar: AppBar( + bottom: TabBar( + indicatorColor: Colors.red, + tabs: [ + Padding( + padding: EdgeInsets.all(6), + child: AppText( + TranslationBase.of(context).family, + color: Colors.white, + )), + Padding( + padding: EdgeInsets.all(6), + child: AppText( + TranslationBase.of(context).request, + color: Colors.white, + )), + ], + controller: _tabController, + ), + title: AppText(TranslationBase.of(context).myFamilyFiles, + color: Colors.white)), + body: TabBarView( + // physics: NeverScrollableScrollPhysics(), + children: [myFamilyDetails(context), myFamilyRequest(context)], + controller: _tabController), + bottomNavigationBar: BottomBarSearch()); + + // AppScaffold( + // appBarTitle: TranslationBase.of(context).myFamilyFiles, + // isShowAppBar: true, + // body: SingleChildScrollView( + // child: Container( + // height: SizeConfig.screenHeight, + // width: SizeConfig.realScreenWidth, + // padding: EdgeInsets.all(20), + // child: Stack( + // children: [ + // TabBar( + // controller: _tabController, + // indicatorColor: Colors.red, + // tabs: [ + // Padding( + // padding: EdgeInsets.all(6), + // child: Text(TranslationBase.of(context).family)), + // Padding( + // padding: EdgeInsets.all(6), + // child: Text(TranslationBase.of(context).request)), + // ], + // ), + // TabBarView( + // controller: _tabController, + // children: [ + // myFamilyDetails(context), + // myFamilyRequest(context) + // ], + // ) + // ], + // )))); } Widget myFamilyDetails(context) { - return // Padding( - //padding: EdgeInsets.only(top: 50), - //child: - Column( - // mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 3, - child: FutureBuilder( - future: getFamilyFiles(), // 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(snapshot.error)); - else + return Container( + height: MediaQuery.of(context).size.height, + margin: EdgeInsets.fromLTRB(20.0, 0, 20.0, 0.0), + child: Column( + children: [ + Expanded( + flex: 4, + child: FutureBuilder( + future: getFamilyFiles(), // async work + builder: (BuildContext context, + AsyncSnapshot + snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: 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, - )), + child: Text('Loading....')); + default: + if (snapshot.hasError) + return Padding( + padding: EdgeInsets.all(10), + child: Text("No data found")); + 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( + 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); + }, + )), + ], + )) + : SizedBox(); + }).toList()) + ])); + } + }, + ), + ), + 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, + )) + ], + ), + ], + ), + ) + ], + )); + } + + Widget myFamilyRequest(context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + children: [ + // SizedBox(height: 20.0), + RoundedContainer( + child: ExpansionTile( + title: Text( + TranslationBase.of(context).userViewRequest, + 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('No data found')); + else + return 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(children: [ + Row(children: [ + Expanded(flex: 3, child: AppText('Name')), + Expanded(flex: 1, child: AppText('Allow')), + Expanded(flex: 1, child: AppText('Reject')), + ]), + Column( + children: snapshot + .data['GetAllPendingRecordsList'] + .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: () { + acceptRequest( + result, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + deleteRequest( + result, context); + }, + )) + ], + )); + }).toList()) + ]) ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: snapshot - .data.getAllSharedRecordsByStatusList - .map((result) { - return result.status == 3 - ? Padding( + ); + } + }) + ], + ), + ), + 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('No data found')); + else + return SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight * .3, + child: ListView( + children: snapshot + .data.getAllSharedRecordsByStatusList + .map((result) { + return Padding( padding: EdgeInsets.all(10), child: Row( children: [ @@ -118,61 +362,102 @@ class MyFamily extends StatelessWidget { 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); - }, + child: AppText( + result.statusDescription, + color: Colors.red, )), ], - )) - : SizedBox(); + )); + }).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('No data found')); + else + return 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(children: [ + Row(children: [ + Expanded(flex: 3, child: AppText('Name')), + Expanded(flex: 1, child: AppText('Delete')), + ]), + Column( + children: snapshot + .data['GetAllPendingRecordsList'] + .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.delete, + color: Colors.black, + ), + onPressed: () { + deleteRequest( + result, context); + }, + )), + ], + )); }).toList()) - ])); - } - }, - )), - Expanded( - flex: 1, - child: Column( - 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, - )) - ], - ), - ], - )) - ], - ); - } - - addMember() {} - Widget myFamilyRequest(context) { - return Column( - children: [], + ]) + ], + ); + } + }) + ], + )) + ], + ), ); } @@ -186,6 +471,16 @@ class MyFamily extends StatelessWidget { } } + Future getUserViewRequest() async { + var user = await sharedPref.getObject(USER_PROFILE); + return familyFileProvider.getUserViewRequest(user['PatientID']); + } + + Future getSentRequest() async { + // var user = await sharedPref.getObject(USER_PROFILE); + return familyFileProvider.getUserSentRequest(); + } + deleteFamily(family, context) { ConfirmDialog dialog = new ConfirmDialog( context: context, @@ -236,4 +531,7 @@ class MyFamily extends StatelessWidget { HOME, ); } + + deleteRequest(result, context) {} + acceptRequest(result, context) {} } diff --git a/lib/pages/feedback/feedback_home_page.dart b/lib/pages/feedback/feedback_home_page.dart index 68f0bfab..d7c7361f 100644 --- a/lib/pages/feedback/feedback_home_page.dart +++ b/lib/pages/feedback/feedback_home_page.dart @@ -33,6 +33,7 @@ class _FeedbackHomePageState extends State Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, + isBottomBar: false, appBarTitle: 'Feedback', body: Scaffold( extendBodyBehindAppBar: true, @@ -62,8 +63,7 @@ class _FeedbackHomePageState extends State decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), + color: Theme.of(context).dividerColor, width: 0.7), ), color: Colors.white), child: Center( @@ -75,7 +75,7 @@ class _FeedbackHomePageState extends State indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( @@ -104,10 +104,7 @@ class _FeedbackHomePageState extends State child: TabBarView( physics: BouncingScrollPhysics(), controller: _tabController, - children: [ - SendFeedbackPage(), - StatusFeedbackPage() - ], + children: [SendFeedbackPage(), StatusFeedbackPage()], ), ) ], diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index e12a0b95..292006d0 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -2,20 +2,21 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; -import 'package:diplomaticquarterapp/pages/ContactUs/hmg_service.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/pages/livecare/livecare_home.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:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -35,6 +36,7 @@ class _HomePageState extends State { return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( + isShowDecPage: false, body: Container( width: double.infinity, child: SingleChildScrollView( @@ -57,20 +59,114 @@ class _HomePageState extends State { child: Stack( children: [ Positioned( - top: 30, - left: 15, - right: 15, + top: 15, + left: 5, + right: 5, child: Container( width: MediaQuery.of(context).size.width * 0.8, child: Row( children: [ + Expanded( + child: Container( + height: 120, + padding: EdgeInsets.all(5), + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/new-design/covid_bg_transparent.png"), + fit: BoxFit.fill, + ), + color: + Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.all( + Radius.circular(5))), + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Column( + children: [ + Text("COVID-19 TEST", + style: TextStyle( + color: Colors.white, + fontWeight: + FontWeight.bold, + fontSize: 18.0)), + Row( + children: [ + Container( + margin: EdgeInsets.only( + top: 15.0, left: 3.5, right: 3.5), + // child: SvgPicture.asset( + // 'assets/images/new-design/covid-19-car.svg', + // width: 45.0, + // height: 45.0), + ), + Container( + margin: EdgeInsets.only( + left: 10.0, + top: 10.0), + child: Column( + children: [ + Text("Drive-Thru", + style: TextStyle( + color: Colors + .white, + fontWeight: + FontWeight + .bold, + fontSize: + 16.0)), + ButtonTheme( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 5.0), + ), + minWidth: MediaQuery.of( + context) + .size + .width * + 0.15, + height: 25.0, + child: RaisedButton( + color: Colors + .red[800], + textColor: + Colors.white, + disabledTextColor: + Colors.white, + disabledColor: + new Color( + 0xFFbcc2c4), + onPressed: () { + navigateToCovidDriveThru(); + }, + child: Text( + "BOOK NOW", + style: TextStyle( + fontSize: + 12.0)), + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ), Expanded( child: InkWell( onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())), child: Container( - height: 110, + height: 120, padding: EdgeInsets.all(15), margin: EdgeInsets.all(5), decoration: BoxDecoration( @@ -78,25 +174,14 @@ class _HomePageState extends State { .withOpacity(0.3), borderRadius: BorderRadius.all( Radius.circular(5))), - child: Image.asset( - 'assets/images/livecare_white_logo.png', - ), + // child: SvgPicture.asset( + // projectViewModel.isArabic + // ? 'assets/images/new-design/livecare_arabic_logo.svg' + // : 'assets/images/new-design/liveCare_white_logo.svg', + // ), ), ), ), - Expanded( - child: Container( - height: 110, - padding: EdgeInsets.all(15), - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - color: - Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all( - Radius.circular(5))), - // child: Image.asset('assets/images/livecare_white_logo.png',), - ), - ), ], ), ), @@ -124,7 +209,7 @@ class _HomePageState extends State { width: double.infinity, height: 125, decoration: BoxDecoration( - color: Hexcolor('#A59E9E'), + color: HexColor('#A59E9E'), shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, width: 0.5), @@ -170,7 +255,7 @@ class _HomePageState extends State { width: 90, height: 30, decoration: BoxDecoration( - color: Hexcolor('#D81A2E'), + color: HexColor('#D81A2E'), shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, @@ -197,7 +282,7 @@ class _HomePageState extends State { width: double.infinity, height: 130, decoration: BoxDecoration( - color: Hexcolor('#A59E9E'), + color: HexColor('#A59E9E'), shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, width: 0.5), @@ -257,7 +342,7 @@ class _HomePageState extends State { width: 90, height: 30, decoration: BoxDecoration( - color: Hexcolor('#D81A2E'), + color: HexColor('#D81A2E'), shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, @@ -360,12 +445,12 @@ class _HomePageState extends State { child: Column( children: [ Image.asset( - 'assets/images/Dr_Schedule_report.png', + 'assets/images/home_health_care_icon.png', width: 50, height: 50, ), SizedBox( - height: 13.5, + height: 3, ), Texts( TranslationBase.of(context) @@ -402,7 +487,7 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier * 1.7, ) ], ), @@ -426,21 +511,21 @@ class _HomePageState extends State { height: 50, ), SizedBox( - height: 15, + height: 3, ), Texts( TranslationBase.of(context).emergencyService, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier * 1.7, ) ], ), ), ), height: MediaQuery.of(context).size.width * 0.4, - color: Hexcolor("#747C80"), + color: HexColor("#747C80"), imageName: 'emergency_service_image.png', ), ], @@ -469,7 +554,7 @@ class _HomePageState extends State { height: 55, ), SizedBox( - height: 15, + height: 5, ), Texts( TranslationBase.of(context) @@ -477,7 +562,7 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.black87, bold: false, - fontSize: SizeConfig.textMultiplier * 2, + fontSize: SizeConfig.textMultiplier * 1.7, ) ], ), @@ -501,7 +586,7 @@ class _HomePageState extends State { height: 55, ), SizedBox( - height: 15, + height: 10, ), Texts( TranslationBase.of(context) @@ -509,7 +594,7 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.black87, bold: false, - fontSize: SizeConfig.textMultiplier * 2, + fontSize: SizeConfig.textMultiplier * 1.7, ) ], ), @@ -541,7 +626,7 @@ class _HomePageState extends State { height: 50, ), SizedBox( - height: 15, + height: 10, ), Texts( TranslationBase.of(context) @@ -549,7 +634,7 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.black87, bold: false, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier * 1.7, ) ], ), @@ -567,7 +652,7 @@ class _HomePageState extends State { ), ), SizedBox( - height: 8, + height: 5, ), Container( margin: EdgeInsets.only(left: 15, right: 15), @@ -605,7 +690,7 @@ class _HomePageState extends State { ), ), height: 100, - imageName: 'hmg_services_bg .png', + imageName: 'contact_us_bg.png', opacity: 0.5, color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, @@ -617,7 +702,7 @@ class _HomePageState extends State { // Navigator.push( // context, FadePage(page: FeedbackHomePage())); Navigator.push( - context, FadePage(page: HmgServicePage())); + context, FadePage(page: ContactUsPage())); }, child: Container( width: double.infinity, @@ -666,6 +751,11 @@ class _HomePageState extends State { ), ); } + + navigateToCovidDriveThru() { + Navigator.push(context, + MaterialPageRoute(builder: (context) => CovidDrivethruLocation())); + } } class DashboardItem extends StatelessWidget { @@ -702,7 +792,9 @@ class DashboardItem extends StatelessWidget { : MediaQuery.of(context).size.height * 0.35, decoration: BoxDecoration( color: !hasBorder - ? color != null ? color : Hexcolor('#050705').withOpacity(opacity) + ? color != null + ? color + : HexColor('#050705').withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), border: hasBorder @@ -710,7 +802,7 @@ class DashboardItem extends StatelessWidget { : Border.all(width: 0.0, color: Colors.transparent), image: imageName != null ? DecorationImage( - image: AssetImage('assets/images/$imageName'), + image: ExactAssetImage('assets/images/$imageName'), fit: BoxFit.cover, colorFilter: new ColorFilter.mode( Colors.black.withOpacity(0.2), BlendMode.dstIn), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index a545f8a7..ff21d73e 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/pages/medical/my_admissions_page.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -23,15 +24,13 @@ import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; import 'home_page.dart'; - - - class LandingPage extends StatefulWidget { static bool isOpenCallPage = false; @@ -47,17 +46,19 @@ class _LandingPageState extends State with WidgetsBindingObserver { ProjectViewModel projectProvider; final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final authService = new AuthProvider(); + var event = RobotProvider(); void _requestIOSPermissions() { flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< - IOSFlutterLocalNotificationsPlugin>() + IOSFlutterLocalNotificationsPlugin>() ?.requestPermissions( - alert: true, - badge: true, - sound: true, - ); + alert: true, + badge: true, + sound: true, + ); } + bool isPageNavigated = false; _changeCurrentTab(int tab) { @@ -141,123 +142,121 @@ class _LandingPageState extends State with WidgetsBindingObserver { //_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"); - // } - // }, - ); + // 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"); + // } + // }, + ); } - - showDialogs(String message) { ConfirmDialog dialog = new ConfirmDialog( context: context, @@ -287,12 +286,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { return; } } - } Future _scheduleNotification() async { var scheduledNotificationDateTime = - DateTime.now().add(Duration(seconds: 5)); + DateTime.now().add(Duration(seconds: 5)); var vibrationPattern = Int64List(4); vibrationPattern[0] = 0; vibrationPattern[1] = 1000; @@ -303,7 +301,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { 'your other channel id', 'your other channel name', 'your other channel description', - // icon: 'secondary_icon', + // icon: 'secondary_icon', sound: RawResourceAndroidNotificationSound('slow_spring_board'), largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'), vibrationPattern: vibrationPattern, @@ -313,18 +311,17 @@ class _LandingPageState extends State with WidgetsBindingObserver { ledOnMs: 1000, ledOffMs: 500); var iOSPlatformChannelSpecifics = - IOSNotificationDetails(sound: 'slow_spring_board.aiff'); - var platformChannelSpecifics = NotificationDetails( - androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.schedule( - 0, - 'scheduled title', - 'scheduled body', - scheduledNotificationDateTime, - platformChannelSpecifics); + IOSNotificationDetails(sound: 'slow_spring_board.aiff'); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.schedule( + // 0, + // 'scheduled title', + // 'scheduled body', + // scheduledNotificationDateTime, + // platformChannelSpecifics); } - @override Widget build(BuildContext context) { //final searchValue = Provider.of(context); @@ -348,6 +345,16 @@ class _LandingPageState extends State with WidgetsBindingObserver { ); }, ), + actions: [ + // IconButton( + // iconSize: 70, + // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // height: 100, width: 100, fit: BoxFit.cover), + // onPressed: () { + // triggerRobot(); + // } //do something, + // ) + ], centerTitle: true, ), drawer: SafeArea(child: AppDrawer()), @@ -374,6 +381,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { ); } + triggerRobot() { + event.setValue({"isRobot": 'true'}); + } + getText(currentTab) { switch (currentTab) { case 0: diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index f3129823..fc5c4eab 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -8,6 +8,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; +import 'livecare_type_select.dart'; + class LiveCareHome extends StatefulWidget { static bool showFooterButton = true; diff --git a/lib/pages/livecare/livecare_scheduling/livecare_scheduling_clinic_list.dart b/lib/pages/livecare/livecare_scheduling/livecare_scheduling_clinic_list.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart new file mode 100644 index 00000000..4309cc62 --- /dev/null +++ b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart @@ -0,0 +1,51 @@ +import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart'; +import 'package:flutter/material.dart'; + +class ScheduleClinicCard extends StatefulWidget { + bool isSelected; + final ClinicsHaveScheduleList clinicsHaveScheduleList; + var languageID; + + ScheduleClinicCard( + {this.isSelected, + this.languageID, + @required this.clinicsHaveScheduleList}); + + @override + _ScheduleClinicCardState createState() => _ScheduleClinicCardState(); +} + +class _ScheduleClinicCardState extends State { + @override + Widget build(BuildContext context) { + return Container( + child: Card( + margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 8.0), + color: widget.isSelected ? Colors.blue : Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + child: Text( + widget.languageID == 'ar' + ? widget.clinicsHaveScheduleList.clinicDescN + : widget.clinicsHaveScheduleList.clinicDesc, + style: TextStyle( + fontSize: 16.0, + color: + widget.isSelected ? Colors.white : Colors.black)), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart new file mode 100644 index 00000000..64114304 --- /dev/null +++ b/lib/pages/livecare/livecare_type_select.dart @@ -0,0 +1,227 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class LiveCareTypeSelect extends StatefulWidget { + @override + _LiveCareTypeSelectState createState() => _LiveCareTypeSelectState(); +} + +class _LiveCareTypeSelectState extends State { + var languageID; + AppSharedPreferences sharedPref = AppSharedPreferences(); + + @override + void initState() { + getLanguageID(); + super.initState(); + } + + @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)), + ), + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 20.0, right: 20.0), + child: Column( + children: [ + 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("LiveCare Service", + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 20.0))), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.center, + child: Text( + "is to obtain medical advice with a specialist doctor Via a video call", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 18.0))), + Container( + margin: EdgeInsets.only(top: 15.0), + alignment: Alignment.centerLeft, + child: Text("WHY LIVECARE?", + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 20.0))), + Container( + margin: EdgeInsets.only(top: 20.0, left: 20.0), + child: Row( + children: [ + SvgPicture.asset("assets/images/new-design/check_icon.svg", + width: 25), + Container( + width: MediaQuery.of(context).size.width * 0.72, + margin: EdgeInsets.all(10.0), + child: Text( + "No need to wait, you will get Medical consultation immediately via Video call.", + overflow: TextOverflow.clip, + style: TextStyle(fontSize: 14.0)), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0, left: 20.0), + child: Row( + children: [ + SvgPicture.asset("assets/images/new-design/check_icon.svg", + width: 25), + Container( + width: MediaQuery.of(context).size.width * 0.72, + margin: EdgeInsets.all(10.0), + child: Text("The doctor will see your medical file.", + overflow: TextOverflow.clip, + style: TextStyle(fontSize: 14.0)), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0, left: 20.0), + child: Row( + children: [ + SvgPicture.asset("assets/images/new-design/check_icon.svg", + width: 25), + Container( + width: MediaQuery.of(context).size.width * 0.72, + margin: EdgeInsets.all(10.0), + child: Text("Free Prescription delivery service.", + overflow: TextOverflow.clip, + style: TextStyle(fontSize: 14.0)), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 20.0), + child: Text( + "** The service is included with some insurance companies according to the terms and conditions With our best wishes for health and wellness", + 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: 20.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("Get Medical consultation immediately", + overflow: TextOverflow.clip, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18.0, + color: Colors.white)), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.centerLeft, + child: Text("Instant video call", + 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: 20.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, 30.0, 0.0, 0.0), + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + child: Text("Book Appointment", + overflow: TextOverflow.clip, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18.0, + color: Colors.white)), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.centerLeft, + child: Text("Schedule Video Call", + style: TextStyle( + fontSize: 18.0, color: Colors.white)), + ) + ], + ), + ), + ], + )), + ), + SizedBox( + height: 40.0, + ), + ], + ), + ), + ), + ); + } + + getLanguageID() async { + var languageID = await sharedPref.getString(APP_LANGUAGE); + setState(() { + this.languageID = languageID; + }); + } +} diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 9100a64e..c1f5eb75 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -1,9 +1,14 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; +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_scheduling/schedule_clinic_card.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePaymentDialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; @@ -30,8 +35,11 @@ class _clinic_listState extends State { int currentSelectedIndex = 0; LiveCareClinicsListResponse liveCareClinicsListResponse; + LiveCareScheduleClinicsListResponse liveCareScheduleClinicsListResponse; + bool isDataLoaded = false; var languageID; + var currentSelectedLiveCareType; int selectedClinicID = 1; String selectedClinicName = "-"; @@ -46,11 +54,13 @@ class _clinic_listState extends State { @override void initState() { liveCareClinicsListResponse = new LiveCareClinicsListResponse(); + liveCareScheduleClinicsListResponse = + new LiveCareScheduleClinicsListResponse(); + WidgetsBinding.instance.addPostFrameCallback((_) { -// Future.delayed(new Duration(milliseconds: 1200), () { - getLiveCareClinicsList(); -// }); + openLiveCareSelectionDialog(); }); + getLanguageID(); super.initState(); } @@ -58,77 +68,9 @@ class _clinic_listState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - child: Column( - children: [ - isDataLoaded - ? Container( - 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, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedIndex(liveCareClinicsListResponse - .patientERGetClinicsList[index]); - }, - child: ClinicCard( - isSelected: selectedClinicID == - liveCareClinicsListResponse - .patientERGetClinicsList[index] - .serviceID - ? true - : false, - patientERGetClinicsList: - liveCareClinicsListResponse - .patientERGetClinicsList[index], - languageID: languageID, - ), - ); - }, - ), - Container( - height: 10.0, - ), - ], - ), - ) - : Container(), - isDataLoaded ? 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: startLiveCare, - child: Text("Start", style: TextStyle(fontSize: 18.0)), - ), - ), - ) : Container(), - ], - ), - ); + child: currentSelectedLiveCareType == "immediate" + ? getLiveCareImmediateClinicList() + : getLiveCareScheduleClinicList()); } void startLiveCare() { @@ -388,10 +330,298 @@ class _clinic_listState extends State { text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } + getLiveCareScheduleClinicsList() { + isDataLoaded = false; + LiveCareService service = new LiveCareService(); + service.getLiveCareScheduledClinics(context).then((res) { + print(res['ClinicsHaveScheduleList'].length); + 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; + }); + } else { + isDataLoaded = true; + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + openLiveCareSelectionDialog() { + Navigator.of(context) + .push(new MaterialPageRoute( + builder: (BuildContext context) { + return LiveCareTypeSelect(); + }, + fullscreenDialog: true)) + .then((value) { + if (value == null) { + Navigator.pop(context); + } else { + print(value); + if (value == "immediate") { + setState(() { + currentSelectedLiveCareType = "immediate"; + }); + getLiveCareClinicsList(); + } + if (value == "schedule") { + setState(() { + currentSelectedLiveCareType = "schedule"; + }); + getLiveCareScheduleClinicsList(); + } + } + }); + } + + Widget getLiveCareScheduleClinicList() { + 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, + ), + ], + ), + ) + : 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(), + ], + ); + } + + Widget getLiveCareImmediateClinicList() { + 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: liveCareClinicsListResponse + .patientERGetClinicsList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedIndex(liveCareClinicsListResponse + .patientERGetClinicsList[index]); + }, + child: ClinicCard( + isSelected: selectedClinicID == + liveCareClinicsListResponse + .patientERGetClinicsList[index] + .serviceID + ? true + : false, + patientERGetClinicsList: liveCareClinicsListResponse + .patientERGetClinicsList[index], + languageID: languageID, + ), + ); + }, + ), + 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, 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: startLiveCare, + child: Text("Start", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ) + : Container(), + ], + ); + } + + void startScheduleLiveCare() { + List doctorsList = []; + LiveCareService service = new LiveCareService(); + List _patientDoctorAppointmentListHospital = + List(); + service + .getLiveCareScheduledDoctorList(context, selectedClinicID) + .then((res) { + print(res['DoctorByClinicIDList']); + print(res['DoctorByClinicIDList'].length); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorByClinicIDList'].length != 0) { + res['DoctorByClinicIDList'].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 {} + }); + this.sharedPref.setBool(IS_LIVECARE_APPOINTMENT, true); + navigateToSearchResults( + context, doctorsList, _patientDoctorAppointmentListHospital); + } else {} + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + Future navigateToSearchResults( + context, + List docList, + List + patientDoctorAppointmentListHospital) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchResults( + doctorsList: docList, + isLiveCareAppointment: true, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))); + } + updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { setState(() { selectedClinicID = patientERGetClinicsList.serviceID; selectedClinicName = patientERGetClinicsList.serviceName; }); } + + updateSelectedScheduleIndex(ClinicsHaveScheduleList patientERGetClinicsList) { + setState(() { + selectedClinicID = patientERGetClinicsList.serviceID; + selectedClinicName = patientERGetClinicsList.clinicDesc; + }); + } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index ac36c7d6..85c1b232 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -21,6 +21,7 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; import 'package:local_auth/local_auth.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class ConfirmLogin extends StatefulWidget { @override @@ -74,183 +75,171 @@ class _ConfirmLogin extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).confirm, isShowAppBar: true, - body: isLoading == false - ? SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(20), - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column( - children: [ - Expanded( - flex: 3, - child: user != null && isMoreOption == false - ? Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/habib-logo.png', - height: 80, - width: 80, - ), - AppText( - TranslationBase.of(context) - .welcomeBack + - ' ' + - user.name, - fontSize: SizeConfig.textMultiplier * 4, - ), - AppText( - TranslationBase.of(context).accountInfo, - fontSize: SizeConfig.textMultiplier * 3, - ), - Card( - color: Colors.grey[300], - child: Row( - children: [ - Expanded( - child: ListTile( - title: Text( - TranslationBase.of(context) - .lastLoginAt, - textAlign: TextAlign.center, - ), - subtitle: Text( - user.editedOn != null - ? formatDate(DateUtil - .convertStringToDate( - user.editedOn)) - : '--', - textAlign: - TextAlign.center), - )), - Expanded( - child: ListTile( - title: Text( - TranslationBase.of(context) - .lastLoginWith, - textAlign: - TextAlign.center), - subtitle: Text( - getType(user.logInType, - context), - textAlign: - TextAlign.center), - )) - ], - )) - ], - ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/habib-logo.png', - height: 80, - width: 80, - ), - this.onlySMSBox == false - ? AppText( - TranslationBase.of(context) - .verifyLoginWith, - fontSize: - SizeConfig.textMultiplier * - 3.5, - textAlign: TextAlign.left, - ) - : AppText( + isShowDecPage: false, + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(20), + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column( + children: [ + Expanded( + flex: 3, + child: user != null && isMoreOption == false + ? Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + 'assets/images/habib-logo.png', + height: 80, + width: 80, + ), + AppText( + TranslationBase.of(context).welcomeBack + + ' ' + + user.name, + fontSize: SizeConfig.textMultiplier * 3.5, + ), + AppText( + TranslationBase.of(context).accountInfo, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + Card( + color: Colors.grey[300], + child: Row( + children: [ + Expanded( + child: ListTile( + title: Text( + TranslationBase.of(context) + .lastLoginAt, + textAlign: TextAlign.center, + ), + subtitle: Text( + user.editedOn != null + ? formatDate(DateUtil + .convertStringToDate( + user.editedOn)) + : '--', + textAlign: TextAlign.center), + )), + Expanded( + child: ListTile( + title: Text( TranslationBase.of(context) - .verifyFingerprint2, - fontSize: - SizeConfig.textMultiplier * - 2.5, - textAlign: TextAlign.left, - ), - ])), - user != null && isMoreOption == false - ? Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( + .lastLoginWith, + textAlign: TextAlign.center), + subtitle: Text( + getType( + user.logInType, context), + textAlign: TextAlign.center), + )) + ], + )) + ], + ) + : Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + 'assets/images/habib-logo.png', + height: 80, + width: 80, + ), + this.onlySMSBox == false + ? AppText( + TranslationBase.of(context) + .verifyLoginWith, + fontSize: + SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.left, + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: + SizeConfig.textMultiplier * 2.5, + textAlign: TextAlign.left, + ), + ])), + user != null && isMoreOption == false + ? Expanded( + flex: 2, + child: 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)) + ]) + ])) + : Expanded( + flex: 4, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + onlySMSBox == false + ? Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Expanded( - child: InkWell( - onTap: () => { - authenticateUser( - 3, - BiometricType - .face.index) - }, - child: getButton( - user.logInType))), - Expanded(child: getButton(5)) - ]) - ])) - : Expanded( - flex: 4, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + Expanded(child: getButton(3)), + Expanded(child: getButton(2)) + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: MainAxisAlignment.center, 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)) - ], - ), - ]), - ), - 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(), - ], - )) - ], - ))) - : AppCircularProgressIndicator()); + Expanded(child: getButton(1)), + Expanded(child: getButton(4)) + ], + ), + ]), + ), + 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(), + ], + )) + ], + )))); } Future _getAvailableBiometrics() async { @@ -314,32 +303,40 @@ class _ConfirmLogin extends State { var request = CheckPatientAuthenticationReq.fromJson(req.toJson()); sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); - authService.checkPatientAuthentication(request).then((value) => { - if (value['isSMSSent']) - { - sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), - this.loginTokenID = value['LogInTokenID'], - sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), - // Future.delayed(Duration(seconds: 1), () { - this.sendActivationCode(type) - // }) - } - else - { - if (value['IsAuthenticated']) {this.checkActivationCode()} - } - }); + authService + .checkPatientAuthentication(request) + .then((value) => { + if (value['isSMSSent']) + { + sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), + this.loginTokenID = value['LogInTokenID'], + sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), + // Future.delayed(Duration(seconds: 1), () { + this.sendActivationCode(type) + // }) + } + else + { + if (value['IsAuthenticated']) {this.checkActivationCode()} + } + }) + .catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } - sendActivationCode(type) { + sendActivationCode(type) async { var request = this.getCommonRequest(); - loading(true); - this.authService.sendActivationCode(request).then((result) => { - if (result != null && result['isSMSSent'] == true) - {loading(false), this.startSMSService(type)} - else - {loading(false)} - }); + // loading(true); + + await this.authService.sendActivationCode(request).then((result) => { + if (result != null && result['isSMSSent'] == true) + {this.startSMSService(type)} + }); + + + // SMSOTP.showLoadingDialog(context, false), } startSMSService(type) { @@ -370,42 +367,50 @@ class _ConfirmLogin extends State { } getMobileInfo(request) { - this.authService.getLoginInfo(request).then((result) => { - if (result['SMSLoginRequired'] == false) - { - this.loginTokenID = result.logInTokenID, - this.patientOutSA = result.patientOutSA, - // sms for register the biometric - if (result.isSMSSent) + this + .authService + .getLoginInfo(request) + .then((result) => { + if (result['SMSLoginRequired'] == false) { - this.onlySMSBox = false, - //this.button(); + this.loginTokenID = result.logInTokenID, + this.patientOutSA = result.patientOutSA, + // sms for register the biometric + if (result.isSMSSent) + { + this.onlySMSBox = false, + //this.button(); + } + else + {checkActivationCode()} } else - {checkActivationCode()} - } - else - { - if (result['IsAuthenticated'] == true) { - setState(() { - isMoreOption = true; - this.onlySMSBox = true; - // this.fingrePrintBefore = true; - }), - - //sharedPref.setBool(ONLY_SMS, true), - // this.cs.sharedService.setSharedData(true, AuthenticationService.ONLY_SMS); - //this.cs.sharedService.setSharedData(this.selectedOption, AuthenticationService.FINGUREPRINT_BEFORE); - // this.cs.confirmLogin(); - //this.button(); + if (result['IsAuthenticated'] == true) + { + setState(() { + isMoreOption = true; + this.onlySMSBox = true; + // this.fingrePrintBefore = true; + }), + + //sharedPref.setBool(ONLY_SMS, true), + // this.cs.sharedService.setSharedData(true, AuthenticationService.ONLY_SMS); + //this.cs.sharedService.setSharedData(this.selectedOption, AuthenticationService.FINGUREPRINT_BEFORE); + // this.cs.confirmLogin(); + //this.button(); + } + // else + // { + // // this.cs.presentAlert(result.ErrorEndUserMessage); + // } } - // else - // { - // // this.cs.presentAlert(result.ErrorEndUserMessage); - // } - } - }); + }) + .catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + ; } setUser() async {} @@ -426,9 +431,13 @@ class _ConfirmLogin extends State { : int.parse(this.user.mobile); this.zipCode = this.registerd_data != null ? this.registerd_data.zipCode - : this.user.outSA == true ? "971" : "966"; + : this.user.outSA == true + ? "971" + : "966"; this.patientOutSA = this.registerd_data != null - ? this.registerd_data.zipCode == "966" ? 0 : 1 + ? this.registerd_data.zipCode == "966" + ? 0 + : 1 : this.user.outSA; if (this.registerd_data != null) { this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); @@ -476,43 +485,51 @@ class _ConfirmLogin extends State { SMSOTP.showLoadingDialog(context, true); var request = this.getCommonRequest().toJson(); - this.authService.checkActivationCode(request, value).then((result) => { - if (result is Map) - { - result = CheckActivationCode.fromJson(result), - if (this.registerd_data != null && - this.registerd_data.isRegister == true) + this + .authService + .checkActivationCode(request, value) + .then((result) => { + if (result is Map) { - Navigator.of(context).pushNamed( - REGISTER_INFO, - ) + result = CheckActivationCode.fromJson(result), + if (this.registerd_data != null && + this.registerd_data.isRegister == true) + { + Navigator.of(context).pushNamed( + REGISTER_INFO, + ) + } + else + { + this.userData = result + .list, //AuthenticatedUser.fromJson(result['List'][0]), + this.sharedPref.setObject(USER_PROFILE, result.list), + this.loginTokenID = result.logInTokenID, + this + .sharedPref + .setObject(LOGIN_TOKEN_ID, result.logInTokenID), + this + .sharedPref + .setString(TOKEN, result.authenticationTokenID), + this.checkIfUserAgreedBefore(result), + // Navigator.of(context).pop(), + SMSOTP.showLoadingDialog(context, false), + } } else { - this.userData = result - .list, //AuthenticatedUser.fromJson(result['List'][0]), - this.sharedPref.setObject(USER_PROFILE, result.list), - this.loginTokenID = result.logInTokenID, - this - .sharedPref - .setObject(LOGIN_TOKEN_ID, result.logInTokenID), - this - .sharedPref - .setString(TOKEN, result.authenticationTokenID), - this.checkIfUserAgreedBefore(result), // Navigator.of(context).pop(), SMSOTP.showLoadingDialog(context, false), + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: result); + }), } - } - else - { - // Navigator.of(context).pop(), - SMSOTP.showLoadingDialog(context, false), - Future.delayed(Duration(seconds: 1), () { - AppToast.showErrorToast(message: result); - }), - } - }); + }) + .catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + ; } checkIfUserAgreedBefore(CheckActivationCode result) { @@ -525,42 +542,17 @@ class _ConfirmLogin extends State { } insertIMEI() { - authService.insertDeviceImei(selectedOption).then((value) => {goToHome()}); + authService + .insertDeviceImei(selectedOption) + .then((value) => {goToHome()}) + .catchError((err) { + print(err); + }); } goToHome() { // authService.insertDeviceImei().then((value) => print(value)); Navigator.of(context).pushNamed(HOME); - // const request = new LoginRequest(); - // if (this.loginType === AuthenticationService.IDENTIFCIATION_LOGIN_TYPE) { - // request.PatientID = 0; - // } else { - // request.PatientID = Number(this.id); - // } - // this.newRating(request); - // } - // public newRating(request: any) { - // this.authService - // .checkIfRated( - // request, - // () => { - // this.gotoHome(); - // }, - // this.ts.trPK("general", "retry") - // ) - // .subscribe((result: CheckUserRatingResponse) => { - // if (this.cs.validResponse(result)) { - // this.cs.sharedService.setSharedData(result, AuthenticationService.SURVEY_DATA); - // if (result.IsLastAppoitmentRatedList.length === 0) { - // this.cs.openHome(); - // } else { - // this.ProjectID = result.IsLastAppoitmentRatedList[0].ProjectID; - // this.AppointmentNo = result.IsLastAppoitmentRatedList[0].AppointmentNo; - // this.cs.sharedService.setSharedData(true, "ratePage"); - // this.showRateModal(); - // } - // } - // }); } loading(flag) { diff --git a/lib/pages/login/forgot-password.dart b/lib/pages/login/forgot-password.dart index c1fa7b18..bbdbb1ae 100644 --- a/lib/pages/login/forgot-password.dart +++ b/lib/pages/login/forgot-password.dart @@ -21,6 +21,7 @@ class _ForgotPassword extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).forgotPassword, isShowAppBar: true, + isShowDecPage: false, body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20), diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index 7a8a940d..8a5087a5 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -16,6 +16,7 @@ class LoginType extends StatelessWidget { return AppScaffold( appBarTitle: TranslationBase.of(context).welcome, isShowAppBar: true, + isShowDecPage: false, body: Padding( padding: EdgeInsets.all(20), child: Column( @@ -23,7 +24,7 @@ class LoginType extends StatelessWidget { Expanded( flex: 4, child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( @@ -135,7 +136,7 @@ class LoginType extends StatelessWidget { ]), ), Expanded( - flex: 2, + flex: 1, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index c1f04a71..f2ece252 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,5 +1,6 @@ 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/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -21,7 +22,7 @@ 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:smart_progress_bar/smart_progress_bar.dart'; class Login extends StatefulWidget { @override _Login createState() => _Login(); @@ -40,6 +41,9 @@ class _Login extends State { AppointmentRateViewModel appointmentRateViewModel = locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); + + @override void initState() { // getDeviceToken(); @@ -57,9 +61,8 @@ class _Login extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, - body: isLoading == true - ? AppCircularProgressIndicator() - : SingleChildScrollView( + isShowDecPage: false, + body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), @@ -84,6 +87,7 @@ class _Login extends State { onCountryChange: (value) => countryCode = value), Container( child: TextFields( + fontWeight: FontWeight.normal, controller: nationalIDorFile, onChanged: (value) => {validateForm()}, prefixIcon: Icon( @@ -146,7 +150,7 @@ class _Login extends State { } checkUserAuthentication() { - showLoader(true); + // showLoader(true); var request = CheckPatientAuthenticationReq(); request.isRegister = false; request.patientMobileNumber = int.parse(mobileNo); @@ -162,7 +166,7 @@ class _Login extends State { } sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); authService.checkPatientAuthentication(request).then((value) => { - showLoader(false), + //showLoader(false), if (value['isSMSSent']) { sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), @@ -173,7 +177,11 @@ class _Login extends State { { if (value['IsAuthenticated']) {this.checkActivationCode()} } - }); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + // SMSOTP.showLoadingDialog(context, false), } checkActivationCode({code}) async { @@ -181,6 +189,8 @@ class _Login extends State { // request.logInTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); // request.activationCode = code ?? "0000"; // request.isSilentLogin = code != null ? false : true; + if (code == null) + //showLoader(true); request['PatientMobileNumber'] = int.parse(mobileNo); request['ZipCode'] = countryCode; request['SearchType'] = loginType; @@ -195,6 +205,7 @@ class _Login extends State { // request.isRegister = false; this.authService.checkActivationCode(request, code).then((result) => { result = CheckActivationCode.fromJson(result), + authenticatedUserObject.getUser(), this.sharedPref.setObject(USER_PROFILE, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), @@ -202,6 +213,7 @@ class _Login extends State { Navigator.of(context).pushNamed( HOME, ), + //showLoader(false), appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { @@ -223,14 +235,17 @@ class _Login extends State { ), ) } - }) + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) // SMSOTP.showLoadingDialog(context, false), }); } - showLoader(bool isTrue) { - setState(() { - isLoading = isTrue; - }); - } + // showLoader(bool isTrue) { + // setState(() { + // isLoading = isTrue; + // }); + // } } diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 70e5fb29..e94c1af6 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -39,6 +39,7 @@ class _RegisterInfo extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).register, isShowAppBar: true, + isShowDecPage: false, body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 3706f452..3ee13a4c 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -45,6 +45,7 @@ class _Register extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).register, isShowAppBar: true, + isShowDecPage: false, body: isLoading == true ? AppCircularProgressIndicator() : SingleChildScrollView( diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index b4b05900..be406a55 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -28,6 +28,7 @@ class _WelcomeLogin extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).welcome, + isShowDecPage: false, isShowAppBar: true, body: Padding( padding: EdgeInsets.all(20), @@ -60,7 +61,7 @@ class _WelcomeLogin extends State { textAlign: TextAlign.left, ), SizedBox( - height: SizeConfig.realScreenHeight * .2, + height: SizeConfig.realScreenHeight * .15, ) ]), ), diff --git a/lib/pages/medical/ask_doctor/doctor_response.dart b/lib/pages/medical/ask_doctor/doctor_response.dart index b6071a4c..846c9a05 100644 --- a/lib/pages/medical/ask_doctor/doctor_response.dart +++ b/lib/pages/medical/ask_doctor/doctor_response.dart @@ -30,7 +30,7 @@ class DoctorResponse extends StatelessWidget { height: 65, ), AppExpandableNotifier( - header: Padding( + headerWidget: Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -110,7 +110,7 @@ class DoctorResponse extends StatelessWidget { ), ), AppExpandableNotifier( - header: Padding( + headerWidget: Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 5cef835f..02d08682 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -29,6 +29,7 @@ import 'new_text_Field.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } + class AdvancePaymentPage extends StatefulWidget { @override _AdvancePaymentPageState createState() => _AdvancePaymentPageState(); diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index 446333cc..421e2bed 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -38,7 +38,7 @@ class MyBalancePage extends StatelessWidget { width: double.infinity, height: 65, decoration: BoxDecoration( - color: Hexcolor('#B61422'), + color: HexColor('#B61422'), shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(7), ), @@ -96,8 +96,7 @@ class MyBalancePage extends StatelessWidget { textColor: Colors.white, label: TranslationBase.of(context).createAdvancedPayment, onTap: () { - Navigator.push(context, - FadePage(page: AdvancePaymentPage())); + Navigator.push(context, FadePage(page: AdvancePaymentPage())); }, ), ), diff --git a/lib/pages/medical/labs/labs_home_page.dart b/lib/pages/medical/labs/labs_home_page.dart index 325d5dcd..995365d9 100644 --- a/lib/pages/medical/labs/labs_home_page.dart +++ b/lib/pages/medical/labs/labs_home_page.dart @@ -20,6 +20,7 @@ class LabsHomePage extends StatelessWidget { builder: (context, LabsViewModel model, widget) => AppScaffold( baseViewModel: model, isShowAppBar: true, + description: TranslationBase.of(context).infoLab, appBarTitle: TranslationBase.of(context).labOrders, body: SingleChildScrollView( physics: BouncingScrollPhysics(), diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index d2b9a9ea..e7d75e7f 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -48,6 +48,7 @@ class _MedicalProfilePageState extends State { return BaseView( onModelReady: (model) => model.getAppointmentHistory(), builder: (_, model, widget) => AppScaffold( + isShowDecPage: false, baseViewModel: model, body: Container( child: SingleChildScrollView( @@ -73,6 +74,7 @@ class _MedicalProfilePageState extends State { fit: BoxFit.cover, width: double.infinity, ), + if(model.authenticatedUserObject.isLogin) ListView.builder( itemBuilder: (context, index) => TimeLineWidget( isUp: index % 2 == 1, diff --git a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart index 7d7c5dd5..8e6f808c 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart @@ -135,7 +135,7 @@ class _WeightHomePageState extends State width: 55, height: 55, decoration: BoxDecoration( - shape: BoxShape.circle, color: Hexcolor('515B5D')), + shape: BoxShape.circle, color: HexColor('515B5D')), child: Center( child: Icon( Icons.add, diff --git a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart index 5bdbfeab..9f7063f1 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart @@ -15,8 +15,7 @@ class WeightMonthlyPage extends StatelessWidget { final List> data; final List diabtecPatientResult; - const WeightMonthlyPage( - {Key key, this.data, this.diabtecPatientResult}) + const WeightMonthlyPage({Key key, this.data, this.diabtecPatientResult}) : super(key: key); @override @@ -67,7 +66,7 @@ class WeightMonthlyPage extends StatelessWidget { children: [ Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -83,18 +82,26 @@ class WeightMonthlyPage extends StatelessWidget { ), Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Time', color: Colors.white,fontSize: 15,), + child: Texts( + 'Time', + color: Colors.white, + fontSize: 15, + ), ), height: 40), Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Value', color: Colors.white,fontSize: 15,), + child: Texts( + 'Value', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ], diff --git a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart index ac1a3214..9c3363dd 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart @@ -29,8 +29,9 @@ class WeightWeeklyPage extends StatelessWidget { dateTimeFactory: const charts.LocalDateTimeFactory(), ), ), - SizedBox(height: 12,), - + SizedBox( + height: 12, + ), Padding( padding: const EdgeInsets.all(8.0), child: Texts('Details'), @@ -62,7 +63,7 @@ class WeightWeeklyPage extends StatelessWidget { children: [ Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -78,37 +79,50 @@ class WeightWeeklyPage extends StatelessWidget { ), Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Time', color: Colors.white,fontSize: 15,), + child: Texts( + 'Time', + color: Colors.white, + fontSize: 15, + ), ), height: 40), Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Value', color: Colors.white,fontSize: 15,), + child: Texts( + 'Value', + color: Colors.white, + fontSize: 15, + ), ), height: 40), Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), ), child: Center( - child: Texts('Edit', color: Colors.white,fontSize: 15,), + child: Texts( + 'Edit', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), ], ), ); - diabtecPatientResult.forEach((diabtec) { + diabtecPatientResult.forEach( + (diabtec) { tableRow.add( TableRow( children: [ diff --git a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart index 3ddeaa82..587cc3f6 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart @@ -65,7 +65,7 @@ class WeightYearPage extends StatelessWidget { children: [ Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -81,25 +81,33 @@ class WeightYearPage extends StatelessWidget { ), Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Time', color: Colors.white,fontSize: 15,), + child: Texts( + 'Time', + color: Colors.white, + fontSize: 15, + ), ), height: 40), Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Value', color: Colors.white,fontSize: 15,), + child: Texts( + 'Value', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ], ), ); diabtecPatientResult.forEach( - (diabtec) { + (diabtec) { tableRow.add( TableRow( children: [ diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index c118f2ca..d2bcde47 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -138,7 +138,7 @@ class _BloodPressureHomePageState extends State width: 55, height: 55, decoration: BoxDecoration( - shape: BoxShape.circle, color: Hexcolor('515B5D')), + shape: BoxShape.circle, color: HexColor('515B5D')), child: Center( child: Icon( Icons.add, diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart index f38cc3b6..8b9e504f 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart @@ -67,7 +67,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -85,7 +85,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( child: Texts( @@ -99,7 +99,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( child: Texts( @@ -113,7 +113,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), @@ -149,7 +149,8 @@ class BloodPressureMonthlyPage extends StatelessWidget { ), ), ), - Container(child: Container( + Container( + child: Container( height: 70, padding: EdgeInsets.all(10), color: Colors.white, @@ -160,7 +161,8 @@ class BloodPressureMonthlyPage extends StatelessWidget { fontSize: 12, ), ), - ),), + ), + ), Container( child: Container( height: 70, diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart index dfcf42ae..0c67be7c 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart @@ -65,7 +65,7 @@ class BloodPressureYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -83,7 +83,7 @@ class BloodPressureYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( child: Texts( @@ -97,7 +97,7 @@ class BloodPressureYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( child: Texts( @@ -108,11 +108,10 @@ class BloodPressureYearPage extends StatelessWidget { ), height: 40), ), - Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), diff --git a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart index fbcbf417..52313483 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart @@ -30,8 +30,9 @@ class BloodPressureWeeklyPage extends StatelessWidget { dateTimeFactory: const charts.LocalDateTimeFactory(), ), ), - SizedBox(height: 12,), - + SizedBox( + height: 12, + ), Padding( padding: const EdgeInsets.all(8.0), child: Texts('Details'), @@ -64,7 +65,7 @@ class BloodPressureWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -82,50 +83,67 @@ class BloodPressureWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Time', color: Colors.white,fontSize: 15,), + child: Texts( + 'Time', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Measured', color: Colors.white,fontSize: 15,), + child: Texts( + 'Measured', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Value', color: Colors.white,fontSize: 15,), + child: Texts( + 'Value', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), ), child: Center( - child: Texts('Edit', color: Colors.white,fontSize: 15,), + child: Texts( + 'Edit', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), ], ), ); - diabtecPatientResult.forEach((diabtec) { + diabtecPatientResult.forEach( + (diabtec) { tableRow.add( TableRow( children: [ diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart index da31c4ed..fdd7b348 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart @@ -1,4 +1,3 @@ - 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'; @@ -14,7 +13,8 @@ class BloodMonthlyPage extends StatelessWidget { final List> data; final List diabtecPatientResult; - const BloodMonthlyPage({Key key, this.data,this.diabtecPatientResult}) : super(key: key); + const BloodMonthlyPage({Key key, this.data, this.diabtecPatientResult}) + : super(key: key); @override Widget build(BuildContext context) { return AppScaffold( @@ -24,14 +24,14 @@ class BloodMonthlyPage extends StatelessWidget { width: double.maxFinite, height: 180, color: Colors.white, - child: charts.LineChart( - data, + child: charts.LineChart(data, //animate: animate, - defaultRenderer: new charts.LineRendererConfig(includePoints: true) - ), + defaultRenderer: + new charts.LineRendererConfig(includePoints: true)), + ), + SizedBox( + height: 12, ), - SizedBox(height: 12,), - Padding( padding: const EdgeInsets.all(8.0), child: Texts('Details'), @@ -51,7 +51,6 @@ class BloodMonthlyPage extends StatelessWidget { ], ), ) - ], ), ); @@ -65,7 +64,7 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -83,105 +82,116 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Time', color: Colors.white,fontSize: 15,), + child: Texts( + 'Time', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Measured', color: Colors.white,fontSize: 15,), + child: Texts( + 'Measured', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), - Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), ), child: Center( - child: Texts('Value', color: Colors.white,fontSize: 15,), + child: Texts( + 'Value', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), ], ), ); - diabtecPatientResult.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.dateChart)} ', - textAlign: TextAlign.center, - fontSize: 12, + diabtecPatientResult.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.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.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.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: Container( + height: 70, + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${diabtec.resultValue}', + textAlign: TextAlign.center, + fontSize: 12, + ), ), ), ), - ), - - ], - ), - ); - }, + ], + ), + ); + }, ); return tableRow; } diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart index 3bddab88..47f87847 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart @@ -64,7 +64,7 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -82,7 +82,7 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( child: Texts( @@ -96,7 +96,7 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( child: Texts( @@ -107,11 +107,10 @@ class BloodYearPage extends StatelessWidget { ), height: 40), ), - Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), 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 1190b6b6..c8c7fa4a 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 @@ -37,7 +37,6 @@ class _BloodSugarHomePageState extends State _tabController.dispose(); } - @override Widget build(BuildContext context) { return BaseView( @@ -78,7 +77,8 @@ class _BloodSugarHomePageState extends State indicatorSize: TabBarIndicatorSize.label, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), + labelPadding: + EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( @@ -114,27 +114,37 @@ class _BloodSugarHomePageState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - BloodSugarWeeklyPage(data: model.getBloodWeeklySeries(),diabtecPatientResult: model.weekDiabtecPatientResult,), - BloodMonthlyPage(data: model.getBloodMonthlyTimeSeriesSales(),diabtecPatientResult: model.monthDiabtecPatientResult,), - BloodYearPage(data: model.getBloodYearTimeSeriesSales(),diabtecPatientResult: model.yearDiabtecPatientResult,) + BloodSugarWeeklyPage( + data: model.getBloodWeeklySeries(), + diabtecPatientResult: model.weekDiabtecPatientResult, + ), + BloodMonthlyPage( + data: model.getBloodMonthlyTimeSeriesSales(), + diabtecPatientResult: model.monthDiabtecPatientResult, + ), + BloodYearPage( + data: model.getBloodYearTimeSeriesSales(), + diabtecPatientResult: model.yearDiabtecPatientResult, + ) ], ), ) ], ), floatingActionButton: InkWell( - onTap: (){ + onTap: () { Navigator.push(context, FadePage(page: AddBloodSugarPage())); }, child: Container( width: 55, height: 55, decoration: BoxDecoration( - shape: BoxShape.circle, - color: Hexcolor('515B5D') - ), + shape: BoxShape.circle, color: HexColor('515B5D')), child: Center( - child: Icon(Icons.add,color: Colors.white,), + child: Icon( + Icons.add, + color: Colors.white, + ), ), ), ), 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 6b892162..4b007929 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 @@ -29,8 +29,9 @@ class BloodSugarWeeklyPage extends StatelessWidget { dateTimeFactory: const charts.LocalDateTimeFactory(), ), ), - SizedBox(height: 12,), - + SizedBox( + height: 12, + ), Padding( padding: const EdgeInsets.all(8.0), child: Texts('Details'), @@ -63,7 +64,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -81,50 +82,67 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Time', color: Colors.white,fontSize: 15,), + child: Texts( + 'Time', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Measured', color: Colors.white,fontSize: 15,), + child: Texts( + 'Measured', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), ), child: Center( - child: Texts('Value', color: Colors.white,fontSize: 15,), + child: Texts( + 'Value', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), ), child: Center( - child: Texts('Edit', color: Colors.white,fontSize: 15,), + child: Texts( + 'Edit', + color: Colors.white, + fontSize: 15, + ), ), height: 40), ), ], ), ); - diabtecPatientResult.forEach((diabtec) { + diabtecPatientResult.forEach( + (diabtec) { tableRow.add( TableRow( children: [ diff --git a/lib/pages/medical/radiology/radiology_home_page.dart b/lib/pages/medical/radiology/radiology_home_page.dart index 0f9f4c7b..995ac485 100644 --- a/lib/pages/medical/radiology/radiology_home_page.dart +++ b/lib/pages/medical/radiology/radiology_home_page.dart @@ -20,6 +20,7 @@ class RadiologyHomePage extends StatelessWidget { isShowAppBar: true, appBarTitle: TranslationBase.of(context).radiology, baseViewModel: model, + description: TranslationBase.of(context).infoRadiology, body: FractionallySizedBox( widthFactor: 1.0, child: ListView( 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 ad5c6ffb..589284a1 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart @@ -52,7 +52,7 @@ class _VitalSignDetailsWidgetState extends State { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -69,7 +69,7 @@ class _VitalSignDetailsWidgetState extends State { Container( child: Container( decoration: BoxDecoration( - color: Hexcolor('#515B5D'), + color: HexColor('#515B5D'), borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), diff --git a/lib/pages/medical/vital_sign/vital_sign_item.dart b/lib/pages/medical/vital_sign/vital_sign_item.dart index 9586fb25..fb44772d 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item.dart @@ -45,16 +45,22 @@ class VitalSignItem extends StatelessWidget { child: Text( des, style: TextStyle( - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Hexcolor('#B8382C'), - fontWeight: FontWeight.bold,), + fontSize: 1.7 * SizeConfig.textMultiplier, + color: HexColor('#B8382C'), + fontWeight: FontWeight.bold, + ), ), ), ), ), Expanded( flex: 1, - child: Container(child: Icon(icon,size: 40,),), + child: Container( + child: Icon( + icon, + size: 40, + ), + ), ) ], ), @@ -65,7 +71,7 @@ class VitalSignItem extends StatelessWidget { child: Align( alignment: Alignment.topRight, child: Container( - margin: EdgeInsets.only(left: 5,right: 5), + margin: EdgeInsets.only(left: 5, right: 5), child: RichText( text: TextSpan( style: TextStyle(color: Colors.black), @@ -74,7 +80,7 @@ class VitalSignItem extends StatelessWidget { TextSpan( text: unit, style: TextStyle( - color: Hexcolor('#B8382C'), + color: HexColor('#B8382C'), ), ), ]), diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index 15a1f699..0d19045b 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -41,7 +41,7 @@ class PaymentService extends StatelessWidget { children: [ Texts( TranslationBase.of(context).payment, - color: Hexcolor('#B61422'), + color: HexColor('#B61422'), bold: true, ), Texts( @@ -73,11 +73,11 @@ class PaymentService extends StatelessWidget { children: [ Texts( TranslationBase.of(context).onlineCheckIn, - color: Hexcolor('#B61422'), + color: HexColor('#B61422'), bold: true, ), Texts( - TranslationBase.of(context).appointment, + TranslationBase.of(context).appointment, fontSize: 14, fontWeight: FontWeight.normal, ), @@ -115,7 +115,7 @@ class PaymentService extends StatelessWidget { children: [ Texts( 'My Balances', - color: Hexcolor('#B61422'), + color: HexColor('#B61422'), bold: true, ), Texts( diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index 74f134ae..38fdd008 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -226,7 +226,7 @@ class _RateAppointmentClinicState extends State { child: Texts( 'Later', decoration: TextDecoration.underline, - color: Hexcolor('#151DFE'), + color: HexColor('#151DFE'), fontSize: 18, ), ) diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index 1583f033..83674906 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -177,7 +177,9 @@ class _RateAppointmentDoctorState extends State { }, ), ), - SizedBox(height: 12,), + SizedBox( + height: 12, + ), Container( width: double.infinity, child: Column( @@ -222,7 +224,7 @@ class _RateAppointmentDoctorState extends State { child: Texts( 'Later', decoration: TextDecoration.underline, - color: Hexcolor('#151DFE'), + color: HexColor('#151DFE'), fontSize: 18, ), ) diff --git a/lib/pages/symptom-checker/symtom-checker.dart b/lib/pages/symptom-checker/symtom-checker.dart new file mode 100644 index 00000000..f7475abf --- /dev/null +++ b/lib/pages/symptom-checker/symtom-checker.dart @@ -0,0 +1,43 @@ +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'; + +class SymptomChecker extends StatelessWidget { + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Symptom Checker', + body: Center( + child: SvgPicture.string( + ''' + + + + + + + + + + + + + + + + + + + + + + + + + + +'''))); + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 27161669..8d109983 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/pages/login/login.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; import 'package:diplomaticquarterapp/pages/family/add-family_type.dart'; import 'package:diplomaticquarterapp/pages/family/add-family-member.dart'; +import 'package:diplomaticquarterapp/pages/symptom-checker/symtom-checker.dart'; const String INIT_ROUTE = '/'; const String HOME = '/'; @@ -25,6 +26,7 @@ const String MY_FAMILIY = 'my-family'; const String ADD_FAMILY_MEMBER_TYPE = 'add-family-member-type'; const String ADD_FAMILY_MEMBER = 'add-family-member'; const String LIVE_CARE = 'live-care'; +const String SYMPTOM_CHECKER = 'symptom-checker'; var routes = { HOME: (_) => LandingPage(), WELCOME_LOGIN: (_) => WelcomeLogin(), @@ -37,5 +39,6 @@ var routes = { MY_FAMILIY: (_) => MyFamily(), ADD_FAMILY_MEMBER_TYPE: (_) => AddFamilyMemberType(), ADD_FAMILY_MEMBER: (_) => AddMember(), - LIVE_CARE: (_) => LiveCareHome() + LIVE_CARE: (_) => LiveCareHome(), + SYMPTOM_CHECKER: (_) => SymptomChecker() }; diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index c992e8e9..4b5dc264 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/core/service/base_service.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/models/LiveCare/insertVIDARequest.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -21,11 +22,12 @@ class DoctorsListService extends BaseService { double lat; double long; + String deviceToken; + String tokenID; Future getDoctorsList( int clinicID, int projectID, bool isNearest, BuildContext context, - {doctorId}) async { - //Utils.showProgressDialog(context); + {doctorId, doctorName}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -48,21 +50,26 @@ class DoctorsListService extends BaseService { "VersionID": req.VersionID, "Channel": req.Channel, "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, + "PatientOutSA": authUser.outSA, "TokenID": "", "DeviceTypeID": req.DeviceTypeID, "SessionID": "YckwoXhUmWBsnHKEKig", "ClinicID": clinicID, "ProjectID": projectID, - "DoctorName": doctorId, //!= null ? doctorId : 0, + "DoctorName": doctorName, //!= null ? doctorId : 0, "ContinueDentalPlan": false, "IsSearchAppointmnetByClinicID": true, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "gender": authUser.gender != null ? authUser.gender : 0, "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, - "Latitude": lat.toString(), - "Longitude": long.toString(), + // "Latitude": 0, + // "Longitude": 0, + // "License": true, + "IsVoiceCommand": doctorId != null && doctorId.length > 0 ? true : false, + "DoctorIDsList": doctorId, + "Latitude": lat != null ? lat.toString() : 0, + "Longitude": long != null ? long.toString() : 0, "IsGetNearAppointment": isNearest, if (isNearest) "SelectedDate": DateUtil.convertDateToString(DateTime.now()), @@ -106,7 +113,7 @@ class DoctorsListService extends BaseService { "VersionID": req.VersionID, "Channel": req.Channel, "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, + "PatientOutSA": authUser.outSA, "TokenID": "", "DeviceTypeID": req.DeviceTypeID, "SessionID": null, @@ -146,7 +153,7 @@ class DoctorsListService extends BaseService { "VersionID": req.VersionID, "Channel": req.Channel, "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, + "PatientOutSA": authUser.outSA, "TokenID": "", "DeviceTypeID": req.DeviceTypeID, "SessionID": null, @@ -188,7 +195,7 @@ class DoctorsListService extends BaseService { "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", - "PatientOutSA": 0, + "PatientOutSA": authUser.outSA, "SessionID": null, "isDentalAllowedBackend": false, "DeviceTypeID": 1 @@ -205,6 +212,42 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getDoctorScheduledFreeSlots( + int docID, int clinicID, int projectID, int serviceID, BuildContext context) async { + Map request; + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "DoctorID": docID, + "IsBookingForLiveCare": 1, + "ClinicID": clinicID, + "ProjectID": projectID, + "OriginalClinicID": clinicID, + "ServiceID": serviceID, + "days": 50, + "isReschadual": false, + "VersionID": req.VersionID, + "Channel": 3, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "generalid": "Cs2020@2016\$2958", + "PatientOutSA": authUser.outSA, + "SessionID": null, + "isDentalAllowedBackend": false, + "DeviceTypeID": 1 + }; + + dynamic localRes; + + await baseAppClient.post(GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, BuildContext context) async { Map request; @@ -258,6 +301,60 @@ 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 { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "IsForLiveCare": true, + "ProjectID": projectID, + "ClinicID": clinicID, + "DoctorID": docID, + "ServiceID": serviceID, + "StartTime": selectedTime, + "SelectedTime": selectedTime, + "EndTime": selectedTime, + "InitialSlotDuration": 0, + "StrAppointmentDate": selectedDate, + "IsVirtual": false, + "DeviceType": Platform.isIOS ? 'iOS' : 'Android', + "BookedBy": 102, + "VisitType": 1, + "VisitFor": 1, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "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 { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getPatientShare( String appoID, int clinicID, int projectID, BuildContext context) async { Map request; @@ -302,6 +399,51 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + 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)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + + request = { + "ProjectID": projectID, + "ClinicID": clinicID, + "AppointmentNo": appoID, + "IsActiveAppointment": true, + "IsForLiveCare": true, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "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 { + localRes = response['OnlineCheckInAppointments'][0]; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getPatientAppointmentHistory( bool isActiveAppointment, BuildContext context) async { Map request; @@ -378,7 +520,7 @@ class DoctorsListService extends BaseService { } Future confirmAppointment( - int appoNo, int clinicID, int projectID, BuildContext context) async { + int appoNo, int clinicID, int projectID, bool isLiveCare, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -392,6 +534,7 @@ class DoctorsListService extends BaseService { request = { "AppointmentNumber": appoNo, + "IsLiveCareAppointment": isLiveCare, "ClinicID": clinicID, "ProjectID": projectID, "ConfirmationBy": 102, @@ -421,6 +564,62 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + + 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)); + authUser = data; + } + + deviceToken = await sharedPref.getString(PUSH_TOKEN); + + 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.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + + request = { + "AppointmentNo": appoNo, + "ClinicID": clinicID, + "ProjectID": projectID, + "ServiceID": serviceID, + "AcceptedBy": docID, + "DeviceToken": deviceToken, + "Latitude": lat, + "Longitude": long, + "DeviceType": req.DeviceType, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + + await baseAppClient.post(INSERT_VIDA_REQUEST, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future cancelAppointment( AppoitmentAllHistoryResultList appo, BuildContext context) async { Map request; diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 1598184c..28b5e73b 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -14,6 +15,8 @@ import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; +import '../../locator.dart'; + // SharedPreferences sharedPref = new SharedPreferences(); enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } AppSharedPreferences sharedPref = new AppSharedPreferences(); @@ -41,6 +44,8 @@ class AuthProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; dynamic authenticatedUser; + AuthenticatedUserObject authenticatedUserObject = locator(); + AuthProvider() { getUserAuthentication(); } @@ -156,19 +161,15 @@ class AuthProvider with ChangeNotifier { request.generalid = GENERAL_ID; request.languageID = LANGUAGE_ID; request.patientOutSA = request.zipCode == '966' ? 0 : 1; - try { - dynamic localRes; - await new BaseAppClient().post(CHECK_PATIENT_AUTH, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); + + dynamic localRes; + await new BaseAppClient().post(CHECK_PATIENT_AUTH, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { throw error; - } + }, body: request.toJson()); + return Future.value(localRes); } Future getLoginInfo(request) async { @@ -180,19 +181,15 @@ class AuthProvider with ChangeNotifier { request.deviceTypeID = DeviceTypeID; request.patientOutSA = request.zipCode == '966' ? 0 : 1; request.isDentalAllowedBackend = false; - try { - dynamic localRes; - await new BaseAppClient().post(GET_MOBILE_INFO, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); + + dynamic localRes; + await new BaseAppClient().post(GET_MOBILE_INFO, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { throw error; - } + }, body: request.toJson()); + return Future.value(localRes); } Future sendActivationCode(request) async { @@ -204,20 +201,16 @@ class AuthProvider with ChangeNotifier { request.deviceTypeID = DeviceTypeID; request.patientOutSA = request.zipCode == '966' ? 0 : 1; request.isDentalAllowedBackend = false; - try { - dynamic localRes; - 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); - } catch (error) { - print(error); + + dynamic localRes; + 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 checkActivationCode(request, [value]) async { diff --git a/lib/services/covid-drivethru/covid-drivethru.dart b/lib/services/covid-drivethru/covid-drivethru.dart new file mode 100644 index 00000000..2681783b --- /dev/null +++ b/lib/services/covid-drivethru/covid-drivethru.dart @@ -0,0 +1,126 @@ +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/Request.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + +class CovidDriveThruService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + Future getCovidProjectsList(BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + 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 + }; + + dynamic localRes; + + await baseAppClient.post(GET_COVID_DRIVETHRU_PROJECT_LIST, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getCovidPaymentInformation(BuildContext context, int projectID) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + 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_PAYMENT_INFO, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getCovidFreeSlots(BuildContext context, int projectID) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + 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); + 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 ea2247d3..f5a06df9 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -33,6 +33,10 @@ const String REMOVE_FILE_STATUS = 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'; class FamilyFilesProvider with ChangeNotifier { bool isLogin = false; @@ -60,6 +64,48 @@ class FamilyFilesProvider with ChangeNotifier { } } + Future getUserViewRequest(responseID) async { + try { + dynamic localRes; + Map request = {}; + request['ResponseID'] = responseID; + await new BaseAppClient().post(RECEVIED_REQUEST_URL, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + return Future.value(error); + }, body: request); + sharedPref.setObject(FAMILY_FILE, localRes); + return Future.value( + GetAllSharedRecordsByStatusResponse.fromJson(localRes)); + } catch (error) { + print(error); + throw error; + } + } + + Future getUserSentRequest() async { + try { + dynamic localRes; + Map request = {}; + request['Status'] = 0; + await new BaseAppClient().post(SENT_REQUEST_URL, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + return Future.value(error); + //AppToast.showErrorToast(message: error); + //throw error; + }, body: request); + sharedPref.setObject(FAMILY_FILE, localRes); + return Future.value( + GetAllSharedRecordsByStatusResponse.fromJson(localRes)); + } catch (error) { + print(error); + throw error; + } + } + Future addFamilyFile(AddFamilyFileReq request) async { try { dynamic localRes; diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index f76e0336..65cf6daf 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -53,6 +53,81 @@ class LiveCareService extends BaseService { return Future.value(localRes); } + Future getLiveCareScheduledClinics(BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + 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 + }; + + dynamic localRes; + + 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); + } + + Future getLiveCareScheduledDoctorList(BuildContext context, int serviceID) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + 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 + }; + + 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); + return Future.value(localRes); + } + Future getLivecareHistory(BuildContext context) async { Map request; diff --git a/lib/services/robo_search/search_provider.dart b/lib/services/robo_search/search_provider.dart index bd129d1b..82c32f91 100644 --- a/lib/services/robo_search/search_provider.dart +++ b/lib/services/robo_search/search_provider.dart @@ -10,9 +10,11 @@ class SearchProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; dynamic pageData = {}; - + static bool isNewSession = false; + static var sessionID = new DateTime.now().millisecondsSinceEpoch; Future getBotPages(request) async { try { + request['SessionID'] = '123'; await BaseAppClient().post(SEARCH_BOT, onSuccess: (dynamic response, int statusCode) { pageData = response; @@ -34,4 +36,12 @@ class SearchProvider with ChangeNotifier { //projectProvider.setSearchValue(pageData); notifyListeners(); } + + getSessionID() { + if (isNewSession == true) { + return new DateTime.now().millisecondsSinceEpoch; + } else { + return sessionID; + } + } } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index ac4f5860..5b826f00 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -4,16 +4,14 @@ import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); +final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = + FlutterLocalNotificationsPlugin(); class LocalNotification { - - static Future scheduleNotification( {@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { - ///vibrationPattern var vibrationPattern = Int64List(4); vibrationPattern[0] = 0; @@ -26,8 +24,10 @@ class LocalNotification { 'ActivePrescriptions', 'ActivePrescriptionsDescription', // icon: 'secondary_icon', - sound: RawResourceAndroidNotificationSound('slow_spring_board'),///change it to be as ionic - // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic + sound: RawResourceAndroidNotificationSound('slow_spring_board'), + + ///change it to be as ionic + // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic vibrationPattern: vibrationPattern, enableLights: true, color: const Color.fromARGB(255, 255, 0, 0), @@ -35,15 +35,13 @@ class LocalNotification { ledOnMs: 1000, ledOffMs: 500); var iOSPlatformChannelSpecifics = - IOSNotificationDetails(sound: 'slow_spring_board.aiff');///change it to be as ionic - var platformChannelSpecifics = NotificationDetails( - androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.schedule( - 0, - title, - description, - scheduledNotificationDateTime, - platformChannelSpecifics); + IOSNotificationDetails(sound: 'slow_spring_board.aiff'); + + ///change it to be as ionic + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.schedule(0, title, description, + // scheduledNotificationDateTime, platformChannelSpecifics); } ///Repeat notification every day at approximately 10:00:00 am @@ -54,14 +52,14 @@ class LocalNotification { 'repeatDailyAtTime channel name', 'repeatDailyAtTime description'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - var platformChannelSpecifics = NotificationDetails( - androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.showDailyAtTime( - 0, - 'show daily title', - 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - time, - platformChannelSpecifics); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showDailyAtTime( + // 0, + // 'show daily title', + // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // time, + // platformChannelSpecifics); } ///Repeat notification weekly on Monday at approximately 10:00:00 am @@ -72,15 +70,15 @@ class LocalNotification { 'show weekly channel name', 'show weekly description'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - var platformChannelSpecifics = NotificationDetails( - androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( - 0, - 'show weekly title', - 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - Day.Monday, - time, - platformChannelSpecifics); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( + // 0, + // 'show weekly title', + // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // Day.Monday, + // time, + // platformChannelSpecifics); } static String _toTwoDigitString(int value) { diff --git a/lib/uitl/ProgressDialog.dart b/lib/uitl/ProgressDialog.dart new file mode 100644 index 00000000..6820a6d5 --- /dev/null +++ b/lib/uitl/ProgressDialog.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +AlertDialog _alert = AlertDialog( + content: Row( + children: [ + CircularProgressIndicator(), + Container(margin: EdgeInsets.only(left: 7), child: Text("Loading...")), + ], + ), +); + +class ProgressDialogUtil { + static showProgressDialog(BuildContext context) { + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return _alert; + }, + ); + } + + static hideProgressDialog(BuildContext context) { + Navigator.pop(context); + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 28b273e5..63f56674 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -95,6 +95,10 @@ class TranslationBase { String get confirm => localizedValues['confirm'][locale.languageCode]; + String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode]; + + String get waitingForDoctor => localizedValues['waitingForDoctor'][locale.languageCode]; + String get confirmLater => localizedValues['confirmLater'][locale.languageCode]; @@ -220,6 +224,9 @@ class TranslationBase { String get upcomingLivecare => localizedValues['upcoming-livecare'][locale.languageCode]; + String get liveCareAppo => + localizedValues['livecareAppo'][locale.languageCode]; + String get upcomingDetails => localizedValues['upcoming-details'][locale.languageCode]; @@ -417,148 +424,224 @@ class TranslationBase { 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 hMGService =>localizedValues['HMGService'][locale.languageCode]; - String get viewAllHabibMedicalService =>localizedValues['ViewAllHabibMedicalService'][locale.languageCode]; - String get viewAll =>localizedValues['viewAll'][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 parking =>localizedValues['parking'][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 nearester=> localizedValues['nearester'][locale.languageCode]; - String get locationa=> localizedValues['locationa'][locale.languageCode]; - String get ambulancerequest=> localizedValues['ambulancerequest'][locale.languageCode]; - String get requestA=> localizedValues['requestA'][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 hMGService => localizedValues['HMGService'][locale.languageCode]; + String get viewAllHabibMedicalService => + localizedValues['ViewAllHabibMedicalService'][locale.languageCode]; + String get viewAll => localizedValues['viewAll'][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 parking => localizedValues['parking'][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 nearester => localizedValues['nearester'][locale.languageCode]; + String get locationa => localizedValues['locationa'][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 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 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 history => localizedValues['History'][locale.languageCode]; - String get orderNo => localizedValues['OrderNo'][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 billNo => localizedValues['BillNo'][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 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 userView => localizedValues['user-view'][locale.languageCode]; + String get sentRequest => + localizedValues['sent-requests'][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 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 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 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 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 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 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 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 depositorName => + localizedValues['DepositorName'][locale.languageCode]; + String get mobileNumber => + localizedValues['MobileNumber'][locale.languageCode]; String get ok => localizedValues['Ok'][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 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]; @@ -572,24 +655,32 @@ class TranslationBase { 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 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]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart index f8aff960..b6ae08b1 100644 --- a/lib/widgets/buttons/button.dart +++ b/lib/widgets/buttons/button.dart @@ -105,7 +105,7 @@ class _ButtonState extends State