diff --git a/android/app/build.gradle b/android/app/build.gradle index fd6c7720..2e124398 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,6 +28,15 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 30 +// signingConfigs { +// release { +// storeFile file('C:\\Users\\admin\\Downloads\\DQKey.jks') +// storePassword 'HmGsa123' +// keyAlias 'key' +// keyPassword 'HmGsa123' +// } +// } + sourceSets { main.java.srcDirs += 'src/main/kotlin' } @@ -39,7 +48,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.hmg.hmgDr" - minSdkVersion 18 + minSdkVersion 21 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -50,10 +59,30 @@ android { buildTypes { release { // TODO: Add your own signing config for the release build. + signingConfig signingConfigs.debug + } + debug { // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug } } + +// flavorDimensions 'environment' +// productFlavors { +// production { +// dimension 'environment' +// } +// } +// +// configurations { +// productionDebugImplementation +// productionReleaseImplementation +// } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + } flutter { @@ -65,18 +94,20 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' //openTok - implementation 'com.opentok.android:opentok-android-sdk:2.16.5' + implementation 'com.opentok.android:opentok-android-sdk:2.20.1' //permissions implementation 'pub.devrel:easypermissions:0.4.0' //retrofit - implementation 'com.squareup.retrofit2:retrofit:2.6.2' + implementation 'com.squareup.retrofit2:retrofit:2.9.0' + implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.6.2' - implementation 'com.squareup.okhttp3:logging-interceptor:3.14.1' + implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' } apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 57a59745..0ac76ea8 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ - + + + + + + + + + + + - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index d1d2a305..f52c2cf2 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -5,7 +5,17 @@ #fc3850 #e4e9f2 + #80757575 + #00ffffff + + #827b92 #484258 + #FF2E303A + + #fff + #000 + #389842 + #d51e26 diff --git a/android/app/src/main/res/values/dimens.xml b/android/app/src/main/res/values/dimens.xml index 79f3d269..65c5c064 100644 --- a/android/app/src/main/res/values/dimens.xml +++ b/android/app/src/main/res/values/dimens.xml @@ -3,20 +3,45 @@ 16dp 16dp 28dp + 12dp 24dp 60dp 54dp + 48dp + 24dp + + 24dp + 25dp 88dp + 40dp 117dp + 50dp 50dp + 25dp 100dp + 40dp 90dp - - 24dp - 25dp + + 14sp + 16sp + 22sp + + + 4dp + 8dp + 16dp + 24dp + + + 36dp + 60dp + 80dp + 40dp + + diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 74349756..bc694f7c 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -4,5 +4,7 @@ الوقت المتبقي بالثانيه: Settings Cancel + + Hello blank fragment \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 24355fae..dae5749f 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,10 +1,12 @@ + + @@ -16,4 +18,26 @@ true @null + + + diff --git a/android/build.gradle b/android/build.gradle index ea0f0026..badc1b18 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -16,10 +16,12 @@ allprojects { repositories { google() jcenter() + mavenCentral() maven { url 'https://tokbox.bintray.com/maven' } } } + rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" diff --git a/assets/fonts/DoctorApp.ttf b/assets/fonts/DoctorApp.ttf index aa108809..4ef2028b 100644 Binary files a/assets/fonts/DoctorApp.ttf and b/assets/fonts/DoctorApp.ttf differ diff --git a/dart b/dart new file mode 100644 index 00000000..e69de29b diff --git a/ios/Podfile b/ios/Podfile index bebf8f5b..c2335042 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' @@ -64,7 +64,8 @@ target 'Runner' do # Keep pod path relative so it can be checked into Podfile.lock. pod 'Flutter', :path => 'Flutter' pod 'OpenTok' - pod 'Alamofire' + pod 'Alamofire', '~> 5.2' + pod 'AADraggableView' # Plugin Pods # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock diff --git a/ios/Podfile.lock b/ios/Podfile.lock deleted file mode 100644 index 878a1850..00000000 --- a/ios/Podfile.lock +++ /dev/null @@ -1,325 +0,0 @@ -PODS: - - Alamofire (4.9.1) - - 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/CoreOnly (6.33.0): - - FirebaseCore (= 6.10.3) - - Firebase/Messaging (6.33.0): - - Firebase/CoreOnly - - FirebaseMessaging (~> 4.7.0) - - firebase_core (0.5.3): - - Firebase/CoreOnly (~> 6.33.0) - - Flutter - - firebase_core_web (0.1.0): - - Flutter - - firebase_messaging (7.0.3): - - Firebase/CoreOnly (~> 6.33.0) - - Firebase/Messaging (~> 6.33.0) - - firebase_core - - Flutter - - FirebaseCore (6.10.3): - - FirebaseCoreDiagnostics (~> 1.6) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Logger (~> 6.7) - - FirebaseCoreDiagnostics (1.7.0): - - GoogleDataTransport (~> 7.4) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Logger (~> 6.7) - - nanopb (~> 1.30906.0) - - FirebaseInstallations (1.7.0): - - FirebaseCore (~> 6.10) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - PromisesObjC (~> 1.2) - - FirebaseInstanceID (4.8.0): - - FirebaseCore (~> 6.10) - - FirebaseInstallations (~> 1.6) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - FirebaseMessaging (4.7.1): - - FirebaseCore (~> 6.10) - - FirebaseInstanceID (~> 4.7) - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Reachability (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - Protobuf (>= 3.9.2, ~> 3.9) - - Flutter (1.0.0) - - flutter_flexible_toast (0.0.1): - - Flutter - - flutter_plugin_android_lifecycle (0.0.1): - - Flutter - - GoogleDataTransport (7.5.1): - - nanopb (~> 1.30906.0) - - GoogleUtilities/AppDelegateSwizzler (6.7.2): - - GoogleUtilities/Environment - - GoogleUtilities/Logger - - GoogleUtilities/Network - - GoogleUtilities/Environment (6.7.2): - - PromisesObjC (~> 1.2) - - GoogleUtilities/Logger (6.7.2): - - GoogleUtilities/Environment - - GoogleUtilities/Network (6.7.2): - - GoogleUtilities/Logger - - "GoogleUtilities/NSData+zlib" - - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (6.7.2)" - - GoogleUtilities/Reachability (6.7.2): - - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (6.7.2): - - GoogleUtilities/Logger - - hexcolor (0.0.1): - - Flutter - - imei_plugin (0.0.1): - - Flutter - - local_auth (0.0.1): - - Flutter - - maps_launcher (0.0.1): - - Flutter - - MTBBarcodeScanner (5.0.11) - - nanopb (1.30906.0): - - nanopb/decode (= 1.30906.0) - - nanopb/encode (= 1.30906.0) - - nanopb/decode (1.30906.0) - - nanopb/encode (1.30906.0) - - OpenTok (2.15.3) - - path_provider_linux (0.0.1): - - Flutter - - path_provider_windows (0.0.1): - - Flutter - - "permission_handler (5.1.0+2)": - - Flutter - - PromisesObjC (1.2.11) - - Protobuf (3.13.0) - - Reachability (3.2) - - screen (0.0.1): - - Flutter - - 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 - - shared_preferences_windows (0.0.1): - - Flutter - - speech_to_text (0.0.1): - - Flutter - - Try - - SwiftProtobuf (1.9.0) - - Try (2.1.1) - - 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 - - url_launcher_windows (0.0.1): - - Flutter - - video_player (0.0.1): - - Flutter - - video_player_web (0.0.1): - - Flutter - - wakelock (0.0.1): - - Flutter - - webview_flutter (0.0.1): - - Flutter - -DEPENDENCIES: - - Alamofire - - 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_core (from `.symlinks/plugins/firebase_core/ios`) - - firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`) - - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - - Flutter (from `Flutter`) - - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) - - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - - imei_plugin (from `.symlinks/plugins/imei_plugin/ios`) - - local_auth (from `.symlinks/plugins/local_auth/ios`) - - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) - - OpenTok - - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) - - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - - screen (from `.symlinks/plugins/screen/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`) - - shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`) - - speech_to_text (from `.symlinks/plugins/speech_to_text/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`) - - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) - - video_player (from `.symlinks/plugins/video_player/ios`) - - video_player_web (from `.symlinks/plugins/video_player_web/ios`) - - wakelock (from `.symlinks/plugins/wakelock/ios`) - - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) - -SPEC REPOS: - trunk: - - Alamofire - - Firebase - - FirebaseCore - - FirebaseCoreDiagnostics - - FirebaseInstallations - - FirebaseInstanceID - - FirebaseMessaging - - GoogleDataTransport - - GoogleUtilities - - MTBBarcodeScanner - - nanopb - - OpenTok - - PromisesObjC - - Protobuf - - Reachability - - SwiftProtobuf - - Try - -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_core: - :path: ".symlinks/plugins/firebase_core/ios" - firebase_core_web: - :path: ".symlinks/plugins/firebase_core_web/ios" - firebase_messaging: - :path: ".symlinks/plugins/firebase_messaging/ios" - Flutter: - :path: Flutter - flutter_flexible_toast: - :path: ".symlinks/plugins/flutter_flexible_toast/ios" - flutter_plugin_android_lifecycle: - :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" - hexcolor: - :path: ".symlinks/plugins/hexcolor/ios" - imei_plugin: - :path: ".symlinks/plugins/imei_plugin/ios" - local_auth: - :path: ".symlinks/plugins/local_auth/ios" - maps_launcher: - :path: ".symlinks/plugins/maps_launcher/ios" - path_provider_linux: - :path: ".symlinks/plugins/path_provider_linux/ios" - path_provider_windows: - :path: ".symlinks/plugins/path_provider_windows/ios" - permission_handler: - :path: ".symlinks/plugins/permission_handler/ios" - screen: - :path: ".symlinks/plugins/screen/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" - shared_preferences_windows: - :path: ".symlinks/plugins/shared_preferences_windows/ios" - speech_to_text: - :path: ".symlinks/plugins/speech_to_text/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" - url_launcher_windows: - :path: ".symlinks/plugins/url_launcher_windows/ios" - video_player: - :path: ".symlinks/plugins/video_player/ios" - video_player_web: - :path: ".symlinks/plugins/video_player_web/ios" - wakelock: - :path: ".symlinks/plugins/wakelock/ios" - webview_flutter: - :path: ".symlinks/plugins/webview_flutter/ios" - -SPEC CHECKSUMS: - Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 - barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 - connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 - connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b - connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 - device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 - Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 - firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 - firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 - firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 - FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd - FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 - FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 - FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 - FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 - flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 - GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 - GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 - hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 - imei_plugin: cb1af7c223ac2d82dcd1457a7137d93d65d2a3cd - local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd - maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 - MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc - OpenTok: fde03ecc5ea31fe0a453242847c4ee1f47e1d735 - path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 - path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b - permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 - PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f - Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748 - Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 - screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0 - shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 - shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 - shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 - shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae - speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe - SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932 - Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 - url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 - url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 - url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c - url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 - video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e - video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7 - wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 - webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 - -PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 - -COCOAPODS: 1.10.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index f0784432..66be39bf 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -9,12 +9,16 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 29211E4225C172B700DD740D /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 29211E4125C172B700DD740D /* GoogleService-Info.plist */; }; + 300790FA266FB14B0052174C /* VCEmbeder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 300790F9266FB14B0052174C /* VCEmbeder.swift */; }; + 300790FC26710CAB0052174C /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 300790FB26710CAB0052174C /* Extensions.swift */; }; + 30F70E6C266F56FD005D8F8E /* MainAppViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30F70E6B266F56FD005D8F8E /* MainAppViewController.swift */; }; + 30F70E6F266F6509005D8F8E /* VideoCallRequestParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30F70E6E266F6509005D8F8E /* VideoCallRequestParameters.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - 9CE61EBD24AB366E008D68DD /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CE61EBC24AB366E008D68DD /* VideoViewController.swift */; }; + 9CE61EBD24AB366E008D68DD /* VideoCallViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CE61EBC24AB366E008D68DD /* VideoCallViewController.swift */; }; 9CE61ECD24ADBB4C008D68DD /* ICallProtocoll.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CE61ECC24ADBB4C008D68DD /* ICallProtocoll.swift */; }; B650DC3076E9D70CB188286A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93A5F83B23AB032D1E096663 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ @@ -37,6 +41,10 @@ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 29211CD725C165D600DD740D /* RunnerRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerRelease.entitlements; sourceTree = ""; }; 29211E4125C172B700DD740D /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + 300790F9266FB14B0052174C /* VCEmbeder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VCEmbeder.swift; sourceTree = ""; }; + 300790FB26710CAB0052174C /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + 30F70E6B266F56FD005D8F8E /* MainAppViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainAppViewController.swift; sourceTree = ""; }; + 30F70E6E266F6509005D8F8E /* VideoCallRequestParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoCallRequestParameters.swift; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -50,7 +58,7 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9CE61EBC24AB366E008D68DD /* VideoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoViewController.swift; sourceTree = ""; }; + 9CE61EBC24AB366E008D68DD /* VideoCallViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoCallViewController.swift; sourceTree = ""; }; 9CE61ECC24ADBB4C008D68DD /* ICallProtocoll.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ICallProtocoll.swift; sourceTree = ""; }; 9D4B7DB43C6A6C849D2387CE /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; E698D7B14B12DF768FE47A1A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; @@ -68,6 +76,31 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 300790F8266FB0F10052174C /* helpers */ = { + isa = PBXGroup; + children = ( + 300790F9266FB14B0052174C /* VCEmbeder.swift */, + 300790FB26710CAB0052174C /* Extensions.swift */, + ); + name = helpers; + sourceTree = ""; + }; + 30F70E6A266F56C9005D8F8E /* controllers */ = { + isa = PBXGroup; + children = ( + 30F70E6B266F56FD005D8F8E /* MainAppViewController.swift */, + ); + name = controllers; + sourceTree = ""; + }; + 30F70E6D266F64F8005D8F8E /* Models */ = { + isa = PBXGroup; + children = ( + 30F70E6E266F6509005D8F8E /* VideoCallRequestParameters.swift */, + ); + name = Models; + sourceTree = ""; + }; 7D66D387293CE5376A07EC5F /* Pods */ = { isa = PBXGroup; children = ( @@ -111,6 +144,9 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 300790F8266FB0F10052174C /* helpers */, + 30F70E6D266F64F8005D8F8E /* Models */, + 30F70E6A266F56C9005D8F8E /* controllers */, 29211E4125C172B700DD740D /* GoogleService-Info.plist */, 29211CD725C165D600DD740D /* RunnerRelease.entitlements */, 97C146FA1CF9000F007C117D /* Main.storyboard */, @@ -122,7 +158,7 @@ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - 9CE61EBC24AB366E008D68DD /* VideoViewController.swift */, + 9CE61EBC24AB366E008D68DD /* VideoCallViewController.swift */, 9CE61ECC24ADBB4C008D68DD /* ICallProtocoll.swift */, ); path = Runner; @@ -290,10 +326,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 300790FA266FB14B0052174C /* VCEmbeder.swift in Sources */, + 30F70E6F266F6509005D8F8E /* VideoCallRequestParameters.swift in Sources */, 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 9CE61EBD24AB366E008D68DD /* VideoViewController.swift in Sources */, + 300790FC26710CAB0052174C /* Extensions.swift in Sources */, + 9CE61EBD24AB366E008D68DD /* VideoCallViewController.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 9CE61ECD24ADBB4C008D68DD /* ICallProtocoll.swift in Sources */, + 30F70E6C266F56FD005D8F8E /* MainAppViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb2dffc4..a28140cf 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -27,6 +27,8 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + - - + + + + Bool { - let controller : FlutterViewController = window?.rootViewController as! FlutterViewController - let videoCallChannel = FlutterMethodChannel(name: "Dr.cloudSolution/videoCall", - binaryMessenger: controller.binaryMessenger) - videoCallChannel.setMethodCallHandler({ - (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in - self.result = result - switch call.method { - case "openVideoCall": - do { - let arguments = call.arguments as? NSDictionary - let kApiKey = arguments!["kApiKey"] as? String - let kSessionId = arguments!["kSessionId"] as? String - let kToken = arguments!["kToken"] as? String - let appLang = arguments!["appLang"] as? String - let vC_ID = arguments!["VC_ID"] as? Int - let tokenID = arguments!["TokenID"] as? String - let generalId = arguments!["generalId"] as? String - let doctorId = arguments!["DoctorId"] as? Int - let baseUrl = arguments!["baseUrl"] as? String - - self.openVideoChat(result: result,kApiKey: kApiKey!,kSessionId:kSessionId!,kToken: kToken!, appLang: appLang!, vC_ID: vC_ID!,tokenID: tokenID!,generalId: generalId!,doctorId: doctorId!, baseUrl: baseUrl!) - } - default: - result(FlutterMethodNotImplemented) - } - }) - GeneratedPluginRegistrant.register(with: self) + GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } @@ -61,7 +35,7 @@ import OpenTok let storyboard = UIStoryboard(name: "Main", bundle: nil) let identifier = "ViewControllerNav" let navVC = storyboard.instantiateViewController(withIdentifier: identifier) as! UINavigationController - let videoVC = navVC.viewControllers.first as! ViewController + let videoVC = navVC.viewControllers.first as! VideoCallViewController videoVC.kApiKey=kApiKey videoVC.kSessionId=kSessionId videoVC.kToken=kToken @@ -75,6 +49,6 @@ import OpenTok navVC.modalPresentationStyle = .fullScreen window.rootViewController?.present(navVC, animated: true, completion: nil) - } } + diff --git a/ios/Runner/Assets.xcassets/Contents.json b/ios/Runner/Assets.xcassets/Contents.json index da4a164c..73c00596 100755 --- a/ios/Runner/Assets.xcassets/Contents.json +++ b/ios/Runner/Assets.xcassets/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/ios/Runner/Assets.xcassets/camera_back.imageset/Contents.json b/ios/Runner/Assets.xcassets/camera_back.imageset/Contents.json new file mode 100644 index 00000000..ab08ef1a --- /dev/null +++ b/ios/Runner/Assets.xcassets/camera_back.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "camera_back.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/camera_back.imageset/camera_back.png b/ios/Runner/Assets.xcassets/camera_back.imageset/camera_back.png new file mode 100644 index 00000000..c3d63ac3 Binary files /dev/null and b/ios/Runner/Assets.xcassets/camera_back.imageset/camera_back.png differ diff --git a/ios/Runner/Assets.xcassets/camera_front.imageset/Contents.json b/ios/Runner/Assets.xcassets/camera_front.imageset/Contents.json new file mode 100644 index 00000000..a0e93123 --- /dev/null +++ b/ios/Runner/Assets.xcassets/camera_front.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "camera_front.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/camera_front.imageset/camera_front.png b/ios/Runner/Assets.xcassets/camera_front.imageset/camera_front.png new file mode 100644 index 00000000..332ab0f5 Binary files /dev/null and b/ios/Runner/Assets.xcassets/camera_front.imageset/camera_front.png differ diff --git a/ios/Runner/Assets.xcassets/end_call.imageset/Contents.json b/ios/Runner/Assets.xcassets/end_call.imageset/Contents.json new file mode 100644 index 00000000..3762a5af --- /dev/null +++ b/ios/Runner/Assets.xcassets/end_call.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "end_call.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/end_call.imageset/end_call.png b/ios/Runner/Assets.xcassets/end_call.imageset/end_call.png new file mode 100644 index 00000000..52f8e267 Binary files /dev/null and b/ios/Runner/Assets.xcassets/end_call.imageset/end_call.png differ diff --git a/ios/Runner/Assets.xcassets/expand_video.imageset/Contents.json b/ios/Runner/Assets.xcassets/expand_video.imageset/Contents.json new file mode 100644 index 00000000..1ecfeae9 --- /dev/null +++ b/ios/Runner/Assets.xcassets/expand_video.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "expand.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/expand_video.imageset/expand.png b/ios/Runner/Assets.xcassets/expand_video.imageset/expand.png new file mode 100644 index 00000000..7020dc2e Binary files /dev/null and b/ios/Runner/Assets.xcassets/expand_video.imageset/expand.png differ diff --git a/ios/Runner/Assets.xcassets/float_video.imageset/Contents.json b/ios/Runner/Assets.xcassets/float_video.imageset/Contents.json new file mode 100644 index 00000000..e3a2ec5a --- /dev/null +++ b/ios/Runner/Assets.xcassets/float_video.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Group 8024.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/float_video.imageset/Group 8024.png b/ios/Runner/Assets.xcassets/float_video.imageset/Group 8024.png new file mode 100644 index 00000000..59f2c9e6 Binary files /dev/null and b/ios/Runner/Assets.xcassets/float_video.imageset/Group 8024.png differ diff --git a/ios/Runner/Assets.xcassets/hide_video_icon.imageset/Contents.json b/ios/Runner/Assets.xcassets/hide_video_icon.imageset/Contents.json new file mode 100644 index 00000000..91a3b7b1 --- /dev/null +++ b/ios/Runner/Assets.xcassets/hide_video_icon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "hide_video_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/hide_video_icon.imageset/hide_video_icon.png b/ios/Runner/Assets.xcassets/hide_video_icon.imageset/hide_video_icon.png new file mode 100644 index 00000000..40889f77 Binary files /dev/null and b/ios/Runner/Assets.xcassets/hide_video_icon.imageset/hide_video_icon.png differ diff --git a/ios/Runner/Assets.xcassets/mic_mute.imageset/Contents.json b/ios/Runner/Assets.xcassets/mic_mute.imageset/Contents.json new file mode 100644 index 00000000..2a0f4d2e --- /dev/null +++ b/ios/Runner/Assets.xcassets/mic_mute.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "mic_mute.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/mic_mute.imageset/mic_mute.png b/ios/Runner/Assets.xcassets/mic_mute.imageset/mic_mute.png new file mode 100644 index 00000000..266cb6c7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/mic_mute.imageset/mic_mute.png differ diff --git a/ios/Runner/Assets.xcassets/mic_unmute.imageset/Contents.json b/ios/Runner/Assets.xcassets/mic_unmute.imageset/Contents.json new file mode 100644 index 00000000..8e85d01a --- /dev/null +++ b/ios/Runner/Assets.xcassets/mic_unmute.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Group 8020.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/mic_unmute.imageset/Group 8020.png b/ios/Runner/Assets.xcassets/mic_unmute.imageset/Group 8020.png new file mode 100644 index 00000000..ef7617f7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/mic_unmute.imageset/Group 8020.png differ diff --git a/ios/Runner/Assets.xcassets/video_mute.imageset/Contents.json b/ios/Runner/Assets.xcassets/video_mute.imageset/Contents.json new file mode 100644 index 00000000..4403d6ee --- /dev/null +++ b/ios/Runner/Assets.xcassets/video_mute.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "video_mute.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/video_mute.imageset/video_mute.png b/ios/Runner/Assets.xcassets/video_mute.imageset/video_mute.png new file mode 100644 index 00000000..d6ccbe7a Binary files /dev/null and b/ios/Runner/Assets.xcassets/video_mute.imageset/video_mute.png differ diff --git a/ios/Runner/Assets.xcassets/video_unmute.imageset/Contents.json b/ios/Runner/Assets.xcassets/video_unmute.imageset/Contents.json new file mode 100644 index 00000000..51724501 --- /dev/null +++ b/ios/Runner/Assets.xcassets/video_unmute.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Group 8022.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/video_unmute.imageset/Group 8022.png b/ios/Runner/Assets.xcassets/video_unmute.imageset/Group 8022.png new file mode 100644 index 00000000..6fcbe750 Binary files /dev/null and b/ios/Runner/Assets.xcassets/video_unmute.imageset/Group 8022.png differ diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard index 73e18f76..2bdee5a2 100755 --- a/ios/Runner/Base.lproj/Main.storyboard +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -1,296 +1,366 @@ - - + + - + - + - + - + - + - + - + - + - - - + + - + - - + - - - - - - - - + + - - - + + + + + + + + + + + + - - + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - + - - - - - - - - - - + + + + + + + + + + - - + - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + diff --git a/ios/Runner/Extensions.swift b/ios/Runner/Extensions.swift new file mode 100644 index 00000000..b79c8deb --- /dev/null +++ b/ios/Runner/Extensions.swift @@ -0,0 +1,27 @@ +// +// Extensions.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 09/06/2021. +// Copyright © 2021 The Chromium Authors. All rights reserved. +// +import AADraggableView + +extension AADraggableView{ + func enable(_ enable:Bool){ + isEnabled = enable + if enable == false{ + gestureRecognizers?.forEach({ gest in + removeGestureRecognizer(gest) + }) + } + } +} + +extension UIView{ + func hidden(_ hidden:Bool, rootView:UIView){ + UIView.transition(with: rootView, duration: 0.5, options: .transitionCrossDissolve, animations: { + self.isHidden = hidden + }) + } +} diff --git a/ios/Runner/MainAppViewController.swift b/ios/Runner/MainAppViewController.swift new file mode 100644 index 00000000..c7b7a18d --- /dev/null +++ b/ios/Runner/MainAppViewController.swift @@ -0,0 +1,190 @@ +// +// MainAppViewController.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 08/06/2021. +// Copyright © 2021 The Chromium Authors. All rights reserved. +// + +import Foundation +import AADraggableView + +class MainAppViewController: FlutterViewController{ + var videoCallContainer:AADraggableView! + var videoCallViewController:VideoCallViewController! + var videoCallFlutterResult:FlutterResult? + var vdoCallViewFloatRectConstraint:[NSLayoutConstraint]! + var vdoCallViewFullConstraint:[NSLayoutConstraint]! + var vdoCallViewFloatCircleConstraint:[NSLayoutConstraint]! + + + override func viewDidLoad() { + super.viewDidLoad() + initFlutterBridge() + prepareVideoCallView() + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + } + + var videoCallChannel:FlutterMethodChannel? + private func initFlutterBridge(){ + videoCallChannel = FlutterMethodChannel(name: "Dr.cloudSolution/videoCall", binaryMessenger: binaryMessenger) + videoCallChannel?.setMethodCallHandler({ + (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in + switch call.method { + case "openVideoCall": + self.startVideoCall(result: result, call: call) + default: + result(FlutterMethodNotImplemented) + } + }) + } + +} + + +// Video Call Functions +extension MainAppViewController : ICallProtocol{ + + func prepareVideoCallView(){ + videoCallContainer = AADraggableView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height)) + videoCallContainer.backgroundColor = UIColor.black + videoCallContainer.isHidden = true + videoCallContainer.clipsToBounds = true + videoCallContainer.padding = 20 + videoCallContainer.reposition = .edgesOnly + videoCallContainer.isEnabled = false + + view.addSubview(videoCallContainer) + setVideoViewConstrints() + NSLayoutConstraint.activate(vdoCallViewFullConstraint) + NSLayoutConstraint.deactivate(vdoCallViewFloatRectConstraint) + + ViewEmbedder.embed( + withIdentifier: "videoCall", // Storyboard ID + parent: self, + container: self.videoCallContainer){ vc in + self.videoCallViewController = vc as? VideoCallViewController + + } + } + + private func showVideo(show:Bool){ + self.videoCallContainer.hidden(!show, rootView: view) + } + + private func startVideoCall(result: @escaping FlutterResult, call:FlutterMethodCall) { + videoCallFlutterResult = result + + if let arguments = call.arguments as? NSDictionary{ + showVideoCallView(true) + + videoCallViewController.onRectFloat = { isRectFloat in + self.rectFloatVideoCallView(isRectFloat) + } + + videoCallViewController.onCircleFloat = { isCircleFloat in + self.circleFloatVideoCallView(isCircleFloat) + } + videoCallViewController.onCallConnect = { + self.videoCallChannel?.invokeMethod("onCallConnected",arguments: nil) + } + videoCallViewController.onCallDisconnect = { + self.showVideoCallView(false) + self.videoCallViewController.minimizeVideoState(state: false) + self.videoCallChannel?.invokeMethod("onCallDisconnected",arguments: nil) + } + videoCallViewController.callBack = self + videoCallViewController.start(params: VideoCallRequestParameters(dictionary: arguments)) + } + + + } + + private func rectFloatVideoCallView(_ value:Bool){ + videoCallContainer.enable(value) + + UIView.animate(withDuration: 0.5) { + if(value){ + NSLayoutConstraint.deactivate(self.vdoCallViewFullConstraint) + NSLayoutConstraint.deactivate(self.vdoCallViewFloatCircleConstraint) + NSLayoutConstraint.activate(self.vdoCallViewFloatRectConstraint) + }else{ + NSLayoutConstraint.deactivate(self.vdoCallViewFloatRectConstraint) + NSLayoutConstraint.deactivate(self.vdoCallViewFloatCircleConstraint) + NSLayoutConstraint.activate(self.vdoCallViewFullConstraint) + } + self.videoCallContainer.layer.cornerRadius = value ? 10 : 0 + self.videoCallContainer.layer.borderColor = value ? UIColor.white.cgColor : nil + self.videoCallContainer.layer.borderWidth = value ? 2 : 0 + self.view.layoutIfNeeded() + } + } + + private func circleFloatVideoCallView(_ value:Bool){ + videoCallContainer.reposition = value ? .sticky : .edgesOnly + + UIView.animate(withDuration: 0.5) { + if(value){ + NSLayoutConstraint.deactivate(self.vdoCallViewFullConstraint) + NSLayoutConstraint.deactivate(self.vdoCallViewFloatRectConstraint) + NSLayoutConstraint.activate(self.vdoCallViewFloatCircleConstraint) + self.videoCallContainer.layer.cornerRadius = 35 + }else{ + NSLayoutConstraint.activate(self.vdoCallViewFloatRectConstraint) + NSLayoutConstraint.deactivate(self.vdoCallViewFullConstraint) + NSLayoutConstraint.deactivate(self.vdoCallViewFloatCircleConstraint) + self.videoCallContainer.layer.cornerRadius = 10 + + } + self.videoCallContainer.layer.borderColor = value ? UIColor.white.cgColor : nil + self.videoCallContainer.layer.borderWidth = value ? 2 : 0 + self.view.layoutIfNeeded() + } + } + + private func showVideoCallView(_ value:Bool){ + self.videoCallContainer.hidden(!value, rootView: view) + } + + func sessionDone(res: Any) { + videoCallFlutterResult?(res) + } + + func sessionNotResponded(res: Any) { + videoCallFlutterResult?(res) + } + + + func setVideoViewConstrints(){ + videoCallContainer.layer.shadowColor = UIColor.black.cgColor + videoCallContainer.layer.shadowOffset = CGSize(width: 1, height: 1) + videoCallContainer.layer.shadowRadius = 5 + + let screen = UIScreen.main.bounds + + videoCallContainer.translatesAutoresizingMaskIntoConstraints = false + + vdoCallViewFullConstraint = [ + videoCallContainer.topAnchor.constraint(equalTo: view.topAnchor), + videoCallContainer.leadingAnchor.constraint(equalTo: view.leadingAnchor), + videoCallContainer.widthAnchor.constraint(equalToConstant: screen.width), + videoCallContainer.heightAnchor.constraint(equalToConstant: screen.height) + ] + vdoCallViewFloatRectConstraint = [ + videoCallContainer.topAnchor.constraint(equalTo: view.topAnchor, constant: 40), + videoCallContainer.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20), + videoCallContainer.widthAnchor.constraint(equalToConstant: screen.width/3), + videoCallContainer.heightAnchor.constraint(equalToConstant: screen.height/3.5) + ] + vdoCallViewFloatCircleConstraint = [ + videoCallContainer.topAnchor.constraint(equalTo: view.topAnchor, constant: 40), + videoCallContainer.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20), + videoCallContainer.widthAnchor.constraint(equalToConstant: 70), + videoCallContainer.heightAnchor.constraint(equalToConstant: 70) + ] + } + +} diff --git a/ios/Runner/VCEmbeder.swift b/ios/Runner/VCEmbeder.swift new file mode 100644 index 00000000..9617a247 --- /dev/null +++ b/ios/Runner/VCEmbeder.swift @@ -0,0 +1,78 @@ +// +// VCEmbeder.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 08/06/2021. +// Copyright © 2021 The Chromium Authors. All rights reserved. +// + +import Foundation + +extension UIView { + func fill(to parent: UIView, animateDuration:Double = 0.5) { + self.topAnchor.constraint(equalTo: parent.topAnchor).isActive = true + self.leadingAnchor.constraint(equalTo: parent.leadingAnchor).isActive = true + self.bottomAnchor.constraint(equalTo: parent.bottomAnchor).isActive = true + self.trailingAnchor.constraint(equalTo: parent.trailingAnchor).isActive = true + UIView.animate(withDuration: animateDuration) { + parent.layoutIfNeeded() + } + } + + func fillToParent(animateDuration:Double = 0.5) { + if let parent = self.superview{ + self.topAnchor.constraint(equalTo: parent.topAnchor).isActive = true + self.leadingAnchor.constraint(equalTo: parent.leadingAnchor).isActive = true + self.bottomAnchor.constraint(equalTo: parent.bottomAnchor).isActive = true + self.trailingAnchor.constraint(equalTo: parent.trailingAnchor).isActive = true + UIView.animate(withDuration: animateDuration) { + parent.layoutIfNeeded() + } + } + } + + func fillInTo(view:UIView) { + view.addSubview(self) + fillToParent() + } +} + +class ViewEmbedder { + class func embed( + parent:UIViewController, + container:UIView, + child:UIViewController, + previous:UIViewController?){ + + if let previous = previous { + removeFromParent(vc: previous) + } + child.willMove(toParent: parent) + parent.addChild(child) + container.addSubview(child.view) + child.didMove(toParent: parent) + let w = container.frame.size.width; + let h = container.frame.size.height; + child.view.frame = CGRect(x: 0, y: 0, width: w, height: h) + child.view.backgroundColor = UIColor.black + + child.view.fill(to: container) + } + + class func removeFromParent(vc:UIViewController){ + vc.willMove(toParent: nil) + vc.view.removeFromSuperview() + vc.removeFromParent() + } + + class func embed(withIdentifier id:String, parent:UIViewController, container:UIView, completion:((UIViewController)->Void)? = nil){ + let vc = parent.storyboard!.instantiateViewController(withIdentifier: id) + embed( + parent: parent, + container: container, + child: vc, + previous: parent.children.first + ) + completion?(vc) + } +} diff --git a/ios/Runner/VideoCallRequestParameters.swift b/ios/Runner/VideoCallRequestParameters.swift new file mode 100644 index 00000000..543d7e8b --- /dev/null +++ b/ios/Runner/VideoCallRequestParameters.swift @@ -0,0 +1,29 @@ + + +import Foundation + +class VideoCallRequestParameters{ + var apiKey:String? + var sessionId:String? + var token:String? + var lang:String? + var vcId:Int? + var tokenId:String? + var generalId:String? + var doctorId:Int? + var baseUrl:String? + var patientName:String? + + init(dictionary:NSDictionary){ + self.apiKey = dictionary["kApiKey"] as? String + self.sessionId = dictionary["kSessionId"] as? String + self.token = dictionary["kToken"] as? String + self.lang = dictionary["appLang"] as? String + self.vcId = dictionary["VC_ID"] as? Int + self.tokenId = dictionary["TokenID"] as? String + self.generalId = dictionary["generalId"] as? String + self.doctorId = dictionary["DoctorId"] as? Int + self.baseUrl = dictionary["baseUrl"] as? String + self.patientName = dictionary["patientName"] as? String + } +} diff --git a/ios/Runner/VideoViewController.swift b/ios/Runner/VideoCallViewController.swift similarity index 55% rename from ios/Runner/VideoViewController.swift rename to ios/Runner/VideoCallViewController.swift index 8609c018..80a6fcb8 100644 --- a/ios/Runner/VideoViewController.swift +++ b/ios/Runner/VideoCallViewController.swift @@ -9,9 +9,9 @@ import UIKit import OpenTok import Alamofire +import AADraggableView - -class ViewController: UIViewController { +class VideoCallViewController: UIViewController { var session: OTSession? var publisher: OTPublisher? @@ -31,21 +31,214 @@ class ViewController: UIViewController { var callBack: ICallProtocol? var timer = Timer() - var seconds = 30 + var seconds = 55 var isUserConnect : Bool = false + var onRectFloat:((Bool)->Void)? = nil + var onCircleFloat:((Bool)->Void)? = nil + var onCallConnect:(()->Void)? = nil + var onCallDisconnect:(()->Void)? = nil + + + @IBOutlet weak var lblRemoteUsername: UILabel! + + // Bottom Actions + @IBOutlet weak var videoMuteBtn: UIButton! + @IBOutlet weak var micMuteBtn: UIButton! + @IBOutlet weak var camSwitchBtn: UIButton! + + @IBOutlet var minimizeConstraint: [NSLayoutConstraint]! + @IBOutlet var maximisedConstraint: [NSLayoutConstraint]! + + @IBOutlet weak var btnMinimize: UIButton! + @IBOutlet weak var hideVideoBtn: UIButton! + var localVideoDraggable:AADraggableView? + @IBOutlet weak var controlButtons: UIView! + @IBOutlet weak var remoteVideoMutedIndicator: UIImageView! + @IBOutlet weak var localVideoMutedBg: UIView! + + @IBOutlet weak var btnScreenTap: UIButton! + @IBOutlet weak var localVideoContainer: UIView! + @IBOutlet weak var topBar: UIView! + @IBOutlet weak var lblCallDuration: UILabel! + @IBOutlet weak var fullVideoView: UIView! + @IBOutlet weak var smallVideoView: UIView!{ + didSet{ + smallVideoView.layer.borderColor = UIColor.white.cgColor + localVideoDraggable = smallVideoView?.superview as? AADraggableView + localVideoDraggable?.reposition = .edgesOnly + } + } override func viewDidLoad() { - super.viewDidLoad() + super.viewDidLoad() + localVideoDraggable?.respectedView = localVideoContainer + } + + @objc func click(gesture:UIGestureRecognizer){ + gesture.view?.removeFromSuperview() + } + + @IBAction func btnOnScreenTapped(_ sender: Any) { + if(hideVideoBtn.isSelected){ + circleFloatBtnTapped(hideVideoBtn) + + }else if(btnMinimize.isSelected){ + btnMinimizeTapped(btnMinimize) + } + } + + @IBAction func btnSwipeVideoTapped(_ sender: Any) { +// let smallVdoRender = smallVideoView.subviews.first +// let fullVdoRender = fullVideoView.subviews.first +// if let vdo = smallVdoRender{ +// fullVideoView.addSubview(vdo) +// } +// if let vdo = fullVdoRender{ +// smallVideoView.addSubview(vdo) +// } +// +// layoutVideoRenderViews() + } + + @IBAction func didClickMuteButton(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + publisher!.publishAudio = !sender.isSelected + } + + @IBAction func didClickSpeakerButton(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + subscriber?.subscribeToAudio = !sender.isSelected + } + + @IBAction func didClickVideoMuteButton(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + if publisher!.publishVideo { + publisher!.publishVideo = false + } else { + publisher!.publishVideo = true + } + smallVideoView.isHidden = sender.isSelected + localVideoMutedBg.isHidden = !sender.isSelected + + } + + + @IBAction func didClickSwitchCameraButton(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + if sender.isSelected { + publisher!.cameraPosition = AVCaptureDevice.Position.front + } else { + publisher!.cameraPosition = AVCaptureDevice.Position.back + } + } + + @IBAction func hangUp(_ sender: UIButton) { + callBack?.sessionDone(res:["callResponse":"CallEnd"]) + sessionDisconnect() + } + + @IBAction func circleFloatBtnTapped(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + onCircleFloat?(sender.isSelected) + topBar.isHidden = sender.isSelected + controlButtons.isHidden = sender.isSelected + smallVideoView.isHidden = sender.isSelected + self.publisher?.view?.layoutIfNeeded() + } + + @IBAction func btnMinimizeTapped(_ sender: UIButton) { + minimizeVideoState(state: !sender.isSelected) + btnScreenTap.isHidden = !sender.isSelected + } + + func minimizeVideoState(state:Bool){ + btnMinimize.isSelected = state + onRectFloat?(state) + + NSLayoutConstraint.activate(state ? minimizeConstraint : maximisedConstraint) + NSLayoutConstraint.deactivate(state ? maximisedConstraint : minimizeConstraint) + localVideoDraggable?.enable(!state) - setupButtons() - askForMicrophonePermission() - requestCameraPermissionsIfNeeded() - hideVideoMuted() - setupSession() - // Do any additional setup after loading the view. - } + lblRemoteUsername.isHidden = state + hideVideoBtn.isHidden = !state + lblCallDuration.superview?.isHidden = !hideVideoBtn.isHidden + + UIView.animate(withDuration: 0.5) { + self.videoMuteBtn.isHidden = state + self.micMuteBtn.isHidden = state + self.camSwitchBtn.isHidden = state + self.layoutVideoRenderViews() + } + } + + func layoutVideoRenderViews(){ + if let publisherVdoSize = publisher?.view?.superview?.bounds.size{ + publisher?.view?.frame = CGRect(x: 0, y: 0, width: publisherVdoSize.width, height: publisherVdoSize.height) + } + if let subscriberVdoSize = subscriber?.view?.superview?.bounds.size{ + subscriber?.view?.frame = CGRect(x: 0, y: 0, width: subscriberVdoSize.width, height: subscriberVdoSize.height) + } + } + + var durationTimer:Timer?; + func startUpdateCallDuration(){ + var seconds = 0 + durationTimer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in + seconds = seconds+1 + let durationSegments = (seconds / 3600, (seconds % 3600) / 60, (seconds % 3600) % 60) + let hours = String(format: "%02d", durationSegments.0) + let mins = String(format: "%02d", durationSegments.1) + let secs = String(format: "%02d", durationSegments.2) + let durationString = "\(mins):\(secs)" + + self.lblCallDuration.text = durationString + } + } + + func start(params:VideoCallRequestParameters){ + lblRemoteUsername.text = params.patientName ?? "- - -" + btnScreenTap.isHidden = true + hideVideoBtn.isHidden = true + + self.kApiKey = params.apiKey ?? "" + self.kSessionId = params.sessionId ?? "" + self.kToken = params.token ?? "" + self.VC_ID = params.vcId ?? 0 + self.generalid = params.generalId ?? "" + self.TokenID = params.tokenId ?? "" + self.DoctorId = params.doctorId ?? 0 + self.baseUrl = params.baseUrl ?? "" + + askForMicrophonePermission() + requestCameraPermissionsIfNeeded() + hideVideoMuted() + setupSession() + + } + private func changeCallStatus(callStatus:Int){ + let URL_USER_REGISTER = baseUrl+"LiveCareApi/DoctorApp/ChangeCallStatus" + let headers: HTTPHeaders = ["Content-Type":"application/json","Accept":"application/json",] + + let parameters = [ + "CallStatus":callStatus, + "VC_ID": VC_ID, + "TokenID": TokenID, + "generalid": generalid, + "DoctorId" : DoctorId , + ] as [String : Any] + + AF.request(URL_USER_REGISTER, method: .post,parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON{ + response in + if let result = response.value { + let jsonData = result as! NSObject + let resultVal = jsonData.value(forKey: "Result") + print(resultVal as Any) + } + + } + } private func getSessionStatus() { let URL_USER_REGISTER = baseUrl+"LiveCareApi/DoctorApp/GetSessionStatus" @@ -61,11 +254,11 @@ class ViewController: UIViewController { "generalid": generalid, "DoctorId" : DoctorId , ] as [String : Any] - Alamofire.request(URL_USER_REGISTER, method: .post,parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON{ + AF.request(URL_USER_REGISTER, method: .post,parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON{ response in if self.isUserConnect { } else { - if let result = response.result.value { + if let result = response.value { let jsonData = result as! NSObject if((jsonData.value(forKey: "SessionStatus")) as! Int == 2 || (jsonData.value(forKey: "SessionStatus")) as! Int == 3) { //jsonData @@ -81,17 +274,9 @@ class ViewController: UIViewController { self.sessionDisconnect(); self.timer.invalidate() } - //getting json value from the server } } - - func setupButtons() { - perform(#selector(hideControlButtons), with: nil, afterDelay: 3) - let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(remoteVideoTapped(_:))) - view.addGestureRecognizer(tapGestureRecognizer) - view.isUserInteractionEnabled = true - } // MARK: -Microphone Camera and Permission Request func askForMicrophonePermission() { @@ -115,60 +300,18 @@ class ViewController: UIViewController { // display a useful message asking the user to grant permissions from within Settings > Privacy > Camera } - - @IBAction func didClickMuteButton(_ sender: UIButton) { - sender.isSelected = !sender.isSelected - publisher!.publishAudio = !sender.isSelected - - } - - @IBAction func didClickSpeakerButton(_ sender: UIButton) { - sender.isSelected = !sender.isSelected - subscriber?.subscribeToAudio = !sender.isSelected - // resetHideButtonsTimer() - } - - @IBAction func didClickVideoMuteButton(_ sender: UIButton) { - sender.isSelected = !sender.isSelected - if publisher!.publishVideo { - publisher!.publishVideo = false - } else { - publisher!.publishVideo = true - } - localVideo.isHidden = sender.isSelected - localVideoMutedBg.isHidden = !sender.isSelected - localVideoMutedIndicator.isHidden = !sender.isSelected - // resetHideButtonsTimer() - - } - - - @IBAction func didClickSwitchCameraButton(_ sender: UIButton) { - sender.isSelected = !sender.isSelected - if sender.isSelected { - publisher!.cameraPosition = AVCaptureDevice.Position.front - } else { - publisher!.cameraPosition = AVCaptureDevice.Position.back - } - /// resetHideButtonsTimer() - } - - @IBAction func hangUp(_ sender: UIButton) { - callBack?.sessionDone(res:["callResponse":"CallEnd"]) - sessionDisconnect() - } - - func sessionDisconnect() { + changeCallStatus(callStatus: 16) if (session != nil) { print("disconnecting....") session!.disconnect(nil) dismiss(animated: true) - return } dismiss(animated: true) + onCallDisconnect?() + durationTimer?.invalidate() } - // Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ + func requestCameraPermissionsIfNeeded() { // check camera authorization status @@ -203,7 +346,6 @@ class ViewController: UIViewController { func hideVideoMuted() { remoteVideoMutedIndicator.isHidden = true localVideoMutedBg.isHidden = true - localVideoMutedIndicator.isHidden = true } func setupSession() { @@ -244,19 +386,6 @@ class ViewController: UIViewController { - @IBOutlet weak var localVideo: UIView! - - @IBOutlet weak var remoteVideo: UIView! - - @IBOutlet weak var controlButtons: UIView! - - @IBOutlet weak var remoteVideoMutedIndicator: UIImageView! - - @IBOutlet weak var localVideoMutedBg: UIImageView! - - - @IBOutlet weak var localVideoMutedIndicator: UIImageView! - @objc func updateTimer(){ seconds -= 1 //This will decrement(count down)the seconds. print(seconds) @@ -270,17 +399,11 @@ class ViewController: UIViewController { } -extension ViewController: OTSessionDelegate { +extension VideoCallViewController: OTSessionDelegate { func sessionDidConnect(_ session: OTSession) { - print("The client connected to the OpenTok session.") - - - - - timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(ViewController.updateTimer)), userInfo: nil, repeats: true) - - + print("The client connected to the OpenTok session.") + timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(VideoCallViewController.updateTimer)), userInfo: nil, repeats: true) setupPublisher() } @@ -295,10 +418,12 @@ extension ViewController: OTSessionDelegate { if error != nil { showAlert(error?.localizedDescription) } - - publisher?.view!.frame = CGRect(x: localVideo.bounds.origin.x, y: localVideo.bounds.origin.y, width: localVideo.bounds.size.width, height: localVideo.bounds.size.height) - - localVideo.addSubview((publisher?.view)!) + + publisher?.view?.tag = 11 + publisher?.view?.layer.cornerRadius = 5 + publisher?.view?.clipsToBounds = true + smallVideoView.addSubview((publisher?.view)!) + layoutVideoRenderViews() } func sessionDidDisconnect(_ session: OTSession) { @@ -306,6 +431,7 @@ extension ViewController: OTSessionDelegate { } func session(_ session: OTSession, didFailWithError error: OTError) { + changeCallStatus(callStatus: 16) print("The client failed to connect to the OpenTok session: \(error).") } @@ -322,27 +448,27 @@ extension ViewController: OTSessionDelegate { func session(_ session: OTSession, streamCreated stream: OTStream) { - subscriber = OTSubscriber(stream: stream, delegate: self) - guard let subscriber = subscriber else { - return - } + subscriber = OTSubscriber(stream: stream, delegate: self) + guard let subscriber = subscriber else { + return + } - var error: OTError? - session.subscribe(subscriber, error: &error) - guard error == nil else { - print(error!) - return - } + var error: OTError? + session.subscribe(subscriber, error: &error) + guard error == nil else { + print(error!) + return + } - guard let subscriberView = subscriber.view else { - return - } - subscriberView.frame = UIScreen.main.bounds - view.insertSubview(subscriberView, at: 0) + guard let subscriberView = subscriber.view else { + return + } + subscriberView.tag = 22 + fullVideoView.addSubview(subscriberView) + layoutVideoRenderViews() -// if nil == subscriber { -// setupSubscribe(stream) -// } + startUpdateCallDuration() + onCallConnect?() } func setupSubscribe(_ stream: OTStream?) { @@ -377,25 +503,20 @@ extension ViewController: OTSessionDelegate { if let connectionId = connection?.connectionId { print("session connectionCreated (\(connectionId))") } + changeCallStatus(callStatus: 3) isUserConnect = true timer.invalidate() } } -extension ViewController: OTPublisherDelegate { +extension VideoCallViewController: OTPublisherDelegate { func publisher(_ publisher: OTPublisherKit, didFailWithError error: OTError) { print("The publisher failed: \(error)") } - @objc func remoteVideoTapped(_ recognizer: UITapGestureRecognizer?) { - if controlButtons.isHidden { - controlButtons.isHidden = false - perform(#selector(hideControlButtons), with: nil, afterDelay: 3) - } - } } -extension ViewController: OTSubscriberDelegate { +extension VideoCallViewController: OTSubscriberDelegate { public func subscriberDidConnect(toStream subscriber: OTSubscriberKit) { print("The subscriber did connect to the stream.") } @@ -403,8 +524,5 @@ extension ViewController: OTSubscriberDelegate { public func subscriber(_ subscriber: OTSubscriberKit, didFailWithError error: OTError) { print("The subscriber failed to connect to the stream.") } - @objc func hideControlButtons() { - controlButtons.isHidden = true - } } diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index bd4b0cd4..de6f59a1 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -3,12 +3,18 @@ import 'dart:io' show Platform; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/service/NavigationService.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart' as http; +import 'package:provider/provider.dart'; + +import '../locator.dart'; +import '../routes.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = new Helpers(); @@ -19,23 +25,28 @@ class BaseAppClient { {Map body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, - bool isAllowAny = false}) async { - String url = BASE_URL + endPoint; + bool isAllowAny = false, + bool isLiveCare = false}) async { + String url; + if (isLiveCare) + url = BASE_URL_LIVE_CARE + endPoint; + else + url = BASE_URL + endPoint; + + bool callLog = true; try { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - if (body['DoctorID'] == null) - body['DoctorID'] = doctorProfile?.doctorID; + if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; if (body['DoctorID'] == "") body['DoctorID'] = null; - if (body['EditedBy'] == null) - body['EditedBy'] = doctorProfile?.doctorID; + if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile?.doctorID; if (body['ProjectID'] == null) { body['ProjectID'] = doctorProfile?.projectID; } - if (body['ClinicID'] == null) - body['ClinicID'] = doctorProfile?.clinicID; + + if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile?.clinicID; } if (body['DoctorID'] == '') { body['DoctorID'] = null; @@ -43,7 +54,10 @@ class BaseAppClient { if (body['EditedBy'] == '') { body.remove("EditedBy"); } - body['TokenID'] = token ?? ''; + if (body['TokenID'] == null) { + body['TokenID'] = token ?? ''; + } + // body['TokenID'] = "@dm!n" ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -59,19 +73,21 @@ class BaseAppClient { body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = body['PatientOutSA'] ?? 0; // PATIENT_OUT_SA; if (body['VidaAuthTokenID'] == null) { - body['VidaAuthTokenID'] = - await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); } if (body['VidaRefreshTokenID'] == null) { - body['VidaRefreshTokenID'] = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } - int projectID = await sharedPref.getInt(PROJECT_ID); - if(projectID ==2 || projectID == 3) - body['PatientOutSA'] = true; - else - body['PatientOutSA'] = false; + int projectID = await sharedPref.getInt(PROJECT_ID); + if (projectID == 2 || projectID == 3) + body['PatientOutSA'] = true; + else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || body['facilityId'] == 3) || + body['ProjectID'] == 2 || + body['ProjectID'] == 3) + body['PatientOutSA'] = true; + else + body['PatientOutSA'] = false; body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; print("URL : $url"); @@ -80,27 +96,24 @@ class BaseAppClient { var asd2; if (await Helpers.checkConnection()) { final response = await http.post(url, - body: json.encode(body), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }); + body: json.encode(body), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}); final int statusCode = response.statusCode; if (statusCode < 200 || statusCode >= 400) { onFailure(Helpers.generateContactAdminMsg(), statusCode); } else { var parsed = json.decode(response.body.toString()); if (parsed['ErrorType'] == 4) { - helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], - parsed['AndroidLink'], parsed['IOSLink']); + helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']); } - if (!parsed['IsAuthenticated']) { + if (parsed['IsAuthenticated'] != null && !parsed['IsAuthenticated']) { if (body['OTP_SendType'] != null) { onFailure(getError(parsed), statusCode); } else if (!isAllowAny) { - await Helpers.logout(); + await Provider.of(AppGlobal.CONTEX, listen: false).logout(); + Helpers.showErrorToast('Your session expired Please login again'); + locator().pushNamedAndRemoveUntil(ROOT); } if (isAllowAny) { onFailure(getError(parsed), statusCode); @@ -132,21 +145,15 @@ class BaseAppClient { String url = BASE_URL + endPoint; try { - Map headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }; + Map headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}; String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); - if (body.containsKey('SetupID')) { - body['SetupID'] = body.containsKey('SetupID') - ? body['SetupID'] != null - ? body['SetupID'] - : SETUP_ID - : SETUP_ID; - } + var languageID = await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID + : SETUP_ID; body['VersionID'] = VERSION_ID; body['Channel'] = CHANNEL; @@ -161,12 +168,11 @@ class BaseAppClient { : PATIENT_OUT_SA_PATIENT_REQ; if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; } body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; @@ -187,16 +193,14 @@ class BaseAppClient { : PATIENT_TYPE_ID : PATIENT_TYPE_ID; - body['TokenID'] = token; - body['PatientID'] = body['PatientID'] != null - ? body['PatientID'] - : patient.patientId ?? patient.patientMRN; + body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] : token; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient.patientId ?? patient.patientMRN; body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it body['SessionID'] = SESSION_ID; //getSe int projectID = await sharedPref.getInt(PROJECT_ID); - if(projectID ==2 || projectID == 3) + if (projectID == 2 || projectID == 3) body['PatientOutSA'] = true; else body['PatientOutSA'] = false; @@ -205,8 +209,7 @@ class BaseAppClient { print("Body : ${json.encode(body)}"); if (await Helpers.checkConnection()) { - final response = await http.post(url.trim(), - body: json.encode(body), headers: headers); + final response = await http.post(url.trim(), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { @@ -218,8 +221,7 @@ class BaseAppClient { onSuccess(parsed, statusCode); } else { if (parsed['ErrorType'] == 4) { - helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], - parsed['AndroidLink'], parsed['IOSLink']); + helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']); } if (parsed['IsAuthenticated'] == null) { if (parsed['isSMSSent'] == true) { @@ -235,28 +237,20 @@ class BaseAppClient { onFailure(getError(parsed), statusCode); } } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { if (parsed['SameClinicApptList'] != null) { onSuccess(parsed, statusCode); } else { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { if (parsed['ErrorSearchMsg'] == null) { - onFailure("Server Error found with no available message", - statusCode); + onFailure("Server Error found with no available message", statusCode); } else { onFailure(parsed['ErrorSearchMsg'], statusCode); } } else { - onFailure( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); + onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } else { @@ -266,9 +260,7 @@ class BaseAppClient { if (parsed['message'] != null) { onFailure(parsed['message'] ?? parsed['message'], statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } @@ -291,12 +283,8 @@ class BaseAppClient { if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { - for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { - error = error + - parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + - "\n"; + for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) { + error = error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n"; } } } diff --git a/lib/config/config.dart b/lib/config/config.dart index ec8efe26..d6836827 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,284 +4,233 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; +const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; -const PATIENT_PROGRESS_NOTE_URL = - "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; -const PATIENT_INSURANCE_APPROVALS_URL = - "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; -const PATIENT_ORDERS_URL = - "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; -const PATIENT_REFER_TO_DOCTOR_URL = - "Services/DoctorApplication.svc/REST/ReferToDoctor"; -const PATIENT_GET_DOCTOR_BY_CLINIC_URL = - "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID"; - -const PATIENT_GET_DOCTOR_BY_CLINIC_Hospital = - "Services/Doctors.svc/REST/SearchDoctorsByTime"; - -const GET_CLINICS_FOR_DOCTOR = - 'Services/DoctorApplication.svc/REST/GetClinicsForDoctor'; -const PATIENT_GET_LIST_REFERAL_URL = - "Services/Lists.svc/REST/GetList_STPReferralFrequency"; -const PATIENT_GET_CLINIC_BY_PROJECT_URL = - "Services/DoctorApplication.svc/REST/GetClinicsByProjectID"; +const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; +const PATIENT_INSURANCE_APPROVALS_URL = "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; +const PATIENT_ORDERS_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; +const PATIENT_REFER_TO_DOCTOR_URL = "Services/DoctorApplication.svc/REST/ReferToDoctor"; +const PATIENT_GET_DOCTOR_BY_CLINIC_URL = "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID"; + +const PATIENT_GET_DOCTOR_BY_CLINIC_Hospital = "Services/Doctors.svc/REST/SearchDoctorsByTime"; + +const GET_CLINICS_FOR_DOCTOR = 'Services/DoctorApplication.svc/REST/GetClinicsForDoctor'; +const PATIENT_GET_LIST_REFERAL_URL = "Services/Lists.svc/REST/GetList_STPReferralFrequency"; +const PATIENT_GET_CLINIC_BY_PROJECT_URL = "Services/DoctorApplication.svc/REST/GetClinicsByProjectID"; const PROJECT_GET_INFO = "Services/DoctorApplication.svc/REST/GetProjectInfo"; const GET_CLINICS = "Services/DoctorApplication.svc/REST/GetClinics"; -const GET_REFERRAL_FACILITIES = - 'Services/DoctorApplication.svc/REST/GetReferralFacilities'; +const GET_REFERRAL_FACILITIES = 'Services/DoctorApplication.svc/REST/GetReferralFacilities'; const GET_PROJECTS = 'Services/DoctorApplication.svc/REST/GetProjectInfo'; -const GET_PATIENT_VITAL_SIGN = - 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; -const GET_PATIENT_VITAL_SIGN_DATA = - 'Services/DoctorApplication.svc/REST/GetVitalSigns'; -const GET_PATIENT_LAB_OREDERS = - 'Services/DoctorApplication.svc/REST/GetPatientLabOreders'; +const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PATIENT_VITAL_SIGN_DATA = 'Services/DoctorApplication.svc/REST/GetVitalSigns'; +const GET_PATIENT_LAB_OREDERS = 'Services/DoctorApplication.svc/REST/GetPatientLabOreders'; const GET_PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; const GET_RADIOLOGY = 'Services/DoctorApplication.svc/REST/GetPatientRadResult'; -const GET_LIVECARE_PENDINGLIST = - 'Services/DoctorApplication.svc/REST/GetPendingPatientER'; -const START_LIVECARE_CALL = 'LiveCareApi/DoctorApp/CallPatient'; +const GET_LIVECARE_PENDINGLIST = 'Services/DoctorApplication.svc/REST/GetPendingPatientER'; +const START_LIVE_CARE_CALL = 'LiveCareApi/DoctorApp/CallPatient'; const LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL = "Lists.svc/REST/DashBoard_GetLiveCareDoctorsStatsticsForCertainDoctor"; -const GET_PRESCRIPTION_REPORT = - 'Services/Patients.svc/REST/GetPrescriptionReport'; +const GET_PRESCRIPTION_REPORT = 'Services/Patients.svc/REST/GetPrescriptionReport'; -const GT_MY_PATIENT_QUESTION = - 'Services/DoctorApplication.svc/REST/GtMyPatientsQuestions'; +const GT_MY_PATIENT_QUESTION = 'Services/DoctorApplication.svc/REST/GtMyPatientsQuestions'; -const PRM_SEARCH_PATIENT = - 'Services/Patients.svc/REST/GetPatientInformation_PRM'; +const PRM_SEARCH_PATIENT = 'Services/Patients.svc/REST/GetPatientInformation_PRM'; const GET_PATIENT = 'Services/DoctorApplication.svc/REST/'; -const GET_PRESCRIPTION_REPORT_FOR_IN_PATIENT = - 'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient'; +const GET_PRESCRIPTION_REPORT_FOR_IN_PATIENT = 'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient'; -const GET_MY_REFERRAL_PATIENT = - 'Services/DoctorApplication.svc/REST/GtMyReferralPatient'; +const GET_MY_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferralPatient'; const REFER_TO_DOCTOR = 'Services/DoctorApplication.svc/REST/ReferToDoctor'; -const ADD_REFERRED_DOCTOR_REMARKS = - 'Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks'; +const ADD_REFERRED_DOCTOR_REMARKS = 'Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks'; -const GET_MY_REFERRED_PATIENT = - 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; +const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; -const GET_PENDING_REFERRAL_PATIENT = - 'Services/DoctorApplication.svc/REST/PendingReferrals'; +const GET_MY_REFERRED_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredOutPatient'; -const CREATE_REFERRAL_PATIENT = - 'Services/DoctorApplication.svc/REST/CreateReferral'; +const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals'; -const RESPONSE_PENDING_REFERRAL_PATIENT = - 'Services/DoctorApplication.svc/REST/RespondReferral'; +const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; + +const RESPONSE_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/RespondReferral'; const GET_PATIENT_REFERRAL = 'Services/DoctorApplication.svc/REST/GetRefferal'; const POST_UCAF = 'Services/DoctorApplication.svc/REST/PostUCAF'; -const GET_DOCTOR_WORKING_HOURS_TABLE = - 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; +const GET_DOCTOR_WORKING_HOURS_TABLE = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; -const GET_PATIENT_LAB_RESULTS = - 'Services/DoctorApplication.svc/REST/GetPatientLabResults'; +const GET_PATIENT_LAB_RESULTS = 'Services/DoctorApplication.svc/REST/GetPatientLabResults'; const LOGIN_URL = 'Services/Sentry.svc/REST/MemberLogIN_New'; -const INSERT_DEVICE_IMEI = - 'Services/DoctorApplication.svc/REST/DoctorApp_InsertOrUpdateDeviceDetails'; +const INSERT_DEVICE_IMEI = 'Services/DoctorApplication.svc/REST/DoctorApp_InsertOrUpdateDeviceDetails'; // 'Services/Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; // const SELECT_DEVICE_IMEI = // 'Services/Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; -const SELECT_DEVICE_IMEI = - 'Services/DoctorApplication.svc/REST/DoctorApp_GetDeviceDetailsByIMEI'; +const SELECT_DEVICE_IMEI = 'Services/DoctorApplication.svc/REST/DoctorApp_GetDeviceDetailsByIMEI'; const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = 'Services/Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; -const SEND_ACTIVATION_CODE_FOR_DOCTOR_APP = - 'Services/DoctorApplication.svc/REST/SendActivationCodeForDoctorApp'; +const SEND_ACTIVATION_CODE_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/REST/SendActivationCodeForDoctorApp'; -const SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN = - 'Services/DoctorApplication.svc/REST/SendVerificationCode'; -const MEMBER_CHECK_ACTIVATION_CODE_NEW = - 'Services/Sentry.svc/REST/MemberCheckActivationCode_New'; +const SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN = 'Services/DoctorApplication.svc/REST/SendVerificationCode'; +const MEMBER_CHECK_ACTIVATION_CODE_NEW = 'Services/Sentry.svc/REST/MemberCheckActivationCode_New'; -const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP = - 'Services/DoctorApplication.svc/REST/CheckActivationCodeForDoctorApp'; +const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/REST/CheckActivationCodeForDoctorApp'; const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; +const SEND_SMS_INSTRUCTIONS = 'LiveCareApi/DoctorApp/SendSMSInstruction'; +const GET_ALTERNATIVE_SERVICE = 'LiveCareApi/DoctorApp/GetAlternativeServices'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; -const GET_DASHBOARD = - 'Services/DoctorApplication.svc/REST/GetDoctorDashboardKPI'; -const GET_SICKLEAVE_STATISTIC = - 'Services/DoctorApplication.svc/REST/PreSickLeaveStatistics'; -const ARRIVED_PATIENT_URL = - 'Services/DoctorApplication.svc/REST/PatientArrivalList'; +const GET_DASHBOARD = 'Services/DoctorApplication.svc/REST/GetDoctorDashboardKPI'; +const GET_SICKLEAVE_STATISTIC = 'Services/DoctorApplication.svc/REST/PreSickLeaveStatistics'; +const ARRIVED_PATIENT_URL = 'Services/DoctorApplication.svc/REST/PatientArrivalList'; const ADD_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/PostSickLeave'; const GET_SICK_LEAVE = 'Services/Patients.svc/REST/GetPatientSickLeave'; const EXTEND_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/ExtendSickLeave'; const GET_OFFTIME = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; -const GET_COVERING_DOCTORS = - 'Services/DoctorApplication.svc/REST/GetCoveringDoctor'; +const GET_COVERING_DOCTORS = 'Services/DoctorApplication.svc/REST/GetCoveringDoctor'; const ADD_RESCHDEULE = 'Services/DoctorApplication.svc/REST/PostRequisition'; -const UPDATE_RESCHDEULE = - 'Services/DoctorApplication.svc/REST/PatchRequisition'; -const GET_RESCHEDULE_LEAVE = - 'Services/DoctorApplication.svc/REST/GetRequisition'; -const GET_PRESCRIPTION_LIST = - 'Services/DoctorApplication.svc/REST/GetPrescription'; - -const POST_PRESCRIPTION_LIST = - 'Services/DoctorApplication.svc/REST/PostPrescription'; -const GET_PROCEDURE_LIST = - 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; +const UPDATE_RESCHDEULE = 'Services/DoctorApplication.svc/REST/PatchRequisition'; +const GET_RESCHEDULE_LEAVE = 'Services/DoctorApplication.svc/REST/GetRequisition'; +const GET_PRESCRIPTION_LIST = 'Services/DoctorApplication.svc/REST/GetPrescription'; + +const POST_PRESCRIPTION_LIST = 'Services/DoctorApplication.svc/REST/PostPrescription'; +const GET_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; const POST_PROCEDURE_LIST = 'Services/DoctorApplication.svc/REST/PostProcedure'; -const GET_PATIENT_ARRIVAL_LIST = - 'Services/DoctorApplication.svc/REST/PatientArrivalList'; +const GET_PATIENT_ARRIVAL_LIST = 'Services/DoctorApplication.svc/REST/PatientArrivalList'; -const GET_PATIENT_IN_PATIENT_LIST = - 'Services/DoctorApplication.svc/REST/GetMyInPatient'; +const GET_PATIENT_IN_PATIENT_LIST = 'Services/DoctorApplication.svc/REST/GetMyInPatient'; -const Verify_Referral_Doctor_Remarks = - 'Services/DoctorApplication.svc/REST/VerifyReferralDoctorRemarks'; +const Verify_Referral_Doctor_Remarks = 'Services/DoctorApplication.svc/REST/VerifyReferralDoctorRemarks'; ///Lab Order const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; -const GET_Patient_LAB_SPECIAL_RESULT = - 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; -const SEND_LAB_RESULT_EMAIL = - 'Services/Notifications.svc/REST/SendLabReportEmail'; -const GET_Patient_LAB_RESULT = - 'Services/Patients.svc/REST/GetPatientLabResults'; -const GET_Patient_LAB_ORDERS_RESULT = - 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; +const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; +const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail'; +const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; // SOAP const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; -const GET_MASTER_LOOKUP_LIST = - 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; +const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_EPISODE = 'Services/DoctorApplication.svc/REST/PostEpisode'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; -const POST_CHIEF_COMPLAINT = - 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; -const POST_PHYSICAL_EXAM = - 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; -const POST_PROGRESS_NOTE = - '/Services/DoctorApplication.svc/REST/PostProgressNote'; +const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; +const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; const POST_ASSESSMENT = 'Services/DoctorApplication.svc/REST/PostAssessment'; const PATCH_ALLERGY = 'Services/DoctorApplication.svc/REST/PatchAllergies'; const PATCH_HISTORY = 'Services/DoctorApplication.svc/REST/PatchHistory'; -const PATCH_CHIEF_COMPLAINT = - 'Services/DoctorApplication.svc/REST/PatchChiefcomplaint'; +const PATCH_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PatchChiefcomplaint'; -const PATCH_PHYSICAL_EXAM = - 'Services/DoctorApplication.svc/REST/PatchPhysicalExam'; -const PATCH_PROGRESS_NOTE = - 'Services/DoctorApplication.svc/REST/PatchProgressNote'; +const PATCH_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PatchPhysicalExam'; +const PATCH_PROGRESS_NOTE = 'Services/DoctorApplication.svc/REST/PatchProgressNote'; const PATCH_ASSESSMENT = 'Services/DoctorApplication.svc/REST/PatchAssessment'; const GET_ALLERGY = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_HISTORY = 'Services/DoctorApplication.svc/REST/GetHistory'; -const GET_CHIEF_COMPLAINT = - 'Services/DoctorApplication.svc/REST/GetChiefcomplaint'; +const GET_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/GetChiefcomplaint'; const GET_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/GetPhysicalExam'; const GET_PROGRESS_NOTE = 'Services/DoctorApplication.svc/REST/GetProgressNote'; const GET_ASSESSMENT = 'Services/DoctorApplication.svc/REST/GetAssessment'; -const GET_ORDER_PROCEDURE = - 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; +const GET_ORDER_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; -const GET_LIST_CATEGORISE = - 'Services/DoctorApplication.svc/REST/GetProcedureCategories'; +const GET_LIST_CATEGORISE = 'Services/DoctorApplication.svc/REST/GetProcedureCategories'; -const GET_CATEGORISE_PROCEDURE = - 'Services/DoctorApplication.svc/REST/GetProcedure'; +const GET_CATEGORISE_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetProcedure'; const UPDATE_PROCEDURE = 'Services/DoctorApplication.svc/REST/PatchProcedure'; -const UPDATE_PRESCRIPTION = - 'Services/DoctorApplication.svc/REST/PatchPrescription'; +const UPDATE_PRESCRIPTION = 'Services/DoctorApplication.svc/REST/PatchPrescription'; const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList'; -const DRUG_TO_DRUG = - 'Services/DoctorApplication.svc/REST/DrugToDrugInteraction'; +const DRUG_TO_DRUG = 'Services/DoctorApplication.svc/REST/DrugToDrugInteraction'; const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; const GET_FLOORS = 'Services/DoctorApplication.svc/REST/GetFloors'; const GET_WARDS = 'Services/DoctorApplication.svc/REST/GetWards'; -const GET_ROOM_CATEGORIES = - 'Services/DoctorApplication.svc/REST/GetRoomCategories'; -const GET_DIAGNOSIS_TYPES = - 'Services/DoctorApplication.svc/REST/DiagnosisTypes'; +const GET_ROOM_CATEGORIES = 'Services/DoctorApplication.svc/REST/GetRoomCategories'; +const GET_DIAGNOSIS_TYPES = 'Services/DoctorApplication.svc/REST/DiagnosisTypes'; const GET_DIET_TYPES = 'Services/DoctorApplication.svc/REST/DietTypes'; const GET_ICD_CODES = 'Services/DoctorApplication.svc/REST/GetICDCodes'; -const POST_ADMISSION_REQUEST = - 'Services/DoctorApplication.svc/REST/PostAdmissionRequest'; -const GET_ITEM_BY_MEDICINE = - 'Services/DoctorApplication.svc/REST/GetItemByMedicineCode'; +const POST_ADMISSION_REQUEST = 'Services/DoctorApplication.svc/REST/PostAdmissionRequest'; +const GET_ITEM_BY_MEDICINE = 'Services/DoctorApplication.svc/REST/GetItemByMedicineCode'; -const GET_PROCEDURE_VALIDATION = - 'Services/DoctorApplication.svc/REST/ValidateProcedures'; -const GET_BOX_QUANTITY = - 'Services/DoctorApplication.svc/REST/CalculateBoxQuantity'; +const GET_PROCEDURE_VALIDATION = 'Services/DoctorApplication.svc/REST/ValidateProcedures'; +const GET_BOX_QUANTITY = 'Services/DoctorApplication.svc/REST/CalculateBoxQuantity'; ///GET ECG const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults"; -const GET_MY_REFERRAL_INPATIENT = - "Services/DoctorApplication.svc/REST/GtMyReferralPatient"; +const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient"; -const GET_MY_DISCHARGE_PATIENT = - "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient"; -const GET_DISCHARGE_PATIENT = - "Services/DoctorApplication.svc/REST/GtMyDischargePatient"; +const GET_MY_REFERRAL_OUT_PATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient"; -const GET_PAtIENTS_INSURANCE_APPROVALS = - "Services/Patients.svc/REST/GetApprovalStatus"; +const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient"; +const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient"; + +const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; const GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL'; const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; -const GET_IN_PATIENT_ORDERS = - 'Services/DoctorApplication.svc/REST/GetPatientRadResult'; +const GET_IN_PATIENT_ORDERS = 'Services/DoctorApplication.svc/REST/GetPatientRadResult'; ///Prescriptions const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; -const GET_PRESCRIPTIONS_ALL_ORDERS = - 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PRESCRIPTION_REPORT_NEW = - 'Services/Patients.svc/REST/INP_GetPrescriptionReport'; -const SEND_PRESCRIPTION_EMAIL = - 'Services/Notifications.svc/REST/SendPrescriptionEmail'; -const GET_PRESCRIPTION_REPORT_ENH = - 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; +const GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PRESCRIPTION_REPORT_NEW = 'Services/Patients.svc/REST/INP_GetPrescriptionReport'; +const SEND_PRESCRIPTION_EMAIL = 'Services/Notifications.svc/REST/SendPrescriptionEmail'; +const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList"; -const UPDATE_PROGRESS_NOTE_FOR_INPATIENT = - "Services/DoctorApplication.svc/REST/UpdateProgressNoteForInPatient"; -const CREATE_PROGRESS_NOTE_FOR_INPATIENT = - "Services/DoctorApplication.svc/REST/CreateProgressNoteForInPatient"; +const UPDATE_PROGRESS_NOTE_FOR_INPATIENT = "Services/DoctorApplication.svc/REST/UpdateProgressNoteForInPatient"; +const CREATE_PROGRESS_NOTE_FOR_INPATIENT = "Services/DoctorApplication.svc/REST/CreateProgressNoteForInPatient"; -const GET_PRESCRIPTION_IN_PATIENT = - 'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient'; +const GET_PRESCRIPTION_IN_PATIENT = 'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient'; -const GET_INSURANCE_IN_PATIENT = - "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; +const GET_INSURANCE_IN_PATIENT = "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; const GET_SICK_LEAVE_PATIENT = "Services/Patients.svc/REST/GetPatientSickLeave"; -const GET_MY_OUT_PATIENT = - "Services/DoctorApplication.svc/REST/GetMyOutPatient"; +const GET_MY_OUT_PATIENT = "Services/DoctorApplication.svc/REST/GetMyOutPatient"; + +const PATIENT_MEDICAL_REPORT_GET_LIST = "Services/Patients.svc/REST/DAPP_ListMedicalReport"; +const PATIENT_MEDICAL_REPORT_GET_TEMPLATE = "Services/Patients.svc/REST/DAPP_GetTemplateByID"; +const PATIENT_MEDICAL_REPORT_INSERT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport"; +const PATIENT_MEDICAL_REPORT_VERIFIED = "Services/Patients.svc/REST/DAPP_VerifiedMedicalReport"; + +const GET_PROCEDURE_TEMPLETE = 'Services/Doctors.svc/REST/DAPP_ProcedureTemplateGet'; + +const GET_TEMPLETE_LIST = 'Services/Doctors.svc/REST/DAPP_TemplateGet'; + +const GET_PROCEDURE_TEMPLETE_DETAILS = "Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet"; +const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/REST/GetPendingPatientERForDoctorApp'; + +const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare"; + +const LIVE_CARE_IS_LOGIN = "LiveCareApi/DoctorApp/UseIsLogin"; +const ADD_REFERRED_REMARKS_NEW = "Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks_New"; +const GET_SPECIAL_CLINICAL_CARE_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList"; +const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareMappingList"; + +const INSERT_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport_New"; + +const UPDATE_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_UpdateMedicalReport"; var selectedPatientType = 1; @@ -326,9 +275,6 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض المحول مني", "المريض الواصل" ]; -//****************** - -// Colors ////// by : ibrahim var DEVICE_TOKEN = ""; const PRIMARY_COLOR = 0xff515B5D; @@ -337,7 +283,7 @@ const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '9.9.9.9'; -const VERSION_ID = 6.0; +const VERSION_ID = 6.1; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f86c4a02..089ff3b5 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1,6 +1,7 @@ const Map> localizedValues = { 'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'}, 'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, + 'areYouSureYouWantTo': {'en': 'Are you sure you want to', 'ar': 'هل انت متاكد من انك تريد أن'}, 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, 'lanEnglish': {'en': 'English', 'ar': 'English'}, 'lanArabic': {'en': 'العربية', 'ar': 'العربية'}, @@ -11,28 +12,21 @@ const Map> localizedValues = { 'mobileNo': {'en': 'Mobile No', 'ar': 'رقم الموبايل'}, 'messagesScreenToolbarTitle': {'en': 'Messages', 'ar': 'الرسائل'}, 'mySchedule': {'en': 'Schedule', 'ar': 'جدولي'}, - 'errorNoSchedule': { - 'en': 'You don\'t have any Schedule', - 'ar': 'ليس لديك أي جدول زمني' - }, + 'errorNoSchedule': {'en': 'You don\'t have any Schedule', 'ar': 'ليس لديك أي جدول زمني'}, 'verify': {'en': 'VERIFY', 'ar': 'تحقق'}, 'referralDoctor': {'en': 'Referral Doctor', 'ar': 'الطبيب المُحول إليه'}, 'referringClinic': {'en': 'Referring Clinic', 'ar': 'العيادة المُحول إليها'}, 'frequency': {'en': 'Frequency', 'ar': 'نوع التحويلا'}, 'priority': {'en': 'Priority', 'ar': 'الأولوية'}, 'maxResponseTime': {'en': 'Max Response Time', 'ar': 'الوقت الأقصى للرد'}, - 'clinicDetailsandRemarks': { - 'en': 'Clinic Details and Remarks', - 'ar': 'ملاحضات وتفاصيل العيادة' - }, - 'answerSuggestions': { - 'en': 'Answer/Suggestions', - 'ar': 'ملاحضات وتفاصيل العيادة' - }, + 'clinicDetailsandRemarks': {'en': 'Clinic Details and Remarks', 'ar': 'ملاحضات وتفاصيل العيادة'}, + 'answerSuggestions': {'en': 'Answer/Suggestions', 'ar': 'ملاحضات وتفاصيل العيادة'}, 'outPatients': {'en': 'Out Patient', 'ar': 'المريض الخارجي'}, 'myOutPatient': {'en': 'My OutPatients', 'ar': 'المريض الخارجي'}, + 'myOutPatient_2lines': {'en': 'My\nOutPatients', 'ar': 'المريض\nالخارجي'}, 'searchPatient': {'en': 'Search Patients', 'ar': 'البحث عن مريض'}, + 'searchPatientDashBoard': {'en': 'Search\nPatients', 'ar': 'البحث\nعن مريض'}, 'searchAbout': {'en': 'Search', 'ar': 'البحث عن'}, 'patient': {'en': 'Patient', 'ar': ' مريض'}, 'patients': {'en': "Patient's", 'ar': ' مريض'}, @@ -48,10 +42,12 @@ const Map> localizedValues = { 'service': {'en': 'Service', 'ar': 'خدمة'}, 'referral': {'en': 'Referral', 'ar': 'الإحالة'}, 'inPatient': {'en': 'InPatients', 'ar': 'مرضاي'}, + 'myInPatient': {'en': 'My\nInPatients', 'ar': 'مرضاي\nالداخليين'}, 'inPatientLabel': {'en': 'InPatients', 'ar': 'المريض الداخلي'}, 'inPatientAll': {'en': 'All InPatients', 'ar': 'كل المرضى'}, 'operations': {'en': 'Operations', 'ar': 'عمليات'}, 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, + 'searchMedicineDashboard': {'en': 'Search\nMedicines', 'ar': 'بحث\nعن الدواء'}, 'searchMedicine': {'en': 'Search Medicines', 'ar': 'بحث عن الدواء'}, 'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'}, 'referPatient': {'en': 'Referral Patient', 'ar': 'إحالة مريض'}, @@ -67,20 +63,14 @@ const Map> localizedValues = { 'patientFile': {'en': 'Patient File', 'ar': 'ملف المريض'}, 'familyMedicine': {'en': 'Family Medicine Clinic', 'ar': 'عيادة طب الأسرة'}, 'search': {'en': 'Search', 'ar': 'بحث '}, - 'onlyArrivedPatient': { - 'en': 'Only Arrived Patient', - 'ar': 'المريض الذي حضر للموعد' - }, + 'onlyArrivedPatient': {'en': 'Only Arrived Patient', 'ar': 'المريض الذي حضر للموعد'}, 'searchMedicineNameHere': {'en': 'Search Medicine ', 'ar': 'ابحث هنا'}, 'youCanFind': {'en': 'You Can Find ', 'ar': 'تستطيع ان تجد '}, 'itemsInSearch': {'en': 'items in search', 'ar': 'عناصر في البحث'}, 'qr': {'en': 'QR', 'ar': 'QR'}, 'reader': {'en': 'Reader', 'ar': 'قارىء رمز ال'}, 'startScanning': {'en': 'Start Scanning', 'ar': 'بدء المسح'}, - 'scanQrCode': { - 'en': 'scan Qr code to retrieve patient profile', - 'ar': 'مسح رمزاال QR لاسترداد ملف تعريف المريض ' - }, + 'scanQrCode': {'en': 'scan Qr code to retrieve patient profile', 'ar': 'مسح رمزاال QR لاسترداد ملف تعريف المريض '}, 'scanQr': {'en': 'Scan Qr', 'ar': 'اقراء ال QR'}, 'profile': {'en': 'Profile', 'ar': 'ملفي الشخصي'}, 'gender': {'en': 'Gender', 'ar': 'الجنس'}, @@ -105,49 +95,28 @@ const Map> localizedValues = { 'bloodPressure': {'en': 'Blood Pressure', 'ar': 'ضغط الدم'}, 'oxygenation': {'en': 'Oxygenation', 'ar': 'الأوكسجين'}, 'painScale': {'en': 'Pain Scale', 'ar': 'مقياس الألم'}, - 'errorNoVitalSign': { - 'en': 'You don\'t have any Vital Sign', - 'ar': 'ليس لديك اي اعراض حيوية' - }, + 'errorNoVitalSign': {'en': 'You don\'t have any Vital Sign', 'ar': 'ليس لديك اي اعراض حيوية'}, 'labOrders': {'en': 'Lab Orders', 'ar': 'الفحوصات الطبية'}, - 'errorNoLabOrders': { - 'en': 'You don\'t have any lab orders', - 'ar': 'ليس لديك اي فحوصات طبية' - }, + 'errorNoLabOrders': {'en': 'You don\'t have any lab orders', 'ar': 'ليس لديك اي فحوصات طبية'}, 'answerThePatient': {'en': 'answer the patient', 'ar': 'اجب المريض '}, - 'pleaseEnterAnswer': { - 'en': 'please enter answer', - 'ar': 'الرجاء ادخال اجابة ' - }, - 'replay': {'en': 'Replay', 'ar': 'تاكيد'}, + 'pleaseEnterAnswer': {'en': 'please enter answer', 'ar': 'الرجاء ادخال اجابة '}, + 'replay': {'en': 'Reply', 'ar': 'تاكيد'}, 'progressNote': {'en': 'Progress Note', 'ar': 'ملاحظة التقدم'}, 'progress': {'en': 'Progress', 'ar': 'التقدم'}, 'note': {'en': 'Note', 'ar': 'ملاحظة'}, 'searchNote': {'en': 'Search Note', 'ar': 'بحث عن ملاحظة'}, - 'errorNoProgressNote': { - 'en': 'You don\'t have any Progress Note', - 'ar': 'ليس لديك اي ملاحظة تقدم ' - }, + 'errorNoProgressNote': {'en': 'You don\'t have any Progress Note', 'ar': 'ليس لديك اي ملاحظة تقدم '}, 'invoiceNo:': {'en': 'Invoice No :', 'ar': 'رقم الفاتورة'}, 'generalResult': {'en': 'General Result ', 'ar': 'النتيجة العامة'}, 'description': {'en': 'Description', 'ar': 'الوصف'}, 'value': {'en': 'Value', 'ar': 'القيمة'}, 'range': {'en': 'Range', 'ar': 'النطاق'}, 'enterId': {'en': 'User ID', 'ar': 'معرف المستخدم'}, - 'pleaseEnterYourID': { - 'en': 'Please enter your ID', - 'ar': 'الرجاء ادخال الهوية' - }, + 'pleaseEnterYourID': {'en': 'Please enter your ID', 'ar': 'الرجاء ادخال الهوية'}, 'enterPassword': {'en': 'Password', 'ar': 'كلمه السر'}, - 'pleaseEnterPassword': { - 'en': 'Please Enter Password', - 'ar': 'الرجاء ادخال الرقم السري' - }, + 'pleaseEnterPassword': {'en': 'Please Enter Password', 'ar': 'الرجاء ادخال الرقم السري'}, 'selectYourProject': {'en': 'Branch', 'ar': 'فرع'}, - 'pleaseEnterYourProject': { - 'en': 'Please Enter Your Project', - 'ar': 'الرجاء ادخال مستشفى' - }, + 'pleaseEnterYourProject': {'en': 'Please Enter Your Project', 'ar': 'الرجاء ادخال مستشفى'}, 'login': {'en': 'Login', 'ar': 'تسجيل دخول'}, 'drSulaimanAlHabib': {'en': 'Dr Sulaiman Al Habib', 'ar': 'د.سليمان الحبيب'}, 'welcomeTo': {'en': 'Welcome to', 'ar': 'مرحبا بك'}, @@ -174,10 +143,7 @@ const Map> localizedValues = { 'youWillReceiveA': {'en': 'You will receive a', 'ar': 'سوف تتلقى '}, 'loginCode': {'en': 'Login Code', 'ar': 'رمز تسجيل دخول'}, 'smsBy': {'en': 'By SMS', 'ar': 'عن طريق رسالة قصيرة'}, - 'pleaseEnterTheCode': { - 'en': 'Please enter the code', - 'ar': 'الرجاء ادخال الرمز' - }, + 'pleaseEnterTheCode': {'en': 'Please enter the code', 'ar': 'الرجاء ادخال الرمز'}, 'youDon\'tHaveAnyPatient': { 'en': 'No data found for the selected search criteria', 'ar': 'لا توجد بيانات لمعايير البحث المختارة' @@ -189,14 +155,8 @@ const Map> localizedValues = { 'tomorrow': {'en': 'Tomorrow', 'ar': 'الغد'}, 'nextWeek': {'en': 'Next Week', 'ar': 'الاسبوع القادم'}, 'all': {'en': 'All', 'ar': 'الجميع'}, - 'errorNoInsuranceApprovals': { - 'en': 'You don\'t have any Insurance Approvals', - 'ar': 'ليس لديك اي موفقات تأمين' - }, - 'searchInsuranceApprovals': { - 'en': 'Search InsuranceApprovals', - 'ar': 'بحث عن موافقات التأمين' - }, + 'errorNoInsuranceApprovals': {'en': 'You don\'t have any Insurance Approvals', 'ar': 'ليس لديك اي موفقات تأمين'}, + 'searchInsuranceApprovals': {'en': 'Search InsuranceApprovals', 'ar': 'بحث عن موافقات التأمين'}, 'status': {'en': 'STATUS', 'ar': 'الحالة'}, 'expiryDate': {'en': 'EXPIRY DATE', 'ar': 'تاريخ الانتهاء'}, 'producerName': {'en': 'PRODUCER NAME', 'ar': 'اسم المنتج'}, @@ -209,19 +169,10 @@ const Map> localizedValues = { 'routine': {'en': 'Routine', 'ar': 'روتيني'}, 'send': {'en': 'Send', 'ar': 'ارسال'}, 'referralFrequency': {'en': 'Referral Frequency:', 'ar': 'تواتر الحالة:'}, - 'selectReferralFrequency': { - 'en': 'Select Referral Frequency:', - 'ar': 'اختار تواتر الحالة:' - }, - 'clinicalDetailsAndRemarks': { - 'en': 'Clinical Details and Remarks', - 'ar': 'التفاصيل السرسرية والملاحظات' - }, + 'selectReferralFrequency': {'en': 'Select Referral Frequency:', 'ar': 'اختار تواتر الحالة:'}, + 'clinicalDetailsAndRemarks': {'en': 'Clinical Details and Remarks', 'ar': 'التفاصيل السرسرية والملاحظات'}, 'remarks': {'en': 'Remarks', 'ar': 'ملاحظات'}, - 'pleaseFill': { - 'en': 'Please fill all fields..!', - 'ar': 'الرجاء ملأ جميع الحقول..!' - }, + 'pleaseFill': {'en': 'Please fill all fields..!', 'ar': 'الرجاء ملأ جميع الحقول..!'}, 'replay2': {'en': 'Reply', 'ar': 'رد الطبيب'}, 'logout': {'en': 'Logout', 'ar': 'تسجيل خروج'}, 'pharmaciesList': {'en': 'Pharmacies List', 'ar': 'قائمة الصيدليات'}, @@ -233,10 +184,7 @@ const Map> localizedValues = { 'searchOrders': {'en': 'Search Orders', 'ar': ' بحث عن الطلبات'}, 'prescriptionDetails': {'en': 'Prescription Details', 'ar': 'تفاصبل الوصفة'}, 'prescriptionInfo': {'en': 'Prescription Info', 'ar': 'معلومات الوصفة'}, - 'errorNoOrders': { - 'en': 'You don\'t have any Orders', - 'ar': 'لا يوجد لديك اي طلبات' - }, + 'errorNoOrders': {'en': 'You don\'t have any Orders', 'ar': 'لا يوجد لديك اي طلبات'}, 'livecare': {'en': 'Live Care', 'ar': 'Live Care'}, 'beingBad': {'en': 'being bad', 'ar': 'سيء'}, 'beingGreat': {'en': 'being great', 'ar': 'رائع'}, @@ -247,26 +195,14 @@ const Map> localizedValues = { 'endcallwithcharge': {'en': 'End with charge', 'ar': 'ينتهي مع الشحن'}, 'endcall': {'en': 'End Call', 'ar': 'إنهاء المكالمة'}, 'transfertoadmin': {'en': 'Transfer to admin', 'ar': 'نقل إلى المسؤول'}, - "searchMedicineImageCaption": { - 'en': 'Type the medicine name to search', - 'ar': ' اكتب اسم الدواء للبحث' - }, + "searchMedicineImageCaption": {'en': 'Type the medicine name to search', 'ar': ' اكتب اسم الدواء للبحث'}, "type": {'en': 'Type ', 'ar': 'اكتب'}, "fromDate": {'en': 'From Date', 'ar': 'من تاريخ'}, "toDate": {'en': 'To Date', 'ar': 'الى تاريخ'}, - "searchPatientImageCaptionTitle": { - 'en': 'SEARCH PATIENT', - 'ar': 'البحث عن المريض' - }, - "searchPatientImageCaptionBody": { - 'en': 'Add Details Of Patient To search', - 'ar': ' أضف تفاصيل المريض للبحث' - }, + "searchPatientImageCaptionTitle": {'en': 'SEARCH PATIENT', 'ar': 'البحث عن المريض'}, + "searchPatientImageCaptionBody": {'en': 'Add Details Of Patient To search', 'ar': ' أضف تفاصيل المريض للبحث'}, "welcome": {'en': 'Welcome', 'ar': ' أهلا بك'}, - 'youDoNotHaveAnyItem': { - 'en': 'You don\'t have any Items', - 'ar': 'لا يوجد اي نتائج' - }, + 'youDoNotHaveAnyItem': {'en': 'You don\'t have any Items', 'ar': 'لا يوجد اي نتائج'}, 'typeMedicineName': {'en': 'Type Medicine Name', 'ar': 'اكتب اسم الدواء'}, 'moreThan3Letter': { 'en': 'Medicine Name Should Be More Than 3 letter', @@ -293,20 +229,14 @@ const Map> localizedValues = { 'bed': {'en': 'BED:', 'ar': 'السرير'}, 'next': {'en': 'Next', 'ar': 'التالي'}, 'previous': {'en': 'Previous', 'ar': 'السابق'}, - 'healthRecordInformation': { - 'en': 'HEALTH RECORD INFORMATION', - 'ar': 'معلومات السجل الصحي' - }, + 'healthRecordInformation': {'en': 'HEALTH RECORD INFORMATION', 'ar': 'معلومات السجل الصحي'}, "prevoius-sickleave-issed": { "en": "Total previous sick leave issued by the doctor", "ar": "مجموع الإجازات المرضية السابقة التي أصدرها الطبيب" }, 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, - "empty-message": { - "en": "Please enter this field", - "ar": "يرجى ادخال هذا الحقل" - }, + "empty-message": {"en": "Please enter this field", "ar": "يرجى ادخال هذا الحقل"}, 'no-sickleve-applied': { 'en': "No sick leave available, apply Now", 'ar': 'لا توجد إجازة مرضية متاحة ، تقدم بطلب الآن' @@ -321,19 +251,13 @@ const Map> localizedValues = { 'leave-start-date': {'en': "Leave start date", 'ar': 'تاريخ بدء المغادرة'}, 'days-sick-leave': {'en': "DAYS OF SICK LEAVE", 'ar': 'أيام الإجازة المرضية'}, 'extend': {'en': "Extend", 'ar': 'تمديد'}, - 'extend-sickleave': { - 'en': "EXTEND SICK LEAVE", - 'ar': 'قم بتمديد الإجازة المرضية' - }, + 'extend-sickleave': {'en': "EXTEND SICK LEAVE", 'ar': 'قم بتمديد الإجازة المرضية'}, "chiefComplaintLength": { "en": "Chief Complaint length should be greater than 25", "ar": "يجب أن يكون طول شكوى الرئيس أكبر من 25" }, 'patient-target': {'en': 'Target Patient', 'ar': 'الهدف المريض'}, - 'no-priscription-listed': { - 'en': 'No Prescription Listed', - 'ar': 'لا وصفة طبية مدرجة' - }, + 'no-priscription-listed': {'en': 'No Prescription Listed', 'ar': 'لا وصفة طبية مدرجة'}, 'referTo': {'en': "Refer To", 'ar': 'محال إلى'}, 'referredFrom': {'en': "From : ", 'ar': ' : من'}, 'branch': {'en': "Branch", 'ar': 'الفرع'}, @@ -348,15 +272,9 @@ const Map> localizedValues = { 'summaryReport': {'en': "Summary", 'ar': 'موجز'}, 'accept': {'en': "ACCEPT", 'ar': 'قبول'}, 'reject': {'en': "REJECT", 'ar': 'رفض'}, - 'noAppointmentsErrorMsg': { - 'en': "There is no appointments for at this date", - 'ar': 'لا توجد مواعيد في هذا التاريخ' - }, + 'noAppointmentsErrorMsg': {'en': "There is no appointments for at this date", 'ar': 'لا توجد مواعيد في هذا التاريخ'}, 'referralPatient': {'en': 'Referral Patient', 'ar': 'المريض المحال '}, - 'noPrescriptionListed': { - 'en': 'NO PRESCRIPTION LISTED', - 'ar': 'لم يتم سرد أي وصف' - }, + 'noPrescriptionListed': {'en': 'NO PRESCRIPTION LISTED', 'ar': 'لم يتم سرد أي وصف'}, 'addNow': {'en': 'ADD Now', 'ar': 'اضف الآن'}, 'orderType': {'en': 'Order Type', 'ar': 'نوع الطلب'}, 'strength': {'en': 'Strength', 'ar': 'شدة'}, @@ -366,14 +284,8 @@ const Map> localizedValues = { 'instruction': {'en': 'Instructions', 'ar': 'إرشادات'}, 'addMedication': {'en': 'ADD MEDICATION', 'ar': 'اضف الدواء'}, 'route': {'en': 'Route', 'ar': 'المسار'}, - 'reschedule-leave': { - 'en': 'Reschedule and leaves', - 'ar': 'إعادة الجدولة والأوراق' - }, - 'no-reschedule-leave': { - 'en': 'No Reschedule and leaves', - 'ar': 'لا إعادة جدولة ويغادر' - }, + 'reschedule-leave': {'en': 'Reschedule and leaves', 'ar': 'إعادة الجدولة والأوراق'}, + 'no-reschedule-leave': {'en': 'No Reschedule and leaves', 'ar': 'لا إعادة جدولة ويغادر'}, 'weight': {'en': "Weight", 'ar': 'الوزن'}, 'kg': {'en': "kg", 'ar': 'كغ'}, 'height': {'en': "Height", 'ar': 'الطول'}, @@ -395,10 +307,7 @@ const Map> localizedValues = { 'rhythm': {'en': "Rhythm", 'ar': 'الإيقاع'}, 'respBeats': {'en': 'RESP (beats/minute)', 'ar': ' (دقة/دقيقة)التنفس'}, 'patternOfRespiration': {'en': "Pattern Of Respiration", 'ar': 'نمط التنفس'}, - 'bloodPressureDiastoleAndSystole': { - 'en': 'Blood Pressure (Sys, Dias)', - 'ar': 'ضغط الدم (العظمى, الصغرى)' - }, + 'bloodPressureDiastoleAndSystole': {'en': 'Blood Pressure (Sys, Dias)', 'ar': 'ضغط الدم (العظمى, الصغرى)'}, 'cuffLocation': {'en': "Cuff Location", 'ar': 'موقع الكف'}, 'cuffSize': {'en': "Cuff Size", 'ar': 'حجم الكف'}, 'patientPosition': {'en': "Patient Position", 'ar': 'موقع المريض'}, @@ -409,73 +318,37 @@ const Map> localizedValues = { 'to': {'en': "To", 'ar': 'إلى'}, 'coveringDoctor': {'en': "Covering Doctor: ", 'ar': ' :تغطية دكتور'}, 'requestLeave': {'en': 'Request Leave', 'ar': 'طلب إجازة'}, - 'pleaseEnterDate': { - 'en': 'Please enter leave start date', - 'ar': 'الرجاء إدخال تاريخ بدء الإجازة' - }, - 'pleaseEnterNoOfDays': { - 'en': 'Please enter sick leave days', - 'ar': 'الرجاء إدخال أيام الإجازة المرضية' - }, - 'pleaseEnterRemarks': { - 'en': 'Please enter remarks', - 'ar': 'الرجاء إدخال الملاحظات' - }, + 'pleaseEnterDate': {'en': 'Please enter leave start date', 'ar': 'الرجاء إدخال تاريخ بدء الإجازة'}, + 'pleaseEnterNoOfDays': {'en': 'Please enter sick leave days', 'ar': 'الرجاء إدخال أيام الإجازة المرضية'}, + 'pleaseEnterRemarks': {'en': 'Please enter remarks', 'ar': 'الرجاء إدخال الملاحظات'}, 'update': {'en': 'Update', 'ar': 'تحديث'}, 'admission': {'en': "Admission", 'ar': 'قبول'}, 'request': {'en': "Request", 'ar': 'طلب'}, 'admissionRequest': {'en': "Admission Request", 'ar': 'طلب قبول'}, 'patientDetails': {'en': "Patient Details", 'ar': 'تفاصيل المريض'}, - 'specialityAndDoctorDetail': { - 'en': "SPECIALITY AND DOCTOR DETAILS", - 'ar': 'تفاصيل التخصص والطبيب' - }, + 'specialityAndDoctorDetail': {'en': "SPECIALITY AND DOCTOR DETAILS", 'ar': 'تفاصيل التخصص والطبيب'}, 'referringDate': {'en': "Referring Date", 'ar': 'تاريخ الإحالة'}, 'referringDoctor': {'en': "Referring Doctor", 'ar': 'دكتور الإحالة'}, 'otherInformation': {'en': "Other Information", 'ar': 'معلومات أخرى'}, 'expectedDays': {'en': "Expected Days", 'ar': 'الأيام المتوقعة'}, - 'expectedAdmissionDate': { - 'en': "Expected Admission Date", - 'ar': 'تاريخ القبول المتوقع' - }, + 'expectedAdmissionDate': {'en': "Expected Admission Date", 'ar': 'تاريخ القبول المتوقع'}, 'admissionDate': {'en': "Admission Date", 'ar': 'تاريخ القبول'}, // 'emergencyAdmission': {'en': "EMERGENCY ADMISSION", 'ar': 'دخول الطوارئ'}, - 'isSickLeaveRequired': { - 'en': "Is Sick Leave Required", - 'ar': 'هل الإجازة المرضية مطلوبة' - }, + 'isSickLeaveRequired': {'en': "Is Sick Leave Required", 'ar': 'هل الإجازة المرضية مطلوبة'}, 'patientPregnant': {'en': "Patient Pregnant", 'ar': 'المريض حامل'}, - 'treatmentLine': { - 'en': "Main line of treatment", - 'ar': 'الخط الرئيسي للعلاج' - }, + 'treatmentLine': {'en': "Main line of treatment", 'ar': 'الخط الرئيسي للعلاج'}, 'ward': {'en': "Ward", 'ar': 'رعاية'}, - 'preAnesthesiaReferred': { - 'en': "PRE ANESTHESIA REFERRED", - 'ar': 'الاحالة قبل التخدير' - }, + 'preAnesthesiaReferred': {'en': "PRE ANESTHESIA REFERRED", 'ar': 'الاحالة قبل التخدير'}, 'admissionType': {'en': "Admission Type", 'ar': 'نوع القبول'}, 'diagnosis': {'en': "Diagnosis", 'ar': 'التشخيص'}, 'allergies': {'en': "Allergies", 'ar': 'الحساسية'}, - 'preOperativeOrders': { - 'en': "Pre Operative Orders", - 'ar': 'أوامر ما قبل العملية' - }, - 'elementForImprovement': { - 'en': "Element For Improvement", - 'ar': 'عنصر للتحسين' - }, + 'preOperativeOrders': {'en': "Pre Operative Orders", 'ar': 'أوامر ما قبل العملية'}, + 'elementForImprovement': {'en': "Element For Improvement", 'ar': 'عنصر للتحسين'}, 'dischargeDate': {'en': "Discharge Date", 'ar': 'تاريخ التفريغ'}, 'dietType': {'en': "Diet Type", 'ar': 'نوع النظام الغذائي'}, - 'dietTypeRemarks': { - 'en': "Remarks on diet type", - 'ar': 'ملاحظات على نوع النظام الغذائي' - }, + 'dietTypeRemarks': {'en': "Remarks on diet type", 'ar': 'ملاحظات على نوع النظام الغذائي'}, 'save': {'en': "SAVE", 'ar': 'حفظ'}, - 'postPlansEstimatedCost': { - 'en': "POST PLANS & ESTIMATED COST", - 'ar': 'خطط البريد والتكلفة المقدرة' - }, + 'postPlansEstimatedCost': {'en': "POST PLANS & ESTIMATED COST", 'ar': 'خطط البريد والتكلفة المقدرة'}, 'postPlans': {'en': "POST PLANS", 'ar': 'خطط البريد'}, 'ucaf': {'en': "UCAF", 'ar': 'UCAF'}, 'emergencyCase': {'en': "Emergency Case", 'ar': 'حالة طارئة'}, @@ -490,19 +363,13 @@ const Map> localizedValues = { 'en': "Patient Feels pain in his back and cough", 'ar': 'يشعر المريض بألم في ظهره ويسعل' }, - 'additionalTextComplaints': { - 'en': "Additional text to add about Complaints", - 'ar': 'نص إضافي لإضافته حول الشكاوى' - }, + 'additionalTextComplaints': {'en': "Additional text to add about Complaints", 'ar': 'نص إضافي لإضافته حول الشكاوى'}, 'otherConditions': {'en': "OTHER CONDITIONS", 'ar': 'شروط أخرى'}, 'other': {'en': "Other", 'ar': 'أخرى'}, 'how': {'en': "How", 'ar': 'كيف'}, 'when': {'en': "When", 'ar': 'متى'}, 'where': {'en': "Where", 'ar': 'أين'}, - 'specifyPossibleLineManagement': { - 'en': "Specify possible line of management", - 'ar': 'حدد خط الإدارة المحتمل' - }, + 'specifyPossibleLineManagement': {'en': "Specify possible line of management", 'ar': 'حدد خط الإدارة المحتمل'}, 'significantSigns': {'en': "SIGNIFICANT SIGNS", 'ar': 'علامات مهمة'}, 'backAbdomen': {'en': "Back : Abdomen", 'ar': 'الظهر: البطن'}, 'reasons': {'en': "Reasons", 'ar': 'الأسباب'}, @@ -512,20 +379,11 @@ const Map> localizedValues = { 'addChiefComplaints': {'en': "Add Chief Complaints", 'ar': ' اضافه الشكاوى'}, 'histories': {'en': "Histories", 'ar': 'التاريخ المرضي'}, 'allergiesSoap': {'en': "Allergies", 'ar': 'الحساسية'}, - 'historyOfPresentIllness': { - 'en': "History of Present Illness", - 'ar': 'تاريخ المرض الحالي' - }, - 'requiredMsg': { - 'en': "Please add required field correctly", - 'ar': "الرجاء إضافة الحقل المطلوب بشكل صحيح" - }, + 'historyOfPresentIllness': {'en': "History of Present Illness", 'ar': 'تاريخ المرض الحالي'}, + 'requiredMsg': {'en': "Please add required field correctly", 'ar': "الرجاء إضافة الحقل المطلوب بشكل صحيح"}, 'addHistory': {'en': "Add History", 'ar': "اضافه تاريخ مرضي"}, 'searchHistory': {'en': "Search History", 'ar': " البحث"}, - 'addSelectedHistories': { - 'en': "Add Selected Histories", - 'ar': " اضافه تاريخ مرضي" - }, + 'addSelectedHistories': {'en': "Add Selected Histories", 'ar': " اضافه تاريخ مرضي"}, 'addAllergies': {'en': "Add Allergies", 'ar': "أضف الحساسية"}, 'itemExist': {'en': "This item already exist", 'ar': "هذا العنصر موجود"}, 'selectAllergy': {'en': "Select Allergy", 'ar': "أختر الحساسية"}, @@ -533,18 +391,9 @@ const Map> localizedValues = { 'leaveCreated': {'en': "Leave has been created", 'ar': "تم إنشاء الإجازة"}, 'medications': {'en': "Medications", 'ar': "الأدوية"}, 'procedures': {'en': "Procedures", 'ar': "الإجراءات"}, - 'vitalSignEmptyMsg': { - 'en': "There is no vital signs for this patient", - 'ar': "لا توجد علامات حيوية لهذا المريض" - }, - 'referralEmptyMsg': { - 'en': "There is no referral data", - 'ar': "لا توجد بيانات إحالة" - }, - 'referralSuccessMsg': { - 'en': "You make referral successfully", - 'ar': "You make referral successfully" - }, + 'vitalSignEmptyMsg': {'en': "There is no vital signs for this patient", 'ar': "لا توجد علامات حيوية لهذا المريض"}, + 'referralEmptyMsg': {'en': "There is no referral data", 'ar': "لا توجد بيانات إحالة"}, + 'referralSuccessMsg': {'en': "You make referral successfully", 'ar': "You make referral successfully"}, 'fromTime': {'en': "From Time", 'ar': "من وقت"}, 'toTime': {'en': "To Time", 'ar': "الى وقت"}, 'diagnoseType': {'en': "Diagnose Type", 'ar': "نوع التشخيص"}, @@ -555,18 +404,9 @@ const Map> localizedValues = { 'codeNo': {'en': "Code #", 'ar': "# الرمز"}, 'covered': {'en': "Covered", 'ar': "مغطى"}, 'approvalRequired': {'en': "Approval Required", 'ar': "الموافقة مطلوبة"}, - 'uncoveredByDoctor': { - 'en': "Uncovered By Doctor", - 'ar': "غير مغطى من قبل الدكتور" - }, - 'chiefComplaintEmptyMsg': { - 'en': "There is no Chief Complaint", - 'ar': "ليس هناك شكوى رئيس" - }, - "more-verify": { - "en": "More Verification Options", - "ar": "المزيد من خيارات التحقق" - }, + 'uncoveredByDoctor': {'en': "Uncovered By Doctor", 'ar': "غير مغطى من قبل الدكتور"}, + 'chiefComplaintEmptyMsg': {'en': "There is no Chief Complaint", 'ar': "ليس هناك شكوى رئيس"}, + "more-verify": {"en": "More Verification Options", "ar": "المزيد من خيارات التحقق"}, "welcome-back": {"en": "Welcome back!", "ar": "مرحبا بعودتك!"}, "account-info": { "en": "Would you like to login with current username?", @@ -578,42 +418,29 @@ const Map> localizedValues = { "ar": "الرجاء اختيار احدى الخيارات التالية للتحقق من البيانات" }, "register-user": {"en": "Register", "ar": "تسجيل"}, - "verify-with-fingerprint": {"en": "Verify through Fingerprint", "ar": "بصمة"}, - "verify-with-faceid": {"en": "Verify through Face ID", "ar": "معرف الوجه"}, - "verify-with-sms": {"en": "Verify through SMS", "ar": "الرسائل القصيرة"}, - "verify-with-whatsapp": {"en": "Verify through WhatsApp", "ar": " الواتس اب"}, - "last-login": { - "en": "Last login details:", - "ar": "تفاصيل تسجيل الدخول الأخير:" - }, + "verify-with-fingerprint": {"en": "Fingerprint", "ar": "بصمة"}, + "verify-with-faceid": {"en": "Face ID", "ar": "معرف الوجه"}, + "verify-with-sms": {"en": " SMS", "ar": "الرسائل القصيرة"}, + "verify-with-whatsapp": {"en": "WhatsApp", "ar": " الواتس اب"}, + "verify-with": {"en": "Verify through ", "ar": " الواتس اب"}, + "last-login": {"en": "Last login details:", "ar": "تفاصيل تسجيل الدخول الأخير:"}, "last-login-with": {"en": "VERIFICATION TYPE:", "ar": "نوع التحقق:"}, "verify-fingerprint": { - "en": - "To activate the fingerprint login service, please verify data by using one of the following options.", - "ar": - "لتفعيل خدمة الدخول بالبصمة، يرجى اختيار احدى القنوات التالية للتحقق من البيانات" + "en": "To activate the fingerprint login service, please verify data by using one of the following options.", + "ar": "لتفعيل خدمة الدخول بالبصمة، يرجى اختيار احدى القنوات التالية للتحقق من البيانات" }, "verification_message": { "en": "Please enter the Verification Code sent to", "ar": "الرجاء ادخال رمز التحقق الذي تم إرساله إلى" }, - "validation_message": { - "en": "The verification code expires in", - "ar": "تنتهي صلاحية رمز التحقق خلال" - }, + "validation_message": {"en": "The verification code expires in", "ar": "تنتهي صلاحية رمز التحقق خلال"}, 'addAssessment': {'en': "Add Assessment", 'ar': "أضف التقييم"}, 'assessment': {'en': "Assessment", 'ar': " التقييم"}, - 'physicalSystemExamination': { - 'en': "Physical System / Examination", - 'ar': "الفحص البدني / النظام" - }, + 'physicalSystemExamination': {'en': "Physical System / Examination", 'ar': "الفحص البدني / النظام"}, 'searchExamination': {'en': "Search Examination", 'ar': "فحص البحث"}, 'addExamination': {'en': "Add Examination", 'ar': "اضافه"}, 'doc': {'en': "Doc : ", 'ar': " د : "}, - 'patientNoDetailErrMsg': { - 'en': "There is no detail for this patient", - 'ar': "لا توجد تفاصيل لهذا المريض" - }, + 'patientNoDetailErrMsg': {'en': "There is no detail for this patient", 'ar': "لا توجد تفاصيل لهذا المريض"}, 'allergicTO': {'en': "ALLERGIC TO ", 'ar': " حساس من"}, 'normal': {'en': "Normal", 'ar': "عادي"}, 'abnormal': {'en': "Abnormal", 'ar': " غير عادي"}, @@ -632,45 +459,25 @@ const Map> localizedValues = { 'visitDate': {'en': "Visit Date", 'ar': "تاريخ الزيارة"}, 'test': {'en': "Procedures/Test", 'ar': "عمليات/تحاليل"}, 'regular': {'en': "Regular", 'ar': "اعتيادي"}, - 'addMoreProcedure': { - 'en': "Add More Procedures", - 'ar': "اضف المزيد من العمليات" - }, + 'addMoreProcedure': {'en': "Add More Procedures", 'ar': "اضف المزيد من العمليات"}, 'searchProcedures': {'en': "Search Procedures", 'ar': "البحث في العمليات"}, 'selectProcedures': {'en': "Select procedure", 'ar': "اختر العملية"}, - 'procedureCategorise': { - 'en': "Select Procedure Category", - 'ar': "اختر صنف العمليات " - }, - 'addSelectedProcedures': { - 'en': "add Selected Procedures", - 'ar': "اضافة العمليات المختارة " - }, + 'procedureCategorise': {'en': "Select Procedure Category", 'ar': "اختر صنف العمليات "}, + 'addSelectedProcedures': {'en': "add Selected Procedures", 'ar': "اضافة العمليات المختارة "}, + 'addProcedures': {'en': "Add Procedure", 'ar': "اضافة العمليات"}, 'updateProcedure': {'en': "Update Procedure", 'ar': "تحديث العملية"}, 'orderProcedure': {'en': "order procedure", 'ar': "طلب العمليات"}, 'nameOrICD': {'en': "Name or ICD", 'ar': "الاسم او  ICD"}, 'dType': {'en': "Type", 'ar': "النوع"}, - 'addAssessmentDetails': { - 'en': "Add Assessment Details", - 'ar': "أضف تفاصيل التقييم" - }, + 'addAssessmentDetails': {'en': "Add Assessment Details", 'ar': "أضف تفاصيل التقييم"}, 'progressNoteSOAP': {'en': "Progress Note", 'ar': "ملاحظة التقدم"}, 'addProgressNote': {'en': "Add Progress Note", 'ar': "أضف ملاحظة التقدم"}, 'createdBy': {'en': "Created By :", 'ar': "أضيفت من قبل : "}, 'editedBy': {'en': "Edited By :", 'ar': "عدلت من قبل : "}, 'currentMedications': {'en': "Current Medications", 'ar': "الأدوية الحالية"}, - 'noItem': { - 'en': "No items exists in this list", - 'ar': "لا توجد عناصر في هذه القائمة" - }, - 'postUcafSuccessMsg': { - 'en': "UCAF request send successfully", - 'ar': "تم ارسال طلب UCAF بنجاح" - }, - 'vitalSignDetailEmpty': { - 'en': "There is no data for this vital sign", - 'ar': "لا توجد بيانات لهذه العلامة الحيوية" - }, + 'noItem': {'en': "No items exists in this list", 'ar': "لا توجد عناصر في هذه القائمة"}, + 'postUcafSuccessMsg': {'en': "UCAF request send successfully", 'ar': "تم ارسال طلب UCAF بنجاح"}, + 'vitalSignDetailEmpty': {'en': "There is no data for this vital sign", 'ar': "لا توجد بيانات لهذه العلامة الحيوية"}, 'onlyOfftimeHoliday': { 'en': "You can only apply holiday or offtime from mobile app", 'ar': "يمكنك فقط تطبيق عطلة أو إجازة من تطبيق الهاتف" @@ -686,10 +493,7 @@ const Map> localizedValues = { 'en': "You have to add at least one examination.", 'ar': "يجب عليك إضافة الفحص واحد على الأقل." }, - 'progressNoteErrorMsg': { - 'en': "You have to add progress Note.", - 'ar': "يجب عليك إضافة ملاحظة التقدم." - }, + 'progressNoteErrorMsg': {'en': "You have to add progress Note.", 'ar': "يجب عليك إضافة ملاحظة التقدم."}, 'chiefComplaintErrorMsg': { 'en': "You have to add chief complaint fields correctly .", 'ar': "يجب عليك إضافة حقول شكوى الرئيس بشكل صحيح" @@ -703,7 +507,7 @@ const Map> localizedValues = { 'days': {'en': "Days", 'ar': "أيام"}, 'months': {'en': "Months", 'ar': "أشهر"}, 'years': {'en': "Years", 'ar': "سنين"}, - 'hr': {'en': "HR", 'ar': "س"}, + 'hr': {'en': "Hr", 'ar': "س"}, 'min': {'en': "Min", 'ar': "د"}, 'appointmentNumber': {'en': "Appointment Number", 'ar': "رقم الموعد"}, 'referralStatusHold': {'en': "Hold", 'ar': "معلق"}, @@ -714,41 +518,20 @@ const Map> localizedValues = { 'clinicSearch': {'en': "Search Clinic", 'ar': "بحث عن عيادة"}, 'doctorSearch': {'en': "Search Doctor", 'ar': "بحث عن طبيب"}, - 'referralResponse': { - 'en': "Referral Response : ", - 'ar': " : استجابة الإحالة" - }, + 'referralResponse': {'en': "Referral Response : ", 'ar': " : استجابة الإحالة"}, 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, 'diagnosisDetail': {'en': "Diagnosis Details", 'ar': "تفاصيل التشخيص"}, - 'referralSuccessMsgAccept': { - 'en': "Referral Accepted Successfully", - 'ar': "تم قبول الإحالة بنجاح" - }, - 'referralSuccessMsgReject': { - 'en': "Referral Rejected Successfully", - 'ar': "تم رفض الإحالة بنجاح" - }, - 'sickLeaveComments': { - 'en': "Sick leave comments", - 'ar': "تعليقات إجازة مرضية" - }, + 'referralSuccessMsgAccept': {'en': "Referral Accepted Successfully", 'ar': "تم قبول الإحالة بنجاح"}, + 'referralSuccessMsgReject': {'en': "Referral Rejected Successfully", 'ar': "تم رفض الإحالة بنجاح"}, + 'sickLeaveComments': {'en': "Sick leave comments", 'ar': "تعليقات إجازة مرضية"}, 'pastMedicalHistory': {'en': "Past medical history", 'ar': "التاريخ الطبي"}, - 'pastSurgicalHistory': { - 'en': "Past surgical history", - 'ar': "التاريخ الجراحي" - }, + 'pastSurgicalHistory': {'en': "Past surgical history", 'ar': "التاريخ الجراحي"}, 'complications': {'en': "Complications", 'ar': "المضاعفات"}, 'floor': {'en': "Floor", 'ar': "الطابق"}, 'roomCategory': {'en': "Room category", 'ar': "فئة الغرفة"}, - 'otherDepartmentsInterventions': { - 'en': "Other departments interventions", - 'ar': "تدخلات الأقسام الأخرى" - }, + 'otherDepartmentsInterventions': {'en': "Other departments interventions", 'ar': "تدخلات الأقسام الأخرى"}, 'otherProcedure': {'en': "Other procedure", 'ar': "إجراء آخر"}, - 'admissionRequestSuccessMsg': { - 'en': "Admission Request Created Successfully", - 'ar': "تم إنشاء طلب القبول بنجاح" - }, + 'admissionRequestSuccessMsg': {'en': "Admission Request Created Successfully", 'ar': "تم إنشاء طلب القبول بنجاح"}, // 'icd': {'en': "ICD", 'ar': " "}, 'orderNo': {'en': "Order No : ", 'ar': "رقم الطلب"}, 'infoStatus': {'en': "Info Status", 'ar': "حالة المعلومات"}, @@ -760,42 +543,28 @@ const Map> localizedValues = { 'no-clinic': {'en': "No Clinic", 'ar': "لا عيادة"}, 'otherStatistic': {'en': "Other Statistics", 'ar': "إحصائيات أخرى"}, 'ptientsreferral': {'en': "Patient's Referrals", 'ar': "إحالات المريض"}, + 'myPatientsReferral': {'en': "Patient's\nReferrals", 'ar': "إحالات\nالمريض"}, 'arrivalpatient': {'en': "Arrival Patients", 'ar': "المرضى القادمون"}, - 'searchmedicinepatient': { - 'en': "Search patient or Medicines", - 'ar': "ابحث عن المريض أو الأدوية" - }, + 'searchmedicinepatient': {'en': "Search patient or Medicines", 'ar': "ابحث عن المريض أو الأدوية"}, 'appointmentDate': {'en': "Appointment Date", 'ar': "تاريخ الموعد"}, 'arrived_p': {'en': "Arrived", 'ar': "وصل"}, 'details': {'en': 'Details', 'ar': 'التفاصيل'}, - "liveCare": {"en": "Live Care", "ar": "لايف كير"}, + "liveCare": {"en": "LiveCare", "ar": "لايف كير"}, "out-patient": {"en": "OutPatient", "ar": "عيادات خارجية"}, "BillNo": {"en": "Bill No :", "ar": "رقم الفاتورة"}, "labResults": {"en": "Lab Result", "ar": "نتيجة المختبر"}, - "sendSuc": { - "en": "A copy has been sent to the email", - "ar": "تم إرسال نسخة إلى البريد الإلكتروني" - }, + "sendSuc": {"en": "A copy has been sent to the email", "ar": "تم إرسال نسخة إلى البريد الإلكتروني"}, "SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"}, - "noDataAvailable": { - "en": "No data available", - "ar": " لا يوجد بيانات متاحة " - }, + "noDataAvailable": {"en": "No data available", "ar": " لا يوجد بيانات متاحة "}, "show-more-btn": {"en": "Flow Chart", "ar": "النتائج التراكمية"}, "open-rad": {"en": "Open Radiology Image", "ar": "فتح صور الاشعة"}, 'fileNumber': {'en': "File Number: ", 'ar': "رقم الملف : "}, - 'searchPatient-name': { - 'en': 'Search Name, Medical File, Phone Number', - 'ar': "اسم البحث ، الملف الطبي ، رقم الهاتف" - }, + 'searchPatient-name': {'en': 'Search Name, Medical File, Phone Number', 'ar': "اسم البحث ، الملف الطبي ، رقم الهاتف"}, 'reschedule': {'en': 'Reschedule', 'ar': 'إعادة الجدولة'}, 'leaves': {'en': 'Leaves', 'ar': 'يغادر'}, - "totalApproval": { - "en": "Total approval unused", - "ar": "اجمالي الموافقات الغير مستخدمة" - }, + "totalApproval": {"en": "Total approval unused", "ar": "اجمالي الموافقات الغير مستخدمة"}, "procedureStatus": {"en": "Procedure Status: ", "ar": "حالة الاجراء"}, "unusedCount": {"en": "Unused Count: ", "ar": "غير مستخدم: "}, "companyName": {"en": "Company Name ", "ar": "اسم الشركة: "}, @@ -804,32 +573,17 @@ const Map> localizedValues = { "prescriptions": {"en": "Prescriptions", "ar": "الوصفات الطبية"}, "notes": {"en": "Notes", "ar": "ملاحظات"}, "dailyDoses": {"en": "Daily Doses", "ar": "جرعات يومية"}, - "searchWithOther": { - "en": "Search With Other Criteria", - "ar": "البحث بمعايير أخرى" - }, - "hideOtherCriteria": { - "en": "Hide Other Criteria", - "ar": "إخفاء المعايير الأخرى" - }, - "applyForReschedule": { - "en": "Apply for leave or reschedule", - "ar": "تقدم بطلب للحصول على إجازة أو إعادة جدولة" - }, + "searchWithOther": {"en": "Search With Other Criteria", "ar": "البحث بمعايير أخرى"}, + "hideOtherCriteria": {"en": "Hide Other Criteria", "ar": "إخفاء المعايير الأخرى"}, + "applyForReschedule": {"en": "Apply for leave or reschedule", "ar": "تقدم بطلب للحصول على إجازة أو إعادة جدولة"}, "startDate": {"en": "Start Date: ", "ar": " :تاريخ البدء"}, "endDate": {"en": "End Date: ", "ar": " :تاريخ الانتهاء"}, "add-reschedule": {"en": "Add reschedule", "ar": "أضف إعادة الجدولة"}, "update-reschedule": {"en": "Update reschedule", "ar": "تحديث إعادة الجدولة"}, "sick_leave": {"en": "Sick Leave", "ar": "إجازة مرضية"}, - "addSickLeaveRequest": { - "en": "Add Sick Leave Request", - "ar": "إضافة طلب إجازة مرضية" - }, - "extendSickLeaveRequest": { - "en": "Extend Sick Leave Request", - "ar": "تمديد طلب الإجازة المرضية" - }, + "addSickLeaveRequest": {"en": "Add Sick Leave Request", "ar": "إضافة طلب إجازة مرضية"}, + "extendSickLeaveRequest": {"en": "Extend Sick Leave Request", "ar": "تمديد طلب الإجازة المرضية"}, "accepted": {"en": "Accepted", "ar": "وافقت"}, "cancelled": {"en": "Cancelled", "ar": "ألغيت"}, "unReplied": {"en": "UnReplied", "ar": "لم يتم الرد"}, @@ -839,16 +593,10 @@ const Map> localizedValues = { "remove": {"en": "Remove", "ar": "حذف"}, "changeOfSchedule": {"en": "Change of Schedule", "ar": "تغيير الجدول"}, "newSchedule": {"en": "New Schedule", "ar": "جدول جديد"}, - "enter_credentials": { - "en": "Enter the user credentials below", - "ar": "أدخل بيانات اعتماد المستخدم أدناه" - }, + "enter_credentials": {"en": "Enter the user credentials below", "ar": "أدخل بيانات اعتماد المستخدم أدناه"}, "step": {"en": "Step", "ar": "خطوة"}, "fieldRequired": {"en": "This field is required", "ar": "هذه الخانة مطلوبه"}, - "applyOrRescheduleLeave": { - "en": "Apply Reschedule Leave", - "ar": "التقدم بطلب أو إعادة جدولة الإجازة" - }, + "applyOrRescheduleLeave": {"en": "Apply Reschedule Leave", "ar": "التقدم بطلب أو إعادة جدولة الإجازة"}, "myQRCode": {"en": "My QR Code", "ar": " كود QR "}, "patientIDMobilenational": { "en": "Patient ID, National ID, Mobile Number", @@ -863,70 +611,37 @@ const Map> localizedValues = { "try-saying": {"en": "Try saying something", "ar": 'حاول قول شيء ما'}, "refClinic": {"en": "Ref Clinic", "ar": "العيادة المرجعية"}, "acknowledged": {"en": "Acknowledged", "ar": "إقرار"}, - "didntCatch": { - "en": "Didn't catch that. Try Speaking again", - "ar": "لم يتم التقاط ذلك. حاول التحدث مرة أخرى" - }, + "didntCatch": {"en": "Didn't catch that. Try Speaking again", "ar": "لم يتم التقاط ذلك. حاول التحدث مرة أخرى"}, "showDetail": {"en": "Show Detail", "ar": "أظهر المعلومات"}, "viewProfile": {"en": "View Profile", "ar": "إعرض الملف"}, - "pleaseEnterProcedure": { - "en": "Please Enter Procedure", - "ar": "الرجاء إدخال الإجراء " - }, + "pleaseEnterProcedure": {"en": "Please Enter Procedure", "ar": "الرجاء إدخال الإجراء "}, "fillTheMandatoryProcedureDetails": { "en": "Fill The Mandatory Procedure Details", "ar": "املأ تفاصيل الإجراء الإلزامي" }, - "atLeastThreeCharacters": { - "en": "At least three Characters", - "ar": "ثلاثة أحرف على الأقل " - }, - "searchProcedureHere": { - "en": "Search Procedure here...", - "ar": "إجراء البحث هنا ... " - }, - "noInsuranceApprovalFound": { - "en": "No Insurance Approval Found", - "ar": "لم يتم العثور على موافقة التأمين" - }, + "atLeastThreeCharacters": {"en": "At least three Characters", "ar": "ثلاثة أحرف على الأقل "}, + "searchProcedureHere": {"en": "Search Procedure here...", "ar": "إجراء البحث هنا ... "}, + "noInsuranceApprovalFound": {"en": "No Insurance Approval Found", "ar": "لم يتم العثور على موافقة التأمين"}, "procedure": {"en": "Procedure", "ar": "عملية"}, "stopDate": {"en": "Stop Date", "ar": "تاريخ التوقف"}, "processed": {"en": "processed", "ar": "معالجتها"}, "direction": {"en": "Direction", "ar": "إشراف"}, "refill": {"en": "Refill", "ar": "اعادة تعبئه"}, - "medicationHasBeenAdded": { - "en": "Medication has been added", - "ar": "تمت إضافة الدواء" - }, - "newPrescriptionOrder": { - "en": "New Prescription Order", - "ar": "طلب وصفة طبية جديد " - }, - "pleaseFillAllFields": { - "en": "Please Fill All Fields", - "ar": "لو سمحت أملأ كل الحقول" - }, + "medicationHasBeenAdded": {"en": "Medication has been added", "ar": "تمت إضافة الدواء"}, + "newPrescriptionOrder": {"en": "New Prescription Order", "ar": "طلب وصفة طبية جديد "}, + "pleaseFillAllFields": {"en": "Please Fill All Fields", "ar": "لو سمحت أملأ كل الحقول"}, "narcoticMedicineCanOnlyBePrescribedFromVida": { "en": "Narcotic medicine can only be prescribed from VIDA", "ar": "لا يمكن وصف الأدوية المخدرة إلا من VIDA " }, - "only5DigitsAllowedForStrength": { - "en": "Only 5 Digits allowed for strength", - "ar": "يسمح فقط بـ 5 أرقام للقوة" - }, + "only5DigitsAllowedForStrength": {"en": "Only 5 Digits allowed for strength", "ar": "يسمح فقط بـ 5 أرقام للقوة"}, "unit": {"en": "Unit", "ar": "وحدة"}, "boxQuantity": {"en": "Box Quantity", "ar": "كمية الصندوق "}, "orderTestOr": {"en": "Order Test or", "ar": "اطلب اختبار أو"}, - "applyForRadiologyOrder": { - "en": "Apply for Radiology Order", - "ar": "التقدم بطلب للحصول على طلب الأشعة " - }, - "applyForNewLabOrder": { - "en": "Apply for New Lab Order", - "ar": "تقدم بطلب جديد للمختبر الأشعة" - }, + "applyForRadiologyOrder": {"en": "Apply for Radiology Order", "ar": "التقدم بطلب للحصول على طلب الأشعة "}, + "applyForNewLabOrder": {"en": "Apply for New Lab Order", "ar": "تقدم بطلب جديد للمختبر الأشعة"}, "addLabOrder": {"en": "Add Lab Order", "ar": "إضافة طلب معمل"}, - "addRadiologyOrder": {"en": "Add Radiology Order", "ar": "إضافة اشغة"}, + "addRadiologyOrder": {"en": "Add Radiology Order", "ar": "إضافة اشعة"}, "newRadiologyOrder": {"en": "New Radiology Order", "ar": "طلب الأشعة الجديد"}, "orderDate": {"en": "Order Date", "ar": "تاريخ الطلب"}, "examType": {"en": "Exam Type", "ar": "نوع الفحص"}, @@ -936,26 +651,14 @@ const Map> localizedValues = { "en": "Apply for New Prescriptions Order", "ar": "التقدم بطلب للحصول على وصفات طبية جديدة " }, - "noPrescriptionsFound": { - "en": "No Prescriptions Found", - "ar": "لم يتم العثور على وصفات طبية" - }, - "noMedicalFileFound": { - "en": "No Medical File Found", - "ar": "لم يتم العثور على ملف طبي" - }, + "noPrescriptionsFound": {"en": "No Prescriptions Found", "ar": "لم يتم العثور على وصفات طبية"}, + "noMedicalFileFound": {"en": "No Medical File Found", "ar": "لم يتم العثور على ملف طبي"}, "insurance22": {"en": "Insurance", "ar": "موافقات"}, "approvals22": {"en": "Approvals", "ar": "التامين"}, "severe": {"en": "Severe", "ar": "الشدة"}, "graphDetails": {"en": "Graph Details", "ar": "تفاصيل الرسم البياني"}, - "addNewOrderSheet": { - "en": "Add a New Order Sheet", - "ar": "أضف ورقة طلب جديدة" - }, - "addNewProgressNote": { - "en": "Add a New Progress Note", - "ar": "أضف ملاحظة تقدم جديدة" - }, + "addNewOrderSheet": {"en": "Add a New Order Sheet", "ar": "أضف ورقة طلب جديدة"}, + "addNewProgressNote": {"en": "Add a New Progress Note", "ar": "أضف ملاحظة تقدم جديدة"}, "notePending": {"en": "Pending", "ar": "قيد الانتظار"}, "noteCanceled": {"en": "Canceled", "ar": "ألغيت"}, "noteVerified": {"en": "Verified", "ar": "تم التحقق"}, @@ -976,4 +679,28 @@ const Map> localizedValues = { "medicalReportAdd": {"en": "Add Medical Report", "ar": "إضافة تقرير طبي"}, "medicalReportVerify": {"en": "Verify Medical Report", "ar": "تحقق من التقرير الطبي"}, "comments": {"en": "Comments", "ar": "تعليقات"}, + "initiateCall": {"en": "Initiate Call ", "ar": "بدء الاتصال"}, + "transferTo": {"en": "Transfer To ", "ar": "حول إلى"}, + "admin": {"en": "Admin", "ar": "مشرف"}, + "instructions": {"en": "Instructions", "ar": "تعليمات"}, + "sendLC": {"en": "Send", "ar": "تعليمات"}, + "endLC": {"en": "End", "ar": "انهاء"}, + "consultation": {"en": "Consultation", "ar": "استشارة"}, + "resume": {"en": "Resume", "ar": "استأنف"}, + "theCall": {"en": "The Call", "ar": "الاتصال"}, + "createNewMedicalReport": {"en": "Create New Medical Report", "ar": "إنشاء تقرير طبي جديد"}, + "historyPhysicalFinding": {"en": "History and Physical Finding", "ar": "التاريخ والاكتشاف المادي"}, + "laboratoryPhysicalData": {"en": "Laboratory and Physical Data", "ar": "المعامل والبيانات الفيزيائية"}, + "impressionRecommendation": {"en": "Impression and Recommendation", "ar": "الانطباع والتوصية"}, + "onHold": {"en": "On Hold", "ar": "قيد الانتظار"}, + "verified": {"en": "Verified", "ar": "تم التحقق"}, + "endCall": {"en": "End Call", "ar": "انهاء"}, + "favoriteTemplates": {"en": "Favorite Templates", "ar": "القوالب المفضلة"}, + "allProcedures": {"en": "All Procedures", "ar": "جميع الإجراءات"}, + "allRadiology": {"en": "All Radiology", "ar": "جميع الأشعة"}, + "allLab": {"en": "All Lab", "ar": "جميع المختبرات"}, + "allPrescription": {"en": "All Prescription", "ar": "جميع الوصفات"}, + "addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"}, + "edit": {"en": "Edit", "ar": "تعديل"}, + "summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"}, }; diff --git a/lib/core/enum/PatientType.dart b/lib/core/enum/PatientType.dart new file mode 100644 index 00000000..96fd9ae5 --- /dev/null +++ b/lib/core/enum/PatientType.dart @@ -0,0 +1,4 @@ +enum PatientType{ + IN_PATIENT, + OUT_PATIENT, +} \ No newline at end of file diff --git a/lib/core/enum/auth_method_types.dart b/lib/core/enum/auth_method_types.dart new file mode 100644 index 00000000..82577eeb --- /dev/null +++ b/lib/core/enum/auth_method_types.dart @@ -0,0 +1,46 @@ +enum AuthMethodTypes { SMS, WhatsApp, Fingerprint,FaceID,MoreOptions } +extension SelectedAuthMethodTypesService on AuthMethodTypes { + // ignore: missing_return + int getTypeIdService() { + switch (this) { + case AuthMethodTypes.SMS: + return 1; + break; + case AuthMethodTypes.WhatsApp: + return 2; + break; + case AuthMethodTypes.Fingerprint: + return 3; + break; + case AuthMethodTypes.FaceID: + return 4; + break; + case AuthMethodTypes.MoreOptions: + return 5; + break; + + } + } + + // ignore: missing_return + static getMethodsTypeService( int typeId) { + switch (typeId) { + case 1: + return AuthMethodTypes.SMS; + break; + case 2: + return AuthMethodTypes.WhatsApp; + break; + case 3: + return AuthMethodTypes.Fingerprint; + break; + case 4: + return AuthMethodTypes.FaceID; + break; + case 5: + return AuthMethodTypes.MoreOptions; + break; + + } + } +} \ No newline at end of file diff --git a/lib/models/auth/activation_Code_req_model.dart b/lib/core/model/auth/activation_Code_req_model.dart similarity index 100% rename from lib/models/auth/activation_Code_req_model.dart rename to lib/core/model/auth/activation_Code_req_model.dart diff --git a/lib/models/auth/send_activation_code_model2.dart b/lib/core/model/auth/activation_code_for_verification_screen_model.dart similarity index 91% rename from lib/models/auth/send_activation_code_model2.dart rename to lib/core/model/auth/activation_code_for_verification_screen_model.dart index 68a90c85..28cc58db 100644 --- a/lib/models/auth/send_activation_code_model2.dart +++ b/lib/core/model/auth/activation_code_for_verification_screen_model.dart @@ -1,4 +1,4 @@ -class ActivationCodeModel2 { +class ActivationCodeForVerificationScreenModel { int oTPSendType; String mobileNumber; String zipCode; @@ -12,7 +12,7 @@ class ActivationCodeModel2 { String vidaAuthTokenID; String vidaRefreshTokenID; String iMEI; - ActivationCodeModel2( + ActivationCodeForVerificationScreenModel( {this.oTPSendType, this.mobileNumber, this.zipCode, @@ -27,7 +27,7 @@ class ActivationCodeModel2 { this.vidaRefreshTokenID, this.iMEI}); - ActivationCodeModel2.fromJson(Map json) { + ActivationCodeForVerificationScreenModel.fromJson(Map json) { oTPSendType = json['OTP_SendType']; mobileNumber = json['MobileNumber']; zipCode = json['ZipCode']; diff --git a/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart b/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart new file mode 100644 index 00000000..c5ff29e6 --- /dev/null +++ b/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart @@ -0,0 +1,192 @@ +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; + +class CheckActivationCodeForDoctorAppResponseModel { + String authenticationTokenID; + List listDoctorsClinic; + List listDoctorProfile; + MemberInformation memberInformation; + + CheckActivationCodeForDoctorAppResponseModel( + {this.authenticationTokenID, + this.listDoctorsClinic, + this.memberInformation}); + + CheckActivationCodeForDoctorAppResponseModel.fromJson( + Map json) { + authenticationTokenID = json['AuthenticationTokenID']; + if (json['List_DoctorsClinic'] != null) { + listDoctorsClinic = new List(); + json['List_DoctorsClinic'].forEach((v) { + listDoctorsClinic.add(new ListDoctorsClinic.fromJson(v)); + }); + } + + if (json['List_DoctorProfile'] != null) { + listDoctorProfile = new List(); + json['List_DoctorProfile'].forEach((v) { + listDoctorProfile.add(new DoctorProfileModel.fromJson(v)); + }); + } + + memberInformation = json['memberInformation'] != null + ? new MemberInformation.fromJson(json['memberInformation']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['AuthenticationTokenID'] = this.authenticationTokenID; + if (this.listDoctorsClinic != null) { + data['List_DoctorsClinic'] = + this.listDoctorsClinic.map((v) => v.toJson()).toList(); + } + + if (this.listDoctorProfile != null) { + data['List_DoctorProfile'] = + this.listDoctorProfile.map((v) => v.toJson()).toList(); + } + if (this.memberInformation != null) { + data['memberInformation'] = this.memberInformation.toJson(); + } + return data; + } +} + +class ListDoctorsClinic { + Null setupID; + int projectID; + int doctorID; + int clinicID; + bool isActive; + String clinicName; + + ListDoctorsClinic({this.setupID, + this.projectID, + this.doctorID, + this.clinicID, + this.isActive, + this.clinicName}); + + ListDoctorsClinic.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + isActive = json['IsActive']; + clinicName = json['ClinicName']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['IsActive'] = this.isActive; + data['ClinicName'] = this.clinicName; + return data; + } +} + +class MemberInformation { + List clinics; + int doctorId; + String email; + int employeeId; + int memberId; + Null memberName; + Null memberNameArabic; + String preferredLanguage; + List roles; + + MemberInformation({this.clinics, + this.doctorId, + this.email, + this.employeeId, + this.memberId, + this.memberName, + this.memberNameArabic, + this.preferredLanguage, + this.roles}); + + MemberInformation.fromJson(Map json) { + if (json['clinics'] != null) { + clinics = new List(); + json['clinics'].forEach((v) { + clinics.add(new Clinics.fromJson(v)); + }); + } + doctorId = json['doctorId']; + email = json['email']; + employeeId = json['employeeId']; + memberId = json['memberId']; + memberName = json['memberName']; + memberNameArabic = json['memberNameArabic']; + preferredLanguage = json['preferredLanguage']; + if (json['roles'] != null) { + roles = new List(); + json['roles'].forEach((v) { + roles.add(new Roles.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.clinics != null) { + data['clinics'] = this.clinics.map((v) => v.toJson()).toList(); + } + data['doctorId'] = this.doctorId; + data['email'] = this.email; + data['employeeId'] = this.employeeId; + data['memberId'] = this.memberId; + data['memberName'] = this.memberName; + data['memberNameArabic'] = this.memberNameArabic; + data['preferredLanguage'] = this.preferredLanguage; + if (this.roles != null) { + data['roles'] = this.roles.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Clinics { + bool defaultClinic; + int id; + String name; + + Clinics({this.defaultClinic, this.id, this.name}); + + Clinics.fromJson(Map json) { + defaultClinic = json['defaultClinic']; + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = new Map(); + data['defaultClinic'] = this.defaultClinic; + data['id'] = this.id; + data['name'] = this.name; + return data; + } +} + +class Roles { + String name; + int roleId; + + Roles({this.name, this.roleId}); + + Roles.fromJson(Map json) { + name = json['name']; + roleId = json['roleId']; + } + + Map toJson() { + final Map data = new Map(); + data['name'] = this.name; + data['roleId'] = this.roleId; + return data; + } +} diff --git a/lib/models/auth/check_activation_code_request_model.dart b/lib/core/model/auth/check_activation_code_request_model.dart similarity index 100% rename from lib/models/auth/check_activation_code_request_model.dart rename to lib/core/model/auth/check_activation_code_request_model.dart diff --git a/lib/core/model/auth/new_login_information_response_model.dart b/lib/core/model/auth/new_login_information_response_model.dart new file mode 100644 index 00000000..117060e4 --- /dev/null +++ b/lib/core/model/auth/new_login_information_response_model.dart @@ -0,0 +1,113 @@ +class NewLoginInformationModel { + int doctorID; + List listMemberInformation; + String logInTokenID; + String mobileNumber; + Null sELECTDeviceIMEIbyIMEIList; + int userID; + String zipCode; + bool isActiveCode; + bool isSMSSent; + + NewLoginInformationModel( + {this.doctorID, + this.listMemberInformation, + this.logInTokenID, + this.mobileNumber, + this.sELECTDeviceIMEIbyIMEIList, + this.userID, + this.zipCode, + this.isActiveCode, + this.isSMSSent}); + + NewLoginInformationModel.fromJson(Map json) { + doctorID = json['DoctorID']; + if (json['List_MemberInformation'] != null) { + listMemberInformation = new List(); + json['List_MemberInformation'].forEach((v) { + listMemberInformation.add(new ListMemberInformation.fromJson(v)); + }); + } + logInTokenID = json['LogInTokenID']; + mobileNumber = json['MobileNumber']; + sELECTDeviceIMEIbyIMEIList = json['SELECTDeviceIMEIbyIMEI_List']; + userID = json['UserID']; + zipCode = json['ZipCode']; + isActiveCode = json['isActiveCode']; + isSMSSent = json['isSMSSent']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + if (this.listMemberInformation != null) { + data['List_MemberInformation'] = + this.listMemberInformation.map((v) => v.toJson()).toList(); + } + data['LogInTokenID'] = this.logInTokenID; + data['MobileNumber'] = this.mobileNumber; + data['SELECTDeviceIMEIbyIMEI_List'] = this.sELECTDeviceIMEIbyIMEIList; + data['UserID'] = this.userID; + data['ZipCode'] = this.zipCode; + data['isActiveCode'] = this.isActiveCode; + data['isSMSSent'] = this.isSMSSent; + return data; + } +} + +class ListMemberInformation { + Null setupID; + int memberID; + String memberName; + Null memberNameN; + String preferredLang; + String pIN; + String saltHash; + int referenceID; + int employeeID; + int roleID; + int projectid; + + ListMemberInformation( + {this.setupID, + this.memberID, + this.memberName, + this.memberNameN, + this.preferredLang, + this.pIN, + this.saltHash, + this.referenceID, + this.employeeID, + this.roleID, + this.projectid}); + + ListMemberInformation.fromJson(Map json) { + setupID = json['SetupID']; + memberID = json['MemberID']; + memberName = json['MemberName']; + memberNameN = json['MemberNameN']; + preferredLang = json['PreferredLang']; + pIN = json['PIN']; + saltHash = json['SaltHash']; + referenceID = json['ReferenceID']; + employeeID = json['EmployeeID']; + roleID = json['RoleID']; + projectid = json['projectid']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['MemberID'] = this.memberID; + data['MemberName'] = this.memberName; + data['MemberNameN'] = this.memberNameN; + data['PreferredLang'] = this.preferredLang; + data['PIN'] = this.pIN; + data['SaltHash'] = this.saltHash; + data['ReferenceID'] = this.referenceID; + data['EmployeeID'] = this.employeeID; + data['RoleID'] = this.roleID; + data['projectid'] = this.projectid; + return data; + } +} diff --git a/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart b/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart new file mode 100644 index 00000000..ceaf4c65 --- /dev/null +++ b/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart @@ -0,0 +1,29 @@ +class SendActivationCodeForDoctorAppResponseModel { + String logInTokenID; + String verificationCode; + String vidaAuthTokenID; + String vidaRefreshTokenID; + + SendActivationCodeForDoctorAppResponseModel( + {this.logInTokenID, + this.verificationCode, + this.vidaAuthTokenID, + this.vidaRefreshTokenID}); + + SendActivationCodeForDoctorAppResponseModel.fromJson( + Map json) { + logInTokenID = json['LogInTokenID']; + verificationCode = json['VerificationCode']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['LogInTokenID'] = this.logInTokenID; + data['VerificationCode'] = this.verificationCode; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + return data; + } +} diff --git a/lib/core/model/hospitals/get_hospitals_request_model.dart b/lib/core/model/hospitals/get_hospitals_request_model.dart new file mode 100644 index 00000000..8a5f1bc1 --- /dev/null +++ b/lib/core/model/hospitals/get_hospitals_request_model.dart @@ -0,0 +1,48 @@ +class GetHospitalsRequestModel { + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + String memberID; + + GetHospitalsRequestModel( + {this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.tokenID, + this.sessionID, + this.isLoginForDoctorApp, + this.memberID}); + + GetHospitalsRequestModel.fromJson(Map json) { + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + memberID = json['MemberID']; + } + + Map toJson() { + final Map data = new Map(); + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['MemberID'] = this.memberID; + return data; + } +} diff --git a/lib/core/model/hospitals/get_hospitals_response_model.dart b/lib/core/model/hospitals/get_hospitals_response_model.dart new file mode 100644 index 00000000..edbc3fe5 --- /dev/null +++ b/lib/core/model/hospitals/get_hospitals_response_model.dart @@ -0,0 +1,22 @@ +class GetHospitalsResponseModel { + String facilityGroupId; + int facilityId; + String facilityName; + + GetHospitalsResponseModel( + {this.facilityGroupId, this.facilityId, this.facilityName}); + + GetHospitalsResponseModel.fromJson(Map json) { + facilityGroupId = json['facilityGroupId']; + facilityId = json['facilityId']; + facilityName = json['facilityName']; + } + + Map toJson() { + final Map data = new Map(); + data['facilityGroupId'] = this.facilityGroupId; + data['facilityId'] = this.facilityId; + data['facilityName'] = this.facilityName; + return data; + } +} diff --git a/lib/core/model/live_care/AlternativeServicesList.dart b/lib/core/model/live_care/AlternativeServicesList.dart new file mode 100644 index 00000000..11f27b95 --- /dev/null +++ b/lib/core/model/live_care/AlternativeServicesList.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +class AlternativeService { + int serviceID; + String serviceName; + bool isSelected; + + AlternativeService( + {this.serviceID, this.serviceName, this.isSelected = false}); + + AlternativeService.fromJson(Map json) { + serviceID = json['ServicID']; + serviceName = json['ServiceName']; + isSelected = false; + } + + Map toJson() { + final Map data = new Map(); + data['ServicID'] = this.serviceID; + data['ServiceName'] = this.serviceName; + return data; + } +} + +class AlternativeServicesList with ChangeNotifier { + List _alternativeServicesList; + + getServicesList(){ + return _alternativeServicesList; + } + + setServicesList(List alternativeServicesList) { + this._alternativeServicesList = alternativeServicesList; + notifyListeners(); + } + + setSelected(AlternativeService service, bool isSelected) { + List alternativeService = _alternativeServicesList.where((element) => service.serviceID == element.serviceID).toList(); + + alternativeService[0].isSelected = isSelected; + notifyListeners(); + } +} diff --git a/lib/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart b/lib/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart new file mode 100644 index 00000000..dc1f25b3 --- /dev/null +++ b/lib/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart @@ -0,0 +1,22 @@ +class PendingPatientERForDoctorAppRequestModel { + bool outSA; + int doctorID; + String sErServiceID; + + PendingPatientERForDoctorAppRequestModel( + {this.outSA, this.doctorID, this.sErServiceID}); + + PendingPatientERForDoctorAppRequestModel.fromJson(Map json) { + outSA = json['OutSA']; + doctorID = json['DoctorID']; + sErServiceID = json['SErServiceID']; + } + + Map toJson() { + final Map data = new Map(); + data['OutSA'] = this.outSA; + data['DoctorID'] = this.doctorID; + data['SErServiceID'] = this.sErServiceID; + return data; + } +} diff --git a/lib/core/model/live_care/live_care_login_reguest_model.dart b/lib/core/model/live_care/live_care_login_reguest_model.dart new file mode 100644 index 00000000..e14d4223 --- /dev/null +++ b/lib/core/model/live_care/live_care_login_reguest_model.dart @@ -0,0 +1,27 @@ +class LiveCareUserLoginRequestModel { + String tokenID; + String generalid; + int doctorId; + int isOutKsa; + int isLogin; + + LiveCareUserLoginRequestModel({this.tokenID, this.generalid, this.doctorId, this.isOutKsa, this.isLogin}); + + LiveCareUserLoginRequestModel.fromJson(Map json) { + tokenID = json['TokenID']; + generalid = json['generalid']; + doctorId = json['DoctorId']; + isOutKsa = json['IsOutKsa']; + isLogin = json['IsLogin']; + } + + Map toJson() { + final Map data = new Map(); + data['TokenID'] = this.tokenID; + data['generalid'] = this.generalid; + data['DoctorId'] = this.doctorId; + data['IsOutKsa'] = this.isOutKsa; + data['IsLogin'] = this.isLogin; + return data; + } +} diff --git a/lib/core/model/patient_muse/PatientSearchRequestModel.dart b/lib/core/model/patient_muse/PatientSearchRequestModel.dart index 437c5885..e8d32cf0 100644 --- a/lib/core/model/patient_muse/PatientSearchRequestModel.dart +++ b/lib/core/model/patient_muse/PatientSearchRequestModel.dart @@ -9,22 +9,28 @@ class PatientSearchRequestModel { String from; String to; int searchType; + int projectID; String mobileNo; String identificationNo; + int nursingStationID; + int clinicID = 0; PatientSearchRequestModel( - {this.doctorID =0, - this.firstName ="0", - this.middleName ="0", - this.lastName ="0", - this.patientMobileNumber ="0", - this.patientIdentificationID ="0", - this.patientID =0, - this.searchType =1, - this.mobileNo="", - this.identificationNo="0", - this.from ="0", - this.to ="0"}); + {this.doctorID, + this.firstName = "0", + this.middleName = "0", + this.lastName = "0", + this.patientMobileNumber = "0", + this.patientIdentificationID = "0", + this.patientID = 0, + this.searchType = 1, + this.mobileNo = "", + this.identificationNo = "0", + this.from = "0", + this.to = "0", + this.clinicID, + this.nursingStationID = 0, + this.projectID}); PatientSearchRequestModel.fromJson(Map json) { doctorID = json['DoctorID']; @@ -39,6 +45,9 @@ class PatientSearchRequestModel { searchType = json['SearchType']; mobileNo = json['MobileNo']; identificationNo = json['IdentificationNo']; + nursingStationID = json['NursingStationID']; + clinicID = json['ClinicID']; + projectID = json['ProjectID']; } Map toJson() { @@ -55,6 +64,9 @@ class PatientSearchRequestModel { data['SearchType'] = this.searchType; data['MobileNo'] = this.mobileNo; data['IdentificationNo'] = this.identificationNo; + //data['NursingStationID'] = this.nursingStationID; + data['ClinicID'] = this.clinicID; + data['ProjectID'] = this.projectID; return data; } } diff --git a/lib/core/model/procedure/Procedure_template_request_model.dart b/lib/core/model/procedure/Procedure_template_request_model.dart new file mode 100644 index 00000000..698178e3 --- /dev/null +++ b/lib/core/model/procedure/Procedure_template_request_model.dart @@ -0,0 +1,120 @@ +class ProcedureTempleteRequestModel { + int doctorID; + String firstName; + String middleName; + String lastName; + String patientMobileNumber; + String patientIdentificationID; + int patientID; + String from; + String to; + int searchType; + String mobileNo; + String identificationNo; + int editedBy; + int projectID; + int clinicID; + String tokenID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + String vidaAuthTokenID; + String vidaRefreshTokenID; + int deviceTypeID; + + ProcedureTempleteRequestModel( + {this.doctorID, + this.firstName, + this.middleName, + this.lastName, + this.patientMobileNumber, + this.patientIdentificationID, + this.patientID, + this.from, + this.to, + this.searchType, + this.mobileNo, + this.identificationNo, + this.editedBy, + this.projectID, + this.clinicID, + this.tokenID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.deviceTypeID}); + + ProcedureTempleteRequestModel.fromJson(Map json) { + doctorID = json['DoctorID']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + patientMobileNumber = json['PatientMobileNumber']; + patientIdentificationID = json['PatientIdentificationID']; + patientID = json['PatientID']; + from = json['From']; + to = json['To']; + searchType = json['SearchType']; + mobileNo = json['MobileNo']; + identificationNo = json['IdentificationNo']; + editedBy = json['EditedBy']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientID'] = this.patientID; + data['From'] = this.from; + data['To'] = this.to; + data['SearchType'] = this.searchType; + data['MobileNo'] = this.mobileNo; + data['IdentificationNo'] = this.identificationNo; + data['EditedBy'] = this.editedBy; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/procedure/get_ordered_procedure_model.dart b/lib/core/model/procedure/get_ordered_procedure_model.dart index b7185711..c3c7718f 100644 --- a/lib/core/model/procedure/get_ordered_procedure_model.dart +++ b/lib/core/model/procedure/get_ordered_procedure_model.dart @@ -53,6 +53,7 @@ class EntityList { String remarks; String status; String template; + int doctorID; EntityList( {this.achiCode, @@ -78,10 +79,12 @@ class EntityList { this.procedureName, this.remarks, this.status, - this.template}); + this.template, + this.doctorID}); EntityList.fromJson(Map json) { achiCode = json['achiCode']; + doctorID = json['doctorID']; appointmentDate = json['appointmentDate']; appointmentNo = json['appointmentNo']; categoryID = json['categoryID']; @@ -110,6 +113,7 @@ class EntityList { Map toJson() { final Map data = new Map(); data['achiCode'] = this.achiCode; + data['doctorID'] = this.doctorID; data['appointmentDate'] = this.appointmentDate; data['appointmentNo'] = this.appointmentNo; data['categoryID'] = this.categoryID; diff --git a/lib/core/model/procedure/procedure_templateModel.dart b/lib/core/model/procedure/procedure_templateModel.dart new file mode 100644 index 00000000..3b12d646 --- /dev/null +++ b/lib/core/model/procedure/procedure_templateModel.dart @@ -0,0 +1,56 @@ +class ProcedureTempleteModel { + String setupID; + int projectID; + int clinicID; + int doctorID; + int templateID; + String templateName; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + + ProcedureTempleteModel( + {this.setupID, + this.projectID, + this.clinicID, + this.doctorID, + this.templateID, + this.templateName, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + ProcedureTempleteModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + templateID = json['TemplateID']; + templateName = json['TemplateName']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['TemplateID'] = this.templateID; + data['TemplateName'] = this.templateName; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/core/model/procedure/procedure_template_details_model.dart b/lib/core/model/procedure/procedure_template_details_model.dart new file mode 100644 index 00000000..1fc797ae --- /dev/null +++ b/lib/core/model/procedure/procedure_template_details_model.dart @@ -0,0 +1,116 @@ +class ProcedureTempleteDetailsModel { + String setupID; + int projectID; + int clinicID; + int doctorID; + int templateID; + String templateName; + String procedureID; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + String procedureName; + String procedureNameN; + String alias; + String aliasN; + String categoryID; + String subGroupID; + String categoryDescription; + String categoryDescriptionN; + String categoryAlias; + dynamic riskCategoryID; + String type = "1"; + String remarks; + int selectedType = 0; + + ProcedureTempleteDetailsModel( + {this.setupID, + this.projectID, + this.clinicID, + this.doctorID, + this.templateID, + this.procedureID, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.procedureName, + this.procedureNameN, + this.alias, + this.aliasN, + this.categoryID, + this.subGroupID, + this.riskCategoryID, + this.templateName, + this.categoryDescription, + this.categoryDescriptionN, + this.categoryAlias, + this.remarks, + this.type = "1", + this.selectedType = 0}); + + ProcedureTempleteDetailsModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + templateID = json['TemplateID']; + procedureID = json['ProcedureID']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + procedureName = json['ProcedureName']; + procedureNameN = json['ProcedureNameN']; + alias = json['Alias']; + aliasN = json['AliasN']; + categoryID = json['CategoryID']; + subGroupID = json['SubGroupID']; + riskCategoryID = json['RiskCategoryID']; + templateName = json['TemplateName']; + categoryDescription = json['CategoryDescription']; + categoryDescriptionN = json['CategoryDescriptionN']; + categoryAlias = json['CategoryAlias']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['TemplateID'] = this.templateID; + data['ProcedureID'] = this.procedureID; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['ProcedureName'] = this.procedureName; + data['ProcedureNameN'] = this.procedureNameN; + data['Alias'] = this.alias; + data['AliasN'] = this.aliasN; + data['CategoryID'] = this.categoryID; + data['SubGroupID'] = this.subGroupID; + data['RiskCategoryID'] = this.riskCategoryID; + data['TemplateName'] = this.templateName; + data['CategoryDescription'] = this.categoryDescription; + data['CategoryDescriptionN'] = this.categoryDescriptionN; + data['CategoryAlias'] = this.categoryAlias; + return data; + } +} +class ProcedureTempleteDetailsModelList { + List procedureTemplate = List(); + String templateName; + int templateId; + + ProcedureTempleteDetailsModelList( + {this.templateName, this.templateId, ProcedureTempleteDetailsModel template}) { + procedureTemplate.add(template); + } +} diff --git a/lib/core/model/procedure/procedure_template_details_request_model.dart b/lib/core/model/procedure/procedure_template_details_request_model.dart new file mode 100644 index 00000000..6df6fc73 --- /dev/null +++ b/lib/core/model/procedure/procedure_template_details_request_model.dart @@ -0,0 +1,124 @@ +class ProcedureTempleteDetailsRequestModel { + int doctorID; + String firstName; + int templateID; + String middleName; + String lastName; + String patientMobileNumber; + String patientIdentificationID; + int patientID; + String from; + String to; + int searchType; + String mobileNo; + String identificationNo; + int editedBy; + int projectID; + int clinicID; + String tokenID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + String vidaAuthTokenID; + String vidaRefreshTokenID; + int deviceTypeID; + + ProcedureTempleteDetailsRequestModel( + {this.doctorID, + this.firstName, + this.templateID, + this.middleName, + this.lastName, + this.patientMobileNumber, + this.patientIdentificationID, + this.patientID, + this.from, + this.to, + this.searchType, + this.mobileNo, + this.identificationNo, + this.editedBy, + this.projectID, + this.clinicID, + this.tokenID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.vidaAuthTokenID, + this.vidaRefreshTokenID, + this.deviceTypeID}); + + ProcedureTempleteDetailsRequestModel.fromJson(Map json) { + doctorID = json['DoctorID']; + firstName = json['FirstName']; + templateID = json['TemplateID']; + middleName = json['MiddleName']; + lastName = json['LastName']; + patientMobileNumber = json['PatientMobileNumber']; + patientIdentificationID = json['PatientIdentificationID']; + patientID = json['PatientID']; + from = json['From']; + to = json['To']; + searchType = json['SearchType']; + mobileNo = json['MobileNo']; + identificationNo = json['IdentificationNo']; + editedBy = json['EditedBy']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['FirstName'] = this.firstName; + data['TemplateID'] = this.templateID; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientID'] = this.patientID; + data['From'] = this.from; + data['To'] = this.to; + data['SearchType'] = this.searchType; + data['MobileNo'] = this.mobileNo; + data['IdentificationNo'] = this.identificationNo; + data['EditedBy'] = this.editedBy; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/referral/MyReferralPatientModel.dart b/lib/core/model/referral/MyReferralPatientModel.dart index 797109dd..4f00f455 100644 --- a/lib/core/model/referral/MyReferralPatientModel.dart +++ b/lib/core/model/referral/MyReferralPatientModel.dart @@ -61,71 +61,83 @@ class MyReferralPatientModel { String priorityDescription; String referringClinicDescription; String referringDoctorName; + int referalStatus; + String sourceSetupID; + int sourceProjectId; + String targetSetupID; + int targetProjectId; + int targetClinicID; + int targetDoctorID; + int sourceAppointmentNo; + int targetAppointmentNo; + String remarksFromSource; MyReferralPatientModel( {this.rowID, - this.projectID, - this.lineItemNo, - this.doctorID, - this.patientID, - this.doctorName, - this.doctorNameN, - this.firstName, - this.middleName, - this.lastName, - this.firstNameN, - this.middleNameN, - this.lastNameN, - this.gender, - this.dateofBirth, - this.mobileNumber, - this.emailAddress, - this.patientIdentificationNo, - this.patientType, - this.admissionNo, - this.admissionDate, - this.roomID, - this.bedID, - this.nursingStationID, - this.description, - this.nationalityName, - this.nationalityNameN, - this.clinicDescription, - this.clinicDescriptionN, - this.referralDoctor, - this.referringDoctor, - this.referralClinic, - this.referringClinic, - this.referralStatus, - this.referralDate, - this.referringDoctorRemarks, - this.referredDoctorRemarks, - this.referralResponseOn, - this.priority, - this.frequency, - this.mAXResponseTime, - this.episodeID, - this.appointmentNo, - this.appointmentDate, - this.appointmentType, - this.patientMRN, - this.createdOn, - this.clinicID, - this.nationalityID, - this.age, - this.doctorImageURL, - this.frequencyDescription, - this.genderDescription, - this.isDoctorLate, - this.isDoctorResponse, - this.nationalityFlagURL, - this.nursingStationName, - this.priorityDescription, - this.referringClinicDescription, - this.referringDoctorName}); + this.projectID, + this.lineItemNo, + this.doctorID, + this.patientID, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.roomID, + this.bedID, + this.nursingStationID, + this.description, + this.nationalityName, + this.nationalityNameN, + this.clinicDescription, + this.clinicDescriptionN, + this.referralDoctor, + this.referringDoctor, + this.referralClinic, + this.referringClinic, + this.referralStatus, + this.referralDate, + this.referringDoctorRemarks, + this.referredDoctorRemarks, + this.referralResponseOn, + this.priority, + this.frequency, + this.mAXResponseTime, + this.episodeID, + this.appointmentNo, + this.appointmentDate, + this.appointmentType, + this.patientMRN, + this.createdOn, + this.clinicID, + this.nationalityID, + this.age, + this.doctorImageURL, + this.frequencyDescription, + this.genderDescription, + this.isDoctorLate, + this.isDoctorResponse, + this.nationalityFlagURL, + this.nursingStationName, + this.priorityDescription, + this.referringClinicDescription, + this.referringDoctorName, + this.referalStatus, this.sourceSetupID, this.sourceAppointmentNo, this.sourceProjectId, this.targetProjectId, this.targetAppointmentNo, this.targetClinicID, this.targetSetupID, this.targetDoctorID, this.remarksFromSource}); MyReferralPatientModel.fromJson(Map json) { rowID = json['RowID']; + referalStatus = json['ReferalStatus']; projectID = json['ProjectID']; lineItemNo = json['LineItemNo']; doctorID = json['DoctorID']; @@ -158,8 +170,21 @@ class MyReferralPatientModel { referringDoctor = json['ReferringDoctor']; referralClinic = json['ReferralClinic']; referringClinic = json['ReferringClinic']; - referralStatus = json['ReferralStatus']; - referralDate = AppDateUtils.convertStringToDate(json['ReferralDate']); + referralStatus = json["ReferralStatus"] is String + ? json['ReferralStatus'] == "Accepted" + ? 46 + : json['ReferralStatus'] == "Pending" + ? 1 + : 0 + : json["ReferralStatus"]; + try { + referralDate = AppDateUtils.getDateTimeFromString(json['ReferralDate']); + } catch (e) { + referralDate = AppDateUtils.convertStringToDate(json['ReferralDate']); + } finally { + referralDate = DateTime.now(); + } + referringDoctorRemarks = json['ReferringDoctorRemarks']; referredDoctorRemarks = json['ReferredDoctorRemarks']; referralResponseOn = json['ReferralResponseOn']; @@ -185,11 +210,22 @@ class MyReferralPatientModel { priorityDescription = json['PriorityDescription']; referringClinicDescription = json['ReferringClinicDescription']; referringDoctorName = json['ReferringDoctorName']; + sourceSetupID = json['SourceSetupID']; + sourceProjectId = json['SourceProjectId']; + targetSetupID = json['TargetSetupID']; + targetProjectId = json['TargetProjectId']; + targetClinicID = json['TargetClinicID']; + targetDoctorID = json['TargetDoctorID']; + sourceAppointmentNo = json['SourceAppointmentNo']; + targetAppointmentNo = json['TargetAppointmentNo']; + remarksFromSource = json['RemarksFromSource']; + } Map toJson() { final Map data = new Map(); data['RowID'] = this.rowID; + data['ReferalStatus'] = this.referalStatus; data['ProjectID'] = this.projectID; data['LineItemNo'] = this.lineItemNo; data['DoctorID'] = this.doctorID; @@ -249,10 +285,19 @@ class MyReferralPatientModel { data['PriorityDescription'] = this.priorityDescription; data['ReferringClinicDescription'] = this.referringClinicDescription; data['ReferringDoctorName'] = this.referringDoctorName; + data['SourceSetupID'] = this.sourceSetupID; + data['SourceProjectId'] = this.sourceProjectId; + data['TargetSetupID'] = this.targetSetupID; + data['TargetProjectId'] = this.targetProjectId; + data['TargetClinicID'] = this.targetClinicID; + data['TargetDoctorID'] = this.targetDoctorID; + data['SourceAppointmentNo'] = this.sourceAppointmentNo; + data['TargetAppointmentNo'] = this.targetAppointmentNo; + data['RemarksFromSource'] = this.remarksFromSource; return data; } get patientName { - return this.firstName+" "+this.lastName; + return this.firstName + " " + this.lastName; } } diff --git a/lib/core/model/referral/MyReferralPatientRequestModel.dart b/lib/core/model/referral/MyReferralPatientRequestModel.dart new file mode 100644 index 00000000..08b98a99 --- /dev/null +++ b/lib/core/model/referral/MyReferralPatientRequestModel.dart @@ -0,0 +1,104 @@ +class MyReferralPatientRequestModel { + int channel; + int clinicID; + int doctorID; + int editedBy; + String firstName; + String from; + String iPAdress; + bool isLoginForDoctorApp; + int languageID; + String lastName; + String middleName; + int patientID; + String patientIdentificationID; + String patientMobileNumber; + bool patientOutSA; + int patientTypeID; + int projectID; + String sessionID; + String stamp; + String to; + String tokenID; + double versionID; + String vidaAuthTokenID; + + MyReferralPatientRequestModel( + {this.channel, + this.clinicID, + this.doctorID, + this.editedBy, + this.firstName, + this.from, + this.iPAdress, + this.isLoginForDoctorApp, + this.languageID, + this.lastName, + this.middleName, + this.patientID, + this.patientIdentificationID, + this.patientMobileNumber, + this.patientOutSA, + this.patientTypeID, + this.projectID, + this.sessionID, + this.stamp, + this.to, + this.tokenID, + this.versionID, + this.vidaAuthTokenID}); + + MyReferralPatientRequestModel.fromJson(Map json) { + channel = json['Channel']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + editedBy = json['EditedBy']; + firstName = json['FirstName']; + from = json['From']; + iPAdress = json['IPAdress']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + languageID = json['LanguageID']; + lastName = json['LastName']; + middleName = json['MiddleName']; + patientID = json['PatientID']; + patientIdentificationID = json['PatientIdentificationID']; + patientMobileNumber = json['PatientMobileNumber']; + patientOutSA = json['PatientOutSA']; + patientTypeID = json['PatientTypeID']; + projectID = json['ProjectID']; + sessionID = json['SessionID']; + stamp = json['stamp']; + to = json['To']; + tokenID = json['TokenID']; + versionID = json['VersionID']; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['Channel'] = this.channel; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + data['FirstName'] = this.firstName; + data['From'] = this.from; + data['IPAdress'] = this.iPAdress; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['LanguageID'] = this.languageID; + data['LastName'] = this.lastName; + data['MiddleName'] = this.middleName; + data['PatientID'] = this.patientID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientOutSA'] = this.patientOutSA; + data['PatientTypeID'] = this.patientTypeID; + data['ProjectID'] = this.projectID; + data['SessionID'] = this.sessionID; + data['stamp'] = this.stamp; + data['To'] = this.to; + data['TokenID'] = this.tokenID; + data['VersionID'] = this.versionID; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/model/referral/add_referred_remarks_request.dart b/lib/core/model/referral/add_referred_remarks_request.dart new file mode 100644 index 00000000..14089513 --- /dev/null +++ b/lib/core/model/referral/add_referred_remarks_request.dart @@ -0,0 +1,72 @@ +class AddReferredRemarksRequestModel { + int projectID; + int admissionNo; + int lineItemNo; + String referredDoctorRemarks; + int editedBy; + int referalStatus; + bool isLoginForDoctorApp; + String iPAdress; + bool patientOutSA; + String tokenID; + int languageID; + double versionID; + int channel; + String sessionID; + int deviceTypeID; + + AddReferredRemarksRequestModel( + {this.projectID, + this.admissionNo, + this.lineItemNo, + this.referredDoctorRemarks, + this.editedBy, + this.referalStatus, + this.isLoginForDoctorApp, + this.iPAdress, + this.patientOutSA, + this.tokenID, + this.languageID, + this.versionID, + this.channel, + this.sessionID, + this.deviceTypeID}); + + AddReferredRemarksRequestModel.fromJson(Map json) { + projectID = json['ProjectID']; + admissionNo = json['AdmissionNo']; + lineItemNo = json['LineItemNo']; + referredDoctorRemarks = json['ReferredDoctorRemarks']; + editedBy = json['EditedBy']; + referalStatus = json['ReferalStatus']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + iPAdress = json['IPAdress']; + patientOutSA = json['PatientOutSA']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['AdmissionNo'] = this.admissionNo; + data['LineItemNo'] = this.lineItemNo; + data['ReferredDoctorRemarks'] = this.referredDoctorRemarks; + data['EditedBy'] = this.editedBy; + data['ReferalStatus'] = this.referalStatus; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['IPAdress'] = this.iPAdress; + data['PatientOutSA'] = this.patientOutSA; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/service/NavigationService.dart b/lib/core/service/NavigationService.dart new file mode 100644 index 00000000..26191ffc --- /dev/null +++ b/lib/core/service/NavigationService.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; + +class NavigationService { + final GlobalKey navigatorKey = + new GlobalKey(); + Future navigateTo(String routeName,{Object arguments}) { + return navigatorKey.currentState.pushNamed(routeName,arguments: arguments); + } + + Future pushReplacementNamed(String routeName,{Object arguments}) { + return navigatorKey.currentState.pushReplacementNamed(routeName,arguments: arguments); + } + + + Future pushNamedAndRemoveUntil(String routeName) { + return navigatorKey.currentState.pushNamedAndRemoveUntil(routeName,(asd)=>false); + } +} \ No newline at end of file diff --git a/lib/core/service/VideoCallService.dart b/lib/core/service/VideoCallService.dart new file mode 100644 index 00000000..dcc31b71 --- /dev/null +++ b/lib/core/service/VideoCallService.dart @@ -0,0 +1,108 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/livecare/end_call_req.dart'; +import 'package:doctor_app_flutter/models/livecare/session_status_model.dart'; +import 'package:doctor_app_flutter/models/livecare/start_call_res.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/VideoChannel.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/cupertino.dart'; + +import '../../locator.dart'; +import '../../routes.dart'; +import 'NavigationService.dart'; + +class VideoCallService extends BaseService { + StartCallRes startCallRes; + PatiantInformtion patient; + LiveCarePatientServices _liveCarePatientServices = + locator(); + + openVideo(StartCallRes startModel, PatiantInformtion patientModel, + bool isRecording,VoidCallback onCallConnected, VoidCallback onCallDisconnected) async { + this.startCallRes = startModel; + this.patient = patientModel; + DoctorProfileModel doctorProfile = + await getDoctorProfile(isGetProfile: true); + await VideoChannel.openVideoCallScreen( + kToken: startCallRes.openTokenID, + kSessionId: startCallRes.openSessionID, + kApiKey:'46209962', + // kToken: "T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGIyZDljOTY3YjFiNWU1YzUzNzFmMjIyNjJmNmEzY2Y5NzZjOTdlYzpzZXNzaW9uX2lkPTFfTVg0ME56STBOemsxTkg1LU1UWXlNekEyTlRRMU9EVXhObjVrVFRoMFlVdFJXaXRYTWpadFZGZHFhSGxZVGpOdE1UVi1mZyZjcmVhdGVfdGltZT0xNjIzMDY1NDk1Jm5vbmNlPTAuMjM2Mjk0NTIwMTkyOTA4OTcmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYyNTY1NzQ5NCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==", + // kSessionId: "1_MX40NzI0Nzk1NH5-MTYyMzA2NTQ1ODUxNn5kTTh0YUtRWitXMjZtVFdqaHlYTjNtMTV-fg", + // kApiKey:'47247954', + vcId: patient.vcId, + isRecording: isRecording, + patientName: patient.fullName ?? + (patient.firstName != null + ? "${patient.firstName} ${patient.lastName}" + : "-"), + tokenID: await sharedPref.getString(TOKEN), + generalId: GENERAL_ID, + doctorId: doctorProfile.doctorID, + onFailure: (String error) { + DrAppToastMsg.showErrorToast(error); + }, + onCallConnected: onCallConnected, + onCallDisconnected: onCallDisconnected, + onCallEnd: () { + WidgetsBinding.instance.addPostFrameCallback((_) async { + GifLoaderDialogUtils.showMyDialog( + locator().navigatorKey.currentContext); + endCall( + patient.vcId, + false, + ).then((value) { + GifLoaderDialogUtils.hideDialog( + locator().navigatorKey.currentContext); + if (hasError) { + DrAppToastMsg.showErrorToast(error); + } else + locator() + .navigateTo(PATIENTS_END_Call, arguments: { + "patient": patient, + }); + }); + }); + }, + onCallNotRespond: (SessionStatusModel sessionStatusModel) { + WidgetsBinding.instance.addPostFrameCallback((_) { + GifLoaderDialogUtils.showMyDialog( + locator().navigatorKey.currentContext); + endCall( + patient.vcId, + sessionStatusModel.sessionStatus == 3, + ).then((value) { + GifLoaderDialogUtils.hideDialog( + locator().navigatorKey.currentContext); + if (hasError) { + DrAppToastMsg.showErrorToast(error); + } else { + locator() + .navigateTo(PATIENTS_END_Call, arguments: { + "patient": patient, + }); + } + }); + }); + }); + } + + Future endCall(int vCID, bool isPatient) async { + hasError = false; + await getDoctorProfile(isGetProfile: true); + EndCallReq endCallReq = new EndCallReq(); + endCallReq.doctorId = doctorProfile.doctorID; + endCallReq.generalid = 'Cs2020@2016\$2958'; + endCallReq.vCID = vCID; + endCallReq.isDestroy = isPatient; + await _liveCarePatientServices.endCall(endCallReq); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + } + } +} diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart new file mode 100644 index 00000000..49e89881 --- /dev/null +++ b/lib/core/service/authentication_service.dart @@ -0,0 +1,164 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/activation_code_for_verification_screen_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/check_activation_code_for_doctor_app_response_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; +import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/new_login_information_response_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/send_activation_code_for_doctor_app_response_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; +import 'package:doctor_app_flutter/models/doctor/user_model.dart'; + +class AuthenticationService extends BaseService { + List _imeiDetails = []; + List get dashboardItemsList => _imeiDetails; + NewLoginInformationModel _loginInfo = NewLoginInformationModel(); + NewLoginInformationModel get loginInfo => _loginInfo; + SendActivationCodeForDoctorAppResponseModel _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel(); + + SendActivationCodeForDoctorAppResponseModel get activationCodeVerificationScreenRes => _activationCodeVerificationScreenRes; + + SendActivationCodeForDoctorAppResponseModel _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel(); + + SendActivationCodeForDoctorAppResponseModel get activationCodeForDoctorAppRes => _activationCodeForDoctorAppRes; + CheckActivationCodeForDoctorAppResponseModel _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel(); + + CheckActivationCodeForDoctorAppResponseModel get checkActivationCodeForDoctorAppRes => _checkActivationCodeForDoctorAppRes; + Map _insertDeviceImeiRes = {}; + + List _doctorProfilesList = []; + List get doctorProfilesList => _doctorProfilesList; + + + + + Future selectDeviceImei(imei) async { + try { + await baseAppClient.post(SELECT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + _imeiDetails = []; + response['List_DoctorDeviceDetails'].forEach((v) { + _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {"IMEI": imei, "TokenID": "@dm!n"}); + } catch (error) { + hasError = true; + super.error = error; + } + } + + Future login(UserModel userInfo) async { + hasError = false; + _loginInfo = NewLoginInformationModel(); + try { + await baseAppClient.post(LOGIN_URL, + onSuccess: (dynamic response, int statusCode) { + _loginInfo = NewLoginInformationModel.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userInfo.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + } + + Future sendActivationCodeVerificationScreen(ActivationCodeForVerificationScreenModel activationCodeModel) async { + hasError = false; + _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel(); + try { + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, + onSuccess: (dynamic response, int statusCode) { + _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: activationCodeModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + } + + Future sendActivationCodeForDoctorApp(ActivationCodeModel activationCodeModel)async { + hasError = false; + _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel(); + try { + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: activationCodeModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + } + + Future checkActivationCodeForDoctorApp(CheckActivationCodeRequestModel checkActivationCodeRequestModel)async { + hasError = false; + _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel(); + try { + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: checkActivationCodeRequestModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + } + + + Future insertDeviceImei(InsertIMEIDetailsModel insertIMEIDetailsModel)async { + hasError = false; + // insertIMEIDetailsModel.tokenID = "@dm!n"; + _insertDeviceImeiRes = {}; + try { + await baseAppClient.post(INSERT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + _insertDeviceImeiRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: insertIMEIDetailsModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + } + + Future getDoctorProfileBasedOnClinic(ProfileReqModel profileReqModel)async { + hasError = false; + try { + await baseAppClient.post(GET_DOC_PROFILES, + onSuccess: (dynamic response, int statusCode) { + _doctorProfilesList.clear(); + response['DoctorProfileList'].forEach((v) { + _doctorProfilesList.add(DoctorProfileModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: profileReqModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + } +} diff --git a/lib/core/service/home/auth_service.dart b/lib/core/service/home/auth_service.dart deleted file mode 100644 index b5435a59..00000000 --- a/lib/core/service/home/auth_service.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; -import 'package:doctor_app_flutter/models/doctor/user_model.dart'; - -class AuthService extends BaseService { - List _imeiDetails = []; - List get dashboardItemsList => _imeiDetails; - Map _loginInfo = {}; - Map get loginInfo => _loginInfo; - Future selectDeviceImei(imei) async { - try { - // dynamic localRes; - await baseAppClient.post(SELECT_DEVICE_IMEI, - onSuccess: (dynamic response, int statusCode) { - _imeiDetails = []; - response['List_DoctorDeviceDetails'].forEach((v) { - _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: {"IMEI": imei, "TokenID": "@dm!n"}); - //return Future.value(localRes); - } catch (error) { - hasError = true; - super.error = error; - } - } - - Future login(UserModel userInfo) async { - hasError = false; - _loginInfo = {}; - try { - await baseAppClient.post(LOGIN_URL, - onSuccess: (dynamic response, int statusCode) { - _loginInfo = response; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: userInfo.toJson()); - } catch (error) { - hasError = true; - super.error = error; - } - - // await baseAppClient.post(SELECT_DEVICE_IMEI, - // onSuccess: (dynamic response, int statusCode) { - // _imeiDetails = []; - // response['List_DoctorDeviceDetails'].forEach((v) { - // _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); - // }); - // }, onFailure: (String error, int statusCode) { - // hasError = true; - // super.error = error; - // }, body: {}); - // } catch (error) { - // hasError = true; - // super.error = error; - // } - } -} diff --git a/lib/core/service/home/dasboard_service.dart b/lib/core/service/home/dasboard_service.dart index 5a66e9eb..ad3ec887 100644 --- a/lib/core/service/home/dasboard_service.dart +++ b/lib/core/service/home/dasboard_service.dart @@ -1,12 +1,15 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; class DashboardService extends BaseService { List _dashboardItemsList = []; List get dashboardItemsList => _dashboardItemsList; + - // DashboardModel _dashboard = DashboardModel(); + bool hasVirtualClinic = false; + String sServiceID; Future getDashboard() async { hasError = false; @@ -23,9 +26,27 @@ class DashboardService extends BaseService { super.error = error; }, body: { - // "VidaAuthTokenID": - // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk" }, ); } + + Future checkDoctorHasLiveCare() async { + hasError = false; + await getDoctorProfile(isGetProfile: true); + await baseAppClient.post( + DOCTOR_CHECK_HAS_LIVE_CARE, + onSuccess: (dynamic response, int statusCode) { + hasVirtualClinic = response['HasVirtualClinic']; + sServiceID = response['SserviceID']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "DoctorID": doctorProfile?.doctorID// test user 9920 + }, + ); + } + } diff --git a/lib/core/service/home/scan_qr_service.dart b/lib/core/service/home/scan_qr_service.dart new file mode 100644 index 00000000..b21768f9 --- /dev/null +++ b/lib/core/service/home/scan_qr_service.dart @@ -0,0 +1,41 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class ScanQrService extends BaseService { + List myInPatientList = List(); + List inPatientList = List(); + + Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async { + hasError = false; + await getDoctorProfile(); + + // if (isMyInpatient) { + // requestModel.doctorID = doctorProfile.doctorID; + // } else { + requestModel.doctorID = 0; + //} + + await baseAppClient.post( + GET_PATIENT_IN_PATIENT_LIST, + onSuccess: (dynamic response, int statusCode) { + inPatientList.clear(); + myInPatientList.clear(); + + response['List_MyInPatient'].forEach((v) { + PatiantInformtion patient = PatiantInformtion.fromJson(v); + inPatientList.add(patient); + if (patient.doctorId == doctorProfile.doctorID) { + myInPatientList.add(patient); + } + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: requestModel.toJson(), + ); + } +} diff --git a/lib/core/service/hospitals/hospitals_service.dart b/lib/core/service/hospitals/hospitals_service.dart new file mode 100644 index 00000000..f8a7579d --- /dev/null +++ b/lib/core/service/hospitals/hospitals_service.dart @@ -0,0 +1,27 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class HospitalsService extends BaseService { + +List hospitals =List(); + + Future getHospitals(GetHospitalsRequestModel getHospitalsRequestModel) async { + hasError = false; + await baseAppClient.post( + GET_PROJECTS, + onSuccess: (dynamic response, int statusCode) { + hospitals.clear(); + response['ProjectInfo'].forEach((hospital) { + hospitals.add(GetHospitalsResponseModel.fromJson(hospital)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: getHospitalsRequestModel.toJson(), + ); + } +} diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart new file mode 100644 index 00000000..fff803d8 --- /dev/null +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -0,0 +1,171 @@ + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart'; +import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/live_care/live_care_login_reguest_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/livecare/end_call_req.dart'; +import 'package:doctor_app_flutter/models/livecare/start_call_req.dart'; +import 'package:doctor_app_flutter/models/livecare/start_call_res.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class LiveCarePatientServices extends BaseService { + List _patientList = []; + + List get patientList => _patientList; + + List alternativeServicesList = []; + + bool _isFinished = false; + + bool _isLive = true; + + bool get isFinished => _isFinished; + + setFinished(bool isFinished) { + _isFinished = isFinished; + } + + var endCallResponse = {}; + var transferToAdminResponse = {}; + var isLoginResponse = {}; + + StartCallRes _startCallRes; + + StartCallRes get startCallRes => _startCallRes; + + Future getPendingPatientERForDoctorApp( + PendingPatientERForDoctorAppRequestModel + pendingPatientERForDoctorAppRequestModel) async { + hasError = false; + await baseAppClient.post( + GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + + List localPatientList= []; + + response['List_PendingPatientList'].forEach((v) { + localPatientList.add(PatiantInformtion.fromJson(v)); + }); + + /// add new items. + localPatientList.forEach((element) { + if ((_patientList.singleWhere((it) => it.patientId == element.patientId, + orElse: () => null)) == null) { + _patientList.add(element); + } + }); + + /// remove items. + List removedPatientList= []; + _patientList.forEach((element) { + if ((localPatientList.singleWhere((it) => it.patientId == element.patientId, + orElse: () => null)) == null) { + removedPatientList.add(element); + } + }); + + + removedPatientList.forEach((element) { + _patientList.remove(element); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: pendingPatientERForDoctorAppRequestModel.toJson(), + ); + } + + Future endCall(EndCallReq endCallReq) async { + hasError = false; + await baseAppClient.post(END_CALL, onSuccess: (response, statusCode) async { + endCallResponse = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: endCallReq.toJson(), isLiveCare: _isLive); + } + + Future startCall(StartCallReq startCallReq) async { + hasError = false; + await baseAppClient.post(START_LIVE_CARE_CALL, onSuccess: (response, statusCode) async { + _startCallRes = StartCallRes.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: startCallReq.toJson(), isLiveCare: _isLive); + } + + Future endCallWithCharge(int vcID, List altServiceList) async { + hasError = false; + await baseAppClient.post(END_CALL_WITH_CHARGE, onSuccess: (dynamic response, int statusCode) { + endCallResponse = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "VC_ID": vcID, + "AltServiceList": altServiceList, + "generalid":GENERAL_ID + }, isLiveCare: _isLive); + } + + Future transferToAdmin(int vcID, String notes) async { + hasError = false; + await baseAppClient.post(TRANSFERT_TO_ADMIN, onSuccess: (dynamic response, int statusCode) { + transferToAdminResponse = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "VC_ID": vcID, + "IsOutKsa": false, + "Notes": notes, + }, isLiveCare: _isLive); + } + + Future sendSMSInstruction(int vcID) async { + hasError = false; + await baseAppClient.post(SEND_SMS_INSTRUCTIONS, + onSuccess: (dynamic response, int statusCode) { + transferToAdminResponse = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "VC_ID": vcID, "generalid": GENERAL_ID + }, isLiveCare: _isLive); + } + + Future isLogin({LiveCareUserLoginRequestModel isLoginRequestModel, int loginStatus}) async { + hasError = false; + await getDoctorProfile( ); + isLoginRequestModel.doctorId = super.doctorProfile.doctorID; + await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async { + isLoginResponse = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: isLoginRequestModel.toJson(), isLiveCare: _isLive); + } + + Future getAlternativeServices(int vcID) async { + hasError = false; + alternativeServicesList.clear(); + + await baseAppClient.post(GET_ALTERNATIVE_SERVICE, + onSuccess: (dynamic response, int statusCode) { + response['AlternativeServicesList'].forEach((v) { + alternativeServicesList.add(AlternativeService.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "VC_ID": vcID, + "generalid": GENERAL_ID + }, isLiveCare: _isLive); + } +} diff --git a/lib/core/service/patient/MyReferralPatientService.dart b/lib/core/service/patient/MyReferralPatientService.dart index 536e68a7..35729def 100644 --- a/lib/core/service/patient/MyReferralPatientService.dart +++ b/lib/core/service/patient/MyReferralPatientService.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; +import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/referral/add_referred_remarks_request.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart'; @@ -8,22 +10,21 @@ class MyReferralInPatientService extends BaseService { Future getMyReferralPatientService() async { hasError = false; - Map body = Map(); await getDoctorProfile(); - body['DoctorID'] = doctorProfile.doctorID; - body['FirstName'] = "0"; - body['MiddleName'] = "0"; - body['LastName'] = "0"; - body['PatientMobileNumber'] = "0"; - body['PatientIdentificationID'] = "0"; - body['PatientID'] = 0; - body['From'] = "0"; - body['To'] = "0"; - body['stamp'] = DateTime.now().toIso8601String(); - body['IsLoginForDoctorApp'] = true; - body['IPAdress'] = "11.11.11.11"; - body['PatientOutSA'] = false; - body['PatientTypeID'] = 1; + + MyReferralPatientRequestModel myReferralPatientRequestModel = MyReferralPatientRequestModel( + doctorID: doctorProfile.doctorID, + firstName: "0", + middleName: "0", + lastName: "0", + patientMobileNumber: "0", + patientIdentificationID: "0", + patientID: 0, + from: "0", + to: "0", + stamp: DateTime.now().toIso8601String(), + isLoginForDoctorApp: true, + patientTypeID: 1); myReferralPatients.clear(); await baseAppClient.post( GET_MY_REFERRAL_INPATIENT, @@ -38,22 +39,53 @@ class MyReferralInPatientService extends BaseService { hasError = true; super.error = error; }, - body: body, + body: myReferralPatientRequestModel.toJson(), + ); + } + + Future getMyReferralOutPatientService() async { + hasError = false; + await getDoctorProfile(); + + MyReferralPatientRequestModel myReferralPatientRequestModel = MyReferralPatientRequestModel( + doctorID: doctorProfile.doctorID, + firstName: "0", + middleName: "0", + lastName: "0", + patientMobileNumber: "0", + patientIdentificationID: "0", + patientID: 0, + from: "0", + to: "0", + stamp: DateTime.now().toIso8601String(), + isLoginForDoctorApp: true, + patientTypeID: 1); + myReferralPatients.clear(); + await baseAppClient.post( + GET_MY_REFERRAL_OUT_PATIENT, + onSuccess: (dynamic response, int statusCode) { + if (response['List_MyOutPatientReferral'] != null) { + response['List_MyOutPatientReferral'].forEach((v) { + myReferralPatients.add(MyReferralPatientModel.fromJson(v)); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: myReferralPatientRequestModel.toJson(), ); } - Future replay( - String referredDoctorRemarks, MyReferralPatientModel referral) async { + Future replay(String referredDoctorRemarks, MyReferralPatientModel referral) async { hasError = false; await getDoctorProfile(); - RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = - RequestAddReferredDoctorRemarks(); + RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks(); _requestAddReferredDoctorRemarks.projectID = referral.projectID; - _requestAddReferredDoctorRemarks.admissionNo = - referral.admissionNo.toString(); + _requestAddReferredDoctorRemarks.admissionNo = referral.admissionNo.toString(); _requestAddReferredDoctorRemarks.lineItemNo = referral.lineItemNo; - _requestAddReferredDoctorRemarks.referredDoctorRemarks = - referredDoctorRemarks; + _requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks; _requestAddReferredDoctorRemarks.editedBy = doctorProfile.doctorID; _requestAddReferredDoctorRemarks.patientID = referral.patientID; _requestAddReferredDoctorRemarks.referringDoctor = referral.referringDoctor; @@ -67,4 +99,34 @@ class MyReferralInPatientService extends BaseService { }, ); } + + Future replayReferred(String referredDoctorRemarks, MyReferralPatientModel referral, int referralStatus) async { + hasError = false; + await getDoctorProfile(); + AddReferredRemarksRequestModel _requestAddReferredDoctorRemarks = AddReferredRemarksRequestModel( + editedBy: doctorProfile.doctorID, + projectID: doctorProfile.projectID, + referredDoctorRemarks: referredDoctorRemarks, + referalStatus: referralStatus); + _requestAddReferredDoctorRemarks.projectID = referral.projectID; + + //TODO Check this in case out patient + _requestAddReferredDoctorRemarks.admissionNo = int.parse(referral.admissionNo); + _requestAddReferredDoctorRemarks.lineItemNo = referral.lineItemNo; + _requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks; + _requestAddReferredDoctorRemarks.editedBy = doctorProfile.doctorID; + _requestAddReferredDoctorRemarks.referalStatus = referralStatus; + + // _requestAddReferredDoctorRemarks.patientID = referral.patientID; + // _requestAddReferredDoctorRemarks.referringDoctor = referral.referringDoctor; + await baseAppClient.post( + ADD_REFERRED_REMARKS_NEW, + body: _requestAddReferredDoctorRemarks.toJson(), + onSuccess: (dynamic body, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } } diff --git a/lib/core/service/patient/patient-doctor-referral-service.dart b/lib/core/service/patient/patient-doctor-referral-service.dart index c83c74c9..5b659631 100644 --- a/lib/core/service/patient/patient-doctor-referral-service.dart +++ b/lib/core/service/patient/patient-doctor-referral-service.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; import 'package:doctor_app_flutter/lookups/hospital_lookup.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; @@ -157,6 +158,36 @@ class PatientReferralService extends LookupService { ); } + Future getMyReferredOutPatient() async { + hasError = false; + RequestMyReferralPatientModel _requestMyReferralPatient = + RequestMyReferralPatientModel(); + DoctorProfileModel doctorProfile = await getDoctorProfile(); + + await baseAppClient.post( + GET_MY_REFERRED_OUT_PATIENT, + onSuccess: (dynamic response, int statusCode) { + listMyReferredPatientModel.clear(); + + response['List_MyReferredOutPatient'].forEach((v) { + MyReferredPatientModel item = MyReferredPatientModel.fromJson(v); + if (doctorProfile != null) { + item.isReferralDoctorSameBranch = + doctorProfile.projectID == item.projectID; + } else { + item.isReferralDoctorSameBranch = false; + } + listMyReferredPatientModel.add(item); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _requestMyReferralPatient.toJson(), + ); + } + Future getPendingReferralList() async { hasError = false; DoctorProfileModel doctorProfile = await getDoctorProfile(); @@ -212,18 +243,18 @@ class PatientReferralService extends LookupService { } Future responseReferral( - PendingReferral pendingReferral, bool isAccepted) async { + MyReferralPatientModel referralPatient, bool isAccepted) async { hasError = false; DoctorProfileModel doctorProfile = await getDoctorProfile(); Map body = Map(); - body['PatientMRN'] = pendingReferral.patientID; - body['AppointmentNo'] = pendingReferral.targetAppointmentNo; - body['SetupID'] = pendingReferral.targetSetupID; - body['ProjectID'] = pendingReferral.targetProjectId; + body['PatientMRN'] = referralPatient.patientID; + body['AppointmentNo'] = referralPatient.targetAppointmentNo; + body['SetupID'] = referralPatient.targetSetupID; + body['ProjectID'] = referralPatient.targetProjectId; body['IsAccepted'] = isAccepted; - body['PatientName'] = pendingReferral.patientName; - body['ReferralResponse'] = pendingReferral.remarksFromSource; + body['PatientName'] = referralPatient.patientName; + body['ReferralResponse'] = referralPatient.remarksFromSource; body['DoctorName'] = doctorProfile.doctorName; await baseAppClient.post( diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index e15cc8d1..25e9481b 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; @@ -12,6 +13,7 @@ import 'package:doctor_app_flutter/models/patient/get_list_stp_referral_frequenc import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result_req_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; @@ -22,20 +24,19 @@ import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_mode class PatientService extends BaseService { List _patientVitalSignList = []; List patientVitalSignOrderdSubList = []; + List inPatientList = List(); + List myInPatientList = List(); List get patientVitalSignList => _patientVitalSignList; List _patientLabResultOrdersList = []; - List get patientLabResultOrdersList => - _patientLabResultOrdersList; + List get patientLabResultOrdersList => _patientLabResultOrdersList; - List get patientPrescriptionsList => - _patientPrescriptionsList; + List get patientPrescriptionsList => _patientPrescriptionsList; List _patientPrescriptionsList = []; - List get prescriptionReportForInPatientList => - _prescriptionReportForInPatientList; + List get prescriptionReportForInPatientList => _prescriptionReportForInPatientList; List _prescriptionReportForInPatientList = []; List _patientRadiologyList = []; @@ -79,12 +80,9 @@ class PatientService extends BaseService { get referalFrequancyList => _referalFrequancyList; - DoctorsByClinicIdRequest _doctorsByClinicIdRequest = - DoctorsByClinicIdRequest(); - STPReferralFrequencyRequest _referralFrequencyRequest = - STPReferralFrequencyRequest(); - ClinicByProjectIdRequest _clinicByProjectIdRequest = - ClinicByProjectIdRequest(); + DoctorsByClinicIdRequest _doctorsByClinicIdRequest = DoctorsByClinicIdRequest(); + STPReferralFrequencyRequest _referralFrequencyRequest = STPReferralFrequencyRequest(); + ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest(); ReferToDoctorRequest _referToDoctorRequest; Future getPatientList(patient, patientType, {isView}) async { @@ -138,6 +136,38 @@ class PatientService extends BaseService { return Future.value(localRes); } + Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async { + hasError = false; + await getDoctorProfile(); + + if (isMyInpatient) { + requestModel.doctorID = doctorProfile.doctorID; + } else { + requestModel.doctorID = 0; + } + + await baseAppClient.post( + GET_PATIENT_IN_PATIENT_LIST, + onSuccess: (dynamic response, int statusCode) { + inPatientList.clear(); + myInPatientList.clear(); + + response['List_MyInPatient'].forEach((v) { + PatiantInformtion patient = PatiantInformtion.fromJson(v); + inPatientList.add(patient); + if (patient.doctorId == doctorProfile.doctorID) { + myInPatientList.add(patient); + } + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: requestModel.toJson(), + ); + } + Future getLabResultOrders(patient) async { hasError = false; await baseAppClient.post( @@ -181,8 +211,7 @@ class PatientService extends BaseService { onSuccess: (dynamic response, int statusCode) { _prescriptionReportForInPatientList = []; response['List_PrescriptionReportForInPatient'].forEach((v) { - prescriptionReportForInPatientList - .add(PrescriptionReportForInPatient.fromJson(v)); + prescriptionReportForInPatientList.add(PrescriptionReportForInPatient.fromJson(v)); }); }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/patient/referred_patient_service.dart b/lib/core/service/patient/referred_patient_service.dart deleted file mode 100644 index 0af9b077..00000000 --- a/lib/core/service/patient/referred_patient_service.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; -import 'package:doctor_app_flutter/models/doctor/verify_referral_doctor_remarks.dart'; -import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; -import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; - -class ReferredPatientService extends BaseService { - List _listMyReferredPatientModel = []; - - List get listMyReferredPatientModel => - _listMyReferredPatientModel; - - RequestMyReferralPatientModel _requestMyReferralPatient = - RequestMyReferralPatientModel(); - VerifyReferralDoctorRemarks _verifyreferraldoctorremarks = - VerifyReferralDoctorRemarks(); - - Future getMyReferredPatient() async { - await baseAppClient.post( - GET_MY_REFERRED_PATIENT, - onSuccess: (dynamic response, int statusCode) { - _listMyReferredPatientModel.clear(); - response['List_MyReferredPatient'].forEach((v) { - listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v)); - }); - // print(response['List_MyReferredPatient']); - }, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - body: _requestMyReferralPatient.toJson(), - ); - } - -} diff --git a/lib/core/service/patient_medical_file/lab_order/labs_service.dart b/lib/core/service/patient_medical_file/lab_order/labs_service.dart index 4eee522a..c7bb9a78 100644 --- a/lib/core/service/patient_medical_file/lab_order/labs_service.dart +++ b/lib/core/service/patient_medical_file/lab_order/labs_service.dart @@ -105,13 +105,16 @@ class LabsService extends BaseService { await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { - patientLabSpecialResult.clear(); - labResultList.clear(); + patientLabSpecialResult = []; + labResultList = []; if (isInpatient) { response['List_GetLabNormal'].forEach((hospital) { labResultList.add(LabResult.fromJson(hospital)); }); + response['List_GetLabSpecial'].forEach((hospital) { + patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital)); + }); } else { response['ListPLR'].forEach((lab) { labResultList.add(LabResult.fromJson(lab)); diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart new file mode 100644 index 00000000..dfb9c3ae --- /dev/null +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -0,0 +1,136 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MedicalReportTemplate.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class PatientMedicalReportService extends BaseService { + List medicalReportList = []; + List medicalReportTemplate = []; + + Future getMedicalReportList(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + await getDoctorProfile(); + body['AdmissionNo'] = patient.admissionNo; + body['SetupID'] = doctorProfile.setupID; + body['ProjectID'] = doctorProfile.projectID; + medicalReportList = []; + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, onSuccess: (dynamic response, int statusCode) { + if (response['DAPP_ListMedicalReportList'] != null) { + response['DAPP_ListMedicalReportList'].forEach((v) { + medicalReportList.add(MedicalReportModel.fromJson(v)); + }); + } + medicalReportList = medicalReportList.reversed.toList(); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } + + Future getMedicalReportTemplate() async { + hasError = false; + Map body = Map(); + body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['TemplateID'] = 43; + + await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE, onSuccess: (dynamic response, int statusCode) { + medicalReportTemplate.clear(); + if (response['DAPP_GetTemplateByIDList'] != null) { + response['DAPP_GetTemplateByIDList'].forEach((v) { + medicalReportTemplate.add(MedicalReportTemplate.fromJson(v)); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body); + } + + Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { + hasError = false; + Map body = Map(); + // body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['AdmissionNo'] = patient.admissionNo; + body['MedicalReportHTML'] = htmlText; + + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT, onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } + + Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async { + hasError = false; + Map body = Map(); + body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['AdmissionNo'] = patient.admissionNo; + body['InvoiceNo'] = medicalReport.invoiceNo; + body['LineItemNo'] = medicalReport.lineItemNo; + if (body['ProjectID'] == null) { + body['ProjectID'] = doctorProfile?.projectID; + } + if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; + + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } + + Future addMedicalReport(PatiantInformtion patient, String htmlText) async { + hasError = false; + Map body = Map(); + // body['TokenID'] = "@dm!n"; + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID + : SETUP_ID; + body['AdmissionNo'] = int.parse(patient.admissionNo); + body['MedicalReportHTML'] = htmlText; + if (body['ProjectID'] == null) { + body['ProjectID'] = doctorProfile?.projectID; + } + if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; + + await baseAppClient.postPatient(INSERT_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } + + Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async { + hasError = false; + Map body = Map(); + // body['TokenID'] = "@dm!n"; + + body['LineItemNo'] = limitNumber; + body['InvoiceNo'] = invoiceNumber; + + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID + : SETUP_ID; + //body['AdmissionNo'] = int.parse(patient.admissionNo); + body['MedicalReportHTML'] = htmlText; + if (body['ProjectID'] == null) { + body['ProjectID'] = doctorProfile?.projectID; + } + if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; + + await baseAppClient.postPatient(UPDATE_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } +} diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index b403edf0..526b2b3e 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -1,9 +1,13 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/Procedure_template_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; @@ -19,9 +23,22 @@ class ProcedureService extends BaseService { List procedureslist = List(); List categoryList = []; + // List _templateList = List(); + // List get templateList => _templateList; + List templateList = List(); + + List _templateDetailsList = List(); + List get templateDetailsList => + _templateDetailsList; + GetOrderedProcedureRequestModel _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(); + ProcedureTempleteRequestModel _procedureTempleteRequestModel = + ProcedureTempleteRequestModel(); + ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = + ProcedureTempleteDetailsRequestModel(); + GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( // clinicId: 17, // pageSize: 10, @@ -46,6 +63,60 @@ class ProcedureService extends BaseService { //search: ["DENTAL"], ); + Future getProcedureTemplate( + {int doctorId, int projectId, int clinicId, String categoryID}) async { + _procedureTempleteRequestModel = ProcedureTempleteRequestModel( + // tokenID: "@dm!n", + patientID: 0, + searchType: 1, + ); + hasError = false; + + await baseAppClient.post(GET_TEMPLETE_LIST/*GET_PROCEDURE_TEMPLETE*/, + onSuccess: (dynamic response, int statusCode) { + templateList.clear(); + response['DAPP_TemplateGetList'].forEach((template) { + ProcedureTempleteDetailsModel templateElement = ProcedureTempleteDetailsModel.fromJson(template); + if(categoryID != null){ + if(categoryID == templateElement.categoryID){ + templateList.add(templateElement); + } + } else { + templateList.add(templateElement); + } + + }); + // response['HIS_ProcedureTemplateList'].forEach((template) { + // _templateList.add(ProcedureTempleteModel.fromJson(template)); + // }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _procedureTempleteRequestModel.toJson()); + } + + Future getProcedureTemplateDetails( + {int doctorId, int projectId, int clinicId, int templateId}) async { + _procedureTempleteDetailsRequestModel = + ProcedureTempleteDetailsRequestModel( + templateID: templateId, searchType: 1, patientID: 0); + hasError = false; + //insuranceApprovalInPatient.clear(); + _templateDetailsList.clear(); + + await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, + onSuccess: (dynamic response, int statusCode) { + //prescriptionsList.clear(); + response['HIS_ProcedureTemplateDetailsList'].forEach((template) { + _templateDetailsList + .add(ProcedureTempleteDetailsModel.fromJson(template)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _procedureTempleteDetailsRequestModel.toJson()); + } + Future getProcedure({int mrn}) async { _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel(patientMRN: mrn); @@ -74,10 +145,10 @@ class ProcedureService extends BaseService { }, body: Map()); } - Future getProcedureCategory({String categoryName, String categoryID}) async { + Future getProcedureCategory({String categoryName, String categoryID,patientId}) async { _getProcedureCategoriseReqModel = GetProcedureReqModel( search: ["$categoryName"], - patientMRN: 0, + patientMRN: patientId, pageIndex: 0, clinicId: 0, pageSize: 0, diff --git a/lib/core/service/patient_medical_file/radiology/radiology_service.dart b/lib/core/service/patient_medical_file/radiology/radiology_service.dart index 7cf17753..df646ca9 100644 --- a/lib/core/service/patient_medical_file/radiology/radiology_service.dart +++ b/lib/core/service/patient_medical_file/radiology/radiology_service.dart @@ -46,6 +46,9 @@ class RadiologyService extends BaseService { if (isInPatient) { label = "List_GetRadOreders"; } + if(response[label] == null || response[label].length == 0){ + label = "FinalRadiologyList"; + } response[label].forEach((radiology) { finalRadiologyList.add(FinalRadiology.fromJson(radiology)); }); diff --git a/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart b/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart index db2deb13..22f53226 100644 --- a/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart +++ b/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart @@ -17,9 +17,9 @@ class UcafService extends LookupService { Future getPatientChiefComplaint(PatiantInformtion patient) async { hasError = false; Map body = Map(); - body['PatientMRN'] = patient.patientMRN; + body['PatientMRN'] = patient.patientMRN ; body['AppointmentNo'] = patient.appointmentNo; - body['EpisodeID'] = patient.episodeNo; + body['EpisodeID'] = patient.episodeNo ; body['DoctorID'] = ""; await baseAppClient.post(GET_CHIEF_COMPLAINT, diff --git a/lib/core/service/special_clinics/special_clinic_service.dart b/lib/core/service/special_clinics/special_clinic_service.dart new file mode 100644 index 00000000..49237331 --- /dev/null +++ b/lib/core/service/special_clinics/special_clinic_service.dart @@ -0,0 +1,57 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart'; + +class SpecialClinicsService extends BaseService { + + + List _specialClinicalCareList = []; + List get specialClinicalCareList => _specialClinicalCareList; + + List _specialClinicalCareMappingList = []; + List get specialClinicalCareMappingList => _specialClinicalCareMappingList; + Future getSpecialClinicalCareList() async { + hasError = false; + await baseAppClient.post( + GET_SPECIAL_CLINICAL_CARE_LIST, + onSuccess: (dynamic response, int statusCode) { + + _specialClinicalCareList.clear(); + response['List_SpecialClinicalCareList'].forEach((v) { + _specialClinicalCareList.add(GetSpecialClinicalCareListResponseModel.fromJson(v)); + });}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + }, + ); + } + + + Future getSpecialClinicalCareMappingList(int clinicId) async { + hasError = false; + await baseAppClient.post( + GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST, + onSuccess: (dynamic response, int statusCode) { + + _specialClinicalCareMappingList.clear(); + response['List_SpecialClinicalCareMappingList'].forEach((v) { + _specialClinicalCareMappingList.add(GetSpecialClinicalCareMappingListResponseModel.fromJson(v)); + });}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "ClinicID": clinicId, + "DoctorID":0, + "EditedBy":0 + }, + ); + } + +} diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart new file mode 100644 index 00000000..03cb0a7b --- /dev/null +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -0,0 +1,255 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart'; +import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/live_care/live_care_login_reguest_model.dart'; +import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; +import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/livecare/end_call_req.dart'; +import 'package:doctor_app_flutter/models/livecare/start_call_req.dart'; +import 'package:doctor_app_flutter/models/livecare/start_call_res.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +import '../../locator.dart'; + +class LiveCarePatientViewModel extends BaseViewModel { + List filterData = []; + + LiveCarePatientServices _liveCarePatientServices = locator(); + + StartCallRes get startCallRes => _liveCarePatientServices.startCallRes; + + List get alternativeServicesList => + _liveCarePatientServices.alternativeServicesList; + + DashboardService _dashboardService = locator(); + + getPendingPatientERForDoctorApp({bool isFromTimer = false}) async { + if (isFromTimer) { + setState(ViewState.Idle); + } else { + setState(ViewState.BusyLocal); + } + + PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel = + PendingPatientERForDoctorAppRequestModel(sErServiceID: _dashboardService.sServiceID, outSA: false); + await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + + setState(ViewState.ErrorLocal); + } else { + filterData = _liveCarePatientServices.patientList; + setState(ViewState.Idle); + } + } + + Future endCall(int vCID, bool isPatient) async { + await getDoctorProfile(isGetProfile: true); + EndCallReq endCallReq = new EndCallReq(); + endCallReq.doctorId = doctorProfile.doctorID; + endCallReq.generalid = 'Cs2020@2016\$2958'; + endCallReq.vCID = vCID; + endCallReq.isDestroy = isPatient; + + setState(ViewState.BusyLocal); + await _liveCarePatientServices.endCall(endCallReq); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + getToken() async { + String token = await sharedPref.getString(TOKEN); + return token; + } + + Future startCall({int vCID, bool isReCall}) async { + StartCallReq startCallReq = new StartCallReq(); + await getDoctorProfile(); + startCallReq.clinicId = super.doctorProfile.clinicID; + startCallReq.vCID = vCID; //["VC_ID"]; + startCallReq.isrecall = isReCall; + startCallReq.doctorId = doctorProfile.doctorID; + startCallReq.isOutKsa = false; //["IsOutKSA"]; + startCallReq.projectName = doctorProfile.projectName; + startCallReq.docotrName = doctorProfile.doctorName; + startCallReq.clincName = doctorProfile.clinicDescription; + startCallReq.docSpec = doctorProfile.doctorTitleForProfile; + startCallReq.generalid = 'Cs2020@2016\$2958'; + + setState(ViewState.BusyLocal); + await _liveCarePatientServices.startCall(startCallReq); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + setSelectedCheckboxValues(AlternativeService service, bool isSelected) { + int index = alternativeServicesList.indexOf(service); + if (index != -1) alternativeServicesList[index].isSelected = isSelected; + notifyListeners(); + } + + Future endCallWithCharge(int vcID, bool isConfirmed) async { + setState(ViewState.BusyLocal); + + List selectedServices = []; + if (isConfirmed) { + selectedServices = getSelectedAlternativeServices(); + } + + await _liveCarePatientServices.endCallWithCharge( + vcID, selectedServices); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + await getPendingPatientERForDoctorApp(); + setState(ViewState.Idle); + } + } + + List getSelectedAlternativeServices() { + List selectedServices = List(); + for (AlternativeService service in alternativeServicesList) { + if (service.isSelected) { + selectedServices.add(service.serviceID); + } + } + return selectedServices; + } + + Future getAlternativeServices(int vcID) async { + setState(ViewState.BusyLocal); + await _liveCarePatientServices.getAlternativeServices(vcID); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future transferToAdmin(int vcID, String notes) async { + setState(ViewState.BusyLocal); + await _liveCarePatientServices.transferToAdmin(vcID, notes); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + await getPendingPatientERForDoctorApp(); + setState(ViewState.Idle); + } + } + + Future sendSMSInstruction(int vcID) async { + setState(ViewState.BusyLocal); + await _liveCarePatientServices.sendSMSInstruction(vcID); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + await getPendingPatientERForDoctorApp(); + setState(ViewState.Idle); + } + } + + searchData(String str) { + var strExist = str.length > 0 ? true : false; + if (strExist) { + filterData = []; + for (var i = 0; i < _liveCarePatientServices.patientList.length; i++) { + String fullName = _liveCarePatientServices.patientList[i].fullName.toUpperCase(); + String patientID = _liveCarePatientServices.patientList[i].patientId.toString(); + String mobile = _liveCarePatientServices.patientList[i].mobileNumber.toUpperCase(); + + if (fullName.contains(str.toUpperCase()) || patientID.contains(str) || mobile.contains(str)) { + filterData.add(_liveCarePatientServices.patientList[i]); + } + } + notifyListeners(); + } else { + filterData = _liveCarePatientServices.patientList; + notifyListeners(); + } + } + + Future isLogin(int loginStatus) async { + await getDoctorProfile(isGetProfile: true); + + LiveCareUserLoginRequestModel userLoginRequestModel = new LiveCareUserLoginRequestModel(); + userLoginRequestModel.isOutKsa = (doctorProfile.projectID == 2 || doctorProfile.projectID == 3) ? 1 : 0; + userLoginRequestModel.isLogin = loginStatus; + userLoginRequestModel.generalid = "Cs2020@2016\$2958"; + + setState(ViewState.BusyLocal); + await _liveCarePatientServices.isLogin(loginStatus: loginStatus, isLoginRequestModel: userLoginRequestModel); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + setDemoData() { + alternativeServicesList.clear(); + alternativeServicesList.add( + AlternativeService(serviceID: 1, serviceName: "Medicine Home Delivery"), + ); + alternativeServicesList.add( + AlternativeService(serviceID: 2, serviceName: "LABORATORY"), + ); + alternativeServicesList.add( + AlternativeService( + serviceID: 3, serviceName: "RADIOLOGY(ULTRASOUND) For pregnant only"), + ); + alternativeServicesList.add( + AlternativeService(serviceID: 4, serviceName: "VACCINATIONS"), + ); + alternativeServicesList.add( + AlternativeService(serviceID: 5, serviceName: "ER SERVICES"), + ); + alternativeServicesList.add( + AlternativeService(serviceID: 6, serviceName: "PHYSIOTHERAPY"), + ); + alternativeServicesList.add( + AlternativeService(serviceID: 7, serviceName: "DRESSING"), + ); + alternativeServicesList.add( + AlternativeService(serviceID: 8, serviceName: "INJECTION"), + ); + alternativeServicesList.add( + AlternativeService(serviceID: 9, serviceName: "FAMILY MEDICIN DR"), + ); + alternativeServicesList.add( + AlternativeService( + serviceID: 10, serviceName: "FOLYS CATHETER INSERTION"), + ); + alternativeServicesList.add( + AlternativeService(serviceID: 11, serviceName: "GASTRIC TUBE CHANGE"), + ); + } + + updateInCallPatient({PatiantInformtion patient, appointmentNo}){ + + _liveCarePatientServices.patientList.forEach((e) { + if(e.patientId == patient.patientId) { + e.episodeNo = 0 ; + e.appointmentNo = appointmentNo; + return; + } + }); + + setState(ViewState.Idle); + + } +} diff --git a/lib/core/viewModel/PatientMedicalReportViewModel.dart b/lib/core/viewModel/PatientMedicalReportViewModel.dart new file mode 100644 index 00000000..e7d343b4 --- /dev/null +++ b/lib/core/viewModel/PatientMedicalReportViewModel.dart @@ -0,0 +1,83 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MedicalReportTemplate.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +import '../../locator.dart'; + +class PatientMedicalReportViewModel extends BaseViewModel { + PatientMedicalReportService _service = locator(); + + List get medicalReportList => _service.medicalReportList; + + List get medicalReportTemplate => _service.medicalReportTemplate; + + Future getMedicalReportList(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _service.getMedicalReportList(patient); + if (_service.hasError) { + error = _service.error; + setState(ViewState.ErrorLocal); // ViewState.Error + } else + setState(ViewState.Idle); + } + + Future getMedicalReportTemplate() async { + setState(ViewState.Busy); + await _service.getMedicalReportTemplate(); + if (_service.hasError) { + error = _service.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { + setState(ViewState.Busy); + await _service.insertMedicalReport(patient, htmlText); + if (_service.hasError) { + error = _service.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async { + setState(ViewState.Busy); + await _service.verifyMedicalReport(patient, medicalReport); + if (_service.hasError) { + error = _service.error; + setState(ViewState.ErrorLocal); + } else + await getMedicalReportList(patient); + setState(ViewState.Idle); + } + + Future addMedicalReport(PatiantInformtion patient, String htmlText) async { + setState(ViewState.Busy); + await _service.addMedicalReport(patient, htmlText); + if (_service.hasError) { + error = _service.error; + await getMedicalReportList(patient); + setState(ViewState.ErrorLocal); + } else + { await getMedicalReportList(patient); + setState(ViewState.Idle); + } + } + + Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async { + setState(ViewState.Busy); + await _service.updateMedicalReport(patient, htmlText, limitNumber, invoiceNumber); + if (_service.hasError) { + error = _service.error; + await getMedicalReportList(patient); + setState(ViewState.ErrorLocal); + } else + { + await getMedicalReportList(patient); + setState(ViewState.Idle);} + } +} diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index a0cd68d9..0ee76cb4 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/patient/out_patient_service.dart'; import 'package:doctor_app_flutter/core/service/patient/patientInPatientService.dart'; +import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -12,8 +14,11 @@ import 'base_view_model.dart'; class PatientSearchViewModel extends BaseViewModel { OutPatientService _outPatientService = locator(); + SpecialClinicsService _specialClinicsService = locator(); List get patientList => _outPatientService.patientList; + List get specialClinicalCareMappingList => + _specialClinicsService.specialClinicalCareMappingList; List filterData = []; @@ -25,14 +30,10 @@ class PatientSearchViewModel extends BaseViewModel { if (strExist) { filterData = []; for (var i = 0; i < _outPatientService.patientList.length; i++) { - String firstName = - _outPatientService.patientList[i].firstName.toUpperCase(); - String lastName = - _outPatientService.patientList[i].lastName.toUpperCase(); - String mobile = - _outPatientService.patientList[i].mobileNumber.toUpperCase(); - String patientID = - _outPatientService.patientList[i].patientId.toString(); + String firstName = _outPatientService.patientList[i].firstName.toUpperCase(); + String lastName = _outPatientService.patientList[i].lastName.toUpperCase(); + String mobile = _outPatientService.patientList[i].mobileNumber.toUpperCase(); + String patientID = _outPatientService.patientList[i].patientId.toString(); if (firstName.contains(str.toUpperCase()) || lastName.contains(str.toUpperCase()) || @@ -48,8 +49,7 @@ class PatientSearchViewModel extends BaseViewModel { } } - getOutPatient(PatientSearchRequestModel patientSearchRequestModel, - {bool isLocalBusy = false}) async { + getOutPatient(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -71,11 +71,19 @@ class PatientSearchViewModel extends BaseViewModel { } } - getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, - {bool isLocalBusy = false}) async { + sortOutPatient({bool isDes = false}) { + if (isDes) + filterData = filterData.reversed.toList(); + // filterData.sort((PatiantInformtion a, PatiantInformtion b)=>b.appointmentDateWithDateTimeForm.compareTo(a.appointmentDateWithDateTimeForm)); + else + filterData = filterData.reversed.toList(); + // filterData.sort((PatiantInformtion a, PatiantInformtion b)=>a.appointmentDateWithDateTimeForm.compareTo(b.appointmentDateWithDateTimeForm)); + setState(ViewState.Idle); + } + + getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { setState(ViewState.Busy); - await _outPatientService - .getPatientFileInformation(patientSearchRequestModel); + await _outPatientService.getPatientFileInformation(patientSearchRequestModel); if (_outPatientService.hasError) { error = _outPatientService.error; setState(ViewState.Error); @@ -94,31 +102,21 @@ class PatientSearchViewModel extends BaseViewModel { String dateTo; String dateFrom; if (OutPatientFilterType.Previous == outPatientFilterType) { - selectedFromDate = DateTime( - DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); - selectedToDate = DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); + selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); + selectedToDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); dateTo = AppDateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd'); dateFrom = AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd'); } else if (OutPatientFilterType.NextWeek == outPatientFilterType) { dateTo = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day + 6), - 'yyyy-MM-dd'); + DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 6), 'yyyy-MM-dd'); dateFrom = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day + 1), - 'yyyy-MM-dd'); + DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1), 'yyyy-MM-dd'); } else { dateFrom = AppDateUtils.convertDateToFormat( - DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day), - 'yyyy-MM-dd'); + DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); dateTo = AppDateUtils.convertDateToFormat( - DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day), - 'yyyy-MM-dd'); + DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); } PatientSearchRequestModel currentModel = PatientSearchRequestModel(); currentModel.patientID = patientSearchRequestModel.patientID; @@ -132,32 +130,46 @@ class PatientSearchViewModel extends BaseViewModel { filterData = _outPatientService.patientList; } - PatientInPatientService _inPatientService = - locator(); + PatientInPatientService _inPatientService = locator(); List get inPatientList => _inPatientService.inPatientList; - List get myIinPatientList => - _inPatientService.myInPatientList; + List get myIinPatientList => _inPatientService.myInPatientList; List filteredInPatientItems = List(); Future getInPatientList(PatientSearchRequestModel requestModel, - {bool isMyInpatient = false}) async { + {bool isMyInpatient = false, bool isLocalBusy = false}) async { await getDoctorProfile(); - setState(ViewState.Busy); - - if (inPatientList.length == 0) - await _inPatientService.getInPatientList(requestModel, false); + if (isLocalBusy) { + setState(ViewState.BusyLocal); + } else { + setState(ViewState.Busy); + } + if (inPatientList.length == 0) await _inPatientService.getInPatientList(requestModel, false); if (_inPatientService.hasError) { error = _inPatientService.error; - setState(ViewState.Error); + if (isLocalBusy) { + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Error); + } } else { // setDefaultInPatientList(); setState(ViewState.Idle); } } + sortInPatient({bool isDes = false}) { + if (isDes) + filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => + b.admissionDateWithDateTimeForm.compareTo(a.admissionDateWithDateTimeForm)); + else + filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) => + a.admissionDateWithDateTimeForm.compareTo(b.admissionDateWithDateTimeForm)); + setState(ViewState.Idle); + } + Future setDefaultInPatientList() async { setState(ViewState.BusyLocal); await getDoctorProfile(); @@ -195,4 +207,23 @@ class PatientSearchViewModel extends BaseViewModel { notifyListeners(); } } + + getSpecialClinicalCareMappingList(clinicId, {bool isLocalBusy = false}) async { + if (isLocalBusy) { + setState(ViewState.BusyLocal); + } else { + setState(ViewState.Busy); + } + await _specialClinicsService.getSpecialClinicalCareMappingList(clinicId); + if (_specialClinicsService.hasError) { + error = _specialClinicsService.error; + if (isLocalBusy) { + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Error); + } + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart deleted file mode 100644 index bb4fd305..00000000 --- a/lib/core/viewModel/auth_view_model.dart +++ /dev/null @@ -1,233 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; -import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; -import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; -import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; -import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; -import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; -import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; - -import '../../models/doctor/user_model.dart'; - -enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } - -class AuthViewModel extends BaseViewModel { - List doctorsClinicList = []; - - String selectedClinicName; - bool isLogin = false; - bool isLoading = true; - DoctorProfileModel doctorProfile; - BaseAppClient baseAppClient = BaseAppClient(); - setDoctorProfile(DoctorProfileModel profileModel) { - doctorProfile = profileModel; - notifyListeners(); - } - - AuthViewModel() { - getUserAuthentication(); - } - - getUserAuthentication() async { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - if (profile != null) { - doctorProfile = new DoctorProfileModel.fromJson(profile); - isLoading = false; - isLogin = true; - } else { - isLoading = false; - isLogin = false; - } - notifyListeners(); - } - - APP_STATUS get stutas { - if (isLoading) { - return APP_STATUS.LOADING; - } else { - if (this.isLogin) { - return APP_STATUS.AUTHENTICATED; - } else { - return APP_STATUS.UNAUTHENTICATED; - } - } - } - - Future login(UserModel userInfo) async { - try { - dynamic localRes; - - await baseAppClient.post(LOGIN_URL, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: userInfo.toJson()); - - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future insertDeviceImei(request) async { - var loggedIn = await sharedPref.getObj(LOGGED_IN_USER); - var user = await sharedPref.getObj(LAST_LOGIN_USER); - if (user != null) { - user = GetIMEIDetailsModel.fromJson(user); - } - request['IMEI'] = DEVICE_TOKEN; - request['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); - request['BioMetricEnabled'] = true; - request['MobileNo'] = - loggedIn != null ? loggedIn['MobileNumber'] : user.mobile; - InsertIMEIDetailsModel nRequest = InsertIMEIDetailsModel.fromJson(request); - nRequest.genderDescription = request['Gender_Description']; - nRequest.genderDescriptionN = request['Gender_DescriptionN']; - nRequest.genderDescriptionN = request['Gender_DescriptionN']; - nRequest.titleDescription = request['Title_Description']; - nRequest.titleDescriptionN = request['Title_DescriptionN']; - nRequest.projectID = await sharedPref.getInt(PROJECT_ID); - nRequest.doctorID = loggedIn != null - ? loggedIn['List_MemberInformation'][0]['MemberID'] - : user.doctorID; - nRequest.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; - nRequest.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - nRequest.vidaRefreshTokenID = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); - nRequest.password = await sharedPref.getString(PASSWORD); - try { - var localRes; - await baseAppClient.post(INSERT_DEVICE_IMEI, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) {}, body: nRequest.toJson()); - return Future.value(localRes); - } catch (error) { - throw error; - } - } - - Future sendActivationCodeByOtpNotificationType(activationCodeModel) async { - try { - var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future sendActivationCodeForDoctorApp( - ActivationCodeModel activationCodeModel) async { - try { - var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future memberCheckActivationCodeNew(activationCodeModel) async { - try { - dynamic localRes; - await baseAppClient.post(MEMBER_CHECK_ACTIVATION_CODE_NEW, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - selectedClinicName = - ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; - - response['List_DoctorsClinic'].forEach((v) { - doctorsClinicList.add(new ClinicModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future checkActivationCodeForDoctorApp( - CheckActivationCodeRequestModel checkActivationCodeRequestModel) async { - try { - dynamic localRes; - await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - selectedClinicName = - ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; - - response['List_DoctorsClinic'].forEach((v) { - doctorsClinicList.add(new ClinicModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - throw error; - }, body: checkActivationCodeRequestModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future getDocProfiles(docInfo, - {bool allowChangeProfile = true}) async { - try { - dynamic localRes; - await baseAppClient.post(GET_DOC_PROFILES, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - if (allowChangeProfile) { - doctorProfile = - DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); - selectedClinicName = - response['DoctorProfileList'][0]['ClinicDescription']; - } - }, onFailure: (String error, int statusCode) { - throw error; - }, body: docInfo); - notifyListeners(); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future sendActivationCodeVerificationScreen( - ActivationCodeModel2 activationCodeModel) async { - try { - var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } -} diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart new file mode 100644 index 00000000..cae415da --- /dev/null +++ b/lib/core/viewModel/authentication_view_model.dart @@ -0,0 +1,440 @@ +import 'dart:io'; + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/activation_code_for_verification_screen_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/check_activation_code_for_doctor_app_response_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; +import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/new_login_information_response_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/send_activation_code_for_doctor_app_response_model.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; +import 'package:doctor_app_flutter/core/service/authentication_service.dart'; +import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; +import 'package:doctor_app_flutter/models/doctor/user_model.dart'; +import 'package:doctor_app_flutter/root_page.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:local_auth/auth_strings.dart'; +import 'package:local_auth/local_auth.dart'; + +enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED, UNVERIFIED } + +class AuthenticationViewModel extends BaseViewModel { + AuthenticationService _authService = locator(); + HospitalsService _hospitalsService = locator(); + + List get imeiDetails => _authService.dashboardItemsList; + + List get hospitals => _hospitalsService.hospitals; + + NewLoginInformationModel get loginInfo => _authService.loginInfo; + + List get doctorProfilesList => _authService.doctorProfilesList; + + SendActivationCodeForDoctorAppResponseModel + get activationCodeVerificationScreenRes => + _authService.activationCodeVerificationScreenRes; + + SendActivationCodeForDoctorAppResponseModel + get activationCodeForDoctorAppRes => + _authService.activationCodeForDoctorAppRes; + + CheckActivationCodeForDoctorAppResponseModel + get checkActivationCodeForDoctorAppRes => + _authService.checkActivationCodeForDoctorAppRes; + + NewLoginInformationModel loggedUser; + GetIMEIDetailsModel user; + + UserModel userInfo = UserModel(); + final LocalAuthentication auth = LocalAuthentication(); + List _availableBiometrics; + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); + + bool isLogin = false; + bool unverified = false; + bool isFromLogin = false; + APP_STATUS app_status = APP_STATUS.LOADING; + + AuthenticationViewModel({bool checkDeviceInfo = false}) { + getDeviceInfoFromFirebase(); + getDoctorProfile(); + } + + /// select Device IMEI + Future selectDeviceImei(imei) async { + setState(ViewState.Busy); + await _authService.selectDeviceImei(imei); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + /// Insert Device IMEI + Future insertDeviceImei() async { + var loggedIn = await sharedPref.getObj(LOGGED_IN_USER); + var user = await sharedPref.getObj(LAST_LOGIN_USER); + if (user != null) { + user = GetIMEIDetailsModel.fromJson(user); + } + + var profileInfo = await sharedPref.getObj(DOCTOR_PROFILE); + + profileInfo['IMEI'] = DEVICE_TOKEN; + profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); + profileInfo['BioMetricEnabled'] = true; + profileInfo['MobileNo'] = + loggedIn != null ? loggedIn['MobileNumber'] : user.mobile; + InsertIMEIDetailsModel insertIMEIDetailsModel = InsertIMEIDetailsModel.fromJson(profileInfo); + insertIMEIDetailsModel.genderDescription = profileInfo['Gender_Description']; + insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN']; + insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN']; + insertIMEIDetailsModel.titleDescription = profileInfo['Title_Description']; + insertIMEIDetailsModel.titleDescriptionN = profileInfo['Title_DescriptionN']; + insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID); + insertIMEIDetailsModel.doctorID = loggedIn != null + ? loggedIn['List_MemberInformation'][0]['MemberID'] + : user.doctorID; + insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; + insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + insertIMEIDetailsModel.vidaRefreshTokenID = + await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + insertIMEIDetailsModel.password = await sharedPref.getString(PASSWORD); + + await _authService.insertDeviceImei(insertIMEIDetailsModel); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + /// first step login + Future login(UserModel userInfo) async { + setState(ViewState.BusyLocal); + await _authService.login(userInfo); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + sharedPref.setInt(PROJECT_ID, userInfo.projectID); + loggedUser = loginInfo; + saveObjToString(LOGGED_IN_USER, loginInfo); + sharedPref.remove(LAST_LOGIN_USER); + sharedPref.setString(TOKEN, loginInfo.logInTokenID); + setState(ViewState.Idle); + } + } + + /// send activation code for for msg methods + Future sendActivationCodeVerificationScreen( AuthMethodTypes authMethodType) async { + setState(ViewState.BusyLocal); + ActivationCodeForVerificationScreenModel activationCodeModel = + ActivationCodeForVerificationScreenModel( + iMEI: user.iMEI, + facilityId: user.projectID, + memberID: user.doctorID, + zipCode: user.outSA == true ? '971' : '966', + mobileNumber: user.mobile, + oTPSendType: authMethodType.getTypeIdService(), + isMobileFingerPrint: 1, + vidaAuthTokenID: user.vidaAuthTokenID, + vidaRefreshTokenID: user.vidaRefreshTokenID); + await _authService.sendActivationCodeVerificationScreen(activationCodeModel); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + /// send activation code for silent login + Future sendActivationCodeForDoctorApp({AuthMethodTypes authMethodType, String password }) async { + setState(ViewState.BusyLocal); + int projectID = await sharedPref.getInt(PROJECT_ID); + ActivationCodeModel activationCodeModel = ActivationCodeModel( + facilityId: projectID, + memberID: loggedUser.listMemberInformation[0].memberID, + zipCode: loggedUser.zipCode, + mobileNumber: loggedUser.mobileNumber, + otpSendType: authMethodType.getTypeIdService().toString(), + password: password); + await _authService.sendActivationCodeForDoctorApp(activationCodeModel); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + /// check activation code for sms and whats app + Future checkActivationCodeForDoctorApp({String activationCode}) async { + setState(ViewState.BusyLocal); + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = + new CheckActivationCodeRequestModel( + zipCode: + loggedUser != null ? loggedUser.zipCode :user.zipCode, + mobileNumber: + loggedUser != null ? loggedUser.mobileNumber : user.mobile, + projectID: await sharedPref.getInt(PROJECT_ID) != null + ? await sharedPref.getInt(PROJECT_ID) + : user.projectID, + logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), + activationCode: activationCode ?? '0000', + oTPSendType: await sharedPref.getInt(OTP_TYPE), + generalid: "Cs2020@2016\$2958"); + await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + /// get list of Hospitals + Future getHospitalsList(memberID) async { + GetHospitalsRequestModel getHospitalsRequestModel =GetHospitalsRequestModel(); + getHospitalsRequestModel.memberID = memberID; + await _hospitalsService.getHospitals(getHospitalsRequestModel); + if (_hospitalsService.hasError) { + error = _hospitalsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + + /// get type name based on id. + getType(type, context) { + switch (type) { + case 1: + return TranslationBase + .of(context) + .verifySMS; + break; + case 3: + return TranslationBase + .of(context) + .verifyFingerprint; + break; + case 4: + return TranslationBase + .of(context) + .verifyFaceID; + break; + case 2: + return TranslationBase.of(context).verifyWhatsApp; + break; + default: + return TranslationBase.of(context).verifySMS; + break; + } + } + + /// add  token to shared preferences in case of send activation code is success + setDataAfterSendActivationSuccess(SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) { + print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); + // DrAppToastMsg.showSuccesToast("_VerificationCode_ : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); + sharedPref.setString(VIDA_AUTH_TOKEN_ID, + sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); + sharedPref.setString(VIDA_REFRESH_TOKEN_ID, + sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID); + sharedPref.setString(LOGIN_TOKEN_ID, + sendActivationCodeForDoctorAppResponseModel.logInTokenID); + } + + saveObjToString(String key, value) async { + sharedPref.setObj(key, value); + } + + /// ask user to add his biometric + showIOSAuthMessages() async { + const iosStrings = const IOSAuthMessages( + cancelButton: 'cancel', + goToSettingsButton: 'settings', + goToSettingsDescription: 'Please set up your Touch ID.', + lockOut: 'Please Enable Your Touch ID'); + + try { + await auth.authenticateWithBiometrics( + localizedReason: 'Scan your fingerprint to authenticate', + useErrorDialogs: true, + stickyAuth: true, + iOSAuthStrings: iosStrings); + } on PlatformException catch (e) { + DrAppToastMsg.showErrorToast(e.toString()); + } + } + + /// add profile to base view model super class + localSetDoctorProfile(DoctorProfileModel profile) { + super.setDoctorProfile(profile); + } + + /// get doctor profile based on clinic model + Future getDoctorProfileBasedOnClinic(ClinicModel clinicInfo) async { + ProfileReqModel docInfo = new ProfileReqModel( + doctorID: clinicInfo.doctorID, + clinicID: clinicInfo.clinicID, + license: true, + projectID: clinicInfo.projectID, + tokenID: '', + languageID: 2);//TODO change the lan + await _authService.getDoctorProfileBasedOnClinic(docInfo); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + localSetDoctorProfile(doctorProfilesList.first); + setState(ViewState.Idle); + } + } + + /// add some logic in case of check activation code is success + onCheckActivationCodeSuccess() async { + sharedPref.setString( + TOKEN, + checkActivationCodeForDoctorAppRes.authenticationTokenID); + if (checkActivationCodeForDoctorAppRes.listDoctorProfile != null && + checkActivationCodeForDoctorAppRes.listDoctorProfile + .isNotEmpty) { + localSetDoctorProfile( + checkActivationCodeForDoctorAppRes.listDoctorProfile[0]); + } else { + sharedPref.setObj( + CLINIC_NAME, + checkActivationCodeForDoctorAppRes.listDoctorsClinic); + ClinicModel clinic = ClinicModel.fromJson( + checkActivationCodeForDoctorAppRes.listDoctorsClinic[0] + .toJson()); + await getDoctorProfileBasedOnClinic(clinic); + } + } + + /// check specific biometric if it available or not + Future checkIfBiometricAvailable(BiometricType biometricType) async { + bool isAvailable = false; + await _getAvailableBiometrics(); + if (_availableBiometrics != null) { + for (var i = 0; i < _availableBiometrics.length; i++) { + if (biometricType == _availableBiometrics[i]) isAvailable = true; + } + } + return isAvailable; + } + + /// get all available biometric on the device for local Auth service + Future _getAvailableBiometrics() async { + try { + _availableBiometrics = await auth.getAvailableBiometrics(); + } on PlatformException catch (e) { + print(e); + } + } + + /// call firebase service to check if the user already login in before or not + getDeviceInfoFromFirebase() async { + _firebaseMessaging.setAutoInitEnabled(true); + if (Platform.isIOS) { + _firebaseMessaging.requestNotificationPermissions(); + } + + try { + setState(ViewState.Busy); + } catch (e) { + Helpers.showErrorToast("fdfdfdfdf"+e.toString()); + } + var token = await _firebaseMessaging.getToken(); + if (DEVICE_TOKEN == "") { + DEVICE_TOKEN = token; + + await _authService.selectDeviceImei(DEVICE_TOKEN); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + if (_authService.dashboardItemsList.length > 0) { + user =_authService.dashboardItemsList[0]; + sharedPref.setObj( + LAST_LOGIN_USER, _authService.dashboardItemsList[0]); + this.unverified = true; + } + setState(ViewState.Idle); + } + } else { + setState(ViewState.Idle); + } + } + + /// determine the status of the app + APP_STATUS get status { + if (state == ViewState.Busy) { + app_status = APP_STATUS.LOADING; + } else { + if(this.doctorProfile !=null) + app_status = APP_STATUS.AUTHENTICATED; + else if (this.unverified) { + app_status = APP_STATUS.UNVERIFIED; + } else if (this.isLogin) { + app_status = APP_STATUS.AUTHENTICATED; + } else { + app_status = APP_STATUS.UNAUTHENTICATED; + } + } + return app_status; + } + setAppStatus(APP_STATUS status){ + this.app_status = status; + notifyListeners(); + } + + setUnverified(bool unverified,{bool isFromLogin = false}){ + this.unverified = unverified; + this.isFromLogin = isFromLogin; + notifyListeners(); + } + + /// logout function + logout({bool isFromLogin = false}) async { + + + DEVICE_TOKEN = ""; + String lang = await sharedPref.getString(APP_Language); + await Helpers.clearSharedPref(); + doctorProfile = null; + sharedPref.setString(APP_Language, lang); + deleteUser(); + await getDeviceInfoFromFirebase(); + this.isFromLogin = isFromLogin; + app_status = APP_STATUS.UNAUTHENTICATED; + setState(ViewState.Idle); + } + + deleteUser(){ + user = null; + unverified = false; + isLogin = false; + } + +} diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index 43e83c9b..794706a6 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -19,12 +19,12 @@ class BaseViewModel extends ChangeNotifier { void setState(ViewState viewState) { _state = viewState; + notifyListeners(); } Future getDoctorProfile({bool isGetProfile = false}) async { - if(isGetProfile) - { + if (isGetProfile) { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = DoctorProfileModel.fromJson(profile); @@ -45,5 +45,11 @@ class BaseViewModel extends ChangeNotifier { } else { return doctorProfile; } -} + } + + setDoctorProfile(DoctorProfileModel doctorProfile) async { + await sharedPref.setObj(DOCTOR_PROFILE, doctorProfile); + this.doctorProfile = doctorProfile; + notifyListeners(); + } } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 1205699b..f35a4a2a 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -1,11 +1,54 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; +import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; +import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; +import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import '../../locator.dart'; +import 'authentication_view_model.dart'; import 'base_view_model.dart'; class DashboardViewModel extends BaseViewModel { + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); DashboardService _dashboardService = locator(); - get dashboardItemsList => _dashboardService.dashboardItemsList; + SpecialClinicsService _specialClinicsService = locator(); + + List get dashboardItemsList => + _dashboardService.dashboardItemsList; + + bool get hasVirtualClinic => _dashboardService.hasVirtualClinic; + + String get sServiceID => _dashboardService.sServiceID; + + List get specialClinicalCareList => _specialClinicsService.specialClinicalCareList; + + + Future setFirebaseNotification(ProjectViewModel projectsProvider, + AuthenticationViewModel authProvider) async { + setState(ViewState.Busy); + await projectsProvider.getDoctorClinicsList(); + + // _firebaseMessaging.setAutoInitEnabled(true); + _firebaseMessaging.requestNotificationPermissions( + const IosNotificationSettings( + sound: true, badge: true, alert: true, provisional: true)); + _firebaseMessaging.onIosSettingsRegistered + .listen((IosNotificationSettings settings) { + print("Settings registered: $settings"); + }); + + _firebaseMessaging.getToken().then((String token) async { + if (token != '') { + DEVICE_TOKEN = token; + authProvider.insertDeviceImei(); + } + }); + } Future getDashboard() async { setState(ViewState.Busy); @@ -16,4 +59,59 @@ class DashboardViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future checkDoctorHasLiveCare() async { + setState(ViewState.Busy); + await _dashboardService.checkDoctorHasLiveCare(); + if (_dashboardService.hasError) { + error = _dashboardService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getSpecialClinicalCareList() async { + setState(ViewState.Busy); + await _specialClinicsService.getSpecialClinicalCareList(); + if (_specialClinicsService.hasError) { + error = _specialClinicsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future changeClinic( + int clinicId, AuthenticationViewModel authProvider) async { + setState(ViewState.BusyLocal); + await getDoctorProfile(); + ClinicModel clinicModel = ClinicModel( + doctorID: doctorProfile.doctorID, + clinicID: clinicId, + projectID: doctorProfile.projectID, + ); + await authProvider.getDoctorProfileBasedOnClinic(clinicModel); + if (authProvider.state == ViewState.ErrorLocal) { + error = authProvider.error; + } + } + + getPatientCount(DashboardModel inPatientCount) { + int value = 0; + inPatientCount.summaryoptions.forEach((result) => {value += result.value}); + + return value.toString(); + } + + + GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){ + GetSpecialClinicalCareListResponseModel special ; + specialClinicalCareList.forEach((element) { + if(element.clinicID == 1){ + special = element; + } + }); + + return special; + + } } diff --git a/lib/core/viewModel/hospital_view_model.dart b/lib/core/viewModel/hospital_view_model.dart deleted file mode 100644 index a49b85e5..00000000 --- a/lib/core/viewModel/hospital_view_model.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:flutter/cupertino.dart'; - -// TODO change it when change login -class HospitalViewModel with ChangeNotifier { - BaseAppClient baseAppClient = BaseAppClient(); - - Future getProjectsList(memberID) async { - const url = GET_PROJECTS; - // TODO create model or remove it if no info need - var info = { - "LanguageID": 1, - "stamp": "2020-02-26T13:51:44.111Z", - "IPAdress": "11.11.11.11", - "VersionID": 5.8, - "Channel": 9, - "TokenID": "", - "SessionID": "i1UJwCTSqt", - "IsLoginForDoctorApp": true, - "MemberID": memberID - }; - dynamic localRes; - - await baseAppClient.post(url, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: info); - return Future.value(localRes); - } -} diff --git a/lib/core/viewModel/hospitals_view_model.dart b/lib/core/viewModel/hospitals_view_model.dart new file mode 100644 index 00000000..c0ce1bc4 --- /dev/null +++ b/lib/core/viewModel/hospitals_view_model.dart @@ -0,0 +1,27 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; +import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; +import 'package:flutter/cupertino.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + + +class HospitalViewModel extends BaseViewModel { + HospitalsService _hospitalsService = locator(); + // List get imeiDetails => _authService.dashboardItemsList; + // get loginInfo => _authService.loginInfo; + Future getHospitalsList(memberID) async { + GetHospitalsRequestModel getHospitalsRequestModel =GetHospitalsRequestModel(); + getHospitalsRequestModel.memberID = memberID; + setState(ViewState.Busy); + await _hospitalsService.getHospitals(getHospitalsRequestModel); + if (_hospitalsService.hasError) { + error = _hospitalsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/imei_view_model.dart b/lib/core/viewModel/imei_view_model.dart deleted file mode 100644 index f8c45762..00000000 --- a/lib/core/viewModel/imei_view_model.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; -import 'package:doctor_app_flutter/core/service/home/auth_service.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; -import 'package:doctor_app_flutter/locator.dart'; -import 'package:doctor_app_flutter/models/doctor/user_model.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; - -class IMEIViewModel extends BaseViewModel { - AuthService _authService = locator(); - List get imeiDetails => _authService.dashboardItemsList; - get loginInfo => _authService.loginInfo; - Future selectDeviceImei(imei) async { - setState(ViewState.Busy); - await _authService.selectDeviceImei(imei); - if (_authService.hasError) { - error = _authService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } - - Future login(UserModel userInfo) async { - setState(ViewState.Busy); - await _authService.login(userInfo); - if (_authService.hasError) { - error = _authService.error; - Helpers.showErrorToast(error); - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } -} diff --git a/lib/core/viewModel/labs_view_model.dart b/lib/core/viewModel/labs_view_model.dart index 90e9b327..5b4b7e4c 100644 --- a/lib/core/viewModel/labs_view_model.dart +++ b/lib/core/viewModel/labs_view_model.dart @@ -128,25 +128,28 @@ class LabsViewModel extends BaseViewModel { error = _labsService.error; setState(ViewState.Error); } else { - _labsService.labResultList.forEach((element) { - List patientLabOrdersClinic = labResultLists - .where( - (elementClinic) => elementClinic.filterName == element.testCode) - .toList(); - - if (patientLabOrdersClinic.length != 0) { - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] - .patientLabResultList - .add(element); - } else { - labResultLists - .add(LabResultList(filterName: element.testCode, lab: element)); - } - }); setState(ViewState.Idle); } } + void setLabResultDependOnFilterName(){ + _labsService.labResultList.forEach((element) { + List patientLabOrdersClinic = labResultLists + .where( + (elementClinic) => elementClinic.filterName == element.testCode) + .toList(); + + if (patientLabOrdersClinic.length != 0) { + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] + .patientLabResultList + .add(element); + } else { + labResultLists + .add(LabResultList(filterName: element.testCode, lab: element)); + } + }); + } + getPatientLabOrdersResults( {PatientLabOrders patientLabOrder, String procedure, diff --git a/lib/core/viewModel/livecare_view_model.dart b/lib/core/viewModel/livecare_view_model.dart index f6ef42e7..de586e1e 100644 --- a/lib/core/viewModel/livecare_view_model.dart +++ b/lib/core/viewModel/livecare_view_model.dart @@ -66,7 +66,7 @@ class LiveCareViewModel with ChangeNotifier { newRequest.docSpec = profile["DoctorTitleForProfile"]; newRequest.generalid = 'Cs2020@2016\$2958'; isFinished = false; - await baseAppClient.post(START_LIVECARE_CALL, + await baseAppClient.post(START_LIVE_CARE_CALL, onSuccess: (response, statusCode) async { isFinished = true; inCallResponse = StartCallRes.fromJson(response); diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index d49b8cc3..8ccf1a70 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/medicine_service.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/procedure/procedure_service.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; @@ -11,9 +13,12 @@ import '../../locator.dart'; import 'base_view_model.dart'; class MedicineViewModel extends BaseViewModel { + bool hasError = false; MedicineService _medicineService = locator(); + ProcedureService _procedureService = locator(); PrescriptionService _prescriptionService = locator(); - + List get procedureTemplate => _procedureService.templateList; + List templateList = List(); get pharmacyItemsList => _medicineService.pharmacyItemsList; get searchText => _medicineService.searchText; get pharmaciesList => _medicineService.pharmaciesList; @@ -27,20 +32,15 @@ class MedicineViewModel extends BaseViewModel { get medicationFrequencyList => _prescriptionService.medicationFrequencyList; get boxQuintity => _prescriptionService.boxQuantity; - get medicationIndicationsList => - _prescriptionService.medicationIndicationsList; + get medicationIndicationsList => _prescriptionService.medicationIndicationsList; get medicationDoseTimeList => _prescriptionService.medicationDoseTimeList; - List get patientAssessmentList => - _prescriptionService.patientAssessmentList; + List get patientAssessmentList => _prescriptionService.patientAssessmentList; - List get allMedicationList => - _prescriptionService.allMedicationList; + List get allMedicationList => _prescriptionService.allMedicationList; List get itemMedicineList => _prescriptionService.itemMedicineList; - List get itemMedicineListRoute => - _prescriptionService.itemMedicineListRoute; - List get itemMedicineListUnit => - _prescriptionService.itemMedicineListUnit; + List get itemMedicineListRoute => _prescriptionService.itemMedicineListRoute; + List get itemMedicineListUnit => _prescriptionService.itemMedicineListUnit; Future getItem({int itemID}) async { //hasError = false; @@ -54,6 +54,35 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } + setTemplateListDependOnId() { + procedureTemplate.forEach((element) { + List templateListData = + templateList.where((elementTemplate) => elementTemplate.templateId == element.templateID).toList(); + + if (templateListData.length != 0) { + templateList[templateList.indexOf(templateListData[0])].procedureTemplate.add(element); + } else { + var template = ProcedureTempleteDetailsModelList( + templateName: element.templateName, templateId: element.templateID, template: element); + if (!templateList.contains(template)) templateList.add(template); + } + }); + print(templateList.length.toString()); + } + + Future getProcedureTemplate({String categoryID}) async { + hasError = false; + setState(ViewState.Busy); + await _procedureService.getProcedureTemplate(categoryID: categoryID); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else { + setTemplateListDependOnId(); + setState(ViewState.Idle); + } + } + Future getPrescription({int mrn}) async { //hasError = false; //_insuranceCardService.clearInsuranceCard(); @@ -86,8 +115,7 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientAssessment( - GetAssessmentReqModel getAssessmentReqModel) async { + Future getPatientAssessment(GetAssessmentReqModel getAssessmentReqModel) async { setState(ViewState.Busy); await _prescriptionService.getPatientAssessment(getAssessmentReqModel); if (_prescriptionService.hasError) { @@ -99,8 +127,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationStrength() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationStrength); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationStrength); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -110,8 +137,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationRoute() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationRoute); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationRoute); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -121,8 +147,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationIndications() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationIndications); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationIndications); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -132,8 +157,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationDoseTime() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationDoseTime); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationDoseTime); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -143,8 +167,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationFrequency() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationFrequency); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationFrequency); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -154,8 +177,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationDuration() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationDuration); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationDuration); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -163,8 +185,7 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getBoxQuantity( - {int itemCode, int duration, double strength, int freq}) async { + Future getBoxQuantity({int itemCode, int duration, double strength, int freq}) async { setState(ViewState.Busy); await _prescriptionService.calculateBoxQuantity( strength: strength, itemCode: itemCode, duration: duration, freq: freq); diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index a414c200..4240e848 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/referral/DischargeReferralPatient.dart'; import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; +import 'package:doctor_app_flutter/core/model/referral/add_referred_remarks_request.dart'; import 'package:doctor_app_flutter/core/service/patient/DischargedPatientService.dart'; import 'package:doctor_app_flutter/core/service/patient/MyReferralPatientService.dart'; import 'package:doctor_app_flutter/core/service/patient/ReferralService.dart'; @@ -18,16 +19,14 @@ import 'package:flutter/cupertino.dart'; import '../../locator.dart'; class PatientReferralViewModel extends BaseViewModel { - PatientReferralService _referralPatientService = - locator(); + PatientReferralService _referralPatientService = locator(); ReferralService _referralService = locator(); - MyReferralInPatientService _myReferralService = - locator(); + MyReferralInPatientService _myReferralService = locator(); + + DischargedPatientService _dischargedPatientService = locator(); - DischargedPatientService _dischargedPatientService = - locator(); List get myDischargeReferralPatient => _dischargedPatientService.myDischargeReferralPatients; @@ -35,28 +34,21 @@ class PatientReferralViewModel extends BaseViewModel { List get clinicsList => _referralPatientService.clinicsList; - List get referralFrequencyList => - _referralPatientService.frequencyList; + List get referralFrequencyList => _referralPatientService.frequencyList; List doctorsList = []; - List get clinicDoctorsList => - _referralPatientService.doctorsList; + List get clinicDoctorsList => _referralPatientService.doctorsList; - List get myReferralPatients => - _myReferralService.myReferralPatients; + List get myReferralPatients => _myReferralService.myReferralPatients; - List get listMyReferredPatientModel => - _referralPatientService.listMyReferredPatientModel; + List get listMyReferredPatientModel => _referralPatientService.listMyReferredPatientModel; - List get pendingReferral => - _referralPatientService.pendingReferralList; + List get pendingReferral => _referralPatientService.pendingReferralList; - List get patientReferral => - _referralPatientService.patientReferralList; + List get patientReferral => _referralPatientService.patientReferralList; - List get patientArrivalList => - _referralPatientService.patientArrivalList; + List get patientArrivalList => _referralPatientService.patientArrivalList; Future getPatientReferral(PatiantInformtion patient) async { setState(ViewState.Busy); @@ -105,8 +97,7 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getClinicDoctors( - PatiantInformtion patient, int clinicId, int branchId) async { + Future getClinicDoctors(PatiantInformtion patient, int clinicId, int branchId) async { setState(ViewState.BusyLocal); await _referralPatientService.getDoctorsList(patient, clinicId, branchId); if (_referralPatientService.hasError) { @@ -124,17 +115,17 @@ class PatientReferralViewModel extends BaseViewModel { Future getDoctorBranch() async { DoctorProfileModel doctorProfile = await getDoctorProfile(); if (doctorProfile != null) { - dynamic _selectedBranch = { - "facilityId": doctorProfile.projectID, - "facilityName": doctorProfile.projectName - }; + dynamic _selectedBranch = {"facilityId": doctorProfile.projectID, "facilityName": doctorProfile.projectName}; return _selectedBranch; } return null; } - Future getMyReferredPatient() async { - setState(ViewState.Busy); + Future getMyReferredPatient({bool isFirstTime = true}) async { + if (isFirstTime) + setState(ViewState.Busy); + else + setState(ViewState.BusyLocal); await _referralPatientService.getMyReferredPatient(); if (_referralPatientService.hasError) { error = _referralPatientService.error; @@ -143,6 +134,19 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getMyReferredOutPatient({bool isFirstTime = true}) async { + if (isFirstTime) + setState(ViewState.Busy); + else + setState(ViewState.BusyLocal); + await _referralPatientService.getMyReferredOutPatient(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + MyReferredPatientModel getReferredPatientItem(int index) { return listMyReferredPatientModel[index]; } @@ -157,18 +161,39 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getMyReferralPatientService() async { - setState(ViewState.Busy); + Future getMyReferralPatientService({bool localBusy = false}) async { + if (localBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); await _myReferralService.getMyReferralPatientService(); if (_myReferralService.hasError) { error = _myReferralService.error; - setState(ViewState.Error); + if (localBusy) + setState(ViewState.ErrorLocal); + else + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMyReferralOutPatientService({bool localBusy = false}) async { + if (localBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); + await _myReferralService.getMyReferralOutPatientService(); + if (_myReferralService.hasError) { + error = _myReferralService.error; + if (localBusy) + setState(ViewState.ErrorLocal); + else + setState(ViewState.Error); } else setState(ViewState.Idle); } - Future replay( - String referredDoctorRemarks, MyReferralPatientModel referral) async { + Future replay(String referredDoctorRemarks, MyReferralPatientModel referral) async { setState(ViewState.Busy); await _myReferralService.replay(referredDoctorRemarks, referral); if (_myReferralService.hasError) { @@ -178,10 +203,9 @@ class PatientReferralViewModel extends BaseViewModel { getMyReferralPatientService(); } - Future responseReferral( - PendingReferral pendingReferral, bool isAccepted) async { + Future responseReferral(MyReferralPatientModel referralPatient, bool isAccepted) async { setState(ViewState.Busy); - await _referralPatientService.responseReferral(pendingReferral, isAccepted); + await _referralPatientService.responseReferral(referralPatient, isAccepted); if (_referralPatientService.hasError) { error = _referralPatientService.error; setState(ViewState.ErrorLocal); @@ -189,11 +213,10 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future makeReferral(PatiantInformtion patient, String isoStringDate, - int projectID, int clinicID, int doctorID, String remarks) async { + Future makeReferral(PatiantInformtion patient, String isoStringDate, int projectID, int clinicID, int doctorID, + String remarks) async { setState(ViewState.Busy); - await _referralPatientService.makeReferral( - patient, isoStringDate, projectID, clinicID, doctorID, remarks); + await _referralPatientService.makeReferral(patient, isoStringDate, projectID, clinicID, doctorID, remarks); if (_referralPatientService.hasError) { error = _referralPatientService.error; setState(ViewState.Error); @@ -217,7 +240,7 @@ class PatientReferralViewModel extends BaseViewModel { patientID: patient.patientId, roomID: patient.roomId, referralClinic: clinicID, - admissionNo: patient.appointmentNo, + admissionNo: int.parse(patient.admissionNo), referralDoctor: doctorID, patientTypeID: patient.patientType, referringDoctorRemarks: remarks, @@ -233,12 +256,10 @@ class PatientReferralViewModel extends BaseViewModel { } } - Future getPatientDetails( - String fromDate, String toDate, int patientMrn, int appointmentNo) async { + Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async { setState(ViewState.Busy); - await _referralPatientService.getPatientArrivalList(toDate, - fromDate: fromDate, patientMrn: patientMrn); + await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn); if (_referralPatientService.hasError) { error = _referralPatientService.error; setState(ViewState.Error); @@ -257,8 +278,7 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future verifyReferralDoctorRemarks( - MyReferredPatientModel referredPatient) async { + Future verifyReferralDoctorRemarks(MyReferredPatientModel referredPatient) async { setState(ViewState.Busy); await _referralPatientService.verifyReferralDoctorRemarks(referredPatient); if (_referralPatientService.hasError) { @@ -283,13 +303,13 @@ class PatientReferralViewModel extends BaseViewModel { String getReferralStatusNameByCode(int statusCode, BuildContext context) { switch (statusCode) { case 1: - return TranslationBase.of(context).pending /*referralStatusHold*/; + return TranslationBase.of(context).referralStatusHold /*pending*/; case 2: - return TranslationBase.of(context).accepted /*referralStatusActive*/; + return TranslationBase.of(context).referralStatusActive /* accepted*/; case 4: - return TranslationBase.of(context).rejected /*referralStatusCancelled*/; + return TranslationBase.of(context).referralStatusCancelled /*rejected*/; case 46: - return TranslationBase.of(context).accepted /*referralStatusCompleted*/; + return TranslationBase.of(context).referralStatusCompleted /*accepted*/; case 63: return TranslationBase.of(context).rejected /*referralStatusNotSeen*/; default: @@ -297,12 +317,12 @@ class PatientReferralViewModel extends BaseViewModel { } } - PatiantInformtion getPatientFromReferral( - MyReferredPatientModel referredPatient) { + PatiantInformtion getPatientFromReferral(MyReferredPatientModel referredPatient) { PatiantInformtion patient = PatiantInformtion(); patient.doctorId = referredPatient.doctorID; patient.doctorName = referredPatient.doctorName; patient.patientId = referredPatient.patientID; + patient.patientMRN = referredPatient.patientID; patient.firstName = referredPatient.firstName; patient.middleName = referredPatient.middleName; patient.lastName = referredPatient.lastName; @@ -320,11 +340,12 @@ class PatientReferralViewModel extends BaseViewModel { patient.nationalityFlagURL = referredPatient.nationalityFlagURL; patient.age = referredPatient.age; patient.clinicDescription = referredPatient.clinicDescription; + patient.appointmentNo = referredPatient.appointmentNo; + return patient; } - PatiantInformtion getPatientFromReferralO( - MyReferralPatientModel referredPatient) { + PatiantInformtion getPatientFromReferralO(MyReferralPatientModel referredPatient) { PatiantInformtion patient = PatiantInformtion(); patient.doctorId = referredPatient.doctorID; patient.doctorName = referredPatient.doctorName; @@ -349,8 +370,7 @@ class PatientReferralViewModel extends BaseViewModel { return patient; } - PatiantInformtion getPatientFromDischargeReferralPatient( - DischargeReferralPatient referredPatient) { + PatiantInformtion getPatientFromDischargeReferralPatient(DischargeReferralPatient referredPatient) { PatiantInformtion patient = PatiantInformtion(); patient.doctorId = referredPatient.doctorID; patient.doctorName = referredPatient.doctorName; @@ -369,10 +389,19 @@ class PatientReferralViewModel extends BaseViewModel { patient.roomId = referredPatient.roomID; patient.bedId = referredPatient.bedID; patient.nationalityName = referredPatient.nationalityName; - patient.nationalityFlagURL = - ''; // TODO from backend referredPatient.nationalityFlagURL; + patient.nationalityFlagURL = ''; // TODO from backend referredPatient.nationalityFlagURL; patient.age = referredPatient.age; patient.clinicDescription = referredPatient.clinicDescription; return patient; } + + Future replayReferred(String referredDoctorRemarks, MyReferralPatientModel referral, int referralStatus) async { + setState(ViewState.Busy); + await _myReferralService.replayReferred(referredDoctorRemarks, referral, referralStatus); + if (_myReferralService.hasError) { + error = _myReferralService.error; + setState(ViewState.ErrorLocal); + } else + getMyReferralPatientService(); + } } diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index de40afde..5bc6250f 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -2,9 +2,11 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/patient/patient_service.dart'; import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; @@ -17,51 +19,43 @@ import 'base_view_model.dart'; class PatientViewModel extends BaseViewModel { PatientService _patientService = locator(); - List get patientVitalSignList => - _patientService.patientVitalSignList; + List get inPatientList => _patientService.inPatientList; - List get patientVitalSignOrderdSubList => - _patientService.patientVitalSignOrderdSubList; + List get patientVitalSignList => _patientService.patientVitalSignList; - List get patientLabResultOrdersList => - _patientService.patientLabResultOrdersList; + List get patientVitalSignOrderdSubList => _patientService.patientVitalSignOrderdSubList; - List get patientPrescriptionsList => - _patientService.patientPrescriptionsList; + List get patientLabResultOrdersList => _patientService.patientLabResultOrdersList; + + List get patientPrescriptionsList => _patientService.patientPrescriptionsList; List get prescriptionReportForInPatientList => _patientService.prescriptionReportForInPatientList; - List get prescriptionReport => - _patientService.prescriptionReport; + List get prescriptionReport => _patientService.prescriptionReport; - List get patientRadiologyList => - _patientService.patientRadiologyList; + List get patientRadiologyList => _patientService.patientRadiologyList; List get labResultList => _patientService.labResultList; get insuranceApporvalsList => _patientService.insuranceApporvalsList; - List get patientProgressNoteList => - _patientService.patientProgressNoteList; + List get patientProgressNoteList => _patientService.patientProgressNoteList; List get clinicsList => _patientService.clinicsList; List get doctorsList => _patientService.doctorsList; - List get referralFrequencyList => - _patientService.referalFrequancyList; + List get referralFrequencyList => _patientService.referalFrequancyList; - Future getPatientList(patient, patientType, - {bool isBusyLocal = false, isView}) async { + Future getPatientList(patient, patientType, {bool isBusyLocal = false, isView}) async { var localRes; if (isBusyLocal) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - localRes = await _patientService.getPatientList(patient, patientType, - isView: isView); + localRes = await _patientService.getPatientList(patient, patientType, isView: isView); if (_patientService.hasError) { error = _patientService.error; @@ -210,16 +204,12 @@ class PatientViewModel extends BaseViewModel { } List getDoctorNameList() { - var doctorNamelist = _patientService.doctorsList - .map((value) => value['DoctorName'].toString()) - .toList(); + var doctorNamelist = _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList(); return doctorNamelist; } List getClinicNameList() { - var clinicsNameslist = _patientService.clinicsList - .map((value) => value['ClinicDescription'].toString()) - .toList(); + var clinicsNameslist = _patientService.clinicsList.map((value) => value['ClinicDescription'].toString()).toList(); return clinicsNameslist; } @@ -234,9 +224,8 @@ class PatientViewModel extends BaseViewModel { } List getReferralNamesList() { - var referralNamesList = _patientService.referalFrequancyList - .map((value) => value['Description'].toString()) - .toList(); + var referralNamesList = + _patientService.referalFrequancyList.map((value) => value['Description'].toString()).toList(); return referralNamesList; } @@ -281,4 +270,18 @@ class PatientViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async { + await getDoctorProfile(); + setState(ViewState.Busy); + + await _patientService.getInPatient(requestModel, false); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.ErrorLocal); + } else { + // setDefaultInPatientList(); + setState(ViewState.Idle); + } + } } diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 32a40e7e..fb96a61a 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -4,9 +4,11 @@ import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; +import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; @@ -17,43 +19,52 @@ import 'package:doctor_app_flutter/core/service/patient_medical_file/radiology/r import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' + as cpe; class ProcedureViewModel extends BaseViewModel { + //TODO Hussam clean it FilterType filterType = FilterType.Clinic; bool hasError = false; ProcedureService _procedureService = locator(); - List get procedureList => - _procedureService.procedureList; - List get valadteProcedureList => - _procedureService.valadteProcedureList; - List get categoriesList => - _procedureService.categoriesList; + + List get procedureList => _procedureService.procedureList; + + List get valadteProcedureList => _procedureService.valadteProcedureList; + + List get categoriesList => _procedureService.categoriesList; + List get categoryList => _procedureService.categoryList; RadiologyService _radiologyService = locator(); LabsService _labsService = locator(); List _finalRadiologyListClinic = List(); List _finalRadiologyListHospital = List(); + List get finalRadiologyList => - filterType == FilterType.Clinic - ? _finalRadiologyListClinic - : _finalRadiologyListHospital; + filterType == FilterType.Clinic ? _finalRadiologyListClinic : _finalRadiologyListHospital; + + List get radiologyList => _radiologyService.finalRadiologyList; - List get radiologyList => - _radiologyService.finalRadiologyList; + List get patientLabOrdersList => _labsService.patientLabOrdersList; - List get patientLabOrdersList => - _labsService.patientLabOrdersList; + List get labOrdersResultsList => _labsService.labOrdersResultsList; - List get labOrdersResultsList => - _labsService.labOrdersResultsList; + List get procedureTemplate => _procedureService.templateList; + List templateList = List(); + + List get procedureTemplateDetails => _procedureService.templateDetailsList; List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); Future getProcedure({int mrn, String patientType}) async { hasError = false; + await getDoctorProfile(); + //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); await _procedureService.getProcedure(mrn: mrn); @@ -67,12 +78,15 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureCategory({String categoryName, String categoryID}) async { + Future getProcedureCategory( + {String categoryName, String categoryID, patientId}) async { + if (categoryName == null) return; hasError = false; - //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); await _procedureService.getProcedureCategory( - categoryName: categoryName, categoryID: categoryID); + categoryName: categoryName, + categoryID: categoryID, + patientId: patientId); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -92,8 +106,51 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postProcedure( - PostProcedureReqModel postProcedureReqModel, int mrn) async { + Future getProcedureTemplate({String categoryID}) async { + hasError = false; + setState(ViewState.Busy); + await _procedureService.getProcedureTemplate(categoryID: categoryID); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else { + setTemplateListDependOnId(); + setState(ViewState.Idle); + } + } + + setTemplateListDependOnId() { + procedureTemplate.forEach((element) { + List templateListData = + templateList.where((elementTemplate) => elementTemplate.templateId == element.templateID).toList(); + + if (templateListData.length != 0) { + templateList[templateList.indexOf(templateListData[0])].procedureTemplate.add(element); + } else { + var template = ProcedureTempleteDetailsModelList( + templateName: element.templateName, templateId: element.templateID, template: element); + if (!templateList.contains(template)) templateList.add(template); + } + }); + print(templateList.length.toString()); + } + + int tempId = 0; + + Future getProcedureTemplateDetails({int templateId}) async { + tempId = templateId; + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.BusyLocal); + await _procedureService.getProcedureTemplateDetails(templateId: templateId); + if (_procedureService.hasError) { + error = _procedureService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postProcedure(PostProcedureReqModel postProcedureReqModel, int mrn) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -107,8 +164,7 @@ class ProcedureViewModel extends BaseViewModel { } } - Future valadteProcedure( - ProcedureValadteRequestModel procedureValadteRequestModel) async { + Future valadteProcedure(ProcedureValadteRequestModel procedureValadteRequestModel) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -121,9 +177,7 @@ class ProcedureViewModel extends BaseViewModel { } } - Future updateProcedure( - {UpdateProcedureRequestModel updateProcedureRequestModel, - int mrn}) async { + Future updateProcedure({UpdateProcedureRequestModel updateProcedureRequestModel, int mrn}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -136,11 +190,9 @@ class ProcedureViewModel extends BaseViewModel { //await getProcedure(mrn: mrn); } - void getPatientRadOrders(PatiantInformtion patient, - {String patientType, bool isInPatient = false}) async { + void getPatientRadOrders(PatiantInformtion patient, {String patientType, bool isInPatient = false}) async { setState(ViewState.Busy); - await _radiologyService.getPatientRadOrders(patient, - isInPatient: isInPatient); + await _radiologyService.getPatientRadOrders(patient, isInPatient: isInPatient); if (_radiologyService.hasError) { error = _radiologyService.error; if (patientType == "7") @@ -149,39 +201,32 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else { _radiologyService.finalRadiologyList.forEach((element) { - List finalRadiologyListClinic = - _finalRadiologyListClinic - .where((elementClinic) => - elementClinic.filterName == element.clinicDescription) - .toList(); + List finalRadiologyListClinic = _finalRadiologyListClinic + .where((elementClinic) => elementClinic.filterName == element.clinicDescription) + .toList(); if (finalRadiologyListClinic.length != 0) { - _finalRadiologyListClinic[ - finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])] + _finalRadiologyListClinic[finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])] .finalRadiologyList .add(element); } else { - _finalRadiologyListClinic.add(FinalRadiologyList( - filterName: element.clinicDescription, finalRadiology: element)); + _finalRadiologyListClinic + .add(FinalRadiologyList(filterName: element.clinicDescription, finalRadiology: element)); } // FinalRadiologyList list sort via project - List finalRadiologyListHospital = - _finalRadiologyListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List finalRadiologyListHospital = _finalRadiologyListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); if (finalRadiologyListHospital.length != 0) { - _finalRadiologyListHospital[finalRadiologyListHospital - .indexOf(finalRadiologyListHospital[0])] + _finalRadiologyListHospital[finalRadiologyListHospital.indexOf(finalRadiologyListHospital[0])] .finalRadiologyList .add(element); } else { - _finalRadiologyListHospital.add(FinalRadiologyList( - filterName: element.projectName, finalRadiology: element)); + _finalRadiologyListHospital.add(FinalRadiologyList(filterName: element.projectName, finalRadiology: element)); } }); @@ -191,17 +236,10 @@ class ProcedureViewModel extends BaseViewModel { String get radImageURL => _radiologyService.url; - getRadImageURL( - {int invoiceNo, - int lineItem, - int projectId, - @required PatiantInformtion patient}) async { + getRadImageURL({int invoiceNo, int lineItem, int projectId, @required PatiantInformtion patient}) async { setState(ViewState.Busy); await _radiologyService.getRadImageURL( - invoiceNo: invoiceNo, - lineItem: lineItem, - projectId: projectId, - patient: patient); + invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, patient: patient); if (_radiologyService.hasError) { error = _radiologyService.error; setState(ViewState.Error); @@ -214,8 +252,7 @@ class ProcedureViewModel extends BaseViewModel { notifyListeners(); } - List get patientLabSpecialResult => - _labsService.patientLabSpecialResult; + List get patientLabSpecialResult => _labsService.patientLabSpecialResult; List get labResultList => _labsService.labResultList; @@ -237,18 +274,10 @@ class ProcedureViewModel extends BaseViewModel { } getLaboratoryResult( - {String projectID, - int clinicID, - String invoiceNo, - String orderNo, - PatiantInformtion patient}) async { + {String projectID, int clinicID, String invoiceNo, String orderNo, PatiantInformtion patient}) async { setState(ViewState.Busy); await _labsService.getLaboratoryResult( - invoiceNo: invoiceNo, - orderNo: orderNo, - projectID: projectID, - clinicID: clinicID, - patient: patient); + invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID, patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -257,51 +286,10 @@ class ProcedureViewModel extends BaseViewModel { } } - getPatientLabResult( - {PatientLabOrders patientLabOrder, PatiantInformtion patient}) async { - setState(ViewState.Busy); - await _labsService.getPatientLabResult( - patientLabOrder: patientLabOrder, patient: patient); - if (_labsService.hasError) { - error = _labsService.error; - setState(ViewState.Error); - } else { - _labsService.labResultList.forEach((element) { - List patientLabOrdersClinic = labResultLists - .where( - (elementClinic) => elementClinic.filterName == element.testCode) - .toList(); - - if (patientLabOrdersClinic.length != 0) { - var value = - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] - .patientLabResultList - .where((e) => - e.sampleCollectedOn == element.sampleCollectedOn && - e.resultValue == element.resultValue) - .toList(); - if (value.isEmpty) - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] - .patientLabResultList - .add(element); - } else { - labResultLists - .add(LabResultList(filterName: element.testCode, lab: element)); - } - }); - setState(ViewState.Idle); - } - } - - getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, - String procedure, - PatiantInformtion patient}) async { + getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure, PatiantInformtion patient}) async { setState(ViewState.Busy); await _labsService.getPatientLabOrdersResults( - patientLabOrder: patientLabOrder, - procedure: procedure, - patient: patient); + patientLabOrder: patientLabOrder, procedure: procedure, patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -309,9 +297,8 @@ class ProcedureViewModel extends BaseViewModel { bool isShouldClear = false; if (_labsService.labOrdersResultsList.length == 1) { labOrdersResultsList.forEach((element) { - if (element.resultValue.contains('/') || - element.resultValue.contains('*') || - element.resultValue.isEmpty) isShouldClear = true; + if (element.resultValue.contains('/') || element.resultValue.contains('*') || element.resultValue.isEmpty) + isShouldClear = true; }); } if (isShouldClear) _labsService.labOrdersResultsList.clear(); @@ -326,4 +313,70 @@ class ProcedureViewModel extends BaseViewModel { } else DrAppToastMsg.showSuccesToast(mes); } + + Future preparePostProcedure( + {String remarks, + String orderType, + PatiantInformtion patient, + List entityList, + ProcedureType procedureType}) async { + PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + ProcedureValadteRequestModel procedureValadteRequestModel = + new ProcedureValadteRequestModel(); + procedureValadteRequestModel.patientMRN = patient.patientMRN; + procedureValadteRequestModel.episodeID = patient.episodeNo; + procedureValadteRequestModel.appointmentNo = patient.appointmentNo; + + List controlsProcedure = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + entityList.forEach((element) { + procedureValadteRequestModel.procedure = [element.procedureId]; + List controls = List(); + controls.add( + Controls( + code: "remarks", + controlValue: element.remarks != null ? element.remarks : ""), + ); + controls.add( + Controls( + code: "ordertype", + controlValue: procedureType == ProcedureType.PROCEDURE + ? element.type ?? "1" + : "0"), + ); + controlsProcedure.add(Procedures( + category: element.categoryID, + procedure: element.procedureId, + controls: controls)); + }); + + postProcedureReqModel.procedures = controlsProcedure; + await valadteProcedure(procedureValadteRequestModel); + if (state == ViewState.Idle) { + if (valadteProcedureList[0].entityList.length == 0) { + await postProcedure(postProcedureReqModel, patient.patientMRN); + + if (state == ViewState.ErrorLocal) { + Helpers.showErrorToast(error); + getProcedure(mrn: patient.patientMRN); + } else if (state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); + } + } else { + if (state == ViewState.ErrorLocal) { + Helpers.showErrorToast(error); + getProcedure(mrn: patient.patientMRN); + } else if (state == ViewState.Idle) { + Helpers.showErrorToast( + valadteProcedureList[0].entityList[0].warringMessages); + } + } + } else { + Helpers.showErrorToast(error); + } + } } diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index 97974a04..e7b7a80f 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -4,15 +4,15 @@ import 'package:connectivity/connectivity.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; import 'package:provider/provider.dart'; +import 'authentication_view_model.dart'; + Helpers helpers = Helpers(); class ProjectViewModel with ChangeNotifier { @@ -24,7 +24,6 @@ class ProjectViewModel with ChangeNotifier { List doctorClinicsList = []; bool isLoading = false; bool isError = false; - bool isLogin = false; String error = ''; BaseAppClient baseAppClient = BaseAppClient(); @@ -108,27 +107,17 @@ class ProjectViewModel with ChangeNotifier { return Future.value(localRes); } catch (error) { - print(error); - throw error; + //print(error); + //throw error; } } void getProfile() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: doctorProfile.doctorID, - clinicID: doctorProfile.clinicID, - license: true, - projectID: doctorProfile.projectID, - ); - - Provider.of(AppGlobal.CONTEX, listen: false) - .getDocProfiles(docInfo.toJson()) - .then((res) async { - sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); - }).catchError((err) { - print(err); - }); + ClinicModel clinicModel = ClinicModel(doctorID:doctorProfile.doctorID,clinicID: doctorProfile.clinicID, projectID: doctorProfile.projectID,); + + await Provider.of(AppGlobal.CONTEX, listen: false) + .getDoctorProfileBasedOnClinic(clinicModel); } } diff --git a/lib/core/viewModel/referred_view_model.dart b/lib/core/viewModel/referred_view_model.dart deleted file mode 100644 index 173aa60a..00000000 --- a/lib/core/viewModel/referred_view_model.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/service/patient/referred_patient_service.dart'; -import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; - -import '../../locator.dart'; -import 'base_view_model.dart'; - -class ReferredPatientViewModel extends BaseViewModel { - ReferredPatientService _referralPatientService = - locator(); - - List get listMyReferredPatientModel => - _referralPatientService.listMyReferredPatientModel; - - Future getMyReferredPatient() async { - setState(ViewState.Busy); - await _referralPatientService.getMyReferredPatient(); - if (_referralPatientService.hasError) { - error = _referralPatientService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } -} diff --git a/lib/core/viewModel/scan_qr_view_model.dart b/lib/core/viewModel/scan_qr_view_model.dart new file mode 100644 index 00000000..b49078c7 --- /dev/null +++ b/lib/core/viewModel/scan_qr_view_model.dart @@ -0,0 +1,26 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; +import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class ScanQrViewModel extends BaseViewModel { + ScanQrService _scanQrService = locator(); + List get inPatientList => _scanQrService.inPatientList; + + Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async { + await getDoctorProfile(); + setState(ViewState.Busy); + + await _scanQrService.getInPatient(requestModel, isMyInpatient); + if (_scanQrService.hasError) { + error = _scanQrService.error; + + setState(ViewState.ErrorLocal); + } else { + // setDefaultInPatientList(); + setState(ViewState.Idle); + } + } +} diff --git a/lib/icons_app/config.json b/lib/icons_app/config.json index a5f1b893..20885d74 100644 --- a/lib/icons_app/config.json +++ b/lib/icons_app/config.json @@ -2513,9 +2513,9 @@ { "uid": "fbbe1c278b442a4840b03064fe4a2ea4", "css": "respiration-rate-1", - "code": 59499, + "code": 59510, "src": "custom_icons", - "selected": false, + "selected": true, "svg": { "path": "M989.3 410.2C907.2 230.7 805.1 123.6 716.1 123.6A91.6 91.6 0 0 0 667.3 137C595.3 181.3 592 319.6 591.9 334.9 591.9 339.7 590.8 377.9 590 431.1L560.9 420.4V20.1A20.3 20.3 0 0 0 540.6-0.2H499.9A20.3 20.3 0 0 0 479.6 20.1V420.4L450.5 431.1C449.7 378 448.7 339.9 448.6 335.3 448.6 319.6 445.2 181.3 373.2 137A91.6 91.6 0 0 0 324.4 123.6C235.5 123.6 133.3 230.8 51.2 410.3-57.1 647.8 39 972 43.2 985.6A20.1 20.1 0 0 0 67.1 999.3 1776.9 1776.9 0 0 0 243.4 946.2C369.2 900.2 434.5 855.1 442.6 808.2A2836.5 2836.5 0 0 0 451.6 473.7L506.5 453.4H534.7L589.6 473.7A2835.8 2835.8 0 0 0 598.6 808.2C606.7 855.1 671.8 900.2 797.8 946.2A1778.4 1778.4 0 0 0 974.1 999.5 20.1 20.1 0 0 0 998 985.7C1001.8 972 1097.9 647.8 989.3 410.2ZM393.1 500.5L249.7 574.6V634.8L260.7 668.2 288.1 694.8A20.3 20.3 0 0 1 260.1 723.7L230.5 695.2 197 732.2A20.3 20.3 0 0 1 167.2 705.1L209.4 658.4V595.3L130.2 636.3A20.3 20.3 0 1 1 111.7 600.5L129.3 591.4 97.8 566.3A20.3 20.3 0 0 1 122.9 534.8L168.5 571.2 278.8 514.3 184.4 442.5A20.3 20.3 0 0 1 208.8 410.4L239.3 433.5 241.9 410.2A20.3 20.3 0 0 1 281.9 414.6L276.5 461.8 318.5 493.7 374.5 464.8A20.3 20.3 0 1 1 393 500.5ZM942.9 566.3L911.4 591.4 929 600.5A20.3 20.3 0 1 1 910.5 636.3L831.4 595.3V658.2L873.7 705A20.3 20.3 0 0 1 843.8 732.1L810.3 695.1 780.8 723.6A20.3 20.3 0 0 1 752.7 694.7L780.1 668.1 791.1 634.7V574.5L647.7 500.4A20.3 20.3 0 1 1 666.2 464.6L722.2 493.6 764.2 461.7 759 414.5A20.3 20.3 0 1 1 799 410L801.6 433.4 832.1 410.2A20.3 20.3 0 0 1 856.5 442.3L761.9 514 872.2 570.9 917.9 534.5A20.3 20.3 0 0 1 943 566Z", "width": 1041 @@ -2523,6 +2523,146 @@ "search": [ "respiration-rate" ] + }, + { + "uid": "002f9ea7269e8e2ca9a28d0e87f09a2c", + "css": "end-call", + "code": 59604, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M282.4 546.3L133.8 620.6A13.6 13.6 0 0 1 118.2 618L77 576.8A108.8 108.8 0 0 1 77 423 598.3 598.3 0 0 1 923.2 423.2 108.6 108.6 0 0 1 923.2 576.8L882 618A13.6 13.6 0 0 1 866.4 620.6L717.6 546.3A13.6 13.6 0 0 1 710.4 531.5L727.1 448.2A13.8 13.8 0 0 0 719.3 432.9 565.7 565.7 0 0 0 280.8 432.9 13.8 13.8 0 0 0 273 448.3L289.6 531.4A13.6 13.6 0 0 1 282.3 546.2Z", + "width": 1000 + }, + "search": [ + "end-call" + ] + }, + { + "uid": "ace119a586c0a290d5da68f59038e160", + "css": "end-consultaion", + "code": 59605, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M664.4 0H92.6A92.7 92.7 0 0 0 0 92.6V907.4A92.7 92.7 0 0 0 92.6 1000H664.3A92.7 92.7 0 0 0 756.9 907.4V92.6A92.7 92.7 0 0 0 664.4 0ZM118.7 167.8L176.4 68.5A20.8 20.8 0 1 1 212.4 89.3L173 157.2H587.9L556.4 87.4A20.8 20.8 0 1 1 594.4 70.1L639.1 169.5A20.8 20.8 0 0 1 620.1 198.9H136.8A20.8 20.8 0 0 1 118.7 167.8ZM644.6 608.6H492.4A20.8 20.8 0 0 1 472.7 594.7L458.3 554.1 423.7 813.6A20.8 20.8 0 0 1 403.7 831.6H403.1A20.8 20.8 0 0 1 382.7 814.7L312.5 452.1 266.5 606.1A20.8 20.8 0 0 1 246.6 621H112.3A20.8 20.8 0 1 1 112.3 579.5H231.1L296.8 358.9A20.8 20.8 0 0 1 337.2 360.9L399.1 681.8 428.4 463.2A20.8 20.8 0 0 1 446.8 445.3 21.3 21.3 0 0 1 468.7 459.1L507 567.1H644.5A20.8 20.8 0 1 1 644.5 608.6Z", + "width": 757 + }, + "search": [ + "end-consultaion" + ] + }, + { + "uid": "62a5ade64a871b2006d088b4e107506f", + "css": "folder-open", + "code": 59606, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1130.2 347.1A103.3 103.3 0 0 0 1027.1 244.8H565.1L102.7 246.1A103.3 103.3 0 0 0 0 349.8 17.1 17.1 0 0 0 0 352.4L89.8 898.2A103.3 103.3 0 0 0 192.8 999.9H1117.6A103.3 103.3 0 0 0 1220.7 896.8 17.1 17.1 0 0 0 1220.7 894.2ZM1269.1 113.6H814.5L724.6 6.1A16.8 16.8 0 0 0 711.3 0H344.3A103.3 103.3 0 0 0 241.2 101.7L225.3 197.9H259.5L1027.4 197.9A151.5 151.5 0 0 1 1178.1 342.7L1239.5 715.6 1254.8 807.5A102.5 102.5 0 0 0 1263.6 767.2L1371.6 220.2A16.8 16.8 0 0 0 1371.6 216.9 103.3 103.3 0 0 0 1269.1 113.6Z", + "width": 1372 + }, + "search": [ + "folder-open" + ] + }, + { + "uid": "f696b8dc00777a69a4e1e52df2955ec4", + "css": "folder", + "code": 59607, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1029 245.6H572.9L482 137.6A15.5 15.5 0 0 0 469.6 132H101.5A102.3 102.3 0 0 0 0 234.4V897.8A102.3 102.3 0 0 0 102.2 1000H1029A102.3 102.3 0 0 0 1131.2 897.8V347.7A102.3 102.3 0 0 0 1029 245.6ZM1163 113.4H706.6L615.9 5.6A15.5 15.5 0 0 0 603.5 0H235.5A102.2 102.2 0 0 0 134.5 88H470.1A59.4 59.4 0 0 1 515.7 109.2L593.2 201.2H1029A146.5 146.5 0 0 1 1175.1 347.8V867A102.2 102.2 0 0 0 1264.6 765.7V215.4A102.3 102.3 0 0 0 1163 113.4Z", + "width": 1265 + }, + "search": [ + "folder" + ] + }, + { + "uid": "e794f7865351585b57f62ec43bba8aff", + "css": "link-in", + "code": 59608, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M333.3 750L916.6 750A83.6 83.6 0 0 0 999.9 666.6V83.3A83.6 83.6 0 0 0 916.6 0L333.3 0A83.6 83.6 0 0 0 250 83.3V666.6A83.6 83.6 0 0 0 333.3 750ZM479.1 375V476.6L789.1 166.6 833.2 210.9 523.8 520.7 625.3 520.7V583.3H458.1A41.6 41.6 0 0 1 416.5 541.6V374.9ZM416.7 833.4V916.7H83.3V583.4H166.6V500H41.7A41.8 41.8 0 0 0 0 541.7V958.4A41.9 41.9 0 0 0 41.7 1000.1H458.3A41.9 41.9 0 0 0 500 958.4V833.4Z", + "width": 1000 + }, + "search": [ + "link-in" + ] + }, + { + "uid": "8cbd9cb0e30a60dbfcd1425cb5dbc06d", + "css": "link-out", + "code": 59609, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M916.7 0H333.5A83.4 83.4 0 0 0 250 83.4V666.8A83.4 83.4 0 0 0 333.5 750.2H916.8A83.4 83.4 0 0 0 1000.2 666.8V83.4A83.4 83.4 0 0 0 916.7 0ZM770.8 375V273.3L460.8 583.3 416.7 539 726.7 229.1 625.1 229.1V166.7H791.7A41.6 41.6 0 0 1 833.4 208.3L833.4 375.2ZM416.7 833.3V916.8H83.4V583.4H166.9V500H41.6A41.8 41.8 0 0 0 0 541.6V958.3A41.8 41.8 0 0 0 41.6 1000H458.4A41.8 41.8 0 0 0 500 958.3V833.3Z", + "width": 1000 + }, + "search": [ + "link-out" + ] + }, + { + "uid": "ed96dd3085af227cc96170408b84c816", + "css": "mute-microphone", + "code": 59610, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M584.7 579.6V448.4L305.8 727.3A178.5 178.5 0 0 0 584.7 579.6ZM693 472.9H657.5A20.7 20.7 0 0 0 636.8 493.6V566.3A230.7 230.7 0 0 1 276.1 756.9L221.8 811.2A302.3 302.3 0 0 0 367.6 871.6V923.1H208.8A20.7 20.7 0 0 0 188.1 943.8V979.4A20.7 20.7 0 0 0 208.8 1000H603.3A20.7 20.7 0 0 0 624 979.4V943.8A20.7 20.7 0 0 0 603.3 923.1H444.5V871.6A312.1 312.1 0 0 0 713.8 566.4V493.7A20.7 20.7 0 0 0 693 472.9ZM795.4 79.6A56.9 56.9 0 0 0 715 79.6L584.7 209.9V178.6A178.6 178.6 0 0 0 227.4 178.6V567.1L180.4 614.2A230 230 0 0 1 175.2 566.3V493.6A20.7 20.7 0 0 0 154.5 472.9H119A20.7 20.7 0 0 0 98.3 493.6V566.3A298.4 298.4 0 0 0 119.3 675.3L16.7 777.9A56.9 56.9 0 0 0 97.1 858.4L795.4 160.1A56.9 56.9 0 0 0 795.4 79.6Z", + "width": 812 + }, + "search": [ + "mute-microphone" + ] + }, + { + "uid": "7c8fce018306529b3c40386a8e946374", + "css": "no-video", + "code": 59611, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M69.3 676.7L620.8 125.2H204A135.1 135.1 0 0 0 69.3 260.4ZM1179.1 184.9A135.9 135.9 0 0 0 1052.4 172.5L926.1 225.1A129.2 129.2 0 0 0 904.5 180.5L982.5 102.6A59.9 59.9 0 1 0 897.7 17.9L17.4 898.1A59.5 59.5 0 0 0 17.6 982.4 59.8 59.8 0 0 0 102.3 982.4L210 874.9H796.2A134.6 134.6 0 0 0 926.1 775L1052.4 827.4A134.4 134.4 0 0 0 1179.1 815 134.9 134.9 0 0 0 1239.1 702.7V297.4A134.9 134.9 0 0 0 1179.1 184.9ZM1119.1 702.7A13.7 13.7 0 0 1 1112.3 715 14.6 14.6 0 0 1 1098.4 716.6L930.9 647.5V352.6L1098.2 283.5A14.6 14.6 0 0 1 1112.1 285 13.7 13.7 0 0 1 1119 297.4Z", + "width": 1239 + }, + "search": [ + "no-video" + ] + }, + { + "uid": "7be786f4ac20cbacd06a26d712accfff", + "css": "send-instruction", + "code": 59612, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M436.7 0A436.7 436.7 0 0 0 226.4 819.5L221.3 1000 427.3 873C430.4 873 433.5 873.5 436.7 873.5A436.7 436.7 0 0 0 436.7 0ZM492.4 691.3H380.4V331H492.4ZM435.7 286.9A54.7 54.7 0 0 1 377.5 231 54.7 54.7 0 0 1 436.4 174.2 56.5 56.5 0 1 1 435.6 287Z", + "width": 873 + }, + "search": [ + "send-instruction" + ] + }, + { + "uid": "926041acc7150e19895e12f7bba3d07a", + "css": "transfer-to-admin", + "code": 59613, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M202.7 517.8L148.9 463.9A52.2 52.2 0 0 1 148.9 390.3L414.1 125 342.5 53.3A31.2 31.2 0 0 1 364.6 0H635.4A31.3 31.3 0 0 1 666.7 31.2V302.1A31.2 31.2 0 0 1 613.3 324.2L541.7 252.5 276.4 517.7A52.2 52.2 0 0 1 202.8 517.7ZM302.1 1000H31.2A31.3 31.3 0 0 1 0 968.8V697.9A31.2 31.2 0 0 1 53.3 675.8L125 747.5 390.3 482.2A52.2 52.2 0 0 1 463.9 482.2L517.8 536.1A52.2 52.2 0 0 1 517.8 609.7L252.5 875 324.1 946.7A31.2 31.2 0 0 1 302 1000Z", + "width": 667 + }, + "search": [ + "transfer-to-admin" + ] } ] } \ No newline at end of file diff --git a/lib/icons_app/doctor_app_icons.dart b/lib/icons_app/doctor_app_icons.dart index 5e5ce23a..a73be2e3 100644 --- a/lib/icons_app/doctor_app_icons.dart +++ b/lib/icons_app/doctor_app_icons.dart @@ -11,374 +11,209 @@ /// fonts: /// - asset: fonts/DoctorApp.ttf /// -/// +/// /// * MFG Labs, Copyright (C) 2012 by Daniel Bruce /// Author: MFG Labs /// License: SIL (http://scripts.sil.org/OFL) /// Homepage: http://www.mfglabs.com/ /// import 'package:flutter/widgets.dart'; +import 'package:flutter/widgets.dart'; class DoctorApp { DoctorApp._(); - static const _kFontFam = 'DoctorApp'; - static const String _kFontPkg = null; + static const _kFontFam = 'DoctorApp'; + static const String _kFontPkg = null; - static const IconData female_icon = - IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male = - IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reject_icon = - IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_active = - IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon = - IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_active = - IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon = - IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_active = - IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scdedule_icon_active = - IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_icon = - IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge_patient = - IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData approved_icon = - IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData pending_icon = - IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData in_patient_white = - IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results = - IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon = - IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral_1 = - IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData progress_notes = - IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_1 = - IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData operations = - IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData out_patient = - IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient = - IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code = - IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology = - IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral = - IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male_2 = - IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_patient = - IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData female_1 = - IconData(0xe81b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_active_1 = - IconData(0xe81c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_1 = - IconData(0xe81d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData mail = - IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData medicine_search = - IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code_1 = - IconData(0xe820, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_1 = - IconData(0xe821, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referred = - IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData send = - IconData(0xe823, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sync_icon = - IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData drawer_icon = - IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData view = - IconData(0xe826, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData warning = - IconData(0xe827, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add = - IconData(0xe828, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData close = - IconData(0xe829, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData back = - IconData(0xe82a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_summary = - IconData(0xe82b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData powered_by_cs = - IconData(0xe82c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code_2 = - IconData(0xe82d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ecg = - IconData(0xe82e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData create_episode = - IconData(0xe82f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData booked = - IconData(0xe830, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData admission_req = - IconData(0xe831, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData walkin = - IconData(0xe832, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reschedule_ = - IconData(0xe833, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData edit = - IconData(0xe834, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results2 = - IconData(0xe835, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData leaves = - IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData logout = - IconData(0xe837, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData obese_bmi = - IconData(0xe838, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData livecare = - IconData(0xe839, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_bmi = - IconData(0xe83a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_bmi_r = - IconData(0xe83b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData modify_episode = - IconData(0xe83c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData height = - IconData(0xe83d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData obese_bmi_r = - IconData(0xe83e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ovrweight_bmi = - IconData(0xe83f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_prescription = - IconData(0xe840, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_procedures = - IconData(0xe841, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ovrweight_bmi_r = - IconData(0xe842, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData respiration_rate = - IconData(0xe843, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient_sick_leave = - IconData(0xe844, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData progress_notes_1 = - IconData(0xe845, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData temperature = - IconData(0xe846, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData underweight_bmi = - IconData(0xe847, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology_1 = - IconData(0xe848, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_patient_1 = - IconData(0xe849, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral_bg = - IconData(0xe84a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search = - IconData(0xe84b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_bg = - IconData(0xe84c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrival_patients = - IconData(0xe84d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrival_patients_bg = - IconData(0xe84e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData refer_patient = - IconData(0xe84f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData underweight_bmi_r = - IconData(0xe850, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData weight = - IconData(0xe851, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData blood_pressure = - IconData(0xe852, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData vital_signs = - IconData(0xe853, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ucaf = - IconData(0xe854, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData filter = - IconData(0xe855, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male_1 = - IconData(0xe856, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData female = - IconData(0xe857, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData external_link = - IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_face_2 = - IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_sms_2 = - IconData(0xe85a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home = - IconData(0xe85b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_finger_2 = - IconData(0xe85c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dr_reply_active = - IconData(0xe85d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dr_reply = - IconData(0xe85e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_active = - IconData(0xe85f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule = - IconData(0xe860, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_reader_active = - IconData(0xe861, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_reader = - IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_active = - IconData(0xe863, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrow_forward = - IconData(0xe864, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData heart_rate = - IconData(0xe865, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_active_1 = - IconData(0xe866, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_1 = - IconData(0xe867, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_active_1 = - IconData(0xe868, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scdedule_icon_active_1 = - IconData(0xe869, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ovrweight_bmi_r_1 = - IconData(0xe86a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData underweight_bmi_1 = - IconData(0xe86b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData temperature_1 = - IconData(0xe86c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData underweight_bmi_r_1 = - IconData(0xe86d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData weight_1 = - IconData(0xe86e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData blood_pressure_1 = - IconData(0xe86f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_bmi_r_1 = - IconData(0xe870, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_bmi_1 = - IconData(0xe871, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData heart_rate_1 = - IconData(0xe872, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData height_1 = - IconData(0xe873, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData obese_bmi_1 = - IconData(0xe874, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ovrweight_bmi_1 = - IconData(0xe875, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code_3 = - IconData(0xe877, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reschedule__1 = - IconData(0xe878, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData logout_1 = - IconData(0xe879, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData livecare_1 = - IconData(0xe87a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData modify_episode_1 = - IconData(0xe87b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_prescription_1 = - IconData(0xe87c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_procedures_1 = - IconData(0xe87d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient_sick_leave_1 = - IconData(0xe87e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData progress_notes_2 = - IconData(0xe87f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology_2 = - IconData(0xe880, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData refer_patient_1 = - IconData(0xe881, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ucaf_1 = - IconData(0xe882, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData vital_signs_1 = - IconData(0xe883, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData walkin_1 = - IconData(0xe884, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData admission_req_1 = - IconData(0xe885, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData booked_1 = - IconData(0xe886, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData create_episode_1 = - IconData(0xe887, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ecg_1 = - IconData(0xe888, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_summary_1 = - IconData(0xe889, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results_1 = - IconData(0xe88a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData female_2 = - IconData(0xe88b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData filter_1 = - IconData(0xe88c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male_3 = - IconData(0xe88d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_2 = - IconData(0xe88e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData send_1 = - IconData(0xe88f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData view_1 = - IconData(0xe890, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData warning_1 = - IconData(0xe891, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_1 = - IconData(0xe892, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrow_forward_1 = - IconData(0xe893, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData back_1 = - IconData(0xe894, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData close_1 = - IconData(0xe895, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData edit_1 = - IconData(0xe896, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData external_link_1 = - IconData(0xe897, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_finger_1 = - IconData(0xe898, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_sms_1 = - IconData(0xe899, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_face_1 = - IconData(0xe89a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_reader_1 = - IconData(0xe89b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_reader_active_1 = - IconData(0xe89c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_1 = - IconData(0xe89d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_active_1 = - IconData(0xe89e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dr_reply_1 = - IconData(0xe89f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dr_reply_active_1 = - IconData(0xe8a0, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_1 = - IconData(0xe8a1, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_active_1 = - IconData(0xe8a2, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_face = - IconData(0xe8a3, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_finger = - IconData(0xe8a4, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_whtsapp = - IconData(0xe8a5, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_sms = - IconData(0xe8a6, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData obese_bmi_r_1 = - IconData(0xe8a9, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData inpatient = - IconData(0xe959, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge = - IconData(0xe95a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_sheets = - IconData(0xe95b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData call = - IconData(0xe95c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData medical_report = - IconData(0xe95d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData painscale = - IconData(0xe95e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData oxygenation = - IconData(0xe95f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData speechtotext = - IconData(0xe960, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_medicines = - IconData(0xe964, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge_patients = - IconData(0xe965, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral_discharge = - IconData(0xe966, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female_icon = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reject_icon = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_active = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_active = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_active = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData scdedule_icon_active = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge_patient = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData approved_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData pending_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData in_patient_white = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData lab_results = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral_1 = IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData progress_notes = IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_1 = IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData operations = IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData out_patient = IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient = IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code = IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology = IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral = IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male_2 = IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_patient = IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female_1 = IconData(0xe81b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_active_1 = IconData(0xe81c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_1 = IconData(0xe81d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData mail = IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData medicine_search = IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code_1 = IconData(0xe820, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_1 = IconData(0xe821, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referred = IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData send = IconData(0xe823, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData sync_icon = IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData drawer_icon = IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData view = IconData(0xe826, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData warning = IconData(0xe827, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData add = IconData(0xe828, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData close = IconData(0xe829, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData back = IconData(0xe82a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_summary = IconData(0xe82b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData powered_by_cs = IconData(0xe82c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code_2 = IconData(0xe82d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ecg = IconData(0xe82e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData create_episode = IconData(0xe82f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData booked = IconData(0xe830, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData admission_req = IconData(0xe831, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData walkin = IconData(0xe832, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reschedule_ = IconData(0xe833, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData edit = IconData(0xe834, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData leaves = IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData logout = IconData(0xe837, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData obese_bmi = IconData(0xe838, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData livecare = IconData(0xe839, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_bmi = IconData(0xe83a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_bmi_r = IconData(0xe83b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData modify_episode = IconData(0xe83c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData height = IconData(0xe83d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData obese_bmi_r = IconData(0xe83e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ovrweight_bmi = IconData(0xe83f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_prescription = IconData(0xe840, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_procedures = IconData(0xe841, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ovrweight_bmi_r = IconData(0xe842, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData respiration_rate = IconData(0xe843, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient_sick_leave = IconData(0xe844, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData progress_notes_1 = IconData(0xe845, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData temperature = IconData(0xe846, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData underweight_bmi = IconData(0xe847, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology_1 = IconData(0xe848, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_patient_1 = IconData(0xe849, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral_bg = IconData(0xe84a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search = IconData(0xe84b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_bg = IconData(0xe84c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrival_patients = IconData(0xe84d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrival_patients_bg = IconData(0xe84e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData refer_patient = IconData(0xe84f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData underweight_bmi_r = IconData(0xe850, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData weight = IconData(0xe851, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData blood_pressure = IconData(0xe852, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData vital_signs = IconData(0xe853, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ucaf = IconData(0xe854, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData filter = IconData(0xe855, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male_1 = IconData(0xe856, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female = IconData(0xe857, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData external_link = IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_face_2 = IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_sms_2 = IconData(0xe85a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home = IconData(0xe85b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_finger_2 = IconData(0xe85c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData dr_reply_active = IconData(0xe85d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData dr_reply = IconData(0xe85e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_active = IconData(0xe85f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule = IconData(0xe860, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_reader_active = IconData(0xe861, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_reader = IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_active = IconData(0xe863, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrow_forward = IconData(0xe864, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData heart_rate = IconData(0xe865, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_active_1 = IconData(0xe866, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_1 = IconData(0xe867, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_active_1 = IconData(0xe868, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData scdedule_icon_active_1 = IconData(0xe869, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ovrweight_bmi_r_1 = IconData(0xe86a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData underweight_bmi_1 = IconData(0xe86b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData temperature_1 = IconData(0xe86c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData underweight_bmi_r_1 = IconData(0xe86d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData weight_1 = IconData(0xe86e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData blood_pressure_1 = IconData(0xe86f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_bmi_r_1 = IconData(0xe870, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_bmi_1 = IconData(0xe871, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData heart_rate_1 = IconData(0xe872, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData height_1 = IconData(0xe873, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData obese_bmi_1 = IconData(0xe874, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ovrweight_bmi_1 = IconData(0xe875, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData respiration_rate_1 = IconData(0xe876, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code_3 = IconData(0xe877, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reschedule__1 = IconData(0xe878, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData logout_1 = IconData(0xe879, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData livecare_1 = IconData(0xe87a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData modify_episode_1 = IconData(0xe87b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_prescription_1 = IconData(0xe87c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_procedures_1 = IconData(0xe87d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient_sick_leave_1 = IconData(0xe87e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData progress_notes_2 = IconData(0xe87f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology_2 = IconData(0xe880, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData refer_patient_1 = IconData(0xe881, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ucaf_1 = IconData(0xe882, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData vital_signs_1 = IconData(0xe883, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData walkin_1 = IconData(0xe884, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData admission_req_1 = IconData(0xe885, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData booked_1 = IconData(0xe886, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData create_episode_1 = IconData(0xe887, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ecg_1 = IconData(0xe888, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_summary_1 = IconData(0xe889, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData lab_results_1 = IconData(0xe88a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female_2 = IconData(0xe88b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData filter_1 = IconData(0xe88c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male_3 = IconData(0xe88d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_2 = IconData(0xe88e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData send_1 = IconData(0xe88f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData view_1 = IconData(0xe890, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData warning_1 = IconData(0xe891, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData add_1 = IconData(0xe892, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrow_forward_1 = IconData(0xe893, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData back_1 = IconData(0xe894, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData close_1 = IconData(0xe895, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData edit_1 = IconData(0xe896, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData external_link_1 = IconData(0xe897, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_finger_1 = IconData(0xe898, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_sms_1 = IconData(0xe899, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_face_1 = IconData(0xe89a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_reader_1 = IconData(0xe89b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_reader_active_1 = IconData(0xe89c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_1 = IconData(0xe89d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_active_1 = IconData(0xe89e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData dr_reply_1 = IconData(0xe89f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData dr_reply_active_1 = IconData(0xe8a0, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_1 = IconData(0xe8a1, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_active_1 = IconData(0xe8a2, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_face = IconData(0xe8a3, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_finger = IconData(0xe8a4, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_whtsapp = IconData(0xe8a5, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_sms = IconData(0xe8a6, fontFamily: _kFontFam, fontPackage: _kFontPkg); + /// static const IconData 124 = IconData(0xe8a7, fontFamily: _kFontFam, fontPackage: _kFontPkg); + ///static const IconData 123 = IconData(0xe8a8, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData obese_bmi_r_1 = IconData(0xe8a9, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData end_call = IconData(0xe8d4, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData end_consultaion = IconData(0xe8d5, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData folder_open = IconData(0xe8d6, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData folder = IconData(0xe8d7, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData link_in = IconData(0xe8d8, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData link_out = IconData(0xe8d9, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData mute_microphone = IconData(0xe8da, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData no_video = IconData(0xe8db, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData send_instruction = IconData(0xe8dc, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData transfer_to_admin = IconData(0xe8dd, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData inpatient = IconData(0xe959, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge = IconData(0xe95a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_sheets = IconData(0xe95b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData call = IconData(0xe95c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData medical_report = IconData(0xe95d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData painscale = IconData(0xe95e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData oxygenation = IconData(0xe95f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData speechtotext = IconData(0xe960, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_medicines = IconData(0xe964, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge_patients = IconData(0xe965, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral_discharge = IconData(0xe966, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 0e1e2c48..5bce4f71 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/screens/home/home_screen.dart'; import 'package:doctor_app_flutter/screens/qr_reader/QR_reader_screen.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/bottom_nav_bar.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/app_showcase_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -33,7 +34,7 @@ class _LandingPageState extends State { @override Widget build(BuildContext context) { - return Scaffold( + return AppScaffold( appBar: currentTab != 0 ? AppBar( elevation: 0, @@ -62,9 +63,7 @@ class _LandingPageState extends State { physics: NeverScrollableScrollPhysics(), controller: pageController, children: [ - ShowCaseWidget( - builder: Builder(builder: (context) => HomeScreen()), - ), + HomeScreen(), MyScheduleScreen(), QrReaderScreen(), DoctorReplyScreen( diff --git a/lib/locator.dart b/lib/locator.dart index 321b3ffa..d74fad8b 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,41 +1,50 @@ +import 'package:doctor_app_flutter/core/service/authentication_service.dart'; +import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; -import 'core/service/home/auth_service.dart'; +import 'core/service/NavigationService.dart'; +import 'core/service/VideoCallService.dart'; import 'core/service/home/dasboard_service.dart'; +import 'core/service/home/doctor_reply_service.dart'; +import 'core/service/home/schedule_service.dart'; +import 'core/service/hospitals/hospitals_service.dart'; import 'core/service/patient/DischargedPatientService.dart'; -import 'core/service/patient/patient_service.dart'; -import 'core/service/patient_medical_file/insurance/InsuranceCardService.dart'; +import 'core/service/patient/LiveCarePatientServices.dart'; import 'core/service/patient/MyReferralPatientService.dart'; import 'core/service/patient/PatientMuseService.dart'; import 'core/service/patient/ReferralService.dart'; +import 'core/service/patient/out_patient_service.dart'; +import 'core/service/patient/patient-doctor-referral-service.dart'; +import 'core/service/patient/patientInPatientService.dart'; +import 'core/service/patient/patient_service.dart'; +import 'core/service/patient/referral_patient_service.dart'; +import 'core/service/patient_medical_file/admission_request/patient-admission-request-service.dart'; +import 'core/service/patient_medical_file/insurance/InsuranceCardService.dart'; +import 'core/service/patient_medical_file/lab_order/labs_service.dart'; +import 'core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart'; import 'core/service/patient_medical_file/medical_report/medical_file_service.dart'; +import 'core/service/patient_medical_file/prescription/medicine_service.dart'; import 'core/service/patient_medical_file/prescription/prescription_service.dart'; +import 'core/service/patient_medical_file/prescription/prescriptions_service.dart'; import 'core/service/patient_medical_file/procedure/procedure_service.dart'; +import 'core/service/patient_medical_file/radiology/radiology_service.dart'; import 'core/service/patient_medical_file/sick_leave/sickleave_service.dart'; import 'core/service/patient_medical_file/soap/SOAP_service.dart'; -import 'core/service/home/doctor_reply_service.dart'; -import 'core/service/patient_medical_file/lab_order/labs_service.dart'; -import 'core/service/patient_medical_file/prescription/medicine_service.dart'; -import 'core/service/patient_medical_file/admission_request/patient-admission-request-service.dart'; -import 'core/service/patient/patient-doctor-referral-service.dart'; import 'core/service/patient_medical_file/ucaf/patient-ucaf-service.dart'; import 'core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart'; -import 'core/service/patient/out_patient_service.dart'; -import 'core/service/patient/patientInPatientService.dart'; -import 'core/service/patient_medical_file/prescription/prescriptions_service.dart'; -import 'core/service/patient_medical_file/radiology/radiology_service.dart'; -import 'core/service/patient/referral_patient_service.dart'; -import 'core/service/patient/referred_patient_service.dart'; -import 'core/service/home/schedule_service.dart'; +import 'core/service/special_clinics/special_clinic_service.dart'; import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart'; +import 'core/viewModel/LiveCarePatientViewModel.dart'; +import 'core/viewModel/PatientMedicalReportViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; import 'core/viewModel/PatientSearchViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; @@ -49,7 +58,6 @@ import 'core/viewModel/patient-vital-sign-viewmodel.dart'; import 'core/viewModel/prescriptions_view_model.dart'; import 'core/viewModel/radiology_view_model.dart'; import 'core/viewModel/referral_view_model.dart'; -import 'core/viewModel/referred_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; GetIt locator = GetIt.instance; @@ -60,7 +68,6 @@ void setupLocator() { locator.registerLazySingleton(() => DoctorReplyService()); locator.registerLazySingleton(() => ScheduleService()); locator.registerLazySingleton(() => ReferralPatientService()); - locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); locator.registerLazySingleton(() => DashboardService()); @@ -73,7 +80,7 @@ void setupLocator() { locator.registerLazySingleton(() => MedicalFileService()); locator.registerLazySingleton(() => AdmissionRequestService()); locator.registerLazySingleton(() => UcafService()); - locator.registerLazySingleton(() => AuthService()); + locator.registerLazySingleton(() => AuthenticationService()); locator.registerLazySingleton(() => PatientMuseService()); locator.registerLazySingleton(() => LabsService()); locator.registerLazySingleton(() => InsuranceCardService()); @@ -84,13 +91,18 @@ void setupLocator() { locator.registerLazySingleton(() => DischargedPatientService()); locator.registerLazySingleton(() => PatientInPatientService()); locator.registerLazySingleton(() => OutPatientService()); + locator.registerLazySingleton(() => HospitalsService()); + locator.registerLazySingleton(() => PatientMedicalReportService()); + locator.registerLazySingleton(() => LiveCarePatientServices()); + locator.registerLazySingleton(() => NavigationService()); + locator.registerLazySingleton(() => ScanQrService()); + locator.registerLazySingleton(() => SpecialClinicsService()); + locator.registerLazySingleton(() => VideoCallService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); - locator.registerFactory(() => IMEIViewModel()); locator.registerFactory(() => ScheduleViewModel()); locator.registerFactory(() => ReferralPatientViewModel()); - locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => DashboardViewModel()); @@ -110,4 +122,8 @@ void setupLocator() { locator.registerFactory(() => PrescriptionsViewModel()); locator.registerFactory(() => DischargedPatientViewModel()); locator.registerFactory(() => PatientSearchViewModel()); + locator.registerFactory(() => HospitalViewModel()); + locator.registerFactory(() => LiveCarePatientViewModel()); + locator.registerFactory(() => PatientMedicalReportViewModel()); + locator.registerFactory(() => ScanQrViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index 4e140920..c29429b0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,8 +11,8 @@ import 'package:provider/provider.dart'; import './config/size_config.dart'; import './routes.dart'; import 'config/config.dart'; -import 'core/viewModel/auth_view_model.dart'; -import 'core/viewModel/hospital_view_model.dart'; +import 'core/service/NavigationService.dart'; +import 'core/viewModel/authentication_view_model.dart'; import 'locator.dart'; void main() async { @@ -23,7 +23,6 @@ void main() async { } class MyApp extends StatelessWidget { - // This widget is the root of your application. @override Widget build(BuildContext context) { AppGlobal.CONTEX = context; @@ -33,10 +32,8 @@ class MyApp extends StatelessWidget { SizeConfig().init(constraints, orientation); return MultiProvider( providers: [ - ChangeNotifierProvider( - create: (context) => AuthViewModel()), - ChangeNotifierProvider( - create: (context) => HospitalViewModel()), + ChangeNotifierProvider( + create: (context) => AuthenticationViewModel()), ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), @@ -70,6 +67,7 @@ class MyApp extends StatelessWidget { dividerColor: Colors.grey[350], backgroundColor: Color.fromRGBO(255, 255, 255, 1), ), + navigatorKey: locator().navigatorKey, initialRoute: INIT_ROUTE, routes: routes, debugShowCheckedModeBanner: false, diff --git a/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart b/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart new file mode 100644 index 00000000..ec19abb0 --- /dev/null +++ b/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart @@ -0,0 +1,32 @@ +class GetSpecialClinicalCareListResponseModel { + int projectID; + int clinicID; + String clinicDescription; + String clinicDescriptionN; + bool isActive; + + GetSpecialClinicalCareListResponseModel( + {this.projectID, + this.clinicID, + this.clinicDescription, + this.clinicDescriptionN, + this.isActive}); + + GetSpecialClinicalCareListResponseModel.fromJson(Map json) { + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + isActive = json['IsActive']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['IsActive'] = this.isActive; + return data; + } +} diff --git a/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart b/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart new file mode 100644 index 00000000..287f40f1 --- /dev/null +++ b/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart @@ -0,0 +1,37 @@ +class GetSpecialClinicalCareMappingListResponseModel { + int mappingProjectID; + int clinicID; + int nursingStationID; + bool isActive; + int projectID; + String description; + + GetSpecialClinicalCareMappingListResponseModel( + {this.mappingProjectID, + this.clinicID, + this.nursingStationID, + this.isActive, + this.projectID, + this.description}); + + GetSpecialClinicalCareMappingListResponseModel.fromJson( + Map json) { + mappingProjectID = json['MappingProjectID']; + clinicID = json['ClinicID']; + nursingStationID = json['NursingStationID']; + isActive = json['IsActive']; + projectID = json['ProjectID']; + description = json['Description']; + } + + Map toJson() { + final Map data = new Map(); + data['MappingProjectID'] = this.mappingProjectID; + data['ClinicID'] = this.clinicID; + data['NursingStationID'] = this.nursingStationID; + data['IsActive'] = this.isActive; + data['ProjectID'] = this.projectID; + data['Description'] = this.description; + return data; + } +} diff --git a/lib/models/doctor/doctor_profile_model.dart b/lib/models/doctor/doctor_profile_model.dart index 17625968..c2f5b0dd 100644 --- a/lib/models/doctor/doctor_profile_model.dart +++ b/lib/models/doctor/doctor_profile_model.dart @@ -7,7 +7,7 @@ class DoctorProfileModel { Null clinicDescriptionN; Null licenseExpiry; int employmentType; - Null setupID; + dynamic setupID; int projectID; String projectName; String nationalityID; diff --git a/lib/models/livecare/start_call_req.dart b/lib/models/livecare/start_call_req.dart index 1ad04480..b3ceabb5 100644 --- a/lib/models/livecare/start_call_req.dart +++ b/lib/models/livecare/start_call_req.dart @@ -1,56 +1,56 @@ class StartCallReq { - int vCID; - bool isrecall; - String tokenID; - String generalid; + String clincName; + int clinicId; + String docSpec; + String docotrName; int doctorId; + String generalid; bool isOutKsa; + bool isrecall; String projectName; - String docotrName; - String clincName; - String docSpec; - int clinicId; + String tokenID; + int vCID; StartCallReq( - {this.vCID, - this.isrecall, - this.tokenID, - this.generalid, - this.doctorId, - this.isOutKsa, - this.projectName, - this.docotrName, - this.clincName, - this.docSpec, - this.clinicId}); + {this.clincName, + this.clinicId, + this.docSpec, + this.docotrName, + this.doctorId, + this.generalid, + this.isOutKsa, + this.isrecall, + this.projectName, + this.tokenID, + this.vCID}); StartCallReq.fromJson(Map json) { - vCID = json['VC_ID']; - isrecall = json['isrecall']; - tokenID = json['TokenID']; - generalid = json['generalid']; + clincName = json['clincName']; + clinicId = json['ClinicId']; + docSpec = json['Doc_Spec']; + docotrName = json['DocotrName']; doctorId = json['DoctorId']; + generalid = json['generalid']; isOutKsa = json['IsOutKsa']; + isrecall = json['isrecall']; projectName = json['projectName']; - docotrName = json['DocotrName']; - clincName = json['clincName']; - docSpec = json['Doc_Spec']; - clinicId = json['ClinicId']; + tokenID = json['TokenID']; + vCID = json['VC_ID']; } Map toJson() { final Map data = new Map(); - data['VC_ID'] = this.vCID; - data['isrecall'] = this.isrecall; - data['TokenID'] = this.tokenID; - data['generalid'] = this.generalid; + data['clincName'] = this.clincName; + data['ClinicId'] = this.clinicId; + data['Doc_Spec'] = this.docSpec; + data['DocotrName'] = this.docotrName; data['DoctorId'] = this.doctorId; + data['generalid'] = this.generalid; data['IsOutKsa'] = this.isOutKsa; + data['isrecall'] = this.isrecall; data['projectName'] = this.projectName; - data['DocotrName'] = this.docotrName; - data['clincName'] = this.clincName; - data['Doc_Spec'] = this.docSpec; - data['ClinicId'] = this.clinicId; + data['TokenID'] = this.tokenID; + data['VC_ID'] = this.vCID; return data; } -} +} \ No newline at end of file diff --git a/lib/models/livecare/start_call_res.dart b/lib/models/livecare/start_call_res.dart index 0566d76d..44921d5f 100644 --- a/lib/models/livecare/start_call_res.dart +++ b/lib/models/livecare/start_call_res.dart @@ -4,13 +4,18 @@ class StartCallRes { String openTokenID; bool isAuthenticated; int messageStatus; + String appointmentNo; + bool isRecording; StartCallRes( {this.result, this.openSessionID, this.openTokenID, this.isAuthenticated, - this.messageStatus}); + this.appointmentNo, + this.messageStatus, + this.isRecording = true, + }); StartCallRes.fromJson(Map json) { result = json['Result']; @@ -18,6 +23,8 @@ class StartCallRes { openTokenID = json['OpenTokenID']; isAuthenticated = json['IsAuthenticated']; messageStatus = json['MessageStatus']; + appointmentNo = json['AppointmentNo']; + isRecording = json['IsRecordedSession'] ?? false; } Map toJson() { @@ -27,6 +34,8 @@ class StartCallRes { data['OpenTokenID'] = this.openTokenID; data['IsAuthenticated'] = this.isAuthenticated; data['MessageStatus'] = this.messageStatus; + data['AppointmentNo'] = this.appointmentNo; + data['IsRecordedSession'] = this.isRecording ?? false; return data; } } diff --git a/lib/models/patient/MedicalReport/MedicalReportTemplate.dart b/lib/models/patient/MedicalReport/MedicalReportTemplate.dart new file mode 100644 index 00000000..f00e84a0 --- /dev/null +++ b/lib/models/patient/MedicalReport/MedicalReportTemplate.dart @@ -0,0 +1,60 @@ +class MedicalReportTemplate { + String setupID; + int projectID; + int templateID; + String procedureID; + int reportType; + String templateName; + String templateNameN; + String templateText; + String templateTextN; + bool isActive; + String templateTextHtml; + String templateTextNHtml; + + MedicalReportTemplate( + {this.setupID, + this.projectID, + this.templateID, + this.procedureID, + this.reportType, + this.templateName, + this.templateNameN, + this.templateText, + this.templateTextN, + this.isActive, + this.templateTextHtml, + this.templateTextNHtml}); + + MedicalReportTemplate.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + templateID = json['TemplateID']; + procedureID = json['ProcedureID']; + reportType = json['ReportType']; + templateName = json['TemplateName']; + templateNameN = json['TemplateNameN']; + templateText = json['TemplateText']; + templateTextN = json['TemplateTextN']; + isActive = json['IsActive']; + templateTextHtml = json['TemplateTextHtml']; + templateTextNHtml = json['TemplateTextNHtml']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['TemplateID'] = this.templateID; + data['ProcedureID'] = this.procedureID; + data['ReportType'] = this.reportType; + data['TemplateName'] = this.templateName; + data['TemplateNameN'] = this.templateNameN; + data['TemplateText'] = this.templateText; + data['TemplateTextN'] = this.templateTextN; + data['IsActive'] = this.isActive; + data['TemplateTextHtml'] = this.templateTextHtml; + data['TemplateTextNHtml'] = this.templateTextNHtml; + return data; + } +} diff --git a/lib/models/patient/MedicalReport/MeidcalReportModel.dart b/lib/models/patient/MedicalReport/MeidcalReportModel.dart new file mode 100644 index 00000000..74ee53a5 --- /dev/null +++ b/lib/models/patient/MedicalReport/MeidcalReportModel.dart @@ -0,0 +1,116 @@ +class MedicalReportModel { + String reportData; + String setupID; + int projectID; + String projectName; + String projectNameN; + int patientID; + String invoiceNo; + int status; + String verifiedOn; + dynamic verifiedBy; + String editedOn; + int editedBy; + int lineItemNo; + String createdOn; + int templateID; + int doctorID; + int doctorGender; + String doctorGenderDescription; + String doctorGenderDescriptionN; + String doctorImageURL; + String doctorName; + String doctorNameN; + int clinicID; + String clinicName; + String clinicNameN; + String reportDataHtml; + + MedicalReportModel( + {this.reportData, + this.setupID, + this.projectID, + this.projectName, + this.projectNameN, + this.patientID, + this.invoiceNo, + this.status, + this.verifiedOn, + this.verifiedBy, + this.editedOn, + this.editedBy, + this.lineItemNo, + this.createdOn, + this.templateID, + this.doctorID, + this.doctorGender, + this.doctorGenderDescription, + this.doctorGenderDescriptionN, + this.doctorImageURL, + this.doctorName, + this.doctorNameN, + this.clinicID, + this.clinicName, + this.clinicNameN, + this.reportDataHtml}); + + MedicalReportModel.fromJson(Map json) { + reportData = json['ReportData']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + patientID = json['PatientID']; + invoiceNo = json['InvoiceNo']; + status = json['Status']; + verifiedOn = json['VerifiedOn']; + verifiedBy = json['VerifiedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; + lineItemNo = json['LineItemNo']; + createdOn = json['CreatedOn']; + templateID = json['TemplateID']; + doctorID = json['DoctorID']; + doctorGender = json['DoctorGender']; + doctorGenderDescription = json['DoctorGenderDescription']; + doctorGenderDescriptionN = json['DoctorGenderDescriptionN']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + clinicID = json['ClinicID']; + clinicName = json['ClinicName']; + clinicNameN = json['ClinicNameN']; + reportDataHtml = json['ReportDataHtml']; + } + + Map toJson() { + final Map data = new Map(); + data['ReportData'] = this.reportData; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; + data['PatientID'] = this.patientID; + data['InvoiceNo'] = this.invoiceNo; + data['Status'] = this.status; + data['VerifiedOn'] = this.verifiedOn; + data['VerifiedBy'] = this.verifiedBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['LineItemNo'] = this.lineItemNo; + data['CreatedOn'] = this.createdOn; + data['TemplateID'] = this.templateID; + data['DoctorID'] = this.doctorID; + data['DoctorGender'] = this.doctorGender; + data['DoctorGenderDescription'] = this.doctorGenderDescription; + data['DoctorGenderDescriptionN'] = this.doctorGenderDescriptionN; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['ClinicID'] = this.clinicID; + data['ClinicName'] = this.clinicName; + data['ClinicNameN'] = this.clinicNameN; + data['ReportDataHtml'] = this.reportDataHtml; + return data; + } +} diff --git a/lib/models/patient/my_referral/my_referred_patient_model.dart b/lib/models/patient/my_referral/my_referred_patient_model.dart index 44a427f7..b353e587 100644 --- a/lib/models/patient/my_referral/my_referred_patient_model.dart +++ b/lib/models/patient/my_referral/my_referred_patient_model.dart @@ -166,8 +166,9 @@ class MyReferredPatientModel { referringDoctor = json['ReferringDoctor']; referralClinic = json['ReferralClinic']; referringClinic = json['ReferringClinic']; - referralStatus = json['ReferralStatus']; - referralDate = json['ReferralDate']; + createdOn = json['CreatedOn']; + referralStatus = json["ReferralStatus"] is String?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0 : json['ReferralStatus']; + referralDate = json['ReferralDate'] ?? createdOn; referringDoctorRemarks = json['ReferringDoctorRemarks']; referredDoctorRemarks = json['ReferredDoctorRemarks']; referralResponseOn = json['ReferralResponseOn']; @@ -179,7 +180,6 @@ class MyReferredPatientModel { appointmentDate = json['AppointmentDate']; appointmentType = json['AppointmentType']; patientMRN = json['PatientMRN']; - createdOn = json['CreatedOn']; clinicID = json['ClinicID']; nationalityID = json['NationalityID']; age = json['Age']; diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 2dec82d1..83a70b01 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -1,12 +1,24 @@ -// TODO : it have to be changed. +// TODO = it have to be changed. + +import 'package:doctor_app_flutter/util/date-utils.dart'; class PatiantInformtion { - final PatiantInformtion patientDetails; + PatiantInformtion patientDetails; int genderInt; dynamic age; String appointmentDate; - int appointmentNo; - String appointmentType; + DateTime appointmentDateWithDateTimeForm; + dynamic appointmentNo; + dynamic appointmentType; + String arrivalTime; + String arrivalTimeD; + int callStatus; + dynamic callStatusDisc; + int callTypeID; + String clientRequestID; + String clinicName; + String consoltationEnd; + String consultationNotes; int appointmentTypeId; String arrivedOn; int clinicGroupId; @@ -23,7 +35,7 @@ class PatiantInformtion { String nationality; int projectId; int clinicId; - int patientId; + dynamic patientId; String doctorName; String doctorNameN; String firstName; @@ -43,6 +55,7 @@ class PatiantInformtion { int patientMRN; String admissionNo; String admissionDate; + DateTime admissionDateWithDateTimeForm; String createdOn; String roomId; String bedId; @@ -57,147 +70,277 @@ class PatiantInformtion { String startTime; String visitType; String nationalityFlagURL; + int patientStatus; int patientStatusType; int visitTypeId; String startTimes; String dischargeDate; int status; - PatiantInformtion( - {this.patientDetails, - this.projectId, - this.clinicId, - this.doctorId, - this.patientId, - this.doctorName, - this.doctorNameN, - this.firstName, - this.middleName, - this.lastName, - this.firstNameN, - this.middleNameN, - this.lastNameN, - this.gender, - this.dateofBirth, - this.nationalityId, - this.mobileNumber, - this.emailAddress, - this.patientIdentificationNo, - this.patientType, - this.admissionNo, - this.admissionDate, - this.createdOn, - this.roomId, - this.bedId, - this.nursingStationId, - this.description, - this.clinicDescription, - this.clinicDescriptionN, - this.nationalityName, - this.nationalityNameN, - this.age, - this.genderDescription, - this.nursingStationName, - this.appointmentDate, - this.startTime, - this.appointmentNo, - this.appointmentType, - this.appointmentTypeId, - this.arrivedOn, - this.clinicGroupId, - this.companyName, - this.dischargeStatus, - this.doctorDetails, - this.endTime, - this.episodeNo, - this.fallRiskScore, - this.genderInt, - this.isSigned, - this.medicationOrders, - this.nationality, - this.patientMRN, - this.visitType, - this.fullName, - this.fullNameN, - this.nationalityFlagURL, - this.patientStatusType, - this.visitTypeId, - this.startTimes,this.dischargeDate,this.status}); - - factory PatiantInformtion.fromJson(Map json) => - PatiantInformtion( - patientDetails: json['patientDetails'] != null ? new PatiantInformtion.fromJson(json['patientDetails']) - : null, - projectId: json["ProjectID"] ?? json["projectID"], - clinicId: json["ClinicID"] ?? json["clinicID"], - doctorId: json["DoctorID"] ?? json["doctorID"], - patientId: json["PatientID"] ?? - json["patientID"] ?? - json['patientMRN'] ?? - json['PatientMRN'], - doctorName: json["DoctorName"] ?? json["doctorName"], - doctorNameN: json["DoctorNameN"] ?? json["doctorNameN"], - firstName: json["FirstName"] ?? json["firstName"], - middleName: json["MiddleName"] ?? json["middleName"], - lastName: json["LastName"] ?? json["lastName"], - firstNameN: json["FirstNameN"] ?? json["firstNameN"], - middleNameN: json["MiddleNameN"] ?? json["middleNameN"], - lastNameN: json["LastNameN"] ?? json["lastNameN"], - gender: json["Gender"] ?? json["gender"], - fullName: json["fullName"] ?? json["fullName"], - fullNameN: json["fullNameN"] ?? json["fullNameN"], - dateofBirth: json["DateofBirth"] ?? json["dob"], - nationalityId: json["NationalityID"] ?? json["nationalityID"], - mobileNumber: json["MobileNumber"] ?? json["mobileNumber"], - emailAddress: json["EmailAddress"] ?? json["emailAddress"], - patientIdentificationNo: - json["PatientIdentificationNo"] ?? json["patientIdentificationNo"], - //TODO make 7 dynamic when the backend retrun it in patient arrival - patientType: json["PatientType"] ?? json["patientType"]??7, - admissionNo: json["AdmissionNo"] ?? json["admissionNo"], - admissionDate: json["AdmissionDate"] ?? json["admissionDate"], - createdOn: json["CreatedOn"] ?? json["CreatedOn"], - roomId: json["RoomID"] ?? json["roomID"], - bedId: json["BedID"] ?? json["bedID"], - nursingStationId: json["NursingStationID"] ?? json["nursingStationID"], - description: json["Description"] ?? json["description"], - clinicDescription: - json["ClinicDescription"] ?? json["clinicDescription"], - clinicDescriptionN: - json["ClinicDescriptionN"] ?? json["clinicDescriptionN"], - nationalityName: json["NationalityName"] ?? - json["nationalityName"] ?? - json['NationalityName'], - nationalityNameN: json["NationalityNameN"] ?? - json["nationalityNameN"] ?? - json['NationalityNameN'], - age: json["Age"] ?? json["age"], - genderDescription: json["GenderDescription"], - nursingStationName: json["NursingStationName"], - appointmentDate: json["AppointmentDate"] ?? '', - startTime: json["startTime"]??json['StartTime'], - appointmentNo: json['appointmentNo'] ?? json['AppointmentNo'], - appointmentType: json['appointmentType'], - appointmentTypeId: json['appointmentTypeId']?? json['appointmentTypeid'], - arrivedOn: json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn'], - clinicGroupId: json['clinicGroupId'], - companyName: json['companyName'], - dischargeStatus: json['dischargeStatus'], - doctorDetails: json['doctorDetails'], - endTime: json['endTime'], - episodeNo: json['episodeNo'] ?? json['EpisodeID'] ?? json['EpisodeNo'], - fallRiskScore: json['fallRiskScore'], - isSigned: json['isSigned'], - medicationOrders: json['medicationOrders'], - nationality: json['nationality'] ?? json['NationalityNameN'], - patientMRN: json['patientMRN'] ?? json['PatientMRN'], - visitType: json['visitType'] ?? json['visitType']?? json['visitType'], - nationalityFlagURL: - json['NationalityFlagURL'] ?? json['NationalityFlagURL'], - patientStatusType: - json['patientStatusType'] ?? json['PatientStatusType'], - visitTypeId: json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'], - startTimes: json['StartTime'] ?? json['StartTime'], - dischargeDate: json['DischargeDate'] , - status: json['Status'] , - ); -} + int vcId; + String voipToken; + + PatiantInformtion({this.patientDetails, + this.projectId, + this.clinicId, + this.doctorId, + this.patientId, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.nationalityId, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.createdOn, + this.roomId, + this.bedId, + this.nursingStationId, + this.description, + this.clinicDescription, + this.clinicDescriptionN, + this.nationalityName, + this.nationalityNameN, + this.age, + this.genderDescription, + this.nursingStationName, + this.appointmentDate, + this.startTime, + this.appointmentNo, + this.arrivalTime, + this.arrivalTimeD, + this.callStatus, + this.callStatusDisc, + this.callTypeID, + this.clientRequestID, + this.clinicName, + this.consoltationEnd, + this.consultationNotes, + this.appointmentType, + this.appointmentTypeId, + this.arrivedOn, + this.clinicGroupId, + this.companyName, + this.dischargeStatus, + this.doctorDetails, + this.endTime, + this.episodeNo, + this.fallRiskScore, + this.genderInt, + this.isSigned, + this.medicationOrders, + this.nationality, + this.patientMRN, + this.visitType, + this.fullName, + this.fullNameN, + this.nationalityFlagURL, + this.patientStatusType, + this.patientStatus, + this.visitTypeId, + this.startTimes, + this.dischargeDate, + this.status, + this.vcId, + this.voipToken, + this.admissionDateWithDateTimeForm, + this.appointmentDateWithDateTimeForm}); + + + PatiantInformtion.fromJson(Map json) { + { + patientDetails = json['patientDetails'] != null + ? new PatiantInformtion.fromJson(json['patientDetails']) + : null; + projectId = json["ProjectID"] ?? json["projectID"]; + clinicId = json["ClinicID"] ?? json["clinicID"]; + doctorId = json["DoctorID"] ?? json["doctorID"]; + patientId = json["PatientID"] != null + ? json["PatientID"] is String + ? int.parse(json["PatientID"]) + : json["PatientID"] + : json["patientID"] ?? json['patientMRN'] ?? json['PatientMRN']; + doctorName = json["DoctorName"] ?? json["doctorName"]; + doctorNameN = json["DoctorNameN"] ?? json["doctorNameN"]; + firstName = json["FirstName"] ?? json["firstName"]; + middleName = json["MiddleName"] ?? json["middleName"]; + lastName = json["LastName"] ?? json["lastName"]; + firstNameN = json["FirstNameN"] ?? json["firstNameN"]; + middleNameN = json["MiddleNameN"] ?? json["middleNameN"]; + lastNameN = json["LastNameN"] ?? json["lastNameN"]; + gender = json["Gender"] != null + ? json["Gender"] is String + ? int.parse(json["Gender"]) + : json["Gender"] + : json["gender"]; + fullName = json["fullName"] ?? json["fullName"] ?? json["PatientName"]; + fullNameN = + json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"]; + dateofBirth = json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth']; + nationalityId = json["NationalityID"] ?? json["nationalityID"]; + mobileNumber = json["MobileNumber"] ?? json["mobileNumber"]; + emailAddress = json["EmailAddress"] ?? json["emailAddress"]; + patientIdentificationNo = + json["PatientIdentificationNo"] ?? json["patientIdentificationNo"]; + //TODO make 7 dynamic when the backend retrun it in patient arrival + patientType = json["PatientType"] ?? json["patientType"] ?? 1; + admissionNo = json["AdmissionNo"] ?? json["admissionNo"]; + admissionDate = json["AdmissionDate"] ?? json["admissionDate"]; + createdOn = json["CreatedOn"] ?? json["CreatedOn"]; + roomId = json["RoomID"] ?? json["roomID"]; + bedId = json["BedID"] ?? json["bedID"]; + nursingStationId = json["NursingStationID"] ?? json["nursingStationID"]; + description = json["Description"] ?? json["description"]; + clinicDescription = + json["ClinicDescription"] ?? json["clinicDescription"]; + clinicDescriptionN = + json["ClinicDescriptionN"] ?? json["clinicDescriptionN"]; + nationalityName = json["NationalityName"] ?? + json["nationalityName"] ?? + json['NationalityName']; + nationalityNameN = json["NationalityNameN"] ?? + json["nationalityNameN"] ?? + json['NationalityNameN']; + age = json["Age"] ?? json["age"]; + genderDescription = json["GenderDescription"]; + nursingStationName = json["NursingStationName"]; + appointmentDate = json["AppointmentDate"] ?? ''; + startTime = json["startTime"] ?? json['StartTime']; + appointmentNo = json['appointmentNo'] ?? json['AppointmentNo']; + appointmentType = json['appointmentType']; + appointmentTypeId = + json['appointmentTypeId'] ?? json['appointmentTypeid']; + arrivedOn = json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn']; + clinicGroupId = json['clinicGroupId']; + companyName = json['companyName']; + dischargeStatus = json['dischargeStatus']; + doctorDetails = json['doctorDetails']; + endTime = json['endTime']; + episodeNo = json['episodeNo'] ?? json['EpisodeID'] ?? json['EpisodeNo']; + fallRiskScore = json['fallRiskScore']; + isSigned = json['isSigned']; + medicationOrders = json['medicationOrders']; + nationality = json['nationality'] ?? json['NationalityNameN']; + patientMRN = json['patientMRN'] ?? + json['PatientMRN'] ?? + (json["PatientID"] != null + ? int?.parse(json["PatientID"].toString()) + : json["patientID"] != null ? int?.parse( + json["patientID"].toString()) : json["patientId"] != null ? int + ?.parse(json["patientId"].toString()) : ''); + visitType = json['visitType'] ?? json['visitType'] ?? json['visitType']; + nationalityFlagURL = + json['NationalityFlagURL'] ?? json['NationalityFlagURL']; + patientStatusType = + json['patientStatusType'] ?? json['PatientStatusType']; + visitTypeId = + json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid']; + startTimes = json['StartTime'] ?? json['StartTime']; + dischargeDate = json['DischargeDate']; + status = json['Status']; + vcId = json['VC_ID']; + + arrivalTime = json['ArrivalTime']; + arrivalTimeD = json['ArrivalTimeD']; + callStatus = json['CallStatus']; + callStatusDisc = json['CallStatusDisc']; + callTypeID = json['CallTypeID']; + clientRequestID = json['ClientRequestID']; + clinicName = json['ClinicName']; + consoltationEnd = json['ConsoltationEnd']; + consultationNotes = json['ConsultationNotes']; + patientStatus = json['PatientStatus']; + voipToken = json['VoipToken']; + admissionDateWithDateTimeForm = json["AdmissionDate"] != null + ? AppDateUtils.convertStringToDate(json["AdmissionDate"]) + : json["admissionDate"] != null ? AppDateUtils.convertStringToDate( + json["admissionDate"]) : null; + + appointmentDateWithDateTimeForm = + json["AppointmentDate"] != null ? AppDateUtils.convertStringToDate( + json["AppointmentDate"]) : null; + } + } + + + Map toJson() { + final Map data = new Map(); + + data['patientDetails'] = this.patientDetails; + data["ProjectID"] = this.projectId; + data["projectID"] = this.projectId; + data["ClinicID"] = this.clinicId; + data["clinicID"] = this.clinicId; + data["DoctorID"] = this.doctorId; + data["doctorID"] = this.doctorId; + data["PatientID"] = this.patientId; + data["patientID"] = this.patientId; + data['patientMRN'] = this.patientMRN; + data['PatientMRN'] = this.patientMRN; + + data['episodeNo'] = this.episodeNo; + data['EpisodeID'] = this.episodeNo; + data['EpisodeNo'] = this.episodeNo; + + data["DoctorName"] = this.doctorName; + data["doctorName"] = this.doctorName; + data["DoctorNameN"] = this.doctorNameN; + data["doctorNameN"] = this.doctorNameN; + data["FirstName"] = this.firstName; + data["firstName"] = this.firstName; + data["MiddleName"] = this.middleName; + data["middleName"] = this.middleName; + data["LastName"] = this.lastName; + data["lastName"] = this.lastName; + data["FirstNameN"] = this.firstNameN; + data["firstNameN"] = this.firstNameN; + data["MiddleNameN"] = this.middleNameN; + data["middleNameN"] = this.middleNameN; + data["LastNameN"] = this.lastNameN; + data["lastNameN"] = this.lastNameN; + + data["fullName"] = this.fullName; + data["fullName"] = this.fullName; + data["PatientName"] = this.fullName; + + data["Gender"] = this.gender; + data["gender"] = this.gender; + + + data['Age'] = this.age; + data['AppointmentDate'] = this.appointmentDate.isNotEmpty?this.appointmentDate:null; + data['AppointmentNo'] = this.appointmentNo; + data['ArrivalTime'] = this.arrivalTime; + data['ArrivalTimeD'] = this.arrivalTimeD; + data['CallStatus'] = this.callStatus; + data['CallStatusDisc'] = this.callStatusDisc; + data['CallTypeID'] = this.callTypeID; + data['ClientRequestID'] = this.clientRequestID; + data['ClinicName'] = this.clinicName; + data['ConsoltationEnd'] = this.consoltationEnd; + data['ConsultationNotes'] = this.consultationNotes; + data['CreatedOn'] = this.createdOn; + data['DoctorName'] = this.doctorName; + data['Gender'] = this.gender; + data['MobileNumber'] = this.mobileNumber; + data['PatientID'] = this.patientId; + data['PatientStatus'] = this.patientStatus; + data['ProjectID'] = this.projectId; + data['VC_ID'] = this.vcId; + data['VoipToken'] = this.voipToken; + + data["DateofBirth"] = this.dateofBirth; + data["dob"] = this.dateofBirth; + data['DateOfBirth'] = this.dateofBirth; + return data; + } +} \ No newline at end of file diff --git a/lib/root_page.dart b/lib/root_page.dart index 3bd24a81..35a3fa44 100644 --- a/lib/root_page.dart +++ b/lib/root_page.dart @@ -1,27 +1,31 @@ -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/screens/auth/login_screen.dart'; +import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'core/viewModel/authentication_view_model.dart'; import 'landing_page.dart'; class RootPage extends StatelessWidget { @override Widget build(BuildContext context) { - AuthViewModel authProvider = Provider.of(context); + AuthenticationViewModel authenticationViewModel = Provider.of(context); Widget buildRoot() { - switch (authProvider.stutas) { + switch (authenticationViewModel.status) { case APP_STATUS.LOADING: return Scaffold( - body: Center( - child: DrAppCircularProgressIndeicator(), - ), + body: AppLoaderWidget(), ); break; + case APP_STATUS.UNVERIFIED: + return VerificationMethodsScreen(password: null,); + break; case APP_STATUS.UNAUTHENTICATED: - return Loginsreen(); + return LoginScreen(); break; case APP_STATUS.AUTHENTICATED: return LandingPage(); diff --git a/lib/routes.dart b/lib/routes.dart index 2684cd82..0826c76e 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,10 +1,14 @@ import 'package:doctor_app_flutter/root_page.dart'; +import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportDetailPage.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportPage.dart'; import 'package:doctor_app_flutter/screens/patients/profile/note/progress_note_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_home_page.dart'; @@ -14,9 +18,9 @@ import 'package:doctor_app_flutter/screens/prescription/prescriptions_page.dart' import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart'; import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart'; +import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import './screens/auth/login_screen.dart'; -import './screens/auth/verification_methods_screen.dart'; import 'screens/patients/profile/profile_screen/patient_profile_screen.dart'; import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart'; import 'landing_page.dart'; @@ -34,6 +38,7 @@ const String LOGIN = 'login'; const String VERIFICATION_METHODS = 'verification-methods'; const String PATIENTS = 'patients/patients'; const String PATIENTS_PROFILE = 'patients/patients-profile'; +const String PATIENTS_END_Call = 'patients/patients-profile/endCall'; const String IN_PATIENTS_PROFILE = 'inpatients/patients-profile'; const String LAB_RESULT = 'patients/lab_result'; const String HEALTH_SUMMARY = 'patients/health-summary'; @@ -51,6 +56,9 @@ const String UPDATE_EPISODE = 'patients/update-episode'; const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; +const String PATIENT_MEDICAL_REPORT = 'patients/medical-report'; +const String PATIENT_MEDICAL_REPORT_INSERT = 'patients/medical-report-insert'; +const String PATIENT_MEDICAL_REPORT_DETAIL = 'patients/medical-report-detail'; const String PATIENT_UCAF_REQUEST = 'patients/ucaf'; const String PATIENT_UCAF_DETAIL = 'patients/ucaf/detail'; const String PATIENT_ECG = 'patients/ecg'; @@ -64,7 +72,7 @@ const String RADIOLOGY_PATIENT = 'radiology-patient'; var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), - LOGIN: (_) => Loginsreen(), + LOGIN: (_) => LoginScreen(), VERIFICATION_METHODS: (_) => VerificationMethodsScreen(), PATIENTS_PROFILE: (_) => PatientProfileScreen(), LAB_RESULT: (_) => LabsHomePage(), @@ -79,6 +87,10 @@ var routes = { PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestFirstScreen(), PATIENT_ADMISSION_REQUEST_2: (_) => AdmissionRequestSecondScreen(), PATIENT_ADMISSION_REQUEST_3: (_) => AdmissionRequestThirdScreen(), + PATIENT_MEDICAL_REPORT: (_) => MedicalReportPage(), + PATIENT_MEDICAL_REPORT_INSERT: (_) => AddVerifyMedicalReport(), + PATIENT_MEDICAL_REPORT_DETAIL: (_) => MedicalReportDetailPage(), + PATIENTS_END_Call: (_) => EndCallScreen(), CREATE_EPISODE: (_) => UpdateSoapIndex( isUpdate: true, ), diff --git a/lib/screens/auth/change_password_screen.dart b/lib/screens/auth/change_password_screen.dart deleted file mode 100644 index 1a502b68..00000000 --- a/lib/screens/auth/change_password_screen.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:doctor_app_flutter/lookups/auth_lookup.dart'; -import 'package:doctor_app_flutter/widgets/auth/auth_header.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - -import '../../widgets/auth/change_password.dart'; - -class ChangePasswordScreen extends StatelessWidget { - @override - Widget build(BuildContext context) { - - return AppScaffold( - isShowAppBar: false, - body: SafeArea( - child: ListView(children: [ - Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.changePassword), - ChangePassword(), - ], - ), - ), - ]), - )); - } -} diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 77d35bfd..9563b29c 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -1,132 +1,300 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/core/service/home/auth_service.dart'; -import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; -import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import '../../lookups/auth_lookup.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../widgets/auth/auth_header.dart'; -import '../../widgets/auth/login_form.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -class Loginsreen extends StatefulWidget { +class LoginScreen extends StatefulWidget { @override - _LoginsreenState createState() => _LoginsreenState(); + _LoginScreenState createState() => _LoginScreenState(); } -class _LoginsreenState extends State { - Future _prefs = SharedPreferences.getInstance(); - +class _LoginScreenState extends State { String platformImei; - // Future platformImeiFuture; - final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); - bool _isLoading = true; - ProjectViewModel projectViewModel; - AuthService authService = AuthService(); + bool allowCallApi = true; + + //TODO change AppTextFormField to AppTextFormFieldCustom + final loginFormKey = GlobalKey(); + var projectIdController = TextEditingController(); + var userIdController = TextEditingController(); + var passwordController = TextEditingController(); + List projectsList = []; + FocusNode focusPass = FocusNode(); + FocusNode focusProject = FocusNode(); + AuthenticationViewModel authenticationViewModel; + @override - void initState() { - super.initState(); + Widget build(BuildContext context) { + authenticationViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: false, + backgroundColor: HexColor('#F8F8F8'), + body: SafeArea( + child: ListView(children: [ + Container( + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), + alignment: Alignment.topLeft, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //TODO Use App Text rather than text + Container( - _firebaseMessaging.setAutoInitEnabled(true); - if (Platform.isIOS) { - _firebaseMessaging.requestNotificationPermissions(); - } + child: Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 30, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, children: [ + SizedBox( + height: 10, + ), + Text( + TranslationBase + .of(context) + .welcomeTo, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight + .w600, + fontFamily: 'Poppins'), + ), + Text( + TranslationBase + .of(context) + .drSulaimanAlHabib, + style: TextStyle( + color:Color(0xFF2B353E), + fontWeight: FontWeight + .bold, + fontSize: SizeConfig + .isMobile + ? 24 + : SizeConfig + .realScreenWidth * + 0.029, + fontFamily: 'Poppins'), + ), + + Text( + "Doctor App", + style: TextStyle( + fontSize: + SizeConfig.isMobile + ? 16 + : SizeConfig + .realScreenWidth * + 0.030, + fontWeight: FontWeight + .w600, + color: Color(0xFFD02127)), + ), + ]), + ], + )), + SizedBox( + height: 40, + ), + Form( + key: loginFormKey, + child: Column( + mainAxisAlignment: MainAxisAlignment + .spaceBetween, + children: [ + Container( + width: SizeConfig + .realScreenWidth * 0.90, + height: SizeConfig + .realScreenHeight * 0.65, + child: + Column( + crossAxisAlignment: CrossAxisAlignment + .start, children: [ + + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).enterId, + hasBorder: true, + controller: userIdController, + onChanged: (value){ + if (value != null) + setState(() { + authenticationViewModel.userInfo + .userID = + value + .trim(); + }); + }, + ), + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).enterPassword, + hasBorder: true, + isSecure: true, + controller: passwordController, + onChanged: (value){ + if (value != null) + setState(() { + authenticationViewModel.userInfo + .password = + value + .trim(); + }); + // if(allowCallApi) { + this.getProjects( + authenticationViewModel.userInfo + .userID); + // setState(() { + // allowCallApi = false; + // }); + // } + }, + onClick: (){ + + }, + ), + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).selectYourProject, + hasBorder: true, + controller: projectIdController, + isTextFieldHasSuffix: true, + enabled: false, + onClick: (){ + Helpers + .showCupertinoPicker( + context, + projectsList, + 'facilityName', + onSelectProject, + authenticationViewModel); + }, + + + ), + buildSizedBox() + ]), + ), + ], + ), + ) + ], + ) + ])) + ]), + ), + bottomSheet: Container( + + height: 90, + width: double.infinity, + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + AppButton( + title: TranslationBase + .of(context) + .login, + color: Color(0xFFD02127), + fontWeight: FontWeight.w700, + disabled: authenticationViewModel.userInfo + .userID == null || + authenticationViewModel.userInfo + .password == + null, + onPressed: () { + login(context); + }, + ), + + SizedBox(height: 25,) + ], + ), + ), + ),), + ); + } + + SizedBox buildSizedBox() { + return SizedBox( + height: 20, + ); + } - _firebaseMessaging.getToken().then((String token) async { - if (DEVICE_TOKEN == "" && projectViewModel.isLogin == false) { - DEVICE_TOKEN = token; - changeLoadingStata(true); - authService.selectDeviceImei(DEVICE_TOKEN).then((value) { - print(authService.dashboardItemsList); - - if (authService.dashboardItemsList.length > 0) { - sharedPref.setObj( - LAST_LOGIN_USER, authService.dashboardItemsList[0]); - Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (BuildContext context) => VerificationMethodsScreen( - password: null, - ))); - } else { - changeLoadingStata(false); - } - //changeLoadingStata(false); - }); + login(context,) async { + if (loginFormKey.currentState.validate()) { + loginFormKey.currentState.save(); + GifLoaderDialogUtils.showMyDialog(context); + await authenticationViewModel.login(authenticationViewModel.userInfo); + if (authenticationViewModel.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Helpers.showErrorToast(authenticationViewModel.error); } else { - changeLoadingStata(false); + GifLoaderDialogUtils.hideDialog(context); + authenticationViewModel.setUnverified(true,isFromLogin: true); + // Navigator.of(context).pushReplacement( + // MaterialPageRoute( + // builder: (BuildContext context) => + // VerificationMethodsScreen( + // password: authenticationViewModel.userInfo.password, + // isFromLogin: true, + // ), + // ), + // ); } - - // else if (projectViewModel.isLogin) { - // getNotificationCount(token); - // } - }).catchError((err) { - print(err); - }); + } } -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: isLoading - *@return: - *@desc: Change Isloading attribute in order to show or hide loader - */ - void changeLoadingStata(isLoading) { + onSelectProject(index) { setState(() { - _isLoading = isLoading; + authenticationViewModel.userInfo.projectID = projectsList[index].facilityId; + projectIdController.text = projectsList[index].facilityName; }); - } - @override - Widget build(BuildContext context) { - projectViewModel = Provider.of(context); - - return BaseView( - onModelReady: (model) => {}, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - backgroundColor: HexColor('#F8F8F8'), - body: SafeArea( - child: (_isLoading == false) - ? ListView(children: [ - Container( - margin: - EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), - alignment: Alignment.topLeft, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.knownUser), - SizedBox( - height: 40, - ), - LoginForm( - model: model, - ), - ], - ) - ])) - ]) - : Center(child: AppLoaderWidget()), - ), - )); + primaryFocus.unfocus(); + } + String memberID =""; + getProjects(memberID)async { + if (memberID != null && memberID != '') { + if (this.memberID !=memberID) { + this.memberID = memberID; + await authenticationViewModel.getHospitalsList(memberID); + if(authenticationViewModel.state == ViewState.Idle) { + projectsList = authenticationViewModel.hospitals; + setState(() { + authenticationViewModel.userInfo.projectID = projectsList[0].facilityId; + projectIdController.text = projectsList[0].facilityName; + }); + } + } + } } } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 0ad71b76..69d4a47a 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -1,66 +1,574 @@ +import 'dart:io' show Platform; + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/auth/sms-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../../config/size_config.dart'; +import '../../landing_page.dart'; +import '../../root_page.dart'; +import '../../routes.dart'; +import '../../util/dr_app_shared_pref.dart'; +import '../../util/helpers.dart'; +import '../../widgets/auth/verification_methods_list.dart'; +import 'login_screen.dart'; -import '../../widgets/auth/verification_methods.dart'; +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +Helpers helpers = Helpers(); -/* - *@author: Elham Rababah - *@Date:4/7/2020 - *@param: - *@return: - *@desc: Verification Methods screen - */ class VerificationMethodsScreen extends StatefulWidget { - const VerificationMethodsScreen({Key key, this.password}) : super(key: key); - @override - _VerificationMethodsScreenState createState() => - _VerificationMethodsScreenState(); final password; + + + VerificationMethodsScreen({this.password, }); + + @override + _VerificationMethodsScreenState createState() => _VerificationMethodsScreenState(); } class _VerificationMethodsScreenState extends State { - bool _isLoading = false; - - /* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: isLoading - *@return: - *@desc: Change Isloading attribute in order to show or hide loader - */ - void changeLoadingStata(isLoading) { - setState(() { - _isLoading = isLoading; - }); - } + + ProjectViewModel projectsProvider; + bool isMoreOption = false; + bool onlySMSBox = false; + AuthMethodTypes fingerPrintBefore; + AuthMethodTypes selectedOption; + AuthenticationViewModel authenticationViewModel; @override Widget build(BuildContext context) { + projectsProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); + + + return AppScaffold( - isLoading: _isLoading, - isShowAppBar: false, - isHomeIcon: false, - backgroundColor: HexColor('#F8F8F8'), - body: ListView(children: [ - Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + // baseViewModel: model, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + child: Container( + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + height: SizeConfig.realScreenHeight * .95, + width: SizeConfig.realScreenWidth, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + height: 80, + ), + if(authenticationViewModel.isFromLogin) + InkWell( + onTap: (){ + authenticationViewModel.setUnverified(false,isFromLogin: false); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + }, + child: Icon(Icons.arrow_back_ios,color: Color(0xFF2B353E),) + + ), + Container( + + child: Column( + children: [ + SizedBox( + height: 20, + ), + authenticationViewModel.user != null && isMoreOption == false + ? Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + AppText( + TranslationBase.of(context).welcomeBack, + fontSize:12, + fontWeight: FontWeight.w700, + color: Color(0xFF2B353E), + ), + AppText( + Helpers.capitalize(authenticationViewModel.user.doctorName), + fontSize: 24, + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).accountInfo , + fontSize: 16, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + ), + SizedBox( + height: 20, + ), + Container( + padding: EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), + ), + border: Border.all( + color: HexColor('#707070'), + width: 0.1), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + + Text( + TranslationBase.of(context) + .lastLoginAt, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontFamily: 'Poppins', + fontSize: 16, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700,), + + ), + Row( + children: [ + AppText( + TranslationBase + .of(context) + .verifyWith, + fontSize: 14, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + AppText( + authenticationViewModel.getType( + authenticationViewModel.user + .logInTypeID, + context), + fontSize: 14, + color: Color(0xFF2B353E), + + fontWeight: FontWeight.w700, + ), + ], + ) + ], + crossAxisAlignment: CrossAxisAlignment.start,), + Column(children: [ + AppText( + authenticationViewModel.user.editedOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate( + authenticationViewModel.user + .editedOn)) + : authenticationViewModel.user.createdOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate(authenticationViewModel.user + .createdOn)) + : '--', + textAlign: + TextAlign.right, + fontSize: 13, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + ), + AppText( + authenticationViewModel.user.editedOn != + null + ? AppDateUtils.getHour( + AppDateUtils.convertStringToDate( + authenticationViewModel.user + .editedOn)) + : authenticationViewModel.user.createdOn != + null + ? AppDateUtils.getHour( + AppDateUtils.convertStringToDate(authenticationViewModel.user + .createdOn)) + : '--', + textAlign: + TextAlign.right, + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + ) + ], + crossAxisAlignment: CrossAxisAlignment.start, + + ) + ], + ), + ), + SizedBox( + height: 20, + ), + Row( + children: [ + AppText( + "Please Verify", + fontSize: 16, + color: Color(0xFF2B353E), + + fontWeight: FontWeight.w700, + ), + ], + ) + ], + ) + : Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + this.onlySMSBox == false + ? Container( + margin: EdgeInsets.only(bottom: 20, top: 30), + child: AppText( + TranslationBase.of(context) + .verifyLoginWith, + fontSize: 18, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + textAlign: TextAlign.left, + ), + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: + SizeConfig.textMultiplier * 2.5, + textAlign: TextAlign.start, + ), + ]), + authenticationViewModel.user != null && isMoreOption == false + ? Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => + { + // TODO check this logic it seem it will create bug to us + authenticateUser( + AuthMethodTypes + .Fingerprint, true) + }, + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: SelectedAuthMethodTypesService + .getMethodsTypeService( + authenticationViewModel.user + .logInTypeID), + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), + )), + ), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.MoreOptions, + onShowMore: () { + setState(() { + isMoreOption = true; + }); + }, + )) + ]), + ]) + : Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + onlySMSBox == false + ? Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.Fingerprint, + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), + )), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.FaceID, + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), + )) + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: AuthMethodTypes + .SMS, + authenticateUser: + ( + AuthMethodTypes authMethodType, + isActive) => + authenticateUser( + authMethodType, isActive), + )), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.WhatsApp, + authenticateUser: + ( + AuthMethodTypes authMethodType, + isActive) => + authenticateUser( + authMethodType, isActive), + )) + ], + ), + ]), + + // ) + ], + ), + ), + ], + ), + ), + ), + ), + ), + bottomSheet: authenticationViewModel.user == null ? SizedBox(height: 0,) : Container( + height: 90, + width: double.infinity, + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, children: [ - // AuthHeader(loginType.verificationMethods), - SizedBox( - height: 50, - ), - VerificationMethods( - password: widget.password, - changeLoadingStata: changeLoadingStata, + SecondaryButton( + label: TranslationBase + .of(context) + .useAnotherAccount, + color: Color(0xFFD02127), + //fontWeight: FontWeight.w700, + onTap: () { + authenticationViewModel.deleteUser(); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + // Navigator.pushAndRemoveUntil( + // AppGlobal.CONTEX, + // FadePage( + // page: RootPage(), + // ), + // (r) => false); + // Navigator.of(context).pushNamed(LOGIN); + }, ), + + SizedBox(height: 25,) ], ), ), - ])); + ),), + ); } + + sendActivationCodeByOtpNotificationType( + AuthMethodTypes authMethodType) async { + if (authMethodType == AuthMethodTypes.SMS || + authMethodType == AuthMethodTypes.WhatsApp) { + GifLoaderDialogUtils.showMyDialog(context); + + + await authenticationViewModel.sendActivationCodeForDoctorApp(authMethodType:authMethodType, password: authenticationViewModel.userInfo.password ); + if (authenticationViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(authenticationViewModel.error); + GifLoaderDialogUtils.hideDialog(context); + } else { + authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeForDoctorAppRes); + sharedPref.setString(PASSWORD, authenticationViewModel.userInfo.password); + GifLoaderDialogUtils.hideDialog(context); + this.startSMSService(authMethodType); + } + } else { + // TODO route to this page with parameters to inicate we should present 2 option + if (Platform.isAndroid && authMethodType == AuthMethodTypes.Fingerprint) { + Helpers.showErrorToast('Your device not support this feature'); + } else {} + } + } + + sendActivationCodeVerificationScreen(AuthMethodTypes authMethodType) async { + GifLoaderDialogUtils.showMyDialog(context); + await authenticationViewModel + .sendActivationCodeVerificationScreen(authMethodType); + + if (authenticationViewModel.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Helpers.showErrorToast(authenticationViewModel.error); + } else { + authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeVerificationScreenRes); + if (authMethodType == AuthMethodTypes.SMS || + authMethodType == AuthMethodTypes.WhatsApp) { + GifLoaderDialogUtils.hideDialog(context); + this.startSMSService(authMethodType); + } else { + checkActivationCode(); + } + } + } + + authenticateUser(AuthMethodTypes authMethodType, isActive) { + if (authMethodType == AuthMethodTypes.Fingerprint || + authMethodType == AuthMethodTypes.FaceID) { + fingerPrintBefore = authMethodType; + } + this.selectedOption = + fingerPrintBefore != null ? fingerPrintBefore : authMethodType; + + switch (authMethodType) { + case AuthMethodTypes.SMS: + sendActivationCode(authMethodType); + break; + case AuthMethodTypes.WhatsApp: + sendActivationCode(authMethodType); + break; + case AuthMethodTypes.Fingerprint: + this.loginWithFingerPrintOrFaceID( + AuthMethodTypes.Fingerprint, isActive); + break; + case AuthMethodTypes.FaceID: + this.loginWithFingerPrintOrFaceID(AuthMethodTypes.FaceID, isActive); + break; + default: + break; + } + sharedPref.setInt(OTP_TYPE, selectedOption.getTypeIdService()); + } + + sendActivationCode(AuthMethodTypes authMethodType) async { + if (authenticationViewModel.user != null) { + sendActivationCodeVerificationScreen(authMethodType); + } else { + sendActivationCodeByOtpNotificationType(authMethodType); + } + } + + startSMSService(AuthMethodTypes type) { + new SMSOTP( + context, + type, + authenticationViewModel.loggedUser != null ? authenticationViewModel.loggedUser.mobileNumber : authenticationViewModel.user.mobile, + (value) { + showDialog( + context: context, + builder: (BuildContext context) { + return AppLoaderWidget(); + }); + + this.checkActivationCode(value: value); + }, + () => + { + print('Faild..'), + }, + ).displayDialog(context); + } + loginWithFingerPrintOrFaceID(AuthMethodTypes authMethodTypes, + isActive) async { + if (isActive) { + await authenticationViewModel.showIOSAuthMessages(); + if (!mounted) return; + if (authenticationViewModel.user != null && + (SelectedAuthMethodTypesService.getMethodsTypeService( + authenticationViewModel.user.logInTypeID) == + AuthMethodTypes.Fingerprint || + SelectedAuthMethodTypesService.getMethodsTypeService( + authenticationViewModel.user.logInTypeID) == AuthMethodTypes.FaceID)) { + this.sendActivationCode(authMethodTypes); + } else { + setState(() { + this.onlySMSBox = true; + }); + } + } + } + + checkActivationCode({value}) async { + await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value); + if (authenticationViewModel.state == ViewState.ErrorLocal) { + Navigator.pop(context); + Helpers.showErrorToast(authenticationViewModel.error); + } else { + await authenticationViewModel.onCheckActivationCodeSuccess(); + Navigator.pop(context); + Navigator.pop(context); + navigateToLandingPage(); + } + } + + navigateToLandingPage() { + if (authenticationViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(authenticationViewModel.error); + } else { + authenticationViewModel.setAppStatus(APP_STATUS.AUTHENTICATED); + } + } + + + } diff --git a/lib/screens/home/dashboard_slider-item-widget.dart b/lib/screens/home/dashboard_slider-item-widget.dart new file mode 100644 index 00000000..4b7c4f46 --- /dev/null +++ b/lib/screens/home/dashboard_slider-item-widget.dart @@ -0,0 +1,37 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/activity_button.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class DashboardSliderItemWidget extends StatelessWidget { + final DashboardModel item; + + DashboardSliderItemWidget(this.item); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + item.kPIName, + fontSize: SizeConfig.textMultiplier * 2.2, + fontWeight: FontWeight.bold, + ), + ], + ), + new Container( + height: 110, + child: ListView( + scrollDirection: Axis.horizontal, + children: + List.generate(item.summaryoptions.length, (int index) { + return GetActivityButton(item.summaryoptions[index]); + }))) + ], + ); + } +} diff --git a/lib/screens/home/dashboard_swipe_widget.dart b/lib/screens/home/dashboard_swipe_widget.dart new file mode 100644 index 00000000..de5cc05f --- /dev/null +++ b/lib/screens/home/dashboard_swipe_widget.dart @@ -0,0 +1,261 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/out_patient_stack.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:charts_flutter/flutter.dart' as charts; + +class DashboardSwipeWidget extends StatefulWidget { + final List dashboardItemList; + final DashboardViewModel model; + final Function(int) sliderChange; + + DashboardSwipeWidget(this.dashboardItemList, this.model, this.sliderChange); + + @override + _DashboardSwipeWidgetState createState() => _DashboardSwipeWidgetState(); +} + +class _DashboardSwipeWidgetState extends State { + int sliderActiveIndex = 0; + + @override + Widget build(BuildContext context) { + return Container( + height: MediaQuery.of(context).size.height * 0.35, + // height: 230, + child: Swiper( + onIndexChanged: (index) { + if (mounted) { + setState(() { + sliderActiveIndex = index; + widget.sliderChange(index); + }); + } + }, + itemBuilder: (BuildContext context, int index) { + return getSwipeWidget(widget.dashboardItemList, index); + }, + itemCount: 3, + // itemHeight: 300, + pagination: new SwiperCustomPagination( + builder: (BuildContext context, SwiperPluginConfig config) { + return new Stack( + alignment: Alignment.bottomCenter, + children: [ + Positioned( + bottom: 0, + child: Center( + child: InkWell( + onTap: () {}, + child: Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + config.activeIndex == 0 + ? SwiperRoundedPagination(true) + : SwiperRoundedPagination(false), + config.activeIndex == 1 + ? SwiperRoundedPagination(true) + : SwiperRoundedPagination(false), + config.activeIndex == 2 + ? SwiperRoundedPagination(true) + : SwiperRoundedPagination(false), + ], + ), + ), + ), + ), + ) + ], + ); + }), + viewportFraction: 0.9, + // scale: 0.9, + // control: new SwiperControl(), + ), + ); + } + + Widget getSwipeWidget(List dashboardItemList, int index) { + if (index == 1) + return RoundedContainer( + raduis: 16, + showBorder: true, + borderColor: Colors.white, + shadowWidth: 0.2, + shadowSpreadRadius: 3, + shadowDy: 1, + margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: GetOutPatientStack(dashboardItemList[1]))); + if (index == 0) + return RoundedContainer( + raduis: 16, + showBorder: true, + borderColor: Colors.white, + shadowWidth: 0.2, + shadowSpreadRadius: 3, + shadowDy: 1, + margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: GetOutPatientStack(dashboardItemList[0]))); + if (index == 2) + return RoundedContainer( + raduis: 16, + showBorder: true, + borderColor: Colors.white, + shadowWidth: 0.2, + shadowSpreadRadius: 3, + shadowDy: 1, + margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), + child: + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Expanded( + flex: 1, + child: Row( + children: [ + Expanded( + flex: 4, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(8), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .patients, + fontSize: 12, + fontWeight: FontWeight.bold, + fontHeight: 0.5, + ), + AppText( + TranslationBase.of(context) + .referral, + fontSize: 22, + fontWeight: FontWeight.bold, + ), + ], + )), + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: RowCounts( + dashboardItemList[2] + .summaryoptions[0] + .kPIParameter, + dashboardItemList[2] + .summaryoptions[0] + .value, + Colors.black), + ), + Expanded( + child: RowCounts( + dashboardItemList[2] + .summaryoptions[1] + .kPIParameter, + dashboardItemList[2] + .summaryoptions[1] + .value, + Colors.grey), + ), + Expanded( + child: RowCounts( + dashboardItemList[2] + .summaryoptions[2] + .kPIParameter, + dashboardItemList[2] + .summaryoptions[2] + .value, + Colors.red), + ), + ], + ), + ) + ], + )), + ), + Expanded( + flex: 3, + child: Stack(children: [ + Container( + child: GaugeChart( + _createReferralData(widget.dashboardItemList))), + Positioned( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + widget.model + .getPatientCount(dashboardItemList[2]) + .toString(), + fontSize: SizeConfig.textMultiplier * 3.0, + fontWeight: FontWeight.bold, + ) + ], + ), + top: MediaQuery.of(context).size.height * 0.13, + left: 0, + right: 0) + ]), + ), + ], + )), + ])); + return Container(); + } + + static List> _createReferralData( + List dashboardItemList) { + final data = [ + new GaugeSegment( + dashboardItemList[2].summaryoptions[0].kPIParameter, + getValue(dashboardItemList[1].summaryoptions[0].value), + charts.MaterialPalette.black), + new GaugeSegment( + dashboardItemList[2].summaryoptions[1].kPIParameter, + getValue(dashboardItemList[1].summaryoptions[1].value), + charts.MaterialPalette.gray.shadeDefault), + new GaugeSegment( + dashboardItemList[2].summaryoptions[2].kPIParameter, + getValue(dashboardItemList[1].summaryoptions[2].value), + charts.MaterialPalette.red.shadeDefault), + ]; + + return [ + new charts.Series( + id: 'Segments', + domainFn: (GaugeSegment segment, _) => segment.segment, + measureFn: (GaugeSegment segment, _) => segment.size, + data: data, + colorFn: (GaugeSegment segment, _) => segment.color, + ) + ]; + } + + static int getValue(value) { + return value == 0 ? 1 : value; + } +} diff --git a/lib/screens/home/home_page_card.dart b/lib/screens/home/home_page_card.dart index fef7dd5b..503bbe60 100644 --- a/lib/screens/home/home_page_card.dart +++ b/lib/screens/home/home_page_card.dart @@ -26,8 +26,8 @@ class HomePageCard extends StatelessWidget { child: Container( width: 120, height: MediaQuery.of(context).orientation == Orientation.portrait - ? 130 - : 250, + ? 100 + : 200, margin: this.margin, decoration: BoxDecoration( color: !hasBorder @@ -41,16 +41,14 @@ class HomePageCard extends StatelessWidget { : Border.all(width: 0.0, color: Colors.transparent), image: imageName != null ? DecorationImage( - image: AssetImage('assets/images/dashboard/${imageName}'), + image: AssetImage('assets/images/dashboard/$imageName'), fit: BoxFit.cover, colorFilter: new ColorFilter.mode( Colors.black.withOpacity(0.2), BlendMode.dstIn), ) : null, ), - child: Center( - child: child, - ), + child: child, ), ); } diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart new file mode 100644 index 00000000..b388a7e2 --- /dev/null +++ b/lib/screens/home/home_patient_card.dart @@ -0,0 +1,85 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/screens/home/home_page_card.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class HomePatientCard extends StatelessWidget { + final Color backgroundColor; + final IconData cardIcon; + final Color backgroundIconColor; + final String text; + final Color textColor; + final Function onTap; + final double iconSize; + + HomePatientCard({ + @required this.backgroundColor, + @required this.backgroundIconColor, + @required this.cardIcon, + @required this.text, + @required this.textColor, + @required this.onTap, + this.iconSize = 30, + }); + + @override + Widget build(BuildContext context) { + return HomePageCard( + color: backgroundColor, + margin: EdgeInsets.all(4), + child: Container( + padding: EdgeInsets.all(8), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Stack( + children: [ + Container( + margin: EdgeInsets.only(top: 18, left: 10), + color:Colors.transparent, + + child: Icon( + cardIcon, + size: iconSize * 2, + color: backgroundIconColor, + ), + ), + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon( + cardIcon, + size: iconSize, + color: textColor, + ), + SizedBox( + height: 4, + ), + ], + ), + ), + ], + ), + ), + Expanded( + child: Container( + child: AppText( + text, + color: textColor, + textAlign: TextAlign.start, + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ), + ), + ], + ), + ), + hasBorder: false, + onTap: onTap, + ); + } +} diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 99eeef91..568ad60f 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -1,54 +1,36 @@ -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/patient_type.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; - -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; -import 'package:doctor_app_flutter/models/patient/patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/home/dashboard_slider-item-widget.dart'; +import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart'; +import 'package:doctor_app_flutter/screens/home/home_patient_card.dart'; +import 'package:doctor_app_flutter/screens/live_care/live_care_patient_screen.dart'; import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/DischargedPatientPage.dart'; import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart'; -import 'package:doctor_app_flutter/screens/patients/ReferralDischargedPatientPage.dart'; import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_result_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/activity_button.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/out_patient_stack.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; -import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:provider/provider.dart'; import 'package:sticky_headers/sticky_headers/widget.dart'; +import '../../routes.dart'; import '../../widgets/shared/app_texts_widget.dart'; -import '../../widgets/shared/rounded_container_widget.dart'; -import 'home_page_card.dart'; - -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -Helpers helpers = Helpers(); class HomeScreen extends StatefulWidget { HomeScreen({Key key, this.title}) : super(key: key); @@ -61,65 +43,36 @@ class HomeScreen extends StatefulWidget { } class _HomeScreenState extends State { - final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); - HospitalViewModel hospitalProvider; - AuthViewModel authProvider; bool isLoading = false; ProjectViewModel projectsProvider; var _isInit = true; DoctorProfileModel profile; bool isExpanded = false; bool isInpatient = false; - var clinicName = []; int sliderActiveIndex = 0; var clinicId; - var _patientSearchFormValues; - - void didChangeDependencies() async { - super.didChangeDependencies(); - if (_isInit) { - projectsProvider = Provider.of(context); - projectsProvider.getDoctorClinicsList(); - - // _firebaseMessaging.setAutoInitEnabled(true); - _firebaseMessaging.requestNotificationPermissions( - const IosNotificationSettings( - sound: true, badge: true, alert: true, provisional: true)); - _firebaseMessaging.onIosSettingsRegistered - .listen((IosNotificationSettings settings) { - print("Settings registered: $settings"); - }); - clinicName = await sharedPref.getObj(CLINIC_NAME); - print(clinicName); - _firebaseMessaging.getToken().then((String token) async { - if (token != '') { - DEVICE_TOKEN = token; - var request = await sharedPref.getObj(DOCTOR_PROFILE); - authProvider.insertDeviceImei(request).then((value) { - // print(value); - changeIsLoading(false); - }); - } - }); - } - _isInit = false; - } + AuthenticationViewModel authenticationViewModel; + int colorIndex = 0; - BuildContext myContext; @override Widget build(BuildContext context) { - myContext = context; - hospitalProvider = Provider.of(context); - authProvider = Provider.of(context); - projectsProvider = Provider.of(context); - FocusScopeNode currentFocus = FocusScope.of(context); + ProjectViewModel projectsProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); + FocusScopeNode currentFocus = FocusScope.of(context); if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } return BaseView( - onModelReady: (model) => model.getDashboard(), + onModelReady: (model) async { + await model.setFirebaseNotification( + projectsProvider, authenticationViewModel); + await model.getDashboard(); + await model.getDoctorProfile(isGetProfile: true); + await model.checkDoctorHasLiveCare(); + // await model.getSpecialClinicalCareList(); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, @@ -144,7 +97,6 @@ class _HomeScreenState extends State { children: [ Container( width: MediaQuery.of(context).size.width * .6, - // // height: 100, child: projectsProvider.doctorClinicsList.length > 0 ? Stack( @@ -170,36 +122,49 @@ class _HomeScreenState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ - Container( - padding: EdgeInsets.all(2), - margin: EdgeInsets.all(2), - decoration: - new BoxDecoration( - color: Colors.red[800], - borderRadius: - BorderRadius.circular( - 20), - ), - constraints: BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: new Text( - projectsProvider - .doctorClinicsList - .length - .toString(), - style: new TextStyle( - color: Colors.white, - fontSize: - projectsProvider - .isArabic - ? 10 - : 11, - ), - textAlign: - TextAlign.center, - ), + Column( + mainAxisAlignment: + MainAxisAlignment + .center, + children: [ + Container( + padding: + EdgeInsets.all(2), + margin: + EdgeInsets.all(2), + decoration: + new BoxDecoration( + color: + Colors.red[800], + borderRadius: + BorderRadius + .circular( + 20), + ), + constraints: + BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: Center( + child: AppText( + projectsProvider + .doctorClinicsList + .length + .toString(), + color: + Colors.white, + fontSize: + projectsProvider + .isArabic + ? 10 + : 11, + textAlign: + TextAlign + .center, + ), + )), + ], ), AppText(item.clinicName, fontSize: 12, @@ -211,10 +176,19 @@ class _HomeScreenState extends State { ); }).toList(); }, - onChanged: (newValue) { + onChanged: (newValue) async { clinicId = newValue; - changeClinic( - newValue, context, model); + GifLoaderDialogUtils.showMyDialog( + context); + await model.changeClinic(newValue, + authenticationViewModel); + GifLoaderDialogUtils.hideDialog( + context); + if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } }, items: projectsProvider .doctorClinicsList @@ -235,70 +209,24 @@ class _HomeScreenState extends State { ), ], ), - isClilic: true, + isClinic: true, height: 50, ), ]) ])), content: Column( children: [ - Container( - height: MediaQuery.of(context).size.height * 0.35, - child: model.dashboardItemsList.length > 0 - ? new Swiper( - onIndexChanged: (index) { - if (mounted) { - setState(() { - sliderActiveIndex = index; - }); - } - }, - itemBuilder: (BuildContext context, int index) { - return getSwipeWidget(model)[index]; - }, - itemCount: 3, - itemHeight: 300, - pagination: new SwiperCustomPagination(builder: - (BuildContext context, - SwiperPluginConfig config) { - return new Stack( - alignment: Alignment.bottomCenter, - children: [ - Positioned( - bottom: 0, - child: Center( - child: InkWell( - onTap: () {}, - child: Container( - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - config.activeIndex == 0 - ? SwiperRoundedPagination( - true) - : SwiperRoundedPagination( - false), - config.activeIndex == 1 - ? SwiperRoundedPagination( - true) - : SwiperRoundedPagination( - false), - config.activeIndex == 2 - ? SwiperRoundedPagination( - true) - : SwiperRoundedPagination( - false), - ], - ))))) - ]); - }), - viewportFraction: 0.9, - // scale: 0.9, - // control: new SwiperControl(), - ) - : SizedBox()), + model.dashboardItemsList.length > 0 + ? DashboardSwipeWidget( + model.dashboardItemsList, + model, + (sliderIndex) { + setState(() { + sliderActiveIndex = sliderIndex; + }); + }, + ) + : SizedBox(), model.dashboardItemsList.length > 0 ? FractionallySizedBox( widthFactor: 0.90, @@ -310,111 +238,13 @@ class _HomeScreenState extends State { height: 10, ), sliderActiveIndex == 1 - ? Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - model.dashboardItemsList[3] - .kPIName, - fontSize: - SizeConfig.textMultiplier * - 2.2, - fontWeight: FontWeight.bold, - ), - ], - ), - new Container( - height: 130, - child: new ListView( - scrollDirection: - Axis.horizontal, - children: new List.generate( - model - .dashboardItemsList[3] - .summaryoptions - .length, (int index) { - return GetActivityButton(model - .dashboardItemsList[3] - .summaryoptions[index]); - }))) - ], - ) + ? DashboardSliderItemWidget( + model.dashboardItemsList[4]) : sliderActiveIndex == 0 - ? Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - model.dashboardItemsList[6] - .kPIName, - fontSize: SizeConfig - .textMultiplier * - 2.2, - fontWeight: FontWeight.bold, - ), - ], - ), - new Container( - height: 130, - child: new ListView( - scrollDirection: Axis - .horizontal, - children: new List - .generate( - model - .dashboardItemsList[ - 6] - .summaryoptions - .length, - (int index) { - return GetActivityButton(model - .dashboardItemsList[ - 6] - .summaryoptions[index]); - }))) - ], - ) - : Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - model.dashboardItemsList[4] - .kPIName, - fontSize: SizeConfig - .textMultiplier * - 2.2, - fontWeight: FontWeight.bold, - ), - ], - ), - new Container( - height: 130, - child: new ListView( - scrollDirection: Axis - .horizontal, - children: new List - .generate( - model - .dashboardItemsList[ - 4] - .summaryoptions - .length, - (int index) { - return GetActivityButton(model - .dashboardItemsList[ - 4] - .summaryoptions[index]); - }))) - ], - ), + ? DashboardSliderItemWidget( + model.dashboardItemsList[3]) + : DashboardSliderItemWidget( + model.dashboardItemsList[6]), ]))) : SizedBox(), FractionallySizedBox( @@ -429,341 +259,40 @@ class _HomeScreenState extends State { margin: EdgeInsets.only(top: 10), child: Column( mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 10, ), - Row( - children: [ - Container( - width: 150, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).patients, - style: TextStyle( - fontSize: 12, - height: .5, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - Text( - TranslationBase.of(context).services, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - ], - )), + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patients, + fontSize: 12, + fontWeight: FontWeight.bold, + fontHeight: .5, + ), + AppText( + TranslationBase.of(context).services, + fontSize: 22, + fontWeight: FontWeight.bold, + ), ], - ), + )), SizedBox( height: 10, ), - new Container( - height: 130, - child: new ListView( + Container( + height: 120, + child: ListView( scrollDirection: Axis.horizontal, children: [ - HomePageCard( - color: Color(0xffD02127), - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp.inpatient, - size: 65, - color: Colors.white12, - ), - ), - Icon( - DoctorApp.inpatient, - size: 32, - color: Colors.white, - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - "My\n" + - TranslationBase.of(context) - .inPatient, - color: Colors.white, - textAlign: TextAlign.start, - fontSize: 15, - )) - ], - ), - hasBorder: false, - onTap: () { - Navigator.push( - context, - FadePage( - page: PatientInPatientScreen(), - ), - ); - }, - ), - HomePageCard( - color: Colors.grey[300], - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp - .arrival_patients, - size: 65, - color: Colors.white38, - ), - ), - Icon( - DoctorApp.arrival_patients, - size: 35, - color: Colors.black, - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .myOutPatient, - color: Colors.black, - textAlign: TextAlign.start, - fontSize: 15, - )) - ], - ), - hasBorder: false, - onTap: () { - String date = - AppDateUtils.convertDateToFormat( - DateTime( - DateTime.now().year, - DateTime.now().month, - DateTime.now().day), - 'yyyy-MM-dd'); - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => OutPatientsScreen( - patientSearchRequestModel: - PatientSearchRequestModel( - from: date, - to: date, - doctorID: authProvider - .doctorProfile - .doctorID)), - )); - }, - ), - HomePageCard( - color: Color(0xff2B353E), - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp.referral_1, - size: 65, - color: Colors.white10 - .withOpacity(0.1), - ), - ), - Icon( - DoctorApp.referral_1, - size: 35, - color: Colors.white, - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .patientsreferral, - color: Colors.white, - textAlign: TextAlign.start, - fontSize: 15, - )) - ], - ), - hasBorder: false, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - PatientReferralScreen(), - // MyReferredPatient(), - ), - ); - }, - ), - HomePageCard( - color: Color(0xffD02127), - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp.search, - size: 65, - color: Colors.white10, - ), - ), - Icon( - DoctorApp.search, - size: 35, - color: Colors.white, - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .searchPatient, - color: Colors.white, - textAlign: TextAlign.start, - fontSize: 13, - )) - ], - ), - hasBorder: false, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - PatientSearchScreen(), - )); - }, - ), - HomePageCard( - color: Color(0xffC9C9C9), - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp - .search_medicines, - color: Colors.black12, - size: 65, - ), - ), - Icon( - DoctorApp.search_medicines, - size: 40, - color: Color(0xff2B353E), - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .searchMedicine, - color: Color(0xff2B353E), - textAlign: TextAlign.start, - fontSize: 13, - )) - ], - ), - hasBorder: false, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - MedicineSearchScreen(), - )); - }, - ) + ...homePatientsCardsWidget( + model, projectsProvider), ])), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width: 8, - ), - ], - ), SizedBox( height: 20, ), @@ -780,213 +309,167 @@ class _HomeScreenState extends State { ); } - static List> _createReferralData(model) { - final data = [ - new GaugeSegment( - model.dashboardItemsList[2].summaryoptions[0].kPIParameter, - getValue(model.dashboardItemsList[1].summaryoptions[0].value), - charts.MaterialPalette.black), - new GaugeSegment( - model.dashboardItemsList[2].summaryoptions[1].kPIParameter, - getValue(model.dashboardItemsList[1].summaryoptions[1].value), - charts.MaterialPalette.gray.shadeDefault), - new GaugeSegment( - model.dashboardItemsList[2].summaryoptions[2].kPIParameter, - getValue(model.dashboardItemsList[1].summaryoptions[2].value), - charts.MaterialPalette.red.shadeDefault), - ]; + List homePatientsCardsWidget( + DashboardViewModel model, projectsProvider) { + colorIndex = 0; - return [ - new charts.Series( - id: 'Segments', - domainFn: (GaugeSegment segment, _) => segment.segment, - measureFn: (GaugeSegment segment, _) => segment.size, - data: data, - colorFn: (GaugeSegment segment, _) => segment.color, - ) - ]; - } + List backgroundColors = List(3); + backgroundColors[0] = Color(0xffD02127); + backgroundColors[1] = Colors.grey[300]; + backgroundColors[2] = Color(0xff2B353E); + List backgroundIconColors = List(3); + backgroundIconColors[0] = Colors.white12; + backgroundIconColors[1] = Colors.white38; + backgroundIconColors[2] = Colors.white10; + List textColors = List(3); + textColors[0] = Colors.white; + textColors[1] = Colors.black; + textColors[2] = Colors.white; - static int getValue(value) { - return value == 0 ? 1 : value; - } + List patientCards = List(); - changeClinic(clinicId, BuildContext context, model) async { - // Navigator.pop(context); - changeIsLoading(true); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: doctorProfile.doctorID, - clinicID: clinicId, - license: true, - projectID: doctorProfile.projectID, - tokenID: '', - languageID: 2); - authProvider.getDocProfiles(docInfo.toJson()).then((res) async { - changeIsLoading(false); - sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); - }).catchError((err) { - changeIsLoading(false); - Helpers.showErrorToast(err); - }); - } + if (model.hasVirtualClinic) { + patientCards.add(HomePatientCard( + backgroundColor: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.livecare, + textColor: textColors[colorIndex], + iconSize: 21, + text: + "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", + onTap: () { + // PatiantInformtion patient = PatiantInformtion( + // patientStatusType: 43, + // episodeNo: 0, + // vcId: 42342, + // fullName: "mosa test", + // dateofBirth: "2000-05-01 10:42:35.790004" + // ); + // Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + // "patient": patient, + // "patientType": "0", + // "isSearch": false, + // "isInpatient": false, + // "arrivalType": "0", + // "isSearchAndOut": false, + // "isFromLiveCare": true, + // }); + Navigator.push( + context, + FadePage( + page: LiveCarePatientScreen(), + ), + ); + }, + )); + changeColorIndex(); + } - changeIsLoading(bool val) { - setState(() { - this.isLoading = val; - }); - } + patientCards.add(HomePatientCard( + backgroundColor: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.inpatient, + textColor: textColors[colorIndex], + text: TranslationBase.of(context).myInPatient, + onTap: () { + Navigator.push( + context, + FadePage( + page: PatientInPatientScreen( + specialClinic: model.getSpecialClinic( + clinicId ?? projectsProvider.doctorClinicsList[0].clinicID), + ), + ), + ); + }, + )); + changeColorIndex(); - getPatientCount(DashboardModel inPatientCount) { - int value = 0; - inPatientCount.summaryoptions.forEach((result) => {value += result.value}); + patientCards.add(HomePatientCard( + backgroundColor: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.arrival_patients, + textColor: textColors[colorIndex], + text: TranslationBase.of(context).myOutPatient_2lines, + onTap: () { + String date = AppDateUtils.convertDateToFormat( + DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day), + 'yyyy-MM-dd'); - return value.toString(); - } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OutPatientsScreen( + patientSearchRequestModel: PatientSearchRequestModel( + from: date, + to: date, + doctorID: + authenticationViewModel.doctorProfile.doctorID)), + )); + }, + )); + changeColorIndex(); + + patientCards.add(HomePatientCard( + backgroundColor: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.referral_1, + textColor: textColors[colorIndex], + text: TranslationBase.of(context).myPatientsReferral, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PatientReferralScreen(), + ), + ); + }, + )); + changeColorIndex(); + + patientCards.add(HomePatientCard( + backgroundColor: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.search, + textColor: textColors[colorIndex], + text: TranslationBase.of(context).searchPatientDashBoard, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PatientSearchScreen(), + )); + }, + )); + changeColorIndex(); + + patientCards.add(HomePatientCard( + backgroundColor: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.search_medicines, + textColor: textColors[colorIndex], + text: TranslationBase.of(context).searchMedicineDashboard, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MedicineSearchScreen(), + )); + }, + )); + changeColorIndex(); - List getSwipeWidget(model) { return [ - RoundedContainer( - height: MediaQuery.of(context).size.height * 0.35, - margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), - child: Padding( - padding: const EdgeInsets.all(5.0), - child: GetOutPatientStack(model.dashboardItemsList[1]))), - RoundedContainer( - height: MediaQuery.of(context).size.height * 0.35, - margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), - child: Padding( - padding: const EdgeInsets.all(5.0), - child: GetOutPatientStack(model.dashboardItemsList[0]))), - RoundedContainer( - height: MediaQuery.of(context).size.height * 0.35, - margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), - child: - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - flex: 1, - child: Row( - children: [ - Expanded( - flex: 4, - child: Padding( - padding: const EdgeInsets.all(5.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.all(8), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context) - .patients, - style: TextStyle( - fontSize: 12, - height: .5, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - Text( - TranslationBase.of(context) - .referral, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - ], - ))), - Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - RowCounts( - model.dashboardItemsList[2] - .summaryoptions[0].kPIParameter, - model.dashboardItemsList[2] - .summaryoptions[0].value, - Colors.black), - RowCounts( - model.dashboardItemsList[2] - .summaryoptions[1].kPIParameter, - model.dashboardItemsList[2] - .summaryoptions[1].value, - Colors.grey), - RowCounts( - model.dashboardItemsList[2] - .summaryoptions[2].kPIParameter, - model.dashboardItemsList[2] - .summaryoptions[2].value, - Colors.red), - ], - ), - ) - ], - ))), - Expanded( - flex: 3, - child: Stack(children: [ - Container( - child: GaugeChart(_createReferralData(model))), - Positioned( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - AppText( - getPatientCount(model.dashboardItemsList[2]) - .toString(), - fontSize: 30, - fontWeight: FontWeight.bold, - ) - ], - ), - top: MediaQuery.of(context).size.height * 0.12, - left: 0, - right: 0) - ]), - ), - ], - )), - ])), + ...List.generate(patientCards.length, (index) => patientCards[index]) + .toList() ]; } - getRequestHeader(isInpatient) { - _patientSearchFormValues = PatientModel( - FirstName: "0", - MiddleName: "0", - LastName: "0", - PatientMobileNumber: "0", - PatientIdentificationID: "0", - PatientID: 0, - From: isInpatient == true - ? '0' - : AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') - .toString(), - To: isInpatient == true - ? '0' - : AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') - .toString(), - LanguageID: 2, - stamp: "2020-03-02T13:56:39.170Z", - IPAdress: "11.11.11.11", - VersionID: 1.2, - Channel: 9, - TokenID: "2Fi7HoIHB0eDyekVa6tCJg==", - SessionID: "5G0yXn0Jnq", - IsLoginForDoctorApp: true, - PatientOutSA: false); + changeColorIndex() { + colorIndex++; + if (colorIndex > 2) { + colorIndex = 0; + } } } diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart new file mode 100644 index 00000000..0e65182b --- /dev/null +++ b/lib/screens/live_care/end_call_screen.dart @@ -0,0 +1,415 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/livecare/session_status_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/live_care/live-care_transfer_to_admin.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart'; +import 'package:doctor_app_flutter/util/VideoChannel.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class EndCallScreen extends StatefulWidget { + final PatiantInformtion patient; + + const EndCallScreen({Key key, this.patient,}) : super(key: key); + + @override + _EndCallScreenState createState() => _EndCallScreenState(); +} + +class _EndCallScreenState extends State { + bool isInpatient = false; + PatiantInformtion patient; + bool isDischargedPatient = false; + bool isSearchAndOut = false; + String patientType; + String arrivalType; + String from; + String to; + + LiveCarePatientViewModel liveCareModel; + @override + void initState() { + super.initState(); + if(widget.patient!=null) + patient = widget.patient; + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + if(routeArgs.containsKey('patient')) + patient = routeArgs['patient']; + } + + @override + Widget build(BuildContext context) { + final List cardsList = [ + PatientProfileCardModel(TranslationBase.of(context).resume, + TranslationBase.of(context).theCall, '', 'patient/vital_signs.png', + isInPatient: isInpatient, + color: Colors.green[800], + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + await liveCareModel + .startCall(isReCall: false, vCID: patient.vcId) + .then((value) async { + await liveCareModel.getDoctorProfile(); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } else + await VideoChannel.openVideoCallScreen( + kToken: liveCareModel.startCallRes.openTokenID, + kSessionId: liveCareModel.startCallRes.openSessionID, + kApiKey: '46209962', + vcId: patient.vcId, + isRecording: liveCareModel.startCallRes != null ? liveCareModel.startCallRes.isRecording: false, + patientName: patient.fullName ?? (patient.firstName != null ? "${patient.firstName} ${patient.lastName}" : "-"), + tokenID: await liveCareModel.getToken(), + generalId: GENERAL_ID, + doctorId: liveCareModel.doctorProfile.doctorID, + onFailure: (String error) { + DrAppToastMsg.showErrorToast(error); + }, + onCallEnd: () async { + GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(context); + await liveCareModel.endCall( + patient.vcId, + false, + ); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } + }, + onCallNotRespond: + (SessionStatusModel sessionStatusModel) async { + GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(context); + await liveCareModel.endCall( + patient.vcId, + sessionStatusModel.sessionStatus == 3, + ); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } + }); + }); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } + }, isDartIcon: true, dartIcon: DoctorApp.call), + PatientProfileCardModel( + TranslationBase.of(context).endLC, + TranslationBase.of(context).consultation, + '', + 'patient/vital_signs.png', + isInPatient: isInpatient, + color: Colors.red[800], + onTap: () { + Helpers.showConfirmationDialog(context, + "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?", + () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + await liveCareModel.getAlternativeServices(patient.vcId); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } else { + showAlternativesDialog(context, liveCareModel, (bool isConfirmed) async { + GifLoaderDialogUtils.showMyDialog(context); + await liveCareModel.endCallWithCharge(patient.vcId, isConfirmed); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } else { + DrAppToastMsg.showSuccesToast("You successfully completed call with charge"); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + }); + } + }); + }, isDartIcon: true, dartIcon: DoctorApp.end_consultaion), + PatientProfileCardModel( + TranslationBase.of(context).sendLC, + TranslationBase.of(context).instruction, + "", + 'patient/health_summary.png', + onTap: () { + Helpers.showConfirmationDialog(context, + "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).sendLC} ${TranslationBase.of(context).instruction} ?", + () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + await liveCareModel.sendSMSInstruction(patient.vcId); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } else { + DrAppToastMsg.showSuccesToast("You successfully sent SMS instructions"); + } + }); + }, + isInPatient: isInpatient, + isDartIcon: true, + // isDisable: true, + dartIcon: DoctorApp.send_instruction), + PatientProfileCardModel( + TranslationBase.of(context).transferTo, + TranslationBase.of(context).admin, + '', + 'patient/health_summary.png', onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + LivaCareTransferToAdmin(patient: patient))); + }, + isInPatient: isInpatient, + isDartIcon: true, + dartIcon: DoctorApp.transfer_to_admin), + ]; + + return BaseView( + onModelReady: (model) { + liveCareModel = model; + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).patientProfile, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + isShowAppBar: true, + appBar: PatientProfileAppBar( + patient, + onPressed: (){ + Navigator.pop(context); + + }, + isInpatient: isInpatient, + height: (patient.patientStatusType != null && + patient.patientStatusType == 43) + ? 210 + : isDischargedPatient + ? 240 + : 0, + isDischargedPatient: isDischargedPatient), + body: Container( + height: !isSearchAndOut + ? isDischargedPatient + ? MediaQuery.of(context).size.height * 0.64 + : MediaQuery.of(context).size.height * 0.65 + : MediaQuery.of(context).size.height * 0.69, + child: ListView( + children: [ + Padding( + padding: + const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patient, + fontSize: 14, + fontWeight: FontWeight.w500, + ), + AppText( + TranslationBase.of(context).endcall, + fontSize: 26, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 10, + ), + StaggeredGridView.countBuilder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + crossAxisSpacing: 10, + mainAxisSpacing: 10, + crossAxisCount: 3, + itemCount: cardsList.length, + staggeredTileBuilder: (int index) => StaggeredTile.fit(1), + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: cardsList[index].nameLine1, + nameLine2: cardsList[index].nameLine2, + route: cardsList[index].route, + icon: cardsList[index].icon, + isInPatient: cardsList[index].isInPatient, + isDischargedPatient: + cardsList[index].isDischargedPatient, + isDisable: cardsList[index].isDisable, + onTap: cardsList[index].onTap, + isLoading: cardsList[index].isLoading, + isDartIcon: cardsList[index].isDartIcon, + dartIcon: cardsList[index].dartIcon, + color: cardsList[index].color, + ), + ), + ], + ), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.05, + ) + ], + ), + ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + fontWeight: FontWeight.w700, + color: Colors.red[600], + title: "Close", //TranslationBase.of(context).close, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + ), + SizedBox( + height: 5, + ), + ], + ), + ), + ), + ); + } + + showAlternativesDialog(BuildContext context, LiveCarePatientViewModel model, + Function(bool) okFunction) { + return showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (_) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AlertDialog( + title: null, + content: Container( + height: MediaQuery.of(context).size.height / 2, + child: CheckBoxListWidget( + model: model, + ), + ), + actions: [ + AppButton( + onPressed: (){ + Navigator.of(context).pop(); + okFunction(true); + }, + title: TranslationBase.of(context).noteConfirm, + fontColor: Colors.white, + color: Colors.green[600], + ), + AppButton( + onPressed: () { + Navigator.of(context).pop(); + Navigator.of(context).pop(); + okFunction(false); + }, + title: TranslationBase.of(context).cancel, + fontColor: Colors.white, + color: Colors.red[600], + ), + ], + ), + ], + ), + ); + }); + } +} + +class CheckBoxListWidget extends StatefulWidget { + final LiveCarePatientViewModel model; + + const CheckBoxListWidget({ + Key key, + this.model, + }) : super(key: key); + + @override + _CheckBoxListState createState() => _CheckBoxListState(); +} + +class _CheckBoxListState extends State { + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: Column( + children: [ + ...widget.model.alternativeServicesList + .map( + (element) => Container( + child: CheckboxListTile( + title: AppText( + element.serviceName, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + value: element.isSelected, + onChanged: (newValue) { + setState(() { + widget.model + .setSelectedCheckboxValues(element, newValue); + }); + }, + activeColor: Color(0xFFD02127), + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + ), + ) + .toList() + ], + ), + ); + } +} diff --git a/lib/screens/live_care/live-care_transfer_to_admin.dart b/lib/screens/live_care/live-care_transfer_to_admin.dart new file mode 100644 index 00000000..233f59d8 --- /dev/null +++ b/lib/screens/live_care/live-care_transfer_to_admin.dart @@ -0,0 +1,198 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/button_bottom_sheet.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; + +class LivaCareTransferToAdmin extends StatefulWidget { + final PatiantInformtion patient; + + const LivaCareTransferToAdmin({Key key, this.patient}) : super(key: key); + + @override + _LivaCareTransferToAdminState createState() => + _LivaCareTransferToAdminState(); +} + +class _LivaCareTransferToAdminState extends State { + stt.SpeechToText speech = stt.SpeechToText(); + var reconizedWord; + var event = RobotProvider(); + ProjectViewModel projectViewModel; + + TextEditingController noteController = TextEditingController(); + String noteError; + + void initState() { + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) {}, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: + "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + isShowAppBar: true, + body: Container( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + color: Colors.white, + margin: EdgeInsets.all(16), + child: Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).notes, + //TranslationBase.of(context).addProgressNote, + controller: noteController, + maxLines: 35, + minLines: 25, + hasBorder: true, + validationError: noteError, + ), + Positioned( + top: -2, //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context).size.width * 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon(DoctorApp.speechtotext, + color: Colors.black, size: 35), + onPressed: () { + initSpeechState() + .then((value) => {onVoiceText()}); + }, + ), + ], + )) + ], + ), + ), + ), + ), + ButtonBottomSheet( + title: + "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", + onPressed: () { + setState(() { + if (noteController.text.isEmpty) { + noteError = TranslationBase.of(context).emptyMessage; + } else { + noteError = null; + } + if (noteController.text.isNotEmpty) { + Helpers.showConfirmationDialog(context, + "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin} ?", + () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + await model.transferToAdmin(widget.patient.vcId, noteController.text); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast("You successfully transfer to admin"); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + }); + } + }); + }, + ) + ], + ), + ), + ), + ); + } + + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + //SpeechToText.closeAlertDialog(context); + print(error); + } + + void statusListener(String status) { + reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + void resultListener(result) { + reconizedWord = result.recognizedWords; + event.setValue({"searchText": reconizedWord}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speech.stop(); + noteController.text += reconizedWord + '\n'; + }); + } else { + print(result.finalResult); + } + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } +} diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart new file mode 100644 index 00000000..12c8caff --- /dev/null +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -0,0 +1,203 @@ +import 'dart:async'; + +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/VideoCallService.dart'; +import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/NotificationPermissionUtils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; +import 'package:flutter/material.dart'; + +import '../../locator.dart'; +import '../../routes.dart'; + +class LiveCarePatientScreen extends StatefulWidget { + @override + _LiveCarePatientScreenState createState() => _LiveCarePatientScreenState(); +} + +class _LiveCarePatientScreenState extends State { + final _controller = TextEditingController(); + + Timer timer; + LiveCarePatientViewModel _liveCareViewModel; + @override + void initState() { + super.initState(); + timer = Timer.periodic(Duration(seconds: 10), (Timer t) { + if (_liveCareViewModel != null) { + _liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true); + } + }); + } + + @override + void dispose() { + _liveCareViewModel.isLogin(0); + _liveCareViewModel = null; + timer?.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + _liveCareViewModel = model; + await model.getPendingPatientERForDoctorApp(); + await model.isLogin(1); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + color: Colors.white, + ), + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ), + Expanded( + child: AppText( + "LiveCare Patients", + fontSize: SizeConfig.textMultiplier * 2.8, + fontWeight: FontWeight.bold, + color: Color(0xFF2B353E), + ), + ), + ]), + ), + ), + SizedBox( + height: 20, + ), + Center( + child: FractionallySizedBox( + widthFactor: .9, + child: Container( + width: double.maxFinite, + height: 75, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: Color(0xffCCCCCC), + ), + color: Colors.white), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: AppText( + TranslationBase.of(context).searchPatientName, + fontSize: 13, + )), + AppTextFormField( + // focusNode: focusProject, + controller: _controller, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + DoctorApp.filter_1, + color: Colors.black, + ), + iconSize: 20, + padding: EdgeInsets.only(bottom: 30), + ), + onChanged: (String str) { + model.searchData(str); + }), + ])), + ), + ), + model.state == ViewState.Idle + ? Expanded( + child: Container( + child: model.filterData.isEmpty + ? Center( + child: ErrorMessage( + error: TranslationBase.of(context).youDontHaveAnyPatient, + ), + ) + : ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.filterData.length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: PatientCard( + patientInfo: PatiantInformtion.fromJson(model.filterData[index].toJson()), + patientType: "0", + arrivalType: "0", + isFromSearch: false, + isInpatient: false, + isFromLiveCare: true, + onTap: () { + // TODO change the parameter to daynamic + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": PatiantInformtion.fromJson(model.filterData[index].toJson()), + "patientType": "0", + "isSearch": false, + "isInpatient": false, + "arrivalType": "0", + "isSearchAndOut": false, + "isFromLiveCare": true, + }); + }, + // isFromSearch: widget.isSearch, + ), + ); + })), + ) + : Expanded( + child: AppLoaderWidget( + containerColor: Colors.transparent, + )), + // AppButton( + // fontWeight: FontWeight.w700, + // color:Colors.green[600], + // title: TranslationBase.of(context).initiateCall, + // disabled: model.state == ViewState.BusyLocal, + // onPressed: () async { + // AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){ + // locator().openVideo(model.startCallRes, PatiantInformtion( + // vcId: 454353, + // fullName: "test mosa" + // ), callConnected, callDisconnected); + // }); + // + // }, + // ), + ], + ), + ), + ); + } + + callConnected(){ + + } + + callDisconnected(){ + } +} diff --git a/lib/screens/live_care/panding_list.dart b/lib/screens/live_care/panding_list.dart index 8c9851db..f081479c 100644 --- a/lib/screens/live_care/panding_list.dart +++ b/lib/screens/live_care/panding_list.dart @@ -204,13 +204,13 @@ class _LiveCarePandingListState extends State { // .pushNamed( // VIDEO_CALL, // item) - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - VideoCallPage( - item, - context))) + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // VideoCallPage( + // item, + // context))) }, ), ) diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart index 961654cc..e024624a 100644 --- a/lib/screens/live_care/video_call.dart +++ b/lib/screens/live_care/video_call.dart @@ -1,10 +1,12 @@ import 'dart:async'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/livecare_view_model.dart'; import 'package:doctor_app_flutter/models/livecare/get_pending_res_list.dart'; import 'package:doctor_app_flutter/models/livecare/session_status_model.dart'; import 'package:doctor_app_flutter/models/livecare/start_call_res.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/VideoChannel.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -13,9 +15,10 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class VideoCallPage extends StatefulWidget { - final LiveCarePendingListResponse patientData; + final PatiantInformtion patientData; final listContext; - VideoCallPage(this.patientData, this.listContext); + final LiveCarePatientViewModel model; + VideoCallPage({this.patientData, this.listContext, this.model}); @override _VideoCallPageState createState() => _VideoCallPageState(); @@ -41,7 +44,8 @@ class _VideoCallPageState extends State { super.didChangeDependencies(); if (_isInit) { _liveCareProvider = Provider.of(context); - startCall(false); + connectOpenTok(widget.model.startCallRes); + // widget.model.startCall(vCID: widget.patientData.vcId, isReCall: false); } _isInit = false; } @@ -61,7 +65,9 @@ class _VideoCallPageState extends State { kSessionId: tokenData.openSessionID, //'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg', kApiKey: '46209962', - vcId: widget.patientData.vCID, + vcId: widget.patientData.vcId, + isRecording: tokenData != null ? tokenData.isRecording: false, + patientName: widget.patientData.fullName ?? widget.patientData.firstName != null ? "${widget.patientData.firstName} ${widget.patientData.lastName}" : "-", tokenID: token, //"hfkjshdf347r8743", generalId: "Cs2020@2016\$2958", doctorId: doctorprofile['DoctorID'], @@ -76,7 +82,7 @@ class _VideoCallPageState extends State { }); }, onCallNotRespond: (SessionStatusModel sessionStatusModel) { - //TODO handling onCalcallNotRespondlEnd + //TODO handling onCalNotRespondEnd WidgetsBinding.instance.addPostFrameCallback((_) { changeRoute(context); }); @@ -130,7 +136,7 @@ class _VideoCallPageState extends State { height: MediaQuery.of(context).size.height * 0.02, ), Text( - widget.patientData.patientName, + widget.patientData.fullName, style: TextStyle( color: Colors.deepPurpleAccent, fontWeight: FontWeight.w900, @@ -319,7 +325,7 @@ class _VideoCallPageState extends State { endCallWithCharge() { _liveCareProvider - .endCallWithCharge(widget.patientData.vCID, doctorprofile['DoctorID']) + .endCallWithCharge(widget.patientData.vcId, doctorprofile['DoctorID']) .then((result) { closeRoute(); print('end callwith charge'); diff --git a/lib/screens/medical-file/health_summary_page.dart b/lib/screens/medical-file/health_summary_page.dart index ad7f13cb..6b4b066c 100644 --- a/lib/screens/medical-file/health_summary_page.dart +++ b/lib/screens/medical-file/health_summary_page.dart @@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; @@ -30,10 +30,8 @@ class _HealthSummaryPageState extends State { builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - patientType.toString() ?? "0", - arrivalType, isInpatient: isInpatient, ), isShowAppBar: true, diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index 9bfde511..b53284a9 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; @@ -102,20 +102,19 @@ class _MedicalFileDetailsState extends State { builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( - appBar: PatientProfileHeaderWhitAppointmentAppBar( - patient: patient, - patientType: patient.patientType.toString() ?? "0", - arrivalType: patient.arrivedOn.toString() ?? 0, + appBar: PatientProfileAppBar( + patient, doctorName: doctorName, profileUrl: doctorImage, clinic: clinicName, isPrescriptions: true, isMedicalFile: true, episode: episode, - vistDate: + visitDate: '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat( vistDate, ), isArabic: projectViewModel.isArabic)}', + isAppointmentHeader: true, ), isShowAppBar: true, appBarTitle: TranslationBase.of(context).medicalReport.toUpperCase(), diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 41ccd59e..eeea51c5 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -29,9 +29,9 @@ import '../../util/extenstions.dart'; DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); class MedicineSearchScreen extends StatefulWidget with DrAppToastMsg { - MedicineSearchScreen({this.changeLoadingStata}); + MedicineSearchScreen({this.changeLoadingState}); - final Function changeLoadingStata; + final Function changeLoadingState; @override _MedicineSearchState createState() => _MedicineSearchState(); diff --git a/lib/screens/patients/ECGPage.dart b/lib/screens/patients/ECGPage.dart index 33692628..ba4c108c 100644 --- a/lib/screens/patients/ECGPage.dart +++ b/lib/screens/patients/ECGPage.dart @@ -6,7 +6,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -31,7 +31,7 @@ class ECGPage extends StatelessWidget { baseViewModel: model, isShowAppBar: true, backgroundColor: Color(0xffF8F8F8), - appBar: PatientProfileHeaderNewDesignAppBar(patient,arrivalType??'0',patientType), + appBar: PatientProfileAppBar(patient), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(8.0), diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index 1b42d305..a88d3007 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -1,12 +1,16 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../../routes.dart'; @@ -22,6 +26,8 @@ class InPatientPage extends StatefulWidget { class _InPatientPageState extends State { TextEditingController _searchController = TextEditingController(); + bool isSortDes = false; + @override void dispose() { _searchController.dispose(); @@ -45,22 +51,47 @@ class _InPatientPageState extends State { ), Container( margin: EdgeInsets.all(16.0), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).searchPatientName, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, + child: Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).searchPatientName, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.black, + ), + onPressed: () {}, + ), + controller: _searchController, + onChanged: (value) { + model.filterSearchResults(value); + }), + + Positioned( + right: 35, + top:5, + child: IconButton( + icon: Icon( + isSortDes + ? FontAwesomeIcons.sortAmountDown + : FontAwesomeIcons.sortAmountUp, + color: Colors.black, + ), + iconSize: 20, + // padding: EdgeInsets.only(bottom: 30), + onPressed: () { + GifLoaderDialogUtils.showMyDialog(context); + model.sortInPatient(isDes: isSortDes); + isSortDes = !isSortDes; + GifLoaderDialogUtils.hideDialog(context); + }, ), - onPressed: () {}, - ), - controller: _searchController, - onChanged: (value) { - model.filterSearchResults(value); - }), + ) + ], + ), ), - model.filteredInPatientItems.length > 0 + model.state == ViewState.Idle?model.filteredInPatientItems.length > 0 ? Expanded( child: Container( margin: EdgeInsets.symmetric(horizontal: 16.0), @@ -155,6 +186,13 @@ class _InPatientPageState extends State { error: TranslationBase.of(context).noDataAvailable)), ), + ): Center( + child: Container( + height: 300, + width: 300, + child: Image.asset( + "assets/images/progress-loading-red.gif"), + ), ), ], ), diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index 60446887..ae0fbb59 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -1,17 +1,27 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'DischargedPatientPage.dart'; import 'InPatientPage.dart'; class PatientInPatientScreen extends StatefulWidget { + GetSpecialClinicalCareListResponseModel specialClinic; + + PatientInPatientScreen({Key key, this.specialClinic}); + @override _PatientInPatientScreenState createState() => _PatientInPatientScreenState(); } @@ -21,6 +31,9 @@ class _PatientInPatientScreenState extends State TabController _tabController; int _activeTab = 0; + int selectedMapId; + + @override void initState() { super.initState(); @@ -42,15 +55,26 @@ class _PatientInPatientScreenState extends State @override Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; + final screenSize = MediaQuery + .of(context) + .size; PatientSearchRequestModel requestModel = PatientSearchRequestModel(); + ProjectViewModel projectsProvider = Provider.of(context); + return BaseView( onModelReady: (model) async { model.clearPatientList(); + // if (widget.specialClinic != null) { + // await model.getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); + // requestModel.nursingStationID = + // model.specialClinicalCareMappingList[0].nursingStationID; + // requestModel.clinicID = 0; + // } model.getInPatientList(requestModel); }, - builder: (_, model, w) => AppScaffold( + builder: (_, model, w) => + AppScaffold( baseViewModel: model, isShowAppBar: false, body: Column( @@ -72,12 +96,125 @@ class _PatientInPatientScreenState extends State ), Expanded( child: AppText( - TranslationBase.of(context).inPatient, + TranslationBase + .of(context) + .inPatient, fontSize: SizeConfig.textMultiplier * 2.8, fontWeight: FontWeight.bold, color: Color(0xFF2B353E), ), ), + if (model.specialClinicalCareMappingList.isNotEmpty && + widget.specialClinic != null && + _activeTab != 2) + Container( + width: MediaQuery.of(context).size.width * .3, + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: selectedMapId == null ? model + .specialClinicalCareMappingList[0] + .nursingStationID : selectedMapId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model + .specialClinicalCareMappingList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .center, + children: [ + Container( + padding: + EdgeInsets.all(2), + margin: + EdgeInsets.all(2), + decoration: + new BoxDecoration( + color: + Colors.red[800], + borderRadius: + BorderRadius + .circular( + 20), + ), + constraints: + BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: Center( + child: AppText( + model + .specialClinicalCareMappingList + .length + .toString(), + color: + Colors.white, + fontSize: + projectsProvider + .isArabic + ? 10 + : 11, + textAlign: + TextAlign + .center, + ), + )), + ], + ), + AppText(item.description, + fontSize: 12, + color: Colors.black, + fontWeight: + FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) async { + setState(() { + selectedMapId = newValue; + }); + model.clearPatientList(); + GifLoaderDialogUtils.showMyDialog( + context); + + PatientSearchRequestModel requestModel = PatientSearchRequestModel( + nursingStationID: selectedMapId, clinicID: 0); + await model.getInPatientList(requestModel, isLocalBusy: true); + GifLoaderDialogUtils.hideDialog( + context); + if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } + }, + items: model + .specialClinicalCareMappingList + .map((item) { + return DropdownMenuItem( + child: AppText( + item.description, + textAlign: TextAlign.left, + ), + value: item.nursingStationID, + ); + }).toList(), + )), + ) ]), ), ), diff --git a/lib/screens/patients/insurance_approval_screen_patient.dart b/lib/screens/patients/insurance_approval_screen_patient.dart index 2e4645ae..b9d3f57e 100644 --- a/lib/screens/patients/insurance_approval_screen_patient.dart +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approvals_details.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card_insurance.dart'; @@ -20,12 +20,10 @@ class InsuranceApprovalScreenNew extends StatefulWidget { InsuranceApprovalScreenNew({this.appointmentNo}); @override - _InsuranceApprovalScreenNewState createState() => - _InsuranceApprovalScreenNewState(); + _InsuranceApprovalScreenNewState createState() => _InsuranceApprovalScreenNewState(); } -class _InsuranceApprovalScreenNewState - extends State { +class _InsuranceApprovalScreenNewState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -39,15 +37,11 @@ class _InsuranceApprovalScreenNewState ? (model) => model.getInsuranceInPatient(mrn: patient.patientId) : patient.appointmentNo != null ? (model) => model.getInsuranceApproval(patient, - appointmentNo: patient.appointmentNo, - projectId: patient.projectId) + appointmentNo: int.parse(patient?.appointmentNo.toString()), projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient), - builder: (BuildContext context, InsuranceViewModel model, Widget child) => - AppScaffold( - appBar: PatientProfileHeaderNewDesignAppBar( + builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( + appBar: PatientProfileAppBar( patient, - patientType.toString() ?? "0", - patientType, isInpatient: isInpatient, ), isShowAppBar: true, @@ -98,8 +92,7 @@ class _InsuranceApprovalScreenNewState Navigator.push( context, MaterialPageRoute( - builder: (context) => - InsuranceApprovalsDetails( + builder: (context) => InsuranceApprovalsDetails( patient: patient, indexInsurance: index, patientType: patientType, @@ -108,27 +101,14 @@ class _InsuranceApprovalScreenNewState }, child: DoctorCardInsurance( patientOut: "In Patient", - profileUrl: model - .insuranceApprovalInPatient[index] - .doctorImage, - clinic: model - .insuranceApprovalInPatient[index] - .clinicName, - doctorName: model - .insuranceApprovalInPatient[index] - .doctorName, - branch: model - .insuranceApprovalInPatient[index] - .approvalNo - .toString(), + profileUrl: model.insuranceApprovalInPatient[index].doctorImage, + clinic: model.insuranceApprovalInPatient[index].clinicName, + doctorName: model.insuranceApprovalInPatient[index].doctorName, + branch: model.insuranceApprovalInPatient[index].approvalNo.toString(), isPrescriptions: true, - approvalStatus: model - .insuranceApprovalInPatient[index] - .approvalStatusDescption ?? - '', - branch2: model - .insuranceApprovalInPatient[index] - .projectName, + approvalStatus: + model.insuranceApprovalInPatient[index].approvalStatusDescption ?? '', + branch2: model.insuranceApprovalInPatient[index].projectName, ), ), ), @@ -145,8 +125,7 @@ class _InsuranceApprovalScreenNewState Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context) - .noInsuranceApprovalFound), + child: AppText(TranslationBase.of(context).noInsuranceApprovalFound), ), SizedBox( height: 150.0, @@ -173,8 +152,7 @@ class _InsuranceApprovalScreenNewState Row( children: [ AppText( - TranslationBase.of(context) - .insurance22, + TranslationBase.of(context).insurance22, fontSize: 15.0, fontWeight: FontWeight.w600, fontFamily: 'Poppins', @@ -184,8 +162,7 @@ class _InsuranceApprovalScreenNewState Row( children: [ AppText( - TranslationBase.of(context) - .approvals22, + TranslationBase.of(context).approvals22, fontSize: 30.0, fontWeight: FontWeight.w700, ), @@ -202,8 +179,7 @@ class _InsuranceApprovalScreenNewState Navigator.push( context, MaterialPageRoute( - builder: (context) => - InsuranceApprovalsDetails( + builder: (context) => InsuranceApprovalsDetails( patient: patient, indexInsurance: index, patientType: patientType, @@ -211,24 +187,14 @@ class _InsuranceApprovalScreenNewState ); }, child: DoctorCardInsurance( - patientOut: model.insuranceApproval[index] - .patientDescription, - profileUrl: model - .insuranceApproval[index].doctorImage, - clinic: model - .insuranceApproval[index].clinicName, - doctorName: model - .insuranceApproval[index].doctorName, - branch: model - .insuranceApproval[index].approvalNo - .toString(), + patientOut: model.insuranceApproval[index].patientDescription, + profileUrl: model.insuranceApproval[index].doctorImage, + clinic: model.insuranceApproval[index].clinicName, + doctorName: model.insuranceApproval[index].doctorName, + branch: model.insuranceApproval[index].approvalNo.toString(), isPrescriptions: true, - approvalStatus: model - .insuranceApproval[index] - .approvalStatusDescption ?? - '', - branch2: model - .insuranceApproval[index].projectName, + approvalStatus: model.insuranceApproval[index].approvalStatusDescption ?? '', + branch2: model.insuranceApproval[index].projectName, ), ), ), @@ -245,8 +211,7 @@ class _InsuranceApprovalScreenNewState Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context) - .noInsuranceApprovalFound), + child: AppText(TranslationBase.of(context).noInsuranceApprovalFound), ) ], ), diff --git a/lib/screens/patients/insurance_approvals_details.dart b/lib/screens/patients/insurance_approvals_details.dart index 92910394..0945df37 100644 --- a/lib/screens/patients/insurance_approvals_details.dart +++ b/lib/screens/patients/insurance_approvals_details.dart @@ -5,7 +5,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -54,8 +54,8 @@ class _InsuranceApprovalsDetailsState extends State { AppScaffold( isShowAppBar: true, baseViewModel: model, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patient.patientType.toString(), patient.arrivedOn), + appBar: PatientProfileAppBar( + patient), body: patient.admissionNo != null ? SingleChildScrollView( child: Container( diff --git a/lib/screens/patients/out_patient/out_patient_screen.dart b/lib/screens/patients/out_patient/out_patient_screen.dart index c8b547b7..0037634d 100644 --- a/lib/screens/patients/out_patient/out_patient_screen.dart +++ b/lib/screens/patients/out_patient/out_patient_screen.dart @@ -1,12 +1,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/patient_type.dart'; - import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; - import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; @@ -14,7 +12,7 @@ import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; @@ -63,9 +61,9 @@ class OutPatientsScreen extends StatefulWidget { class _OutPatientsScreenState extends State { int clinicId; - AuthViewModel authProvider; + AuthenticationViewModel authenticationViewModel; - List _times = []; //['All', 'Today', 'Tomorrow', 'Next Week']; + List _times = []; int _activeLocation = 1; String patientType; @@ -79,10 +77,11 @@ class _OutPatientsScreenState extends State { PatientModel patient; OutPatientFilterType outPatientFilterType = OutPatientFilterType.Today; + bool isSortDes = true; @override Widget build(BuildContext context) { - authProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); _times = [ TranslationBase.of(context).previous, TranslationBase.of(context).today, @@ -106,15 +105,13 @@ class _OutPatientsScreenState extends State { Container( // color: Colors.red, height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - Color(0Xffffffff), Color(0xFFCCCCCC), + decoration: TextFieldsUtils.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC), borderRadius: 4, borderWidth: 0), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: _times.map((item) { - bool _isActive = - _times[_activeLocation] == item ? true : false; + bool _isActive = _times[_activeLocation] == item ? true : false; return Expanded( child: InkWell( @@ -134,8 +131,7 @@ class _OutPatientsScreenState extends State { await model.getPatientBasedOnDate( item: item, selectedPatientType: widget.selectedPatientType, - patientSearchRequestModel: - widget.patientSearchRequestModel, + patientSearchRequestModel: widget.patientSearchRequestModel, isSearchWithKeyInfo: widget.isSearchWithKeyInfo, outPatientFilterType: outPatientFilterType); GifLoaderDialogUtils.hideDialog(context); @@ -143,16 +139,11 @@ class _OutPatientsScreenState extends State { child: Center( child: Container( height: screenSize.height * 0.070, - decoration: - TextFieldsUtils.containerBorderDecoration( - _isActive - ? Color(0xFFD02127 /*B8382B*/) - : Color(0xFFEAEAEA), - _isActive - ? Color(0xFFD02127) - : Color(0xFFEAEAEA), - borderRadius: 4, - borderWidth: 0), + decoration: TextFieldsUtils.containerBorderDecoration( + _isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + _isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -160,22 +151,16 @@ class _OutPatientsScreenState extends State { AppText( item, fontSize: SizeConfig.textMultiplier * 1.8, - color: _isActive - ? Colors.white - : Color(0xFF2B353E), + color: _isActive ? Colors.white : Color(0xFF2B353E), fontWeight: FontWeight.w700, ), - _isActive && - _activeLocation != 0 && - model.state == ViewState.Idle + _isActive && _activeLocation != 0 && model.state == ViewState.Idle ? Container( padding: EdgeInsets.all(2), - margin: EdgeInsets.symmetric( - horizontal: 5), + margin: EdgeInsets.symmetric(horizontal: 5), decoration: new BoxDecoration( color: Colors.white, - borderRadius: - BorderRadius.circular(50), + borderRadius: BorderRadius.circular(50), ), constraints: BoxConstraints( minWidth: 20, @@ -183,9 +168,7 @@ class _OutPatientsScreenState extends State { ), child: new Text( model.filterData.length.toString(), - style: new TextStyle( - color: Colors.red, - fontSize: 10), + style: new TextStyle(color: Colors.red, fontSize: 10), textAlign: TextAlign.center, ), ) @@ -203,7 +186,7 @@ class _OutPatientsScreenState extends State { SizedBox(height: 18.5), Container( width: SizeConfig.screenWidth * 0.9, - height: 75, + height: 85, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( @@ -211,24 +194,22 @@ class _OutPatientsScreenState extends State { color: HexColor("#CCCCCC"), ), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: AppText( + TranslationBase.of(context).searchPatientName, + fontSize: 13, + )), + Stack( children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).searchPatientName, - fontSize: 13, - )), AppTextFormField( // focusNode: focusProject, controller: _controller, borderColor: Colors.white, prefix: IconButton( icon: Icon( - _activeLocation != 0 - ? DoctorApp.filter_1 - : FontAwesomeIcons.slidersH, + _activeLocation != 0 ? DoctorApp.filter_1 : FontAwesomeIcons.slidersH, color: Colors.black, ), iconSize: 20, @@ -239,19 +220,33 @@ class _OutPatientsScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => - FilterDatePage( - outPatientFilterType: - outPatientFilterType, - patientSearchViewModel: - model, + builder: (BuildContext context) => FilterDatePage( + outPatientFilterType: outPatientFilterType, + patientSearchViewModel: model, ))); }, ), onChanged: (String str) { model.searchData(str); }), - ])), + Positioned( + right: 25, + child: IconButton( + icon: Icon( + isSortDes ? FontAwesomeIcons.sortAmountDown : FontAwesomeIcons.sortAmountUp, + color: Colors.black, + ), + iconSize: 20, + padding: EdgeInsets.only(bottom: 30), + onPressed: () { + model.sortOutPatient(isDes: isSortDes); + isSortDes = !isSortDes; + }, + ), + ) + ], + ), + ])), SizedBox( height: 10.0, ), @@ -260,8 +255,7 @@ class _OutPatientsScreenState extends State { child: model.filterData.isEmpty ? Center( child: ErrorMessage( - error: TranslationBase.of(context) - .youDontHaveAnyPatient, + error: TranslationBase.of(context).youDontHaveAnyPatient, ), ) : ListView.builder( @@ -270,11 +264,8 @@ class _OutPatientsScreenState extends State { itemCount: model.filterData.length, itemBuilder: (BuildContext ctxt, int index) { if (_activeLocation != 0 || - (model.filterData[index].patientStatusType != - null && - model.filterData[index] - .patientStatusType == - 43)) + (model.filterData[index].patientStatusType != null && + model.filterData[index].patientStatusType == 43)) return Padding( padding: EdgeInsets.all(8.0), child: PatientCard( @@ -285,20 +276,16 @@ class _OutPatientsScreenState extends State { isInpatient: widget.isInpatient, onTap: () { // TODO change the parameter to daynamic - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": model.filterData[index], - "patientType": "1", - "from": widget - .patientSearchRequestModel.from, - "to": widget - .patientSearchRequestModel.from, - "isSearch": false, - "isInpatient": false, - "arrivalType": "7", - "isSearchAndOut": false, - }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": model.filterData[index], + "patientType": "1", + "from": widget.patientSearchRequestModel.from, + "to": widget.patientSearchRequestModel.from, + "isSearch": false, + "isInpatient": false, + "arrivalType": "7", + "isSearchAndOut": false, + }); }, // isFromSearch: widget.isSearch, ), diff --git a/lib/screens/patients/patient_search/patient_search_result_screen.dart b/lib/screens/patients/patient_search/patient_search_result_screen.dart index 3395ead8..8044e991 100644 --- a/lib/screens/patients/patient_search/patient_search_result_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_result_screen.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/patient_type.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; @@ -10,13 +10,11 @@ import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -48,7 +46,7 @@ class PatientsSearchResultScreen extends StatefulWidget { class _PatientsSearchResultScreenState extends State { int clinicId; - AuthViewModel authProvider; + AuthenticationViewModel authenticationViewModel; String patientType; String patientTypeTitle; @@ -62,7 +60,7 @@ class _PatientsSearchResultScreenState @override Widget build(BuildContext context) { - authProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); return BaseView( onModelReady: (model) async { if (!widget.isSearchWithKeyInfo && diff --git a/lib/screens/patients/patient_search/patient_search_screen.dart b/lib/screens/patients/patient_search/patient_search_screen.dart index b6f9cae8..2275cc09 100644 --- a/lib/screens/patients/patient_search/patient_search_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_screen.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/patient_type.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_result_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; @@ -29,11 +29,11 @@ class _PatientSearchScreenState extends State { TextEditingController middleNameInfoController = TextEditingController(); TextEditingController lastNameFileInfoController = TextEditingController(); PatientType selectedPatientType = PatientType.inPatient; - AuthViewModel authProvider; + AuthenticationViewModel authenticationViewModel; @override Widget build(BuildContext context) { - authProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); return BaseView( onModelReady: (model) async {}, builder: (_, model, w) => AppScaffold( @@ -148,7 +148,7 @@ class _PatientSearchScreenState extends State { }); PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel( - doctorID: authProvider.doctorProfile.doctorID); + doctorID: authenticationViewModel.doctorProfile.doctorID); if (showOther) { patientSearchRequestModel.firstName = firstNameInfoController.text.trim().isEmpty diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 6890d74f..081f1a6e 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -12,7 +12,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-wi import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -47,8 +47,8 @@ class _UcafDetailScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patientType, arrivalType), + appBar: PatientProfileAppBar( + patient), appBarTitle: TranslationBase.of(context).ucaf, body: Column( children: [ diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 5e1b6155..3bbc6637 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -65,8 +65,8 @@ class _UCAFInputScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patientType, arrivalType), + appBar: PatientProfileAppBar( + patient), appBarTitle: TranslationBase.of(context).ucaf, body: model.patientVitalSignsHistory.length > 0 && model.patientChiefComplaintList != null && @@ -428,10 +428,11 @@ class _UCAFInputScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: AppText( - model.patientVitalSignsHistory.length > 0 + model.patientVitalSignsHistory.length == 0 ? TranslationBase.of(context).vitalSignEmptyMsg : TranslationBase.of(context).chiefComplaintEmptyMsg, fontWeight: FontWeight.normal, + textAlign: TextAlign.center, color: HexColor("#B8382B"), fontSize: SizeConfig.textMultiplier * 2.5, ), diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart deleted file mode 100644 index bbc968b0..00000000 --- a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart +++ /dev/null @@ -1,307 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; - -import '../../../../routes.dart'; - -class AdmissionRequestDetailScreen extends StatefulWidget { - @override - _AdmissionRequestDetailScreenState createState() => - _AdmissionRequestDetailScreenState(); -} - -class _AdmissionRequestDetailScreenState - extends State { - DateTime selectedDate; - dynamic _selectedSpeciality; - dynamic _selectedDoctor; - - @override - Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - final screenSize = MediaQuery.of(context).size; - ProjectViewModel projectViewModel = Provider.of(context); - - return BaseView( - onModelReady: (model) => model.getSpecialityList(), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).admissionRequest, - body: model.doctorsList != null - ? Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - PatientPageHeaderWidget(patient), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).patientDetails, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - Container( - decoration: - Helpers.containerBorderDecoration( - Color(0xFFEEEEEE), - Color(0xFFCCCCCC), - borderWidth: 0.0), - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - "Pre Admission Number :01", - null, - false), - enabled: false, - // controller: _remarksController, - keyboardType: TextInputType.text, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () => _selectDate(context, model), - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).date, - selectedDate != null - ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .specialityAndDoctorDetail, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.speciality, - attributeName: - projectViewModel.isArabic - ? 'nameAr' - : 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedSpeciality = - selectedValue; - }); - }); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .speciality, - _selectedSpeciality != null - ? projectViewModel.isArabic - ? _selectedSpeciality[ - 'nameAr'] - : _selectedSpeciality[ - 'nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - usingSearch: true, - hintSearchText: - TranslationBase.of(context) - .doctorSearch, - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .doctor, - _selectedDoctor != null - ? _selectedDoctor[ - 'DoctorName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - decoration: Helpers.containerBorderDecoration( - Color(0xFFEEEEEE), Color(0xFFCCCCCC), - borderWidth: 0.0), - child: InkWell( - onTap: () => null, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .referringDate, - null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Color(0xFFCCCCCC), - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - decoration: - Helpers.containerBorderDecoration( - Color(0xFFEEEEEE), - Color(0xFFCCCCCC), - borderWidth: 0.0), - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .referringDoctor, - null, - true, - dropDownColor: Color(0xFFCCCCCC)), - enabled: false, - // controller: _remarksController, - keyboardType: TextInputType.text, - )), - ], - ), - ), - ], - ), - ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () { - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_2, - arguments: {'patient': patient}); - }, - ), - ), - ], - ) - : Container(), - ), - ); - } - - _selectDate(BuildContext context, AdmissionRequestViewModel model) async { - selectedDate = DateTime.now(); - final DateTime picked = await showDatePicker( - context: context, - initialDate: selectedDate, - firstDate: DateTime.now().add(Duration(hours: 2)), - lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, - ); - if (picked != null && picked != selectedDate) { - setState(() { - selectedDate = picked; - }); - } - } -} diff --git a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart index d23397da..f0ccaece 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -61,8 +61,8 @@ class _AdmissionRequestThirdScreenState builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patientType, arrivalType), + appBar: PatientProfileAppBar( + patient), appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -453,20 +453,6 @@ class _AdmissionRequestThirdScreenState ); } - Future _selectDate(BuildContext context, DateTime dateTime, - Function(DateTime picked) updateDate) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: dateTime, - firstDate: DateTime.now(), - lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, - ); - if (picked != null && picked != dateTime) { - updateDate(picked); - } - } - void openListDialogField(String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart index 120b6adf..563b4827 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -8,7 +8,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -52,8 +52,8 @@ class _AdmissionRequestThirdScreenState builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patientType, arrivalType), + appBar: PatientProfileAppBar( + patient), appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 8627d224..dc79b2be 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -10,7 +10,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -74,8 +74,8 @@ class _AdmissionRequestSecondScreenState builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patientType, arrivalType), + appBar: PatientProfileAppBar( + patient), appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -477,7 +477,7 @@ class _AdmissionRequestSecondScreenState Expanded( child: AppButton( title: TranslationBase.of(context).previous, - color: HexColor("#EAEAEA"), + color: Color(0xffEAEAEA), fontColor: Colors.black, onPressed: () { Navigator.pop(context); diff --git a/lib/screens/patients/profile/in_patient_profile_screen.dart b/lib/screens/patients/profile/in_patient_profile_screen.dart deleted file mode 100644 index 8b1c3b7e..00000000 --- a/lib/screens/patients/profile/in_patient_profile_screen.dart +++ /dev/null @@ -1,227 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; -import '../../../routes.dart'; - - -class InPatientProfileScreen extends StatefulWidget { - @override - _InPatientProfileScreenState createState() => _InPatientProfileScreenState(); -} - -class _InPatientProfileScreenState extends Statewith SingleTickerProviderStateMixin { - PatiantInformtion patient; - - bool isFromSearch = false; - - bool isInpatient = false; - - bool isDischargedPatient = false; - String patientType; - String arrivalType; - String from; - String to; - - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - patient = routeArgs['patient']; - patientType = routeArgs['patientType']; - arrivalType = routeArgs['arrivalType']; - from = routeArgs['from']; - to = routeArgs['to']; - if (routeArgs.containsKey("isSearch")) { - isFromSearch = routeArgs['isSearch']; - } - if (routeArgs.containsKey("isInpatient")) { - isInpatient = routeArgs['isInpatient']; - } - if (routeArgs.containsKey("isDischargedPatient")) { - isDischargedPatient = routeArgs['isDischargedPatient']; - } - - } - - @override - Widget build(BuildContext context) { - return BaseView( - builder: (_, patientViewModel, w) => AppScaffold( - baseViewModel: patientViewModel, - appBarTitle: TranslationBase.of(context).patientProfile, - isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar(patient,arrivalType??'0',patientType), - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(top: 10), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 15.0,horizontal: 15), - child: GridView.count( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - crossAxisSpacing: 10, - mainAxisSpacing: 10, - childAspectRatio: 1 / 1.0, - crossAxisCount: 3, - children: [ - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: TranslationBase.of(context).vital, - nameLine2: TranslationBase.of(context).signs, - route: VITAL_SIGN_DETAILS, - isInPatient: true, - icon: 'patient/vital_signs.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: LAB_RESULT, - isInPatient: true, - nameLine1: TranslationBase.of(context).lab, - nameLine2: TranslationBase.of(context).result, - icon: 'patient/lab_results.png'), - PatientProfileButton( - - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isInPatient: isInpatient, - route: RADIOLOGY_PATIENT, - nameLine1: TranslationBase.of(context).radiology, - nameLine2: TranslationBase.of(context).result, - icon: 'patient/health_summary.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_PRESCRIPTION_NEW, - nameLine1: TranslationBase.of(context).patient, - nameLine2: TranslationBase.of(context).prescription, - icon: 'patient/order_prescription.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PROGRESS_NOTE, - isDischargedPatient: isDischargedPatient, - nameLine1: TranslationBase.of(context).progress, - nameLine2: TranslationBase.of(context).note, - icon: 'patient/Progress_notes.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_NOTE, - isDischargedPatient: isDischargedPatient, - nameLine1: "Order", //"Text", - nameLine2: - "Sheet", //TranslationBase.of(context).orders, - icon: 'patient/Progress_notes.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_PROCEDURE, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).procedures, - icon: 'patient/Order_Procedures.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: HEALTH_SUMMARY, - nameLine1: "Health", - //TranslationBase.of(context).medicalReport, - nameLine2: "Summary", - //TranslationBase.of(context).summaryReport, - icon: 'patient/health_summary.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isDisable: true, - route: HEALTH_SUMMARY, - nameLine1: "Medical", //Health - //TranslationBase.of(context).medicalReport, - nameLine2: "Report", //Report - //TranslationBase.of(context).summaryReport, - icon: 'patient/health_summary.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: REFER_IN_PATIENT_TO_DOCTOR, - isInPatient: true, - nameLine1: TranslationBase.of(context).referral, - nameLine2: TranslationBase.of(context).patient, - icon: 'patient/refer_patient.png'), - PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PATIENT_INSURANCE_APPROVALS_NEW, - nameLine1: TranslationBase.of(context).insurance, - nameLine2: TranslationBase.of(context).approvals, - icon: 'patient/vital_signs.png'), - PatientProfileButton( - - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isDisable: true, - route: null, - nameLine1: "Discharge", - nameLine2: "Summery", - icon: 'patient/patient_sick_leave.png'), - PatientProfileButton( - - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ADD_SICKLEAVE, - nameLine1: TranslationBase.of(context).patientSick, - nameLine2: TranslationBase.of(context).leave, - icon: 'patient/patient_sick_leave.png'), - ], - ), - ), - ), - ), - )); - } -} - -class AvatarWidget extends StatelessWidget { - final Widget avatarIcon; - - AvatarWidget(this.avatarIcon); - - @override - Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.08), - offset: Offset(0.0, 5.0), - blurRadius: 16.0) - ], - borderRadius: BorderRadius.all(Radius.circular(35.0)), - color: Color(0xffCCCCCC), - ), - child: avatarIcon, - ); - } -} diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart index 1c5104f8..e58d4ef5 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -14,13 +14,15 @@ class LaboratoryResultPage extends StatefulWidget { final PatiantInformtion patient; final String patientType; final String arrivalType; + final bool isInpatient; LaboratoryResultPage( {Key key, this.patientLabOrders, this.patient, this.patientType, - this.arrivalType}); + this.arrivalType, + this.isInpatient}); @override _LaboratoryResultPageState createState() => _LaboratoryResultPageState(); @@ -30,44 +32,36 @@ class _LaboratoryResultPageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getLaboratoryResult( - invoiceNo: widget.patientLabOrders.invoiceNo, - clinicID: widget.patientLabOrders.clinicID, - projectID: widget.patientLabOrders.projectID, - orderNo: widget.patientLabOrders.orderNo, + onModelReady: (model) => model.getPatientLabResult( + patientLabOrder: widget.patientLabOrders, patient: widget.patient, - isInpatient: widget.patientType == "1"), + isInpatient: true), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBar: PatientProfileHeaderWhitAppointmentAppBar( - patient: widget.patient, - patientType: widget.patientType ?? "0", - arrivalType: widget.arrivalType ?? "0", - orderNo: widget.patientLabOrders.orderNo, + appBar: PatientProfileAppBar( + widget.patient, + isInpatient:widget.isInpatient, + isFromLabResult: true, appointmentDate: widget.patientLabOrders.orderDate, - doctorName: widget.patientLabOrders.doctorName, - branch: widget.patientLabOrders.projectName, - clinic: widget.patientLabOrders.clinicDescription, - profileUrl: widget.patientLabOrders.doctorImageURL, - invoiceNO: widget.patientLabOrders.invoiceNo, ), + baseViewModel: model, - body: Scaffold( + body: AppScaffold( + isShowAppBar: false, body: SingleChildScrollView( child: Column( children: [ - ...List.generate( - model.patientLabSpecialResult.length, - (index) => LaboratoryResultWidget( - onTap: () async {}, - billNo: widget.patientLabOrders.invoiceNo, - details: model - .patientLabSpecialResult[index].resultDataHTML, - orderNo: widget.patientLabOrders.orderNo, - patientLabOrder: widget.patientLabOrders, - patient: widget.patient, - isInpatient: widget.patientType == "1", - )), + LaboratoryResultWidget( + onTap: () async {}, + billNo: widget.patientLabOrders.invoiceNo, + details: model.patientLabSpecialResult.length > 0 + ? model.patientLabSpecialResult[0].resultDataHTML + : null, + orderNo: widget.patientLabOrders.orderNo, + patientLabOrder: widget.patientLabOrders, + patient: widget.patient, + isInpatient: widget.patientType == "1", + ), ], ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart index 810f025f..08c247ee 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart @@ -4,11 +4,13 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/LabResultWidget.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:provider/provider.dart'; class LaboratoryResultWidget extends StatefulWidget { @@ -37,16 +39,18 @@ class LaboratoryResultWidget extends StatefulWidget { class _LaboratoryResultWidgetState extends State { bool _isShowMoreGeneral = true; + bool _isShowMore = true; ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientLabResult( - patientLabOrder: widget.patientLabOrder, - patient: widget.patient, - isInpatient: widget.isInpatient), + onModelReady: (model) => model.setLabResultDependOnFilterName(), + // model.getPatientLabResult( + // patientLabOrder: widget.patientLabOrder, + // patient: widget.patient, + // isInpatient: widget.isInpatient), builder: (_, model, w) => NetworkBaseView( baseViewModel: model, child: Container( @@ -128,8 +132,11 @@ class _LaboratoryResultWidgetState extends State { model.labResultLists.length, (index) => LabResultWidget( patientLabOrder: widget.patientLabOrder, - filterName: model.labResultLists[index].filterName, - patientLabResultList: model.labResultLists[index].patientLabResultList, + filterName: model + .labResultLists[index].filterName, + patientLabResultList: model + .labResultLists[index] + .patientLabResultList, patient: widget.patient, isInpatient: widget.isInpatient, ), @@ -142,8 +149,84 @@ class _LaboratoryResultWidgetState extends State { ), ), SizedBox( - height: 10, + height: 15, ), + if (widget.details != null && widget.details.isNotEmpty) + Column( + children: [ + InkWell( + onTap: () { + setState(() { + _isShowMore = !_isShowMore; + }); + }, + child: Container( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(5.0), + )), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only( + left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .specialResult, + bold: true, + ))), + Container( + width: 25, + height: 25, + child: Icon( + _isShowMore + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Colors.grey[800], + size: 22, + ), + ) + ], + ), + ), + ), + if (_isShowMore) + AnimatedContainer( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + )), + duration: Duration(milliseconds: 7000), + child: Container( + width: double.infinity, + child: !Helpers.isTextHtml(widget.details) + ? AppText( + widget.details ?? + TranslationBase.of(context) + .noDataAvailable, + ) + : Html( + data: widget.details ?? + TranslationBase.of(context) + .noDataAvailable, + ), + ), + ), + SizedBox( + height: 10, + ), + ], + ), ], ), ], diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index f60e875a..7da55967 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -3,10 +3,11 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result_page.dart'; -import 'package:doctor_app_flutter/screens/procedures/add_lab_orders.dart'; +import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; +import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; @@ -26,6 +27,9 @@ class _LabsHomePageState extends State { String arrivalType; PatiantInformtion patient; bool isInpatient; + bool isFromLiveCare; + + @override void didChangeDependencies() { super.didChangeDependencies(); @@ -34,6 +38,8 @@ class _LabsHomePageState extends State { patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; isInpatient = routeArgs['isInpatient']; + isFromLiveCare = routeArgs['isFromLiveCare']; + print(arrivalType); } @@ -46,10 +52,8 @@ class _LabsHomePageState extends State { baseViewModel: model, backgroundColor: Colors.grey[100], isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - patient.patientType.toString() ?? '0', - patientType, isInpatient: isInpatient, ), body: SingleChildScrollView( @@ -104,17 +108,20 @@ class _LabsHomePageState extends State { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || + (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddSelectedLabOrder( - patient: patient, - model: model, - )), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.LAB_RESULT, + ), + ), ); }, label: TranslationBase.of(context).applyForNewLabOrder, @@ -180,9 +187,9 @@ class _LabsHomePageState extends State { context, FadePage( page: LaboratoryResultPage( - patientLabOrders: - model.patientLabOrdersList[index], + patientLabOrders: model.patientLabOrdersList[index], patient: patient, + isInpatient:isInpatient, arrivalType: arrivalType, patientType: patientType, ), @@ -199,7 +206,7 @@ class _LabsHomePageState extends State { clinic: model .patientLabOrdersList[index].clinicDescription, appointmentDate: - model.patientLabOrdersList[index].orderDate, + model.patientLabOrdersList[index].orderDate.add(Duration(days: 1)), orderNo: model.patientLabOrdersList[index].orderNo, isShowTime: false, ), diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index 1b33aecb..b3714edd 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -1,55 +1,49 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/html_rich_editor.dart'; import 'package:flutter/material.dart'; +import 'package:html_editor_enhanced/html_editor.dart'; import 'package:permission_handler/permission_handler.dart'; -import 'package:provider/provider.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_to_text.dart' as stt; class AddVerifyMedicalReport extends StatefulWidget { + final PatiantInformtion patient; + final String patientType; + final String arrivalType; + final MedicalReportModel medicalReport; + final PatientMedicalReportViewModel model; final MedicalReportStatus status; - - AddVerifyMedicalReport(this.status); + final String medicalNote; + + const AddVerifyMedicalReport( + {Key key, + this.patient, + this.patientType, + this.arrivalType, + this.medicalReport, + this.model, + this.status, + this.medicalNote}) + : super(key: key); @override _AddVerifyMedicalReportState createState() => _AddVerifyMedicalReportState(); } class _AddVerifyMedicalReportState extends State { - stt.SpeechToText speech = stt.SpeechToText(); - var reconizedWord; - var event = RobotProvider(); - - TextEditingController commentController = TextEditingController(); - String commentsError; - - @override - void initState() { - requestPermissions(); - event.controller.stream.listen((p) { - if (p['startPopUp'] == 'true') { - if (this.mounted) { - initSpeechState().then((value) => {onVoiceText()}); - } - } - }); - super.initState(); - } - @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + String txtOfMedicalReport; - return BaseView( + return BaseView( + onModelReady: (model) async {}, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, @@ -60,67 +54,103 @@ class _AddVerifyMedicalReportState extends State { body: Column( children: [ Expanded( - child: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .sickLeaveComments, - controller: commentController, - maxLines: 30, - minLines: 20, - hasBorder: true, - validationError: commentsError, + child: Container( + margin: EdgeInsets.all(16), + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (model.medicalReportTemplate.length > 0) + HtmlRichEditor( + initialText: (widget.medicalReport != null + ? widget.medicalNote + : widget.model.medicalReportTemplate[0].templateText.length > 0 + ? widget.model.medicalReportTemplate[0].templateText + : ""), + hint: "Write the medical report ", + height: MediaQuery.of(context).size.height * 0.75, + ), + ], ), - Positioned( - top: -2, - //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context).size.width * - 0.75 - : 15, - child: Column( - children: [ - IconButton( - icon: Icon(DoctorApp.speechtotext, - color: Colors.black, size: 35), - onPressed: () { - initSpeechState().then( - (value) => {onVoiceText()}); - }, - ), - ], - )), - ], + ), ), - ], - ), + ), + ], ), ), ), Container( - margin: EdgeInsets.all(16.0), - child: AppButton( - title: widget.status == MedicalReportStatus.ADD - ? TranslationBase.of(context).medicalReportAdd - : TranslationBase.of(context).medicalReportVerify, - color: Color(0xff359846), - // disabled: progressNoteController.text.isEmpty, - fontWeight: FontWeight.w700, - onPressed: () { - setState(() { - if (commentController.text == "") { - commentsError = - TranslationBase.of(context).fieldRequired; - } else { - commentsError = null; - } - }); - }, + padding: EdgeInsets.all(16.0), + color: Colors.white, + child: Row( + children: [ + Expanded( + child: AppButton( + title: widget.status == MedicalReportStatus.ADD + ? TranslationBase.of(context).save + : TranslationBase.of(context).save, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + // disabled: progressNoteController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () async { + txtOfMedicalReport = await HtmlEditor.getText(); + + if (txtOfMedicalReport.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + widget.medicalReport != null + ?await widget.model.updateMedicalReport( + widget.patient, + txtOfMedicalReport, + widget.medicalReport != null ? widget.medicalReport.lineItemNo : null, + widget.medicalReport != null ? widget.medicalReport.invoiceNo : null) + : await widget.model.addMedicalReport(widget.patient, txtOfMedicalReport); + //model.getMedicalReportList(patient); + + Navigator.pop(context); + + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(widget.model.error); + } + } else { + DrAppToastMsg.showErrorToast("Please enter medical note"); + } + }, + ), + ), + SizedBox( + width: 8, + ), + if (widget.medicalReport != null) + Expanded( + child: AppButton( + title: widget.status == MedicalReportStatus.ADD + ? TranslationBase.of(context).add + : TranslationBase.of(context).verify, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () async { + txtOfMedicalReport = await HtmlEditor.getText(); + if (txtOfMedicalReport.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + await widget.model.verifyMedicalReport(widget.patient, widget.medicalReport); + GifLoaderDialogUtils.hideDialog(context); + Navigator.pop(context); + if (widget.model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(widget.model.error); + } + } else { + DrAppToastMsg.showErrorToast("Please enter medical note"); + } + }, + ), + ), + ], ), ), ], @@ -128,59 +158,11 @@ class _AddVerifyMedicalReportState extends State { )); } - onVoiceText() async { - new SpeechToText(context: context).showAlertDialog(context); - var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); - if (available) { - speech.listen( - onResult: resultListener, - listenMode: stt.ListenMode.confirmation, - localeId: lang == 'en' ? 'en-US' : 'ar-SA', - ); - } else { - print("The user has denied the use of speech recognition."); - } - } - - void errorListener(SpeechRecognitionError error) { - event.setValue({"searchText": 'null'}); - //SpeechToText.closeAlertDialog(context); - print(error); - } - - void statusListener(String status) { - reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; - } - void requestPermissions() async { Map statuses = await [ Permission.microphone, ].request(); } - - void resultListener(result) { - reconizedWord = result.recognizedWords; - event.setValue({"searchText": reconizedWord}); - - if (result.finalResult == true) { - setState(() { - SpeechToText.closeAlertDialog(context); - speech.stop(); - commentController.text += reconizedWord + '\n'; - }); - } else { - print(result.finalResult); - } - } - - Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); - print(hasSpeech); - if (!mounted) return; - } } enum MedicalReportStatus { ADD, VERIFY } diff --git a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart index 76ce2951..ab24f8e0 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart @@ -1,14 +1,19 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:provider/provider.dart'; class MedicalReportDetailPage extends StatelessWidget { @@ -19,15 +24,15 @@ class MedicalReportDetailPage extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; + MedicalReportModel medicalReport = routeArgs['medicalReport']; - return BaseView( + return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: PatientProfileAppBar( patient, - patientType, - arrivalType, ), body: Container( child: SingleChildScrollView( @@ -54,7 +59,7 @@ class MedicalReportDetailPage extends StatelessWidget { ], ), ), - Container( + medicalReport.reportDataHtml != null ? Container( width: double.infinity, margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), @@ -69,88 +74,11 @@ class MedicalReportDetailPage extends StatelessWidget { ), ), ), - child: Column( - children: [ - AppText( - TranslationBase.of(context).chiefComplaints, - fontWeight: FontWeight.w700, - fontSize: 2.4 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), - AppText( - "chief complaints data", - fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), - SizedBox( - height: 8, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 30, - height: 30, - margin: EdgeInsets.only( - left: projectViewModel.isArabic ? 10 : 85, - right: projectViewModel.isArabic ? 85 : 10, - top: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border( - bottom: BorderSide( - color: Colors.grey[400], width: 2.5), - left: BorderSide( - color: Colors.grey[400], width: 2.5), - )), - ), - Expanded( - child: Container( - margin: EdgeInsets.only(top: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: LargeAvatar( - name: "doctorName", - url: "doctor avatar", - ), - width: 25, - height: 25, - margin: EdgeInsets.only(top: 10), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - '${TranslationBase.of(context).dr}. replace with doctor name', - fontWeight: FontWeight.w800, - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Colors.black, - ), - AppText( - 'replace clinic Description', - fontWeight: FontWeight.w700, - fontSize: 1.4 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ], - ), - ], + child: Html( + data: medicalReport.reportDataHtml ?? "" ), + ) : Container( + child: ErrorMessage(error: "No Data",), ), ], ), diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index f31c754e..a5c367de 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -1,8 +1,244 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; -class MedicalReportPage extends StatelessWidget { +import '../../../../routes.dart'; +import 'AddVerifyMedicalReport.dart'; + +class MedicalReportPage extends StatefulWidget { + @override + _MedicalReportPageState createState() => _MedicalReportPageState(); +} + +class _MedicalReportPageState extends State { @override Widget build(BuildContext context) { - return Container(); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) async { + await model.getMedicalReportList(patient); + await model.getMedicalReportTemplate(); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: PatientProfileAppBar( + patient, + ), + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).medical}", + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w700, + color: Color(0xFF2E303A), + ), + AppText( + TranslationBase.of(context).report, + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + color: Color(0xFF2E303A), + ) + ], + ), + ), + AddNewOrder( + onTap: () { + // if (model.hasOnHold()) { + // Helpers.showErrorToast("Please Verified the on hold report to be able to add new one"); + // } else + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddVerifyMedicalReport( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + model: model, + status: MedicalReportStatus.ADD, + )), + ); + + }, + label: TranslationBase.of(context).createNewMedicalReport, + ), + // if (model.state != ViewState.ErrorLocal)ß + ...List.generate( + model.medicalReportList.length, + (index) => InkWell( + onTap: () { + if (model.medicalReportList[index].status == 1) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddVerifyMedicalReport( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + medicalReport: model.medicalReportList[index], + model: model, + medicalNote: model.medicalReportList[index].reportDataHtml, + )), + ); + } else { + Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'type': MedicalReportStatus.ADD, + 'medicalReport': model.medicalReportList[index], + 'model': model, + }); + } + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 8), + child: CardWithBgWidget( + hasBorder: false, + bgColor: model.medicalReportList[index].status == 1 ? Color(0xFFCC9B14) : Colors.green[700], + widget: Column( + children: [ + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + model.medicalReportList[index].status == 1 + ? TranslationBase.of(context).onHold + : TranslationBase.of(context).verified, + color: model.medicalReportList[index].status == 1 + ? Color(0xFFCC9B14) + : Colors.green[700], + fontSize: 1.4 * SizeConfig.textMultiplier, + bold: true, + ), + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index].doctorNameN ?? "" + : model.medicalReportList[index].doctorName ?? "", + fontSize: 1.9 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w700, + color: Color(0xFF2E303A), + ), + ], + )), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + AppText( + '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "dd MMM yyyy")}', + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + fontSize: 1.6 * SizeConfig.textMultiplier, + ), + AppText( + '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "hh:mm a")}', + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + fontSize: 1.5 * SizeConfig.textMultiplier, + ), + ], + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(left: 0, top: 4, right: 8, bottom: 0), + child: LargeAvatar( + name: projectViewModel.isArabic + ? model.medicalReportList[index].doctorNameN + : model.medicalReportList[index].doctorName, + url: model.medicalReportList[index].doctorImageURL, + ), + width: 50, + height: 50, + ), + Expanded( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index].projectNameN + : model.medicalReportList[index].projectName, + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Color(0xFF2E303A), + ), + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index].clinicNameN + : model.medicalReportList[index].clinicName, + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Color(0xFF2E303A), + ), + ], + ), + ), + ), + Container( + height: 50, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + model.medicalReportList[index].status == 1 ? DoctorApp.edit_1 : EvaIcons.eye, + ), + ], + ), + ) + ], + ), + ], + ), + ), + ), + ), + ), + SizedBox( + height: 15, + ) + ], + ), + ), + ), + ); } } diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index 668e5a44..723ee75f 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -1,6 +1,6 @@ import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; @@ -10,7 +10,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.dar import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; @@ -39,10 +39,8 @@ class ProgressNoteScreen extends StatefulWidget { class _ProgressNoteState extends State { List notesList; var filteredNotesList; - final _controller = TextEditingController(); - var _isInit = true; bool isDischargedPatient = false; - AuthViewModel authProvider; + AuthenticationViewModel authenticationViewModel; ProjectViewModel projectViewModel; getProgressNoteList(BuildContext context, PatientViewModel model, @@ -71,7 +69,7 @@ class _ProgressNoteState extends State { @override Widget build(BuildContext context) { - authProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); projectViewModel = Provider.of(context); final routeArgs = ModalRoute .of(context) @@ -90,10 +88,8 @@ class _ProgressNoteState extends State { .of(context) .scaffoldBackgroundColor, // appBarTitle: TranslationBase.of(context).progressNote, - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - patient.patientType.toString() ?? '0', - arrivalType, isInpatient: true, ), body: model.patientProgressNoteList == null || @@ -141,7 +137,7 @@ class _ProgressNoteState extends State { bgColor: model.patientProgressNoteList[index] .status == 1 && - authProvider.doctorProfile.doctorID != + authenticationViewModel.doctorProfile.doctorID != model .patientProgressNoteList[ index] @@ -167,7 +163,7 @@ class _ProgressNoteState extends State { index] .status == 1 && - authProvider + authenticationViewModel .doctorProfile.doctorID != model .patientProgressNoteList[ @@ -213,7 +209,7 @@ class _ProgressNoteState extends State { index] .status != 4 && - authProvider + authenticationViewModel .doctorProfile.doctorID == model .patientProgressNoteList[ diff --git a/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart b/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart index 3b566d81..e4351d91 100644 --- a/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart +++ b/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart @@ -1,3 +1,5 @@ +import 'package:flutter/material.dart'; + class PatientProfileCardModel { final String nameLine1; final String nameLine2; @@ -9,6 +11,9 @@ class PatientProfileCardModel { final Function onTap; final bool isDischargedPatient; final bool isSelectInpatient; + final bool isDartIcon; + final IconData dartIcon; + final Color color; PatientProfileCardModel( this.nameLine1, @@ -21,5 +26,8 @@ class PatientProfileCardModel { this.onTap, this.isDischargedPatient = false, this.isSelectInpatient = false, + this.isDartIcon = false, + this.dartIcon, + this.color, }); } diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index aa2b5276..a1da7882 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -1,21 +1,28 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; +import 'dart:async'; + +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/VideoCallService.dart'; +import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart'; +import 'package:doctor_app_flutter/util/NotificationPermissionUtils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:quiver/async.dart'; +import '../../../../locator.dart'; import '../../../../routes.dart'; class PatientProfileScreen extends StatefulWidget { @@ -23,16 +30,17 @@ class PatientProfileScreen extends StatefulWidget { _PatientProfileScreenState createState() => _PatientProfileScreenState(); } -class _PatientProfileScreenState extends State - with SingleTickerProviderStateMixin { +class _PatientProfileScreenState extends State with SingleTickerProviderStateMixin { PatiantInformtion patient; bool isFromSearch = false; + bool isFromLiveCare = false; bool isInpatient = false; - + bool isCallFinished = false; bool isDischargedPatient = false; bool isSearchAndOut = false; + bool isCallStarted = false; String patientType; String arrivalType; String from; @@ -40,10 +48,15 @@ class _PatientProfileScreenState extends State TabController _tabController; int index = 0; int _activeTab = 0; + + StreamController videoCallDurationStreamController; + Stream videoCallDurationStream = (() async* {})(); @override void initState() { _tabController = TabController(length: 2, vsync: this); super.initState(); + videoCallDurationStreamController = StreamController(); + videoCallDurationStream = videoCallDurationStreamController.stream; } @override @@ -73,225 +86,287 @@ class _PatientProfileScreenState extends State if (routeArgs.containsKey("isSearchAndOut")) { isSearchAndOut = routeArgs['isSearchAndOut']; } + if (routeArgs.containsKey("isFromLiveCare")) { + isFromLiveCare = routeArgs['isFromLiveCare']; + } + if (routeArgs.containsKey("isCallFinished")) { + isCallFinished = routeArgs['isCallFinished']; + } if (isInpatient) _activeTab = 0; else _activeTab = 1; } + StreamSubscription callTimer; + callConnected() { + callTimer = CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) + ..onDone(() { + callTimer.cancel(); + }) + ..onData((data) { + var t = Helpers.timeFrom(duration: data.elapsed); + videoCallDurationStreamController.sink.add(t); + }); + } + + callDisconnected() { + callTimer.cancel(); + videoCallDurationStreamController.sink.add(null); + + setState(() { + isCallStarted = false; + }); + } + @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return BaseView( - builder: (_, patientViewModel, w) => AppScaffold( - baseViewModel: patientViewModel, - appBarTitle: TranslationBase.of(context).patientProfile, - isShowAppBar: false, - body: Column( - children: [ - Stack( - children: [ - Column( + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).patientProfile, + isShowAppBar: false, + body: Column( + children: [ + Stack( + children: [ + Column( + children: [ + PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType, + videoCallDurationStream: videoCallDurationStream, + isInpatient: isInpatient, + isFromLiveCare: isFromLiveCare, + height: (patient.patientStatusType != null && patient.patientStatusType == 43) + ? 210 + : isDischargedPatient + ? 240 + : 0, + isDischargedPatient: isDischargedPatient), + Container( + height: !isSearchAndOut + ? isDischargedPatient + ? MediaQuery.of(context).size.height * 0.64 + : MediaQuery.of(context).size.height * 0.65 + : MediaQuery.of(context).size.height * 0.69, + child: ListView( children: [ - PatientProfileHeaderNewDesignAppBar( - - patient, - arrivalType ?? '0', - patientType, - isInpatient: isInpatient, - height: (patient.patientStatusType != null && - patient.patientStatusType == 43) - ? 210 - : isDischargedPatient - ? 240 - : 0, - isDischargedPatient:isDischargedPatient - ), Container( - height: !isSearchAndOut - ? isDischargedPatient - ? MediaQuery.of(context).size.height * 0.64 - : MediaQuery.of(context).size.height * 0.65 - : MediaQuery.of(context).size.height * 0.69, - child: ListView( - children: [ - Container( - child: isSearchAndOut - ? ProfileGridForSearch( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isInpatient: isInpatient, - from: from, - to: to, - ) - : isInpatient - ? ProfileGridForInPatient( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isInpatient: isInpatient, - from: from, - to: to, - isDischargedPatient: - isDischargedPatient, - isFromSearch: isFromSearch, - ) - : ProfileGridForOther( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isInpatient: isInpatient, - from: from, - to: to, - ), - ), - ], - ), + child: isSearchAndOut + ? ProfileGridForSearch( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + isInpatient: isInpatient, + from: from, + to: to, + ) + : isInpatient + ? ProfileGridForInPatient( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + isInpatient: isInpatient, + from: from, + to: to, + isDischargedPatient: isDischargedPatient, + isFromSearch: isFromSearch, + ) + : ProfileGridForOther( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + isInpatient: isInpatient, + isFromLiveCare: isFromLiveCare, + from: from, + to: to, + ), ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.05, + ) ], ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) - BaseView( - onModelReady: (model) async {}, - builder: (_, model, w) => Positioned( - top: 180, - left: 20, - right: 20, - child: Row( - children: [ - Expanded(child: Container()), - if (patient.episodeNo == 0) - AppButton( - title: - "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", - color: patient.patientStatusType == 43 + ), + ], + ), + if (isFromLiveCare + ? patient.episodeNo != null + : patient.patientStatusType != null && patient.patientStatusType == 43) + BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) => Positioned( + top: 180, + left: 20, + right: 20, + child: Row( + children: [ + Expanded(child: Container()), + if (patient.episodeNo == 0) + AppButton( + title: + "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", + color: isFromLiveCare + ? Colors.red.shade700 + : patient.patientStatusType == 43 + ? Colors.red.shade700 + : Colors.grey.shade700, + fontColor: Colors.white, + vPadding: 8, + radius: 30, + hPadding: 20, + fontWeight: FontWeight.normal, + fontSize: 1.6, + icon: Image.asset( + "assets/images/create-episod.png", + color: Colors.white, + height: 30, + ), + onPressed: () async { + if ((isFromLiveCare && patient.appointmentNo != null) || + patient.patientStatusType == 43) { + PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( + appointmentNo: int.parse(patient.appointmentNo.toString()), + patientMRN: patient.patientMRN); + GifLoaderDialogUtils.showMyDialog(context); + await model.postEpisode(postEpisodeReqModel); + GifLoaderDialogUtils.hideDialog(context); + patient.episodeNo = model.episodeID; + Navigator.of(context) + .pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); + } + }, + ), + if (patient.episodeNo != 0) + AppButton( + title: + "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", + color: isFromLiveCare + ? Colors.red.shade700 + : patient.patientStatusType == 43 ? Colors.red.shade700 : Colors.grey.shade700, - fontColor: Colors.white, - vPadding: 8, - radius: 30, - hPadding: 20, - fontWeight: FontWeight.normal, - fontSize: 1.6, - icon: Image.asset( - "assets/images/create-episod.png", - color: Colors.white, - height: 30, - ), - onPressed: () async { - if (patient.patientStatusType == - 43) { - PostEpisodeReqModel - postEpisodeReqModel = - PostEpisodeReqModel( - appointmentNo: - patient.appointmentNo, - patientMRN: - patient.patientMRN); - GifLoaderDialogUtils.showMyDialog( - context); - await model.postEpisode( - postEpisodeReqModel); - GifLoaderDialogUtils.hideDialog( - context); - patient.episodeNo = - model.episodeID; - Navigator.of(context).pushNamed( - CREATE_EPISODE, - arguments: { - 'patient': patient - }); - } - }, - ), - if (patient.episodeNo != 0) - AppButton( - title: - "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", - color: - patient.patientStatusType == 43 - ? Colors.red.shade700 - : Colors.grey.shade700, - fontColor: Colors.white, - vPadding: 8, - radius: 30, - hPadding: 20, - fontWeight: FontWeight.normal, - fontSize: 1.6, - icon: Image.asset( - "assets/images/modilfy-episode.png", - color: Colors.white, - height: 30, - ), - onPressed: () { - if (patient.patientStatusType == - 43) { - Navigator.of(context).pushNamed( - UPDATE_EPISODE, - arguments: { - 'patient': patient - }); - } - }), - ], - ), - )), - ], + fontColor: Colors.white, + vPadding: 8, + radius: 30, + hPadding: 20, + fontWeight: FontWeight.normal, + fontSize: 1.6, + icon: Image.asset( + "assets/images/modilfy-episode.png", + color: Colors.white, + height: 30, + ), + onPressed: () { + if ((isFromLiveCare && + patient.appointmentNo != null && + patient.appointmentNo != 0) || + patient.patientStatusType == 43) { + Navigator.of(context) + .pushNamed(UPDATE_EPISODE, arguments: {'patient': patient}); + } + }), + ], + ), + )), + ], + ), + ], + ), + bottomSheet: isFromLiveCare + ? Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), ), - ], - ), - )); - } - - Widget tabsBar(BuildContext context, Size screenSize) { - List _tabs = [ - "Inpatient Info".toUpperCase(), - "Outpatient Info".toUpperCase(), - ]; - - return Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - Color(0Xffffffff), Color(0xFFCCCCCC), - borderRadius: 4, borderWidth: 0), - child: Row( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _tabs.map((item) { - bool _isActive = _tabs[_activeTab] == item ? true : false; + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + fontWeight: FontWeight.w700, + color: isCallFinished ? Colors.red[600] : Colors.green[600], + title: isCallFinished + ? TranslationBase.of(context).endCall + : TranslationBase.of(context).initiateCall, + disabled: isCallStarted || model.state == ViewState.BusyLocal, + onPressed: () async { + // AppPermissionsUtils + // .requestVideoCallPermission( + // context: context, + // onTapGrant: () { + // locator() + // .openVideo( + // model.startCallRes, + // patient, + // model.startCallRes != null ? model.startCallRes.isRecording : true, callConnected, + // callDisconnected); + // }); + if (isCallFinished) { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + EndCallScreen(patient: patient))); + } else { + GifLoaderDialogUtils.showMyDialog(context); + await model.startCall( + isReCall: false, vCID: patient.vcId); - return Expanded( - child: InkWell( - onTap: () async { - setState(() { - _activeTab = _tabs.indexOf(item); - }); - }, - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - _isActive - ? Color(0xFFD02127 /*B8382B*/) - : Color(0xFFEAEAEA), - _isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), - borderRadius: 4, - borderWidth: 0), - child: Center( - child: AppText( - item, - fontSize: SizeConfig.textMultiplier * 1.8, - color: _isActive ? Colors.white : Color(0xFF2B353E), - fontWeight: FontWeight.w700, + if (model.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Helpers.showErrorToast(model.error); + } else { + await model.getDoctorProfile(); + patient.appointmentNo = int.parse(model + .startCallRes.appointmentNo + .toString()); + patient.episodeNo = 0; + model.updateInCallPatient( + patient: patient, + appointmentNo: int.parse(model + .startCallRes.appointmentNo + .toString())); + setState(() { + isCallStarted = true; + }); + GifLoaderDialogUtils.hideDialog(context); + AppPermissionsUtils + .requestVideoCallPermission( + context: context, + onTapGrant: () { + locator() + .openVideo( + model.startCallRes, + patient, + model.startCallRes != null ? model.startCallRes.isRecording : true + , callConnected, + callDisconnected); + }); + } + } + }, + ), + ), + ), ), - ), + SizedBox( + height: 5, + ), + ], ), - ), - ), - ); - }).toList(), + ) + : null, ), ); } @@ -306,12 +381,7 @@ class AvatarWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.08), - offset: Offset(0.0, 5.0), - blurRadius: 16.0) - ], + boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.08), offset: Offset(0.0, 5.0), blurRadius: 16.0)], borderRadius: BorderRadius.all(Radius.circular(35.0)), color: Color(0xffCCCCCC), ), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 1df7d236..49fa8012 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -88,10 +88,10 @@ class ProfileGridForInPatient extends StatelessWidget { PatientProfileCardModel( TranslationBase.of(context).medical, TranslationBase.of(context).report, - HEALTH_SUMMARY, + PATIENT_MEDICAL_REPORT, 'patient/health_summary.png', isInPatient: isInpatient, - isDisable: true), + isDisable: false), PatientProfileCardModel( TranslationBase.of(context).referral, TranslationBase.of(context).patient, diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart index 86ccd6d1..c01757c5 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart @@ -14,6 +14,7 @@ class ProfileGridForOther extends StatelessWidget { final String arrivalType; final double height; final bool isInpatient; + final bool isFromLiveCare; String from; String to; @@ -25,7 +26,8 @@ class ProfileGridForOther extends StatelessWidget { this.height, this.isInpatient, this.from, - this.to}) + this.to, + this.isFromLiveCare}) : super(key: key); @override @@ -74,41 +76,69 @@ class ProfileGridForOther extends StatelessWidget { 'patient/Order_Procedures.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).insurance, - TranslationBase.of(context).service, + TranslationBase + .of(context) + .insurance, + TranslationBase + .of(context) + .service, PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).patientSick, - TranslationBase.of(context).leave, + TranslationBase + .of(context) + .patientSick, + TranslationBase + .of(context) + .leave, ADD_SICKLEAVE, 'patient/patient_sick_leave.png', isInPatient: isInpatient), - if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel( - TranslationBase.of(context).patient, - TranslationBase.of(context).ucaf, - PATIENT_UCAF_REQUEST, - 'patient/ucaf.png', - isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 ? true : false), - if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel( - TranslationBase.of(context).referral, - TranslationBase.of(context).patient, - REFER_PATIENT_TO_DOCTOR, - 'patient/refer_patient.png', - isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 ? true : false), - if (patient.appointmentNo != null && patient.appointmentNo != 0) + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) + PatientProfileCardModel( + TranslationBase + .of(context) + .patient, + TranslationBase + .of(context) + .ucaf, + PATIENT_UCAF_REQUEST, + 'patient/ucaf.png', + isInPatient: isInpatient, + isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 || + patient.appointmentNo == null ), + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) + PatientProfileCardModel( + TranslationBase + .of(context) + .referral, + TranslationBase + .of(context) + .patient, + REFER_PATIENT_TO_DOCTOR, + 'patient/refer_patient.png', + isInPatient: isInpatient, + isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 || + patient.appointmentNo == null , + ), + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel( - TranslationBase.of(context).admission, - TranslationBase.of(context).request, + TranslationBase + .of(context) + .admission, + TranslationBase + .of(context) + .request, PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png', isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 ? true : false), + isDisable: isFromLiveCare?patient.appointmentNo == null:patient.patientStatusType != 43 || + patient.appointmentNo == null + ), ]; return Column( @@ -124,20 +154,22 @@ class ProfileGridForOther extends StatelessWidget { itemCount: cardsList.length, staggeredTileBuilder: (int index) => StaggeredTile.fit(1), itemBuilder: (BuildContext context, int index) => PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: cardsList[index].nameLine1, - nameLine2: cardsList[index].nameLine2, - route: cardsList[index].route, - icon: cardsList[index].icon, - isInPatient: cardsList[index].isInPatient, - isDischargedPatient: cardsList[index].isDischargedPatient, - isDisable: cardsList[index].isDisable, - onTap: cardsList[index].onTap, - isLoading: cardsList[index].isLoading, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: cardsList[index].nameLine1, + nameLine2: cardsList[index].nameLine2, + route: cardsList[index].route, + icon: cardsList[index].icon, + isInPatient: cardsList[index].isInPatient, + isDischargedPatient: cardsList[index].isDischargedPatient, + isDisable: cardsList[index].isDisable, + onTap: cardsList[index].onTap, + isLoading: cardsList[index].isLoading, + isFromLiveCare: isFromLiveCare + ), ), ), diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index acc79d19..48bef68a 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -3,7 +3,7 @@ import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; @@ -16,13 +16,15 @@ class RadiologyDetailsPage extends StatelessWidget { final PatiantInformtion patient; final String patientType; final String arrivalType; + final bool isInpatient; RadiologyDetailsPage( {Key key, this.finalRadiology, this.patient, this.patientType, - this.arrivalType}); + this.arrivalType, + this.isInpatient = false}); @override Widget build(BuildContext context) { @@ -33,16 +35,16 @@ class RadiologyDetailsPage extends StatelessWidget { lineItem: finalRadiology.invoiceLineItemNo, invoiceNo: finalRadiology.invoiceNo), builder: (_, model, widget) => AppScaffold( - appBar: PatientProfileHeaderWhitAppointmentAppBar( - patient: patient, - patientType: patientType ?? "0", - arrivalType: arrivalType ?? "0", + appBar: PatientProfileAppBar( + patient, appointmentDate: finalRadiology.orderDate, doctorName: finalRadiology.doctorName, clinic: finalRadiology.clinicDescription, branch: finalRadiology.projectName, profileUrl: finalRadiology.doctorImageURL, invoiceNO: finalRadiology.invoiceNo.toString(), + isAppointmentHeader: true, + ), isShowAppBar: true, baseViewModel: model, diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 4b8d224e..3d8d527c 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -3,10 +3,11 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_details_page.dart'; -import 'package:doctor_app_flutter/screens/procedures/add_radiology_order.dart'; +import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; +import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; @@ -25,6 +26,7 @@ class _RadiologyHomePageState extends State { PatiantInformtion patient; String arrivalType; bool isInpatient; + bool isFromLiveCare; @override void didChangeDependencies() { @@ -34,6 +36,7 @@ class _RadiologyHomePageState extends State { patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; isInpatient = routeArgs['isInpatient']; + isFromLiveCare = routeArgs['isFromLiveCare']; print(arrivalType); } @@ -47,10 +50,8 @@ class _RadiologyHomePageState extends State { isShowAppBar: true, backgroundColor: Colors.grey[100], // appBarTitle: TranslationBase.of(context).radiology, - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - patient.patientType.toString() ?? '0', - arrivalType, isInpatient: isInpatient, ), baseViewModel: model, @@ -104,17 +105,20 @@ class _RadiologyHomePageState extends State { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || + (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddSelectedRadiologyOrder( - patient: patient, - model: model, - )), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.RADIOLOGY, + ), + ), ); }, label: TranslationBase.of(context).applyForRadiologyOrder, @@ -146,11 +150,18 @@ class _RadiologyHomePageState extends State { ? Colors.black : Color(0xffa9a089), borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic? Radius.circular(0):Radius.circular(8), - bottomLeft: projectViewModel.isArabic? Radius.circular(0):Radius.circular(8), - topRight: projectViewModel.isArabic? Radius.circular(8):Radius.circular(0), - bottomRight: projectViewModel.isArabic? Radius.circular(8):Radius.circular(0) - ), + topLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + bottomLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + topRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0), + bottomRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0)), ), child: RotatedBox( quarterTurns: 3, @@ -197,6 +208,7 @@ class _RadiologyHomePageState extends State { finalRadiology: model.radiologyList[index], patient: patient, + isInpatient:isInpatient ), ), ); diff --git a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart index f54a18ac..e4b8700c 100644 --- a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart +++ b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart @@ -1,7 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; +import 'package:doctor_app_flutter/core/model/referral/add_referred_remarks_request.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; @@ -19,30 +19,40 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; +import 'ReplySummeryOnReferralPatient.dart'; + class AddReplayOnReferralPatient extends StatefulWidget { final PatientReferralViewModel patientReferralViewModel; final MyReferralPatientModel myReferralInPatientModel; + final AddReferredRemarksRequestModel myReferralInPatientRequestModel; + final bool isEdited; const AddReplayOnReferralPatient( - {Key key, this.patientReferralViewModel, this.myReferralInPatientModel}) + {Key key, + this.patientReferralViewModel, + this.myReferralInPatientModel, + this.isEdited, + this.myReferralInPatientRequestModel}) : super(key: key); @override - _AddReplayOnReferralPatientState createState() => - _AddReplayOnReferralPatientState(); + _AddReplayOnReferralPatientState createState() => _AddReplayOnReferralPatientState(); } -class _AddReplayOnReferralPatientState - extends State { +class _AddReplayOnReferralPatientState extends State { bool isSubmitted = false; + int replay = 1; + int reject = 2; stt.SpeechToText speech = stt.SpeechToText(); var reconizedWord; var event = RobotProvider(); TextEditingController replayOnReferralController = TextEditingController(); + @override void initState() { requestPermissions(); super.initState(); + replayOnReferralController.text = widget.myReferralInPatientModel.referredDoctorRemarks ?? ""; } @override @@ -50,116 +60,148 @@ class _AddReplayOnReferralPatientState return AppScaffold( isShowAppBar: false, backgroundColor: Theme.of(context).scaffoldBackgroundColor, - body: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.0, - child: Padding( - padding: EdgeInsets.all(0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - BottomSheetTitle(title: 'Replay'), - SizedBox( - height: 10.0, - ), - Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - Stack( - children: [ - AppTextFieldCustom( - hintText: 'Replay your responses here', - controller: replayOnReferralController, - maxLines: 35, - minLines: 25, - hasBorder: true, - validationError: - replayOnReferralController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, - ), - Positioned( - top: 0, //MediaQuery.of(context).size.height * 0, - right: 15, - child: IconButton( - icon: Icon( - DoctorApp.speechtotext, - color: Colors.black, - size: 35, - ), - onPressed: () { - onVoiceText(); - }, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetTitle(title: 'Reply'), + SizedBox( + height: 10.0, + ), + Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + Stack( + children: [ + AppTextFieldCustom( + hintText: 'Reply your responses here', + controller: replayOnReferralController, + maxLines: 35, + minLines: 25, + hasBorder: true, + validationError: replayOnReferralController.text.isEmpty && isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, ), - ) - ], - ), - ], + Positioned( + top: 0, + //MediaQuery.of(context).size.height * 0, + right: 15, + child: IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35, + ), + onPressed: () { + onVoiceText(); + }, + ), + ) + ], + ), + ], + ), ), ), - ), - ], + ], + ), ), ), - ), - ), - bottomSheet: Container( - height: replayOnReferralController.text.isNotEmpty ? 130 : 70, - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Column( - children: [ - replayOnReferralController.text.isEmpty - ? SizedBox() - : Container( - margin: EdgeInsets.all(5), - child: Expanded( + Container( + // height: replayOnReferralController.text.isNotEmpty ? 130 : 70, + // margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Column( + children: [ + replayOnReferralController.text.isEmpty + ? SizedBox() + : Container( + margin: EdgeInsets.all(16), + child: AppButton( + title: TranslationBase.of(context).clearText, + onPressed: () { + setState(() { + replayOnReferralController.text = ''; + }); + }, + ), + ), + Container( + margin: EdgeInsets.fromLTRB(16, 0, 16, 16), + child: Row( + children: [ + Expanded( + child: AppButton( + onPressed: () async { + if (replayOnReferralController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + await widget.patientReferralViewModel.replayReferred( + replayOnReferralController.text.trim(), widget.myReferralInPatientModel, reject); + if (widget.patientReferralViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(widget.patientReferralViewModel.error); + } else { + GifLoaderDialogUtils.hideDialog(context); + DrAppToastMsg.showSuccesToast("Has been rejected"); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + } else { + Helpers.showErrorToast("You can't add empty reply"); + setState(() { + isSubmitted = false; + }); + } + }, + title: TranslationBase.of(context).reject, + fontColor: Colors.white, + color: Colors.red[600], + ), + ), + SizedBox( + width: 4, + ), + Expanded( child: AppButton( - title: TranslationBase.of(context).clearText, - onPressed: () { - setState(() { - replayOnReferralController.text = ''; - }); - }, - )), + onPressed: () async { + setState(() { + isSubmitted = true; + }); + if (replayOnReferralController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + await widget.patientReferralViewModel.replayReferred( + replayOnReferralController.text.trim(), widget.myReferralInPatientModel, replay); + if (widget.patientReferralViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(widget.patientReferralViewModel.error); + } else { + GifLoaderDialogUtils.hideDialog(context); + DrAppToastMsg.showSuccesToast("Your Reply Added Successfully"); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + } else { + Helpers.showErrorToast("You can't add empty reply"); + setState(() { + isSubmitted = false; + }); + } + }, + title: TranslationBase.of(context).noteConfirm, + fontColor: Colors.white, + color: Colors.green[600], + ), + ), + ], ), - Container( - margin: EdgeInsets.all(5), - child: AppButton( - title: 'Submit Replay', - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () async { - setState(() { - isSubmitted = true; - }); - if (replayOnReferralController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - await widget.patientReferralViewModel.replay( - replayOnReferralController.text.trim(), - widget.myReferralInPatientModel); - if (widget.patientReferralViewModel.state == - ViewState.ErrorLocal) { - Helpers.showErrorToast( - widget.patientReferralViewModel.error); - } else { - GifLoaderDialogUtils.hideDialog(context); - DrAppToastMsg.showSuccesToast( - "Your Replay Added Successfully"); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - } - } else { - Helpers.showErrorToast("You can't add empty replay"); - setState(() { - isSubmitted = false; - }); - } - })), - ], - ), + ), + ], + ), + ), + ], ), ); } @@ -167,8 +209,7 @@ class _AddReplayOnReferralPatientState onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, diff --git a/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart b/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart new file mode 100644 index 00000000..2a48e079 --- /dev/null +++ b/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart @@ -0,0 +1,119 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; + +import '../../../../routes.dart'; + +class ReplySummeryOnReferralPatient extends StatefulWidget { + final MyReferralPatientModel referredPatient; + final String doctorReply; + + ReplySummeryOnReferralPatient(this.referredPatient, this.doctorReply); + + @override + _ReplySummeryOnReferralPatientState createState() => + _ReplySummeryOnReferralPatientState(this.referredPatient); +} + +class _ReplySummeryOnReferralPatientState + extends State { + final MyReferralPatientModel referredPatient; + + _ReplySummeryOnReferralPatientState(this.referredPatient); + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).summeryReply, + body: Container( + child: Column( + children: [ + + Expanded( + child: SingleChildScrollView( + child: Container( + width: double.infinity, + margin: + EdgeInsets.symmetric(horizontal: 16, vertical: 16), + padding: EdgeInsets.symmetric( + horizontal: 16, vertical: 16), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(8)), + border: Border.fromBorderSide(BorderSide( + color: Colors.white, + width: 1.0, + )), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).reply, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 2.4 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + AppText( + widget.doctorReply ?? '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + SizedBox( + height: 8, + ), + ], + ), + ), + ), + ), + Container( + margin: + EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Row( + children: [ + Expanded( + child: AppButton( + onPressed: () { + Navigator.of(context).pop(); + }, + title: TranslationBase.of(context).cancel, + fontColor: Colors.white, + color: Colors.red[600], + ), + ), + SizedBox(width: 4,), + Expanded( + child: AppButton( + onPressed: () {}, + title: TranslationBase.of(context).noteConfirm, + fontColor: Colors.white, + color: Colors.green[600], + ), + ), + ], + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 2adef799..4cc5effd 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -1,9 +1,8 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -14,479 +13,415 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; +// ignore: must_be_immutable class MyReferralDetailScreen extends StatelessWidget { - PendingReferral pendingReferral; + final MyReferralPatientModel referralPatient; + + const MyReferralDetailScreen({Key key, this.referralPatient}) + : super(key: key); @override Widget build(BuildContext context) { - final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; - - AuthViewModel authProvider = Provider.of(context); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - pendingReferral = routeArgs['referral']; + // final routeArgs = ModalRoute.of(context).settings.arguments as Map; + // pendingReferral = routeArgs['referral']; return BaseView( - onModelReady: (model) => model.getPatientDetails( - AppDateUtils.convertStringToDateFormat( - DateTime.now() /*.subtract(Duration(days: 350))*/ .toString(), - "yyyy-MM-dd"), - AppDateUtils.convertStringToDateFormat( - DateTime.now().toString(), "yyyy-MM-dd"), - pendingReferral.patientID, - pendingReferral.sourceAppointmentNo), + onModelReady: (model) => model.getDoctorProfile(), builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).referPatient, - isShowAppBar: false, - body: model.patientArrivalList != null && - model.patientArrivalList.length > 0 - ? Column( - children: [ - Container( - padding: - EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), - decoration: BoxDecoration( - color: Colors.white, - ), - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), - child: Column( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).referPatient, + isShowAppBar: false, + body: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + color: Colors.white, + ), + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 12.0), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.black, //Colors.black, + onPressed: () => Navigator.pop(context), + ), + Expanded( + child: AppText( + (Helpers.capitalize(referralPatient.firstName + " "+ + referralPatient.lastName)), + fontSize: SizeConfig.textMultiplier * 2.5, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + ), + ), + referralPatient.gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + ]), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( + Padding( padding: EdgeInsets.only(left: 12.0), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), + child: Container( + width: 60, + height: 60, + child: Image.asset( + referralPatient.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, ), - Expanded( - child: AppText( - (Helpers.capitalize(model - .patientArrivalList[0] - .patientDetails - .fullName)), - fontSize: SizeConfig.textMultiplier * 2.5, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - ), - ), - model.patientArrivalList[0].patientDetails - .gender == - 1 - ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) - : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), - ]), + ), + ), + SizedBox( + width: 10, ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 12.0), - child: Container( - width: 60, - height: 60, - child: Image.asset( - pendingReferral.patientDetails.gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), + Expanded( + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + referralPatient.referralStatus != null + ? model.getReferralStatusNameByCode( + referralPatient.referralStatus, + context) + : "", + fontFamily: 'Poppins', + fontSize: 1.9 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w700, + color: referralPatient.referralStatus == 1 + ? Color(0xffc4aa54) + : referralPatient.referralStatus == + 46 || + referralPatient + .referralStatus == + 2 + ? Colors.green[700] + : Colors.red[700], + ), + AppText( + AppDateUtils.getDayMonthYearDateFormatted( + referralPatient.referralDate), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: + 2.0 * SizeConfig.textMultiplier, + color: Color(0XFF28353E), + ) + ], ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.start, children: [ AppText( - pendingReferral.referralStatus != null - ? pendingReferral.referralStatus - : "", - fontFamily: 'Poppins', - fontSize: - 1.9 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w700, - color: pendingReferral - .referralStatus != - null - ? pendingReferral - .referralStatus == - 'Pending' - ? Color(0xffc4aa54) - : pendingReferral - .referralStatus == - 'Accepted' - ? Colors.green[700] - : Colors.red[700] - : Colors.grey[500], - ), - AppText( - pendingReferral.referredOn - .split(" ")[0], + TranslationBase.of(context) + .fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: - 2.0 * SizeConfig.textMultiplier, - color: Color(0XFF28353E), - ) - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .fileNumber, - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, - color: Color(0XFF575757), - ), - AppText( - "${pendingReferral.patientID}", - fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), - ], + 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), ), AppText( - pendingReferral.referredOn - .split(" ")[1], + "${referralPatient.patientID}", fontFamily: 'Poppins', - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w700, fontSize: 1.8 * SizeConfig.textMultiplier, - color: Color(0XFF575757), - ) + color: Color(0XFF2E303A), + ), ], ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Expanded( - child: Column( + AppText( + AppDateUtils.getTimeHHMMA(referralPatient.referralDate), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: + 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ) + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + children: [ + + Row( + mainAxisAlignment: + MainAxisAlignment.start, children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .referredFrom, - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig - .textMultiplier, - color: Color(0XFF575757), - ), - AppText( - pendingReferral - .isReferralDoctorSameBranch - ? TranslationBase.of( - context) - .sameBranch - : TranslationBase.of( - context) - .otherBranch, - fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig - .textMultiplier, - color: Color(0XFF2E303A), - ), - ], + AppText( + TranslationBase.of(context) + .referredFrom, + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.7 * + SizeConfig.textMultiplier, + color: Color(0XFF575757), ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .remarks + - " : ", - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig - .textMultiplier, - color: Color(0XFF575757), - ), - Expanded( - child: AppText( - pendingReferral - .remarksFromSource, - fontFamily: 'Poppins', - fontWeight: - FontWeight.w700, - fontSize: 1.8 * - SizeConfig - .textMultiplier, - color: Color(0XFF2E303A), - ), - ), - ], + AppText( + referralPatient.targetProjectId ==referralPatient.sourceProjectId + ? TranslationBase.of( + context) + .sameBranch + : TranslationBase.of( + context) + .otherBranch, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.8 * + SizeConfig + .textMultiplier, + color: Color(0XFF2E303A), ), ], ), - ), - Row( - children: [ - AppText( - pendingReferral.patientDetails - .nationalityName != - null - ? pendingReferral - .patientDetails - .nationalityName - : "", - fontWeight: FontWeight.bold, - color: Color(0xFF2E303A), - fontSize: 1.4 * - SizeConfig.textMultiplier, - ), - pendingReferral - .nationalityFlagUrl != - null - ? ClipRRect( - borderRadius: - BorderRadius.circular( - 20.0), - child: Image.network( - pendingReferral - .nationalityFlagUrl, - height: 25, - width: 30, - errorBuilder: - (BuildContext context, - Object exception, - StackTrace - stackTrace) { - return Text('No Image'); - }, - )) - : SizedBox() - ], - ) - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only( - left: 10, right: 0), - child: Image.asset( - 'assets/images/patient/ic_ref_arrow_up.png', - height: 50, - width: 30, - ), - ), - Container( - margin: EdgeInsets.only( - left: 0, - top: 25, - right: 0, - bottom: 0), - padding: EdgeInsets.only( - left: 4.0, right: 4.0), - child: Container( - width: 40, - height: 40, - child: CircleAvatar( - radius: 25.0, - backgroundImage: NetworkImage( - pendingReferral - .doctorImageUrl), - backgroundColor: - Colors.transparent, - ), - ), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.only( - left: 10, - top: 25, - right: 10, - bottom: 0), - child: Column( - children: [ - AppText( - pendingReferral - .referredByDoctorInfo, + Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .remarks + + " : ", + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.7 * + SizeConfig.textMultiplier, + color: Color(0XFF575757), + ), + Expanded( + child: AppText( + referralPatient.referringDoctorRemarks?? + '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.7 * + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), - ], - ), + ), + ], ), + ], + ), + ), + Row( + children: [ + AppText( + referralPatient.nationalityName != + null + ? referralPatient.nationalityName + : "", + fontWeight: FontWeight.bold, + color: Color(0xFF2E303A), + fontSize: + 1.4 * SizeConfig.textMultiplier, ), + referralPatient.nationalityFlagURL != + null + ? ClipRRect( + borderRadius: + BorderRadius.circular(20.0), + child: Image.network( + referralPatient + .nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: (BuildContext + context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + )) + : SizedBox() ], + ) + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: + EdgeInsets.only(left: 10, right: 0), + child: Image.asset( + 'assets/images/patient/ic_ref_arrow_up.png', + height: 50, + width: 30, + ), + ), + Container( + margin: EdgeInsets.only( + left: 0, + top: 25, + right: 0, + bottom: 0), + padding: EdgeInsets.only( + left: 4.0, right: 4.0), + child: Container( + width: 40, + height: 40, + child: CircleAvatar( + radius: 25.0, + backgroundImage: NetworkImage( + referralPatient.doctorImageURL), + backgroundColor: Colors.transparent, + ), + ), + ), + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.only( + left: 10, + top: 25, + right: 10, + bottom: 0), + child: Column( + children: [ + AppText( + referralPatient.doctorName, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.7 * + SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ], + ), + ), ), ], ), - ), - ], + ], + ), ), ], ), - ), - ), - Expanded( - child: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16), - child: SizedBox( - child: ProfileMedicalInfoWidgetSearch( - patient: model.patientArrivalList[0], - patientType: "7", - from: null, - to: null, - ), - ), - ), - ], - ), - ), - ), + ], ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Row( + ), + ), + Expanded( + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).accept, - color: Color(0xFF4BA821), - fontColor: Colors.white, - fontSize: 1.6, - hPadding: 8, - vPadding: 12, - onPressed: () async { - await model.responseReferral( - pendingReferral, true); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsgAccept); - Navigator.pop(context); - Navigator.pop(context); - } - }, - ), - ), SizedBox( - width: 8, + height: 16, ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).reject, - color: Color(0xFFB9382C), - fontColor: Colors.white, - fontSize: 1.6, - hPadding: 8, - vPadding: 12, - onPressed: () async { - await model.responseReferral( - pendingReferral, true); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsgReject); - Navigator.pop(context); - Navigator.pop(context); - } - }, + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: SizedBox( + child: ProfileMedicalInfoWidgetSearch( + patient: model + .getPatientFromReferralO(referralPatient), + patientType: "7", + isInpatient: false, + from: null, + to: null, + ), ), ), ], ), ), - ], - ) - : Column( - children: [ - Container( - padding: EdgeInsets.only(left: 12.0), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), + ), + ), + if (referralPatient.referralStatus == 1) + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Row( + children: [ Expanded( - child: AppText( - "", - fontSize: SizeConfig.textMultiplier * 2.5, - fontWeight: FontWeight.bold, - - fontFamily: 'Poppins', + child: AppButton( + title: TranslationBase.of(context).accept, + color: Color(0xFF4BA821), + fontColor: Colors.white, + fontSize: 1.6, + hPadding: 8, + vPadding: 12, + disabled: model.state == ViewState.Busy, + onPressed: () async { + await model.responseReferral(referralPatient, true); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgAccept); + model.getMyReferralOutPatientService(); + Navigator.pop(context); + Navigator.pop(context); + } + }, ), ), - ]), - ), - Container( - child: Center( - child: AppText( - TranslationBase.of(context).patientNoDetailErrMsg, - color: HexColor("#B8382B"), - fontWeight: FontWeight.bold, - fontSize: 16, + SizedBox( + width: 8, ), - ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).reject, + color: Color(0xFFB9382C), + fontColor: Colors.white, + fontSize: 1.6, + hPadding: 8, + vPadding: 12, + disabled: model.state == ViewState.Busy, + onPressed: () async { + await model.responseReferral(referralPatient, false); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgReject); + model.getMyReferralOutPatientService(); + Navigator.pop(context); + Navigator.pop(context); + } + }, + ), + ), + ], ), - ], - ), - ), + ), + ], + )), ); } } diff --git a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart index fcbd11b7..cb6c1e5f 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -1,16 +1,28 @@ +import 'package:doctor_app_flutter/core/enum/PatientType.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-detail-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referral_patient_detail_in-paint.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -class MyReferralInPatientScreen extends StatelessWidget { +import 'my-referral-patient-screen.dart'; + +class MyReferralInPatientScreen extends StatefulWidget { + @override + _MyReferralInPatientScreenState createState() => _MyReferralInPatientScreenState(); +} + +class _MyReferralInPatientScreenState extends State { + PatientType patientType = PatientType.IN_PATIENT; @override Widget build(BuildContext context) { @@ -20,72 +32,102 @@ class MyReferralInPatientScreen extends StatelessWidget { baseViewModel: model, isShowAppBar: false, appBarTitle: TranslationBase.of(context).referPatient, - body: model.myReferralPatients.isEmpty - ? Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 100, + body: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 70), + child: PatientTypeRadioWidget( + (patientType) async { + setState(() { + this.patientType = patientType; + }); + GifLoaderDialogUtils.showMyDialog(context); + if (patientType == PatientType.IN_PATIENT) { + await model.getMyReferralPatientService(localBusy: true); + } else { + await model.getMyReferralOutPatientService(localBusy: true); + } + GifLoaderDialogUtils.hideDialog(context); + }, + ), + ), + model.myReferralPatients.isEmpty + ? Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + TranslationBase.of(context).referralEmptyMsg, + color: Theme.of(context).errorColor, + ), + ) + ], ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).referralEmptyMsg, - color: Theme.of(context).errorColor, - ), - ) - ], - ), - ) - : SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(top: 70), - // color: Colors.white, - // height: MediaQuery.of(context).size.height, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // SizedBox(height: 50), - ...List.generate( - model.myReferralPatients.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferralPatientDetailScreen(model.myReferralPatients[index],model), + ) + : Expanded( + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + model.myReferralPatients.length, + (index) => InkWell( + onTap: () { + if(patientType == PatientType.OUT_PATIENT) { + Navigator.push( + context, + FadePage( + page: MyReferralDetailScreen(referralPatient: model.myReferralPatients[index]), + ), + ); + } else{ + Navigator.push( + context, + FadePage( + page: ReferralPatientDetailScreen(model.myReferralPatients[index], model), + ), + ); + } + + }, + child: PatientReferralItemWidget( + referralStatus: model.getReferralStatusNameByCode( + model.myReferralPatients[index].referralStatus, context), + referralStatusCode: model.myReferralPatients[index].referralStatus, + patientName: model.myReferralPatients[index].patientName, + patientGender: model.myReferralPatients[index].gender, + referredDate: AppDateUtils.getDayMonthYearDateFormatted( + model.myReferralPatients[index].referralDate), + referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), + patientID: "${model.myReferralPatients[index].patientID}", + isSameBranch: false, + isReferral: true, + isReferralClinic: true, + referralClinic: "${model.myReferralPatients[index].referringClinicDescription}", + remark: model.myReferralPatients[index].referringDoctorRemarks, + nationality: model.myReferralPatients[index].nationalityName, + nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, + doctorAvatar: model.myReferralPatients[index].doctorImageURL, + referralDoctorName: model.myReferralPatients[index].referringDoctorName, + clinicDescription: model.myReferralPatients[index].referringClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), + ), ), - ); - }, - child: PatientReferralItemWidget( - referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus,context), - referralStatusCode: model.myReferralPatients[index].referralStatus, - patientName: model.myReferralPatients[index].patientName, - patientGender: model.myReferralPatients[index].gender, - referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate), - referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), - patientID: "${model.myReferralPatients[index].patientID}", - isSameBranch: false, - isReferral: true, - isReferralClinic: true, - referralClinic:"${model.myReferralPatients[index].referringClinicDescription}", - remark: model.myReferralPatients[index].referringDoctorRemarks, - nationality: model.myReferralPatients[index].nationalityName, - nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, - doctorAvatar: model.myReferralPatients[index].doctorImageURL, - referralDoctorName: model.myReferralPatients[index].referringDoctorName, - clinicDescription: model.myReferralPatients[index].referringClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), - ), + ), + ], ), ), - ], + ), ), - ), - ), + ], + ), ), ); } diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index b2953cca..fe6fd2db 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -7,15 +6,12 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:provider/provider.dart'; import '../../../../routes.dart'; class MyReferralPatientScreen extends StatelessWidget { - // previous design page is: MyReferralPatient @override Widget build(BuildContext context) { - AuthViewModel authProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getPendingReferralPatients(), diff --git a/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart b/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart index cc491cf2..66fd22fd 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart @@ -8,7 +8,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -25,12 +25,10 @@ import 'package:speech_to_text/speech_to_text.dart' as stt; class PatientMakeInPatientReferralScreen extends StatefulWidget { @override - _PatientMakeInPatientReferralScreenState createState() => - _PatientMakeInPatientReferralScreenState(); + _PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState(); } -class _PatientMakeInPatientReferralScreenState - extends State { +class _PatientMakeInPatientReferralScreenState extends State { PatiantInformtion patient; List referToList; dynamic _referTo; @@ -68,8 +66,7 @@ class _PatientMakeInPatientReferralScreenState onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, @@ -113,8 +110,7 @@ class _PatientMakeInPatientReferralScreenState } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; } @@ -127,14 +123,8 @@ class _PatientMakeInPatientReferralScreenState String arrivalType = routeArgs['arrivalType']; bool isInpatient = routeArgs['isInpatient']; referToList = List(); - dynamic sameBranch = { - "id": 1, - "name": TranslationBase.of(context).sameBranch - }; - dynamic otherBranch = { - "id": 2, - "name": TranslationBase.of(context).otherBranch - }; + dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch}; + dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch}; referToList.add(sameBranch); referToList.add(otherBranch); @@ -146,10 +136,8 @@ class _PatientMakeInPatientReferralScreenState baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - patientType, - arrivalType, isInpatient: isInpatient, ), body: SingleChildScrollView( @@ -188,8 +176,7 @@ class _PatientMakeInPatientReferralScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).branch, - dropDownText: - _referTo != null ? _referTo['name'] : null, + dropDownText: _referTo != null ? _referTo['name'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: branchError, @@ -206,23 +193,15 @@ class _PatientMakeInPatientReferralScreenState _selectedBranch = null; _selectedClinic = null; _selectedDoctor = null; - model - .getDoctorBranch() - .then((value) async { + model.getDoctorBranch().then((value) async { _selectedBranch = value; if (_referTo['id'] == 1) { - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model - .getClinics(_selectedBranch[ - 'facilityId']) - .then((_) => - GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + .getClinics(_selectedBranch['facilityId']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } } else { _selectedBranch = null; @@ -247,9 +226,7 @@ class _PatientMakeInPatientReferralScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).hospital, - dropDownText: _selectedBranch != null - ? _selectedBranch['facilityName'] - : null, + dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: hospitalError, @@ -268,17 +245,12 @@ class _PatientMakeInPatientReferralScreenState _selectedBranch = selectedValue; _selectedClinic = null; _selectedDoctor = null; - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model - .getClinics( - _selectedBranch['facilityId']) - .then((_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + .getClinics(_selectedBranch['facilityId']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } }); }, @@ -299,9 +271,7 @@ class _PatientMakeInPatientReferralScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).clinic, - dropDownText: _selectedClinic != null - ? _selectedClinic['ClinicDescription'] - : null, + dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: clinicError, @@ -314,27 +284,19 @@ class _PatientMakeInPatientReferralScreenState attributeName: 'ClinicDescription', attributeValueId: 'ClinicID', usingSearch: true, - hintSearchText: - TranslationBase.of(context) - .clinicSearch, + hintSearchText: TranslationBase.of(context).clinicSearch, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() async { _selectedDoctor = null; _selectedClinic = selectedValue; - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model .getClinicDoctors( - patient, - _selectedClinic['ClinicID'], - _selectedBranch['facilityId']) - .then((_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + patient, _selectedClinic['ClinicID'], _selectedBranch['facilityId']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } }); }, @@ -355,49 +317,41 @@ class _PatientMakeInPatientReferralScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).doctor, - dropDownText: _selectedDoctor != null - ? _selectedDoctor['Name'] - : null, + dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: doctorError, - onClick: _selectedClinic != null && - model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.doctorsList, - attributeName: 'Name', - attributeValueId: 'DoctorID', - usingSearch: true, - hintSearchText: - TranslationBase.of(context) - .doctorSearch, - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); + onClick: + _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.doctorsList, + attributeName: 'Name', + attributeValueId: 'DoctorID', + usingSearch: true, + hintSearchText: TranslationBase.of(context).doctorSearch, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : () { + if (_selectedClinic == null) { + DrAppToastMsg.showErrorToast("You need to select a clinic first"); + } else if (model.doctorsList == null || model.doctorsList.length == 0) { + DrAppToastMsg.showErrorToast("There is no doctors for this clinic"); + } }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : () { - if (_selectedClinic == null) { - DrAppToastMsg.showErrorToast( - "You need to select a clinic first"); - } else if (model.doctorsList == null || - model.doctorsList.length == 0) { - DrAppToastMsg.showErrorToast( - "There is no doctors for this clinic"); - } - }, ), SizedBox( height: 10, @@ -425,11 +379,8 @@ class _PatientMakeInPatientReferralScreenState ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).referralFrequency, - dropDownText: _selectedFrequency != null - ? _selectedFrequency['Description'] - : null, + hintText: TranslationBase.of(context).referralFrequency, + dropDownText: _selectedFrequency != null ? _selectedFrequency['Description'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: frequencyError, @@ -439,8 +390,7 @@ class _PatientMakeInPatientReferralScreenState attributeName: 'Description', attributeValueId: 'ParameterCode', usingSearch: true, - hintSearchText: TranslationBase.of(context) - .selectReferralFrequency, + hintSearchText: TranslationBase.of(context).selectReferralFrequency, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { @@ -478,8 +428,7 @@ class _PatientMakeInPatientReferralScreenState maxLines: 6, ), Positioned( - top: - 0, //MediaQuery.of(context).size.height * 0, + top: 0, //MediaQuery.of(context).size.height * 0, right: 15, child: IconButton( icon: Icon( @@ -488,8 +437,7 @@ class _PatientMakeInPatientReferralScreenState size: 35, ), onPressed: () { - initSpeechState() - .then((value) => {onVoiceText()}); + initSpeechState().then((value) => {onVoiceText()}); }, ), ), @@ -524,32 +472,27 @@ class _PatientMakeInPatientReferralScreenState onPressed: () async { setState(() { if (_referTo == null) { - branchError = - TranslationBase.of(context).fieldRequired; + branchError = TranslationBase.of(context).fieldRequired; } else { branchError = null; } if (_selectedBranch == null) { - hospitalError = - TranslationBase.of(context).fieldRequired; + hospitalError = TranslationBase.of(context).fieldRequired; } else { hospitalError = null; } if (_selectedClinic == null) { - clinicError = - TranslationBase.of(context).fieldRequired; + clinicError = TranslationBase.of(context).fieldRequired; } else { clinicError = null; } if (_selectedDoctor == null) { - doctorError = - TranslationBase.of(context).fieldRequired; + doctorError = TranslationBase.of(context).fieldRequired; } else { doctorError = null; } if (_selectedFrequency == null) { - frequencyError = - TranslationBase.of(context).fieldRequired; + frequencyError = TranslationBase.of(context).fieldRequired; } else { frequencyError = null; } @@ -566,8 +509,7 @@ class _PatientMakeInPatientReferralScreenState projectID: _selectedBranch['facilityId'], clinicID: _selectedClinic['ClinicID'], doctorID: _selectedDoctor['DoctorID'], - frequencyCode: - _selectedFrequency['ParameterCode'], + frequencyCode: _selectedFrequency['ParameterCode'], ext: _extController.text, remarks: _remarksController.text, priority: _activePriority, @@ -575,9 +517,7 @@ class _PatientMakeInPatientReferralScreenState if (model.state == ViewState.ErrorLocal) DrAppToastMsg.showErrorToast(model.error); else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsg); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); Navigator.pop(context); } } @@ -602,8 +542,7 @@ class _PatientMakeInPatientReferralScreenState ]; return Container( height: screenSize.height * 0.070, - decoration: - containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + decoration: containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -615,16 +554,13 @@ class _PatientMakeInPatientReferralScreenState child: Container( height: screenSize.height * 0.070, decoration: containerBorderDecoration( - _isActive ? Color(0XFFB8382B) : Colors.white, - _isActive ? Color(0XFFB8382B) : Colors.white), + _isActive ? Color(0XFFB8382B) : Colors.white, _isActive ? Color(0XFFB8382B) : Colors.white), child: Center( child: Text( item, style: TextStyle( fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, + color: _isActive ? Colors.white : Colors.black, //Colors.black, fontWeight: FontWeight.bold, ), ), @@ -664,8 +600,7 @@ class _PatientMakeInPatientReferralScreenState return time; } - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 6a25b9a1..407a6815 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -74,8 +74,8 @@ class _PatientMakeReferralScreenState extends State { baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patientType, arrivalType), + appBar: PatientProfileAppBar( + patient), body: SingleChildScrollView( child: Container( child: Column( diff --git a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart index a949036b..50bd0a9e 100644 --- a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart @@ -19,8 +19,8 @@ import 'AddReplayOnReferralPatient.dart'; class ReferralPatientDetailScreen extends StatelessWidget { final MyReferralPatientModel referredPatient; final PatientReferralViewModel patientReferralViewModel; - ReferralPatientDetailScreen( - this.referredPatient, this.patientReferralViewModel); + + ReferralPatientDetailScreen(this.referredPatient, this.patientReferralViewModel); @override Widget build(BuildContext context) { @@ -51,8 +51,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - (Helpers.capitalize( - "${referredPatient.firstName} ${referredPatient.lastName}")), + (Helpers.capitalize("${referredPatient.firstName} ${referredPatient.lastName}")), fontSize: SizeConfig.textMultiplier * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -69,18 +68,14 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), InkWell( onTap: () { - PatiantInformtion patient = model - .getPatientFromReferralO(referredPatient); - Navigator.of(context) - .pushNamed(PATIENTS_PROFILE, arguments: { + PatiantInformtion patient = model.getPatientFromReferralO(referredPatient); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": patient, "patientType": "1", "isInpatient": true, "arrivalType": "1", - "from": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), - "to": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), + "from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), + "to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), }); }, child: Icon( @@ -97,18 +92,14 @@ class ReferralPatientDetailScreen extends StatelessWidget { children: [ InkWell( onTap: () { - PatiantInformtion patient = model - .getPatientFromReferralO(referredPatient); - Navigator.of(context) - .pushNamed(PATIENTS_PROFILE, arguments: { + PatiantInformtion patient = model.getPatientFromReferralO(referredPatient); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": patient, "patientType": "1", "isInpatient": true, "arrivalType": "1", - "from": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), - "to": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), + "from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), + "to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), }); }, child: Padding( @@ -143,8 +134,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( "${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}", @@ -153,7 +143,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { fontWeight: FontWeight.w700, color: referredPatient.referralStatus == 1 ? Color(0xffc4aa54) - : referredPatient.referralStatus == 46 + : referredPatient.referralStatus == 46 || referredPatient.referralStatus == 2 ? Colors.green[700] : Colors.red[700], ), @@ -169,28 +159,23 @@ class ReferralPatientDetailScreen extends StatelessWidget { ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .fileNumber, + TranslationBase.of(context).fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( "${referredPatient.patientID}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -207,94 +192,79 @@ class ReferralPatientDetailScreen extends StatelessWidget { ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( "${TranslationBase.of(context).refClinic}: ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, - color: Color(0XFF575757), - ), - AppText( - referredPatient - .referringClinicDescription, - fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .frequency + - ": ", - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient - .frequencyDescription, + referredPatient.referringClinicDescription, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ), ], ), + if (referredPatient.frequency != null) + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).frequency + ": ", + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ), + Expanded( + child: AppText( + referredPatient.frequencyDescription ?? '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ), + ], + ), ], ), ), Row( children: [ AppText( - referredPatient.nationalityName != - null + referredPatient.nationalityName != null ? referredPatient.nationalityName : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), - fontSize: - 1.4 * SizeConfig.textMultiplier, + fontSize: 1.4 * SizeConfig.textMultiplier, ), - referredPatient.nationalityFlagURL != - null + referredPatient.nationalityFlagURL != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), + borderRadius: BorderRadius.circular(20.0), child: Image.network( - referredPatient - .nationalityFlagURL, + referredPatient.nationalityFlagURL, height: 25, width: 30, - errorBuilder: (BuildContext - context, - Object exception, - StackTrace stackTrace) { + errorBuilder: + (BuildContext context, Object exception, StackTrace stackTrace) { return Text('No Image'); }, )) @@ -303,63 +273,60 @@ class ReferralPatientDetailScreen extends StatelessWidget { ) ], ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).priority + - ": ", - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Color(0XFF575757), - ), - Expanded( - child: AppText( - referredPatient.priorityDescription, + if (referredPatient.priorityDescription != null) + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).priority + ": ", fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), + fontWeight: FontWeight.w600, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .maxResponseTime + - ": ", - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Color(0XFF575757), - ), - Expanded( - child: AppText( - AppDateUtils.convertDateFromServerFormat( - referredPatient.mAXResponseTime, - "dd MMM,yyyy"), + Expanded( + child: AppText( + referredPatient.priorityDescription ?? '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ), + ], + ), + if (referredPatient.mAXResponseTime != null) + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).maxResponseTime + ": ", fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), + fontWeight: FontWeight.w600, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), ), - ), - ], - ), + Expanded( + child: AppText( + referredPatient.mAXResponseTime != null + ? AppDateUtils.convertDateFromServerFormat( + referredPatient.mAXResponseTime, "dd MMM,yyyy") + : '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ), + ], + ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: - EdgeInsets.only(left: 10, right: 0), + margin: EdgeInsets.only(left: 10, right: 0), child: Image.asset( 'assets/images/patient/ic_ref_arrow_up.png', height: 50, @@ -367,26 +334,17 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only( - left: 0, - top: 25, - right: 0, - bottom: 0), - padding: EdgeInsets.only( - left: 4.0, right: 4.0), - child: referredPatient.doctorImageURL != - null + margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0), + padding: EdgeInsets.only(left: 4.0, right: 4.0), + child: referredPatient.doctorImageURL != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), + borderRadius: BorderRadius.circular(20.0), child: Image.network( referredPatient.doctorImageURL, height: 25, width: 30, errorBuilder: - (BuildContext context, - Object exception, - StackTrace stackTrace) { + (BuildContext context, Object exception, StackTrace stackTrace) { return Text('No Image'); }, )) @@ -402,30 +360,22 @@ class ReferralPatientDetailScreen extends StatelessWidget { Expanded( flex: 4, child: Container( - margin: EdgeInsets.only( - left: 10, - top: 30, - right: 10, - bottom: 0), + margin: EdgeInsets.only(left: 10, top: 30, right: 10, bottom: 0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( "${TranslationBase.of(context).dr} ${referredPatient.referringDoctorName}", fontFamily: 'Poppins', fontWeight: FontWeight.w800, - fontSize: 1.5 * - SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier, color: Colors.black, ), AppText( - referredPatient - .referringClinicDescription, + referredPatient.referringClinicDescription, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.3 * - SizeConfig.textMultiplier, + fontSize: 1.3 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -445,67 +395,110 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), Expanded( child: SingleChildScrollView( - child: Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(8)), - border: Border.fromBorderSide(BorderSide( - color: Colors.white, - width: 1.0, - )), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).remarks, - fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: 2.4 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), + child: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(8)), + border: Border.fromBorderSide(BorderSide( + color: Colors.white, + width: 1.0, + )), ), - AppText( - referredPatient.referringDoctorRemarks, - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).remarks, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 2.4 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + AppText( + referredPatient.referringDoctorRemarks ?? '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + SizedBox( + height: 8, + ), + ], ), - SizedBox( - height: 8, + ), + if (referredPatient.referredDoctorRemarks!= null && referredPatient.referredDoctorRemarks.isNotEmpty) + Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 0), + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(8)), + border: Border.fromBorderSide(BorderSide( + color: Colors.white, + width: 1.0, + )), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).reply, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 2.4 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + AppText( + referredPatient.referredDoctorRemarks ?? '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + SizedBox( + height: 8, + ), + ], + ), ), - ], - ), + ], ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: AppButton( - title: TranslationBase.of(context).replay, - color: Colors.red[700], - fontColor: Colors.white, - fontWeight: FontWeight.w700, - fontSize: 1.8, - hPadding: 8, - vPadding: 12, - onPressed: () async { - Navigator.push( - context, - SlideUpPageRoute( - widget: AddReplayOnReferralPatient( - patientReferralViewModel: patientReferralViewModel, - myReferralInPatientModel: referredPatient, + if (referredPatient.referralStatus == 1) + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: AppButton( + title: TranslationBase.of(context).replay, + color: Colors.red[700], + fontColor: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 1.8, + hPadding: 8, + vPadding: 12, + onPressed: () async { + Navigator.push( + context, + SlideUpPageRoute( + widget: AddReplayOnReferralPatient( + patientReferralViewModel: patientReferralViewModel, + myReferralInPatientModel: referredPatient, + isEdited: referredPatient.referredDoctorRemarks!=null && referredPatient.referredDoctorRemarks.isNotEmpty, + ), ), - ), - ); - }, + ); + }, + ), ), - ), ], ), ), diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index dc2bf798..8dce7d60 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/enum/PatientType.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referred_patient_detail_in-paint.dart'; @@ -6,12 +7,20 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -class ReferredPatientScreen extends StatelessWidget { - // previous design page is: MyReferredPatient +class ReferredPatientScreen extends StatefulWidget { + + @override + _ReferredPatientScreenState createState() => _ReferredPatientScreenState(); +} + +class _ReferredPatientScreenState extends State { + PatientType patientType = PatientType.IN_PATIENT; + @override Widget build(BuildContext context) { return BaseView( @@ -20,103 +29,174 @@ class ReferredPatientScreen extends StatelessWidget { baseViewModel: model, isShowAppBar: false, appBarTitle: TranslationBase.of(context).referredPatient, - body: model.listMyReferredPatientModel == null || - model.listMyReferredPatientModel.length == 0 - ? Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: 100, + body: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 70), + child: PatientTypeRadioWidget( + (patientType) async { + setState(() { + this.patientType = patientType; + }); + GifLoaderDialogUtils.showMyDialog(context); + if (patientType == PatientType.IN_PATIENT) { + await model.getMyReferredPatient(isFirstTime: false); + } else { + await model.getMyReferredOutPatient(isFirstTime: false); + } + GifLoaderDialogUtils.hideDialog(context); + }, + ), + ), + model.listMyReferredPatientModel == null || + model.listMyReferredPatientModel.length == 0 + ? Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + TranslationBase.of(context).referralEmptyMsg, + color: Theme.of(context).errorColor, + ), + ) + ], ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).referralEmptyMsg, - color: Theme.of(context).errorColor, - ), - ) - ], - ), - ) - : SingleChildScrollView( - // DoctorApplication.svc/REST/GtMyReferredPatient - child: Container( - margin: EdgeInsets.only(top: 70), - child: Column( - children: [ - // const Divider( - // color: Color(0xffCCCCCC), - // height: 1, - // thickness: 2, - // indent: 0, - // endIndent: 0, - // ), - ...List.generate( - model.listMyReferredPatientModel.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferredPatientDetailScreen( - model.getReferredPatientItem(index)), + ) + : Expanded( + child: SingleChildScrollView( + // DoctorApplication.svc/REST/GtMyReferredPatient + child: Container( + child: Column( + children: [ + ...List.generate( + model.listMyReferredPatientModel.length, + (index) => InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferredPatientDetailScreen( + model.getReferredPatientItem(index), this.patientType), + ), + ); + }, + child: PatientReferralItemWidget( + referralStatus: model + .getReferredPatientItem(index) + .referralStatusDesc, + referralStatusCode: model + .getReferredPatientItem(index) + .referralStatus, + patientName: + "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + patientGender: + model.getReferredPatientItem(index).gender, + referredDate: + AppDateUtils.convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "dd/MM/yyyy"), + referredTime: + AppDateUtils.convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "hh:mm a"), + patientID: + "${model.getReferredPatientItem(index).patientID}", + isSameBranch: model + .getReferredPatientItem(index) + .isReferralDoctorSameBranch, + isReferral: false, + remark: model + .getReferredPatientItem(index) + .referringDoctorRemarks, + nationality: model + .getReferredPatientItem(index) + .nationalityName, + nationalityFlag: model + .getReferredPatientItem(index) + .nationalityFlagURL, + doctorAvatar: model + .getReferredPatientItem(index) + .doctorImageURL, + referralDoctorName: + "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", + clinicDescription: model + .getReferredPatientItem(index) + .referralClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, + size: 25, color: Colors.black), + ), ), - ); - }, - child: PatientReferralItemWidget( - referralStatus:model.getReferredPatientItem(index).referralStatusDesc, - referralStatusCode: model - .getReferredPatientItem(index) - .referralStatus, - patientName: - "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", - patientGender: - model.getReferredPatientItem(index).gender, - referredDate: AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "dd/MM/yyyy"), - referredTime: AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "hh:mm a"), - patientID: - "${model.getReferredPatientItem(index).patientID}", - isSameBranch: model - .getReferredPatientItem(index) - .isReferralDoctorSameBranch, - isReferral: false, - remark: model - .getReferredPatientItem(index) - .referringDoctorRemarks, - nationality: model - .getReferredPatientItem(index) - .nationalityName, - nationalityFlag: model - .getReferredPatientItem(index) - .nationalityFlagURL, - doctorAvatar: model - .getReferredPatientItem(index) - .doctorImageURL, - referralDoctorName: - "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", - clinicDescription: model - .getReferredPatientItem(index) - .referralClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), - ), + ), + ], ), ), - ], - ), + ), ), - ), + ], + ), ), ); } } + +class PatientTypeRadioWidget extends StatefulWidget { + final Function(PatientType) radioOnChange; + + PatientTypeRadioWidget(this.radioOnChange); + + @override + _PatientTypeRadioWidgetState createState() => + _PatientTypeRadioWidgetState(this.radioOnChange); +} + +class _PatientTypeRadioWidgetState extends State { + final Function(PatientType) radioOnChange; + + _PatientTypeRadioWidgetState(this.radioOnChange); + + PatientType patientType = PatientType.IN_PATIENT; + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded( + child: RadioListTile( + title: AppText(TranslationBase.of(context).inPatient), + value: PatientType.IN_PATIENT, + groupValue: patientType, + onChanged: (PatientType value) { + setState(() { + patientType = value; + radioOnChange(value); + }); + }, + ), + ), + Expanded( + child: RadioListTile( + title: AppText(TranslationBase.of(context).outpatient), + value: PatientType.OUT_PATIENT, + groupValue: patientType, + onChanged: (PatientType value) { + setState(() { + patientType = value; + radioOnChange(value); + }); + }, + ), + ), + ], + ); + } +} diff --git a/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart index b4e1ddc5..f6d3b8d7 100644 --- a/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/PatientType.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; @@ -18,8 +19,9 @@ import '../../../../routes.dart'; class ReferredPatientDetailScreen extends StatelessWidget { final MyReferredPatientModel referredPatient; + final PatientType patientType; - ReferredPatientDetailScreen(this.referredPatient); + ReferredPatientDetailScreen(this.referredPatient, this.patientType); @override Widget build(BuildContext context) { @@ -74,7 +76,8 @@ class ReferredPatientDetailScreen extends StatelessWidget { .pushNamed(PATIENTS_PROFILE, arguments: { "patient": patient, "patientType": "1", - "isInpatient": true, + "isInpatient": + patientType == PatientType.IN_PATIENT, "arrivalType": "1", "from": AppDateUtils.convertDateToFormat( DateTime.now(), 'yyyy-MM-dd'), @@ -93,14 +96,15 @@ class ReferredPatientDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ InkWell( - onTap: (){ + onTap: () { PatiantInformtion patient = - model.getPatientFromReferral(referredPatient); + model.getPatientFromReferral(referredPatient); Navigator.of(context) .pushNamed(PATIENTS_PROFILE, arguments: { "patient": patient, "patientType": "1", - "isInpatient": true, + "isInpatient": + patientType == PatientType.IN_PATIENT, "arrivalType": "1", "from": AppDateUtils.convertDateToFormat( DateTime.now(), 'yyyy-MM-dd'), @@ -236,34 +240,37 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), ], ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .frequency + - ": ", - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, - color: Color(0XFF575757), - ), - Expanded( - child: AppText( - referredPatient - .frequencyDescription, + if (referredPatient + .frequencyDescription != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .frequency + + ": ", fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: 14, - color: Color(0XFF2E303A), + fontWeight: FontWeight.w600, + fontSize: 1.7 * + SizeConfig.textMultiplier, + color: Color(0XFF575757), ), - ), - ], - ), + Expanded( + child: AppText( + referredPatient + .frequencyDescription, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 14, + color: Color(0XFF2E303A), + ), + ), + ], + ), ], ), ), @@ -301,54 +308,65 @@ class ReferredPatientDetailScreen extends StatelessWidget { ) ], ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).priority + - ": ", - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Color(0XFF575757), - ), - AppText( - referredPatient.priorityDescription, - fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: 14, - color: Color(0XFF2E303A), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .maxResponseTime + - ": ", - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Color(0XFF575757), - ), - Expanded( - child: AppText( - AppDateUtils.convertDateFromServerFormat( - referredPatient.mAXResponseTime, - "dd MMM,yyyy"), + if (referredPatient.priorityDescription != null) + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).priority + + ": ", fontFamily: 'Poppins', - fontWeight: FontWeight.w700, + fontWeight: FontWeight.w600, fontSize: - 1.8 * SizeConfig.textMultiplier, + 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ), + AppText( + referredPatient.priorityDescription, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 14, color: Color(0XFF2E303A), ), - ), - ], - ), + ], + ), + if (referredPatient.mAXResponseTime != null) + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .maxResponseTime + + ": ", + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: + 1.7 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ), + Expanded( + child: AppText( + referredPatient.mAXResponseTime != + null + ? AppDateUtils + .convertDateFromServerFormat( + referredPatient + .mAXResponseTime, + "dd MMM,yyyy") + : '', + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: + 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ), + ], + ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -514,10 +532,15 @@ class ReferredPatientDetailScreen extends StatelessWidget { color: Color(0XFF2E303A), ), AppText( - referredPatient - .referredDoctorRemarks.isNotEmpty - ? referredPatient.referredDoctorRemarks - : TranslationBase.of(context).notRepliedYet, + referredPatient.referredDoctorRemarks == + null + ? '' + : referredPatient.referredDoctorRemarks + .isNotEmpty + ? referredPatient + .referredDoctorRemarks + : TranslationBase.of(context) + .notRepliedYet, fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.6 * SizeConfig.textMultiplier, @@ -533,6 +556,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), ), ), + if (patientType == PatientType.IN_PATIENT) Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: AppButton( @@ -543,9 +567,11 @@ class ReferredPatientDetailScreen extends StatelessWidget { fontSize: 1.8, hPadding: 8, vPadding: 12, - disabled: referredPatient.referredDoctorRemarks.isNotEmpty - ? false - : true, + disabled: referredPatient.referredDoctorRemarks == null + ? true + : referredPatient.referredDoctorRemarks.isNotEmpty + ? false + : true, onPressed: () async { await model.verifyReferralDoctorRemarks(referredPatient); if (model.state == ViewState.ErrorLocal) { diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index 47d639ad..a30842f8 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -3,7 +3,6 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -// import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index 4f48ff27..fab69c44 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -55,7 +55,7 @@ class _UpdateAssessmentPageState extends State { episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', - appointmentNo: widget.patientInfo.appointmentNo); + appointmentNo: int.parse(widget.patientInfo.appointmentNo)); await model.getPatientAssessment(getAssessmentReqModel); if (model.patientAssessmentList.isNotEmpty) { if (model.listOfDiagnosisCondition.length == 0) { diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index 8fdfffc2..4d36f49f 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -36,7 +36,8 @@ class UpdateObjectivePage extends StatefulWidget { this.changePageViewIndex, this.mySelectedExamination, this.patientInfo, - this.changeLoadingState, this.currentIndex}); + this.changeLoadingState, + this.currentIndex}); @override _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); @@ -45,8 +46,7 @@ class UpdateObjectivePage extends StatefulWidget { class _UpdateObjectivePageState extends State { bool isSysExaminationExpand = false; - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -61,98 +61,89 @@ class _UpdateObjectivePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) async { - widget.mySelectedExamination.clear(); - GetPhysicalExamReqModel getPhysicalExamReqModel = - GetPhysicalExamReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: widget.patientInfo.appointmentNo); + onModelReady: (model) async { + widget.mySelectedExamination.clear(); + GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); - await model.getPatientPhysicalExam(getPhysicalExamReqModel); - if (model.patientPhysicalExamList.isNotEmpty) { - if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); - } - model.patientPhysicalExamList.forEach((element) { - MasterKeyModel examMaster = model.getOneMasterKey( - masterKeys: MasterKeysService.PhysicalExamination, - id: element.examId, - ); - MySelectedExamination tempEam = MySelectedExamination( - selectedExamination: examMaster, - remark: element.remarks, - isNormal: element.isNormal, - createdBy: element.createdBy, - notExamined: element.notExamined, - isNew: element.isNew, - isAbnormal: element.isAbnormal); - widget.mySelectedExamination.add(tempEam); - }); + await model.getPatientPhysicalExam(getPhysicalExamReqModel); + if (model.patientPhysicalExamList.isNotEmpty) { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup(MasterKeysService.PhysicalExamination); } + model.patientPhysicalExamList.forEach((element) { + MasterKeyModel examMaster = model.getOneMasterKey( + masterKeys: MasterKeysService.PhysicalExamination, + id: element.examId, + ); + MySelectedExamination tempEam = MySelectedExamination( + selectedExamination: examMaster, + remark: element.remarks, + isNormal: element.isNormal, + createdBy: element.createdBy, + notExamined: element.notExamined, + isNew: element.isNew, + isAbnormal: element.isAbnormal); + widget.mySelectedExamination.add(tempEam); + }); + } - widget.changeLoadingState(false); - }, - builder: (_, model, w) => AppScaffold( + widget.changeLoadingState(false); + }, + builder: (_, model, w) => AppScaffold( isShowAppBar: false, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SOAPStepHeader( - currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex), - ExpandableSOAPWidget( - headerTitle: - TranslationBase.of(context).physicalSystemExamination, - onTap: () { - setState(() { - isSysExaminationExpand = !isSysExaminationExpand; - }); - }, - child: Column( - children: [ - SOAPOpenItems(label: "${TranslationBase.of(context).addExamination}",onTap: () { - openExaminationList(context); - },), - Column( - children: - widget.mySelectedExamination.map((examination) { - return ExaminationItemCard(examination, () { - removeExamination( - examination.selectedExamination); - }); - }).toList(), - ) - ], - + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), + ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).physicalSystemExamination, + onTap: () { + setState(() { + isSysExaminationExpand = !isSysExaminationExpand; + }); + }, + child: Column( + children: [ + SOAPOpenItems( + label: "${TranslationBase.of(context).addExamination}", + onTap: () { + openExaminationList(context); + }, + ), + Column( + children: widget.mySelectedExamination.map((examination) { + return ExaminationItemCard(examination, () { + removeExamination(examination.selectedExamination); + }); + }).toList(), + ) + ], + ), + isExpanded: isSysExaminationExpand, ), - isExpanded: isSysExaminationExpand, - ), - SizedBox(height: MediaQuery - .of(context) - .size - .height * 0.12,) - ], + SizedBox( + height: MediaQuery.of(context).size.height * 0.12, + ) + ], + ), ), ), ), - ), - bottomSheet: - Container( + bottomSheet: Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all( - color: HexColor('#707070'), - width: 0), + border: Border.all(color: HexColor('#707070'), width: 0), ), height: 80, width: double.infinity, @@ -161,50 +152,48 @@ class _UpdateObjectivePageState extends State { SizedBox( height: 10, ), - Container(child: - FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: Colors.grey[300], - fontColor: Colors.black, - fontWeight: FontWeight.w600, - onPressed: () { - widget.changePageViewIndex(0); - }, - ) - , - ), - SizedBox(width: 5,), - Expanded( - child: AppButton( - title: TranslationBase - .of(context) - .next, - fontWeight: FontWeight.w600, - color: Colors.red[700], - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - await submitUpdateObjectivePage(model); - }, + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + widget.changePageViewIndex(0); + }, + ), + ), + SizedBox( + width: 5, ), - ), - ], + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + color: Colors.red[700], + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + await submitUpdateObjectivePage(model); + }, + ), + ), + ], + ), ), ), - ),), + ), SizedBox( height: 5, ), ], - ),) - - - ), + ), + )), ); } @@ -213,40 +202,36 @@ class _UpdateObjectivePageState extends State { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = - new PostPhysicalExamRequestModel(); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = - []; + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM - .add(ListHisProgNotePhysicalExaminationVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: exam.remark ?? '', - createdBy: exam.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - notExamined: exam.notExamined, - examinationType: exam.isNormal - ? 1 - : exam.isAbnormal - ? 2 - : 3, - examinationTypeName: exam.isNormal - ? "Normal" - : exam.isAbnormal - ? 'AbNormal' - : "Not Examined", - isNew: exam.isNew)); + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: exam.remark ?? '', + createdBy: exam.createdBy ?? doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + notExamined: exam.notExamined, + examinationType: exam.isNormal + ? 1 + : exam.isAbnormal + ? 2 + : 3, + examinationTypeName: exam.isNormal + ? "Normal" + : exam.isAbnormal + ? 'AbNormal' + : "Not Examined", + isNew: exam.isNew)); }); if (model.patientPhysicalExamList.isEmpty) { @@ -268,10 +253,8 @@ class _UpdateObjectivePageState extends State { } removeExamination(MasterKeyModel masterKey) { - Iterable history = widget.mySelectedExamination - .where((element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + Iterable history = widget.mySelectedExamination.where((element) => + masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); if (history.length > 0) setState(() { @@ -316,11 +299,7 @@ class AddExaminationDailog extends StatefulWidget { final Function addSelectedExamination; final Function(MasterKeyModel) removeExamination; - const AddExaminationDailog( - {Key key, - this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}) + const AddExaminationDailog({Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) : super(key: key); @override @@ -335,8 +314,7 @@ class _AddExaminationDailogState extends State { child: BaseView( onModelReady: (model) async { if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); + await model.getMasterLookup(MasterKeysService.PhysicalExamination); } }, builder: (_, model, w) => AppScaffold( @@ -346,21 +324,19 @@ class _AddExaminationDailogState extends State { child: Container( child: FractionallySizedBox( widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).physicalSystemExamination, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - ]), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).physicalSystemExamination, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + ]), ))), )), ); diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index 87ea1e4d..1960ef72 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -45,11 +45,9 @@ class _UpdatePlanPageState extends State { bool isAddProgress = true; bool isProgressExpanded = true; - TextEditingController progressNoteController = - TextEditingController(text: null); + TextEditingController progressNoteController = TextEditingController(text: null); - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -64,33 +62,32 @@ class _UpdatePlanPageState extends State { @override void initState() { super.initState(); - if(widget.patientProgressNote.planNote !=null ){ + if (widget.patientProgressNote.planNote != null) { setState(() { isAddProgress = false; }); } } - @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - GetGetProgressNoteReqModel getGetProgressNoteReqModel = - GetGetProgressNoteReqModel( - appointmentNo: widget.patientInfo.appointmentNo, - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: ''); + GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( + appointmentNo: int.parse(widget.patientInfo.appointmentNo), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); await model.getPatientProgressNote(getGetProgressNoteReqModel); if (model.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Helpers - .parseHtmlString(model.patientProgressNoteList[0].planNote); - widget.patientProgressNote.planNote = progressNoteController.text; - widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; - widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; - widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; - widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; + progressNoteController.text = Helpers.parseHtmlString(model.patientProgressNoteList[0].planNote); + widget.patientProgressNote.planNote = progressNoteController.text; + widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; + widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; + widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; + widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; setState(() { isAddProgress = false; }); @@ -98,267 +95,254 @@ class _UpdatePlanPageState extends State { widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( - backgroundColor: Theme - .of(context) - .scaffoldBackgroundColor, - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.90, - child: Column( - children: [ - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex:widget.changePageViewIndex), - - SizedBox(height: 10,), - - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).progressNote - , - onTap: () { - setState(() { - isProgressExpanded = !isProgressExpanded; - }); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if(isAddProgress) - Container( - margin: - EdgeInsets.only(left: 10, right: 10, top: 15), - - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).progressNote, - controller: progressNoteController, - minLines: 2, - maxLines: 4, - inputType: TextInputType.multiline, - onChanged: (value){ - widget.patientProgressNote.planNote = value; - }, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.90, + child: Column( + children: [ + SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), + SizedBox( + height: 10, + ), + ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).progressNote, + onTap: () { + setState(() { + isProgressExpanded = !isProgressExpanded; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (isAddProgress) + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).progressNote, + controller: progressNoteController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) { + widget.patientProgressNote.planNote = value; + }, + ), ), + SizedBox( + height: 9, ), - SizedBox( - height: 9, - ), - if ( widget.patientProgressNote.planNote != null&& !isAddProgress) - Container( - margin: - EdgeInsets.only(left: 5, right: 5, ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - - - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - AppText('Appointment No: ',fontSize: 12,), - AppText(widget.patientProgressNote.appointmentNo??'',fontWeight: FontWeight.w600,), - - ], - ), - AppText( - widget.patientProgressNote.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(DateTime.parse(widget.patientProgressNote.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), - fontWeight: FontWeight - .w600, - fontSize: 14, - ) - - ], - ), - Row( - - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - AppText('Condition: ', - fontSize: 12,), - AppText( - widget.patientProgressNote.mName??'',fontWeight: FontWeight.w600), - ], - ), - AppText( - widget.patientProgressNote.createdOn !=null?AppDateUtils.getHour(DateTime.parse(widget.patientProgressNote.createdOn)):AppDateUtils.getHour(DateTime.now()), - fontWeight: FontWeight.w600, - fontSize: 14, - ) - ], - ), - SizedBox(height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - child: AppText( - progressNoteController.text, - fontSize: 10, + if (widget.patientProgressNote.planNote != null && !isAddProgress) + Container( + margin: EdgeInsets.only( + left: 5, + right: 5, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + 'Appointment No: ', + fontSize: 12, + ), + AppText( + widget.patientProgressNote.appointmentNo ?? '', + fontWeight: FontWeight.w600, + ), + ], ), - ), - InkWell( - onTap: (){ - setState(() { - isAddProgress = true; - widget.changePageViewIndex(3,isChangeState:false); - }); - }, - child: Icon(DoctorApp.edit,size: 18,)) - ], - ), - ], - ), - ) - ], - ), - - ], + AppText( + widget.patientProgressNote.createdOn != null + ? AppDateUtils.getDayMonthYearDateFormatted( + DateTime.parse(widget.patientProgressNote.createdOn)) + : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + fontWeight: FontWeight.w600, + fontSize: 14, + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + 'Condition: ', + fontSize: 12, + ), + AppText(widget.patientProgressNote.mName ?? '', + fontWeight: FontWeight.w600), + ], + ), + AppText( + widget.patientProgressNote.createdOn != null + ? AppDateUtils.getHour( + DateTime.parse(widget.patientProgressNote.createdOn)) + : AppDateUtils.getHour(DateTime.now()), + fontWeight: FontWeight.w600, + fontSize: 14, + ) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: AppText( + progressNoteController.text, + fontSize: 10, + ), + ), + InkWell( + onTap: () { + setState(() { + isAddProgress = true; + widget.changePageViewIndex(3, isChangeState: false); + }); + }, + child: Icon( + DoctorApp.edit, + size: 18, + )) + ], + ), + ], + ), + ) + ], + ), + ], + ), + isExpanded: isProgressExpanded, ), - isExpanded: isProgressExpanded, - ), - - ], + ], + ), ), ), ), - ), - bottomSheet: - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all( - color: HexColor('#707070'), - width: 0), - ), - height: 80, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container(child: - FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase - .of(context) - .previous, - color: Colors.grey[300], - fontColor: Colors.black, - fontWeight: FontWeight.w600, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - widget.changePageViewIndex(2); - }, - ) - , - ), - SizedBox(width: 5,), - Expanded( - child: AppButton( - title: TranslationBase - .of(context) - .next, - fontWeight: FontWeight.w600, - color: Colors.red[700], - loading: model.state == ViewState.BusyLocal, - disabled: progressNoteController.text.isEmpty, - onPressed: () async { - if (progressNoteController.text.isNotEmpty) { - if (isAddProgress) { - Map profile = - await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = - DoctorProfileModel.fromJson(profile); - setState(() { - widget.patientProgressNote.createdByName = - widget.patientProgressNote - .createdByName ?? - doctorProfile.doctorName; - widget.patientProgressNote.editedByName = - doctorProfile.doctorName; - widget.patientProgressNote.createdOn = - DateTime.now().toString(); - widget.patientProgressNote.planNote = - progressNoteController.text; - isAddProgress = !isAddProgress; - }); - submitPlan(model); - } else { - Navigator.of(context).pop(); - } - } else { - Helpers.showErrorToast(TranslationBase.of(context) - .progressNoteErrorMsg); - } - }, - ), - ), - ], - ), - ), - ),), - SizedBox( - height: 5, - ), - ], - ),) - - ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: 80, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + fontColor: Colors.black, + fontWeight: FontWeight.w600, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + widget.changePageViewIndex(2); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + color: Colors.red[700], + loading: model.state == ViewState.BusyLocal, + disabled: progressNoteController.text.isEmpty, + onPressed: () async { + if (progressNoteController.text.isNotEmpty) { + if (isAddProgress) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + setState(() { + widget.patientProgressNote.createdByName = + widget.patientProgressNote.createdByName ?? doctorProfile.doctorName; + widget.patientProgressNote.editedByName = doctorProfile.doctorName; + widget.patientProgressNote.createdOn = DateTime.now().toString(); + widget.patientProgressNote.planNote = progressNoteController.text; + isAddProgress = !isAddProgress; + }); + submitPlan(model); + } else { + Navigator.of(context).pop(); + } + } else { + Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + } + }, + ), + ), + ], + ), + ), + ), + ), + SizedBox( + height: 5, + ), + ], + ), + )), ); } - submitPlan(SOAPViewModel model) async { + submitPlan(SOAPViewModel model) async { if (progressNoteController.text.isNotEmpty) { PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, appointmentNo: widget.patientInfo.appointmentNo, - planNote: widget.patientProgressNote.planNote, doctorID: '', editedBy: ''); + planNote: widget.patientProgressNote.planNote, + doctorID: '', + editedBy: ''); - if(model.patientProgressNoteList.isEmpty){ + if (model.patientProgressNoteList.isEmpty) { await model.postProgressNote(postProgressNoteRequestModel); - - }else { + } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - postProgressNoteRequestModel.editedBy =doctorProfile.doctorID; + postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; await model.patchProgressNote(postProgressNoteRequestModel); - } if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); } else { - widget.changePageViewIndex(4,isChangeState:false); + widget.changePageViewIndex(4, isChangeState: false); } } else { Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); } } - - } diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index b0db0414..1b6cd274 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -33,14 +33,16 @@ class UpdateSubjectivePage extends StatefulWidget { final List myAllergiesList; final List myHistoryList; final PatiantInformtion patientInfo; - final int currentIndex; + final int currentIndex; UpdateSubjectivePage( {Key key, this.changePageViewIndex, this.myAllergiesList, this.myHistoryList, - this.patientInfo, this.changeLoadingState, this.currentIndex}); + this.patientInfo, + this.changeLoadingState, + this.currentIndex}); @override _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); @@ -63,11 +65,11 @@ class _UpdateSubjectivePageState extends State { GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( patientMRN: widget.patientInfo.patientMRN, episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: widget.patientInfo.appointmentNo, + appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), doctorID: '', editedBy: ''); - await model.getPatientHistories(getHistoryReqModel,isFirst: true); + await model.getPatientHistories(getHistoryReqModel, isFirst: true); if (model.patientHistoryList.isNotEmpty) { if (model.historyFamilyList.isEmpty) { @@ -84,62 +86,50 @@ class _UpdateSubjectivePageState extends State { } model.patientHistoryList.forEach((element) { - if (element.historyType == - MasterKeysService.HistoryFamily.getMasterKeyService()) { + if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryFamily, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = MySelectedHistory( - selectedHistory: history, - isChecked: element.isChecked, - remark: element.remarks); + MySelectedHistory mySelectedHistory = + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); widget.myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistoryMedical.getMasterKeyService()) { + if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryMedical, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = MySelectedHistory( - selectedHistory: history, - isChecked: element.isChecked, - remark: element.remarks); + MySelectedHistory mySelectedHistory = + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); widget.myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistorySports.getMasterKeyService()) { + if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySports, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = MySelectedHistory( - selectedHistory: history, - isChecked: element.isChecked, - remark: element.remarks); + MySelectedHistory mySelectedHistory = + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); widget.myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistorySurgical.getMasterKeyService()) { + if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySurgical, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = MySelectedHistory( - selectedHistory: history, - isChecked: element.isChecked, - remark: element.remarks); + MySelectedHistory mySelectedHistory = + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); widget.myHistoryList.add(mySelectedHistory); } @@ -152,28 +142,23 @@ class _UpdateSubjectivePageState extends State { GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, + appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), doctorID: '', editedBy: ''); await model.getPatientAllergy(generalGetReqForSOAP); if (model.patientAllergiesList.isNotEmpty) { - if (model.allergiesList.isEmpty) - await model.getMasterLookup(MasterKeysService.Allergies); - if (model.allergySeverityList.isEmpty) - await model.getMasterLookup(MasterKeysService.AllergySeverity); + if (model.allergiesList.isEmpty) await model.getMasterLookup(MasterKeysService.Allergies); + if (model.allergySeverityList.isEmpty) await model.getMasterLookup(MasterKeysService.AllergySeverity); model.patientAllergiesList.forEach((element) { MasterKeyModel selectedAllergy = model.getOneMasterKey( - masterKeys: MasterKeysService.Allergies, - id: element.allergyDiseaseId, - typeId: element.allergyDiseaseType); + masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); MasterKeyModel selectedAllergySeverity; if (element.severity == 0) { selectedAllergySeverity = MasterKeyModel( - id: 0, - typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); + id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); } else { - selectedAllergySeverity = model.getOneMasterKey( + selectedAllergySeverity = model.getOneMasterKey( masterKeys: MasterKeysService.AllergySeverity, id: element.severity, ); @@ -185,8 +170,7 @@ class _UpdateSubjectivePageState extends State { createdBy: element.createdBy, remark: element.remarks, selectedAllergySeverity: selectedAllergySeverity); - if (selectedAllergy != null && selectedAllergySeverity != null) - widget.myAllergiesList.add(mySelectedAllergy); + if (selectedAllergy != null && selectedAllergySeverity != null) widget.myAllergiesList.add(mySelectedAllergy); }); } } @@ -198,33 +182,30 @@ class _UpdateSubjectivePageState extends State { widget.myAllergiesList.clear(); widget.myHistoryList.clear(); - GetChiefComplaintReqModel getChiefComplaintReqModel = - GetChiefComplaintReqModel( - patientMRN: widget.patientInfo.patientMRN, - appointmentNo: widget.patientInfo.appointmentNo, - episodeId: widget.patientInfo.episodeNo, - episodeID: widget.patientInfo.episodeNo, - doctorID: ''); + GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( + patientMRN: widget.patientInfo.patientMRN, + appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), + episodeId: widget.patientInfo.episodeNo, + episodeID: widget.patientInfo.episodeNo, + doctorID: ''); await model.getPatientChiefComplaint(getChiefComplaintReqModel); if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; - complaintsController.text = Helpers.parseHtmlString( - model.patientChiefComplaintList[0].chiefComplaint); + complaintsController.text = Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint); illnessController.text = model.patientChiefComplaintList[0].hopi; - medicationController.text =!(model.patientChiefComplaintList[0].currentMedication).isNotEmpty ? model.patientChiefComplaintList[0].currentMedication + '\n \n':model.patientChiefComplaintList[0].currentMedication; + medicationController.text = !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty + ? model.patientChiefComplaintList[0].currentMedication + '\n \n' + : model.patientChiefComplaintList[0].currentMedication; } await getHistory(model); await getAllergies(model); widget.changeLoadingState(false); - }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, - backgroundColor: Theme - .of(context) - .scaffoldBackgroundColor, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( @@ -234,12 +215,9 @@ class _UpdateSubjectivePageState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex:widget.changePageViewIndex), + SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context) - .chiefComplaints - , + headerTitle: TranslationBase.of(context).chiefComplaints, onTap: () { setState(() { isChiefExpand = !isChiefExpand; @@ -259,12 +237,8 @@ class _UpdateSubjectivePageState extends State { SizedBox( height: 30, ), - - ExpandableSOAPWidget( - headerTitle: TranslationBase - .of(context) - .histories, + headerTitle: TranslationBase.of(context).histories, isRequired: false, onTap: () { setState(() { @@ -272,22 +246,15 @@ class _UpdateSubjectivePageState extends State { }); }, child: Column( - children: [ - UpdateHistoryWidget(myHistoryList: widget.myHistoryList) - ], + children: [UpdateHistoryWidget(myHistoryList: widget.myHistoryList)], ), isExpanded: isHistoryExpand, ), SizedBox( height: 30, ), - - ExpandableSOAPWidget( - headerTitle: TranslationBase - .of(context) - .allergiesSoap - , + headerTitle: TranslationBase.of(context).allergiesSoap, isRequired: false, onTap: () { setState(() { @@ -296,8 +263,9 @@ class _UpdateSubjectivePageState extends State { }, child: Column( children: [ - UpdateAllergiesWidget(myAllergiesList: widget - .myAllergiesList,), + UpdateAllergiesWidget( + myAllergiesList: widget.myAllergiesList, + ), SizedBox( height: 30, ), @@ -306,7 +274,7 @@ class _UpdateSubjectivePageState extends State { isExpanded: isAllergiesExpand, ), SizedBox( - height:MediaQuery.of(context).size.height * 0.16, + height: MediaQuery.of(context).size.height * 0.16, ), ], ), @@ -319,9 +287,7 @@ class _UpdateSubjectivePageState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all( - color: HexColor('#707070'), - width: 0), + border: Border.all(color: HexColor('#707070'), width: 0), ), height: 80, width: double.infinity, @@ -330,38 +296,35 @@ class _UpdateSubjectivePageState extends State { SizedBox( height: 10, ), - Container(child: - FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: TranslationBase - .of(context) - .next, - fontWeight: FontWeight.w600, - color:Colors.red[700], - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - addSubjectiveInfo( - model: model, - myAllergiesList: widget.myAllergiesList, - myHistoryList: widget.myHistoryList); - }, + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + color: Colors.red[700], + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + addSubjectiveInfo( + model: model, myAllergiesList: widget.myAllergiesList, myHistoryList: widget.myHistoryList); + }, + ), ), ), - ),), + ), SizedBox( height: 5, ), ], - ),), + ), + ), ), ); } - addSubjectiveInfo({SOAPViewModel model, - List myAllergiesList, - List myHistoryList}) async { + addSubjectiveInfo( + {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { formKey.currentState.save(); formKey.currentState.validate(); @@ -391,66 +354,49 @@ class _UpdateSubjectivePageState extends State { widget.changeLoadingState(true); widget.changePageViewIndex(1); - } else { setState(() { if (complaintsController.text.isEmpty) { - complaintsControllerError = TranslationBase - .of(context) - .emptyMessage; + complaintsControllerError = TranslationBase.of(context).emptyMessage; } else if (complaintsController.text.length < 25) { - complaintsControllerError = TranslationBase - .of(context) - .chiefComplaintLength; + complaintsControllerError = TranslationBase.of(context).chiefComplaintLength; } if (illnessController.text.isEmpty) { - illnessControllerError = TranslationBase - .of(context) - .emptyMessage; + illnessControllerError = TranslationBase.of(context).emptyMessage; } if (medicationController.text.isEmpty) { - medicationControllerError = TranslationBase - .of(context) - .emptyMessage; + medicationControllerError = TranslationBase.of(context).emptyMessage; } }); - Helpers.showErrorToast(TranslationBase - .of(context) - .chiefComplaintErrorMsg); + Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); } - - } - postAllergy( - {List myAllergiesList, SOAPViewModel model}) async { - PostAllergyRequestModel postAllergyRequestModel = - new PostAllergyRequestModel(); + postAllergy({List myAllergiesList, SOAPViewModel model}) async { + PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); widget.myAllergiesList.forEach((allergy) { - if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == - null) + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( - ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: allergy.createdBy??doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - isChecked: allergy.isChecked, - isUpdatedByNurse: false)); + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: allergy.createdBy ?? doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + isChecked: allergy.isChecked, + isUpdatedByNurse: false)); }); if (model.patientAllergiesList.isEmpty) { await model.postAllergy(postAllergyRequestModel); @@ -464,20 +410,17 @@ class _UpdateSubjectivePageState extends State { appointmentNo: widget.patientInfo.appointmentNo, doctorID: '', editedBy: ''); - await model.getPatientAllergy(generalGetReqForSOAP, isLocalBusy : true); + await model.getPatientAllergy(generalGetReqForSOAP, isLocalBusy: true); if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); } } - postHistories( - {List myHistoryList, SOAPViewModel model}) async { - PostHistoriesRequestModel postHistoriesRequestModel = - new PostHistoriesRequestModel(doctorID: ''); + postHistories({List myHistoryList, SOAPViewModel model}) async { + PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: ''); widget.myHistoryList.forEach((history) { - if (postHistoriesRequestModel.listMedicalHistoryVM == null) - postHistoriesRequestModel.listMedicalHistoryVM = []; + if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = []; postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, @@ -489,14 +432,12 @@ class _UpdateSubjectivePageState extends State { )); }); - if (model.patientHistoryList.isEmpty) { await model.postHistories(postHistoriesRequestModel); } else { await model.patchHistories(postHistoriesRequestModel); } - if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); } @@ -504,20 +445,18 @@ class _UpdateSubjectivePageState extends State { postChiefComplaint({SOAPViewModel model}) async { formKey.currentState.save(); - if(formKey.currentState.validate()){ - PostChiefComplaintRequestModel postChiefComplaintRequestModel = - new PostChiefComplaintRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - chiefComplaint: complaintsController.text, - currentMedication: medicationController.text, - hopi: illnessController.text, - isLactation: false, - ispregnant: false, - doctorID: '', - - numberOfWeeks: 0); + if (formKey.currentState.validate()) { + PostChiefComplaintRequestModel postChiefComplaintRequestModel = new PostChiefComplaintRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + chiefComplaint: complaintsController.text, + currentMedication: medicationController.text, + hopi: illnessController.text, + isLactation: false, + ispregnant: false, + doctorID: '', + numberOfWeeks: 0); if (model.patientChiefComplaintList.isEmpty) { postChiefComplaintRequestModel.editedBy = ''; await model.postChiefComplaint(postChiefComplaintRequestModel); @@ -527,8 +466,3 @@ class _UpdateSubjectivePageState extends State { } } } - - - - - diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index d9af7457..60597b11 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/update_subjective_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -82,7 +82,7 @@ class _UpdateSoapIndexState extends State mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - PatientProfileHeaderNewDesign(patient, '7', '7',), + PatientProfileAppBar(patient), Container( width: double.infinity, height: 1, diff --git a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart deleted file mode 100644 index 0bf2197b..00000000 --- a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart +++ /dev/null @@ -1,1074 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - -class PatientVitalSignScreen extends StatelessWidget { - @override - Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String from = routeArgs['from']; - String to = routeArgs['to']; - - return BaseView( - onModelReady: (model) => model.getPatientVitalSign(patient), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).vitalSign, - body: model.patientVitalSigns != null - ? SingleChildScrollView( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - PatientPageHeaderWidget(patient), - SizedBox( - height: 16, - ), - Container( - margin: - EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).weight} :", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 8, - ), - AppText( - "${model.patientVitalSigns.weightKg} ${TranslationBase.of(context).kg}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).idealBodyWeight} :", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 8, - ), - AppText( - "${model.patientVitalSigns.idealBodyWeightLbs} ${TranslationBase.of(context).kg}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).height} :", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 8, - ), - AppText( - "${model.patientVitalSigns.heightCm} ${TranslationBase.of(context).cm}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - /*Row( - children: [ - AppText( - "${TranslationBase.of(context).waistSize} :", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 8, - ), - AppText( - "${model.patientVitalSigns.waistSizeInch} ${TranslationBase.of(context).inch}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ),*/ - Row( - children: [ - AppText( - "${TranslationBase.of(context).headCircum} :", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 8, - ), - AppText( - "${model.patientVitalSigns.headCircumCm} ${TranslationBase.of(context).cm}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - SizedBox( - height: 16, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).leanBodyWeight} :", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 8, - ), - AppText( - "${model.patientVitalSigns.leanBodyWeightLbs} ${TranslationBase.of(context).kg}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).bodyMassIndex} :", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 8, - ), - AppText( - "${model.patientVitalSigns.bodyMassIndex}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - SizedBox( - width: 8, - ), - Container( - color: Colors.green, - child: Padding( - padding: EdgeInsets.symmetric( - vertical: 2, horizontal: 8), - child: AppText( - "${model.getBMI(model.patientVitalSigns.bodyMassIndex)}", - fontSize: - SizeConfig.textMultiplier * 2, - color: Colors.white, - fontWeight: FontWeight.bold, - ), - ), - ) - ], - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "G.C.S :", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 8, - ), - AppText( - "N/A", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - SizedBox( - height: 16, - ), - const Divider( - color: Color(0xffCCCCCC), - height: 1, - thickness: 2, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 16, - ), - TemperatureWidget(model, model.patientVitalSigns), - SizedBox( - height: 16, - ), - const Divider( - color: Color(0xffCCCCCC), - height: 1, - thickness: 2, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 16, - ), - PulseWidget(model.patientVitalSigns), - SizedBox( - height: 16, - ), - const Divider( - color: Color(0xffCCCCCC), - height: 1, - thickness: 2, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 16, - ), - RespirationWidget(model.patientVitalSigns), - SizedBox( - height: 16, - ), - const Divider( - color: Color(0xffCCCCCC), - height: 1, - thickness: 2, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 16, - ), - BloodPressureWidget(model.patientVitalSigns), - SizedBox( - height: 16, - ), - const Divider( - color: Color(0xffCCCCCC), - height: 1, - thickness: 2, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 16, - ), - OxygenationWidget(model.patientVitalSigns), - SizedBox( - height: 16, - ), - const Divider( - color: Color(0xffCCCCCC), - height: 1, - thickness: 2, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 16, - ), - PainScaleWidget(model.patientVitalSigns), - SizedBox( - height: 16, - ), - const Divider( - color: Color(0xffCCCCCC), - height: 1, - thickness: 2, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 16, - ), - ], - ), - ) - ], - ), - ), - ) - : Center( - child: AppText( - "${TranslationBase.of(context).vitalSignEmptyMsg}", - fontSize: SizeConfig.textMultiplier * 2.5, - color: HexColor("#B8382B"), - fontWeight: FontWeight.normal, - ), - ), - ), - ); - } -} - -class TemperatureWidget extends StatefulWidget { - final VitalSignsViewModel model; - final VitalSignData vitalSign; - - TemperatureWidget(this.model, this.vitalSign); - - @override - _TemperatureWidgetState createState() => _TemperatureWidgetState(); -} - -class _TemperatureWidgetState extends State { - bool isExpand = false; - - @override - Widget build(BuildContext context) { - return Container( - child: HeaderBodyExpandableNotifier( - headerWidget: Container( - margin: EdgeInsets.symmetric(vertical: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - "${TranslationBase.of(context).temperature}", - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.black, - fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, - ), - InkWell( - onTap: () { - setState(() { - isExpand = !isExpand; - }); - }, - child: Icon(isExpand ? Icons.remove : Icons.add), - ), - ], - ), - ), - bodyWidget: Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).temperature} (C):", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.temperatureCelcius}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).temperature} (F):", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).method} :", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.model.getTempratureMethod(widget.vitalSign.temperatureCelciusMethod)}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - ], - ), - ), - isExpand: isExpand, - ), - ); - } -} - -class PulseWidget extends StatefulWidget { - final VitalSignData vitalSign; - - PulseWidget(this.vitalSign); - - @override - _PulseWidgetState createState() => _PulseWidgetState(); -} - -class _PulseWidgetState extends State { - bool isExpand = false; - - @override - Widget build(BuildContext context) { - return Container( - child: HeaderBodyExpandableNotifier( - headerWidget: Container( - margin: EdgeInsets.symmetric(vertical: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - "${TranslationBase.of(context).pulse}", - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.black, - fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, - ), - InkWell( - onTap: () { - setState(() { - isExpand = !isExpand; - }); - }, - child: Icon(isExpand ? Icons.remove : Icons.add), - ), - ], - ), - ), - bodyWidget: Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).pulseBeats}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.pulseBeatPerMinute}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).rhythm}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.pulseRhythm}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - isExpand: isExpand, - ), - ); - } -} - -class RespirationWidget extends StatefulWidget { - final VitalSignData vitalSign; - - RespirationWidget(this.vitalSign); - - @override - _RespirationWidgetState createState() => _RespirationWidgetState(); -} - -class _RespirationWidgetState extends State { - bool isExpand = false; - - @override - Widget build(BuildContext context) { - return Container( - child: HeaderBodyExpandableNotifier( - headerWidget: Container( - margin: EdgeInsets.symmetric(vertical: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - "${TranslationBase.of(context).respiration}", - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.black, - fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, - ), - InkWell( - onTap: () { - setState(() { - isExpand = !isExpand; - }); - }, - child: Icon(isExpand ? Icons.remove : Icons.add), - ), - ], - ), - ), - bodyWidget: Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).respBeats}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.respirationBeatPerMinute}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).patternOfRespiration}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.respirationPattern}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - ], - ), - ), - isExpand: isExpand, - ), - ); - } -} - -class BloodPressureWidget extends StatefulWidget { - final VitalSignData vitalSign; - - BloodPressureWidget(this.vitalSign); - - @override - _BloodPressureWidgetState createState() => _BloodPressureWidgetState(); -} - -class _BloodPressureWidgetState extends State { - bool isExpand = false; - - @override - Widget build(BuildContext context) { - return Container( - child: HeaderBodyExpandableNotifier( - headerWidget: Container( - margin: EdgeInsets.symmetric(vertical: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - "${TranslationBase.of(context).bloodPressure}", - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.black, - fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, - ), - InkWell( - onTap: () { - setState(() { - isExpand = !isExpand; - }); - }, - child: Icon(isExpand ? Icons.remove : Icons.add), - ), - ], - ), - ), - bodyWidget: Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).cuffLocation}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.bloodPressureCuffLocation}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: AppText( - "${TranslationBase.of(context).patientPosition}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: AppText( - "${widget.vitalSign.bloodPressurePatientPosition}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - Expanded( - child: Row( - children: [ - AppText( - "${TranslationBase.of(context).cuffSize}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureCuffSize}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ), - ], - ), - ], - ), - ), - isExpand: isExpand, - ), - ); - } -} - -class OxygenationWidget extends StatefulWidget { - final VitalSignData vitalSign; - - OxygenationWidget(this.vitalSign); - - @override - _OxygenationWidgetState createState() => _OxygenationWidgetState(); -} - -class _OxygenationWidgetState extends State { - bool isExpand = false; - - @override - Widget build(BuildContext context) { - return Container( - child: HeaderBodyExpandableNotifier( - headerWidget: Container( - margin: EdgeInsets.symmetric(vertical: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - "${TranslationBase.of(context).oxygenation}", - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.black, - fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, - ), - InkWell( - onTap: () { - setState(() { - isExpand = !isExpand; - }); - }, - child: Icon(isExpand ? Icons.remove : Icons.add), - ), - ], - ), - ), - bodyWidget: Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).sao2}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.sao2}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).fio2}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.fio2}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - ], - ), - ), - isExpand: isExpand, - ), - ); - } -} - -class PainScaleWidget extends StatefulWidget { - final VitalSignData vitalSign; - - PainScaleWidget(this.vitalSign); - - @override - _PainScaleWidgetState createState() => _PainScaleWidgetState(); -} - -class _PainScaleWidgetState extends State { - bool isExpand = false; - - @override - Widget build(BuildContext context) { - return Container( - child: HeaderBodyExpandableNotifier( - headerWidget: Container( - margin: EdgeInsets.symmetric(vertical: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - "${TranslationBase.of(context).painScale}", - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.black, - fontWeight: isExpand ? FontWeight.bold : FontWeight.normal, - ), - InkWell( - onTap: () { - setState(() { - isExpand = !isExpand; - }); - }, - child: Icon(isExpand ? Icons.remove : Icons.add), - ), - ], - ), - ), - bodyWidget: Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - children: [ - AppText( - "${TranslationBase.of(context).painScale}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.painScore}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ), - Expanded( - child: Row( - children: [ - AppText( - "${TranslationBase.of(context).painManagement}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.isPainManagementDone}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ), - ], - ), - ], - ), - ), - isExpand: isExpand, - ), - ); - } -} diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index a6f36784..23266095 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -6,12 +6,12 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_item.dart'; import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; class VitalSignDetailsScreen extends StatelessWidget { int appointmentNo; @@ -39,8 +39,9 @@ class VitalSignDetailsScreen extends StatelessWidget { builder: (_, mode, widget) => AppScaffold( baseViewModel: mode, isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patientType, arrivalType), + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: PatientProfileAppBar( + patient), appBarTitle: TranslationBase.of(context).vitalSign, body: mode.patientVitalSignsHistory.length > 0 ? Column( @@ -56,7 +57,7 @@ class VitalSignDetailsScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - "${patient.firstName ?? patient.patientDetails.firstName}'s", + "${patient.firstName ?? patient?.patientDetails?.firstName?? patient.fullName?? ''}'s", fontSize: SizeConfig.textMultiplier * 1.6, fontWeight: FontWeight.w700, color: Color(0xFF2E303A), @@ -587,31 +588,18 @@ class VitalSignDetailsScreen extends StatelessWidget { ), ), ], - ), - ), - ), - ], - ) - : Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 100, - ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).vitalSignEmptyMsg, - fontWeight: FontWeight.normal, - color: HexColor("#B8382B"), - fontSize: SizeConfig.textMultiplier * 2.5, - ), - ) - ], ), ), + ), + ], + ) + : Container( + color: Theme + .of(context) + .scaffoldBackgroundColor, + child: ErrorMessage(error: TranslationBase + .of(context) + .vitalSignEmptyMsg,)), ), ); } diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart index 343d0590..0ed9da56 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart @@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sig import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart'; import 'package:doctor_app_flutter/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -190,8 +190,8 @@ class VitalSignItemDetailsScreen extends StatelessWidget { appBarTitle: pageTitle, backgroundColor: Color.fromRGBO(248, 248, 248, 1), isShowAppBar: true, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patientType, arrivalType), + appBar: PatientProfileAppBar( + patient,), body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -202,7 +202,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - "${patient.firstName ?? patient.patientDetails.firstName}'s", + "${patient.firstName ?? patient?.patientDetails?.firstName?? patient.fullName?? ''}'s", fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 1.6, fontWeight: FontWeight.w600, diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index a3c6e589..477e5359 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -5,14 +5,16 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; - +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/drugtodrug.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -21,17 +23,19 @@ import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; -addPrescriptionForm(context, PrescriptionViewModel model, - PatiantInformtion patient, prescription) { +addPrescriptionForm(context, PrescriptionViewModel model, PatiantInformtion patient, prescription) { showModalBottomSheet( isScrollControlled: true, context: context, @@ -40,7 +44,7 @@ addPrescriptionForm(context, PrescriptionViewModel model, }); } -postProcedure( +postPrescription( {String duration, String doseTimeIn, String dose, @@ -56,16 +60,15 @@ postProcedure( String icdCode, PatiantInformtion patient, String patientType}) async { - PostPrescriptionReqModel postProcedureReqModel = - new PostPrescriptionReqModel(); - List sss = List(); + PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); + List prescriptionList = List(); postProcedureReqModel.appointmentNo = patient.appointmentNo; postProcedureReqModel.clinicID = patient.clinicId; postProcedureReqModel.episodeID = patient.episodeNo; postProcedureReqModel.patientMRN = patient.patientMRN; - sss.add(PrescriptionRequestModel( + prescriptionList.add(PrescriptionRequestModel( covered: true, dose: double.parse(dose), itemId: drugId.isEmpty ? 1 : int.parse(drugId), @@ -78,9 +81,7 @@ postProcedure( doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn), duration: duration.isEmpty ? 1 : int.parse(duration), doseStartDate: doseTime.toIso8601String())); - postProcedureReqModel.prescriptionRequestModel = sss; - //postProcedureReqModel.procedures = controlsProcedure; - + postProcedureReqModel.prescriptionRequestModel = prescriptionList; await model.postPrescription(postProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { @@ -93,8 +94,9 @@ postProcedure( class PrescriptionFormWidget extends StatefulWidget { final PrescriptionViewModel model; - PatiantInformtion patient; - List prescriptionList; + final PatiantInformtion patient; + final List prescriptionList; + PrescriptionFormWidget(this.model, this.patient, this.prescriptionList); @override @@ -102,11 +104,16 @@ class PrescriptionFormWidget extends StatefulWidget { } class _PrescriptionFormWidgetState extends State { + String routeError; + String frequencyError; + String doseTimeError; + String durationError; + String unitError; + String strengthError; + int selectedType; - TextEditingController durationController = TextEditingController(); + TextEditingController strengthController = TextEditingController(); - TextEditingController routeController = TextEditingController(); - TextEditingController frequencyController = TextEditingController(); TextEditingController indicationController = TextEditingController(); TextEditingController instructionController = TextEditingController(); @@ -115,25 +122,19 @@ class _PrescriptionFormWidgetState extends State { final myController = TextEditingController(); DateTime selectedDate; - dynamic selectedDrug; int strengthChar; GetMedicationResponseModel _selectedMedication; - GlobalKey key = - new GlobalKey>(); + GlobalKey key = new GlobalKey>(); TextEditingController drugIdController = TextEditingController(); TextEditingController doseController = TextEditingController(); final searchController = TextEditingController(); - - var notesList; - var filteredNotesList; - String textSeartch = "Amoxicillin"; + stt.SpeechToText speech = stt.SpeechToText(); + var event = RobotProvider(); + var reconizedWord; final GlobalKey formKey = GlobalKey(); final double spaceBetweenTextFileds = 12; - List referToList; - dynamic type; - dynamic strength; dynamic route; dynamic frequency; dynamic duration; @@ -144,42 +145,18 @@ class _PrescriptionFormWidgetState extends State { dynamic box; dynamic x; - List indicationList; - String routeInatial = 'By Mouth'; - - //PatiantInformtion patient; @override void initState() { - super.initState(); + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); selectedType = 1; - referToList = List(); - - indicationList = List(); - - dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"}; - dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"}; - dynamic indication3 = {"id": 547, "name": "Hypertrichosis"}; - dynamic indication4 = {"id": 548, "name": "Mild Dizziness"}; - dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"}; - dynamic indication6 = { - "id": 550, - "name": "Phenytoin Hypersensitivity Syndrome" - }; - dynamic indication7 = {"id": 551, "name": "Asterixis"}; - dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"}; - dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; - dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"}; - - indicationList.add(indication1); - indicationList.add(indication2); - indicationList.add(indication3); - indicationList.add(indication4); - indicationList.add(indication5); - indicationList.add(indication6); - indicationList.add(indication7); - indicationList.add(indication8); - indicationList.add(indication9); - indicationList.add(indication10); + super.initState(); } setSelectedType(int val) { @@ -188,15 +165,61 @@ class _PrescriptionFormWidgetState extends State { }); } + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + print(error); + } + + void statusListener(String status) { + reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + void resultListener(result) { + reconizedWord = result.recognizedWords; + event.setValue({"searchText": reconizedWord}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speech.stop(); + instructionController.text += reconizedWord + '\n'; + }); + } else { + print(result.finalResult); + } + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } + @override Widget build(BuildContext context) { - ListSelectDialog drugDialog; final screenSize = MediaQuery.of(context).size; ProjectViewModel projectViewModel = Provider.of(context); - - // final routeArgs = ModalRoute.of(context).settings.arguments as Map; - // patient = routeArgs['patient']; - return BaseView( onModelReady: (model) async { x = model.patientAssessmentList.map((element) { @@ -208,22 +231,16 @@ class _PrescriptionFormWidgetState extends State { editedBy: '', doctorID: '', appointmentNo: widget.patient.appointmentNo); - //await model.getMedicationList(); if (model.medicationStrengthList.length == 0) { await model.getMedicationStrength(); } - //await model.getPrescription(mrn: widget.patient.patientMRN); if (model.medicationDurationList.length == 0) { await model.getMedicationDuration(); } - //await model.getMedicationRoute(); - //await model.getMedicationFrequency(); if (model.medicationDoseTimeList.length == 0) { await model.getMedicationDoseTime(); } - //await model.getMedicationIndications(); await model.getPatientAssessment(getAssessmentReqModel); - //await model.getItem(); }, builder: ( BuildContext context, @@ -240,44 +257,19 @@ class _PrescriptionFormWidgetState extends State { initialChildSize: 0.98, maxChildSize: 0.98, minChildSize: 0.9, - builder: - (BuildContext context, ScrollController scrollController) { + builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( child: Container( - height: MediaQuery.of(context).size.height * 1.45, + height: MediaQuery.of(context).size.height * 1.65, color: Color(0xffF8F8F8), child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 12.0, vertical: 10.0), + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ SizedBox( - height: 15, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context) - .newPrescriptionOrder, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ) - ], + height: 60, ), ], ), @@ -288,17 +280,13 @@ class _PrescriptionFormWidgetState extends State { child: Form( key: formKey, child: Column( - //mainAxisAlignment: MainAxisAlignment.end, children: [ FractionallySizedBox( widthFactor: 0.9, child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.all(10), child: AppTextFormField( onTap: () { @@ -306,8 +294,7 @@ class _PrescriptionFormWidgetState extends State { visbiltySearch = true; }, borderColor: Colors.white, - hintText: TranslationBase.of(context) - .searchMedicineNameHere, + hintText: TranslationBase.of(context).searchMedicineNameHere, controller: myController, onSaved: (value) {}, onFieldSubmitted: (value) { @@ -333,12 +320,9 @@ class _PrescriptionFormWidgetState extends State { children: [ // TODO change it secondary button and add loading AppButton( - title: TranslationBase.of( - context) - .search, + title: TranslationBase.of(context).search, onPressed: () async { - await searchMedicine( - context, model); + await searchMedicine(context, model); }, ), ], @@ -347,50 +331,23 @@ class _PrescriptionFormWidgetState extends State { ), if (myController.text != '') Container( - height: MediaQuery.of(context) - .size - .height * - 0.5, + height: MediaQuery.of(context).size.height * 0.5, child: ListView.builder( - padding: const EdgeInsets.only( - top: 20), - + padding: const EdgeInsets.only(top: 20), scrollDirection: Axis.vertical, - // shrinkWrap: true, - itemCount: - model.allMedicationList == - null - ? 0 - : model - .allMedicationList - .length, - itemBuilder: - (BuildContext context, - int index) { + itemCount: model.allMedicationList == null + ? 0 + : model.allMedicationList.length, + itemBuilder: (BuildContext context, int index) { return InkWell( child: MedicineItemWidget( - label: model - .allMedicationList[ - index] - .description - // url: model - // .pharmacyItemsList[ - // index]["ImageSRCUrl"], - ), + label: model.allMedicationList[index].description), onTap: () { - model.getItem( - itemID: model - .allMedicationList[ - index] - .itemId); - visbiltyPrescriptionForm = - true; + model.getItem(itemID: model.allMedicationList[index].itemId); + visbiltyPrescriptionForm = true; visbiltySearch = false; - _selectedMedication = - model.allMedicationList[ - index]; - uom = _selectedMedication - .uom; + _selectedMedication = model.allMedicationList[index]; + uom = _selectedMedication.uom; }, ); }, @@ -409,385 +366,134 @@ class _PrescriptionFormWidgetState extends State { child: Column( children: [ AppText( - _selectedMedication?.description ?? - "", + _selectedMedication?.description ?? "", bold: true, ), Container( child: Row( children: [ AppText( - TranslationBase.of(context) - .orderType, + TranslationBase.of(context).orderType, fontWeight: FontWeight.w600, ), Radio( - activeColor: - Color(0xFFB9382C), + activeColor: Color(0xFFB9382C), value: 1, groupValue: selectedType, onChanged: (value) { setSelectedType(value); }, ), - Text('Regular'), + Text(TranslationBase.of(context).regular), ], ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( - //height: screenSize.height * 0.062, - height: MediaQuery.of(context) - .size - .height * - 0.0749, width: double.infinity, child: Row( children: [ Container( - color: Colors.white, - width: MediaQuery.of(context) - .size - .width * - 0.35, - child: TextField( - decoration: - textFieldSelectorDecorationStreangrh( - strengthController - .text, - 'Strength', //strengthController.text, - false), - enabled: true, - controller: - strengthController, - onChanged: - (String value) { - setState(() { - strengthChar = - value.length; - }); - if (strengthChar >= 5) { - DrAppToastMsg - .showErrorToast( - TranslationBase.of( - context) - .only5DigitsAllowedForStrength, - ); - } - }, - keyboardType: TextInputType - .numberWithOptions( - decimal: true, - )), + width: MediaQuery.of(context).size.width * 0.35, + child: AppTextFieldCustom( + height: 40, + validationError: strengthError, + hintText: 'Strength', + isTextFieldHasSuffix: false, + enabled: true, + controller: strengthController, + onChanged: (String value) { + setState(() { + strengthChar = value.length; + }); + if (strengthChar >= 5) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).only5DigitsAllowedForStrength, + ); + } + }, + inputType: TextInputType.numberWithOptions( + decimal: true, + ), + ), ), SizedBox( width: 5.0, ), - Container( - // height: MediaQuery.of(context) - // .size - // .height * - // 0.06, - color: Colors.white, - width: MediaQuery.of(context) - .size - .width * - 0.560, - child: InkWell( - onTap: - model.itemMedicineListUnit != - null - ? () { - Helpers - .hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .itemMedicineListUnit, - attributeName: - 'description', - attributeValueId: - 'parameterCode', - okText: TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState( - () { - units = - selectedValue; - units['isDefault'] = - true; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: - context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - 'Select', - model.itemMedicineListUnit - .length == - 1 - ? units = model - .itemMedicineListUnit[0] - [ - 'description'] - : units != - null - ? units['description'] - .toString() - : null, - true), - enabled: false), - ), + PrescriptionTextFiled( + width: MediaQuery.of(context).size.width * 0.517, + element: units, + elementError: unitError, + keyName: 'description', + keyId: 'parameterCode', + hintText: 'Select', + elementList: model.itemMedicineListUnit, + okFunction: (selectedValue) { + setState(() { + units = selectedValue; + units['isDefault'] = true; + }); + }, ), ], ), ), - SizedBox( - height: spaceBetweenTextFileds), - Container( - height: screenSize.height * 0.070, - color: Colors.white, - child: InkWell( - onTap: - model.itemMedicineListRoute != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .itemMedicineListRoute, - attributeName: - 'description', - attributeValueId: - 'parameterCode', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - route = - selectedValue; - route['isDefault'] = - true; - }); - if (route == - null) { - Helpers.showErrorToast( - 'plase fill'); - } - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .route, - model.itemMedicineListRoute - .length == - 1 - ? model.itemMedicineListRoute[ - 0] - ['description'] - : route != null - ? route[ - 'description'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: spaceBetweenTextFileds), - Container( - height: screenSize.height * 0.070, - color: Colors.white, - child: InkWell( - onTap: - model.itemMedicineList != null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .itemMedicineList, - attributeName: - 'description', - attributeValueId: - 'parameterCode', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - frequency = - selectedValue; - frequency[ - 'isDefault'] = - true; - if (_selectedMedication != null && - duration != - null && - frequency != - null && - strengthController - .text != - null) { - model.getBoxQuantity( - freq: frequency[ - 'parameterCode'], - duration: - duration[ - 'id'], - itemCode: - _selectedMedication - .itemId, - strength: - double.parse( - strengthController.text)); - - return; - } - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .frequency, - model.itemMedicineList - .length == - 1 - ? model.itemMedicineList[ - 0] - ['description'] - : frequency != null - ? frequency[ - 'description'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: spaceBetweenTextFileds), - Container( - height: screenSize.height * 0.070, - color: Colors.white, - child: InkWell( - onTap: - model.medicationDoseTimeList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .medicationDoseTimeList, - attributeName: - 'nameEn', - attributeValueId: - 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - doseTime = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .doseTime, - doseTime != null - ? doseTime['nameEn'] - : null, - true), - enabled: false, - ), - ), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + elementList: model.itemMedicineListRoute, + element: route, + elementError: routeError, + keyId: 'parameterCode', + keyName: 'description', + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + route['isDefault'] = true; + }); + }, + hintText: TranslationBase.of(context).route, ), - SizedBox( - height: spaceBetweenTextFileds), - if (model - .patientAssessmentList.isNotEmpty) + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + hintText: TranslationBase.of(context).frequency, + elementError: frequencyError, + element: frequency, + elementList: model.itemMedicineList, + keyId: 'parameterCode', + keyName: 'description', + okFunction: (selectedValue) { + setState(() { + frequency = selectedValue; + frequency['isDefault'] = true; + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != null) { + model.getBoxQuantity( + freq: frequency['parameterCode'], + duration: duration['id'], + itemCode: _selectedMedication.itemId, + strength: double.parse(strengthController.text)); + + return; + } + }); + }), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + hintText: TranslationBase.of(context).doseTime, + elementError: doseTimeError, + element: doseTime, + elementList: model.medicationDoseTimeList, + keyId: 'id', + keyName: 'nameEn', + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }), + SizedBox(height: spaceBetweenTextFileds), + if (model.patientAssessmentList.isNotEmpty) Container( height: screenSize.height * 0.070, width: double.infinity, @@ -795,477 +501,289 @@ class _PrescriptionFormWidgetState extends State { child: Row( children: [ Container( - width: - MediaQuery.of(context) - .size - .width * - 0.29, - child: InkWell( - onTap: - indicationList != null - ? () { - Helpers.hideKeyboard( - context); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString(), - indication != - null - ? indication[ - 'name'] - : null, - false), - enabled: true, - readOnly: true, - ), + width: MediaQuery.of(context).size.width * 0.29, + child: TextField( + decoration: textFieldSelectorDecoration( + model.patientAssessmentList[0].icdCode10ID.toString(), + indication != null ? indication['name'] : null, + false), + enabled: true, + readOnly: true, ), ), Container( - width: - MediaQuery.of(context) - .size - .width * - 0.65, + width: MediaQuery.of(context).size.width * 0.59, color: Colors.white, - child: InkWell( - onTap: - indicationList != null - ? () { - Helpers.hideKeyboard( - context); - } - : null, - child: TextField( - maxLines: 5, - decoration: - textFieldSelectorDecoration( - model - .patientAssessmentList[ - 0] - .asciiDesc - .toString(), - indication != - null - ? indication[ - 'name'] - : null, - false), - enabled: true, - readOnly: true, - ), + child: TextField( + maxLines: 5, + decoration: textFieldSelectorDecoration( + model.patientAssessmentList[0].asciiDesc.toString(), + indication != null ? indication['name'] : null, + false), + enabled: true, + readOnly: true, ), ), ], ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( height: screenSize.height * 0.070, color: Colors.white, child: InkWell( - onTap: () => selectDate( - context, widget.model), + onTap: () => selectDate(context, widget.model), child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .date, - selectedDate != null - ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).date, + selectedDate != null + ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), enabled: false, ), ), ), - SizedBox( - height: spaceBetweenTextFileds), - Container( - height: screenSize.height * 0.070, - color: Colors.white, - child: InkWell( - onTap: - model.medicationDurationList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .medicationDurationList, - attributeName: - 'nameEn', - attributeValueId: - 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - duration = - selectedValue; - if (_selectedMedication != null && - duration != - null && - frequency != - null && - strengthController - .text != - null) { - model - .getBoxQuantity( - freq: frequency[ - 'parameterCode'], - duration: - duration[ - 'id'], - itemCode: - _selectedMedication - .itemId, - strength: double.parse( - strengthController - .text), - ); - box = model - .boxQuintity; + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + element: duration, + elementError: durationError, + hintText: TranslationBase.of(context).duration, + elementList: model.medicationDurationList, + keyName: 'nameEn', + keyId: 'id', + okFunction: (selectedValue) { + setState(() { + duration = selectedValue; + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != null) { + model.getBoxQuantity( + freq: frequency['parameterCode'], + duration: duration['id'], + itemCode: _selectedMedication.itemId, + strength: double.parse(strengthController.text), + ); + box = model.boxQuintity; - return; - } - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .duration, - duration != null - ? duration['nameEn'] - : null, - true), - enabled: false, - ), - ), + return; + } + }); + }, ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( - height: screenSize.height * 0.070, color: Colors.white, - child: InkWell( - onTap: model.allMedicationList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .allMedicationList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - duration = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - "UOM", - uom != null - ? uom - : null, - false), - //enabled: false, - readOnly: true, - ), + child: AppTextFieldCustom( + hintText: "UOM", + isTextFieldHasSuffix: false, + dropDownText: uom != null ? uom : null, + enabled: false, ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( - height: screenSize.height * 0.070, color: Colors.white, - child: InkWell( - onTap: model.allMedicationList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .allMedicationList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - duration = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of( - context) - .boxQuantity, - box != null - ? TranslationBase.of( - context) - .boxQuantity + - ": " + - model - .boxQuintity - .toString() - : null, - false), - //enabled: false, - readOnly: true, - ), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).boxQuantity, + isTextFieldHasSuffix: false, + dropDownText: box != null ? model.boxQuintity.toString() : null, + enabled: false, ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: - HexColor("#CCCCCC"))), - child: TextFields( - maxLines: 6, - minLines: 4, - hintText: - TranslationBase.of(context) - .instruction, - controller: instructionController, - //keyboardType: TextInputType.number, + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + child: Stack( + children: [ + TextFields( + maxLines: 6, + minLines: 4, + hintText: TranslationBase.of(context).instruction, + controller: instructionController, + //keyboardType: TextInputType.number, + ), + Positioned( + top: 0, + right: 15, + child: IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35, + ), + onPressed: () { + initSpeechState().then((value) => {onVoiceText()}); + }, + ), + ), + ], ), ), - SizedBox( - height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), child: Wrap( alignment: WrapAlignment.center, children: [ AppButton( color: Color(0xff359846), - title: TranslationBase.of( - context) - .addMedication, + title: TranslationBase.of(context).addMedication, fontWeight: FontWeight.w600, - onPressed: () { - formKey.currentState.save(); - // Navigator.pop(context); - // openDrugToDrug(); - if (frequency == null || - strengthController - .text == - "" || - doseTime == null || - duration == null || - selectedDate == null) { - DrAppToastMsg.showErrorToast( - TranslationBase.of( - context) - .pleaseFillAllFields); - return; - } - if (_selectedMedication - .isNarcotic == - true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of( - context) - .narcoticMedicineCanOnlyBePrescribedFromVida); - Navigator.pop(context); - return; - } + onPressed: () async { + if (route != null && + duration != null && + doseTime != null && + frequency != null && + units != null && + selectedDate != null && + strengthController.text != "") { + if (_selectedMedication.isNarcotic == true) { + DrAppToastMsg.showErrorToast(TranslationBase.of(context) + .narcoticMedicineCanOnlyBePrescribedFromVida); + Navigator.pop(context); + return; + } - if (double.parse( - strengthController - .text) > - 1000.0) { - DrAppToastMsg.showErrorToast( - "1000 is the MAX for the strength"); - return; - } - if (double.parse( - strengthController - .text) < - 0.0) { - DrAppToastMsg.showErrorToast( - "strength can't be zero"); - return; - } + if (double.parse(strengthController.text) > 1000.0) { + DrAppToastMsg.showErrorToast( + "1000 is the MAX for the strength"); + return; + } + if (double.parse(strengthController.text) < 0.0) { + DrAppToastMsg.showErrorToast("strength can't be zero"); + return; + } - if (formKey.currentState - .validate()) { - Navigator.pop(context); - openDrugToDrug(model); - { - // postProcedure( - // icdCode: model - // .patientAssessmentList - // .isNotEmpty - // ? model - // .patientAssessmentList[ - // 0] - // .icdCode10ID - // .isEmpty - // ? "test" - // : model - // .patientAssessmentList[ - // 0] - // .icdCode10ID - // .toString() - // : "test", - // // icdCode: model - // // .patientAssessmentList - // // .map((value) => value - // // .icdCode10ID - // // .trim()) - // // .toList() - // // .join(' '), - // dose: strengthController - // .text, - // doseUnit: model - // .itemMedicineListUnit - // .length == - // 1 - // ? model - // .itemMedicineListUnit[ - // 0][ - // 'parameterCode'] - // .toString() - // : units['parameterCode'] - // .toString(), - // patient: widget.patient, - // doseTimeIn: - // doseTime['id'] - // .toString(), - // model: widget.model, - // duration: duration['id'] - // .toString(), - // frequency: model - // .itemMedicineList - // .length == - // 1 - // ? model - // .itemMedicineList[ - // 0][ - // 'parameterCode'] - // .toString() - // : frequency[ - // 'parameterCode'] - // .toString(), - // route: model.itemMedicineListRoute - // .length == - // 1 - // ? model - // .itemMedicineListRoute[ - // 0][ - // 'parameterCode'] - // .toString() - // : route['parameterCode'] - // .toString(), - // drugId: - // _selectedMedication - // .itemId - // .toString(), - // strength: - // strengthController - // .text, - // indication: - // indicationController - // .text, - // instruction: - // instructionController - // .text, - // doseTime: selectedDate, - // ); + if (formKey.currentState.validate()) { + Navigator.pop(context); + openDrugToDrug(model); + { + // postProcedure( + // icdCode: model + // .patientAssessmentList + // .isNotEmpty + // ? model + // .patientAssessmentList[ + // 0] + // .icdCode10ID + // .isEmpty + // ? "test" + // : model + // .patientAssessmentList[ + // 0] + // .icdCode10ID + // .toString() + // : "test", + // // icdCode: model + // // .patientAssessmentList + // // .map((value) => value + // // .icdCode10ID + // // .trim()) + // // .toList() + // // .join(' '), + // dose: strengthController + // .text, + // doseUnit: model + // .itemMedicineListUnit + // .length == + // 1 + // ? model + // .itemMedicineListUnit[ + // 0][ + // 'parameterCode'] + // .toString() + // : units['parameterCode'] + // .toString(), + // patient: widget.patient, + // doseTimeIn: + // doseTime['id'] + // .toString(), + // model: widget.model, + // duration: duration['id'] + // .toString(), + // frequency: model + // .itemMedicineList + // .length == + // 1 + // ? model + // .itemMedicineList[ + // 0][ + // 'parameterCode'] + // .toString() + // : frequency[ + // 'parameterCode'] + // .toString(), + // route: model.itemMedicineListRoute + // .length == + // 1 + // ? model + // .itemMedicineListRoute[ + // 0][ + // 'parameterCode'] + // .toString() + // : route['parameterCode'] + // .toString(), + // drugId: + // _selectedMedication + // .itemId + // .toString(), + // strength: + // strengthController + // .text, + // indication: + // indicationController + // .text, + // instruction: + // instructionController + // .text, + // doseTime: selectedDate, + // ); + } } + } else { + setState(() { + if (duration == null) { + durationError = TranslationBase.of(context).fieldRequired; + } else { + durationError = null; + } + if (doseTime == null) { + doseTimeError = TranslationBase.of(context).fieldRequired; + } else { + doseTimeError = null; + } + if (route == null) { + routeError = TranslationBase.of(context).fieldRequired; + } else { + routeError = null; + } + if (frequency == null) { + frequencyError = TranslationBase.of(context).fieldRequired; + } else { + frequencyError = null; + } + if (units == null) { + unitError = TranslationBase.of(context).fieldRequired; + } else { + unitError = null; + } + if (strengthController.text == "") { + strengthError = TranslationBase.of(context).fieldRequired; + } else { + strengthError = null; + } + }); } - { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // NewPrescriptionScreen()), - // ); - } + formKey.currentState.save(); }, ), ], @@ -1308,8 +826,7 @@ class _PrescriptionFormWidgetState extends State { } } - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, + InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {Icon suffixIcon}) { return InputDecoration( focusedBorder: OutlineInputBorder( @@ -1349,48 +866,6 @@ class _PrescriptionFormWidgetState extends State { ); } - InputDecoration textFieldSelectorDecorationStreangrh( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.keyboard_arrow_down_sharp, - color: Color(0xff2E303A), - ) - : null, - hintStyle: TextStyle( - fontSize: 13, - color: Color(0xff2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - ), - hintText: selectedText == null || selectedText == "" ? hintText : null, - labelText: - selectedText != null && selectedText != "" ? '\n$selectedText' : null, - labelStyle: TextStyle( - fontSize: 15, - color: Color(0xff2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - ), - ); - } - openDrugToDrug(model) { showModalBottomSheet( context: context, @@ -1402,9 +877,7 @@ class _PrescriptionFormWidgetState extends State { child: Column( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - DrugToDrug( - widget.patient, - getPriscriptionforDrug(widget.prescriptionList, model), + DrugToDrug(widget.patient, getPriscriptionforDrug(widget.prescriptionList, model), model.patientAssessmentList), Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3), @@ -1413,21 +886,12 @@ class _PrescriptionFormWidgetState extends State { onPressed: () { Navigator.pop(context); - postProcedure( + postPrescription( icdCode: model.patientAssessmentList.isNotEmpty - ? model.patientAssessmentList[0].icdCode10ID - .isEmpty + ? model.patientAssessmentList[0].icdCode10ID.isEmpty ? "test" - : model.patientAssessmentList[0].icdCode10ID - .toString() + : model.patientAssessmentList[0].icdCode10ID.toString() : "test", - // icdCode: model - // .patientAssessmentList - // .map((value) => value - // .icdCode10ID - // .trim()) - // .toList() - // .join(' '), dose: strengthController.text, doseUnit: model.itemMedicineListUnit.length == 1 ? model.itemMedicineListUnit[0]['parameterCode'].toString() @@ -1448,36 +912,6 @@ class _PrescriptionFormWidgetState extends State { instruction: instructionController.text, doseTime: selectedDate, ); - - // postProcedure( - // icdCode: model.patientAssessmentList.isNotEmpty - // ? model.patientAssessmentList[0].icdCode10ID - // .isEmpty - // ? "test" - // : model.patientAssessmentList[0].icdCode10ID - // .toString() - // : "test", - // // icdCode: model - // // .patientAssessmentList - // // .map((value) => value - // // .icdCode10ID - // // .trim()) - // // .toList() - // // .join(' '), - // dose: strengthController.text, - // doseUnit: units['parameterCode'].toString(), - // patient: widget.patient, - // doseTimeIn: doseTime['id'].toString(), - // model: widget.model, - // duration: duration['id'].toString(), - // frequency: frequency['parameterCode'].toString(), - // route: route['parameterCode'].toString(), - // drugId: _selectedMedication.itemId.toString(), - // strength: strengthController.text, - // indication: indicationController.text, - // instruction: instructionController.text, - // doseTime: selectedDate, - // ); }, )) ], @@ -1489,17 +923,7 @@ class _PrescriptionFormWidgetState extends State { }); } - // selectedValue(itemMdeicationList,key){ - // // String selected = ""; - // // units[key]=itemMdeicationList.length==1? itemMdeicationList[0][key]:units[key].toString(); - // // - // // selected = units[key]; - // // - // // return selected; - // // } - - getPriscriptionforDrug( - List prescriptionList, MedicineViewModel model) { + getPriscriptionforDrug(List prescriptionList, MedicineViewModel model) { var prescriptionDetails = []; if (prescriptionList.length > 0) { prescriptionList[0].entityList.forEach((element) { @@ -1544,19 +968,10 @@ class _PrescriptionFormWidgetState extends State { searchMedicine(context, MedicineViewModel model) async { FocusScope.of(context).unfocus(); - // if (myController.text.isEmpty()) { - // Helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); - // //"Type Medicine Name") - // return; - // } if (myController.text.length < 3) { Helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); return; } - - //GifLoaderDialogUtils.showMyDialog(context); - await model.getMedicationList(drug: myController.text); - //GifLoaderDialogUtils.hideDialog(context); } } diff --git a/lib/screens/prescription/prescription_checkout_screen.dart b/lib/screens/prescription/prescription_checkout_screen.dart new file mode 100644 index 00000000..cac2f99a --- /dev/null +++ b/lib/screens/prescription/prescription_checkout_screen.dart @@ -0,0 +1,746 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; + +class PrescriptionCheckOutScreen extends StatefulWidget { + final PrescriptionViewModel model; + final PatiantInformtion patient; + final List prescriptionList; + final ProcedureTempleteDetailsModel groupProcedures; + + const PrescriptionCheckOutScreen({Key key, this.model, this.patient, this.prescriptionList, this.groupProcedures}) + : super(key: key); + + @override + _PrescriptionCheckOutScreenState createState() => _PrescriptionCheckOutScreenState(); +} + +class _PrescriptionCheckOutScreenState extends State { + postPrescription( + {String duration, + String doseTimeIn, + String dose, + String drugId, + String strength, + String route, + String frequency, + String indication, + String instruction, + PrescriptionViewModel model, + DateTime doseTime, + String doseUnit, + String icdCode, + PatiantInformtion patient, + String patientType}) async { + PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); + List prescriptionList = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + postProcedureReqModel.clinicID = patient.clinicId; + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + + prescriptionList.add(PrescriptionRequestModel( + covered: true, + dose: double.parse(dose), + itemId: drugId.isEmpty ? 1 : int.parse(drugId), + doseUnitId: int.parse(doseUnit), + route: route.isEmpty ? 1 : int.parse(route), + frequency: frequency.isEmpty ? 1 : int.parse(frequency), + remarks: instruction, + approvalRequired: true, + icdcode10Id: icdCode.toString(), + doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn), + duration: duration.isEmpty ? 1 : int.parse(duration), + doseStartDate: doseTime.toIso8601String())); + postProcedureReqModel.prescriptionRequestModel = prescriptionList; + await model.postPrescription(postProcedureReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); + } else if (model.state == ViewState.Idle) { + model.getPrescriptions(patient); + DrAppToastMsg.showSuccesToast('Medication has been added'); + } + } + + String routeError; + String frequencyError; + String doseTimeError; + String durationError; + String unitError; + String strengthError; + + int selectedType; + + TextEditingController strengthController = TextEditingController(); + TextEditingController indicationController = TextEditingController(); + TextEditingController instructionController = TextEditingController(); + + bool visbiltyPrescriptionForm = true; + bool visbiltySearch = true; + + final myController = TextEditingController(); + DateTime selectedDate; + int strengthChar; + GetMedicationResponseModel _selectedMedication; + GlobalKey key = new GlobalKey>(); + + TextEditingController drugIdController = TextEditingController(); + TextEditingController doseController = TextEditingController(); + final searchController = TextEditingController(); + stt.SpeechToText speech = stt.SpeechToText(); + var event = RobotProvider(); + var reconizedWord; + + final GlobalKey formKey = GlobalKey(); + final double spaceBetweenTextFileds = 12; + dynamic route; + dynamic frequency; + dynamic duration; + dynamic doseTime; + dynamic indication; + dynamic units; + dynamic uom; + dynamic box; + dynamic x; + + @override + void initState() { + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); + selectedType = 1; + super.initState(); + } + + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + print(error); + } + + void statusListener(String status) { + reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + void resultListener(result) { + reconizedWord = result.recognizedWords; + event.setValue({"searchText": reconizedWord}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speech.stop(); + instructionController.text += reconizedWord + '\n'; + }); + } else { + print(result.finalResult); + } + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( + onModelReady: (model) async { + model.getItem(itemID: int.parse(widget.groupProcedures.aliasN.replaceAll("item code ;", ""))); + + x = model.patientAssessmentList.map((element) { + return element.icdCode10ID; + }); + GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( + patientMRN: widget.patient.patientMRN, + episodeID: widget.patient.episodeNo.toString(), + editedBy: '', + doctorID: '', + appointmentNo: widget.patient.appointmentNo); + if (model.medicationStrengthList.length == 0) { + await model.getMedicationStrength(); + } + if (model.medicationDurationList.length == 0) { + await model.getMedicationDuration(); + } + if (model.medicationDoseTimeList.length == 0) { + await model.getMedicationDoseTime(); + } + await model.getPatientAssessment(getAssessmentReqModel); + }, + builder: ( + BuildContext context, + MedicineViewModel model, + Widget child, + ) => + AppScaffold( + backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), + isShowAppBar: false, + body: NetworkBaseView( + baseViewModel: model, + child: GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.35, + color: Color(0xffF8F8F8), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), + child: Column( + children: [ + Column( + children: [ + SizedBox( + height: 60, + ), + Row( + //mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Icon( + Icons.arrow_back_ios, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ), + SizedBox( + width: 7.0, + ), + AppText( + TranslationBase.of(context).newPrescriptionOrder, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ], + ), + ], + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Form( + key: formKey, + child: Column( + children: [ + Container( + child: Column( + children: [ + SizedBox( + height: 14.5, + ), + ], + ), + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Visibility( + visible: visbiltyPrescriptionForm, + child: Container( + child: Column( + children: [ + AppText( + widget.groupProcedures.procedureName ?? "", + bold: true, + ), + Container( + child: Row( + children: [ + AppText( + TranslationBase.of(context).orderType, + fontWeight: FontWeight.w600, + ), + Radio( + activeColor: Color(0xFFB9382C), + value: 1, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).regular), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + width: double.infinity, + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: AppTextFieldCustom( + height: 40, + validationError: strengthError, + hintText: 'Strength', + isTextFieldHasSuffix: false, + enabled: true, + controller: strengthController, + onChanged: (String value) { + setState(() { + strengthChar = value.length; + }); + if (strengthChar >= 5) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).only5DigitsAllowedForStrength, + ); + } + }, + inputType: TextInputType.numberWithOptions( + decimal: true, + ), + ), + ), + SizedBox( + width: 5.0, + ), + PrescriptionTextFiled( + width: MediaQuery.of(context).size.width * 0.560, + element: units, + elementError: unitError, + keyName: 'description', + keyId: 'parameterCode', + hintText: 'Select', + elementList: model.itemMedicineListUnit, + okFunction: (selectedValue) { + setState(() { + units = selectedValue; + units['isDefault'] = true; + }); + }, + ), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + elementList: model.itemMedicineListRoute, + element: route, + elementError: routeError, + keyId: 'parameterCode', + keyName: 'description', + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + route['isDefault'] = true; + }); + }, + hintText: TranslationBase.of(context).route, + ), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + hintText: TranslationBase.of(context).frequency, + elementError: frequencyError, + element: frequency, + elementList: model.itemMedicineList, + keyId: 'parameterCode', + keyName: 'description', + okFunction: (selectedValue) { + setState(() { + frequency = selectedValue; + frequency['isDefault'] = true; + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != null) { + model.getBoxQuantity( + freq: frequency['parameterCode'], + duration: duration['id'], + itemCode: _selectedMedication.itemId, + strength: double.parse(strengthController.text)); + + return; + } + }); + }), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + hintText: TranslationBase.of(context).doseTime, + elementError: doseTimeError, + element: doseTime, + elementList: model.medicationDoseTimeList, + keyId: 'id', + keyName: 'nameEn', + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }), + SizedBox(height: spaceBetweenTextFileds), + if (model.patientAssessmentList.isNotEmpty) + Container( + height: screenSize.height * 0.070, + width: double.infinity, + color: Colors.white, + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.29, + child: TextField( + decoration: textFieldSelectorDecoration( + model.patientAssessmentList[0].icdCode10ID.toString(), + indication != null ? indication['name'] : null, + false), + enabled: true, + readOnly: true, + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.65, + color: Colors.white, + child: TextField( + maxLines: 5, + decoration: textFieldSelectorDecoration( + model.patientAssessmentList[0].asciiDesc.toString(), + indication != null ? indication['name'] : null, + false), + enabled: true, + readOnly: true, + ), + ), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + height: screenSize.height * 0.070, + color: Colors.white, + child: InkWell( + onTap: () => selectDate(context, widget.model), + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).date, + selectedDate != null + ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox(height: spaceBetweenTextFileds), + PrescriptionTextFiled( + element: duration, + elementError: durationError, + hintText: TranslationBase.of(context).duration, + elementList: model.medicationDurationList, + keyName: 'nameEn', + keyId: 'id', + okFunction: (selectedValue) { + setState(() { + duration = selectedValue; + if (_selectedMedication != null && + duration != null && + frequency != null && + strengthController.text != null) { + model.getBoxQuantity( + freq: frequency['parameterCode'], + duration: duration['id'], + itemCode: _selectedMedication.itemId, + strength: double.parse(strengthController.text), + ); + box = model.boxQuintity; + + return; + } + }); + }, + ), + SizedBox(height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + child: Stack( + children: [ + TextFields( + maxLines: 6, + minLines: 4, + hintText: TranslationBase.of(context).instruction, + controller: instructionController, + //keyboardType: TextInputType.number, + ), + Positioned( + top: 0, + right: 15, + child: IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35, + ), + onPressed: () { + initSpeechState().then((value) => {onVoiceText()}); + }, + ), + ), + ], + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + color: Color(0xff359846), + title: TranslationBase.of(context).addMedication, + fontWeight: FontWeight.w600, + onPressed: () async { + if (route != null && + duration != null && + doseTime != null && + frequency != null && + units != null && + selectedDate != null && + strengthController.text != "") { + // if (_selectedMedication.isNarcotic == true) { + // DrAppToastMsg.showErrorToast(TranslationBase.of(context) + // .narcoticMedicineCanOnlyBePrescribedFromVida); + // Navigator.pop(context); + // return; + // } + + if (double.parse(strengthController.text) > 1000.0) { + DrAppToastMsg.showErrorToast("1000 is the MAX for the strength"); + return; + } + if (double.parse(strengthController.text) < 0.0) { + DrAppToastMsg.showErrorToast("strength can't be zero"); + return; + } + + if (formKey.currentState.validate()) { + Navigator.pop(context); + // openDrugToDrug(model); + { + postPrescription( + icdCode: model.patientAssessmentList.isNotEmpty + ? model.patientAssessmentList[0].icdCode10ID.isEmpty + ? "test" + : model.patientAssessmentList[0].icdCode10ID.toString() + : "test", + // icdCode: model + // .patientAssessmentList + // .map((value) => value + // .icdCode10ID + // .trim()) + // .toList() + // .join(' '), + dose: strengthController.text, + doseUnit: model.itemMedicineListUnit.length == 1 + ? model.itemMedicineListUnit[0]['parameterCode'].toString() + : units['parameterCode'].toString(), + patient: widget.patient, + doseTimeIn: doseTime['id'].toString(), + model: widget.model, + duration: duration['id'].toString(), + frequency: model.itemMedicineList.length == 1 + ? model.itemMedicineList[0]['parameterCode'].toString() + : frequency['parameterCode'].toString(), + route: model.itemMedicineListRoute.length == 1 + ? model.itemMedicineListRoute[0]['parameterCode'].toString() + : route['parameterCode'].toString(), + drugId: (widget.groupProcedures.aliasN + .replaceAll("item code ;", "")), + strength: strengthController.text, + indication: indicationController.text, + instruction: instructionController.text, + doseTime: selectedDate, + ); + } + } + } else { + setState(() { + if (duration == null) { + durationError = TranslationBase.of(context).fieldRequired; + } else { + durationError = null; + } + if (doseTime == null) { + doseTimeError = TranslationBase.of(context).fieldRequired; + } else { + doseTimeError = null; + } + if (route == null) { + routeError = TranslationBase.of(context).fieldRequired; + } else { + routeError = null; + } + if (frequency == null) { + frequencyError = TranslationBase.of(context).fieldRequired; + } else { + frequencyError = null; + } + if (units == null) { + unitError = TranslationBase.of(context).fieldRequired; + } else { + unitError = null; + } + if (strengthController.text == "") { + strengthError = TranslationBase.of(context).fieldRequired; + } else { + strengthError = null; + } + }); + } + + formKey.currentState.save(); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + ), + ), + ), + ); + } + + selectDate(BuildContext context, PrescriptionViewModel model) async { + Helpers.hideKeyboard(context); + DateTime selectedDate; + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + this.selectedDate = picked; + }); + } + } + + InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + : null, + hintStyle: TextStyle( + fontSize: 13, + color: Color(0xff2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), + labelText: selectedText != null ? '$hintText\n$selectedText' : null, + labelStyle: TextStyle( + fontSize: 13, + color: Color(0xff2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), + ); + } +} diff --git a/lib/screens/prescription/prescription_item_in_patient_page.dart b/lib/screens/prescription/prescription_item_in_patient_page.dart index 4828608a..7cf33935 100644 --- a/lib/screens/prescription/prescription_item_in_patient_page.dart +++ b/lib/screens/prescription/prescription_item_in_patient_page.dart @@ -5,7 +5,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -44,166 +44,12 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { isShowAppBar: true, backgroundColor: Colors.grey[100], baseViewModel: model, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patient.patientType.toString(), patient.arrivedOn), + appBar: PatientProfileAppBar( + patient), body: SingleChildScrollView( child: Container( child: Column( children: [ - // if (!prescriptions.isInOutPatient) - // ...List.generate( - // model.prescriptionReportList.length, - // (index) => Container( - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(12), - // color: Colors.white, - // ), - // margin: EdgeInsets.all(12), - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // margin: - // EdgeInsets.only(left: 18, right: 18), - // child: AppText( - // model.prescriptionReportList[index] - // .itemDescription.isNotEmpty - // ? model - // .prescriptionReportList[index] - // .itemDescription - // : model - // .prescriptionReportList[index] - // .itemDescriptionN, - // bold: true, - // )), - // SizedBox( - // height: 12, - // ), - // Row( - // children: [ - // SizedBox( - // width: 18, - // ), - // Container( - // decoration: BoxDecoration( - // shape: BoxShape.circle, - // border: Border.all( - // width: 0.5, - // color: Colors.grey)), - // height: 55, - // width: 55, - // child: InkWell( - // onTap: () { - // showDialog( - // context: context, - // child: ShowImageDialog( - // imageUrl: model - // .prescriptionReportEnhList[ - // index] - // .imageSRCUrl, - // )); - // }, - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // child: Image.network( - // model - // .prescriptionReportList[index] - // .imageSRCUrl, - // fit: BoxFit.cover, - // ), - // ), - // ), - // ), - // SizedBox( - // width: 10, - // ), - // Expanded( - // child: Column( - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .route, - // color: Colors.grey, - // ), - // Expanded( - // child: AppText(" " + - // model - // .prescriptionReportList[ - // index] - // .routeN)), - // ], - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .frequency, - // color: Colors.grey, - // ), - // AppText(" " + - // model - // .prescriptionReportList[ - // index] - // .frequencyN ?? - // ''), - // ], - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .dailyDoses, - // color: Colors.grey, - // ), - // AppText(" " + - // model - // .prescriptionReportList[ - // index] - // .doseDailyQuantity ?? - // ''), - // ], - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .duration, - // color: Colors.grey, - // ), - // AppText(" " + - // model - // .prescriptionReportList[ - // index] - // .days - // .toString() ?? - // ''), - // ], - // ), - // SizedBox( - // height: 12, - // ), - // AppText(model - // .prescriptionReportList[ - // index] - // .remarks ?? - // ''), - // ], - // ), - // ) - // ], - // ) - // ], - // ), - // ), - // )) - // else - Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), @@ -233,34 +79,6 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { SizedBox( width: 18, ), - // Container( - // decoration: BoxDecoration( - // shape: BoxShape.circle, - // border: Border.all( - // width: 0.5, color: Colors.grey)), - // height: 55, - // width: 55, - // child: InkWell( - // onTap: () { - // showDialog( - // context: context, - // // child: ShowImageDialog( - // // imageUrl: model - // // .inPatientPrescription[index] - // // .imageSRCUrl, - // // ), - // ); - // }, - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // // child: Image.network( - // // model.prescriptionReportEnhList[index] - // // .imageSRCUrl, - // // fit: BoxFit.cover, - // // ), - // ), - // ), - // ), SizedBox( width: 10, ), diff --git a/lib/screens/prescription/prescription_items_page.dart b/lib/screens/prescription/prescription_items_page.dart index 8051beae..b97343c4 100644 --- a/lib/screens/prescription/prescription_items_page.dart +++ b/lib/screens/prescription/prescription_items_page.dart @@ -4,10 +4,11 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/ShowImageDialog.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -27,16 +28,15 @@ class PrescriptionItemsPage extends StatelessWidget { isShowAppBar: true, backgroundColor: Colors.grey[100], baseViewModel: model, - appBar: PatientProfileHeaderWhitAppointmentAppBar( - patient: patient, - patientType: patientType??"0", - arrivalType: arrivalType??"0", + appBar: PatientProfileAppBar( + patient, clinic: prescriptions.clinicDescription, branch: prescriptions.name, isPrescriptions: true, appointmentDate: AppDateUtils.getDateTimeFromServerFormat(prescriptions.appointmentDate), doctorName: prescriptions.doctorName, profileUrl: prescriptions.doctorImageURL, + isAppointmentHeader: true, ), body: SingleChildScrollView( child: Container( @@ -169,13 +169,21 @@ class PrescriptionItemsPage extends StatelessWidget { ) ); }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.network( + model.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, - ), + ), + ), + Positioned( + top: 10, + right: 10, + child: Icon(EvaIcons.search,color: Colors.grey,size: 35,)) + ], ), ), ), diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart deleted file mode 100644 index 6608f108..00000000 --- a/lib/screens/prescription/prescription_screen.dart +++ /dev/null @@ -1,745 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; -import 'package:doctor_app_flutter/screens/prescription/update_prescription_form.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:flutter/material.dart'; - -class NewPrescriptionScreen extends StatefulWidget { - @override - _NewPrescriptionScreenState createState() => _NewPrescriptionScreenState(); -} - -class _NewPrescriptionScreenState extends State { - PersistentBottomSheetController _controller; - final _scaffoldKey = GlobalKey(); - TextEditingController strengthController = TextEditingController(); - int testNum = 0; - int strengthChar; - PatiantInformtion patient; - - @override - void initState() { - super.initState(); - } - - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - patient = routeArgs['patient']; - return BaseView( - onModelReady: (model) => model.getPrescription(mrn: patient.patientId), - builder: - (BuildContext context, PrescriptionViewModel model, Widget child) => - AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).prescription, - body: NetworkBaseView( - baseViewModel: model, - child: SingleChildScrollView( - child: Container( - color: Colors.white, - child: Column( - children: [ - PatientPageHeaderWidget(patient), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey, - ), - (model.prescriptionList.length != 0) - ? SizedBox( - height: - model.prescriptionList[0].rowcount == 0 - ? 200.0 - : 10.0) - : SizedBox(height: 200.0), - //model.prescriptionList == null - (model.prescriptionList.length != 0) - ? model.prescriptionList[0].rowcount == 0 - ? Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - InkWell( - onTap: () { - addPrescriptionForm( - context, - model, - patient, - model.prescriptionList); - //model.postPrescription(); - }, - child: CircleAvatar( - radius: 65, - backgroundColor: - Color(0XFFB8382C), - child: CircleAvatar( - radius: 60, - backgroundColor: Colors.white, - child: Icon( - Icons.add, - color: Colors.black, - size: 45.0, - ), - ), - ), - ), - SizedBox( - height: 15.0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context) - .noPrescriptionListed, - color: Colors.black, - fontWeight: FontWeight.w900, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context) - .addNow, - color: Color(0XFFB8382C), - fontWeight: FontWeight.w900, - ), - ], - ), - ], - ) - : Padding( - padding: EdgeInsets.all(14.0), - child: NetworkBaseView( - baseViewModel: model, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - InkWell( - child: Container( - height: 50.0, - width: 450.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey), - borderRadius: - BorderRadius.circular( - 10.0), - ), - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - AppText( - ' Add more medication', - fontWeight: - FontWeight.w100, - fontSize: 12.5, - ), - Icon( - Icons.add, - color: - Color(0XFFB8382C), - ) - ], - ), - ), - ), - onTap: () { - addPrescriptionForm( - context, - model, - patient, - model.prescriptionList); - //model.postPrescription(); - }, - ), - SizedBox( - height: 10.0, - ), - ...List.generate( - model.prescriptionList[0] - .rowcount, - (index) => Container( - color: Colors.white, - child: Column( - children: [ - SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.022, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - // crossAxisAlignment: - // CrossAxisAlignment.start, - children: [ - Container( - color: Colors.white, - height: MediaQuery.of( - context) - .size - .height * - 0.21, - width: MediaQuery.of( - context) - .size - .width * - 0.1, - child: Column( - children: [ - AppText( - (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != - null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) - .toString() - : DateTime.now() - .year) - .toString(), - color: Colors - .green, - fontSize: - 13.5, - ), - AppText( - AppDateUtils.getMonth(model.prescriptionList[0].entityList[index].createdOn != - null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) - .month) - : DateTime.now() - .month) - .toUpperCase(), - color: Colors - .green, - ), - AppText( - DateTime.parse(model - .prescriptionList[ - 0] - .entityList[ - index] - .createdOn) - .day - .toString(), - color: Colors - .green, - ), - AppText( - AppDateUtils.getTimeFormated(DateTime.parse(model - .prescriptionList[ - 0] - .entityList[ - index] - .createdOn)) - .toString(), - color: Colors - .green, - ), - ], - ), - ), - Container( - color: Colors.white, - // height: MediaQuery.of( - // context) - // .size - // .height * - // 0.3499, - width: MediaQuery.of( - context) - .size - .width * - 0.77, - child: Column( - children: [ - Row( - children: [ - AppText( - 'Start Date:', - fontWeight: - FontWeight - .w700, - fontSize: - 14.0, - ), - Expanded( - child: - AppText( - AppDateUtils.getDateFormatted(DateTime.parse(model - .prescriptionList[0] - .entityList[index] - .startDate)), - fontSize: - 13.5, - ), - ), - SizedBox( - width: - 6.0, - ), - AppText( - 'Order Type:', - fontWeight: - FontWeight - .w700, - fontSize: - 14.0, - ), - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .orderTypeDescription, - fontSize: - 13.0, - ), - ), - ], - ), - SizedBox( - height: 5.5, - ), - Row( - children: [ - Container( - color: Colors - .white, - child: - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .medicationName, - fontWeight: - FontWeight.w700, - fontSize: - 15.0, - ), - ), - ) - ], - ), - SizedBox( - height: 5.5, - ), - Row( - children: [ - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .doseDetail, - fontSize: - 15.0, - ), - ) - ], - ), - SizedBox( - height: 10.0, - ), - Row( - children: [ - AppText( - 'Indication: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].indication), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'UOM: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].uom), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'BOX Quantity: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].quantity.toString() == null ? "" : model.prescriptionList[0].entityList[index].quantity.toString()), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'pharmacy Intervention ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].pharmacyInervention == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), - ), - ), - ], - ), - SizedBox( - height: - 5.0), - Row( - children: [ - AppText( - 'pharmacist Remarks : ', - fontWeight: - FontWeight - .w700, - fontSize: - 15.0, - ), - Expanded( - child: AppText( - // commening below code because there is an error coming in the model please fix it before pushing it - model.prescriptionList[0].entityList[index].pharmacistRemarks == null ? "" : model.prescriptionList[0].entityList[index].pharmacistRemarks, - fontSize: 15.0), - ) - ], - ), - SizedBox( - height: 20.0, - ), - Row( - children: [ - AppText( - TranslationBase.of(context) - .doctorName + - ": ", - fontWeight: - FontWeight - .w600, - ), - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .doctorName, - fontWeight: - FontWeight.w700, - ), - ) - ], - ), - SizedBox( - height: 8.0, - ), - Row( - children: [ - AppText( - 'Doctor Remarks : ', - fontWeight: - FontWeight - .w700, - fontSize: - 13.0, - ), - Expanded( - child: - Container( - color: Colors - .white, - // height: MediaQuery.of(context).size.height * - // 0.038, - child: - RichText( - // maxLines: - // 2, - // overflow: - // TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 10.0), - text: - TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].remarks != null - ? model.prescriptionList[0].entityList[index].remarks - : "", - ), - ), - ), - ), - ], - ), - SizedBox( - height: 10.0, - ), - - // SizedBox( - // height: 40, - // ), - ], - ), - ), - Container( - color: Colors.white, - height: MediaQuery.of( - context) - .size - .height * - 0.16, - width: MediaQuery.of( - context) - .size - .width * - 0.06, - child: Column( - children: [ - InkWell( - child: Icon( - Icons - .edit), - onTap: () { - updatePrescriptionForm( - box: model - .prescriptionList[ - 0] - .entityList[ - index] - .quantity, - uom: model - .prescriptionList[ - 0] - .entityList[ - index] - .uom, - drugNameGeneric: model - .prescriptionList[ - 0] - .entityList[ - index] - .medicationName, - doseUnit: model.prescriptionList[0].entityList[index].doseDailyUnitID - .toString(), - doseStreangth: model.prescriptionList[0].entityList[index].doseDailyQuantity - .toString(), - duration: - model.prescriptionList[0].entityList[index].doseDurationDays - .toString(), - startDate: - model.prescriptionList[0].entityList[index].startDate - .toString(), - dose: model - .prescriptionList[ - 0] - .entityList[ - index] - .doseTimingID - .toString(), - frequency: - model.prescriptionList[0].entityList[index].frequencyID - .toString(), - rouat: model - .prescriptionList[0] - .entityList[index] - .routeID - .toString(), - patient: patient, - drugId: model.prescriptionList[0].entityList[index].medicineCode, - drugName: model.prescriptionList[0].entityList[index].medicationName, - remarks: model.prescriptionList[0].entityList[index].remarks, - model: model, - enteredRemarks: model.prescriptionList[0].entityList[index].remarks, - context: context); - //model.postPrescription(); - }, - ), - ], - ), - ), - ], - ), - Divider( - height: 0, - thickness: 1.0, - color: Colors.grey, - ), - ], - ), - ), - ), - ], - ), - ), - ) - : Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - InkWell( - onTap: () { - addPrescriptionForm(context, model, - patient, model.prescriptionList); - //model.postPrescription(); - }, - child: CircleAvatar( - radius: 65, - backgroundColor: Color(0XFFB8382C), - child: CircleAvatar( - radius: 60, - backgroundColor: Colors.white, - child: Icon( - Icons.add, - color: Colors.black, - size: 45.0, - ), - ), - ), - ), - SizedBox( - height: 15.0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context) - .noPrescriptionListed, - color: Colors.black, - fontWeight: FontWeight.w900, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context).addNow, - color: Color(0XFFB8382C), - fontWeight: FontWeight.w900, - ), - ], - ), - ], - ) - ], - ), - ), - ), - )), - ); - } - - selectDate(BuildContext context, PrescriptionViewModel model) async { - DateTime selectedDate; - selectedDate = DateTime.now(); - final DateTime picked = await showDatePicker( - context: context, - initialDate: selectedDate, - firstDate: DateTime.now().add(Duration(hours: 2)), - lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, - ); - if (picked != null && picked != selectedDate) { - setState(() { - selectedDate = picked; - }); - } - } -} diff --git a/lib/screens/prescription/prescription_screen_history.dart b/lib/screens/prescription/prescription_screen_history.dart deleted file mode 100644 index 5ce98c54..00000000 --- a/lib/screens/prescription/prescription_screen_history.dart +++ /dev/null @@ -1,516 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:flutter/material.dart'; - -class NewPrescriptionHistoryScreen extends StatefulWidget { - @override - _NewPrescriptionHistoryScreenState createState() => - _NewPrescriptionHistoryScreenState(); -} - -class _NewPrescriptionHistoryScreenState - extends State { - PersistentBottomSheetController _controller; - final _scaffoldKey = GlobalKey(); - TextEditingController strengthController = TextEditingController(); - int testNum = 0; - int strengthChar; - PatiantInformtion patient; - - @override - void initState() { - super.initState(); - } - - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - patient = routeArgs['patient']; - return BaseView( - onModelReady: (model) => model.getPrescription(mrn: patient.patientId), - builder: - (BuildContext context, PrescriptionViewModel model, Widget child) => - AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).prescription, - body: NetworkBaseView( - baseViewModel: model, - child: SingleChildScrollView( - child: Container( - color: Colors.white, - child: Column( - children: [ - PatientPageHeaderWidget(patient), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey, - ), - (model.prescriptionList.length != 0) - ? SizedBox( - height: - model.prescriptionList[0].rowcount == 0 - ? 200.0 - : 10.0) - : SizedBox(height: 200.0), - //model.prescriptionList == null - (model.prescriptionList.length != 0) - ? model.prescriptionList[0].rowcount == 0 - ? Container( - child: AppText( - 'Sorry , Theres no prescriptions for this patient', - color: Color(0xFFB9382C), - ), - ) - : Padding( - padding: EdgeInsets.all(14.0), - child: NetworkBaseView( - baseViewModel: model, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - ...List.generate( - model.prescriptionList[0] - .rowcount, - (index) => Container( - color: Colors.white, - child: Column( - children: [ - SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.022, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - // crossAxisAlignment: - // CrossAxisAlignment.start, - children: [ - Container( - height: MediaQuery.of( - context) - .size - .height * - 0.21, - width: MediaQuery.of( - context) - .size - .width * - 0.1, - child: Column( - children: [ - AppText( - (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != - null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) - .toString() - : DateTime.now() - .year) - .toString(), - color: Colors - .green, - fontSize: - 13.5, - ), - AppText( - AppDateUtils.getMonth(model.prescriptionList[0].entityList[index].createdOn != - null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) - .month) - : DateTime.now() - .month) - .toUpperCase(), - color: Colors - .green, - ), - AppText( - DateTime.parse(model - .prescriptionList[ - 0] - .entityList[ - index] - .createdOn) - .day - .toString(), - color: Colors - .green, - ), - AppText( - AppDateUtils.getTimeFormated(DateTime.parse(model - .prescriptionList[ - 0] - .entityList[ - index] - .createdOn)) - .toString(), - color: Colors - .green, - ), - ], - ), - ), - Container( - // height: MediaQuery.of( - // context) - // .size - // .height * - // 0.3499, - width: MediaQuery.of( - context) - .size - .width * - 0.77, - child: Column( - children: [ - Row( - children: [ - AppText( - 'Start Date:', - fontWeight: - FontWeight - .w700, - fontSize: - 14.0, - ), - Expanded( - child: - AppText( - AppDateUtils.getDateFormatted(DateTime.parse(model - .prescriptionList[0] - .entityList[index] - .startDate)), - fontSize: - 13.5, - ), - ), - SizedBox( - width: - 6.0, - ), - AppText( - 'Order Type:', - fontWeight: - FontWeight - .w700, - fontSize: - 14.0, - ), - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .orderTypeDescription, - fontSize: - 13.0, - ), - ), - ], - ), - SizedBox( - height: 5.5, - ), - Row( - children: [ - Container( - child: - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .medicationName, - fontWeight: - FontWeight.w700, - fontSize: - 15.0, - ), - ), - ) - ], - ), - SizedBox( - height: 5.5, - ), - Row( - children: [ - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .doseDetail, - fontSize: - 15.0, - ), - ) - ], - ), - SizedBox( - height: 10.0, - ), - Row( - children: [ - AppText( - 'Indication: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].indication), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'UOM: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].uom), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'BOX Quantity: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].quantity.toString() == null ? "" : model.prescriptionList[0].entityList[index].quantity.toString()), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'pharmacy Intervention ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].pharmacyInervention == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), - ), - ), - ], - ), - SizedBox( - height: - 5.0), - Row( - children: [ - AppText( - 'pharmacist Remarks : ', - fontWeight: - FontWeight - .w700, - fontSize: - 15.0, - ), - Expanded( - child: AppText( - // commening below code because there is an error coming in the model please fix it before pushing it - model.prescriptionList[0].entityList[index].pharmacistRemarks == null ? "" : model.prescriptionList[0].entityList[index].pharmacistRemarks, - fontSize: 15.0), - ) - ], - ), - SizedBox( - height: 20.0, - ), - Row( - children: [ - AppText( - TranslationBase.of(context) - .doctorName + - ": ", - fontWeight: - FontWeight - .w600, - ), - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .doctorName, - fontWeight: - FontWeight.w700, - ), - ) - ], - ), - SizedBox( - height: 8.0, - ), - Row( - children: [ - AppText( - 'Doctor Remarks : ', - fontWeight: - FontWeight - .w700, - fontSize: - 13.0, - ), - Expanded( - child: - Container( - // height: MediaQuery.of(context).size.height * - // 0.038, - child: - RichText( - // maxLines: - // 2, - // overflow: - // TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 10.0), - text: - TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].remarks != null - ? model.prescriptionList[0].entityList[index].remarks - : "", - ), - ), - ), - ), - ], - ), - SizedBox( - height: 10.0, - ), - - // SizedBox( - // height: 40, - // ), - ], - ), - ), - ], - ), - Divider( - height: 0, - thickness: 1.0, - color: Colors.grey, - ), - ], - ), - ), - ), - ], - ), - ), - ) - : Container( - child: AppText( - 'Sorry , theres no prescriptions listed for this patient', - color: Color(0xFFB9382C), - ), - ) - ], - ), - ), - ), - )), - ); - } - - selectDate(BuildContext context, PrescriptionViewModel model) async { - DateTime selectedDate; - selectedDate = DateTime.now(); - final DateTime picked = await showDatePicker( - context: context, - initialDate: selectedDate, - firstDate: DateTime.now().add(Duration(hours: 2)), - lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, - ); - if (picked != null && picked != selectedDate) { - setState(() { - selectedDate = picked; - }); - } - } -} diff --git a/lib/screens/prescription/prescription_text_filed.dart b/lib/screens/prescription/prescription_text_filed.dart new file mode 100644 index 00000000..dd9428fd --- /dev/null +++ b/lib/screens/prescription/prescription_text_filed.dart @@ -0,0 +1,75 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionTextFiled extends StatefulWidget { + dynamic element; + final String elementError; + final List elementList; + final String keyName; + final String keyId; + final String hintText; + final double width; + final Function(dynamic) okFunction; + + PrescriptionTextFiled( + {Key key, + @required this.element, + @required this.elementError, + this.width, + this.elementList, + this.keyName, + this.keyId, + this.hintText, + this.okFunction}) + : super(key: key); + + @override + _PrescriptionTextFiledState createState() => _PrescriptionTextFiledState(); +} + +class _PrescriptionTextFiledState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: widget.width ?? null, + child: InkWell( + onTap: widget.elementList != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: widget.elementList, + attributeName: '${widget.keyName}', + attributeValueId: '${widget.keyId}', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) => + widget.okFunction(selectedValue), + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: AppTextFieldCustom( + hintText: widget.hintText, + dropDownText: widget.elementList.length == 1 + ? widget.elementList[0]['${widget.keyName}'] + : widget.element != null + ? widget.element['${widget.keyName}'] + : null, + isTextFieldHasSuffix: true, + validationError: + widget.elementList.length != 1 ? widget.elementError : null, + enabled: false, + ), + ), + ); + } +} diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index a7367cf3..1a99299b 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -1,14 +1,14 @@ import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_item_in_patient_page.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart'; +import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; +import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; @@ -16,7 +16,6 @@ import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_doctor_ca import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class PrescriptionsPage extends StatelessWidget { @override @@ -26,8 +25,8 @@ class PrescriptionsPage extends StatelessWidget { String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; bool isInpatient = routeArgs['isInpatient']; + bool isFromLiveCare = routeArgs['isFromLiveCare']; bool isSelectInpatient = routeArgs['isSelectInpatient']; - ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => isSelectInpatient ? model.getPrescriptionsInPatient(patient) @@ -36,10 +35,8 @@ class PrescriptionsPage extends StatelessWidget { baseViewModel: model, isShowAppBar: true, backgroundColor: Colors.grey[100], - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - patientType ?? '0', - arrivalType, isInpatient: isInpatient, ), body: patient.admissionNo == null @@ -93,12 +90,22 @@ class PrescriptionsPage extends StatelessWidget { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || + (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { - addPrescriptionForm(context, model, patient, - model.prescriptionList); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + BaseAddProcedureTabPage( + patient: patient, + prescriptionModel: model, + procedureType: + ProcedureType.PRESCRIPTION, + )), + ); }, label: TranslationBase.of(context) .applyForNewPrescriptionsOrder, @@ -128,7 +135,7 @@ class PrescriptionsPage extends StatelessWidget { .clinicDescription, isPrescriptions: true, appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( + AppDateUtils.getDateTimeFromServerFormat( model.prescriptionsList[index] .appointmentDate, ), @@ -197,7 +204,7 @@ class PrescriptionsPage extends StatelessWidget { clinic: 'basheer', isPrescriptions: true, appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( + AppDateUtils.getDateTimeFromServerFormat( model.inPatientPrescription[index] .prescriptionDatetime, ), diff --git a/lib/screens/procedures/ExpansionProcedure.dart b/lib/screens/procedures/ExpansionProcedure.dart new file mode 100644 index 00000000..06e56f03 --- /dev/null +++ b/lib/screens/procedures/ExpansionProcedure.dart @@ -0,0 +1,184 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_request_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ExpansionProcedure extends StatefulWidget { + final ProcedureTempleteDetailsModelList procedureTempleteModel; + final ProcedureViewModel model; + final Function(ProcedureTempleteDetailsModel) removeFavProcedure; + final Function(ProcedureTempleteDetailsModel) addFavProcedure; + final Function(ProcedureTempleteDetailsModel) selectProcedures; + + final bool Function(ProcedureTempleteModel) isEntityListSelected; + final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected; + final bool isProcedure; + final ProcedureTempleteDetailsModel groupProcedures; + + const ExpansionProcedure( + {Key key, + this.procedureTempleteModel, + this.model, + this.removeFavProcedure, + this.addFavProcedure, + this.selectProcedures, + this.isEntityListSelected, + this.isEntityFavListSelected, + this.isProcedure = true, + this.groupProcedures}) + : super(key: key); + + @override + _ExpansionProcedureState createState() => _ExpansionProcedureState(); +} + +class _ExpansionProcedureState extends State { + bool _isShowMore = false; + BaseAppClient baseAppClient = BaseAppClient(); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + InkWell( + onTap: () async { + setState(() { + _isShowMore = !_isShowMore; + }); + }, + child: Container( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(5.0), + )), + child: Row( + children: [ + Expanded( + child: Row( + children: [ + Icon( + Icons.folder, + size: 20, + color: Color(0xff575757), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: AppText( + widget.isProcedure == true + ? "Procedures for " + widget.procedureTempleteModel.templateName + : "Prescription for " + widget.procedureTempleteModel.templateName, + fontSize: 16.0, + variant: "bodyText", + bold: true, + color: Color(0xff575757)), + ), + ), + ], + )), + Container( + width: 25, + height: 25, + child: Icon( + _isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, + color: Colors.grey[800], + size: 22, + ), + ) + ], + ), + ), + ), + if (_isShowMore) + AnimatedContainer( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + )), + duration: Duration(milliseconds: 7000), + child: Column( + children: widget.procedureTempleteModel.procedureTemplate.map((itemProcedure) { + return InkWell( + onTap: () { + if (widget.isProcedure) { + setState(() { + if (widget.isEntityFavListSelected(itemProcedure)) { + widget.removeFavProcedure(itemProcedure); + } else { + widget.addFavProcedure(itemProcedure); + } + }); + } else { + widget.selectProcedures(itemProcedure); + } + }, + child: Container( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 11), + child: widget.isProcedure + ? Checkbox( + value: widget.isEntityFavListSelected(itemProcedure), + activeColor: Color(0xffD02127), + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityFavListSelected(itemProcedure)) { + widget.removeFavProcedure(itemProcedure); + } else { + widget.addFavProcedure(itemProcedure); + } + }); + }) + : Radio( + value: itemProcedure, + groupValue: widget.groupProcedures, + activeColor: Color(0xffD02127), + onChanged: (newValue) { + widget.selectProcedures(newValue); + })), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: AppText(itemProcedure.procedureName, + fontSize: 14.0, variant: "bodyText", bold: true, color: Color(0xff575757)), + ), + ), + ], + ), + ], + ), + ), + ), + ); + }).toList(), + ), + ), + SizedBox( + height: 10, + ), + ], + ); + } +} diff --git a/lib/screens/procedures/ProcedureCard.dart b/lib/screens/procedures/ProcedureCard.dart index f18422ee..31611b67 100644 --- a/lib/screens/procedures/ProcedureCard.dart +++ b/lib/screens/procedures/ProcedureCard.dart @@ -1,6 +1,8 @@ //import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -15,8 +17,8 @@ class ProcedureCard extends StatelessWidget { final String categoryName; final int categoryID; final PatiantInformtion patient; - final String doctorName; - + final int doctorID; + final bool isInpatient; const ProcedureCard({ Key key, this.onTap, @@ -24,15 +26,16 @@ class ProcedureCard extends StatelessWidget { this.categoryID, this.categoryName, this.patient, - this.doctorName, + this.doctorID, this.isInpatient = false, }) : super(key: key); + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( width: double.maxFinite, - height: MediaQuery.of(context).size.height * .22, + //height: MediaQuery.of(context).size.height * .22, margin: EdgeInsets.all(10), padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( @@ -130,72 +133,84 @@ class ProcedureCard extends StatelessWidget { ], ), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context).doctorName + ": ", - //color: Colors.grey, - fontSize: 12, - color: Colors.grey, - ), - AppText( - entityList.doctorName.toString(), - fontSize: 12, - bold: true, + Container( + margin: EdgeInsets.only(left: 10, right: 0), + child: Image.asset( + 'assets/images/patient/ic_ref_arrow_left.png', + height: 50, + width: 30, + ), ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).clinic + ": ", - //color: Colors.grey, - fontSize: 12, - color: Colors.grey, + Container( + margin: EdgeInsets.only( + left: 0, top: 25, right: 0, bottom: 0), + padding: EdgeInsets.only(left: 4.0, right: 4.0), + child: Container( + width: 40, + height: 40, + child: ClipRRect( + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + 'assets/images/male_avatar.png', + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + ))), ), - AppText( - entityList.clinicDescription ?? "", - bold: true, - fontSize: 12, + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.only( + left: 10, top: 25, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + entityList.doctorName, + fontFamily: 'Poppins', + fontWeight: FontWeight.w800, + fontSize: 1.7 * SizeConfig.textMultiplier, + color: Colors.black, + ), + if (entityList.clinicDescription != null) + AppText( + entityList.clinicDescription, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.4 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), + ], + ), + ), ), ], ), - /*Container( - alignment: Alignment.centerRight, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: FlowChartPage( - filterName: entityList.procedureName, - patient: patient, - ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: AppText( + entityList.remarks.toString() ?? '', + fontSize: 12, ), - ); - }, - child: AppText( - TranslationBase.of(context).showMoreBtn, - textDecoration: TextDecoration.underline, - color: Colors.blue, - ), + ), + if ((entityList.categoryID == 2 || entityList.categoryID == 4) && doctorID == entityList.doctorID && !isInpatient) + InkWell( + child: Icon(DoctorApp.edit), + onTap: onTap, + ) + ], ), - ),*/ - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // AppText( - // entityList.remarks.toString() ?? '', - // fontSize: 12, - // ), - // if (entityList.categoryID == 2 || - // entityList.categoryID == 4 && - // doctorName == entityList.doctorName) - // InkWell( - // child: Icon(DoctorApp.edit), - // onTap: onTap, - // ) - // ], - // ) + ) ], ), //onTap: onTap, diff --git a/lib/screens/procedures/ProcedureType.dart b/lib/screens/procedures/ProcedureType.dart new file mode 100644 index 00000000..28a72041 --- /dev/null +++ b/lib/screens/procedures/ProcedureType.dart @@ -0,0 +1,88 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +enum ProcedureType { + PROCEDURE, + LAB_RESULT, + RADIOLOGY, + PRESCRIPTION, +} + +extension procedureType on ProcedureType { + String getFavouriteTabName(BuildContext context) { + return TranslationBase.of(context).favoriteTemplates; + } + + String getAllLabelName(BuildContext context) { + switch (this) { + case ProcedureType.PROCEDURE: + return TranslationBase.of(context).allProcedures; + case ProcedureType.LAB_RESULT: + return TranslationBase.of(context).allLab; + case ProcedureType.RADIOLOGY: + return TranslationBase.of(context).allRadiology; + case ProcedureType.PRESCRIPTION: + return TranslationBase.of(context).allPrescription; + default: + return ""; + } + } + + String getToolbarLabel(BuildContext context) { + switch (this) { + case ProcedureType.PROCEDURE: + return TranslationBase.of(context).addProcedures; + case ProcedureType.LAB_RESULT: + return TranslationBase.of(context).addLabOrder; + case ProcedureType.RADIOLOGY: + return TranslationBase.of(context).addRadiologyOrder; + case ProcedureType.PRESCRIPTION: + return TranslationBase.of(context).addPrescription; + default: + return ""; + } + } + + String getAddButtonTitle(BuildContext context) { + switch (this) { + case ProcedureType.PROCEDURE: + return TranslationBase.of(context).addProcedures; + case ProcedureType.LAB_RESULT: + return TranslationBase.of(context).addLabOrder; + case ProcedureType.RADIOLOGY: + return TranslationBase.of(context).addRadiologyOrder; + case ProcedureType.PRESCRIPTION: + return TranslationBase.of(context).addPrescription; + default: + return ""; + } + } + + String getCategoryId() { + switch (this) { + case ProcedureType.PROCEDURE: + return null; + case ProcedureType.LAB_RESULT: + return "02"; + case ProcedureType.RADIOLOGY: + return "03"; + case ProcedureType.PRESCRIPTION: + return "55"; + default: + return null; + } + } + + String getCategoryName() { + switch (this) { + case ProcedureType.PROCEDURE: + return null; + case ProcedureType.LAB_RESULT: + return "Laboratory"; + case ProcedureType.RADIOLOGY: + return "Radiology"; + default: + return null; + } + } +} diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart new file mode 100644 index 00000000..978fc2c5 --- /dev/null +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -0,0 +1,156 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/prescription_checkout_screen.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'ProcedureType.dart'; + +class AddFavouriteProcedure extends StatefulWidget { + final ProcedureViewModel model; + final PrescriptionViewModel prescriptionModel; + final PatiantInformtion patient; + final ProcedureType procedureType; + + AddFavouriteProcedure({ + Key key, + this.model, + this.prescriptionModel, + this.patient, + @required this.procedureType, + }); + + @override + _AddFavouriteProcedureState createState() => _AddFavouriteProcedureState(); +} + +class _AddFavouriteProcedureState extends State { + _AddFavouriteProcedureState({this.patient, this.model}); + + ProcedureViewModel model; + PatiantInformtion patient; + List entityList = List(); + ProcedureTempleteDetailsModel groupProcedures; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => + model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + baseViewModel: model, + body: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + if (model.templateList.length != 0) + Expanded( + child: EntityListCheckboxSearchFavProceduresWidget( + isProcedure: !(widget.procedureType == ProcedureType.PRESCRIPTION), + model: model, + removeFavProcedure: (item) { + setState(() { + entityList.remove(item); + }); + }, + addFavProcedure: (history) { + setState(() { + entityList.add(history); + }); + }, + isEntityFavListSelected: (master) => + isEntityListSelected(master), + groupProcedures: groupProcedures, + selectProcedures: (selectedProcedure) { + setState(() { + groupProcedures = selectedProcedure; + }); + }, + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.procedureType.getAddButtonTitle(context) ?? + TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () { + if(widget.procedureType == ProcedureType.PRESCRIPTION){ + if (groupProcedures == null) { + DrAppToastMsg.showErrorToast( + 'Please Select item ', + ); + return; + } + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PrescriptionCheckOutScreen( + patient: widget.patient, + model: widget.prescriptionModel, + groupProcedures: groupProcedures, + ), + ), + ); + } else { + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ProcedureCheckOutScreen( + items: entityList, + model: model, + patient: widget.patient, + addButtonTitle: widget.procedureType.getAddButtonTitle(context), + toolbarTitle: widget.procedureType.getToolbarLabel(context), + ), + ), + ); + } + }, + ), + ], + ), + ), + ], + ), + ), + ); + } + + bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { + Iterable history = entityList.where( + (element) => + masterKey.templateID == element.templateID && + masterKey.procedureName == element.procedureName); + if (history.length > 0) { + return true; + } + return false; + } +} diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart deleted file mode 100644 index df748922..00000000 --- a/lib/screens/procedures/add-procedure-form.dart +++ /dev/null @@ -1,494 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; -import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:flutter/material.dart'; - -import 'entity_list_checkbox_search_widget.dart'; -import 'entity_list_procedure_widget.dart'; - -valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, - List entityList) async { - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - - procedureValadteRequestModel.patientMRN = patient.appointmentNo; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; -} - -postProcedure( - {ProcedureViewModel model, - String remarks, - String orderType, - PatiantInformtion patient, - List entityList}) async { - PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - procedureValadteRequestModel.patientMRN = patient.patientMRN; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; - - List controlsProcedure = List(); - - postProcedureReqModel.appointmentNo = patient.appointmentNo; - - postProcedureReqModel.episodeID = patient.episodeNo; - postProcedureReqModel.patientMRN = patient.patientMRN; - - entityList.forEach((element) { - procedureValadteRequestModel.procedure = [element.procedureId]; - List controls = List(); - controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), - ); - controls.add( - Controls(code: "ordertype", controlValue: "0"), - ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); - }); - - postProcedureReqModel.procedures = controlsProcedure; - await model.valadteProcedure(procedureValadteRequestModel); - if (model.state == ViewState.Idle) { - if (model.valadteProcedureList[0].entityList.length == 0) { - await model.postProcedure(postProcedureReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); - } - } else { - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - Helpers.showErrorToast( - model.valadteProcedureList[0].entityList[0].warringMessages); - } - } - } else { - Helpers.showErrorToast(model.error); - } -} - -void addSelectedProcedure( - context, ProcedureViewModel model, PatiantInformtion patient) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext bc) { - return AddSelectedProcedure( - model: model, - patient: patient, - ); - }); -} - -class AddSelectedProcedure extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - - const AddSelectedProcedure({Key key, this.model, this.patient}) - : super(key: key); - @override - _AddSelectedProcedureState createState() => - _AddSelectedProcedureState(patient: patient, model: model); -} - -class _AddSelectedProcedureState extends State { - int selectedType; - ProcedureViewModel model; - PatiantInformtion patient; - _AddSelectedProcedureState({this.patient, this.model}); - TextEditingController procedureController = TextEditingController(); - TextEditingController remarksController = TextEditingController(); - List entityList = List(); - List entityListProcedure = List(); - TextEditingController procedureName = TextEditingController(); - - dynamic selectedCategory; - - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( - //onModelReady: (model) => model.getCategory(), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.20, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context) - .pleaseEnterProcedure, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ) - ]), - SizedBox( - height: MediaQuery.of(context).size.height * 0.04, - ), - Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.85, - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchProcedureHere, - isTextFieldHasSuffix: false, - - maxLines: 1, - minLines: 1, - hasBorder: true, - controller: procedureName, - // onSubmitted: (_) { - // model.getProcedureCategory( - // categoryName: procedureName.text); - // }, - onClick: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - categoryName: procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - ), - ), - SizedBox( - width: MediaQuery.of(context).size.width * 0.02, - ), - InkWell( - onTap: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - categoryName: procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - child: Icon( - Icons.search, - size: 25.0, - ), - ), - ], - ), - // SizedBox( - // width: MediaQuery.of(context).size.width * 0.29, - // ), - // InkWell( - // child: Icon( - // Icons.close, - // size: 24.0, - // ), - // onTap: () { - // Navigator.pop(context); - // }, - // ), - // ], - // ), - // SizedBox( - // height: 10.0, - // ), - // Container( - // height: screenSize.height * 0.070, - // child: InkWell( - // onTap: model.categoryList != null && - // model.categoryList.length > 0 - // ? () { - // ListSelectDialog dialog = - // ListSelectDialog( - // list: model.categoryList, - // attributeName: 'categoryName', - // attributeValueId: 'categoryId', - // okText: TranslationBase.of(context).ok, - // okFunction: (selectedValue) { - // setState(() { - // selectedCategory = selectedValue; - // model.getProcedureCategory( - // categoryName: selectedCategory[ - // 'categoryName'], - // categoryID: selectedCategory[ - // 'categoryId'] <= - // 9 - // ? "0" + - // selectedCategory[ - // 'categoryId'] - // .toString() - // : selectedCategory[ - // 'categoryId'] - // .toString()); - // }); - // }, - // ); - // showDialog( - // barrierDismissible: false, - // context: context, - // builder: (BuildContext context) { - // return dialog; - // }, - // ); - // //model.getProcedureCategory(); - // } - // : null, - // child: TextField( - // decoration: textFieldSelectorDecoration( - // TranslationBase.of(context) - // .procedureCategorise, - // selectedCategory != null - // ? selectedCategory['categoryName'] - // : null, - // true, - // suffixIcon: Icon( - // Icons.search, - // color: Colors.black, - // )), - // enabled: false, - // ), - // ), - // ), - if (procedureName.text.isNotEmpty && - model.procedureList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: - // selectedCategory != null - // ? selectedCategory['categoryId'] == 02 || - // selectedCategory['categoryId'] == 03 - // ? - EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - ) - // : ProcedureListWidget( - // model: widget.model, - // masterList: widget.model - // .categoriesList[0].entityList, - // removeHistory: (item) { - // setState(() { - // entityList.remove(item); - // }); - // }, - // addHistory: (history) { - // setState(() { - // entityList.add(history); - // }); - // }, - // addSelectedHistories: () { - // //TODO build your fun herr - // // widget.addSelectedHistories(); - // }, - // isEntityListSelected: (master) => - // isEntityListSelected(master), - // ) - // : null, - ), - SizedBox( - height: 15.0, - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Container( - // child: Row( - // children: [ - // AppText( - // TranslationBase.of(context).orderType), - // Radio( - // activeColor: Color(0xFFB9382C), - // value: 1, - // groupValue: selectedType, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text('routine'), - // Radio( - // activeColor: Color(0xFFB9382C), - // groupValue: selectedType, - // value: 0, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text(TranslationBase.of(context).urgent), - // ], - // ), - // ), - // SizedBox( - // height: 15.0, - // ), - // TextFields( - // hintText: TranslationBase.of(context).remarks, - // controller: remarksController, - // minLines: 3, - // maxLines: 5, - // ), - SizedBox( - height: 100.0, - ), - ], - ) - ], - ), - ), - ), - ); - }), - ), - bottomSheet: Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).addSelectedProcedures, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - //print(entityList.toString()); - onPressed: - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ), - ), - ); - } - - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } -} diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add-procedure-page.dart new file mode 100644 index 00000000..e0b7374f --- /dev/null +++ b/lib/screens/procedures/add-procedure-page.dart @@ -0,0 +1,221 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + +import 'ProcedureType.dart'; +import 'entity_list_checkbox_search_widget.dart'; + +class AddProcedurePage extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + final ProcedureType procedureType; + + const AddProcedurePage( + {Key key, this.model, this.patient, @required this.procedureType}) + : super(key: key); + + @override + _AddProcedurePageState createState() => _AddProcedurePageState( + patient: patient, model: model, procedureType: this.procedureType); +} + +class _AddProcedurePageState extends State { + int selectedType; + ProcedureViewModel model; + PatiantInformtion patient; + ProcedureType procedureType; + + _AddProcedurePageState({this.patient, this.model, this.procedureType}); + + TextEditingController procedureController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); + List entityList = List(); + List entityListProcedure = List(); + TextEditingController procedureName = TextEditingController(); + + dynamic selectedCategory; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.getProcedureCategory( + categoryName: procedureType.getCategoryName(), + categoryID: procedureType.getCategoryId(), + patientId: patient.patientId); + }, + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + Expanded( + child: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (procedureType == ProcedureType.PROCEDURE) + Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context) + .pleaseEnterProcedure, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ], + ), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.02, + ), + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * + 0.79, + child: AppTextFieldCustom( + hintText: TranslationBase.of(context) + .searchProcedureHere, + isTextFieldHasSuffix: false, + maxLines: 1, + minLines: 1, + hasBorder: true, + controller: procedureName, + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * + 0.02, + ), + Expanded( + child: InkWell( + onTap: () { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) + model.getProcedureCategory( + patientId: patient.patientId, + categoryName: + procedureName.text); + else + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + }, + child: Icon( + Icons.search, + size: 25.0, + ), + ), + ), + ], + ), + ], + ), + if ((procedureType == ProcedureType.PROCEDURE + ? procedureName.text.isNotEmpty + : true) && + model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: + model.categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + )), + ], + ), + ), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: procedureType.getAddButtonTitle(context), + fontWeight: FontWeight.w700, + color: Color(0xff359846), + onPressed: () async { + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } + + await this.model.preparePostProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + remarks: remarksController.text); + Navigator.pop(context); + }, + ), + ], + ), + ), + ], + ), + ), + ); + } + + bool isEntityListSelected(EntityList masterKey) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } +} diff --git a/lib/screens/procedures/add_lab_orders.dart b/lib/screens/procedures/add_lab_orders.dart deleted file mode 100644 index 4a20dbaa..00000000 --- a/lib/screens/procedures/add_lab_orders.dart +++ /dev/null @@ -1,294 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; -import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:flutter/material.dart'; - -import 'entity_list_checkbox_search_widget.dart'; - -valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, - List entityList) async { - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - - procedureValadteRequestModel.patientMRN = patient.appointmentNo; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; -} - -postProcedure( - {ProcedureViewModel model, - String remarks, - String orderType, - PatiantInformtion patient, - List entityList}) async { - PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - procedureValadteRequestModel.patientMRN = patient.patientMRN; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; - - List controlsProcedure = List(); - - postProcedureReqModel.appointmentNo = patient.appointmentNo; - - postProcedureReqModel.episodeID = patient.episodeNo; - postProcedureReqModel.patientMRN = patient.patientMRN; - - entityList.forEach((element) { - procedureValadteRequestModel.procedure = [element.procedureId]; - List controls = List(); - controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), - ); - controls.add( - Controls(code: "ordertype", controlValue: "0"), - ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); - }); - - postProcedureReqModel.procedures = controlsProcedure; - await model.valadteProcedure(procedureValadteRequestModel); - if (model.state == ViewState.Idle) { - if (model.valadteProcedureList[0].entityList.length == 0) { - await model.postProcedure(postProcedureReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getLabs(patient); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); - } - } else { - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getLabs(patient); - } else if (model.state == ViewState.Idle) { - Helpers.showErrorToast( - model.valadteProcedureList[0].entityList[0].warringMessages); - } - } - } else { - Helpers.showErrorToast(model.error); - } -} - -void addSelectedLabOrder( - context, ProcedureViewModel model, PatiantInformtion patient) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext bc) { - return AddSelectedLabOrder( - model: model, - patient: patient, - ); - }); -} - -class AddSelectedLabOrder extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - - const AddSelectedLabOrder({Key key, this.model, this.patient}) - : super(key: key); - @override - _AddSelectedLabOrderState createState() => - _AddSelectedLabOrderState(patient: patient, model: model); -} - -class _AddSelectedLabOrderState extends State { - int selectedType; - ProcedureViewModel model; - PatiantInformtion patient; - _AddSelectedLabOrderState({this.patient, this.model}); - TextEditingController procedureController = TextEditingController(); - TextEditingController remarksController = TextEditingController(); - List entityList = List(); - List entityListProcedure = List(); - - dynamic selectedCategory; - - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( - onModelReady: (model) => model.getProcedureCategory( - categoryName: "Laboratory", categoryID: "02"), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * .90, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - AppText( - TranslationBase.of(context).applyForNewLabOrder, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - SizedBox( - width: MediaQuery.of(context).size.width * 0.48, - ), - InkWell( - child: Icon( - Icons.close, - size: 28.0, - ), - onTap: () { - Navigator.pop(context); - }, - ), - ], - ), - SizedBox( - height: 10.0, - ), - if (widget.model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - )), - ], - ), - ), - ), - ); - }), - ), - bottomSheet: Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .addLabOrder, //TranslationBase.of(context) - fontWeight: FontWeight.w700, - //.addSelectedProcedures, - color: Color(0xff359846), - onPressed: () { - //print(entityList.toString()); - onPressed: - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ), - ), - ); - } - - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } -} diff --git a/lib/screens/procedures/add_radiology_order.dart b/lib/screens/procedures/add_radiology_order.dart deleted file mode 100644 index 3f19e7f9..00000000 --- a/lib/screens/procedures/add_radiology_order.dart +++ /dev/null @@ -1,288 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; -import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:flutter/material.dart'; - -import 'entity_list_checkbox_search_widget.dart'; - -valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, - List entityList) async { - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - - procedureValadteRequestModel.patientMRN = patient.appointmentNo; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; -} - -postProcedure( - {ProcedureViewModel model, - String remarks, - String orderType, - PatiantInformtion patient, - List entityList}) async { - PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); - procedureValadteRequestModel.patientMRN = patient.patientMRN; - procedureValadteRequestModel.episodeID = patient.episodeNo; - procedureValadteRequestModel.appointmentNo = patient.appointmentNo; - - List controlsProcedure = List(); - - postProcedureReqModel.appointmentNo = patient.appointmentNo; - - postProcedureReqModel.episodeID = patient.episodeNo; - postProcedureReqModel.patientMRN = patient.patientMRN; - - entityList.forEach((element) { - procedureValadteRequestModel.procedure = [element.procedureId]; - List controls = List(); - controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), - ); - controls.add( - Controls(code: "ordertype", controlValue: "0"), - ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); - }); - - postProcedureReqModel.procedures = controlsProcedure; - await model.valadteProcedure(procedureValadteRequestModel); - if (model.state == ViewState.Idle) { - if (model.valadteProcedureList[0].entityList.length == 0) { - await model.postProcedure(postProcedureReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getPatientRadOrders(patient); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); - } - } else { - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - model.getPatientRadOrders(patient); - } else if (model.state == ViewState.Idle) { - Helpers.showErrorToast( - model.valadteProcedureList[0].entityList[0].warringMessages); - } - } - } else { - Helpers.showErrorToast(model.error); - } -} - -void addSelectedRadiologyOrder( - context, ProcedureViewModel model, PatiantInformtion patient) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext bc) { - return AddSelectedRadiologyOrder( - model: model, - patient: patient, - ); - }); -} - -class AddSelectedRadiologyOrder extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - - const AddSelectedRadiologyOrder({Key key, this.model, this.patient}) - : super(key: key); - @override - _AddSelectedRadiologyOrderState createState() => - _AddSelectedRadiologyOrderState(patient: patient, model: model); -} - -class _AddSelectedRadiologyOrderState extends State { - int selectedType; - ProcedureViewModel model; - PatiantInformtion patient; - _AddSelectedRadiologyOrderState({this.patient, this.model}); - TextEditingController procedureController = TextEditingController(); - TextEditingController remarksController = TextEditingController(); - List entityList = List(); - List entityListProcedure = List(); - - dynamic selectedCategory; - - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( - onModelReady: (model) => model.getProcedureCategory( - categoryName: "Radiology", categoryID: "03"), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: - (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.0, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context).newRadiologyOrder, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - InkWell( - child: Icon( - Icons.close, - size: 28.0, - ), - onTap: () { - Navigator.pop(context); - }, - ), - ], - ), - SizedBox( - height: 10.0, - ), - if (widget.model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - )), - ], - ), - ), - ), - ); - }), - ), - bottomSheet: Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).addRadiologyOrder, - color: Color(0xff359846), - fontWeight: FontWeight.w700, - onPressed: () { - //print(entityList.toString()); - onPressed: - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast(TranslationBase.of(context) - .fillTheMandatoryProcedureDetails); - return; - } - - Navigator.pop(context); - postProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ), - ), - ); - } - - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } -} diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart new file mode 100644 index 00000000..e9ab695b --- /dev/null +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -0,0 +1,242 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/material.dart'; + +import 'ProcedureType.dart'; +import 'add-favourite-procedure.dart'; +import 'add-procedure-page.dart'; + +class BaseAddProcedureTabPage extends StatefulWidget { + final ProcedureViewModel model; + final PrescriptionViewModel prescriptionModel; + final PatiantInformtion patient; + final ProcedureType procedureType; + + const BaseAddProcedureTabPage( + {Key key, + this.model, + this.prescriptionModel, + this.patient, + @required this.procedureType}) + : super(key: key); + + @override + _BaseAddProcedureTabPageState createState() => _BaseAddProcedureTabPageState( + patient: patient, model: model, procedureType: procedureType); +} + +class _BaseAddProcedureTabPageState extends State + with SingleTickerProviderStateMixin { + final ProcedureViewModel model; + final PatiantInformtion patient; + final ProcedureType procedureType; + + _BaseAddProcedureTabPageState({this.patient, this.model, this.procedureType}); + + TabController _tabController; + int _activeTab = 0; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: + (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.25, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + procedureType.getToolbarLabel(context), + fontWeight: FontWeight.w700, + fontSize: 20, + ), + InkWell( + child: Icon( + Icons.close, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ) + ]), + SizedBox( + height: MediaQuery.of(context).size.height * 0.04, + ), + Expanded( + child: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).size.height * 0.070), + child: Container( + height: + MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only( + top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget( + screenSize, + _activeTab == 0, + procedureType + .getFavouriteTabName(context), + ), + tabWidget( + screenSize, + _activeTab == 1, + procedureType.getAllLabelName(context), + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + AddFavouriteProcedure( + model: this.model, + prescriptionModel: + widget.prescriptionModel, + patient: patient, + procedureType: procedureType, + ), + if (widget.procedureType == + ProcedureType.PRESCRIPTION) + PrescriptionFormWidget( + widget.prescriptionModel, + widget.patient, + widget.prescriptionModel + .prescriptionList) + else + AddProcedurePage( + model: this.model, + patient: patient, + procedureType: procedureType, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + }), + ), + ), + ); + } + + Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index 801c730c..725bb007 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -19,6 +19,7 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { final bool Function(EntityList) isEntityListSelected; final List masterList; + /// todo clear the function here EntityListCheckboxSearchWidget( {Key key, this.model, diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/entity_list_fav_procedure.dart new file mode 100644 index 00000000..8d4f93ed --- /dev/null +++ b/lib/screens/procedures/entity_list_fav_procedure.dart @@ -0,0 +1,159 @@ +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'ExpansionProcedure.dart'; + +class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { + final ProcedureViewModel model; + final Function addSelectedHistories; + final Function(ProcedureTempleteModel) removeHistory; + final Function(ProcedureTempleteModel) addHistory; + final Function(ProcedureTempleteModel) addRemarks; + + final Function(ProcedureTempleteDetailsModel) removeFavProcedure; + final Function(ProcedureTempleteDetailsModel) addFavProcedure; + final Function(ProcedureTempleteDetailsModel) selectProcedures; + final ProcedureTempleteDetailsModel groupProcedures; + + final bool Function(ProcedureTempleteModel) isEntityListSelected; + final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected; + final List masterList; + + final bool isProcedure; + + EntityListCheckboxSearchFavProceduresWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.addFavProcedure, + this.selectProcedures, + this.removeFavProcedure, + this.isEntityListSelected, + this.isEntityFavListSelected, + this.addRemarks, + this.isProcedure = true, + this.groupProcedures}) + : super(key: key); + + @override + _EntityListCheckboxSearchFavProceduresWidgetState createState() => + _EntityListCheckboxSearchFavProceduresWidgetState(); +} + +class _EntityListCheckboxSearchFavProceduresWidgetState extends State { + int selectedType = 0; + int typeUrgent; + int typeRegular; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + List items = List(); + List itemsProcedure = List(); + List remarksList = List(); + List typeList = List(); + + @override + void initState() { + //items.addAll(widget.masterList); + super.initState(); + } + + TextEditingController remarksController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.60, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white), + child: ListView( + children: [ + TextFields( + hintText: 'Search Favourite templates', + suffixIcon: EvaIcons.search, + suffixIconColor: Color(0xff2B353E), + onChanged: (value) { + filterSearchResults(value); + }, + hasBorder: false, + ), + SizedBox( + height: 15, + ), + widget.model.templateList.length != 0 + ? Column( + children: widget.model.templateList.map((historyInfo) { + return ExpansionProcedure( + procedureTempleteModel: historyInfo, + model: widget.model, + removeFavProcedure: widget.removeFavProcedure, + addFavProcedure: widget.addFavProcedure, + selectProcedures: widget.selectProcedures, + isEntityListSelected: widget.isEntityListSelected, + isEntityFavListSelected: widget.isEntityFavListSelected, + isProcedure: widget.isProcedure, + groupProcedures: widget.groupProcedures); + }).toList(), + ) + : Center( + child: Container( + child: AppText("Sorry , No Match", color: Color(0xFFB9382C)), + ), + ) + ], + ), + )), + ), + ), + ], + ), + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.templateName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} diff --git a/lib/screens/procedures/entity_list_procedure_widget.dart b/lib/screens/procedures/entity_list_procedure_widget.dart deleted file mode 100644 index 125262e4..00000000 --- a/lib/screens/procedures/entity_list_procedure_widget.dart +++ /dev/null @@ -1,168 +0,0 @@ -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class ProcedureListWidget extends StatefulWidget { - final ProcedureViewModel model; - final Function addSelectedHistories; - final Function(EntityList) removeHistory; - final Function(EntityList) addHistory; - final Function(EntityList) addRemarks; - - final bool Function(EntityList) isEntityListSelected; - final List masterList; - - ProcedureListWidget( - {Key key, - this.model, - this.addSelectedHistories, - this.removeHistory, - this.masterList, - this.addHistory, - this.isEntityListSelected, - this.addRemarks}) - : super(key: key); - - @override - _ProcedureListWidgetState createState() => _ProcedureListWidgetState(); -} - -class _ProcedureListWidgetState extends State { - int selectedType = 0; - int typeUrgent; - int typeRegular; - - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - List items = List(); - List remarksList = List(); - List typeList = List(); - - @override - void initState() { - items.addAll(widget.masterList); - super.initState(); - } - - TextEditingController remarksController = TextEditingController(); - @override - Widget build(BuildContext context) { - return Container( - child: Column( - children: [ - NetworkBaseView( - baseViewModel: widget.model, - child: Container( - height: MediaQuery.of(context).size.height * 0.75, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - TextFields( - hintText: TranslationBase.of(context).searchProcedures, - suffixIcon: EvaIcons.search, - onChanged: (value) { - filterSearchResults(value); - }, - ), - SizedBox( - height: 15, - ), - items.length != 0 - ? Column( - children: items.map((historyInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: widget.isEntityListSelected( - historyInfo), - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() { - if (widget.isEntityListSelected( - historyInfo)) { - widget - .removeHistory(historyInfo); - } else { - widget.addHistory(historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: AppText( - historyInfo.procedureName, - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ) - : Center( - child: Container( - child: AppText( - "There's no procedures for this category", - color: Color(0xFFB9382C)), - ), - ) - ], - ), - )), - ), - ), - SizedBox( - height: 10, - ), - ], - ), - ); - } - - void filterSearchResults(String query) { - List dummySearchList = List(); - dummySearchList.addAll(widget.masterList); - if (query.isNotEmpty) { - List dummyListData = List(); - dummySearchList.forEach((item) { - if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { - dummyListData.add(item); - } - }); - setState(() { - items.clear(); - items.addAll(dummyListData); - }); - return; - } else { - setState(() { - items.clear(); - items.addAll(widget.masterList); - }); - } - } -} diff --git a/lib/screens/procedures/procedure_checkout_screen.dart b/lib/screens/procedures/procedure_checkout_screen.dart new file mode 100644 index 00000000..4c054fc5 --- /dev/null +++ b/lib/screens/procedures/procedure_checkout_screen.dart @@ -0,0 +1,240 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-procedure-page.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ProcedureCheckOutScreen extends StatefulWidget { + final List items; + final ProcedureViewModel model; + final PatiantInformtion patient; + final String addButtonTitle; + final String toolbarTitle; + + ProcedureCheckOutScreen( + {this.items, this.model, this.patient,@required this.addButtonTitle,@required this.toolbarTitle}); + + @override + _ProcedureCheckOutScreenState createState() => + _ProcedureCheckOutScreenState(); +} + +class _ProcedureCheckOutScreenState extends State { + List remarksList = List(); + final TextEditingController remarksController = TextEditingController(); + List typeList = List(); + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), + isShowAppBar: false, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + color: Colors.white, + ), + Container( + color: Colors.white, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Row( + //mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Icon( + Icons.arrow_back_ios_sharp, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ), + SizedBox( + width: 5.0, + ), + AppText( + widget.toolbarTitle ?? 'Add Procedure', + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ], + ), + ), + ), + SizedBox( + height: 30, + ), + ...List.generate( + widget.items.length, + (index) => Container( + margin: EdgeInsets.only(bottom: 15.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.all(Radius.circular(10.0))), + child: ExpansionTile( + initiallyExpanded: true, + title: Row( + children: [ + Icon( + Icons.check_box, + color: Color(0xffD02127), + size: 30.5, + ), + SizedBox( + width: 6.0, + ), + Expanded( + child: AppText( + widget.items[index].procedureName)), + ], + ), + children: [ + Container( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 11), + child: AppText( + TranslationBase.of(context) + .orderType, + fontWeight: FontWeight.w700, + color: Color(0xff2B353E), + ), + ), + ], + ), + Row( + children: [ + Radio( + activeColor: Color(0xFFD02127), + value: 0, + groupValue: + widget.items[index].selectedType, + onChanged: (value) { + widget.items[index].selectedType = + 0; + setState(() { + widget.items[index].type = + value.toString(); + }); + }, + ), + AppText( + 'routine', + color: Color(0xff575757), + fontWeight: FontWeight.w600, + ), + Radio( + activeColor: Color(0xFFD02127), + groupValue: + widget.items[index].selectedType, + value: 1, + onChanged: (value) { + widget.items[index].selectedType = + 1; + setState(() { + widget.items[index].type = + value.toString(); + }); + }, + ), + AppText( + TranslationBase.of(context).urgent, + color: Color(0xff575757), + fontWeight: FontWeight.w600, + ), + ], + ), + ], + ), + ), + ), + SizedBox( + height: 2.0, + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 12, vertical: 15.0), + child: TextFields( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + onChanged: (value) { + widget.items[index].remarks = value; + }, + minLines: 3, + maxLines: 5, + borderWidth: 0.5, + borderColor: Colors.grey[500], + ), + ), + SizedBox( + height: 19.0, + ), + //DividerWithSpacesAround(), + ], + ), + )), + SizedBox( + height: 90, + ), + ], + ), + ), + bottomSheet: Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.addButtonTitle ?? TranslationBase.of(context).addSelectedProcedures, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () async { + List entityList = List(); + widget.items.forEach((element) { + entityList.add( + EntityList( + procedureId: element.procedureID, + remarks: element.remarks, + categoryID: element.categoryID, + type: element.type, + ), + ); + }); + Navigator.pop(context); + await model.preparePostProcedure( + entityList: entityList, + patient: widget.patient, + remarks: remarksController.text); + Navigator.pop(context); + Navigator.pop(context); + }, + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 7e18055d..79371459 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -5,23 +5,25 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; + import 'ProcedureCard.dart'; +import 'ProcedureType.dart'; +import 'base_add_procedure_tab_page.dart'; class ProcedureScreen extends StatelessWidget { - String doctorNameP; + int doctorNameP; void initState() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - doctorNameP = doctorProfile.doctorName; + doctorNameP = doctorProfile.doctorID; } @override @@ -30,6 +32,7 @@ class ProcedureScreen extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; + bool isFromLiveCare = routeArgs['isFromLiveCare']; bool isInpatient = routeArgs['isInpatient']; return BaseView( onModelReady: (model) => model.getProcedure( @@ -41,10 +44,8 @@ class ProcedureScreen extends StatelessWidget { isShowAppBar: true, backgroundColor: Colors.grey[100], baseViewModel: model, - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - arrivalType ?? '0', - patientType, isInpatient: isInpatient, ), body: SingleChildScrollView( @@ -97,17 +98,20 @@ class ProcedureScreen extends StatelessWidget { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || + (isFromLiveCare && patient.appointmentNo != null)) InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddSelectedProcedure( - patient: patient, - model: model, - )), + builder: (context) => BaseAddProcedureTabPage( + patient: patient, + model: model, + procedureType: ProcedureType.PROCEDURE, + ), + ), ); }, child: Container( @@ -186,7 +190,7 @@ class ProcedureScreen extends StatelessWidget { // 'You Cant Update This Procedure'); }, patient: patient, - doctorName: doctorNameP, + doctorID: model?.doctorProfile?.doctorID, ), ), if (model.state == ViewState.ErrorLocal || diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 6190e92e..24c4ea41 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -100,7 +100,7 @@ class _UpdateProcedureWidgetState extends State { baseViewModel: model, child: SingleChildScrollView( child: Container( - height: MediaQuery.of(context).size.height * 0.65, + height: MediaQuery.of(context).size.height * 0.9, child: Form( child: Padding( padding: diff --git a/lib/screens/qr_reader/QR_reader_screen.dart b/lib/screens/qr_reader/QR_reader_screen.dart index 57e6cc11..c6d07bb9 100644 --- a/lib/screens/qr_reader/QR_reader_screen.dart +++ b/lib/screens/qr_reader/QR_reader_screen.dart @@ -1,11 +1,9 @@ -import 'package:barcode_scan/platform_wrapper.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/models/patient/patient_model.dart'; -import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; -import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -26,43 +24,13 @@ class QrReaderScreen extends StatefulWidget { } class _QrReaderScreenState extends State { - DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - - bool isLoading = false; - bool isError = false; - PatientModel patient = PatientModel( - ProjectID: 15, - ClinicID: 0, - DoctorID: 1485, - FirstName: "0", - MiddleName: "0", - LastName: "0", - PatientMobileNumber: "0", - PatientIdentificationID: "0", - PatientID: 0, - From: "0", - To: "0", - LanguageID: 2, - stamp: "2020-03-02T13:56:39.170Z", - IPAdress: "11.11.11.11", - VersionID: 5.5, - Channel: 9, - TokenID: "@dm!n", - SessionID: "5G0yXn0Jnq", - IsLoginForDoctorApp: true, - PatientOutSA: false); - List patientList = []; - String error = ''; - @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getClinicsList(), + return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, - appBarTitle: - TranslationBase.of(context).qr + TranslationBase.of(context).reader, + appBarTitle: TranslationBase.of(context).qr + TranslationBase.of(context).reader, body: Center( child: Container( margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7), @@ -80,9 +48,7 @@ class _QrReaderScreenState extends State { height: 7, ), AppText(TranslationBase.of(context).scanQrCode, - fontSize: 14, - fontWeight: FontWeight.w400, - textAlign: TextAlign.center), + fontSize: 14, fontWeight: FontWeight.w400, textAlign: TextAlign.center), SizedBox( height: 15, ), @@ -98,31 +64,8 @@ class _QrReaderScreenState extends State { onPressed: () { _scanQrAndGetPatient(context, model); }, - loading: isLoading, icon: Image.asset('assets/images/qr_code_white.png'), ), - isError - ? Container( - margin: EdgeInsets.only(top: 8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: - Theme.of(context).errorColor.withOpacity(0.06), - ), - padding: EdgeInsets.symmetric( - vertical: 8.0, horizontal: 12.0), - child: Row( - children: [ - Expanded( - child: AppText( - error ?? - TranslationBase.of(context) - .errorMessage, - color: Theme.of(context).errorColor)), - ], - ), - ) - : Container(), ], ), ), @@ -132,86 +75,32 @@ class _QrReaderScreenState extends State { ); } - _scanQrAndGetPatient(BuildContext context, PatientViewModel model) async { - /// When give qr we will change this method to get data - /// var result = await BarcodeScanner.scan(); - /// int patientID = get from qr result + _scanQrAndGetPatient(BuildContext context, ScanQrViewModel model) async { var result = await BarcodeScanner.scan(); - if (result.rawContent != "") { - List listOfParams = result.rawContent.split(','); - String patientType = "1"; - setState(() { - isLoading = true; - isError = false; - patientList = []; - }); - String token = await sharedPref.getString(TOKEN); -// Map profile = await sharedPref.getObj(DOCTOR_PROFILE); -// DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); -// patient.PatientID = 8808; -// patient.TokenID = token; -// patient.setDoctorID = doctorProfile.projectID; -// patient.setClinicID = doctorProfile.clinicID; -// patient.setProjectID = doctorProfile.projectID; -// Provider.of(context, listen: false); - patient.PatientID = 8808; - patient.TokenID = token; - model.getPatientList(patient, "1", isBusyLocal: true).then((response) { - if (response['MessageStatus'] == 1) { - switch (patientType) { - case "0": - if (response['List_MyOutPatient'] != null) { - setState(() { - patientList = - ModelResponse.fromJson(response['List_MyOutPatient']) - .list; - isLoading = false; - }); - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": patientList[0], - }); - } else { - setState(() { - isError = true; - isLoading = false; - }); - DrAppToastMsg.showErrorToast('No patient'); - } - break; - case "1": - if (response['List_MyInPatient'] != null) { - setState(() { - patientList = - ModelResponse.fromJson(response['List_MyInPatient']).list; - isLoading = false; - error = ""; - }); - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": patientList[0], - }); - } else { - setState(() { - isError = true; - isLoading = false; - }); - DrAppToastMsg.showErrorToast('No patient'); - break; - } - } + if (result != "") { + List listOfParams = result.split(','); + int patientID = 0; + if (listOfParams[1].length != 0) patientID = int.parse(listOfParams[1]); + PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel( + patientID: patientID,clinicID: 0, + doctorID: 0, + projectID: int.parse(listOfParams[0]) + ); + + await model.getInPatientList(patientSearchRequestModel, isMyInpatient: false).then((d) { + if (model.state != ViewState.ErrorLocal) { + if (model.inPatientList.isEmpty) + DrAppToastMsg.showErrorToast('No patient'); + else + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": model.inPatientList[0], + "isInpatient": true, + }); } else { - setState(() { - isLoading = false; - isError = true; - }); - DrAppToastMsg.showErrorToast( - response['ErrorEndUserMessage'] ?? response['ErrorMessage']); + DrAppToastMsg.showErrorToast(model.error); } }).catchError((error) { - setState(() { - isLoading = false; - }); Helpers.showErrorToast(error.message); - //DrAppToastMsg.showErrorToast(error); }); } } diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 734e849a..7b065321 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -9,7 +9,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; @@ -34,10 +34,8 @@ class AddSickLeavScreen extends StatelessWidget { baseViewModel: model, isShowAppBar: true, backgroundColor: Colors.grey[100], - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - routeArgs['patientType'] ?? "0", - routeArgs['arrivalType'] ?? "0", isInpatient: isInpatient, ), body: SingleChildScrollView( diff --git a/lib/screens/sick-leave/show-sickleave.dart b/lib/screens/sick-leave/show-sickleave.dart index 3fbb3287..726524d8 100644 --- a/lib/screens/sick-leave/show-sickleave.dart +++ b/lib/screens/sick-leave/show-sickleave.dart @@ -5,7 +5,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; @@ -25,10 +25,8 @@ class ShowSickLeaveScreen extends StatelessWidget { baseViewModel: model, isShowAppBar: true, backgroundColor: Colors.grey[100], - appBar: PatientProfileHeaderNewDesignAppBar( + appBar: PatientProfileAppBar( patient, - routeArgs['patientType'] ?? "0", - routeArgs['arrivalType'] ?? "0", ), body: SingleChildScrollView( child: Column( diff --git a/lib/util/NotificationPermissionUtils.dart b/lib/util/NotificationPermissionUtils.dart new file mode 100644 index 00000000..8950fae3 --- /dev/null +++ b/lib/util/NotificationPermissionUtils.dart @@ -0,0 +1,42 @@ +import 'package:doctor_app_flutter/widgets/dialog/AskPermissionDialog.dart'; +import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:permission_handler/permission_handler.dart'; + + +class AppPermissionsUtils { + + static requestVideoCallPermission({BuildContext context, String type,Function onTapGrant}) async { + + var cameraPermission = Permission.camera; + var microphonePermission = Permission.microphone; + PermissionStatus permissionCameraStatus = await cameraPermission.status; + PermissionStatus permissionMicrophoneStatus = await microphonePermission.status; + + if (permissionCameraStatus.isPermanentlyDenied || permissionMicrophoneStatus.isPermanentlyDenied) { + await _showPermissionDialog(context, type,onTapGrant); + } else if (!permissionCameraStatus.isGranted || !permissionMicrophoneStatus.isGranted) { + permissionCameraStatus = await cameraPermission.request(); + permissionMicrophoneStatus = await microphonePermission.request(); + if (permissionCameraStatus.isDenied || permissionMicrophoneStatus.isDenied) + await _showPermissionDialog(context, type,onTapGrant); + else + onTapGrant(); + } else if (permissionCameraStatus.isDenied || permissionMicrophoneStatus.isDenied) + await _showPermissionDialog(context, type,onTapGrant); + else + onTapGrant(); + } + + static _showPermissionDialog(BuildContext context, String type,Function onTapGrant) async { + Navigator.push( + context, SlideUpPageRoute(widget: AskPermissionDialog(type: type,onTapGrant: onTapGrant,))); + } + + static Future isVideoCallPermissionGranted() async { + PermissionStatus permissionCameraStatus = await Permission.camera.status; + PermissionStatus permissionMicrophoneStatus = await Permission.microphone.status; + return permissionCameraStatus.isGranted && permissionMicrophoneStatus.isGranted; + } +} diff --git a/lib/util/VideoChannel.dart b/lib/util/VideoChannel.dart index bf255b54..94035d7d 100644 --- a/lib/util/VideoChannel.dart +++ b/lib/util/VideoChannel.dart @@ -4,15 +4,30 @@ import 'dart:io' show Platform; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/livecare/session_status_model.dart'; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class VideoChannel{ /// channel name static const _channel = const MethodChannel("Dr.cloudSolution/videoCall"); - static openVideoCallScreen( - {kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID,String generalId,int doctorId, Function() onCallEnd , Function(SessionStatusModel sessionStatusModel) onCallNotRespond ,Function(String error) onFailure}) async { + static openVideoCallScreen({kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID, + String generalId,int doctorId, String patientName, bool isRecording = false, Function() onCallEnd , + Function(SessionStatusModel sessionStatusModel) onCallNotRespond ,Function(String error) onFailure, VoidCallback onCallConnected, VoidCallback onCallDisconnected}) async { + + onCallConnected = onCallConnected ?? (){}; + onCallDisconnected = onCallDisconnected ?? (){}; var result; try { + _channel.setMethodCallHandler((call) { + if(call.method == 'onCallConnected'){ + onCallConnected(); + } + if(call.method == 'onCallDisconnected'){ + onCallDisconnected(); + } + return true as dynamic; + }); + result = await _channel.invokeMethod( 'openVideoCall', { @@ -20,11 +35,13 @@ class VideoChannel{ "kSessionId": kSessionId, "kToken": kToken, "appLang": "en", - "baseUrl": BASE_URL, + "baseUrl": BASE_URL_LIVE_CARE,//TODO change it to live "VC_ID": vcId, "TokenID": tokenID, "generalId": generalId, "DoctorId": doctorId , + "patientName": patientName, + "isRecording": isRecording, }, ); if(result['callResponse'] == 'CallEnd') { diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index 44e7bffe..9b00ba2b 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -7,7 +7,7 @@ class AppDateUtils { return DateFormat(dateFormat).format(dateTime); } - static DateTime convertISOStringToDateTime(String date){ + static DateTime convertISOStringToDateTime(String date) { DateTime newDate; newDate = DateTime.parse(date); @@ -16,7 +16,11 @@ class AppDateUtils { } static String convertStringToDateFormat(String date, String dateFormat) { - DateTime dateTime = DateTime.parse(date); + DateTime dateTime ; + if(date.contains("/Date")) + dateTime= getDateTimeFromServerFormat(date); + else + dateTime = DateTime.parse(date); return convertDateToFormat(dateTime, dateFormat); } @@ -27,22 +31,20 @@ class AppDateUtils { } static DateTime getDateTimeFromServerFormat(String str) { - DateTime date= DateTime.now(); - if (str!=null) { + DateTime date = DateTime.now(); + if (str != null) { const start = "/Date("; const end = "+0300)"; - if(str.contains("/Date")){ - final startIndex = str.indexOf(start); - - final endIndex = str.indexOf(end, startIndex + start.length); + if (str.contains("/Date")) { + final startIndex = str.indexOf(start); - date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - } else { - date = DateTime.now(); - } + final endIndex = str.indexOf(end, startIndex + start.length); + date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); + } else { + date = DateTime.now(); + } } else { date = DateTime.parse(str); } @@ -50,8 +52,7 @@ class AppDateUtils { return date; } - static String differenceBetweenDateAndCurrentInYearMonthDay( - DateTime firstDate, BuildContext context) { + static String differenceBetweenDateAndCurrentInYearMonthDay(DateTime firstDate, BuildContext context) { DateTime now = DateTime.now(); // now = now.add(Duration(days: 400, minutes: 0)); var difference = firstDate.difference(now); @@ -71,26 +72,29 @@ class AppDateUtils { return "$days ${TranslationBase.of(context).days}, $months ${TranslationBase.of(context).months}, $years ${TranslationBase.of(context).years}"; } - static String differenceBetweenDateAndCurrent( - DateTime firstDate, BuildContext context) { + static String differenceBetweenDateAndCurrent(DateTime firstDate, BuildContext context, {bool isShowSecond = false, bool isShowDays = true }) { DateTime now = DateTime.now(); - // DateTime now = nows.add(Duration(days: 400, minutes: 25, hours: 0)); var difference = now.difference(firstDate); int minutesInDays = difference.inMinutes; - int hoursInDays = - minutesInDays ~/ 60; // ~/ : truncating division to make the result int + int secondInDays = difference.inSeconds; + int hoursInDays = minutesInDays ~/ 60; // ~/ : truncating division to make the result int + int second = secondInDays % 60; int minutes = minutesInDays % 60; int days = hoursInDays ~/ 24; int hours = hoursInDays % 24; double hoursInOneDay = difference.inHours / difference.inDays; - return "$days ${TranslationBase.of(context).days}, $hours ${TranslationBase.of(context).hr}, $minutes ${TranslationBase.of(context).min}"; + return (isShowDays + ? (days > 0 ? "$days ${TranslationBase.of(context).days}," : '') + : "") + + (hours > 0 ? "$hours ${TranslationBase.of(context).hr}," : "") + + " $minutes ${TranslationBase.of(context).min}" + + (isShowSecond ? ", $second Sec" : ""); } - static String differenceBetweenServerDateAndCurrent( - String str, BuildContext context) { + static String differenceBetweenServerDateAndCurrent(String str, BuildContext context) { const start = "/Date("; const end = "+0300)"; @@ -99,8 +103,7 @@ class AppDateUtils { final endIndex = str.indexOf(end, startIndex + start.length); - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); + var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); return differenceBetweenDateAndCurrent(date, context); } @@ -246,7 +249,10 @@ class AppDateUtils { final startIndex = date.indexOf(start); final endIndex = date.indexOf(end, startIndex + start.length); DateTime newDate = DateTime.fromMillisecondsSinceEpoch( - int.parse(date.substring(startIndex + start.length, endIndex),),); + int.parse( + date.substring(startIndex + start.length, endIndex), + ), + ); return newDate; } else return DateTime.now(); @@ -256,35 +262,30 @@ class AppDateUtils { /// [dateTime] convert DateTime to data formatted Arabic static String getMonthDayYearDateFormattedAr(DateTime dateTime) { if (dateTime != null) - return getMonthArabic(dateTime.month) + - " " + - dateTime.day.toString() + - ", " + - dateTime.year.toString(); + return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); else return ""; } /// get data formatted like Apr 26,2020 /// [dateTime] convert DateTime to data formatted - static String getMonthDayYearDateFormatted(DateTime dateTime,{bool isArabic = false}) { + static String getMonthDayYearDateFormatted(DateTime dateTime, {bool isArabic = false}) { if (dateTime != null) - return isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - ", " + - dateTime.year.toString(); + return isArabic + ? getMonthArabic(dateTime.month) + : getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); else return ""; } /// get data formatted like 26 Apr 2020 /// [dateTime] convert DateTime to data formatted - static String getDayMonthYearDateFormatted(DateTime dateTime,{bool isArabic = false}) { + static String getDayMonthYearDateFormatted(DateTime dateTime, {bool isArabic = false}) { if (dateTime != null) - return dateTime.day.toString()+" "+ "${isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) }"+ + return dateTime.day.toString() + + " " + + "${isArabic ? getMonthArabic(dateTime.month) : getMonth(dateTime.month)}" + " " + - dateTime.year.toString(); else return ""; @@ -292,9 +293,9 @@ class AppDateUtils { /// get data formatted like 26/4/2020 /// [dateTime] convert DateTime to data formatted - static String getDayMonthYearDate(DateTime dateTime,{bool isArabic = false}) { + static String getDayMonthYearDate(DateTime dateTime, {bool isArabic = false}) { if (dateTime != null) - return dateTime.day.toString()+"/"+ "${dateTime.month}"+ "/" + dateTime.year.toString(); + return dateTime.day.toString() + "/" + "${dateTime.month}" + "/" + dateTime.year.toString(); else return ""; } @@ -302,12 +303,17 @@ class AppDateUtils { /// get data formatted like 10:45 PM /// [dateTime] convert DateTime to data formatted static String getHour(DateTime dateTime) { - return DateFormat('hh:mm a').format(dateTime); + return DateFormat('hh:mm a').format(dateTime); } - static String getAgeByBirthday(dynamic birthday, BuildContext context) { + static String getAgeByBirthday(String birthOfDate, BuildContext context, {bool isServerFormat = true}) { // https://leechy.dev/calculate-dates-diff-in-dart - DateTime birthDate = AppDateUtils.getDateTimeFromServerFormat(birthday); + DateTime birthDate; + if (birthOfDate.contains("/Date")) { + birthDate = AppDateUtils.getDateTimeFromServerFormat(birthOfDate); + } else { + birthDate = DateTime.parse(birthOfDate); + } final now = DateTime.now(); int years = now.year - birthDate.year; int months = now.month - birthDate.month; @@ -323,24 +329,18 @@ class AppDateUtils { return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}"; } - static bool isToday(DateTime dateTime){ - + static bool isToday(DateTime dateTime) { DateTime todayDate = DateTime.now().toUtc(); - if(dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) { + if (dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) { return true; } return false; - } static String getDate(DateTime dateTime) { print(dateTime); if (dateTime != null) - return getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - "," + - dateTime.year.toString(); + return getMonth(dateTime.month) + " " + dateTime.day.toString() + "," + dateTime.year.toString(); else return ""; } @@ -348,28 +348,23 @@ class AppDateUtils { static String getDateFormatted(DateTime dateTime) { print(dateTime); if (dateTime != null) - return dateTime.day.toString() + - "/" + - dateTime.month.toString() + - "/" + - dateTime.year.toString(); + return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString(); else return ""; } - static String getTimeHHMMA(DateTime dateTime){ + static String getTimeHHMMA(DateTime dateTime) { return DateFormat('hh:mm a').format(dateTime); } - static String getTimeHHMMA2 (DateTime dateTime){ + static String getTimeHHMMA2(DateTime dateTime) { return DateFormat('hh:mm').format(dateTime); } - static String getStartTime(String dateTime){ - String time=dateTime; + static String getStartTime(String dateTime) { + String time = dateTime; - if(dateTime.length>7) - time = dateTime.substring(0,5); + if (dateTime.length > 7) time = dateTime.substring(0, 5); return time; } @@ -380,4 +375,44 @@ class AppDateUtils { else return ""; } + + + // handel date like "09/05/2021 17:00" + static DateTime getDateTimeFromString(String str) { + List array = str.split('/'); + int day = int.parse(array[0]); + int month = int.parse(array[1]); + + List array2 = array[2].split(' '); + int year = int.parse(array2[0]); + String hour = array2[1]; + List hourList = hour.split(":"); + + DateTime date = DateTime(year, month, day, int.parse(hourList[0]), int.parse(hourList[1])); + + + return date; + } + + + static convertDateFormatImproved(String str) { + String newDate; + const start = "/Date("; + if (str.isNotEmpty) { + const end = "+0300)"; + + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + } + + return newDate??''; + } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 3e410c86..7232f0c9 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -1,11 +1,15 @@ import 'package:connectivity/connectivity.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart'; import 'package:doctor_app_flutter/screens/auth/login_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -22,7 +26,47 @@ class Helpers { static int cupertinoPickerIndex = 0; get currentLanguage => null; - static showCupertinoPicker(context, items, decKey, onSelectFun) { + + static showConfirmationDialog( + BuildContext context, String message, Function okFunction) { + return showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (_) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AlertDialog( + title: null, + content: Container( + child: AppText(message), + ), + actions: [ + AppButton( + onPressed: okFunction, + title: TranslationBase.of(context).noteConfirm, + fontColor: Colors.white, + color: Colors.green[600], + ), + AppButton( + onPressed: () { + Navigator.of(context).pop(); + }, + title: TranslationBase.of(context).cancel, + fontColor: Colors.white, + color: Colors.red[600], + ), + ], + ), + ], + ), + ); + }); + } + + static showCupertinoPicker(context, List items, + decKey, onSelectFun, AuthenticationViewModel model) { showModalBottomSheet( isDismissible: false, context: context, @@ -62,8 +106,8 @@ class Helpers { Container( height: SizeConfig.realScreenHeight * 0.3, color: Color(0xfff7f7f7), - child: - buildPickerItems(context, items, decKey, onSelectFun)) + child: buildPickerItems( + context, items, decKey, onSelectFun, model)) ], ), ); @@ -73,14 +117,15 @@ class Helpers { static TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor); - static buildPickerItems(context, List items, decKey, onSelectFun) { + static buildPickerItems(context, List items, + decKey, onSelectFun, model) { return CupertinoPicker( magnification: 1.5, scrollController: FixedExtentScrollController(initialItem: cupertinoPickerIndex), children: items.map((item) { return Text( - '${item["$decKey"]}', + '${item.facilityName}', style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), ); }).toList(), @@ -130,6 +175,7 @@ class Helpers { } static generateContactAdminMsg([err = null]) { + //TODO: Add translation String localMsg = 'Something wrong happened, please contact the admin'; if (err != null) { localMsg = localMsg + '\n \n' + err.toString(); @@ -141,20 +187,6 @@ class Helpers { await sharedPref.clear(); } - static logout() async { - DEVICE_TOKEN = ""; - String lang = await sharedPref.getString(APP_Language); - await clearSharedPref(); - sharedPref.setString(APP_Language, lang); - ProjectViewModel().isLogin = false; - Navigator.pushAndRemoveUntil( - AppGlobal.CONTEX, - FadePage( - page: Loginsreen(), - ), - (r) => false); - } - navigateToUpdatePage(String message, String androidLink, iosLink) { Navigator.pushAndRemoveUntil( AppGlobal.CONTEX, @@ -233,4 +265,16 @@ class Helpers { return str; } } + + static bool isTextHtml(String text) { + var htmlRegex = RegExp("<(“[^”]*”|'[^’]*’|[^'”>])*>"); + return htmlRegex.hasMatch(text); + } + + static String timeFrom({Duration duration}) { + String twoDigits(int n) => n.toString().padLeft(2, "0"); + String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60)); + String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60)); + return "$twoDigitMinutes:$twoDigitSeconds"; + } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c95fbd2f..165a9bb5 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -18,6 +18,8 @@ class TranslationBase { String get settings => localizedValues['settings'][locale.languageCode]; + String get areYouSureYouWantTo => localizedValues['areYouSureYouWantTo'][locale.languageCode]; + String get language => localizedValues['language'][locale.languageCode]; String get lanEnglish => localizedValues['lanEnglish'][locale.languageCode]; @@ -68,8 +70,8 @@ class TranslationBase { String get outPatients => localizedValues['outPatients'][locale.languageCode]; - String get searchPatient => - localizedValues['searchPatient'][locale.languageCode]; + String get searchPatient => localizedValues['searchPatient'][locale.languageCode]; + String get searchPatientDashBoard => localizedValues['searchPatientDashBoard'][locale.languageCode]; String get searchPatientName => localizedValues['searchPatient-name'][locale.languageCode]; @@ -100,6 +102,7 @@ class TranslationBase { String get referral => localizedValues['referral'][locale.languageCode]; String get inPatient => localizedValues['inPatient'][locale.languageCode]; + String get myInPatient => localizedValues['myInPatient'][locale.languageCode]; String get inPatientLabel => localizedValues['inPatientLabel'][locale.languageCode]; @@ -111,8 +114,8 @@ class TranslationBase { String get patientServices => localizedValues['patientServices'][locale.languageCode]; - String get searchMedicine => - localizedValues['searchMedicine'][locale.languageCode]; + String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; + String get searchMedicineDashboard => localizedValues['searchMedicineDashboard'][locale.languageCode]; String get myReferralPatient => localizedValues['myReferralPatient'][locale.languageCode]; @@ -398,8 +401,8 @@ class TranslationBase { String get outPatient => localizedValues['outPatients'][locale.languageCode]; - String get myOutPatient => - localizedValues['myOutPatient'][locale.languageCode]; + String get myOutPatient => localizedValues['myOutPatient'][locale.languageCode]; + String get myOutPatient_2lines => localizedValues['myOutPatient_2lines'][locale.languageCode]; String get logout => localizedValues['logout'][locale.languageCode]; @@ -940,6 +943,8 @@ class TranslationBase { String get verifySMS => localizedValues['verify-with-sms'][locale.languageCode]; + String get verifyWith => + localizedValues['verify-with'][locale.languageCode]; String get verifyWhatsApp => localizedValues['verify-with-whatsapp'][locale.languageCode]; @@ -1030,6 +1035,8 @@ class TranslationBase { String get addSelectedProcedures => localizedValues['addSelectedProcedures'][locale.languageCode]; + String get addProcedures => + localizedValues['addProcedures'][locale.languageCode]; String get updateProcedure => localizedValues['updateProcedure'][locale.languageCode]; @@ -1159,6 +1166,8 @@ class TranslationBase { String get patientsreferral => localizedValues['ptientsreferral'][locale.languageCode]; + String get myPatientsReferral => + localizedValues['myPatientsReferral'][locale.languageCode]; String get arrivalpatient => localizedValues['arrivalpatient'][locale.languageCode]; String get searchmedicinepatient => @@ -1331,6 +1340,31 @@ class TranslationBase { String get medicalReportAdd => localizedValues['medicalReportAdd'][locale.languageCode]; String get medicalReportVerify => localizedValues['medicalReportVerify'][locale.languageCode]; String get comments => localizedValues['comments'][locale.languageCode]; + String get initiateCall => localizedValues['initiateCall'][locale.languageCode]; + String get endCall => localizedValues['endCall'][locale.languageCode]; + + String get transferTo => localizedValues['transferTo'][locale.languageCode]; + String get admin => localizedValues['admin'][locale.languageCode]; + String get instructions => localizedValues['instructions'][locale.languageCode]; + String get sendLC => localizedValues['sendLC'][locale.languageCode]; + String get endLC => localizedValues['endLC'][locale.languageCode]; + String get consultation => localizedValues['consultation'][locale.languageCode]; + String get resume => localizedValues['resume'][locale.languageCode]; + String get theCall => localizedValues['theCall'][locale.languageCode]; + String get createNewMedicalReport => localizedValues['createNewMedicalReport'][locale.languageCode]; + String get historyPhysicalFinding => localizedValues['historyPhysicalFinding'][locale.languageCode]; + String get laboratoryPhysicalData => localizedValues['laboratoryPhysicalData'][locale.languageCode]; + String get impressionRecommendation => localizedValues['impressionRecommendation'][locale.languageCode]; + String get onHold => localizedValues['onHold'][locale.languageCode]; + String get verified => localizedValues['verified'][locale.languageCode]; + String get favoriteTemplates => localizedValues['favoriteTemplates'][locale.languageCode]; + String get allProcedures => localizedValues['allProcedures'][locale.languageCode]; + String get allRadiology => localizedValues['allRadiology'][locale.languageCode]; + String get allLab => localizedValues['allLab'][locale.languageCode]; + String get allPrescription => localizedValues['allPrescription'][locale.languageCode]; + String get addPrescription => localizedValues['addPrescription'][locale.languageCode]; + String get edit => localizedValues['edit'][locale.languageCode]; + String get summeryReply => localizedValues['summeryReply'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/auth/auth_header.dart b/lib/widgets/auth/auth_header.dart deleted file mode 100644 index f84e9425..00000000 --- a/lib/widgets/auth/auth_header.dart +++ /dev/null @@ -1,198 +0,0 @@ -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:hexcolor/hexcolor.dart'; - -import '../../config/size_config.dart'; -import '../../lookups/auth_lookup.dart'; - -class AuthHeader extends StatelessWidget { - var userType; - AuthHeader(this.userType); - - @override - Widget build(BuildContext context) { - var screen = Container( - margin: SizeConfig.isMobile - ? null - : EdgeInsetsDirectional.fromSTEB(SizeConfig.realScreenWidth * 0.30, - SizeConfig.realScreenWidth * 0.1, 0, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Container( - // margin: SizeConfig.isMobile - // ? EdgeInsetsDirectional.fromSTEB( - // 0, SizeConfig.realScreenHeight * 0.03, 0, 0) - // : EdgeInsetsDirectional.fromSTEB( - // SizeConfig.realScreenWidth * 0.13, 0, 0, 0), - // child: buildImageLogo(), - // ), - SizedBox( - height: 30, - ), - //buildTextUnderLogo(context), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: SizeConfig.isMobile - ? [ - SizedBox( - height: 10, - ), - buildWelText(context), - buildDrSulText(context), - ] - : [ - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - buildWelText(context), - buildDrSulText(context), - ], - ), - ], - ), - buildDrAppContainer(context) - ], - )); - return screen; - } - - Image buildImageLogo() { - String img = 'assets/images/dr_app_logo.png'; - return Image.asset( - img, - fit: BoxFit.cover, - height: SizeConfig.isMobile ? null : SizeConfig.realScreenWidth * 0.09, - ); - } - - Widget buildTextUnderLogo(context) { - Widget finalWid; - double textFontSize = - SizeConfig.isMobile ? 30 : SizeConfig.textMultiplier * 3; - EdgeInsetsDirectional containerMargin; - if (userType == loginType.knownUser || userType == loginType.unknownUser) { - finalWid = Text( - TranslationBase.of(context).login, - style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800), - ); - } else { - String text1; - String text2; - if (userType == loginType.changePassword) { - text1 = 'Change '; - text2 = 'Password!'; - } - if (userType == loginType.verifyPassword) { - text1 = TranslationBase.of(context).verify1; - text2 = TranslationBase.of(context).yourAccount; - } - if (userType == loginType.verificationMethods) { - text1 = TranslationBase.of(context).choose; - text2 = TranslationBase.of(context).verification; - } - List childrens = [ - Text( - text1, - style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800), - ), - Text( - text2, - style: TextStyle( - color: HexColor('#B8382C'), - fontSize: textFontSize, - fontWeight: FontWeight.w800), - ) - ]; - - if (!SizeConfig.isMobile) { - finalWid = Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: childrens, - ); - } else { - finalWid = Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: childrens, - ); - } - } - if (!SizeConfig.isMobile) { - double start = SizeConfig.realScreenWidth * 0.13; - if (loginType.verifyPassword == userType || - loginType.changePassword == userType || - userType == loginType.verificationMethods) { - start = 0; - } - containerMargin = EdgeInsetsDirectional.fromSTEB(start, 0, 0, 0); - } - - return Container(margin: containerMargin, child: finalWid); - } - - Container buildDrAppContainer(BuildContext context) { - if (userType == loginType.changePassword || - userType == loginType.verifyPassword || - userType == loginType.verificationMethods) { - return Container(); - } - return Container( - // margin: SizeConfig.isMobile - // ? null - // : EdgeInsetsDirectional.fromSTEB( - // SizeConfig.realScreenWidth * 0.13, 0, 0, 0), - child: Text( - "Doctor App", - style: TextStyle( - fontSize: - SizeConfig.isMobile ? 16 : SizeConfig.realScreenWidth * 0.030, - fontWeight: FontWeight.w800, - color: HexColor('#B8382C')), - ), - ); - } - - Text buildDrSulText(BuildContext context) { - if (userType == loginType.changePassword || - userType == loginType.verifyPassword || - userType == loginType.verificationMethods) { - return Text(''); - } - return Text( - TranslationBase.of(context).drSulaimanAlHabib, - style: TextStyle( - fontWeight: FontWeight.w800, - fontSize: - SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029, - fontFamily: 'Poppins'), - ); - } - - Widget buildWelText(BuildContext context) { - String text = TranslationBase.of(context).welcomeTo; - if (userType == loginType.unknownUser) { - text = TranslationBase.of(context).welcomeBackTo; - } - if (userType == loginType.changePassword || - userType == loginType.verifyPassword || - userType == loginType.verificationMethods) { - return Text(''); - } - return AppText( - text, - // style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - ); - } -} diff --git a/lib/widgets/auth/change_password.dart b/lib/widgets/auth/change_password.dart deleted file mode 100644 index 3eb9b975..00000000 --- a/lib/widgets/auth/change_password.dart +++ /dev/null @@ -1,159 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - -class ChangePassword extends StatelessWidget { - final changePassFormKey = GlobalKey(); - var changePassFormValues = { - 'currentPass': null, - 'newPass': null, - 'repeatedPass': null - }; - - @override - Widget build(BuildContext context) { - return Form( - key: changePassFormKey, - child: Container( - width: SizeConfig.realScreenWidth * 0.90, - child: - Column(crossAxisAlignment: CrossAxisAlignment.start, children: < - Widget>[ - buildSizedBox(), - TextFormField( - keyboardType: TextInputType.number, - decoration: InputDecoration( - // ts/images/password_icon.png - prefixIcon: Image.asset('assets/images/password_icon.png'), - hintText: 'Current Password', - hintStyle: - TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: HexColor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: - BorderSide(color: Theme.of(context).primaryColor), - ) - //BorderRadius.all(Radius.circular(20)); - ), - validator: (value) { - if (value.isEmpty) { - return 'Please enter your Current Password'; - } - return null; - }, - onSaved: (value) { - // changePassFormValues. = value; - }, - ), - buildSizedBox(40), - // buildSizedBox(), - Text( - "New Password", - style: TextStyle( - fontSize: 2.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w800), - ), - buildSizedBox(10.0), - // Text() - TextFormField( - keyboardType: TextInputType.number, - decoration: InputDecoration( - // ts/images/password_icon.png - prefixIcon: Image.asset('assets/images/password_icon.png'), - hintText: 'New Password', - hintStyle: - TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: HexColor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: - BorderSide(color: Theme.of(context).primaryColor), - ) - //BorderRadius.all(Radius.circular(20)); - ), - validator: (value) { - if (value.isEmpty) { - return 'Please enter your New Password'; - } - return null; - }, - onSaved: (value) { - // userInfo.UserID = value; - }, - ), - buildSizedBox(), - TextFormField( - keyboardType: TextInputType.number, - decoration: InputDecoration( - prefixIcon: Image.asset('assets/images/password_icon.png'), - hintText: 'Repeat Password', - hintStyle: - TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: HexColor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: - BorderSide(color: Theme.of(context).primaryColor), - ) - //BorderRadius.all(Radius.circular(20)); - ), - validator: (value) { - if (value.isEmpty) { - return 'Please enter your Repeat Password'; - } - return null; - }, - onSaved: (value) { - // userInfo.UserID = value; - }, - ), - buildSizedBox(), - RaisedButton( - onPressed:changePass, - elevation: 0.0, - child: Container( - width: double.infinity, - height: 50, - child: Center( - child: Text( - 'Change Password' - .toUpperCase(), - // textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 2.5 * SizeConfig.textMultiplier), - ), - ), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), - ), - SizedBox( - height: 10, - ), - ]))); - } - - SizedBox buildSizedBox([double height = 20]) { - return SizedBox( - height: height, - ); - } - changePass(){ - if(changePassFormKey.currentState.validate()){ - changePassFormKey.currentState.save(); - // call Api - } - } -} diff --git a/lib/widgets/auth/known_user_login.dart b/lib/widgets/auth/known_user_login.dart deleted file mode 100644 index cbf3c71a..00000000 --- a/lib/widgets/auth/known_user_login.dart +++ /dev/null @@ -1,328 +0,0 @@ -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:local_auth/error_codes.dart' as auth_error; -import 'package:local_auth/local_auth.dart'; -import 'package:provider/provider.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import '../../config/size_config.dart'; -import '../../core/viewModel/auth_view_model.dart'; -import '../../routes.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../util/dr_app_toast_msg.dart'; -import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; - -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - -class KnownUserLogin extends StatefulWidget { - @override - _KnownUserLoginState createState() => _KnownUserLoginState(); -} - -class _KnownUserLoginState extends State { - Future _prefs = SharedPreferences.getInstance(); - final LocalAuthentication auth = LocalAuthentication(); - - String _authorized = "not Authorized"; - bool _isAuthenticating = false; - Future _loggedUserFuture; - var _loggedUser; - int _loginType = 1; - String _platformImei; - Future _loginTypeFuture; - - Map _loginTypeMap = { - 1: { - "name": "SMS", - 'imageUrl': 'assets/images/verification_sms_lg_icon.png', - }, - 2: { - "name": "FingerPrint", - 'imageUrl': 'assets/images/verification_fingerprint_lg_icon.png' - }, - 3: { - "name": "Face", - 'imageUrl': 'assets/images/verification_faceid_lg_icon.png' - }, - 4: { - "name": "WhatsApp", - 'imageUrl': 'assets/images/verification_whatsapp_lg_icon.png' - } - }; - - Future getSharedPref() async { - sharedPref.getObj(LOGGED_IN_USER).then((userInfo) { - _loggedUser = userInfo; - }); - sharedPref.getString('platformImei').then((imei) { - _platformImei = imei; - }); - } - - @override - void initState() { - super.initState(); - _loggedUserFuture = getSharedPref(); - } - - @override - Widget build(BuildContext context) { - AuthViewModel authProv = Provider.of(context); - // var imeiModel = {'IMEI': _platformImei}; - // _loginTypeFuture = authProv.selectDeviceImei(imeiModel); - return FutureBuilder( - future: Future.wait([_loggedUserFuture, _loginTypeFuture]), - builder: (BuildContext context, AsyncSnapshot snapshot) { - _loginTypeFuture.then((res) { - _loginType = - 2; //res['SELECTDeviceIMEIbyIMEI_List'][0]['LogInType']; - }).catchError((err) { - print('${err}'); - DrAppToastMsg.showErrorToast(err); - }); - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return DrAppCircularProgressIndeicator(); - default: - if (snapshot.hasError) { - DrAppToastMsg.showErrorToast('Error: ${snapshot.error}'); - return Text('Error: ${snapshot.error}'); - } else { - return Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Stack(children: [ - Container( - decoration: BoxDecoration( - border: Border.all( - color: HexColor('#CCCCCC'), - ), - borderRadius: BorderRadius.circular(50)), - margin: const EdgeInsets.fromLTRB(0, 20.0, 30, 0), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 100, - width: 100, - decoration: new BoxDecoration( - // color: Colors.green, // border color - shape: BoxShape.circle, - border: - Border.all(color: HexColor('#CCCCCC'))), - child: CircleAvatar( - child: Image.asset( - 'assets/images/dr_avatar.png', - fit: BoxFit.cover, - ), - )), - Container( - margin: EdgeInsets.symmetric( - vertical: 3, horizontal: 15), - child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _loggedUser['List_MemberInformation'][0] - ['MemberName'], - style: TextStyle( - color: HexColor('515A5D'), - fontSize: - 2.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w800), - ), - Text( - 'ENT Spec', - style: TextStyle( - color: HexColor('515A5D'), - fontSize: - 1.5 * SizeConfig.textMultiplier), - ) - ], - ), - ) - ], - ), - ), - Positioned( - top: 7, - right: 70, - child: Image.asset( - 'assets/images/close_icon.png', - fit: BoxFit.cover, - )) - ]), - buildVerificationTypeImageContainer(), - buildButtonsContainer(context) - ], - ); - } - } - }); - } - - Container buildVerificationTypeImageContainer() { - print('${_loginTypeMap[_loginType]}'); - return Container( - height: 200, - width: 200, - child: Center( - child: Image.asset( - _loginTypeMap[_loginType]['imageUrl'], - fit: BoxFit.cover, - ), - )); - } - - // - Container buildButtonsContainer(BuildContext context) { - return Container( - margin: EdgeInsetsDirectional.fromSTEB(0, 0, 30, 0), - width: double.infinity, - child: Column( - children: [ - RaisedButton( - onPressed: _authenticate, - elevation: 0.0, - child: Container( - width: double.infinity, - height: 50, - child: Center( - child: Text( - "Verify using ${_loginTypeMap[_loginType]['name']}" - .toUpperCase(), - // textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 2.5 * SizeConfig.textMultiplier), - ), - ), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), - ), - SizedBox( - height: 10, - ), - Container( - width: double.infinity, - height: 50, - child: FlatButton( - onPressed: () { - navigateToMoreOption(); - }, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, color: Theme.of(context).primaryColor)), - child: Text( - "More verification Options".toUpperCase(), - style: TextStyle( - color: Theme.of(context).primaryColor, - fontSize: 2.5 * SizeConfig.textMultiplier), - )), - ), - SizedBox( - height: 20, - ), - ], - ), - ); - } - - navigateToMoreOption() { - Navigator.of(context).pushNamed(VERIFICATION_METHODS); - } - - _authenticate() { - if (_loginType == 1) { - _authenticateBySMS(); - } - if (_loginType == 2) { - _authenticateByFingerPrint(); - } - if (_loginType == 3) { - _authenticateByFace(); - } - if (_loginType == 4) { - _authenticateByWhatsApp(); - } - } - - Future _authenticateByFingerPrint() async { - _getAvailableBiometrics(); - bool authenticated = false; - try { - setState(() { - _isAuthenticating = true; - _authorized = 'Authenticating'; - }); - authenticated = await auth.authenticateWithBiometrics( - localizedReason: 'Scan your fingerprint to authenticate', - useErrorDialogs: true, - stickyAuth: false); - setState(() { - _isAuthenticating = false; - _authorized = 'Authenticating'; - }); - } on PlatformException catch (e) { - print(e); - } - if (!mounted) return; - - final String message = authenticated ? 'Authorized' : 'Not Authorized'; - if (message == 'Authorized') { - navigateToHome(); - } - setState(() { - print('_authorized' + _authorized); - _authorized = message; - print('_authorized' + _authorized); - }); - } - - Future _authenticateBySMS() { - print('_authenticateBySMS'); - } - - Future _authenticateByFace() { - print('_authenticateByFace'); - } - - Future _authenticateByWhatsApp() { - print('_authenticateByWhatsApp'); - } - - Future _getAvailableBiometrics() async { - List availableBiometrics; - try { - availableBiometrics = await auth.getAvailableBiometrics(); - } on PlatformException catch (e) { - print(e); - if (e.code == auth_error.notAvailable) { - showErorrMsg("Auth Methods Not Available"); - } else if (e.code == auth_error.passcodeNotSet) { - showErorrMsg("Auth Methods Not passcodeNotSet"); - } else if (e.code == auth_error.permanentlyLockedOut) { - showErorrMsg("Auth Methods Not permanentlyLockedOut"); - } - } - if (!mounted) return; - - setState(() { - print('availableBiometrics $availableBiometrics'); - }); - } - - navigateToHome() { - Navigator.of(context).pushReplacementNamed(HOME); - } - - showErorrMsg(localMsg) { - DrAppToastMsg.showErrorToast(localMsg); - } -} diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart deleted file mode 100644 index a2c200cb..00000000 --- a/lib/widgets/auth/login_form.dart +++ /dev/null @@ -1,312 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; -import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; - -import '../../config/shared_pref_kay.dart'; -import '../../config/size_config.dart'; -import '../../core/viewModel/hospital_view_model.dart'; -import '../../models/doctor/user_model.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../util/dr_app_toast_msg.dart'; -import '../../util/helpers.dart'; - -DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); -DrAppToastMsg toastMsg = DrAppToastMsg(); -Helpers helpers = Helpers(); - -class LoginForm extends StatefulWidget with DrAppToastMsg { - LoginForm({this.model}); - - final IMEIViewModel model; - - @override - _LoginFormState createState() => _LoginFormState(); -} - -class _LoginFormState extends State { - final loginFormKey = GlobalKey(); - var projectIdController = TextEditingController(); - var projectsList = []; - FocusNode focusPass = FocusNode(); - FocusNode focusProject = FocusNode(); - HospitalViewModel projectsProv; - var userInfo = UserModel(); - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - projectsProv = Provider.of(context); - return Form( - key: loginFormKey, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: SizeConfig.realScreenWidth * 0.90, - height: SizeConfig.realScreenHeight * 0.65, - child: - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - buildSizedBox(), - Padding( - child: AppText( - TranslationBase.of(context).enterCredentials, - fontSize: 18, - fontWeight: FontWeight.bold, - ), - padding: EdgeInsets.only(top: 10, bottom: 10)), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).enterId, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - labelText: '', - borderColor: Colors.white, - // keyboardType: TextInputType.number, - textInputAction: TextInputAction.next, - - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterYourID; - } - return null; - }, - onSaved: (value) { - if (value != null) userInfo.userID = value.trim(); - }, - onChanged: (value) { - if (value != null) userInfo.userID = value.trim(); - }, - onFieldSubmitted: (_) { - focusPass.nextFocus(); - }, - ) - ])), - buildSizedBox(), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).enterPassword, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - focusNode: focusPass, - obscureText: true, - borderColor: Colors.white, - textInputAction: TextInputAction.next, - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterPassword; - } - return null; - }, - onSaved: (value) { - userInfo.password = value; - }, - onFieldSubmitted: (_) { - focusPass.nextFocus(); - Helpers.showCupertinoPicker(context, projectsList, - 'facilityName', onSelectProject); - }, - onTap: () { - this.getProjects(userInfo.userID); - }, - ) - ])), - buildSizedBox(), - projectsList.length > 0 - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).selectYourProject, - fontWeight: FontWeight.w600, - )), - AppTextFormField( - focusNode: focusProject, - controller: projectIdController, - borderColor: Colors.white, - suffixIcon: Icons.arrow_drop_down, - onTap: () { - Helpers.showCupertinoPicker( - context, - projectsList, - 'facilityName', - onSelectProject); - }, - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterYourProject; - } - return null; - }) - ])) - : Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).selectYourProject, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - readOnly: true, - borderColor: Colors.white, - prefix: IconButton( - icon: Icon(Icons.arrow_drop_down), - iconSize: 30, - padding: EdgeInsets.only(bottom: 30), - ), - ) - ])), - ]), - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).login, - color: HexColor('#D02127'), - fontWeight: FontWeight.bold, - onPressed: () { - login(context, this.widget.model); - }, - )), - ], - ) - ], - ), - ); - //)); - } - - SizedBox buildSizedBox() { - return SizedBox( - height: 20, - ); - } - - login( - context, - model, - ) { - if (loginFormKey.currentState.validate()) { - loginFormKey.currentState.save(); - sharedPref.setInt(PROJECT_ID, userInfo.projectID); - model.login(userInfo).then((res) { - if (model.loginInfo['MessageStatus'] == 1) { - saveObjToString(LOGGED_IN_USER, model.loginInfo); - sharedPref.remove(LAST_LOGIN_USER); - sharedPref.setString(TOKEN, model.loginInfo['LogInTokenID']); - Navigator.of(AppGlobal.CONTEX).pushReplacement(MaterialPageRoute( - builder: (BuildContext context) => VerificationMethodsScreen( - password: userInfo.password, - ))); - } - }); - } - } - - Future setSharedPref(key, value) async { - sharedPref.setString(key, value).then((success) { - print("sharedPref.setString" + success.toString()); - }); - } - - getProjectsList(memberID) { - projectsProv.getProjectsList(memberID).then((res) { - if (res['MessageStatus'] == 1) { - projectsList = res['ProjectInfo']; - setState(() { - userInfo.projectID = projectsList[0]["facilityId"]; - projectIdController.text = projectsList[0]['facilityName']; - }); - } else { - print(res); - } - }); - } - - saveObjToString(String key, value) async { - sharedPref.setObj(key, value); - } - - onSelectProject(index) { - setState(() { - userInfo.projectID = projectsList[index]["facilityId"]; - projectIdController.text = projectsList[index]['facilityName']; - }); - - primaryFocus.unfocus(); - } - - getProjects(value) { - if (value != null && value != '') { - if (projectsList.length == 0) { - getProjectsList(value); - } - } - } -} diff --git a/lib/widgets/auth/method_type_card.dart b/lib/widgets/auth/method_type_card.dart new file mode 100644 index 00000000..6d091756 --- /dev/null +++ b/lib/widgets/auth/method_type_card.dart @@ -0,0 +1,62 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class MethodTypeCard extends StatelessWidget { + const MethodTypeCard({ + Key key, + this.assetPath, + this.onTap, + this.label, this.height = 20, + }) : super(key: key); + final String assetPath; + final Function onTap; + final String label; + final double height; + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onTap, + child: Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), + ), + border: Border.all( + color: HexColor('#707070'), + width: 0.1), + ), + height: 170, + child: Padding( + padding: EdgeInsets.fromLTRB(20, 15, 20, 15), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + assetPath, + height: 60, + width: 60, + ), + ], + ), + SizedBox( + height:height , + ), + AppText( + label, + fontSize: 14, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + ) + ], + ), + )), + ); + } +} diff --git a/lib/widgets/auth/show_timer_text.dart b/lib/widgets/auth/show_timer_text.dart deleted file mode 100644 index a418e1b5..00000000 --- a/lib/widgets/auth/show_timer_text.dart +++ /dev/null @@ -1,105 +0,0 @@ -import 'dart:async'; - -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; -import 'package:doctor_app_flutter/routes.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; -Helpers helpers = Helpers(); - -class ShowTimerText extends StatefulWidget { - ShowTimerText({Key key, this.model}); - final model; - - @override - _ShowTimerTextState createState() => _ShowTimerTextState(); -} - -class _ShowTimerTextState extends State { - String timerText = (TIMER_MIN - 1).toString() + ':59'; - int min = TIMER_MIN - 1; - int sec = 59; - Timer _timer; - - AuthViewModel authProv; - - resendCode() { - min = TIMER_MIN - 1; - sec = 59; - _timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { - if (min <= 0 && sec <= 0) { - timer.cancel(); - } else { - setState(() { - sec = sec - 1; - if (sec == 0 && min == 0) { - Navigator.of(context).pushNamed(LOGIN); - - min = 0; - sec = 0; - } else if (sec == 0) { - min = min - 1; - sec = 59; - } - timerText = min.toString() + ':' + sec.toString(); - }); - } - }); - } - - @override - void initState() { - super.initState(); - resendCode(); - } - - @override - void dispose() { - _timer.cancel(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - authProv = Provider.of(context); - return Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: min != 0 || sec != 0 - ? null - : () { - resendActivatioinCode(); - }, - child: Text( - timerText, - style: TextStyle( - fontSize: 3.0 * SizeConfig.textMultiplier, - color: HexColor('#B8382C'), - fontWeight: FontWeight.bold), - ), - ), - ], - ), - ); - } - - resendActivatioinCode() { - authProv - .sendActivationCodeByOtpNotificationType(widget.model) - .then((res) => { - // print('$value') - if (res['MessageStatus'] == 1) - {resendCode()} - else - {Helpers.showErrorToast(res['ErrorEndUserMessage'])} - }) - .catchError((err) { - Helpers.showErrorToast(); - }); - } -} diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/auth/sms-popup.dart similarity index 92% rename from lib/widgets/otp/sms-popup.dart rename to lib/widgets/auth/sms-popup.dart index 0c34e67d..0c374e58 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/auth/sms-popup.dart @@ -1,15 +1,16 @@ import 'dart:async'; +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - class SMSOTP { - final type; + final AuthMethodTypes type; final mobileNo; final Function onSuccess; final Function onFailure; @@ -17,12 +18,6 @@ class SMSOTP { int remainingTime = 600; - Future timer; - - static BuildContext _context; - - static bool _loading; - SMSOTP( this.context, this.type, @@ -60,9 +55,6 @@ class SMSOTP { projectProvider = Provider.of(context); return AlertDialog( contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 0.0, 24.0), - - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.all(Radius.circular(10.0))), content: StatefulBuilder(builder: (context, setState) { if (displayTime == '') { startTimer(setState); @@ -81,7 +73,7 @@ class SMSOTP { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - type == 1 + type == AuthMethodTypes.SMS ? Padding( child: Icon( DoctorApp.verify_sms_1, @@ -287,8 +279,6 @@ class SMSOTP { InputDecoration buildInputDecoration(BuildContext context) { return InputDecoration( counterText: " ", - // ts/images/password_icon.png - // contentPadding: EdgeInsets.only(top: 20, bottom: 20), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.grey[300]), @@ -308,6 +298,7 @@ class SMSOTP { ); } + // ignore: missing_return String validateCodeDigit(value) { if (value.isEmpty) { return ' '; @@ -318,13 +309,14 @@ class SMSOTP { } } - checkValue() { - //print(verifyAccountFormValue); + checkValue() async { if (verifyAccountForm.currentState.validate()) { onSuccess(digit1.text.toString() + digit2.text.toString() + digit3.text.toString() + digit4.text.toString()); + this.isClosed = true; + } } @@ -349,42 +341,14 @@ class SMSOTP { displayTime = this.getSecondsAsDigitalClock(this.remainingTime); }); - timer = Future.delayed(Duration(seconds: 1), () { + Future.delayed(Duration(seconds: 1), () { if (this.remainingTime > 0) { - if (isClosed == false) startTimer(setState); + if (isClosed == false) { + startTimer(setState); + } } else { Navigator.pop(context); } }); } - - static void showLoadingDialog(BuildContext context, bool _loading) async { - _context = context; - - if (_loading == false) { - Navigator.of(context).pop(); - return; - } - _loading = true; - await showDialog( - context: _context, - barrierDismissible: false, - builder: (BuildContext context) { - return SimpleDialog( - elevation: 0.0, - backgroundColor: Colors.transparent, - children: [ - Center( - child: CircularProgressIndicator( - valueColor: AlwaysStoppedAnimation(Colors.black), - ), - ) - ], - ); - }); - } - - static void hideSMSBox(context) { - Navigator.pop(context); - } } diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart deleted file mode 100644 index 1574d3d4..00000000 --- a/lib/widgets/auth/verfiy_account.dart +++ /dev/null @@ -1,386 +0,0 @@ -import 'dart:async'; - -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; -import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; -import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/auth/show_timer_text.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; - -import '../../config/size_config.dart'; -import '../../core/viewModel/auth_view_model.dart'; -import '../../routes.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../util/dr_app_toast_msg.dart'; -import '../../util/helpers.dart'; -import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; - -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -Helpers helpers = Helpers(); - -class VerifyAccount extends StatefulWidget { - VerifyAccount({this.changeLoadingStata}); - - final Function changeLoadingStata; - - @override - _VerifyAccountState createState() => _VerifyAccountState(); -} - -class _VerifyAccountState extends State { - final verifyAccountForm = GlobalKey(); - Map verifyAccountFormValue = { - 'digit1': null, - 'digit2': null, - 'digit3': null, - 'digit4': null, - }; - Future _loggedUserFuture; - var _loggedUser; - AuthViewModel authProv; - bool _isInit = true; - var model; - TextEditingController digit1 = TextEditingController(text: ""); - TextEditingController digit2 = TextEditingController(text: ""); - TextEditingController digit3 = TextEditingController(text: ""); - TextEditingController digit4 = TextEditingController(text: ""); - - @override - void initState() { - super.initState(); - _loggedUserFuture = getSharedPref(); - } - - Future getSharedPref() async { - sharedPref.getObj(LOGGED_IN_USER).then((userInfo) { - _loggedUser = userInfo; - }); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - if (_isInit) { - authProv = Provider.of(context); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - model = routeArgs['model']; - } - _isInit = false; - } - - @override - Widget build(BuildContext context) { - authProv = Provider.of(context); - final focusD1 = FocusNode(); - final focusD2 = FocusNode(); - final focusD3 = FocusNode(); - final focusD4 = FocusNode(); - return FutureBuilder( - future: Future.wait([_loggedUserFuture]), - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return DrAppCircularProgressIndeicator(); - default: - if (snapshot.hasError) { - DrAppToastMsg.showErrorToast('Error: ${snapshot.error}'); - return Text('Error: ${snapshot.error}'); - } else { - return Form( - key: verifyAccountForm, - child: Container( - width: SizeConfig.realScreenWidth * 0.95, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - buildSizedBox(30), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Container( - width: SizeConfig.realScreenWidth * 0.20, - child: TextFormField( - textInputAction: TextInputAction.next, - style: buildTextStyle(), - autofocus: true, - maxLength: 1, - controller: digit1, - textAlign: TextAlign.center, - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) { - verifyAccountFormValue['digit1'] = val; - }, - validator: validateCodeDigit, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD2); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD2); - } - }, - ), - ), - Container( - width: SizeConfig.realScreenWidth * 0.20, - child: TextFormField( - focusNode: focusD2, - controller: digit2, - textInputAction: TextInputAction.next, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onSaved: (val) { - verifyAccountFormValue['digit2'] = - val; - }, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD3); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD3); - } - }, - validator: validateCodeDigit), - ), - Container( - width: SizeConfig.realScreenWidth * 0.20, - child: TextFormField( - focusNode: focusD3, - controller: digit3, - textInputAction: TextInputAction.next, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onSaved: (val) { - verifyAccountFormValue['digit3'] = - val; - }, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD4); - } - }, - validator: validateCodeDigit)), - Container( - width: SizeConfig.realScreenWidth * 0.20, - child: TextFormField( - focusNode: focusD4, - controller: digit4, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onSaved: (val) { - verifyAccountFormValue['digit4'] = - val; - }, - validator: validateCodeDigit)) - ], - ), - buildSizedBox(20), - buildText(), - buildSizedBox(40), - RaisedButton( - onPressed: () { - verifyAccount( - authProv, widget.changeLoadingStata); - }, - elevation: 0.0, - child: Container( - width: double.infinity, - height: 50, - child: Center( - child: Text( - TranslationBase.of(context).verify, - style: TextStyle( - color: Colors.white, - fontSize: - 3 * SizeConfig.textMultiplier), - ), - ), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 0.5, - color: HexColor('#CCCCCC'))), - ), - buildSizedBox(20), - ShowTimerText(model: model), - buildSizedBox(10), - ]))); - } - } - }); - } - - TextStyle buildTextStyle() { - return TextStyle( - fontSize: SizeConfig.textMultiplier * 3, - ); - } - - String validateCodeDigit(value) { - if (value.isEmpty) { - return 'Please enter your Password'; - } - - return null; - } - - InputDecoration buildInputDecoration(BuildContext context) { - return InputDecoration( - contentPadding: EdgeInsets.only(top: 30, bottom: 30), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10)), - borderSide: BorderSide(color: Colors.black), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).primaryColor), - ), - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).errorColor), - ), - focusedErrorBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).errorColor), - ), - ); - } - - RichText buildText() { - String medthodName; - switch (model['OTP_SendType']) { - case 1: - medthodName = TranslationBase.of(context).smsBy; - break; - case 2: - medthodName = TranslationBase.of(context).whatsAppBy; - break; - default: - } - var text = RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 3.0 * SizeConfig.textMultiplier, color: Colors.black), - children: [ - new TextSpan(text: TranslationBase.of(context).youWillReceiveA), - new TextSpan( - text: TranslationBase.of(context).loginCode, - style: TextStyle(fontWeight: FontWeight.w700)), - new TextSpan(text: ' ${medthodName},'), - TextSpan(text: TranslationBase.of(context).pleaseEnterTheCode) - ])); - return text; - } - - SizedBox buildSizedBox([double height = 20]) { - return SizedBox( - height: height, - ); - } - - verifyAccount(AuthViewModel authProv, Function changeLoadingStata) async { - if (verifyAccountForm.currentState.validate()) { - changeLoadingStata(true); - - verifyAccountForm.currentState.save(); - final activationCode = verifyAccountFormValue['digit1'] + - verifyAccountFormValue['digit2'] + - verifyAccountFormValue['digit3'] + - verifyAccountFormValue['digit4']; - - CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = - new CheckActivationCodeRequestModel( - zipCode: _loggedUser['ZipCode'], - mobileNumber: _loggedUser['MobileNumber'], - projectID: await sharedPref.getInt(PROJECT_ID), - logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), - activationCode: activationCode, - generalid: "Cs2020@2016\$2958"); - - authProv - .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) - .then((res) async { - if (res['MessageStatus'] == 1) { - sharedPref.setString(TOKEN, res['AuthenticationTokenID']); - if (res['List_DoctorProfile'] != null) { - loginProcessCompleted( - res['List_DoctorProfile'][0], changeLoadingStata); - } else { - ClinicModel clinic = - ClinicModel.fromJson(res['List_DoctorsClinic'][0]); - getDocProfiles(clinic, changeLoadingStata); - } - } else { - changeLoadingStata(false); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - changeLoadingStata(false); - Helpers.showErrorToast(err); - }); - } - } - - loginProcessCompleted( - Map profile, Function changeLoadingStata) { - var doctor = DoctorProfileModel.fromJson(profile); - authProv.setDoctorProfile(doctor); - sharedPref.setObj(DOCTOR_PROFILE, profile); - this.getDashboard(doctor, changeLoadingStata); - } - - getDashboard(doctor, Function changeLoadingStata) { - changeLoadingStata(false); - Navigator.of(context).pushReplacementNamed(HOME); - } - - getDocProfiles(ClinicModel clinicInfo, Function changeLoadingStata) { - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: clinicInfo.doctorID, - clinicID: clinicInfo.clinicID, - license: true, - projectID: clinicInfo.projectID, - tokenID: '', - languageID: 2); - authProv.getDocProfiles(docInfo.toJson()).then((res) { - if (res['MessageStatus'] == 1) { - loginProcessCompleted(res['DoctorProfileList'][0], changeLoadingStata); - } else { - changeLoadingStata(false); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - changeLoadingStata(false); - Helpers.showErrorToast(err); - }); - } -} diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart deleted file mode 100644 index 2d8c4199..00000000 --- a/lib/widgets/auth/verification_methods.dart +++ /dev/null @@ -1,869 +0,0 @@ -import 'dart:io' show Platform; - -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; -import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; -import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; -import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; -import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/otp/sms-popup.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:intl/intl.dart'; -import 'package:local_auth/auth_strings.dart'; -import 'package:local_auth/local_auth.dart'; -import 'package:provider/provider.dart'; - -import '../../config/size_config.dart'; -import '../../core/viewModel/auth_view_model.dart'; -import '../../landing_page.dart'; -import '../../routes.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../util/helpers.dart'; -import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; - -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -Helpers helpers = Helpers(); - -/* - *@author: Elham Rababah - *@Date:4/7/2020 - *@param: - *@return: - *@desc: Verification Methods widget - */ -class VerificationMethods extends StatefulWidget { - VerificationMethods({this.changeLoadingStata, this.password}); - - final password; - final Function changeLoadingStata; - - @override - _VerificationMethodsState createState() => _VerificationMethodsState(); -} - -class _VerificationMethodsState extends State { - MainAxisAlignment spaceBetweenMethods = MainAxisAlignment.spaceBetween; - Future _loggedUserFuture; - var _loggedUser; - var verificationMethod; - GetIMEIDetailsModel user; - final LocalAuthentication auth = LocalAuthentication(); - var _availableBiometrics; - ProjectViewModel projectsProvider; - var isMoreOption = false; - var onlySMSBox = false; - static BuildContext _context; - var loginTokenID; - - bool authenticated; - - var fingrePrintBefore; - - var selectedOption; - - @override - void initState() { - super.initState(); - _loggedUserFuture = getSharedPref(); - _getAvailableBiometrics(); - } - - Future getSharedPref() async { - sharedPref.getObj(LOGGED_IN_USER).then((userInfo) { - _loggedUser = userInfo; - }); - sharedPref.getObj(LAST_LOGIN_USER).then((lastLogin) { - if (lastLogin != null) { - user = GetIMEIDetailsModel.fromJson(lastLogin); - } - }); - - print(user); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - verificationMethod = - routeArgs != null ? routeArgs['verificationMethod'] : null; - } - - @override - Widget build(BuildContext context) { - AuthViewModel authProv = Provider.of(context); - projectsProvider = Provider.of(context); - return FutureBuilder( - future: Future.wait([_loggedUserFuture]), - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return DrAppCircularProgressIndeicator(); - default: - if (snapshot.hasError) { - Helpers.showErrorToast('Error: ${snapshot.error}'); - return Text('Error: ${snapshot.error}'); - } else { - return SingleChildScrollView( - child: Container( - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Column( - children: [ - user != null && isMoreOption == false - ? Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context) - .welcomeBack), - AppText( - Helpers.capitalize(user.doctorName), - fontSize: - SizeConfig.textMultiplier * 3.5, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).accountInfo, - fontSize: - SizeConfig.textMultiplier * 2.5, - fontWeight: FontWeight.w600, - ), - SizedBox( - height: 20, - ), - Card( - color: Colors.white, - child: Row( - children: [ - Flexible( - flex: 3, - child: ListTile( - title: Text( - TranslationBase.of( - context) - .lastLoginAt, - overflow: TextOverflow - .ellipsis, - style: TextStyle( - fontFamily: - 'Poppins', - fontWeight: - FontWeight.w800, - fontSize: 14), - ), - subtitle: AppText( - getType( - user.logInTypeID, - context), - fontSize: 14, - ))), - Flexible( - flex: 2, - child: ListTile( - title: AppText( - user.editedOn != null - ? getDate(AppDateUtils - .convertStringToDate( - user - .editedOn)) - : user.createdOn != - null - ? getDate(AppDateUtils - .convertStringToDate( - user.createdOn)) - : '--', - textAlign: - TextAlign.right, - fontSize: 14, - fontWeight: - FontWeight.w800, - ), - subtitle: AppText( - user.editedOn != null - ? getTime(AppDateUtils - .convertStringToDate( - user - .editedOn)) - : user.createdOn != - null - ? getTime(AppDateUtils - .convertStringToDate( - user.createdOn)) - : '--', - textAlign: - TextAlign.right, - fontSize: 14, - ), - )) - ], - )), - ], - ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - 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.start, - ), - ]), - user != null && isMoreOption == false - ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - // Expanded( - // child: - // getButton(3, authProv)), - // Expanded( - // child: getButton(4, authProv)) - Expanded( - child: InkWell( - onTap: () => { - authenticateUser(3, - true, authProv) - }, - child: getButton( - user.logInTypeID, - authProv))), - Expanded( - child: getButton(5, authProv)) - ]), - ]) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: getButton( - 3, authProv)), - Expanded( - child: getButton( - 4, authProv)) - ], - ) - : SizedBox(), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: getButton(1, authProv)), - Expanded( - child: getButton(2, authProv)) - ], - ), - ]), - - // ) - ], - ), - ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - user != null - ? Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context) - .useAnotherAccount, - color: Colors.red[700], - onPressed: () { - Navigator.of(context).pushNamed(LOGIN); - }, - )), - ], - ) - : SizedBox(), - ], - ), - ], - ), - )); - } - } - }); - } - - bool hideSilentMethods() { - return verificationMethod == 4 || verificationMethod == 3 ? true : false; - } - - sendActivationCodeByOtpNotificationType( - oTPSendType, AuthViewModel authProv) async { - // TODO : build enum for verfication method - if (oTPSendType == 1 || oTPSendType == 2) { - widget.changeLoadingStata(true); - int projectID = await sharedPref.getInt(PROJECT_ID); - ActivationCodeModel activationCodeModel = ActivationCodeModel( - facilityId: projectID, - memberID: _loggedUser['List_MemberInformation'][0]['MemberID'], - zipCode: _loggedUser['ZipCode'], - mobileNumber: _loggedUser['MobileNumber'], - otpSendType: oTPSendType.toString(), - password: widget.password); - - try { - authProv - .sendActivationCodeForDoctorApp(activationCodeModel) - .then((res) { - if (res['MessageStatus'] == 1) { - print("VerificationCode : " + res["VerificationCode"]); - sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); - sharedPref.setString( - VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); - sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); - sharedPref.setString(PASSWORD, widget.password); - this.startSMSService(oTPSendType, authProv); - } else { - print(res['ErrorEndUserMessage']); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - print('$err'); - widget.changeLoadingStata(false); - - Helpers.showErrorToast(); - }); - } catch (e) {} - } else { - // TODO route to this page with parameters to inicate we should present 2 option - if (Platform.isAndroid && oTPSendType == 3) { - Helpers.showErrorToast('Your device not support this feature'); - } else { - // Navigator.of(context).push(MaterialPageRoute( - // builder: (BuildContext context) => - // VerificationMethodsScreen(password: widget.password,))); - - // Navigator.of(context).pushNamed(VERIFICATION_METHODS, - // arguments: {'verificationMethod': oTPSendType}); - } - } - } - - sendActivationCodeVerificationScreen( - oTPSendType, AuthViewModel authProv) async { - // TODO : build enum for verfication method - //if (oTPSendType == 1 || oTPSendType == 2) { - widget.changeLoadingStata(true); - ActivationCodeModel2 activationCodeModel = ActivationCodeModel2( - iMEI: user.iMEI, - facilityId: user.projectID, - memberID: user.doctorID, - zipCode: user.outSA == true ? '971' : '966', - mobileNumber: user.mobile, - oTPSendType: oTPSendType, - isMobileFingerPrint: 1, - vidaAuthTokenID: user.vidaAuthTokenID, - vidaRefreshTokenID: user.vidaRefreshTokenID); - - try { - authProv - .sendActivationCodeVerificationScreen(activationCodeModel) - .then((res) { - if (res['MessageStatus'] == 1) { - print("VerificationCode : " + res["VerificationCode"]); - sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); - sharedPref.setString( - VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); - sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); - if (oTPSendType == 1 || oTPSendType == 2) { - widget.changeLoadingStata(false); - this.startSMSService(oTPSendType, authProv); - } else { - checkActivationCode(authProv); - } - } else { - print(res['ErrorEndUserMessage']); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - print('$err'); - widget.changeLoadingStata(false); - - Helpers.showErrorToast(); - }); - } catch (e) {} - // } - // else { - // checkActivationCode(authProv); - // } - } - - Widget getButton(flag, authProv) { - switch (flag) { - case 2: - return InkWell( - onTap: () => {authenticateUser(2, true, authProv)}, - child: Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Image.asset( - 'assets/images/verify-whtsapp.png', - height: 60, - width: 60, - ), - ], - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).verifyWhatsApp, - fontSize: 14, - fontWeight: FontWeight.w600, - ) - ], - ), - ))); - break; - case 1: - return InkWell( - onTap: () => {authenticateUser(1, true, authProv)}, - child: Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/verify-sms.png', - height: 60, - width: 60, - ), - projectsProvider.isArabic - ? SizedBox( - height: 20, - ) - : SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).verifySMS, - fontSize: 14, - fontWeight: FontWeight.w600, - ) - ], - ), - ))); - break; - case 3: - return InkWell( - onTap: () => { - if (checkIfBiometricAvailable(BiometricType.fingerprint)) - {authenticateUser(3, true, authProv)} - }, - child: Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/verification_fingerprint_icon.png', - height: 60, - width: 60, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).verifyFingerprint, - fontSize: 14, - fontWeight: FontWeight.w600, - ) - ], - ), - ))); - break; - case 4: - return InkWell( - onTap: () { - if (checkIfBiometricAvailable(BiometricType.face)) { - authenticateUser(4, true, authProv); - } - }, - child: - // RoundedContainer( - // backgroundColor: checkIfBiometricAvailable(BiometricType.face) - // ? Colors.white - // : Colors.white.withOpacity(.7), - // borderColor: Colors.grey, - // showBorder: false, - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - margin: EdgeInsets.all(10), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/verification_faceid_icon.png', - height: 60, - width: 60, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).verifyFaceID, - fontSize: 14, - fontWeight: FontWeight.w600, - ) - ], - ), - ))); - break; - - default: - return InkWell( - onTap: () => { - setState(() { - isMoreOption = true; - }) - }, - child: Container( - // backgroundColor: Colors.white, - // borderColor: Colors.grey, - // showBorder: false, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/login/more_icon.png', - height: 60, - width: 60, - ), - projectsProvider.isArabic - ? SizedBox( - height: 20, - ) - : SizedBox( - height: 10, - ), - AppText( - TranslationBase.of(context).moreVerification, - fontSize: 14, - fontWeight: FontWeight.w600, - // textAlign: TextAlign.center, - ) - ], - ), - ))); - } - } - - getType(type, context) { - switch (type) { - case 1: - return TranslationBase.of(context).verifySMS; - break; - case 3: - return TranslationBase.of(context).verifyFingerprint; - break; - case 4: - return TranslationBase.of(context).verifyFaceID; - break; - case 2: - return TranslationBase.of(context).verifyWhatsApp; - break; - default: - return TranslationBase.of(context).verifySMS; - break; - } - } - - bool checkIfBiometricAvailable(BiometricType biometricType) { - bool isAvailable = false; - if (_availableBiometrics != null) { - for (var i = 0; i < _availableBiometrics.length; i++) { - if (biometricType == _availableBiometrics[i]) isAvailable = true; - } - } - return isAvailable; - } - - formatDate(date) { - return DateFormat('MMM dd, yyy, kk:mm').format(date); - } - - authenticateUser(type, isActive, authProv) { - //GifLoaderDialogUtils.showMyDialog(context); - if (type == 3 || type == 4) { - fingrePrintBefore = type; - } - this.selectedOption = fingrePrintBefore != null ? fingrePrintBefore : type; - - switch (type) { - case 1: - this.loginWithSMS(1, isActive, authProv); - break; - case 2: - this.loginWithSMS(2, isActive, authProv); - - break; - case 3: - this.loginWithFingurePrintFace(3, isActive, authProv); - break; - case 4: - this.loginWithFingurePrintFace(4, isActive, authProv); - break; - default: - break; - } - sharedPref.setInt(OTP_TYPE, selectedOption); - // sharedPref.setInt(LAST_LOGIN), - } - - loginWithSMS(type, isActive, authProv) { - this.sendActivationCode(type, authProv); - } - - Future _getAvailableBiometrics() async { - var availableBiometrics; - try { - availableBiometrics = await auth.getAvailableBiometrics(); - } on PlatformException catch (e) { - print(e); - } - if (!mounted) return; - - setState(() { - _availableBiometrics = availableBiometrics; - }); - } - - sendActivationCode(type, authProv) async { - if (user != null) { - sendActivationCodeVerificationScreen(type, authProv); - } else { - sendActivationCodeByOtpNotificationType(type, authProv); - } - } - - startSMSService(type, authProv) { - new SMSOTP( - context, - type, - _loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile, - (value) { - showDialog( - context: context, - builder: (BuildContext context) { - return Center( - child: CircularProgressIndicator(), - ); - }); - - this.checkActivationCode(authProv, value: value); - }, - () => { - widget.changeLoadingStata(false), - print('Faild..'), - }, - ).displayDialog(context); - } - - loginWithFingurePrintFace(type, isActive, authProv) async { - if (isActive) { - // this.startBiometricLoginIfAvailable(); - - const iosStrings = const IOSAuthMessages( - cancelButton: 'cancel', - goToSettingsButton: 'settings', - goToSettingsDescription: 'Please set up your Touch ID.', - lockOut: 'Please reenable your Touch ID'); - - try { - authenticated = await auth.authenticateWithBiometrics( - localizedReason: 'Scan your fingerprint to authenticate', - useErrorDialogs: true, - stickyAuth: true, - iOSAuthStrings: iosStrings); - } on PlatformException catch (e) { - DrAppToastMsg.showErrorToast(e); - } - if (!mounted) return; - if (user != null && (user.logInTypeID == 3 || user.logInTypeID == 4)) { - this.sendActivationCode(type, authProv); - // this.checkActivationCode(authProv); - } else { - setState(() { - this.onlySMSBox = true; - }); - } - } - } - - checkActivationCode(AuthViewModel authProv, {value}) async { - CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = - new CheckActivationCodeRequestModel( - zipCode: - _loggedUser != null ? _loggedUser['ZipCode'] : user.zipCode, - mobileNumber: - _loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile, - projectID: await sharedPref.getInt(PROJECT_ID) != null - ? await sharedPref.getInt(PROJECT_ID) - : user.projectID, - logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), - activationCode: value ?? '0000', - oTPSendType: await sharedPref.getInt(OTP_TYPE), - generalid: "Cs2020@2016\$2958"); - - authProv - .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) - .then((res) async { - widget.changeLoadingStata(false); - if (res['MessageStatus'] == 1) { - sharedPref.setString(TOKEN, res['AuthenticationTokenID']); - if (res['List_DoctorProfile'] != null) { - loginProcessCompleted(res['List_DoctorProfile'][0], authProv); - sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); - } else { - sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); - ClinicModel clinic = - ClinicModel.fromJson(res['List_DoctorsClinic'][0]); - getDocProfiles(clinic, authProv); - } - } else { - Navigator.pop(context); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - Navigator.pop(context); - Helpers.showErrorToast(err); - }); - } - - loginProcessCompleted(Map profile, authProv) { - var doctor = DoctorProfileModel.fromJson(profile); - authProv.setDoctorProfile(doctor); - sharedPref.setObj(DOCTOR_PROFILE, profile); - projectsProvider.isLogin = true; - - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false); - } - - getDocProfiles(ClinicModel clinicInfo, authProv) { - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: clinicInfo.doctorID, - clinicID: clinicInfo.clinicID, - license: true, - projectID: clinicInfo.projectID, - tokenID: '', - languageID: 2); - authProv.getDocProfiles(docInfo.toJson()).then((res) { - if (res['MessageStatus'] == 1) { - loginProcessCompleted(res['DoctorProfileList'][0], authProv); - } else { - // changeLoadingStata(false); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - // changeLoadingStata(false); - Helpers.showErrorToast(err); - }); - } - - getDate(DateTime date) { - final DateFormat formatter = DateFormat('dd MMM yyyy'); - - return formatter.format(date); - } - - getTime(DateTime date) { - final DateFormat formatter = DateFormat('HH:mm a'); - - return formatter.format(date); - } -} diff --git a/lib/widgets/auth/verification_methods_list.dart b/lib/widgets/auth/verification_methods_list.dart new file mode 100644 index 00000000..27dbe8bf --- /dev/null +++ b/lib/widgets/auth/verification_methods_list.dart @@ -0,0 +1,96 @@ +import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/auth/method_type_card.dart'; +import 'package:flutter/material.dart'; +import 'package:local_auth/local_auth.dart'; +import 'package:provider/provider.dart'; + +class VerificationMethodsList extends StatefulWidget { + final AuthMethodTypes authMethodType; + final Function(AuthMethodTypes type, bool isActive) authenticateUser; + final Function onShowMore; + final AuthenticationViewModel authenticationViewModel; + + const VerificationMethodsList( + {Key key, + this.authMethodType, + this.authenticateUser, + this.onShowMore, + this.authenticationViewModel}) + : super(key: key); + + @override + _VerificationMethodsListState createState() => + _VerificationMethodsListState(); +} + +class _VerificationMethodsListState extends State { + final LocalAuthentication auth = LocalAuthentication(); + ProjectViewModel projectsProvider; + + @override + Widget build(BuildContext context) { + projectsProvider = Provider.of(context); + + switch (widget.authMethodType) { + case AuthMethodTypes.WhatsApp: + return MethodTypeCard( + assetPath: 'assets/images/verify-whtsapp.png', + onTap: () => + {widget.authenticateUser(AuthMethodTypes.WhatsApp, true)}, + label: TranslationBase + .of(context) + .verifyWith+ TranslationBase.of(context).verifyWhatsApp, + ); + break; + case AuthMethodTypes.SMS: + return MethodTypeCard( + assetPath: "assets/images/verify-sms.png", + onTap: () => {widget.authenticateUser(AuthMethodTypes.SMS, true)}, + label:TranslationBase + .of(context) + .verifyWith+ TranslationBase.of(context).verifySMS, + ); + break; + case AuthMethodTypes.Fingerprint: + return MethodTypeCard( + assetPath: 'assets/images/verification_fingerprint_icon.png', + onTap: () async { + if (await widget.authenticationViewModel + .checkIfBiometricAvailable(BiometricType.fingerprint)) { + + widget.authenticateUser(AuthMethodTypes.Fingerprint, true); + } + }, + label: TranslationBase + .of(context) + .verifyWith+TranslationBase.of(context).verifyFingerprint, + ); + break; + case AuthMethodTypes.FaceID: + return MethodTypeCard( + assetPath: 'assets/images/verification_faceid_icon.png', + onTap: () async { + if (await widget.authenticationViewModel + .checkIfBiometricAvailable(BiometricType.face)) { + widget.authenticateUser(AuthMethodTypes.FaceID, true); + } + }, + label: TranslationBase + .of(context) + .verifyWith+TranslationBase.of(context).verifyFaceID, + ); + break; + + default: + return MethodTypeCard( + assetPath: 'assets/images/login/more_icon.png', + onTap: widget.onShowMore, + label: TranslationBase.of(context).moreVerification, + height: 0, + ); + } + } +} diff --git a/lib/widgets/dashboard/activity_button.dart b/lib/widgets/dashboard/activity_button.dart index 8258a1df..ff9db962 100644 --- a/lib/widgets/dashboard/activity_button.dart +++ b/lib/widgets/dashboard/activity_button.dart @@ -3,36 +3,41 @@ import 'package:flutter/material.dart'; class GetActivityButton extends StatelessWidget { final value; + GetActivityButton(this.value); + @override Widget build(BuildContext context) { return Container( - width: 120, + width: MediaQuery.of(context).size.height * 0.125, padding: EdgeInsets.all(5), margin: EdgeInsets.all(5), - height: 120, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.circular(20), + borderRadius: BorderRadius.circular(15), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.all(10), - child: AppText(value.value.toString(), - fontSize: 32, fontWeight: FontWeight.bold)), - Expanded( - child: AppText( + child: Padding( + padding: const EdgeInsets.fromLTRB(8, 0, 8, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + value.value.toString(), + fontSize: 27, + fontWeight: FontWeight.bold, + color: Color(0xFF2B353E), + ), + AppText( value.kPIParameter, textOverflow: TextOverflow.clip, - fontSize: 12, - textAlign: TextAlign.center, - fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF2B353E), + textAlign: TextAlign.start, + fontWeight: FontWeight.w700, ), - ), - ], + ], + ), ), ); } diff --git a/lib/widgets/dashboard/out_patient_stack.dart b/lib/widgets/dashboard/out_patient_stack.dart index d5da97c6..fe05d69d 100644 --- a/lib/widgets/dashboard/out_patient_stack.dart +++ b/lib/widgets/dashboard/out_patient_stack.dart @@ -4,7 +4,9 @@ import 'package:flutter/material.dart'; class GetOutPatientStack extends StatelessWidget { final value; + GetOutPatientStack(this.value); + @override Widget build(BuildContext context) { value.summaryoptions @@ -12,57 +14,86 @@ class GetOutPatientStack extends StatelessWidget { var list = new List(); value.summaryoptions.forEach((result) => - {list.add(getStack(result, value.summaryoptions.first.value))}); + {list.add(getStack(result, value.summaryoptions.first.value,context))}); return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - AppText( - value.kPIName, - medium: true, + Container( + height: 30, + child: AppText( + value.kPIName, + medium: true, + fontSize: 14, + ), ), Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list) ], ); } - getStack(Summaryoptions value, max) { - return Stack(children: [ - Container( - height: 150, - margin: EdgeInsets.all(5), - width: 40, - child: SizedBox(), + getStack(Summaryoptions value, max,context) { + return Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 2), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: Colors.red[50]), - ), - Positioned( - bottom: 0, - child: Container( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment( + 0.0, 1.0), // 10% of the width, so there are ten blinds. + colors: [Color(0x8FF5F6FA), Colors.red[50]], // red to yellow + tileMode: TileMode.mirror, // repeats the gradient over the canvas + ), + borderRadius: BorderRadius.circular(8), + // color: Colors.red[50], + ), + child: Stack(children: [ + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Container( child: SizedBox(), - margin: EdgeInsets.all(5), padding: EdgeInsets.all(10), - height: max != 0 ? (150 * value.value) / max : 0, - width: 40, + height: max != 0 ? ((MediaQuery.of(context).size.height * 0.24 )* value.value) / max : 0, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.red[300]))), - Container( - height: 150, - margin: EdgeInsets.only(left: 5, top: 5), - padding: EdgeInsets.all(10), - child: RotatedBox( - quarterTurns: 1, - child: Center( - child: Align( - child: AppText( - value.kPIParameter + ' (' + value.value.toString() + ') ', - fontSize: 10, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - )), + borderRadius: BorderRadius.circular(8), + color: Color(0x63D02127), + ), ), - )) - ]); + ), + Container( + height: (MediaQuery.of(context).size.height * 0.24 ), + margin: EdgeInsets.only(left: 5, top: 5), + padding: EdgeInsets.all(10), + child: RotatedBox( + quarterTurns: 3, + child: Center( + child: Align( + child: FittedBox( + child: Row( + children: [ + AppText( + value.kPIParameter, + fontSize: 10, + textAlign: TextAlign.center, + color: Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + AppText( + ' (' + value.value.toString() + ') ', + fontSize: 12, + textAlign: TextAlign.center, + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + ), + ], + ), + )), + ), + )) + ]), + ), + ); } } diff --git a/lib/widgets/dashboard/row_count.dart b/lib/widgets/dashboard/row_count.dart index c56613da..a22932f4 100644 --- a/lib/widgets/dashboard/row_count.dart +++ b/lib/widgets/dashboard/row_count.dart @@ -8,31 +8,38 @@ class RowCounts extends StatelessWidget { RowCounts(this.name, this.count, this.c); @override Widget build(BuildContext context) { - return Row( - children: [ - dot(c), - Padding( - padding: EdgeInsets.only(top: 5, bottom: 5), + return Container( + padding: EdgeInsets.only(top: 5, bottom: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + dot(c), + Expanded( child: Row( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - AppText( - name, - color: Colors.black, - textAlign: TextAlign.center, - fontSize: 12, - textOverflow: TextOverflow.ellipsis, + Expanded( + child: AppText( + name, + color: Colors.black, + textAlign: TextAlign.start, // from TextAlign.center + fontSize: 11, + textOverflow: TextOverflow.ellipsis, + ), ), AppText( ' (' + count.toString() + ')', color: Colors.black, textAlign: TextAlign.center, - fontSize: 14, + fontSize: 12, fontWeight: FontWeight.bold, ) ], - )), - ], + ), + ), + ], + ), ); } diff --git a/lib/widgets/dialog/AskPermissionDialog.dart b/lib/widgets/dialog/AskPermissionDialog.dart new file mode 100644 index 00000000..58718373 --- /dev/null +++ b/lib/widgets/dialog/AskPermissionDialog.dart @@ -0,0 +1,90 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:permission_handler/permission_handler.dart'; + +class AskPermissionDialog extends StatefulWidget { + final String type; + final Function onTapGrant; + + AskPermissionDialog({this.type, this.onTapGrant}); + + @override + _AskPermissionDialogState createState() => _AskPermissionDialogState(); +} + +class _AskPermissionDialogState extends State { + getText() { + return "Turn on your Camera, Microphone to start video call"; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + elevation: 0.5, + actions: [ + Padding( + padding: EdgeInsets.only(right: 18.0), + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: Feedback.wrapForTap(() { + Navigator.pop(context); + }, context), + child: + Icon(EvaIcons.close, color: Theme.of(context).primaryColor), + ), + ) + ], + ), + body: Container( + margin: EdgeInsets.symmetric(horizontal: 48), + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + "🙋‍♀", + style: "headline1", + color: Colors.black, + ), + AppText( + "Don't miss out!", + style: "headline4", + color: Colors.black, + ), + SizedBox( + height: 8, + ), + AppText( + getText(), + color: Colors.grey, + style: "bodyText2", + textAlign: TextAlign.center, + ), + SizedBox( + height: MediaQuery.of(context).size.height / 6, + ), + AppButton( + fontColor: Theme.of(context).backgroundColor, + color: Colors.red[700], + title: "Turn On Camera, Microphone", + onPressed: () async { + openAppSettings().then((value) { + Navigator.pop(context); + widget.onTapGrant(); + }); + }, + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart deleted file mode 100644 index 179633e7..00000000 --- a/lib/widgets/patients/PatientCard.dart +++ /dev/null @@ -1,399 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; - -class PatientCard extends StatelessWidget { - final PatiantInformtion patientInfo; - final Function onTap; - final String patientType; - final String arrivalType; - final bool isInpatient; - final bool isMyPatient; - final bool isFromSearch; - - const PatientCard( - {Key key, - this.patientInfo, - this.onTap, - this.patientType, - this.arrivalType, - this.isInpatient, this.isMyPatient = false, this.isFromSearch = false}) - : super(key: key); - @override - Widget build(BuildContext context) { - return Container( - width: SizeConfig.screenWidth * 0.9, - margin: EdgeInsets.all(6), - padding: EdgeInsets.only(left: 0, right: 5, bottom: 0, top: 0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: CardWithBgWidget( - padding: 0, - marginLeft: (!isMyPatient && isInpatient)?0:10, - marginSymmetric:isFromSearch ? 10 : 0.0, - hasBorder: false, - bgColor:(isMyPatient && !isFromSearch)?Colors.green[500]: patientInfo.patientStatusType == 43 - ? Colors.green[500] - :isMyPatient? Colors.green[500]:isInpatient?Colors.white:!isFromSearch?Colors.red[800]:Colors.white, - widget: Container( - color: Colors.white, - // padding: EdgeInsets.only(left: 10, right: 0, bottom: 0), - child: InkWell( - child: Column( - children: [ - SizedBox( - height: 10, - ), - !(isInpatient && !isFromSearch) - ? Padding( - padding: EdgeInsets.only(left: 12.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - patientInfo.patientStatusType == 43 - ? Row( - children: [ - AppText( - TranslationBase.of(context).arrivedP, - color: Colors.green, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 10, - ), - SizedBox(width: 8,), - SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),), - SizedBox(width: 8,), - AppText( - patientInfo.status==2? 'Confirmed':'Booked', - color: patientInfo.status==2? Colors.green:Colors.grey , - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 10, - ), - ], - ) - : patientInfo.patientStatusType == 42?Row( - children: [ - AppText( - TranslationBase.of(context).notArrived, - color: Colors.red[800], - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 10, - ), - SizedBox(width: 8,), - SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),), - SizedBox(width: 8,), - AppText( - patientInfo.status==2? 'Confirmed':'Booked', - color: patientInfo.status==2? Colors.green:Colors.grey , - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 10, - ), - ], - ): !isFromSearch && patientInfo.patientStatusType==null ? Row( - children: [ - AppText( - TranslationBase.of(context).notArrived, - color: Colors.red[800], - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 12, - ), - SizedBox(width: 8,), - SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),), - SizedBox(width: 8,), - AppText( - patientInfo.status==2? 'Booked':'Confirmed', - color: patientInfo.status==2? Colors.grey:Colors.green , - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 12, - ) - ], - ):SizedBox(), - this.arrivalType == '1' - ? AppText( - patientInfo.startTime != null - ? patientInfo.startTime - : patientInfo.startTimes, - fontFamily: 'Poppins', - fontWeight: FontWeight.w400, - ) - : patientInfo.arrivedOn != null - ? AppText( - AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate(patientInfo.arrivedOn,) - )+" "+ "${AppDateUtils.getStartTime(patientInfo.startTime)}", - fontFamily: 'Poppins', - fontWeight: FontWeight.w400, - fontSize: 15, - ) - : (patientInfo.appointmentDate != null && patientInfo.appointmentDate.isNotEmpty)? - AppText( - - "${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate(patientInfo.appointmentDate,))} ${AppDateUtils.getStartTime(patientInfo.startTime)}", - fontFamily: 'Poppins', - fontWeight: FontWeight.w400, - fontSize: 15, - ):SizedBox() - ], - )) - : SizedBox(), - if(isInpatient && isMyPatient && !isFromSearch) - Row( - children: [ - SizedBox(width: 12,), - AppText( - 'My Patient', - color: Colors.green, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 12, - ), - ], - ), - Padding( - padding: EdgeInsets.only(left: 12.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row(children: [ - Expanded( - // width: MediaQuery.of(context).size.width*0.51, - child: AppText( - (Helpers.capitalize(patientInfo.firstName) + - " " + - Helpers.capitalize(patientInfo.lastName)), - fontSize: 16, - color: Color(0xff2e303a), - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - textOverflow: TextOverflow.ellipsis, - ), - ), - if (patientInfo.gender == 1) - Icon( - DoctorApp.male_2, - color: Colors.blue, - ) else Icon( - DoctorApp.female_1, - color: Colors.pink, - ), - ]), - ), - Row( - children: [ - AppText( - patientInfo.nationalityName != null - ? patientInfo.nationalityName.trim() - : patientInfo.nationality != null - ? patientInfo.nationality.trim() - : patientInfo.nationalityId != null - ? patientInfo.nationalityId - : "", - fontWeight: FontWeight.bold, - fontSize: 14, - textOverflow: TextOverflow.ellipsis, - ), - patientInfo.nationality != null || - patientInfo.nationalityId != null - ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), - child: Image.network( - patientInfo.nationalityFlagURL != null - ? patientInfo.nationalityFlagURL - : '', - height: 25, - width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return AppText( - 'No Image', - fontSize: 10, - ); - }, - )) - : SizedBox() - ], - ) - ], - )), - Row(children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 12.0), - child: Container( - width: 60, - height: 60, - child: Image.asset( - patientInfo.gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), - ), - ), - ], - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, - color: Colors.black), - children: [ - new TextSpan( - text: TranslationBase.of(context) - .fileNumber, - style: TextStyle( - fontSize: 12, - fontFamily: 'Poppins')), - new TextSpan( - text: patientInfo.patientId.toString(), - style: TextStyle( - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - fontSize: 13)), - ], - ), - ), - ), - //if (isInpatient) - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: - TranslationBase.of(context).age + - " : ", - style: TextStyle(fontSize: 12)), - new TextSpan( - text: - "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context)}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 13)), - ], - ), - ), - ), - if (isInpatient ) - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: - 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: patientInfo.admissionDate == null - ? "" - : TranslationBase.of(context) - .admissionDate + - " : ", - style: TextStyle(fontSize: 12)), - new TextSpan( - text: patientInfo.admissionDate == null - ? "" - : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 13)), - ]))), - if (patientInfo.admissionDate != null) - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: - 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: TranslationBase.of(context).numOfDays + " : ", - style: TextStyle(fontSize: 12)), - new TextSpan( - text: "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 13)), - ]))), - - ])) - ]), - !isInpatient && !isFromSearch - ? Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - padding: EdgeInsets.all(4), - child: Image.asset( - patientInfo.appointmentType == - 'Regular' && - patientInfo.visitTypeId == 100 - ? 'assets/images/livecare.png' - : patientInfo.appointmentType == - 'Walkin' - ? 'assets/images/walkin.png' - : 'assets/images/booked.png', - height: 25, - width: 35, - )), - ]) - : (isInpatient == true) - ? Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - padding: EdgeInsets.all(4), - child: Image.asset( - 'assets/images/inpatient.png', - height: 25, - width: 35, - )), - ]) - : SizedBox() - ], - ), - onTap: onTap, - )), - )); - } - - -} diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index a08282c0..6d573cc4 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -44,7 +44,9 @@ class PatientReferralItemWidget extends StatelessWidget { this.doctorAvatar, this.referralDoctorName, this.clinicDescription, - this.infoIcon,this.isReferralClinic=false,this.referralClinic}); + this.infoIcon, + this.isReferralClinic = false, + this.referralClinic}); @override Widget build(BuildContext context) { @@ -58,9 +60,13 @@ class PatientReferralItemWidget extends StatelessWidget { child: CardWithBgWidget( bgColor: referralStatusCode == 1 ? Color(0xffc4aa54) - : referralStatusCode == 46 + : referralStatusCode == 2 ? Colors.green[700] - : Colors.red[700], + : referralStatusCode == 46 + ? Colors.green[900] + : referralStatusCode == 4 + ? Colors.red[700] + : Colors.red[900], hasBorder: false, widget: Container( // padding: EdgeInsets.only(left: 20, right: 0, bottom: 0), @@ -78,9 +84,13 @@ class PatientReferralItemWidget extends StatelessWidget { fontWeight: FontWeight.w700, color: referralStatusCode == 1 ? Color(0xffc4aa54) - : referralStatusCode == 46 + : referralStatusCode == 2 ? Colors.green[700] - : Colors.red[700], + : referralStatusCode == 46 + ? Colors.green[900] + : referralStatusCode == 4 + ? Colors.red[700] + : Colors.red[900], ), AppText( referredDate, @@ -155,21 +165,32 @@ class PatientReferralItemWidget extends StatelessWidget { ), Row( mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - isSameBranch ? TranslationBase.of(context).referredFrom :TranslationBase.of(context).refClinic, + isSameBranch + ? TranslationBase.of(context) + .referredFrom + : TranslationBase.of(context).refClinic, fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), - - AppText( - !isReferralClinic? isSameBranch ? TranslationBase.of(context).sameBranch : TranslationBase.of(context).otherBranch: " "+referralClinic, - fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), + Expanded( + child: AppText( + !isReferralClinic + ? isSameBranch + ? TranslationBase.of(context) + .sameBranch + : TranslationBase.of(context) + .otherBranch + : " " + referralClinic, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.8 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), ), ], ), @@ -215,7 +236,7 @@ class PatientReferralItemWidget extends StatelessWidget { ), Expanded( child: AppText( - remark, + remark ?? "", fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -259,13 +280,13 @@ class PatientReferralItemWidget extends StatelessWidget { }, )) : Container( - child: Image.asset( - patientGender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), - ), + child: Image.asset( + patientGender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), ), ), Expanded( diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart new file mode 100644 index 00000000..b90eecd3 --- /dev/null +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -0,0 +1,535 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'ShowTimer.dart'; + +class PatientCard extends StatelessWidget { + final PatiantInformtion patientInfo; + final Function onTap; + final String patientType; + final String arrivalType; + final bool isInpatient; + final bool isMyPatient; + final bool isFromSearch; + final bool isFromLiveCare; + + PatientCard( + {Key key, + this.patientInfo, + this.onTap, + this.patientType, + this.arrivalType, + this.isInpatient, + this.isMyPatient = false, + this.isFromSearch = false, + this.isFromLiveCare = false}) + : super(key: key); + + @override + Widget build(BuildContext context) { + + return Container( + width: SizeConfig.screenWidth * 0.9, + margin: EdgeInsets.all(6), + padding: EdgeInsets.only(left: 0, right: 5, bottom: 0, top: 0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + ), + child: CardWithBgWidget( + padding: 0, + marginLeft: (!isMyPatient && isInpatient) ? 0 : 10, + marginSymmetric: isFromSearch ? 10 : 0.0, + hasBorder: false, + bgColor: isFromLiveCare + ? Colors.white + : (isMyPatient && !isFromSearch) + ? Colors.green[500] + : patientInfo.patientStatusType == 43 + ? Colors.green[500] + : isMyPatient + ? Colors.green[500] + : isInpatient + ? Colors.white + : !isFromSearch + ? Colors.red[800] + : Colors.white, + widget: Container( + color: Colors.white, + // padding: EdgeInsets.only(left: 10, right: 0, bottom: 0), + child: InkWell( + child: Column( + children: [ + SizedBox( + height: 10, + ), + !(isInpatient && !isFromSearch) + ? Padding( + padding: EdgeInsets.only(left: 12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + patientInfo.patientStatusType == 43 + ? Row( + children: [ + AppText( + TranslationBase.of(context) + .arrivedP, + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 10, + ), + SizedBox( + width: 8, + ), + SizedBox( + height: 12, + width: 1.5, + child: Container( + color: Colors.grey, + ), + ), + SizedBox( + width: 8, + ), + AppText( + patientInfo.status == 2 + ? 'Confirmed' + : 'Booked', + color: patientInfo.status == 2 + ? Colors.green + : Colors.grey, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 10, + ), + ], + ) + : patientInfo.patientStatusType == 42 + ? Row( + children: [ + AppText( + TranslationBase.of(context) + .notArrived, + color: Colors.red[800], + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 10, + ), + SizedBox( + width: 8, + ), + SizedBox( + height: 12, + width: 1.5, + child: Container( + color: Colors.grey, + ), + ), + SizedBox( + width: 8, + ), + AppText( + patientInfo.status == 2 + ? 'Confirmed' + : 'Booked', + color: patientInfo.status == 2 + ? Colors.green + : Colors.grey, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 10, + ), + ], + ) + : !isFromSearch && + !isFromLiveCare && + patientInfo.patientStatusType == + null + ? Row( + children: [ + AppText( + TranslationBase.of(context) + .notArrived, + color: Colors.red[800], + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + SizedBox( + width: 8, + ), + SizedBox( + height: 12, + width: 1.5, + child: Container( + color: Colors.grey, + ), + ), + SizedBox( + width: 8, + ), + AppText( + patientInfo.status == 2 + ? 'Booked' + : 'Confirmed', + color: + patientInfo.status == 2 + ? Colors.grey + : Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ) + ], + ) + : SizedBox(), + this.arrivalType == '1' + ? AppText( + patientInfo.startTime != null + ? patientInfo.startTime + : patientInfo.startTimes, + fontFamily: 'Poppins', + fontWeight: FontWeight.w400, + ) + : patientInfo.arrivedOn != null + ? AppText( + AppDateUtils.getDayMonthYearDate( + AppDateUtils + .convertStringToDate( + patientInfo.arrivedOn, + )) + + " " + + "${AppDateUtils.getStartTime(patientInfo.startTime)}", + fontFamily: 'Poppins', + fontWeight: FontWeight.w400, + fontSize: 15, + ) + : (patientInfo.appointmentDate != + null && + patientInfo + .appointmentDate.isNotEmpty) + ? AppText( + "${AppDateUtils.getDayMonthYearDate(AppDateUtils.convertStringToDate( + patientInfo.appointmentDate, + ))} ${AppDateUtils.getStartTime(patientInfo.startTime)}", + fontFamily: 'Poppins', + fontWeight: FontWeight.w400, + fontSize: 15, + ) + : SizedBox() + ], + )) + : SizedBox(), + if (isInpatient && isMyPatient && !isFromSearch) + Row( + children: [ + SizedBox( + width: 12, + ), + AppText( + 'My Patient', + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], + ), + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Row(children: [ + Expanded( + // width: MediaQuery.of(context).size.width*0.51, + child: AppText( + isFromLiveCare + ? Helpers.capitalize( + patientInfo.fullName) + : (Helpers.capitalize( + patientInfo.firstName) + + " " + + Helpers.capitalize( + patientInfo.lastName)), + fontSize: 16, + color: Color(0xff2e303a), + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + textOverflow: TextOverflow.ellipsis, + ), + ), + + if (patientInfo.gender == 1) + Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + else + Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + + if(isFromLiveCare) + ShowTimer(patientInfo: patientInfo,), + ]), + ), + Row( + children: [ + AppText( + patientInfo.nationalityName != null + ? patientInfo.nationalityName.trim() + : patientInfo.nationality != null + ? patientInfo.nationality.trim() + : patientInfo.nationalityId != null + ? patientInfo.nationalityId + : "", + fontWeight: FontWeight.bold, + fontSize: 14, + textOverflow: TextOverflow.ellipsis, + ), + patientInfo.nationality != null || + patientInfo.nationalityId != null + ? ClipRRect( + borderRadius: + BorderRadius.circular(20.0), + child: Image.network( + patientInfo.nationalityFlagURL != null + ? patientInfo.nationalityFlagURL + : '', + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return AppText( + 'No Image', + fontSize: 10, + ); + }, + )) + : SizedBox() + ], + ) + ], + )), + Row(children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Container( + width: 60, + height: 60, + child: Image.asset( + patientInfo.gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ), + ], + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context) + .fileNumber, + style: TextStyle( + fontSize: 12, + fontFamily: 'Poppins')), + new TextSpan( + text: patientInfo.patientId.toString(), + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 13)), + ], + ), + ), + ), + //if (isInpatient) + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase.of(context).age + + " : ", + style: TextStyle(fontSize: 12)), + new TextSpan( + text: + "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 13)), + ], + ), + ), + ), + if (isInpatient) + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: + 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: patientInfo.admissionDate == null + ? "" + : TranslationBase.of(context) + .admissionDate + + " : ", + style: TextStyle(fontSize: 12)), + new TextSpan( + text: patientInfo.admissionDate == null + ? "" + : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 13)), + ]))), + if (patientInfo.admissionDate != null) + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: + 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase.of(context) + .numOfDays + + " : ", + style: TextStyle(fontSize: 12)), + new TextSpan( + text: + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 13)), + ]))), + if (isFromLiveCare) + Column( + children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: + TranslationBase.of(context).clinic + + " : ", + style: TextStyle(fontSize: 12)), + new TextSpan( + text: + patientInfo.clinicName, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 13)), + ], + ), + ), + ), + ], + ), + ])) + ]), + isFromLiveCare + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(4), + child: Image.asset( + 'assets/images/livecare.png', + height: 25, + width: 35, + color: Colors.grey.shade700, + )), + ], + ) + : !isInpatient && !isFromSearch + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(4), + child: Image.asset( + patientInfo.appointmentType == + 'Regular' && + patientInfo.visitTypeId == 100 + ? 'assets/images/livecare.png' + : patientInfo.appointmentType == + 'Walkin' + ? 'assets/images/walkin.png' + : 'assets/images/booked.png', + height: 25, + width: 35, + )), + ]) + : (isInpatient == true) + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(4), + child: Image.asset( + 'assets/images/inpatient.png', + height: 25, + width: 35, + )), + ]) + : SizedBox() + ], + ), + onTap: onTap, + )), + )); + } + + +} \ No newline at end of file diff --git a/lib/widgets/patients/patient_card/ShowTimer.dart b/lib/widgets/patients/patient_card/ShowTimer.dart new file mode 100644 index 00000000..b769588b --- /dev/null +++ b/lib/widgets/patients/patient_card/ShowTimer.dart @@ -0,0 +1,59 @@ + +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class ShowTimer extends StatefulWidget { + final PatiantInformtion patientInfo; + + + const ShowTimer({ + Key key, this.patientInfo, + }) : super(key: key); + + @override + _ShowTimerState createState() => _ShowTimerState(); +} + +class _ShowTimerState extends State { + + int remainingTime = 600; + String displayTime = ''; + + @override + Widget build(BuildContext context) { + if (displayTime.isEmpty) { + startShowTimer(); + } + return AppText( + "$displayTime", + color: Colors.red, + textAlign: TextAlign.start, + fontWeight: FontWeight.bold, + fontSize: 11, + ); + } + + startShowTimer() { + // this.remainingTime--; + setState(() { + displayTime = this.generateShowTimerString(); + }); + + Future.delayed(Duration(seconds: 1), () { + if (this.remainingTime > 0) { + startShowTimer(); + } + }); + } + + generateShowTimerString() { + DateTime now = DateTime.now(); + DateTime liveCareDate = DateTime.parse(widget.patientInfo.arrivalTime); + String timer = AppDateUtils.differenceBetweenDateAndCurrent( + liveCareDate, context, isShowSecond: true, isShowDays: false); + + return timer; + } +} diff --git a/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart deleted file mode 100644 index aef7a161..00000000 --- a/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; - -class PatientHeaderWidgetNoAvatar extends StatelessWidget { - final PatiantInformtion patient; - - PatientHeaderWidgetNoAvatar(this.patient); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - margin: EdgeInsets.all(16), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + ' ' + patient.lastName, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.2, - ), - Row( - children: [ - AppText( - "VIP", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.2, - ), - SizedBox( - width: 8, - ), - AppText( - " ${patient.age}", - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ], - ), - AppText( - patient.visitType ?? "", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - AppText( - "${patient.companyName != null ? patient.companyName : ""}", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ], - ), - ), - Icon( - Icons.info_outline, - color: Colors.black, - ), - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - ], - ); - } -} diff --git a/lib/widgets/patients/profile/PatientProfileButton.dart b/lib/widgets/patients/profile/PatientProfileButton.dart index 2cf9a5ca..36755502 100644 --- a/lib/widgets/patients/profile/PatientProfileButton.dart +++ b/lib/widgets/patients/profile/PatientProfileButton.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indei import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +// ignore: must_be_immutable class PatientProfileButton extends StatelessWidget { final String nameLine1; final String nameLine2; @@ -24,6 +25,10 @@ class PatientProfileButton extends StatelessWidget { final Function onTap; final bool isDischargedPatient; final bool isSelectInpatient; + final bool isDartIcon; + final IconData dartIcon; + final bool isFromLiveCare; + final Color color; PatientProfileButton({ Key key, @@ -42,6 +47,8 @@ class PatientProfileButton extends StatelessWidget { this.isInPatient = false, this.isDischargedPatient = false, this.isSelectInpatient = false, + this.isDartIcon = false, + this.dartIcon, this.isFromLiveCare = false, this.color, }) : super(key: key); @override @@ -66,7 +73,9 @@ class PatientProfileButton extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ Container( - child: new Image.asset( + child: isDartIcon ? Icon( + dartIcon, size: 30, color: color?? Color(0xFF333C45),) : new Image + .asset( url + icon, width: 30, height: 30, @@ -85,14 +94,14 @@ class PatientProfileButton extends StatelessWidget { children: [ AppText( !projectsProvider.isArabic ? this.nameLine1 : nameLine2, - color: Color(0xFF2B353E), + color: color??Color(0xFF2B353E), fontWeight: FontWeight.w600, textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 1.5, ), AppText( !projectsProvider.isArabic ? this.nameLine2 : nameLine1, - color: Color(0xFF2B353E), + color: color??Color(0xFF2B353E), fontWeight: FontWeight.w600, textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 1.5, @@ -108,7 +117,7 @@ class PatientProfileButton extends StatelessWidget { color: isDisable ? Colors.grey.withOpacity(0.4) : Colors.white, borderRadius: BorderRadius.all(Radius.circular(10)), border: Border.fromBorderSide(BorderSide( - color: Color(0xffBBBBBB), + color: color??Color(0xffBBBBBB), width: 1, )), ), @@ -136,6 +145,7 @@ class PatientProfileButton extends StatelessWidget { 'isInpatient': isInPatient, 'isDischargedPatient': isDischargedPatient, 'isSelectInpatient': isSelectInpatient, + "isFromLiveCare":isFromLiveCare }); } } diff --git a/lib/widgets/patients/profile/patient-page-header-widget.dart b/lib/widgets/patients/profile/patient-page-header-widget.dart deleted file mode 100644 index 49ad8f4e..00000000 --- a/lib/widgets/patients/profile/patient-page-header-widget.dart +++ /dev/null @@ -1,114 +0,0 @@ -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_screen.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class PatientPageHeaderWidget extends StatelessWidget { - - final PatiantInformtion patient; - PatientPageHeaderWidget(this.patient); - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - - return BaseView( - onModelReady: (model) async { - GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( - patientMRN: patient.patientMRN??patient.patientId, - doctorID: '', - editedBy: ''); - await model.getPatientAllergy(generalGetReqForSOAP); - if (model.allergiesList.length == 0) { - await model.getMasterLookup(MasterKeysService.Allergies); - } - if (model.allergySeverityList.length == 0) { - await model.getMasterLookup(MasterKeysService.AllergySeverity); - } - - }, - builder: (_, model, w) => Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - AppText( - patient.patientDetails.fullName != null ? patient.patientDetails.fullName : patient.firstName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).age , - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 20, - ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ), - model.patientAllergiesList.isNotEmpty && model.getAllergicNames(projectViewModel.isArabic)!='' ?AppText( - TranslationBase.of(context).allergicTO +" : "+model.getAllergicNames(projectViewModel.isArabic), - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, - ) : AppText(''), - ], - ), - ) - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - width: 20, - ), - ], - ), - )); - } -} diff --git a/lib/widgets/patients/profile/patient-profile-app-bar.dart b/lib/widgets/patients/profile/patient-profile-app-bar.dart new file mode 100644 index 00000000..2a0fa072 --- /dev/null +++ b/lib/widgets/patients/profile/patient-profile-app-bar.dart @@ -0,0 +1,561 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import 'large_avatar.dart'; + +class PatientProfileAppBar extends StatelessWidget + with PreferredSizeWidget { + final PatiantInformtion patient; + final double height; + final bool isInpatient; + final bool isDischargedPatient; + final bool isFromLiveCare; + + final String doctorName; + final String branch; + final DateTime appointmentDate; + final String profileUrl; + final String invoiceNO; + final String orderNo; + final bool isPrescriptions; + final bool isMedicalFile; + final String episode; + final String visitDate; + final String clinic; + final bool isAppointmentHeader; + final bool isFromLabResult; + final VoidCallback onPressed; + + PatientProfileAppBar( + this.patient, + {this.height = 0.0, + this.isInpatient = false, + this.isDischargedPatient = false, + this.isFromLiveCare = false, + this.doctorName, + this.branch, + this.appointmentDate, + this.profileUrl, + this.invoiceNO, + this.orderNo, + this.isPrescriptions = false, + this.clinic, + this.isMedicalFile = false, + this.episode, + this.visitDate, + this.isAppointmentHeader = false, + this.isFromLabResult = false, this.onPressed}); + + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + int gender = 1; + if (patient.patientDetails != null) { + gender = patient.patientDetails.gender; + } else { + gender = patient.gender; + } + + return Container( + padding: EdgeInsets.only( + left: 0, + right: 5, + bottom: 5, + ), + decoration: BoxDecoration( + color: Colors.white, + ), + // height: height == 0 + // ? isInpatient + // ? 215 + // : isAppointmentHeader + // ? 325 + // : 200 + // : height, + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 12.0), + child: Row(children: [ + IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Color(0xFF2B353E), //Colors.black, + onPressed: () { + if(onPressed!=null) + onPressed(); + Navigator.pop(context); + }, + ), + Expanded( + child: AppText( + patient.firstName != null + ? (Helpers.capitalize(patient.firstName) + + " " + + Helpers.capitalize(patient.lastName)) + : Helpers.capitalize(patient.fullName??patient.patientDetails.fullName), + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + color: Color(0xFF2B353E), + ), + ), + gender == 1 + ? Icon( + DoctorApp.male_2, + color: Colors.blue, + ) + : Icon( + DoctorApp.female_1, + color: Colors.pink, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 4), + child: InkWell( + onTap: () { + launch("tel://" + patient.mobileNumber); + }, + child: Icon( + Icons.phone, + color: Colors.black87, + ), + ), + ), + ]), + ), + Row(children: [ + Padding( + padding: EdgeInsets.only(left: 12.0), + child: Container( + width: 60, + height: 60, + child: Image.asset( + gender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + patient.patientStatusType != null + ? Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + patient.patientStatusType == 43 + ? AppText( + TranslationBase + .of(context) + .arrivedP, + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ) + : AppText( + TranslationBase.of(context).notArrived, + color: Colors.red[800], + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + patient.startTime != null + ? AppText( + patient.startTime != null + ? patient.startTime + : '', + fontWeight: FontWeight.w700, + fontSize: 12, + color: Color(0xFF2E303A)) + : SizedBox() + ], + )) + : SizedBox(), + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + RichText( + text: TextSpan( + style: TextStyle( + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase + .of(context) + .fileNumber, + + style: TextStyle( + fontSize: 10, + fontFamily: 'Poppins', + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + + ),), + new TextSpan( + text: patient.patientId.toString(), + style: TextStyle( + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + fontSize: 12, color: Color(0xFF2E303A),)), + ], + ), + ), + Row( + children: [ + AppText( + patient.nationalityName ?? patient.nationality?? patient.nationalityId ?? '', + fontWeight: FontWeight.bold, + fontSize: 12, + ), + patient.nationalityFlagURL != null + ? ClipRRect( + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + patient.nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + )) + : SizedBox() + ], + ) + ], + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase + .of(context) + .age + " : ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),)), + new TextSpan( + text: + "${AppDateUtils.getAgeByBirthday( + patient.patientDetails != null + ? patient.patientDetails.dateofBirth ?? + "" + : patient.dateofBirth ?? "", context, + isServerFormat: !isFromLiveCare)}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 12, + color: Color(0xFF2E303A),)), + ], + ), + ), + ), + + if ( patient.appointmentDate != null && patient.appointmentDate.isNotEmpty && !isFromLabResult) + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).appointmentDate + + " : ", + fontSize: 10, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + SizedBox( + width: 3.5, + ), + AppText( + AppDateUtils + .getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate( + patient.appointmentDate)) + , + fontWeight: FontWeight.w700, + fontSize: 12, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 0.5, + ) + ], + ), + if(isFromLabResult)Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: "Result Date: ", + style: TextStyle( fontSize: 10, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + fontFamily: 'Poppins',)), + new TextSpan( + text: + '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', + style: TextStyle( + fontWeight: FontWeight.w700, fontSize: 12)), + ], + ), + ), + ), + // if(isInpatient) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(patient.admissionDate != null && patient.admissionDate.isNotEmpty) + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757), + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: patient.admissionDate == null + ? "" + : TranslationBase.of(context) + .admissionDate + + " : ", + style: TextStyle(fontSize: 10)), + new TextSpan( + text: patient.admissionDate == null + ? "" + : "${AppDateUtils + .getDayMonthYearDateFormatted( + (AppDateUtils + .getDateTimeFromServerFormat( + patient.admissionDate + .toString())))}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 12, + color: Color(0xFF2E303A),)), + ]))), + if (patient.admissionDate != null) + Row( + children: [ + AppText( + "${TranslationBase.of(context).numOfDays}: ", + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757) + ), + if(isDischargedPatient && + patient.dischargeDate != null) + AppText( + "${AppDateUtils + .getDateTimeFromServerFormat( + patient.dischargeDate) + .difference(AppDateUtils + .getDateTimeFromServerFormat( + patient.admissionDate)) + .inDays + 1}", + fontWeight: FontWeight.w700, + fontSize: 12, + color: Color(0xFF2E303A), + ) + else + AppText( + "${DateTime + .now() + .difference(AppDateUtils + .getDateTimeFromServerFormat( + patient.admissionDate)) + .inDays + 1}", + fontWeight: FontWeight.w700, + fontSize: 12, + color: Color(0xFF2E303A),), + ], + ), + ], + ), + ], + ), + ), + ]), + if(isAppointmentHeader) + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 30, + height: 30, + margin: EdgeInsets.only( + left: projectViewModel.isArabic ? 10 : 85, + right: projectViewModel.isArabic ? 85 : 10, + top: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border( + bottom: BorderSide( + color: Colors.grey[400], width: 2.5), + left: BorderSide( + color: Colors.grey[400], width: 2.5), + )), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: LargeAvatar( + name: doctorName ?? "", + url: profileUrl, + ), + width: 25, + height: 25, + margin: EdgeInsets.only(top: 10), + ), + + + Expanded( + flex: 5, + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + AppText( + '${TranslationBase + .of(context) + .dr}$doctorName', + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + fontSize: 12, + ), + if (orderNo != null && + !isPrescriptions) + Row( + children: [ + AppText('Order No: ', + + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + AppText(orderNo ?? '', + fontSize: 12) + ], + ), + if (invoiceNO != null && + !isPrescriptions) + Row( + children: [ + AppText('Invoice: ', + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + AppText(invoiceNO ?? "", + fontSize: 12) + ], + ), + if (branch != null) + Row( + children: [ + AppText('Branch: ', + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + AppText(branch ?? '', + fontSize: 12) + ], + ), + + if (clinic != null) + Row( + children: [ + AppText('Clinic: ', + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + AppText(clinic ?? '', + fontSize: 12) + ], + ), + if (isMedicalFile && + episode != null) + Row( + children: [ + AppText('Episode: ', + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + AppText(episode ?? '', + fontSize: 12) + ], + ), + if (isMedicalFile && + visitDate != null) + Row( + children: [ + AppText('Visit Date: ', + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + AppText(visitDate ?? '', + fontSize: 12) + ], + ), + if (!isMedicalFile) + Row( + + children: [ + AppText( + !isPrescriptions + ? 'Result Date:' + : 'Prescriptions Date ', + fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757), + ), + AppText( + '${AppDateUtils + .getDayMonthYearDateFormatted( + appointmentDate, + isArabic: projectViewModel + .isArabic)}', + fontSize: 12, + ) + ], + ) + ]), + ), + ), + ], + ), + ), + ), + ], + ) + ], + ), + ), + ); + } + @override + Size get preferredSize => + Size(double.maxFinite, height == 0 + ? isInpatient ? (isFromLabResult?200:170) : isAppointmentHeader ? 290 : 170 + : height); +} diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart index 07bfe8f7..f2a32e63 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart @@ -19,9 +19,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget final double height; final bool isInpatient; final bool isDischargedPatient; + final bool isFromLiveCare; + + final Stream videoCallDurationStream; PatientProfileHeaderNewDesignAppBar( - this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false}); + this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false, this.isFromLiveCare = false, this.videoCallDurationStream}); @override Widget build(BuildContext context) { @@ -60,7 +63,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget ? (Helpers.capitalize(patient.firstName) + " " + Helpers.capitalize(patient.lastName)) - : Helpers.capitalize(patient.patientDetails.fullName), + : Helpers.capitalize(patient.fullName??patient.patientDetails.fullName), fontSize: SizeConfig.textMultiplier * 1.8, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -87,6 +90,23 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget ), ), ), + StreamBuilder( + stream: videoCallDurationStream, + builder: (BuildContext context, AsyncSnapshot snapshot) { + if(snapshot.hasData && snapshot.data != null) + return InkWell( + onTap: (){ + }, + child: Container( + decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20)), + padding: EdgeInsets.symmetric(vertical: 2, horizontal: 10), + child: Text(snapshot.data, style: TextStyle(color: Colors.white),), + ), + ); + else + return Container(); + }, + ), ]), ), Row(children: [ @@ -152,13 +172,13 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget )) : SizedBox(), if (SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient") + "List_MyOutPatient" && !isFromLiveCare) Container( child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).appointmentDate + + TranslationBase.of(context).appointmentDate + " : ", fontSize: 14, ), @@ -182,14 +202,14 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget SizedBox( width: 3.5, ), - Container( - child: AppText( - convertDateFormat2( - patient.appointmentDate ?? ''), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, + Container( + child: AppText( + convertDateFormat2( + patient.appointmentDate ?? ''), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), ), - ), SizedBox( height: 0.5, ) @@ -260,7 +280,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget style: TextStyle(fontSize: 14)), new TextSpan( text: - "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth??"" : patient.dateofBirth??"", context)}", + "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth??"" : patient.dateofBirth??"", context,isServerFormat: !isFromLiveCare)}", style: TextStyle( fontWeight: FontWeight.w700, fontSize: 14)), ], diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design.dart b/lib/widgets/patients/profile/patient-profile-header-new-design.dart deleted file mode 100644 index 1db29087..00000000 --- a/lib/widgets/patients/profile/patient-profile-header-new-design.dart +++ /dev/null @@ -1,316 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:intl/intl.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class PatientProfileHeaderNewDesign extends StatelessWidget { - final PatiantInformtion patient; - final String patientType; - final String arrivalType; - final double height; - final bool isHaveMargin; - - PatientProfileHeaderNewDesign( - this.patient, this.patientType, this.arrivalType, - {this.height = 0.0, this.isHaveMargin=true}); - - @override - Widget build(BuildContext context) { - int gender = 1; - if (patient.patientDetails != null) { - gender = patient.patientDetails.gender; - } else { - gender = patient.gender; - } - - return Container( - padding: EdgeInsets.only( - left: 0, - right: 5, - bottom: 5, - ), - decoration: BoxDecoration( - color: Colors.white, - ), - height: height == 0 ? 200 : height, - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), - child: Column( - children: [ - Container( - padding: EdgeInsets.only(left: 12.0), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), - Expanded( - child: AppText( - patient.firstName != null - ? (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize(patient.lastName)) - : Helpers.capitalize(patient.patientDetails.fullName), - fontSize: SizeConfig.textMultiplier * 2.2, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - ), - ), - gender == 1 - ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) - : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 4), - child: InkWell( - onTap: () { - launch("tel://" + patient.mobileNumber); - }, - child: Icon( - Icons.phone, - color: Colors.black87, - ), - ), - ), - ]), - ), - Row(children: [ - Padding( - padding: EdgeInsets.only(left: 12.0), - child: Container( - width: 60, - height: 60, - child: Image.asset( - gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SERVICES_PATIANT2[int.parse(patientType)] == - "patientArrivalList" - ? Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - patient.patientStatusType == 43 - ? AppText( - TranslationBase.of(context).arrivedP, - color: Colors.green, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 12, - ) - : AppText( - TranslationBase.of(context).notArrived, - color: Colors.red[800], - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 12, - ), - arrivalType == '1' || patient.arrivedOn == null - ? AppText( - patient.startTime != null - ? patient.startTime - : '', - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - ) - : AppText( - AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(patient.arrivedOn)), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - ) - ], - )) - : SizedBox(), - if (SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient") - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).appointmentDate + - " : ", - fontSize: 14, - ), - patient.startTime != null - ? Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - patient.startTime ?? "", - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ) - : SizedBox(), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2( - patient.appointmentDate.toString() ?? ''), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 0.5, - ) - ], - ), - margin: EdgeInsets.only( - top: 8, - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - RichText( - text: TextSpan( - style: TextStyle( - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Colors.black), - children: [ - new TextSpan( - text: TranslationBase.of(context).fileNumber, - style: TextStyle( - fontSize: 12, fontFamily: 'Poppins')), - new TextSpan( - text: patient.patientId.toString(), - style: TextStyle( - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - fontSize: 14)), - ], - ), - ), - Row( - children: [ - AppText( - patient.nationalityName ?? - patient.nationality ?? - patient.nationalityId ?? - '', - fontWeight: FontWeight.bold, - fontSize: 12, - ), - patient.nationalityFlagURL != null - ? ClipRRect( - borderRadius: BorderRadius.circular(20.0), - child: Image.network( - patient.nationalityFlagURL, - height: 25, - width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return Text('No Image'); - }, - )) - : SizedBox() - ], - ) - ], - ), - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: TranslationBase.of(context).age + " : ", - style: TextStyle(fontSize: 14)), - new TextSpan( - text: - "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth ?? "" : patient.dateofBirth ?? "", context)}", - style: TextStyle( - fontWeight: FontWeight.w700, fontSize: 14)), - ], - ), - ), - ), - ], - ), - ), - ]), - ], - ), - ), - ); - } - - convertDateFormat2(String str) { - String newDate; - const start = "/Date("; - if (str.isNotEmpty) { - const end = "+0300)"; - - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); - } - - return newDate.toString(); - } - - isToday(date) { - DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); - return DateFormat("yyyy-MM-dd").format(tempDate) == - DateFormat("yyyy-MM-dd").format(DateTime.now()); - } - - myBoxDecoration() { - return BoxDecoration( - border: Border( - top: BorderSide( - color: Colors.green, - width: 5, - ), - ), - borderRadius: BorderRadius.circular(10)); - } -} diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart b/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart deleted file mode 100644 index c3a8638f..00000000 --- a/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart +++ /dev/null @@ -1,242 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class PatientProfileHeaderNewDesignInPatient extends StatelessWidget { - final PatiantInformtion patient; - final String patientType; - final String arrivalType; - final double height; - - PatientProfileHeaderNewDesignInPatient( - this.patient, this.patientType, this.arrivalType, - {this.height = 0.0}); - - @override - Widget build(BuildContext context) { - int gender = 1; - if (patient.patientDetails != null) { - gender = patient.patientDetails.gender; - } else { - gender = patient.gender; - } - - return Container( - padding: EdgeInsets.only( - left: 0, - right: 5, - bottom: 5, - ), - decoration: BoxDecoration( - color: Colors.white, - ), - height: height == 0 ? 200 : height, - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - // margin: EdgeInsets.only(top: 50), - child: Column( - children: [ - Container( - padding: EdgeInsets.only(left: 12.0), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), - Expanded( - child: AppText( - patient.firstName != null - ? (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize(patient.lastName)) - : Helpers.capitalize(patient.patientDetails.fullName), - fontSize: SizeConfig.textMultiplier * 2.2, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - ), - ), - gender == 1 - ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) - : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 4), - child: InkWell( - onTap: () { - launch("tel://" + patient.mobileNumber); - }, - child: Icon( - Icons.phone, - color: Colors.black87, - ), - ), - ), - ]), - ), - Row(children: [ - Padding( - padding: EdgeInsets.only(left: 12.0), - child: Container( - width: 60, - height: 60, - child: Image.asset( - gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - TranslationBase.of(context).fileNumber, - fontSize: 1.2 * SizeConfig.textMultiplier, - ), - AppText(patient.patientId.toString(), - fontSize: 1.4 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w700), - ], - ), - if(patient.admissionDate!=null) - Row( - children: [ - AppText( - AppDateUtils.convertDateFromServerFormat( - patient.admissionDate, "hh:mm a"), - fontWeight: FontWeight.bold, - fontSize: 1.4 * SizeConfig.textMultiplier, - ), - ], - ) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - if(patient.admissionDate!=null) - Row( - children: [ - AppText( - "${TranslationBase.of(context).admissionDate}: ", - fontSize: 1.2 * SizeConfig.textMultiplier, - ), - AppText( - AppDateUtils.convertDateFromServerFormat( - patient.admissionDate, "dd MMM,yyyy"), - fontSize: 1.4 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w700), - ], - ), - Row( - children: [ - AppText( - patient.nationalityName ?? - patient.nationality ?? - patient.nationalityId ?? - '', - fontWeight: FontWeight.bold, - fontSize: 1.4 * SizeConfig.textMultiplier, - ), - patient.nationalityFlagURL != null - ? ClipRRect( - borderRadius: BorderRadius.circular(20.0), - child: Image.network( - patient.nationalityFlagURL, - height: 25, - width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return Text('No Image'); - }, - )) - : SizedBox() - ], - ) - ], - ), - if(patient.admissionDate!=null) - Row( - children: [ - AppText( - "${TranslationBase.of(context).numOfDays}: ", - fontSize: 1.2 * SizeConfig.textMultiplier, - ), - AppText( - "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", - fontSize: 1.4 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w700), - ], - ), - ], - ), - ), - ]), - ], - ), - ), - ); - } - - convertDateFormat2(String str) { - String newDate; - const start = "/Date("; - if (str.isNotEmpty) { - const end = "+0300)"; - - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); - } - - return newDate.toString(); - } - - isToday(date) { - DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); - return DateFormat("yyyy-MM-dd").format(tempDate) == - DateFormat("yyyy-MM-dd").format(DateTime.now()); - } - - myBoxDecoration() { - return BoxDecoration( - border: Border( - top: BorderSide( - color: Colors.green, - width: 5, - ), - ), - borderRadius: BorderRadius.circular(10)); - } -} diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart deleted file mode 100644 index f3e01316..00000000 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart +++ /dev/null @@ -1,507 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:intl/intl.dart'; -import 'package:provider/provider.dart'; -import 'package:url_launcher/url_launcher.dart'; - -import 'large_avatar.dart'; - -class PatientProfileHeaderWhitAppointment extends StatelessWidget { - - final PatiantInformtion patient; - final String patientType; - final String arrivalType; - final String doctorName; - final String branch; - final DateTime appointmentDate; - final String profileUrl; - final String invoiceNO; - final String orderNo; - final bool isPrescriptions; - final String clinic; - PatientProfileHeaderWhitAppointment( - {this.patient, - this.patientType, - this.arrivalType, - this.doctorName, - this.branch, - this.appointmentDate, - this.profileUrl, - this.invoiceNO, - this.orderNo, this.isPrescriptions = false, this.clinic}); - - @override - Widget build(BuildContext context) { - int gender = 1; - if (patient.patientDetails != null) { - gender = patient.patientDetails.gender; - } else { - gender = patient.gender; - } - - ProjectViewModel projectViewModel = Provider.of(context); - return Container( - padding: EdgeInsets.only( - left: 0, right: 5, bottom: 5, top: 5), - decoration: BoxDecoration( - color: Colors.white, - ), - //height: 300, - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only(left: 12.0), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), - Expanded( - child: AppText( - patient.firstName != null ? - (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize( - patient.lastName)) : Helpers.capitalize(patient.patientDetails.fullName), - fontSize: SizeConfig.textMultiplier *2.2, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - ), - ), - gender == 1 - ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) - : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 4), - child: InkWell( - onTap: () { - launch("tel://" + patient.mobileNumber); - }, - child: Icon( - Icons.phone, - color: Colors.black87, - ), - ), - ) - ]), - ), - Row(children: [ - Padding( - padding: EdgeInsets.only(left: 12.0), - child: Container( - width: 60, - height: 60, - child: Image.asset( - gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SERVICES_PATIANT2[ - int.parse(patientType)] == - "patientArrivalList" - ? Container( - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - patient.patientStatusType == - 43 - ? AppText( - TranslationBase.of( - context) - .arrivedP, - color: Colors.green, - fontWeight: - FontWeight.bold, - fontFamily: - 'Poppins', - fontSize: 12, - ) - : AppText( - TranslationBase.of( - context) - .notArrived, - color: - Colors.red[800], - fontWeight: - FontWeight.bold, - fontFamily: - 'Poppins', - fontSize: 12, - ), - arrivalType == '1' || patient.arrivedOn == null - ? AppText( - patient.startTime != - null - ? patient - .startTime - : '', - fontFamily: - 'Poppins', - fontWeight: - FontWeight.w600, - ) - : AppText( - AppDateUtils.convertStringToDateFormat( - patient - .arrivedOn, - 'MM-dd-yyyy HH:mm'), - fontFamily: - 'Poppins', - fontWeight: - FontWeight.w600, - ) - ], - )) - : SizedBox(), - if (SERVICES_PATIANT2[ - int.parse(patientType)] == - "List_MyOutPatient") - Container( - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .appointmentDate + - " : ", - fontSize: 14, - ), - patient.startTime != null - ? Container( - height: 15, - width: 60, - decoration: - BoxDecoration( - borderRadius: - BorderRadius - .circular( - 25), - color: HexColor( - "#20A169"), - ), - child: AppText( - patient.startTime, - color: Colors.white, - fontSize: 1.5 * - SizeConfig - .textMultiplier, - textAlign: TextAlign - .center, - fontWeight: - FontWeight.bold, - ), - ) - : SizedBox(), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(patient.appointmentDate.toString()?? ''), - fontSize: 1.5 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold, - ), - ), - SizedBox( - height: 0.5, - ) - ], - ), - margin: EdgeInsets.only( - top: 8, - ), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - RichText( - text: TextSpan( - style: TextStyle( - fontSize: 1.6 * - SizeConfig - .textMultiplier, - color: Colors.black), - children: [ - new TextSpan( - text: - TranslationBase.of( - context) - .fileNumber, - style: TextStyle( - fontSize: 12, - fontFamily: - 'Poppins')), - new TextSpan( - text: patient.patientId - .toString(), - style: TextStyle( - fontWeight: - FontWeight.w700, - fontFamily: - 'Poppins', - fontSize: 14)), - ], - ), - ), - Row( - children: [ - AppText( - patient.nationalityName ?? - patient.nationality??"", - fontWeight: FontWeight.bold, - fontSize: 12, - ), - patient.nationality != null - ? ClipRRect( - borderRadius: - BorderRadius - .circular( - 20.0), - child: Image.network( - patient.nationalityFlagURL, - height: 25, - width: 30, - errorBuilder: - (BuildContext - context, - Object - exception, - StackTrace - stackTrace) { - return Text( - 'No Image'); - }, - )) - : SizedBox() - ], - ) - ], - ), - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 1.6 * - SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: TranslationBase.of( - context) - .age + - " : ", - style: TextStyle( - fontSize: 14)), - new TextSpan( - text: - "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth ??"": patient.dateofBirth??"", context)}", - style: TextStyle( - fontWeight: - FontWeight.w700, - fontSize: 14)), - ], - ), - ), - ), - ], - ), - ), - ]), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 30, - height: 30, - margin: EdgeInsets.only(left: projectViewModel.isArabic?10:85, right: projectViewModel.isArabic?85:10,top: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border( - bottom:BorderSide(color: Colors.grey[400],width: 2.5), - left: BorderSide(color: Colors.grey[400],width: 2.5), - ) - ), - ), - Expanded( - child: Container( - margin: EdgeInsets.only(top: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: LargeAvatar( - name: doctorName, - url: profileUrl, - ), - width: 25, - height: 25, - margin: EdgeInsets.only(top: 10), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - '${TranslationBase.of(context).dr}.$doctorName', - color: Colors.black, - fontWeight: FontWeight.w600, - fontSize: 14, - ), - if (orderNo != null && !isPrescriptions) - Row( - children: [ - AppText( - 'Order No:', - color: Colors.grey[800], - ), - AppText( - orderNo ?? '', - ) - ], - ), - if (invoiceNO != null && !isPrescriptions) - Row( - children: [ - AppText( - 'Invoice:', - color: Colors.grey[800], - ), - AppText( - invoiceNO, - ) - ], - ), - if(isPrescriptions) - Row( - children: [ - AppText( - 'Branch:', - color: Colors.grey[800], - ), - AppText( - branch?? '', - ) - ], - ), - if(isPrescriptions) - Row( - children: [ - AppText( - 'Clinic:', - color: Colors.grey[800], - ), - AppText( - clinic?? '', - ) - ], - ), - Row( - children: [ - AppText( - !isPrescriptions? 'Result Date:': 'Prescriptions Date', - color: Colors.grey[800], - ), - Expanded( - child: AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', - ), - ) - ], - ) - ]), - ), - ), - - ], - ), - ), - ), - ], - ) - ], - ), - ), - ); - } - - convertDateFormat2(String str) { - String newDate =""; - const start = "/Date("; - const end = "+0300)"; - - if (str.isNotEmpty) { - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); - } - - return newDate.toString(); - } - - isToday(date) { - DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); - return DateFormat("yyyy-MM-dd").format(tempDate) == - DateFormat("yyyy-MM-dd").format(DateTime.now()); - } - - myBoxDecoration() { - return BoxDecoration( - border: Border( - top: BorderSide( - color: Colors.green, - width: 5, - ), - ), - borderRadius: BorderRadius.circular(10)); - } -} diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart deleted file mode 100644 index 2e47b211..00000000 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart +++ /dev/null @@ -1,471 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:intl/intl.dart'; -import 'package:provider/provider.dart'; -import 'package:url_launcher/url_launcher.dart'; - -import 'large_avatar.dart'; - -class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget - with PreferredSizeWidget { - final PatiantInformtion patient; - final String patientType; - final String arrivalType; - final String doctorName; - final String branch; - final DateTime appointmentDate; - final String profileUrl; - final String invoiceNO; - final String orderNo; - final bool isPrescriptions; - final bool isMedicalFile; - final String episode; - final String vistDate; - - final String clinic; - PatientProfileHeaderWhitAppointmentAppBar( - {this.patient, - this.patientType, - this.arrivalType, - this.doctorName, - this.branch, - this.appointmentDate, - this.profileUrl, - this.invoiceNO, - this.orderNo, - this.isPrescriptions = false, - this.clinic, - this.isMedicalFile = false, - this.episode, - this.vistDate}); - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - int gender = 1; - if (patient.patientDetails != null) { - gender = patient.patientDetails.gender; - } else { - gender = patient.gender; - } - - return Container( - padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), - decoration: BoxDecoration( - color: Colors.white, - ), - //height: 300, - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only(left: 12.0), - child: Row(children: [ - IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.black, //Colors.black, - onPressed: () => Navigator.pop(context), - ), - Expanded( - child: AppText( - patient.firstName != null - ? (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize(patient.lastName)) - : Helpers.capitalize(patient.patientDetails.fullName), - fontSize: SizeConfig.textMultiplier * 2.2, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - ), - ), - gender == 1 - ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) - : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 4), - child: InkWell( - onTap: () { - launch("tel://" + patient.mobileNumber); - }, - child: Icon( - Icons.phone, - color: Colors.black87, - ), - ), - ) - ]), - ), - Row(children: [ - Padding( - padding: EdgeInsets.only(left: 12.0), - child: Container( - width: 60, - height: 60, - child: Image.asset( - gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit.cover, - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SERVICES_PATIANT2[int.parse(patientType)] == - "patientArrivalList" - ? Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - patient.patientStatusType == 43 - ? AppText( - TranslationBase.of(context).arrivedP, - color: Colors.green, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 12, - ) - : AppText( - TranslationBase.of(context).notArrived, - color: Colors.red[800], - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 12, - ), - arrivalType == '1' || patient.arrivedOn == null - ? AppText( - patient.startTime != null - ? patient.startTime - : '', - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - ) - : AppText( - AppDateUtils.convertStringToDateFormat( - patient.arrivedOn, - 'MM-dd-yyyy HH:mm'), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - ) - ], - )) - : SizedBox(), - if (SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient") - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).appointmentDate + - " : ", - fontSize: 14, - ), - patient.startTime != null - ? Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - patient.startTime ?? "", - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ) - : SizedBox(), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2( - patient.appointmentDate.toString() ?? ''), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 0.5, - ) - ], - ), - margin: EdgeInsets.only( - top: 8, - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - RichText( - text: TextSpan( - style: TextStyle( - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Colors.black), - children: [ - new TextSpan( - text: TranslationBase.of(context).fileNumber, - style: TextStyle( - fontSize: 12, fontFamily: 'Poppins')), - new TextSpan( - text: patient.patientId.toString(), - style: TextStyle( - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - fontSize: 14)), - ], - ), - ), - Row( - children: [ - AppText( - patient.nationalityName ?? - patient.nationality ?? - "", - fontWeight: FontWeight.bold, - fontSize: 12, - ), - patient.nationality != null - ? ClipRRect( - borderRadius: BorderRadius.circular(20.0), - child: Image.network( - patient.nationalityFlagURL, - height: 25, - width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return Text('No Image'); - }, - )) - : SizedBox() - ], - ) - ], - ), - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: TranslationBase.of(context).age + " : ", - style: TextStyle(fontSize: 14)), - new TextSpan( - text: - "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth : patient.dateofBirth, context)}", - style: TextStyle( - fontWeight: FontWeight.w700, fontSize: 14)), - ], - ), - ), - ), - ], - ), - ), - ]), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 30, - height: 30, - margin: EdgeInsets.only( - left: projectViewModel.isArabic ? 10 : 85, - right: projectViewModel.isArabic ? 85 : 10, - top: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border( - bottom: BorderSide(color: Colors.grey[400], width: 2.5), - left: BorderSide(color: Colors.grey[400], width: 2.5), - )), - ), - Expanded( - child: Container( - margin: EdgeInsets.only(top: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: LargeAvatar( - name: doctorName ?? "", - url: profileUrl, - ), - width: 25, - height: 25, - margin: EdgeInsets.only(top: 10), - ), - Expanded( - flex: 5, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - '${TranslationBase.of(context).dr}$doctorName', - color: Colors.black, - fontWeight: FontWeight.w600, - fontSize: 9, - ), - if (orderNo != null && !isPrescriptions) - Row( - children: [ - AppText('Order No: ', - color: Colors.grey[800], - fontSize: 12), - AppText(orderNo ?? '', fontSize: 12) - ], - ), - if (invoiceNO != null && !isPrescriptions) - Row( - children: [ - AppText('Invoice: ', - color: Colors.grey[800], - fontSize: 12), - AppText(invoiceNO, fontSize: 12) - ], - ), - if (branch != null) - Row( - children: [ - AppText('Branch: ', - color: Colors.grey[800], - fontSize: 12), - AppText(branch ?? '', fontSize: 12) - ], - ), - - if (clinic != null) - Row( - children: [ - AppText('Clinic: ', - color: Colors.grey[800], - fontSize: 12), - AppText(clinic ?? '', fontSize: 12) - ], - ), - if (isMedicalFile && episode != null) - Row( - children: [ - AppText('Episode: ', - color: Colors.grey[800], - fontSize: 12), - AppText(episode ?? '', fontSize: 12) - ], - ), - if (isMedicalFile && vistDate != null) - Row( - children: [ - AppText('Visit Date: ', - color: Colors.grey[800], - fontSize: 12), - AppText(vistDate ?? '', fontSize: 12) - ], - ), - if (!isMedicalFile) - Row( - children: [ - Expanded( - child: AppText( - !isPrescriptions - ? 'Result Date: ' - : 'Prescriptions Date ', - color: Colors.grey[800], - fontSize: 12, - ), - ), - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', - fontSize: 14, - ) - ], - ) - ]), - ), - ), - ], - ), - ), - ), - ], - ) - ], - ), - ), - ); - } - - convertDateFormat2(String str) { - String newDate = ""; - const start = "/Date("; - const end = "+0300)"; - - if (str.isNotEmpty) { - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); - } - - return newDate.toString(); - } - - isToday(date) { - DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); - return DateFormat("yyyy-MM-dd").format(tempDate) == - DateFormat("yyyy-MM-dd").format(DateTime.now()); - } - - myBoxDecoration() { - return BoxDecoration( - border: Border( - top: BorderSide( - color: Colors.green, - width: 5, - ), - ), - borderRadius: BorderRadius.circular(10)); - } - - @override - Size get preferredSize => Size(double.maxFinite, 310); -} diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index 10586552..53228bc2 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -1,17 +1,17 @@ -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class ProfileWelcomeWidget extends StatelessWidget { final Widget clinicWidget; final double height; - final bool isClilic; + final bool isClinic; ProfileWelcomeWidget(this.clinicWidget, - {this.height = 150, this.isClilic = false}); + {this.height = 150, this.isClinic = false}); @override Widget build(BuildContext context) { - AuthViewModel authProvider = Provider.of(context); + AuthenticationViewModel authenticationViewModel = Provider.of(context); return Container( height: height, @@ -23,39 +23,17 @@ class ProfileWelcomeWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: [ - this.isClilic == true ? clinicWidget : SizedBox(), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).welcome, - // fontSize: SizeConfig.textMultiplier * 1.7, - // color: Colors.black, - // ) - // ], - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // AppText( - // // TranslationBase.of(context).dr + - // ' ${authProvider.doctorProfile.doctorName}', - // fontWeight: FontWeight.bold, - // fontSize: SizeConfig.textMultiplier * 2.5, - // color: Colors.black, - // ), + this.isClinic == true ? clinicWidget : SizedBox(), SizedBox( width: 20, ), + if(authenticationViewModel.doctorProfile!=null) CircleAvatar( // radius: (52) child: ClipRRect( borderRadius: BorderRadius.circular(20), child: Image.network( - authProvider.doctorProfile.doctorImageURL, + authenticationViewModel.doctorProfile.doctorImageURL, fit: BoxFit.fill, width: 75, height: 75, @@ -63,23 +41,10 @@ class ProfileWelcomeWidget extends StatelessWidget { ), backgroundColor: Colors.transparent, ), - // ], - // ), SizedBox( height: 20, ), - /// ], - // ), - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.end, - // children: [ - - // ], - // ), - // ), ], )), ); diff --git a/lib/widgets/patients/profile/profile_header_widget.dart b/lib/widgets/patients/profile/profile_header_widget.dart deleted file mode 100644 index df958106..00000000 --- a/lib/widgets/patients/profile/profile_header_widget.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - -import '../../../config/size_config.dart'; -import '../../shared/profile_image_widget.dart'; - -/* - *@author: Elham Rababah - *@Date:21/4/2020 - *@param: - *@return: - *@desc: Profile Header Widget class - */ -class ProfileHeaderWidget extends StatelessWidget { - ProfileHeaderWidget({ - Key key, - this.patient - }) : super(key: key); - - PatiantInformtion patient; - - @override - Widget build(BuildContext context) { - // PatientsProvider patientsProv = Provider.of(context); - // patient = patientsProv.getSelectedPatient(); - return Container( - height: SizeConfig.heightMultiplier * 30, - child: ProfileImageWidget( - url: - "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - name: patient.firstName + ' ' + patient.lastName, - des: patient.patientId.toString(), - height: SizeConfig.heightMultiplier * 17, - width: SizeConfig.heightMultiplier * 17, - color: HexColor('#58434F')), - ); - } -} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart index ac33eb82..573ada32 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart @@ -46,500 +46,168 @@ class ProfileMedicalInfoWidgetSearch extends StatelessWidget { height: MediaQuery.of(context).size.height * 1.0, width: double.infinity, child: Scaffold( - appBar: AppBar( - backgroundColor: Colors.white, - toolbarHeight: 55, - elevation: 0, - bottom: TabBar( - controller: _tabController, - indicator: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10), // Creates border - color: Color(0xffD02126), - ), - //isScrollable: true, - - //indicatorWeight: 4.0, - indicatorColor: Colors.red[500], - - // labelPadding: - // EdgeInsets.symmetric(horizontal: 13.0, vertical: 2.0), - unselectedLabelColor: Color(0xff5A6168), - labelColor: Colors.white, - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.35, - height: MediaQuery.of(context).size.height * 0.06, - child: Center( - child: Text('Inpatient Info'), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.35, - height: MediaQuery.of(context).size.height * 0.06, - child: Center( - child: Text('OutPatient Info'), - ), - ), - ]), - ), - body: Padding( - padding: const EdgeInsets.symmetric(vertical: 15.0), - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - GridView.count( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - crossAxisSpacing: 10, - mainAxisSpacing: 10, - childAspectRatio: 1 / 1.0, - crossAxisCount: 3, - children: [ - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: TranslationBase.of(context).vital, - nameLine2: TranslationBase.of(context).signs, - route: VITAL_SIGN_DETAILS, - isInPatient: true, - icon: 'patient/vital_signs.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: LAB_RESULT, - isInPatient: true, - nameLine1: TranslationBase.of(context).lab, - nameLine2: TranslationBase.of(context).result, - icon: 'patient/lab_results.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isInPatient: isInpatient, - route: RADIOLOGY_PATIENT, - nameLine1: TranslationBase.of(context).radiology, - nameLine2: TranslationBase.of(context).result, - icon: 'patient/health_summary.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_PRESCRIPTION_NEW, - nameLine1: TranslationBase.of(context).patient, - nameLine2: TranslationBase.of(context).prescription, - icon: 'patient/order_prescription.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PROGRESS_NOTE, - isDischargedPatient: isDischargedPatient, - nameLine1: TranslationBase.of(context).progress, - nameLine2: TranslationBase.of(context).note, - icon: 'patient/Progress_notes.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_NOTE, - isDischargedPatient: isDischargedPatient, - nameLine1: "Order", //"Text", - nameLine2: - "Sheet", //TranslationBase.of(context).orders, - icon: 'patient/Progress_notes.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_PROCEDURE, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).procedures, - icon: 'patient/Order_Procedures.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: HEALTH_SUMMARY, - nameLine1: "Health", - //TranslationBase.of(context).medicalReport, - nameLine2: "Summary", - //TranslationBase.of(context).summaryReport, - icon: 'patient/health_summary.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isDisable: true, - route: HEALTH_SUMMARY, - nameLine1: "Medical", //Health - //TranslationBase.of(context).medicalReport, - nameLine2: "Report", //Report - //TranslationBase.of(context).summaryReport, - icon: 'patient/health_summary.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: REFER_IN_PATIENT_TO_DOCTOR, - isInPatient: true, - nameLine1: TranslationBase.of(context).referral, - nameLine2: TranslationBase.of(context).patient, - icon: 'patient/refer_patient.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PATIENT_INSURANCE_APPROVALS_NEW, - nameLine1: TranslationBase.of(context).insurance, - nameLine2: TranslationBase.of(context).approvals, - icon: 'patient/vital_signs.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isDisable: true, - route: null, - nameLine1: "Discharge", - nameLine2: "Summery", - icon: 'patient/patient_sick_leave.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ADD_SICKLEAVE, - nameLine1: TranslationBase.of(context).patientSick, - nameLine2: TranslationBase.of(context).leave, - icon: 'patient/patient_sick_leave.png'), - ], - ), - GridView.count( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - crossAxisSpacing: 10, - mainAxisSpacing: 10, - childAspectRatio: 1 / 1.0, - crossAxisCount: 3, - children: [ - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: TranslationBase.of(context).vital, - nameLine2: TranslationBase.of(context).signs, - route: VITAL_SIGN_DETAILS, - icon: 'patient/vital_signs.png'), - // if (selectedPatientType != 7) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: HEALTH_SUMMARY, - nameLine1: - "Health", //TranslationBase.of(context).medicalReport, - nameLine2: - "Summary", //TranslationBase.of(context).summaryReport, - icon: 'patient/health_summary.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: LAB_RESULT, - nameLine1: TranslationBase.of(context).lab, - nameLine2: TranslationBase.of(context).result, - icon: 'patient/lab_results.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isInPatient: isInpatient, - route: RADIOLOGY_PATIENT, - nameLine1: TranslationBase.of(context).radiology, - nameLine2: TranslationBase.of(context).service, - icon: 'patient/health_summary.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PATIENT_ECG, - nameLine1: TranslationBase.of(context).patient, - nameLine2: "ECG", - icon: 'patient/patient_sick_leave.png'), - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_PRESCRIPTION_NEW, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).prescription, - icon: 'patient/order_prescription.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_PROCEDURE, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).procedures, - icon: 'patient/Order_Procedures.png'), - //if (int.parse(patientType) == 7 || int.parse(patientType) == 6) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PATIENT_INSURANCE_APPROVALS_NEW, - nameLine1: TranslationBase.of(context).insurance, - nameLine2: TranslationBase.of(context).service, - icon: 'patient/vital_signs.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ADD_SICKLEAVE, - nameLine1: TranslationBase.of(context).patientSick, - nameLine2: TranslationBase.of(context).leave, - icon: 'patient/patient_sick_leave.png'), - if (patient.appointmentNo != null && - patient.appointmentNo != 0) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PATIENT_UCAF_REQUEST, - isDisable: - patient.patientStatusType != 43 ? true : false, - nameLine1: TranslationBase.of(context).patient, - nameLine2: TranslationBase.of(context).ucaf, - icon: 'patient/ucaf.png'), - if (patient.appointmentNo != null && - patient.appointmentNo != 0) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: REFER_PATIENT_TO_DOCTOR, - isDisable: - patient.patientStatusType != 43 ? true : false, - nameLine1: TranslationBase.of(context).referral, - nameLine2: TranslationBase.of(context).patient, - icon: 'patient/refer_patient.png'), - if (patient.appointmentNo != null && - patient.appointmentNo != 0) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PATIENT_ADMISSION_REQUEST, - isDisable: - patient.patientStatusType != 43 ? true : false, - nameLine1: TranslationBase.of(context).admission, - nameLine2: TranslationBase.of(context).request, - icon: 'patient/admission_req.png'), - if (isInpatient) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PROGRESS_NOTE, - nameLine1: TranslationBase.of(context).progress, - nameLine2: TranslationBase.of(context).note, - icon: 'patient/Progress_notes.png'), - if (isInpatient) - PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: ORDER_NOTE, - nameLine1: "Order", //"Text", - nameLine2: "Sheet", - icon: 'patient/Progress_notes.png'), - ], - ), - ], - ), + body: GridView.count( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + crossAxisSpacing: 8, + mainAxisSpacing: 10, + childAspectRatio: 1 / 1.0, + crossAxisCount: 3, + children: [ + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: TranslationBase.of(context).vital, + nameLine2: TranslationBase.of(context).signs, + route: VITAL_SIGN_DETAILS, + icon: 'patient/vital_signs.png'), + // if (selectedPatientType != 7) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: HEALTH_SUMMARY, + nameLine1: + "Health", //TranslationBase.of(context).medicalReport, + nameLine2: + "Summary", //TranslationBase.of(context).summaryReport, + icon: 'patient/health_summary.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: LAB_RESULT, + nameLine1: TranslationBase.of(context).lab, + nameLine2: TranslationBase.of(context).result, + icon: 'patient/lab_results.png'), + // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + isInPatient: isInpatient, + route: RADIOLOGY_PATIENT, + nameLine1: TranslationBase.of(context).radiology, + nameLine2: TranslationBase.of(context).service, + icon: 'patient/health_summary.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_ECG, + nameLine1: TranslationBase.of(context).patient, + nameLine2: "ECG", + icon: 'patient/patient_sick_leave.png'), + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PRESCRIPTION_NEW, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).prescription, + icon: 'patient/order_prescription.png'), + // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_PROCEDURE, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).procedures, + icon: 'patient/Order_Procedures.png'), + //if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_INSURANCE_APPROVALS_NEW, + nameLine1: TranslationBase.of(context).insurance, + nameLine2: TranslationBase.of(context).service, + icon: 'patient/vital_signs.png'), + // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ADD_SICKLEAVE, + nameLine1: TranslationBase.of(context).patientSick, + nameLine2: TranslationBase.of(context).leave, + icon: 'patient/patient_sick_leave.png'), + if (patient.appointmentNo != null && + patient.appointmentNo != 0) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_UCAF_REQUEST, + isDisable: + patient.patientStatusType != 43 ? true : false, + nameLine1: TranslationBase.of(context).patient, + nameLine2: TranslationBase.of(context).ucaf, + icon: 'patient/ucaf.png'), + if (patient.appointmentNo != null && + patient.appointmentNo != 0) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: REFER_PATIENT_TO_DOCTOR, + isDisable: + patient.patientStatusType != 43 ? true : false, + nameLine1: TranslationBase.of(context).referral, + nameLine2: TranslationBase.of(context).patient, + icon: 'patient/refer_patient.png'), + if (patient.appointmentNo != null && + patient.appointmentNo != 0) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PATIENT_ADMISSION_REQUEST, + isDisable: + patient.patientStatusType != 43 ? true : false, + nameLine1: TranslationBase.of(context).admission, + nameLine2: TranslationBase.of(context).request, + icon: 'patient/admission_req.png'), + if (isInpatient) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PROGRESS_NOTE, + nameLine1: TranslationBase.of(context).progress, + nameLine2: TranslationBase.of(context).note, + icon: 'patient/Progress_notes.png'), + if (isInpatient) + PatientProfileButton( + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: ORDER_NOTE, + nameLine1: "Order", //"Text", + nameLine2: "Sheet", + icon: 'patient/Progress_notes.png'), + ], ), ), ), - - // GridView.count( - // shrinkWrap: true, - // physics: NeverScrollableScrollPhysics(), - // crossAxisSpacing: 10, - // mainAxisSpacing: 10, - // childAspectRatio: 1 / 1.0, - // crossAxisCount: 3, - // children: [ - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // from: from, - // to: to, - // nameLine1: TranslationBase.of(context).vital, - // nameLine2: TranslationBase.of(context).signs, - // route: VITAL_SIGN_DETAILS, - // icon: 'patient/vital_signs.png'), - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: MEDICAL_FILE, - // nameLine1: - // "Health", //TranslationBase.of(context).medicalReport, - // nameLine2: - // "Summary", //TranslationBase.of(context).summaryReport, - // icon: 'patient/health_summary.png'), - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: LAB_RESULT, - // nameLine1: TranslationBase.of(context).lab, - // nameLine2: TranslationBase.of(context).result, - // icon: 'patient/lab_results.png'), - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // isInPatient: isInpatient, - // route: RADIOLOGY_PATIENT, - // nameLine1: TranslationBase.of(context).radiology, - // nameLine2: TranslationBase.of(context).service, - // icon: 'patient/health_summary.png'), - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: PATIENT_ECG, - // nameLine1: TranslationBase.of(context).patient, - // nameLine2: "ECG", - // icon: 'patient/patient_sick_leave.png'), - // (int.parse(patientType) == 7 || - // int.parse(patientType) == 6) - // ? PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: ORDER_PRESCRIPTION_NEW, - // nameLine1: TranslationBase.of(context).orders, - // nameLine2: - // TranslationBase.of(context).prescription, - // icon: 'patient/order_prescription.png') - // : PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: ORDER_PRESCRIPTION_NEW, - // nameLine1: TranslationBase.of(context).orders, - // nameLine2: - // TranslationBase.of(context).prescription, - // icon: 'patient/order_prescription.png'), - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: ORDER_PROCEDURE, - // nameLine1: TranslationBase.of(context).orders, - // nameLine2: TranslationBase.of(context).procedures, - // icon: 'patient/Order_Procedures.png'), - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: PATIENT_INSURANCE_APPROVALS_NEW, - // nameLine1: TranslationBase.of(context).insurance, - // nameLine2: TranslationBase.of(context).service, - // icon: 'patient/vital_signs.png'), - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: SHOW_SICKLEAVE, - // nameLine1: TranslationBase.of(context).patientSick, - // nameLine2: TranslationBase.of(context).leave, - // icon: 'patient/patient_sick_leave.png'), - // if (patient.admissionNo != null && - // patient.admissionNo != "0") - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: PROGRESS_NOTE, - // nameLine1: TranslationBase.of(context).progress, - // nameLine2: TranslationBase.of(context).note, - // icon: 'patient/Progress_notes.png'), - // if (patient.admissionNo != null && - // patient.admissionNo != "0") - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: ORDER_NOTE, - // nameLine1: "Order", //"Text", - // nameLine2: "Sheet", - // icon: 'patient/Progress_notes.png'), - // if (patient.appointmentNo != null && - // patient.appointmentNo != 0) - // PatientProfileButton( - // key: key, - // patient: patient, - // patientType: patientType, - // arrivalType: arrivalType, - // route: REFER_PATIENT_TO_DOCTOR, - // // isDisable: patient.patientStatusType != 43 ? true : false, - // nameLine1: TranslationBase.of(context).referral, - // nameLine2: TranslationBase.of(context).patient, - // icon: 'patient/refer_patient.png'), - // ], - // ), ), ); } diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index ebb49e6f..b13a4f10 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -1,9 +1,10 @@ -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; @@ -28,7 +29,7 @@ class _AppDrawerState extends State { @override Widget build(BuildContext context) { - AuthViewModel authProvider = Provider.of(context); + AuthenticationViewModel authenticationViewModel = Provider.of(context); projectsProvider = Provider.of(context); return RoundedContainer( child: Container( @@ -69,7 +70,7 @@ class _AppDrawerState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, ), SizedBox(height: 5), - if (authProvider.doctorProfile != null) + if (authenticationViewModel.doctorProfile != null) InkWell( onTap: () { // TODO: return it back when its needed @@ -85,7 +86,7 @@ class _AppDrawerState extends State { padding: EdgeInsets.only(top: 10), child: AppText( TranslationBase.of(context).dr + - authProvider.doctorProfile?.doctorName, + authenticationViewModel.doctorProfile?.doctorName, fontWeight: FontWeight.bold, color: Color(0xFF2E303A), fontFamily: 'Poppins', @@ -95,7 +96,7 @@ class _AppDrawerState extends State { Padding( padding: EdgeInsets.only(top: 0), child: AppText( - authProvider.doctorProfile?.clinicDescription, + authenticationViewModel.doctorProfile?.clinicDescription, fontWeight: FontWeight.w600, color: Color(0xFF2E303A), fontSize: 15, @@ -172,8 +173,8 @@ class _AppDrawerState extends State { ), onTap: () async { Navigator.pop(context); - await Helpers.logout(); - projectsProvider.isLogin = false; + await authenticationViewModel.logout(isFromLogin: false); + }, ), ], diff --git a/lib/widgets/shared/app_loader_widget.dart b/lib/widgets/shared/app_loader_widget.dart index 7b1f1718..4b6d753b 100644 --- a/lib/widgets/shared/app_loader_widget.dart +++ b/lib/widgets/shared/app_loader_widget.dart @@ -3,13 +3,6 @@ import 'package:progress_hud_v2/progress_hud.dart'; import 'loader/gif_loader_container.dart'; -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: - *@return: Positioned - *@desc: AppLoaderWidget to create loader - */ class AppLoaderWidget extends StatefulWidget { AppLoaderWidget({Key key, this.title, this.containerColor}) : super(key: key); @@ -21,25 +14,7 @@ class AppLoaderWidget extends StatefulWidget { } class _AppLoaderWidgetState extends State { - ProgressHUD _progressHUD; - @override - void initState() { - super.initState(); -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: - *@return: - *@desc: create loader the desing - */ - _progressHUD = new ProgressHUD( - backgroundColor: widget.containerColor == null ? Colors.black12 : widget.containerColor, - color: Colors.black, - // containerColor: Colors.blue, - borderRadius: 5.0, - // text: 'Loading...', - ); - } + @override Widget build(BuildContext context) { @@ -49,7 +24,7 @@ class _AppLoaderWidgetState extends State { child: Stack( children: [ Container( - color: Colors.grey.withOpacity(0.6), + color: widget.containerColor??Colors.grey.withOpacity(0.6), ), Container(child: GifLoaderContainer(), margin: EdgeInsets.only( bottom: MediaQuery.of(context).size.height * 0.09)) diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index e957b5d4..b930c21a 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -19,8 +19,11 @@ class AppScaffold extends StatelessWidget { final Widget bottomSheet; final Color backgroundColor; final Widget appBar; + final Widget drawer; + final Widget bottomNavigationBar; final String subtitle; final bool isHomeIcon; + final bool extendBody; AppScaffold( {this.appBarTitle = '', this.body, @@ -30,7 +33,7 @@ class AppScaffold extends StatelessWidget { this.bottomSheet, this.backgroundColor, this.isHomeIcon = true, - this.appBar, this.subtitle}); + this.appBar, this.subtitle, this.drawer, this.extendBody = false, this.bottomNavigationBar}); @override Widget build(BuildContext context) { @@ -42,6 +45,9 @@ class AppScaffold extends StatelessWidget { }, child: Scaffold( backgroundColor: backgroundColor ?? Colors.white, + drawer: drawer, + extendBody: extendBody, + bottomNavigationBar: bottomNavigationBar, appBar: isShowAppBar ? appBar ?? AppBar( diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index 74acff8a..48661a32 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -9,6 +9,7 @@ class AppText extends StatefulWidget { final Color color; final FontWeight fontWeight; final double fontSize; + final double fontHeight; final String fontFamily; final int maxLength; final bool italic; @@ -35,6 +36,7 @@ class AppText extends StatefulWidget { this.fontWeight, this.variant, this.fontSize, + this.fontHeight, this.fontFamily = 'Poppins', this.italic = false, this.maxLength = 60, @@ -121,20 +123,20 @@ class _AppTextState extends State { style: widget.style != null ? _getFontStyle().copyWith( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color , + color: widget.color, fontWeight: widget.fontWeight ?? _getFontWeight(), - ) + height: widget.fontHeight) : TextStyle( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color != null - ? widget.color - : Colors.black, + color: + widget.color != null ? widget.color : Colors.black, fontSize: widget.fontSize ?? _getFontSize(), letterSpacing: widget.variant == "overline" ? 1.5 : null, fontWeight: widget.fontWeight ?? _getFontWeight(), fontFamily: widget.fontFamily ?? 'Poppins', - decoration: widget.textDecoration), + decoration: widget.textDecoration, + height: widget.fontHeight), ), if (widget.readMore && text.length > widget.maxLength && hidden) Positioned( diff --git a/lib/widgets/shared/buttons/button_bottom_sheet.dart b/lib/widgets/shared/buttons/button_bottom_sheet.dart index 9db662d2..3c5cc32d 100644 --- a/lib/widgets/shared/buttons/button_bottom_sheet.dart +++ b/lib/widgets/shared/buttons/button_bottom_sheet.dart @@ -42,23 +42,27 @@ class ButtonBottomSheet extends StatelessWidget { Widget build(BuildContext context) { return Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: AppButton( - title: title, - onPressed: onPressed, - fontWeight: fontWeight, - color: color, - fontSize: fontSize, - padding: padding, - disabled: disabled, - radius: radius, - hasBorder: hasBorder, - fontColor: fontColor, - icon: icon, - iconData: iconData, - hPadding: hPadding, - vPadding: vPadding, - borderColor: borderColor, - loading: loading, + child: Column( + children: [ + AppButton( + title: title, + onPressed: onPressed, + fontWeight: fontWeight, + color: color, + fontSize: fontSize, + padding: padding, + disabled: disabled, + radius: radius, + hasBorder: hasBorder, + fontColor: fontColor, + icon: icon, + iconData: iconData, + hPadding: hPadding, + vPadding: vPadding, + borderColor: borderColor, + loading: loading, + ), + ], ), ); } diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index 2a98a381..faa4379a 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -139,6 +139,7 @@ class DoctorCard extends StatelessWidget { ), if (clinic != null) Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context).clinic + @@ -146,9 +147,11 @@ class DoctorCard extends StatelessWidget { color: Colors.grey[500], fontSize: 14, ), - AppText( - clinic, - fontSize: 14, + Expanded( + child: AppText( + clinic, + fontSize: 14, + ), ) ], ), diff --git a/lib/widgets/shared/rounded_container_widget.dart b/lib/widgets/shared/rounded_container_widget.dart index e86c85aa..8364bb79 100644 --- a/lib/widgets/shared/rounded_container_widget.dart +++ b/lib/widgets/shared/rounded_container_widget.dart @@ -1,9 +1,5 @@ import 'package:flutter/material.dart'; -// OWNER : Ibrahim albitar -// DATE : 05-04-2020 -// DESCRIPTION : Custom widget for rounded container and custom decoration - class RoundedContainer extends StatefulWidget { final double width; final double height; @@ -13,6 +9,9 @@ class RoundedContainer extends StatefulWidget { final double elevation; final bool showBorder; final Color borderColor; + final double shadowWidth; + final double shadowSpreadRadius; + final double shadowDy; final bool customCornerRaduis; final double topLeft; final double bottomRight; @@ -31,6 +30,9 @@ class RoundedContainer extends StatefulWidget { this.elevation = 1, this.showBorder = false, this.borderColor = Colors.red, + this.shadowWidth = 0.1, + this.shadowSpreadRadius = 10, + this.shadowDy = 5, this.customCornerRaduis = false, this.topLeft = 0, this.topRight = 0, @@ -63,10 +65,10 @@ class _RoundedContainerState extends State { : BorderRadius.circular(widget.raduis), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.1), - spreadRadius: 10, + color: Colors.grey.withOpacity(widget.shadowWidth), + spreadRadius: widget.shadowSpreadRadius, blurRadius: 5, - offset: Offset(0, 5), // changes position of shadow + offset: Offset(0, widget.shadowDy), // changes position of shadow ), ]) : null, diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index ded2568d..fc7df189 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -26,6 +26,7 @@ class AppTextFieldCustom extends StatefulWidget { final Function(String) onChanged; final String validationError; final bool isPrscription; + final bool isSecure; AppTextFieldCustom({ this.height = 0, @@ -45,6 +46,7 @@ class AppTextFieldCustom extends StatefulWidget { this.onChanged, this.validationError, this.isPrscription = false, + this.isSecure = false, }); @override @@ -103,36 +105,36 @@ class _AppTextFieldCustomState extends State { ? widget.height - 22 : null, child: TextField( - textAlign: projectViewModel.isArabic - ? TextAlign.right - : TextAlign.left, - decoration: TextFieldsUtils - .textFieldSelectorDecoration( - widget.hintText, null, true), - style: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.7, - fontFamily: 'Poppins', - color: Color(0xFF575757), - ), - controller: widget.controller, - keyboardType: widget.inputType ?? - (widget.maxLines == 1 - ? TextInputType.text - : TextInputType.multiline), - enabled: widget.enabled, - minLines: widget.minLines, - maxLines: widget.maxLines, - inputFormatters: - widget.inputFormatters != null - ? widget.inputFormatters - : [], - onChanged: (value) { - setState(() {}); - if (widget.onChanged != null) { - widget.onChanged(value); - } - }, - ), + textAlign: projectViewModel.isArabic + ? TextAlign.right + : TextAlign.left, + decoration: TextFieldsUtils + .textFieldSelectorDecoration( + widget.hintText, null, true), + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.7, + fontFamily: 'Poppins', + color: Color(0xFF575757), + ), + controller: widget.controller, + keyboardType: widget.inputType ?? + (widget.maxLines == 1 + ? TextInputType.text + : TextInputType.multiline), + enabled: widget.enabled, + minLines: widget.minLines, + maxLines: widget.maxLines, + inputFormatters: + widget.inputFormatters != null + ? widget.inputFormatters + : [], + onChanged: (value) { + setState(() {}); + if (widget.onChanged != null) { + widget.onChanged(value); + } + }, + obscureText: widget.isSecure), ) : AppText( widget.dropDownText, diff --git a/lib/widgets/shared/text_fields/html_rich_editor.dart b/lib/widgets/shared/text_fields/html_rich_editor.dart new file mode 100644 index 00000000..71359604 --- /dev/null +++ b/lib/widgets/shared/text_fields/html_rich_editor.dart @@ -0,0 +1,174 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:html_editor_enhanced/html_editor.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; +import '../speech-text-popup.dart'; + +class HtmlRichEditor extends StatefulWidget { + HtmlRichEditor({ + key, + this.hint = "Your text here...", + this.initialText, + this.height = 400, + this.decoration, + this.darkMode = false, + this.showBottomToolbar = false, + this.toolbar, + }) : super(key: key); + final String hint; + final String initialText; + final double height; + final BoxDecoration decoration; + final bool darkMode; + final bool showBottomToolbar; + final List toolbar; + + + @override + _HtmlRichEditorState createState() => _HtmlRichEditorState(); +} + +class _HtmlRichEditorState extends State { + ProjectViewModel projectViewModel; + stt.SpeechToText speech = stt.SpeechToText(); + var recognizedWord; + var event = RobotProvider(); + + + @override + void initState() { + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); + super.initState(); + } + + + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return Stack( + children: [ + HtmlEditor( + hint: widget.hint, + height: widget.height, + initialText: widget.initialText, + showBottomToolbar: widget.showBottomToolbar, + darkMode: widget.darkMode, + decoration: widget.decoration ?? + BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.all( + Radius.circular(30.0), + ), + border: Border.all(color: Colors.grey[200], width: 0.5), + ), + toolbar: widget.toolbar ?? + const [ + // Style(), + Font(buttons: [ + FontButtons.bold, + FontButtons.italic, + FontButtons.underline, + ]), + // ColorBar(buttons: [ColorButtons.color]), + Paragraph(buttons: [ + ParagraphButtons.ul, + ParagraphButtons.ol, + ParagraphButtons.paragraph + ]), + // Insert(buttons: [InsertButtons.link, InsertButtons.picture, InsertButtons.video, InsertButtons.table]), + // Misc(buttons: [MiscButtons.fullscreen, MiscButtons.codeview, MiscButtons.help]) + ], + ), + Positioned( + top: + 50, //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context).size.width * 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon(DoctorApp.speechtotext, + color: Colors.black, size: 35), + onPressed: () { + initSpeechState() + .then((value) => {onVoiceText()}); + }, + ), + ], + )) + ], + ); + } + + + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + //SpeechToText.closeAlertDialog(context); + print(error); + } + + void statusListener(String status) { + recognizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + void resultListener(result)async { + recognizedWord = result.recognizedWords; + event.setValue({"searchText": recognizedWord}); + String txt = await HtmlEditor.getText(); + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speech.stop(); + HtmlEditor.setText(txt+recognizedWord); + }); + } else { + print(result.finalResult); + } + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } +} diff --git a/lib/widgets/shared/text_fields/text_field_error.dart b/lib/widgets/shared/text_fields/text_field_error.dart index ee22a6a4..9c781db0 100644 --- a/lib/widgets/shared/text_fields/text_field_error.dart +++ b/lib/widgets/shared/text_fields/text_field_error.dart @@ -7,12 +7,11 @@ import '../app_texts_widget.dart'; class TextFieldsError extends StatelessWidget { const TextFieldsError({ Key key, - @required this.error, + @required this.error, }) : super(key: key); final String error; - @override Widget build(BuildContext context) { return Container( @@ -27,12 +26,14 @@ class TextFieldsError extends StatelessWidget { SizedBox( width: 12, ), - AppText( - error, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.7, - color: Colors.red.shade700, - fontWeight: FontWeight.w700, + Expanded( + child: AppText( + error, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.7, + color: Colors.red.shade700, + fontWeight: FontWeight.w700, + ), ), ], ), diff --git a/pubspec.lock b/pubspec.lock index ee31002d..a408ffd5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -43,13 +43,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.3" - barcode_scan: + barcode_scan_fix: dependency: "direct main" description: - name: barcode_scan + name: barcode_scan_fix url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "1.0.2" bazel_worker: dependency: transitive description: @@ -426,6 +426,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + flutter_inappwebview: + dependency: transitive + description: + name: flutter_inappwebview + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0+4" flutter_localizations: dependency: "direct main" description: flutter @@ -518,6 +525,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.14.0+4" + html_editor_enhanced: + dependency: "direct main" + description: + name: html_editor_enhanced + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" http: dependency: "direct main" description: @@ -573,7 +587,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3-nullsafety.1" json_annotation: dependency: transitive description: @@ -776,7 +790,7 @@ packages: name: protobuf url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.1.4" provider: dependency: "direct main" description: @@ -799,7 +813,7 @@ packages: source: hosted version: "0.1.8" quiver: - dependency: transitive + dependency: "direct main" description: name: quiver url: "https://pub.dartlang.org" @@ -1013,6 +1027,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.1+3" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.2" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 29c3f7b1..1429bc3e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,7 +51,7 @@ dependencies: expandable: ^4.1.4 # Qr code Scanner - barcode_scan: ^3.0.1 + barcode_scan_fix: ^1.0.2 # permissions permission_handler: ^5.0.0+hotfix.3 device_info: ^0.4.2+4 @@ -90,6 +90,11 @@ dependencies: speech_to_text: path: speech_to_text + quiver: ^2.1.5 + + # Html Editor Enhanced + html_editor_enhanced: ^1.3.0 + dev_dependencies: flutter_test: sdk: flutter diff --git a/speech_to_text/example/pubspec.lock b/speech_to_text/example/pubspec.lock index e0e9b753..6809f75f 100644 --- a/speech_to_text/example/pubspec.lock +++ b/speech_to_text/example/pubspec.lock @@ -1,69 +1,48 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" + version: "1.15.0-nullsafety.3" cupertino_icons: dependency: "direct main" description: @@ -71,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" flutter: dependency: "direct main" description: flutter @@ -81,13 +67,6 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" json_annotation: dependency: transitive description: @@ -101,14 +80,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" nested: dependency: transitive description: @@ -122,7 +101,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" permission_handler: dependency: "direct main" description: @@ -137,13 +116,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" plugin_platform_interface: dependency: transitive description: @@ -158,13 +130,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.3.1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -176,7 +141,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" speech_to_text: dependency: "direct dev" description: @@ -190,56 +155,49 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" + version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.16.0 <2.0.0" diff --git a/speech_to_text/pubspec.lock b/speech_to_text/pubspec.lock index 7877604f..efc63cc7 100644 --- a/speech_to_text/pubspec.lock +++ b/speech_to_text/pubspec.lock @@ -15,13 +15,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.39.13" - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" args: dependency: transitive description: @@ -35,14 +28,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" build: dependency: transitive description: @@ -99,13 +92,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" checked_yaml: dependency: transitive description: @@ -119,7 +119,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" code_builder: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" + version: "1.15.0-nullsafety.3" convert: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" fixnum: dependency: transitive description: @@ -221,13 +221,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" io: dependency: transitive description: @@ -269,14 +262,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -311,7 +304,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" pedantic: dependency: transitive description: @@ -319,13 +312,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.0" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" pool: dependency: transitive description: @@ -386,21 +372,21 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" stream_transform: dependency: transitive description: @@ -414,21 +400,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.19-nullsafety.2" timing: dependency: transitive description: @@ -442,14 +428,14 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" watcher: dependency: transitive description: @@ -464,13 +450,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" yaml: dependency: transitive description: @@ -479,5 +458,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.10.0"