diff --git a/PatientAppAPNSAuthKey.p8 b/PatientAppAPNSAuthKey.p8 new file mode 100755 index 00000000..0515964e --- /dev/null +++ b/PatientAppAPNSAuthKey.p8 @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgJ5XRSnefd1apSG/z +YJTQ55ffLMlPgKlGM9edg88mUZagCgYIKoZIzj0DAQehRANCAATSA2MbS+J0cQsc +uBU0xaoxOUgGvnHCQSEK4t22i8eeKPPhH6RHJhK1ugPvj+Eyadf7j6pn3QRonEJu +mIL+qvqC +-----END PRIVATE KEY----- \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index de6f8030..42fc0237 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,6 +6,9 @@ In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + + + diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt index 5e7fe57b..8452a083 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt @@ -30,12 +30,12 @@ enum class GeofenceTransition(val value: Int) { fun fromInt(value: Int) = GeofenceTransition.values().first { it.value == value } } - fun named():String{ - if (value == 1)return "Enter" - if (value == 2)return "Exit" - if (value == 4)return "dWell" - if (value == (ENTER.value or EXIT.value))return "Enter or Exit" - if (value == (DWELL.value or EXIT.value))return "DWell or Exit" + fun named(): String { + if (value == 1) return "Enter" + if (value == 2) return "Exit" + if (value == 4) return "dWell" + if (value == (ENTER.value or EXIT.value)) return "Enter or Exit" + if (value == (DWELL.value or EXIT.value)) return "DWell or Exit" return "unknown" } } @@ -44,63 +44,65 @@ class HMG_Geofence { // https://developer.android.com/training/location/geofencing#java private lateinit var context: Context - private lateinit var preferences:SharedPreferences + private lateinit var preferences: SharedPreferences private val gson = Gson() - private lateinit var geofencingClient:GeofencingClient + private lateinit var geofencingClient: GeofencingClient private val geofencePendingIntent: PendingIntent by lazy { val intent = Intent(context, GeofenceBroadcastReceiver::class.java) PendingIntent.getBroadcast( - context, - 0, - intent, - PendingIntent.FLAG_UPDATE_CURRENT) + context, + 0, + intent, + PendingIntent.FLAG_IMMUTABLE + ) } - companion object{ + companion object { var instance: HMG_Geofence? = null - fun shared(context: Context) : HMG_Geofence { - if (instance == null) { + fun shared(context: Context): HMG_Geofence { + if (instance == null) { instance = HMG_Geofence() instance?.context = context instance?.geofencingClient = LocationServices.getGeofencingClient(context) - instance?.preferences = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) + instance?.preferences = + context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) } - return instance!! + return instance!! } } - fun limitize(zones: List):List{ + private fun limitize(zones: List): List { var geoZones_ = zones - if(zones.size > 100) + if (zones.size > 100) geoZones_ = zones.subList(0, 99) return geoZones_ } - fun register(completion:((Boolean, java.lang.Exception?)->Unit)){ + fun register(completion: ((Boolean, java.lang.Exception?) -> Unit)) { unRegisterAll { status, exception -> val geoZones = getGeoZonesFromPreference(context) - doRegister(geoZones){ status_, error -> + doRegister(geoZones) { status_, error -> completion.let { it(status_, error) } } } } - fun unRegisterAll(completion: (status: Boolean, exception: Exception?) -> Unit){ + fun unRegisterAll(completion: (status: Boolean, exception: Exception?) -> Unit) { getActiveGeofences({ success -> removeActiveGeofences() - if(success.isNotEmpty()) + if (success.isNotEmpty()) geofencingClient - .removeGeofences(success) - .addOnSuccessListener { - completion(true, null) - } - .addOnFailureListener { - completion(false, it) - saveLog(context, "error:REMOVE_GEOFENCES", it.localizedMessage) - } + .removeGeofences(success) + .addOnSuccessListener { + completion(true, null) + } + .addOnFailureListener { + completion(false, it) + saveLog(context, "error:REMOVE_GEOFENCES", it.localizedMessage) + } else completion(true, null) @@ -109,7 +111,10 @@ class HMG_Geofence { }) } - private fun doRegister(geoZones: List, completion:((Boolean, java.lang.Exception?)->Unit)? = null){ + private fun doRegister( + geoZones: List, + completion: ((Boolean, java.lang.Exception?) -> Unit)? = null + ) { if (geoZones.isEmpty()) return @@ -117,9 +122,9 @@ class HMG_Geofence { fun buildGeofencingRequest(geofences: List): GeofencingRequest { return GeofencingRequest.Builder() - .setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_DWELL) - .addGeofences(geofences) - .build() + .setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_DWELL) + .addGeofences(geofences) + .build() } getActiveGeofences({ active -> @@ -135,26 +140,41 @@ class HMG_Geofence { if (checkPermission() && geofences.isNotEmpty()) { geofencingClient - .addGeofences(buildGeofencingRequest(geofences), geofencePendingIntent) - .addOnSuccessListener { - Logs.RegisterGeofence.save(context,"SUCCESS", "Successfuly registered the geofences", Logs.STATUS.SUCCESS) - saveActiveGeofence(geofences.map { it.requestId }, listOf()) - completion?.let { it(true,null) } - } - .addOnFailureListener { exc -> - Logs.RegisterGeofence.save(context,"FAILED_TO_REGISTER", "Failed to register geofence",Logs.STATUS.ERROR) - completion?.let { it(false,exc) } - } + .addGeofences(buildGeofencingRequest(geofences), geofencePendingIntent) + .addOnSuccessListener { + Logs.RegisterGeofence.save( + context, + "SUCCESS", + "Successfuly registered the geofences", + Logs.STATUS.SUCCESS + ) + saveActiveGeofence(geofences.map { it.requestId }, listOf()) + completion?.let { it(true, null) } + } + .addOnFailureListener { exc -> + Logs.RegisterGeofence.save( + context, + "FAILED_TO_REGISTER", + "Failed to register geofence", + Logs.STATUS.ERROR + ) + completion?.let { it(false, exc) } + } // Schedule the job to register after specified duration (due to: events not calling after long period.. days or days [Needs to register fences again]) - HMGUtils.scheduleJob(context, ReregisterGeofenceJobService::class.java,ReregisterGeofenceJobService.JobID, ReregisterGeofenceJobService.TriggerIntervalDuration) + HMGUtils.scheduleJob( + context, + ReregisterGeofenceJobService::class.java, + ReregisterGeofenceJobService.JobID, + ReregisterGeofenceJobService.TriggerIntervalDuration + ) } }, null) } - fun getGeoZonesFromPreference(context: Context):List{ + fun getGeoZonesFromPreference(context: Context): List { val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) val json = pref.getString(PREF_KEY_HMG_ZONES, "[]") @@ -162,26 +182,29 @@ class HMG_Geofence { return geoZones } - fun saveActiveGeofence(success: List, failed: List){ + fun saveActiveGeofence(success: List, failed: List) { val jsonSuccess = gson.toJson(success) val jsonFailure = gson.toJson(failed) preferences.edit().putString(PREF_KEY_SUCCESS, jsonSuccess).apply() preferences.edit().putString(PREF_KEY_FAILED, jsonFailure).apply() } - fun removeActiveGeofences(){ + fun removeActiveGeofences() { preferences.edit().putString(PREF_KEY_SUCCESS, "[]").apply() preferences.edit().putString(PREF_KEY_FAILED, "[]").apply() } - fun getActiveGeofences(success: (success: List) -> Unit, failure: ((failed: List) -> Unit)?){ - val type = object : TypeToken?>() {}.type + fun getActiveGeofences( + success: (success: List) -> Unit, + failure: ((failed: List) -> Unit)? + ) { + val type = object : TypeToken?>() {}.type val jsonSuccess = preferences.getString(PREF_KEY_SUCCESS, "[]") val success = gson.fromJson>(jsonSuccess, type) success(success) - if(failure != null){ + if (failure != null) { val jsonFailure = preferences.getString(PREF_KEY_FAILED, "[]") val failed = gson.fromJson>(jsonFailure, type) failure(failed) @@ -189,47 +212,74 @@ class HMG_Geofence { } - private fun checkPermission() : Boolean{ - return ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED + private fun checkPermission(): Boolean { + return ContextCompat.checkSelfPermission( + context, + Manifest.permission.ACCESS_FINE_LOCATION + ) == PackageManager.PERMISSION_GRANTED } - fun getPatientID():Int?{ + fun getPatientID(): Int? { var profileJson = preferences.getString("flutter.imei-user-data", null) if (profileJson == null) profileJson = preferences.getString("flutter.user-profile", null) val type = object : TypeToken?>() {}.type return gson.fromJson?>(profileJson, type) - ?.get("PatientID") - .toString() - .toDoubleOrNull() - ?.toInt() + ?.get("PatientID") + .toString() + .toDoubleOrNull() + ?.toInt() } - fun handleEvent(triggerGeofences: List, location: Location, transition: GeofenceTransition) { + fun handleEvent( + triggerGeofences: List, + location: Location, + transition: GeofenceTransition + ) { getPatientID()?.let { patientId -> getActiveGeofences({ activeGeofences -> triggerGeofences.forEach { geofence -> // Extract PointID from 'geofence.requestId' and find from active geofences - val pointID = activeGeofences.firstOrNull { it == geofence.requestId }?.split('_')?.first() + val pointID = + activeGeofences.firstOrNull { it == geofence.requestId }?.split('_') + ?.first() if (!pointID.isNullOrEmpty() && pointID.toIntOrNull() != null) { val body = mutableMapOf( - "PointsID" to pointID.toIntOrNull(), - "GeoType" to transition.value, - "PatientID" to patientId + "PointsID" to pointID.toIntOrNull(), + "GeoType" to transition.value, + "PatientID" to patientId ) body.putAll(HMGUtils.defaultHTTPParams(context)) httpPost>(API.LOG_GEOFENCE, body, { response -> - saveLog(context, "HMG_GEOFENCE_NOTIFY", "Success: Notified to server\uD83D\uDE0E.") - sendNotification(context, transition.named(), geofence.requestId, "Notified to server.😎") + saveLog( + context, + "HMG_GEOFENCE_NOTIFY", + "Success: Notified to server\uD83D\uDE0E." + ) + sendNotification( + context, + transition.named(), + geofence.requestId, + "Notified to server.😎" + ) }, { exception -> val errorMessage = "${transition.named()}, ${geofence.requestId}" - saveLog(context, "HMG_GEOFENCE_NOTIFY", "failed: $errorMessage | error: ${exception.localizedMessage}") - sendNotification(context, transition.named(), geofence.requestId, "Failed to notify server😔 -> ${exception.localizedMessage}") + saveLog( + context, + "HMG_GEOFENCE_NOTIFY", + "failed: $errorMessage | error: ${exception.localizedMessage}" + ) + sendNotification( + context, + transition.named(), + geofence.requestId, + "Failed to notify server😔 -> ${exception.localizedMessage}" + ) }) } diff --git a/ios/Podfile b/ios/Podfile index c92f7e80..264db98d 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -32,6 +32,7 @@ target 'Runner' do use_modular_headers! pod 'OpenTok', '~> 2.22.0' + pod 'VTO2Lib' flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end @@ -53,9 +54,34 @@ post_install do |installer| ] build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386' build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' + xcconfig_path = build_configuration.base_configuration_reference.real_path + xcconfig = File.read(xcconfig_path) + xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR") + File.open(xcconfig_path, "w") { |file| file << xcconfig_mod } + if build_configuration.build_settings['WRAPPER_EXTENSION'] == 'bundle' build_configuration.build_settings['DEVELOPMENT_TEAM'] = '3A359E86ZF' end end end +end + +post_integrate do |installer| + compiler_flags_key = 'COMPILER_FLAGS' + project_path = 'Pods/Pods.xcodeproj' + + project = Xcodeproj::Project.open(project_path) + project.targets.each do |target| + target.build_phases.each do |build_phase| + if build_phase.is_a?(Xcodeproj::Project::Object::PBXSourcesBuildPhase) + build_phase.files.each do |file| + if !file.settings.nil? && file.settings.key?(compiler_flags_key) + compiler_flags = file.settings[compiler_flags_key] + file.settings[compiler_flags_key] = compiler_flags.gsub(/-DOS_OBJECT_USE_OBJC=0\s*/, '') + end + end + end + end + end + project.save() end \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5fea0490..240eb6e4 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 306FE6C8271D790C002D6EFC /* OpenTokPlatformBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */; }; 306FE6CB271D8B73002D6EFC /* OpenTok.swift in Sources */ = {isa = PBXBuildFile; fileRef = 306FE6CA271D8B73002D6EFC /* OpenTok.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 4EE411B2E3CB5D4F81AE5078 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D1513E0724DAFB89C198BDD /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 762D738E274E42650063CE73 /* ring_30Sec.caf in Resources */ = {isa = PBXBuildFile; fileRef = 762D738C274E42650063CE73 /* ring_30Sec.caf */; }; 762D738F274E42650063CE73 /* ring_30Sec.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 762D738D274E42650063CE73 /* ring_30Sec.mp3 */; }; @@ -22,7 +23,6 @@ 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 */; }; - B40C32A62DF065A3A0414845 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B99ADD0B93AC14DD8D0BAB0 /* Pods_Runner.framework */; }; E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538D256AAA6500E96549 /* GlobalHelper.swift */; }; E91B5397256AAA6500E96549 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538E256AAA6500E96549 /* Extensions.swift */; }; E91B5398256AAA6500E96549 /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538F256AAA6500E96549 /* API.swift */; }; @@ -63,6 +63,8 @@ 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTokPlatformBridge.swift; sourceTree = ""; }; 306FE6CA271D8B73002D6EFC /* OpenTok.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTok.swift; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3D1513E0724DAFB89C198BDD /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6EE8819867EC2775AB578377 /* 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 = ""; }; 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 = ""; }; 762D738C274E42650063CE73 /* ring_30Sec.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = ring_30Sec.caf; path = ../../assets/sounds/ring_30Sec.caf; sourceTree = ""; }; @@ -70,9 +72,8 @@ 76815B26275F381C00E66E94 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; }; 76962ECD28AE5C10004EAE09 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 76F2556027F1FFED0062C1CD /* PassKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PassKit.framework; path = System/Library/Frameworks/PassKit.framework; sourceTree = SDKROOT; }; - 7805E271E86E72F39E68ADCC /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 8B99ADD0B93AC14DD8D0BAB0 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 838788A2BEDC4910F4B029A6 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -80,7 +81,6 @@ 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 = ""; }; - BC1BA79F1F6E9D7BE59D2AE4 /* 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 = ""; }; E91B538D256AAA6500E96549 /* GlobalHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlobalHelper.swift; sourceTree = ""; }; E91B538E256AAA6500E96549 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; E91B538F256AAA6500E96549 /* API.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = API.swift; sourceTree = ""; }; @@ -99,7 +99,7 @@ E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMG_Guest.swift; sourceTree = ""; }; E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizedFromFlutter.swift; sourceTree = ""; }; E9F7623A25922BCE00FB5CCF /* FlutterConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlutterConstants.swift; sourceTree = ""; }; - EBA301C32F4CA9F09D2D7713 /* 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 = ""; }; + F2C7D3C4718A1DED85DA3AD4 /* 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -110,7 +110,7 @@ 76F2556127F1FFED0062C1CD /* PassKit.framework in Frameworks */, 76815B27275F381C00E66E94 /* HealthKit.framework in Frameworks */, E9620805255C2ED100D3A35D /* NetworkExtension.framework in Frameworks */, - B40C32A62DF065A3A0414845 /* Pods_Runner.framework in Frameworks */, + 4EE411B2E3CB5D4F81AE5078 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -133,7 +133,7 @@ 76F2556027F1FFED0062C1CD /* PassKit.framework */, 76815B26275F381C00E66E94 /* HealthKit.framework */, E9620804255C2ED100D3A35D /* NetworkExtension.framework */, - 8B99ADD0B93AC14DD8D0BAB0 /* Pods_Runner.framework */, + 3D1513E0724DAFB89C198BDD /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -141,9 +141,9 @@ 605039E5DDF72C245F9765FE /* Pods */ = { isa = PBXGroup; children = ( - EBA301C32F4CA9F09D2D7713 /* Pods-Runner.debug.xcconfig */, - 7805E271E86E72F39E68ADCC /* Pods-Runner.release.xcconfig */, - BC1BA79F1F6E9D7BE59D2AE4 /* Pods-Runner.profile.xcconfig */, + F2C7D3C4718A1DED85DA3AD4 /* Pods-Runner.debug.xcconfig */, + 838788A2BEDC4910F4B029A6 /* Pods-Runner.release.xcconfig */, + 6EE8819867EC2775AB578377 /* Pods-Runner.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -246,15 +246,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - A37FFD337A0067237A8DACD6 /* [CP] Check Pods Manifest.lock */, + 6D0B2FE51DC05E2D0395E861 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - E1D6AED972DEFC56AA7DB402 /* [CP] Embed Pods Frameworks */, - 541D1D49FBD13BE6BA6DA5BC /* [CP] Copy Pods Resources */, + 487FDD6493EB9AE7D8E39485 /* [CP] Embed Pods Frameworks */, + 4671D3CD126F6635F4B75A6E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -334,7 +334,7 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; }; - 541D1D49FBD13BE6BA6DA5BC /* [CP] Copy Pods Resources */ = { + 4671D3CD126F6635F4B75A6E /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -351,21 +351,24 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { + 487FDD6493EB9AE7D8E39485 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputPaths = ( + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - name = "Run Script"; - outputPaths = ( + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; }; - A37FFD337A0067237A8DACD6 /* [CP] Check Pods Manifest.lock */ = { + 6D0B2FE51DC05E2D0395E861 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -387,22 +390,19 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - E1D6AED972DEFC56AA7DB402 /* [CP] Embed Pods Frameworks */ = { + 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + name = "Run Script"; + outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; /* End PBXShellScriptBuildPhase section */ @@ -538,7 +538,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.57; + MARKETING_VERSION = 4.5.63; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -682,7 +682,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.57; + MARKETING_VERSION = 4.5.63; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -720,7 +720,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.57; + MARKETING_VERSION = 4.5.63; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/lib/config/config.dart b/lib/config/config.dart index 4645ba77..0764c199 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -97,6 +97,7 @@ var COVID_PASSPORT_UPDATE = 'Services/Patients.svc/REST/Covid19_Certificate_Pass var GET_PATIENT_PASSPORT_NUMBER = 'Services/Patients.svc/REST/Covid19_Certificate_GetPassport'; var UPDATE_WORKPLACE_NAME = 'Services/Patients.svc/REST/ActivateSickLeave_FromVida'; +var GET_SICKLEAVE_STATUS_ADMISSION_NO = 'Services/ChatBot_Service.svc/REST/GetSickLeaveStatusByAdmissionNo'; /// var GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; @@ -191,6 +192,8 @@ var SAVE_BLOOD_AGREEMENT = 'Services/PatientVarification.svc/REST/AddUserAgreeme var REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; var INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; var SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail'; +var GET_INPATIENT_ADMISSIONS = 'Services/inps.svc/REST/getAdmissionForMedicalReport'; +var GET_MEDICAL_REPORT_PDF = 'Services/inps.svc/REST/getMedicalReportPDF'; ///Rate // var IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; @@ -332,7 +335,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 10.4; +var VERSION_ID = 10.9; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; @@ -409,6 +412,8 @@ var ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = 'Services/Patients.svc/Rest/ var GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; var GET_CALL_REQUEST_TYPE_LOV = 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; +var GET_QUESTION_TYPES = 'Services/OUTPs.svc/REST/getQuestionsTypes'; + var UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult'; var SEND_AVERAGE_BLOOD_SUGAR_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport'; @@ -423,7 +428,10 @@ var UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWe var DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus'; var GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse'; var UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus'; + var INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; +var INSERT_APPOINTMENT_QUESTION = 'Services/OUTPs.svc/REST/insertAppointmentQuestion'; +var RATE_DOCTOR_RESPONSE = 'Services/OUTPs.svc/REST/insertAppointmentQuestionRating'; var GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; @@ -600,7 +608,13 @@ var CANCEL_PHARMA_LIVECARE_REQUEST = 'https://vcallapi.hmg.com/api/PharmaLiveCar var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLogs'; -var GET_NATIONALITY ='Services/Lists.svc/REST/GetNationality'; +var GET_NATIONALITY = 'Services/Lists.svc/REST/GetNationality'; + +var PAYFORT_TEST_URL = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; +var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; + +var CHECK_PATIENT_NPHIES_ELIGIBILITY = 'Services/Doctors.svc/REST/checkPatientInsuranceCompanyValidity'; +var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceCompany'; class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5fe40ec1..7fd9507b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -326,8 +326,8 @@ const Map localizedValues = { "nearester": {"en": "Nearest ER", "ar": "أقرب طوارى"}, "locationa": {"en": "Location", "ar": "الموقع"}, "call_now": {"en": "Call now", "ar": "اتصل الان"}, - "ambulancerequest": {"en": "Ambulance", "ar": "طلب نقل "}, - "requestA": {"en": "Request", "ar": "اسعاف"}, + "ambulancerequest": {"en": "Ambulance", "ar": "خدمات النقل "}, + "requestA": {"en": "Request", "ar": "الاسعافي"}, "NoBookedAppointments": {"en": "No Booked Appointments", "ar": "لا توجد مواعيد محجوزة"}, "NoConfirmedAppointments": {"en": "No Confirmed Appointments", "ar": "لا توجد مواعيد مؤكدة"}, "noArrivedAppointments": {"en": "No Arrived Appointments", "ar": "لم يتم حضورها"}, @@ -581,6 +581,7 @@ const Map localizedValues = { "items": {"en": "item(s)", "ar": "عنصر"}, "checkOut": {"en": "CHECK OUT", "ar": "الدفع"}, "sar": {"en": "SAR", "ar": " ر.س "}, + "aed": {"en": "AED", "ar": "درهم"}, "payOnline": {"en": "PAY ONLINE", "ar": "اتمام عملية الدفع "}, "cancelOrder": {"en": "CANCEL ORDER", "ar": "الغاء الطلب "}, "confirmAddress": {"en": "CONFIRM ADDRESS ", "ar": " تأكيد العنوان "}, @@ -926,7 +927,7 @@ const Map localizedValues = { "ar": "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." }, "er": {"en": "ER", "ar": "الطوارىء"}, - "transportation-Service": {"en": "Ambulance Request", "ar": "طلب نقل اسعاف"}, + "transportation-Service": {"en": "Ambulance Request", "ar": "خدمات النقل الاسعافي"}, "info-ambulance": { "en": "Through this service, you can request evacuation by ambulance, whether from home or to home, in addition to a set of other services", "ar": "عن طريق هذه الخدمة يمكنك طلب اخلاء بواسطة سيارة اسعاف سواء من المزل او الى المنزل بالاضافة الى مجموعة من الخدمات الاخرى" @@ -1883,4 +1884,19 @@ const Map localizedValues = { "pharmaLiveCareMakePayment1": {"en": "Make the payment through the mobile app", "ar": "قم بالدفع من خلال تطبيق الهاتف المحمول"}, "pharmaLiveCareJoinConsultation": {"en": "Join the virtual consultation from booth", "ar": "انضم إلى الاستشارة الافتراضية من الكبينة"}, "pharmaLiveCareJoinConsultation1": {"en": "Wait for the doctor in the pharma booth to join you", "ar": "انتظر حتى ينضم إليك الطبيب في كبينة لايف كير الصيدلية"}, + "emergencyServicesSubtitle": {"en": "Always at your service", "ar": "في خدمتكم دائما"}, + "rateDoctorResponse": {"en": "Rate Doctor Response", "ar": "تقييم استجابة الطبيب"}, + "comments": {"en": "Comments", "ar": "تعليقات"}, + "rateDoctorResponseHeading": {"en": "Please rate the doctor response:", "ar": "يرجى تقييم استجابة الطبيب:"}, + "updateInsuranceManuallyDialog": {"en": "Would you like to update your insurance manually?", "ar": "هل ترغب في تحديث التأمين الخاص بك يدويًا؟"}, + "viewReport": {"en": "View Report", "ar": "عرض التقرير"}, + "sickLeaveAdmittedPatient": {"en": "You cannot activate this sick leave since you're an admitted patient.", "ar": "لا يمكنك تفعيل هذه الإجازة المرضية لأنك مريض مقبل."}, + "dischargeDate": {"en": "Discharge Date", "ar": "تاريخ التفريغ"}, + "selectAdmissionText": {"en": "Please select one of the admissions from below to view medical reports:", "ar": "يرجى تحديد أحد حالات القبول من الأسفل لعرض التقارير الطبية:"}, + "invalidEligibility": {"en": "You cannot make online payment because you are not eligible to use the provided service.", "ar": "لا يمكنك إجراء الدفع عبر الإنترنت لأنك غير مؤهل لاستخدام الخدمة المقدمة."}, + "invalidInsurance": {"en": "You cannot make online payment because you do not have a valid insurance.", "ar": "لا يمكنك إجراء الدفع عبر الإنترنت لأنه ليس لديك تأمين صالح."}, + "continueCash": {"en": "Continue as cash", "ar": "تواصل نقدا"}, + "updateInsurance": {"en": "Update insurance", "ar": "تحديث التأمين"}, + "downloadReport": {"en": "Download Report", "ar": "تحميل تقرير المختبر"}, + "habibCallCenter": {"en": "Please contact AlHabib call center to update your insurance manually.", "ar": "يرجى الاتصال بمركز اتصال الحبيب لتحديث التأمين الخاص بك يدوياً."}, }; \ No newline at end of file diff --git a/lib/core/model/hospitals/hospitals_model.dart b/lib/core/model/hospitals/hospitals_model.dart index 246de0b1..43e2e50b 100644 --- a/lib/core/model/hospitals/hospitals_model.dart +++ b/lib/core/model/hospitals/hospitals_model.dart @@ -13,7 +13,7 @@ class HospitalsModel { String latitude; String longitude; dynamic mainProjectID; - dynamic projectOutSA; + bool projectOutSA; bool usingInDoctorApp; HospitalsModel( diff --git a/lib/core/model/insurance/insuranceManualUpdateRequest.dart b/lib/core/model/insurance/insuranceManualUpdateRequest.dart index 13fee506..5eb8ebb9 100644 --- a/lib/core/model/insurance/insuranceManualUpdateRequest.dart +++ b/lib/core/model/insurance/insuranceManualUpdateRequest.dart @@ -12,21 +12,23 @@ class InsuranceManualUpdateRequest { String policyNo; String schemeClass; int requestType; + int patientID; InsuranceManualUpdateRequest( {this.setupID, - this.patientIdentificationID, - this.projectID, - this.mobileNo, - this.activityId, - this.component, - this.enableLogging, - this.insuranceCompanyName, - this.cardHolderName, - this.memberShipNo, - this.policyNo, - this.schemeClass, - this.requestType}); + this.patientIdentificationID, + this.projectID, + this.mobileNo, + this.activityId, + this.component, + this.enableLogging, + this.insuranceCompanyName, + this.cardHolderName, + this.memberShipNo, + this.policyNo, + this.schemeClass, + this.requestType, + this.patientID}); InsuranceManualUpdateRequest.fromJson(Map json) { setupID = json['SetupID']; @@ -42,6 +44,7 @@ class InsuranceManualUpdateRequest { policyNo = json['PolicyNo']; schemeClass = json['SchemeClass']; requestType = json['RequestType']; + patientID = json['PatientID']; } Map toJson() { @@ -59,6 +62,7 @@ class InsuranceManualUpdateRequest { data['PolicyNo'] = this.policyNo; data['SchemeClass'] = this.schemeClass; data['RequestType'] = this.requestType; + data['PatientID'] = this.patientID; return data; } } diff --git a/lib/core/model/labs/request_send_lab_report_email.dart b/lib/core/model/labs/request_send_lab_report_email.dart index 4f2fc02a..2188c500 100644 --- a/lib/core/model/labs/request_send_lab_report_email.dart +++ b/lib/core/model/labs/request_send_lab_report_email.dart @@ -26,6 +26,8 @@ class RequestSendLabReportEmail { String invoiceNoVP; String orderDate; String orderNo; + bool isDownload; + int doctorID; RequestSendLabReportEmail( {this.versionID, @@ -53,7 +55,10 @@ class RequestSendLabReportEmail { this.projectID, this.invoiceNo, this.invoiceNoVP, - this.orderDate, this.orderNo}); + this.orderDate, + this.orderNo, + this.isDownload, + this.doctorID}); RequestSendLabReportEmail.fromJson(Map json) { versionID = json['VersionID']; @@ -83,6 +88,8 @@ class RequestSendLabReportEmail { invoiceNoVP = json['InvoiceNo_VP']; orderDate = json['OrderDate']; orderNo = json['OrderNo']; + isDownload = json['IsDownload']; + doctorID = json['DoctorID']; } Map toJson() { @@ -114,6 +121,8 @@ class RequestSendLabReportEmail { data['InvoiceNo_VP'] = this.invoiceNoVP; data['OrderDate'] = this.orderDate; data['OrderNo'] = this.orderNo; + data['IsDownload'] = this.isDownload; + data['DoctorID'] = this.doctorID; return data; } } diff --git a/lib/core/model/reports/admission_for_medical_report.dart b/lib/core/model/reports/admission_for_medical_report.dart new file mode 100644 index 00000000..a185762d --- /dev/null +++ b/lib/core/model/reports/admission_for_medical_report.dart @@ -0,0 +1,228 @@ +class AdmissionMedicalReport { + int rowID; + String setupID; + int projectID; + int admissionNo; + String admissionDate; + int admissionRequestNo; + int admissionType; + int patientType; + int patientID; + int clinicID; + int doctorID; + int admittingClinicID; + int admittingDoctorID; + int categoryID; + String roomID; + String bedID; + String dischargeDate; + int approvalNo; + dynamic relativeID; + String registrationDate; + String firstName; + String middleName; + String lastName; + String firstNameN; + String middleNameN; + String lastNameN; + int patientCategory; + int gender; + String dateofBirth; + String dateofBirthN; + String nationalityID; + String firstVisit; + String lastVisit; + int noOfVisit; + String mobileNumber; + String patientIdentificationNo; + int sTATUS; + int admissionStatus; + int buildingID; + String buildingDescription; + String buildingDescriptionN; + int floorID; + int bedGender; + int tariffType; + dynamic cRSVerificationStatus; + String nursingStationID; + String description; + String clinicName; + String doctorNameObj; + int patientDataVerified; + String projectName; + dynamic projectNameN; + String statusDescription; + String statusDescriptionN; + + AdmissionMedicalReport( + {this.rowID, + this.setupID, + this.projectID, + this.admissionNo, + this.admissionDate, + this.admissionRequestNo, + this.admissionType, + this.patientType, + this.patientID, + this.clinicID, + this.doctorID, + this.admittingClinicID, + this.admittingDoctorID, + this.categoryID, + this.roomID, + this.bedID, + this.dischargeDate, + this.approvalNo, + this.relativeID, + this.registrationDate, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.patientCategory, + this.gender, + this.dateofBirth, + this.dateofBirthN, + this.nationalityID, + this.firstVisit, + this.lastVisit, + this.noOfVisit, + this.mobileNumber, + this.patientIdentificationNo, + this.sTATUS, + this.admissionStatus, + this.buildingID, + this.buildingDescription, + this.buildingDescriptionN, + this.floorID, + this.bedGender, + this.tariffType, + this.cRSVerificationStatus, + this.nursingStationID, + this.description, + this.clinicName, + this.doctorNameObj, + this.patientDataVerified, + this.projectName, + this.projectNameN, + this.statusDescription, + this.statusDescriptionN}); + + AdmissionMedicalReport.fromJson(Map json) { + rowID = json['RowID']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + admissionNo = json['AdmissionNo']; + admissionDate = json['AdmissionDate']; + admissionRequestNo = json['AdmissionRequestNo']; + admissionType = json['AdmissionType']; + patientType = json['PatientType']; + patientID = json['PatientID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + admittingClinicID = json['AdmittingClinicID']; + admittingDoctorID = json['AdmittingDoctorID']; + categoryID = json['CategoryID']; + roomID = json['RoomID']; + bedID = json['BedID']; + dischargeDate = json['DischargeDate']; + approvalNo = json['ApprovalNo']; + relativeID = json['RelativeID']; + registrationDate = json['RegistrationDate']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + patientCategory = json['PatientCategory']; + gender = json['Gender']; + dateofBirth = json['DateofBirth']; + dateofBirthN = json['DateofBirthN']; + nationalityID = json['NationalityID']; + firstVisit = json['FirstVisit']; + lastVisit = json['LastVisit']; + noOfVisit = json['NoOfVisit']; + mobileNumber = json['MobileNumber']; + patientIdentificationNo = json['PatientIdentificationNo']; + sTATUS = json['STATUS']; + admissionStatus = json['AdmissionStatus']; + buildingID = json['BuildingID']; + buildingDescription = json['BuildingDescription']; + buildingDescriptionN = json['BuildingDescriptionN']; + floorID = json['FloorID']; + bedGender = json['BedGender']; + tariffType = json['TariffType']; + cRSVerificationStatus = json['CRSVerificationStatus']; + nursingStationID = json['NursingStationID']; + description = json['Description']; + clinicName = json['ClinicName']; + doctorNameObj = json['DoctorNameObj']; + patientDataVerified = json['PatientDataVerified']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + statusDescription = json['StatusDescription']; + statusDescriptionN = json['StatusDescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['AdmissionNo'] = this.admissionNo; + data['AdmissionDate'] = this.admissionDate; + data['AdmissionRequestNo'] = this.admissionRequestNo; + data['AdmissionType'] = this.admissionType; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['AdmittingClinicID'] = this.admittingClinicID; + data['AdmittingDoctorID'] = this.admittingDoctorID; + data['CategoryID'] = this.categoryID; + data['RoomID'] = this.roomID; + data['BedID'] = this.bedID; + data['DischargeDate'] = this.dischargeDate; + data['ApprovalNo'] = this.approvalNo; + data['RelativeID'] = this.relativeID; + data['RegistrationDate'] = this.registrationDate; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; + data['PatientCategory'] = this.patientCategory; + data['Gender'] = this.gender; + data['DateofBirth'] = this.dateofBirth; + data['DateofBirthN'] = this.dateofBirthN; + data['NationalityID'] = this.nationalityID; + data['FirstVisit'] = this.firstVisit; + data['LastVisit'] = this.lastVisit; + data['NoOfVisit'] = this.noOfVisit; + data['MobileNumber'] = this.mobileNumber; + data['PatientIdentificationNo'] = this.patientIdentificationNo; + data['STATUS'] = this.sTATUS; + data['AdmissionStatus'] = this.admissionStatus; + data['BuildingID'] = this.buildingID; + data['BuildingDescription'] = this.buildingDescription; + data['BuildingDescriptionN'] = this.buildingDescriptionN; + data['FloorID'] = this.floorID; + data['BedGender'] = this.bedGender; + data['TariffType'] = this.tariffType; + data['CRSVerificationStatus'] = this.cRSVerificationStatus; + data['NursingStationID'] = this.nursingStationID; + data['Description'] = this.description; + data['ClinicName'] = this.clinicName; + data['DoctorNameObj'] = this.doctorNameObj; + data['PatientDataVerified'] = this.patientDataVerified; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; + data['StatusDescription'] = this.statusDescription; + data['StatusDescriptionN'] = this.statusDescriptionN; + return data; + } +} diff --git a/lib/core/model/reports/request_reports.dart b/lib/core/model/reports/request_reports.dart index 14359591..9bb44280 100644 --- a/lib/core/model/reports/request_reports.dart +++ b/lib/core/model/reports/request_reports.dart @@ -15,24 +15,26 @@ class RequestReports { String tokenID; int patientTypeID; int patientType; + int projectID; RequestReports( {this.isReport, - this.encounterType, - this.requestType, - this.versionID, - this.channel, - this.languageID, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID, - this.patientID, - this.tokenID, - this.patientTypeID, - this.patientType}); + this.encounterType, + this.requestType, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.projectID}); RequestReports.fromJson(Map json) { isReport = json['IsReport']; @@ -51,6 +53,7 @@ class RequestReports { tokenID = json['TokenID']; patientTypeID = json['PatientTypeID']; patientType = json['PatientType']; + projectID = json['ProjectID']; } Map toJson() { @@ -71,6 +74,7 @@ class RequestReports { data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; return data; } -} \ No newline at end of file +} diff --git a/lib/core/model/sick_leave/admission_status_for_sick_leave.dart b/lib/core/model/sick_leave/admission_status_for_sick_leave.dart new file mode 100644 index 00000000..e4ee923c --- /dev/null +++ b/lib/core/model/sick_leave/admission_status_for_sick_leave.dart @@ -0,0 +1,64 @@ +class AdmissionStatusForSickLeave { + String setupID; + int projectID; + int patientID; + int patientType; + int requestNo; + String requestDate; + int sickLeaveDays; + int appointmentNo; + int admissionNo; + String reportDate; + String placeOfWork; + int status; + dynamic dischargeDate; + + AdmissionStatusForSickLeave( + {this.setupID, + this.projectID, + this.patientID, + this.patientType, + this.requestNo, + this.requestDate, + this.sickLeaveDays, + this.appointmentNo, + this.admissionNo, + this.reportDate, + this.placeOfWork, + this.status, + this.dischargeDate}); + + AdmissionStatusForSickLeave.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + patientType = json['PatientType']; + requestNo = json['RequestNo']; + requestDate = json['RequestDate']; + sickLeaveDays = json['SickLeaveDays']; + appointmentNo = json['AppointmentNo']; + admissionNo = json['AdmissionNo']; + reportDate = json['ReportDate']; + placeOfWork = json['PlaceOfWork']; + status = json['Status']; + dischargeDate = json['DischargeDate']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['RequestNo'] = this.requestNo; + data['RequestDate'] = this.requestDate; + data['SickLeaveDays'] = this.sickLeaveDays; + data['AppointmentNo'] = this.appointmentNo; + data['AdmissionNo'] = this.admissionNo; + data['ReportDate'] = this.reportDate; + data['PlaceOfWork'] = this.placeOfWork; + data['Status'] = this.status; + data['DischargeDate'] = this.dischargeDate; + return data; + } +} diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index 321d2d09..be0024ab 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -51,12 +51,13 @@ class HospitalService extends BaseService { } } - Future getHospitals({bool isResBasedOnLoc = true}) async { + Future getHospitals({bool isResBasedOnLoc = true, bool isAdvancePayment = false}) async { if (isResBasedOnLoc) await _getCurrentLocation(); Map body = Map(); body['Latitude'] = await this.sharedPref.getDouble(USER_LAT); body['Longitude'] = await this.sharedPref.getDouble(USER_LONG); body['IsOnlineCheckIn'] = isResBasedOnLoc; + body['IsAdvancePayment'] = isAdvancePayment; await baseAppClient.post(GET_PROJECT, onSuccess: (dynamic response, int statusCode) { _hospitals.clear(); diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index ca2e12a3..bc3c5b62 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ask_doctor/AskDoctorReqTypes.dart'; import 'package:diplomaticquarterapp/core/model/ask_doctor/DoctorResponse.dart'; @@ -42,6 +44,21 @@ class AskDoctorService extends BaseService { }, body: body); } + Future getQuestionTypes() async { + hasError = false; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_QUESTION_TYPES, onSuccess: (dynamic response, int statusCode) { + askDoctorReqTypes.clear(); + response['QuestionsTypes'].forEach((reqType) { + askDoctorReqTypes.add(AskDoctorReqTypes.fromJson(reqType)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getDoctorResponse() async { hasError = false; Map body = Map(); @@ -80,21 +97,56 @@ class AskDoctorService extends BaseService { body['DoctorID'] = doctorList.doctorID; body['PatientMobileNumber'] = user.mobileNumber; body['IsMessageSent'] = false; - body['RequestDate'] = DateUtil.yearMonthDay(DateTime.now()); - body['RequestTime'] = DateUtil.time(DateTime.now()); + body['RequestDate'] = DateUtil.convertDateToString(DateTime.now()); + body['RequestTime'] = DateUtil.convertDateToString(DateTime.now()); body['Remarks'] = remark; body['Status'] = 2; // 4 for testing only.."cancelled status insert" else should be changed to 1 in live version body['CreatedBy'] = 102; - body['CreatedOn'] = DateUtil.yearMonthDay(DateTime.now()); + body['CreatedOn'] = DateUtil.convertDateToString(DateTime.now()); body['EditedBy'] = 102; - body['EditedOn'] = DateUtil.yearMonthDay(DateTime.now()); + body['EditedOn'] = DateUtil.convertDateToString(DateTime.now()); body['isDentalAllowedBackend'] = false; + body['AppointmentNo'] = doctorList.appointmentNo; + body['ClinicID'] = doctorList.clinicID; body['QuestionType'] = num.parse(requestType); body['RequestType'] = num.parse(requestType); body['RequestTypeID'] = num.parse(requestType); + await baseAppClient.post(INSERT_CALL_INFO, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } + + Future rateDoctorResponse({int transactionNo, int questionType, int rate, String notes, String mobileNo, String idNo, String patientName, int projectID, String language}) async { + hasError = false; + dynamic localRes; + Map body = Map(); + body['MobileNo'] = mobileNo; + body['IdentificationNo'] = idNo; + body['PatientName'] = patientName; + body['IsUserLoggedIn'] = true; + body['ProjectID'] = projectID; + body['UILanguage'] = language; + body['BrowserInfo'] = Platform.localHostname; + body['COCTypeName'] = 3; + body['FormTypeID'] = 3; + body['DeviceInfo'] = Platform.localHostname; + body['Resolution'] = "400x847"; + body['AppVersion'] = VERSION_ID; + body['ForDemo'] = false; + body['isVidaPlus'] = false; + body['TransactionNo'] = transactionNo; + body['QuestionType'] = questionType; + body['Rate'] = rate; + body['Notes'] = notes; + await baseAppClient.post(RATE_DOCTOR_RESPONSE, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return Future.value(localRes); + } + } diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index ab3cd829..15337576 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -11,6 +11,8 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da class LabsService extends BaseService { List patientLabOrdersList = List(); + String labReportPDF = ""; + Future getPatientLabOrdersList() async { hasError = false; Map body = Map(); @@ -157,6 +159,24 @@ class LabsService extends BaseService { return Future.value(localRes); } + Future getSickLeaveStatusByAdmissionNo(int projectID, int admissionNo) async { + hasError = false; + Map body = Map(); + + body['AdmissionNo'] = admissionNo; + body['ProjectID'] = projectID; + + dynamic localRes; + + await baseAppClient.post(GET_SICKLEAVE_STATUS_ADMISSION_NO, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return Future.value(localRes); + } + Future getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure}) async { hasError = false; Map body = Map(); @@ -181,7 +201,7 @@ class LabsService extends BaseService { RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail(); - Future sendLabReportEmail({PatientLabOrders patientLabOrder, AuthenticatedUser userObj, bool isVidaPlus}) async { + Future sendLabReportEmail({PatientLabOrders patientLabOrder, AuthenticatedUser userObj, bool isVidaPlus, bool isDownload = false}) async { _requestSendLabReportEmail.projectID = patientLabOrder.projectID; _requestSendLabReportEmail.invoiceNo = isVidaPlus ? "0" : patientLabOrder.invoiceNo; _requestSendLabReportEmail.invoiceNoVP = isVidaPlus ? patientLabOrder.invoiceNo : "0"; @@ -196,8 +216,15 @@ class LabsService extends BaseService { _requestSendLabReportEmail.projectName = patientLabOrder.projectName; _requestSendLabReportEmail.setupID = patientLabOrder.setupID; _requestSendLabReportEmail.orderNo = patientLabOrder.orderNo; + _requestSendLabReportEmail.orderNo = patientLabOrder.orderNo; + _requestSendLabReportEmail.isDownload = isDownload; + _requestSendLabReportEmail.doctorID = patientLabOrder.doctorID; - await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) { + if (isDownload) { + labReportPDF = response['LabReportsPDFContent']; + } + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: _requestSendLabReportEmail.toJson()); diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index bf340814..d80c80e4 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -1,24 +1,23 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/reports/Reports.dart'; +import 'package:diplomaticquarterapp/core/model/reports/admission_for_medical_report.dart'; import 'package:diplomaticquarterapp/core/model/reports/request_reports.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; class ReportsService extends BaseService { List reportsList = List(); + List inpatientReportsList = List(); List appointHistoryList = List(); + + List admissionsMedicalReport = List(); + String userAgreementContent = ""; - RequestReports _requestReports = RequestReports( - isReport: true, - encounterType: 1, - requestType: 1, - patientOutSA: 0, - ); + RequestReports _requestReports = RequestReports(isReport: true, encounterType: 1, requestType: 1, patientOutSA: 0, projectID: 0); Future getReports() async { hasError = false; - await baseAppClient.post(REPORTS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(REPORTS, onSuccess: (dynamic response, int statusCode) { reportsList.clear(); response['GetPatientMedicalStatus'].forEach((reports) { reportsList.add(Reports.fromJson(reports)); @@ -29,12 +28,41 @@ class ReportsService extends BaseService { }, body: _requestReports.toJson()); } + Future getInPatientReports() async { + RequestReports _requestReportsInpatient = RequestReports(isReport: true, encounterType: 2, requestType: 1, patientOutSA: 0, projectID: 0); + hasError = false; + await baseAppClient.post(REPORTS, onSuccess: (dynamic response, int statusCode) { + inpatientReportsList.clear(); + response['GetPatientMedicalStatus'].forEach((reports) { + inpatientReportsList.add(Reports.fromJson(reports)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestReportsInpatient.toJson()); + } + + Future getInpatientAdmissionsList() async { + Map body = new Map(); + body['IsForMedicalReport'] = true; + hasError = false; + await baseAppClient.post(GET_INPATIENT_ADMISSIONS, onSuccess: (dynamic response, int statusCode) { + admissionsMedicalReport.clear(); + print(response['AdmissionsForMedicalReport']); + response['AdmissionsForMedicalReport'].forEach((reports) { + admissionsMedicalReport.add(AdmissionMedicalReport.fromJson(reports)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getPatentAppointmentHistory() async { hasError = false; Map body = new Map(); body['IsForMedicalReport'] = true; - await baseAppClient.post(GET_PATIENT_AppointmentHistory, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PATIENT_AppointmentHistory, onSuccess: (dynamic response, int statusCode) { appointHistoryList = []; response['AppoimentAllHistoryResultList'].forEach((appoint) { appointHistoryList.add(AppointmentHistory.fromJson(appoint)); @@ -47,8 +75,7 @@ class ReportsService extends BaseService { Future getUserTermsAndConditions() async { hasError = false; - await baseAppClient.post(GET_USER_TERMS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_USER_TERMS, onSuccess: (dynamic response, int statusCode) { userAgreementContent = response['UserAgreementContent']; }, onFailure: (String error, int statusCode) { hasError = true; @@ -60,9 +87,7 @@ class ReportsService extends BaseService { Map body = Map(); body['RSummaryReport'] = isSummary; hasError = false; - await baseAppClient.post(UPDATE_HEALTH_TERMS, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(UPDATE_HEALTH_TERMS, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -73,16 +98,13 @@ class ReportsService extends BaseService { body['EmailAddress'] = email; body['isDentalAllowedBackend'] = false; hasError = false; - await baseAppClient.post(UPDATE_PATENT_EMAIL, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + await baseAppClient.post(UPDATE_PATENT_EMAIL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - Future insertRequestForMedicalReport( - AppointmentHistory appointmentHistory) async { + Future insertRequestForMedicalReport(AppointmentHistory appointmentHistory) async { Map body = new Map(); body['ClinicID'] = appointmentHistory.clinicID; body['DoctorID'] = appointmentHistory.doctorID; @@ -98,23 +120,65 @@ class ReportsService extends BaseService { body['Status'] = 1; body['CreatedBy'] = 102; hasError = false; - await baseAppClient.post(INSERT_REQUEST_FOR_MEDICAL_REPORT, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(INSERT_REQUEST_FOR_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } - Future sendEmailForMedicalReport( - String projectName, - String clinicName, - String doctorName, - String requestDate, - String invoiceNo, - int projectID, - String stamp, - String setupID) async { + Future insertRequestForInPatientMedicalReport(int clinicID, int doctorID, String setupID, int admissionNo, int projectID) async { + Map body = new Map(); + body['ClinicID'] = clinicID; + body['DoctorID'] = doctorID; + body['SetupID'] = setupID; + body['EncounterNo'] = admissionNo; + body['EncounterType'] = 2; // appointmentHistory.appointmentType; + body['IsActive'] = true; + body['ProjectID'] = projectID; + body['Remarks'] = ""; + body['ProcedureId'] = ""; + body['RequestType'] = 1; + body['Source'] = 2; + body['Status'] = 1; + body['CreatedBy'] = 102; + hasError = false; + await baseAppClient.post(INSERT_REQUEST_FOR_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future sendEmailForMedicalReport(String projectName, String clinicName, String doctorName, String requestDate, String invoiceNo, int projectID, String stamp, String setupID) async { + Map body = new Map(); + body['SetupID'] = setupID; + body['PrintDate'] = requestDate; + body['ProcedureID'] = "05005009"; + body['Reporttype'] = "MEDICAL REPORT"; + body['stamp'] = stamp; + body['To'] = user.emailAddress; + body['DateofBirth'] = user.dateofBirth; + body['PatientIditificationNum'] = user.patientIdentificationNo; + body['PatientMobileNumber'] = user.mobileNumber; + body['PatientName'] = user.firstName + " " + user.lastName; + body['ProjectName'] = projectName; + body['ClinicName'] = clinicName; + body['ProjectID'] = projectID; + body['InvoiceNo'] = invoiceNo; + body['PrintedByName'] = user.firstName + " " + user.lastName; + + dynamic response; + + hasError = false; + await baseAppClient.post(SEND_MEDICAL_REPORT_EMAIL, onSuccess: (dynamic res, int statusCode) { + response = res; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return response; + } + + Future getMedicalReportPDF(String projectName, String clinicName, String doctorName, String requestDate, String invoiceNo, int projectID, String stamp, String setupID) async { Map body = new Map(); body['SetupID'] = setupID; body['PrintDate'] = requestDate; @@ -135,11 +199,9 @@ class ReportsService extends BaseService { dynamic response; hasError = false; - await baseAppClient.post(SEND_MEDICAL_REPORT_EMAIL, - onSuccess: (dynamic res, int statusCode) { - response = res; - }, - onFailure: (String error, int statusCode) { + await baseAppClient.post(GET_MEDICAL_REPORT_PDF, onSuccess: (dynamic res, int statusCode) { + response = res; + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); diff --git a/lib/core/viewModels/medical/ask_doctor_view_model.dart b/lib/core/viewModels/medical/ask_doctor_view_model.dart index d060db1f..abe2220c 100644 --- a/lib/core/viewModels/medical/ask_doctor_view_model.dart +++ b/lib/core/viewModels/medical/ask_doctor_view_model.dart @@ -54,6 +54,17 @@ class AskDoctorViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getQuestionTypes() async { + setState(ViewState.Busy); + await _askDoctorService.getQuestionTypes(); + if (_askDoctorService.hasError) { + error = _askDoctorService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else + setState(ViewState.Idle); + } + Future getCallInfoHoursResult({int projectId, int doctorId}) async { setState(ViewState.Busy); await _askDoctorService.getCallInfoHoursResult(projectId: projectId, doctorId: doctorId); diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 3d4b1039..4fbab4e6 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -20,6 +20,8 @@ class LabsViewModel extends BaseViewModel { List get labOrdersResultsList => _labsService.labOrdersResultsList; List timeSeries = []; + String get labReportPDF => _labsService.labReportPDF; + List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); @@ -46,7 +48,7 @@ class LabsViewModel extends BaseViewModel { List patientLabOrdersHospital = _patientLabOrdersListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, - ) + ) .toList(); if (patientLabOrdersHospital.length != 0) { @@ -74,7 +76,12 @@ class LabsViewModel extends BaseViewModel { getLaboratoryResult({String projectID, int clinicID, String invoiceNo, String orderNo, String setupID, bool isVidaPlus}) async { setState(ViewState.Busy); - await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID, setupID: setupID, isVidaPlus: isVidaPlus); + await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, + orderNo: orderNo, + projectID: projectID, + clinicID: clinicID, + setupID: setupID, + isVidaPlus: isVidaPlus); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -135,11 +142,14 @@ class LabsViewModel extends BaseViewModel { } } - sendLabReportEmail({PatientLabOrders patientLabOrder, String mes, AuthenticatedUser userObj, bool isVidaPlus}) async { - await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder, userObj: userObj, isVidaPlus: isVidaPlus); + sendLabReportEmail({PatientLabOrders patientLabOrder, String mes, AuthenticatedUser userObj, bool isVidaPlus, bool isDownload = false}) async { + await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder, userObj: userObj, isVidaPlus: isVidaPlus, isDownload: isDownload); if (_labsService.hasError) { error = _labsService.error; - } else - AppToast.showSuccessToast(message: mes); + } else { + if (isDownload) {} else { + AppToast.showSuccessToast(message: mes); + } + } } } diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index e12e2b07..4166a4b3 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -70,9 +70,9 @@ class MyBalanceViewModel extends BaseViewModel { } } - Future getHospitals() async { + Future getHospitals({bool isAdvancePayment = false}) async { setState(ViewState.Busy); - await _hospitalService.getHospitals(); + await _hospitalService.getHospitals(isAdvancePayment: isAdvancePayment); if (_hospitalService.hasError) { error = _hospitalService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/medical/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index 271b5463..8f55b3b7 100644 --- a/lib/core/viewModels/medical/reports_view_model.dart +++ b/lib/core/viewModels/medical/reports_view_model.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/reports/admission_for_medical_report.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -15,17 +16,20 @@ class ReportsViewModel extends BaseViewModel { List reportsOrderRequestList = List(); List reportsOrderReadyList = List(); - List reportsOrderCompletedList = List(); List reportsOrderCanceledList = List(); - List get appointHistoryList => - _reportsService.appointHistoryList; + List reportsInPatientOrderRequestList = List(); + List reportsInPatientOrderReadyList = List(); + List reportsInPatientOrderCanceledList = List(); + + List get appointHistoryList => _reportsService.appointHistoryList; + + List get admissionsMedicalReportList => _reportsService.admissionsMedicalReport; getReports() async { setState(ViewState.Busy); reportsOrderRequestList.clear(); reportsOrderReadyList.clear(); - reportsOrderCompletedList.clear(); reportsOrderCanceledList.clear(); await _reportsService.getReports(); if (_reportsService.hasError) { @@ -33,6 +37,22 @@ class ReportsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); + await _reportsService.getInpatientAdmissionsList(); + setState(ViewState.Idle); + } + } + + getInPatientReports() async { + setState(ViewState.Busy); + reportsInPatientOrderRequestList.clear(); + reportsInPatientOrderReadyList.clear(); + reportsInPatientOrderCanceledList.clear(); + await _reportsService.getInPatientReports(); + if (_reportsService.hasError) { + error = _reportsService.error; + setState(ViewState.Error); + } else { + _filterInPatientList(); setState(ViewState.Idle); } } @@ -48,6 +68,23 @@ class ReportsViewModel extends BaseViewModel { } } + void _filterInPatientList() { + _reportsService.inpatientReportsList.forEach((report) { + switch (report.status) { + case 1: + reportsInPatientOrderRequestList.add(report); + break; + case 2: + reportsInPatientOrderReadyList.add(report); + break; + case 4: + reportsInPatientOrderCanceledList.add(report); + break; + default: + } + }); + } + void _filterList() { _reportsService.reportsList.forEach((report) { switch (report.status) { @@ -57,9 +94,6 @@ class ReportsViewModel extends BaseViewModel { case 2: reportsOrderReadyList.add(report); break; - case 3: - reportsOrderCompletedList.add(report); - break; case 4: reportsOrderCanceledList.add(report); break; @@ -68,17 +102,31 @@ class ReportsViewModel extends BaseViewModel { }); } + insertRequestForMedicalReport(AppointmentHistory appointmentHistory, String mes) async { + setState(ViewState.Busy); + await _reportsService.insertRequestForMedicalReport(appointmentHistory); + if (_reportsService.hasError) { + error = _reportsService.error; + AppToast.showErrorToast(message: error); + setState(ViewState.ErrorLocal); + } else { + AppToast.showSuccessToast(message: mes); + getInPatientReports(); + setState(ViewState.Idle); + } + } - insertRequestForMedicalReport(AppointmentHistory appointmentHistory,String mes)async{ - setState(ViewState.Busy); - await _reportsService.insertRequestForMedicalReport(appointmentHistory); - if (_reportsService.hasError) { - error = _reportsService.error; - AppToast.showErrorToast(message: error); - setState(ViewState.ErrorLocal); - } else { - AppToast.showSuccessToast(message: mes); - setState(ViewState.Idle); - } + insertRequestForInPatientMedicalReport(int clinicID, int doctorID, String setupID, int admissionNo, int projectID, String mes) async { + setState(ViewState.Busy); + await _reportsService.insertRequestForInPatientMedicalReport(clinicID, doctorID, setupID, admissionNo, projectID); + if (_reportsService.hasError) { + error = _reportsService.error; + AppToast.showErrorToast(message: error); + setState(ViewState.ErrorLocal); + } else { + AppToast.showSuccessToast(message: mes); + setState(ViewState.Idle); + } } + } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index e1700bc5..df9cb4f6 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,6 +1,19 @@ +import 'dart:convert'; +import 'package:crypto/crypto.dart'; + extension CapExtension on String { String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; + String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; + String get allInCaps => this.toUpperCase(); - String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; + + String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.isNotEmpty ? str.inCaps : str).join(" ") : ""; +} + +extension HashSha on String { + String get toSha256 { + var bytes = utf8.encode(this); + return sha256.convert(bytes).toString(); + } } diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 122f560f..f7a19c3a 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -1,5 +1,6 @@ class DoctorList { num clinicID; + dynamic appointmentNo; String clinicName; String doctorTitle; num iD; @@ -45,6 +46,7 @@ class DoctorList { DoctorList( {this.clinicID, + this.appointmentNo, this.clinicName, this.doctorTitle, this.iD, @@ -90,6 +92,7 @@ class DoctorList { DoctorList.fromJson(Map json) { clinicID = json['ClinicID']; + appointmentNo = json['AppointmentNo']; clinicName = json['ClinicName']; doctorTitle = json['DoctorTitle']; iD = json['ID']; @@ -138,6 +141,7 @@ class DoctorList { Map toJson() { final Map data = new Map(); data['ClinicID'] = this.clinicID; + data['AppointmentNo'] = this.appointmentNo; data['ClinicName'] = this.clinicName; data['DoctorTitle'] = this.doctorTitle; data['ID'] = this.iD; diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 5fba9b5a..b1b457f5 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -58,6 +58,16 @@ class _AnicllaryOrdersState extends State with SingleTic super.dispose(); } + void getAncillaryOrderDetails(AnciallryOrdersViewModel model) { + GifLoaderDialogUtils.showMyDialog(context); + model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) { + addToSelectedProcedures(model); + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + }); + } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -65,6 +75,7 @@ class _AnicllaryOrdersState extends State with SingleTic AppGlobal.context = context; return BaseView( onModelReady: (model) { + // getAncillaryOrderDetails(model); model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) { addToSelectedProcedures(model); }); diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index bfd8f69a..700d5471 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -88,7 +88,7 @@ class ConfirmPaymentPage extends StatelessWidget { child: selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(selectedPaymentMethod)) : Image.asset(getImagePath(selectedPaymentMethod)), ), Texts( - '${advanceModel.amount} SAR', + advanceModel.hospitalsModel.projectOutSA ? '${advanceModel.amount} AED' : '${advanceModel.amount} SAR', fontSize: 26, bold: true, ) diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 473c8650..50dbc70f 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -7,6 +7,9 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; +import 'package:diplomaticquarterapp/pages/insurance/UpdateInsuranceManually.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; @@ -56,6 +59,10 @@ class _BookConfirmState extends State { AppSharedPreferences sharedPref = new AppSharedPreferences(); + bool isInsured = false; + bool isEligible = false; + bool isCash = false; + @override void initState() { // widget.authUser = new AuthenticatedUser(); @@ -271,7 +278,51 @@ class _BookConfirmState extends State { }); } - insertAppointment(context, DoctorList docObject, int initialSlotDuration) async{ + checkPatientNphiesEligibility(DoctorList docObject, String appointmentNo, BuildContext context) { + widget.service.checkPatientNphiesEligibility(docObject.projectID).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["isNphiesMatchedWithVida"]) { + getPatientShare(context, appointmentNo, docObject.clinicID, docObject.projectID, docObject); + getToDoCount(); + } else { + ConfirmDialog dialog = new ConfirmDialog( + isDissmissable: false, + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: "Update insurance", + cancelText: "Continue as cash", + okFunction: () => {openUpdateInsurance()}, + cancelFunction: () => {continueAsCash(docObject, appointmentNo)}); + dialog.showAlertDialog(context); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void openUpdateInsurance() { + Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false); + Navigator.push(context, FadePage(page: InsuranceUpdate())); + } + + void continueAsCash(DoctorList docObject, String appointmentNo) { + GifLoaderDialogUtils.showMyDialog(context); + widget.service.convertPatientToCash(docObject.projectID).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["MessageStatus"] == 1) { + getPatientShare(context, appointmentNo, docObject.clinicID, docObject.projectID, docObject); + getToDoCount(); + } else { + AppToast.showErrorToast(message: res["ErrorEndUserMessage"]); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + insertAppointment(context, DoctorList docObject, int initialSlotDuration) async { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; String logs = await sharedPref.getString('selectedLogSlots'); List decodedLogs = json.decode(logs); @@ -284,14 +335,15 @@ class _BookConfirmState extends State { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); Future.delayed(new Duration(milliseconds: 500), () { - getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); + // checkPatientNphiesEligibility(docObject, res['AppointmentNo'], context); getToDoCount(); + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); }); - widget.service.logDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, decodedLogs,res['AppointmentNo'], context).then((res) { + widget.service.logDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, decodedLogs, res['AppointmentNo'], context).then((res) { if (res['MessageStatus'] == 1) { print("Logs Saved"); - }else{ + } else { print("Error Saving logs"); } }); @@ -389,12 +441,40 @@ class _BookConfirmState extends State { } getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { + String errorMsg = ""; + GifLoaderDialogUtils.showMyDialog(context); widget.service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { projectViewModel.selectedBodyPartList.clear(); projectViewModel.laserSelectionDuration = 0; print(res); - widget.patientShareResponse = new PatientShareResponse.fromJson(res); - navigateToBookSuccess(context, docObject, widget.patientShareResponse); + widget.patientShareResponse = new PatientShareResponse.fromJson(res['OnlineCheckInAppointments'][0]); + + isInsured = res["IsInsured"]; + isEligible = res["IsEligible"]; + isCash = res["IsCash"]; + + if (isCash) { + navigateToBookSuccess(context, docObject, widget.patientShareResponse); + } else { + if (isInsured && isEligible) { + navigateToBookSuccess(context, docObject, widget.patientShareResponse); + } else { + if (isInsured && !isEligible) { + errorMsg = TranslationBase.of(context).invalidEligibility; + } else { + errorMsg = TranslationBase.of(context).invalidInsurance; + } + ConfirmDialog dialog = new ConfirmDialog( + isDissmissable: false, + context: context, + confirmMessage: errorMsg, + okText: TranslationBase.of(context).updateInsuranceText, + cancelText: TranslationBase.of(context).continueCash, + okFunction: () => {openUpdateInsurance()}, + cancelFunction: () => {continueAsCash(docObject, appointmentNo)}); + dialog.showAlertDialog(context); + } + } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); // AppToast.showErrorToast(message: err); diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 0f80abac..3d95a694 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -52,6 +52,7 @@ class _SearchResultsState extends State { ? widget.patientDoctorAppointmentListHospital[index].filterName + " - " + widget.patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km : widget.patientDoctorAppointmentListHospital[index].filterName, isTitleSingleLine: false, + isExpand: widget.patientDoctorAppointmentListHospital.length == 1 ? true : false, bodyWidget: ListView.separated( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index 04db5bed..918ca9ad 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -1,5 +1,6 @@ import 'dart:collection'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; @@ -17,7 +18,9 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class LaserClinic extends StatefulWidget { - LaserClinic({Key key}) : super(key: key); + HospitalsModel selectedHospital; + + LaserClinic({this.selectedHospital}); @override _LaserClinicState createState() { @@ -66,7 +69,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getLaserBodyPartsList(laserCategoryId).then((res) { + service.getLaserBodyPartsList(laserCategoryId, widget.selectedHospital.iD).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['Laser_GetBodyPartsByCategoryList'].length != 0) { diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 850e23af..26deb0f8 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -240,7 +240,7 @@ class _SearchByClinicState extends State { dropdownValue = clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString(); if (dropdownValue == "253-false-0-0") { - Navigator.push(context, FadePage(page: LaserClinic())); + // Navigator.push(context, FadePage(page: LaserClinic())); } else if (!isDentalSelectedAndSupported()) { projectDropdownValue = ""; if (!nearestAppo) getDoctorsList(context); @@ -332,7 +332,11 @@ class _SearchByClinicState extends State { setState(() { selectedHospital = newValue; projectDropdownValue = newValue.mainProjectID.toString(); - getDoctorsList(context); + if (dropdownValue.split("-")[0] == "253") { + Navigator.push(context, FadePage(page: LaserClinic(selectedHospital: selectedHospital))); + } else { + getDoctorsList(context); + } }); }, ), @@ -457,7 +461,7 @@ class _SearchByClinicState extends State { bool isDentalSelectedAndSupported() { if (dropdownValue != null) - return dropdownValue != "" && (dropdownValue.split("-")[0] == "17") && isMobileAppDentalAllow; + return dropdownValue != "" && (dropdownValue.split("-")[0] == "17" || dropdownValue.split("-")[0] == "253") && isMobileAppDentalAllow; else return false; } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index f7d58b36..fa7d4a6a 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -446,11 +446,10 @@ class _MyFamily extends State with TickerProviderStateMixin { this.familyFileProvider.deativateActivateMemberFile(request).then((value) => refreshFamily(context)); } - refreshFamily(context) { - setState(() { - sharedPref.remove(FAMILY_FILE); - checkUserData(); - }); + refreshFamily(context) async { + + await sharedPref.remove(FAMILY_FILE); + await checkUserData(); } switchUser(user, context) { @@ -525,17 +524,23 @@ class _MyFamily extends State with TickerProviderStateMixin { Map request = {}; request["ID"] = ID; request["Status"] = status; - this.familyFileProvider.acceptRejectFamily(request).then((value) => {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); + this.familyFileProvider.acceptRejectFamily(request).then((value) async{ + + await refreshFamily(context); + GifLoaderDialogUtils.hideDialog(context); + }); } checkUserData() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER)); + // var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER)); await getFamilyFiles(); - setState(() { + this.user = data; - }); + setState(() { + + }); } } @@ -552,16 +557,20 @@ class _MyFamily extends State with TickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); try { if (familySharedRecords == null) { + familySharedRecords = await familyFileProvider.getSharedRecordByStatus(); } + sentRecordsList =[]; familySharedRecords.getAllSharedRecordsByStatusList.forEach((element) { if (element.status == 3) { familySharedRecordsList.add(element); } sentRecordsList.add(element); }); - + approvedRecordsList =[]; + pendingRecordsList =[]; GetAllSharedRecordsByStatusResponse pendingAndApprovedRecords = await getUserViewRequest(); + pendingAndApprovedRecords.getAllSharedRecordsByStatusList.forEach((element) { print(element.toJson()); if (element.status == 2) { @@ -571,6 +580,7 @@ class _MyFamily extends State with TickerProviderStateMixin { } }); } catch (ex) { + familySharedRecords = GetAllSharedRecordsByStatusResponse(getAllSharedRecordsByStatusList: []); } GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 63ad920b..8068c541 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -72,7 +72,8 @@ class _AppointmentActionsState extends State { padding: EdgeInsets.all(21), shrinkWrap: true, itemBuilder: (context, index) { - bool shouldEnable = ((widget.appo.clinicID == 17 || widget.appo.clinicID == 47) && appoButtonsList[index].caller == "openReschedule"); + // bool shouldEnable = ((widget.appo.clinicID == 17 || widget.appo.clinicID == 47) || (widget.appo.isLiveCareAppointment && appoButtonsList[index].caller == "askDoc") || appoButtonsList[index].caller == "openReschedule"); + bool shouldEnable = (((widget.appo.clinicID == 17 || widget.appo.clinicID == 47) && appoButtonsList[index].caller == "openReschedule") || (widget.appo.isLiveCareAppointment && appoButtonsList[index].caller == "askDoc")); return InkWell( onTap: shouldEnable ? null diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 5f29e784..75290ab1 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -17,6 +17,8 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -28,6 +30,7 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; @@ -76,6 +79,10 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { bool dataLoaded = false; + bool isInsured = false; + bool isEligible = false; + bool isCash = false; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); @@ -541,6 +548,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { break; case 20: getPatientShare(context, appo); + // checkPatientNphiesEligibility(context, appo); break; case 30: getAppoQR(context, appo); @@ -837,7 +845,55 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { // getAncillaryOrders(); } + checkPatientNphiesEligibility(context, AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.checkPatientNphiesEligibility(appo.projectID).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["isNphiesMatchedWithVida"]) { + getPatientShare(context, appo); + // getToDoCount(); + } else { + ConfirmDialog dialog = new ConfirmDialog( + isDissmissable: false, + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: "Update insurance", + cancelText: "Continue as cash", + okFunction: () => {openUpdateInsurance()}, + cancelFunction: () => {continueAsCash(appo)}); + dialog.showAlertDialog(context); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void openUpdateInsurance() { + Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false); + Navigator.push(context, FadePage(page: InsuranceUpdate())); + } + + void continueAsCash(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.convertPatientToCash(appo.projectID).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["MessageStatus"] == 1) { + getPatientShare(context, appo); + // getToDoCount(); + } else { + AppToast.showErrorToast(message: res["ErrorEndUserMessage"]); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + getPatientShare(context, AppoitmentAllHistoryResultList appo) { + String errorMsg = ""; DoctorsListService service = new DoctorsListService(); if (appo.isLiveCareAppointment) { getLiveCareAppointmentPatientShare(context, service, appo); @@ -845,8 +901,33 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); service.getPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - widget.patientShareResponse = new PatientShareResponse.fromJson(res); - openPaymentDialog(appo, widget.patientShareResponse); + widget.patientShareResponse = new PatientShareResponse.fromJson(res['OnlineCheckInAppointments'][0]); + isInsured = res["IsInsured"]; + isEligible = res["IsEligible"]; + isCash = res["IsCash"]; + + if (isCash) { + openPaymentDialog(appo, widget.patientShareResponse); + } else { + if (isInsured && isEligible) { + openPaymentDialog(appo, widget.patientShareResponse); + } else { + if (isInsured && !isEligible) { + errorMsg = TranslationBase.of(context).invalidEligibility; + } else { + errorMsg = TranslationBase.of(context).invalidInsurance; + } + ConfirmDialog dialog = new ConfirmDialog( + isDissmissable: false, + context: context, + confirmMessage: errorMsg, + okText: TranslationBase.of(context).updateInsuranceText, + cancelText: TranslationBase.of(context).continueCash, + okFunction: () => {openUpdateInsurance()}, + cancelFunction: () => {continueAsCash(appo)}); + dialog.showAlertDialog(context); + } + } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); diff --git a/lib/pages/conference/web_rtc/call_home_page_.dart b/lib/pages/conference/web_rtc/call_home_page_.dart index a831a23f..13dbfb35 100644 --- a/lib/pages/conference/web_rtc/call_home_page_.dart +++ b/lib/pages/conference/web_rtc/call_home_page_.dart @@ -33,7 +33,7 @@ // //Stream to enable video // MediaStream localMediaStream; // MediaStream remoteMediaStream; -// // Signaling signaling = Signaling(); +// Signaling signaling = Signaling(); // // @override // void initState() { diff --git a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart index e7d57363..16c8cdf5 100644 --- a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart +++ b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart @@ -13,9 +13,11 @@ import 'package:flutter/material.dart'; class AttachInsuranceCardImageDialog extends StatefulWidget { final String name; final String fileNo; + final String identificationNo; + final String mobileNo; final Function(File file, String image) image; - const AttachInsuranceCardImageDialog({Key key, this.name, this.fileNo, this.image}) : super(key: key); + const AttachInsuranceCardImageDialog({Key key, this.name, this.fileNo, this.identificationNo, this.mobileNo, this.image}) : super(key: key); @override _AttachInsuranceCardImageDialogState createState() => _AttachInsuranceCardImageDialogState(); @@ -130,15 +132,31 @@ class _AttachInsuranceCardImageDialogState extends State createState() => _UpdateInsuranceManuallyState(); @@ -51,7 +55,7 @@ class _UpdateInsuranceManuallyState extends State { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - _nationalIDTextController.text = projectViewModel.user.patientIdentificationNo; + _nationalIDTextController.text = widget.patientIdentificationNo; return AppScaffold( isShowAppBar: true, isShowDecPage: false, @@ -159,9 +163,12 @@ class _UpdateInsuranceManuallyState extends State { padding: EdgeInsets.all(18), child: DefaultButton( TranslationBase.of(context).submit, - isFormValid() ? () { - submitManualInsuranceUpdateRequest(); - } : null, + () { + if (isFormValid()) + submitManualInsuranceUpdateRequest(); + else + AppToast.showErrorToast(message: TranslationBase.of(context).enterInsuranceDetails); + }, disabledColor: Colors.grey, ), ), @@ -190,6 +197,7 @@ class _UpdateInsuranceManuallyState extends State { listData: list, selectedIndex: _selectedInsuranceCompanyIndex, isScrollable: true, + isShowSearch: true, onValueSelected: (index) { _selectedInsuranceCompanyIndex = index; selectedInsuranceCompanyObj = insuranceCompaniesList[index]; @@ -236,16 +244,18 @@ class _UpdateInsuranceManuallyState extends State { insuranceManualUpdateRequest.projectID = selectedInsuranceCompanyObj.projectID; insuranceManualUpdateRequest.requestType = 2; - insuranceManualUpdateRequest.mobileNo = projectViewModel.user.mobileNumber; + insuranceManualUpdateRequest.mobileNo = widget.patientMobileNumber; insuranceManualUpdateRequest.cardHolderName = _cardHolderNameTextController.text; insuranceManualUpdateRequest.insuranceCompanyName = selectedInsuranceCompanyObj.companyName; insuranceManualUpdateRequest.memberShipNo = _membershipNoTextController.text; insuranceManualUpdateRequest.policyNo = _policyNoTextController.text; - insuranceManualUpdateRequest.patientIdentificationID = projectViewModel.user.patientIdentificationNo; + insuranceManualUpdateRequest.patientIdentificationID = widget.patientIdentificationNo; insuranceManualUpdateRequest.schemeClass = selectedInsuranceCompaniesSchemesObj.subCategoryDesc; insuranceManualUpdateRequest.setupID = selectedInsuranceCompanyObj.setupID; + insuranceManualUpdateRequest.patientID = widget.patientID; _insuranceCardService.submitManualInsuranceUpdateRequest(insuranceManualUpdateRequest).then((value) { + print(value); AppToast.showSuccessToast(message: TranslationBase.of(context).insuranceRequestSubmit); Navigator.pop(context); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index b84b63d3..0788305d 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -53,10 +54,7 @@ class _InsuranceCardState extends State { Navigator.push(context, FadePage(page: InsuranceUpdate())); }, backgroundColor: CustomColors.accentColor, - label: Text(TranslationBase.of(context).update, style: TextStyle( - fontSize: 12.0, - fontWeight: FontWeight.bold - )), + label: Text(TranslationBase.of(context).update, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), ), body: Container( child: ListView.separated( @@ -176,12 +174,11 @@ class _InsuranceCardState extends State { if (model.insurance[index].isActive == true) Container( color: Colors.transparent, - child: SecondaryButton( - onTap: () => { + child: DefaultButton( + TranslationBase.of(context).seeDetails, + () => { getDetails(model.insurance[index]), }, - label: TranslationBase.of(context).seeDetails, - textColor: Colors.white, ), width: double.infinity, ), diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index 71637051..2f0cc5a5 100644 --- a/lib/pages/insurance/insurance_card_update_details.dart +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -22,8 +22,9 @@ class InsuranceCardUpdateDetails extends StatelessWidget { final String patientIdentificationID; final int patientID; final String name; + final String mobileNo; - const InsuranceCardUpdateDetails({Key key, this.insuranceCardDetailsModel, this.patientIdentificationID, this.patientID, this.name}) : super(key: key); + const InsuranceCardUpdateDetails({Key key, this.insuranceCardDetailsModel, this.patientIdentificationID, this.patientID, this.name, this.mobileNo}) : super(key: key); @override Widget build(BuildContext context) { @@ -53,8 +54,7 @@ class InsuranceCardUpdateDetails extends StatelessWidget { // height: projectViewModel.isArabic ? 320 : 240, // decoration: containerRadius(CustomColors.accentColor, 12), child: Container( - decoration: cardRadius(12,color: CustomColors.accentColor), - + decoration: cardRadius(12, color: CustomColors.accentColor), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( @@ -229,7 +229,6 @@ class InsuranceCardUpdateDetails extends StatelessWidget { children: [ Container( child: Container( - decoration: cardRadius(12), child: Container( width: MediaQuery.of(context).size.width, @@ -306,7 +305,8 @@ class InsuranceCardUpdateDetails extends StatelessWidget { color: CustomColors.accentColor, small: true, onTap: () async { - confirmAttachInsuranceCardImageDialogDialog(context: context, name: name, fileNo: patientID.toString(), model: model); + confirmAttachInsuranceCardImageDialogDialog( + context: context, name: name, fileNo: patientID.toString(), identificationNo: patientIdentificationID, mobileNo: mobileNo, model: model); }, ), if (insuranceCardDetailsModel.isNotEmpty) @@ -324,7 +324,6 @@ class InsuranceCardUpdateDetails extends StatelessWidget { AppToast.showErrorToast(message: err.toString()); print(err); }); - }, ), if (insuranceCardDetailsModel.isNotEmpty) @@ -337,7 +336,8 @@ class InsuranceCardUpdateDetails extends StatelessWidget { label: TranslationBase.of(context).disagree.toUpperCase(), color: Colors.grey[800], onTap: () async { - confirmAttachInsuranceCardImageDialogDialog(context: context, name: name, fileNo: patientID.toString(), model: model); + confirmAttachInsuranceCardImageDialogDialog( + context: context, name: name, fileNo: patientID.toString(), identificationNo: patientIdentificationID, mobileNo: mobileNo, model: model); }, ) ], @@ -349,12 +349,14 @@ class InsuranceCardUpdateDetails extends StatelessWidget { ); } - void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo, InsuranceViewModel model}) { + void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo, String identificationNo, String mobileNo, InsuranceViewModel model}) { showDialog( context: context, builder: (cxt) => AttachInsuranceCardImageDialog( fileNo: fileNo, name: name, + identificationNo: identificationNo, + mobileNo: mobileNo, image: (file, image) async { GifLoaderDialogUtils.showMyDialog(context); await model.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID, patientID: patientID, image: image); diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart index 2ea4213f..c388d341 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -1,14 +1,17 @@ import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/insurance/UpdateInsuranceManually.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../locator.dart'; +import '../../widgets/dialogs/confirm_dialog.dart'; import 'insurance_card_update_details.dart'; class InsurancePage extends StatelessWidget { @@ -17,8 +20,11 @@ class InsurancePage extends StatelessWidget { InsurancePage({Key key, this.model}) : super(key: key); + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(12.0), @@ -35,11 +41,16 @@ class InsurancePage extends StatelessWidget { getDetails( setupID: '010266', projectID: 15, - patientIdentificationID: model.user.patientIdentificationNo, - patientID: model.user.patientID, + patientIdentificationID: projectViewModel.user.patientIdentificationNo, + //model.user.patientIdentificationNo, + patientID: projectViewModel.user.patientID, + //model.user.patientID, parentID: 0, - isFamily: false, - name: model.user.firstName + " " + model.user.lastName, + isFamily: projectViewModel.isLoginChild, + //false, + name: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + mobileNumber: projectViewModel.user.mobileNumber, + //model.user.firstName + " " + model.user.lastName, context: context, ); }, @@ -53,7 +64,7 @@ class InsurancePage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - model.user.firstName + " " + model.user.lastName, + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -61,7 +72,7 @@ class InsurancePage extends StatelessWidget { ), ), Text( - TranslationBase.of(context).fileno + ": " + model.user.patientID.toString(), + TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), //model.user.patientID.toString(), style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, @@ -78,73 +89,77 @@ class InsurancePage extends StatelessWidget { ), ), ), - if (model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList != null ?? false) - ListView.separated( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, index) { - return model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 - ? InkWell( - onTap: () { - getDetails( - projectID: 15, - patientIdentificationID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientIdenficationNumber, - setupID: '010266', - patientID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID, - name: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, - parentID: model.user.patientID, - isFamily: true, - context: context); - }, - child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 12.0), + if (!projectViewModel.isLoginChild) + if (model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList != null ?? false) + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 + ? InkWell( + onTap: () { + getDetails( + projectID: 15, + patientIdentificationID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientIdenficationNumber, + setupID: '010266', + patientID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID, + name: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, + parentID: model.user.patientID, + isFamily: true, + mobileNumber: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].mobileNumber, + context: context); + }, child: Container( - decoration: cardRadius(12), - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46), - ), - Text( - TranslationBase.of(context).fileno + ": " + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID.toString(), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.46), - ), - ], + width: double.infinity, + margin: EdgeInsets.only(top: 12.0), + child: Container( + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46), + ), + Text( + TranslationBase.of(context).fileno + ": " + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID.toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.46), + ), + ], + ), ), - ), - Icon(Icons.arrow_forward), - ], + Icon(Icons.arrow_forward), + ], + ), ), ), ), - ), - ) - : Container(); - }, - separatorBuilder: (context, index) { - return mHeight(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 ? 8 : 0); - }, - itemCount: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, - ), + ) + : Container(); + }, + separatorBuilder: (context, index) { + return mHeight(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 ? 8 : 0); + }, + itemCount: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, + ), ], ), ), ); } - getDetails({String setupID, int projectID, String patientIdentificationID, int patientID, String name, bool isFamily, int parentID = 0, BuildContext context}) { + getDetails({String setupID, int projectID, String patientIdentificationID, int patientID, String name, String mobileNumber, bool isFamily, int parentID = 0, BuildContext context}) { GifLoaderDialogUtils.showMyDialog(context); - _insuranceCardService.getPatientInsuranceDetails(setupID: setupID, projectID: projectID, patientID: patientID, patientIdentificationID: patientIdentificationID, isFamily: isFamily, parentID: parentID).then((value) { + _insuranceCardService + .getPatientInsuranceDetails(setupID: setupID, projectID: projectID, patientID: patientID, patientIdentificationID: patientIdentificationID, isFamily: isFamily, parentID: parentID) + .then((value) { GifLoaderDialogUtils.hideDialog(context); if (!_insuranceCardService.hasError && _insuranceCardService.isHaveInsuranceCard) { Navigator.push( @@ -155,12 +170,37 @@ class InsurancePage extends StatelessWidget { patientID: patientID, patientIdentificationID: patientIdentificationID, name: name, + mobileNo: mobileNumber, ))).then((value) { model.getInsuranceUpdated(); }); } else { - AppToast.showErrorToast(message: _insuranceCardService.error); + // AppToast.showErrorToast(message: _insuranceCardService.error); + updateManually(context, _insuranceCardService.error, patientIdentificationID, patientID, mobileNumber); } }); } + + void updateManually(BuildContext context, String errorMsg, String patientIdentificationID, int patientID, String mobileNumber) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: errorMsg + ". " + TranslationBase.of(context).habibCallCenter, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () => { + Navigator.pop(context), + Navigator.push( + context, + FadePage( + page: UpdateInsuranceManually( + patientIdentificationNo: patientIdentificationID, + patientID: patientID, + patientMobileNumber: mobileNumber, + ), + ), + ), + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } } diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart index 5b68687f..56f67282 100644 --- a/lib/pages/insurance/insurance_update_screen.dart +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -1,10 +1,12 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../base/base_view.dart'; import 'insurance_page.dart'; @@ -17,6 +19,7 @@ class InsuranceUpdate extends StatefulWidget { class _InsuranceUpdateState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); + ProjectViewModel projectViewModel; @override void initState() { @@ -33,6 +36,7 @@ class _InsuranceUpdateState extends State with SingleTickerProv } Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getInsuranceUpdated(), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( @@ -123,7 +127,7 @@ class _InsuranceUpdateState extends State with SingleTickerProv crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - model.user.firstName + " " + model.user.lastName, + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -141,7 +145,6 @@ class _InsuranceUpdateState extends State with SingleTickerProv letterSpacing: -0.46, ), ), - Text( model.insuranceUpdate[index].createdOn, style: TextStyle( diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 9111c2ab..207310b4 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -1,6 +1,3 @@ -import 'dart:math' as math; - -import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -12,6 +9,7 @@ import 'package:diplomaticquarterapp/models/gradient_color.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/models/slider_data.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart'; +import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart'; @@ -289,9 +287,8 @@ class _HomePageFragment2State extends State { flex: 1, child: InkWell( onTap: () { - AuthenticatedUser user = projectViewModel.user; - if (projectViewModel.havePrivilege(82) || bypassPrivilageCheck) Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesOfferTabPage(user))); - projectViewModel.analytics.offerPackages.log(); + // Navigator.of(context).push(MaterialPageRoute(builder: (context) => ErOptions(isAppbar: true))); + Navigator.push(context, FadePage(page: ErOptions(isAppbar: true))); }, child: Stack( children: [ @@ -306,7 +303,7 @@ class _HomePageFragment2State extends State { width: double.infinity, height: double.infinity, // color: Color(0xFF2B353E), - decoration: containerRadius(Color(0xFF2B353E), 20), + decoration: containerRadius(CustomColors.accentColor, 20), ), Container( width: double.infinity, @@ -331,9 +328,9 @@ class _HomePageFragment2State extends State { left: 20, top: 12, child: Opacity( - opacity: 0.04, + opacity: 0.5, child: SvgPicture.asset( - "assets/images/new/logo.svg", + "assets/images/new/emergency_services_back.svg", height: MediaQuery.of(context).size.width * 0.14, ), ), @@ -342,114 +339,73 @@ class _HomePageFragment2State extends State { right: 20, top: 12, child: Opacity( - opacity: 0.04, + opacity: 0.5, child: SvgPicture.asset( - "assets/images/new/logo.svg", + "assets/images/new/emergency_services_back.svg", height: MediaQuery.of(context).size.width * 0.14, ), ), ), - projectViewModel.isArabic - ? Positioned( - right: -16, - top: 2, - child: Transform.rotate( - angle: math.pi / 4, - child: Container( - padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Text( - TranslationBase.of(context).newDes, - style: TextStyle( - color: Colors.white, - fontSize: 9, - height: 0.8, - letterSpacing: -0.27, - ), - ), - ), - ), - ) - : Positioned( - left: -16, - top: 2, - child: Transform.rotate( - angle: -math.pi / 4, - child: Container( - padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Text( - TranslationBase.of(context).newDes, - style: TextStyle( - color: Colors.white, - fontSize: 9, - letterSpacing: -0.27, - height: 1.2, - ), - ), - ), - ), - ), Container( width: double.infinity, height: double.infinity, - padding: EdgeInsets.only(left: projectViewModel.isArabic ? 20 : 25, right: projectViewModel.isArabic ? 25 : 20), + padding: EdgeInsets.all(SizeConfig.widthMultiplier * 3.4), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - mFlex(3), - AutoSizeText( - TranslationBase.of(context).offersdiscount, - maxLines: 1, - style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.75, - height: 1, - ), - ), - projectViewModel.isArabic ? mHeight(4) : Container(), - Text( - TranslationBase.of(context).explore, - style: TextStyle( - color: Colors.black, - fontSize: 9, - fontWeight: FontWeight.w600, - letterSpacing: -0.27, - height: projectViewModel.isArabic ? 0.8 : 1, + Container( + child: SvgPicture.asset( + "assets/images/new/emergency_services.svg", + height: MediaQuery.of(context).size.width * 0.08, ), ), mFlex(1), - Row( + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - showFloating("assets/images/new/ear.svg"), - mWidth(4), - showFloating("assets/images/new/head.svg"), - mWidth(4), - showFloating("assets/images/new/tooth.svg"), + Text( + TranslationBase.of(context).emergencyServices, + style: TextStyle( + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.45, + height: 1, + ), + ), + projectViewModel.isArabic ? mHeight(5) : Container(), + Text( + TranslationBase.of(context).emergencyServicesSubtitle, + style: TextStyle( + color: Colors.black, + fontSize: 9, + fontWeight: FontWeight.w600, + letterSpacing: -0.27, + height: projectViewModel.isArabic ? 0.2 : 1, + ), + ), ], ), - mFlex(2) ], ), ), ], ), ), - projectViewModel.havePrivilege(82) || bypassPrivilageCheck - ? Container() - : Container( - width: double.infinity, - height: double.infinity, - clipBehavior: Clip.antiAlias, - decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor.withOpacity(0.7), darkColor: CustomColors.lightGreyColor.withOpacity(0.7)), - child: Icon( - Icons.lock_outline, - size: 40, - ), - ) + // projectViewModel.havePrivilege(82) || bypassPrivilageCheck + // ? Container() + // : Container( + // width: double.infinity, + // height: double.infinity, + // clipBehavior: Clip.antiAlias, + // decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor.withOpacity(0.7), darkColor: CustomColors.lightGreyColor.withOpacity(0.7)), + // child: Icon( + // Icons.lock_outline, + // size: 40, + // ), + // ) ], ), ), @@ -500,7 +456,7 @@ class _HomePageFragment2State extends State { left: 20, top: 12, child: Opacity( - opacity: 0.04, + opacity: 0.25, child: SvgPicture.asset( "assets/images/new/Pharmacy.svg", height: MediaQuery.of(context).size.width * 0.15, @@ -511,7 +467,7 @@ class _HomePageFragment2State extends State { right: 20, top: 12, child: Opacity( - opacity: 0.04, + opacity: 0.25, child: SvgPicture.asset( "assets/images/new/Pharmacy.svg", height: MediaQuery.of(context).size.width * 0.15, @@ -527,8 +483,6 @@ class _HomePageFragment2State extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - color: Colors.yellow, - // width: MediaQuery.of(context).size.width * 0.065, child: SvgPicture.asset( "assets/images/new/Pharmacy.svg", height: MediaQuery.of(context).size.width * 0.08, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 623c9298..0c044e6b 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -25,7 +25,6 @@ import 'package:diplomaticquarterapp/services/livecare_services/livecare_provide import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; -import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index def0461d..cf89b766 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -240,9 +240,11 @@ class _LiveCareHistoryCardState extends State { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); service.sendLiveCareInvoiceEmail(widget.erRequestHistoryList.appointmentNo.toString(), widget.erRequestHistoryList.projectID, authUser.emailAddress, context).then((res) { - AppToast.showSuccessToast(message: TranslationBase(context).emailSentSuccessfully); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully); }).catchError((err) { - AppToast.showErrorToast(message: err); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err.toString()); print(err); }); } diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 489e9281..c73b0fd6 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -1,21 +1,39 @@ import 'package:diplomaticquarterapp/core/model/ask_doctor/DoctorResponse.dart'; +import 'package:diplomaticquarterapp/core/service/medical/ask_doctor_services.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; -class ViewDoctorResponsesPage extends StatelessWidget { +class ViewDoctorResponsesPage extends StatefulWidget { final DoctorResponse doctorResponse; const ViewDoctorResponsesPage({Key key, this.doctorResponse}) : super(key: key); + @override + State createState() => _ViewDoctorResponsesPageState(); +} + +class _ViewDoctorResponsesPageState extends State { + int rate = 1; + TextEditingController textController = new TextEditingController(); + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.updateReadStatus(transactionNo: doctorResponse.transactionNo), + onModelReady: (model) => model.updateReadStatus(transactionNo: widget.doctorResponse.transactionNo), builder: (_, model, w) => AppScaffold( isShowAppBar: true, showNewAppBar: true, @@ -44,7 +62,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { itemBuilder: (context, _index) { return Container( padding: const EdgeInsets.only(left: 20, right: 12, top: 12, bottom: 12), - height: 130, + height: 160, decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(10.0), @@ -64,7 +82,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { children: [ Container( child: Text( - (doctorResponse.doctorName ?? ""), + (widget.doctorResponse.doctorName ?? ""), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -75,7 +93,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { ), Container( child: Text( - (DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctorResponse.createdOn)) ?? ""), + (DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.doctorResponse.createdOn)) ?? ""), style: TextStyle( fontSize: 14, color: Color(0xff2E303A), @@ -86,7 +104,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { Container( margin: EdgeInsets.only(top: 10.0), child: Text( - doctorResponse.transactions[_index]['InfoStatusDescription'], + widget.doctorResponse.transactions[_index]['DoctorResponse'], style: TextStyle( fontSize: 16, color: Color(0xff2E303A), @@ -94,11 +112,231 @@ class ViewDoctorResponsesPage extends StatelessWidget { ), ), ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: DefaultButton( + TranslationBase.of(context).rateDoctorResponse, + () { + openResponseRateDialog(context); + }, + color: CustomColors.accentColor, + ), + ), ], ), ); }, separatorBuilder: (context, index) => SizedBox(height: 14), - itemCount: doctorResponse.transactions.length); + itemCount: widget.doctorResponse.transactions.length); + } + + void openResponseRateDialog(BuildContext context) { + showModalBottomSheet( + context: context, + enableDrag: true, + isDismissible: true, + isScrollControlled: true, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)), + ), + backgroundColor: Colors.white, + builder: (context) { + return StatefulBuilder(builder: (BuildContext context, StateSetter setState) { + return Container( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 16.0, + ), + Text( + TranslationBase.of(context).rateDoctorResponseHeading, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.64, + ), + ), + Padding( + padding: const EdgeInsets.all(24.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: rate == 1 ? EdgeInsets.only(left: 3.0, right: 3.0) : EdgeInsets.only(left: 0.0, right: 0.0), + decoration: rate == 1 + ? BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.green)) + : BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.white)), + child: IconButton( + onPressed: () { + rate = 1; + setState(() {}); + }, + iconSize: 35, + icon: SvgPicture.asset('assets/images/new/appointment-rating/5.svg'), + ), + ), + Container( + margin: rate == 0 ? EdgeInsets.only(left: 3.0, right: 3.0) : EdgeInsets.only(left: 0.0, right: 0.0), + decoration: rate == 0 + ? BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.green)) + : BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.white)), + child: IconButton( + onPressed: () { + rate = 0; + setState(() {}); + }, + iconSize: 35, + icon: SvgPicture.asset('assets/images/new/appointment-rating/1.svg'), + ), + ), + ], + ), + ), + if (rate == 0) + Container( + padding: const EdgeInsets.all(24.0), + child: Padding( + padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + child: inputWidget(TranslationBase.of(context).comments, "", textController, isEnable: true), + ), + ), + SizedBox( + height: 16.0, + ), + Container( + margin: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 24.0), + child: DefaultButton( + TranslationBase.of(context).submit, + () { + if (rate == 0 && textController.text.isEmpty) { + AppToast.showErrorToast(message: "Please enter comments"); + } else { + rateDoctorResponse(); + } + }, + color: CustomColors.accentColor, + ), + ), + ], + ), + ); + }); + }).then((value) { + rate = 1; + setState(() {}); + }); + } + + void rateDoctorResponse() { + GifLoaderDialogUtils.showMyDialog(context); + AskDoctorService service = new AskDoctorService(); + service + .rateDoctorResponse( + transactionNo: widget.doctorResponse.transactionNo, + questionType: widget.doctorResponse.requestType, + rate: rate, + notes: textController.text, + mobileNo: projectViewModel.user.mobileNumber, + idNo: projectViewModel.user.patientIdentificationNo, + patientName: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + projectID: widget.doctorResponse.projectID, + language: projectViewModel.isArabic ? "ar" : "en") + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['SuccessMsg']); + Navigator.of(context).pop(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + }); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.all(40.0), + keyboardType: TextInputType.text, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + fillColor: CustomColors.accentColor, + hintStyle: TextStyle( + fontSize: isEnable ? 14 : 24, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: isEnable ? Color(0xff575757) : CustomColors.black, + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); } } diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 66cd9344..4c21e826 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_mod import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -26,7 +27,7 @@ class _RequestTypePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getCallRequestTypeLOVs(), + onModelReady: (model) => model.getQuestionTypes(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).requestType, @@ -109,8 +110,9 @@ class _RequestTypePageState extends State { TranslationBase.of(context).submit, () => { model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) { - if (model.state != ViewState.ErrorLocal || model.state != ViewState.Error) { + if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) { Navigator.pop(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).RRTRequestSuccess); } }) }, diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index b555a1bf..a07944f1 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -67,7 +67,7 @@ class _AdvancePaymentPageState extends State { projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) { - model.getHospitals(); + model.getHospitals(isAdvancePayment: true); model.getFamilyFiles(); }, builder: (_, model, w) => AppScaffold( @@ -315,7 +315,6 @@ class _AdvancePaymentPageState extends State { advanceModel.patientName = patientName; GifLoaderDialogUtils.showMyDialog(context); - model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) { GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { @@ -327,7 +326,8 @@ class _AdvancePaymentPageState extends State { onSelectedMethod: (String metohd, [String selectedInstallmentPlan]) { setState(() {}); }, - isShowInstallments: false, isFromAdvancePayment: true), + isShowInstallments: false, + isFromAdvancePayment: true), ), ).then( (value) { diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index b43810c0..0697ea75 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -139,7 +139,10 @@ class _ConfirmPaymentPageState extends State { : Image.asset(getImagePath(widget.selectedPaymentMethod)), ), Text( - '${widget.advanceModel.amount} ' + TranslationBase.of(context).sar, + widget.advanceModel.hospitalsModel.projectOutSA + ? '${widget.advanceModel.amount} ' + TranslationBase.of(context).aed + : '${widget.advanceModel.amount} ' + TranslationBase.of(context).sar, + // '${widget.advanceModel.amount} ' + TranslationBase.of(context).sar, style: TextStyle( fontSize: 20, fontWeight: FontWeight.w900, diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index a7a6d5d7..6783c895 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -106,7 +106,7 @@ class MyBalancePage extends StatelessWidget { ), ), Text( - TranslationBase.of(context).sar, + projectViewModel.user.outSA == 1 ? TranslationBase.of(context).aed : TranslationBase.of(context).sar, style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, @@ -157,7 +157,7 @@ class MyBalancePage extends StatelessWidget { ), ), Text( - amount.toStringAsFixed(2) + " " + TranslationBase.of(context).sar, + amount.toStringAsFixed(2) + " " + (projectViewModel.user.outSA == 1 ? TranslationBase.of(context).aed : TranslationBase.of(context).sar), style: TextStyle( fontSize: 16, letterSpacing: -0.64, diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index 694382cc..3e4aa2be 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -1,14 +1,22 @@ +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/LabResult/laboratory_result_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:open_filex/open_filex.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:provider/provider.dart'; class LaboratoryResultPage extends StatefulWidget { @@ -40,31 +48,73 @@ class _LaboratoryResultPageState extends State { showNewAppBar: true, showNewAppBarTitle: true, backgroundColor: Color(0xffF8F8F8), - body: ListView.builder( - physics: BouncingScrollPhysics(), - padding: EdgeInsets.only(bottom: 12), - itemBuilder: (context, index) => LaboratoryResultWidget( - onTap: () async { - GifLoaderDialogUtils.showMyDialog(context); - await model.sendLabReportEmail( + body: SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + physics: BouncingScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.only(bottom: 12), + itemBuilder: (context, index) => LaboratoryResultWidget( + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders, mes: TranslationBase.of(context).sendSuc, userObj: projectViewModel.user); + GifLoaderDialogUtils.hideDialog(context); + }, + billNo: widget.patientLabOrders.invoiceNo, + // details: model.patientLabSpecialResult[index].resultDataHTML, + details: model.patientLabSpecialResult.isEmpty ? null : getSpecialResults(model), + orderNo: widget.patientLabOrders.orderNo, patientLabOrder: widget.patientLabOrders, - mes: TranslationBase.of(context).sendSuc, - userObj: projectViewModel.user, - isVidaPlus: Utils.isVidaPlusProject(projectViewModel, num.parse(widget.patientLabOrders.projectID))); - GifLoaderDialogUtils.hideDialog(context); - }, - billNo: widget.patientLabOrders.invoiceNo, - // details: model.patientLabSpecialResult[index].resultDataHTML, - details: model.patientLabSpecialResult.isEmpty ? null : getSpecialResults(model), - orderNo: widget.patientLabOrders.orderNo, - patientLabOrder: widget.patientLabOrders, + ), + itemCount: 1, + ), + SizedBox( + height: 120.0, + ) + ], + ), + ), + bottomSheet: Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.081, + width: double.infinity, + padding: EdgeInsets.all(12.0), + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: DefaultButton( + TranslationBase.of(context).downloadReport, + () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders, mes: TranslationBase.of(context).sendSuc, userObj: projectViewModel.user, isDownload: true); + GifLoaderDialogUtils.hideDialog(context); + try { + String path = await _createFileFromString(model.labReportPDF, "pdf"); + OpenFilex.open(path); + } catch (ex) { + AppToast.showErrorToast(message: "Cannot open file."); + } + }, + textColor: Colors.white, + ), + ), + ], ), - itemCount: 1, ), ), ); } + Future _createFileFromString(String encodedStr, String ext) async { + Uint8List bytes = base64.decode(encodedStr); + String dir = (await getApplicationDocumentsDirectory()).path; + File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext); + await file.writeAsBytes(bytes); + return file.path; + } + String getSpecialResults(LabsViewModel model) { String labResults = ""; model.patientLabSpecialResult.forEach((element) { diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 3d977a96..479b5fe6 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -1,9 +1,15 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/admission_status_for_sick_leave.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart'; +import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/patient_sick_leave_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/sickleave_workplace_update_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -110,20 +116,61 @@ class _PatientSickLeavePageState extends State { ); } - void openWorkPlaceUpdatePage(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { + Future openWorkPlaceUpdatePage(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) async { + if (model.sickLeaveList[index].admissionNo != 0 && model.sickLeaveList[index].admissionNo != null) { + getSickLeaveStatusByAdmissionNo(requestNumber, setupID, model, index, projectID); + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + } + + void getSickLeaveStatusByAdmissionNo(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { + AdmissionStatusForSickLeave admissionStatusForSickLeave; + + LabsService service = new LabsService(); + GifLoaderDialogUtils.showMyDialog(context); + + service.getSickLeaveStatusByAdmissionNo(model.sickLeaveList[index].projectID, model.sickLeaveList[index].admissionNo).then((res) { + print(res); + GifLoaderDialogUtils.hideDialog(context); + if (res != null && res["List_GetSickLeaveStatusByAdmissionNo"] != null) { + if (res["List_GetSickLeaveStatusByAdmissionNo"].length != 0) { + admissionStatusForSickLeave = AdmissionStatusForSickLeave.fromJson(res["List_GetSickLeaveStatusByAdmissionNo"][0]); + if (admissionStatusForSickLeave.status != 6) { + AppToast.showErrorToast(message: TranslationBase.of(context).sickLeaveAdmittedPatient); + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void openWorkPlaceUpdatePageFunc(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { Navigator.push( - context, - FadePage( - page: WorkplaceUpdatePage( + context, + FadePage( + page: WorkplaceUpdatePage( requestNumber: requestNumber, setupID: setupID, projectID: projectID, - ))).then((value) { - print(value); - if (value != null && value == true) { - model.getSickLeave(); - showEmailDialog(model, index); - } - }); + ), + ), + ).then( + (value) { + print(value); + if (value != null && value == true) { + model.getSickLeave(); + showEmailDialog(model, index); + } + }, + ); } } diff --git a/lib/pages/medical/reports/inpatient_medical_reports_page.dart b/lib/pages/medical/reports/inpatient_medical_reports_page.dart new file mode 100644 index 00000000..4eb10085 --- /dev/null +++ b/lib/pages/medical/reports/inpatient_medical_reports_page.dart @@ -0,0 +1,132 @@ +import 'package:diplomaticquarterapp/core/model/reports/admission_for_medical_report.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class InPatientMedicalReports extends StatefulWidget { + final AdmissionMedicalReport admissionMedicalReport; + + InPatientMedicalReports({@required this.admissionMedicalReport}); + + @override + State createState() => _InPatientMedicalReportsState(); +} + +class _InPatientMedicalReportsState extends State { + int _currentPage = 0; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) { + model.getInPatientReports(); + }, + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).newMedReport, + title: TranslationBase.of(context).medReport, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), + body: Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(21), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + myRadioButton(TranslationBase.of(context).requested, 0), + myRadioButton(TranslationBase.of(context).ready, 1), + myRadioButton(TranslationBase.of(context).cancelled, 2), + ], + ), + ), + Expanded( + child: IndexedStack( + index: _currentPage, + children: [ + ReportListWidget(reportList: model.reportsInPatientOrderRequestList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsInPatientOrderReadyList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsInPatientOrderCanceledList, emailAddress: model.user.emailAddress), + ], + ), + ), + Padding( + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).requestMedicalReport.toLowerCase().capitalizeFirstofEach, + () { + confirmBox(model); + }, + ), + ), + ], + ), + ), + ), + ); + } + + void confirmBox(ReportsViewModel reportsViewModel) { + showDialog( + context: context, + builder: (cxt) => ConfirmWithMessageDialog( + message: TranslationBase.of(context).confirmMsgReport, + onTap: () => reportsViewModel.insertRequestForInPatientMedicalReport(widget.admissionMedicalReport.clinicID, widget.admissionMedicalReport.doctorID, widget.admissionMedicalReport.setupID, + widget.admissionMedicalReport.admissionNo, widget.admissionMedicalReport.projectID, TranslationBase.of(context).successSendReport), + ), + ); + return; + } + + Widget myRadioButton(String _label, int _value) { + return InkWell( + onTap: () { + setState(() { + _currentPage = _value; + }); + }, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: _value, + activeColor: _value == _currentPage ? Color(0xffD02127) : Color(0xffE8E8E8), + groupValue: _currentPage, + onChanged: (index) { + setState(() { + _currentPage = index; + }); + }, + ), + ), + SizedBox(width: 10), + Text( + _label, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 6e6d991a..911e74a0 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -1,14 +1,21 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/reports/admission_for_medical_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/inpatient_medical_reports_page.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -21,19 +28,20 @@ class HomeReportPage extends StatefulWidget { } class _HomeReportPageState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + TabController _tabController_new; List imagesInfo = List(); + int _currentPage = 0; @override void initState() { + _tabController_new = TabController(length: 2, vsync: this); super.initState(); - _tabController = TabController(length: 4, vsync: this); } @override void dispose() { super.dispose(); - _tabController.dispose(); + _tabController_new.dispose(); } @override @@ -46,7 +54,9 @@ class _HomeReportPageState extends State with SingleTickerProvid imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); return BaseView( - onModelReady: (model) => model.getReports(), //model.getPrescriptions(), + onModelReady: (model) { + model.getReports(); + }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).newMedReport, @@ -57,74 +67,245 @@ class _HomeReportPageState extends State with SingleTickerProvid showNewAppBarTitle: true, backgroundColor: Color(0xffF7F7F7), imagesInfo: imagesInfo, - body: Column( - children: [ - TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 3.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Color(0xff2B353E), - unselectedLabelColor: Color(0xff575757), - labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), - labelStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - unselectedLabelStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - tabs: [ - Text( - TranslationBase.of(context).requested, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - ), - Text( - TranslationBase.of(context).ready, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - ), - Text( - TranslationBase.of(context).completed, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + body: Container( + child: Column( + children: [ + TabBar( + controller: _tabController_new, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - Text( - TranslationBase.of(context).cancelled, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - ), - ], - ), - if (model.user != null) - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - ReportListWidget(reportList: model.reportsOrderRequestList, emailAddress: model.user.emailAddress), - ReportListWidget(reportList: model.reportsOrderReadyList, emailAddress: model.user.emailAddress), - ReportListWidget(reportList: model.reportsOrderCompletedList, emailAddress: model.user.emailAddress), - ReportListWidget(reportList: model.reportsOrderCanceledList, emailAddress: model.user.emailAddress), - ], + unselectedLabelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), + onTap: (int value) { + print(value); + setState(() {}); + }, + tabs: [ + Text( + TranslationBase.of(context).outpatient, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + ), + Text( + TranslationBase.of(context).inPatient, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + ), + ], ), - if (projectViewModel.havePrivilege(21)) - Padding( - padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: DefaultButton( - TranslationBase.of(context).requestMedicalReport.toLowerCase().capitalizeFirstofEach, - () => Navigator.push( - context, - FadePage( - page: MedicalReports(), - ), + if (model.user != null) + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController_new, + children: [ + Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(21), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + myRadioButton(TranslationBase.of(context).requested, 0), + myRadioButton(TranslationBase.of(context).ready, 1), + myRadioButton(TranslationBase.of(context).cancelled, 2), + ], + ), + ), + Expanded( + child: IndexedStack( + index: _currentPage, + children: [ + ReportListWidget(reportList: model.reportsOrderRequestList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsOrderReadyList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsOrderCanceledList, emailAddress: model.user.emailAddress), + ], + ), + ) + ], + ), + ), + // InPatient Medical Reports + Container( + child: model.admissionsMedicalReportList.isNotEmpty + ? Column( + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: Text( + TranslationBase.of(context).selectAdmissionText, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + ListView.separated( + physics: BouncingScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.only(left: 21, right: 21, top: 12, bottom: 12), + itemBuilder: (context, index) { + AdmissionMedicalReport admissionMedicalReport = model.admissionsMedicalReportList[index]; + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: InPatientMedicalReports( + admissionMedicalReport: admissionMedicalReport, + ))); + }, + child: Container( + // height: 100.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dr + " " + admissionMedicalReport.doctorNameObj, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(admissionMedicalReport.admissionDate)), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + Text(admissionMedicalReport.projectName, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + ], + ), + ], + ), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (admissionMedicalReport.clinicName != null) + MyRichText(TranslationBase.of(context).clinic + ":", admissionMedicalReport.clinicName, projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + MyRichText( + TranslationBase.of(context).status + ":", + projectViewModel.isArabic ? admissionMedicalReport.statusDescriptionN : admissionMedicalReport.statusDescription, + projectViewModel.isArabic), + Icon( + Icons.arrow_forward, + color: Theme.of(context).primaryColor, + ) + ], + ), + ], + ), + ), + ], + ) + ], + ), + ), + ), + ); + }, + separatorBuilder: (context, index) => SizedBox( + height: 16.0, + ), + itemCount: model.admissionsMedicalReportList.length), + ], + ) + : getNoDataWidget(context), + ) + ], ), ), + if (projectViewModel.havePrivilege(21) + // && _tabController_new.index == 0 ) - ], + if (_tabController_new.index == 0) + Padding( + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).requestMedicalReport.toLowerCase().capitalizeFirstofEach, + () => Navigator.push( + context, + FadePage( + page: MedicalReports(), + ), + ).then((value) { + model.getReports(); + }), + ), + ) + ], + ), ), ), ); } + + Widget myRadioButton(String _label, int _value) { + return InkWell( + onTap: () { + setState(() { + _currentPage = _value; + }); + }, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: _value, + activeColor: _value == _currentPage ? Color(0xffD02127) : Color(0xffE8E8E8), + groupValue: _currentPage, + onChanged: (index) { + setState(() { + _currentPage = index; + }); + }, + ), + ), + SizedBox(width: 10), + Text( + _label, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ], + ), + ); + } } diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index cc76214b..adaef00e 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -1,8 +1,13 @@ +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/reports/Reports.dart'; import 'package:diplomaticquarterapp/core/service/medical/reports_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -13,6 +18,8 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.d import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:open_filex/open_filex.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -55,9 +62,24 @@ class ReportListWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ if (report.doctorName != null) - Text( - report.doctorName, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + report.doctorName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(DateUtil.getDayMonthYearDateFormatted(report.requestDate), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + Text(DateUtil.formatDateToTimeLang(report.requestDate, projectViewModel.isArabic), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + ], + ), + ], ), if (report.doctorName != null) SizedBox(height: 6), Row( @@ -75,8 +97,8 @@ class ReportListWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - if (report.projectName != null) MyRichText(TranslationBase.of(context).clinic + ":", report.projectName, projectViewModel.isArabic), - if (report.clinicDescription != null) MyRichText(TranslationBase.of(context).hospital + ":", report.clinicDescription, projectViewModel.isArabic), + if (report.projectName != null) MyRichText(TranslationBase.of(context).hospital + ":", report.projectName, projectViewModel.isArabic), + if (report.clinicDescription != null) MyRichText(TranslationBase.of(context).clinic + ":", report.clinicDescription, projectViewModel.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, @@ -93,14 +115,35 @@ class ReportListWidget extends StatelessWidget { emptyIcon: Icons.star_border, ), if (reportList[index].status == 2) - IconButton( - icon: Icon(Icons.email), - color: Color(0xff28323A), - constraints: BoxConstraints(), - padding: EdgeInsets.zero, - onPressed: () { - showConfirmMessage(reportList[index]); - }) + Row( + children: [ + InkWell( + onTap: () { + getMedicalReportPDF(report); + }, + child: Padding( + padding: const EdgeInsets.only(right: 11.0, left: 11.0), + child: Text(TranslationBase.of(context).viewReport, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + fontStyle: FontStyle.italic, + color: CustomColors.accentColor, + letterSpacing: -0.48, + height: 18 / 12, + decoration: TextDecoration.underline)), + ), + ), + IconButton( + icon: Icon(Icons.email), + color: Color(0xff28323A), + constraints: BoxConstraints(), + padding: EdgeInsets.zero, + onPressed: () { + showConfirmMessage(reportList[index]); + }) + ], + ), ], ), ], @@ -130,6 +173,26 @@ class ReportListWidget extends StatelessWidget { ); } + void getMedicalReportPDF(Reports report) { + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); + ReportsService _reportsService = locator(); + _reportsService + .getMedicalReportPDF(report.projectName, report.clinicDescription, report.doctorName, DateUtil.convertDateToString(report.requestDate), report.invoiceNo.toString(), report.projectID, + DateUtil.convertDateToString(report.requestDate), report.setupId) + .then((value) async { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + try { + String path = await _createFileFromString(value["MedicalReportBase64"], "pdf"); + OpenFilex.open(path); + } catch (ex) { + AppToast.showErrorToast(message: "Cannot open file."); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + print(err); + }); + } + sendReportEmail(Reports report) { GifLoaderDialogUtils.showMyDialog(AppGlobal.context); ReportsService _reportsService = locator(); @@ -144,4 +207,12 @@ class ReportListWidget extends StatelessWidget { print(err); }); } + + Future _createFileFromString(String encodedStr, String ext) async { + Uint8List bytes = base64.decode(encodedStr); + String dir = (await getApplicationDocumentsDirectory()).path; + File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext); + await file.writeAsBytes(bytes); + return file.path; + } } diff --git a/lib/pages/medical/reports/reports_page.dart b/lib/pages/medical/reports/reports_page.dart index bdd638e5..0dfa2ac9 100644 --- a/lib/pages/medical/reports/reports_page.dart +++ b/lib/pages/medical/reports/reports_page.dart @@ -24,7 +24,9 @@ class MedicalReports extends StatelessWidget { message: TranslationBase.of(context).confirmMsgReport, onTap: () => reportsViewModel.insertRequestForMedicalReport(model, TranslationBase.of(context).successSendReport), ), - ); + ).then((value) { + Navigator.pop(context); + }); return; } diff --git a/lib/pages/medical/sickleave_workplace_update_page.dart b/lib/pages/medical/sickleave_workplace_update_page.dart index 3b4a1f1b..60d9ef54 100644 --- a/lib/pages/medical/sickleave_workplace_update_page.dart +++ b/lib/pages/medical/sickleave_workplace_update_page.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; @@ -143,6 +144,9 @@ class _WorkplaceUpdatePageState extends State { scrollPadding: EdgeInsets.zero, keyboardType: TextInputType.name, controller: _controller, + inputFormatters: [ + projectViewModel.isArabic ? FilteringTextInputFormatter.allow(RegExp("[ء-ي ]")) : FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]")), + ], onChanged: (value) => {_onPassportTextChanged(value)}, style: TextStyle( fontSize: 14, diff --git a/lib/pages/webRTC/call_page.dart b/lib/pages/webRTC/call_page.dart index e75b2f8e..b9f444d1 100644 --- a/lib/pages/webRTC/call_page.dart +++ b/lib/pages/webRTC/call_page.dart @@ -1,164 +1,164 @@ -import 'dart:io'; - -import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; -import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:firebase_messaging/firebase_messaging.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; - -class CallPage extends StatefulWidget { - @override - _CallPageState createState() => _CallPageState(); -} - -class _CallPageState extends State { - // Signaling signaling = Signaling(); - RTCVideoRenderer _localRenderer = RTCVideoRenderer(); - RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); - String roomId; - TextEditingController textEditingController = TextEditingController(text: ''); - - @override - void initState() { - _localRenderer.initialize(); - _remoteRenderer.initialize(); - - // signaling.onRemoteStream = ((stream) { - // _remoteRenderer.srcObject = stream; - // setState(() {}); - // }); - - fcmConfigure(); - - super.initState(); - } - - @override - void dispose() { - _localRenderer.dispose(); - _remoteRenderer.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - FirebaseMessaging.instance.getToken().then((value) { - print('FCM_TOKEN: $value'); - }); - - return AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - isShowDecPage: false, - appBarTitle: "WebRTC Calling", - body: Column( - children: [ - SizedBox(height: 8), - Wrap( - children: [ - SizedBox( - width: 8, - ), - ElevatedButton( - onPressed: () { - dummyCall(); - }, - child: Text("Call"), - ), - SizedBox( - width: 8, - ), - ElevatedButton( - onPressed: () { - // signaling.hangUp(_localRenderer); - }, - child: Text("Hangup"), - ) - ], - ), - SizedBox(height: 8), - Expanded( - child: Padding( - padding: const EdgeInsets.all(0.0), - child: Stack( - children: [ - Positioned(top: 0.0, right: 0.0, left: 0.0, bottom: 0.0, child: RTCVideoView(_remoteRenderer)), - Positioned( - top: 20.0, - right: 100.0, - left: 20.0, - bottom: 300.0, - child: RTCVideoView(_localRenderer, mirror: true), - ), - ], - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("Join the following Room: "), - Flexible( - child: TextFormField( - controller: textEditingController, - ), - ) - ], - ), - ), - SizedBox(height: 8) - ], - ), - ); - } - - dummyCall() async { - final json = { - "callerID": "9920", - "receiverID": "2001273", - "msgID": "123", - "notfID": "123", - "notification_foreground": "true", - "count": "1", - "message": "Doctor is calling ", - "AppointmentNo": "123", - "title": "Rayyan Hospital", - "ProjectID": "123", - "NotificationType": "10", - "background": "1", - "doctorname": "Dr Sulaiman Al Habib", - "clinicname": "ENT Clinic", - "speciality": "Speciality", - "appointmentdate": "Sun, 15th Dec, 2019", - "appointmenttime": "09:00", - "type": "video", - "session_id": - "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", - "identity": "Haroon1", - "name": "SmallDailyStandup", - "videoUrl": "video", - "picture": "video", - "is_call": "true" - }; - - IncomingCallData incomingCallData = IncomingCallData.fromJson(json); - final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); - } - - fcmConfigure() { - FirebaseMessaging.onMessage.listen((RemoteMessage message) async { - print(message.toString()); - - IncomingCallData incomingCallData; - if (Platform.isAndroid) - incomingCallData = IncomingCallData.fromJson(message.data['data']); - else if (Platform.isIOS) incomingCallData = IncomingCallData.fromJson(message.data); - if (incomingCallData != null) final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); - }); - } -} +// import 'dart:io'; +// +// import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; +// import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; +// import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +// import 'package:firebase_messaging/firebase_messaging.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// class CallPage extends StatefulWidget { +// @override +// _CallPageState createState() => _CallPageState(); +// } +// +// class _CallPageState extends State { +// Signaling signaling = Signaling(); +// RTCVideoRenderer _localRenderer = RTCVideoRenderer(); +// RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); +// String roomId; +// TextEditingController textEditingController = TextEditingController(text: ''); +// +// @override +// void initState() { +// _localRenderer.initialize(); +// _remoteRenderer.initialize(); +// +// // signaling.onRemoteStream = ((stream) { +// // _remoteRenderer.srcObject = stream; +// // setState(() {}); +// // }); +// +// fcmConfigure(); +// +// super.initState(); +// } +// +// @override +// void dispose() { +// _localRenderer.dispose(); +// _remoteRenderer.dispose(); +// super.dispose(); +// } +// +// @override +// Widget build(BuildContext context) { +// FirebaseMessaging.instance.getToken().then((value) { +// print('FCM_TOKEN: $value'); +// }); +// +// return AppScaffold( +// isShowAppBar: true, +// showNewAppBar: true, +// showNewAppBarTitle: true, +// isShowDecPage: false, +// appBarTitle: "WebRTC Calling", +// body: Column( +// children: [ +// SizedBox(height: 8), +// Wrap( +// children: [ +// SizedBox( +// width: 8, +// ), +// ElevatedButton( +// onPressed: () { +// dummyCall(); +// }, +// child: Text("Call"), +// ), +// SizedBox( +// width: 8, +// ), +// ElevatedButton( +// onPressed: () { +// signaling.hangUp(_localRenderer); +// }, +// child: Text("Hangup"), +// ) +// ], +// ), +// SizedBox(height: 8), +// Expanded( +// child: Padding( +// padding: const EdgeInsets.all(0.0), +// child: Stack( +// children: [ +// Positioned(top: 0.0, right: 0.0, left: 0.0, bottom: 0.0, child: RTCVideoView(_remoteRenderer)), +// Positioned( +// top: 20.0, +// right: 100.0, +// left: 20.0, +// bottom: 300.0, +// child: RTCVideoView(_localRenderer, mirror: true), +// ), +// ], +// ), +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Text("Join the following Room: "), +// Flexible( +// child: TextFormField( +// controller: textEditingController, +// ), +// ) +// ], +// ), +// ), +// SizedBox(height: 8) +// ], +// ), +// ); +// } +// +// dummyCall() async { +// final json = { +// "callerID": "9920", +// "receiverID": "2001273", +// "msgID": "123", +// "notfID": "123", +// "notification_foreground": "true", +// "count": "1", +// "message": "Doctor is calling ", +// "AppointmentNo": "123", +// "title": "Rayyan Hospital", +// "ProjectID": "123", +// "NotificationType": "10", +// "background": "1", +// "doctorname": "Dr Sulaiman Al Habib", +// "clinicname": "ENT Clinic", +// "speciality": "Speciality", +// "appointmentdate": "Sun, 15th Dec, 2019", +// "appointmenttime": "09:00", +// "type": "video", +// "session_id": +// "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", +// "identity": "Haroon1", +// "name": "SmallDailyStandup", +// "videoUrl": "video", +// "picture": "video", +// "is_call": "true" +// }; +// +// IncomingCallData incomingCallData = IncomingCallData.fromJson(json); +// final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); +// } +// +// fcmConfigure() { +// FirebaseMessaging.onMessage.listen((RemoteMessage message) async { +// print(message.toString()); +// +// IncomingCallData incomingCallData; +// if (Platform.isAndroid) +// incomingCallData = IncomingCallData.fromJson(message.data['data']); +// else if (Platform.isIOS) incomingCallData = IncomingCallData.fromJson(message.data); +// if (incomingCallData != null) final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); +// }); +// } +// } diff --git a/lib/pages/webRTC/signaling.dart b/lib/pages/webRTC/signaling.dart index 53966bdc..028de903 100644 --- a/lib/pages/webRTC/signaling.dart +++ b/lib/pages/webRTC/signaling.dart @@ -91,7 +91,7 @@ // if (signalR != null) await signalR.closeConnection(); // // https://vcallapi.hmg.com/webRTCHub?source=web&username=zohaib // // signalR = SignalRUtil(hubName: "https://vcallapi.hmg.com/webRTCHub?source=mobile&username=$userName"); -// // signalR = SignalRUtil(hubName: "http://35.193.237.29/webRTCHub?source=mobile&username=$userName"); +// signalR = SignalRUtil(hubName: "http://35.193.237.29/webRTCHub?source=mobile&username=$userName"); // final connected = await signalR.openConnection(); // if (!connected) throw 'Failed to connect SignalR'; // } @@ -125,7 +125,7 @@ // ] // }; // -// // SignalRUtil signalR; +// SignalRUtil signalR; // // RTCPeerConnection peerConnection; // MediaStream localStream; diff --git a/lib/routes.dart b/lib/routes.dart index fe620bbd..7df15030 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -82,7 +82,7 @@ var routes = { APP_UPDATE: (_) => AppUpdatePage(), SETTINGS: (_) => Settings(), CART_ORDER_PAGE: (_) => CartOrderPage(), - CALL_PAGE: (_) => CallPage(), + // CALL_PAGE: (_) => CallPage(), INCOMING_CALL_PAGE: (_) => IncomingCall(), OPENTOK_CALL_PAGE: (_) => OpenTokConnectCallPage( apiKey: OPENTOK_API_KEY, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 62097fb1..0a293818 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -485,7 +485,7 @@ class DoctorsListService extends BaseService { dynamic localRes; await baseAppClient.post(GET_PATIENT_SHARE, onSuccess: (response, statusCode) async { - localRes = response['OnlineCheckInAppointments'][0]; + localRes = response; }, onFailure: (String error, int statusCode) { throw error; }, body: request); @@ -1623,11 +1623,12 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getLaserBodyPartsList(int laserCategoryID) async { + Future getLaserBodyPartsList(int laserCategoryID, int projectID) async { Map request; request = { "LaserCategoryID": laserCategoryID, + "ProjectID": projectID, }; dynamic localRes; await baseAppClient.post(LASER_BODY_PARTS, onSuccess: (response, statusCode) async { @@ -1768,6 +1769,45 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future checkPatientNphiesEligibility(int projectID) async { + Map request; + request = {"ProjectID": projectID}; + dynamic localRes; + await baseAppClient.post(CHECK_PATIENT_NPHIES_ELIGIBILITY, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + + return Future.value(localRes); + } + + Future convertPatientToCash(int projectID) async { + Map request; + request = {"ProjectID": projectID}; + dynamic localRes; + await baseAppClient.post(CONVERT_PATIENT_TO_CASH, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + + return Future.value(localRes); + } + + Future getPayfortSDKTokenForPayment(String deviceID, String signatureValue, {bool isTest = true}) async { + Map request; + request = {"service_command": "SDK_TOKEN", "access_code": "BsM6He4FMBaZ86W64kjZ", "merchant_identifier": "ipxnRXXq", "language": "en", "device_id": deviceID, "signature": signatureValue}; + dynamic localRes; + await baseAppClient.post(isTest ? PAYFORT_TEST_URL : PAYFORT_PROD_URL, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isExternal: true, isAllowAny: true); + + return Future.value(localRes); + } + Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel projectViewModel]) async { Map requestFreeSlots; Map request; @@ -1803,4 +1843,6 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + + } diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index a784d161..2a18c79c 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -281,15 +281,12 @@ class LiveCareService extends BaseService { Future sendLiveCareInvoiceEmail(String appoNo, int projectID, String emailAddress, BuildContext context) async { Map request; - if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } request = {"To": emailAddress, "ProjectID": projectID, "AppointmentNo": appoNo}; - dynamic localRes; - await baseAppClient.post(SEND_LIVECARE_INVOICE_EMAIL, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index c6e1685d..d7afaa90 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -28,11 +28,55 @@ class LocalNotification { } } - _initialize() { - var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); - // var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null); - // var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); - // flutterLocalNotificationsPlugin.initialize(initializationSettings, onSelectNotification: _onNotificationClick); + _initialize() async { + try { + var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); + var initializationSettingsIOS = DarwinInitializationSettings(onDidReceiveLocalNotification: null); + var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); + await flutterLocalNotificationsPlugin.initialize( + initializationSettings, + onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { + switch (notificationResponse.notificationResponseType) { + case NotificationResponseType.selectedNotification: + // selectNotificationStream.add(notificationResponse.payload); + break; + case NotificationResponseType.selectedNotificationAction: + // if (notificationResponse.actionId == navigationActionId) { + // selectNotificationStream.add(notificationResponse.payload); + // } + break; + } + }, + onDidReceiveBackgroundNotificationResponse: notificationTapBackground, + ); + } catch (ex) {} + // flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) + // { + // switch (notificationResponse.notificationResponseType) { + // case NotificationResponseType.selectedNotification: + // // selectNotificationStream.add(notificationResponse.payload); + // break; + // case NotificationResponseType.selectedNotificationAction: + // // if (notificationResponse.actionId == navigationActionId) { + // // selectNotificationStream.add(notificationResponse.payload); + // } + // // break; + // },} + // + // , + // + // ); + } + + void notificationTapBackground(NotificationResponse notificationResponse) { + // ignore: avoid_print + print('notification(${notificationResponse.id}) action tapped: ' + '${notificationResponse.actionId} with' + ' payload: ${notificationResponse.payload}'); + if (notificationResponse.input?.isNotEmpty ?? false) { + // ignore: avoid_print + print('notification action tapped with input: ${notificationResponse.input}'); + } } var _random = new Random(); @@ -55,11 +99,11 @@ class LocalNotification { Future.delayed(Duration(seconds: 1)).then((result) async { var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern()); - // var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { - // print(err); - // }); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { + print(err); + }); }); } @@ -84,18 +128,18 @@ class LocalNotification { ledColor: const Color.fromARGB(255, 255, 0, 0), ledOnMs: 1000, ledOffMs: 500); - // var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(sound: 'slow_spring_board.aiff'); // /change it to be as ionic - // var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); } ///Repeat notification every day at approximately 10:00:00 am Future showDailyAtTime() async { var time = Time(10, 0, 0); var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); - // var iOSPlatformChannelSpecifics = IOSNotificationDetails(); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); // await flutterLocalNotificationsPlugin.showDailyAtTime( @@ -110,7 +154,7 @@ class LocalNotification { Future showWeeklyAtDayAndTime() async { var time = Time(10, 0, 0); var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); - // var iOSPlatformChannelSpecifics = IOSNotificationDetails(); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( diff --git a/lib/uitl/SignalRUtil.dart b/lib/uitl/SignalRUtil.dart index 904155a2..de90981f 100644 --- a/lib/uitl/SignalRUtil.dart +++ b/lib/uitl/SignalRUtil.dart @@ -4,7 +4,7 @@ // import 'package:flutter/cupertino.dart'; // import 'package:flutter_webrtc/flutter_webrtc.dart'; // import 'package:http/io_client.dart'; -// // import 'package:signalr_core/signalr_core.dart'; +// import 'package:signalr_core/signalr_core.dart'; // // class SignalRUtil { // String hubName; @@ -20,7 +20,7 @@ // SignalRUtil({@required this.hubName}); // // -// // HubConnection connectionHub; +// HubConnection connectionHub; // // closeConnection() async{ // if(connectionHub != null) { @@ -35,14 +35,14 @@ // } // // Future openConnection() async { -// // connectionHub = HubConnectionBuilder() -// // .withUrl( -// // hubName, -// // HttpConnectionOptions( -// // logMessageContent: true, -// // client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), -// // logging: (level, message) => print(message), -// // )).build(); +// connectionHub = HubConnectionBuilder() +// .withUrl( +// hubName, +// HttpConnectionOptions( +// logMessageContent: true, +// client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), +// logging: (level, message) => print(message), +// )).build(); // // await connectionHub.start(); // await Future.delayed(Duration(seconds: 1)); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index dabe80ab..804cecdd 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1071,6 +1071,8 @@ class TranslationBase { String get sar => localizedValues['sar'][locale.languageCode]; + String get aed => localizedValues['aed'][locale.languageCode]; + String get payOnline => localizedValues['payOnline'][locale.languageCode]; String get cancelOrder => localizedValues['cancelOrder'][locale.languageCode]; @@ -2891,6 +2893,21 @@ class TranslationBase { String get pharmaLiveCareMakePayment1 => localizedValues["pharmaLiveCareMakePayment1"][locale.languageCode]; String get pharmaLiveCareJoinConsultation => localizedValues["pharmaLiveCareJoinConsultation"][locale.languageCode]; String get pharmaLiveCareJoinConsultation1 => localizedValues["pharmaLiveCareJoinConsultation1"][locale.languageCode]; + String get emergencyServicesSubtitle => localizedValues["emergencyServicesSubtitle"][locale.languageCode]; + String get rateDoctorResponse => localizedValues["rateDoctorResponse"][locale.languageCode]; + String get comments => localizedValues["comments"][locale.languageCode]; + String get rateDoctorResponseHeading => localizedValues["rateDoctorResponseHeading"][locale.languageCode]; + String get updateInsuranceManuallyDialog => localizedValues["updateInsuranceManuallyDialog"][locale.languageCode]; + String get viewReport => localizedValues["viewReport"][locale.languageCode]; + String get sickLeaveAdmittedPatient => localizedValues["sickLeaveAdmittedPatient"][locale.languageCode]; + String get dischargeDate => localizedValues["dischargeDate"][locale.languageCode]; + String get selectAdmissionText => localizedValues["selectAdmissionText"][locale.languageCode]; + String get invalidEligibility => localizedValues["invalidEligibility"][locale.languageCode]; + String get invalidInsurance => localizedValues["invalidInsurance"][locale.languageCode]; + String get continueCash => localizedValues["continueCash"][locale.languageCode]; + String get updateInsuranceText => localizedValues["updateInsurance"][locale.languageCode]; + String get downloadReport => localizedValues["downloadReport"][locale.languageCode]; + String get habibCallCenter => localizedValues["habibCallCenter"][locale.languageCode]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 1621002c..75b11879 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -819,6 +819,11 @@ class Utils { }); return isVidaPlus; } + + static String generateSignature() { + + } + } Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) { diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart index b677fb3e..4892d09f 100644 --- a/lib/widgets/dialogs/confirm_dialog.dart +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -14,8 +14,9 @@ class ConfirmDialog { final cancelText; final Function okFunction; final Function cancelFunction; + final isDissmissable; - ConfirmDialog({@required this.context, this.title, @required this.confirmMessage, @required this.okText, @required this.cancelText, @required this.okFunction, @required this.cancelFunction}); + ConfirmDialog({@required this.context, this.title, @required this.confirmMessage, @required this.okText, @required this.cancelText, @required this.okFunction, @required this.cancelFunction, this.isDissmissable = true}); showAlertDialog(BuildContext context) { Dialog alert = Dialog( @@ -35,6 +36,7 @@ class ConfirmDialog { // show the dialog showDialog( + barrierDismissible: isDissmissable, context: context, builder: (BuildContext context) { return alert; @@ -99,7 +101,7 @@ class Mdialog extends StatelessWidget { child: Container( decoration: containerRadius(CustomColors.lightGreyColor, 12), padding: EdgeInsets.only(top: 8,bottom: 8), - child: Center(child: Texts(cancelText)), + child: Center(child: Texts(cancelText, variant: "caption3")), ), ), ), @@ -114,6 +116,7 @@ class Mdialog extends StatelessWidget { child: Texts( okText, color: Colors.white, + variant: "caption3", ), ), ), diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index ffce6c29..dc460009 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -14,8 +14,9 @@ class RadioSelectionDialog extends StatefulWidget { final List listData; final int selectedIndex; final bool isScrollable; + final bool isShowSearch; - const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false}) : super(key: key); + const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false, this.isShowSearch = false}) : super(key: key); @override State createState() => new RadioSelectionDialogState(); @@ -24,10 +25,22 @@ class RadioSelectionDialog extends StatefulWidget { class RadioSelectionDialogState extends State { int selectedIndex; + List tempListData = []; + TextEditingController controller = new TextEditingController(); + @override void initState() { selectedIndex = widget.selectedIndex ?? 0; super.initState(); + addAllData(); + } + + addAllData() { + tempListData.clear(); + for (int i = 0; i < widget.listData.length; i++) { + tempListData.add(widget.listData[i]); + } + setState(() {}); } Widget build(BuildContext context) { @@ -37,100 +50,131 @@ class RadioSelectionDialogState extends State { insetPadding: EdgeInsets.only(left: 21, right: 21), child: Padding( padding: EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.only(top: 16.0), - child: Text( - TranslationBase.of(context).select, - style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(top: 16.0), + child: Text( + TranslationBase.of(context).select, + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), + ), ), ), - ), - IconButton( - padding: EdgeInsets.zero, - icon: Icon(Icons.close), - color: Color(0xff2B353E), - constraints: BoxConstraints(), - onPressed: () { - Navigator.pop(context); - }, - ) - ], - ), - SizedBox(height: 21), - Text( - TranslationBase.of(context).pleaseSelectFromBelowOptions, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), - ), - SizedBox(height: widget.isScrollable ? 12 : 0), - SizedBox( - height: widget.isScrollable ? MediaQuery.of(context).size.height * .4 : null, - child: ListView.separated( - physics: widget.isScrollable ? BouncingScrollPhysics() : NeverScrollableScrollPhysics(), - shrinkWrap: !widget.isScrollable, - padding: EdgeInsets.only(bottom: widget.isScrollable ? 21 : 42, top: 10), - itemBuilder: (context, index) { - return InkWell( - onTap: () { - setState(() { - selectedIndex = widget.listData[index].value; - }); - }, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width: 22, - height: 22, - child: Radio( - value: widget.listData[index].value, - groupValue: selectedIndex, - onChanged: (value) { - setState(() { - selectedIndex = value; - }); - }, + IconButton( + padding: EdgeInsets.zero, + icon: Icon(Icons.close), + color: Color(0xff2B353E), + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + ), + SizedBox(height: 21), + Text( + TranslationBase.of(context).pleaseSelectFromBelowOptions, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + widget.isShowSearch + ? Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + controller: controller, + onChanged: (v) { + if (v.length > 0) { + tempListData.clear(); + for (int i = 0; i < widget.listData.length; i++) { + if (widget.listData[i].title.toLowerCase().contains(v.toLowerCase())) { + tempListData.add(widget.listData[i]); + } + } + } else { + addAllData(); + } + setState(() {}); + }, + decoration: InputDecoration( + hintStyle: TextStyle(fontSize: 17), + hintText: 'Search Insurance', + suffixIcon: Icon(Icons.search), + border: InputBorder.none, + contentPadding: EdgeInsets.all(12), + ), + ), + ) + : Container(), + SizedBox(height: widget.isScrollable ? 12 : 0), + SizedBox( + height: widget.isScrollable ? MediaQuery.of(context).size.height * .4 : null, + child: ListView.separated( + physics: widget.isScrollable ? BouncingScrollPhysics() : NeverScrollableScrollPhysics(), + // shrinkWrap: !widget.isScrollable, + shrinkWrap: !widget.isScrollable, + padding: EdgeInsets.only(bottom: widget.isScrollable ? 21 : 42, top: 10), + itemBuilder: (context, index) { + return InkWell( + onTap: () { + setState(() { + selectedIndex = tempListData[index].value; + }); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: tempListData[index].value, + groupValue: selectedIndex, + onChanged: (value) { + setState(() { + selectedIndex = value; + }); + }, + ), ), - ), - SizedBox(width: 8), - Expanded( - child: Text( - widget.listData[index].title, - // maxLines: 2, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), + SizedBox(width: 8), + Expanded( + child: Text( + tempListData[index].title, + // maxLines: 2, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), + ), ), - ), - ], - ), - ); - }, - separatorBuilder: (context, index) => SizedBox(height: 10), - itemCount: widget.listData.length), - ), - SizedBox(height: widget.isScrollable ? 12 : 0), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).save, - () { - Navigator.pop(context); - widget.onValueSelected(selectedIndex); + ], + ), + ); }, - color: Color(0xff349745), + separatorBuilder: (context, index) => SizedBox(height: 10), + itemCount: tempListData.length), + ), + SizedBox(height: widget.isScrollable ? 12 : 0), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).save, + () { + Navigator.pop(context); + widget.onValueSelected(selectedIndex); + }, + color: Color(0xff349745), + ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), ), ); diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index debf1656..e71a4266 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -20,6 +21,7 @@ import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; @@ -28,6 +30,7 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/HMGNetworkConnectivity.dart'; +import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -38,6 +41,14 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +// import 'package:flutter_amazonpaymentservices/environment_type.dart'; +// import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; + +// import 'package:flutter_amazonpaymentservices/environment_type.dart'; +// import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; + +// import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:in_app_review/in_app_review.dart'; import 'package:provider/provider.dart'; @@ -453,11 +464,22 @@ class _AppDrawerState extends State { ), mHeight(12), InkWell( - onTap: () { - Navigator.push(context, FadePage(page: CallPage())); - GifLoaderDialogUtils.showMyDialog(context); - HMGNetworkConnectivity(context).start(); - locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); + onTap: () async { + // var deviceId = await FlutterAmazonpaymentservices.getUDID; + // var signatureValue = "asD123@saereaccess_code=BsM6He4FMBaZ86W64kjZdevice_id=$deviceId" + "language=enmerchant_identifier=ipxnRXXqservice_command=SDK_TOKENasD123@saere"; + // var signatureValueSHA = signatureValue.toSha256; + // + // GifLoaderDialogUtils.showMyDialog(context); + // DoctorsListService service = new DoctorsListService(); + // service.getPayfortSDKTokenForPayment(deviceId, signatureValueSHA, isTest: true).then((res) { + // GifLoaderDialogUtils.hideDialog(context); + // print(res); + // startPaymentProcess(res['sdk_token']); + // }).catchError((err) { + // print(err); + // AppToast.showErrorToast(message: err); + // GifLoaderDialogUtils.hideDialog(context); + // }); }, child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -495,6 +517,34 @@ class _AppDrawerState extends State { )); } + startPaymentProcess(String sdkToken) async { + // Map requestParam = {}; + // requestParam = { + // "amount": "100", + // "command": "PURCHASE", + // "currency": "SAR", + // "order_description": "Advance Payment", + // "customer_email": projectProvider.user.emailAddress, + // "customer_name": projectProvider.user.firstName + " " + projectProvider.user.lastName, + // "phone_number": projectProvider.user.mobileNumber, + // "language": projectProvider.isArabic ? "ar" : "en", + // "merchant_reference": DateTime.now().millisecondsSinceEpoch.toString(), + // "sdk_token": sdkToken, + // }; + // try { + // await FlutterAmazonpaymentservices.normalPay(requestParam, EnvironmentType.sandbox, isShowResponsePage: false).then((value) { + // if (value["status"] == 14) { + // AppToast.showSuccessToast(message: "Payment has been successful"); + // } else { + // AppToast.showErrorToast(message: value['response_message']); + // } + // }); + // } on PlatformException catch (e) { + // AppToast.showErrorToast(message: e.message); + // return; + // } + } + readQRCode() async { pharmacyLiveCareQRCode = (await BarcodeScanner.scan())?.rawContent; print(pharmacyLiveCareQRCode); @@ -512,7 +562,13 @@ class _AppDrawerState extends State { startPharmacyLiveCareProcess() { sharedPref.setString(LIVECARE_CLINIC_DATA, "Pharmacy LiveCare" + "-" + "501" + "-" + "7"); - Navigator.push(context, FadePage(page: LiveCareHome(isPharmacyLiveCare: true, pharmacyLiveCareQRCode: pharmacyLiveCareQRCode,))); + Navigator.push( + context, + FadePage( + page: LiveCareHome( + isPharmacyLiveCare: true, + pharmacyLiveCareQRCode: pharmacyLiveCareQRCode, + ))); } drawerNavigator(context, routeName) { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index ba9d79ee..73069b22 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -24,9 +24,7 @@ enum _PAYMENT_TYPE { PACKAGES, PHARMACY, PATIENT } var _InAppBrowserOptions = InAppBrowserClassOptions( inAppWebViewGroupOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true, transparentBackground: false), - ios: IOSInAppWebViewOptions( - applePayAPIEnabled: true, - )), + ios: IOSInAppWebViewOptions(applePayAPIEnabled: true, isFraudulentWebsiteWarningEnabled: false)), crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black), android: AndroidInAppBrowserOptions(), ios: IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, closeButtonColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); @@ -127,17 +125,6 @@ class MyInAppBrowser extends InAppBrowser { this.deviceToken = deviceToken; } - // getPatientData() async { - // if (await this.sharedPref.getObject(USER_PROFILE) != null) { - // var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - // authUser = data; - // } - // if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { - // lat = await this.sharedPref.getDouble(USER_LAT); - // long = await this.sharedPref.getDouble(USER_LONG); - // } - // } - openPackagesPaymentBrowser({@required int customer_id, @required int order_id}) { paymentType = _PAYMENT_TYPE.PACKAGES; var full_url = '$PACKAGES_REQUEST_PAYMENT_URL?customer_id=$customer_id&order_id=$order_id'; @@ -190,7 +177,7 @@ class MyInAppBrowser extends InAppBrowser { service.applePayInsertRequest(applePayInsertRequest, context).then((res) { if (context != null) GifLoaderDialogUtils.hideDialog(context); String url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // Prod - // String url = "https://uat.hmgwebservices.com/HMGApplePayLiveNew/applepay/pay?apq=" + res['result']; // UAT + // String url = "https://uat.hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // UAT // safariBrowser.open(url: Uri.parse(url)); this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(url)), options: _InAppBrowserOptions); }).catchError((err) { diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 806cbb4a..549c182a 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -298,12 +298,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[0].patientNumber, Colors.green[700]), + getRatingLine(doctorDetailsList[0].ratio, Colors.green[700]), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(getRatingWidth(doctorDetailsList[0].patientNumber).round().toString() + "%", + child: Text(getRatingWidth(doctorDetailsList[0].ratio).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -319,12 +319,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[1].patientNumber, Color(0xffB7B723)), + getRatingLine(doctorDetailsList[1].ratio, Color(0xffB7B723)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(getRatingWidth(doctorDetailsList[1].patientNumber).round().toString() + "%", + child: Text(doctorDetailsList[1].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -340,12 +340,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[2].patientNumber, Color(0xffEBA727)), + getRatingLine(doctorDetailsList[2].ratio, Color(0xffEBA727)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(getRatingWidth(doctorDetailsList[2].patientNumber).round().toString() + "%", + child: Text(doctorDetailsList[2].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -361,12 +361,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[3].patientNumber, Color(0xffEB7227)), + getRatingLine(doctorDetailsList[3].ratio, Color(0xffEB7227)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(getRatingWidth(doctorDetailsList[3].patientNumber).round().toString() + "%", + child: Text(doctorDetailsList[3].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -383,12 +383,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[4].patientNumber, Color(0xffE20C0C)), + getRatingLine(doctorDetailsList[4].ratio, Color(0xffE20C0C)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(getRatingWidth(doctorDetailsList[4].patientNumber).round().toString() + "%", + child: Text(doctorDetailsList[4].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -410,12 +410,12 @@ class DoctorHeader extends StatelessWidget { pageBuilder: (context, animation1, animation2) {}); } - double getRatingWidth(int patientNumber) { - var width = (patientNumber / this.headerModel.totalReviews) * 100; + double getRatingWidth(double patientNumber) { + var width = patientNumber; return width.roundToDouble(); } - Widget getRatingLine(int patientNumber, Color color) { + Widget getRatingLine(double patientNumber, Color color) { return Container( margin: EdgeInsets.only(top: 10.0), child: Stack(children: [ @@ -427,7 +427,7 @@ class DoctorHeader extends StatelessWidget { ), ), SizedBox( - width: getRatingWidth(patientNumber) * 1.35, + width: patientNumber * 1.35, height: 4.0, child: Container( color: color, diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 5b2c995e..8e5c16b5 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -66,8 +66,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.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 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; +import 'package:speech_to_text/speech_to_text.dart'; import 'package:url_launcher/url_launcher.dart'; class FloatingSearchButton extends StatefulWidget { @@ -83,7 +84,8 @@ class _FloatingSearchButton extends State with TickerProvi RobotProvider eventProvider = RobotProvider(); bool isLoading = false; bool isError = false; - // stt.SpeechToText speech = stt.SpeechToText(); + stt.SpeechToText speech = stt.SpeechToText(); + FlutterTts tts = FlutterTts(); String error = ''; String _currentLocaleId = ""; String lastError; @@ -92,7 +94,6 @@ class _FloatingSearchButton extends State with TickerProvi double minSoundLevel = 50000; double maxSoundLevel = -50000; String reconizedWord = ''; - FlutterTts flutterTts = FlutterTts(); var selectedLang; bool isSearching = false; Map results = {}; @@ -113,7 +114,7 @@ class _FloatingSearchButton extends State with TickerProvi void initState() { controller = AnimationController(vsync: this, duration: Duration(seconds: 1)); offset = Tween(begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0)).animate(controller); - + startIosTts(); if (IS_VOICE_COMMAND_CLOSED == true) { controller.reverse(from: -1); } else { @@ -143,7 +144,7 @@ class _FloatingSearchButton extends State with TickerProvi if (p['startPopUp'] == 'true') { if (this.mounted) { new RoboSearch(context: context).showAlertDialog(context); - initSpeechState().then((value) => {startVoiceSearch()}); + // initSpeechState().then((value) => {startVoiceSearch()}); } } }); @@ -234,10 +235,19 @@ class _FloatingSearchButton extends State with TickerProvi ])); } - startVoiceSearch() async { - // bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); - // _currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + startIosTts() async{ + await tts.setSharedInstance(true); + await tts.setLanguage("en-US"); + tts.setIosAudioCategory( + IosTextToSpeechAudioCategory.playback, + [IosTextToSpeechAudioCategoryOptions.mixWithOthers], + IosTextToSpeechAudioMode.voicePrompt); + } + startVoiceSearch() async { + bool available = await speech.initialize(); + _currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + // // if (available) { // speech.listen( // onResult: resultListener, @@ -248,30 +258,37 @@ class _FloatingSearchButton extends State with TickerProvi // print("The user has denied the use of speech recognition."); // } // some time later... - //speech.stop(); - // speech.listen( - // onResult: resultListener, - // listenFor: Duration(seconds: 10), - // localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', - // onSoundLevelChange: soundLevelListener, - // cancelOnError: true, - // partialResults: true, - // onDevice: true, - // listenMode: ListenMode.deviceDefault); + if(available) { + speech.stop(); + speech.listen( + onResult: resultListener, + listenFor: Duration(seconds: 10), + localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', + onSoundLevelChange: soundLevelListener, + cancelOnError: true, + partialResults: true, + onDevice: true, + listenMode: ListenMode.deviceDefault); + } } void resultListener(result) { + _stopListening(); reconizedWord = result.recognizedWords; event.setValue({"searchText": reconizedWord}); if (result.finalResult == true) { Future.delayed(const Duration(seconds: 1), () { + _speak(reconizedWord); - RoboSearch.closeAlertDialog(context); + RoboSearch.closeAlertDialog(context); //Navigator.of(context).pop(); }); } } - + void _stopListening() async { + await speech.stop(); + // setState(() {}); + } Future _speak(reconizedWord) async { getPages(reconizedWord); } @@ -315,10 +332,10 @@ class _FloatingSearchButton extends State with TickerProvi // }); } - // void errorListener(SpeechRecognitionError error) { - // event.setValue({"searchText": 'null'}); - // RoboSearch.closeAlertDialog(context); - // } + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + RoboSearch.closeAlertDialog(context); + } void statusListener(String status) { //setState(() { @@ -807,7 +824,7 @@ class _FloatingSearchButton extends State with TickerProvi ); } - speak({isInit}) async { + speak({isInit =false}) async { //if (mounted) { setState(() { this.networkImage = results['AnimationURL']; @@ -817,12 +834,18 @@ class _FloatingSearchButton extends State with TickerProvi if (isInit == true) { event.setValue({"animationEnable": 'true'}); } + + // var voice = await tts.getVoice(); + // print(voice); if (isArabic == false && results['ReturnMessage'] != null && isInit == false) { - await flutterTts.setVoice({"name": "en-au-x-aub-network", "locale": "en-AU"}); - await flutterTts.speak(results['ReturnMessage']); + // await tts.synthesizeToFile("Hello World", Platform.isAndroid ? "tts.wav" : "tts.caf"); + + await tts.setVoice({"name": "Karen", "locale": "en-AU"}); + // await tts.setVoice({"name" : voice[35]["name"],"locale": voice[35]["locale"]}); + await tts.speak(results['ReturnMessage']); } else if (results['ReturnMessage_Ar'] != null && isInit == false) { - await flutterTts.setVoice({"name": "ar-xa-x-ard-network", "locale": "ar"}); - await flutterTts.speak(results['ReturnMessage_Ar']); + //await tts.setVoice({"name" : voice[0]["name"],"locale": voice[0]["locale"]}); + await tts.speak(results['ReturnMessage_Ar']); } stopAnimation(isInit: isInit); @@ -850,7 +873,7 @@ class _FloatingSearchButton extends State with TickerProvi } initialSpeak() async { - await flutterTts.awaitSpeakCompletion(true); + // await flutterTts.awaitSpeakCompletion(true); results = { 'ReturnMessage_Ar': "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي.", 'ReturnMessage': "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file." @@ -875,21 +898,21 @@ class _FloatingSearchButton extends State with TickerProvi }); }); } else { - flutterTts.setCompletionHandler(() async { - event.setValue({"animationEnable": 'false'}); - setState(() { - this.networkImage = null; - this.isAnimationEnable = false; - }); - }); + // tts.setCompletionHandler(() async { + // event.setValue({"animationEnable": 'false'}); + // setState(() { + // this.networkImage = null; + // this.isAnimationEnable = false; + // }); + // }); } - flutterTts.setCompletionHandler(() async { - event.setValue({"animationEnable": 'false'}); - setState(() { - this.networkImage = null; - this.isAnimationEnable = false; - }); - }); + // flutterTts.setCompletionHandler(() async { + // event.setValue({"animationEnable": 'false'}); + // setState(() { + // this.networkImage = null; + // this.isAnimationEnable = false; + // }); + // }); } signOut() async { diff --git a/pubspec.yaml b/pubspec.yaml index 834913a8..a711467e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.63+1 +version: 4.5.026+4050026 environment: sdk: ">=2.7.0 <3.0.0" @@ -15,7 +15,7 @@ dependencies: sdk: flutter intl: ^0.17.0 # web view -# webview_flutter: ^2.3.1 + # webview_flutter: ^2.3.1 # http client http: ^0.13.4 @@ -23,7 +23,7 @@ dependencies: async: ^2.8.1 audio_wave: ^0.1.4 -# audio_session: ^0.1.13 + # audio_session: ^0.1.13 # State Management provider: ^6.0.1 @@ -54,7 +54,7 @@ dependencies: maps_launcher: ^2.0.1 url_launcher: ^6.0.15 shared_preferences: ^2.0.0 -# flutter_flexible_toast: ^0.1.4 + # flutter_flexible_toast: ^0.1.4 fluttertoast: ^8.0.8 firebase_messaging: ^14.1.0 firebase_analytics: ^10.0.5 @@ -95,10 +95,10 @@ dependencies: # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 - flutter_polyline_points: ^1.0.0 + # flutter_polyline_points: ^1.0.0 location: ^4.3.0 # Qr code Scanner -# barcode_scan_fix: ^1.0.2 + # barcode_scan_fix: ^1.0.2 barcode_scan2: ^4.2.2 # Rating Stars @@ -108,7 +108,7 @@ dependencies: syncfusion_flutter_calendar: ^19.3.55 # SVG Images -# flutter_svg: ^0.23.0+1 + # flutter_svg: ^0.23.0+1 #Calendar Events manage_calendar_events: ^2.0.1 @@ -152,7 +152,7 @@ dependencies: #google maps places google_maps_place_picker_mb: ^3.0.0 -# google_maps_place_picker: ^2.1.0-nullsafety.3 + # google_maps_place_picker: ^2.1.0-nullsafety.3 map_launcher: ^1.1.3 #countdown timer for Upcoming List flutter_countdown_timer: ^4.1.0 @@ -161,10 +161,10 @@ dependencies: native_device_orientation: ^1.0.0 wakelock: ^0.5.6 after_layout: ^1.1.0 -# twilio_programmable_video: ^0.11.0+1 + # twilio_programmable_video: ^0.11.0+1 cached_network_image: ^3.1.0+1 -# flutter_tts: -# path: flutter_tts-voice_enhancement + # flutter_tts: + # path: flutter_tts-voice_enhancement flutter_tts: ^3.6.1 wifi: ^0.1.5 @@ -174,8 +174,8 @@ dependencies: geofencing: ^0.1.0 -# speech_to_text: ^6.1.1 -# path: speech_to_text + speech_to_text: ^6.1.1 + # path: speech_to_text in_app_update: ^3.0.0 @@ -183,7 +183,7 @@ dependencies: badges: ^2.0.1 flutter_app_icon_badge: ^2.0.0 - syncfusion_flutter_sliders: ^19.3.55 + # syncfusion_flutter_sliders: ^19.3.55 searchable_dropdown: ^1.1.3 dropdown_search: 0.4.9 youtube_player_flutter: ^8.0.0 @@ -191,29 +191,35 @@ dependencies: # Dep by Zohaib shimmer: ^2.0.0 carousel_slider: ^4.0.0 - flutter_material_pickers: ^3.1.2 + # flutter_material_pickers: ^3.1.2 flutter_staggered_grid_view: ^0.4.1 -# flutter_hms_gms_availability: ^2.0.0 + # flutter_hms_gms_availability: ^2.0.0 huawei_hmsavailability: ^6.6.0+300 huawei_location: 6.0.0+302 # Marker Animation - flutter_animarker: ^3.2.0 + # flutter_animarker: ^3.2.0 auto_size_text: ^3.0.0 equatable: ^2.0.3 - signalr_core: ^1.1.1 + # signalr_core: ^1.1.1 wave: ^0.2.0 -# sms_retriever: ^1.0.0 + # sms_retriever: ^1.0.0 sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 google_api_availability: ^3.0.1 -# flutter_callkit_incoming: ^1.0.3+3 -# firebase_core: 1.12.0 + # open_file: ^3.2.1 + open_filex: ^4.3.2 + path_provider: ^2.0.8 + # flutter_callkit_incoming: ^1.0.3+3 + # firebase_core: 1.12.0 + +# flutter_amazonpaymentservices: 0.0.6 +# crypto: dependency_overrides: - provider : ^5.0.0 -# permission_handler : ^10.2.0 - flutter_svg: ^1.0.0 + provider: ^5.0.0 + # permission_handler : ^10.2.0 + flutter_svg: ^1.1.6 # firebase_messaging_platform_interface: any # flutter_inappwebview: 5.7.2+3 # git: diff --git a/speech_to_text/lib/speech_recognition_error.dart b/speech_to_text/lib/speech_recognition_error.dart index 2ab6cd4d..1b47b0c9 100644 --- a/speech_to_text/lib/speech_recognition_error.dart +++ b/speech_to_text/lib/speech_recognition_error.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; + part 'speech_recognition_error.g.dart'; /// A single error returned from the underlying speech services.