From 555898c822487c7bb70dea78ce74533753608ede Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 22 May 2023 09:34:08 +0300 Subject: [PATCH 01/49] updates --- PatientAppAPNSAuthKey.p8 | 6 + android/app/src/main/AndroidManifest.xml | 3 + .../geofence/HMG_Geofence.kt | 186 +++++++++++------- ios/Runner.xcodeproj/project.pbxproj | 62 +++--- pubspec.yaml | 2 +- 5 files changed, 159 insertions(+), 100 deletions(-) create mode 100755 PatientAppAPNSAuthKey.p8 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/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/pubspec.yaml b/pubspec.yaml index 834913a8..ff3d9a2f 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.020+4050020 environment: sdk: ">=2.7.0 <3.0.0" From badc13d41a148b7d21d13e6b9e4e09b130b3ca43 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 23 May 2023 10:39:20 +0300 Subject: [PATCH 02/49] sickleave CR Enabled --- lib/config/config.dart | 2 +- .../medical/patient_sick_leave_page.dart | 25 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index cd192911..0694f080 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -323,7 +323,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.5; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 1ca32e02..3d977a96 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -57,8 +57,8 @@ class _PatientSickLeavePageState extends State { subName: model.sickLeaveList[index].clinicName, isSortByClinic: false, isInOutPatient: model.sickLeaveList[index].isInOutPatient, - // isSickLeave: true, - // sickLeaveStatus: model.sickLeaveList[index].status, + isSickLeave: true, + sickLeaveStatus: model.sickLeaveList[index].status, onEmailTap: () { showConfirmMessage(model, index); }, @@ -69,13 +69,13 @@ class _PatientSickLeavePageState extends State { } void showConfirmMessage(PatientSickLeaveViewMode model, int index) { - // if (model.sickLeaveList[index].status == 1) { - // openWorkPlaceUpdatePage(model.sickLeaveList[index].requestNo, model.sickLeaveList[index].setupID, model, index, model.sickLeaveList[index].projectID); - // } else if (model.sickLeaveList[index].status == 2) { + if (model.sickLeaveList[index].status == 1) { + openWorkPlaceUpdatePage(model.sickLeaveList[index].requestNo, model.sickLeaveList[index].setupID, model, index, model.sickLeaveList[index].projectID); + } else if (model.sickLeaveList[index].status == 2) { showEmailDialog(model, index); - // } else { - // showApprovalDialog(); - // } + } else { + showApprovalDialog(); + } } void showApprovalDialog() { @@ -111,7 +111,14 @@ class _PatientSickLeavePageState extends State { } void openWorkPlaceUpdatePage(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { - Navigator.push(context, FadePage(page: WorkplaceUpdatePage(requestNumber: requestNumber, setupID: setupID, projectID: projectID,))).then((value) { + Navigator.push( + context, + FadePage( + page: WorkplaceUpdatePage( + requestNumber: requestNumber, + setupID: setupID, + projectID: projectID, + ))).then((value) { print(value); if (value != null && value == true) { model.getSickLeave(); From 15c4f016dfd8a1913cc2b71f388bc847e27a7b5b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 23 May 2023 12:48:42 +0300 Subject: [PATCH 03/49] update to stores for version 10.5 --- lib/pages/BookAppointment/SearchResults.dart | 1 + pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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/pubspec.yaml b/pubspec.yaml index ff3d9a2f..39370e58 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.020+4050020 +version: 4.5.64+1 environment: sdk: ">=2.7.0 <3.0.0" From a7a06f40835a2738981099d6a7608283026ea7e8 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 24 May 2023 16:55:53 +0300 Subject: [PATCH 04/49] Home page change --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 1 + .../fragments/home_page_fragment2.dart | 124 ++++++------------ lib/uitl/translations_delegate_base.dart | 1 + 4 files changed, 43 insertions(+), 87 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 0694f080..b84ee11e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; - // var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; + var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5fe40ec1..9737f921 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1883,4 +1883,5 @@ 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": "في خدمتكم دائما"}, }; \ No newline at end of file diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 9111c2ab..bb7a4156 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,96 +339,55 @@ 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) ], ), ), @@ -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/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index dabe80ab..bdaa3798 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2891,6 +2891,7 @@ 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]; } From 420aef3195bc8510b4c009c98b4f6bfa91491697 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 31 May 2023 16:28:09 +0300 Subject: [PATCH 05/49] Updates --- lib/config/localized_values.dart | 6 ++--- .../labs/request_send_lab_report_email.dart | 6 ++++- lib/core/service/medical/labs_service.dart | 1 + .../fragments/home_page_fragment2.dart | 24 +++++++++---------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9737f921..d64a2fe6 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": "لم يتم حضورها"}, @@ -926,7 +926,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": "عن طريق هذه الخدمة يمكنك طلب اخلاء بواسطة سيارة اسعاف سواء من المزل او الى المنزل بالاضافة الى مجموعة من الخدمات الاخرى" 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 118da906..65ac1762 100644 --- a/lib/core/model/labs/request_send_lab_report_email.dart +++ b/lib/core/model/labs/request_send_lab_report_email.dart @@ -24,6 +24,7 @@ class RequestSendLabReportEmail { String projectID; String invoiceNo; String orderDate; + String orderNo; RequestSendLabReportEmail( {this.versionID, @@ -50,7 +51,8 @@ class RequestSendLabReportEmail { this.doctorName, this.projectID, this.invoiceNo, - this.orderDate}); + this.orderDate, + this.orderNo}); RequestSendLabReportEmail.fromJson(Map json) { versionID = json['VersionID']; @@ -78,6 +80,7 @@ class RequestSendLabReportEmail { projectID = json['ProjectID']; invoiceNo = json['InvoiceNo']; orderDate = json['OrderDate']; + orderNo = json['OrderNo']; } Map toJson() { @@ -107,6 +110,7 @@ class RequestSendLabReportEmail { data['ProjectID'] = this.projectID; data['InvoiceNo'] = this.invoiceNo; data['OrderDate'] = this.orderDate; + data['OrderNo'] = this.orderNo; return data; } } diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 484bfff8..078703df 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -189,6 +189,7 @@ class LabsService extends BaseService { _requestSendLabReportEmail.patientMobileNumber = userObj.mobileNumber; _requestSendLabReportEmail.projectName = patientLabOrder.projectName; _requestSendLabReportEmail.setupID = patientLabOrder.setupID; + _requestSendLabReportEmail.orderNo = patientLabOrder.orderNo; await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index bb7a4156..207310b4 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -394,18 +394,18 @@ class _HomePageFragment2State extends State { ], ), ), - 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, + // ), + // ) ], ), ), From 2d93b9753d18aede53894b2c23f92942958dd4f8 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 12 Jun 2023 16:13:12 +0300 Subject: [PATCH 06/49] Ask doctor improvements --- lib/config/config.dart | 4 ++ .../service/medical/ask_doctor_services.dart | 69 ++++++++++--------- .../medical/ask_doctor_view_model.dart | 11 +++ .../medical/ask_doctor/request_type.dart | 4 +- lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- 5 files changed, 57 insertions(+), 35 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index b84ee11e..5ff4e6f1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -400,6 +400,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'; @@ -414,7 +416,9 @@ 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 GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index 57ab856b..80ee3e6d 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -18,9 +18,8 @@ class AskDoctorService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_CALL_INFO_HOURS_RESULT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; + await baseAppClient.post(GET_CALL_INFO_HOURS_RESULT, onSuccess: (dynamic response, int statusCode) { + localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -29,11 +28,10 @@ class AskDoctorService extends BaseService { } Future getCallRequestTypeLOV() async { - hasError =false; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_CALL_REQUEST_TYPE_LOV, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_CALL_REQUEST_TYPE_LOV, onSuccess: (dynamic response, int statusCode) { askDoctorReqTypes.clear(); response['ListReqTypes'].forEach((reqType) { askDoctorReqTypes.add(AskDoctorReqTypes.fromJson(reqType)); @@ -44,16 +42,28 @@ 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; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - body['from'] = - "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} 00:00:00"; - body['from'] = - "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}:00"; - await baseAppClient.post(GET_DOCTOR_RESPONSE, - onSuccess: (dynamic response, int statusCode) { + body['from'] = "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} 00:00:00"; + body['from'] = "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}:00"; + await baseAppClient.post(GET_DOCTOR_RESPONSE, onSuccess: (dynamic response, int statusCode) { doctorResponseList.clear(); response['List_DoctorResponse'].forEach((reqType) { doctorResponseList.add(DoctorResponse.fromJson(reqType)); @@ -65,12 +75,11 @@ class AskDoctorService extends BaseService { } Future updateReadStatus({int transactionNo}) async { - hasError =false; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; body['TransactionNo'] = transactionNo; - await baseAppClient.post(UPDATE_READ_STATUS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_READ_STATUS, onSuccess: (dynamic response, int statusCode) { //TODO fix it }, onFailure: (String error, int statusCode) { hasError = true; @@ -78,31 +87,27 @@ class AskDoctorService extends BaseService { }, body: body); } - - Future sendRequestLOV({DoctorList doctorList,String requestType,String remark}) async { - hasError =false; + Future sendRequestLOV({DoctorList doctorList, String requestType, String remark}) async { + hasError = false; Map body = Map(); body['ProjectID'] = doctorList.projectID; body['SetupID'] = doctorList.setupID; 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['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; - await baseAppClient.post(INSERT_CALL_INFO, - onSuccess: (dynamic response, int statusCode) { - - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + body['QuestionType'] = num.parse(requestType); + await baseAppClient.post(INSERT_APPOINTMENT_QUESTION, onSuccess: (dynamic response, int statusCode) {}, 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/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 66cd9344..4ceb5bf5 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, @@ -111,6 +112,7 @@ class _RequestTypePageState extends State { model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) { if (model.state != ViewState.ErrorLocal || model.state != ViewState.Error) { Navigator.pop(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).RRTRequestSuccess); } }) }, diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e91990b4..f62248b8 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -37,9 +37,9 @@ class MyInAppBrowser extends InAppBrowser { // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS From 3fda1da16aca17aba502f56abd04044304ff74a6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 18 Jun 2023 20:23:57 +0300 Subject: [PATCH 07/49] updates --- lib/core/service/medical/ask_doctor_services.dart | 5 ++++- lib/models/Appointments/DoctorListResponse.dart | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index 80ee3e6d..84c4f9d1 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -104,8 +104,11 @@ class AskDoctorService extends BaseService { body['EditedBy'] = 102; body['EditedOn'] = DateUtil.convertDateToString(DateTime.now()); body['isDentalAllowedBackend'] = false; + body['AppointmentNo'] = doctorList.appointmentNo; + body['ClinicID'] = doctorList.clinicID; body['QuestionType'] = num.parse(requestType); - await baseAppClient.post(INSERT_APPOINTMENT_QUESTION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + + await baseAppClient.post(INSERT_CALL_INFO, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); 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; From f29d33d7e781bc18a6015d6466aa0fa3daa0df25 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Tue, 20 Jun 2023 12:43:44 +0300 Subject: [PATCH 08/49] Changes for voice command search --- .../others/floating_button_search.dart | 163 ++++++++++-------- pubspec.yaml | 41 +++-- .../lib/speech_recognition_error.dart | 1 + 3 files changed, 116 insertions(+), 89 deletions(-) diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 5a571df8..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 { @@ -192,20 +193,20 @@ class _FloatingSearchButton extends State with TickerProvi : Image.asset('assets/images/gif/robot-idle.gif'), ), onTap: () async { - // if (Platform.isAndroid) { - // if (await PermissionService.isMicrophonePermissionEnabled()) { - // new RoboSearch(context: context).showAlertDialog(context); - // initSpeechState().then((value) => {startVoiceSearch()}); - // } else { - // Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () { - // new RoboSearch(context: context).showAlertDialog(context); - // initSpeechState().then((value) => {startVoiceSearch()}); - // }); - // } - // } else { - // new RoboSearch(context: context).showAlertDialog(context); - // initSpeechState().then((value) => {startVoiceSearch()}); - // } + if (Platform.isAndroid) { + if (await PermissionService.isMicrophonePermissionEnabled()) { + new RoboSearch(context: context).showAlertDialog(context); + initSpeechState().then((value) => {startVoiceSearch()}); + } else { + Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () { + new RoboSearch(context: context).showAlertDialog(context); + initSpeechState().then((value) => {startVoiceSearch()}); + }); + } + } else { + new RoboSearch(context: context).showAlertDialog(context); + initSpeechState().then((value) => {startVoiceSearch()}); + } }, ), Positioned( @@ -234,44 +235,60 @@ class _FloatingSearchButton extends State with TickerProvi ])); } - // startVoiceSearch() async { - // bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); - // _currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - // - // if (available) { - // speech.listen( - // onResult: resultListener, - // //listenMode: ListenMode.confirmation, - // localeId: _currentLocaleId == 'en' ? 'en_US' : 'ar_SA', - // ); - // } else { - // 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); - // } + + 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, + // //listenMode: ListenMode.confirmation, + // localeId: _currentLocaleId == 'en' ? 'en_US' : 'ar_SA', + // ); + // } else { + // print("The user has denied the use of speech recognition."); + // } + // some time later... + 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 a7222ce6..970ebdcc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.61+1 +version: 4.5.64+1 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 @@ -34,7 +34,7 @@ dependencies: health: ^3.0.3 #chart - fl_chart: ^0.40.2 + fl_chart: ^0.45.0 #Camera Preview camera: ^0.10.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 @@ -98,7 +98,7 @@ dependencies: 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,23 +161,25 @@ 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: ^3.6.1 + # flutter_tts: + # path: flutter_tts-voice_enhancement + flutter_tts: ^3.7.0 wifi: ^0.1.5 vibration: ^1.7.3 flutter_nfc_kit: ^3.3.1 -# speech_to_text: ^6.1.1 -# path: speech_to_text + geofencing: ^0.1.0 - in_app_update: ^3.0.0 + speech_to_text: ^6.1.1 + # path: speech_to_text - in_app_review: ^2.0.3 + in_app_update: ^4.0.1 + + in_app_review: ^2.0.6 badges: ^2.0.1 flutter_app_icon_badge: ^2.0.0 @@ -191,7 +193,7 @@ dependencies: carousel_slider: ^4.0.0 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 @@ -201,15 +203,16 @@ dependencies: equatable: ^2.0.3 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 dependency_overrides: provider : ^5.0.0 -# permission_handler : ^10.2.0 + # permission_handler : ^10.2.0 flutter_svg: ^1.0.0 # firebase_messaging_platform_interface: any # flutter_inappwebview: 5.7.2+3 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. From 6877244d0e385aebb4e7fe0d2348bcb4ab9f8385 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 2 Jul 2023 15:57:29 +0300 Subject: [PATCH 09/49] CR# 5805 Ask Doc Improvements dev completed. --- lib/config/config.dart | 1 + lib/config/localized_values.dart | 3 + .../service/medical/ask_doctor_services.dart | 33 +++ .../ask_doctor/ViewDoctorResponsesPage.dart | 248 +++++++++++++++++- .../medical/ask_doctor/doctor_response.dart | 20 +- lib/uitl/translations_delegate_base.dart | 3 + 6 files changed, 287 insertions(+), 21 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 5ff4e6f1..4981aca0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -419,6 +419,7 @@ 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'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d64a2fe6..f08b9c41 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1884,4 +1884,7 @@ const Map localizedValues = { "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": "يرجى تقييم استجابة الطبيب:"}, }; \ No newline at end of file diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index 84c4f9d1..a6482431 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'; @@ -113,4 +115,35 @@ class AskDoctorService extends BaseService { 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/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 489e9281..c6fdb47f 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,227 @@ 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, + () { + 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/doctor_response.dart b/lib/pages/medical/ask_doctor/doctor_response.dart index 37e5f1c9..0dd9b9a1 100644 --- a/lib/pages/medical/ask_doctor/doctor_response.dart +++ b/lib/pages/medical/ask_doctor/doctor_response.dart @@ -85,24 +85,20 @@ class DoctorResponse extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts('${doctor.doctorName}'), SizedBox( height: 5, ), - Texts( - '${doctor.requestTypeDescription}'), + Texts('${doctor.requestTypeDescription}'), ], ), ), ), Padding( padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Icon(projectViewModel.isArabic - ? Icons.arrow_forward_ios - : Icons.arrow_back_ios), + child: Icon(projectViewModel.isArabic ? Icons.arrow_back_ios : Icons.arrow_forward_ios), ) ], ), @@ -158,24 +154,20 @@ class DoctorResponse extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts('${doctor.doctorName}'), SizedBox( height: 5, ), - Texts( - '${doctor.requestTypeDescription}'), + Texts('${doctor.requestTypeDescription}'), ], ), ), ), Padding( padding: const EdgeInsets.all(8.0), - child: Icon(projectViewModel.isArabic - ? Icons.arrow_forward_ios - : Icons.arrow_back_ios), + child: Icon(projectViewModel.isArabic ? Icons.arrow_back_ios : Icons.arrow_forward_ios), ) ], ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index bdaa3798..e0b93147 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2892,6 +2892,9 @@ class TranslationBase { 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]; } From f2ab76eb247c34ecb48350a1aeddf7e00a6ed257 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 9 Jul 2023 10:17:29 +0300 Subject: [PATCH 10/49] updates --- lib/core/service/medical/ask_doctor_services.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index a6482431..bfb45e77 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -109,6 +109,8 @@ class AskDoctorService extends BaseService { 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; From 0306c777ed56794e4120658af3ed5218d89d95d1 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Sun, 9 Jul 2023 10:54:28 +0300 Subject: [PATCH 11/49] rating bug fixed --- lib/extensions/string_extensions.dart | 3 ++- lib/widgets/new_design/doctor_header.dart | 28 +++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index e1700bc5..6ba96b08 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,6 +1,7 @@ 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(" ") : ""; } diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 2c9bb42a..bcbd55f8 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: 20.0, right: 20.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: 20.0, right: 20.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: 20.0, right: 20.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: 20.0, right: 20.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: 20.0, right: 20.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, From 27373b697235a9a343dbf4272301ab54b4724607 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Tue, 11 Jul 2023 10:06:37 +0300 Subject: [PATCH 12/49] doctor header. --- lib/widgets/new_design/doctor_header.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index bcbd55f8..549c182a 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -302,7 +302,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(getRatingWidth(doctorDetailsList[0].ratio).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), @@ -323,7 +323,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(doctorDetailsList[1].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), @@ -344,7 +344,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(doctorDetailsList[2].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), @@ -365,7 +365,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(doctorDetailsList[3].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), @@ -387,7 +387,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(doctorDetailsList[4].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), From 4b0a41d7d8efb8ddffc04b26b4f204eec5262450 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 12 Jul 2023 12:54:43 +0300 Subject: [PATCH 13/49] updates --- lib/config/config.dart | 4 ++-- pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4981aca0..e261a875 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; - var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; + // var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; diff --git a/pubspec.yaml b/pubspec.yaml index 39370e58..5d9f5e79 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -174,7 +174,7 @@ dependencies: geofencing: ^0.1.0 -# speech_to_text: ^6.1.1 + speech_to_text: ^6.1.1 # path: speech_to_text in_app_update: ^3.0.0 From d9404d3abefd3e27f2cd048aceca2abf15045beb Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 13 Jul 2023 11:30:13 +0300 Subject: [PATCH 14/49] Medical Report changes --- lib/pages/medical/reports/report_home_page.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 6e6d991a..08f1e43a 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -27,7 +27,7 @@ class _HomeReportPageState extends State with SingleTickerProvid @override void initState() { super.initState(); - _tabController = TabController(length: 4, vsync: this); + _tabController = TabController(length: 3, vsync: this); } @override @@ -86,10 +86,10 @@ class _HomeReportPageState extends State with SingleTickerProvid TranslationBase.of(context).ready, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), - Text( - TranslationBase.of(context).completed, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - ), + // Text( + // TranslationBase.of(context).completed, + // style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + // ), Text( TranslationBase.of(context).cancelled, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), @@ -104,7 +104,7 @@ class _HomeReportPageState extends State with SingleTickerProvid 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.reportsOrderCompletedList, emailAddress: model.user.emailAddress), ReportListWidget(reportList: model.reportsOrderCanceledList, emailAddress: model.user.emailAddress), ], ), From 83859e05f1ee4a5b92c13460434a0c4369bc63f7 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Sun, 16 Jul 2023 11:48:28 +0300 Subject: [PATCH 15/49] family file approve reject button refresh --- lib/pages/DrawerPages/family/my-family.dart | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) 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); From 047877fb08e5e76d13670dce831935a1067093f3 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 16 Jul 2023 14:10:55 +0300 Subject: [PATCH 16/49] Add Doctor response rate comments validation --- lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index c6fdb47f..2e930330 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -210,7 +210,11 @@ class _ViewDoctorResponsesPageState extends State { child: DefaultButton( TranslationBase.of(context).submit, () { - rateDoctorResponse(); + if (textController.text.isEmpty) { + AppToast.showErrorToast(message: "Please enter comments"); + } else { + rateDoctorResponse(); + } }, color: CustomColors.accentColor, ), From 1a45dd57e9a36aebccf8576e0e3c8bffc9ad005c Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 17 Jul 2023 16:27:39 +0300 Subject: [PATCH 17/49] LiveCare Fix --- lib/pages/livecare/widgets/LiveCareHistoryCard.dart | 5 +++-- lib/services/livecare_services/livecare_provider.dart | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index def0461d..9e08af05 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -240,9 +240,10 @@ 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); + AppToast.showErrorToast(message: err.toString()); print(err); }); } 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) { From 1eccaf0aac18f5122cd3c06009b51f92b210b58a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 18 Jul 2023 11:02:33 +0300 Subject: [PATCH 18/49] Regex added to allow characters only. --- lib/pages/medical/sickleave_workplace_update_page.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pages/medical/sickleave_workplace_update_page.dart b/lib/pages/medical/sickleave_workplace_update_page.dart index 3b4a1f1b..517f251c 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: [ + FilteringTextInputFormatter.allow(RegExp("[a-zA-Zء-ي ]")), + ], onChanged: (value) => {_onPassportTextChanged(value)}, style: TextStyle( fontSize: 14, From 3fb8876c31f6ee0eff253077c8593573ad3c3b44 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 19 Jul 2023 09:54:34 +0300 Subject: [PATCH 19/49] Manual Insurance Card Update --- lib/config/config.dart | 6 +++--- lib/config/localized_values.dart | 1 + .../insurance/UpdateInsuranceManually.dart | 9 +++++--- lib/pages/insurance/insurance_page.dart | 21 ++++++++++++++++--- .../ask_doctor/ViewDoctorResponsesPage.dart | 20 +++++++++--------- lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/in_app_browser/InAppBrowser.dart | 4 ++-- pubspec.yaml | 2 +- 8 files changed, 42 insertions(+), 22 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index e261a875..93128eff 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; - // var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; + var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -323,7 +323,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.5; +var VERSION_ID = 10.6; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f08b9c41..47d36da3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1887,4 +1887,5 @@ const Map localizedValues = { "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": "هل ترغب في تحديث التأمين الخاص بك يدويًا؟"}, }; \ No newline at end of file diff --git a/lib/pages/insurance/UpdateInsuranceManually.dart b/lib/pages/insurance/UpdateInsuranceManually.dart index a9ee8a67..32378aa0 100644 --- a/lib/pages/insurance/UpdateInsuranceManually.dart +++ b/lib/pages/insurance/UpdateInsuranceManually.dart @@ -159,9 +159,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, ), ), diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart index 2ea4213f..324c9fa1 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -1,6 +1,6 @@ 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/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'; @@ -9,6 +9,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../locator.dart'; +import '../../widgets/dialogs/confirm_dialog.dart'; import 'insurance_card_update_details.dart'; class InsurancePage extends StatelessWidget { @@ -144,7 +145,9 @@ class InsurancePage extends StatelessWidget { getDetails({String setupID, int projectID, String patientIdentificationID, int patientID, String name, 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( @@ -159,8 +162,20 @@ class InsurancePage extends StatelessWidget { model.getInsuranceUpdated(); }); } else { - AppToast.showErrorToast(message: _insuranceCardService.error); + // AppToast.showErrorToast(message: _insuranceCardService.error); + updateManually(context, _insuranceCardService.error); } }); } + + void updateManually(BuildContext context, String errorMsg) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: errorMsg + ". " + TranslationBase.of(context).updateInsuranceManuallyDialog, + okText: TranslationBase.of(context).yes, + cancelText: TranslationBase.of(context).no, + okFunction: () => {Navigator.pop(context), Navigator.push(context, FadePage(page: UpdateInsuranceManually()))}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } } diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 2e930330..893a59df 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -112,16 +112,16 @@ class _ViewDoctorResponsesPageState extends State { ), ), ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: DefaultButton( - TranslationBase.of(context).rateDoctorResponse, - () { - openResponseRateDialog(context); - }, - color: CustomColors.accentColor, - ), - ), + // Container( + // margin: EdgeInsets.only(top: 10.0), + // child: DefaultButton( + // TranslationBase.of(context).rateDoctorResponse, + // () { + // openResponseRateDialog(context); + // }, + // color: CustomColors.accentColor, + // ), + // ), ], ), ); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index e0b93147..a9a4b4bb 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2895,6 +2895,7 @@ class TranslationBase { 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]; } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f62248b8..e91990b4 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -37,9 +37,9 @@ class MyInAppBrowser extends InAppBrowser { // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS diff --git a/pubspec.yaml b/pubspec.yaml index 5d9f5e79..1c7c9b15 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.64+1 +version: 4.5.022+4050022 environment: sdk: ">=2.7.0 <3.0.0" From a60f66a0691b5beaf802425bdf85a35ca60febfe Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 27 Jul 2023 16:25:25 +0300 Subject: [PATCH 20/49] Updates --- lib/config/config.dart | 5 +- lib/config/localized_values.dart | 1 + lib/core/model/reports/request_reports.dart | 36 +- lib/core/service/medical/reports_service.dart | 69 +-- .../medical/reports_view_model.dart | 1 + .../conference/web_rtc/call_home_page_.dart | 408 ++++++------- lib/pages/landing/landing_page.dart | 3 +- lib/pages/livecare/incoming_call.dart | 2 +- .../ask_doctor/ViewDoctorResponsesPage.dart | 20 +- .../medical/reports/report_home_page.dart | 196 +++++-- .../medical/reports/report_list_widget.dart | 47 +- lib/pages/webRTC/call_page.dart | 328 +++++------ lib/pages/webRTC/signaling.dart | 554 +++++++++--------- lib/routes.dart | 2 +- lib/uitl/SignalRUtil.dart | 346 +++++------ lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/drawer/app_drawer_widget.dart | 8 +- lib/widgets/in_app_browser/InAppBrowser.dart | 17 +- pubspec.yaml | 10 +- 19 files changed, 1065 insertions(+), 989 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 93128eff..0fad39b1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; - var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; + // var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -182,6 +182,7 @@ 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'; ///Rate // var IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 47d36da3..a69002f6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1888,4 +1888,5 @@ const Map localizedValues = { "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": "عرض التقرير"}, }; \ No newline at end of file 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/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index bf340814..a496c6df 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -8,17 +8,11 @@ class ReportsService extends BaseService { List reportsList = List(); List appointHistoryList = 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 +23,25 @@ class ReportsService extends BaseService { }, body: _requestReports.toJson()); } + Future getInpatientAdmissionsList() async { + hasError = false; + await baseAppClient.post(GET_INPATIENT_ADMISSIONS, onSuccess: (dynamic response, int statusCode) { + reportsList.clear(); + print(response['AdmissionsForMedicalReport']); + response['AdmissionsForMedicalReport'].forEach((reports) { + // reportsList.add(Reports.fromJson(reports)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestReports.toJson()); + } + 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 +54,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 +66,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 +77,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 +99,13 @@ 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 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; @@ -135,11 +126,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(SEND_MEDICAL_REPORT_EMAIL, 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/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index 271b5463..544ead18 100644 --- a/lib/core/viewModels/medical/reports_view_model.dart +++ b/lib/core/viewModels/medical/reports_view_model.dart @@ -33,6 +33,7 @@ class ReportsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); + await _reportsService.getInpatientAdmissionsList(); setState(ViewState.Idle); } } diff --git a/lib/pages/conference/web_rtc/call_home_page_.dart b/lib/pages/conference/web_rtc/call_home_page_.dart index 1f36a8e9..13dbfb35 100644 --- a/lib/pages/conference/web_rtc/call_home_page_.dart +++ b/lib/pages/conference/web_rtc/call_home_page_.dart @@ -1,204 +1,204 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; -import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; - -import '../conference_button_bar.dart'; - -class CallHomePage extends StatefulWidget { - final String receiverId; - final String callerId; - - const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); - - @override - _CallHomePageState createState() => _CallHomePageState(); -} - -class _CallHomePageState extends State { - bool showNoise = true; - RTCVideoRenderer _localRenderer = RTCVideoRenderer(); - RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); - - final StreamController _audioButton = StreamController.broadcast(); - final StreamController _videoButton = StreamController.broadcast(); - final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); - final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); - - //Stream to enable video - MediaStream localMediaStream; - MediaStream remoteMediaStream; - Signaling signaling = Signaling(); - - @override - void initState() { - // TODO: implement initState - super.initState(); - startCall(); - } - - startCall() async{ - await _localRenderer.initialize(); - await _remoteRenderer.initialize(); - await signaling.init(); - final connected = await receivedCall(); - } - - - Future receivedCall() async { - //Stream local media - localMediaStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); - _localRenderer.srcObject = localMediaStream; - - final connected = await signaling.acceptCall(widget.callerId, widget.receiverId, localMediaStream: localMediaStream, - onRemoteMediaStream: (remoteMediaStream){ - - // print(remoteMediaStream.toString()); - // print(json.encode(remoteMediaStream.getTracks().asMap())); - this.remoteMediaStream = remoteMediaStream; - _remoteRenderer.srcObject = remoteMediaStream; - _remoteRenderer.addListener(() { - print('_remoteRenderer'); - print(_remoteRenderer); - setState(() {}); - }); - }, - onRemoteTrack: (track){ - _remoteRenderer.srcObject.addTrack(track.track); - // setState(() { - // }); - - print(track.streams.first.getVideoTracks()); - print(track.streams.first.getAudioTracks()); - print(json.encode(track.streams.asMap())); - } - ); - - if(connected){ - signaling.signalR.listen( - onAcceptCall: (arg0){ - print(arg0.toString()); - }, - onCandidate: (candidateJson){ - signaling.addCandidate(candidateJson); - }, - onDeclineCall: (arg0,arg1){ - // _onHangup(); - }, - onHangupCall: (arg0){ - // _onHangup(); - }, - - onOffer: (offerSdp, callerUser) async{ - print('${offerSdp.toString()} | ${callerUser.toString()}'); - await signaling.answerOffer(offerSdp); - } - ); - } - return connected; - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - signaling.dispose(); - _localRenderer?.dispose(); - _remoteRenderer?.dispose(); - _audioButton?.close(); - _videoButton?.close(); - localMediaStream?.dispose(); - remoteMediaStream?.dispose(); - _disposeStreamsAndSubscriptions(); - } - - Future _disposeStreamsAndSubscriptions() async { - if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); - if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.white, - body: buildLayout(), - ); - } - - LayoutBuilder buildLayout() { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return Stack( - children: [ - CamViewWidget( - localRenderer: _localRenderer, - remoteRenderer: _remoteRenderer, - constraints: constraints, - onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, - onButtonBarHeightStreamController: _onButtonBarHeightStreamController, - ), - ConferenceButtonBar( - audioEnabled: _audioButton.stream, - videoEnabled: _videoButton.stream, - onAudioEnabled: _onAudioEnable, - onVideoEnabled: _onVideoEnabled, - onSwitchCamera: _onSwitchCamera, - onHangup: _onHangup, - onPersonAdd: () {}, - onPersonRemove: () {}, - onHeight: _onHeightBar, - onShow: _onShowBar, - onHide: _onHideBar, - ), - ], - ); - }, - ); - } - - Function _onAudioEnable() { - final audioTrack = localMediaStream.getAudioTracks()[0]; - final mute = audioTrack.muted; - Helper.setMicrophoneMute(!mute, audioTrack); - _audioButton.add(mute); - } - - Function _onVideoEnabled() { - final videoTrack = localMediaStream.getVideoTracks()[0]; - bool videoEnabled = videoTrack.enabled; - localMediaStream.getVideoTracks()[0].enabled = !videoEnabled; - _videoButton.add(!videoEnabled); - } - - Function _onSwitchCamera() { - Helper.switchCamera(localMediaStream.getVideoTracks()[0]); - } - - void _onShowBar() { - setState(() { - }); - _onButtonBarVisibleStreamController.add(true); - } - - void _onHeightBar(double height) { - _onButtonBarHeightStreamController.add(height); - } - - void _onHideBar() { - setState(() { - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); - }); - _onButtonBarVisibleStreamController.add(false); - } - - Future _onHangup() async { - signaling.hangupCall(widget.callerId, widget.receiverId); - print('onHangup'); - Navigator.of(context).pop(); - } -} +// import 'dart:async'; +// import 'dart:convert'; +// +// import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; +// import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +// import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +// import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// import '../conference_button_bar.dart'; +// +// class CallHomePage extends StatefulWidget { +// final String receiverId; +// final String callerId; +// +// const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); +// +// @override +// _CallHomePageState createState() => _CallHomePageState(); +// } +// +// class _CallHomePageState extends State { +// bool showNoise = true; +// RTCVideoRenderer _localRenderer = RTCVideoRenderer(); +// RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); +// +// final StreamController _audioButton = StreamController.broadcast(); +// final StreamController _videoButton = StreamController.broadcast(); +// final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); +// final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); +// +// //Stream to enable video +// MediaStream localMediaStream; +// MediaStream remoteMediaStream; +// Signaling signaling = Signaling(); +// +// @override +// void initState() { +// // TODO: implement initState +// super.initState(); +// startCall(); +// } +// +// startCall() async{ +// await _localRenderer.initialize(); +// await _remoteRenderer.initialize(); +// await signaling.init(); +// final connected = await receivedCall(); +// } +// +// +// Future receivedCall() async { +// //Stream local media +// localMediaStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); +// _localRenderer.srcObject = localMediaStream; +// +// final connected = await signaling.acceptCall(widget.callerId, widget.receiverId, localMediaStream: localMediaStream, +// onRemoteMediaStream: (remoteMediaStream){ +// +// // print(remoteMediaStream.toString()); +// // print(json.encode(remoteMediaStream.getTracks().asMap())); +// this.remoteMediaStream = remoteMediaStream; +// _remoteRenderer.srcObject = remoteMediaStream; +// _remoteRenderer.addListener(() { +// print('_remoteRenderer'); +// print(_remoteRenderer); +// setState(() {}); +// }); +// }, +// onRemoteTrack: (track){ +// _remoteRenderer.srcObject.addTrack(track.track); +// // setState(() { +// // }); +// +// print(track.streams.first.getVideoTracks()); +// print(track.streams.first.getAudioTracks()); +// print(json.encode(track.streams.asMap())); +// } +// ); +// +// if(connected){ +// signaling.signalR.listen( +// onAcceptCall: (arg0){ +// print(arg0.toString()); +// }, +// onCandidate: (candidateJson){ +// signaling.addCandidate(candidateJson); +// }, +// onDeclineCall: (arg0,arg1){ +// // _onHangup(); +// }, +// onHangupCall: (arg0){ +// // _onHangup(); +// }, +// +// onOffer: (offerSdp, callerUser) async{ +// print('${offerSdp.toString()} | ${callerUser.toString()}'); +// await signaling.answerOffer(offerSdp); +// } +// ); +// } +// return connected; +// } +// +// @override +// void dispose() { +// // TODO: implement dispose +// super.dispose(); +// signaling.dispose(); +// _localRenderer?.dispose(); +// _remoteRenderer?.dispose(); +// _audioButton?.close(); +// _videoButton?.close(); +// localMediaStream?.dispose(); +// remoteMediaStream?.dispose(); +// _disposeStreamsAndSubscriptions(); +// } +// +// Future _disposeStreamsAndSubscriptions() async { +// if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); +// if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); +// } +// +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// backgroundColor: Colors.white, +// body: buildLayout(), +// ); +// } +// +// LayoutBuilder buildLayout() { +// return LayoutBuilder( +// builder: (BuildContext context, BoxConstraints constraints) { +// return Stack( +// children: [ +// CamViewWidget( +// localRenderer: _localRenderer, +// remoteRenderer: _remoteRenderer, +// constraints: constraints, +// onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, +// onButtonBarHeightStreamController: _onButtonBarHeightStreamController, +// ), +// ConferenceButtonBar( +// audioEnabled: _audioButton.stream, +// videoEnabled: _videoButton.stream, +// onAudioEnabled: _onAudioEnable, +// onVideoEnabled: _onVideoEnabled, +// onSwitchCamera: _onSwitchCamera, +// onHangup: _onHangup, +// onPersonAdd: () {}, +// onPersonRemove: () {}, +// onHeight: _onHeightBar, +// onShow: _onShowBar, +// onHide: _onHideBar, +// ), +// ], +// ); +// }, +// ); +// } +// +// Function _onAudioEnable() { +// final audioTrack = localMediaStream.getAudioTracks()[0]; +// final mute = audioTrack.muted; +// Helper.setMicrophoneMute(!mute, audioTrack); +// _audioButton.add(mute); +// } +// +// Function _onVideoEnabled() { +// final videoTrack = localMediaStream.getVideoTracks()[0]; +// bool videoEnabled = videoTrack.enabled; +// localMediaStream.getVideoTracks()[0].enabled = !videoEnabled; +// _videoButton.add(!videoEnabled); +// } +// +// Function _onSwitchCamera() { +// Helper.switchCamera(localMediaStream.getVideoTracks()[0]); +// } +// +// void _onShowBar() { +// setState(() { +// }); +// _onButtonBarVisibleStreamController.add(true); +// } +// +// void _onHeightBar(double height) { +// _onButtonBarHeightStreamController.add(height); +// } +// +// void _onHideBar() { +// setState(() { +// SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); +// }); +// _onButtonBarVisibleStreamController.add(false); +// } +// +// Future _onHangup() async { +// signaling.hangupCall(widget.callerId, widget.receiverId); +// print('onHangup'); +// Navigator.of(context).pop(); +// } +// } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index e9fbd62c..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'; @@ -81,7 +80,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { var themeNotifier; DateTime currentBackPressTime; - SignalRUtil signalRUtil; + // SignalRUtil signalRUtil; ToDoCountProviderModel toDoProvider; diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index da8c507e..7cea1153 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -34,7 +34,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt CameraController _controller; Future _initializeControllerFuture; bool isCameraReady = false; - Signaling signaling = Signaling()..init(); + // Signaling signaling = Signaling()..init(); @override void initState() { diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 893a59df..2e930330 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -112,16 +112,16 @@ class _ViewDoctorResponsesPageState extends State { ), ), ), - // Container( - // margin: EdgeInsets.only(top: 10.0), - // child: DefaultButton( - // TranslationBase.of(context).rateDoctorResponse, - // () { - // openResponseRateDialog(context); - // }, - // color: CustomColors.accentColor, - // ), - // ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: DefaultButton( + TranslationBase.of(context).rateDoctorResponse, + () { + openResponseRateDialog(context); + }, + color: CustomColors.accentColor, + ), + ), ], ), ); diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 08f1e43a..375bbb8c 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -21,19 +21,23 @@ 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); + WidgetsBinding.instance.addPostFrameCallback((_) { + getInPatientAdmissionList(); + }); super.initState(); - _tabController = TabController(length: 3, vsync: this); } @override void dispose() { super.dispose(); - _tabController.dispose(); + _tabController_new.dispose(); } @override @@ -57,74 +61,138 @@ 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'), - // ), - Text( - TranslationBase.of(context).cancelled, - 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, ), - ], - ), - 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).inPatient, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + ), + Text( + TranslationBase.of(context).outpatient, + 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(), + 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), + ], + ), + ) + ], + ), + ) + ], ), ), - ) - ], + if (projectViewModel.havePrivilege(21) && _tabController_new.index == 1) + 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, + ), + ), + ], + ), + ); + } + + void getInPatientAdmissionList() {} } diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index cc76214b..e47b8244 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -3,6 +3,7 @@ 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'; @@ -55,9 +56,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( @@ -93,14 +109,23 @@ 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: [ + 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]); + }) + ], + ), ], ), ], diff --git a/lib/pages/webRTC/call_page.dart b/lib/pages/webRTC/call_page.dart index 8a5625b2..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 9a4d1c48..028de903 100644 --- a/lib/pages/webRTC/signaling.dart +++ b/lib/pages/webRTC/signaling.dart @@ -1,277 +1,277 @@ -import 'dart:convert'; - -import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; - -typedef void StreamStateCallback(MediaStream stream); -typedef void RTCIceGatheringStateCallback(RTCIceGatheringState state); -typedef void RTCPeerConnectionStateCallback(RTCPeerConnectionState state); -typedef void RTCSignalingStateCallback(RTCSignalingState state); - -final Map constraints = { - 'mandatory': {}, - 'optional': [ - {'DtlsSrtpKeyAgreement': true}, - ] -}; - -Map snapsis_ice_config = { - 'iceServers': [ - { "urls": 'stun:15.185.116.59:3478' }, - { "urls": "turn:15.185.116.59:3479", "username": "admin", "credential": "admin" }, - ], - // 'sdpSemantics': 'unified-plan' -}; -Map twilio_ice_config = { - "ice_servers": [ - { - "url": "stun:global.stun.twilio.com:3478?transport=udp", - "urls": "stun:global.stun.twilio.com:3478?transport=udp" - }, - { - "url": "turn:global.turn.twilio.com:3478?transport=udp", - "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", - "urls": "turn:global.turn.twilio.com:3478?transport=udp", - "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" - }, - { - "url": "turn:global.turn.twilio.com:3478?transport=tcp", - "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", - "urls": "turn:global.turn.twilio.com:3478?transport=tcp", - "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" - }, - { - "url": "turn:global.turn.twilio.com:443?transport=tcp", - "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", - "urls": "turn:global.turn.twilio.com:443?transport=tcp", - "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" - } - ], - // 'sdpSemantics': 'unified-plan' -}; -Map google_ice_config = { - 'iceServers': [ - { - 'urls': [ - 'stun:stun.l.google.com:19302', - 'stun:stun1.l.google.com:19302', - 'stun:stun2.l.google.com:19302', - 'stun:stun3.l.google.com:19302' - ] - }, - ], - // 'sdpSemantics': 'unified-plan' -}; -Map aws_ice_config = { - 'iceServers': [ - {'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"}, - {'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"} - ], - // 'sdpSemantics': 'unified-plan' -}; - -class Signaling { - dispose() { - if (peerConnection != null) { - peerConnection.dispose(); - peerConnection.getLocalStreams().forEach((e) => e.dispose()); - peerConnection.getRemoteStreams().forEach((e) => e.dispose()); - } - signalR.closeConnection(); - } - - init() async{ - // Create Peer Connection - peerConnection = await createPeerConnection(google_ice_config, constraints); - registerPeerConnectionListeners(); - } - - initializeSignalR(String userName) async { - 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"); - final connected = await signalR.openConnection(); - if (!connected) throw 'Failed to connect SignalR'; - } - - Map configuration = { - // 'iceServers': [ - // { - // 'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'] - // } - // ] - - 'iceServers': [ - // {'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"}, - // {'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"} - // {'url': "stun:15.185.116.59:3478"}, - // { - // "url":"turn:15.185.116.59:3479", - // "username": "admin", - // "credential":"admin" - // } - { - "url": "stun:global.stun.twilio.com:3478?transport=udp", - "urls": "stun:global.stun.twilio.com:3478?transport=udp" - }, - { - "url": "turn:global.turn.twilio.com:3478?transport=udp", - "username": "f18fc347ba4aeeaa1b00f5199b1e900834b464962d434a4a89b4cdba02510047", - "urls": "turn:global.turn.twilio.com:3478?transport=udp", - "credential": "WX16BB+9nKm0f+Whf5EwpM8S/Yv+T2tlvQWLfdV7oqo=" - } - ] - }; - - SignalRUtil signalR; - - RTCPeerConnection peerConnection; - MediaStream localStream; - MediaStream remoteStream; - RTCDataChannel dataChannel; - - // Future call(String patientId, String mobile, {@required RTCVideoRenderer localVideo, @required RTCVideoRenderer remoteVideo}) async { - // await initializeSignalR(patientId); - // - // // final isCallPlaced = await FCM.sendCallNotifcationTo(DOCTOR_TOKEN, patientId, mobile); - // if(!isCallPlaced) - // throw 'Failed to notify target for call'; - // - // return isCallPlaced; - // } - - Future acceptCall(String caller, String receiver, {@required MediaStream localMediaStream, @required Function(MediaStream) onRemoteMediaStream, @required Function(RTCTrackEvent) onRemoteTrack}) async { - await initializeSignalR(receiver); - signalR.setContributors(caller: caller, receiver: receiver); - await signalR.acceptCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); - - peerConnection.addStream(localMediaStream); - - // peerConnection?.onTrack = (track){ - // onRemoteTrack(track); - // }; - peerConnection?.onAddStream = (MediaStream stream) { - remoteStream = stream; - onRemoteMediaStream?.call(stream); - }; - return true; - } - - - Future declineCall(String caller, String receiver) async { - await initializeSignalR(receiver); - signalR.setContributors(caller: caller, receiver: receiver); - await signalR.declineCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); - - // peerConnection.addStream(localMediaStream); - // - // peerConnection?.onAddStream = (MediaStream stream) { - // remoteStream = stream; - // onRemoteMediaStream?.call(stream); - // }; - return true; - } - - Future hangupCall(String caller, String receiver) async { - await signalR.hangupCall(caller, receiver); - dispose(); - } - - answerOffer(String sdp) async { - final offer = jsonDecode(sdp); - final caller = offer['caller']; - final receiver = offer['target']; - final offerSdp = offer['sdp']; - peerConnection.setRemoteDescription(rtcSessionDescriptionFrom(offerSdp)).then((value) { - return peerConnection.createAnswer().catchError((e){ - print(e); - }); - }).then((anwser) { - return peerConnection.setLocalDescription(anwser).catchError((e){ - print(e); - }); - }).then((value) { - return peerConnection.getLocalDescription().catchError((e){ - print(e); - }); - }).then((answer) { - return signalR.answerOffer(answer, caller, receiver).catchError((e){ - print(e); - }); - }).catchError((e) { - print(e); - }); - } - - Future hangUp(RTCVideoRenderer localVideo) async {} - - Future createSdpAnswer(String toOfferSdp) async { - final offerSdp = rtcSessionDescriptionFrom(jsonDecode(toOfferSdp)); - peerConnection.setRemoteDescription(offerSdp).catchError((e){ - print(e); - }); - - final answer = await peerConnection.createAnswer().catchError((e){ - print(e); - }); - var answerSdp = json.encode(answer); // Send SDP via Push or any channel - return answerSdp; - } - - Future createSdpOffer() async { - final offer = await peerConnection.createOffer(); - await peerConnection.setLocalDescription(offer).catchError((e){ - print(e); - }); - final map = offer.toMap(); - var offerSdp = json.encode(map); // Send SDP via Push or any channel - return offerSdp; - } - - addCandidate(String candidateJson) { - peerConnection.addCandidate(rtcIceCandidateFrom(candidateJson)).catchError((e){ - print(e); - }); - } - - void registerPeerConnectionListeners() { - peerConnection.onRenegotiationNeeded = (){ - print('Renegotiation Needed...'); - }; - - peerConnection.onIceCandidate = (RTCIceCandidate candidate) { - // print(json.encode(candidate.toMap())); - signalR.addIceCandidate(json.encode(candidate.toMap())).catchError((e){ - print(e); - }); - }; - - peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { - print('ICE gathering state changed: $state'); - }; - - peerConnection?.onConnectionState = (RTCPeerConnectionState state) { - print('Connection state change: $state'); - }; - - peerConnection?.onSignalingState = (RTCSignalingState state) { - print('Signaling state change: $state'); - }; - - - } -} - -rtcSessionDescriptionFrom(Map sdp) { - return RTCSessionDescription( - sdp['sdp'], - sdp['type'], - ); -} - -rtcIceCandidateFrom(String json) { - final map = jsonDecode(json)['candidate']; - return RTCIceCandidate(map['candidate'], map['sdpMid'], map['sdpMLineIndex']); -} +// import 'dart:convert'; +// +// import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// typedef void StreamStateCallback(MediaStream stream); +// typedef void RTCIceGatheringStateCallback(RTCIceGatheringState state); +// typedef void RTCPeerConnectionStateCallback(RTCPeerConnectionState state); +// typedef void RTCSignalingStateCallback(RTCSignalingState state); +// +// final Map constraints = { +// 'mandatory': {}, +// 'optional': [ +// {'DtlsSrtpKeyAgreement': true}, +// ] +// }; +// +// Map snapsis_ice_config = { +// 'iceServers': [ +// { "urls": 'stun:15.185.116.59:3478' }, +// { "urls": "turn:15.185.116.59:3479", "username": "admin", "credential": "admin" }, +// ], +// // 'sdpSemantics': 'unified-plan' +// }; +// Map twilio_ice_config = { +// "ice_servers": [ +// { +// "url": "stun:global.stun.twilio.com:3478?transport=udp", +// "urls": "stun:global.stun.twilio.com:3478?transport=udp" +// }, +// { +// "url": "turn:global.turn.twilio.com:3478?transport=udp", +// "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", +// "urls": "turn:global.turn.twilio.com:3478?transport=udp", +// "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" +// }, +// { +// "url": "turn:global.turn.twilio.com:3478?transport=tcp", +// "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", +// "urls": "turn:global.turn.twilio.com:3478?transport=tcp", +// "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" +// }, +// { +// "url": "turn:global.turn.twilio.com:443?transport=tcp", +// "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", +// "urls": "turn:global.turn.twilio.com:443?transport=tcp", +// "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" +// } +// ], +// // 'sdpSemantics': 'unified-plan' +// }; +// Map google_ice_config = { +// 'iceServers': [ +// { +// 'urls': [ +// 'stun:stun.l.google.com:19302', +// 'stun:stun1.l.google.com:19302', +// 'stun:stun2.l.google.com:19302', +// 'stun:stun3.l.google.com:19302' +// ] +// }, +// ], +// // 'sdpSemantics': 'unified-plan' +// }; +// Map aws_ice_config = { +// 'iceServers': [ +// {'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"}, +// {'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"} +// ], +// // 'sdpSemantics': 'unified-plan' +// }; +// +// class Signaling { +// dispose() { +// if (peerConnection != null) { +// peerConnection.dispose(); +// peerConnection.getLocalStreams().forEach((e) => e.dispose()); +// peerConnection.getRemoteStreams().forEach((e) => e.dispose()); +// } +// signalR.closeConnection(); +// } +// +// init() async{ +// // Create Peer Connection +// peerConnection = await createPeerConnection(google_ice_config, constraints); +// registerPeerConnectionListeners(); +// } +// +// initializeSignalR(String userName) async { +// 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"); +// final connected = await signalR.openConnection(); +// if (!connected) throw 'Failed to connect SignalR'; +// } +// +// Map configuration = { +// // 'iceServers': [ +// // { +// // 'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'] +// // } +// // ] +// +// 'iceServers': [ +// // {'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"}, +// // {'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"} +// // {'url': "stun:15.185.116.59:3478"}, +// // { +// // "url":"turn:15.185.116.59:3479", +// // "username": "admin", +// // "credential":"admin" +// // } +// { +// "url": "stun:global.stun.twilio.com:3478?transport=udp", +// "urls": "stun:global.stun.twilio.com:3478?transport=udp" +// }, +// { +// "url": "turn:global.turn.twilio.com:3478?transport=udp", +// "username": "f18fc347ba4aeeaa1b00f5199b1e900834b464962d434a4a89b4cdba02510047", +// "urls": "turn:global.turn.twilio.com:3478?transport=udp", +// "credential": "WX16BB+9nKm0f+Whf5EwpM8S/Yv+T2tlvQWLfdV7oqo=" +// } +// ] +// }; +// +// SignalRUtil signalR; +// +// RTCPeerConnection peerConnection; +// MediaStream localStream; +// MediaStream remoteStream; +// RTCDataChannel dataChannel; +// +// // Future call(String patientId, String mobile, {@required RTCVideoRenderer localVideo, @required RTCVideoRenderer remoteVideo}) async { +// // await initializeSignalR(patientId); +// // +// // // final isCallPlaced = await FCM.sendCallNotifcationTo(DOCTOR_TOKEN, patientId, mobile); +// // if(!isCallPlaced) +// // throw 'Failed to notify target for call'; +// // +// // return isCallPlaced; +// // } +// +// Future acceptCall(String caller, String receiver, {@required MediaStream localMediaStream, @required Function(MediaStream) onRemoteMediaStream, @required Function(RTCTrackEvent) onRemoteTrack}) async { +// await initializeSignalR(receiver); +// signalR.setContributors(caller: caller, receiver: receiver); +// await signalR.acceptCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); +// +// peerConnection.addStream(localMediaStream); +// +// // peerConnection?.onTrack = (track){ +// // onRemoteTrack(track); +// // }; +// peerConnection?.onAddStream = (MediaStream stream) { +// remoteStream = stream; +// onRemoteMediaStream?.call(stream); +// }; +// return true; +// } +// +// +// Future declineCall(String caller, String receiver) async { +// await initializeSignalR(receiver); +// signalR.setContributors(caller: caller, receiver: receiver); +// await signalR.declineCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); +// +// // peerConnection.addStream(localMediaStream); +// // +// // peerConnection?.onAddStream = (MediaStream stream) { +// // remoteStream = stream; +// // onRemoteMediaStream?.call(stream); +// // }; +// return true; +// } +// +// Future hangupCall(String caller, String receiver) async { +// await signalR.hangupCall(caller, receiver); +// dispose(); +// } +// +// answerOffer(String sdp) async { +// final offer = jsonDecode(sdp); +// final caller = offer['caller']; +// final receiver = offer['target']; +// final offerSdp = offer['sdp']; +// peerConnection.setRemoteDescription(rtcSessionDescriptionFrom(offerSdp)).then((value) { +// return peerConnection.createAnswer().catchError((e){ +// print(e); +// }); +// }).then((anwser) { +// return peerConnection.setLocalDescription(anwser).catchError((e){ +// print(e); +// }); +// }).then((value) { +// return peerConnection.getLocalDescription().catchError((e){ +// print(e); +// }); +// }).then((answer) { +// return signalR.answerOffer(answer, caller, receiver).catchError((e){ +// print(e); +// }); +// }).catchError((e) { +// print(e); +// }); +// } +// +// Future hangUp(RTCVideoRenderer localVideo) async {} +// +// Future createSdpAnswer(String toOfferSdp) async { +// final offerSdp = rtcSessionDescriptionFrom(jsonDecode(toOfferSdp)); +// peerConnection.setRemoteDescription(offerSdp).catchError((e){ +// print(e); +// }); +// +// final answer = await peerConnection.createAnswer().catchError((e){ +// print(e); +// }); +// var answerSdp = json.encode(answer); // Send SDP via Push or any channel +// return answerSdp; +// } +// +// Future createSdpOffer() async { +// final offer = await peerConnection.createOffer(); +// await peerConnection.setLocalDescription(offer).catchError((e){ +// print(e); +// }); +// final map = offer.toMap(); +// var offerSdp = json.encode(map); // Send SDP via Push or any channel +// return offerSdp; +// } +// +// addCandidate(String candidateJson) { +// peerConnection.addCandidate(rtcIceCandidateFrom(candidateJson)).catchError((e){ +// print(e); +// }); +// } +// +// void registerPeerConnectionListeners() { +// peerConnection.onRenegotiationNeeded = (){ +// print('Renegotiation Needed...'); +// }; +// +// peerConnection.onIceCandidate = (RTCIceCandidate candidate) { +// // print(json.encode(candidate.toMap())); +// signalR.addIceCandidate(json.encode(candidate.toMap())).catchError((e){ +// print(e); +// }); +// }; +// +// peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { +// print('ICE gathering state changed: $state'); +// }; +// +// peerConnection?.onConnectionState = (RTCPeerConnectionState state) { +// print('Connection state change: $state'); +// }; +// +// peerConnection?.onSignalingState = (RTCSignalingState state) { +// print('Signaling state change: $state'); +// }; +// +// +// } +// } +// +// rtcSessionDescriptionFrom(Map sdp) { +// return RTCSessionDescription( +// sdp['sdp'], +// sdp['type'], +// ); +// } +// +// rtcIceCandidateFrom(String json) { +// final map = jsonDecode(json)['candidate']; +// return RTCIceCandidate(map['candidate'], map['sdpMid'], map['sdpMLineIndex']); +// } 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/uitl/SignalRUtil.dart b/lib/uitl/SignalRUtil.dart index d9a73a14..de90981f 100644 --- a/lib/uitl/SignalRUtil.dart +++ b/lib/uitl/SignalRUtil.dart @@ -1,173 +1,173 @@ -import 'dart:convert'; -import 'dart:io'; - -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'; - -class SignalRUtil { - String hubName; - - String sourceUser; - String destinationUser; - setContributors({@required String caller, @required String receiver}){ - this.sourceUser = caller; - this.destinationUser = receiver; - } - - Function(bool) onConnected; - SignalRUtil({@required this.hubName}); - - - HubConnection connectionHub; - - closeConnection() async{ - if(connectionHub != null) { - connectionHub.off('OnIncomingCallAsync'); - connectionHub.off('OnCallDeclinedAsync'); - connectionHub.off('OnCallAcceptedAsync'); - connectionHub.off('nHangUpAsync'); - connectionHub.off('OnIceCandidateAsync'); - connectionHub.off('OnOfferAsync'); - await connectionHub.stop(); - } - } - - Future openConnection() async { - 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)); - - connectionHub.on('ReceiveMessage', (message) { - handleIncomingMessage(message); - }); - - return getConnectionState(); - } - - void handleIncomingMessage(List message) { - print(message.toString()); - } - - void sendMessage(List args) async { - await connectionHub.invoke('SendMessage', args: args); //['Bob', 'Says hi!'] - } - - listen({Function(CallUser) onAcceptCall, Function(CallUser) onHangupCall, Function(String, CallUser) onDeclineCall, Function(String, CallUser) onOffer, Function(String) onCandidate}){ - - connectionHub.on('OnIncomingCallAsync', (arguments) { - print('OnIncomingCallAsync: ${arguments.toString()}'); - }); - - connectionHub.on('OnCallDeclinedAsync', (arguments) { - print('OnCallDeclinedAsync: ${arguments.toString()}'); - onDeclineCall(arguments.first, CallUser.from(arguments.last)); - }); - - connectionHub.on('OnCallAcceptedAsync', (arguments) { - print('OnCallAcceptedAsync: ${arguments.toString()}'); - }); - - connectionHub.on('OnHangUpAsync', (arguments) { - print('nHangUpAsync: ${arguments.toString()}'); - onHangupCall(CallUser.from(arguments.first)); - }); - - connectionHub.on('OnIceCandidateAsync', (arguments) { - print('OnIceCandidateAsync: ${arguments.toString()}'); - onCandidate(arguments.first); - }); - - connectionHub.on('OnOfferAsync', (arguments) { - print('OnOfferAsync: ${arguments.toString()}'); - onOffer(arguments.first, CallUser.from(arguments.last)); - }); - - } - - // CallUserAsync(string currentUserId, string targerUserId) - Future callUser(String from, to) async{ - return await connectionHub.invoke('CallUserAsync', args: [from, to]); - } - - // CallDeclinedAsync(string currentUserId, string targerUserId) - Future declineCall(String from, to) async{ - return await connectionHub.invoke('CallDeclinedAsync', args: [from, to]); - } - - // AnswerCallAsync(string currentUserId, string targetUserId) - Future answerCall(String from, to) async{ - return await connectionHub.invoke('AnswerCallAsync', args: [from, to]); - } - - // IceCandidateAsync(string targetUserId, string candidate) - Future addIceCandidate(String candidate) async{ - final target = destinationUser; - return await connectionHub.invoke('IceCandidateAsync', args: [target, candidate]); - } - - // OfferAsync(string targetUserId,string currentUserId, string targetOffer) - Future offer(String from, to, offer) async{ - return await connectionHub.invoke('OfferAsync', args: [from, to, offer]); - } - - // AnswerOfferAsync(string targetUserId, string CallerOffer) - Future answerOffer(RTCSessionDescription answerSdp, caller, receiver) async{ - final payload = { - 'target': receiver, - 'caller': caller, - 'sdp': answerSdp.toMap(), - }; - return await connectionHub.invoke('AnswerOfferAsync', args: [caller, jsonEncode(payload)]); - } - - // HangUpAsync(string currentUserId, string targetUserId) - Future hangupCall(String from, to) async{ - return await connectionHub.invoke('HangUpAsync', args: [from, to]); - } - - // CallAccepted(string currentUserId,string targetUserId) - Future acceptCall(String from, to) async{ - // return await connectionHub.send(methodName: 'CallAccepted', args: [from, to]); - return await connectionHub.invoke("CallAccepted", args: [ from, to]); - } - - - bool getConnectionState() { - if (connectionHub.state == HubConnectionState.connected) return true; - if (connectionHub.state == HubConnectionState.disconnected) return false; - return false; - } -} - - -class CallUser{ - String Id; - String UserName; - String Email; - String Phone; - String Title; - dynamic UserStatus; - String Image; - int UnreadMessageCount = 0; - - CallUser.from(Map map){ - Id = map['Id']; - UserName = map['UserName']; - Email = map['Email']; - Phone = map['Phone']; - Title = map['Title']; - UserStatus = map['UserStatus']; - Image = map['Image']; - UnreadMessageCount = map['UnreadMessageCount']; - } -} \ No newline at end of file +// import 'dart:convert'; +// import 'dart:io'; +// +// 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'; +// +// class SignalRUtil { +// String hubName; +// +// String sourceUser; +// String destinationUser; +// setContributors({@required String caller, @required String receiver}){ +// this.sourceUser = caller; +// this.destinationUser = receiver; +// } +// +// Function(bool) onConnected; +// SignalRUtil({@required this.hubName}); +// +// +// HubConnection connectionHub; +// +// closeConnection() async{ +// if(connectionHub != null) { +// connectionHub.off('OnIncomingCallAsync'); +// connectionHub.off('OnCallDeclinedAsync'); +// connectionHub.off('OnCallAcceptedAsync'); +// connectionHub.off('nHangUpAsync'); +// connectionHub.off('OnIceCandidateAsync'); +// connectionHub.off('OnOfferAsync'); +// await connectionHub.stop(); +// } +// } +// +// Future openConnection() async { +// 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)); +// +// connectionHub.on('ReceiveMessage', (message) { +// handleIncomingMessage(message); +// }); +// +// return getConnectionState(); +// } +// +// void handleIncomingMessage(List message) { +// print(message.toString()); +// } +// +// void sendMessage(List args) async { +// await connectionHub.invoke('SendMessage', args: args); //['Bob', 'Says hi!'] +// } +// +// listen({Function(CallUser) onAcceptCall, Function(CallUser) onHangupCall, Function(String, CallUser) onDeclineCall, Function(String, CallUser) onOffer, Function(String) onCandidate}){ +// +// connectionHub.on('OnIncomingCallAsync', (arguments) { +// print('OnIncomingCallAsync: ${arguments.toString()}'); +// }); +// +// connectionHub.on('OnCallDeclinedAsync', (arguments) { +// print('OnCallDeclinedAsync: ${arguments.toString()}'); +// onDeclineCall(arguments.first, CallUser.from(arguments.last)); +// }); +// +// connectionHub.on('OnCallAcceptedAsync', (arguments) { +// print('OnCallAcceptedAsync: ${arguments.toString()}'); +// }); +// +// connectionHub.on('OnHangUpAsync', (arguments) { +// print('nHangUpAsync: ${arguments.toString()}'); +// onHangupCall(CallUser.from(arguments.first)); +// }); +// +// connectionHub.on('OnIceCandidateAsync', (arguments) { +// print('OnIceCandidateAsync: ${arguments.toString()}'); +// onCandidate(arguments.first); +// }); +// +// connectionHub.on('OnOfferAsync', (arguments) { +// print('OnOfferAsync: ${arguments.toString()}'); +// onOffer(arguments.first, CallUser.from(arguments.last)); +// }); +// +// } +// +// // CallUserAsync(string currentUserId, string targerUserId) +// Future callUser(String from, to) async{ +// return await connectionHub.invoke('CallUserAsync', args: [from, to]); +// } +// +// // CallDeclinedAsync(string currentUserId, string targerUserId) +// Future declineCall(String from, to) async{ +// return await connectionHub.invoke('CallDeclinedAsync', args: [from, to]); +// } +// +// // AnswerCallAsync(string currentUserId, string targetUserId) +// Future answerCall(String from, to) async{ +// return await connectionHub.invoke('AnswerCallAsync', args: [from, to]); +// } +// +// // IceCandidateAsync(string targetUserId, string candidate) +// Future addIceCandidate(String candidate) async{ +// final target = destinationUser; +// return await connectionHub.invoke('IceCandidateAsync', args: [target, candidate]); +// } +// +// // OfferAsync(string targetUserId,string currentUserId, string targetOffer) +// Future offer(String from, to, offer) async{ +// return await connectionHub.invoke('OfferAsync', args: [from, to, offer]); +// } +// +// // AnswerOfferAsync(string targetUserId, string CallerOffer) +// Future answerOffer(RTCSessionDescription answerSdp, caller, receiver) async{ +// final payload = { +// 'target': receiver, +// 'caller': caller, +// 'sdp': answerSdp.toMap(), +// }; +// return await connectionHub.invoke('AnswerOfferAsync', args: [caller, jsonEncode(payload)]); +// } +// +// // HangUpAsync(string currentUserId, string targetUserId) +// Future hangupCall(String from, to) async{ +// return await connectionHub.invoke('HangUpAsync', args: [from, to]); +// } +// +// // CallAccepted(string currentUserId,string targetUserId) +// Future acceptCall(String from, to) async{ +// // return await connectionHub.send(methodName: 'CallAccepted', args: [from, to]); +// return await connectionHub.invoke("CallAccepted", args: [ from, to]); +// } +// +// +// bool getConnectionState() { +// if (connectionHub.state == HubConnectionState.connected) return true; +// if (connectionHub.state == HubConnectionState.disconnected) return false; +// return false; +// } +// } +// +// +// class CallUser{ +// String Id; +// String UserName; +// String Email; +// String Phone; +// String Title; +// dynamic UserStatus; +// String Image; +// int UnreadMessageCount = 0; +// +// CallUser.from(Map map){ +// Id = map['Id']; +// UserName = map['UserName']; +// Email = map['Email']; +// Phone = map['Phone']; +// Title = map['Title']; +// UserStatus = map['UserStatus']; +// Image = map['Image']; +// UnreadMessageCount = map['UnreadMessageCount']; +// } +// } \ No newline at end of file diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a9a4b4bb..534b0540 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2896,6 +2896,7 @@ class TranslationBase { 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]; } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index debf1656..4ae60764 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -454,10 +454,10 @@ 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'); + // Navigator.push(context, FadePage(page: CallPage())); + // GifLoaderDialogUtils.showMyDialog(context); + // HMGNetworkConnectivity(context).start(); + // locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); }, child: Row( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e91990b4..f38ad57c 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/pubspec.yaml b/pubspec.yaml index 1c7c9b15..c19788d3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -95,7 +95,7 @@ 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 @@ -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,17 +191,17 @@ 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 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_otp_auto_verify: ^2.1.0 From b92e45aa93459cad96be1915286aa2f75580c9eb Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 7 Aug 2023 09:52:49 +0300 Subject: [PATCH 21/49] Updates & fixes --- lib/config/config.dart | 14 +- lib/config/localized_values.dart | 1 + .../admission_status_for_sick_leave.dart | 64 +++++ lib/core/service/medical/labs_service.dart | 18 ++ lib/extensions/string_extensions.dart | 16 +- .../livecare/widgets/LiveCareHistoryCard.dart | 1 + .../medical/patient_sick_leave_page.dart | 64 ++++- .../sickleave_workplace_update_page.dart | 2 +- .../appointment_services/GetDoctorsList.dart | 68 +++--- lib/uitl/LocalNotification.dart | 229 +++++++++--------- lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 5 + lib/widgets/drawer/app_drawer_widget.dart | 66 ++++- pubspec.yaml | 47 ++-- 14 files changed, 400 insertions(+), 196 deletions(-) create mode 100644 lib/core/model/sick_leave/admission_status_for_sick_leave.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 0fad39b1..73b647bf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -19,9 +19,9 @@ var PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; - // var BASE_URL = 'http://10.50.100.198:2018/'; - // var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'http://10.50.100.198:2018/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -88,6 +88,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'; @@ -324,7 +325,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.6; +var VERSION_ID = 10.7; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; @@ -597,7 +598,10 @@ 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'; class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a69002f6..2336430b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1889,4 +1889,5 @@ const Map localizedValues = { "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": "لا يمكنك تفعيل هذه الإجازة المرضية لأنك مريض مقبل."}, }; \ 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/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 078703df..714ebcb1 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -153,6 +153,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(); diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 6ba96b08..df9cb4f6 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,7 +1,19 @@ -extension CapExtension on String { +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.isNotEmpty ? str.inCaps: str).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/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index 9e08af05..cf89b766 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -243,6 +243,7 @@ class _LiveCareHistoryCardState extends State { GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err.toString()); print(err); }); diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 3d977a96..a82ff6b3 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,56 @@ 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) { + GifLoaderDialogUtils.hideDialog(context); + 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); + } + }).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/sickleave_workplace_update_page.dart b/lib/pages/medical/sickleave_workplace_update_page.dart index 517f251c..60d9ef54 100644 --- a/lib/pages/medical/sickleave_workplace_update_page.dart +++ b/lib/pages/medical/sickleave_workplace_update_page.dart @@ -145,7 +145,7 @@ class _WorkplaceUpdatePageState extends State { keyboardType: TextInputType.name, controller: _controller, inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp("[a-zA-Zء-ي ]")), + projectViewModel.isArabic ? FilteringTextInputFormatter.allow(RegExp("[ء-ي ]")) : FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]")), ], onChanged: (value) => {_onPassportTextChanged(value)}, style: TextStyle( diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index effa4445..51471790 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1757,41 +1757,45 @@ class DoctorsListService extends BaseService { 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; - - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); - requestFreeSlots = { - "DoctorID": docID, - "IsBookingForLiveCare": 0, - "ClinicID": clinicID, - "ProjectID": projectID, - "OriginalClinicID": clinicID, - "days": 0, - "isReschadual": false, - "VersionID": req.VersionID, - "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "generalid": "Cs2020@2016\$2958", - "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, - "SessionID": null, - "isDentalAllowedBackend": false, - "DeviceTypeID": 1 - }; - - request = { + Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel projectViewModel]) async { + Map requestFreeSlots; + Map request; + + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + requestFreeSlots = { + "DoctorID": docID, + "IsBookingForLiveCare": 0, "ClinicID": clinicID, "ProjectID": projectID, - "AppointmentNo":appoNumber, - "DoctorFreeSlotRequest":requestFreeSlots, - "DoctorFreeSlotResponse":selectedfreeSlots, - "Value1":docID - }; + "OriginalClinicID": clinicID, + "days": 0, + "isReschadual": false, + "VersionID": req.VersionID, + "Channel": 3, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "generalid": "Cs2020@2016\$2958", + "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, + "SessionID": null, + "isDentalAllowedBackend": false, + "DeviceTypeID": 1 + }; + + request = {"ClinicID": clinicID, "ProjectID": projectID, "AppointmentNo": appoNumber, "DoctorFreeSlotRequest": requestFreeSlots, "DoctorFreeSlotResponse": selectedfreeSlots, "Value1": docID}; dynamic localRes; await baseAppClient.post(INSERT_FREE_SLOTS_LOGS, onSuccess: (response, statusCode) async { localRes = response; @@ -1801,6 +1805,4 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - - } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index af0db957..d7afaa90 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -35,39 +35,38 @@ class LocalNotification { var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); await flutterLocalNotificationsPlugin.initialize( initializationSettings, - onDidReceiveNotificationResponse: - (NotificationResponse notificationResponse) { + onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { switch (notificationResponse.notificationResponseType) { case NotificationResponseType.selectedNotification: - // selectNotificationStream.add(notificationResponse.payload); + // selectNotificationStream.add(notificationResponse.payload); break; case NotificationResponseType.selectedNotificationAction: - // if (notificationResponse.actionId == navigationActionId) { - // selectNotificationStream.add(notificationResponse.payload); - // } + // 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; - // },} - // - // , - // - // ); -} + } 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 @@ -76,110 +75,106 @@ class LocalNotification { ' payload: ${notificationResponse.payload}'); if (notificationResponse.input?.isNotEmpty ?? false) { // ignore: avoid_print - print( - 'notification action tapped with input: ${notificationResponse.input}'); + print('notification action tapped with input: ${notificationResponse.input}'); } } -var _random = new Random(); + var _random = new Random(); -_randomNumber({int from = 100000}) { - return _random.nextInt(from); -} + _randomNumber({int from = 100000}) { + return _random.nextInt(from); + } -_vibrationPattern() { - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; + _vibrationPattern() { + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; - return vibrationPattern; -} + return vibrationPattern; + } -Future showNow({@required String title, @required String subtitle, String payload}) { - 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 = DarwinNotificationDetails(); - var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { - print(err); + Future showNow({@required String title, @required String subtitle, String payload}) { + 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 = DarwinNotificationDetails(); + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { + print(err); + }); }); - }); -} + } -Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { - ///vibrationPattern - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; - - var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', - channelDescription: 'ActivePrescriptionsDescription', - // icon: 'secondary_icon', - sound: RawResourceAndroidNotificationSound('slow_spring_board'), - - ///change it to be as ionic - // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic - vibrationPattern: vibrationPattern, - enableLights: true, - color: const Color.fromARGB(255, 255, 0, 0), - ledColor: const Color.fromARGB(255, 255, 0, 0), - ledOnMs: 1000, - ledOffMs: 500); - 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); -} + Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { + ///vibrationPattern + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', + channelDescription: 'ActivePrescriptionsDescription', + // icon: 'secondary_icon', + sound: RawResourceAndroidNotificationSound('slow_spring_board'), + + ///change it to be as ionic + // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic + vibrationPattern: vibrationPattern, + enableLights: true, + color: const Color.fromARGB(255, 255, 0, 0), + ledColor: const Color.fromARGB(255, 255, 0, 0), + ledOnMs: 1000, + ledOffMs: 500); + 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); + } -///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 = DarwinNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showDailyAtTime( - // 0, - // 'show daily title', - // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // time, - // platformChannelSpecifics); -} + ///Repeat notification 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 = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showDailyAtTime( + // 0, + // 'show daily title', + // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // time, + // platformChannelSpecifics); + } -///Repeat notification weekly on Monday at approximately 10:00:00 am -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 = DarwinNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( - // 0, - // 'show weekly title', - // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // Day.Monday, - // time, - // platformChannelSpecifics); -} + ///Repeat notification weekly on Monday at approximately 10:00:00 am + 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 = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( + // 0, + // 'show weekly title', + // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // Day.Monday, + // time, + // platformChannelSpecifics); + } -String _toTwoDigitString(int value) { - return value.toString().padLeft(2, '0'); -} + String _toTwoDigitString(int value) { + return value.toString().padLeft(2, '0'); + } -Future cancelNotification() async { - await flutterLocalNotificationsPlugin.cancel(0); -} + Future cancelNotification() async { + await flutterLocalNotificationsPlugin.cancel(0); + } -Future cancelAllNotifications() async { - await flutterLocalNotificationsPlugin.cancelAll(); -}} + Future cancelAllNotifications() async { + await flutterLocalNotificationsPlugin.cancelAll(); + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 534b0540..5f2d0f3f 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2897,6 +2897,7 @@ class TranslationBase { 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]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 001baf50..ece5613d 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -809,6 +809,11 @@ class Utils { static String generateMd5Hash(String input) { return crypto.md5.convert(utf8.encode(input)).toString(); } + + 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/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 4ae60764..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())); + 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); - // HMGNetworkConnectivity(context).start(); - // locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); + // 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/pubspec.yaml b/pubspec.yaml index c19788d3..c4265c47 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.022+4050022 +version: 4.5.024+4050024 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 @@ -175,7 +175,7 @@ dependencies: geofencing: ^0.1.0 speech_to_text: ^6.1.1 -# path: speech_to_text + # 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,28 +191,31 @@ 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 + # 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 + provider: ^5.0.0 + # permission_handler : ^10.2.0 flutter_svg: ^1.0.0 # firebase_messaging_platform_interface: any # flutter_inappwebview: 5.7.2+3 From 657248803f74e43c58a2b599d1468a9acb0aec93 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 8 Aug 2023 17:54:04 +0300 Subject: [PATCH 22/49] Ask doc disabled for LiveCare appointments --- lib/pages/MyAppointments/widgets/AppointmentActions.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 63ad920b..6924cb63 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -72,7 +72,7 @@ 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"); return InkWell( onTap: shouldEnable ? null From 9b3c07d3b11349500a1eb34a05bed51178b3d808 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 9 Aug 2023 11:32:08 +0300 Subject: [PATCH 23/49] Added AED in advance payment --- lib/config/localized_values.dart | 1 + lib/core/model/hospitals/hospitals_model.dart | 2 +- lib/pages/Blood/confirm_payment_page.dart | 2 +- lib/pages/medical/balance/confirm_payment_page.dart | 7 ++++++- lib/uitl/translations_delegate_base.dart | 2 ++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2336430b..80237255 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -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": " تأكيد العنوان "}, 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/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index 4b3f96e2..149d1a33 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -84,7 +84,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/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 7c562b43..b3b29384 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -24,6 +24,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; + // import 'package:pay/pay.dart'; import 'package:provider/provider.dart'; @@ -52,6 +53,7 @@ class _ConfirmPaymentPageState extends State { String tamaraPaymentStatus; String tamaraOrderID; + // Pay _payClient; @override @@ -137,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/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 5f2d0f3f..04c85504 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]; From a17b941c63d97e9d0c45e4dcb9c3897aa395f7c6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 9 Aug 2023 15:28:05 +0300 Subject: [PATCH 24/49] InPatient Medical Report continued --- lib/config/localized_values.dart | 2 + .../reports/admission_for_medical_report.dart | 228 ++++++++++++++++++ lib/core/service/medical/reports_service.dart | 45 +++- .../medical/reports_view_model.dart | 83 +++++-- .../inpatient_medical_reports_page.dart | 132 ++++++++++ .../medical/reports/report_home_page.dart | 130 +++++++++- .../medical/reports/report_list_widget.dart | 4 +- lib/uitl/translations_delegate_base.dart | 2 + 8 files changed, 594 insertions(+), 32 deletions(-) create mode 100644 lib/core/model/reports/admission_for_medical_report.dart create mode 100644 lib/pages/medical/reports/inpatient_medical_reports_page.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 80237255..4984053d 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1891,4 +1891,6 @@ const Map localizedValues = { "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": "يرجى تحديد أحد حالات القبول من الأسفل لعرض التقارير الطبية:"}, }; \ No newline at end of file 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/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index a496c6df..9281c51c 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -1,12 +1,17 @@ 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, projectID: 0); @@ -23,13 +28,27 @@ class ReportsService extends BaseService { }, body: _requestReports.toJson()); } + Future getInPatientReports() async { + RequestReports _requestReportsInpatient = RequestReports(isReport: true, encounterType: 1, requestType: 2, 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 { hasError = false; await baseAppClient.post(GET_INPATIENT_ADMISSIONS, onSuccess: (dynamic response, int statusCode) { - reportsList.clear(); + admissionsMedicalReport.clear(); print(response['AdmissionsForMedicalReport']); response['AdmissionsForMedicalReport'].forEach((reports) { - // reportsList.add(Reports.fromJson(reports)); + admissionsMedicalReport.add(AdmissionMedicalReport.fromJson(reports)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -105,6 +124,28 @@ class ReportsService extends BaseService { }, body: body); } + 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'] = 2; + 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; diff --git a/lib/core/viewModels/medical/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index 544ead18..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) { @@ -38,6 +42,21 @@ class ReportsViewModel extends BaseViewModel { } } + 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); + } + } + getPatentAppointmentHistory() async { setState(ViewState.Busy); await _reportsService.getPatentAppointmentHistory(); @@ -49,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) { @@ -58,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; @@ -69,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/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 375bbb8c..3a902332 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'; @@ -28,9 +35,6 @@ class _HomeReportPageState extends State with SingleTickerProvid @override void initState() { _tabController_new = TabController(length: 2, vsync: this); - WidgetsBinding.instance.addPostFrameCallback((_) { - getInPatientAdmissionList(); - }); super.initState(); } @@ -50,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, @@ -87,11 +93,11 @@ class _HomeReportPageState extends State with SingleTickerProvid }, tabs: [ Text( - TranslationBase.of(context).inPatient, + TranslationBase.of(context).outpatient, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), Text( - TranslationBase.of(context).outpatient, + TranslationBase.of(context).inPatient, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), ], @@ -102,7 +108,6 @@ class _HomeReportPageState extends State with SingleTickerProvid physics: BouncingScrollPhysics(), controller: _tabController_new, children: [ - Container(), Container( child: Column( children: [ @@ -129,11 +134,118 @@ class _HomeReportPageState extends State with SingleTickerProvid ) ], ), + ), + // 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 == 1) + if (projectViewModel.havePrivilege(21) && _tabController_new.index == 0) Padding( padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: DefaultButton( @@ -193,6 +305,4 @@ class _HomeReportPageState extends State with SingleTickerProvid ), ); } - - void getInPatientAdmissionList() {} } diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index e47b8244..5c62de22 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -91,8 +91,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, diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 04c85504..8d8f51ee 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2900,6 +2900,8 @@ class TranslationBase { 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]; } From 44d8f0efe23ca8d128f51b79aafb1d1f9679ad95 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 10 Aug 2023 10:28:53 +0300 Subject: [PATCH 25/49] InPatient medical report contd. --- lib/core/service/medical/reports_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index 9281c51c..f3938992 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -29,7 +29,7 @@ class ReportsService extends BaseService { } Future getInPatientReports() async { - RequestReports _requestReportsInpatient = RequestReports(isReport: true, encounterType: 1, requestType: 2, patientOutSA: 0, projectID: 0); + RequestReports _requestReportsInpatient = RequestReports(isReport: true, encounterType: 2, requestType: 2, patientOutSA: 0, projectID: 0); hasError = false; await baseAppClient.post(REPORTS, onSuccess: (dynamic response, int statusCode) { inpatientReportsList.clear(); From e4e3377c5c61adcd26bfa9ca4d6416a57f9f00e6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 13 Aug 2023 10:56:55 +0300 Subject: [PATCH 26/49] update --- lib/core/service/medical/reports_service.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index f3938992..f9a0041c 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -43,6 +43,8 @@ class ReportsService extends BaseService { } 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(); @@ -53,7 +55,7 @@ class ReportsService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _requestReports.toJson()); + }, body: body); } Future getPatentAppointmentHistory() async { From 2455f48fe1ce68e94fd5dad6e521cd8e6ab3a885 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 15 Aug 2023 10:03:18 +0300 Subject: [PATCH 27/49] View medical report done --- lib/config/config.dart | 1 + lib/core/service/medical/reports_service.dart | 30 +++++++++++ .../medical/reports/report_list_widget.dart | 54 +++++++++++++++++-- pubspec.yaml | 2 + 4 files changed, 83 insertions(+), 4 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 73b647bf..17840c50 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -184,6 +184,7 @@ 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'; diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index f9a0041c..9f8bfb45 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -177,4 +177,34 @@ class ReportsService extends BaseService { }, 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; + 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(GET_MEDICAL_REPORT_PDF, onSuccess: (dynamic res, int statusCode) { + response = res; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return response; + } } diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 5c62de22..016fad79 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -1,3 +1,7 @@ +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'; @@ -14,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_file/open_file.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -111,10 +117,22 @@ class ReportListWidget extends StatelessWidget { if (reportList[index].status == 2) Row( children: [ - 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)), + 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), @@ -155,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"); + OpenFile.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(); @@ -169,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/pubspec.yaml b/pubspec.yaml index c4265c47..c7bbbdf2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -207,6 +207,8 @@ dependencies: sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 google_api_availability: ^3.0.1 + open_file: ^3.2.1 + path_provider: ^2.0.8 # flutter_callkit_incoming: ^1.0.3+3 # firebase_core: 1.12.0 From 7c68779324dc93392106a08dd2ad0176a10d97a0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 17 Aug 2023 00:03:18 +0300 Subject: [PATCH 28/49] Nphies integration --- lib/config/config.dart | 3 + lib/pages/BookAppointment/BookConfirm.dart | 56 +++++++++++++++++-- lib/pages/ToDoList/ToDo.dart | 55 +++++++++++++++++- .../insurance/UpdateInsuranceManually.dart | 1 + .../appointment_services/GetDoctorsList.dart | 26 +++++++++ lib/widgets/dialogs/confirm_dialog.dart | 7 ++- .../dialogs/radio_selection_dialog.dart | 47 ++++++++++++++-- 7 files changed, 182 insertions(+), 13 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 17840c50..091acb7b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -604,6 +604,9 @@ 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/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 473c8650..4214b01c 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'; @@ -271,7 +274,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, res['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 +331,13 @@ 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); - getToDoCount(); + checkPatientNphiesEligibility(docObject, res['AppointmentNo'], context); }); - 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"); } }); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index d8eeded9..d3705a7c 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'; @@ -540,7 +543,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { confirmAppointment(appo); break; case 20: - getPatientShare(context, appo); + // getPatientShare(context, appo); + checkPatientNphiesEligibility(context, appo); break; case 30: getAppoQR(context, appo); @@ -837,6 +841,53 @@ 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) { DoctorsListService service = new DoctorsListService(); if (appo.isLiveCareAppointment) { @@ -1119,7 +1170,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { error_type: res['Response_Message']); } }).catchError((err) { - if(mounted) GifLoaderDialogUtils.hideDialog(context); + if (mounted) GifLoaderDialogUtils.hideDialog(context); print(err); }); } diff --git a/lib/pages/insurance/UpdateInsuranceManually.dart b/lib/pages/insurance/UpdateInsuranceManually.dart index 32378aa0..d1a74d11 100644 --- a/lib/pages/insurance/UpdateInsuranceManually.dart +++ b/lib/pages/insurance/UpdateInsuranceManually.dart @@ -193,6 +193,7 @@ class _UpdateInsuranceManuallyState extends State { listData: list, selectedIndex: _selectedInsuranceCompanyIndex, isScrollable: true, + isShowSearch: true, onValueSelected: (index) { _selectedInsuranceCompanyIndex = index; selectedInsuranceCompanyObj = insuranceCompaniesList[index]; diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 51471790..9fa1ac3c 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1757,6 +1757,32 @@ 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}; 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..b6380a3c 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) { @@ -69,6 +82,32 @@ class RadioSelectionDialogState extends State { 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, @@ -80,7 +119,7 @@ class RadioSelectionDialogState extends State { return InkWell( onTap: () { setState(() { - selectedIndex = widget.listData[index].value; + selectedIndex = tempListData[index].value; }); }, child: Row( @@ -90,7 +129,7 @@ class RadioSelectionDialogState extends State { width: 22, height: 22, child: Radio( - value: widget.listData[index].value, + value: tempListData[index].value, groupValue: selectedIndex, onChanged: (value) { setState(() { @@ -102,7 +141,7 @@ class RadioSelectionDialogState extends State { SizedBox(width: 8), Expanded( child: Text( - widget.listData[index].title, + tempListData[index].title, // maxLines: 2, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), ), From 965df3325370736ef24793cb96d2c1cb3441a983 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 17 Aug 2023 10:02:09 +0300 Subject: [PATCH 29/49] Appointment actions fixes --- lib/pages/MyAppointments/widgets/AppointmentActions.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 6924cb63..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) || (widget.appo.isLiveCareAppointment && appoButtonsList[index].caller == "askDoc") || 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 From c58e180c9114e23bc31d8cb4718a97158a4321ca Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 17 Aug 2023 17:50:16 +0300 Subject: [PATCH 30/49] Updates --- lib/config/config.dart | 2 +- lib/pages/BookAppointment/BookConfirm.dart | 5 ++++- lib/pages/insurance/insurance_card_screen.dart | 13 +++++-------- lib/widgets/in_app_browser/InAppBrowser.dart | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 091acb7b..e93af7c8 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -326,7 +326,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.7; +var VERSION_ID = 10.8; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 4214b01c..0405f657 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -278,7 +278,7 @@ class _BookConfirmState extends State { widget.service.checkPatientNphiesEligibility(docObject.projectID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res["isNphiesMatchedWithVida"]) { - getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); + getPatientShare(context, appointmentNo, docObject.clinicID, docObject.projectID, docObject); getToDoCount(); } else { ConfirmDialog dialog = new ConfirmDialog( @@ -332,6 +332,8 @@ class _BookConfirmState extends State { Future.delayed(new Duration(milliseconds: 500), () { checkPatientNphiesEligibility(docObject, res['AppointmentNo'], context); + // getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); + // getToDoCount(); }); widget.service.logDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, decodedLogs, res['AppointmentNo'], context).then((res) { @@ -435,6 +437,7 @@ class _BookConfirmState extends State { } getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { + GifLoaderDialogUtils.showMyDialog(context); widget.service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { projectViewModel.selectedBodyPartList.clear(); projectViewModel.laserSelectionDuration = 0; 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/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f38ad57c..28a364e5 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -35,9 +35,9 @@ class MyInAppBrowser extends InAppBrowser { // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS From 2bf8d454f56f7f6713a81e262644d4212bfff179 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 20 Aug 2023 09:33:06 +0300 Subject: [PATCH 31/49] updates --- lib/pages/insurance/insurance_card_update_details.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index 71637051..3fb1c19d 100644 --- a/lib/pages/insurance/insurance_card_update_details.dart +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -53,8 +53,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 +228,6 @@ class InsuranceCardUpdateDetails extends StatelessWidget { children: [ Container( child: Container( - decoration: cardRadius(12), child: Container( width: MediaQuery.of(context).size.width, @@ -324,7 +322,6 @@ class InsuranceCardUpdateDetails extends StatelessWidget { AppToast.showErrorToast(message: err.toString()); print(err); }); - }, ), if (insuranceCardDetailsModel.isNotEmpty) From 7702960bb56e1e89079dd15bf7f814b39223aaff Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 21 Aug 2023 13:04:39 +0300 Subject: [PATCH 32/49] InPatient medical report & view medical report commented out --- .../medical/reports_view_model.dart | 2 +- .../medical/reports/report_home_page.dart | 349 +++++++++--------- .../medical/reports/report_list_widget.dart | 34 +- 3 files changed, 194 insertions(+), 191 deletions(-) diff --git a/lib/core/viewModels/medical/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index 8f55b3b7..7fb4cf93 100644 --- a/lib/core/viewModels/medical/reports_view_model.dart +++ b/lib/core/viewModels/medical/reports_view_model.dart @@ -37,7 +37,7 @@ class ReportsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); - await _reportsService.getInpatientAdmissionsList(); + // await _reportsService.getInpatientAdmissionsList(); setState(ViewState.Idle); } } diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 3a902332..a520b956 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -28,20 +28,20 @@ class HomeReportPage extends StatefulWidget { } class _HomeReportPageState extends State with SingleTickerProviderStateMixin { - TabController _tabController_new; + // TabController _tabController_new; List imagesInfo = List(); int _currentPage = 0; @override void initState() { - _tabController_new = TabController(length: 2, vsync: this); + // _tabController_new = TabController(length: 2, vsync: this); super.initState(); } @override void dispose() { super.dispose(); - _tabController_new.dispose(); + // _tabController_new.dispose(); } @override @@ -70,182 +70,185 @@ class _HomeReportPageState extends State with SingleTickerProvid 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, - ), - 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'), - ), - ], - ), + // 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, + // ), + // 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 (model.user != null) Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController_new, - children: [ + 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), - ], - ), - ) - ], + 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), + ], + ), ), - ), - // 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), - ) - ], + 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 (projectViewModel.havePrivilege(21) + // && _tabController_new.index == 0 + ) Padding( padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: DefaultButton( diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 016fad79..b8b457de 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -117,23 +117,23 @@ class ReportListWidget extends StatelessWidget { if (reportList[index].status == 2) 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)), - ), - ), + // 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), From e64a91855f60e715bb729849876b2c53a651f067 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 21 Aug 2023 16:41:38 +0300 Subject: [PATCH 33/49] fixes --- lib/pages/medical/reports/reports_page.dart | 4 +- .../dialogs/radio_selection_dialog.dart | 231 +++++++++--------- 2 files changed, 121 insertions(+), 114 deletions(-) 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/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index b6380a3c..dc460009 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -50,126 +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), - ), - 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), - ), + IconButton( + padding: EdgeInsets.zero, + icon: Icon(Icons.close), + color: Color(0xff2B353E), + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + ) + ], ), - ) : 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, - 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(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( - tempListData[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), + ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), ), ); From 75685b1f614d7870bb18dc938a0cf7ca3ae1faec Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 22 Aug 2023 11:19:42 +0300 Subject: [PATCH 34/49] Project selection added in Laser & advance payment --- lib/core/service/hospital_service.dart | 3 ++- .../medical/my_balance_view_model.dart | 4 ++-- .../ancillaryOrdersDetails.dart | 11 +++++++++++ .../components/SearchByClinic.dart | 17 ++++++++++------- .../medical/balance/advance_payment_page.dart | 6 +++--- lib/pages/medical/patient_sick_leave_page.dart | 13 +++++++++---- 6 files changed, 37 insertions(+), 17 deletions(-) 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/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/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 1dd34876..da5ce04a 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -57,6 +57,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); @@ -64,6 +74,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/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 891d01cb..2d5d514d 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -240,11 +240,10 @@ 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); + if (!nearestAppo) getDoctorsList(context); } else {} }); projectViewModel.analytics.appointment.book_appointment_select_clinic(appointment_type: 'regular', clinic: clincs.clinicDescription); @@ -333,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())); + } else { + getDoctorsList(context); + } }); }, ), @@ -458,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; } @@ -531,8 +534,8 @@ class _SearchByClinicState extends State { searchInfo.clinic = selectedClinic; searchInfo.date = DateTime.now(); - if(projectViewModel.isLogin) { - if(projectViewModel.user.age > 12) { + if (projectViewModel.isLogin) { + if (projectViewModel.user.age > 12) { navigateToDentalComplaints(context, searchInfo); } else { callDoctorsSearchAPI(17); 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/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index a82ff6b3..479b5fe6 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -131,11 +131,16 @@ class _PatientSickLeavePageState extends State { GifLoaderDialogUtils.showMyDialog(context); service.getSickLeaveStatusByAdmissionNo(model.sickLeaveList[index].projectID, model.sickLeaveList[index].admissionNo).then((res) { + print(res); GifLoaderDialogUtils.hideDialog(context); - if (res["List_GetSickLeaveStatusByAdmissionNo"].length != 0) { - admissionStatusForSickLeave = AdmissionStatusForSickLeave.fromJson(res["List_GetSickLeaveStatusByAdmissionNo"][0]); - if (admissionStatusForSickLeave.status != 6) { - AppToast.showErrorToast(message: TranslationBase.of(context).sickLeaveAdmittedPatient); + 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); } From 6b121e7f395470ad418e026f381b41c950df9501 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 22 Aug 2023 15:28:38 +0300 Subject: [PATCH 35/49] Store build version 4.5.026 --- lib/config/config.dart | 4 ++-- lib/pages/BookAppointment/components/SearchByClinic.dart | 6 ++++-- lib/widgets/in_app_browser/InAppBrowser.dart | 4 ++-- pubspec.yaml | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index e93af7c8..5c9912e4 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; -var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 2d5d514d..8dbfe320 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); @@ -461,7 +461,9 @@ class _SearchByClinicState extends State { bool isDentalSelectedAndSupported() { if (dropdownValue != null) - return dropdownValue != "" && (dropdownValue.split("-")[0] == "17" || dropdownValue.split("-")[0] == "253") && isMobileAppDentalAllow; + return dropdownValue != "" && (dropdownValue.split("-")[0] == "17" + // || dropdownValue.split("-")[0] == "253" + ) && isMobileAppDentalAllow; else return false; } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 28a364e5..f38ad57c 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -35,9 +35,9 @@ class MyInAppBrowser extends InAppBrowser { // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS diff --git a/pubspec.yaml b/pubspec.yaml index c7bbbdf2..1170b282 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.024+4050024 +version: 4.5.026+4050026 environment: sdk: ">=2.7.0 <3.0.0" @@ -218,7 +218,7 @@ dependencies: dependency_overrides: provider: ^5.0.0 # permission_handler : ^10.2.0 - flutter_svg: ^1.0.0 + flutter_svg: ^1.1.6 # firebase_messaging_platform_interface: any # flutter_inappwebview: 5.7.2+3 # git: From fb9a4d52972350d09c48d00ddc6b798d55182036 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 24 Aug 2023 10:36:07 +0300 Subject: [PATCH 36/49] Laser clinic changes --- lib/pages/BookAppointment/components/LaserClinic.dart | 7 +++++-- lib/pages/BookAppointment/components/SearchByClinic.dart | 8 +++----- lib/services/appointment_services/GetDoctorsList.dart | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) 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 8dbfe320..dc126e78 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); @@ -333,7 +333,7 @@ class _SearchByClinicState extends State { selectedHospital = newValue; projectDropdownValue = newValue.mainProjectID.toString(); if (dropdownValue.split("-")[0] == "253") { - Navigator.push(context, FadePage(page: LaserClinic())); + Navigator.push(context, FadePage(page: LaserClinic(selectedHospital: selectedHospital))); } else { getDoctorsList(context); } @@ -461,9 +461,7 @@ class _SearchByClinicState extends State { bool isDentalSelectedAndSupported() { if (dropdownValue != null) - return dropdownValue != "" && (dropdownValue.split("-")[0] == "17" - // || dropdownValue.split("-")[0] == "253" - ) && isMobileAppDentalAllow; + return dropdownValue != "" && (dropdownValue.split("-")[0] == "17" || dropdownValue.split("-")[0] == "253") && isMobileAppDentalAllow; else return false; } diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 9fa1ac3c..7d97239c 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1612,11 +1612,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 { From 66600fe66c688e8bdf5526ae049c335402f1ba35 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 24 Aug 2023 10:43:34 +0300 Subject: [PATCH 37/49] Medical report CR implemented --- .../medical/reports_view_model.dart | 2 +- .../medical/reports/report_home_page.dart | 294 +++++++++--------- .../medical/reports/report_list_widget.dart | 34 +- 3 files changed, 165 insertions(+), 165 deletions(-) diff --git a/lib/core/viewModels/medical/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index 7fb4cf93..8f55b3b7 100644 --- a/lib/core/viewModels/medical/reports_view_model.dart +++ b/lib/core/viewModels/medical/reports_view_model.dart @@ -37,7 +37,7 @@ class ReportsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); - // await _reportsService.getInpatientAdmissionsList(); + await _reportsService.getInpatientAdmissionsList(); setState(ViewState.Idle); } } diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index a520b956..7cc8fc2b 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -28,20 +28,20 @@ class HomeReportPage extends StatefulWidget { } class _HomeReportPageState extends State with SingleTickerProviderStateMixin { - // TabController _tabController_new; + TabController _tabController_new; List imagesInfo = List(); int _currentPage = 0; @override void initState() { - // _tabController_new = TabController(length: 2, vsync: this); + _tabController_new = TabController(length: 2, vsync: this); super.initState(); } @override void dispose() { super.dispose(); - // _tabController_new.dispose(); + _tabController_new.dispose(); } @override @@ -70,45 +70,45 @@ class _HomeReportPageState extends State with SingleTickerProvid 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, - // ), - // 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'), - // ), - // ], - // ), + 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, + ), + 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 (model.user != null) Expanded( child: - // TabBarView( - // physics: BouncingScrollPhysics(), - // controller: _tabController_new, - // children: [ + TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController_new, + children: [ Container( child: Column( children: [ @@ -137,114 +137,114 @@ class _HomeReportPageState extends State with SingleTickerProvid ), ), // 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), - // ) - // ], - // ), + 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 diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index b8b457de..016fad79 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -117,23 +117,23 @@ class ReportListWidget extends StatelessWidget { if (reportList[index].status == 2) 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)), - // ), - // ), + 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), From 5ddf8d4b7ae7da371739f1c6f563ca5270a69a65 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 27 Aug 2023 10:19:50 +0300 Subject: [PATCH 38/49] View Dr response fix --- lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 2e930330..c73b0fd6 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -210,7 +210,7 @@ class _ViewDoctorResponsesPageState extends State { child: DefaultButton( TranslationBase.of(context).submit, () { - if (textController.text.isEmpty) { + if (rate == 0 && textController.text.isEmpty) { AppToast.showErrorToast(message: "Please enter comments"); } else { rateDoctorResponse(); From 0f863cd2593299f3a064c90b33c33bcf19b12d94 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 28 Aug 2023 11:11:46 +0300 Subject: [PATCH 39/49] Updates & fixes --- lib/config/config.dart | 4 +- .../insuranceManualUpdateRequest.dart | 28 ++-- lib/core/service/client/base_app_client.dart | 2 +- .../AttachInsuranceCardImageDialog.dart | 15 +- .../insurance/UpdateInsuranceManually.dart | 16 +- .../insurance_card_update_details.dart | 13 +- lib/pages/insurance/insurance_page.dart | 149 ++++++++++-------- .../insurance/insurance_update_screen.dart | 7 +- .../medical/ask_doctor/request_type.dart | 2 +- .../medical/reports/report_list_widget.dart | 4 +- pubspec.yaml | 3 +- 11 files changed, 148 insertions(+), 95 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 5c9912e4..e93af7c8 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; 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/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 9cb81a41..fb3c900a 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -149,7 +149,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 2001273; //3844083 + // body['PatientID'] = 4767370; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart index e7d57363..c331da2a 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(); @@ -134,7 +136,16 @@ 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, @@ -160,7 +164,7 @@ class _UpdateInsuranceManuallyState extends State { child: DefaultButton( TranslationBase.of(context).submit, () { - if(isFormValid()) + if (isFormValid()) submitManualInsuranceUpdateRequest(); else AppToast.showErrorToast(message: TranslationBase.of(context).enterInsuranceDetails); @@ -240,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_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index 3fb1c19d..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) { @@ -304,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) @@ -334,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); }, ) ], @@ -346,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 324c9fa1..f8b2da65 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.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'; @@ -7,6 +8,7 @@ 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'; @@ -18,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), @@ -36,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, ); }, @@ -54,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, @@ -62,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, @@ -79,71 +89,73 @@ 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) @@ -158,23 +170,34 @@ class InsurancePage extends StatelessWidget { patientID: patientID, patientIdentificationID: patientIdentificationID, name: name, + mobileNo: mobileNumber, ))).then((value) { model.getInsuranceUpdated(); }); } else { // AppToast.showErrorToast(message: _insuranceCardService.error); - updateManually(context, _insuranceCardService.error); + updateManually(context, _insuranceCardService.error, patientIdentificationID, patientID, mobileNumber); } }); } - void updateManually(BuildContext context, String errorMsg) { + void updateManually(BuildContext context, String errorMsg, String patientIdentificationID, int patientID, String mobileNumber) { ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: errorMsg + ". " + TranslationBase.of(context).updateInsuranceManuallyDialog, okText: TranslationBase.of(context).yes, cancelText: TranslationBase.of(context).no, - okFunction: () => {Navigator.pop(context), Navigator.push(context, FadePage(page: UpdateInsuranceManually()))}, + 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/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 4ceb5bf5..4c21e826 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -110,7 +110,7 @@ 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/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 016fad79..adaef00e 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -18,7 +18,7 @@ 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_file/open_file.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'; @@ -183,7 +183,7 @@ class ReportListWidget extends StatelessWidget { GifLoaderDialogUtils.hideDialog(AppGlobal.context); try { String path = await _createFileFromString(value["MedicalReportBase64"], "pdf"); - OpenFile.open(path); + OpenFilex.open(path); } catch (ex) { AppToast.showErrorToast(message: "Cannot open file."); } diff --git a/pubspec.yaml b/pubspec.yaml index 1170b282..9f3755da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -207,7 +207,8 @@ dependencies: sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 google_api_availability: ^3.0.1 - open_file: ^3.2.1 +# 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 From 275c99a4ceb576ccd298a0514c471756c3326eb0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 29 Aug 2023 16:25:54 +0300 Subject: [PATCH 40/49] updates --- lib/pages/BookAppointment/BookConfirm.dart | 6 +++--- lib/pages/ToDoList/ToDo.dart | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 0405f657..830bd6bb 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -331,9 +331,9 @@ class _BookConfirmState extends State { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); Future.delayed(new Duration(milliseconds: 500), () { - checkPatientNphiesEligibility(docObject, res['AppointmentNo'], context); - // getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); - // getToDoCount(); + // 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) { diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index d3705a7c..9d806a18 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -543,8 +543,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { confirmAppointment(appo); break; case 20: - // getPatientShare(context, appo); - checkPatientNphiesEligibility(context, appo); + getPatientShare(context, appo); + // checkPatientNphiesEligibility(context, appo); break; case 30: getAppoQR(context, appo); From 38661621e33253c3b415e0703b07cada0e9dd232 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 4 Sep 2023 14:09:26 +0300 Subject: [PATCH 41/49] updates & fixes --- lib/core/service/medical/reports_service.dart | 4 ++-- lib/pages/medical/balance/my_balance_page.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index 9f8bfb45..d80c80e4 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -29,7 +29,7 @@ class ReportsService extends BaseService { } Future getInPatientReports() async { - RequestReports _requestReportsInpatient = RequestReports(isReport: true, encounterType: 2, requestType: 2, patientOutSA: 0, projectID: 0); + 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(); @@ -137,7 +137,7 @@ class ReportsService extends BaseService { body['ProjectID'] = projectID; body['Remarks'] = ""; body['ProcedureId'] = ""; - body['RequestType'] = 2; + body['RequestType'] = 1; body['Source'] = 2; body['Status'] = 1; body['CreatedBy'] = 102; 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, From 4dd16bde59762959a434de8934818376beb2049a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 7 Sep 2023 12:53:14 +0300 Subject: [PATCH 42/49] Inpatient medical report fixes --- .../medical/reports/report_home_page.dart | 92 +++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 7cc8fc2b..911e74a0 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -104,40 +104,39 @@ class _HomeReportPageState extends State with SingleTickerProvid ), if (model.user != null) Expanded( - child: - TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController_new, - children: [ + 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), - ], - ), + 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), + ], + ), + ) + ], ), - 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( + ), + // InPatient Medical Reports + Container( child: model.admissionsMedicalReportList.isNotEmpty ? Column( children: [ @@ -249,20 +248,21 @@ class _HomeReportPageState extends State with SingleTickerProvid if (projectViewModel.havePrivilege(21) // && _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(); - }), - ), - ) + 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(); + }), + ), + ) ], ), ), From 49963911ba6870b0096f654763212f5a0f56d796 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 7 Sep 2023 14:12:53 +0300 Subject: [PATCH 43/49] Patient eligibility change --- lib/config/config.dart | 2 +- lib/config/localized_values.dart | 3 ++ lib/pages/BookAppointment/BookConfirm.dart | 29 +++++++++++++++++-- lib/pages/ToDoList/ToDo.dart | 28 ++++++++++++++++-- .../appointment_services/GetDoctorsList.dart | 2 +- lib/uitl/translations_delegate_base.dart | 3 ++ 6 files changed, 61 insertions(+), 6 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index e93af7c8..1b4c69b3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -326,7 +326,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.8; +var VERSION_ID = 10.9; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4984053d..ea364e24 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1893,4 +1893,7 @@ const Map localizedValues = { "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": "لا يمكنك إجراء الدفع عبر الإنترنت لأنه ليس لديك تأمين صالح."}, }; \ No newline at end of file diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 830bd6bb..f6988037 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -59,6 +59,9 @@ class _BookConfirmState extends State { AppSharedPreferences sharedPref = new AppSharedPreferences(); + bool isInsured = false; + bool isEligible = false; + @override void initState() { // widget.authUser = new AuthenticatedUser(); @@ -437,13 +440,35 @@ 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"]; + + 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: "Update insurance", + cancelText: "Continue as cash", + okFunction: () => {openUpdateInsurance()}, + cancelFunction: () => {continueAsCash(docObject, appointmentNo)}); + dialog.showAlertDialog(context); + } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); // AppToast.showErrorToast(message: err); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 9d806a18..d98c40be 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -79,6 +79,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { bool dataLoaded = false; + bool isInsured = false; + bool isEligible = false; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); @@ -889,6 +892,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } getPatientShare(context, AppoitmentAllHistoryResultList appo) { + String errorMsg = ""; DoctorsListService service = new DoctorsListService(); if (appo.isLiveCareAppointment) { getLiveCareAppointmentPatientShare(context, service, appo); @@ -896,8 +900,28 @@ 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"]; + + 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: "Update insurance", + cancelText: "Continue as cash", + okFunction: () => {openUpdateInsurance()}, + cancelFunction: () => {continueAsCash(appo)}); + dialog.showAlertDialog(context); + } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 7d97239c..f4c0aec3 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -484,7 +484,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); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 8d8f51ee..35e6b7bf 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2903,6 +2903,9 @@ class TranslationBase { 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]; + } class TranslationBaseDelegate extends LocalizationsDelegate { From 9ed454f67a3405d18e3791ce5f51b63df9fb2b1b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 12 Sep 2023 11:01:04 +0300 Subject: [PATCH 44/49] Cash patient check implemented --- lib/config/localized_values.dart | 3 +- lib/pages/BookAppointment/BookConfirm.dart | 32 +++++++++++++--------- lib/pages/ToDoList/ToDo.dart | 32 +++++++++++++--------- lib/uitl/translations_delegate_base.dart | 3 +- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ea364e24..4a24f79b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1893,7 +1893,8 @@ const Map localizedValues = { "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": "تحديث التأمين"}, }; \ No newline at end of file diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index f6988037..50dbc70f 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -61,6 +61,7 @@ class _BookConfirmState extends State { bool isInsured = false; bool isEligible = false; + bool isCash = false; @override void initState() { @@ -450,24 +451,29 @@ class _BookConfirmState extends State { isInsured = res["IsInsured"]; isEligible = res["IsEligible"]; + isCash = res["IsCash"]; - if (isInsured && isEligible) { + if (isCash) { navigateToBookSuccess(context, docObject, widget.patientShareResponse); } else { - if (isInsured && !isEligible) { - errorMsg = TranslationBase.of(context).invalidEligibility; + if (isInsured && isEligible) { + navigateToBookSuccess(context, docObject, widget.patientShareResponse); } else { - errorMsg = TranslationBase.of(context).invalidInsurance; + 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); } - ConfirmDialog dialog = new ConfirmDialog( - isDissmissable: false, - context: context, - confirmMessage: errorMsg, - okText: "Update insurance", - cancelText: "Continue as cash", - okFunction: () => {openUpdateInsurance()}, - cancelFunction: () => {continueAsCash(docObject, appointmentNo)}); - dialog.showAlertDialog(context); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index d98c40be..d3af8742 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -81,6 +81,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { bool isInsured = false; bool isEligible = false; + bool isCash = false; @override void initState() { @@ -903,24 +904,29 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { widget.patientShareResponse = new PatientShareResponse.fromJson(res['OnlineCheckInAppointments'][0]); isInsured = res["IsInsured"]; isEligible = res["IsEligible"]; + isCash = res["IsCash"]; - if (isInsured && isEligible) { + if (isCash) { openPaymentDialog(appo, widget.patientShareResponse); } else { - if (isInsured && !isEligible) { - errorMsg = TranslationBase.of(context).invalidEligibility; + if (isInsured && isEligible) { + openPaymentDialog(appo, widget.patientShareResponse); } else { - errorMsg = TranslationBase.of(context).invalidInsurance; + 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); } - ConfirmDialog dialog = new ConfirmDialog( - isDissmissable: false, - context: context, - confirmMessage: errorMsg, - okText: "Update insurance", - cancelText: "Continue as cash", - okFunction: () => {openUpdateInsurance()}, - cancelFunction: () => {continueAsCash(appo)}); - dialog.showAlertDialog(context); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 35e6b7bf..b14c21a5 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2902,9 +2902,10 @@ class TranslationBase { 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]; } From df610690d55abdd4effe7974c30041c0bf72d838 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 1 Oct 2023 11:46:48 +0300 Subject: [PATCH 45/49] updates --- lib/config/localized_values.dart | 1 + lib/core/service/client/base_app_client.dart | 2 +- .../medical/labs/laboratory_result_page.dart | 56 ++++++++++++++----- lib/pages/paymentService/payment_service.dart | 14 ++--- lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 26 ++++----- .../bottom_navigation_item.dart | 8 +-- lib/widgets/others/app_scaffold_widget.dart | 8 +-- 8 files changed, 72 insertions(+), 44 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4a24f79b..e818eb82 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1897,4 +1897,5 @@ const Map localizedValues = { "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": "تحميل تقرير المختبر"}, }; \ No newline at end of file diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index fb3c900a..9cb81a41 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -149,7 +149,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 4767370; //3844083 + // body['PatientID'] = 2001273; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index 847f979b..88fdcbe8 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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'; @@ -37,22 +38,47 @@ 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(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, + 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, + ), + itemCount: 1, + ), + ], + ), + ), + bottomSheet: Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.08, + 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, + () => {}, + textColor: Colors.white, + ), + ), + ], ), - itemCount: 1, ), ), ); diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index 5bcf4592..3c5cb01f 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -1,4 +1,4 @@ -import 'package:badges/badges.dart'; +import 'package:badges/badges.dart' as badge_import; import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -95,11 +95,11 @@ class PaymentService extends StatelessWidget { ? Positioned( left: 8, top: 4, - child: Badge( + child: badge_import.Badge( toAnimate: false, elevation: 0, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( @@ -111,11 +111,11 @@ class PaymentService extends StatelessWidget { : Positioned( right: 8, top: 4, - child: Badge( + child: badge_import.Badge( toAnimate: false, elevation: 0, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index b14c21a5..0863de1e 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2906,6 +2906,7 @@ class TranslationBase { 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]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index ece5613d..f061b6bf 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:auto_size_text/auto_size_text.dart'; -import 'package:badges/badges.dart'; +import 'package:badges/badges.dart' as badge_import; import 'package:cached_network_image/cached_network_image.dart'; import 'package:connectivity/connectivity.dart'; import 'package:crypto/crypto.dart' as crypto; @@ -241,11 +241,11 @@ class Utils { ? Positioned( left: 8, top: 4, - child: Badge( + child: badge_import.Badge( toAnimate: false, elevation: 0, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( @@ -259,11 +259,11 @@ class Utils { ? Positioned( right: 8, top: 4, - child: Badge( + child: badge_import.Badge( toAnimate: false, elevation: 0, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( @@ -614,11 +614,11 @@ class Utils { ? Positioned( left: 8, top: 4, - child: Badge( + child: badge_import.Badge( toAnimate: false, elevation: 0, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( @@ -632,11 +632,11 @@ class Utils { ? Positioned( right: 8, top: 4, - child: Badge( + child: badge_import.Badge( toAnimate: false, elevation: 0, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index ff085dd9..f7cdafce 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -1,4 +1,4 @@ -import 'package:badges/badges.dart'; +import 'package:badges/badges.dart' as badge_import; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -106,10 +106,10 @@ class BottomNavigationItem extends StatelessWidget { Positioned( right: 18.0, bottom: 28.0, - child: Badge( + child: badge_import.Badge( toAnimate: false, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 6865ece5..f433a8e4 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,5 +1,5 @@ import 'package:auto_size_text/auto_size_text.dart'; -import 'package:badges/badges.dart'; +import 'package:badges/badges.dart' as badge_import; import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -494,7 +494,7 @@ class AppBarWidgetState extends State { actions: [ (widget.isPharmacy && widget.showPharmacyCart) ? IconButton( - icon: Badge( + icon: badge_import.Badge( badgeContent: Text( orderPreviewViewModel.cartResponse.quantityCount.toString(), style: TextStyle(color: Colors.white), @@ -507,8 +507,8 @@ class AppBarWidgetState extends State { : Container(), (widget.isOfferPackages && widget.showOfferPackagesCart) ? IconButton( - icon: Badge( - position: BadgePosition.topStart(top: -15, start: -10), + icon: badge_import.Badge( + position: badge_import.BadgePosition.topStart(top: -15, start: -10), badgeContent: Text( _badgeText, style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal), From 34d3cf29456fbf3850459a172ce378889694e6d0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 2 Oct 2023 12:01:56 +0300 Subject: [PATCH 46/49] CR 6204 Lab reports enhancements in progress --- .../labs/request_send_lab_report_email.dart | 54 ++++++++++--------- lib/core/service/medical/labs_service.dart | 3 +- .../viewModels/medical/labs_view_model.dart | 2 +- .../medical/labs/laboratory_result_page.dart | 6 ++- 4 files changed, 37 insertions(+), 28 deletions(-) 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 65ac1762..a849da73 100644 --- a/lib/core/model/labs/request_send_lab_report_email.dart +++ b/lib/core/model/labs/request_send_lab_report_email.dart @@ -25,34 +25,36 @@ class RequestSendLabReportEmail { String invoiceNo; String orderDate; String orderNo; + bool isDownload; RequestSendLabReportEmail( {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.to, - this.dateofBirth, - this.patientIditificationNum, - this.patientMobileNumber, - this.patientName, - this.setupID, - this.projectName, - this.clinicName, - this.doctorName, - this.projectID, - this.invoiceNo, - this.orderDate, - this.orderNo}); + 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.to, + this.dateofBirth, + this.patientIditificationNum, + this.patientMobileNumber, + this.patientName, + this.setupID, + this.projectName, + this.clinicName, + this.doctorName, + this.projectID, + this.invoiceNo, + this.orderDate, + this.orderNo, + this.isDownload}); RequestSendLabReportEmail.fromJson(Map json) { versionID = json['VersionID']; @@ -81,6 +83,7 @@ class RequestSendLabReportEmail { invoiceNo = json['InvoiceNo']; orderDate = json['OrderDate']; orderNo = json['OrderNo']; + isDownload = json['IsDownload']; } Map toJson() { @@ -111,6 +114,7 @@ class RequestSendLabReportEmail { data['InvoiceNo'] = this.invoiceNo; data['OrderDate'] = this.orderDate; data['OrderNo'] = this.orderNo; + data['IsDownload'] = this.isDownload; return data; } } diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 714ebcb1..06115173 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -194,7 +194,7 @@ class LabsService extends BaseService { RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail(); - Future sendLabReportEmail({PatientLabOrders patientLabOrder, AuthenticatedUser userObj}) async { + Future sendLabReportEmail({PatientLabOrders patientLabOrder, AuthenticatedUser userObj, bool isDownload = false}) async { _requestSendLabReportEmail.projectID = patientLabOrder.projectID; _requestSendLabReportEmail.invoiceNo = patientLabOrder.invoiceNo; _requestSendLabReportEmail.doctorName = patientLabOrder.doctorName; @@ -208,6 +208,7 @@ class LabsService extends BaseService { _requestSendLabReportEmail.projectName = patientLabOrder.projectName; _requestSendLabReportEmail.setupID = patientLabOrder.setupID; _requestSendLabReportEmail.orderNo = patientLabOrder.orderNo; + _requestSendLabReportEmail.isDownload = isDownload; await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index e42dbbb4..263d7d32 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -135,7 +135,7 @@ class LabsViewModel extends BaseViewModel { } } - sendLabReportEmail({PatientLabOrders patientLabOrder, String mes, AuthenticatedUser userObj}) async { + sendLabReportEmail({PatientLabOrders patientLabOrder, String mes, AuthenticatedUser userObj, bool isDownload = false}) async { await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder, userObj: userObj); if (_labsService.hasError) { error = _labsService.error; diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index 88fdcbe8..574c407f 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -73,7 +73,11 @@ class _LaboratoryResultPageState extends State { 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); + }, textColor: Colors.white, ), ), From 14928ad833a3ac1514c68730867150a40f1eec9e Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 2 Oct 2023 12:48:15 +0300 Subject: [PATCH 47/49] CR 6204 --- lib/core/model/labs/request_send_lab_report_email.dart | 6 +++++- lib/core/service/medical/labs_service.dart | 1 + lib/core/viewModels/medical/labs_view_model.dart | 2 +- lib/pages/medical/labs/laboratory_result_page.dart | 5 ++++- 4 files changed, 11 insertions(+), 3 deletions(-) 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 a849da73..2fae6e0c 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,7 @@ class RequestSendLabReportEmail { String orderDate; String orderNo; bool isDownload; + int doctorID; RequestSendLabReportEmail( {this.versionID, @@ -54,7 +55,8 @@ class RequestSendLabReportEmail { this.invoiceNo, this.orderDate, this.orderNo, - this.isDownload}); + this.isDownload, + this.doctorID}); RequestSendLabReportEmail.fromJson(Map json) { versionID = json['VersionID']; @@ -84,6 +86,7 @@ class RequestSendLabReportEmail { orderDate = json['OrderDate']; orderNo = json['OrderNo']; isDownload = json['IsDownload']; + doctorID = json['DoctorID']; } Map toJson() { @@ -115,6 +118,7 @@ class RequestSendLabReportEmail { data['OrderDate'] = this.orderDate; data['OrderNo'] = this.orderNo; data['IsDownload'] = this.isDownload; + data['DoctorID'] = this.doctorID; return data; } } diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 06115173..1bc12af3 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -209,6 +209,7 @@ class LabsService extends BaseService { _requestSendLabReportEmail.setupID = patientLabOrder.setupID; _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) { hasError = true; diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 263d7d32..e250a85c 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -136,7 +136,7 @@ class LabsViewModel extends BaseViewModel { } sendLabReportEmail({PatientLabOrders patientLabOrder, String mes, AuthenticatedUser userObj, bool isDownload = false}) async { - await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder, userObj: userObj); + await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder, userObj: userObj, isDownload: true); if (_labsService.hasError) { error = _labsService.error; } else diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index 574c407f..9ef18fb3 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -59,12 +59,15 @@ class _LaboratoryResultPageState extends State { ), itemCount: 1, ), + SizedBox( + height: 120.0, + ) ], ), ), bottomSheet: Container( color: Colors.white, - height: MediaQuery.of(context).size.height * 0.08, + height: MediaQuery.of(context).size.height * 0.081, width: double.infinity, padding: EdgeInsets.all(12.0), child: Column( From b2f390c19d438d08afa00ee66ec6fcee11bdb739 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 2 Oct 2023 14:42:47 +0300 Subject: [PATCH 48/49] CR 6204 implemented --- ios/Podfile | 26 +++++++++++++++++++ lib/core/service/medical/labs_service.dart | 10 ++++++- .../viewModels/medical/labs_view_model.dart | 13 +++++++--- .../medical/labs/laboratory_result_page.dart | 21 +++++++++++++++ pubspec.yaml | 2 +- 5 files changed, 67 insertions(+), 5 deletions(-) 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/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 1bc12af3..c9abb4e8 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(); @@ -211,7 +213,13 @@ class LabsService extends BaseService { _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/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index e250a85c..c9fdd114 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(); @@ -136,10 +138,15 @@ class LabsViewModel extends BaseViewModel { } sendLabReportEmail({PatientLabOrders patientLabOrder, String mes, AuthenticatedUser userObj, bool isDownload = false}) async { - await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder, userObj: userObj, isDownload: true); + await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder, userObj: userObj, 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/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index 9ef18fb3..f2c86c5f 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -1,7 +1,12 @@ +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'; @@ -9,6 +14,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/medical/LabResult/labo 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 { @@ -80,6 +87,12 @@ class _LaboratoryResultPageState extends State { 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, ), @@ -91,6 +104,14 @@ class _LaboratoryResultPageState extends State { ); } + 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/pubspec.yaml b/pubspec.yaml index 9f3755da..a711467e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -207,7 +207,7 @@ dependencies: sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 google_api_availability: ^3.0.1 -# open_file: ^3.2.1 + # open_file: ^3.2.1 open_filex: ^4.3.2 path_provider: ^2.0.8 # flutter_callkit_incoming: ^1.0.3+3 From af5b0766a27c0916d7b63f032f4c9fa9b4c6f22b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 3 Oct 2023 09:51:50 +0300 Subject: [PATCH 49/49] CR 6654, Disable update manual insurance temporarily. --- lib/config/localized_values.dart | 1 + .../AttachInsuranceCardImageDialog.dart | 41 +++++++++++-------- lib/pages/insurance/insurance_page.dart | 16 ++++---- lib/uitl/translations_delegate_base.dart | 1 + 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index e818eb82..7fd9507b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1898,4 +1898,5 @@ const Map localizedValues = { "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/pages/insurance/AttachInsuranceCardImageDialog.dart b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart index c331da2a..16c8cdf5 100644 --- a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart +++ b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart @@ -132,24 +132,31 @@ class _AttachInsuranceCardImageDialogState extends State { Navigator.pop(context), Navigator.push( - context, - FadePage( - page: UpdateInsuranceManually( + context, + FadePage( + page: UpdateInsuranceManually( patientIdentificationNo: patientIdentificationID, patientID: patientID, patientMobileNumber: mobileNumber, - ))) + ), + ), + ), }, cancelFunction: () => {}); dialog.showAlertDialog(context); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0863de1e..804cecdd 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2907,6 +2907,7 @@ class TranslationBase { 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]; }