diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 1032b29b..1a3d4cfe 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ + @@ -76,13 +77,21 @@ - - - + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt index 8b73b0c7..e67f646f 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt @@ -2,8 +2,7 @@ package com.cloud.diplomaticquarterapp import android.os.Bundle import android.util.Log import androidx.annotation.NonNull; -import com.cloud.diplomaticquarterapp.utils.FlutterText -import com.cloud.diplomaticquarterapp.utils.PlatformBridge +import com.cloud.diplomaticquarterapp.utils.* import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.engine.FlutterEngine import io.flutter.plugin.common.MethodChannel @@ -15,6 +14,16 @@ class MainActivity: FlutterFragmentActivity() { // Create Flutter Platform Bridge PlatformBridge(flutterEngine.dartExecutor.binaryMessenger, this).create() + val time = timeToMillis("04:00:00", "HH:mm:ss") + print(time) + +// val d1 = Logs.list(this) +// val d2 = Logs.raw(this) +// val d3 = Logs.RegisterGeofence.list(this) +// val d4 = Logs.RegisterGeofence.raw(this) +// val d5 = Logs.GeofenceEvent.list(this) +// val d6 = Logs.GeofenceEvent.raw(this) + print("") } override fun onResume() { diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt index 7eba1ead..b3fb4f56 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt @@ -37,6 +37,7 @@ class GeoZoneModel { val rad = Radius.toFloat() if(lat != null && long != null){ + val loiteringDelayMinutes:Int = 2 // in Minutes return Geofence.Builder() .setRequestId(identifier()) .setCircularRegion( @@ -45,7 +46,8 @@ class GeoZoneModel { rad ) .setTransitionTypes(GeofenceTransition.ENTER_EXIT.value) -// .setNotificationResponsiveness(0) + .setNotificationResponsiveness(0) + .setLoiteringDelay(loiteringDelayMinutes * 60 * 1000) .setExpirationDuration(Geofence.NEVER_EXPIRE) .build() } diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt deleted file mode 100644 index 8fc1faae..00000000 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt +++ /dev/null @@ -1,13 +0,0 @@ - - -package com.cloud.diplomaticquarterapp.geofence - -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent - -class GeofenceBroadcastReceiver : BroadcastReceiver() { - override fun onReceive(context: Context, intent: Intent) { - GeofenceTransitionsJobIntentService.enqueueWork(context, intent) - } -} \ No newline at end of file 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 4d2c48b3..840075eb 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 @@ -6,7 +6,11 @@ import android.content.Context import android.content.Intent import android.content.SharedPreferences import android.content.pm.PackageManager +import android.location.Location import androidx.core.content.ContextCompat +import com.cloud.diplomaticquarterapp.geofence.intent_receivers.GeofenceBroadcastReceiver +import com.cloud.diplomaticquarterapp.geofence.intent_receivers.ReregisterGeofenceJobService +import com.cloud.diplomaticquarterapp.utils.* import com.google.android.gms.location.Geofence import com.google.android.gms.location.GeofencingClient import com.google.android.gms.location.GeofencingRequest @@ -17,8 +21,10 @@ import com.google.gson.reflect.TypeToken enum class GeofenceTransition(val value: Int) { ENTER(1), EXIT(2), + DWELL(4), + ENTER_EXIT((ENTER.value or EXIT.value)), - DWELL(4); + DWELL_EXIT((DWELL.value or EXIT.value)); companion object { fun fromInt(value: Int) = GeofenceTransition.values().first { it.value == value } @@ -27,17 +33,13 @@ enum class GeofenceTransition(val value: Int) { fun named():String{ if (value == 1)return "Enter" if (value == 2)return "Exit" - if (value == (ENTER.value or EXIT.value))return "Enter or 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" } } -const val PREFS_STORAGE = "FlutterSharedPreferences" -const val PREF_KEY_SUCCESS = "HMG_GEOFENCE_SUCCESS" -const val PREF_KEY_FAILED = "HMG_GEOFENCE_FAILED" -const val PREF_KEY_HMG_ZONES = "flutter.hmg-geo-fences" - class HMG_Geofence { // https://developer.android.com/training/location/geofencing#java @@ -69,13 +71,53 @@ class HMG_Geofence { } } - fun register(geoZones: List){ + fun limitize(zones: List):List{ + var geoZones_ = zones + if(zones.size > 100) + geoZones_ = zones.subList(0, 99) + return geoZones_ + } + + + fun register(completion:((Boolean, java.lang.Exception?)->Unit)){ + unRegisterAll { status, exception -> + val geoZones = getGeoZonesFromPreference(context) + doRegister(geoZones){ status_, error -> + completion.let { it(status_, error) } + } + } + } + + fun unRegisterAll(completion: (status: Boolean, exception: Exception?) -> Unit){ + getActiveGeofences({ success -> + removeActiveGeofences() + if(success.isNotEmpty()) + geofencingClient + .removeGeofences(success) + .addOnSuccessListener { + completion(true, null) + } + .addOnFailureListener { + completion(false, it) + saveLog(context, "error:REMOVE_GEOFENCES", it.localizedMessage) + } + else + completion(true, null) + + }, { failed -> + // Nothing to do with failed geofences. + }) + } + + private fun doRegister(geoZones: List, completion:((Boolean, java.lang.Exception?)->Unit)? = null){ if (geoZones.isEmpty()) return + val geoZones_ = limitize(geoZones) + fun buildGeofencingRequest(geofences: List): GeofencingRequest { return GeofencingRequest.Builder() - .setInitialTrigger(0) + .setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_DWELL) .addGeofences(geofences) .build() } @@ -83,9 +125,9 @@ class HMG_Geofence { getActiveGeofences({ active -> val geofences = mutableListOf() - geoZones.forEach { - it.toGeofence()?.let { geof -> - if(!active.contains(geof.requestId)){ // if not already registered then register + geoZones_.forEach { + it.toGeofence()?.let { geof -> + if (!active.contains(geof.requestId)) { // if not already registered then register geofences.add(geof) } } @@ -95,31 +137,29 @@ class HMG_Geofence { 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 { - print(it.localizedMessage) + .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) } - },null) + + }, null) + } - fun unRegisterAll(completion: (status: Boolean, exception:Exception?) -> Unit){ - getActiveGeofences({ success -> - val mList = success.toMutableList() - mList.add("12345") - geofencingClient - .removeGeofences(success) - .addOnSuccessListener { - completion(true, null) - } - .addOnFailureListener { - completion(false, it) - } - removeActiveGeofences() - }, { failed -> - // Nothing to do with failed geofences. - }) + fun getGeoZonesFromPreference(context: Context):List{ + val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) + val json = pref.getString(PREF_KEY_HMG_ZONES, "[]") + + val geoZones = GeoZoneModel().listFrom(json!!) + return geoZones } fun saveActiveGeofence(success: List, failed: List){ @@ -130,8 +170,8 @@ class HMG_Geofence { } fun removeActiveGeofences(){ - preferences.edit().putString(PREF_KEY_SUCCESS,"[]").apply() - preferences.edit().putString(PREF_KEY_FAILED,"[]").apply() + preferences.edit().putString(PREF_KEY_SUCCESS, "[]").apply() + preferences.edit().putString(PREF_KEY_FAILED, "[]").apply() } fun getActiveGeofences(success: (success: List) -> Unit, failure: ((failed: List) -> Unit)?){ @@ -154,12 +194,48 @@ class HMG_Geofence { } fun getPatientID():Int?{ - val profileJson = preferences.getString("flutter.imei-user-data", "{}") + 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) + return gson.fromJson?>(profileJson, type) ?.get("PatientID") .toString() .toDoubleOrNull() ?.toInt() } + + + 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() + if (!pointID.isNullOrEmpty() && pointID.toIntOrNull() != null) { + + val body = mutableMapOf( + "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.😎") + }, { 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}") + }) + + } + } + + }, null) + } + } } \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiver.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiver.kt new file mode 100644 index 00000000..77df1572 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiver.kt @@ -0,0 +1,49 @@ + + +package com.cloud.diplomaticquarterapp.geofence.intent_receivers + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.util.Log +import com.cloud.diplomaticquarterapp.geofence.GeofenceTransition +import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence +import com.cloud.diplomaticquarterapp.utils.Logs +import com.google.android.gms.location.GeofenceStatusCodes +import com.google.android.gms.location.GeofencingEvent + +class GeofenceBroadcastReceiver : BroadcastReceiver() { + private val LOG_TAG = "GeofenceBroadcastReceiver" + override fun onReceive(context: Context, intent: Intent) { + + val geofencingEvent = GeofencingEvent.fromIntent(intent) + if (geofencingEvent.hasError()) { + val errorMessage = GeofenceErrorMessages.getErrorString(context, geofencingEvent.errorCode) + Log.e(LOG_TAG, errorMessage) + + Logs.GeofenceEvent.save(context,LOG_TAG,"Error while triggering geofence event",Logs.STATUS.ERROR) + doReRegisterIfRequired(context,geofencingEvent.errorCode) + + return + } + + Logs.GeofenceEvent.save(context,LOG_TAG,"Geofence event triggered: ${GeofenceTransition.fromInt(geofencingEvent.geofenceTransition).value} for ${geofencingEvent.triggeringGeofences.map {it.requestId}}",Logs.STATUS.SUCCESS) + HMG_Geofence.shared(context).handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition)); + + } + + fun doReRegisterIfRequired(context: Context, errorCode: Int){ + val errorRequiredReregister = listOf( + GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE, + GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES, + GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS, + GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT + ) + + if(errorRequiredReregister.contains(errorCode)) + HMG_Geofence.shared(context).register(){ status, error -> + + } + + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiverWithJobService.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiverWithJobService.kt new file mode 100644 index 00000000..a9924ca1 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceBroadcastReceiverWithJobService.kt @@ -0,0 +1,16 @@ + + +package com.cloud.diplomaticquarterapp.geofence.intent_receivers + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence +import com.google.android.gms.location.GeofenceStatusCodes + +class GeofenceBroadcastReceiverWithJobService : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + GeofenceTransitionsJobIntentService.enqueueWork(context, intent) + } + +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceErrorMessages.kt similarity index 67% rename from android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt rename to android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceErrorMessages.kt index 4890f7cb..01377d49 100755 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceErrorMessages.kt @@ -1,9 +1,10 @@ -package com.cloud.diplomaticquarterapp.geofence +package com.cloud.diplomaticquarterapp.geofence.intent_receivers import android.content.Context import com.cloud.diplomaticquarterapp.R +import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence import com.google.android.gms.common.api.ApiException import com.google.android.gms.location.GeofenceStatusCodes @@ -18,7 +19,7 @@ object GeofenceErrorMessages { fun getErrorString(context: Context, errorCode: Int): String { val resources = context.resources - return when (errorCode) { + val errorMessage = when (errorCode) { GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE -> resources.getString(R.string.geofence_not_available) @@ -28,7 +29,15 @@ object GeofenceErrorMessages { GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS -> resources.getString(R.string.geofence_too_many_pending_intents) + GeofenceStatusCodes.GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION -> + resources.getString(R.string.GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION) + + GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT -> + resources.getString(R.string.GEOFENCE_REQUEST_TOO_FREQUENT) + else -> resources.getString(R.string.geofence_unknown_error) } + + return errorMessage } } \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceTransitionsJobIntentService.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceTransitionsJobIntentService.kt similarity index 53% rename from android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceTransitionsJobIntentService.kt rename to android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceTransitionsJobIntentService.kt index f28e1720..214957cf 100755 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceTransitionsJobIntentService.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofenceTransitionsJobIntentService.kt @@ -29,31 +29,27 @@ */ -package com.cloud.diplomaticquarterapp.geofence +package com.cloud.diplomaticquarterapp.geofence.intent_receivers import android.content.Context import android.content.Intent -import android.location.Location import android.util.Log import androidx.core.app.JobIntentService -import com.cloud.diplomaticquarterapp.utils.API -import com.cloud.diplomaticquarterapp.utils.httpPost -import com.cloud.diplomaticquarterapp.utils.sendNotification -import com.github.kittinunf.fuel.core.extensions.jsonBody -import com.github.kittinunf.fuel.core.isSuccessful -import com.github.kittinunf.fuel.httpPost -import com.google.android.gms.location.Geofence +import com.cloud.diplomaticquarterapp.geofence.GeofenceTransition +import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence +import com.cloud.diplomaticquarterapp.utils.saveLog +import com.google.android.gms.location.GeofenceStatusCodes import com.google.android.gms.location.GeofencingEvent -import com.google.gson.Gson class GeofenceTransitionsJobIntentService : JobIntentService() { companion object { private const val LOG_TAG = "GeoTrIntentService" - private const val JOB_ID = 573 - + private const val JOB_ID = 95902 + var context_: Context? = null fun enqueueWork(context: Context, intent: Intent) { + context_ = context enqueueWork( context, GeofenceTransitionsJobIntentService::class.java, JOB_ID, @@ -64,43 +60,31 @@ class GeofenceTransitionsJobIntentService : JobIntentService() { override fun onHandleWork(intent: Intent) { val geofencingEvent = GeofencingEvent.fromIntent(intent) if (geofencingEvent.hasError()) { - val errorMessage = GeofenceErrorMessages.getErrorString(this, geofencingEvent.errorCode) + val errorMessage = GeofenceErrorMessages.getErrorString(context_!!, geofencingEvent.errorCode) Log.e(LOG_TAG, errorMessage) - return - } - if (geofencingEvent.geofenceTransition == Geofence.GEOFENCE_TRANSITION_ENTER || geofencingEvent.geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXIT) { - handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition)); - } - } - private fun handleEvent(triggerGeofences: List, location:Location, transition:GeofenceTransition) { - val hmg = HMG_Geofence.shared(this) - hmg.getPatientID()?.let { patientId -> + saveLog(context_!!,LOG_TAG,errorMessage) + doReRegisterIfRequired(context_!!, geofencingEvent.errorCode) - hmg.getActiveGeofences({ activeGeofences -> + return + } - triggerGeofences.forEach { geofence -> - // Extract PointID from 'geofence.requestId' and find from active geofences - val pointID = activeGeofences.firstOrNull {it == geofence.requestId}?.split('_')?.first() - if(!pointID.isNullOrEmpty() && pointID.toIntOrNull() != null){ + HMG_Geofence.shared(context_!!).handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition)); - val body = mapOf( - "PointsID" to pointID.toIntOrNull(), - "GeoType" to transition.value, - "PatientID" to patientId - ) + } - httpPost>(API.LOG_GEOFENCE, body, { response -> - sendNotification(this, transition.named(), geofence.requestId, "Notified to server.😎") - },{ exception -> - sendNotification(this, transition.named(), geofence.requestId, "Failed to notify server.😔") - }) - } - } + fun doReRegisterIfRequired(context: Context, errorCode: Int){ + val errorRequiredReregister = listOf( + GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE, + GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES, + GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS, + GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT + ) + + if(errorRequiredReregister.contains(errorCode)) + HMG_Geofence.shared(context).register(){ status, exc -> } - },null) - } } } \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofencingRebootBroadcastReceiver.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofencingRebootBroadcastReceiver.kt similarity index 58% rename from android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofencingRebootBroadcastReceiver.kt rename to android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofencingRebootBroadcastReceiver.kt index 08a0c93f..6421b327 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofencingRebootBroadcastReceiver.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/GeofencingRebootBroadcastReceiver.kt @@ -1,26 +1,22 @@ -package com.cloud.diplomaticquarterapp.geofence +package com.cloud.diplomaticquarterapp.geofence.intent_receivers import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.os.Handler -import android.os.Message import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence -import com.cloud.diplomaticquarterapp.utils.HMGUtils +import com.cloud.diplomaticquarterapp.utils.PREFS_STORAGE class GeofencingRebootBroadcastReceiver : BroadcastReceiver(){ override fun onReceive(context: Context, intent: Intent) { if (Intent.ACTION_BOOT_COMPLETED.equals(intent.action)) { +// if (intent.action.equals("android.intent.action.BOOT_COMPLETE")) { val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) pref.edit().putString("REBOOT_DETECTED","YES").apply() - HMG_Geofence.shared(context).unRegisterAll { status, exception -> - val geoZones = HMGUtils.getGeoZonesFromPreference(context) - HMG_Geofence.shared(context).register(geoZones) - } + HMG_Geofence.shared(context).register(){ status, error -> } } } diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/LocationProviderChangeReceiver.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/LocationProviderChangeReceiver.kt new file mode 100644 index 00000000..273ca8f5 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/LocationProviderChangeReceiver.kt @@ -0,0 +1,25 @@ + + +package com.cloud.diplomaticquarterapp.geofence.intent_receivers + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.location.LocationManager +import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence +import com.cloud.diplomaticquarterapp.utils.HMGUtils +import com.cloud.diplomaticquarterapp.utils.PREFS_STORAGE + +class LocationProviderChangeReceiver : BroadcastReceiver() { + private val LOG_TAG = "LocationProviderChangeReceiver" + override fun onReceive(context: Context, intent: Intent) { + + if (LocationManager.PROVIDERS_CHANGED_ACTION.equals(intent.action)) { + val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) + pref.edit().putString("LOCATION_PROVIDER_CHANGE","YES").apply() + + HMG_Geofence.shared(context).register(){ s, e -> } + } + } + +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/ReregisterGeofenceJobService.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/ReregisterGeofenceJobService.kt new file mode 100644 index 00000000..0bc496bc --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/intent_receivers/ReregisterGeofenceJobService.kt @@ -0,0 +1,24 @@ +package com.cloud.diplomaticquarterapp.geofence.intent_receivers + +import android.app.job.JobParameters +import android.app.job.JobService +import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence +import com.cloud.diplomaticquarterapp.utils.Logs + +class ReregisterGeofenceJobService : JobService(){ + companion object{ + val TriggerIntervalDuration:String = "06:00:00" + val JobID = 918273 + } + override fun onStartJob(params: JobParameters?): Boolean { + Logs.save(applicationContext,"ReregisterGeofenceJobService.onStartJob", "triggered to re-register the geofences after $TriggerIntervalDuration >> [HH:mm:ss]") + HMG_Geofence.shared(applicationContext).register(){ status, error -> + jobFinished(params, true) + } + return true + } + + override fun onStopJob(params: JobParameters?): Boolean { + return true + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt index 30f57dde..924bda91 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt @@ -2,7 +2,7 @@ package com.cloud.diplomaticquarterapp.utils class API { companion object{ - private val BASE = "https://uat.hmgwebservices.com" + private val BASE = "https://hmgwebservices.com" private val SERVICE = "Services/Patients.svc/REST" val WIFI_CREDENTIALS = "$BASE/$SERVICE/Hmg_SMS_Get_By_ProjectID_And_PatientID" diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/Constants.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/Constants.kt new file mode 100644 index 00000000..aa0f8ec2 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/Constants.kt @@ -0,0 +1,8 @@ +package com.cloud.diplomaticquarterapp.utils + + +const val PREFS_STORAGE = "FlutterSharedPreferences" +const val PREF_KEY_SUCCESS = "HMG_GEOFENCE_SUCCESS" +const val PREF_KEY_FAILED = "HMG_GEOFENCE_FAILED" +const val PREF_KEY_HMG_ZONES = "flutter.hmg-geo-fences" +const val PREF_KEY_LANGUAGE = "flutter.language" \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt index ceecd65b..94bf54e6 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt @@ -3,6 +3,9 @@ package com.cloud.diplomaticquarterapp.utils import android.app.NotificationChannel import android.app.NotificationManager import android.app.PendingIntent +import android.app.job.JobInfo +import android.app.job.JobScheduler +import android.content.ComponentName import android.content.Context import android.content.Intent import android.os.Build @@ -14,17 +17,16 @@ import com.cloud.diplomaticquarterapp.BuildConfig import com.cloud.diplomaticquarterapp.MainActivity import com.cloud.diplomaticquarterapp.R import com.cloud.diplomaticquarterapp.geofence.GeoZoneModel -import com.cloud.diplomaticquarterapp.geofence.PREFS_STORAGE -import com.cloud.diplomaticquarterapp.geofence.PREF_KEY_HMG_ZONES import com.github.kittinunf.fuel.core.extensions.jsonBody import com.github.kittinunf.fuel.httpPost -import com.google.android.gms.location.Geofence import com.google.gson.Gson import com.google.gson.reflect.TypeToken import io.flutter.plugin.common.MethodChannel +import org.jetbrains.anko.doAsyncResult import org.json.JSONArray import org.json.JSONException import org.json.JSONObject +import java.text.SimpleDateFormat import java.util.* import kotlin.concurrent.timerTask @@ -68,24 +70,65 @@ class HMGUtils { } } - fun getGeoZonesFromPreference(context: Context): List { + fun getLanguageCode(context: Context) : Int { val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) - val json = pref.getString(PREF_KEY_HMG_ZONES,"[]") + val lang = pref.getString(PREF_KEY_LANGUAGE, "ar") + return if (lang == "ar") 2 else 1 + } - val geoZones = json?.let { GeoZoneModel().listFrom(it) } - return geoZones!! + fun defaultHTTPParams(context: Context) : Map{ + return mapOf( + "ZipCode" to "966", + "VersionID" to 5.8, + "Channel" to 3, + "LanguageID" to getLanguageCode(context), + "IPAdress" to "10.20.10.20", + "generalid" to "Cs2020@2016$2958", + "PatientOutSA" to 0, + "SessionID" to null, + "isDentalAllowedBackend" to false, + "DeviceTypeID" to 2) + } + + + fun scheduleJob(context: Context, pendingIntentClassType:Class, jobId:Int, intervalDuration:String, deadlineMillis:Long = (30 * 1000)) { // default deadline: 30 Seconds + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { + val jobScheduler: JobScheduler = context.getSystemService(JobScheduler::class.java) + + val serviceComponent = ComponentName(context, pendingIntentClassType) + val builder = JobInfo.Builder(jobId, serviceComponent) + builder.setPersisted(true) + builder.setBackoffCriteria(30000, JobInfo.BACKOFF_POLICY_LINEAR) + + val intervalMillis = timeToMillis(intervalDuration,"HH:mm:ss") + builder.setMinimumLatency(intervalMillis) // wait at least + builder.setOverrideDeadline((intervalMillis + deadlineMillis)) // maximum delay + if (jobScheduler.schedule(builder.build()) == JobScheduler.RESULT_SUCCESS){ + Logs.save(context,"ScheduleJob", "${pendingIntentClassType.simpleName}: Job scheduled to trigger after duration $intervalDuration >> HH:mm:ss --('MinimumLatency:$intervalMillis Deadline:${(intervalMillis + deadlineMillis)}')--",Logs.STATUS.SUCCESS) + }else{ + Logs.save(context,"ScheduleJob", "${pendingIntentClassType.simpleName}: Failed to scheduled Job",Logs.STATUS.ERROR) + } + + } else { + Logs.save(context,"ScheduleJob", "${pendingIntentClassType.simpleName}: Failed to scheduled Job on VERSION.SDK_INT < ${android.os.Build.VERSION_CODES.M}",Logs.STATUS.ERROR) + } } } } -private fun Timer.schedule(timerTask: TimerTask) { -} private const val NOTIFICATION_CHANNEL_ID = BuildConfig.APPLICATION_ID + ".channel" -fun sendNotification(context: Context, title:String, @Nullable subtitle:String?, message:String?) { + +fun timeToMillis(time:String, format:String):Long{ + val sdf = SimpleDateFormat(format, Locale.US) + val millis = sdf.parse(time).time + TimeZone.getDefault().rawOffset + return millis +} + +fun sendNotification(context: Context, title: String, @Nullable subtitle: String?, message: String?) { val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O @@ -117,8 +160,18 @@ fun sendNotification(context: Context, title:String, @Nullable subtitle:String?, notificationManager.notify(getUniqueId(), notification.build()) } +//------------------------- +// Open Helper Methods +//------------------------- +fun getUniqueId() = ((System.currentTimeMillis() % 10000).toInt()) -private fun getUniqueId() = ((System.currentTimeMillis() % 10000).toInt()) +object DateUtils { + @JvmStatic + fun dateTimeNow() : String { + val format = SimpleDateFormat("dd-MMM-yyy hh:mm:ss") + return format.format(Date()) + } +} fun isJSONValid(jsonString: String?): Boolean { try { JSONObject(jsonString) } catch (ex: JSONException) { @@ -129,31 +182,43 @@ fun isJSONValid(jsonString: String?): Boolean { return true } +fun saveLog(context: Context, tag: String, message: String){ + val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) + var logs = pref.getString("LOGS", "") + logs += "$tag -> $message \n" + pref.edit().putString("LOGS", logs).apply(); +} + +fun getLogs(context: Context) : String?{ + val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) + return pref.getString("LOGS", "") +} + class HTTPResponse(data: T){ final var data:T = data } -fun httpPost(url: String, body: Map, onSuccess: (response: HTTPResponse) -> Unit, onError: (error: Exception) -> Unit){ +fun httpPost(url: String, body: Map, onSuccess: (response: HTTPResponse) -> Unit, onError: (error: Exception) -> Unit){ val gson = Gson() val type = object : TypeToken() {}.type val jsonBody = gson.toJson(body) url.httpPost() .jsonBody(jsonBody, Charsets.UTF_8) .timeout(10000) - .header("Content-Type","application/json") - .header("Allow","*/*") + .header("Content-Type", "application/json") + .header("Allow", "*/*") .response { request, response, result -> + result.doAsyncResult { } result.fold({ data -> val dataString = String(data) - if(isJSONValid(dataString)){ - val responseData = gson.fromJson(dataString,type) + if (isJSONValid(dataString)) { + val responseData = gson.fromJson(dataString, type) onSuccess(HTTPResponse(responseData)) - }else{ + } else { onError(Exception("Invalid response from server (Not a valid JSON)")) } }, { onError(it) - it.localizedMessage }) } diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/Logs.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/Logs.kt new file mode 100644 index 00000000..e74f463e --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/Logs.kt @@ -0,0 +1,145 @@ +package com.cloud.diplomaticquarterapp.utils + +import android.content.Context +import android.content.SharedPreferences +import android.os.Build +import com.cloud.diplomaticquarterapp.BuildConfig +import com.google.gson.Gson + +class Logs { + + enum class STATUS{ + SUCCESS, + ERROR; + } + class GeofenceEvent{ + companion object{ + fun save(context: Context, tag:String, message:String, status:Logs.STATUS = STATUS.SUCCESS){ + Logs.Common.save(context,"GeofenceEvent", tag, message, status) + } + + fun list(context: Context, tag:String? = null, status:Logs.STATUS? = null):List{ + return Logs.Common.list(context,"GeofenceEvent", tag, status) + } + + fun raw(context: Context):String{ + return Logs.Common.raw(context,"GeofenceEvent") + } + } + } + + class RegisterGeofence{ + companion object{ + fun save(context: Context, tag:String, message:String, status:Logs.STATUS = STATUS.SUCCESS){ + Logs.Common.save(context,"RegisterGeofence", tag, message, status) + } + + fun list(context: Context, tag:String? = null, status:Logs.STATUS? = null):List{ + return Logs.Common.list(context,"RegisterGeofence", tag, status) + } + + fun raw(context: Context):String{ + return Logs.Common.raw(context,"RegisterGeofence"); + } + } + } + + + companion object{ + private var pref:SharedPreferences? = null + fun save(context: Context, tag:String, message:String, status:Logs.STATUS = STATUS.SUCCESS){ + Logs.Common.save(context,"Logs", tag, message, status) + } + + fun list(context: Context, tag:String? = null, status:Logs.STATUS? = null):List{ + return Logs.Common.list(context,"Logs", tag, status) + } + + fun raw(context: Context):String{ + return Logs.Common.raw(context,"Logs"); + } + + private fun storage(context: Context):SharedPreferences{ + if(pref == null) { + pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) + } + return pref!! + } + } + + private class Common{ + companion object{ + private val gson = Gson() + + fun save(context: Context, key:String, tag:String, message:String, status:Logs.STATUS = STATUS.SUCCESS){ + if(!BuildConfig.DEBUG) + return + + val pref = Logs.storage(context) + + val string = pref.getString(key,"{}") + val json = gson.fromJson(string,LogsContainerModel::class.java) + json.add( + LogModel().apply { + this.TAG = tag + this.MESSAGE = message + this.STATUS = status.name + this.DATE = DateUtils.dateTimeNow() + } + ) + + pref.edit().putString(key,gson.toJson(json)).apply() + } + + fun list(context: Context, key:String, tag:String? = null, status:Logs.STATUS? = null):List{ + val pref = Logs.storage(context) + val string = pref.getString(key,"{}") + val json = gson.fromJson(string,LogsContainerModel::class.java) + if(tag == null && status == null) { + return json.LOGS + }else if(tag != null && status != null){ + return json.LOGS.filter { (it.TAG == tag && it.STATUS == status.name) } + }else if(tag != null){ + return json.LOGS.filter { (it.TAG == tag) } + }else if(status != null){ + return json.LOGS.filter { (it.STATUS == status.name) } + } + return listOf() + } + + fun raw(context: Context, key:String):String{ + val pref = Logs.storage(context) + val string = pref.getString(key,"{}") + return string!! + } + + } + } + + class LogModel{ + lateinit var TAG:String + lateinit var MESSAGE:String + lateinit var STATUS:String + lateinit var DATE:String + + companion object{ + fun with(tag:String, message:String, status:String):LogModel{ + return LogModel().apply { + this.TAG = tag + this.MESSAGE = message + this.STATUS = status + this.DATE = DateUtils.dateTimeNow() + } + } + } + } + + class LogsContainerModel{ + var LOGS = mutableListOf() + fun add(log:LogModel){ + LOGS.add(log) + } + } + + +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt index ed1a62c8..eb2fff08 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt @@ -105,7 +105,7 @@ class PlatformBridge(binaryMessenger: BinaryMessenger, flutterMainActivity: Main override fun success(result: Any?) { if(result is String) { val geoZones = GeoZoneModel().listFrom(result) - HMG_Geofence.shared(mainActivity).register(geoZones) + HMG_Geofence.shared(mainActivity).register(){ s, e -> } } } diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 8acc0c12..4e107030 100755 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -13,4 +13,10 @@ You have provided too many PendingIntents to the addGeofences() call. + + App do not have permission to access location service. + + + Geofence requests happened too frequently. + diff --git a/assets/images/map_markers/destination_map_marker.png b/assets/images/map_markers/destination_map_marker.png new file mode 100644 index 00000000..4f4eca35 Binary files /dev/null and b/assets/images/map_markers/destination_map_marker.png differ diff --git a/assets/images/map_markers/driver-pin.png b/assets/images/map_markers/driver-pin.png new file mode 100644 index 00000000..9d16ceca Binary files /dev/null and b/assets/images/map_markers/driver-pin.png differ diff --git a/assets/images/map_markers/source_map_marker.png b/assets/images/map_markers/source_map_marker.png new file mode 100644 index 00000000..4b493b09 Binary files /dev/null and b/assets/images/map_markers/source_map_marker.png differ diff --git a/assets/images/new-design/covid-19-car.svg b/assets/images/new-design/covid-19-car.svg new file mode 100644 index 00000000..b5c9cb85 --- /dev/null +++ b/assets/images/new-design/covid-19-car.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new-design/video.png b/assets/images/new-design/video.png new file mode 100644 index 00000000..2962aade Binary files /dev/null and b/assets/images/new-design/video.png differ diff --git a/assets/images/new-design/view_more.png b/assets/images/new-design/view_more.png new file mode 100644 index 00000000..8b52a7e7 Binary files /dev/null and b/assets/images/new-design/view_more.png differ diff --git a/assets/images/new-design/walkin.png b/assets/images/new-design/walkin.png new file mode 100644 index 00000000..248c8788 Binary files /dev/null and b/assets/images/new-design/walkin.png differ diff --git a/help/ios/Runner/Info.plist b/help/ios/Runner/Info.plist index fe4c8174..71ce57cb 100644 --- a/help/ios/Runner/Info.plist +++ b/help/ios/Runner/Info.plist @@ -41,5 +41,8 @@ UIViewControllerBasedStatusBarAppearance + + < key >NSCameraUsageDescription< /key > + < string >Camera permission is required for barcode scanning.< /string > diff --git a/ios/GoogleService-Info.plist b/ios/GoogleService-Info.plist index 0c093a2a..633037cb 100644 --- a/ios/GoogleService-Info.plist +++ b/ios/GoogleService-Info.plist @@ -3,21 +3,23 @@ CLIENT_ID - 864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r.apps.googleusercontent.com + 815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt.apps.googleusercontent.com REVERSED_CLIENT_ID - com.googleusercontent.apps.864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r + com.googleusercontent.apps.815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt + ANDROID_CLIENT_ID + 815750722565-m14h8mkosm7cnq6uh6rhqr54dn02d705.apps.googleusercontent.com API_KEY - AIzaSyA_6ayGCk4fly7o7eTVBrj9kuHBYHMAOfs + AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA GCM_SENDER_ID - 864393916058 + 815750722565 PLIST_VERSION 1 BUNDLE_ID - com.cloud.diplomaticquarterapp + com.HMG.HMG-Smartphone PROJECT_ID - diplomaticquarter-d2385 + api-project-815750722565 STORAGE_BUCKET - diplomaticquarter-d2385.appspot.com + api-project-815750722565.appspot.com IS_ADS_ENABLED IS_ANALYTICS_ENABLED @@ -29,8 +31,8 @@ IS_SIGNIN_ENABLED GOOGLE_APP_ID - 1:864393916058:ios:13f787bbfe6051f8b97923 + 1:815750722565:ios:328ec247a81a2ca23c186c DATABASE_URL - https://diplomaticquarter-d2385.firebaseio.com + https://api-project-815750722565.firebaseio.com \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a09481c1..1df50aa4 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,455 +1,25 @@ PODS: - - android_intent (0.0.1): - - Flutter - - barcode_scan_fix (0.0.1): - - Flutter - - MTBBarcodeScanner - - connectivity (0.0.1): - - Flutter - - Reachability - - connectivity_for_web (0.1.0): - - Flutter - - connectivity_macos (0.0.1): - - Flutter - - device_calendar (0.0.1): - - Flutter - - device_info (0.0.1): - - Flutter - - Firebase/CoreOnly (6.33.0): - - FirebaseCore (= 6.10.3) - - Firebase/Messaging (6.33.0): - - Firebase/CoreOnly - - FirebaseMessaging (~> 4.7.0) - - firebase_core (0.5.3): - - Firebase/CoreOnly (~> 6.33.0) - - Flutter - - firebase_core_web (0.1.0): - - Flutter - - firebase_messaging (7.0.3): - - Firebase/CoreOnly (~> 6.33.0) - - Firebase/Messaging (~> 6.33.0) - - firebase_core - - Flutter - - FirebaseCore (6.10.3): - - FirebaseCoreDiagnostics (~> 1.6) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Logger (~> 6.7) - - FirebaseCoreDiagnostics (1.7.0): - - GoogleDataTransport (~> 7.4) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Logger (~> 6.7) - - nanopb (~> 1.30906.0) - - FirebaseInstallations (1.7.0): - - FirebaseCore (~> 6.10) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - PromisesObjC (~> 1.2) - - FirebaseInstanceID (4.8.0): - - FirebaseCore (~> 6.10) - - FirebaseInstallations (~> 1.6) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - FirebaseMessaging (4.7.1): - - FirebaseCore (~> 6.10) - - FirebaseInstanceID (~> 4.7) - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Reachability (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - Protobuf (>= 3.9.2, ~> 3.9) - Flutter (1.0.0) - - flutter_email_sender (0.0.1): - - Flutter - - flutter_flexible_toast (0.0.1): - - Flutter - - flutter_inappwebview (0.0.1): - - Flutter - - flutter_local_notifications (0.0.1): - - Flutter - - flutter_plugin_android_lifecycle (0.0.1): - - Flutter - - flutter_tts (0.0.1): - - Flutter - - geolocator (6.1.9): - - Flutter - - google_maps_flutter (0.0.1): - - Flutter - - GoogleMaps (< 3.10) - - GoogleDataTransport (7.5.1): - - nanopb (~> 1.30906.0) - - GoogleMaps (3.9.0): - - GoogleMaps/Maps (= 3.9.0) - - GoogleMaps/Base (3.9.0) - - GoogleMaps/Maps (3.9.0): - - GoogleMaps/Base - - GoogleUtilities/AppDelegateSwizzler (6.7.2): - - GoogleUtilities/Environment - - GoogleUtilities/Logger - - GoogleUtilities/Network - - GoogleUtilities/Environment (6.7.2): - - PromisesObjC (~> 1.2) - - GoogleUtilities/Logger (6.7.2): - - GoogleUtilities/Environment - - GoogleUtilities/Network (6.7.2): - - GoogleUtilities/Logger - - "GoogleUtilities/NSData+zlib" - - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (6.7.2)" - - GoogleUtilities/Reachability (6.7.2): - - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (6.7.2): - - GoogleUtilities/Logger - - hexcolor (0.0.1): - - Flutter - - image_cropper (0.0.3): - - Flutter - - TOCropViewController (~> 2.5.4) - - image_picker (0.0.1): - - Flutter - - just_audio (0.0.1): - - Flutter - - local_auth (0.0.1): - - Flutter - - manage_calendar_events (0.0.1): - - Flutter - - map_launcher (0.0.1): - - Flutter - - maps_launcher (0.0.1): - - Flutter - - MTBBarcodeScanner (5.0.11) - - nanopb (1.30906.0): - - nanopb/decode (= 1.30906.0) - - nanopb/encode (= 1.30906.0) - - nanopb/decode (1.30906.0) - - nanopb/encode (1.30906.0) - - native_device_orientation (0.0.1): - - Flutter - - native_progress_hud (0.0.1): - - Flutter - NVActivityIndicatorView (5.1.1): - NVActivityIndicatorView/Base (= 5.1.1) - NVActivityIndicatorView/Base (5.1.1) - - path_provider (0.0.1): - - Flutter - - path_provider_linux (0.0.1): - - Flutter - - path_provider_macos (0.0.1): - - Flutter - - path_provider_windows (0.0.1): - - Flutter - - "permission_handler (5.0.1+1)": - - Flutter - - PromisesObjC (1.2.11) - - Protobuf (3.13.0) - - Reachability (3.2) - - screen (0.0.1): - - Flutter - - shared_preferences (0.0.1): - - Flutter - - shared_preferences_linux (0.0.1): - - Flutter - - shared_preferences_macos (0.0.1): - - Flutter - - shared_preferences_web (0.0.1): - - Flutter - - shared_preferences_windows (0.0.1): - - Flutter - - speech_to_text (0.0.1): - - Flutter - - Try - - TOCropViewController (2.5.5) - - Try (2.1.1) - - "twilio_programmable_video (0.5.0+4)": - - Flutter - - TwilioVideo (~> 3.4) - - TwilioVideo (3.7.2) - - url_launcher (0.0.1): - - Flutter - - url_launcher_linux (0.0.1): - - Flutter - - url_launcher_macos (0.0.1): - - Flutter - - url_launcher_web (0.0.1): - - Flutter - - url_launcher_windows (0.0.1): - - Flutter - - vibration (1.7.3): - - Flutter - - vibration_web (1.6.2): - - Flutter - - video_player (0.0.1): - - Flutter - - video_player_web (0.0.1): - - Flutter - - wakelock (0.0.1): - - Flutter - - webview_flutter (0.0.1): - - Flutter - - wifi (0.0.1): - - Flutter DEPENDENCIES: - - android_intent (from `.symlinks/plugins/android_intent/ios`) - - barcode_scan_fix (from `.symlinks/plugins/barcode_scan_fix/ios`) - - connectivity (from `.symlinks/plugins/connectivity/ios`) - - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - - device_calendar (from `.symlinks/plugins/device_calendar/ios`) - - device_info (from `.symlinks/plugins/device_info/ios`) - - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - - firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`) - - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) - - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`) - - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) - - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) - - geolocator (from `.symlinks/plugins/geolocator/ios`) - - google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`) - - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - - image_cropper (from `.symlinks/plugins/image_cropper/ios`) - - image_picker (from `.symlinks/plugins/image_picker/ios`) - - just_audio (from `.symlinks/plugins/just_audio/ios`) - - local_auth (from `.symlinks/plugins/local_auth/ios`) - - manage_calendar_events (from `.symlinks/plugins/manage_calendar_events/ios`) - - map_launcher (from `.symlinks/plugins/map_launcher/ios`) - - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) - - native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`) - - native_progress_hud (from `.symlinks/plugins/native_progress_hud/ios`) - NVActivityIndicatorView - - path_provider (from `.symlinks/plugins/path_provider/ios`) - - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) - - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) - - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - - screen (from `.symlinks/plugins/screen/ios`) - - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) - - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) - - shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`) - - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) - - twilio_programmable_video (from `.symlinks/plugins/twilio_programmable_video/ios`) - - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) - - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) - - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) - - vibration (from `.symlinks/plugins/vibration/ios`) - - vibration_web (from `.symlinks/plugins/vibration_web/ios`) - - video_player (from `.symlinks/plugins/video_player/ios`) - - video_player_web (from `.symlinks/plugins/video_player_web/ios`) - - wakelock (from `.symlinks/plugins/wakelock/ios`) - - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) - - wifi (from `.symlinks/plugins/wifi/ios`) SPEC REPOS: trunk: - - Firebase - - FirebaseCore - - FirebaseCoreDiagnostics - - FirebaseInstallations - - FirebaseInstanceID - - FirebaseMessaging - - GoogleDataTransport - - GoogleMaps - - GoogleUtilities - - MTBBarcodeScanner - - nanopb - NVActivityIndicatorView - - PromisesObjC - - Protobuf - - Reachability - - TOCropViewController - - Try - - TwilioVideo EXTERNAL SOURCES: - android_intent: - :path: ".symlinks/plugins/android_intent/ios" - barcode_scan_fix: - :path: ".symlinks/plugins/barcode_scan_fix/ios" - connectivity: - :path: ".symlinks/plugins/connectivity/ios" - connectivity_for_web: - :path: ".symlinks/plugins/connectivity_for_web/ios" - connectivity_macos: - :path: ".symlinks/plugins/connectivity_macos/ios" - device_calendar: - :path: ".symlinks/plugins/device_calendar/ios" - device_info: - :path: ".symlinks/plugins/device_info/ios" - firebase_core: - :path: ".symlinks/plugins/firebase_core/ios" - firebase_core_web: - :path: ".symlinks/plugins/firebase_core_web/ios" - firebase_messaging: - :path: ".symlinks/plugins/firebase_messaging/ios" Flutter: :path: Flutter - flutter_email_sender: - :path: ".symlinks/plugins/flutter_email_sender/ios" - flutter_flexible_toast: - :path: ".symlinks/plugins/flutter_flexible_toast/ios" - flutter_inappwebview: - :path: ".symlinks/plugins/flutter_inappwebview/ios" - flutter_local_notifications: - :path: ".symlinks/plugins/flutter_local_notifications/ios" - flutter_plugin_android_lifecycle: - :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" - flutter_tts: - :path: ".symlinks/plugins/flutter_tts/ios" - geolocator: - :path: ".symlinks/plugins/geolocator/ios" - google_maps_flutter: - :path: ".symlinks/plugins/google_maps_flutter/ios" - hexcolor: - :path: ".symlinks/plugins/hexcolor/ios" - image_cropper: - :path: ".symlinks/plugins/image_cropper/ios" - image_picker: - :path: ".symlinks/plugins/image_picker/ios" - just_audio: - :path: ".symlinks/plugins/just_audio/ios" - local_auth: - :path: ".symlinks/plugins/local_auth/ios" - manage_calendar_events: - :path: ".symlinks/plugins/manage_calendar_events/ios" - map_launcher: - :path: ".symlinks/plugins/map_launcher/ios" - maps_launcher: - :path: ".symlinks/plugins/maps_launcher/ios" - native_device_orientation: - :path: ".symlinks/plugins/native_device_orientation/ios" - native_progress_hud: - :path: ".symlinks/plugins/native_progress_hud/ios" - path_provider: - :path: ".symlinks/plugins/path_provider/ios" - path_provider_linux: - :path: ".symlinks/plugins/path_provider_linux/ios" - path_provider_macos: - :path: ".symlinks/plugins/path_provider_macos/ios" - path_provider_windows: - :path: ".symlinks/plugins/path_provider_windows/ios" - permission_handler: - :path: ".symlinks/plugins/permission_handler/ios" - screen: - :path: ".symlinks/plugins/screen/ios" - shared_preferences: - :path: ".symlinks/plugins/shared_preferences/ios" - shared_preferences_linux: - :path: ".symlinks/plugins/shared_preferences_linux/ios" - shared_preferences_macos: - :path: ".symlinks/plugins/shared_preferences_macos/ios" - shared_preferences_web: - :path: ".symlinks/plugins/shared_preferences_web/ios" - shared_preferences_windows: - :path: ".symlinks/plugins/shared_preferences_windows/ios" - speech_to_text: - :path: ".symlinks/plugins/speech_to_text/ios" - twilio_programmable_video: - :path: ".symlinks/plugins/twilio_programmable_video/ios" - url_launcher: - :path: ".symlinks/plugins/url_launcher/ios" - url_launcher_linux: - :path: ".symlinks/plugins/url_launcher_linux/ios" - url_launcher_macos: - :path: ".symlinks/plugins/url_launcher_macos/ios" - url_launcher_web: - :path: ".symlinks/plugins/url_launcher_web/ios" - url_launcher_windows: - :path: ".symlinks/plugins/url_launcher_windows/ios" - vibration: - :path: ".symlinks/plugins/vibration/ios" - vibration_web: - :path: ".symlinks/plugins/vibration_web/ios" - video_player: - :path: ".symlinks/plugins/video_player/ios" - video_player_web: - :path: ".symlinks/plugins/video_player_web/ios" - wakelock: - :path: ".symlinks/plugins/wakelock/ios" - webview_flutter: - :path: ".symlinks/plugins/webview_flutter/ios" - wifi: - :path: ".symlinks/plugins/wifi/ios" SPEC CHECKSUMS: - android_intent: 367df2f1277a74e4a90e14a8ab3df3112d087052 - barcode_scan_fix: 80dd65de55f27eec6591dd077c8b85f2b79e31f1 - connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 - connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b - connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 - device_calendar: 23b28a5f1ab3bf77e34542fb1167e1b8b29a98f5 - device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 - Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 - firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 - firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 - firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 - FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd - FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 - FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 - FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 - FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - flutter_email_sender: f787522d0e82f50e5766c1213dbffff22fdcf009 - flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 - flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189 - flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 - flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 - flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d - geolocator: 057a0c63a43e9c5296d8ad845a3ac8e6df23d899 - google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619 - GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 - GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac - GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 - hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 - image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4 - image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 - just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa - local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd - manage_calendar_events: 0338d505ea26cdfd20cd883279bc28afa11eca34 - map_launcher: e325db1261d029ff33e08e03baccffe09593ffea - maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 - MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc - native_device_orientation: e24d00be281de72996640885d80e706142707660 - native_progress_hud: f95f5529742b36a3c7fdecfa88dc018319e39bf9 NVActivityIndicatorView: 1f6c5687f1171810aa27a3296814dc2d7dec3667 - path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c - path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 - path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 - path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b - permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 - PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f - Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748 - Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 - screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0 - shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 - shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 - shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 - shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae - speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe - TOCropViewController: da59f531f8ac8a94ef6d6c0fc34009350f9e8bfe - Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 - twilio_programmable_video: 6a41593640f3d86af60b22541fd457b22deaae7f - TwilioVideo: 5257640fab00d1b9f44db060815b03516a9eb0e8 - url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 - url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 - url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c - url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 - vibration: b5a33e764c3f609a975b9dca73dce20fdde627dc - vibration_web: 0ba303d92469ba34d71c612a228b315908d7fcd9 - video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e - video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7 - wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 - webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 - wifi: d7d77c94109e36c4175d845f0a5964eadba71060 -PODFILE CHECKSUM: 5a17be3f8af73a757fa4439c77cf6ab2db29a6e7 +PODFILE CHECKSUM: d94bd40f28772938199c67fcced06ffe96096c14 -COCOAPODS: 1.10.0 +COCOAPODS: 1.10.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 009006ed..366647c0 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -28,8 +28,10 @@ E923EFD62587443800E3E751 /* HMGPlatformBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */; }; E923EFD82588D17700E3E751 /* gpx.gpx in Resources */ = {isa = PBXBuildFile; fileRef = E923EFD72588D17700E3E751 /* gpx.gpx */; }; E9620805255C2ED100D3A35D /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9620804255C2ED100D3A35D /* NetworkExtension.framework */; }; + E9A35329258B8E8F00CBA688 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E9A35328258B8E8F00CBA688 /* GoogleService-Info.plist */; }; E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */; }; E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */; }; + E9F7623B25922BCE00FB5CCF /* FlutterConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F7623A25922BCE00FB5CCF /* FlutterConstants.swift */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -78,8 +80,10 @@ E923EFD72588D17700E3E751 /* gpx.gpx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = gpx.gpx; sourceTree = ""; }; E9620803255C2ED100D3A35D /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; E9620804255C2ED100D3A35D /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; }; + E9A35328258B8E8F00CBA688 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -128,6 +132,7 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( + E9A35328258B8E8F00CBA688 /* GoogleService-Info.plist */, E923EFD72588D17700E3E751 /* gpx.gpx */, 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, @@ -177,6 +182,7 @@ E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */, E923EFD3258645C100E3E751 /* HMG_Geofence.swift */, E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */, + E9F7623A25922BCE00FB5CCF /* FlutterConstants.swift */, ); path = Helper; sourceTree = ""; @@ -213,8 +219,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 125A739F71A29FBAE7B4D5AC /* [CP] Embed Pods Frameworks */, - 940F4A376A48B060117A1E5D /* [CP] Copy Pods Resources */, + EFDAD5E1235DCA1DB6187148 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -265,6 +270,7 @@ files = ( E91B53A0256AAC1400E96549 /* GuestPOC_Certificate.cer in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + E9A35329258B8E8F00CBA688 /* GoogleService-Info.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, E923EFD82588D17700E3E751 /* gpx.gpx in Resources */, E91B539F256AAC1400E96549 /* GuestPOC_Certificate.p12 in Resources */, @@ -277,23 +283,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 125A739F71A29FBAE7B4D5AC /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - 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 = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 299B8FE131E5BAE7FA7E2FC9 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -330,36 +319,36 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 940F4A376A48B060117A1E5D /* [CP] Copy Pods Resources */ = { + 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + inputPaths = ( ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + name = "Run Script"; + outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { + EFDAD5E1235DCA1DB6187148 /* [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; }; /* End PBXShellScriptBuildPhase section */ @@ -374,6 +363,7 @@ E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */, E923EFD4258645C100E3E751 /* HMG_Geofence.swift in Sources */, E923EFD62587443800E3E751 /* HMGPlatformBridge.swift in Sources */, + E9F7623B25922BCE00FB5CCF /* FlutterConstants.swift in Sources */, 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, @@ -472,7 +462,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -488,7 +478,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_BUNDLE_IDENTIFIER = com.hmg.smartphone; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -611,7 +601,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -627,7 +617,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_BUNDLE_IDENTIFIER = com.hmg.smartphone; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -644,7 +634,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -660,7 +650,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_BUNDLE_IDENTIFIER = com.hmg.smartphone; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index e686619c..2dc828d1 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -2,46 +2,67 @@ import UIKit import Flutter import GoogleMaps +var userNotificationCenterDelegate:UNUserNotificationCenterDelegate? = nil @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { let locationManager = CLLocationManager() + var flutterViewController:MainFlutterVC! override func application( _ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { -// initLocationManager() GMSServices.provideAPIKey("AIzaSyCiiJiHkocPbcziHt9O8rGWavDrxHRQys8") GeneratedPluginRegistrant.register(with: self) - if let mainViewController = window.rootViewController as? MainFlutterVC{ - HMGPlatformBridge.initialize(flutterViewController: mainViewController) - } + initializePlatformChannel() if let _ = launchOptions?[.location] { HMG_Geofence.initGeofencing() } + UNUserNotificationCenter.current().delegate = self return super.application(application, didFinishLaunchingWithOptions: launchOptions) } -} - -extension AppDelegate: CLLocationManagerDelegate { - func initLocationManager(){ - locationManager.allowsBackgroundLocationUpdates = true - locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters - locationManager.activityType = .other - locationManager.delegate = self - locationManager.requestAlwaysAuthorization() + + func initializePlatformChannel(){ + if let mainViewController = window.rootViewController as? MainFlutterVC{ // platform initialization suppose to be in foreground + flutterViewController = mainViewController + HMGPlatformBridge.initialize(flutterViewController: flutterViewController) + + }else if let mainViewController = initialViewController(){ // platform initialization suppose to be in background + flutterViewController = mainViewController + HMGPlatformBridge.initialize(flutterViewController: flutterViewController) + } } - - func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) { - if region is CLCircularRegion { + + + func initialViewController() -> MainFlutterVC?{ + return nil //UIStoryboard(name: "Main", bundle: .main).instantiateInitialViewController() as? MainFlutterVC } - } - - func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) { - if region is CLCircularRegion { +} + +extension AppDelegate{ + override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { + if (notification.request.content.categoryIdentifier == HmgLocalNotificationCategoryIdentifier){ + completionHandler([.alert,.sound]) + }else{ + super.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler) + } } - } } + + +/* + let dart = FlutterDartProject(precompiledDartBundle: .main) + let engine = FlutterEngine(name: "com.hmg.cs", project: dart, allowHeadlessExecution: true) + if engine.run(){ + flutterMethodChannel = FlutterMethodChannel(name: "HMG-Platform-Bridge", binaryMessenger: engine.binaryMessenger) + + Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { (timer) in + FlutterText.with(key: "alreadyConnectedHmgNetwork"){ localized in + print(localized) + } + } + } + */ diff --git a/ios/Runner/Helper/API.swift b/ios/Runner/Helper/API.swift index 763147c8..b487f033 100644 --- a/ios/Runner/Helper/API.swift +++ b/ios/Runner/Helper/API.swift @@ -13,5 +13,10 @@ fileprivate let BASE_URL = "\(DOMAIN)/\(SERVICE)" struct API { static let WIFI_CREDENTIALS = "\(BASE_URL)/Hmg_SMS_Get_By_ProjectID_And_PatientID" - } + + +//struct API { +// static let WIFI_CREDENTIALS = FlutterConstants.WIFI_CREDENTIALS_URL +// static let LOG_GEOFENCE = FlutterConstants.LOG_GEOFENCE_URL +//} diff --git a/ios/Runner/Helper/Extensions.swift b/ios/Runner/Helper/Extensions.swift index a8793617..de67f9b9 100644 --- a/ios/Runner/Helper/Extensions.swift +++ b/ios/Runner/Helper/Extensions.swift @@ -18,6 +18,24 @@ extension String{ } } +extension Date{ + func toString(format:String) -> String{ + let df = DateFormatter() + df.dateFormat = format + return df.string(from: self) + } +} + +extension Dictionary{ + func merge(dict:[String:Any?]) -> [String:Any?]{ + var self_ = self as! [String:Any?] + dict.forEach { (kv) in + self_.updateValue(kv.value, forKey: kv.key) + } + return self_ + } +} + extension Bundle { func certificate(named name: String) -> SecCertificate { diff --git a/ios/Runner/Helper/FlutterConstants.swift b/ios/Runner/Helper/FlutterConstants.swift new file mode 100644 index 00000000..f1b3f098 --- /dev/null +++ b/ios/Runner/Helper/FlutterConstants.swift @@ -0,0 +1,36 @@ +// +// FlutterConstants.swift +// Runner +// +// Created by ZiKambrani on 22/12/2020. +// + +import UIKit + +class FlutterConstants{ + static var LOG_GEOFENCE_URL:String? + static var WIFI_CREDENTIALS_URL:String? + static var DEFAULT_HTTP_PARAMS:[String:Any?]? + + class func set(){ + + // (FiX) Take a start with FlutterMethodChannel (kikstart) + /* First call to flutter method is not returning the correct value (Always returning 'NSObject') then after it wroking fine and returning correct value*/ + FlutterText.with(key: "test") { (test) in + + flutterMethodChannel?.invokeMethod("getDefaultHttpParameters", arguments: nil){ (response) in + if let defaultHTTPParams = response as? [String:Any?]{ + DEFAULT_HTTP_PARAMS = defaultHTTPParams + } + + } + + flutterMethodChannel?.invokeMethod("getLogGeofenceFullUrl", arguments:nil){ (response) in + if let url = response as? String{ + LOG_GEOFENCE_URL = url + } + } + + } + } +} diff --git a/ios/Runner/Helper/GlobalHelper.swift b/ios/Runner/Helper/GlobalHelper.swift index c5eb7295..37687806 100644 --- a/ios/Runner/Helper/GlobalHelper.swift +++ b/ios/Runner/Helper/GlobalHelper.swift @@ -31,27 +31,59 @@ func dictionary(from:String) -> [String:Any]?{ } -func showNotification(identifier:String? = nil, title:String?, subtitle:String?, message:String?, sound:UNNotificationSound = UNNotificationSound.default){ - let notificationContent = UNMutableNotificationContent() - - if identifier != nil { notificationContent.categoryIdentifier = identifier! } - if title != nil { notificationContent.title = title! } - if subtitle != nil { notificationContent.body = message! } - if message != nil { notificationContent.subtitle = subtitle! } - - notificationContent.sound = UNNotificationSound.default - let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false) - let request = UNNotificationRequest(identifier: "\(Date().timeIntervalSinceNow)", content: notificationContent, trigger: trigger) - UNUserNotificationCenter.current().add(request) { error in - if let error = error { - print("Error: \(error)") +let HmgLocalNotificationCategoryIdentifier = "hmg.local.notification" +func showNotification(identifier:String? = nil, title:String?, subtitle:String?, message:String?, sound:UNNotificationSound = UNNotificationSound.default, categoryIdentifier:String = HmgLocalNotificationCategoryIdentifier){ + DispatchQueue.main.async { + let notificationContent = UNMutableNotificationContent() + notificationContent.categoryIdentifier = categoryIdentifier + + if identifier != nil { notificationContent.categoryIdentifier = identifier! } + if title != nil { notificationContent.title = title! } + if subtitle != nil { notificationContent.body = message! } + if message != nil { notificationContent.subtitle = subtitle! } + + notificationContent.sound = UNNotificationSound.default + let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false) + let request = UNNotificationRequest(identifier: "\(Date().timeIntervalSinceNow)", content: notificationContent, trigger: trigger) + + + UNUserNotificationCenter.current().add(request) { error in + if let error = error { + print("Error: \(error)") + } } } } +func appLanguageCode() -> Int{ + let lang = UserDefaults.standard.string(forKey: "language") ?? "ar" + return lang == "ar" ? 2 : 1 +} + +func userProfile() -> [String:Any?]?{ + var userProf = UserDefaults.standard.string(forKey: "flutter.imei-user-data") + if(userProf == nil){ + userProf = UserDefaults.standard.string(forKey: "flutter.user-profile") + } + return dictionary(from: userProf ?? "{}") +} + +fileprivate let defaultHTTPParams:[String : Any?] = [ + "ZipCode" : "966", + "VersionID" : 5.8, + "Channel" : 3, + "LanguageID" : appLanguageCode(), + "IPAdress" : "10.20.10.20", + "generalid" : "Cs2020@2016$2958", + "PatientOutSA" : 0, + "SessionID" : nil, + "isDentalAllowedBackend" : false, + "DeviceTypeID" : 2 +] -func httpPostRequest(urlString:String, jsonBody:[String:Any], completion:((Bool,[String:Any]?)->Void)?){ - let json: [String: Any] = jsonBody +func httpPostRequest(urlString:String, jsonBody:[String:Any?], completion:((Bool,[String:Any]?)->Void)?){ + var json: [String: Any?] = jsonBody + json = json.merge(dict: defaultHTTPParams) let jsonData = try? JSONSerialization.data(withJSONObject: json) // create post request @@ -77,6 +109,8 @@ func httpPostRequest(urlString:String, jsonBody:[String:Any], completion:((Bool, completion?(false,responseJSON) } + }else{ + completion?(false,nil) } } diff --git a/ios/Runner/Helper/HMGPlatformBridge.swift b/ios/Runner/Helper/HMGPlatformBridge.swift index f897188c..f94f9b34 100644 --- a/ios/Runner/Helper/HMGPlatformBridge.swift +++ b/ios/Runner/Helper/HMGPlatformBridge.swift @@ -49,6 +49,9 @@ class HMGPlatformBridge{ print("") } + Timer.scheduledTimer(withTimeInterval: 0.1, repeats: false) { (timer) in + FlutterConstants.set() + } } diff --git a/ios/Runner/Helper/HMG_Geofence.swift b/ios/Runner/Helper/HMG_Geofence.swift index fb469165..47454d3e 100644 --- a/ios/Runner/Helper/HMG_Geofence.swift +++ b/ios/Runner/Helper/HMG_Geofence.swift @@ -129,8 +129,10 @@ extension HMG_Geofence : CLLocationManagerDelegate{ extension HMG_Geofence{ func handleEvent(for region: CLRegion!, transition:Transition, location:CLLocation?) { - notifyUser(forRegion: region, transition: transition, location: locationManager.location) - notifyServer(forRegion: region, transition: transition, location: locationManager.location) + if let userProfile = userProfile(){ + notifyUser(forRegion: region, transition: transition, location: locationManager.location, userProfile: userProfile) + notifyServer(forRegion: region, transition: transition, location: locationManager.location, userProfile: userProfile) + } } func geoZone(by id: String) -> GeoZoneModel? { @@ -144,20 +146,14 @@ extension HMG_Geofence{ } - func notifyUser(forRegion:CLRegion, transition:Transition, location:CLLocation?){ - if let zone = geoZone(by: forRegion.identifier){ - if UIApplication.shared.applicationState == .active { - mainViewController.showAlert(withTitle: transition.name(), message: zone.message()) - }else{ - - } + func notifyUser(forRegion:CLRegion, transition:Transition, location:CLLocation?, userProfile:[String:Any?]){ + if let patientId = userProfile["PatientID"] as? Int{ + } } - func notifyServer(forRegion:CLRegion, transition:Transition, location:CLLocation?){ - df.dateFormat = "MMM/dd/yyyy hh:mm:ss" - if let userProfileJson = UserDefaults.standard.string(forKey: "flutter.user-profile"), - let userProfile = dictionary(from: userProfileJson), let patientId = userProfile["PatientID"] as? Int{ + func notifyServer(forRegion:CLRegion, transition:Transition, location:CLLocation?, userProfile:[String:Any?]){ + if let patientId = userProfile["PatientID"] as? Int{ if let idString = forRegion.identifier.split(separator: "_").first, let idInt = Int(idString){ let body:[String:Any] = [ @@ -165,22 +161,20 @@ extension HMG_Geofence{ "GeoType":transition.rawValue, "PatientID":patientId ] + + var logs = UserDefaults.init(suiteName: "GeoFenceLog")?.dictionary(forKey: "GEOFENCE_LOGS") ?? [:] + var geo = (logs[forRegion.identifier] as? [String]) ?? [] let url = "https://hmgwebservices.com/Services/Patients.svc/REST/GeoF_InsertPatientFileInfo" httpPostRequest(urlString: url, jsonBody: body){ (status,json) in - let status_ = status ? "Notified" : "Not notified" + let status_ = status ? "Notified successfully:" : "Failed to notify:" showNotification(title: transition.name(), subtitle: forRegion.identifier, message: status_) - var logs = UserDefaults.init(suiteName: "GeoFenceLog")?.dictionary(forKey: "LOGS") ?? [:] - if var geo = logs[forRegion.identifier] as? [String]{ - geo.append("\(status_) at \(df.string(from: Date()))") - }else{ - logs.updateValue(["\(status_) at \(df.string(from: Date()))"], forKey: forRegion.identifier) - } - - UserDefaults.init(suiteName: "GeoFenceLog")?.set(logs, forKey: "LOGS") + geo.append("\(status_) \(transition.name()) at \(Date().toString(format: "dd/MMM/yyy hh:mm:ss"))") + logs.updateValue( geo, forKey: forRegion.identifier) + UserDefaults.init(suiteName: "GeoFenceLog")?.set(logs, forKey: "GEOFENCE_LOGS") } } } diff --git a/ios/gpx.gpx b/ios/gpx.gpx index 9cc26956..ed8e9be6 100644 --- a/ios/gpx.gpx +++ b/ios/gpx.gpx @@ -1 +1 @@ - Sverrir Sigmundarson Office Office Mahmoud Home Mahmoud Home Panorama Mall Panorama Mall Saudi Architects Crossing Saudi Architects Crossing Office Office \ No newline at end of file + Sverrir Sigmundarson 608.26 620.97 617.77 643.86 \ No newline at end of file diff --git a/lib/config/config.dart b/lib/config/config.dart index cd7a5383..bce0cc8c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -32,41 +32,33 @@ const WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo'; const GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege'; +// Wifi Credentials +const WIFI_CREDENTIALS = "Services/Patients.svc/Hmg_SMS_Get_By_ProjectID_And_PatientID"; + ///Doctor -const GET_MY_DOCTOR = - 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; +const GET_MY_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; const GET_DOCTOR_PROFILE = 'Services/Doctors.svc/REST/GetDocProfiles'; -const GET_DOCTOR_RATING_NOTES = - 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating'; -const GET_DOCTOR_RATING_DETAILS = - 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails'; +const GET_DOCTOR_RATING_NOTES = 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating'; +const GET_DOCTOR_RATING_DETAILS = 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails'; const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating'; ///Prescriptions const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; -const GET_PRESCRIPTIONS_ALL_ORDERS = - 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PRESCRIPTION_REPORT = - 'Services/Patients.svc/REST/INP_GetPrescriptionReport'; -const SEND_PRESCRIPTION_EMAIL = - 'Services/Notifications.svc/REST/SendPrescriptionEmail'; -const GET_PRESCRIPTION_REPORT_ENH = - 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; +const GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PRESCRIPTION_REPORT = 'Services/Patients.svc/REST/INP_GetPrescriptionReport'; +const SEND_PRESCRIPTION_EMAIL = 'Services/Notifications.svc/REST/SendPrescriptionEmail'; +const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; ///Lab Order const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; -const SEND_LAB_RESULT_EMAIL = - 'Services/Notifications.svc/REST/SendLabReportEmail'; -const GET_Patient_LAB_RESULT = - 'Services/Patients.svc/REST/GetPatientLabResults'; -const GET_Patient_LAB_ORDERS_RESULT = - 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; +const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail'; +const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; /// const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; -const GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = - 'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo'; +const GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = 'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo'; const GET_PATIENT_ORDERS_DETAILS = 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead'; const GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL'; @@ -131,8 +123,7 @@ const GET_BLOOD_REQUEST = 'services/PatientVarification.svc/REST/BloodDonation_G ///Reports const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; const INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; -const SEND_MEDICAL_REPORT_EMAIL = - 'Services/Notifications.svc/REST/SendMedicalReportEmail'; +const SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail'; ///Rate const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; @@ -225,8 +216,10 @@ const GET_LIVECARE_HISTORY = 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtu const CANCEL_LIVECARE_REQUEST = 'Services/ER_VirtualCall.svc/REST/DeleteErRequest'; const SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; -const GET_USER_TERMS = '/Services/Patients.svc/REST/GetUserTermsAndConditions'; -const UPDATE_HEALTH_TERMS = '/services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; +const GET_USER_TERMS = 'Services/Patients.svc/REST/GetUserTermsAndConditions'; +const UPDATE_HEALTH_TERMS = 'services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; + +const GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactionsSts'; //URL to get medicine and pharmacies list const CHANNEL = 3; @@ -249,10 +242,8 @@ const GET_PAtIENTS_INSURANCE = "Services/Patients.svc/REST/Get_PatientInsuranceD const GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory"; const INSURANCE_DETAILS = "Services/Patients.svc/REST/Get_InsuranceCheckList"; -const GET_PATIENT_INSURANCE_DETAILS = - "Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails"; -const UPLOAD_INSURANCE_CARD = - 'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate'; +const GET_PATIENT_INSURANCE_DETAILS = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails"; +const UPLOAD_INSURANCE_CARD = 'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate'; const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; @@ -285,15 +276,25 @@ const GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRe const GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; const GET_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_GetDiabtecResults'; const ADD_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_AddDiabtecResult'; +const SEND_AVERAGE_BLOOD_SUGAR_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport'; +const DEACTIVATE_DIABETIC_STATUS = 'services/Patients.svc/REST/Patient_DeactivateDiabeticStatus'; +const DEACTIVATE_BLOOD_PRESSURES_STATUS = 'services/Patients.svc/REST/Patient_DeactivateBloodPressureStatus'; const GET_BLOOD_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage'; const GET_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetBloodPressureResult'; const ADD_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddBloodPressureResult'; +const UPDATE_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateBloodPressureResult'; +const SEND_AVERAGE_BLOOD_WEIGHT_REPORT = 'Services/Notifications.svc/REST/SendAverageBodyWeightReport'; +const SEND_AVERAGE_BLOOD_PRESSURE_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodPressureReport'; +const UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult'; const GET_WEIGHT_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage'; const GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; const ADD_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; +const UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult'; +const DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus'; + const ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = 'Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID'; const GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; @@ -305,8 +306,11 @@ const INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; const GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; // H2O +const H2O_GET_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_GetUserDetails_New"; +const H2O_UPDATE_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New"; const H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; const H2O_INSERT_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; +const H2O_UNDO_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity"; //E_Referral Services const GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes"; @@ -320,42 +324,38 @@ const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; // const GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/"; // pharmacy -const PHARMACY_VERIFY_CUSTOMER = "epharmacy/api/VerifyCustomer"; -const PHARMACY_GET_COUNTRY = "epharmacy/api/countries"; +const PHARMACY_AUTORZIE_CUSTOMER = "epharmacy/api/AutorizeCustomer"; +const PHARMACY_VERIFY_CUSTOMER = "VerifyCustomer"; +const PHARMACY_GET_COUNTRY = "countries"; const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer"; -const GET_PHARMACY_BANNER = "epharmacy/api/promotionbanners"; -const GET_PHARMACY_TOP_MANUFACTURER = "epharmacy/api/topmanufacturer"; -const GET_PHARMACY_BEST_SELLER_PRODUCT = "epharmacy/api/bestsellerproducts"; -const GET_PHARMACY_PRODUCTs_BY_IDS = "epharmacy/api/productsbyids/"; -const GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/"; +const GET_PHARMACY_BANNER = "promotionbanners"; +const GET_PHARMACY_TOP_MANUFACTURER = "topmanufacturer"; +const GET_PHARMACY_BEST_SELLER_PRODUCT = "bestsellerproducts"; +const GET_PHARMACY_PRODUCTs_BY_IDS = "productsbyids/"; +const GET_PHARMACY_PRODUCTs_BY_SKU = "productbysku/"; +const GET_CUSTOMERS_ADDRESSES = "Customers/"; +const SUBSCRIBE_PRODUCT = "subscribe?"; const GET_ORDER = "orders?"; -const GET_ORDER_DETAILS = "epharmacy/api/orders/"; +const GET_ORDER_DETAILS = "orders/"; const ADD_CUSTOMER_ADDRESS = "epharmacy/api/addcustomeraddress"; const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress"; const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress"; const GET_ADDRESS = "Customers/"; const GET_Cancel_ORDER = "cancelorder/"; const WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8"; -const GET_SHOPPING_CART = "epharmacy/api/shopping_cart_items/"; -const GET_SHIPPING_OPTIONS = "epharmacy/api/get_shipping_option/"; +const GET_SHOPPING_CART = "shopping_cart_items/"; +const GET_SHIPPING_OPTIONS = "get_shipping_option/"; const DELETE_SHOPPING_CART = "epharmacy/api/delete_shopping_cart_items/"; -const DELETE_SHOPPING_CART_ALL = - "epharmacy/api/delete_shopping_cart_item_by_customer/"; +const DELETE_SHOPPING_CART_ALL = "delete_shopping_cart_item_by_customer/"; const ORDER_SHOPPING_CART = "epharmacy/api/orders"; -const GET_LACUM_ACCOUNT_INFORMATION = - "Services/Patients.svc/REST/GetLakumAccountInformation"; -const GET_LACUM_GROUP_INFORMATION = - "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping"; -const LACUM_ACCOUNT_ACTIVATE = - "Services/Patients.svc/REST/LakumAccountActivation"; -const LACUM_ACCOUNT_DEACTIVATE = - "Services/Patients.svc/REST/LakumAccountDeactivation"; -const CREATE_LAKUM_ACCOUNT = - "Services/Patients.svc/REST/PHR_CreateLakumAccount"; -const TRANSFER_YAHALA_LOYALITY_POINTS = - "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; -const LAKUM_GET_USER_TERMS_AND_CONDITIONS = - "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; +const GET_LACUM_ACCOUNT_INFORMATION = "Services/Patients.svc/REST/GetLakumAccountInformation"; +const GET_LACUM_GROUP_INFORMATION = "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping"; +const LACUM_ACCOUNT_ACTIVATE = "Services/Patients.svc/REST/LakumAccountActivation"; +const LACUM_ACCOUNT_DEACTIVATE = "Services/Patients.svc/REST/LakumAccountDeactivation"; +const CREATE_LAKUM_ACCOUNT = "Services/Patients.svc/REST/PHR_CreateLakumAccount"; +const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; +const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; +const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; // Home Health Care const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; @@ -364,15 +364,13 @@ const PATIENT_ER_UPDATE_PRES_ORDER = "Services/Patients.svc/REST/PatientER_Updat const GET_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder"; const GET_CMC_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder"; const GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems"; -const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = - 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications'; -const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = - 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead'; -const GET_PATIENT_ALL_PRES_ORD = - 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const PATIENT_ER_INSERT_PRES_ORDER = - 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; +const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications'; +const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead'; +const GET_PATIENT_ALL_PRES_ORD = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const PATIENT_ER_INSERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews'; +const BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; +const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; //Pharmacy wishlist const GET_WISHLIST = "shopping_cart_items/"; @@ -386,39 +384,32 @@ const GET_SPECIFICATION = "productspecification/"; const GET_BRAND_ITEMS = "products?ManufacturerId="; // External API -const ADD_ADDRESS_INFO = - "https://mdlaboratories.com/exacartapi/api/addcustomeraddress"; -const GET_CUSTOMER_ADDRESSES = - "https://mdlaboratories.com/exacartapi/api/Customers/"; -const GET_CUSTOMER_INFO = - "https://mdlaboratories.com/exacartapi/api/VerifyCustomer"; +const ADD_ADDRESS_INFO = "https://mdlaboratories.com/exacartapi/api/addcustomeraddress"; +const GET_CUSTOMER_ADDRESSES = "https://mdlaboratories.com/exacartapi/api/Customers/"; +const GET_CUSTOMER_INFO = "https://mdlaboratories.com/exacartapi/api/VerifyCustomer"; //Pharmacy -const GET_PHARMACY_CATEGORISE = - 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; -const GET_OFFERS_CATEGORISE = 'epharmacy/api/discountcategories'; -const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/'; -const GET_CATEGORISE_PARENT = - 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; -const GET_PARENT_PRODUCTS = 'epharmacy/api/products?categoryid='; -const GET_SUB_CATEGORISE = - 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; -const GET_SUB_PRODUCTS = 'epharmacy/api/products?categoryid='; +const GET_PHARMACY_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; +const GET_OFFERS_CATEGORISE = 'discountcategories'; +const GET_OFFERS_PRODUCTS = 'offerproducts/'; +const GET_CATEGORISE_PARENT = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; +const GET_PARENT_PRODUCTS = 'products?categoryid='; +const GET_SUB_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; +const GET_SUB_PRODUCTS = 'products?categoryid='; const GET_FINAL_PRODUCTS = - 'epharmacy/api/products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId='; - + 'products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId='; const TIMER_MIN = 10; const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"; -const GET_BRANDS_LIST = 'epharmacy/api/categoryManufacturer?categoryids='; +const GET_BRANDS_LIST = 'categoryManufacturer?categoryids='; const GET_SEARCH_PRODUCTS = - 'epharmacy/api/searchproducts?fields=id,discount_ids,reviews,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&search_key='; + 'searchproducts?fields=id,discount_ids,reviews,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&search_key='; -const SCAN_QR_CODE = 'epharmacy/api/productbysku/'; +const SCAN_QR_CODE = 'productbysku/'; class AppGlobal { static var context; @@ -427,7 +418,6 @@ class AppGlobal { Request getPublicRequest() { Request request = new Request(); - request.VersionID = 5.6; //3.6; request.Channel = 3; request.IPAdress = "10.20.10.20"; request.generalid = 'Cs2020@2016\$2958'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 387dbcb1..9ba405e7 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -3,15 +3,24 @@ // --------- - -- - - - - - - - - ---------------- const Map platformLocalizedValues = { "errorConnectingHmgNetwork": {"en": "Sorry you are not connecting to HMG network", "ar": "نعتذر لست متصل في شكبة مستشفى د.سليمان الحبيب"}, - "successConnectingHmgNetwork": {"en": "You connected to HMG network successfully, you can access the app", "ar": "تم التصال بشبكة د.سليمان الحبيب بنجاح, تستطيع الان استخدام تطبيق الحبيب"}, + "successConnectingHmgNetwork": { + "en": "You connected to HMG network successfully, you can access the app", + "ar": "تم التصال بشبكة د.سليمان الحبيب بنجاح, تستطيع الان استخدام تطبيق الحبيب" + }, "failedConnectingHmgNetwork": { "en": "Sorry the connection to HMG network had been failed, make sure you are in range of HMG network", "ar": "نعتذر لقد فشل الاتصال بشبكة د.سليمان الحبيب, تاكد من وجودك داخل نطاق الشبكة" }, - "alreadyConnectedHmgNetwork": {"en": " You already connected to HMG network to access Alhabib app", "ar": "انت متصل مسبقاً بالشبكة تستطيع استخدام تطبيق الحبيب"}, + "alreadyConnectedHmgNetwork": { + "en": " You already connected to HMG network to access Alhabib app", + "ar": "انت متصل مسبقاً بالشبكة تستطيع استخدام تطبيق الحبيب" + }, "somethingWentWrong": {"en": "Sorry something went wrong please try again later", "ar": "نعتذر لخدمتكم يرجى المحاولة لاحقا"}, "enablingWifi": {"en": "Enabling wifi...", "ar": "Enabling wifi..."}, - "connectedHmgNetworkWithInternet": {"en": "Successfully connected to the HMG network to access internet", "ar": "Successfully connected to the HMG network to access internet"}, + "connectedHmgNetworkWithInternet": { + "en": "Successfully connected to the HMG network to access internet", + "ar": "Successfully connected to the HMG network to access internet" + }, "connectedToHmgNetworkWithNoInternet": { "en": "Successfully connected to the HMG network but it have no internet access", "ar": "Successfully connected to the HMG network but it have no internet access" @@ -76,22 +85,24 @@ const Map localizedValues = { 'instruction': {'en': 'Instructions', 'ar': 'تعليمات'}, 'livecare': {'en': 'LiveCare', 'ar': 'لايف كير'}, 'livecareAppo': {'en': 'LiveCare Appointment', 'ar': 'الموعد لايف كير'}, - 'cancelAppoMsg': { - 'en': 'Are you sure you want to cancel this appointment?', - 'ar': 'هل أنت متأكد أنك تريد إلغاء هذا الموعد؟' - }, + 'cancelAppoMsg': {'en': 'Are you sure you want to cancel this appointment?', 'ar': 'هل أنت متأكد أنك تريد إلغاء هذا الموعد؟'}, 'upcoming-noAction': {'en': 'No Action Required', 'ar': 'لا يوجد إجراء مطلوب'}, 'upcoming-confirm': {'en': 'Please confirm the appointment to avoid cancellation', 'ar': 'يرجى تأكيد الموعد لتفادي الإلغاء'}, "book-success-confirm-more-24-1-2": { - "en": - "The online payment process will be available 24 hours before the appointment.", + "en": "The online payment process will be available 24 hours before the appointment.", "ar": "- عملية الدفع الالكتروني ستكون متاحة قبل الموعد ب 24 ساعة." }, - 'upcoming-payment-pending': {'en': 'Online Payment will be Activated before 24 Hours of Appointment Time', 'ar': 'سيتم تفعيل خدمة الدفع الالكتروني قبل 24 ساعة من موعد الحجز'}, + 'upcoming-payment-pending': { + 'en': 'Online Payment will be Activated before 24 Hours of Appointment Time', + 'ar': 'سيتم تفعيل خدمة الدفع الالكتروني قبل 24 ساعة من موعد الحجز' + }, 'upcoming-payment-now': {'en': 'Pay Online now to avoid long waiting queue', 'ar': 'ادفع الآن لتفادي الانتظار'}, 'upcoming-QR': {'en': 'Use the QR Code to Check-In in hospital', 'ar': 'استخدم الرمز لتسجيل الحضور في المستشفى'}, - 'upcoming-virtual': {'en': 'This is a virtual appointment, Please adhere to the instructions for a seamless experience.', 'ar': 'هذا موعد اتصال مرئي عن بعد ، يرجى اتباع تعليمات الخدمة.'}, + 'upcoming-virtual': { + 'en': 'This is a virtual appointment, Please adhere to the instructions for a seamless experience.', + 'ar': 'هذا موعد اتصال مرئي عن بعد ، يرجى اتباع تعليمات الخدمة.' + }, 'upcoming-livecare': {'en': 'This is a LiveCare appointment', 'ar': 'هذا موعد لايف كير'}, 'upcoming-details': {'en': 'More Details', 'ar': 'المزيد'}, 'reschedule': {'en': 'Reschedule', 'ar': 'إعادة جدولة'}, @@ -109,42 +120,21 @@ const Map localizedValues = { 'loginregister': {'en': 'Login / Register', 'ar': 'تسجيل الدخول'}, 'poweredBy': {'en': 'Powered By', 'ar': 'مشغل بواسطة'}, "welcome": {"en": "Welcome", "ar": "مرحبا"}, - "welcome_text": { - "en": "Dr. Sulaiman Al Habib Mobile Application", - "ar": "الدكتور سليمان الحبيب لتطبيقات الهاتف المتحرك" - }, - 'welcome_text2': { - 'en': 'Have you visited AlHabib Medical Group before? ', - 'ar': 'هل قمت بزيارة مجموعة الحبيب الطبية من قبل؟' - }, + "welcome_text": {"en": "Dr. Sulaiman Al Habib Mobile Application", "ar": "الدكتور سليمان الحبيب لتطبيقات الهاتف المتحرك"}, + 'welcome_text2': {'en': 'Have you visited AlHabib Medical Group before? ', 'ar': 'هل قمت بزيارة مجموعة الحبيب الطبية من قبل؟'}, 'yes': {'en': 'Yes', 'ar': 'نعم'}, 'no': {'en': 'No', 'ar': 'لا'}, - "logintyperadio": { - "en": "Choose from below options to login to your medical file.", - "ar": "اختر من الخيارات أدناه لتسجيل الدخول إلى ملفك الطبي." - }, + "logintyperadio": {"en": "Choose from below options to login to your medical file.", "ar": "اختر من الخيارات أدناه لتسجيل الدخول إلى ملفك الطبي."}, "registernow": {"en": "Register Now", "ar": "تسجيل الان"}, - "nationalID": { - "en": "Enter the Identification Number", - "ar": "أدخل رقم الهوية الوطنية او الاقامة" - }, + "nationalID": {"en": "Enter the Identification Number", "ar": "أدخل رقم الهوية الوطنية او الاقامة"}, "national-id": {"en": "National ID", "ar": "رقم الهوية"}, "fileNo": {"en": "File Number", "ar": "رقم الملف"}, "fileno": {"en": "File No", "ar": "رقم الملف"}, "forgotFileNo": {"en": "Forgot file Number?", "ar": "نسيت رقم الملف الطبي؟"}, - "forgotFileNoTitle": { - "en": "Forgot medical file Number", - "ar": "نسيت رقم الملف" - }, + "forgotFileNoTitle": {"en": "Forgot medical file Number", "ar": "نسيت رقم الملف"}, - "enter-national-id": { - "en": "Please enter mobile number and identification number", - "ar": "الرجاء إدخال رقم الجوال ورقم الهوية" - }, - "profile-info": { - "en": "Please enter profile information", - "ar": "الرجاء إدخال معلومات الملف الشخصي" - }, + "enter-national-id": {"en": "Please enter mobile number and identification number", "ar": "الرجاء إدخال رقم الجوال ورقم الهوية"}, + "profile-info": {"en": "Please enter profile information", "ar": "الرجاء إدخال معلومات الملف الشخصي"}, "submit": {"en": "Submit", "ar": "ارسال"}, "forgot-desc": { "en": "Enter the mobile number to receive the Medical file Number via SMS", @@ -153,10 +143,7 @@ const Map localizedValues = { "dob": {"en": "Birth Date:", "ar": "تاريخ الميلاد"}, "hijri-date": {"en": "Hijri Date", "ar": "التاريخ الهجري"}, "gregorian-date": {"en": "Gregorian Date", "ar": "التاريخ الميلادي"}, - "verify-login-with": { - "en": "Please choose one of the following options to verify", - "ar": "الرجاء اختيار احدى الخيارات التالية للتحقق من البيانات" - }, + "verify-login-with": {"en": "Please choose one of the following options to verify", "ar": "الرجاء اختيار احدى الخيارات التالية للتحقق من البيانات"}, "register-user": {"en": "Register", "ar": "تسجيل"}, "verify-with-fingerprint": {"en": "Fingerprint", "ar": "بصمة"}, "verify-with-faceid": {"en": "Face ID", "ar": "معرف الوجه"}, @@ -165,32 +152,19 @@ const Map localizedValues = { "last-login": {"en": "LAST LOGIN AT:", "ar": "آخر تسجيل دخول"}, "last-login-with": {"en": "VERIFICATION TYPE:", "ar": "نوع التحقق:"}, "verify-fingerprint": { - "en": - "To activate the fingerprint login service, please verify data by using one of the following options.", - "ar": - "لتفعيل خدمة الدخول بالبصمة، يرجى اختيار احدى القنوات التالية للتحقق من البيانات" + "en": "To activate the fingerprint login service, please verify data by using one of the following options.", + "ar": "لتفعيل خدمة الدخول بالبصمة، يرجى اختيار احدى القنوات التالية للتحقق من البيانات" }, 'searchMedicine': {'en': 'Search Medicine', 'ar': 'البحث عن الدواء'}, 'pharmaciesList': {'en': 'Pharmacies List', 'ar': 'قائمة الصيدلايات'}, - 'searchMedicineHere': { - 'en': 'Search Medicine Here', - 'ar': 'ابحث عن الدواء هنا' - }, + 'searchMedicineHere': {'en': 'Search Medicine Here', 'ar': 'ابحث عن الدواء هنا'}, 'description': {'en': 'Description', 'ar': 'الوصف'}, + 'howToUse': {'en': 'How to Use', 'ar': 'طريقة الأستخدام'}, 'price': {'en': 'Price', 'ar': 'السعر'}, 'youCanFindItIn': {'en': 'You can find it in', 'ar': 'يمكنكة ان تجده في'}, - 'pleaseEnterMedicineName': { - 'en': 'Please Enter Medicine Name', - 'ar': 'الرجائ ادخال اسم الدواء' - }, - "verification_message": { - "en": "Please enter the Verification Code sent to", - "ar": "الرجاء ادخال رمز التحقق الذي تم إرساله إلى" - }, - "validation_message": { - "en": "The verification code expires in", - "ar": "تنتهي صلاحية رمز التحقق خلال" - }, + 'pleaseEnterMedicineName': {'en': 'Please Enter Medicine Name', 'ar': 'الرجائ ادخال اسم الدواء'}, + "verification_message": {"en": "Please enter the Verification Code sent to", "ar": "الرجاء ادخال رمز التحقق الذي تم إرساله إلى"}, + "validation_message": {"en": "The verification code expires in", "ar": "تنتهي صلاحية رمز التحقق خلال"}, "arabic-change": {"en": "عربي", "ar": "English"}, "notification": {"en": "Notifications", "ar": "إشعارات"}, "app-settings": {"en": "App Settings", "ar": "إعدادات التطبيق"}, @@ -198,58 +172,32 @@ const Map localizedValues = { "before": {"en": "Before", "ar": "قبل"}, "minute": {"en": "Minutes", "ar": "دقيقة"}, "hour": {"en": "Hour", "ar": "ساعة"}, - "reminderSuccess": { - "en": "The reminder has been added successfully", - "ar": "يضاف التذكير بنجاح" - }, - "patientShareToDo": { - "en": "Amount before tax: ", - "ar": "المبلغ قبل الضريبة:" - }, + "reminderSuccess": {"en": "The reminder has been added successfully", "ar": "يضاف التذكير بنجاح"}, + "patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, - "patientShareTotalToDo": { - "en": "Total amount Due: ", - "ar": "المبلغ الإجمالي المستحق:" - }, + "patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"}, 'paymentMethod': {'en': 'Payment Method', 'ar': 'طريقة الدفع او السداد'}, - 'noNeedToWaitInLine': { - 'en': 'No need to stand in line.', - 'ar': 'لا داعي للوقوف في الطابور.' - }, - 'useQRAppoAttend': { - 'en': 'Use the QR code to register the appointment attendance.', - 'ar': 'استخدم الكود لتسجيل الحضور في المستشفى.' - }, + 'noNeedToWaitInLine': {'en': 'No need to stand in line.', 'ar': 'لا داعي للوقوف في الطابور.'}, + 'useQRAppoAttend': {'en': 'Use the QR code to register the appointment attendance.', 'ar': 'استخدم الكود لتسجيل الحضور في المستشفى.'}, 'passQRAppoAttend': { - 'en': - 'Pass the QR code through the attendance devices available in the Hospital.', + 'en': 'Pass the QR code through the attendance devices available in the Hospital.', 'ar': 'تمرير الكود من خلال اجهزة تسجيل الحضور المتوفرة في الفرع.' }, - 'sitWaitingQR': { - 'en': 'Sit in the waiting rooms until called by the nurse.', - 'ar': 'الجلوس في غرف الانتظار لحين منادتك من قبل الممرضة.' - }, - 'attendRegisterCode': { - 'en': 'Attendance registration code', - 'ar': 'رمز تسجيل الحضور' - }, + 'sitWaitingQR': {'en': 'Sit in the waiting rooms until called by the nurse.', 'ar': 'الجلوس في غرف الانتظار لحين منادتك من قبل الممرضة.'}, + 'attendRegisterCode': {'en': 'Attendance registration code', 'ar': 'رمز تسجيل الحضور'}, 'scanQRHospital': { 'en': 'Scan above QR Code to Check-In on the Machine in Hospital', 'ar': 'مسح فوق رمز الاستجابة السريعة للتحقق في الجهاز في المستشفى' }, "sendEmail": {"en": "Send Email", "ar": "ارسال نسخة"}, - "EmailSentSuccessfully": { - "en": "Email Sent Successfully", - "ar": "تم إرسال البريد الإلكتروني بنجاح" - }, + "success": {"en": "Done successfully", "ar": "تم تنفذ الطلب بنجاح"}, + "EmailSentSuccessfully": {"en": "Email Sent Successfully", "ar": "تم إرسال البريد الإلكتروني بنجاح"}, + "EmailSentError": {"en": "Error Sending Email", "ar": "خطأ في إرسال البريد الإلكتروني"}, "close": {"en": "Close", "ar": "مغلق"}, "booked": {"en": "Booked", "ar": "محجوز"}, "confirmed": {"en": "Confirmed", "ar": "مؤكد"}, "arrived": {"en": "Arrived", "ar": "تم الحضور"}, - "payNowBookSuccess": { - "en": "Pay now via Al Habib App", - "ar": "ادفع الآن عبر تطبيق الحبيب" - }, + "payNowBookSuccess": {"en": "Pay now via Al Habib App", "ar": "ادفع الآن عبر تطبيق الحبيب"}, "payNowBookSuccesstext1": { "en": "Pay Now using online payment service From secure payment gateways", "ar": "ادفع الآن باستخدام خدمة الدفع عبر الإنترنت من بوابات الدفع الآمنة" @@ -263,15 +211,9 @@ const Map localizedValues = { 'en': 'This service will be available for last 15 days doctor Visit only', 'ar': 'هذه الخدمة متاحة للزيارات خلال اخر 15 يوم فقط' }, - "more-verify": { - "en": "More Verification Options", - "ar": "المزيد من خيارات التحقق" - }, + "more-verify": {"en": "More Verification Options", "ar": "المزيد من خيارات التحقق"}, "welcome-back": {"en": "Welcome back!", "ar": "مرحبا بعودتك!"}, - "account-info": { - "en": "Would you like to login with current username?", - "ar": "هل ترغب في تسجيل الدخول باسم المستخدم الحالي؟" - }, + "account-info": {"en": "Would you like to login with current username?", "ar": "هل ترغب في تسجيل الدخول باسم المستخدم الحالي؟"}, "another-acc": {"en": "Use Another Account", "ar": "استخدم حسابا آخر"}, "next": {"en": "Next", "ar": 'التالى'}, "first-name": {"en": "First Name", "ar": "الاسم الأول"}, @@ -282,13 +224,10 @@ const Map localizedValues = { "preferred-language": {"en": "Preferred Language", "ar": "اللغة المفضلة"}, "english": {"en": "English", "ar": "الإنجليزية"}, "arabic": {"en": "Arabic", "ar": "العربية"}, - "locations-register": { - "en": "Where do you want to create this file?", - "ar": "أين تريد فتح هذا الملف؟" - }, + "locations-register": {"en": "Where do you want to create this file?", "ar": "أين تريد فتح هذا الملف؟"}, "ksa": {"en": "KSA", "ar": "السعودية"}, "dubai": {"en": "Dubai", "ar": "دبي"}, - "enter-email": {"en": "Enter Email", "ar": "ادخل البريد الالكتروني"}, + "enter-email": {"en": "Please Enter Email", "ar": "ادخل البريد الالكتروني"}, "family": {"en": "My Family", "ar": "عائلتي"}, "family-title": {"en": "My Family Files", "ar": "ملفات العائلة"}, "myFamily": {"en": "My Family", "ar": "ملفات العائلة"}, @@ -306,7 +245,8 @@ const Map localizedValues = { 'weight': {'en': 'Weight', 'ar': 'الوزن'}, 'height': {'en': 'Height', 'ar': 'الطول'}, 'heart': {'en': 'Heart', 'ar': 'قلب'}, - + "heightUnit": {"en": "height unit", "ar": "وحدة الطول"}, + "weightUnit": {"en": "Weight Unit", "ar": "وحدة الوزن"}, "request": {"en": "Request", "ar": "طلبات الاضافة"}, "member-name": {"en": "Member Name", "ar": "اسم العضو"}, "switch-login": {"en": "Switch User", "ar": "تغير المستخدم"}, @@ -324,10 +264,7 @@ const Map localizedValues = { "procedureStatus": {"en": "Procedure Status: ", "ar": "حالة الاجراء"}, "usageStatus": {"en": "Usage Status", "ar": "جالة الاستخدام"}, "unusedCount": {"en": "Unused Count: ", "ar": "غير مستخدم: "}, - "totalApproval": { - "en": "Total approval unused", - "ar": "اجمالي الموافقات الغير مستخدمة" - }, + "totalApproval": {"en": "Total approval unused", "ar": "اجمالي الموافقات الغير مستخدمة"}, "category": {"en": "Category: ", "ar": "الفئة"}, "expirationDate": {"en": "Expiration Date: ", "ar": "تاريخ الانتهاء"}, "patientCard": {"en": "Patient Card ID: ", "ar": "رقم الاشتراك"}, @@ -386,18 +323,9 @@ const Map localizedValues = { "ambulancerequest": {"en": "Ambulance :", "ar": "طلب نقل "}, "requestA": {"en": "Request:", "ar": "اسعاف"}, "MyAppointments": {"en": "Appointments", "ar": "مواعيدي"}, - "NoBookedAppointments": { - "en": "No Booked Appointments", - "ar": "لا توجد مواعيد محجوزة" - }, - "NoConfirmedAppointments": { - "en": "No Confirmed Appointments", - "ar": "لا توجد مواعيد مؤكدة" - }, - "noArrivedAppointments": { - "en": "No Arrived Appointments", - "ar": "لم تصل المواعيد" - }, + "NoBookedAppointments": {"en": "No Booked Appointments", "ar": "لا توجد مواعيد محجوزة"}, + "NoConfirmedAppointments": {"en": "No Confirmed Appointments", "ar": "لا توجد مواعيد مؤكدة"}, + "noArrivedAppointments": {"en": "No Arrived Appointments", "ar": "لم تصل المواعيد"}, "MyAppointmentsList": {"en": "List", "ar": "قائمة بمواعدي"}, "Radiology": {"en": "Radiology", "ar": "الأشعة"}, "RadiologySubtitle": {"en": "Result", "ar": "صور وتقارير"}, @@ -453,19 +381,10 @@ const Map localizedValues = { "VitalSign": {"en": "Vital Sign", "ar": "العلامة حيوية"}, "MonthlyReports": {"en": "Monthly Reports", "ar": "تقارير شهرية"}, "km": {"en": "KMs:", "ar": "كم"}, - "PatientHealthSummaryReport": { - "en": "Patient Health Summary Report", - "ar": " ملخص التقارير الشهرية" - }, - "ToViewTheTermsAndConditions": { - "en": "To View The Terms And Conditions Report", - "ar": " عرض الشروط والأحكام " - }, + "PatientHealthSummaryReport": {"en": "Patient Health Summary Report", "ar": " ملخص التقارير الشهرية"}, + "ToViewTheTermsAndConditions": {"en": "To View The Terms And Conditions Report", "ar": " عرض الشروط والأحكام "}, "ClickHere": {"en": "Click here", "ar": "أنقر هنا"}, - "IAgreeToTheTermsAndConditions": { - "en": "I agree to the terms and conditions ", - "ar": "أوافق على الشروط والاحكام " - }, + "IAgreeToTheTermsAndConditions": {"en": "I agree to the terms and conditions ", "ar": "أوافق على الشروط والاحكام "}, "IAgreeToTheTermsAndConditionsSubtitle": { "en": "I agree to the terms and conditions ", "ar": @@ -474,14 +393,8 @@ const Map localizedValues = { "Save": {"en": "Save", "ar": "حفظ "}, "UserAgreement": {"en": "User Agreement", "ar": "اتفاقية الخصوصية "}, "UpdateSuccessfully": {"en": "Update Successfully", "ar": "تم التحديث بنجاح"}, - "CHECK_VACCINE_AVAILABILITY": { - "en": "CHECK VACCINE AVAILABILITY", - "ar": "تحقق من توافر اللقاح" - }, - "MyVaccinesAvailability": { - "en": "MyVaccinesAvailability", - "ar": "توفر لقاحي" - }, + "CHECK_VACCINE_AVAILABILITY": {"en": "CHECK VACCINE AVAILABILITY", "ar": "تحقق من توافر اللقاح"}, + "MyVaccinesAvailability": {"en": "MyVaccinesAvailability", "ar": "توفر لقاحي"}, "PaymentService": {"en": "Payment Service", "ar": "خدمة المدفوعات"}, "PaymentOnline": {"en": "Service", "ar": "الالكتروني"}, "OnlineCheckIn": {"en": "Online Check-In", "ar": "مدفوعات معلقة"}, @@ -490,7 +403,10 @@ const Map localizedValues = { "TotalBalance": {"en": "Total Balance", "ar": "الرصيد الكلي"}, "CreateAdvancedPayment": {"en": "Create Advanced Payment", "ar": "إنشاء دفعة مقدمة"}, "AdvancePayment": {"en": "Advance Payment", "ar": "الدفع مقدما"}, - "AdvancePaymentLabel": {"en": "You can create and add an Advanced Payment for you account or other accounts.", "ar": "يمكنك تحويل مبلغ لحسابك لدى المجموعة أو لحساب احد المراجعين"}, + "AdvancePaymentLabel": { + "en": "You can create and add an Advanced Payment for you account or other accounts.", + "ar": "يمكنك تحويل مبلغ لحسابك لدى المجموعة أو لحساب احد المراجعين" + }, "FileNumber": {"en": "File Number", "ar": "رقم الملف"}, "Amount": {"en": "Amount *", "ar": "المبلغ *"}, "DepositorEmail": {"en": "Depositor Email *", "ar": "البريد الإلكتروني للمودع *"}, @@ -498,6 +414,7 @@ const Map localizedValues = { "SelectPatientName": {"en": "Select Patient Name", "ar": "اختر اسم المريض"}, "SelectFamilyPatientName": {"en": "Family Members", "ar": "أفراد الأسرة"}, "SelectHospital": {"en": "Select Hospital", "ar": "اختر المستشفى"}, + "selectCity": {"en": "Select City", "ar": "اختر المدينة"}, "MyAccount": {"en": "My Account", "ar": "حسابي"}, "OtherAccount": {"en": "Other Account", "ar": "حساب آخر"}, "SelectBeneficiary": {"en": "Select Beneficiary", "ar": "حدد المستفيد"}, @@ -505,14 +422,10 @@ const Map localizedValues = { "DepositorName": {"en": "Depositor Name", "ar": "اسم المودع *"}, "MobileNumber": {"en": "Mobile Number", "ar": "رقم الجوال"}, "Ok": {"en": "Ok", "ar": "حسنا"}, - "TheVerificationCodeExpiresIn": { - "en": "The Verification Code Expires In", - "ar": "تنتهي صلاحية رمز التحقق في" - }, - "PleaseEnterTheVerificationCode": { - "en": "Please enter the verification code send to", - "ar": "الرجاء إدخال رمز التحقق المرسل إلى" - }, + "WaterConsumedInWeek": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, + "WaterConsumedInMonth": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, + "TheVerificationCodeExpiresIn": {"en": "The Verification Code Expires In", "ar": "تنتهي صلاحية رمز التحقق في"}, + "PleaseEnterTheVerificationCode": {"en": "Please enter the verification code send to", "ar": "الرجاء إدخال رمز التحقق المرسل إلى"}, "EyeMeasurements": {"en": "Eye Measurements", "ar": "قياسات النظر"}, "Measurements": {"en": "Measurements", "ar": "قياسات"}, "Classes": {"en": "Classes", "ar": "نظارات"}, @@ -535,10 +448,8 @@ const Map localizedValues = { "DailyQuantity": {"en": "Daily Quantity :", "ar": "جرعات يومية"}, "AddReminder": {"en": "Add Reminder", "ar": "إضافة تذكير"}, "reminderDes": { - "en": - "Please select treatment start day and time to be notified when it\'s time to take the medicine", - "ar": - " يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" + "en": "Please select treatment start day and time to be notified when it\'s time to take the medicine", + "ar": " يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" }, "StartDay": {"en": "Start Day", "ar": "يوم البداية"}, "EndDay": {"en": "End Day", "ar": "يوم الانتهاء"}, @@ -548,24 +459,12 @@ const Map localizedValues = { "DoctorResponses": {"en": "Doctor Responses", "ar": "ردود الأطباء"}, "New": {"en": "New", "ar": "جديد"}, "All": {"en": "All", "ar": "الكل"}, - "QuestionHere": { - "en": "Enter the question here...", - "ar": "اضف الاستفسار هنا" - }, - "ViewDoctorResponses": { - "en": "View Doctor Responses", - "ar": "الاطلاع على ردود الأطباء" - }, + "QuestionHere": {"en": "Enter the question here...", "ar": "اضف الاستفسار هنا"}, + "ViewDoctorResponses": {"en": "View Doctor Responses", "ar": "الاطلاع على ردود الأطباء"}, "ServiceInformationButton": {"en": "LOGIN / REGISTER", "ar": "دخول / تسجيل"}, - "ServiceInformationTitle": { - "en": "Service Information", - "ar": "معلومات الخدمة" - }, + "ServiceInformationTitle": {"en": "Service Information", "ar": "معلومات الخدمة"}, "ServiceInformation": {"en": "Service Information", "ar": "معلومات الخدمة"}, - "HomeHealthCare": { - "en": "Home Health Care", - "ar": " الرعاية الصحية المنزلية " - }, + "HomeHealthCare": {"en": "Home Health Care", "ar": " الرعاية الصحية المنزلية "}, "HomeHealthCareText": { "en": "This service provides a set of home health care services, continuous and comprehensive follow-up in their places of residence for those who cannot access health facilities, such as (laboratory analyzes - radiology - vaccinations - physical therapy), etc.", @@ -577,14 +476,11 @@ const Map localizedValues = { "info-lab": { "en": "This service allows you to view the results of all laboratory tests performed in Al Habib Medical Group as well as sending the report via e-mail.", - "ar": - "خدمة نتائج المختبر: هذه الخدمة تمكنك من الاطلاع على نتائج جميع الفحوصات المخبرية التي تمت في مجموعة الحبيب الطبية." + "ar": "خدمة نتائج المختبر: هذه الخدمة تمكنك من الاطلاع على نتائج جميع الفحوصات المخبرية التي تمت في مجموعة الحبيب الطبية." }, "info-radiology": { - "en": - "This service allows you to view the reports and photos of radiology in Al Habib Medical Group as well as send the report by e-mail.", - "ar": - "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." + "en": "This service allows you to view the reports and photos of radiology in Al Habib Medical Group as well as send the report by e-mail.", + "ar": "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." }, "orders": {"en": "Orders", "ar": "الطلبات"}, "lakum": {"en": "Lakum", "ar": "لكم"}, @@ -603,6 +499,7 @@ const Map localizedValues = { "order": {"en": "My Order", "ar": " طلباتي"}, "delivered": {"en": "Delivered", "ar": " تم التوصيل"}, "pending": {"en": "Pending", "ar": " معلقة "}, + "enterNameHere": {"en": "Enter the name here", "ar": " أدخل الاسم هنا "}, "processing": {"en": "Processing", "ar": " تحت المعالجة"}, "cancelled": {"en": "Cancelled", "ar": " ملغي"}, "writeReview": {"en": "Write Review", "ar": " اكتب تقييمك"}, @@ -614,21 +511,13 @@ const Map localizedValues = { "cancelledOrder": {"en": " CANCELLED", "ar": "ملغي"}, "compare": {"en": " Compare", "ar": "مقارنه"}, "medicationsRefill": {"en": " Medication Refill", "ar": "طلب أعادة صرف"}, + "recommended": {"en": " Recommended For You", "ar": "موصى لك"}, "myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"}, "quantity": {"en": " QTY ", "ar": "الكمية"}, - "backMyAccount": { - "en": "BACK TO MY ACCOUNT ", - "ar": " الرجوع لحسابي الشخصي" - }, + "backMyAccount": {"en": "BACK TO MY ACCOUNT ", "ar": " الرجوع لحسابي الشخصي"}, "reviewSuccessful": {"en": "Review Successful", "ar": " تقييم ناجح"}, - "reviewShared": { - "en": "Your review has been shared on product review section", - "ar": " تمت مشاركة تقييمك في قسم تقييم المنتج" - }, - "reviewComment": { - "en": "Your reviews help other to choose better product", - "ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل" - }, + "reviewShared": {"en": "Your review has been shared on product review section", "ar": " تمت مشاركة تقييمك في قسم تقييم المنتج"}, + "reviewComment": {"en": "Your reviews help other to choose better product", "ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل"}, "shippedMethod": {"en": "SHIP BY:", "ar": " الشحن بواسطة:"}, "orderDetail": {"en": "Order Details", "ar": " تفاصيل الطلب"}, "orderSummary": {"en": "Order Summary", "ar": " تفاصيل المنتج"}, @@ -649,61 +538,32 @@ const Map localizedValues = { "confirmLocation": {"en": "CONFIRM LOCATION ", "ar": " تأكيد الموقع "}, "conditionsHMG": {"en": "Terms & Conditions ", "ar": "الشروط و الأحكام "}, "conditions": {"en": "Terms & Conditions of Lakum", "ar": "شروط و احكام لكم"}, - "confirmDeleteMsg": { - "en": "Are you sure! want to delete ", - "ar": "هل انت متأكد تريد الحذف " - }, + "confirmDeleteMsg": {"en": "Are you sure! want to delete ", "ar": "هل انت متأكد تريد الحذف "}, "confirmDelete": {"en": "DELETE", "ar": "حذف"}, - "confirmCancellation": { - "en": "Are you sure! want to cancel this order ", - "ar": "هل انت متأكد تريد حذف هذا المنتج " - }, + "confirmCancellation": {"en": "Are you sure! want to cancel this order ", "ar": "هل انت متأكد تريد حذف هذا المنتج "}, "orderNumber": {"en": "Order#: ", "ar": "الطلب: "}, "orderDate": {"en": "Date", "ar": "التاريخ:"}, "itemsNo": {"en": "items(s)", "ar": "عناصر"}, "noOrder": {"en": "You Don't have any orders.", "ar": "ليس لديك طلبات"}, "TermsService": {"en": "Terms of Service", "ar": "شروط الخدمه"}, - "Beforeusing": { - "en": "Before using the checkup, please read Terms of Service.", - "ar": "قبل استخدام الفحص ، يرجى قراءة شروط الخدمة" - }, - "accept": { - "en": "I read and accept Terms of Service and Privacy Policy", - "ar": "قرأت ووافقت على شروط الخدمة وسياسة الخصوصية" - }, + "Beforeusing": {"en": "Before using the checkup, please read Terms of Service.", "ar": "قبل استخدام الفحص ، يرجى قراءة شروط الخدمة"}, + "accept": {"en": "I read and accept Terms of Service and Privacy Policy", "ar": "قرأت ووافقت على شروط الخدمة وسياسة الخصوصية"}, "data-safe-info": { - "en": - "Information that you provide is anonymous and not shared with anyone.", + "en": "Information that you provide is anonymous and not shared with anyone.", "ar": "المعلومات التي تقدمها لا تتم مشاركتها مع أي شخص" }, "data-safe": {"en": " Your data is safe.", "ar": "بياناتك آمنة"}, "informational": { - "en": - "Checkup is for informational purposes and is not a qualified medical opinion", + "en": "Checkup is for informational purposes and is not a qualified medical opinion", "ar": "الفحص هو لأغراض معلوماتية وليس رأي طبي مؤهل" }, - "not-use-in-emerbency": { - "en": "Do not use in emergencies.", - "ar": "لا تستخدم في حالات الطوارئ" - }, - "not-use-in-emerbency-details": { - "en": "In case of health emergency, ", - "ar": "في حالة الطوارئ اتصل بأقرب رقم للطوارئ على الفور" - }, - "not-use-in-emerbency-details-call": { - "en": "call the nearest emergency number immediately", - "ar": " اتصل بأقرب رقم للطوارئ على الفور" - }, - "check-diagnosis": { - "en": "Checkup is not a diagnosis.", - "ar": "الفحص ليس تشخيص." - }, + "not-use-in-emerbency": {"en": "Do not use in emergencies.", "ar": "لا تستخدم في حالات الطوارئ"}, + "not-use-in-emerbency-details": {"en": "In case of health emergency, ", "ar": "في حالة الطوارئ اتصل بأقرب رقم للطوارئ على الفور"}, + "not-use-in-emerbency-details-call": {"en": "call the nearest emergency number immediately", "ar": " اتصل بأقرب رقم للطوارئ على الفور"}, + "check-diagnosis": {"en": "Checkup is not a diagnosis.", "ar": "الفحص ليس تشخيص."}, "remeberthat": {"en": "Remember that", "ar": "تذكر ذلك:"}, - "loginToUseService": { - "en": "You need to login to use this service", - "ar": "هذة الخدمة تتطلب تسجيل الدخول" - }, + "loginToUseService": {"en": "You need to login to use this service", "ar": "هذة الخدمة تتطلب تسجيل الدخول"}, // pharmacy module "medicationRefill": {"en": "MEDICATION REFILL", "ar": "إعادة تعبئة الدواء"}, @@ -718,10 +578,7 @@ const Map localizedValues = { "selectAddress": {"en": "Select Address", "ar": "حدد العنوان"}, "shippingAddress": {"en": "SHIPPING ADDRESS", "ar": "عنوان الشحن"}, "changeAddress": {"en": "Change Address", "ar": "تغيير العنوان"}, - "selectPaymentOption": { - "en": "Select Payment Option", - "ar": "حدد خيار الدفع" - }, + "selectPaymentOption": {"en": "Select Payment Option", "ar": "حدد خيار الدفع"}, "changeMethod": {"en": "Change Method", "ar": "تغيير خيار الدفع"}, "reviewOrder": {"en": "Review Order", "ar": "مراجعة الطلب"}, "active": {"en": "ACTIVE", "ar": "فعال"}, @@ -739,24 +596,17 @@ const Map localizedValues = { "select-age": {"en": "Select Your Age", "ar": "حدد العمر"}, "i-am": {"en": "I am", "ar": "أنا"}, "years-old": {"en": "years old", "ar": "سنة"}, - "drag-point": { - "en": "Drag point to change your age", - "ar": "اسحب لتغيير عمرك" - }, + "drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"}, "categorise": {"en": "Categories", "ar": "التطبيقات"}, "wishList": {"en": "WishList", "ar": "الرغبات"}, "myAccount": {"en": "My Account", "ar": "حسابي"}, "cart": {"en": "Cart", "ar": "التسوق"}, - "searchProductHere": { - "en": "Search Product here", - "ar": "ابحث في الطلب الخاص بك" - }, + "searchProductHere": {"en": "Search Product here", "ar": "ابحث في الطلب الخاص بك"}, "HHCNotAuthMsg": { "en": "This service provides a set of home health care services, continuous and comprehensive follow-up in their places of residence for those who cannot access health facilities, such as (laboratory analyzes - radiology - vaccinations - physical therapy), etc.", - "ar": - "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" + "ar": "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" }, "email": {"en": "Email", "ar": "البريد الالكتروني"}, "Book": {"en": "Book", "ar": "احجز"}, @@ -776,7 +626,12 @@ const Map localizedValues = { "View details of your appointments with the selected doctor.", "Book appointment with the doctor. ", ], - "ar": ["الاطلاع على معلومات الطبيب ومؤهلاته.", "الاطلاع على جدول الطبيب.", "الاطلاع على تفاصيل المواعيد التي تمت مع الطبيب.", "حجز موعد مع الطبيب."] + "ar": [ + "الاطلاع على معلومات الطبيب ومؤهلاته.", + "الاطلاع على جدول الطبيب.", + "الاطلاع على تفاصيل المواعيد التي تمت مع الطبيب.", + "حجز موعد مع الطبيب." + ] }, "info-my-doctor": { "en": "This service allows you to see all the doctors you have visited in Al Habib Medical Group, and through this service:", @@ -784,7 +639,8 @@ const Map localizedValues = { }, "info-prescriptions": { "en": "This service allows you to view all the medical prescriptions issued by Al Habib Medical Group, and through this service, you can:", - "ar": "خدمة الوصفات الطبية: هذه الخدمة تمكنك من الاطلاع على جميع الوصفات الطبية التي تم اصدارها في مجموعة الحبيب الطبية، كما تستطيع من خلال هذه الخدمة:" + "ar": + "خدمة الوصفات الطبية: هذه الخدمة تمكنك من الاطلاع على جميع الوصفات الطبية التي تم اصدارها في مجموعة الحبيب الطبية، كما تستطيع من خلال هذه الخدمة:" }, "info-my-prescription-points": { "en": [ @@ -809,7 +665,8 @@ const Map localizedValues = { "info-insurance-cards": { "en": "This service allows you to view all the insurance cards that recorded during your visits to Al Habib Medical Group in addition to:", - "ar": "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" + "ar": + "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" }, "info-insurance-cards-points": { @@ -832,19 +689,15 @@ const Map localizedValues = { }, "info-allergies": { - "en": - "This service allows you to view all types of allergies recorded during your visits to Al Habib Medical Group.", - "ar": - "خدمة الحساسية: هذه الخدمة تمكنك من الاطلاع على جميع انواع الحساسية التي تم تسجيلها خلال زياراتك في مجموعة الحبيب الطبية." + "en": "This service allows you to view all types of allergies recorded during your visits to Al Habib Medical Group.", + "ar": "خدمة الحساسية: هذه الخدمة تمكنك من الاطلاع على جميع انواع الحساسية التي تم تسجيلها خلال زياراتك في مجموعة الحبيب الطبية." }, "sick-leaves": {"en": "Sick Leaves", "ar": "الاجازات المرضية"}, "info-sick-leaves": { - "en": - "This service allows you to view all sick leaves that were taken in Al Habib Medical Group in addition to:", - "ar": - "الاجازات المرضية: هذه الخدمة تمكنك من الاطلاع على جميع الاجازات المرضية والتي تم اصدارها في مجموعة الحبيب الطبية بالاضافة الى:" + "en": "This service allows you to view all sick leaves that were taken in Al Habib Medical Group in addition to:", + "ar": "الاجازات المرضية: هذه الخدمة تمكنك من الاطلاع على جميع الاجازات المرضية والتي تم اصدارها في مجموعة الحبيب الطبية بالاضافة الى:" }, "info-sick-leave-points": { "en": [ @@ -864,10 +717,8 @@ const Map localizedValues = { }, "info-approvals": { - "en": - "This service allows you to view all approvals requests that have been sent to the insurance companies in addition to:", - "ar": - "خدمة الموافقات: هذه الخدمة تمكنك من الاطلاع على جميع طلبات الموافقات والتي تم ارسالها الى شركات التامين بالاضافة الى:" + "en": "This service allows you to view all approvals requests that have been sent to the insurance companies in addition to:", + "ar": "خدمة الموافقات: هذه الخدمة تمكنك من الاطلاع على جميع طلبات الموافقات والتي تم ارسالها الى شركات التامين بالاضافة الى:" }, "info-approval-points": { @@ -888,34 +739,16 @@ const Map localizedValues = { "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." }, - "language-setting": { - "en": "SMS and Confirmation Calls Language", - "ar": "لغة الرسائل القصيرة و الاتصال الآلي" - }, + "language-setting": {"en": "SMS and Confirmation Calls Language", "ar": "لغة الرسائل القصيرة و الاتصال الآلي"}, "alert": {"en": "Alerts", "ar": "التنبيهات"}, - "email-alert": { - "en": "Alert By Email", - "ar": "استلام التنبيهات بالبريد الالكتروني" - }, - "sms-alert": { - "en": "Alert By SMS", - "ar": "استلام التنبيهات بالرسائل القصيرة" - }, + "email-alert": {"en": "Alert By Email", "ar": "استلام التنبيهات بالبريد الالكتروني"}, + "sms-alert": {"en": "Alert By SMS", "ar": "استلام التنبيهات بالرسائل القصيرة"}, "contact-info": {"en": "Contact Information", "ar": "معلومات التواصل"}, - "emrg-name": { - "en": "Emergency Contact Name", - "ar": "اسم للتواصل في حالة الطوارئ" - }, - "emrg-no": { - "en": "Emergency Contact Number", - "ar": "رقم للتواصل في حالة الطوارئ" - }, + "emrg-name": {"en": "Emergency Contact Name", "ar": "اسم للتواصل في حالة الطوارئ"}, + "emrg-no": {"en": "Emergency Contact Number", "ar": "رقم للتواصل في حالة الطوارئ"}, "modes": {"en": "Modes", "ar": "الاوضاع"}, "vibration": {"en": "Vibration Touch Feedback", "ar": "الاهتزاز عند اللمس"}, - "blind-modes": { - "en": "Modes for Partially Blind", - "ar": "تأثيرات لدعم ضعاف البصر" - }, + "blind-modes": {"en": "Modes for Partially Blind", "ar": "تأثيرات لدعم ضعاف البصر"}, "invert-theme": {"en": "Invert", "ar": "ألوان سلبية"}, "off-theme": {"en": "Off", "ar": "إيقاف"}, "dim-theme": {"en": "Dim", "ar": "ضوء خافت"}, @@ -932,14 +765,8 @@ const Map localizedValues = { "LiveChat": {"en": "Live Chat", "ar": "محادثة مباشرة"}, "Service": {"en": "Service", "ar": "خدمة"}, "HMGServiceLabel": {"en": "HMG Service", 'ar': 'خدمات الحبيب'}, - "HealthWeatherIndicators": { - "en": "Health Weather Indicators", - 'ar': ' مؤشرات الطقس الصحية ' - }, - "HealthTipsBasedOnCurrentWeather": { - "en": "Health Tips Based On Current Weather", - 'ar': ' نصائح صحية على أساس الطقس الحالي ' - }, + "HealthWeatherIndicators": {"en": "Health Weather Indicators", 'ar': ' مؤشرات الطقس الصحية '}, + "HealthTipsBasedOnCurrentWeather": {"en": "Health Tips Based On Current Weather", 'ar': ' نصائح صحية على أساس الطقس الحالي '}, "MoreDetails": {"en": "More details", "ar": " المزيد من التفاصيل "}, "SendCopy": {"en": "Send Copy", "ar": "ارسال نسخة"}, "ResendOrder": {"en": "Resend order & deliver", "ar": "إعادة طلب و توصيل"}, @@ -949,7 +776,10 @@ const Map localizedValues = { "DailyDoses": {"en": "Daily Doses", "ar": "جرعات يومية"}, "Period": {"en": "Period", "ar": "الفترة"}, "cm": {"en": "CM", "ar": "سم"}, + "ft": {"en": "ft", "ar": "قدم"}, "kg": {"en": "kg", "ar": "كجم"}, + "lb": {"en": "lb", "ar": "رطل"}, + "birth_date": {"en": "Birth Date", "ar": "تاريخ الميلاد"}, "mass": {"en": "Mass", "ar": "كتلة"}, "temp-c": {"en": "°C", "ar": "°س"}, "bpm": {"en": "bpm", "ar": "نبضة"}, @@ -960,47 +790,38 @@ const Map localizedValues = { "send": {"en": "Send", "ar": "أرسل"}, "status": {"en": "Status", "ar": "الحالة"}, "like-to-hear": { - "en": - "We would love to hear the feedback, concerns on healthcare services and eServices experience. Please use the below form", - "ar": - "يسعدنا سماع ملاحظاتك حول خدمات الرعاية الصحية والخدمات الإلكترونية. يرجى تعبئة الحقول المطلوبة" + "en": "We would love to hear the feedback, concerns on healthcare services and eServices experience. Please use the below form", + "ar": "يسعدنا سماع ملاحظاتك حول خدمات الرعاية الصحية والخدمات الإلكترونية. يرجى تعبئة الحقول المطلوبة" }, "subject": {"en": "Subject", "ar": "الموضوع"}, "message": {"en": "Message", "ar": "رسالة"}, - "empty-subject": { - "en": "Please enter the subject", - "ar": "يرجى ادخال الموضوع" - }, + "empty-subject": {"en": "Please enter the subject", "ar": "يرجى ادخال الموضوع"}, "empty-message": {"en": "Please enter message", "ar": "يرجى ادخال الرسالة"}, "select-attachment": {"en": "Select Attachment", "ar": "إختر المرفق"}, "complain-appo": {"en": "Complaint for appointment", "ar": "شكوى على موعد"}, - "complain-without-appo": { - "en": "Complaint without appointment", - "ar": "شكوى بدون موعد" - }, + "complain-without-appo": {"en": "Complaint without appointment", "ar": "شكوى بدون موعد"}, "question": {"en": "Question", "ar": "سؤال"}, "message-type": {"en": "Message Type", "ar": "نوع الرسالة"}, "compliment": {"en": "compliment", "ar": "ثناء"}, "suggestion": {"en": "Suggestion", "ar": "إقتراح"}, "your-feedback": {"en": "Your feedback was sent", "ar": "لقد تم ارسال اقراحك شكرا لك"}, - "select-part": { - "en": "Please select the part that complain about", - "ar": "يرجى تحديد الجزء الذي تشكو منه" - }, + "select-part": {"en": "Please select the part that complain about", "ar": "يرجى تحديد الجزء الذي تشكو منه"}, "number": {"en": "Number", "ar": "الرقم"}, "not-classified": {"en": "Not classified", "ar": "غير محدد"}, "selectClinic": {"en": "Select Clinic", "ar": " بحث بالعيادة"}, - "searchItemError": { - "en": "Item name should be more than 3 character ", - "ar": "يجب أن يكون اسم العنصر أكثر من 3 أحرف" - }, + "searchItemError": {"en": "Item name should be more than 3 character ", "ar": "يجب أن يكون اسم العنصر أكثر من 3 أحرف"}, "YouCanFind": {"en": "You Can Find ", "ar": "باستطاعتك العثور على "}, "ItemInSearch": {"en": " Item In Search", "ar": " عنصر في البحث "}, "wantConnectHmgNetwork": { - "en": "Dear customer there is no internet access, Do you want to connect with HMG network to use our app, make sure you are in range of HMG network", - "ar": "عزيز العميل لا يوجد اتصال بالإنترنت, هل تريد الاتصال بشبكة مستشفى د. سليمان الحبيب لاستخدام التطبيق. يجب عليك ان تكون في نطاق شبكة المستشفى" + "en": + "Dear customer there is no internet access, Do you want to connect with HMG network to use our app, make sure you are in range of HMG network", + "ar": + "عزيز العميل لا يوجد اتصال بالإنترنت, هل تريد الاتصال بشبكة مستشفى د. سليمان الحبيب لاستخدام التطبيق. يجب عليك ان تكون في نطاق شبكة المستشفى" + }, + "failedToAccessHmgServices": { + "en": "Connected with HMG Network,\n\nBut failed to access HMG services", + "ar": "Connected with HMG Network,\n\nBut failed to access HMG services" }, - "failedToAccessHmgServices": {"en": "Connected with HMG Network,\n\nBut failed to access HMG services", "ar": "Connected with HMG Network,\n\nBut failed to access HMG services"}, "offerAndPackages": {"en": "Offers And Packages", "ar": "العروض والباقات"}, "InvoiceNo": {"en": " Invoice No", "ar": "رقم الفاتورة"}, "SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"}, @@ -1032,31 +853,20 @@ const Map localizedValues = { "info-advance-payment": { "en": "This service designed so that you can deposit an amount in advance either in your account or in someone else's account with Al Habib Medical Group.", - "ar": - "تم تصميم هذه الخدمة حتى تتمكن من دفع مبلغ مقدما او تحت الحساب سواء في حسابك او في حساب شخص اخر لدى مجموعة الحبيب الطبية." - }, - "info-my-balance": { - "en": "This service allows you to check your balance in all branchs", - "ar": "هذه الخدمه تتيح لك الاطلاع رصيدك في كل الفروع" + "ar": "تم تصميم هذه الخدمة حتى تتمكن من دفع مبلغ مقدما او تحت الحساب سواء في حسابك او في حساب شخص اخر لدى مجموعة الحبيب الطبية." }, + "info-my-balance": {"en": "This service allows you to check your balance in all branchs", "ar": "هذه الخدمه تتيح لك الاطلاع رصيدك في كل الفروع"}, "er-contant": { - "en": - "This service displays nearest branch among all the branches of Al Habib Medical Group based on your current location.", - "ar": - "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." + "en": "This service displays nearest branch among all the branches of Al Habib Medical Group based on your current location.", + "ar": "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." }, "er": {"en": "ER", "ar": "الطوارىء"}, "transportation-Service": {"en": "Ambulance Request", "ar": "طلب نقل اسعاف"}, "info-ambulance": { - "en": - "Through this service, you can request evacuation by ambulance, whether from home or to home, in addition to a set of other services", - "ar": - "عن طريق هذه الخدمة يمكنك طلب اخلاء بواسطة سيارة اسعاف سواء من المزل او الى المنزل بالاضافة الى مجموعة من الخدمات الاخرى" - }, - "RRT-transport-heading": { - "en": "Select Transportation Method", - "ar": "حدد طريقة النقل" + "en": "Through this service, you can request evacuation by ambulance, whether from home or to home, in addition to a set of other services", + "ar": "عن طريق هذه الخدمة يمكنك طلب اخلاء بواسطة سيارة اسعاف سواء من المزل او الى المنزل بالاضافة الى مجموعة من الخدمات الاخرى" }, + "RRT-transport-heading": {"en": "Select Transportation Method", "ar": "حدد طريقة النقل"}, "RRT-direction-heading": {"en": "Select Direction", "ar": "حدد الاتجاه"}, "to-hospital": {"en": "To Hospital", "ar": "الى المستشفى"}, "from-hospital": {"en": "From Hospital", "ar": "من المستشفى"}, @@ -1065,23 +875,14 @@ const Map localizedValues = { "pickup-location": {"en": "Pickup Location", "ar": "نقطة الانطلاق"}, "pickup-spot": {"en": "Pickup Spot", "ar": "نقطة اللقاء"}, "inside-home": {"en": "Inside Home", "ar": "داخل المنزل"}, - "have-appo": {"en": "Do you have an appointment?", "ar": "هل لديك موعد؟"}, + "have-appo": {"en": "Do you have an appointment ?", "ar": "هل لديك موعد ؟"}, "dropoff-location": {"en": "Dropoff Location", "ar": "نقطة الوصول"}, - "select-all": { - "en": "Please select all fields", - "ar": "يرجى تحديد جميع الحقول" - }, + "select-all": {"en": "Please select all fields", "ar": "يرجى تحديد جميع الحقول"}, "select-map": {"en": "Select From Map", "ar": "حدد من الخريطة"}, - "no-appointment": { - "en": "You don't have any appointments yet", - "ar": "ليس لديك أي مواعيد حتى الآن" - }, + "no-appointment": {"en": "You don't have any appointments yet", "ar": "ليس لديك أي مواعيد حتى الآن"}, "patient-share": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patient-share-tax": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, - "patient-share-total": { - "en": "Total amount payable: ", - "ar": "المبلغ الإجمالي المستحق:" - }, + "patient-share-total": {"en": "Total amount payable: ", "ar": "المبلغ الإجمالي المستحق:"}, "select-ambulate": {"en": "Select Ambulate", "ar": "بحاجة للتنقل بواسطة"}, "wheelchair": {"en": "Wheelchair", "ar": "كرسي متحرك"}, "walker": {"en": "Walker", "ar": "مشاية"}, @@ -1092,63 +893,35 @@ const Map localizedValues = { "transport-method": {"en": "Transportation Method", "ar": "طريقة النقل"}, "directions": {"en": "Directions", "ar": "الاتجاهات"}, "info-my-appointments": { - "en": - "This service allows you to see all the appointment you have visited in Al Habib Medical Group, and through this service:", - "ar": - "خدمة مواعيدي: هذه الخدمة تمكنك من الاطلاع على جميع المواعيد التي قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" + "en": "This service allows you to see all the appointment you have visited in Al Habib Medical Group, and through this service:", + "ar": "خدمة مواعيدي: هذه الخدمة تمكنك من الاطلاع على جميع المواعيد التي قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" }, "info-todo": { - "en": - "This service is designed to enable you to have a quick link to the list of tasks that need to be done", - "ar": - "هذه الخدمة تم تصميمها لتمكنك من الوصول الى رابط سريع لقائمة المهام التي يجب القيام بها" + "en": "This service is designed to enable you to have a quick link to the list of tasks that need to be done", + "ar": "هذه الخدمة تم تصميمها لتمكنك من الوصول الى رابط سريع لقائمة المهام التي يجب القيام بها" }, "family-info": { "en": "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.", - "ar": - "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." - }, - "update-succ": { - "en": "Successfully updated profile", - "ar": "تم تحديث البيانات بنجاح" + "ar": "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." }, + "update-succ": {"en": "Successfully updated profile", "ar": "تم تحديث البيانات بنجاح"}, "dental-complains": {"en": "Symptoms", "ar": "الأعراض"}, - "empty-result": { - "en": "There is no search results found", - "ar": "لايوجد نتائج" - }, + "empty-result": {"en": "There is no search results found", "ar": "لايوجد نتائج"}, - "no-booked-appointment": { - "en": "No booked appointments", - "ar": "لا يوجد مواعيد محجوزة" - }, - "no-confirmed-appointment": { - "en": "No confirmed appointments", - "ar": "لا توجد مواعيد مؤكدة" - }, - "no-arrived-appointment": { - "en": "No arrived appointments", - "ar": "لا يوجد مواعيد" - }, - "upcoming-empty": { - "en": "You do not have any Todo actions yet.", - "ar": "ليس لديك أي إجراءات الآن." - }, - "upcoming-timeLeft": { - "en": "time left for appointment", - "ar": "الوقت المتبقي للموعد" - }, - "covid-test-all-services": { - "en": "Covid-19 Drive-Thru Test", - "ar": "فحص كورونا من داخل السيارة" - }, + "no-booked-appointment": {"en": "No booked appointments", "ar": "لا يوجد مواعيد محجوزة"}, + "no-confirmed-appointment": {"en": "No confirmed appointments", "ar": "لا توجد مواعيد مؤكدة"}, + "no-arrived-appointment": {"en": "No arrived appointments", "ar": "لا يوجد مواعيد"}, + "upcoming-empty": {"en": "You do not have any Todo actions yet.", "ar": "ليس لديك أي إجراءات الآن."}, + "upcoming-timeLeft": {"en": "time left for appointment", "ar": "الوقت المتبقي للموعد"}, + "covid-test-all-services": {"en": "Covid-19 Drive-Thru Test", "ar": "فحص كورونا من داخل السيارة"}, "pharmacy": {"en": "Pharmacy", "ar": "الصيدلية"}, "ereferral": {"en": "E-Referral", "ar": "طلب التحويل"}, "child-vaccine": {"en": "Child Vaccines", "ar": "تطعيمات الأطفال"}, "calculators": {"en": "Health Calculators", "ar": "الحاسبات الصحية"}, "converters": {"en": "Health Converter", "ar": "تحويل القياسات"}, - "h2o": {"en": "Water Tracker", "ar": "حساب كمية الماء"}, + "waterTracker": {"en": "Water Tracker", "ar": "حساب كمية الماء"}, + "h2o": {"en": "H2O", "ar": "استهلاك"}, "v-tour": {"en": "Virtual Tour", "ar": "جولة إفتراضية"}, "hmg-news": {"en": "HMG News", "ar": "أخبار المجموعة"}, "blood-d": {"en": "Blood Donation", "ar": "تبرع بالدم"}, @@ -1164,10 +937,7 @@ const Map localizedValues = { "ready": {"en": "Ready", "ar": "جاهز"}, "completed": {"en": "Completed", "ar": "مكتمل"}, - "request-medical-report": { - "en": "Request medical report", - "ar": "طلب تقرير طبي" - }, + "request-medical-report": {"en": "Request medical report", "ar": "طلب تقرير طبي"}, "insur-cards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, 'labResult': {"en": "Lab results", "ar": "نتائج التحاليل المخبرية"}, 'details': {'en': 'Details', 'ar': 'التفاصيل'}, @@ -1177,217 +947,86 @@ const Map localizedValues = { "card-detail": {"en": "Insurance Details", "ar": "منافعك التامينية"}, "Dr": {"en": "Dr. ", "ar": "الدكتور."}, "empty": {"en": "You do not have any records.", "ar": "ليس لديك أي سجلات"}, - "last-visit": { - "en": "How was your last visit with doctor?", - "ar": "كيف تقيم زيارتك الأخيرة للطبيب؟" - }, + "last-visit": {"en": "How was your last visit with doctor?", "ar": "كيف تقيم زيارتك الأخيرة للطبيب؟"}, "tap-title": {"en": "Please rate the doctor", "ar": "يرجى تقييم الطبيب"}, "later": {"en": "Later", "ar": "لاحقاً"}, - "sendSuc": { - "en": "A copy has been sent to the email", - "ar": "تم إرسال نسخة إلى البريد الإلكتروني" - }, + "sendSuc": {"en": "A copy has been sent to the email", "ar": "تم إرسال نسخة إلى البريد الإلكتروني"}, "instructions": { - "en": - "You can now talk directly to the appointments department by chat or request a call back", - "ar": - "يمكنك الان التحدث مباشرة مع قسم المواعيد عن طريق خدمة المحادثة النصية أو طلب معاودة الاتصال" + "en": "You can now talk directly to the appointments department by chat or request a call back", + "ar": "يمكنك الان التحدث مباشرة مع قسم المواعيد عن طريق خدمة المحادثة النصية أو طلب معاودة الاتصال" }, "instructions-pharmacies": { - "en": - "You can now talk directly to the pharmacist by chat or request a call back", - "ar": - "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال" + "en": "You can now talk directly to the pharmacist by chat or request a call back", + "ar": "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال" }, "select-hospital": {"en": "Choose Hospital", "ar": "اختر المستشفى"}, "start": {"en": "Start", "ar": "ابدأ"}, "info-chat": { - "en": - "This service allows you to chat with customer service directly without the need to call.", - "ar": - "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." - }, - "last-appointment": { - "en": "How was your appointment?", - "ar": "كيف كان موعدك الطبي ؟" + "en": "This service allows you to chat with customer service directly without the need to call.", + "ar": "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." }, + "last-appointment": {"en": "How was your appointment?", "ar": "كيف كان موعدك الطبي ؟"}, "rate-clinic": {"en": "Please rate the clinic", "ar": "يرجى تقييم العيادة"}, "fetch-data": {"en": "Fetch Data", "ar": "تحديث الان"}, "rate": {"en": "Rate", "ar": "تقييم"}, - "send-email": { - "en": "Send a copy of this report to the email", - "ar": "أرسل نسخة من هذا التقرير إلى البريد الإلكتروني" - }, + "send-email": {"en": "Send a copy of this report to the email", "ar": "أرسل نسخة من هذا التقرير إلى البريد الإلكتروني"}, + "update-email-msg": {"en": "Email updated", "ar": "تم تحديث البريد الالكتروني"}, "update-email": {"en": "Update Email", "ar": "تحديث البريد الالكتروني"}, - "booked-success": { - "en": "The appointment has been successfully booked.", - "ar": "لقد تم حجز الموعد بنجاح" - }, - "appo-reminder-select-option-30": { - "en": "Before 30 Mins", - "ar": "قبل 30 دقيقة" - }, - "appo-reminder-select-option-60": { - "en": "Before 1 Hour", - "ar": "قبل ساعة واحدة" - }, - "appo-reminder-select-option-90": { - "en": "Before 1 Hour and 30 mins", - "ar": "قبل ساعة و 30 دقيقة" - }, - "appo-reminder-select-option-120": { - "en": "Before 2 Hours", - "ar": "قبل ساعتين" - }, - "noDataAvailable": { - "en": "No data available", - "ar": " لا يوجد بيانات متاحة " - }, + "booked-success": {"en": "The appointment has been successfully booked.", "ar": "لقد تم حجز الموعد بنجاح"}, + "appo-reminder-select-option-30": {"en": "Before 30 Mins", "ar": "قبل 30 دقيقة"}, + "appo-reminder-select-option-60": {"en": "Before 1 Hour", "ar": "قبل ساعة واحدة"}, + "appo-reminder-select-option-90": {"en": "Before 1 Hour and 30 mins", "ar": "قبل ساعة و 30 دقيقة"}, + "appo-reminder-select-option-120": {"en": "Before 2 Hours", "ar": "قبل ساعتين"}, + "noDataAvailable": {"en": "No data available", "ar": " لا يوجد بيانات متاحة "}, "thename": {"en": "The Name", "ar": "الاسم"}, "noSearchResult": {"en": "No Search Result", "ar": "لا توجد نتيجة بحث"}, "selectFileSouse": {"en": "Select file souse", "ar": "حدد الملف"}, "gallery": {"en": "Gallery", "ar": "معرض الصور"}, "camera": {"en": "Camera", "ar": "كاميرا"}, - "med-report": { - "en": "Medical Reports", - "ar": "التقارير الطبية" - }, - "new-med-report": { - "en": "Requests", - "ar": "الطلبات" - }, - "requestReport":{ - "en":"Request a report", - "ar":" طلب تقرير" - }, - "confirm-msg-report": { - "en": "Request for medical report?", - "ar": "طلب تقرير طبي؟" - }, - "successSendReport": { - "en": "The request has been submitted successfully", - "ar": "تم تنفيذ طلبك بنجاح" - }, - "pulseTitle": { - "en": "Heart rate", - "ar": "معدل النبض بالدقيقة" - }, - "systolic-lng": { - "en": "Systolic", - "ar": "الإنقباض" - }, - "diastolic-lng": { - "en": "Diastolic", - "ar": "الإنبساط" - }, - "policy-holder": { - "en": "Policy Holder", - "ar": "حامل بطاقة التأمين" - }, - "policy-no": { - "en": "Policy Number", - "ar": "رقم سياسات" - }, - "agree": { - "en": "I agree, this is the correct information", - "ar": "موافق، هذه المعلومات صحيحة" - }, - "disagree": { - "en": "No, this is not the correct information", - "ar": "غير موافق، هذه المعلومات غير الصحيحة" - }, - "expiry-date": { - "en": "Expiry Date", - "ar": "تاريخ انتهاء الصلاحية" - }, - "class": { - "en": "Class", - "ar": "فئة" - }, - "approval": { - "en": "Approval", - "ar": "موافقة" - }, - "no-data": { - "en": "No data found", - "ar": "لاتوجد بيانات" - }, - "insurance-details": { - "en": "Insurance Details", - "ar": "تفاصيل التأمين" - }, - "nearest-hospital": { - "en": "Nearest Hospital", - "ar": "أقرب مستشفى" - }, - "request-sent": { - "en": "Request sent successfully", - "ar": "تم إرسال الطلب بنجاح" - }, - "message-sent": { - "en": "Message sent successfully", - "ar": "تم إرسال الرسالة بنجاح" - }, - "sent-on": { - "en": "Sent on", - "ar": "أرسلت في" - }, - "attach-insurace-image": { - "en": "Attach insurance card image", - "ar": "إرفاق صورة بطاقة التأمين" - }, + "med-report": {"en": "Medical Reports", "ar": "التقارير الطبية"}, + "new-med-report": {"en": "Requests", "ar": "الطلبات"}, + "requestReport": {"en": "Request a report", "ar": " طلب تقرير"}, + "confirm-msg-report": {"en": "Request for medical report?", "ar": "طلب تقرير طبي؟"}, + "successSendReport": {"en": "The request has been submitted successfully", "ar": "تم تنفيذ طلبك بنجاح"}, + "pulseTitle": {"en": "Heart rate", "ar": "معدل النبض بالدقيقة"}, + "systolic-lng": {"en": "Systolic", "ar": "الإنقباض"}, + "diastolic-lng": {"en": "Diastolic", "ar": "الإنبساط"}, + "policy-holder": {"en": "Policy Holder", "ar": "حامل بطاقة التأمين"}, + "policy-no": {"en": "Policy Number", "ar": "رقم سياسات"}, + "agree": {"en": "I agree, this is the correct information", "ar": "موافق، هذه المعلومات صحيحة"}, + "disagree": {"en": "No, this is not the correct information", "ar": "غير موافق، هذه المعلومات غير الصحيحة"}, + "expiry-date": {"en": "Expiry Date", "ar": "تاريخ انتهاء الصلاحية"}, + "class": {"en": "Class", "ar": "فئة"}, + "approval": {"en": "Approval", "ar": "موافقة"}, + "no-data": {"en": "No data found", "ar": "لاتوجد بيانات"}, + "insurance-details": {"en": "Insurance Details", "ar": "تفاصيل التأمين"}, + "nearest-hospital": {"en": "Nearest Hospital", "ar": "أقرب مستشفى"}, + "request-sent": {"en": "Request sent successfully", "ar": "تم إرسال الطلب بنجاح"}, + "message-sent": {"en": "Message sent successfully", "ar": "تم إرسال الرسالة بنجاح"}, + "sent-on": {"en": "Sent on", "ar": "أرسلت في"}, + "attach-insurace-image": {"en": "Attach insurance card image", "ar": "إرفاق صورة بطاقة التأمين"}, "upload-without-image": { "en": "You can still submit, if you don't have Insurance Image", "ar": "لا يزال بإمكانك الإرسال ، إذا لم يكن لديك صورة تأمين" }, "info-insur-cards": { "en": "This service allows you to view all the insurance cards that recorded during your visits to Al Habib Medical Group in addition to:", - "ar": "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" - }, - "scan-now": { - "en": "If you have a card / Document Scan now", - "ar": "إذا كانت لديك بطاقة / مستند ارفقها الان" - }, - "liveCare": { - "en": "Live Care", - "ar": "لايف كير" - }, - "topBrands":{ - "en":"Top Brands", - "ar":"اعلى العلامات التجارية" - }, - - "notifyMe":{ - "en":"notify me", - "ar":"اعلمني" - }, - "specification":{ - "en":"Specification", - "ar":"تخصيص" + "ar": + "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" }, + "scan-now": {"en": "If you have a card / Document Scan now", "ar": "إذا كانت لديك بطاقة / مستند ارفقها الان"}, + "liveCare": {"en": "Live Care", "ar": "لايف كير"}, + "topBrands": {"en": "Top Brands", "ar": "اعلى العلامات التجارية"}, - "availability":{ - "en":"Availability", - "ar":"التوفر" - }, + "notifyMe": {"en": "notify me", "ar": "اعلمني"}, + "specification": {"en": "Specification", "ar": "تخصيص"}, - "quantitySize":{ - "en":"Quantity", - "ar":"كميه" - }, - "addToCart":{ - "en":"add to cart", - "ar":"إضفة للسلة" - }, - "buyNow":{ - "en":"buy now", - "ar":"إشتري الان" - }, - "quantityShortcut":{ - "en":"QTY", - "ar":"كمية" - }, + "availability": {"en": "Availability", "ar": "التوفر"}, + "quantitySize": {"en": "Quantity", "ar": "كميه"}, + "addToCart": {"en": "add to cart", "ar": "إضفة للسلة"}, + "buyNow": {"en": "buy now", "ar": "إشتري الان"}, + "quantityShortcut": {"en": "QTY", "ar": "كمية"}, "pharmacyServiceTermsCondition": { "en": "I agree with the terms of service and I adhere to them unconditionally", @@ -1411,42 +1050,146 @@ const Map localizedValues = { "orderLocation": {"en": "Location", "ar": "الموقع"}, "selectService": {"en": "Select Service", "ar": "حدد الخدمة"}, "coveredService": {"en": "Covered Service : ", "ar": " الخدمات المغطاة : "}, - "selectedService": { - "en": "Selected Service : ", - "ar": " الخدمات المختارة : " - }, - "cancelOrderMsg": { - "en": "Are you sure!! want to cancel this order", - "ar": "هل أنت واثق!! تريد إلغاء هذا الطلب" - }, - "processDoneSuccessfully": { - "en": "Process Done Successfully", - "ar": "تمت العملية بنجاح" - }, - "selectHomeHealthCareServices": { - "en": "Select Home Health Care Services", - "ar": " حدد خدمات الرعاية الصحية المنزلية" - }, + "selectedService": {"en": "Selected Service : ", "ar": " الخدمات المختارة : "}, + "cancelOrderMsg": {"en": "Are you sure!! want to cancel this order", "ar": "هل أنت واثق!! تريد إلغاء هذا الطلب"}, + "processDoneSuccessfully": {"en": "Process Done Successfully", "ar": "تمت العملية بنجاح"}, + "selectHomeHealthCareServices": {"en": "Select Home Health Care Services", "ar": " حدد خدمات الرعاية الصحية المنزلية"}, "description-vaccination": {"en": "Description", "ar": "وصف"}, "due-date": {"en": "Due date", "ar": "تاريخ الاستحقاق"}, - "valid-email": { - "en": "Please enter valid email", - "ar": "الرجاء إدخال عنوان بريد صحيح" - }, - "confirm-send": { - "en": "Send the child's schedule to the email?", - "ar": "ارسال جدول التطعيمات الى بريدك الالكتروني؟" - }, + "valid-email": {"en": "Please enter valid email", "ar": "الرجاء إدخال عنوان بريد صحيح"}, + "confirm-send": {"en": "Send the child's schedule to the email?", "ar": "ارسال جدول التطعيمات الى بريدك الالكتروني؟"}, "vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"}, "welcomeBack": {"en": "Welcome back", "ar": "مرحبا مرة أخرى"}, - "updated-email": { - "en": "Updated email successfully", - "ar": "تم تحديث البريد الالكتروني" - }, + "updated-email": {"en": "Updated email successfully", "ar": "تم تحديث البريد الالكتروني"}, - "view-list-children": { - "en": "View List of Children", - "ar": "عرض قائمة الأطفال" + "view-list-children": {"en": "View List of Children", "ar": "عرض قائمة الأطفال"}, + "trackDeliveryDriver": {"en": "Track Delivery Driver", "ar": "trackDeliveryDriver"}, + "covidTest": {"en": "COVID-19 TEST", "ar": "فحص كورونا"}, + "driveThru": {"en": "Drive-Thru", "ar": "من السيارة"}, + "NearestErDesc": { + "en": "\nThis service Displays nearest branch\n among all the branches of All Habib \n medical Group based on your current Location", + "ar": "\nتعرض هذه الخدمة أقرب فرع\n من بين جميع فروع مجموعة \nالحبيب الطبية بناءً على موقعك الحالي." + }, + "NearestEr": {"en": "Nearest ER", "ar": "أقرب ER"}, + "infoCMC": { + "en": + "Through this service, you can request a set of tests that help you and your doctor to understand the current health condition and then identify potential risks.", + "ar": "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" }, + "instructionAgree": { + "en": + "This monthly Health Summary Report reflects the health indicators and analysis results of the latest visits. Please note that this will be sent automatically from the system and it's not considered as an official report so no medical decisions should be taken based on it.", + "ar": + "هذا ملخص التقرير الصحي الشهري و الذي يسرد المؤشرات الصحية و نتائج التحاليل لأخر الزيارات. يرجى ملاحظة أن هذا التقرير هو تقرير يتم ارساله بشكل آلي من النظام و لا يعتبر رسمي و لا تؤخذ عليه أي قرارات طبية" + }, + "reqId": {"en": "Request ID:", "ar": " رقم الطلب"}, + "RRT-orders-log": {"en": "Orders Log", "ar": "سجل الطلبات"}, + "blood-sugar": {"en": "Blood Sugar", "ar": "سكر الدم"}, + + "covid19_driveThrueTest": {"en": "'Covid-19- Drive-Thru Test'", "ar": "Covid-19- الفحص من خلال القيادة"}, + "E-Referral": {"en": "'E-Referral'", "ar": "الإحالة الإلكترونية"}, + "childName": {"en": "'CHILD NAME'", "ar": "إسم الطفل"}, + "recordDeleted": {"en": "'Record Deleted'", "ar": "تم حذف السجل"}, + "msg_email_address_up_to_date": { + "en": "Please ensure that the email address is up-to-date and process to view the schedule", + "ar": "يرجى التأكد من أن عنوان البريد الإلكتروني محدث وأن العملية لعرض الجدول الزمني" + }, + "add-new-child": {"en": "ADD NEW CHILD", "ar": "إضافة طفل جديد"}, + "visit": {"en": "Visit", "ar": "الزيارة"}, + "send-child-email-msg": {"en": "Send the child's schedule to the email", "ar": "أرسل جدول الطفل إلى البريد الإلكتروني"}, + "vaccination-add-child-msg": { + "en": "Add the child's information below to receive the schedule of vaccinations.", + "ar": "أضف معلومات الطفل أدناه للحصول على جدول التطعيمات." + }, + "child_added_successfully": {"en": "Child added successfully", "ar": "تمت إضافة الطفل بنجاح"}, + "bloodSugar": {"en": "Blood", "ar": "السكر في الدم"}, + "sugar": {"en": "Sugar", "ar": ""}, + "bloodCholesterol": {"en": "Blood", "ar": " الكولسترول في الدم"}, + + "cholesterol": {"en": "Cholesterol", "ar": ""}, + "triglycerides": {"en": "Triglycerides", "ar": "الدهون الثلاثية"}, + + "fatInBlood": {"en": "Fat In Blood", "ar": ""}, + "convertFrom": {"en": "Convert From", "ar": "تحويل من"}, + "calculate": {"en": "calculate", "ar": "حساب"}, + "enterReadingValue": {"en": "Enter the reading value", "ar": "ادخل القيمة"}, + "result": {"en": "Result", "ar": "النتيجة"}, + "bloodSugarConversion": {"en": "Blood Sugar Conversion", "ar": "السكر في الدم"}, + "convertBloodSugarStatement": { + "en": "Convert blood sugar/glucose from mmol/l (UK standard) to mg/dlt (US standard) and vice versa.", + "ar": "تحويل مستوى السكر في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" + }, + "convertCholesterolStatement": { + "en": "Convert blood cholesterol from\n mmol/l to mg/dlt and vice versa.", + "ar": "تحويل مستوى الكولسترول في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" + }, + "triglyceridesConvertStatement": { + "en": "Convert Triglycerides from mmol/l to mg/dlt and vice versa.", + "ar": "تحويل مستوى الدهون الثلاثية في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" + }, + "my-tracker": {"en": "My Tracker", "ar": "قراءاتي"}, + "weekly": {"en": "Weekly", "ar": "أسبوعي"}, + "monthly": {"en": "Monthly", "ar": "شهري"}, + "yearly": {"en": "Yearly", "ar": "سنوي"}, + "measured": {"en": "Measured", "ar": "قياس"}, + "sugar-add": {"en": "Enter Blood Sugar Value", "ar": "أدخل قيمة قراءة السكر"}, + "other": {"en": "Other", "ar": "آخر"}, + "measure-unit": {"en": "Measure unit", "ar": "وحدة القياس"}, + "measure-time": {"en": "Measure time", "ar": "وقت القياس"}, + "update": {"en": "Update", "ar": "تعديل"}, + "bloodD-enter-desc": { + "en": "Enter the required information, In order to register for Blood Donation Service", + "ar": "أدخل المعلومات المطلوبة ، للتسجيل في خدمة التبرع بالدم" + }, + "viewTermsConditions": {"en": "To view the terms and conditions", "ar": "لعرض الشروط والأحكام"}, + "WalkinAppo": {"en": "Hospital Visit Appointment", "ar": "موعد زيارة للمستشفى"}, + "videoAppo": {"en": "Video Call Appointment", "ar": "موعد اتصال فيديو"}, + // "visit": {"en" : "Visit", "ar": "الزيارة"}, + "weight-add": {"en": "Enter Weight Value", "ar": "أدخل الوزن "}, + "systolic-add": {"en": "Enter Systolic Value", "ar": "أدخل قيمة الإنقباض "}, + "diastolic-add": {"en": "Enter Diastolic Value", "ar": "أدخل قيمة الإنبساط "}, + "cmc-heading": {"en": "Comprehensive Medical Checkup", "ar": "فحص طبي شامل"}, + "today": {"en": "Today", "ar": "اليوم"}, + "week": {"en": "Week", "ar": "أسبوع"}, + "month": {"en": "Month", "ar": "شهر"}, + "h2o-amount-of-water": {"en": "Enter the amount of water:", "ar": "ادخل كمية الماء:"}, + "update-user": {"en": "Update Information", "ar": "تحديث بيانات"}, + "editname": {"en": "Enter the name here", "ar": "أدخل الاسم هنا"}, + "activity-level": {"en": "Activity Level", "ar": "مستوى النشاط"}, + "light-active": {"en": "Lightly Active", "ar": " قليل النشاط"}, + "mod-active": {"en": "Moderately Active", "ar": "متوسط النشاط"}, + "reminder-label": {"en": "Activate the reminder of drink water?", "ar": "تفعيل خاصية تذكير شرب الماء؟"}, + "reminder-times-label": {"en": "How many times do you want to be reminded?", "ar": "عدد مرات التذكير"}, + "times": {"en": "Times", "ar": "مرات"}, + "WaterCalculate": {"en": "Save", "ar": "حفظ"}, + "notif-title": {"en": "Water Reminder", "ar": "تذكير"}, + "notif-text": {"en": " Don't forget to drink water.", "ar": "لا تنسى شرب الماء"}, + "custom": {"en": "Custom", "ar": "خاص"}, + "undo": {"en": "Undo", "ar": "تراجع"}, + "drinking": {"en": "Drinkning", "ar": "الشرب"}, + "remaining": {"en": "Remaining", "ar": "المتبقي"}, + "taken": {"en": "Taken", "ar": " مأخوذ"}, + "ml": {"en": "ml", "ar": "مل"}, + "l": {"en": "L", "ar": "لتر"}, + "custom-label": {"en": "Enter amount", "ar": "أدخل كمية الماء"}, + "custom-label-in-litres": {"en": "Enter amount in liters", "ar": "أدخل الكمية باللتر"}, + "custom-label-in-mililitres": {"en": "Enter amount in millilitres", "ar": "أدخل الكمية بالملليتر"}, + "amount": {"en": "Amount", "ar": "الكمية"}, + "target-reach": {"en": "You have reached the target for the day!", "ar": "لقد حققت هدفك اليومي! مبروك"}, + "week-header": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, + "month-header": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, + "notif-permission-title": {"en": "Could not set the water reminders", "ar": "لا يمكن ضبط اشعار شرب الماء"}, + "notif-permission-msg": { + "en": "To recieve water reminders, please turn on notifications in the system settings", + "ar": "الرجاء تفعيل الاشعارات في الاعدادات" + }, + "verification_message_code": {"en": "Please enter verification code", "ar": "الرجاء إدخال رمز التحقق"}, + "sms_code": {"en": "Enter SMS Code here", "ar": "أدخل رمز التحقق هنا"}, + "code_failure": {"en": "Didn’t received the code", "ar": "لم أستلم رمز التحقق"}, + "resend": {"en": "Resend", "ar": "إعادة إرسال"}, + "submitncontinue": {"en": "Submit and continue", "ar": "إرسال ومتابعة"}, + "areyousure": {"en": "Are you sure you want to Add", "ar": "هل أنت متأكد أنك تريد إضافة"}, + "preferredunit": {"en": "Select the preferred unit", "ar": "اختر الوحدة المفضلة"}, + "select-unit": {"en": "Select unit", "ar": "اختر وحدة القياس"} }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 458040bb..0e56e30b 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -26,3 +26,4 @@ const WEATHER = 'weather'; const BLOOD_TYPE = 'blood-type'; const NOTIFICATION_COUNT = 'notification-count'; const PHARMACY_SELECTED_ADDRESS = 'selected-address'; +const PHARMACY_AUTORZIE_TOKEN = 'PHARMACY_AUTORZIE_TOKEN'; diff --git a/lib/core/enum/Ambulate.dart b/lib/core/enum/Ambulate.dart index f8b2e8be..e4714cb2 100644 --- a/lib/core/enum/Ambulate.dart +++ b/lib/core/enum/Ambulate.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; enum Ambulate { Wheelchair, Walker, Stretcher, None } @@ -6,19 +7,19 @@ extension SelectedAmbulate on Ambulate { String getAmbulateTitle(BuildContext context) { switch (this) { case Ambulate.Wheelchair: - return 'Wheelchair'; + return TranslationBase.of(context).wheelchair; break; case Ambulate.Walker: - return 'Walker'; + return TranslationBase.of(context).walker; break; case Ambulate.Stretcher: - return 'Stretcher'; + return TranslationBase.of(context).stretcher; break; case Ambulate.None: - return 'None'; + return TranslationBase.of(context).none; break; } - return 'None'; + return TranslationBase.of(context).none; } int selectAmbulateNumber() { diff --git a/lib/core/model/AlHabibMedicalService/H2O/user_detail_model.dart b/lib/core/model/AlHabibMedicalService/H2O/user_detail_model.dart new file mode 100644 index 00000000..bb100219 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/H2O/user_detail_model.dart @@ -0,0 +1,104 @@ +class UserDetailModel { + int userID; + int patientID; + int patientType; + bool patientOutSA; + String firstName; + String middleName; + String lastName; + String firstNameN; + String middleNameN; + String lastNameN; + String identificationNo; + String mobile; + String emailID; + String zipCode; + String dOB; + String gender; + int activityID; + String createdDate; + double height; + double weight; + bool isHeightInCM; + bool isWeightInKG; + bool isNotificationON; + + UserDetailModel( + {this.userID, + this.patientID, + this.patientType, + this.patientOutSA, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.identificationNo, + this.mobile, + this.emailID, + this.zipCode, + this.dOB, + this.gender, + this.activityID, + this.createdDate, + this.height, + this.weight, + this.isHeightInCM, + this.isWeightInKG, + this.isNotificationON}); + + UserDetailModel.fromJson(Map json) { + userID = json['UserID']; + patientID = json['PatientID']; + patientType = json['PatientType']; + patientOutSA = json['PatientOutSA']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + identificationNo = json['IdentificationNo']; + mobile = json['Mobile']; + emailID = json['EmailID']; + zipCode = json['ZipCode']; + dOB = json['DOB']; + gender = json['Gender']; + activityID = json['ActivityID']; + createdDate = json['CreatedDate']; + height = json['Height']; + weight = json['Weight']; + isHeightInCM = json['IsHeightInCM']; + isWeightInKG = json['IsWeightInKG']; + isNotificationON = json['IsNotificationON']; + } + + Map toJson() { + final Map data = new Map(); + data['UserID'] = this.userID; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['PatientOutSA'] = this.patientOutSA; + 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['IdentificationNo'] = this.identificationNo; + data['Mobile'] = this.mobile; + data['EmailID'] = this.emailID; + data['ZipCode'] = this.zipCode; + data['DOB'] = this.dOB; + data['Gender'] = this.gender; + data['ActivityID'] = this.activityID; + data['CreatedDate'] = this.createdDate; + data['Height'] = this.height; + data['Weight'] = this.weight; + data['IsHeightInCM'] = this.isHeightInCM; + data['IsWeightInKG'] = this.isWeightInKG; + data['IsNotificationON'] = this.isNotificationON; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/H2O/user_detail_request_model.dart b/lib/core/model/AlHabibMedicalService/H2O/user_detail_request_model.dart new file mode 100644 index 00000000..9d23d383 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/H2O/user_detail_request_model.dart @@ -0,0 +1,124 @@ +class UserDetailRequestModel { + String activityID; + int channel; + int deviceTypeID; + String dOB; + String email; + String firstName; + String gender; + String generalid; + double height; + String identificationNo; + String iPAdress; + bool isDentalAllowedBackend; + bool isHeightInCM; + bool isNotificationOn; + bool isWeightInKG; + int languageID; + String lastName; + String middleName; + String mobileNumber; + int patientID; + int patientOutSA; + int patientType; + int patientTypeID; + String sessionID; + String tokenID; + double versionID; + double weight; + String zipCode; + + UserDetailRequestModel( + {this.activityID, + this.channel, + this.deviceTypeID, + this.dOB, + this.email, + this.firstName, + this.gender, + this.generalid, + this.height, + this.identificationNo, + this.iPAdress, + this.isDentalAllowedBackend, + this.isHeightInCM, + this.isNotificationOn, + this.isWeightInKG, + this.languageID, + this.lastName, + this.middleName, + this.mobileNumber, + this.patientID, + this.patientOutSA, + this.patientType, + this.patientTypeID, + this.sessionID, + this.tokenID, + this.versionID, + this.weight, + this.zipCode}); + + UserDetailRequestModel.fromJson(Map json) { + activityID = json['ActivityID']; + channel = json['Channel']; + deviceTypeID = json['DeviceTypeID']; + dOB = json['DOB']; + email = json['Email']; + firstName = json['FirstName']; + gender = json['Gender']; + generalid = json['generalid']; + height = json['Height']; + identificationNo = json['IdentificationNo']; + iPAdress = json['IPAdress']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + isHeightInCM = json['IsHeightInCM']; + isNotificationOn = json['isNotificationOn']; + isWeightInKG = json['IsWeightInKG']; + languageID = json['LanguageID']; + lastName = json['LastName']; + middleName = json['MiddleName']; + mobileNumber = json['MobileNumber']; + patientID = json['PatientID']; + patientOutSA = json['PatientOutSA']; + patientType = json['PatientType']; + patientTypeID = json['PatientTypeID']; + sessionID = json['SessionID']; + tokenID = json['TokenID']; + versionID = json['VersionID']; + weight = json['Weight']; + zipCode = json['ZipCode']; + } + + Map toJson() { + final Map data = new Map(); + data['ActivityID'] = this.activityID; + data['Channel'] = this.channel; + data['DeviceTypeID'] = this.deviceTypeID; + data['DOB'] = this.dOB; + data['Email'] = this.email; + data['FirstName'] = this.firstName; + data['Gender'] = this.gender; + data['generalid'] = this.generalid; + data['Height'] = this.height; + data['IdentificationNo'] = this.identificationNo; + data['IPAdress'] = this.iPAdress; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['IsHeightInCM'] = this.isHeightInCM; + data['isNotificationOn'] = this.isNotificationOn; + data['IsWeightInKG'] = this.isWeightInKG; + data['LanguageID'] = this.languageID; + data['LastName'] = this.lastName; + data['MiddleName'] = this.middleName; + data['MobileNumber'] = this.mobileNumber; + data['PatientID'] = this.patientID; + data['PatientOutSA'] = this.patientOutSA; + data['PatientType'] = this.patientType; + data['PatientTypeID'] = this.patientTypeID; + data['SessionID'] = this.sessionID; + data['TokenID'] = this.tokenID; + data['VersionID'] = this.versionID; + data['Weight'] = this.weight; + data['ZipCode'] = this.zipCode; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/ImagesInfo.dart b/lib/core/model/ImagesInfo.dart index 5ab48fb3..54e8042b 100644 --- a/lib/core/model/ImagesInfo.dart +++ b/lib/core/model/ImagesInfo.dart @@ -1,6 +1,7 @@ class ImagesInfo { final String imageAr; final String imageEn; + final bool isAsset; - ImagesInfo({this.imageAr, this.imageEn}); + ImagesInfo({this.imageAr, this.imageEn, this.isAsset = false}); } diff --git a/lib/core/model/er/PickUpRequestPresOrder.dart b/lib/core/model/er/PickUpRequestPresOrder.dart index 376e30ae..c4f359f5 100644 --- a/lib/core/model/er/PickUpRequestPresOrder.dart +++ b/lib/core/model/er/PickUpRequestPresOrder.dart @@ -18,8 +18,8 @@ class PickUpRequestPresOrder { int pickupSpot; dynamic dropoffLocationId; int transportationMethodId; - double cost; - double vAT; + dynamic cost; + dynamic vAT; double totalPrice; int amountCollected; int selectedAmbulate; diff --git a/lib/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart b/lib/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart index 5b95409e..86263155 100644 --- a/lib/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart +++ b/lib/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart @@ -17,7 +17,7 @@ class DiabtecPatientResult { int patientID; var remark; var resultDesc; - int resultValue; + dynamic resultValue; String unit; var weekAverageResult; String weekDesc; diff --git a/lib/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart b/lib/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart index c18e5433..3b1a8d9c 100644 --- a/lib/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart +++ b/lib/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; class WeekDiabtectResultAverage { - int dailyAverageResult; + dynamic dailyAverageResult; DateTime dateChart; WeekDiabtectResultAverage({this.dailyAverageResult, this.dateChart}); diff --git a/lib/core/model/pharmacies/Prescriptions.dart b/lib/core/model/pharmacies/Prescriptions.dart new file mode 100644 index 00000000..80caff0a --- /dev/null +++ b/lib/core/model/pharmacies/Prescriptions.dart @@ -0,0 +1,157 @@ + + +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class Prescriptions { + String setupID; + int projectID; + int patientID; + int appointmentNo; + String appointmentDate; + String doctorName; + String clinicDescription; + String name; + int episodeID; + int actualDoctorRate; + int admission; + int clinicID; + String companyName; + String despensedStatus; + DateTime dischargeDate; + int dischargeNo; + int doctorID; + String doctorImageURL; + int doctorRate; + String doctorTitle; + int gender; + String genderDescription; + bool isActiveDoctorProfile; + bool isDoctorAllowVedioCall; + bool isExecludeDoctor; + bool isInOutPatient; + String isInOutPatientDescription; + String isInOutPatientDescriptionN; + bool isInsurancePatient; + String nationalityFlagURL; + int noOfPatientsRate; + String qR; + List speciality; + + Prescriptions( + {this.setupID, + this.projectID, + this.patientID, + this.appointmentNo, + this.appointmentDate, + this.doctorName, + this.clinicDescription, + this.name, + this.episodeID, + this.actualDoctorRate, + this.admission, + this.clinicID, + this.companyName, + this.despensedStatus, + this.dischargeDate, + this.dischargeNo, + this.doctorID, + this.doctorImageURL, + this.doctorRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.isInOutPatient, + this.isInOutPatientDescription, + this.isInOutPatientDescriptionN, + this.isInsurancePatient, + this.nationalityFlagURL, + this.noOfPatientsRate, + this.qR, + this.speciality}); + + Prescriptions.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + appointmentNo = json['AppointmentNo']; + appointmentDate = json['AppointmentDate']; + doctorName = json['DoctorName']; + clinicDescription = json['ClinicDescription']; + name = json['Name']; + episodeID = json['EpisodeID']; + actualDoctorRate = json['ActualDoctorRate']; + admission = json['Admission']; + clinicID = json['ClinicID']; + companyName = json['CompanyName']; + despensedStatus = json['Despensed_Status']; + dischargeDate = DateUtil.convertStringToDate(json['DischargeDate']); + dischargeNo = json['DischargeNo']; + doctorID = json['DoctorID']; + doctorImageURL = json['DoctorImageURL']; + doctorRate = json['DoctorRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + isInOutPatient = json['IsInOutPatient']; + isInOutPatientDescription = json['IsInOutPatientDescription']; + isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; + isInsurancePatient = json['IsInsurancePatient']; + nationalityFlagURL = json['NationalityFlagURL']; + noOfPatientsRate = json['NoOfPatientsRate']; + qR = json['QR']; + // speciality = json['Speciality'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentDate'] = this.appointmentDate; + data['DoctorName'] = this.doctorName; + data['ClinicDescription'] = this.clinicDescription; + data['Name'] = this.name; + data['EpisodeID'] = this.episodeID; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['Admission'] = this.admission; + data['ClinicID'] = this.clinicID; + data['CompanyName'] = this.companyName; + data['Despensed_Status'] = this.despensedStatus; + data['DischargeDate'] = this.dischargeDate; + data['DischargeNo'] = this.dischargeNo; + data['DoctorID'] = this.doctorID; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['IsInOutPatient'] = this.isInOutPatient; + data['IsInOutPatientDescription'] = this.isInOutPatientDescription; + data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; + data['IsInsurancePatient'] = this.isInsurancePatient; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['QR'] = this.qR; + data['Speciality'] = this.speciality; + return data; + } +} + +//class PrescriptionsList { +// String filterName = ""; +// List prescriptionsList = List(); +// +// PrescriptionsList({this.filterName, Prescriptions prescriptions}) { +// prescriptionsList.add(prescriptions); +// } +//} diff --git a/lib/core/model/pharmacies/order_model.dart b/lib/core/model/pharmacies/order_model.dart index 027d1f81..8872aaf8 100644 --- a/lib/core/model/pharmacies/order_model.dart +++ b/lib/core/model/pharmacies/order_model.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; List orderModelFromJson(String str) => List.from(json.decode(str).map((x) => OrderModel.fromJson(x))); @@ -31,6 +32,7 @@ class OrderModel { this.taxRates, this.orderTax, this.orderDiscount, + this.productCount, this.orderTotal, this.refundedAmount, this.rewardPointsWereAdded, @@ -95,6 +97,7 @@ class OrderModel { String taxRates; double orderTax; dynamic orderDiscount; + dynamic productCount; double orderTotal; dynamic refundedAmount; dynamic rewardPointsWereAdded; @@ -159,6 +162,7 @@ class OrderModel { taxRates: json["tax_rates"], orderTax: json["order_tax"].toDouble(), orderDiscount: json["order_discount"], + productCount: json["product_count"], orderTotal: json["order_total"].toDouble(), refundedAmount: json["refunded_amount"], rewardPointsWereAdded: json["reward_points_were_added"], @@ -306,7 +310,22 @@ class IngAddress { String customerAttributes; DateTime createdOnUtc; dynamic province; - LatLong latLong; + String latLong; + + LatLng getLocation(){ + if(latLong.contains(',')){ + var parts = latLong.trim().split(','); + if(parts.length == 2){ + var lat = double.tryParse(parts.first); + var lng = double.tryParse(parts.last); + if(lat != null || lng != null) { + var location = LatLng(lat, lng); + return location; + } + } + } + return null; + } factory IngAddress.fromJson(Map json) => IngAddress( id: json["id"], @@ -326,7 +345,7 @@ class IngAddress { customerAttributes: json["customer_attributes"], createdOnUtc: DateTime.parse(json["created_on_utc"]), province: json["province"], - latLong: latLongValues.map[json["lat_long"]], + latLong: json["lat_long"], ); Map toJson() => { @@ -347,7 +366,7 @@ class IngAddress { "customer_attributes": customerAttributes, "created_on_utc": createdOnUtc.toIso8601String(), "province": province, - "lat_long": latLongValues.reverse[latLong], + "lat_long": latLong, }; } @@ -491,9 +510,9 @@ class OrderModelCustomer { isSystemAccount: json["is_system_account"], systemName: json["system_name"], lastIpAddress: lastIpAddressValues.map[json["last_ip_address"]], - createdOnUtc: DateTime.parse(json["created_on_utc"]), - lastLoginDateUtc: DateTime.parse(json["last_login_date_utc"]), - lastActivityDateUtc: DateTime.parse(json["last_activity_date_utc"]), + createdOnUtc: (json["created_on_utc"] != null) ? DateTime.parse(json["created_on_utc"]) : null, + lastLoginDateUtc: (json["created_on_utc"] != null) ? DateTime.parse(json["last_login_date_utc"]) : null, + lastActivityDateUtc: (json["created_on_utc"] != null) ? DateTime.parse(json["last_activity_date_utc"]) : null, registeredInStoreId: json["registered_in_store_id"], roleIds: List.from(json["role_ids"].map((x) => x)), ); diff --git a/lib/core/model/pharmacies/orders_model.dart b/lib/core/model/pharmacies/orders_model.dart new file mode 100644 index 00000000..a97bda98 --- /dev/null +++ b/lib/core/model/pharmacies/orders_model.dart @@ -0,0 +1,77 @@ +class OrdersModel { + List orders; + + OrdersModel({this.orders}); + + OrdersModel.fromJson(Map json) { + if (json['orders'] != null) { + orders = new List(); + json['orders'].forEach((v) { + orders.add(new Orders.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.orders != null) { + data['orders'] = this.orders.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Orders { + String id; + int productCount; + double orderTotal; + String createdOnUtc; + int orderStatusId; + String orderStatus; + String orderStatusn; + bool canCancel; + bool canRefund; + dynamic customerId; + + Orders( + {this.id, + this.productCount, + this.orderTotal, + this.createdOnUtc, + this.orderStatusId, + this.orderStatus, + this.orderStatusn, + this.canCancel, + this.canRefund, + this.customerId,}); + + Orders.fromJson(Map json) { + try { + id = json['id']; + productCount = json['product_count']; + orderTotal = json['order_total']; + createdOnUtc = json['created_on_utc']; + orderStatusId = json['order_status_id']; + orderStatus = json['order_status']; + orderStatusn = json['order_statusn']; + canCancel = json['can_cancel']; + canRefund = json['can_refund']; + customerId = json['customer_id']; + }catch(e){ + print(e); + } + + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['product_count'] = this.productCount; + data['order_total'] = this.orderTotal; + data['created_on_utc'] = this.createdOnUtc; + data['order_status_id'] = this.orderStatusId; + data['order_status'] = this.orderStatus; + data['order_statusn'] = this.orderStatusn; + return data; + } +} diff --git a/lib/core/model/reports/Reports.dart b/lib/core/model/reports/Reports.dart index a8a5869d..6791a3d4 100644 --- a/lib/core/model/reports/Reports.dart +++ b/lib/core/model/reports/Reports.dart @@ -11,24 +11,24 @@ class Reports { String setupId; int patientID; int doctorID; - Null clinicID; + dynamic clinicID; DateTime requestDate; bool isRead; DateTime isReadOn; int actualDoctorRate; String clinicDescription; - Null clinicDescriptionN; + dynamic clinicDescriptionN; String docName; Null docNameN; String doctorImageURL; - Null doctorName; - Null doctorNameN; + dynamic doctorName; + dynamic doctorNameN; int doctorRate; bool isDoctorAllowVedioCall; bool isExecludeDoctor; int noOfPatientsRate; String projectName; - Null projectNameN; + dynamic projectNameN; Reports( {this.status, @@ -61,37 +61,41 @@ class Reports { this.projectNameN}); Reports.fromJson(Map json) { - status = json['Status']; - encounterDate = DateUtil.convertStringToDate( - json['EncounterDate']); //json['EncounterDate']; - projectID = json['ProjectID']; - invoiceNo = json['InvoiceNo']; - encounterNo = json['EncounterNo']; - procedureId = json['ProcedureId']; - requestType = json['RequestType']; - setupId = json['SetupId']; - patientID = json['PatientID']; - doctorID = json['DoctorID']; - clinicID = json['ClinicID']; - requestDate = DateUtil.convertStringToDate( - json['RequestDate']); //json['RequestDate']; - isRead = json['IsRead']; - isReadOn = - DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn']; - actualDoctorRate = json['ActualDoctorRate']; - clinicDescription = json['ClinicDescription']; - clinicDescriptionN = json['ClinicDescriptionN']; - docName = json['DocName']; - docNameN = json['DocNameN']; - doctorImageURL = json['DoctorImageURL']; - doctorName = json['DoctorName']; - doctorNameN = json['DoctorNameN']; - doctorRate = json['DoctorRate']; - isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; - isExecludeDoctor = json['IsExecludeDoctor']; - noOfPatientsRate = json['NoOfPatientsRate']; - projectName = json['ProjectName']; - projectNameN = json['ProjectNameN']; + try { + status = json['Status']; + encounterDate = DateUtil.convertStringToDate( + json['EncounterDate']); //json['EncounterDate']; + projectID = json['ProjectID']; + invoiceNo = json['InvoiceNo']; + encounterNo = json['EncounterNo']; + procedureId = json['ProcedureId']; + requestType = json['RequestType']; + setupId = json['SetupId']; + patientID = json['PatientID']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + requestDate = DateUtil.convertStringToDate( + json['RequestDate']); //json['RequestDate']; + isRead = json['IsRead']; + isReadOn = + DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn']; + actualDoctorRate = json['ActualDoctorRate']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + docName = json['DocName']; + docNameN = json['DocNameN']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + doctorRate = json['DoctorRate']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + noOfPatientsRate = json['NoOfPatientsRate']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + }catch(e){ + print(e); + } } Map toJson() { diff --git a/lib/core/service/AlHabibMedicalService/H2O_service.dart b/lib/core/service/AlHabibMedicalService/H2O_service.dart index c65221c5..9483bc31 100644 --- a/lib/core/service/AlHabibMedicalService/H2O_service.dart +++ b/lib/core/service/AlHabibMedicalService/H2O_service.dart @@ -1,5 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_month_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_today_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart'; @@ -10,8 +12,66 @@ class H2OService extends BaseService { List userProgressForTodayDataList = List(); List userProgressForWeekDataList = List(); List userProgressForMonthDataList = List(); - UserProgressRequestModel userProgressRequestModel = - UserProgressRequestModel(); + UserProgressRequestModel userProgressRequestModel = UserProgressRequestModel(); + + UserDetailModel userDetailModel = UserDetailModel(); + + Future getUserDetail() async { + userProgressRequestModel.progress = 1; + userProgressRequestModel.mobileNumber = user.mobileNumber.substring(1); + userProgressRequestModel.identificationNo = user.patientIdentificationNo; + + hasError = false; + await baseAppClient.post(H2O_GET_USER_DETAIL, onSuccess: (dynamic response, int statusCode) { + userDetailModel = UserDetailModel.fromJson(response["UserDetailData_New"]); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userProgressRequestModel.toJson()); + } + + Future updateUserDetail(UserDetailModel userDetail) async { + userProgressRequestModel.progress = 1; + userProgressRequestModel.mobileNumber = user.mobileNumber.substring(1); + userProgressRequestModel.identificationNo = user.patientIdentificationNo; + + UserDetailRequestModel _requestModel = UserDetailRequestModel(); + + _requestModel.activityID = userDetail.activityID.toString(); + _requestModel.channel = userProgressRequestModel.channel; + _requestModel.dOB = userDetail.dOB; + _requestModel.deviceTypeID = userProgressRequestModel.deviceTypeID; + _requestModel.email = userDetail.emailID; + _requestModel.firstName = userDetail.firstName; + _requestModel.gender = userDetail.gender; + _requestModel.height = userDetail.height; + _requestModel.iPAdress = userProgressRequestModel.iPAdress; + _requestModel.identificationNo = userProgressRequestModel.identificationNo; + _requestModel.isHeightInCM = userDetail.isHeightInCM; + _requestModel.isWeightInKG = userDetail.isWeightInKG; + _requestModel.languageID = userProgressRequestModel.languageID; + _requestModel.mobileNumber = userProgressRequestModel.mobileNumber; + _requestModel.patientID = userProgressRequestModel.patientID; + _requestModel.patientOutSA = userProgressRequestModel.patientOutSA; + _requestModel.patientType = userProgressRequestModel.patientType; + _requestModel.patientTypeID = userProgressRequestModel.patientOutSA; + _requestModel.sessionID = userProgressRequestModel.sessionID; + _requestModel.tokenID = userProgressRequestModel.tokenID; + _requestModel.versionID = userProgressRequestModel.versionID; + _requestModel.zipCode = userDetail.zipCode; + _requestModel.weight = userDetail.weight; + _requestModel.generalid = userProgressRequestModel.generalid; + _requestModel.isDentalAllowedBackend = userProgressRequestModel.isDentalAllowedBackend; + _requestModel.isNotificationOn = userDetail.isNotificationON; + + hasError = false; + await baseAppClient.post(H2O_UPDATE_USER_DETAIL, onSuccess: (dynamic response, int statusCode) { + userDetailModel = userDetail; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestModel.toJson()); + } Future getUserProgressForTodayData() async { userProgressRequestModel.progress = 1; @@ -19,12 +79,10 @@ class H2OService extends BaseService { userProgressRequestModel.identificationNo = user.patientIdentificationNo; hasError = false; - await baseAppClient.post(H2O_GET_USER_PROGRESS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) { userProgressForTodayDataList.clear(); response['UserProgressForTodayData'].forEach((progressData) { - userProgressForTodayDataList - .add(UserProgressForTodayDataModel.fromJson(progressData)); + userProgressForTodayDataList.add(UserProgressForTodayDataModel.fromJson(progressData)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -38,16 +96,15 @@ class H2OService extends BaseService { userProgressRequestModel.identificationNo = super.user.patientIdentificationNo; hasError = false; - await baseAppClient.post(H2O_GET_USER_PROGRESS, - onSuccess: (dynamic response, int statusCode) { - userProgressForTodayDataList.clear(); - response['UserProgressForWeekData'].forEach((hospital) { - userProgressForWeekDataList.add(UserProgressForWeekDataModel.fromJson(hospital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: userProgressRequestModel.toJson()); + await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) { + userProgressForWeekDataList.clear(); + response['UserProgressForWeekData'].forEach((hospital) { + userProgressForWeekDataList.add(UserProgressForWeekDataModel.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userProgressRequestModel.toJson()); } Future getUserProgressForMonthData() async { @@ -56,8 +113,7 @@ class H2OService extends BaseService { userProgressRequestModel.identificationNo = super.user.patientIdentificationNo; hasError = false; - await baseAppClient.post(H2O_GET_USER_PROGRESS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(H2O_GET_USER_PROGRESS, onSuccess: (dynamic response, int statusCode) { userProgressForMonthDataList.clear(); response['UserProgressForMonthData'].forEach((hospital) { userProgressForMonthDataList.add(UserProgressForMonthDataModel.fromJson(hospital)); @@ -68,22 +124,33 @@ class H2OService extends BaseService { }, body: userProgressRequestModel.toJson()); } - - - Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async { + hasError = false; + await baseAppClient.post(H2O_INSERT_USER_ACTIVITY, onSuccess: (dynamic response, int statusCode) { + userProgressForTodayDataList.clear(); + response['UserProgressForTodayData'].forEach((progressData) { + userProgressForTodayDataList.add(UserProgressForTodayDataModel.fromJson(progressData)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: insertUserActivityRequestModel.toJson()); + } + + Future undoUserActivity() async { + userProgressRequestModel.progress = 1; + userProgressRequestModel.mobileNumber = user.mobileNumber.substring(1); + userProgressRequestModel.identificationNo = user.patientIdentificationNo; hasError = false; - await baseAppClient.post(H2O_INSERT_USER_ACTIVITY, - onSuccess: (dynamic response, int statusCode) { - userProgressForTodayDataList.clear(); - response['UserProgressForTodayData'].forEach((progressData) { - userProgressForTodayDataList - .add(UserProgressForTodayDataModel.fromJson(progressData)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: insertUserActivityRequestModel.toJson()); + await baseAppClient.post(H2O_UNDO_USER_ACTIVITY, onSuccess: (dynamic response, int statusCode) { + userProgressForTodayDataList.clear(); + response['UserProgressForTodayData'].forEach((progressData) { + userProgressForTodayDataList.add(UserProgressForTodayDataModel.fromJson(progressData)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userProgressRequestModel.toJson()); } } diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index dffa6683..9e99f3ad 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; @@ -47,8 +48,9 @@ class CMCService extends BaseService { await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { cmcAllPresOrdersList.clear(); + cmcAllOrderDetail.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == 3) + if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) cmcAllPresOrdersList .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); @@ -104,7 +106,7 @@ class CMCService extends BaseService { Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { hasError = false; - await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, + await baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart index da12b48b..803a80f0 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -43,7 +43,7 @@ class CustomerAddressesService extends BaseService { 'fields':'addresses' }; hasError = false; - await baseAppClient.get("$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", + await baseAppClient.getPharmacy("$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", onSuccess: (dynamic response, int statusCode) { addressesList.clear(); response["customers"][0]["addresses"].forEach((data) { @@ -63,7 +63,7 @@ class CustomerAddressesService extends BaseService { }; hasError = false; - await baseAppClient.get(GET_CUSTOMER_INFO, + await baseAppClient.getPharmacy(GET_CUSTOMER_INFO, onSuccess: (dynamic response, int statusCode) { customerInfo= CustomerInfo.fromJson(response); }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index e636321b..2ec1e310 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hHC_all_pres_orders_request_model.dart'; @@ -7,6 +8,8 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import '../base_service.dart'; @@ -15,9 +18,10 @@ class HomeHealthCareService extends BaseService { List hhcAllPresOrdersList = List(); List hhcAllOrderDetail = List(); + List addressesList = List(); bool isOrderUpdated; - + CustomerInfo customerInfo; Future getHHCAllServices( HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; @@ -37,11 +41,11 @@ class HomeHealthCareService extends BaseService { GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORD, onSuccess: (dynamic response, int statusCode) { hhcAllPresOrdersList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == 2) + if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) hhcAllPresOrdersList .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); @@ -91,3 +95,5 @@ class HomeHealthCareService extends BaseService { }, body: order.toJson()); } } + + diff --git a/lib/core/service/childvaccines/vaccination_table_service.dart b/lib/core/service/childvaccines/vaccination_table_service.dart index 7f987b76..fc2b40e9 100644 --- a/lib/core/service/childvaccines/vaccination_table_service.dart +++ b/lib/core/service/childvaccines/vaccination_table_service.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import '../base_service.dart'; class VaccinationTableService extends BaseService { @@ -10,19 +12,18 @@ class VaccinationTableService extends BaseService { - Future getCreateVaccinationTableOrders() async { + Future getCreateVaccinationTableOrders(List_BabyInformationModel babyInfo, bool sendEmail) async { + String babyBDFormatted = "${DateUtil.convertDateToString(babyInfo.dOB)}/"; + hasError = false; await getUser(); - body['BabyName']="fffffffffff eeeeeeeeeeeeee"; - body['DOB'] = "/Date(1585774800000+0300)/"; + body['BabyName']= babyInfo.babyName; + body['DOB'] = babyBDFormatted; body['EmailAddress'] = user.emailAddress; body['isDentalAllowedBackend'] = false; - body['SendEmail'] = false; + body['SendEmail'] = sendEmail; body['IsLogin'] =true; - - - await baseAppClient.post(GET_TABLE_REQUEST, onSuccess: (dynamic response, int statusCode) { createVaccinationTableModelList.clear(); diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 04f599f1..a11f9169 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -46,7 +46,7 @@ class BaseAppClient { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); if (!isExternal) { String token = await sharedPref.getString(TOKEN); - var languageID = await sharedPref.getString(APP_LANGUAGE); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE,'ar'); var user = await sharedPref.getObject(USER_PROFILE); if (body.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') @@ -58,15 +58,7 @@ class BaseAppClient { body['VersionID'] = VERSION_ID; body['Channel'] = CHANNEL; - body['LanguageID'] = body.containsKey('LanguageID') - ? body['LanguageID'] != null - ? body['LanguageID'] - : languageID == 'ar' - ? 1 - : 2 - : languageID == 'en' - ? 2 - : 1; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; body['IPAdress'] = IP_ADDRESS; body['generalid'] = GENERAL_ID; @@ -203,7 +195,7 @@ class BaseAppClient { get(String endPoint, {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, - Map queryParams, + Map queryParams, bool isExternal = false}) async { String url; if (isExternal) { @@ -244,19 +236,41 @@ class BaseAppClient { {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, bool isAllowAny = false, - Map queryParams}) async { - String url = PHARMACY_BASE_URL + endPoint; + bool isExternal = false, + Map queryParams}) async { + + String url; + if (isExternal) { + url = endPoint; + } else { + url = PHARMACY_BASE_URL + endPoint; + } if (queryParams != null) { String queryString = Uri(queryParameters: queryParams).query; url += '?' + queryString; } print("URL : $url"); + var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); + var user = await sharedPref.getObject(USER_PROFILE); + + Map test = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'Authorization': token, + 'Mobilenumber': user['MobileNumber'].toString(), + 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', + 'Username': user['PatientID'].toString(), + }; if (await Utils.checkConnection()) { final response = await http.get(url.trim(), headers: { 'Content-Type': 'application/json', - 'Accept': 'application/json' + 'Accept': 'application/json', + 'Authorization': token, + 'Mobilenumber': user['MobileNumber'].toString(), + 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', + 'Username': user['PatientID'].toString(), }); final int statusCode = response.statusCode; print("statusCode :$statusCode"); diff --git a/lib/core/service/medical/BloodPressureService.dart b/lib/core/service/medical/BloodPressureService.dart index f2681191..82130750 100644 --- a/lib/core/service/medical/BloodPressureService.dart +++ b/lib/core/service/medical/BloodPressureService.dart @@ -68,6 +68,19 @@ class BloodPressureService extends BaseService { super.error = error; }, body: Map()); } + Future sendReportByEmail() async { + hasError = false; + super.error = ""; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['to'] = user.emailAddress; + await baseAppClient.post(SEND_AVERAGE_BLOOD_PRESSURE_REPORT, + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } addDiabtecResult( {String bloodPressureDate, @@ -93,4 +106,43 @@ class BloodPressureService extends BaseService { super.error = error; }, body: body); } + + updateDiabtecResult( + {String bloodPressureDate, + String diastolicPressure, + String systolicePressure, + int measuredArm}) async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['BloodPressureDate'] = bloodPressureDate; + body['DiastolicPressure'] = diastolicPressure; + body['SystolicePressure'] = systolicePressure; + body['MeasuredArm'] ='$measuredArm'; + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(UPDATE_BLOOD_PRESSURE_RESULT, + onSuccess: (response, statusCode) async { + + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future deactivateDiabeticStatus({int lineItemNo }) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['LineItemNo'] =lineItemNo; + await baseAppClient.post(DEACTIVATE_BLOOD_PRESSURES_STATUS, + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/service/medical/BloodSugarService.dart b/lib/core/service/medical/BloodSugarService.dart index 09fe9fe9..e8e2fabf 100644 --- a/lib/core/service/medical/BloodSugarService.dart +++ b/lib/core/service/medical/BloodSugarService.dart @@ -24,6 +24,11 @@ class BloodSugarService extends BaseService { monthDiabtectResultAverageList.clear(); weekDiabtectResultAverageList.clear(); yearDiabtecResultAverageList.clear(); + + monthDiabtecPatientResult.clear(); + weekDiabtecPatientResult.clear(); + yearDiabtecPatientResult.clear(); + response['List_MonthDiabtectResultAverage'].forEach((item) { monthDiabtectResultAverageList .add(MonthDiabtectResultAverage.fromJson(item)); @@ -69,28 +74,66 @@ class BloodSugarService extends BaseService { }, body: Map()); } - addDiabtecResult( - {String bloodSugerDateChart, - String bloodSugerResult, - String diabtecUnit, - int measuredTime}) async { + addDiabtecResult({String bloodSugerDateChart, String bloodSugerResult, String diabtecUnit, int measuredTime}) async { hasError = false; super.error = ""; - Map body = Map(); body['BloodSugerDateChart'] = bloodSugerDateChart; body['BloodSugerResult'] = bloodSugerResult; body['DiabtecUnit'] = diabtecUnit; - body['MeasuredTime'] =2;// measuredTime; + body['MeasuredTime'] = measuredTime+1; body['isDentalAllowedBackend'] = false; + await baseAppClient.post(ADD_DIABTEC_RESULT, + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } - await baseAppClient.post(ADD_BLOOD_PRESSURE_RESULT, - onSuccess: (response, statusCode) async { - var asd =""; - }, + updateDiabtecResult({DateTime month,DateTime hour,String bloodSugerResult,String diabtecUnit, int measuredTime,int lineItemNo}) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['BloodSugerResult'] = bloodSugerResult; + body['DiabtecUnit'] = diabtecUnit; + body['BloodSugerDateChart'] = '${month.year}-${month.month}-${month.day} ${hour.hour}:${hour.minute}:00'; + body['isDentalAllowedBackend'] = false; + body['MeasuredTime'] = measuredTime+1; + body['LineItemNo'] = lineItemNo; + await baseAppClient.post(UPDATE_DIABETIC_RESULT, + onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } + + Future sendReportByEmail() async { + hasError = false; + super.error = ""; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['to'] = user.emailAddress; + await baseAppClient.post(SEND_AVERAGE_BLOOD_SUGAR_REPORT, + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future deactivateDiabeticStatus({int lineItemNo }) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['LineItemNo'] =lineItemNo; + await baseAppClient.post(DEACTIVATE_DIABETIC_STATUS, + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/service/medical/WeightPressureService.dart b/lib/core/service/medical/WeightPressureService.dart index 27048dc8..b48c4795 100644 --- a/lib/core/service/medical/WeightPressureService.dart +++ b/lib/core/service/medical/WeightPressureService.dart @@ -6,11 +6,13 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/weight/YearWeightMeas import 'package:diplomaticquarterapp/core/service/base_service.dart'; class WeightService extends BaseService { - ///Average - List monthWeightMeasurementResultAverage = List(); - List weekWeightMeasurementResultAverage = List(); - List yearWeightMeasurementResultAverage = List(); + List + monthWeightMeasurementResultAverage = List(); + List weekWeightMeasurementResultAverage = + List(); + List yearWeightMeasurementResultAverage = + List(); ///Result List monthWeightMeasurementResult = List(); @@ -59,7 +61,8 @@ class WeightService extends BaseService { }); response['List_MonthWeightMeasurementResult'].forEach((item) { - monthWeightMeasurementResult.add(WeightMeasurementResult.fromJson(item)); + monthWeightMeasurementResult + .add(WeightMeasurementResult.fromJson(item)); }); response['List_YearWeightMeasurementResult'].forEach((item) { @@ -72,9 +75,7 @@ class WeightService extends BaseService { } addWeightResult( - {String weightDate, - String weightMeasured, - int weightUnit}) async { + {String weightDate, String weightMeasured, int weightUnit}) async { hasError = false; super.error = ""; @@ -85,9 +86,53 @@ class WeightService extends BaseService { body['isDentalAllowedBackend'] = false; await baseAppClient.post(ADD_WEIGHT_PRESSURE_RESULT, - onSuccess: (response, statusCode) async { + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + updateWeightResult({int lineItemNo, int weightUnit,String weightMeasured,String weightDate}) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['LineItemNo'] = lineItemNo; + body['weightUnit'] = '$weightUnit'; + body['WeightMeasured'] = weightMeasured; + body['WeightDate'] = weightDate; + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(UPDATE_WEIGHT_PRESSURE_RESULT, + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future sendReportByEmail() async { + hasError = false; + super.error = ""; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['to'] = user.emailAddress; + await baseAppClient.post(SEND_AVERAGE_BLOOD_WEIGHT_REPORT, + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + deleteWeightResult({int lineItemNo, }) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['LineItemNo'] = lineItemNo; + body['isDentalAllowedBackend'] = false; - }, + await baseAppClient.post(DEACTIVATE_WEIGHT_PRESSURE_RESULT, + onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/medical/my_balance_service.dart b/lib/core/service/medical/my_balance_service.dart index 86e925b8..e2744250 100644 --- a/lib/core/service/medical/my_balance_service.dart +++ b/lib/core/service/medical/my_balance_service.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; @@ -23,11 +24,11 @@ class MyBalanceService extends BaseService { PatientInfoAndMobileNumber patientInfoAndMobileNumber; String logInTokenID; String verificationCode; - + String updatedRegisterBloodMessage = ""; AuthenticatedUserObject authenticatedUserObject = locator(); - MyBalanceService(){ + MyBalanceService() { getFamilyFiles(); } @@ -156,4 +157,49 @@ class MyBalanceService extends BaseService { return await getSharedRecordByStatus(); } } + + Future updateBloodGroup(List_BloodGroupDetailsModel detailsModel) async { + hasError = false; + await getUser(); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Map body = Map(); + body['City'] = detailsModel.city; + body['cityCode'] = detailsModel.cityCode; + body['Gender'] = detailsModel.gender; + body['BloodGroup'] = detailsModel.bloodGroup; + body['CellNumber'] = user.mobileNumber; + body['LanguageID'] = languageID; + body['NationalID'] = user.nationalityID; + body['ZipCode'] = user.zipCode ?? "+966"; + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(BLOOD_DONATION_REGISTER_BLOOD_TYPE, + onSuccess: (dynamic response, int statusCode) { + updatedRegisterBloodMessage = response['ErrorEndUserMessage']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + if(error == null){ + super.error = "Something went wrong"; + } + }, body: body); + } + + Future addUserAgreementForBloodDonation() async { + hasError = false; + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Map body = Map(); + body['IsAgreed'] = true; + body['LanguageID'] = languageID; + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(ADD_USER_AGREEMENT_FOR_BLOOD_DONATION, + onSuccess: (dynamic response, int statusCode) { + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index b2f90e61..bf340814 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -68,6 +68,19 @@ class ReportsService extends BaseService { }, body: body); } + Future updateEmail({String email}) async { + Map body = Map(); + 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); + } + Future insertRequestForMedicalReport( AppointmentHistory appointmentHistory) async { Map body = new Map(); diff --git a/lib/core/service/offers_service.dart b/lib/core/service/offers_service.dart index 2247c833..8007007b 100644 --- a/lib/core/service/offers_service.dart +++ b/lib/core/service/offers_service.dart @@ -21,7 +21,7 @@ class OffersCategoriseService extends BaseService { Future getOffersCategorise() async { hasError = false; _offersList.clear(); - await baseAppClient.get( + await baseAppClient.getPharmacy( GET_OFFERS_CATEGORISE, onSuccess: (dynamic response, int statusCode) { response['categories'].forEach((item) { @@ -40,7 +40,7 @@ class OffersCategoriseService extends BaseService { _offerProducts.clear(); String endPoint = id != null ? GET_OFFERS_PRODUCTS + "$id" : GET_OFFERS_PRODUCTS + "1"; - await baseAppClient.get( + await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 5648ff6d..18cfa87e 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -21,7 +21,7 @@ class OrderPreviewService extends BaseService { Map queryParams = {'fields': 'addresses'}; hasError = false; try { - await baseAppClient.get("$GET_CUSTOMERS_ADDRESSES$customerId", + await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) { addresses.clear(); response['customers'][0]['addresses'].forEach((item) { @@ -42,7 +42,7 @@ class OrderPreviewService extends BaseService { dynamic localRes; hasError = false; try { - await baseAppClient.get("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}", + await baseAppClient.getPharmacy("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}", onSuccess: (dynamic response, int statusCode) { localRes = response['shipping_option'][0]; }, onFailure: (String error, int statusCode) { @@ -61,7 +61,7 @@ class OrderPreviewService extends BaseService { dynamic localRes; hasError = false; try { - await baseAppClient.get("$GET_SHOPPING_CART$customerId", + await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId", onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { @@ -125,7 +125,7 @@ class OrderPreviewService extends BaseService { super.error = ""; dynamic localRes; - await baseAppClient.get("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart", + await baseAppClient.getPharmacy("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart", onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index c3bce324..c400d788 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -11,6 +11,7 @@ class PharmacyModuleService extends BaseService { bool isFinished = true; bool hasError = false; String errorMsg = ''; + String url = ""; List bannerItems = List(); List manufacturerList = List(); @@ -21,8 +22,7 @@ class PharmacyModuleService extends BaseService { Map queryParams = {'FileNumber': data['PatientID'].toString()}; hasError = false; try { - await baseAppClient.get(PHARMACY_VERIFY_CUSTOMER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode) { if (response['UserName'] != null) { sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); print(response); @@ -54,9 +54,29 @@ class PharmacyModuleService extends BaseService { }; hasError = false; try { - await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async{ if (!response['IsRegistered']) {} + await generatePharmacyToken(); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future generatePharmacyToken() async { + Map queryParams = { + 'Filenumber':user.patientID.toString(), + 'MobileNumber':user.mobileNumber, + }; + hasError = false; + try { + await baseAppClient.get(PHARMACY_AUTORZIE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async{ + if (response['Status'] == 200) { + await sharedPref.setString(PHARMACY_AUTORZIE_TOKEN, response['token'].toString()); + } }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -69,8 +89,7 @@ class PharmacyModuleService extends BaseService { Future getBannerListList() async { hasError = false; try { - await baseAppClient.get(GET_PHARMACY_BANNER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BANNER, onSuccess: (dynamic response, int statusCode) { bannerItems.clear(); response['images'].forEach((item) { bannerItems.add(PharmacyImageObject.fromJson(item)); @@ -87,12 +106,11 @@ class PharmacyModuleService extends BaseService { Future getTopManufacturerList() async { Map queryParams = {'page': '1', 'limit': '8'}; try { - await baseAppClient.get(GET_PHARMACY_TOP_MANUFACTURER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) { manufacturerList.clear(); response['manufacturer'].forEach((item) { Manufacturer manufacturer = Manufacturer.fromJson(item); - if(manufacturer.image != null){ + if (manufacturer.image != null) { manufacturerList.add(Manufacturer.fromJson(item)); } }); @@ -111,8 +129,7 @@ class PharmacyModuleService extends BaseService { 'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews', }; try { - await baseAppClient.get(GET_PHARMACY_BEST_SELLER_PRODUCT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) { bestSellerProducts.clear(); response['products'].forEach((item) { bestSellerProducts.add(PharmacyProduct.fromJson(item)); @@ -128,13 +145,10 @@ class PharmacyModuleService extends BaseService { Future getLastVisitedProducts() async { String lastVisited = ""; - if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != - null) { - lastVisited = - await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { + lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); try { - await baseAppClient.get("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) { lastVisitedProducts.clear(); response['products'].forEach((item) { lastVisitedProducts.add(PharmacyProduct.fromJson(item)); diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart new file mode 100644 index 00000000..33c2cfd7 --- /dev/null +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -0,0 +1,53 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; + + +class PrescriptionService extends BaseService { + final AppSharedPreferences sharedPref = AppSharedPreferences(); + bool isFinished = true; + bool hasError = false; + String errorMsg = ''; + String url = ""; + + List _prescriptionsList = List(); + List get prescriptionsList => _prescriptionsList; + + + Future getPrescription() async { + hasError = false; + url = PRESCRIPTION; + print("Print PRESCRIPTION url" + url); + await baseAppClient.post(url, + onSuccess: (dynamic response, int statusCode) { + _prescriptionsList.clear(); + response['PatientPrescriptionList'].forEach((item) { + _prescriptionsList.add(Prescriptions.fromJson(item)); + }); + print(_prescriptionsList.length); + print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } +// Future getPrescription() async { +// hasError = false; +// Map body = Map(); +// body['isDentalAllowedBackend'] = false; +// await baseAppClient.post(PRESCRIPTION, +// onSuccess: (dynamic response, int statusCode) { +// prescriptionsList.clear(); +// response['PatientPrescriptionList'].forEach((prescriptions) { +// prescriptionsList.add(Prescriptions.fromJson(prescriptions)); +// }); +// }, onFailure: (String error, int statusCode) { +// hasError = true; +// super.error = error; +// }, body: body); +// } + +} \ No newline at end of file diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index b55a755d..0082cc49 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -56,7 +56,7 @@ class PharmacyCategoriseService extends BaseService { Future getCategorise() async { hasError = false; _categoriseList.clear(); - await baseAppClient.get( + await baseAppClient.getPharmacy( GET_PHARMACY_CATEGORISE, onSuccess: (dynamic response, int statusCode) { response['categories'].forEach((item) { @@ -74,7 +74,7 @@ class PharmacyCategoriseService extends BaseService { hasError = false; _scanList.clear(); String endPoint = id != null ? SCAN_QR_CODE + "$id" : SCAN_QR_CODE + ""; - await baseAppClient.get( + await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { @@ -94,7 +94,7 @@ class PharmacyCategoriseService extends BaseService { String endPoint = productName != null ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' : GET_SEARCH_PRODUCTS + ""; - await baseAppClient.get( + await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { @@ -111,7 +111,7 @@ class PharmacyCategoriseService extends BaseService { Future getBrands() async { hasError = false; _brandsList.clear(); - await baseAppClient.get( + await baseAppClient.getPharmacy( GET_BRANDS_LIST, onSuccess: (dynamic response, int statusCode) { response['manufacturer'].forEach((item) { @@ -130,7 +130,7 @@ class PharmacyCategoriseService extends BaseService { _parentCategoriseList.clear(); String endPoint = id != null ? GET_CATEGORISE_PARENT + "$id" : GET_CATEGORISE_PARENT + ""; - await baseAppClient.get( + await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { response['categories'].forEach((item) { @@ -150,7 +150,7 @@ class PharmacyCategoriseService extends BaseService { String endPoint = id != null ? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50' : GET_PARENT_PRODUCTS + ""; - await baseAppClient.get( + await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { @@ -170,7 +170,7 @@ class PharmacyCategoriseService extends BaseService { String endPoint = id != null ? GET_SUB_CATEGORISE + "$id" : GET_SUB_CATEGORISE + ""; - await baseAppClient.get( + await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { response['categories'].forEach((item) { @@ -190,7 +190,7 @@ class PharmacyCategoriseService extends BaseService { String endPoint = id != null ? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50' : GET_SUB_PRODUCTS + ""; - await baseAppClient.get( + await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { @@ -209,7 +209,7 @@ class PharmacyCategoriseService extends BaseService { _finalProducts.clear(); String endPoint = id != null ? GET_FINAL_PRODUCTS + "$id" : GET_FINAL_PRODUCTS + ""; - await baseAppClient.get( + await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { diff --git a/lib/core/service/termsConditionsService.dart b/lib/core/service/termsConditionsService.dart new file mode 100644 index 00000000..1f806e22 --- /dev/null +++ b/lib/core/service/termsConditionsService.dart @@ -0,0 +1,18 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class TermsConditionsService extends BaseService { + + String userAgreementContent = ""; + + Future getUserTermsAndConditions() async { + hasError = false; + await baseAppClient.post(GET_USER_TERMS, + onSuccess: (dynamic response, int statusCode) { + userAgreementContent = response['UserAgreementContent']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } +} \ No newline at end of file diff --git a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart index 15b00e37..a89ec799 100644 --- a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart @@ -1,26 +1,54 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_month_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_today_data_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:charts_flutter/flutter.dart' as charts; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import '../../../locator.dart'; class H2OViewModel extends BaseViewModel { - H2OService _h2OService = locator(); List userProgressForWeekDataSeries; List userProgressForMonthDataSeries; + UserDetailModel get userDetail => _h2OService.userDetailModel; + UserProgressForTodayDataModel get userProgressData { - if (_h2OService.userProgressForTodayDataList.length != 0) - return _h2OService.userProgressForTodayDataList[0]; - return null; + if (_h2OService.userProgressForTodayDataList.length != 0) return _h2OService.userProgressForTodayDataList[0]; + return null; } + Future getUserDetail() async { + // if(_h2OService.userProgressForTodayDataList.length==0){ + setState(ViewState.Busy); + await _h2OService.getUserDetail(); + if (_h2OService.hasError) { + error = _h2OService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future updateUserDetail(UserDetailModel userDetailModel, Function(bool) onResponse) async { + setState(ViewState.Busy); + + await _h2OService.updateUserDetail(userDetailModel); + if (_h2OService.hasError) { + error = _h2OService.error; + setState(ViewState.Error); + onResponse(false); + } else { + _h2OService.userDetailModel = userDetailModel; + setState(ViewState.Idle); + onResponse(true); + } + } Future getUserProgressForTodayData() async { // if(_h2OService.userProgressForTodayDataList.length==0){ @@ -58,13 +86,9 @@ class H2OViewModel extends BaseViewModel { } } - - List> createUserProgressForWeekDataSeries() { - List globalData = [ - ]; - _h2OService.userProgressForWeekDataList.forEach(( - UserProgressForWeekDataModel data) { + List> createUserProgressForWeekDataSeries() { + List globalData = []; + _h2OService.userProgressForWeekDataList.forEach((UserProgressForWeekDataModel data) { globalData.add(new ChartSeries(data.dayName, data.percentageConsumed)); }); return [ @@ -77,12 +101,9 @@ class H2OViewModel extends BaseViewModel { ]; } - List> createUserProgressForMonthDataSeries() { - List globalData = [ - ]; - _h2OService.userProgressForMonthDataList.forEach(( - UserProgressForMonthDataModel data) { + List> createUserProgressForMonthDataSeries() { + List globalData = []; + _h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) { globalData.add(new ChartSeries(data.monthName, data.percentageConsumed)); }); return [ @@ -95,14 +116,10 @@ class H2OViewModel extends BaseViewModel { ]; } - - Future insertUserActivity( - InsertUserActivityRequestModel insertUserActivityRequestModel) async { + Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async { setState(ViewState.BusyLocal); - insertUserActivityRequestModel.mobileNumber = - user.mobileNumber.substring(1); - insertUserActivityRequestModel.identificationNo = - user.patientIdentificationNo; + insertUserActivityRequestModel.mobileNumber = user.mobileNumber.substring(1); + insertUserActivityRequestModel.identificationNo = user.patientIdentificationNo; await _h2OService.insertUserActivity(insertUserActivityRequestModel); if (_h2OService.hasError) { @@ -113,9 +130,18 @@ class H2OViewModel extends BaseViewModel { } } + Future undoUserActivity() async { + setState(ViewState.BusyLocal); + await _h2OService.undoUserActivity(); + if (_h2OService.hasError) { + error = _h2OService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } - /// Sample ordinal data type. class ChartSeries { final String y; diff --git a/lib/core/viewModels/TermsConditionsViewModel.dart b/lib/core/viewModels/TermsConditionsViewModel.dart new file mode 100644 index 00000000..0cd667cf --- /dev/null +++ b/lib/core/viewModels/TermsConditionsViewModel.dart @@ -0,0 +1,29 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/termsConditionsService.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; + +import '../../locator.dart'; + +class TermsConditionsViewModel extends BaseViewModel{ + + TermsConditionsService _service = locator(); + + String get userAgreementContent => _service.userAgreementContent; + + getUserTermsAndConditions() async { + setState(ViewState.Busy); + await _service.getUserTermsAndConditions(); + if (_service.hasError) { + error = _service.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + @override + void dispose() { + super.dispose(); + } + +} \ No newline at end of file diff --git a/lib/core/viewModels/appointment_rate_view_model.dart b/lib/core/viewModels/appointment_rate_view_model.dart index 23d00366..e1bdfc9e 100644 --- a/lib/core/viewModels/appointment_rate_view_model.dart +++ b/lib/core/viewModels/appointment_rate_view_model.dart @@ -40,7 +40,7 @@ class AppointmentRateViewModel extends BaseViewModel { Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { - setState(ViewState.BusyLocal); + setState(ViewState.Busy); await _appointmentRateService.sendAppointmentRate( rate, appointmentNo, projectID, doctorID, clinicID, note); if (_appointmentRateService.hasError) { diff --git a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart index 3b72dd50..d0ccb8a1 100644 --- a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart +++ b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; @@ -11,14 +12,12 @@ import '../base_view_model.dart'; class VaccinationTableViewModel extends BaseViewModel{ VaccinationTableService _creteVaccinationTableService = locator(); + List get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList; - // String get creteVaccinationTableContent => _creteVaccinationTableService.userAgreementContent; - //String get userAgreementContent => _creteNewBabyService.v//_reportsService.userAgreementContent; - List get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;//.createNewBabyModelList; - getCreateVaccinationTable() async { + getCreateVaccinationTable(List_BabyInformationModel babyInfo, bool sendEmail) async { setState(ViewState.Busy); - await _creteVaccinationTableService.getCreateVaccinationTableOrders();//getCreateNewBabyOrders(); + await _creteVaccinationTableService.getCreateVaccinationTableOrders(babyInfo, sendEmail);//getCreateNewBabyOrders(); if ( _creteVaccinationTableService.hasError) { error = _creteVaccinationTableService.error; diff --git a/lib/core/viewModels/medical/blood_pressure_view_model.dart b/lib/core/viewModels/medical/blood_pressure_view_model.dart index dfff5b45..ae3abbcb 100644 --- a/lib/core/viewModels/medical/blood_pressure_view_model.dart +++ b/lib/core/viewModels/medical/blood_pressure_view_model.dart @@ -1,33 +1,31 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; import 'package:diplomaticquarterapp/core/service/medical/BloodPressureService.dart'; -import 'package:diplomaticquarterapp/core/service/medical/BloodSugarService.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:charts_flutter/flutter.dart' as charts; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import '../../../core/viewModels/base_view_model.dart'; class BloodPressureViewMode extends BaseViewModel { BloodPressureService bloodPressureService = locator(); - ///BLOOD - List _bloodDiastolicPressureWeeklyTimeSeriesSalesList = List(); - List _bloodSystolicePressureWeeklyTimeSeriesSalesList = List(); + List get monthDiabtecPatientResult => + bloodPressureService.monthDiabtecPatientResult; - List _bloodDiastolicMonthlyTimeSeriesSalesList = List(); - List _bloodSystolicMonthlyTimeSeriesSalesList = List(); + List get weekDiabtecPatientResult => + bloodPressureService.weekDiabtecPatientResult; - List _bloodSystoliceYearTimeSeriesSalesList = List(); - List _bloodDiastolicYearTimeSeriesSalesList = List(); + List get yearDiabtecPatientResult => + bloodPressureService.yearDiabtecPatientResult; - List get monthDiabtecPatientResult => bloodPressureService.monthDiabtecPatientResult; + List weightWeekTimeSeriesDataTop = []; + List weightWeekTimeSeriesDataLow = []; - List get weekDiabtecPatientResult => bloodPressureService.weekDiabtecPatientResult; + List weighMonthTimeSeriesDataTop = []; + List weighMonthTimeSeriesDataLow = []; - List get yearDiabtecPatientResult => bloodPressureService.yearDiabtecPatientResult; + List weightYearTimeSeriesDataTop = []; + List weightYearTimeSeriesDataLow = []; Future getBloodPressure() async { setState(ViewState.Busy); @@ -35,114 +33,94 @@ class BloodPressureViewMode extends BaseViewModel { await bloodPressureService.getDiabtecResults(); if (bloodPressureService.hasError) { error = bloodPressureService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else { + clearDate(); bloodPressureService.weekDiabtectResultAverageList.forEach((element) { - _bloodDiastolicPressureWeeklyTimeSeriesSalesList.add(WeekChartDate( - x: element.bloodPressureDate, - y: element.dailyDiastolicPressureAverageResult)); - _bloodSystolicePressureWeeklyTimeSeriesSalesList.add(WeekChartDate( - x: element.bloodPressureDate, - y: element.dailySystolicePressureAverageResult)); - }); + weightWeekTimeSeriesDataTop.add(TimeSeriesSales2( + element.bloodPressureDate, + element.dailyDiastolicPressureAverageResult.toDouble())); + weightWeekTimeSeriesDataLow.add(TimeSeriesSales2( + element.bloodPressureDate, + element.dailySystolicePressureAverageResult.toDouble())); - for (int index = 0; - index < bloodPressureService.monthDiabtectResultAverageList.length; - index++) { - _bloodDiastolicMonthlyTimeSeriesSalesList.add(YearMonthlyChartDate( - x: index, - y: bloodPressureService.monthDiabtectResultAverageList[index] - .weekDiastolicPressureAverageResult)); - _bloodSystolicMonthlyTimeSeriesSalesList.add(YearMonthlyChartDate( - x: index, - y: bloodPressureService.monthDiabtectResultAverageList[index] - .weekSystolicePressureAverageResult)); - } - - bloodPressureService.yearDiabtecResultAverageList.forEach((element) { - _bloodSystoliceYearTimeSeriesSalesList - .add(WeekChartDate(x: element.date, y: element.monthSystolicePressureAverageResult)); - - _bloodDiastolicYearTimeSeriesSalesList - .add(WeekChartDate(x: element.date, y: element.monthDiastolicPressureAverageResult)); - }); + for (int index = 0; index < bloodPressureService.monthDiabtectResultAverageList.length; index++) { + + weighMonthTimeSeriesDataTop.add(TimeSeriesSales3(index, bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult.toDouble())); + + weighMonthTimeSeriesDataLow.add(TimeSeriesSales3(index, bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult.toDouble())); + } + bloodPressureService.yearDiabtecResultAverageList.forEach((element) { + weightYearTimeSeriesDataTop.add(TimeSeriesSales2(element.date, + element.monthSystolicePressureAverageResult.toDouble())); + + weightYearTimeSeriesDataLow.add(TimeSeriesSales2(element.date, + element.monthDiastolicPressureAverageResult.toDouble())); + }); + + }); setState(ViewState.Idle); } } - List> getBloodWeeklySeries() { - return [ - charts.Series( - id: 'Diastolic', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (WeekChartDate sales, _) => sales.x, - measureFn: (WeekChartDate sales, _) => sales.y, - data: _bloodDiastolicPressureWeeklyTimeSeriesSalesList, - ), - charts.Series( - id: 'Systolice', - colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, - domainFn: (WeekChartDate sales, _) => sales.x, - measureFn: (WeekChartDate sales, _) => sales.y, - data: _bloodSystolicePressureWeeklyTimeSeriesSalesList, - ) - ]; - } - List> - getBloodMonthlyTimeSeriesSales() { - return [ - charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (YearMonthlyChartDate sales, _) => sales.x, - measureFn: (YearMonthlyChartDate sales, _) => sales.y, - data: _bloodDiastolicMonthlyTimeSeriesSalesList, - ), - charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, - domainFn: (YearMonthlyChartDate sales, _) => sales.x, - measureFn: (YearMonthlyChartDate sales, _) => sales.y, - data: _bloodSystolicMonthlyTimeSeriesSalesList, - ), - ]; + void clearDate(){ + weightWeekTimeSeriesDataTop.clear(); + weightWeekTimeSeriesDataLow.clear(); + weighMonthTimeSeriesDataTop.clear(); + weighMonthTimeSeriesDataLow.clear(); + weightYearTimeSeriesDataTop.clear(); + weightYearTimeSeriesDataLow.clear(); } - List> getBloodYearTimeSeriesSales() { - return [ - charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (WeekChartDate sales, _) => sales.x, - measureFn: (WeekChartDate sales, _) => sales.y, - data: _bloodSystoliceYearTimeSeriesSalesList, - ), - charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault, - domainFn: (WeekChartDate sales, _) => sales.x, - measureFn: (WeekChartDate sales, _) => sales.y, - data: _bloodDiastolicYearTimeSeriesSalesList, - ) - ]; + Future sendReportByEmail() async { + setState(ViewState.BusyLocal); + + await bloodPressureService.sendReportByEmail(); + if (bloodPressureService.hasError) { + error = bloodPressureService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } } - addDiabtecResult( + Future addORUpdateDiabtecResult( {String bloodPressureDate, - String diastolicPressure, - String systolicePressure, - int measuredArm}) async { + String diastolicPressure, + String systolicePressure, + int measuredArm,bool isUpdate = false}) async { setState(ViewState.BusyLocal); + if(!isUpdate) await bloodPressureService.addDiabtecResult( bloodPressureDate: bloodPressureDate, diastolicPressure: diastolicPressure, systolicePressure: systolicePressure, measuredArm: measuredArm); + else + await bloodPressureService.updateDiabtecResult( + bloodPressureDate: bloodPressureDate, + diastolicPressure: diastolicPressure, + systolicePressure: systolicePressure, + measuredArm: measuredArm); + if (bloodPressureService.hasError) { + error = bloodPressureService.error; + setState(ViewState.ErrorLocal); + } else { + await getBloodPressure(); + setState(ViewState.Idle); + } + } + + + Future deactivateDiabeticStatus({int lineItemNo}) async { + setState(ViewState.BusyLocal); + + await bloodPressureService.deactivateDiabeticStatus(lineItemNo: lineItemNo); if (bloodPressureService.hasError) { error = bloodPressureService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else { await getBloodPressure(); setState(ViewState.Idle); diff --git a/lib/core/viewModels/medical/blood_sugar_view_model.dart b/lib/core/viewModels/medical/blood_sugar_view_model.dart index fb00f80e..8a513992 100644 --- a/lib/core/viewModels/medical/blood_sugar_view_model.dart +++ b/lib/core/viewModels/medical/blood_sugar_view_model.dart @@ -5,17 +5,13 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthly import 'package:diplomaticquarterapp/core/service/medical/BloodSugarService.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:charts_flutter/flutter.dart' as charts; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import '../../../core/viewModels/base_view_model.dart'; class BloodSugarViewMode extends BaseViewModel { BloodSugarService bloodSugarService = locator(); - ///BLOOD - List _bloodWeeklyTimeSeriesSalesList = List(); - List _bloodMonthlyTimeSeriesSalesList = List(); - List _bloodYearTimeSeriesSalesList = List(); - List get monthDiabtecPatientResult => bloodSugarService.monthDiabtecPatientResult; @@ -25,6 +21,10 @@ class BloodSugarViewMode extends BaseViewModel { List get yearDiabtecPatientResult => bloodSugarService.yearDiabtecPatientResult; + List bloodWeekTimeSeriesData = []; + List yearTimeSeriesData = []; + List monthTimeSeriesData = []; + Future getBloodSugar() async { setState(ViewState.Busy); await bloodSugarService.getBloodSugar(); @@ -34,67 +34,35 @@ class BloodSugarViewMode extends BaseViewModel { setState(ViewState.Error); } else { bloodSugarService.weekDiabtectResultAverageList.forEach((element) { - _bloodWeeklyTimeSeriesSalesList.add( - WeekChartDate(x: element.dateChart, y: element.dailyAverageResult)); + bloodWeekTimeSeriesData.add(TimeSeriesSales2( + element.dateChart, + element.dailyAverageResult.toDouble(), + )); }); for (int index = 0; index < bloodSugarService.monthDiabtectResultAverageList.length; index++) { - _bloodMonthlyTimeSeriesSalesList.add(YearMonthlyChartDate( - x: index, - y: bloodSugarService - .monthDiabtectResultAverageList[index].weekAverageResult)); - var asd=""; + monthTimeSeriesData.add(TimeSeriesSales3( + index, + bloodSugarService + .monthDiabtectResultAverageList[index].weekAverageResult + .toDouble(), + )); } bloodSugarService.yearDiabtecResultAverageList.forEach((element) { - _bloodYearTimeSeriesSalesList - .add(WeekChartDate(x: element.date, y: element.monthAverageResult)); + yearTimeSeriesData.add(TimeSeriesSales2( + element.date, + element.monthAverageResult.toDouble(), + )); }); setState(ViewState.Idle); } } - List> getBloodWeeklySeries() { - return [ - new charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (WeekChartDate sales, _) => sales.x, - measureFn: (WeekChartDate sales, _) => sales.y, - data: _bloodWeeklyTimeSeriesSalesList, - ) - ]; - } - - List> - getBloodMonthlyTimeSeriesSales() { - return [ - new charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (YearMonthlyChartDate sales, _) => sales.x, - measureFn: (YearMonthlyChartDate sales, _) => sales.y, - data: _bloodMonthlyTimeSeriesSalesList, - ) - ]; - } - - List> getBloodYearTimeSeriesSales() { - return [ - new charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (WeekChartDate sales, _) => sales.x, - measureFn: (WeekChartDate sales, _) => sales.y, - data: _bloodYearTimeSeriesSalesList, - ) - ]; - } - - addDiabtecResult( + Future addDiabtecResult( {String bloodSugerDateChart, String bloodSugerResult, String diabtecUnit, @@ -102,7 +70,7 @@ class BloodSugarViewMode extends BaseViewModel { setState(ViewState.BusyLocal); await bloodSugarService.addDiabtecResult( bloodSugerDateChart: bloodSugerDateChart, - bloodSugerResult: bloodSugerResult , + bloodSugerResult: bloodSugerResult, diabtecUnit: diabtecUnit, measuredTime: measuredTime); if (bloodSugarService.hasError) { @@ -113,7 +81,54 @@ class BloodSugarViewMode extends BaseViewModel { setState(ViewState.Idle); } } - - - + + Future updateDiabtecResult( + {DateTime month, + DateTime hour, + String bloodSugerResult, + String diabtecUnit, + int measuredTime, + int lineItemNo}) async { + setState(ViewState.BusyLocal); + + await bloodSugarService.updateDiabtecResult( + bloodSugerResult: bloodSugerResult, + diabtecUnit: diabtecUnit, + hour: hour, + measuredTime: measuredTime, + lineItemNo: lineItemNo, + month: month); + if (bloodSugarService.hasError) { + error = bloodSugarService.error; + setState(ViewState.ErrorLocal); + } else { + await getBloodSugar(); + setState(ViewState.Idle); + } + } + + Future sendReportByEmail() async { + setState(ViewState.BusyLocal); + + await bloodSugarService.sendReportByEmail(); + if (bloodSugarService.hasError) { + error = bloodSugarService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future deactivateDiabeticStatus({int lineItemNo}) async { + setState(ViewState.BusyLocal); + + await bloodSugarService.deactivateDiabeticStatus(lineItemNo: lineItemNo); + if (bloodSugarService.hasError) { + error = bloodSugarService.error; + setState(ViewState.ErrorLocal); + } else { + await getBloodSugar(); + setState(ViewState.Idle); + } + } } diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index f9554d94..acbbee07 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -41,6 +41,9 @@ class MyBalanceViewModel extends BaseViewModel { double get totalAdvanceBalanceAmount => _myBalanceService.totalAdvanceBalanceAmount; + String get updatedRegisterBloodMessage => + _myBalanceService.updatedRegisterBloodMessage; + GetAllSharedRecordsByStatusResponse get getAllSharedRecordsByStatusResponse => _myBalanceService.getAllSharedRecordsByStatusResponse; @@ -74,7 +77,6 @@ class MyBalanceViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getCities() async { setState(ViewState.Busy); await _bloodDonationService.getAllCitiesOrders(); @@ -159,4 +161,17 @@ class MyBalanceViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future updateBloodGroup(List_BloodGroupDetailsModel detailsModel) async { + setState(ViewState.Busy); + await _myBalanceService.updateBloodGroup(detailsModel); + if (_myBalanceService.hasError) { + error = _myBalanceService.error; + setState(ViewState.ErrorLocal); + } else { + await _myBalanceService.addUserAgreementForBloodDonation(); + setState(ViewState.Idle); + } + + } } diff --git a/lib/core/viewModels/medical/reports_monthly_view_model.dart b/lib/core/viewModels/medical/reports_monthly_view_model.dart index 3ae196f5..adb7223e 100644 --- a/lib/core/viewModels/medical/reports_monthly_view_model.dart +++ b/lib/core/viewModels/medical/reports_monthly_view_model.dart @@ -13,11 +13,9 @@ class ReportsMonthlyViewModel extends BaseViewModel { ReportsService _reportsService = locator(); - - String get userAgreementContent => _reportsService.userAgreementContent; - getUserTermsAndConditions() async{ + getUserTermsAndConditions() async { setState(ViewState.Busy); await _reportsService.getUserTermsAndConditions(); if (_reportsService.hasError) { @@ -28,19 +26,33 @@ class ReportsMonthlyViewModel extends BaseViewModel { } } - updatePatientHealthSummaryReport({String message, bool isSummary})async{ + updatePatientHealthSummaryReport( + {String message, + bool isSummary, + bool isUpdateEmail = false, + String email}) async { setState(ViewState.BusyLocal); - await _reportsService.updatePatientHealthSummaryReport(isSummary: isSummary); + await _reportsService.updatePatientHealthSummaryReport( + isSummary: isSummary); if (_reportsService.hasError) { error = _reportsService.error; AppToast.showErrorToast(message: error); setState(ViewState.ErrorLocal); } else { - AppToast.showSuccessToast(message: message); - setState(ViewState.Idle); + if (isUpdateEmail) { + await _reportsService.updateEmail(email: email); + if (_reportsService.hasError) { + error = _reportsService.error; + AppToast.showErrorToast(message: error); + setState(ViewState.ErrorLocal); + } else { + AppToast.showSuccessToast(message: message); + setState(ViewState.Idle); + } + } else { + AppToast.showSuccessToast(message: message); + setState(ViewState.Idle); + } } } - - - } diff --git a/lib/core/viewModels/medical/weight_pressure_view_model.dart b/lib/core/viewModels/medical/weight_pressure_view_model.dart index 29095895..42db0a58 100644 --- a/lib/core/viewModels/medical/weight_pressure_view_model.dart +++ b/lib/core/viewModels/medical/weight_pressure_view_model.dart @@ -9,16 +9,13 @@ import 'package:diplomaticquarterapp/core/service/medical/BloodSugarService.dart import 'package:diplomaticquarterapp/core/service/medical/WeightPressureService.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:charts_flutter/flutter.dart' as charts; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import '../../../core/viewModels/base_view_model.dart'; -class WeightPressureViewMode extends BaseViewModel { +class WeightPressureViewModel extends BaseViewModel { WeightService weightService = locator(); - List _weightWeeklyTimeSeriesSalesList = List(); - List _weightMonthlyTimeSeriesSalesList = List(); - List _weightYearTimeSeriesSalesList = List(); - List get monthWeightMeasurementResult => weightService.monthWeightMeasurementResult; @@ -28,6 +25,10 @@ class WeightPressureViewMode extends BaseViewModel { List get yearWeightMeasurementResult => weightService.yearWeightMeasurementResult; + List weightWeekTimeSeriesData = []; + List weighMonthTimeSeriesData = []; + List weightYearTimeSeriesData = []; + Future getWeight() async { setState(ViewState.Busy); await weightService.getWeightAverage(); @@ -37,71 +38,84 @@ class WeightPressureViewMode extends BaseViewModel { setState(ViewState.Error); } else { weightService.weekWeightMeasurementResultAverage.forEach((element) { - _weightWeeklyTimeSeriesSalesList.add(WeekChartDate( - x: element.weightDate, y: element.dailyAverageResult)); + weightWeekTimeSeriesData.add(TimeSeriesSales2( + element.weightDate, + element.dailyAverageResult.toDouble(), + )); }); for (int index = 0; index < weightService.monthWeightMeasurementResultAverage.length; index++) { - _weightMonthlyTimeSeriesSalesList.add(YearMonthlyChartDate( - x: index, - y: weightService.monthWeightMeasurementResultAverage[index].weekAverageResult)); + weighMonthTimeSeriesData.add(TimeSeriesSales3( + index, + weightService + .monthWeightMeasurementResultAverage[index].weekAverageResult + .toDouble(), + )); } weightService.yearWeightMeasurementResultAverage.forEach((element) { - _weightYearTimeSeriesSalesList - .add(WeekChartDate(x: element.date, y: element.monthAverageResult)); + weightYearTimeSeriesData.add(TimeSeriesSales2( + element.date, + element.monthAverageResult.toDouble(), + )); }); setState(ViewState.Idle); } } - List> getWeightWeeklySeries() { - return [ - charts.Series( - id: 'Diastolic', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (WeekChartDate sales, _) => sales.x, - measureFn: (WeekChartDate sales, _) => sales.y, - data: _weightWeeklyTimeSeriesSalesList, - ), - ]; + addWeightResult( + {String weightDate, String weightMeasured, int weightUnit}) async { + setState(ViewState.BusyLocal); + await weightService.addWeightResult( + weightDate: weightDate, + weightMeasured: weightMeasured, + weightUnit: weightUnit, + ); + if (weightService.hasError) { + error = weightService.error; + setState(ViewState.Error); + } else { + await getWeight(); + setState(ViewState.Idle); + } } + Future sendReportByEmail() async { + setState(ViewState.BusyLocal); - List> - getWeightMonthlyTimeSeriesSales() { - return [ - charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (YearMonthlyChartDate sales, _) => sales.x, - measureFn: (YearMonthlyChartDate sales, _) => sales.y, - data: _weightMonthlyTimeSeriesSalesList, - ), - ]; + await weightService.sendReportByEmail(); + if (weightService.hasError) { + error = weightService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } } - List> getWeightYearTimeSeriesSales() { - return [ - charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (WeekChartDate sales, _) => sales.x, - measureFn: (WeekChartDate sales, _) => sales.y, - data: _weightYearTimeSeriesSalesList, - ), - ]; + updateWeightResult({int lineItemNo, int weightUnit, String weightMeasured,String weightDate}) async { + setState(ViewState.BusyLocal); + await weightService.updateWeightResult( + lineItemNo: lineItemNo, + weightMeasured: weightMeasured, + weightUnit: weightUnit, + weightDate: weightDate + ); + if (weightService.hasError) { + error = weightService.error; + setState(ViewState.Error); + } else { + await getWeight(); + setState(ViewState.Idle); + } } - addWeightResult( - {String weightDate, String weightMeasured, int weightUnit}) async { + deleteWeightResult({int lineItemNo, }) async { setState(ViewState.BusyLocal); - await weightService.addWeightResult( - weightDate: weightDate, - weightMeasured: weightMeasured, - weightUnit: weightUnit,); + await weightService.deleteWeightResult( + lineItemNo: lineItemNo, + ); if (weightService.hasError) { error = weightService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart index b7ddb528..f434db54 100644 --- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_serv import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:flutter/material.dart'; import '../../../locator.dart'; @@ -17,15 +18,12 @@ import '../base_view_model.dart'; class OrderModelViewModel extends BaseViewModel { OrderService _orderService = locator(); - - List get order => _orderService.orderList; + List get orders => _orderService.orderList; OrderDetailsService _orderDetailsService = locator(); - - List get orderDetails => _orderDetailsService.orderDetails; + List get orderListModel => _orderDetailsService.orderList; CancelOrderService _cancelOrderService = locator(); - List get cancelOrder => _cancelOrderService.cancelOrderList; @@ -52,9 +50,9 @@ class OrderModelViewModel extends BaseViewModel { } } - Future getOrderDetails(orderId) async { + Future getOrderDetails(OrderId) async { setState(ViewState.Busy); - await _orderDetailsService.getOrderDetails(orderId); + await _orderDetailsService.getOrderDetails(OrderId); if (_orderDetailsService.hasError) { error = _orderDetailsService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index 4dfc6a26..303dab9e 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -3,7 +3,11 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; +//import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; +//import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import '../../../locator.dart'; @@ -11,6 +15,8 @@ import '../../../locator.dart'; class PharmacyModuleViewModel extends BaseViewModel { PharmacyModuleService _pharmacyService = locator(); + PrescriptionService _prescriptionService = locator(); + List get bannerList => _pharmacyService.bannerItems; List get manufacturerList => _pharmacyService.manufacturerList; @@ -21,6 +27,11 @@ class PharmacyModuleViewModel extends BaseViewModel { List get lastVisitedProducts => _pharmacyService.lastVisitedProducts; + List get prescriptionsList => + _prescriptionService.prescriptionsList; + +// List get pharmacyPrescriptionsList => PharmacyProduct.pharmacyPrescriptionsList ; + Future getPharmacyHomeData() async { setState(ViewState.Busy); var data = await sharedPref.getObject(USER_PROFILE); @@ -40,6 +51,27 @@ class PharmacyModuleViewModel extends BaseViewModel { } } + Future createUser() async { + setState(ViewState.Busy); + await _pharmacyService.createUser(); + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + Future generatePharmacyToken() async { + setState(ViewState.Busy); + await _pharmacyService.generatePharmacyToken(); + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + Future getBannerList() async { setState(ViewState.Busy); await _pharmacyService.getBannerListList(); @@ -92,6 +124,17 @@ class PharmacyModuleViewModel extends BaseViewModel { } } + /////////////RecommendedProducts +// _getRecommendedProducts() async { +// await _pharmacyService.getRecommendedProducts(); +// if (_pharmacyService.hasError) { +// error = _pharmacyService.error; +// setState(ViewState.Error); +// } else { +// setState(ViewState.Idle); +// } +// } + Future checkUserIsActivated() async { if (authenticatedUserObject.isLogin) { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); @@ -105,4 +148,17 @@ class PharmacyModuleViewModel extends BaseViewModel { return false; } } + + getPrescription() async { + print("Print PRESCRIPTION url"); + setState(ViewState.Busy); + await _prescriptionService.getPrescription(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index 47a3bb11..e3a6255e 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -50,6 +50,17 @@ class ProductDetailViewModel extends BaseViewModel{ setState(ViewState.Idle); } + Future notifyMe(customerId, itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productLocationService.notifyMe(customerId, itemID); + if (_productLocationService.hasError) { + error = _productLocationService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future addToCartData(quantity, itemID) async { hasError = false; setState(ViewState.Busy); diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart index 5e1f4f9f..d26d860d 100644 --- a/lib/core/viewModels/pharmacy_categorise_view_model.dart +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -16,30 +16,22 @@ import 'base_view_model.dart'; class PharmacyCategoriseViewModel extends BaseViewModel { bool hasError = false; - PharmacyCategoriseService _pharmacyCategoriseService = - locator(); + PharmacyCategoriseService _pharmacyCategoriseService = locator(); - List get categorise => - _pharmacyCategoriseService.categoriseList; + List get categorise => _pharmacyCategoriseService.categoriseList; - List get categoriseParent => - _pharmacyCategoriseService.parentCategoriseList; + List get categoriseParent => _pharmacyCategoriseService.parentCategoriseList; - List get parentProducts => - _pharmacyCategoriseService.parentProductsList; + List get parentProducts => _pharmacyCategoriseService.parentProductsList; - List get subCategorise => - _pharmacyCategoriseService.subCategoriseList; + List get subCategorise => _pharmacyCategoriseService.subCategoriseList; - List get subProducts => - _pharmacyCategoriseService.subProductsList; + List get subProducts => _pharmacyCategoriseService.subProductsList; - List get finalProducts => - _pharmacyCategoriseService.finalProducts; + List get finalProducts => _pharmacyCategoriseService.finalProducts; List get brandsList => _pharmacyCategoriseService.brandsList; - List get searchList => - _pharmacyCategoriseService.searchList; + List get searchList => _pharmacyCategoriseService.searchList; List get scanList => _pharmacyCategoriseService.scanList; diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index baaf6b5b..2bb75305 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -32,7 +32,7 @@ class ProjectViewModel extends BaseViewModel { Locale get appLocal => _appLocale; - LocaleType get localeType => isArabic ? LocaleType.en : LocaleType.ar; + LocaleType get localeType => isArabic ? LocaleType.ar : LocaleType.en; bool get isArabic => _isArabic; diff --git a/lib/locator.dart b/lib/locator.dart index cfdad053..c5bde524 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/service/qr_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; @@ -59,12 +60,14 @@ import 'core/service/parmacyModule/order-preview-service.dart'; import 'core/service/notifications_service.dart'; import 'core/service/parmacyModule/terms-condition-service.dart'; import 'core/service/privilege_service.dart'; +import 'core/service/termsConditionsService.dart'; import 'core/service/weather_service.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'core/service/parmacyModule/parmacy_module_service.dart'; import 'core/service/offers_service.dart'; import 'core/service/pharmacy_categorise_service.dart'; +import 'core/viewModels/TermsConditionsViewModel.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; import 'core/viewModels/blooddonation/blood_details_view_model.dart'; @@ -202,8 +205,11 @@ void setupLocator() { locator.registerLazySingleton(() => CustomerAddressesService()); locator.registerLazySingleton(() => TermsConditionService()); locator.registerLazySingleton(() => CancelOrderService()); + locator.registerLazySingleton(() => PrescriptionService()); + locator.registerLazySingleton(() => PrivilegeService()); locator.registerLazySingleton(() => WeatherService()); + locator.registerLazySingleton(() => TermsConditionsService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -242,7 +248,7 @@ void setupLocator() { locator.registerFactory(() => H2OViewModel()); locator.registerFactory(() => BloodSugarViewMode()); locator.registerFactory(() => BloodPressureViewMode()); - locator.registerFactory(() => WeightPressureViewMode()); + locator.registerFactory(() => WeightPressureViewModel()); locator.registerFactory(() => EyeViewModel()); locator.registerFactory(() => ActiveMedicationsViewModel()); locator.registerFactory(() => AskDoctorViewModel()); @@ -259,7 +265,6 @@ void setupLocator() { locator.registerFactory(() => ProductDetailViewModel()); locator.registerFactory(() => WeatherViewModel()); - locator.registerFactory(() => OrderPreviewViewModel()); locator.registerFactory(() => LacumViewModel()); locator.registerFactory(() => LacumTranferViewModel()); @@ -271,11 +276,16 @@ void setupLocator() { // Offer And Packages //---------------------- - locator.registerLazySingleton(() => OffersAndPackagesServices()); // offerPackagesServices Service - locator.registerFactory(() => OfferCategoriesViewModel()); // Categories View Model - locator.registerFactory(() => OfferProductsViewModel()); // Products View Model + locator.registerLazySingleton( + () => OffersAndPackagesServices()); // offerPackagesServices Service + locator.registerFactory( + () => OfferCategoriesViewModel()); // Categories View Model + locator + .registerFactory(() => OfferProductsViewModel()); // Products View Model // Geofencing // --------------------- - locator.registerLazySingleton(() => GeofencingServices()); // Geofencing Services + locator.registerLazySingleton( + () => GeofencingServices()); // Geofencing Services + locator.registerFactory(() => TermsConditionsViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index fe129e01..e0444a32 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -100,14 +100,14 @@ class MyApp extends StatelessWidget { backgroundColor: Color.fromRGBO(255, 255, 255, 1), highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Colors.grey, + primaryColor: Color(0xff515A5D), toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, bottomSheetTheme: BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), cursorColor: Colors.grey, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( - color: Colors.grey[700], + color: Color(0xff515A5D), brightness: Brightness.light, elevation: 0.0, actionsIconTheme: IconThemeData( diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart new file mode 100644 index 00000000..f01c3bf8 --- /dev/null +++ b/lib/models/SmartWatch/HealthData.dart @@ -0,0 +1,8 @@ +class healthData { + int MedCategoryID; + int MedSubCategoryID; + String Value; + String Notes; + String MachineDate; + int TransactionsListID; +} diff --git a/lib/models/SmartWatch/YearlyStepsResModel.dart b/lib/models/SmartWatch/YearlyStepsResModel.dart new file mode 100644 index 00000000..728633d9 --- /dev/null +++ b/lib/models/SmartWatch/YearlyStepsResModel.dart @@ -0,0 +1,36 @@ +class YearlyStepsResModel { + double valueSum; + int medCategoryID; + int month; + String monthName; + int patientID; + int year; + + YearlyStepsResModel( + {this.valueSum, + this.medCategoryID, + this.month, + this.monthName, + this.patientID, + this.year}); + + YearlyStepsResModel.fromJson(Map json) { + valueSum = json['ValueSum']; + medCategoryID = json['MedCategoryID']; + month = json['Month']; + monthName = json['MonthName']; + patientID = json['PatientID']; + year = json['Year']; + } + + Map toJson() { + final Map data = new Map(); + data['ValueSum'] = this.valueSum; + data['MedCategoryID'] = this.medCategoryID; + data['Month'] = this.month; + data['MonthName'] = this.monthName; + data['PatientID'] = this.patientID; + data['Year'] = this.year; + return data; + } +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart index 45bf01b7..549f90b8 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart @@ -30,7 +30,7 @@ class _ConfirmCancelOrderDialogState extends State { contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), title: Center( child: Texts( - "Confirm", + TranslationBase.of(context).confirm, color: Colors.black, ), ), @@ -40,7 +40,7 @@ class _ConfirmCancelOrderDialogState extends State { Divider(), Center( child: Texts( - "Are you sure!! want to cancel this order", + TranslationBase.of(context).cancelOrderMsg , color: Colors.grey, ), ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart new file mode 100644 index 00000000..4e396427 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -0,0 +1,148 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:provider/provider.dart'; + +class CMCLocationPage extends StatefulWidget { + final Function(PickResult) onPick; + final double latitude; + final double longitude; + final dynamic model; + + const CMCLocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) + : super(key: key); + + @override + _CMCLocationPageState createState() => + _CMCLocationPageState(); +} + +class _CMCLocationPageState + extends State { + double latitude = 0; + double longitude = 0; + + @override + void initState() { + + latitude = widget.latitude; + longitude = widget.longitude; + super.initState(); + } + + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) {}, + builder: (_, model, widget) => AppScaffold( + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () async { + print(selectedPlace); + AddNewAddressRequestModel + addNewAddressRequestModel = + new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: + selectedPlace.formattedAddress, + address2: selectedPlace + .formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: "$latitude,$longitude", + email: "") + ]), + ); + + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer + .addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer + .addresses[0].zipPostalCode = + e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer + .addresses[0].city = + e.longName; + } + }); + + await model.addAddressInfo( + addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast( + message: "Address Added Successfully"); + } + Navigator.of(context).pop(); + }, + label: TranslationBase.of(context).addNewAddress, + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + )); + } +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index 532396cc..2a7696b7 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -3,15 +3,18 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/Comprehens import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; +import 'package:provider/provider.dart'; import 'new_cmc_step_one_page.dart'; import 'new_cmc_step_three_page.dart'; @@ -46,7 +49,7 @@ class _NewCMCPageState extends State price: widget.model.cmcAllServicesList[0].price, serviceID: widget.model.cmcAllServicesList[0].serviceID.toString(), selectedServiceName: widget.model.cmcAllServicesList[0].description, - selectedServiceNameAR: widget.model.cmcAllServicesList[0].description, + selectedServiceNameAR: widget.model.cmcAllServicesList[0].descriptionN, recordID: 1, totalPrice: widget.model.cmcAllServicesList[0].totalPrice, vAT: widget.model.cmcAllServicesList[0].vAT); @@ -85,6 +88,8 @@ class _NewCMCPageState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + void showConfirmMessage( CMCViewModel model, GetOrderDetailByOrderIDResponseModel order) { showDialog( @@ -101,7 +106,7 @@ class _NewCMCPageState extends State if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message: "Done Successfully"); + AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); await model.getCmcAllPresOrders(); } }, @@ -114,13 +119,16 @@ class _NewCMCPageState extends State height: MediaQuery.of(context).size.height * 0.8, child: Column( children: [ - Container( - margin: EdgeInsets.only(left: MediaQuery.of(context).size.width*0.05, right: MediaQuery.of(context).size.width*0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: changePageViewIndex, + if (widget.model.cmcAllOrderDetail.length == 0) + Container( + margin: EdgeInsets.only( + left: MediaQuery.of(context).size.width * 0.05, + right: MediaQuery.of(context).size.width * 0.05), + child: StepsWidget( + index: _currentIndex, + changeCurrentTab: changePageViewIndex, + ), ), - ), Expanded( child: PageView( physics: NeverScrollableScrollPhysics(), @@ -134,183 +142,192 @@ class _NewCMCPageState extends State children: [ widget.model.cmcAllOrderDetail.length != 0 ? FractionallySizedBox( - heightFactor: 0.8, widthFactor: 0.9, - child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Colors.white), + child: SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 12, - ), Container( width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + margin: EdgeInsets.only(top: 15), decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), + border: + Border.all(color: Colors.grey, width: 1), + borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - "Request ID", - bold: false, - fontSize: 13, - ), SizedBox( - height: 4, - ), - Texts( - widget.model.cmcAllOrderDetail[0].iD.toString(), - fontSize: 22, + height: 12, ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15,right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase + .of(context) + .requestID, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + widget.model.cmcAllOrderDetail[0].iD.toString(), + fontSize: 22, + ), + ], ), ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Status", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - "Pending", - fontSize: 22, + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15,right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase + .of(context) + .OrderStatus, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + + projectViewModel.isArabic ? widget.model.cmcAllOrderDetail[0] + .descriptionN : widget.model.cmcAllOrderDetail[0].description, + fontSize: 22, + ), + ], + ), ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15,right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).pickupDate, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(widget.model.cmcAllOrderDetail[0].createdOn)), + fontSize: 22, + ), + ], ), ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Pickup Date", - bold: false, - fontSize: 13, + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).serviceName, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + !projectViewModel.isArabic?widget.model.cmcAllOrderDetail[0].description + .toString() : + widget.model.cmcAllOrderDetail[0] + .descriptionN + .toString(), + fontSize: 22, + ), + ], + ), ), SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - widget.model.cmcAllOrderDetail[0] - .createdOn)), - fontSize: 22, + height: 12, ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, + Center( + child: Container( + width: MediaQuery + .of(context) + .size + .width * + 0.85, + child: SecondaryButton( + label: TranslationBase.of(context).cancel.toUpperCase(), + onTap: () { + showConfirmMessage(widget.model, + widget.model.cmcAllOrderDetail[0]); + } + , + color: Colors.red[800], + disabled: false, + textColor: Theme + .of(context) + .backgroundColor), ), ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Service Name", - bold: false, - fontSize: 13, - ), SizedBox( - height: 4, - ), - Texts( - widget.model.cmcAllOrderDetail[0].description - .toString() ?? - widget.model.cmcAllOrderDetail[0] - .descriptionN - .toString(), - fontSize: 22, + height: 22, ), ], ), ), SizedBox( - height: 12, - ), - Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: "Cancel".toUpperCase(), - onTap: () { - showConfirmMessage(widget.model, - widget.model.cmcAllOrderDetail[0]); - } - , - color: Colors.red[800], - disabled: false, - textColor: Theme - .of(context) - .backgroundColor), - ), - ), - SizedBox( - height: 12, + height: 22, ), ], ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index 02d099b4..b80d125a 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -1,11 +1,16 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class NewCMCStepOnePage extends StatefulWidget { final CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel; @@ -31,6 +36,8 @@ class _NewCMCStepOnePageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return AppScaffold( isShowAppBar: false, baseViewModel: widget.model, @@ -50,17 +57,17 @@ class _NewCMCStepOnePageState extends State { height: 20, ), Texts( - "Select Home Health Care Services", + TranslationBase.of(context).selectService, textAlign: TextAlign.center, ), Column( children: - widget.model.cmcAllServicesList.map((service) { + widget.model.cmcAllServicesList.map((service) { return Container( margin: EdgeInsets.only(top: 15), decoration: BoxDecoration( border: - Border.all(color: Colors.grey, width: 1), + Border.all(color: Colors.grey, width: 1), borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( @@ -72,50 +79,53 @@ class _NewCMCStepOnePageState extends State { activeColor: Colors.red[800], onChanged: (newValue) async { PatientERCMCInsertServicesList - patientERCMCInsertServicesList = - new PatientERCMCInsertServicesList( - price: service.price, - serviceID: service.serviceID - .toString(), - selectedServiceName: - service.description, - selectedServiceNameAR: - service.description, - recordID: 1, - totalPrice: - service.totalPrice, - vAT: service.vAT); + patientERCMCInsertServicesList = + new PatientERCMCInsertServicesList( + price: service.price, + serviceID: service.serviceID + .toString(), + selectedServiceName: + service.description, + selectedServiceNameAR: + service.descriptionN, + recordID: 1, + totalPrice: + service.totalPrice, + vAT: service.vAT); setState(() { widget .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList = [ + .patientERCMCInsertServicesList = + [ patientERCMCInsertServicesList ]; }); CMCGetItemsRequestModel - cMCGetItemsRequestModel = - new CMCGetItemsRequestModel( - checkupType: newValue); + cMCGetItemsRequestModel = + new CMCGetItemsRequestModel( + checkupType: newValue); await widget.model.getCheckupItems( cMCGetItemsRequestModel: - cMCGetItemsRequestModel); + cMCGetItemsRequestModel); }, groupValue: widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList - .length > - 0 + .cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList + .length > + 0 ? int.parse(widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList[ - 0] - .serviceID) + .cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList[ + 0] + .serviceID) : 1), Expanded( child: Padding( padding: const EdgeInsets.all(20.0), child: Texts( - service.description, + projectViewModel.isArabic ? service + .descriptionN : service + .description, fontSize: 15, ), ), @@ -137,52 +147,67 @@ class _NewCMCStepOnePageState extends State { color: Colors.white, width: double.infinity, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: widget.model.checkupItems.map((item) { - return Center( - child: FractionallySizedBox( - widthFactor: 1, - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration(color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 5, top: 5), - decoration: BoxDecoration( - border: BorderDirectional( - bottom: BorderSide( - style: BorderStyle.solid, - width: 0.5, - color: Colors.grey)), - //borderRadius: , - color: Colors.white), - child: Column( - crossAxisAlignment: + children: [ + Row( + children: [ + Container(margin: EdgeInsets.only( + right: 10, left: 10), child: Texts(TranslationBase.of(context).coveredService, fontWeight: FontWeight.bold,)) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: widget.model.checkupItems.map((item) { + return Center( + child: FractionallySizedBox( + widthFactor: 1, + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 5, top: 5), + decoration: BoxDecoration( + border: BorderDirectional( + bottom: BorderSide( + style: BorderStyle.solid, + width: 0.5, + color: Colors.grey)), + //borderRadius: , + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - item.itemName, - fontSize: 15, + children: [ + Container(margin: EdgeInsets.only( + right: 10, left: 10), + child: Texts( + item.itemName, + fontSize: 15, fontWeight: FontWeight.bold + ), + ), + ], ), - ], - ), - ), - SizedBox( - height: 12, + ), + SizedBox( + height: 12, + ), + ], ), - ], + ), ), - ), - ), - ); - }).toList()), + ); + }).toList()), + ], + ), ) ], ), @@ -197,28 +222,48 @@ class _NewCMCStepOnePageState extends State { Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( - label: "Next", - textColor: Theme.of(context).backgroundColor, - onTap: () { - if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length = null) { + label: TranslationBase + .of(context) + .next, + textColor: Theme + .of(context) + .backgroundColor, + color: Colors.grey[800], + onTap: () async { + if (widget.cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList.length != + 0 || + widget.cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList == + null) { int index = widget.model.cmcAllServicesList.length; PatientERCMCInsertServicesList - patientERCMCInsertServicesList = - new PatientERCMCInsertServicesList( - price: widget.model.cmcAllServicesList[index-1].price, - serviceID: widget.model.cmcAllServicesList[index-1].serviceID.toString(), - selectedServiceName: widget.model.cmcAllServicesList[index-1].description, - selectedServiceNameAR: widget.model.cmcAllServicesList[index-1].description, - recordID: 1, - totalPrice: widget.model.cmcAllServicesList[index-1].totalPrice, - vAT: widget.model.cmcAllServicesList[index-1].vAT); + patientERCMCInsertServicesList = + new PatientERCMCInsertServicesList( + price: widget + .model.cmcAllServicesList[index - 1].price, + serviceID: widget + .model.cmcAllServicesList[index - 1].serviceID + .toString(), + selectedServiceName: widget.model + .cmcAllServicesList[index - 1].description, + selectedServiceNameAR: widget.model + .cmcAllServicesList[index - 1].descriptionN, + recordID: 1, + totalPrice: widget + .model.cmcAllServicesList[index - 1].totalPrice, + vAT: widget.model.cmcAllServicesList[index - 1].vAT); widget.cMCInsertPresOrderRequestModel .patientERCMCInsertServicesList = [ patientERCMCInsertServicesList ]; - - widget.changePageViewIndex(1); + await widget.model.getCustomerInfo(); + if (widget.model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(); + } else { + widget.changePageViewIndex(1); + } } }, ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart index e48bb5d5..eea9853b 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart @@ -2,15 +2,16 @@ import 'dart:async'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:provider/provider.dart'; class NewCMCStepThreePage extends StatefulWidget { final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel; @@ -63,19 +64,23 @@ class _NewCMCStepThreePageState @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowDecPage: false, baseViewModel: widget.model, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( - height: 400, + height: 500, width: double.maxFinite, margin: EdgeInsets.only(left: 12, right: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts('Order Details'), + Texts( + TranslationBase.of(context).orderDetails, + fontWeight: FontWeight.bold, + ), SizedBox( height: 12, ), @@ -87,7 +92,9 @@ class _NewCMCStepThreePageState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts('Location :'), + Texts(TranslationBase + .of(context) + .orderLocation + " : ", fontWeight: FontWeight.bold,), SizedBox( height: 12, ), @@ -108,30 +115,40 @@ class _NewCMCStepThreePageState SizedBox( height: 12, ), - Texts('Selected Service :'), + Texts(TranslationBase + .of(context) + .selectedService), ...List.generate( - widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList.length, - (index) => Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - 'Service Name :', - fontSize: 12, - ), - SizedBox( - height: 5, - ), - Texts( - widget - .cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList[index] - .selectedServiceName, - fontSize: 15, - bold: true, + widget.cmcInsertPresOrderRequestModel + .patientERCMCInsertServicesList.length, + (index) => + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase + .of(context) + .serviceName, + fontSize: 12, fontWeight: FontWeight.bold, + ), + SizedBox( + height: 5, + ), + Texts( + projectViewModel.isArabic ? widget + .cmcInsertPresOrderRequestModel + .patientERCMCInsertServicesList[index] + .selectedServiceNameAR : widget + .cmcInsertPresOrderRequestModel + .patientERCMCInsertServicesList[index] + .selectedServiceName, + fontSize: 15, + bold: true, + ), + ], ), - ], - ), - ), + ), ) ], ), @@ -148,14 +165,20 @@ class _NewCMCStepThreePageState Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( - label: "Confirm", + label: TranslationBase + .of(context) + .confirm, + color: Colors.grey[800], onTap: () async { - await widget.model.insertPresPresOrder(order: widget.cmcInsertPresOrderRequestModel); + await widget.model.insertPresPresOrder( + order: widget.cmcInsertPresOrderRequestModel); if (widget.model.state != ViewState.ErrorLocal) { widget.changePageViewIndex(0); } }, - textColor: Theme.of(context).backgroundColor), + textColor: Theme + .of(context) + .backgroundColor), ), ], ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 27cddfe3..cc8ea8dd 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -1,19 +1,22 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/close_back.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; +import 'cmc_location_page.dart'; + class NewCMCStepTowPage extends StatefulWidget { final Function(PickResult) onPick; final double latitude; @@ -41,12 +44,13 @@ class _NewCMCStepTowPageState extends State { double latitude = 0; double longitude = 0; + AddressInfo _selectedAddress; + @override void initState() { if (widget.cmcInsertPresOrderRequestModel.latitude == null) { - latitude = widget.latitude; - longitude = widget.longitude; + setLatitudeAndLongitude(); } else { latitude = widget.cmcInsertPresOrderRequestModel.latitude; longitude = widget.cmcInsertPresOrderRequestModel.longitude; @@ -54,60 +58,152 @@ class _NewCMCStepTowPageState super.initState(); } + setLatitudeAndLongitude({bool isSetState = false, String latLong}) { + if (latLong == null) + latLong = widget.model.addressesList[widget.model.addressesList + .length - 1].latLong; + List latLongArr = latLong.split(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + } @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( + return AppScaffold( isShowDecPage: false, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.cmcInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.cmcInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).next, - ), + body: Stack( + children: [ + PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + + onPlacePicked: (PickResult result) { + print(result.adrAddress); + widget.changePageViewIndex(3); + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + CMCLocationPage( + latitude: latitude, + longitude: longitude, + + ), + ), + ); + }, + label: TranslationBase.of(context).addNewAddress, + ), + SizedBox(height: 10,), + SecondaryButton( + color: Colors.red + [800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.cmcInsertPresOrderRequestModel + .latitude = + selectedPlace.geometry.location.lat; + widget.cmcInsertPresOrderRequestModel + .longitude = + selectedPlace.geometry.location.lng; + }); + widget.changePageViewIndex(3); + }, + label: TranslationBase.of(context).confirm, ), - ); + ], + ) + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + Container( + child: InkWell( + onTap: () => + confirmSelectLocationDialog(widget.model.addressesList), + child: Container( + padding: EdgeInsets.all(10), + width: double.infinity, + // height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Texts(getAddressName(), fontSize: 14,),), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + height: 56, width: double.infinity, color: Theme + .of(context) + .scaffoldBackgroundColor, + + ) + ], + ), + ); + + + } + + + void confirmSelectLocationDialog(List addresses) { + showDialog( + context: context, + child: SelectLocationDialog( + addresses: addresses, + selectedAddress: _selectedAddress + , + onValueSelected: (value) { + setLatitudeAndLongitude(latLong: value.latLong); + setState(() { + _selectedAddress = value; + }); }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: true, ), ); } + + String getAddressName() { + if (_selectedAddress != null) + return _selectedAddress.address1; + else + return TranslationBase.of(context).selectAddress; + } } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart deleted file mode 100644 index e8e9eccc..00000000 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'cmc_page.dart'; - -class CMCIndexPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).serviceInformation, - body: SingleChildScrollView( - padding: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "CMC", - fontWeight: FontWeight.normal, - fontSize: 25, - color: Color(0xff60686b), - ), - SizedBox( - height: 12, - ), - Texts( - "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.", - fontWeight: FontWeight.normal, - fontSize: 17, - ), - SizedBox( - height: 22, - ), - Center( - child: Image.asset( - 'assets/images/AlHabibMedicalService/Wifi-AR.png')), - SizedBox( - height: 77, - ), - ], - )), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () => Navigator.push( - context, - FadePage( - page: CMCPage(), - ), - ), - label: "CMC", - textColor: Theme.of(context).backgroundColor), - ), - ], - ), - )); - } -} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart index 385d0da3..b745e0c9 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -35,12 +36,15 @@ class _CMCPageState extends State @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model){ - model.getCmcAllPresOrders(); + onModelReady: (model) async{ + await model.getCmcAllPresOrders(); + }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).homeHealthCare, + description:TranslationBase.of(context).infoCMC, + imagesInfo: [ImagesInfo(imageAr: 'assets/images/AlHabibMedicalService/Wifi-AR.png',imageEn: 'assets/images/AlHabibMedicalService/Wifi-EN.png', isAsset: true)], + appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -78,7 +82,7 @@ class _CMCPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: @@ -88,7 +92,8 @@ class _CMCPageState extends State Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts("CMC Service"), + child: Texts(TranslationBase.of(context) + .comprehensiveMedicalCheckup), ), ), Container( diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index 6c915a4c..ec686e70 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -2,13 +2,16 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'Dialog/confirm_cancel_order_dialog.dart'; @@ -19,6 +22,9 @@ class OrdersLogDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { + + ProjectViewModel projectViewModel = Provider.of(context); + void showConfirmMessage( CMCViewModel model, GetHHCAllPresOrdersResponseModel order) { showDialog( @@ -35,7 +41,7 @@ class OrdersLogDetailsPage extends StatelessWidget { if(model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message: "Done Successfully"); + AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); await model.getCmcAllPresOrders(); } }, @@ -78,7 +84,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + left: 15, bottom: 15, top: 15,right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -89,11 +95,12 @@ class OrdersLogDetailsPage extends StatelessWidget { // borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "Request ID", + TranslationBase + .of(context) + .requestID, bold: false, fontSize: 13, ), @@ -110,7 +117,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + left: 15, bottom: 15, top: 15,right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -121,11 +128,12 @@ class OrdersLogDetailsPage extends StatelessWidget { // borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "Status", + TranslationBase + .of(context) + .OrderStatus, bold: false, fontSize: 13, ), @@ -133,7 +141,9 @@ class OrdersLogDetailsPage extends StatelessWidget { height: 4, ), Texts( - order.description, + + projectViewModel.isArabic ? order + .descriptionN : order.description, fontSize: 22, ), ], @@ -142,7 +152,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + left: 15, bottom: 15, top: 15,right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -153,11 +163,10 @@ class OrdersLogDetailsPage extends StatelessWidget { // borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "Pickup Date", + TranslationBase.of(context).pickupDate, bold: false, fontSize: 13, ), @@ -166,8 +175,7 @@ class OrdersLogDetailsPage extends StatelessWidget { ), Texts( DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - order.createdOn)), + DateUtil.convertStringToDate(order.createdOn)), fontSize: 22, ), ], @@ -176,7 +184,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + left: 15, bottom: 15, top: 15,right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -191,7 +199,7 @@ class OrdersLogDetailsPage extends StatelessWidget { CrossAxisAlignment.start, children: [ Texts( - "Location", + TranslationBase.of(context).orderLocation, bold: false, fontSize: 13, ), @@ -199,10 +207,11 @@ class OrdersLogDetailsPage extends StatelessWidget { height: 4, ), Texts( - order.nearestProjectDescription - .toString() ?? - order.nearestProjectDescriptionN - .toString(), + !projectViewModel.isArabic?order. + projectDescription.toString() : + order + .projectDescriptionN + .toString(), fontSize: 22, ), ], @@ -212,32 +221,33 @@ class OrdersLogDetailsPage extends StatelessWidget { height: 12, ), if (order.status == 1 ||order.status == 2 ) - Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: "Cancel".toUpperCase(), - onTap: () { - showConfirmMessage(model, order); - } - , - color: Colors.red[800], - disabled: false, - textColor: Theme - .of(context) - .backgroundColor), - ), + Center( + child: Container( + width: MediaQuery + .of(context) + .size + .width * + 0.85, + child: SecondaryButton( + label: TranslationBase.of(context).cancel.toUpperCase(), + onTap: () { + showConfirmMessage(model, + order); + } + , + color: Colors.red[800], + disabled: false, + textColor: Theme + .of(context) + .backgroundColor), ), + ), SizedBox( - height: 12, - ), - ], - ), - ); + height: 22, + ), + ], + ), + ); }).toList()) ], ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart index 9f836860..a0583434 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart @@ -78,7 +78,7 @@ class _EReferralPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart index 17be8edd..bfab0324 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart @@ -29,7 +29,7 @@ class _ConfirmCancelOrderDialogState extends State { contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), title: Center( child: Texts( - "Confirm", + TranslationBase.of(context).confirm, color: Colors.black, ), ), @@ -39,7 +39,7 @@ class _ConfirmCancelOrderDialogState extends State { Divider(), Center( child: Texts( - "Are you sure!! want to cancel this order", + TranslationBase.of(context).cancelOrderMsg , color: Colors.grey, ), ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart new file mode 100644 index 00000000..4bf3a762 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -0,0 +1,146 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:provider/provider.dart'; + +class LocationPage extends StatefulWidget { + final Function(PickResult) onPick; + final double latitude; + final double longitude; + final dynamic model; + + const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) + : super(key: key); + + @override + _LocationPageState createState() => + _LocationPageState(); +} + +class _LocationPageState + extends State { + double latitude = 0; + double longitude = 0; + + @override + void initState() { + + latitude = widget.latitude; + longitude = widget.longitude; + super.initState(); + } + + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) {}, + builder: (_, model, widget) => AppScaffold( + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () async { + AddNewAddressRequestModel + addNewAddressRequestModel = + new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: + selectedPlace.formattedAddress, + address2: selectedPlace + .formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: "$latitude,$longitude", + email: "") + ]), + ); + + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer + .addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer + .addresses[0].zipPostalCode = + e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer + .addresses[0].city = + e.longName; + } + }); + + await model.addAddressInfo( + addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast( + message: "Address Added Successfully"); + } + Navigator.of(context).pop(); + }, + label: TranslationBase.of(context).addNewAddress, + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + )); + } +} diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index 1dbee1b5..447ba177 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -2,15 +2,16 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:provider/provider.dart'; class NewHomeHealthCareStepOnePage extends StatefulWidget { final PatientERInsertPresOrderRequestModel @@ -45,6 +46,8 @@ class _NewHomeHealthCareStepOnePageState extends State { double latitude = 0; double longitude = 0; + AddressInfo _selectedAddress; @override void initState() { if (widget.patientERInsertPresOrderRequestModel.latitude == null) { - latitude = widget.latitude; - longitude = widget.longitude; + setLatitudeAndLongitude(); } else { latitude = widget.patientERInsertPresOrderRequestModel.latitude; longitude = widget.patientERInsertPresOrderRequestModel.longitude; } + super.initState(); } + setLatitudeAndLongitude({bool isSetState = false, String latLong}) { + if (latLong == null) + latLong = widget.model.addressesList[widget.model.addressesList + .length - 1].latLong; + List latLongArr = latLong.split(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowDecPage: false, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.patientERInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.patientERInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).next, - ), - ), - ); + body: Stack( + children: [ + PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + + onPlacePicked: (PickResult result) { + print(result.adrAddress); + widget.changePageViewIndex(3); + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + LocationPage( + latitude: latitude, + longitude: longitude, + ), + ), + ); + }, + label: TranslationBase.of(context).addNewAddress, + ), + SizedBox(height: 10,), + SecondaryButton( + color: Colors.red[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientERInsertPresOrderRequestModel + .latitude = + selectedPlace.geometry.location.lat; + widget.patientERInsertPresOrderRequestModel + .longitude = + selectedPlace.geometry.location.lng; + }); + widget.changePageViewIndex(3); + }, + label: TranslationBase.of(context).confirm, + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + Container( + child: InkWell( + onTap: () => + confirmSelectLocationDialog(widget.model.addressesList), + child: Container( + padding: EdgeInsets.all(10), + width: double.infinity, + // height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Texts(getAddressName(), fontSize: 14,),), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + height: 56, width: double.infinity, color: Theme + .of(context) + .scaffoldBackgroundColor, + + ) + ], + ), + ); + } + + + void confirmSelectLocationDialog(List addresses) { + showDialog( + context: context, + child: SelectLocationDialog( + addresses: addresses, + selectedAddress: _selectedAddress + , + onValueSelected: (value) { + setLatitudeAndLongitude(latLong: value.latLong); + setState(() { + _selectedAddress = value; + }); }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: true, ), ); } + + String getAddressName() { + if (_selectedAddress != null) + return _selectedAddress.address1; + else + return TranslationBase.of(context).selectAddress; + } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index 87a33c6d..d9bf67d8 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -3,16 +3,19 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; +import 'package:provider/provider.dart'; import '../StepsWidget.dart'; import 'new_Home_health_care_step_one_page.dart'; @@ -84,7 +87,7 @@ class _NewHomeHealthCarePageState extends State if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message: "Done Successfully"); + AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); await model.getHHCAllPresOrders(); // await model.getHHCAllServices(); } @@ -92,6 +95,8 @@ class _NewHomeHealthCarePageState extends State )); } + ProjectViewModel projectViewModel = Provider.of(context); + return Scaffold( body: SafeArea( child: SingleChildScrollView( @@ -99,7 +104,6 @@ class _NewHomeHealthCarePageState extends State height: MediaQuery.of(context).size.height * 0.8, child: Column( children: [ - Container( margin: EdgeInsets.only(left: MediaQuery.of(context).size.width*0.05, right: MediaQuery.of(context).size.width*0.05), child: StepsWidget( @@ -138,7 +142,7 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + left: 15, bottom: 15, top: 15,right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -152,7 +156,9 @@ class _NewHomeHealthCarePageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "Request ID", + TranslationBase + .of(context) + .requestID, bold: false, fontSize: 13, ), @@ -169,7 +175,7 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + left: 15, bottom: 15, top: 15,right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -183,7 +189,9 @@ class _NewHomeHealthCarePageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "Status", + TranslationBase + .of(context) + .OrderStatus, bold: false, fontSize: 13, ), @@ -191,7 +199,11 @@ class _NewHomeHealthCarePageState extends State height: 4, ), Texts( - widget.model.pendingOrder.description, + + projectViewModel.isArabic ? widget + .model.pendingOrder + .descriptionN : widget.model + .pendingOrder.description, fontSize: 22, ), ], @@ -200,7 +212,7 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + left: 15, bottom: 15, top: 15,right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -214,7 +226,7 @@ class _NewHomeHealthCarePageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "Pickup Date", + TranslationBase.of(context).pickupDate, bold: false, fontSize: 13, ), @@ -235,7 +247,7 @@ class _NewHomeHealthCarePageState extends State (index) => Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), + left: 15, bottom: 15, top: 15,right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -250,7 +262,9 @@ class _NewHomeHealthCarePageState extends State CrossAxisAlignment.start, children: [ Texts( - "Service Name", + TranslationBase + .of(context) + .serviceName, bold: false, fontSize: 13, ), @@ -258,7 +272,12 @@ class _NewHomeHealthCarePageState extends State height: 4, ), Texts( - widget.model.hhcAllOrderDetail[index] + projectViewModel.isArabic + ? widget.model + .hhcAllOrderDetail[index] + .descriptionN + : widget.model + .hhcAllOrderDetail[index] .description, fontSize: 22, bold: true, @@ -275,7 +294,7 @@ class _NewHomeHealthCarePageState extends State width: MediaQuery.of(context).size.width * 0.85, child: SecondaryButton( - label: "Cancel".toUpperCase(), + label: TranslationBase.of(context).cancel.toUpperCase(), onTap: () { showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart index 8f4821f6..3180cf18 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart @@ -42,6 +42,7 @@ class _HomeHealthCarePageState extends State }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, + description: TranslationBase.of(context).HHCNotAuthMsg, appBarTitle: TranslationBase.of(context).homeHealthCare, body: Scaffold( extendBodyBehindAppBar: true, @@ -80,7 +81,7 @@ class _HomeHealthCarePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index 0cfedb41..f0ca5fe4 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -2,13 +2,16 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'Dialog/confirm_cancel_order_dialog.dart'; @@ -19,6 +22,8 @@ class OrdersLogDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + void showConfirmMessage( HomeHealthCareViewModel model, GetHHCAllPresOrdersResponseModel order) { showDialog( @@ -29,212 +34,219 @@ class OrdersLogDetailsPage extends StatelessWidget { UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel( presOrderID: order.iD, - rejectionReason: "", - presOrderStatus: 4, editedBy: 3); + rejectionReason: "", + presOrderStatus: 4, editedBy: 3); await model.updateHHCPresOrder(updatePresOrderRequestModel); if(model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); + Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message: "Done Successfully"); + AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); await model.getHHCAllPresOrders(); - // await model.getHHCAllServices(); + // await model.getHHCAllServices(); } }, )); } return AppScaffold( - isShowAppBar: false, - baseViewModel: model, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 50, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: model.hhcAllPresOrders.map((order) { - return Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Request ID", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - order.iD.toString(), - fontSize: 22, + isShowAppBar: false, + baseViewModel: model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.94, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 50, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: model.hhcAllPresOrders.map((order) { + return Container( + width: double.infinity, + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + border: + Border.all(color: Colors.grey, width: 1), + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15, right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, ), - ], - ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase + .of(context) + .requestID, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + order.iD.toString(), + fontSize: 22, + ), + ], ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Status", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - order.description, - fontSize: 22, + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15, right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, ), - ], - ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase + .of(context) + .OrderStatus, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + + projectViewModel.isArabic ? order.descriptionN : order.description, + fontSize: 22, + ), + ], ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Pickup Date", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - order.createdOn)), - fontSize: 22, + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15, right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, ), - ], - ), + ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase + .of(context) + .pickupDate, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(order.createdOn)), + fontSize: 22, + ), + ], ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "Location", - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - order.nearestProjectDescription - .toString() ?? - order.nearestProjectDescriptionN - .toString(), - fontSize: 22, + ), + + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15, right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, ), - ], - ), - ), - SizedBox( - height: 12, - ), - if (order.status == 1 ||order.status == 2 ) - Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: "Cancel".toUpperCase(), - onTap: () { - showConfirmMessage(model, order); - } - , - color: Colors.red[800], - disabled: false, - textColor: Theme - .of(context) - .backgroundColor), ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).orderLocation, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + !projectViewModel.isArabic ?order.nearestProjectDescription + .toString() : + order.nearestProjectDescriptionN + .toString(), + fontSize: 22, + ), + ], + ), + ), + SizedBox( + height: 12, + ), + if (order.status == 1 ||order.status == 2 ) + Center( + child: Container( + width: MediaQuery + .of(context) + .size + .width * + 0.85, + child: SecondaryButton( + label: "Cancel".toUpperCase(), + onTap: () { + showConfirmMessage(model, order); + } + , + color: Colors.red[800], + disabled: false, + textColor: Theme + .of(context) + .backgroundColor), ), - SizedBox( - height: 12, + ), + SizedBox( + height: 12, ), ], ), diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 1359ab8d..d81fe78f 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -37,6 +37,8 @@ import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'h2o/h2o_page.dart'; + class AllHabibMedicalService extends StatefulWidget { //TODO final Function goToMyProfile; @@ -56,12 +58,8 @@ class _AllHabibMedicalServiceState extends State { @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance.addPostFrameCallback((_) => { - Geolocator.getLastKnownPosition() - .then((value) => setLocation(value)) - }); + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => {Geolocator.getLastKnownPosition().then((value) => setLocation(value))}); }); super.initState(); } @@ -100,8 +98,7 @@ class _AllHabibMedicalServiceState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context) - .healthWeatherIndicators, + TranslationBase.of(context).healthWeatherIndicators, color: Colors.white, fontWeight: FontWeight.w600, ), @@ -134,11 +131,7 @@ class _AllHabibMedicalServiceState extends State { width: 60, height: 60, ), - Directionality( - textDirection: TextDirection.ltr, - child: AppText(weather, - fontSize: 22, - color: Colors.white)) + Directionality(textDirection: TextDirection.ltr, child: AppText(weather, fontSize: 22, color: Colors.white)) ], ), Texts( @@ -158,8 +151,7 @@ class _AllHabibMedicalServiceState extends State { Navigator.pop(context); widget.goToMyProfile(); }, - imageLocation: - 'assets/images/new-design/my_file_bottom_bar.png', + imageLocation: 'assets/images/new-design/my_file_bottom_bar.png', title: TranslationBase.of(context).myMedicalFile, ), ServicesContainer( @@ -181,8 +173,7 @@ class _AllHabibMedicalServiceState extends State { ), ), ), - imageLocation: - 'assets/images/new-design/booking_icon_active.png', + imageLocation: 'assets/images/new-design/booking_icon_active.png', title: TranslationBase.of(context).bookAppo, ), ServicesContainer( @@ -192,8 +183,7 @@ class _AllHabibMedicalServiceState extends State { page: PaymentService(), ), ), - imageLocation: - 'assets/images/al-habib_online_payment_service_icon.png', + imageLocation: 'assets/images/al-habib_online_payment_service_icon.png', title: TranslationBase.of(context).onlinePaymentService, ), ServicesContainer( @@ -201,9 +191,8 @@ class _AllHabibMedicalServiceState extends State { context, FadePage(), ), - imageLocation: - 'assets/images/al-habib_online_payment_service_icon.png', - title: 'Covid-19- Drive-Thru Test', + imageLocation: 'assets/images/al-habib_online_payment_service_icon.png', + title: TranslationBase.of(context).covid19_driveThrueTest, ), ServicesContainer( onTap: () { @@ -227,7 +216,7 @@ class _AllHabibMedicalServiceState extends State { ), ), imageLocation: 'assets/images/pharmacy_logo.png', - title: 'Pharmacy'), + title: TranslationBase.of(context).pharmacy), ServicesContainer( onTap: () => Navigator.push( context, @@ -235,20 +224,16 @@ class _AllHabibMedicalServiceState extends State { page: InsuranceUpdate(), ), ), - imageLocation: - 'assets/images/medical/insurance_card_icon.png', + imageLocation: 'assets/images/medical/insurance_card_icon.png', title: TranslationBase.of(context).updateInsurance, ), ServicesContainer( onTap: () => Navigator.push( context, - FadePage( - page: authUser.patientID == null - ? EReferralIndexPage() - : EReferralPage()), + FadePage(page: authUser.patientID == null ? EReferralIndexPage() : EReferralPage()), ), imageLocation: 'assets/images/ereferral_service_icon.png', - title: 'E-Referral', + title: TranslationBase.of(context).ereferral, ), ServicesContainer( onTap: () => Navigator.push( @@ -257,20 +242,18 @@ class _AllHabibMedicalServiceState extends State { page: MyFamily(), ), ), - imageLocation: - 'assets/images/new-design/family_menu_icon_red.png', - title: 'My Family', + imageLocation: 'assets/images/new-design/family_menu_icon_red.png', + title: TranslationBase.of(context).myFamily, ), - if(projectViewModel.havePrivilege(35)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(page: ChildVaccinesPage()), + if (projectViewModel.havePrivilege(35)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: ChildVaccinesPage()), + ), + imageLocation: 'assets/images/new-design/children_vaccines_icon.png', + title: TranslationBase.of(context).childVaccine, ), - imageLocation: - 'assets/images/new-design/children_vaccines_icon.png', - title: 'Child Vaccines', - ), ServicesContainer( onTap: () => Navigator.push( context, @@ -278,27 +261,26 @@ class _AllHabibMedicalServiceState extends State { page: ToDo(isShowAppBar: true), ), ), - imageLocation: - 'assets/images/new-design/upcoming_icon_bottom_bar.png', + imageLocation: 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), - if(projectViewModel.havePrivilege(42)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(page: SymptomInfo()), - ), - imageLocation: 'assets/images/new-design/body_icon.png', - title: 'Symptom Checker'), - if(projectViewModel.havePrivilege(36)) + if (projectViewModel.havePrivilege(42)) ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(page: BloodDonationPage()), + onTap: () => Navigator.push( + context, + FadePage(page: SymptomInfo()), + ), + imageLocation: 'assets/images/new-design/body_icon.png', + title: TranslationBase.of(context).symptomCheckerTitle), + if (projectViewModel.havePrivilege(36)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: BloodDonationPage()), + ), + imageLocation: 'assets/images/new-design/blood_icon.png', + title: TranslationBase.of(context).bloodD, ), - imageLocation: 'assets/images/new-design/blood_icon.png', - title: 'Blood Donation', - ), ServicesContainer( onTap: () => Navigator.push( context, @@ -306,9 +288,8 @@ class _AllHabibMedicalServiceState extends State { page: (HealthCalculators()), ), ), - imageLocation: - 'assets/images/new-design/health_calculator_icon.png', - title: 'Health Calculators', + imageLocation: 'assets/images/new-design/health_calculator_icon.png', + title: TranslationBase.of(context).calculators, ), ServicesContainer( onTap: () => Navigator.push( @@ -317,30 +298,30 @@ class _AllHabibMedicalServiceState extends State { page: HealthConverter(), ), ), - imageLocation: - 'assets/images/new-design/health_convertor_icon.png', - title: 'Health Converter', + imageLocation: 'assets/images/new-design/health_convertor_icon.png', + title: TranslationBase.of(context).converters, ), - if(projectViewModel.havePrivilege(38)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage( - page: H2OPageIndexPage(), - ), + if (projectViewModel.havePrivilege(38)) + ServicesContainer( + onTap: () => Navigator.push(context, FadePage(page: H2OPage())), + // Navigator.push( + // context, + // FadePage( + // page: H2OPageIndexPage(), + // ), + // ), + imageLocation: 'assets/images/new-design/water_icon.png', + title: TranslationBase.of(context).h2o, ), - imageLocation: 'assets/images/new-design/water_icon.png', - title: 'H2O', - ), - if(projectViewModel.havePrivilege(41)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(), + if (projectViewModel.havePrivilege(41)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(), + ), + imageLocation: 'assets/images/new-design/smartwatch_icon.png', + title: TranslationBase.of(context).smartWatches, ), - imageLocation: 'assets/images/new-design/smartwatch_icon.png', - title: TranslationBase.of(context).smartWatches, - ), ServicesContainer( onTap: () => Navigator.push( context, @@ -348,15 +329,12 @@ class _AllHabibMedicalServiceState extends State { page: ParkingPage(), ), ), - imageLocation: - 'assets/images/new-design/parking_system_icon.png', + imageLocation: 'assets/images/new-design/parking_system_icon.png', title: TranslationBase.of(context).parking, ), ServicesContainer( - onTap: () => launch( - "https://hmgwebservices.com/vt_mobile/html/index.html"), - imageLocation: - 'assets/images/new-design/virtual_tour_icon.png', + onTap: () => launch("https://hmgwebservices.com/vt_mobile/html/index.html"), + imageLocation: 'assets/images/new-design/virtual_tour_icon.png', title: TranslationBase.of(context).vTour, ), ServicesContainer( @@ -364,13 +342,11 @@ class _AllHabibMedicalServiceState extends State { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => MyWebView( title: "HMG News", - selectedUrl: - "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", ))); }, - imageLocation: - 'assets/images/new-design/twitter_dashboard_icon.png', - title: 'Latest News', + imageLocation: 'assets/images/new-design/twitter_dashboard_icon.png', + title: TranslationBase.of(context).latestNews, ), ServicesContainer( onTap: () => Navigator.push( @@ -392,8 +368,7 @@ class _AllHabibMedicalServiceState extends State { getAuthUser() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); @@ -407,8 +382,7 @@ class _AllHabibMedicalServiceState extends State { }); } else { setState(() { - weather = - data != null ? data['Temperature'].toString() + '\u2103' : '--'; + weather = data != null ? data['Temperature'].toString() + '\u2103' : '--'; }); } } diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart index 90386827..1558b8c7 100644 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart +++ b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart @@ -12,9 +12,7 @@ class ConfirmAddAmountDialog extends StatefulWidget { final String unit; final H2OViewModel model; - - ConfirmAddAmountDialog( - {Key key, this.model,this.amount,this.unit ="ml"}); + ConfirmAddAmountDialog({Key key, this.model, this.amount, this.unit = "ml"}); @override _ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState(); @@ -29,10 +27,12 @@ class _ConfirmAddAmountDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), + contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 8.0), + titlePadding: EdgeInsets.fromLTRB(24.0, 16.0, 24.0, 8.0), title: Center( child: Texts( - "Confirm", + TranslationBase.of(context).confirm, + textAlign: TextAlign.center, color: Colors.black, ), ), @@ -42,12 +42,13 @@ class _ConfirmAddAmountDialogState extends State { Divider(), Center( child: Texts( - "Are you sure you want to Add ${widget.amount} ${widget.unit} ?", + "${TranslationBase.of(context).areyousure} ${widget.amount} ${widget.unit} ?", + textAlign: TextAlign.center, color: Colors.grey, ), ), SizedBox( - height: 5.0, + height: 16.0, ), Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -79,8 +80,8 @@ class _ConfirmAddAmountDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () async{ - InsertUserActivityRequestModel insertUserActivityRequestModel= InsertUserActivityRequestModel(quantityIntake:widget.amount ); + onTap: () async { + InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: widget.amount); await widget.model.insertUserActivity(insertUserActivityRequestModel); Navigator.pop(context); }, @@ -88,20 +89,17 @@ class _ConfirmAddAmountDialogState extends State { padding: const EdgeInsets.all(8.0), child: Center( child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + TranslationBase.of(context).ok.toUpperCase(), + fontWeight: FontWeight.w400, + )), ), ), ), ], - ) + ), ], ) ], ); } } - - - diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart index d70aec4e..2df90419 100644 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart +++ b/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart @@ -1,3 +1,5 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; @@ -5,25 +7,32 @@ import 'package:flutter/material.dart'; // ignore: must_be_immutable class SelectAmountDialog extends StatefulWidget { - List searchAmount = [ - AmountModel(name: "l",nameAr:"لتر",value: 1), - AmountModel(name: "ml",nameAr:"مم لتر",value: 2), - ]; final Function(AmountModel) onValueSelected; AmountModel selectedAmount; - SelectAmountDialog( - {Key key, this.onValueSelected, this.selectedAmount}); + SelectAmountDialog({Key key, this.onValueSelected, this.selectedAmount}); @override _SelectAmountDialogState createState() => _SelectAmountDialogState(); } class _SelectAmountDialogState extends State { + List searchAmount = [ + AmountModel(name: "l", nameAr: "لتر", value: 1), + AmountModel(name: "ml", nameAr: "مم لتر", value: 2), + ]; @override void initState() { super.initState(); - widget.selectedAmount = widget.selectedAmount ?? widget.searchAmount[0]; + widget.selectedAmount = widget.selectedAmount ?? searchAmount[0]; + getLanguage(); + } + + String languageID = "en"; + + void getLanguage() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + setState(() {}); } @override @@ -32,11 +41,14 @@ class _SelectAmountDialogState extends State { children: [ Column( children: [ - Texts("Select the preferred unit", fontSize: 20,), + Texts( + TranslationBase.of(context).preferredunit, + fontSize: 20, + ), Divider(), ...List.generate( - widget.searchAmount.length, - (index) => Column( + searchAmount.length, + (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( @@ -49,13 +61,13 @@ class _SelectAmountDialogState extends State { child: InkWell( onTap: () { setState(() { - widget.selectedAmount = widget.searchAmount[index]; + widget.selectedAmount = searchAmount[index]; }); }, child: ListTile( - title: Text(widget.searchAmount[index].name), + title: Text(languageID == "ar" ? searchAmount[index].nameAr : searchAmount[index].name), leading: Radio( - value: widget.searchAmount[index], + value: searchAmount[index], groupValue: widget.selectedAmount, activeColor: Colors.red[800], onChanged: (value) { @@ -116,9 +128,9 @@ class _SelectAmountDialogState extends State { padding: const EdgeInsets.all(8.0), child: Center( child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), ), ), ), @@ -130,6 +142,7 @@ class _SelectAmountDialogState extends State { ); } } + class AmountModel { String name; String nameAr; @@ -151,7 +164,3 @@ class AmountModel { return data; } } - - - - diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/setting_page_radio_button_list_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/setting_page_radio_button_list_dialog.dart new file mode 100644 index 00000000..580207d8 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/Dialog/setting_page_radio_button_list_dialog.dart @@ -0,0 +1,101 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +class CommonRadioButtonDialog extends StatefulWidget { + final List list; + final String title; + final int selectedIndex; + final Function(int) onSelect; + CommonRadioButtonDialog({Key key, this.title = "", this.selectedIndex = 0, this.list, this.onSelect}) : super(key: key); + + @override + _CommonRadioButtonDialogState createState() { + return _CommonRadioButtonDialogState(); + } +} + +class _CommonRadioButtonDialogState extends State { + int _selectedIndex = 0; + + @override + void initState() { + super.initState(); + _selectedIndex = widget.selectedIndex; + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4), + ), + elevation: 0, + backgroundColor: Colors.white, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + height: widget.title == "" ? 24 : 50, + alignment: Alignment.center, + child: Text( + widget.title, + style: TextStyle(color: Colors.black87, fontSize: 18, fontWeight: FontWeight.w500), + ), + ), + Divider(height: 1, color: Colors.black38), + ListView.builder( + shrinkWrap: true, + padding: EdgeInsets.only(top: 4, bottom: 4), + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + return RadioListTile( + value: index, + dense: true, + activeColor: Colors.black54, + groupValue: _selectedIndex, + onChanged: (_index) => setState(() => _selectedIndex = _index), + title: Text( + widget.list[index], + style: TextStyle(fontWeight: FontWeight.w500), + ), + ); + }, + itemCount: widget.list?.length ?? 0, + ), + Divider(height: 1, color: Colors.black38), + Container( + height: 50, + alignment: Alignment.center, + child: Row( + children: [ + Expanded( + child: FlatButton( + child: Text( + TranslationBase.of(context).cancel, + style: TextStyle(color: Colors.redAccent, fontSize: 16, fontWeight: FontWeight.w500), + ), + onPressed: () => Navigator.pop(context), + ), + ), + Expanded( + child: FlatButton( + child: Text( + TranslationBase.of(context).ok, + style: TextStyle(color: Colors.black87, fontSize: 16, fontWeight: FontWeight.w500), + ), + onPressed: () => widget.onSelect(_selectedIndex), + ), + ) + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart b/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart index 036ed186..2b22a100 100644 --- a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart +++ b/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -36,7 +37,7 @@ class _AddCustomAmountState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: "Enter amount", + appBarTitle:TranslationBase.of(context).customLabel, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( @@ -51,7 +52,7 @@ class _AddCustomAmountState extends State { height: 12, ), NewTextFields( - hintText: "Enter the amount of water:", + hintText: TranslationBase.of(context).h2oAmountOfWater, // type: "Number", controller: _nameTextController, ), @@ -81,7 +82,7 @@ class _AddCustomAmountState extends State { ), SecondaryButton( textColor: Colors.white, - label: "OK", + label: TranslationBase.of(context).ok, onTap: () async { Navigator.of(context).pop(); showConfirmMessage (int.parse(_nameTextController.text), widget.model); @@ -120,7 +121,7 @@ void confirmAmountTypeDialog() { if (selectedAmount != null) return selectedAmount.name; else - return "Select unit"; + return TranslationBase.of(context).selectUnit; } diff --git a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart new file mode 100644 index 00000000..4295558a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart @@ -0,0 +1,463 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/painting.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; + +import 'Dialog/setting_page_radio_button_list_dialog.dart'; + +class H2oSetting extends StatefulWidget { + final UserDetailModel userDetailModel; + final H2OViewModel viewModel; + H2oSetting({Key key, this.userDetailModel, this.viewModel}) : super(key: key); + + @override + _H2oSettingState createState() { + return _H2oSettingState(); + } +} + +class _H2oSettingState extends State { + TextEditingController _nameController = TextEditingController(); + TextEditingController _heightController = TextEditingController(); + TextEditingController _weightController = TextEditingController(); + bool _isUnitML = false; + bool _isGenderMale = false; + bool _isHeightCM = false; + bool _isWeightKG = false; + double _heightValue = 1; + double _weightValue = 1; + + List _activityLevelListEng = []; + List _remindedTimeListEng = []; + int _selectedActiveLevel = 1; + int _selectedRemindedTime = 0; + DateTime _dobDate = DateTime.now(); + DateTime _tempDate = DateTime.now(); + + UserDetailModel _userDetailModel; + + @override + void initState() { + super.initState(); + _userDetailModel = widget.userDetailModel; + _heightValue = _userDetailModel.height; + _weightValue = _userDetailModel.weight; + _heightController.text = _heightValue.toStringAsFixed(0); + _weightController.text = _weightValue.toStringAsFixed(0); + _nameController.text = _userDetailModel.firstName; + _isWeightKG = _userDetailModel.isWeightInKG; + _isHeightCM = _userDetailModel.isHeightInCM; + _isGenderMale = _userDetailModel.gender == "M" ? true : false; + _dobDate = DateUtil.convertStringToDate(_userDetailModel.dOB); + _selectedActiveLevel = _userDetailModel.activityID ?? 1; + } + + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + super.didChangeDependencies(); + + _activityLevelListEng = [ + TranslationBase.of(context).notActive, + TranslationBase.of(context).lightActive, + TranslationBase.of(context).modActive, + TranslationBase.of(context).active + ]; + + _remindedTimeListEng = [ + "1 ${TranslationBase.of(context).time}", + "2 ${TranslationBase.of(context).times}", + "3 ${TranslationBase.of(context).times}", + "4 ${TranslationBase.of(context).times}" + ]; + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).h2o, + showHomeAppBarIcon: false, + body: SingleChildScrollView( + padding: EdgeInsets.fromLTRB(8, 8, 8, 80), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + controller: _nameController, + decoration: InputDecoration( + labelText: TranslationBase.of(context).enterNameHere, + labelStyle: TextStyle(color: Colors.black87), + fillColor: Colors.white, + filled: true, + border: UnderlineInputBorder( + borderSide: BorderSide( + width: 0, + style: BorderStyle.none, + ), + borderRadius: BorderRadius.circular(6.0), + ), + ), + ), + SizedBox(height: 8), + Text(TranslationBase.of(context).preferredunit), + SizedBox(height: 8), + _commonButtonsRow(TranslationBase.of(context).ml, TranslationBase.of(context).l, _isUnitML, (value) { + if (_isUnitML != value) { + setState(() { + _isUnitML = value; + }); + } + }), + Padding( + padding: EdgeInsets.only(top: 8.0, bottom: 8.0), + child: Divider(height: 1.5, color: Colors.black54), + ), + Text(TranslationBase.of(context).gender), + SizedBox(height: 8), + _commonButtonsRow(TranslationBase.of(context).male, TranslationBase.of(context).female, _isGenderMale, (value) { + if (_isGenderMale != value) { + setState(() { + _isGenderMale = value; + }); + } + }), + Padding( + padding: EdgeInsets.only(top: 8.0, bottom: 8.0), + child: Divider(height: 1.5, color: Colors.black54), + ), + Text(TranslationBase.of(context).height), + _commonSlidersRow(_heightController, 1, 270, _heightValue, (text) { + _heightController.text = text; + }, (value) { + setState(() { + _heightValue = value; + }); + }), + SizedBox(height: 8), + Text(TranslationBase.of(context).heightUnit), + SizedBox(height: 8), + _commonButtonsRow(TranslationBase.of(context).cm, TranslationBase.of(context).ft, _isHeightCM, (value) { + if (_isHeightCM != value) { + setState(() { + _isHeightCM = value; + }); + } + }), + SizedBox(height: 8), + _commonSlidersRow(_weightController, 1, 250, _weightValue, (text) { + _weightController.text = text; + }, (value) { + setState(() { + _weightValue = value; + }); + }), + SizedBox(height: 8), + Text(TranslationBase.of(context).weightUnit), + SizedBox(height: 8), + _commonButtonsRow(TranslationBase.of(context).kg, TranslationBase.of(context).lb, _isWeightKG, (value) { + if (_isWeightKG != value) { + setState(() { + _isWeightKG = value; + }); + } + }), + Padding( + padding: EdgeInsets.only(top: 8.0, bottom: 8.0), + child: Divider(height: 1.5, color: Colors.black54), + ), + Container( + padding: EdgeInsets.all(8), + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${TranslationBase.of(context).birth_date}:"), + SizedBox(height: 8), + InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (context) { + return Container( + height: 250, + padding: EdgeInsets.all(8), + child: Column(children: [ + Container( + height: 40, + alignment: Alignment.centerRight, + child: Row(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + onTap: () => Navigator.pop(context), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).cancel), + ), + ), + SizedBox(width: 8), + InkWell( + onTap: () { + Navigator.pop(context); + setState(() { + _dobDate = _tempDate; + }); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).ok), + ), + ) + ]), + ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width, + child: CupertinoDatePicker( + initialDateTime: _dobDate, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (_date) { + _tempDate = _date; + }, + ), + ), + ) + ]), + ); + }); + }, // implement cupertino dialog to select date + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Text(DateUtil.getFormattedDate(_dobDate, "yyyy-MM-dd")), Icon(Icons.arrow_drop_down_outlined)]), + ) + ], + ), + ), + SizedBox(height: 8), + _commonDialogSelectorRow(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { + showDialog( + context: context, + child: CommonRadioButtonDialog( + list: _activityLevelListEng, + title: TranslationBase.of(context).activityLevel, + onSelect: (index) { + Navigator.pop(context); + setState(() { + _selectedActiveLevel = index + 1; + }); + }, + selectedIndex: _selectedActiveLevel - 1, + ), + ); + }), + SizedBox(height: 8), + _commonDialogSelectorRow(TranslationBase.of(context).reminderLabel, _remindedTimeListEng[_selectedRemindedTime], () { + showDialog( + context: context, + child: CommonRadioButtonDialog( + list: _remindedTimeListEng, + onSelect: (index) { + Navigator.pop(context); + setState(() { + _selectedRemindedTime = index; + }); + }, + selectedIndex: _selectedRemindedTime, + ), + ); + }), + SizedBox(height: 16), + SizedBox( + height: 50, + width: MediaQuery.of(context).size.width, + child: FlatButton( + color: Theme.of(context).appBarTheme.color, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0), + ), + onPressed: _updateUserDetails, + child: Text( + TranslationBase.of(context).save, + style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600), + ), + ), + ) + ], + ), + ), + ); + } + + Widget _commonButtonsRow(String rightText, String leftText, bool checkParam, Function(bool) callBack) { + return Row(children: [ + Expanded( + child: SizedBox( + height: 40, + child: RaisedButton( + color: checkParam ? Theme.of(context).appBarTheme.color : Colors.white, + child: Text( + rightText, + style: TextStyle(color: checkParam ? Colors.white : Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w600), + ), + onPressed: () => callBack(true), + ), + ), + ), + SizedBox(width: 12), + Expanded( + child: SizedBox( + height: 40, + child: RaisedButton( + color: !checkParam ? Theme.of(context).appBarTheme.color : Colors.white, + child: Text( + leftText, + style: TextStyle(color: !checkParam ? Colors.white : Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w600), + ), + onPressed: () => callBack(false), + ), + ), + ), + ]); + } + + Widget _commonSlidersRow( + _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange) { + return Container( + margin: EdgeInsets.only(top: 6), + padding: EdgeInsets.all(6), + color: Colors.white, + height: 50, + child: Row( + children: [ + SizedBox( + width: 75, + child: TextField( + controller: _controller, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + decoration: InputDecoration( + contentPadding: EdgeInsets.only(left: 4, right: 4), + fillColor: Colors.white, + filled: true, + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + width: 1, + color: Colors.grey, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.circular(6.0), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + width: 1, + color: Colors.grey, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.circular(6.0), + ), + ), + ), + ), + Expanded( + flex: 6, + child: Slider( + min: _minValue, + max: _maxValue, + activeColor: Colors.redAccent, + inactiveColor: Colors.redAccent.withOpacity(.3), + value: _valueOrg, + onChanged: (value) { + onTextValueChange(value.toStringAsFixed(0)); + onValueChange(value); + }, + ), + ) + ], + ), + ); + } + + Widget _commonDialogSelectorRow(String title, String selectedText, VoidCallback onPressed) { + return Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + Text(title), + SizedBox(height: 8), + InkWell( + onTap: onPressed, + child: Container( + height: 50, + padding: EdgeInsets.all(8), + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Text(selectedText), Icon(Icons.arrow_drop_down_outlined)], + ), + ), + ) + ]); + } + + void _updateUserDetails() async { + _userDetailModel.height = _heightValue; + _userDetailModel.weight = _weightValue; + _userDetailModel.firstName = _nameController.text; + _userDetailModel.isWeightInKG = _isWeightKG; + _userDetailModel.isHeightInCM = _isHeightCM; + _userDetailModel.gender = _isGenderMale ? "M" : "F"; + + var tempDate = DateUtil.convertDateToString(_dobDate); + if (!tempDate.endsWith("/")) { + tempDate = tempDate + "/"; + } + + _userDetailModel.dOB = tempDate; + _userDetailModel.activityID = _selectedActiveLevel; + GifLoaderDialogUtils.showMyDialog(context); + await widget.viewModel.updateUserDetail(_userDetailModel, (tag) { + if (tag) { + AppToast.showSuccessToast(message: TranslationBase.of(context).success); + } + GifLoaderDialogUtils.hideDialog(context); + }); + + Navigator.pop(context); + } +} diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index ad2c6ece..b4d39682 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -1,12 +1,15 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -34,9 +37,26 @@ class _H2OPageState extends State @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model) => model.getUserDetail(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: "Water Tracker", + appBarTitle: TranslationBase.of(context).waterTracker, + showHomeAppBarIcon: false, + baseViewModel: model, + appBarIcons: [ + IconButton( + icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), + color: Colors.white, + onPressed: () { + Navigator.push( + context, + FadePage( + page: H2oSetting(userDetailModel: model.userDetail, viewModel: model), + ), + ); + }, + ), + ], body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -50,9 +70,7 @@ class _H2OPageState extends State child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), + color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8), height: 70.0, ), ), @@ -60,48 +78,46 @@ class _H2OPageState extends State Center( child: Container( height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, + alignment: Alignment.center, + // margin: EdgeInsets.only(top: 10.0), + // width: MediaQuery.of(context).size.width * 0.9, - child: Center( - child: TabBar( - isScrollable: false, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.28, - child: Center( - child: Texts( - "Today"), - ), + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.tab, + indicatorColor: Colors.red[800], + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.28, + child: Center( + child: Texts(TranslationBase.of(context).today), ), - Container( - width: MediaQuery.of(context).size.width * 0.28, - child: Center( - child: Texts("Week"), - ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.28, + child: Center( + child: Texts(TranslationBase.of(context).week), ), - Container( - width: MediaQuery.of(context).size.width * 0.28, - child: Center( - child: Texts("Month"), - ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.28, + child: Center( + child: Texts(TranslationBase.of(context).month), ), - ], - ), + ), + ], ), ), ), ], ), ), + backgroundColor: Colors.white, body: Column( children: [ Expanded( diff --git a/lib/pages/AlHabibMedicalService/h2o/month_page.dart b/lib/pages/AlHabibMedicalService/h2o/month_page.dart index f0baf34d..e0118495 100644 --- a/lib/pages/AlHabibMedicalService/h2o/month_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/month_page.dart @@ -1,11 +1,13 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; class MonthPage extends StatelessWidget { @override @@ -14,12 +16,39 @@ class MonthPage extends StatelessWidget { onModelReady: (model) => model.getUserProgressForMonthData(), builder: (_, model, widget) => AppScaffold( isShowAppBar: false, - appBarTitle: "Water Tracker", - baseViewModel:model , - body: SingleChildScrollView( - padding: EdgeInsets.symmetric(vertical: 12), - child: AppBarChart( - seriesList: model.userProgressForMonthDataSeries), + appBarTitle: TranslationBase.of(context).h2o, + baseViewModel: model, + body: Padding( + padding: EdgeInsets.all(8.0), + child: ListView( + children: [ + Center( + child: Text( + TranslationBase.of(context).waterConsumedInMonth, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 20.0, color: Colors.black87), + ), + ), + SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 10, + width: 40, + color: Colors.blue, + ), + SizedBox(width: 8), + Text( + TranslationBase.of(context).waterConsumedInMonth, + style: TextStyle(fontSize: 12.0), + ), + ], + ), + // SizedBox(height: 8), + AppBarChart(seriesList: model.userProgressForMonthDataSeries), + ], + ), ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index b92efc9e..33383287 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -14,7 +15,7 @@ class TodayPage extends StatelessWidget { onModelReady: (model) => model.getUserProgressForTodayData(), builder: (_, model, widget) => AppScaffold( isShowAppBar: false, - appBarTitle: "Water Tracker", + appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, body: SingleChildScrollView( padding: EdgeInsets.symmetric(vertical: 12), @@ -36,13 +37,14 @@ class TodayPage extends StatelessWidget { //, center: Center( child: Column( + mainAxisSize: MainAxisSize.min, children: [ - SizedBox( - height: 40, - ), + // SizedBox( + // height: 40, + // ), Text( - "Consumed", - style: TextStyle(fontSize: 20.0), + TranslationBase.of(context).consumed, + style: TextStyle(fontSize: 16.0), ), SizedBox( height: 4, @@ -50,13 +52,8 @@ class TodayPage extends StatelessWidget { Text( model.userProgressData == null ? "0.0" - : model.userProgressData.quantityConsumed - .toString() + - 'ml', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20.0, - color: HexColor("#60BCF9")), + : model.userProgressData.quantityConsumed.toString() + TranslationBase.of(context).ml, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0, color: HexColor("#60BCF9")), ), SizedBox( height: 4, @@ -70,8 +67,8 @@ class TodayPage extends StatelessWidget { height: 4, ), Text( - "Remaining", - style: TextStyle(fontSize: 20.0), + TranslationBase.of(context).remaining, + style: TextStyle(fontSize: 16.0), ), SizedBox( height: 4, @@ -79,18 +76,11 @@ class TodayPage extends StatelessWidget { Text( model.userProgressData == null ? "0.0" - : (model.userProgressData.quantityLimit - - model.userProgressData - .quantityConsumed) < - 0 - ? "0 ml" - : (model.userProgressData.quantityLimit - - model.userProgressData - .quantityConsumed) - .toString() + - ' ml', - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 18.0), + : (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed) < 0 + ? "0 ${TranslationBase.of(context).ml}" + : (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed).toString() + + ' ${TranslationBase.of(context).ml}', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0), ), ], ), @@ -104,42 +94,32 @@ class TodayPage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Center( - child: Container( - margin: EdgeInsets.only(left: 20), - height: 30, - width: 70, - decoration: BoxDecoration( - color: HexColor("#D1E3F6"), - borderRadius: - BorderRadius.all(Radius.circular(30))), - ), + Container( + margin: EdgeInsets.only(bottom: 16), + height: 30, + width: 70, + decoration: BoxDecoration(color: HexColor("#D1E3F6"), borderRadius: BorderRadius.all(Radius.circular(30))), ), Text( - "Remaining % ", - style: TextStyle(fontSize: 20.0), + "${TranslationBase.of(context).remaining} %", + style: TextStyle(fontSize: 16.0), ) ], ), Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Center( - child: Container( - margin: EdgeInsets.only(left: 20), - height: 30, - width: 70, - decoration: BoxDecoration( - color: HexColor("#60BCF9"), - borderRadius: - BorderRadius.all(Radius.circular(30))), - ), + Container( + margin: EdgeInsets.only(bottom: 16), + height: 30, + width: 70, + decoration: BoxDecoration(color: HexColor("#60BCF9"), borderRadius: BorderRadius.all(Radius.circular(30))), ), Text( - "Consumed % ", - style: TextStyle(fontSize: 20.0), + "${TranslationBase.of(context).consumed} %", + style: TextStyle(fontSize: 16.0), ) ], ) diff --git a/lib/pages/AlHabibMedicalService/h2o/week_page.dart b/lib/pages/AlHabibMedicalService/h2o/week_page.dart index e42eb19b..34e365e6 100644 --- a/lib/pages/AlHabibMedicalService/h2o/week_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/week_page.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -15,16 +16,41 @@ class WeekPage extends StatelessWidget { onModelReady: (model) => model.getUserProgressForWeekData(), builder: (_, model, widget) => AppScaffold( isShowAppBar: false, - appBarTitle: "Water Tracker", + appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, - body: SingleChildScrollView( - padding: EdgeInsets.symmetric(vertical: 12), - child: AppBarChart(seriesList: model.userProgressForWeekDataSeries), + body: Padding( + padding: EdgeInsets.all(8.0), + child: ListView( + children: [ + Center( + child: Text( + TranslationBase.of(context).waterConsumedInWeek, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 20.0, color: Colors.black87), + ), + ), + SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 10, + width: 40, + color: Colors.blue, + ), + SizedBox(width: 8), + Text( + TranslationBase.of(context).waterConsumedInWeek, + style: TextStyle(fontSize: 12.0), + ), + ], + ), + // SizedBox(height: 8), + AppBarChart(seriesList: model.userProgressForWeekDataSeries), + ], + ), ), ), ); } } - - - diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart index 7eaed1a8..b692e6ba 100644 --- a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart +++ b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -12,13 +13,7 @@ import 'package:flutter/material.dart'; import '../add_custom_amount.dart'; class H20FloatingActionButton extends StatefulWidget { - const H20FloatingActionButton({ - Key key, - @required AnimationController controller, - @required this.model - - }) : - super(key: key); + const H20FloatingActionButton({Key key, @required AnimationController controller, @required this.model}) : super(key: key); final H2OViewModel model; @@ -26,7 +21,7 @@ class H20FloatingActionButton extends StatefulWidget { _H20FloatingActionButtonState createState() => _H20FloatingActionButtonState(); } -class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { +class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { AnimationController _controller; @override void initState() { @@ -37,15 +32,20 @@ class _H20FloatingActionButtonState extends State with super.initState(); } + void showConfirmMessage(int amount, H2OViewModel model) { + showDialog( + context: context, + child: ConfirmAddAmountDialog( + model: model, + amount: amount, + ), + ); + } + @override Widget build(BuildContext context) { - - void showConfirmMessage(int amount, H2OViewModel model) { - showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,)); - } - return Container( - margin: EdgeInsets.only(left: 20), + margin: EdgeInsets.only(left: 20, right: 20), child: new Column(mainAxisSize: MainAxisSize.min, children: [ Row( mainAxisAlignment: MainAxisAlignment.start, @@ -55,21 +55,21 @@ class _H20FloatingActionButtonState extends State with children: [ ActionButton( controller: _controller, - text: "600ml", + text: "600${TranslationBase.of(context).ml}", onTap: () { showConfirmMessage(600, widget.model); }, ), ActionButton( controller: _controller, - text: "330ml", + text: "330${TranslationBase.of(context).ml}", onTap: () { showConfirmMessage(330, widget.model); }, ), ActionButton( controller: _controller, - text: "200ml", + text: "200${TranslationBase.of(context).ml}", onTap: () { showConfirmMessage(200, widget.model); }, @@ -87,11 +87,9 @@ class _H20FloatingActionButtonState extends State with animation: _controller, builder: (BuildContext context, Widget child) { return new Transform( - transform: new Matrix4.rotationZ( - _controller.value * 0.5 * math.pi), + transform: new Matrix4.rotationZ(_controller.value * 0.5 * math.pi), alignment: FractionalOffset.center, - child: new Icon( - _controller.isDismissed ? Icons.add : Icons.close), + child: new Icon(_controller.isDismissed ? Icons.add : Icons.close), ); }, ), @@ -104,21 +102,21 @@ class _H20FloatingActionButtonState extends State with }, ), new Container( + margin: EdgeInsets.only(left: 8, bottom: 4), alignment: FractionalOffset.topCenter, child: new ScaleTransition( scale: new CurvedAnimation( parent: _controller, - curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, - curve: Curves.easeOut), + curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), ), child: new FloatingActionButton( backgroundColor: Colors.white, heroTag: null, - mini: true, + // mini: true, child: Text( - "Custom", + TranslationBase.of(context).custom, textAlign: TextAlign.center, - style: TextStyle(fontSize: 14.0, color: Colors.grey), + style: TextStyle(fontSize: 12, color: Colors.grey), ), onPressed: () { Navigator.push( @@ -134,23 +132,23 @@ class _H20FloatingActionButtonState extends State with ), ), new Container( + margin: EdgeInsets.only(left: 8, bottom: 4), alignment: FractionalOffset.topCenter, child: new ScaleTransition( scale: new CurvedAnimation( parent: _controller, - curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, - curve: Curves.easeOut), + curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), ), child: new FloatingActionButton( backgroundColor: Colors.white, heroTag: null, - mini: true, + //mini: true, child: Text( - "Undo", + TranslationBase.of(context).undo, textAlign: TextAlign.center, - style: TextStyle(fontSize: 14.0, color: Colors.grey), + style: TextStyle(fontSize: 12.0, color: Colors.grey), ), - onPressed: () {}, + onPressed: undoVolume, ), ), ), @@ -159,14 +157,16 @@ class _H20FloatingActionButtonState extends State with ]), ); } + + void undoVolume() async { + GifLoaderDialogUtils.showMyDialog(context); + await widget.model.undoUserActivity(); + GifLoaderDialogUtils.hideDialog(context); + } } class ActionButton extends StatelessWidget { - const ActionButton( - {Key key, - @required AnimationController controller, - @required this.text, - this.onTap}) + const ActionButton({Key key, @required AnimationController controller, @required this.text, this.onTap}) : _controller = controller, super(key: key); @@ -177,6 +177,7 @@ class ActionButton extends StatelessWidget { @override Widget build(BuildContext context) { return Container( + margin: EdgeInsets.only(left: 4, bottom: 8), alignment: FractionalOffset.topCenter, child: new ScaleTransition( scale: new CurvedAnimation( @@ -184,16 +185,15 @@ class ActionButton extends StatelessWidget { curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), ), child: new FloatingActionButton( - heroTag: null, - backgroundColor: Colors.white, - mini: true, - child: Text( - text, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 14.0, color: Colors.grey), - ), - onPressed: onTap - ), + heroTag: null, + backgroundColor: Colors.white, + //mini: true, + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 12.0, color: Colors.grey), + ), + onPressed: onTap), ), ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart index c84053c5..68cd2c99 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -490,11 +491,11 @@ class _BMICalculatorState extends State { height: 25.0, ), Container( - height: 100.0, + height: 50.0, width: 350.0, - child: Button( + child: SecondaryButton( label: 'CALCULATE', - onTap: () { + onTap: () => { setState(() { calculateBMI(); showTextResult(); @@ -510,7 +511,7 @@ class _BMICalculatorState extends State { )), ); } - }); + }) }, ), ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart index 1af0f949..01393e0b 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -687,9 +688,9 @@ class _BmrCalculatorState extends State { height: 30.0, ), Container( - height: 100.0, + height: 50.0, width: 350.0, - child: Button( + child: SecondaryButton( label: 'CALCULATE', onTap: () { setState(() { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart index 91847e37..51b4cad6 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -985,8 +986,13 @@ class _BodyFatState extends State { Container( height: 100.0, width: 350.0, - child: Button( + child: SecondaryButton( label: 'CALCULATE', + // onTap: () => { + // setState(() { + // print('hiii'); + // }) + // } onTap: () { setState(() { calculateBodyFat(); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart index 4361425a..e2196540 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -648,7 +649,7 @@ class _CalorieCalculatorState extends State { Container( height: 100.0, width: 350.0, - child: Button( + child: SecondaryButton( label: 'CALCULATE', onTap: () { setState(() { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index e273b075..50152328 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -329,9 +330,9 @@ class _CarbsState extends State { height: 55.0, ), Container( - height: 100.0, + height: 50.0, width: 350.0, - child: Button( + child: SecondaryButton( label: 'CALCULATE', onTap: () { setState(() { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart index c9993b95..c69f0564 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -111,9 +112,9 @@ class _DeliveryDueState extends State { height: 280.0, ), Container( - height: 100.0, + height: 50.0, width: 350.0, - child: Button( + child: SecondaryButton( label: 'CALCULATE', onTap: () { setState(() { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart index 9bdbfb36..2aff7836 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -518,7 +519,7 @@ class _IdealBodyState extends State { Container( height: 100.0, width: 350.0, - child: Button( + child: SecondaryButton( label: 'CALCULATE', onTap: () { setState(() { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart index 1a272c11..9c5dc0d3 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -319,9 +320,9 @@ class _OvulationPeriodState extends State { height: 220.0, ), Container( - height: 100.0, + height: 50.0, width: 350.0, - child: Button( + child: SecondaryButton( label: 'CALCULATE', onTap: () { setState(() { diff --git a/lib/pages/AlHabibMedicalService/health_converter.dart b/lib/pages/AlHabibMedicalService/health_converter.dart index 61ea406f..2b3b1a8e 100644 --- a/lib/pages/AlHabibMedicalService/health_converter.dart +++ b/lib/pages/AlHabibMedicalService/health_converter.dart @@ -18,7 +18,7 @@ class _HealthConverterState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Health Converter', + appBarTitle: TranslationBase.of(context).converters, body: Column( children: [ Container( @@ -37,9 +37,9 @@ class _HealthConverterState extends State { ); }, child: MedicalProfileItem( - title: 'Blood', + title: TranslationBase.of(context).bloodSugar, imagePath: 'blood_sugar_icon.png', - subTitle: 'Sugar', + subTitle: TranslationBase.of(context).sugar, ), ), ), @@ -55,9 +55,9 @@ class _HealthConverterState extends State { ); }, child: MedicalProfileItem( - title: 'Blood', + title: TranslationBase.of(context).bloodCholesterol, imagePath: 'blood_cholesterol_icon.png', - subTitle: 'Cholesterol', + subTitle: TranslationBase.of(context).cholesterol, ), ), ), @@ -77,9 +77,9 @@ class _HealthConverterState extends State { ); }, child: MedicalProfileItem( - title: 'Triglycerides', + title: TranslationBase.of(context).triglycerides, imagePath: 'triglycerides_blood_icon.png', - subTitle: 'Fat in blood', + subTitle: TranslationBase.of(context).fatInBlood, ), ), ), diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index 58caee36..513b50ab 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -62,7 +63,7 @@ class _BloodCholesterolState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Blood Cholesterol ', + appBarTitle: TranslationBase.of(context).bloodCholesterol, body: Padding( padding: const EdgeInsets.all(16.0), child: SingleChildScrollView( @@ -74,7 +75,7 @@ class _BloodCholesterolState extends State { Container( width: 350.0, child: Text( - 'Convert blood cholesterol from\n mmol/l to mg/dlt and vice versa.', + TranslationBase.of(context).convertCholesterolStatement, //textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0), ), @@ -95,7 +96,7 @@ class _BloodCholesterolState extends State { child: Row( children: [ Texts( - 'Convert from', + TranslationBase.of(context).convertFrom, ), ], ), @@ -117,7 +118,7 @@ class _BloodCholesterolState extends State { }); }, child: Container( - height: 55.0, + height: 65.0, width: 150.0, decoration: BoxDecoration( boxShadow: [ @@ -150,7 +151,7 @@ class _BloodCholesterolState extends State { }); }, child: Container( - height: 55.0, + height: 65.0, width: 150.0, decoration: BoxDecoration( color: cardMMOLColor, @@ -196,7 +197,7 @@ class _BloodCholesterolState extends State { decoration: InputDecoration( border: OutlineInputBorder( borderSide: BorderSide(color: Colors.black45)), - labelText: " Enter the reading value", + labelText: TranslationBase.of(context).enterReadingValue, labelStyle: TextStyle( color: Colors.black87, ), @@ -209,7 +210,7 @@ class _BloodCholesterolState extends State { Visibility( visible: _visible, child: Container( - height: 95.0, + height: 115.0, width: 350.0, decoration: BoxDecoration( color: Colors.white, @@ -222,7 +223,7 @@ class _BloodCholesterolState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - Texts('Result:'), + Texts(TranslationBase.of(context).result + ":"), Row( children: [ Text( @@ -252,10 +253,10 @@ class _BloodCholesterolState extends State { ), Flexible( child: Container( - height: 100.0, + height: 60.0, width: 150.0, - child: Button( - label: 'CALCULATE', + child: SecondaryButton( + label: TranslationBase.of(context).calculate, onTap: () { setState(() { _visible == false diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart index f5d66ccf..8a7e9792 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart @@ -64,7 +64,7 @@ class _BloodSugarState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Blood Sugar Conversion', + appBarTitle: TranslationBase.of(context).bloodSugarConversion, body: Padding( padding: const EdgeInsets.all(16.0), child: SingleChildScrollView( @@ -76,7 +76,7 @@ class _BloodSugarState extends State { Container( width: 350.0, child: Text( - 'Convert blood sugar/glucose from mmol/l (UK standard) to mg/dlt (US standard) and vice versa.', + TranslationBase.of(context).convertBloodSugarStatement, //textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0), ), @@ -97,7 +97,7 @@ class _BloodSugarState extends State { child: Row( children: [ Texts( - 'Convert from', + TranslationBase.of(context).convertFrom, ) ], ), @@ -119,7 +119,7 @@ class _BloodSugarState extends State { }); }, child: Container( - height: 55.0, + height: 65.0, width: 150.0, decoration: BoxDecoration( boxShadow: [ @@ -152,7 +152,7 @@ class _BloodSugarState extends State { }); }, child: Container( - height: 55.0, + height: 65.0, width: 150.0, decoration: BoxDecoration( color: cardMMOLColor, @@ -196,7 +196,7 @@ class _BloodSugarState extends State { ], keyboardType: TextInputType.number, decoration: InputDecoration( - labelText: " Enter the reading value", + labelText: TranslationBase.of(context).enterReadingValue, border: OutlineInputBorder( borderSide: BorderSide(color: Colors.black45)), labelStyle: TextStyle( @@ -211,7 +211,7 @@ class _BloodSugarState extends State { Visibility( visible: _visible, child: Container( - height: 95.0, + height: 115.0, width: 350.0, decoration: BoxDecoration( color: Colors.white, @@ -224,7 +224,7 @@ class _BloodSugarState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - Texts('Result:'), + Texts(TranslationBase.of(context).result + ": "), Row( children: [ Text( @@ -254,10 +254,10 @@ class _BloodSugarState extends State { ), Flexible( child: Container( - height: 100.0, + height: 60.0, width: 150.0, - child: Button( - label: 'CALCULATE', + child: SecondaryButton( + label: TranslationBase.of(context).calculate, onTap: () { setState(() { _visible == false diff --git a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart index a86fdb88..4c5f9a83 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -64,7 +65,7 @@ class _TriglyceridesState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Triglycerides', + appBarTitle: TranslationBase.of(context).triglycerides, body: Padding( padding: const EdgeInsets.all(16.0), child: SingleChildScrollView( @@ -76,7 +77,7 @@ class _TriglyceridesState extends State { Container( width: 350.0, child: Text( - 'Convert Triglycerides from mmol/l to\n mg/dlt and vice versa.', + TranslationBase.of(context).triglyceridesConvertStatement, //textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0), ), @@ -95,7 +96,9 @@ class _TriglyceridesState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 15.0), child: Row( - children: [Texts('Convert from')], + children: [ + Texts(TranslationBase.of(context).convertFrom) + ], ), ), SizedBox( @@ -115,7 +118,7 @@ class _TriglyceridesState extends State { }); }, child: Container( - height: 55.0, + height: 65.0, width: 150.0, decoration: BoxDecoration( boxShadow: [ @@ -148,7 +151,7 @@ class _TriglyceridesState extends State { }); }, child: Container( - height: 55.0, + height: 65.0, width: 150.0, decoration: BoxDecoration( color: cardMMOLColor, @@ -194,7 +197,7 @@ class _TriglyceridesState extends State { decoration: InputDecoration( border: OutlineInputBorder( borderSide: BorderSide(color: Colors.black45)), - labelText: " Enter the reading value", + labelText: TranslationBase.of(context).enterReadingValue, labelStyle: TextStyle( color: Colors.black87, ), @@ -207,7 +210,7 @@ class _TriglyceridesState extends State { Visibility( visible: _visible, child: Container( - height: 95.0, + height: 115.0, width: 350.0, decoration: BoxDecoration( color: Colors.white, @@ -220,7 +223,7 @@ class _TriglyceridesState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - Texts('Result:'), + Texts(TranslationBase.of(context).result + ":"), Row( children: [ Text( @@ -250,10 +253,11 @@ class _TriglyceridesState extends State { ), Flexible( child: Container( - height: 100.0, + height: 60.0, width: 250.0, - child: Button( - label: 'CALCULATE', + child: SecondaryButton( + label: + TranslationBase.of(context).calculate.toUpperCase(), onTap: () { setState(() { _visible == false diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 99e5242e..e0fa2aec 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -1,14 +1,15 @@ - import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; + //import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart'; import 'package:diplomaticquarterapp/core/viewModels/blooddonation/blood_details_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; @@ -27,6 +28,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:giffy_dialog/giffy_dialog.dart'; +import 'package:provider/provider.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; //import '../../../core/model/my_balance/AdvanceModel.dart'; @@ -39,8 +41,8 @@ import 'dialogs/SelectPatientInfoDialog.dart'; import 'new_text_Field.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } -enum Gender{Male,Female,NON} -enum Blood{Oplus,Ominus,Aplus,Aminus,Bplus,Bminus,ABplus,ABminus,NON} +enum Gender { Male, Female, NON } +enum Blood { Oplus, Ominus, Aplus, Aminus, Bplus, Bminus, ABplus, ABminus, NON } class BloodDonationPage extends StatefulWidget { @override @@ -51,8 +53,8 @@ class _BloodDonationPageState extends State { TextEditingController _fileTextController = TextEditingController(); TextEditingController _notesTextController = TextEditingController(); BeneficiaryType beneficiaryType = BeneficiaryType.NON; - Gender gender = Gender.Male;//Gender.NON; - Blood blood = Blood.Aminus;//Blood.NON; + Gender gender = Gender.Male; //Gender.NON; + Blood blood = Blood.Aminus; //Blood.NON; //HospitalsModel _selectedHospital; CitiesModel _selectedHospital; @@ -62,22 +64,27 @@ class _BloodDonationPageState extends State { AuthenticatedUser authenticatedUser; GetAllSharedRecordsByStatusList selectedPatientFamily; AdvanceModel advanceModel = AdvanceModel(); - List_BloodGroupDetailsModel bloodDetails=List_BloodGroupDetailsModel(); + List_BloodGroupDetailsModel bloodDetails = List_BloodGroupDetailsModel(bloodGroup: "A-"); AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; - var checkedValue = false; + var checkedValue = false; + @override void initState() { super.initState(); getAuthUser(); } + @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + return BaseView( - onModelReady: (model) => model.getCities(),//model.getHospitals(), + onModelReady: (model) => model.getCities(), //model.getHospitals(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: "Blood Donation",//TranslationBase.of(context).advancePayment, + baseViewModel: model, + appBarTitle: TranslationBase.of(context).bloodD, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( @@ -86,15 +93,16 @@ class _BloodDonationPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - // TranslationBase.of(context).advancePaymentLabel, - "Enter the required information, In order to register for Blood Donation Service",//+model.user.firstName, + TranslationBase.of(context).bloodDEnterDesc, textAlign: TextAlign.center, ), SizedBox( height: 12, ), InkWell( - onTap: () => confirmSelectHospitalDialog(model.CitiesModelList),//model.hospitals + onTap: () => + confirmSelectHospitalDialog(model.CitiesModelList), + //model.hospitals child: Container( padding: EdgeInsets.all(12), width: double.infinity, @@ -105,7 +113,7 @@ class _BloodDonationPageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getHospitalName()), + Texts(getHospitalName(projectProvider, context)), Icon(Icons.arrow_drop_down) ], ), @@ -116,7 +124,8 @@ class _BloodDonationPageState extends State { ), InkWell( //======Gender======== - onTap: () => confirmSelectGenderDialog(),//confirmSelectBeneficiaryDialog(model), + onTap: () => confirmSelectGenderDialog(), + //confirmSelectBeneficiaryDialog(model), child: Container( padding: EdgeInsets.all(12), width: double.infinity, @@ -128,49 +137,19 @@ class _BloodDonationPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ //Texts(getBeneficiaryType()), - Texts(getGender()), + Texts(getGender(context)), Icon(Icons.arrow_drop_down) ], ), ), ), - // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) - // SizedBox( - // height: 12, - // ), - // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) - // InkWell( - // onTap: () { - // model.getFamilyFiles().then((value) { - // confirmSelectFamilyDialog(model - // .getAllSharedRecordsByStatusResponse - // .getAllSharedRecordsByStatusList); - // }).showProgressBar( - // text: "Loading", - // backgroundColor: Colors.blue.withOpacity(0.6)); - // }, - // child: Container( - // padding: EdgeInsets.all(12), - // width: double.infinity, - // height: 65, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(12), - // color: Colors.white), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Texts(getFamilyMembersName()), - // Icon(Icons.arrow_drop_down) - // ], - // ), - // ), - // ), SizedBox( height: 12, ), InkWell( //======Gender======== - onTap: () => confirmSelectBloodDialog(),//confirmSelectBeneficiaryDialog(model), + onTap: () => confirmSelectBloodDialog(), + //confirmSelectBeneficiaryDialog(model), child: Container( padding: EdgeInsets.all(12), width: double.infinity, @@ -188,44 +167,14 @@ class _BloodDonationPageState extends State { ), ), ), - // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) - // SizedBox( - // height: 12, - // ), - // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) - // InkWell( - // onTap: () { - // model.getFamilyFiles().then((value) { - // confirmSelectFamilyDialog(model - // .getAllSharedRecordsByStatusResponse - // .getAllSharedRecordsByStatusList); - // }).showProgressBar( - // text: "Loading", - // backgroundColor: Colors.blue.withOpacity(0.6)); - // }, - // child: Container( - // padding: EdgeInsets.all(12), - // width: double.infinity, - // height: 65, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(12), - // color: Colors.white), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Texts(getFamilyMembersName()), - // Icon(Icons.arrow_drop_down) - // ], - // ), - // ), - // ), SizedBox( height: 12, ), Row( children: [ Container( - child: Text(" To view the terms and conditions "), + child: Text( + TranslationBase.of(context).viewTermsConditions), ), SizedBox( width: MediaQuery.of(context).size.height * 0.10, @@ -233,10 +182,14 @@ class _BloodDonationPageState extends State { InkWell( onTap: () { Navigator.of(context).push(MaterialPageRoute( - builder: (BuildContext context) => UserAgreementPage())); + builder: (BuildContext context) => + UserAgreementPage())); }, child: Container( - child: Texts(" Click here ",color: Colors.blue,), + child: Texts( + TranslationBase.of(context).clickHere, + color: Colors.blue, + ), ), ) ], @@ -247,99 +200,34 @@ class _BloodDonationPageState extends State { Row( children: [ Checkbox( - onChanged: (bool value) { + onChanged: (bool value) { setState(() { checkedValue = value; }); }, - // tristate: checkedValue==true,//i == 1, + // tristate: checkedValue==true,//i == 1, value: checkedValue, - activeColor: Colors.red,//Color(0xFF6200EE), + activeColor: Color(0xFFc5272d), //Color(0xFF6200EE), + ), + SizedBox( + height: 10, + ), + Row( + children: [], ), - SizedBox(height: 10,), - Row(children: [ - - ],), SizedBox( width: 10, ), Text( - 'I agree to the terms and conditions ', - style: Theme.of(context).textTheme.subtitle1.copyWith(color: checkedValue? Colors.red : Colors.black), + TranslationBase.of(context) + .iAgreeToTheTermsAndConditions, + style: Theme.of(context).textTheme.subtitle1.copyWith( + color: checkedValue + ? Color(0xFFc5272d) + : Colors.black), ), ], ), - // NewTextFields( - // hintText: TranslationBase.of(context).fileNumber, - // controller: _fileTextController, - // ), - // if (beneficiaryType == BeneficiaryType.OtherAccount) - // SizedBox( - // height: 12, - // ), - // if (beneficiaryType == BeneficiaryType.OtherAccount) - // InkWell( - // onTap: () { - // if (_fileTextController.text.isNotEmpty) - // model - // .getPatientInfoByPatientID( - // id: _fileTextController.text) - // .then((value) { - // confirmSelectPatientDialog(model.patientInfoList); - // }).showProgressBar( - // text: "Loading", - // backgroundColor: - // Colors.blue.withOpacity(0.6)); - // else - // AppToast.showErrorToast( - // message: 'Please Enter The File Number'); - // }, - // child: Container( - // padding: EdgeInsets.all(12), - // width: double.infinity, - // height: 65, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(12), - // color: Colors.white), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Texts(getPatientName()), - // Icon(Icons.arrow_drop_down) - // ], - // ), - // ), - // ), - // SizedBox( - // height: 12, - // ), - - // NewTextFields( - // hintText: TranslationBase.of(context).amount, - // keyboardType: TextInputType.number, - // onChanged: (value) { - // setState(() { - // amount = value; - // }); - // }, - // ), - // SizedBox( - // height: 12, - // ), - // NewTextFields( - // hintText: TranslationBase.of(context).depositorEmail, - // initialValue: model.user.emailAddress, - // onChanged: (value) { - // email = value; - // }, - // ), - // SizedBox( - // height: 12, - // ), - // NewTextFields( - // hintText: TranslationBase.of(context).notes, - // controller: _notesTextController, - // ), SizedBox( height: 10, ), @@ -355,29 +243,25 @@ class _BloodDonationPageState extends State { onTap: () { showDialog( context: context, - builder: (_) => - AssetGiffyDialog( + builder: (_) => AssetGiffyDialog( title: Text( "", style: TextStyle( fontSize: 22.0, - fontWeight: - FontWeight - .w600), + fontWeight: FontWeight.w600), ), image: Image.asset( 'assets/images/BloodChrt_EN.png'), - buttonCancelText: - Text('cancel'), - buttonCancelColor: - Colors.grey, + buttonCancelText: Text( + TranslationBase.of(context).cancel), + buttonCancelColor: Colors.grey, onlyCancelButton: true, )); }, child: Container( width: 250, height: 200, - child:Image.asset( + child: Image.asset( 'assets/images/BloodChrt_EN.png')), ), ), @@ -395,25 +279,41 @@ class _BloodDonationPageState extends State { bottomSheet: Container( height: MediaQuery.of(context).size.height * 0.12, width: double.infinity, - padding: EdgeInsets.all(12), child: SecondaryButton( textColor: Colors.white, - color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), - label: "Save", - // - onTap: (){ - - bloodDetails.city=_selectedHospital.toString(); - - // bloodDetails. + color: checkedValue == false + ? Color(0xFFa0a4a6) + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: TranslationBase.of(context).save, + onTap: () async { + if(_selectedHospital == null){ + AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); + return; + } + bloodDetails.city = projectProvider.isArabic + ? _selectedHospital.descriptionN + : _selectedHospital.description; + bloodDetails.cityCode = _selectedHospital.iD.toString(); + bloodDetails.gender = gender == Gender.Male ? 1 : 2; + await model.updateBloodGroup(bloodDetails); + if (model.state == ViewState.Idle) { + AppToast.showSuccessToast( + message: model.updatedRegisterBloodMessage); + } else { + AppToast.showErrorToast(message: model.error); + } }, - - ), )), ); } + //============== void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { showDialog( @@ -435,94 +335,85 @@ class _BloodDonationPageState extends State { ), ); } - void confirmSelectBloodDialog(){ + + void confirmSelectBloodDialog() { showDialog( context: context, - child: SelectBloodDialog(bloodType: blood, + child: SelectBloodDialog( + bloodType: blood, onValueSelected: (value) { setState(() { if (value == Blood.Oplus) { - bloodDetails.bloodGroup="O+"; + bloodDetails.bloodGroup = "O+"; // _fileTextController.text = model.user.patientID.toString(); // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; - }else - if (value == Blood.Ominus) { + } else if (value == Blood.Ominus) { // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.bloodGroup="O-"; + bloodDetails.bloodGroup = "O-"; // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; - }else - if (value == Blood.ABplus) { - bloodDetails.bloodGroup="AB+"; + } else if (value == Blood.ABplus) { + bloodDetails.bloodGroup = "AB+"; // _fileTextController.text = model.user.patientID.toString(); // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; - }else - if (value == Blood.ABminus) { - bloodDetails.bloodGroup="AB-"; + } else if (value == Blood.ABminus) { + bloodDetails.bloodGroup = "AB-"; // _fileTextController.text = model.user.patientID.toString(); // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; - }else - if (value == Blood.Aplus) { - bloodDetails.bloodGroup="A+"; + } else if (value == Blood.Aplus) { + bloodDetails.bloodGroup = "A+"; // _fileTextController.text = model.user.patientID.toString(); // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; - }else - if (value == Blood.Aminus) { - bloodDetails.bloodGroup="A-"; + } else if (value == Blood.Aminus) { + bloodDetails.bloodGroup = "A-"; // _fileTextController.text = model.user.patientID.toString(); // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; - }else - if (value == Blood.Bplus) { - bloodDetails.bloodGroup="B+"; + } else if (value == Blood.Bplus) { + bloodDetails.bloodGroup = "B+"; // _fileTextController.text = model.user.patientID.toString(); // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; - }else - if (value == Blood.Bminus) { - bloodDetails.bloodGroup="B-"; + } else if (value == Blood.Bminus) { + bloodDetails.bloodGroup = "B-"; // _fileTextController.text = model.user.patientID.toString(); // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; - } - - - else + } else _fileTextController.text = ""; // beneficiaryType = value; - blood=value; - } - - - - - ); + blood = value; + }); }, ), ); } - void confirmSelectGenderDialog(){ + + void confirmSelectGenderDialog() { showDialog( context: context, - child: SelectGenderDialog(beneficiaryType: gender, + child: SelectGenderDialog( + beneficiaryType: gender, onValueSelected: (value) { setState(() { if (value == Gender.Male) { // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.patientType=1; + bloodDetails.patientType = 1; // advanceModel.depositorName = // model.user.firstName + " " + model.user.lastName; } else - // _fileTextController.text = ""; - {bloodDetails.gender=2;} + // _fileTextController.text = ""; + { + bloodDetails.gender = 2; + } - // beneficiaryType = value; - gender=value; + // beneficiaryType = value; + gender = value; }); }, ), @@ -591,23 +482,25 @@ class _BloodDonationPageState extends State { return TranslationBase.of(context).otherAccount; break; case BeneficiaryType.NON: - return "Select Gender";//TranslationBase.of(context).selectBeneficiary; + return TranslationBase.of(context).selectBeneficiary; } - return "Select Gender";//TranslationBase.of(context).selectBeneficiary; + return TranslationBase.of(context).selectBeneficiary; } - String getGender() { + + String getGender(BuildContext context) { switch (gender) { case Gender.Male: - return "Male"; + return TranslationBase.of(context).male; case Gender.Female: - return "Female"; + return TranslationBase.of(context).female; break; case Gender.NON: - return "Select Gender";//TranslationBase.of(context).selectBeneficiary; + return TranslationBase.of(context).selectGender; } - return "Select Gender";//TranslationBase.of(context).selectBeneficiary; + return TranslationBase.of(context).selectGender; } + String getBlood() { switch (blood) { case Blood.Oplus: @@ -639,18 +532,19 @@ class _BloodDonationPageState extends State { break; case Blood.NON: - return "Select Blood Type";//TranslationBase.of(context).selectBeneficiary; + return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; } - return "Select Blood Type";//TranslationBase.of(context).selectBeneficiary; + return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; } - String getHospitalName() { + String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { if (_selectedHospital != null) - return _selectedHospital.description; + return projectProvider.isArabic + ? _selectedHospital.descriptionN + : _selectedHospital.description; else - return - "Riyadh"; - // return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital; + return TranslationBase.of(context).selectCity; + // return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital; } String getPatientName() { @@ -677,8 +571,6 @@ class _BloodDonationPageState extends State { return TranslationBase.of(context).selectFamilyPatientName; } - - //================ - +//================ } diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index 75282190..c384b7b5 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; -import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -166,7 +165,7 @@ class ConfirmPaymentPage extends StatelessWidget { patientID: int.parse(advanceModel.fileNumber), projectID: advanceModel.hospitalsModel.iD) .then((value) { - GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(); }); @@ -218,7 +217,8 @@ class ConfirmPaymentPage extends StatelessWidget { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - browser); + browser, + false); } onBrowserLoadStart(String url) { @@ -277,8 +277,8 @@ class ConfirmPaymentPage extends StatelessWidget { String paymentReference = res['Fort_id'].toString(); GifLoaderDialogUtils.showMyDialog(AppGlobal.context); service - .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], - res['PaymentMethod'], AppGlobal.context) + .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], + res['Fort_id'], res['PaymentMethod'], AppGlobal.context) .then((res) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); @@ -315,5 +315,4 @@ class ConfirmPaymentPage extends StatelessWidget { Future navigateToHome(context) async { Navigator.of(context).pushNamed(HOME); } - } diff --git a/lib/pages/Blood/dialogs/SelectGenderDialog.dart b/lib/pages/Blood/dialogs/SelectGenderDialog.dart index 295c6dcd..a097ae8e 100644 --- a/lib/pages/Blood/dialogs/SelectGenderDialog.dart +++ b/lib/pages/Blood/dialogs/SelectGenderDialog.dart @@ -38,7 +38,7 @@ class _SelectGenderDialogState extends State { }); }, child: ListTile( - title: Text("Male"), + title: Text(TranslationBase.of(context).male), leading: Radio( value: Gender.Male, groupValue: beneficiaryType, @@ -68,7 +68,7 @@ class _SelectGenderDialogState extends State { }); }, child: ListTile( - title: Text("Female"), + title: Text(TranslationBase.of(context).female), leading: Radio( value: Gender.Female, groupValue: beneficiaryType, diff --git a/lib/pages/Blood/user_agreement_page.dart b/lib/pages/Blood/user_agreement_page.dart index d05725b4..36989ea5 100644 --- a/lib/pages/Blood/user_agreement_page.dart +++ b/lib/pages/Blood/user_agreement_page.dart @@ -1,55 +1,23 @@ +import 'package:diplomaticquarterapp/core/viewModels/TermsConditionsViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter_html/flutter_html.dart'; class UserAgreementPage extends StatelessWidget { @override Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle: "User Agreement", - - body: - Container( - child:ListView( - scrollDirection: Axis.vertical, - children: [ - /////////// - Column( - children: [ - SizedBox( - height: 20, - ), - Container( - child:Text("Communication via email, text messages and phone calls",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)), - ), - SizedBox( - height: 20, - ), - Container( - child: - Text("I understand that the contact number or Email that \n I have provided on registration will be used for communication by HMG.\n I hereby agree to be notified by HMG through SMS, Email or any other method for appointments notifications, current HMG’s medical services, and any services introduced by the HMG in the future or any modifications made to the services offered by the HMG. And these messages may be submitted as evidence where the HMG has the right to use at any time whatsoever and as it sees fit.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)), - ), - SizedBox( - height: 20, - ), - Container( - child: - Text("I understand the risks of communicating by email and text messages, in particular the privacy risks. \nI understand that HMG cannot guarantee the security and confidentiality of email or text communication. HMG will not be responsible for messages that are not received or delivered due to technical failure, or for disclosure of confidential information unless caused by intentional misconduct.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)), - ), - SizedBox( - height: 20, - ), - Container( - child: - Text("\b I hereby agree to receive emails, text messages, phone calls for appointments notifications, special promotions and new features or products introduced by HMG or any third party.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)), - ), - ], - ) - /////////// - ]) - - - - )); + return BaseView( + onModelReady: (model) => model.getUserTermsAndConditions(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).userAgreement, + body: SingleChildScrollView( + child: Html( + data: model.userAgreementContent, + ), + )), + ); } } diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index d7e08a66..03a28d90 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -187,27 +187,29 @@ class _BookConfirmState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), - child: Image.asset( - "assets/images/new-design/icon_hospital.png"), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), - child: Text( - TranslationBase.of(context).hospital + - ": " + - widget.doctor.projectName, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - ), - ], - ), + !widget.isLiveCareAppointment ? Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + margin: + EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), + child: Image.asset( + "assets/images/new-design/icon_hospital.png"), + ), + Container( + margin: + EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), + child: Text( + TranslationBase.of(context).hospital + + ": " + + widget.doctor.projectName, + style: TextStyle( + fontSize: 14.0, + color: Colors.grey[700], + letterSpacing: 1.0)), + ), + ], + ) : Container(), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -325,7 +327,8 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(top: 5.0), child: Text( - TranslationBase.of(context).gender + ": " + + TranslationBase.of(context).gender + + ": " + widget.authUser.genderDescription, style: TextStyle( fontSize: 12.0, @@ -335,7 +338,9 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(top: 5.0, bottom: 3.0), child: Text( - TranslationBase.of(context).age + ": " + widget.authUser.age.toString(), + TranslationBase.of(context).age + + ": " + + widget.authUser.age.toString(), style: TextStyle( fontSize: 12.0, color: Colors.grey[600], @@ -423,7 +428,8 @@ class _BookConfirmState extends State { context) .then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); + AppToast.showSuccessToast( + message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); Future.delayed(new Duration(milliseconds: 500), () { @@ -543,13 +549,13 @@ class _BookConfirmState extends State { getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { - GifLoaderDialogUtils.hideDialog(context); widget.service .getLiveCareAppointmentPatientShare( appointmentNo, clinicID, projectID, context) .then((res) { print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); + GifLoaderDialogUtils.hideDialog(context); navigateToBookSuccess(context, docObject, widget.patientShareResponse); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index f513c434..bd6c242c 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -255,7 +255,7 @@ class _BookSuccessState extends State { minWidth: MediaQuery.of(context).size.width * 0.7, height: 45.0, child: RaisedButton( - color: new Color(0xFF40ACC9), + color: new Color(0xffc5272d), textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), @@ -318,7 +318,7 @@ class _BookSuccessState extends State { minWidth: MediaQuery.of(context).size.width * 0.7, height: 45.0, child: RaisedButton( - color: new Color(0xFF40ACC9), + color: new Color(0xFFc5272d), textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), @@ -637,7 +637,12 @@ class _BookSuccessState extends State { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - widget.browser); + widget.browser, + widget.patientShareResponse.isLiveCareAppointment, + widget.patientShareResponse.appointmentDate, + widget.patientShareResponse.appointmentNo, + widget.patientShareResponse.clinicID, + widget.patientShareResponse.doctorID); } } diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index d419e4af..1562c5f7 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -61,7 +61,7 @@ class DoctorView extends StatelessWidget { letterSpacing: 1.0)), Container( margin: EdgeInsets.only(top: 3.0), - child: Text(this.doctor.clinicName, + child: Text(this.doctor.clinicName != null ? this.doctor.clinicName : "", style: TextStyle( fontSize: 12.0, color: Colors.grey[600], diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index 51b89f98..3c0d072b 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -84,10 +85,12 @@ class _AddNewChildPageState extends State { @override Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: "Vaccintion", + appBarTitle: TranslationBase.of(context).vaccination, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( @@ -96,10 +99,10 @@ class _AddNewChildPageState extends State { // crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( - height: 50, + height: 20, ), Texts( - "Add the child's information below to recieve the schedule of vaccinations.", + TranslationBase.of(context).vaccinationAddChildMsg, //+model.user.firstName, textAlign: TextAlign.center, ), @@ -107,14 +110,14 @@ class _AddNewChildPageState extends State { height: 12, ), NewTextFields( - hintText: "First Name", + hintText: TranslationBase.of(context).firstName, controller: _firstTextController, ), SizedBox( height: 12, ), NewTextFields( - hintText: "Second Name", + hintText: TranslationBase.of(context).middleName, controller: _secondTextController, ), SizedBox( @@ -124,62 +127,57 @@ class _AddNewChildPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Gender:", + TranslationBase.of(context).gender, textAlign: TextAlign.end, ), ], ), Container( - height: MediaQuery.of(context).size.height * 0.12, width: double.infinity, + height: size.height * 0.12, padding: EdgeInsets.all(12), - - child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: 175, - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 1 ? Colors.white : Colors.black, - color: checkedValue == 1 ? Colors.red : Colors.white, - - label: "Male", - // - onTap: () { + Expanded( + child: Container( + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 1 ? Colors.white : Colors.black, + color: checkedValue == 1 ? Colors.red : Colors.white, + label: TranslationBase.of(context).male, + onTap: () { + setState(() { + checkedValue = 1; + print("checkedValue=" + checkedValue.toString()); + }); - setState(() { - checkedValue = 1; - print("checkedValue=" + checkedValue.toString()); - }); - - // bloodDetails. - }, + // bloodDetails. + }, + ), ), ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: 175, - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 2 ? Colors.white : Colors.black, - color: checkedValue == 2 ? Colors.red : Colors.white, - label: "Female", - // - onTap: () { - setState(() { - checkedValue = 2; - print("checkedValue=" + checkedValue.toString()); - }); - // bloodDetails.city=_selectedHospital.toString(); + Expanded( + child: Container( + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 2 ? Colors.white : Colors.black, + color: checkedValue == 2 ? Colors.red : Colors.white, + label: TranslationBase.of(context).female, + // + onTap: () { + setState(() { + checkedValue = 2; + print("checkedValue=" + checkedValue.toString()); + }); + // bloodDetails.city=_selectedHospital.toString(); - // bloodDetails. - }, + // bloodDetails. + }, + ), ), ) ], @@ -193,7 +191,7 @@ class _AddNewChildPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Date Of Birth::", + TranslationBase.of(context).dob, textAlign: TextAlign.end, ), ], @@ -249,29 +247,29 @@ class _AddNewChildPageState extends State { color: checkedValue == false ? Colors.white24 : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: "Add", + 63, + 72, + 74, + 1, + ), + label: TranslationBase.of(context).add, // - onTap: () async{ - newChild.babyName = _firstTextController.text + " " + _secondTextController.text; + onTap: () async { + newChild.babyName = _firstTextController.text + + " " + + _secondTextController.text; newChild.gender = checkedValue.toString(); newChild.strDOB = getStartDay(); newChild.tempValue = true; newChild.isLogin = true; await model.createNewBabyOrders(newChild: newChild); - if(model.isAdded){ - AppToast.showSuccessToast(message: "Record Added"); - Navigator.pop(context,model.isAdded); - }else{ - + if (model.isAdded) { + AppToast.showSuccessToast(message: TranslationBase.of(context).childAddedSuccessfully); + Navigator.pop(context, model.isAdded); + } else { //TODO handling error } - }, ), ), @@ -280,7 +278,7 @@ class _AddNewChildPageState extends State { ), ), ), - // bottomSheet: + // bottomSheet: ), ); } diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart index 806a5b71..ae33cc03 100644 --- a/lib/pages/ChildVaccines/child_page.dart +++ b/lib/pages/ChildVaccines/child_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart' import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -22,30 +23,51 @@ class ChildPage extends StatefulWidget { class _ChildPageState extends State with SingleTickerProviderStateMixin { - DeleteBaby deleteBaby = DeleteBaby(); @override Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double height = (size.height - kToolbarHeight - 60); + final double itemWidth = size.width / 2; + final double itemHeight = height / 2 + 40; + var checkedValue = true; return BaseView( onModelReady: (model) => model.getNewUserOrders(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: " Vaccination", + appBarTitle: TranslationBase.of(context).vaccination, baseViewModel: model, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 15, right: 15, top: 70), - child: Column( - children: [ - ...List.generate( + body: Container( + height: height * 0.85, + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 16), + child: GridView.count( + crossAxisCount: 2, + childAspectRatio: (itemWidth / (itemHeight + 0)), + crossAxisSpacing: 10, + mainAxisSpacing: 10, + controller: ScrollController(keepScrollOffset: true), + shrinkWrap: true, + padding: const EdgeInsets.all(4.0), + children: [ + ...List.generate( model.babyInformationModelList.length, - (index) => Container( - margin: EdgeInsets.only( - left: 0, right: 0, bottom: 20), - - decoration: BoxDecoration( + (index) => InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage(model.babyInformationModelList[index]), + ), + ); + }, + child: Container( + margin: EdgeInsets.only( + left: 0, right: 0, bottom: 20), + decoration: BoxDecoration( shape: BoxShape.rectangle, border: Border.all( color: Colors.white, width: 0.5), @@ -54,11 +76,12 @@ class _ChildPageState extends State color: Colors.white, ), padding: EdgeInsets.all(12), - width: 200,//double.infinity, + //double.infinity, child: Column( children: [ Row(children: [ - Texts("CHILD NAME"), + Texts(TranslationBase.of(context) + .childName), ]), Row(children: [ Texts(model @@ -96,19 +119,14 @@ class _ChildPageState extends State Navigator.push( context, FadePage( - - - page: VaccinationTablePage(), - - + page: VaccinationTablePage(model.babyInformationModelList[index]), ), ); - }, ) ]), Row(children: [ - Texts("Birthday"), + Texts(TranslationBase.of(context).dob), ]), Row(children: [ IconButton( @@ -116,9 +134,7 @@ class _ChildPageState extends State 'assets/images/new-design/calender-secondary.png'), tooltip: '', onPressed: () { - setState(() { - - }); + setState(() {}); }, ), Texts(DateUtil.yearMonthDay(model @@ -130,73 +146,71 @@ class _ChildPageState extends State icon: new Image.asset( 'assets/images/new-design/garbage.png'), tooltip: '', - onPressed: ()async { - + onPressed: () async { //===================== - await model.deleteBabyOrders(newChild:deleteBaby ); - + await model.deleteBabyOrders( + newChild: deleteBaby); - deleteBaby.babyID=model.babyInformationModelList[index] + deleteBaby.babyID = model + .babyInformationModelList[index] .babyID; - await model.deleteBabyOrders(newChild:deleteBaby ); - if(model.isDeleted){ - AppToast.showSuccessToast(message: "Record Deleted"); - Navigator.pop(context,model.isDeleted); - }else{ - - //TODO handling error - } - - - - - + await model.deleteBabyOrders( + newChild: deleteBaby); + if (model.isDeleted) { + AppToast.showSuccessToast( + message: + TranslationBase.of(context) + .recordDeleted); + Navigator.pop( + context, model.isDeleted); + } else { + //TODO handling error + } }, ), - Texts("Delete"), + Texts(TranslationBase.of(context) + .deleteView), ]), SizedBox( height: 12, ), ], ), - + ), ), - - - ) - ], - )) + ) + ], + ))), ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: "ADD NEW CHILD ", - // - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AddNewChildPage(), - ), - ).then((value) { - if (value) model.getNewUserOrders(); - }); - }, - ), + bottomSheet: Container( + height: height * 0.15, + width: double.infinity, + padding: EdgeInsets.all(16), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, ), + label: TranslationBase.of(context).addNewChild, + // + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddNewChildPage(), + ), + ).then((value) { + if (value) model.getNewUserOrders(); + }); + }, + ), + ), )); } } diff --git a/lib/pages/ChildVaccines/child_vaccines_page.dart b/lib/pages/ChildVaccines/child_vaccines_page.dart index 92f3a0be..38c6b5af 100644 --- a/lib/pages/ChildVaccines/child_vaccines_page.dart +++ b/lib/pages/ChildVaccines/child_vaccines_page.dart @@ -1,10 +1,10 @@ - import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; @@ -13,214 +13,218 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - - class ChildVaccinesPage extends StatefulWidget { @override _ChildVaccinesPageState createState() => _ChildVaccinesPageState(); } class _ChildVaccinesPageState extends State - with SingleTickerProviderStateMixin{ + with SingleTickerProviderStateMixin { TextEditingController titleController = TextEditingController(); - var checkedValue=false; - String addEmail=""; + var checkedValue = false; + String addEmail = ""; + @override Widget build(BuildContext context) { - return BaseView( onModelReady: (model) => model.getUserInformationRequestOrders(), builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - baseViewModel: model, - appBarTitle: " Vaccination",//TranslationBase.of(context).advancePayment, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - SizedBox( - height: 20, - ), - - Padding( - padding: const EdgeInsets.all(10.0), - child:Container( - child: Texts("Welcome back",fontSize: 20,), - ) , - ), - Divider(color:Colors.black , indent: 10, - endIndent: 10,), - SizedBox( - height: 20, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child:Container( - child: Texts("Please ensure that the email address is up-to-date and process to view the schedule",fontSize: 20,), - ) , + isShowAppBar: true, + baseViewModel: model, + appBarTitle: TranslationBase.of(context).vaccination, + //TranslationBase.of(context).advancePayment, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + child: Texts( + TranslationBase.of(context).welcomeBack, + fontSize: 20, ), - - Divider(color:Colors.black , indent: 10, - endIndent: 10,), - Padding( - padding: const EdgeInsets.all(10.0), - child:Container( - - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - fillColor: Colors.red, - - hintText: model.user.emailAddress, - controller: titleController, - fontSize: 20, - hintColor: Colors.black, - fontWeight: FontWeight.w600, - onChanged: (text) { - addEmail=text; - model.user.emailAddress==addEmail?checkedValue=false:checkedValue=true; - - - }, - validator: (value) { - - if (value == null) - { - return model.user.emailAddress; - - } - else - - { - return model.user.emailAddress;} - }, - ), - ), + ), + ), + Divider( + color: Colors.black, + indent: 10, + endIndent: 10, + ), + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + child: Texts( + TranslationBase.of(context).msg_email_address_up_to_date, + fontSize: 20, ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), - label: "UPDATE EMAIL", - // - onTap: (){ - model.user.emailAddress=addEmail.toString(); - AppToast.showSuccessToast( - message: "Email updated"); - // bloodDetails.city=_selectedHospital.toString(); - - // bloodDetails. - }, - + ), + ), - ), + Divider( + color: Colors.black, + indent: 10, + endIndent: 10, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + fillColor: Colors.red, + hintText: model.user.emailAddress, + controller: titleController, + fontSize: 20, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + onChanged: (text) { + addEmail = text; + model.user.emailAddress == addEmail + ? checkedValue = false + : checkedValue = true; + }, + validator: (value) { + if (value == null) { + return model.user.emailAddress; + } else { + return model.user.emailAddress; + } + }, ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: Color.fromRGBO(63, 72, 74, 1,), - label: " VIEW LIST OF CHILDREN", - // - onTap: () => Navigator.push( - context, - FadePage( - page: ChildPage(), - - - - ), + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + padding: EdgeInsets.all(15), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, ), - - - ), - ), - - // Texts( - // // TranslationBase.of(context).advancePaymentLabel, - // model.user.emailAddress, - // textAlign: TextAlign.center, - // ), - SizedBox( - height: 12, - ), - SizedBox( - height: 12, - ), - SizedBox( - height: 12, + label: TranslationBase.of(context).updateEmail, + // + onTap: () { + model.user.emailAddress = addEmail.toString(); + AppToast.showSuccessToast( + message: TranslationBase.of(context).updateEmailMsg); + // bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + padding: EdgeInsets.all(15), + child: SecondaryButton( + textColor: Colors.white, + color: Color.fromRGBO( + 63, + 72, + 74, + 1, ), - - SizedBox( - height: 12, + label: TranslationBase.of(context).viewListChildren, + // + onTap: () => Navigator.push( + context, + FadePage( + page: ChildPage(), + ), ), + ), + ), - SizedBox( - height: 12, - ), + // Texts( + // // TranslationBase.of(context).advancePaymentLabel, + // model.user.emailAddress, + // textAlign: TextAlign.center, + // ), + SizedBox( + height: 12, + ), + SizedBox( + height: 12, + ), + SizedBox( + height: 12, + ), - SizedBox( - height: 10, - ), - // Row( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.center, - // children: [ - // Center( - // child: Container( - // color: Colors.white, - // width: 350, - // child: InkWell( - // onTap: () { - // showDialog( - // context: context, - // builder: (_) => - // AssetGiffyDialog( - // title: Text( - // "", - // style: TextStyle( - // fontSize: 22.0, - // fontWeight: - // FontWeight - // .w600), - // ), - // image: Image.asset( - // 'assets/images/BloodChrt_EN.png'), - // buttonCancelText: - // Text('cancel'), - // buttonCancelColor: - // Colors.grey, - // onlyCancelButton: true, - // )); - // }, - // child: Container( - // width: 250, - // height: 200, - // child:Image.asset( - // 'assets/images/BloodChrt_EN.png')), - // ), - // ), - // ), - // ], - // ), + SizedBox( + height: 12, + ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + SizedBox( + height: 12, ), + SizedBox( + height: 10, + ), + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Center( + // child: Container( + // color: Colors.white, + // width: 350, + // child: InkWell( + // onTap: () { + // showDialog( + // context: context, + // builder: (_) => + // AssetGiffyDialog( + // title: Text( + // "", + // style: TextStyle( + // fontSize: 22.0, + // fontWeight: + // FontWeight + // .w600), + // ), + // image: Image.asset( + // 'assets/images/BloodChrt_EN.png'), + // buttonCancelText: + // Text('cancel'), + // buttonCancelColor: + // Colors.grey, + // onlyCancelButton: true, + // )); + // }, + // child: Container( + // width: 250, + // height: 200, + // child:Image.asset( + // 'assets/images/BloodChrt_EN.png')), + // ), + // ), + // ), + // ], + // ), + + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], ), - ), + ), + ), ); } } - diff --git a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart index 259bbdb7..c08749b8 100644 --- a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart +++ b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart @@ -7,8 +7,11 @@ import 'package:flutter/material.dart'; class SelectGenderDialog extends StatefulWidget { final Email; + final Function okFunction; + + const SelectGenderDialog({Key key, this.Email, this.okFunction}) + : super(key: key); - const SelectGenderDialog({Key key, this.Email}) : super(key: key); @override _SelectGenderDialogState createState() => _SelectGenderDialogState(); } @@ -33,9 +36,8 @@ class _SelectGenderDialogState extends State { }); }, child: ListTile( - title: Text("Send the child's schedule to the email\n Tamer.dasdasdas@gmail.com "), - - + title: Text( + "${TranslationBase.of(context).sendChildEmailMsg}\n Tamer.dasdasdas@gmail.com "), ), ), ) @@ -44,7 +46,6 @@ class _SelectGenderDialogState extends State { SizedBox( height: 5.0, ), - SizedBox( height: 5.0, ), @@ -82,7 +83,7 @@ class _SelectGenderDialogState extends State { flex: 1, child: InkWell( onTap: () { - AppToast.showSuccessToast(message: "Email Sended"); + widget.okFunction(); // widget.onValueSelected(beneficiaryType); Navigator.pop(context); }, @@ -105,7 +106,4 @@ class _SelectGenderDialogState extends State { ], ); } - - - } diff --git a/lib/pages/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart index c160acfb..7b8499e0 100644 --- a/lib/pages/ChildVaccines/vaccinationtable_page.dart +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -1,8 +1,13 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -12,91 +17,161 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'dialogs/SelectGenderDialog.dart'; class VaccinationTablePage extends StatelessWidget { + final List_BabyInformationModel babyInfo; + + VaccinationTablePage(this.babyInfo); + @override Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double height = (size.height - kToolbarHeight - 60); + var checkedValue; return BaseView( - onModelReady: (model) => model.getCreateVaccinationTable(),//getUserTermsAndConditions(), + onModelReady: (model) => model.getCreateVaccinationTable(babyInfo, false), builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, - appBarTitle: "Vaccination", - body: SingleChildScrollView( - child:Container( - margin: EdgeInsets.only(left: 15,right: 15,top: 70), - child: Column( - children: [//babyInformationModelList.length - ...List.generate(model.creteVaccinationTableModelList.length, (index) => - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.white, - - ), - padding: EdgeInsets.all(12), - width: double.infinity, - child: Column( - - children: [ - Row(children: [ - Text(model.creteVaccinationTableModelList[index].visit), - SizedBox(width: 10,), - - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Html( - // data:"
BCG
HEPATITIS B
"//model.creteVaccinationTableModelList[index].vaccinesDescription - data:model.creteVaccinationTableModelList[index].vaccinesDescription, - - ), - ],), - ), - Text(model.creteVaccinationTableModelList[index].givenAt), - - - ],), - Divider(color:Colors.black ,), - - ], - ) - - - ) - - ) - ], + appBarTitle: TranslationBase.of(context).vaccination, + body: Container( + height: height * 0.85, + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 16, right: 16, top: 16), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Texts(TranslationBase.of(context).childName), + ), + Expanded( + child: Texts(TranslationBase.of(context).dob), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( + child: Texts(babyInfo.babyName), + ), + Expanded( + child: Texts(DateUtil.getFormattedDate( + babyInfo.dOB, "MMM dd,yyyy")), + ), + ], + ), + SizedBox( + height: 10, + ), + Divider( + color: Colors.black, + ), + Row( + children: [ + Text(TranslationBase.of(context).visit), + SizedBox( + width: 25, + ), + Expanded( + child: Text(TranslationBase.of(context).description)), + Text(TranslationBase.of(context).dueDate), + ], + ), + ...List.generate( + model.creteVaccinationTableModelList.length, + (index) => Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + // border: Border.all(color: Colors.white, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(5)), + // color: Colors.white, + ), + padding: EdgeInsets.all(12), + width: double.infinity, + child: Column( + children: [ + Row( + children: [ + Text(model + .creteVaccinationTableModelList[index] + .visit), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Html( + // data:"
BCG
HEPATITIS B
"//model.creteVaccinationTableModelList[index].vaccinesDescription + data: model + .creteVaccinationTableModelList[ + index] + .vaccinesDescription, + ), + ], + ), + ), + Text(model + .creteVaccinationTableModelList[index] + .givenAt), + ], + ), + Divider( + color: Colors.black, + ), + ], + ))) + ], + ), ), - + ), ), - ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.12, + height: height * 0.15, width: double.infinity, - padding: EdgeInsets.all(12), child: SecondaryButton( - textColor: Colors.white, - color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), - label: "Send Email ", - // - onTap: () { - //SelectGenderDialog(); + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: TranslationBase.of(context).sendEmail, + // + onTap: () { + //SelectGenderDialog(); //=============== - showDialog( - context: context, - child: SelectGenderDialog( - ), - ); - //========= - } - - - ), + showDialog( + context: context, + child: SelectGenderDialog( + okFunction: () async { + await model.getCreateVaccinationTable(babyInfo, true); + if (model.state == ViewState.Idle) { + AppToast.showSuccessToast( + message: TranslationBase.of(context) + .emailSentSuccessfully); + } else { + AppToast.showErrorToast( + message: TranslationBase.of(context) + .EmailSentError); + } + }, + ), + ); + //========= + }), ), ), ); diff --git a/lib/pages/ContactUs/findus/findus_page.dart b/lib/pages/ContactUs/findus/findus_page.dart index 5cf59e21..80648292 100644 --- a/lib/pages/ContactUs/findus/findus_page.dart +++ b/lib/pages/ContactUs/findus/findus_page.dart @@ -78,10 +78,7 @@ class _FindUsPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.tab, - - indicatorColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), diff --git a/lib/pages/ContactUs/widgets/card_common_contat.dart b/lib/pages/ContactUs/widgets/card_common_contat.dart index cfb9108b..8848e2ff 100644 --- a/lib/pages/ContactUs/widgets/card_common_contat.dart +++ b/lib/pages/ContactUs/widgets/card_common_contat.dart @@ -7,6 +7,8 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../Constants.dart'; + class CardCommonContact extends StatelessWidget { final image; final text; @@ -37,7 +39,7 @@ class CardCommonContact extends StatelessWidget { margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Texts(this.text, // overflow: TextOverflow.clip, - color:Theme.of(context).primaryColor, + color:secondaryColor, fontWeight: FontWeight.w700, fontSize: 20.0), ), diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 3e58b657..f21a9718 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.da import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -469,9 +470,7 @@ class _CovidTimeSlotsState extends State } bookCovidTestAppointment() { -// Navigator.push(context, -// MaterialPageRoute(builder: (context) => CovidPaymentAlert())); - + GifLoaderDialogUtils.showMyDialog(context); DoctorList docObject = new DoctorList(); docObject.doctorID = widget.selectedDoctorID; docObject.clinicID = widget.selectedClinicID; @@ -494,11 +493,12 @@ class _CovidTimeSlotsState extends State print(res); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Appointment Booked Successfully"); - Future.delayed(new Duration(milliseconds: 1800), () { - getPatientShare(context, res['AppointmentNo'], docObject.clinicID, - docObject.projectID, docObject); - }); + // Future.delayed(new Duration(milliseconds: 1800), () { + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, + docObject.projectID, docObject); + // }); } else { + GifLoaderDialogUtils.hideDialog(context); appo = new AppoitmentAllHistoryResultList(); appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; @@ -529,14 +529,16 @@ class _CovidTimeSlotsState extends State cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); ConfirmDialog.closeAlertDialog(context); DoctorsListService service = new DoctorsListService(); service.cancelAppointment(appo, context).then((res) { if (res['MessageStatus'] == 1) { - Future.delayed(new Duration(milliseconds: 1500), () { - insertAppointmentCovidTest(context, docObject); - }); + // Future.delayed(new Duration(milliseconds: 1500), () { + insertAppointmentCovidTest(context, docObject); + // }); } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { @@ -592,6 +594,7 @@ class _CovidTimeSlotsState extends State }); } else {} } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 2d7e4270..5a2247e5 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -58,6 +59,8 @@ class _MyFamily extends State with TickerProviderStateMixin { ProjectViewModel projectViewModel; AuthenticatedUser user; VitalSignService _vitalSignService = locator(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); + var isVaiable = false; @override void initState() { @@ -728,6 +731,12 @@ class _MyFamily extends State with TickerProviderStateMixin { authenticatedUserObject.user; Provider.of(context, listen: false) .setUser(authenticatedUserObject.user); + + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + if(pharmacyModuleViewModel.error.isNotEmpty) + await pharmacyModuleViewModel.createUser(); + }); + appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index 1690254a..1d4e78ee 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -79,7 +79,7 @@ class _AmbulanceReqState extends State child: Container( height: 60.0, margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.93, + width: MediaQuery.of(context).size.width * 0.90, decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -93,7 +93,6 @@ class _AmbulanceReqState extends State controller: _tabController, indicatorWeight: 5.0, indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), @@ -108,7 +107,7 @@ class _AmbulanceReqState extends State Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: Texts("Orders Log"), + child: Texts(TranslationBase.of(context).ordersLog), ), ), ], diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index 5f303846..1fb47cec 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -62,18 +62,18 @@ class _AmbulanceRequestIndexPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ OrderLogItem( - title: 'Request ID', + title: TranslationBase.of(context).reqId, value: widget.amRequestViewModel.pickUpRequestPresOrder .presOrderID .toString(), ), OrderLogItem( - title: 'Status', + title: TranslationBase.of(context).status, value: widget.amRequestViewModel.pickUpRequestPresOrder .ambulateDescription, ), OrderLogItem( - title: 'Last edit time', + title: TranslationBase.of(context).pickupDate, value: DateUtil.getDayMonthYearDateFormatted( DateUtil.convertStringToDate(widget .amRequestViewModel @@ -81,17 +81,17 @@ class _AmbulanceRequestIndexPageState extends State { .lastEditDate)), ), OrderLogItem( - title: 'Pickup Location', + title: TranslationBase.of(context).pickupLocation, value: widget.amRequestViewModel.pickUpRequestPresOrder .pickupLocationName, ), OrderLogItem( - title: 'Drop off Location', + title: TranslationBase.of(context).dropoffLocation, value: widget.amRequestViewModel.pickUpRequestPresOrder .dropoffLocationName, ), OrderLogItem( - title: 'Trasfaer way', + title: TranslationBase.of(context).transportMethod, value: widget .amRequestViewModel.pickUpRequestPresOrder.title, ), diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart index cc6af0f2..051f672e 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart @@ -2,8 +2,10 @@ import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -44,306 +46,309 @@ class _BillAmountState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Bill Amount '), - SizedBox( - height: 10, - ), - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 1.0, color: Colors.grey[300]), - outside: BorderSide(width: 1.0, color: Colors.grey[300])), - children: [ - TableRow( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + return AppScaffold( + isShowDecPage: false, + isShowAppBar: false, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).billAmount), + SizedBox( + height: 10, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 1.0, color: Colors.grey[300]), + outside: BorderSide(width: 1.0, color: Colors.grey[300])), + children: [ + TableRow( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), + ), ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - 'Amount before tax: ', - textAlign: TextAlign.start, - color: Colors.black, - fontSize: 15, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).patientShareB, + textAlign: TextAlign.start, + color: Colors.black, + fontSize: 15, + ), ), ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(10.0), + ), ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - 'SR ${widget.patientER.patientERTransportationMethod.price}', - color: Colors.black, - textAlign: TextAlign.start, - fontSize: 15, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.price}', + color: Colors.black, + textAlign: TextAlign.start, + fontSize: 15, + ), ), ), - ), - ], - ), - TableRow( - children: [ - Container( - color: Colors.white, - height: MediaQuery.of(context).size.height * 0.09, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - 'Tax amount :', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - color: Colors.white, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - 'SR ${widget.patientER.patientERTransportationMethod.vAT}', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, + ], + ), + TableRow( + children: [ + Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.09, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).patientShareTax, + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), ), ), - ), - ], - ), - TableRow( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( + Container( + height: MediaQuery.of(context).size.height * 0.09, color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(10.0), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.vAT}', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), ), ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - 'Total amount payable', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - bold: true, + ], + ), + TableRow( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(10.0), + ), ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10.0), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).patientShareTotal, + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + bold: true, + ), ), ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - 'SR ${widget.patientER.patientERTransportationMethod.totalPrice}', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10.0), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.totalPrice}', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), ), ), - ), - ], - ), - ], - ), - SizedBox( - height: 10, - ), - Texts('Select Ambulate',bold: true,), - SizedBox(height: 5,), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Wheelchair; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('Wheelchair'), - leading: Radio( - value: Ambulate.Wheelchair, - groupValue: _ambulate, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Texts(TranslationBase.of(context).selectAmbulate,bold: true,), + SizedBox(height: 5,), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Wheelchair; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text(TranslationBase.of(context).wheelchair), + leading: Radio( + value: Ambulate.Wheelchair, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Walker; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('Walker'), - leading: Radio( - value: Ambulate.Walker, - groupValue: _ambulate, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Walker; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text(TranslationBase.of(context).walker), + leading: Radio( + value: Ambulate.Walker, + groupValue: _ambulate, + + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), ), ), ), ), - ), - ], - ), - SizedBox(height: 5,), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Stretcher; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('Stretcher'), - leading: Radio( - value: Ambulate.Stretcher, - groupValue: _ambulate, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, + ], + ), + SizedBox(height: 5,), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Stretcher; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text(TranslationBase.of(context).stretcher), + leading: Radio( + value: Ambulate.Stretcher, + groupValue: _ambulate, + + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.None; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('None'), - leading: Radio( - value: Ambulate.None, - groupValue: _ambulate, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.None; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text(TranslationBase.of(context).none), + leading: Radio( + value: Ambulate.None, + groupValue: _ambulate, + + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), ), ), ), ), - ), - ], - ), - SizedBox(height: 12,), - NewTextFields( - hintText: 'Note', - initialValue: note, - onChanged: (value){ - setState(() { - note = value; - }); - }, - ), - - SizedBox( - height: 15, - ), - Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 76, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { + ], + ), + SizedBox(height: 12,), + NewTextFields( + hintText: TranslationBase.of(context).notes, + initialValue: note, + onChanged: (value){ setState(() { - widget.patientER.ambulate = _ambulate; - widget.patientER.requesterNote = note; - widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); - widget.changeCurrentTab(3); + note = value; }); }, - label: 'Next', ), - ) - ], + + SizedBox( + height: 15, + ), + ], + ), + ), + ), + bottomSheet: Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 90, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientER.ambulate = _ambulate; + widget.patientER.requesterNote = note; + widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); + widget.changeCurrentTab(3); + }); + }, + label: TranslationBase.of(context).next, ), ), ); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index b99596c8..1ea0f7f5 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -5,22 +5,20 @@ import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.da import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/Blood/dialogs/SelectHospitalDialog.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart'; -import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -import '../AmbulanceReq.dart'; import '../AvailableAppointmentsPage.dart'; enum HaveAppointment { YES, NO } @@ -67,370 +65,397 @@ class _PickupLocationState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (widget.patientER.direction == 1) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Pickup Location'), - SizedBox( - height: 15, - ), - InkWell( - onTap: (){ - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, - onPick: (value) { + return AppScaffold( + isShowAppBar: false, + isShowDecPage: false, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.patientER.direction == 1) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).pickupLocation), + SizedBox( + height: 15, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + ), + ), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Texts(getSelectFromMapName(context))), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).pickupSpot), + SizedBox( + height: 5, + ), + InkWell( + onTap: () { + setState(() { + _isInsideHome = !_isInsideHome; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts(TranslationBase.of(context).insideHome), + leading: Checkbox( + value: _isInsideHome, + onChanged: (value) { setState(() { - _result = value; + _isInsideHome = value; }); }, ), ), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getSelectFromMapName()), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) - ], ), ), - ), - SizedBox( - height: 12, - ), - Texts('Pickup Spot'), - SizedBox( - height: 5, - ), - InkWell( - onTap: () { - setState(() { - _isInsideHome = !_isInsideHome; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Texts('Inside Home'), - leading: Checkbox( - activeColor: Colors.red[800], - value: _isInsideHome, - onChanged: (value) { - setState(() { - _isInsideHome = value; - }); - }, - ), - ), + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).haveAppo), + SizedBox( + height: 5, ), - ), - SizedBox( - height: 12, - ), - Texts('Do you have an appointment ?'), - SizedBox( - height: 5, - ), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - if (myAppointment == null) { - getAppointment(); + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = HaveAppointment.YES; + }); + } + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts(TranslationBase.of(context).yes), + leading: Radio( + value: HaveAppointment.YES, + groupValue: _haveAppointment, + onChanged: (value) { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = value; + }); + } + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { setState(() { - _haveAppointment = HaveAppointment.YES; + _haveAppointment = HaveAppointment.NO; + myAppointment = null; }); - } - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('Yes'), - leading: Radio( - value: HaveAppointment.YES, - groupValue: _haveAppointment, - activeColor: Colors.red[800], - onChanged: (value) { - if (myAppointment == null) { - getAppointment(); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts(TranslationBase.of(context).no), + leading: Radio( + value: HaveAppointment.NO, + groupValue: _haveAppointment, + onChanged: (value) { setState(() { _haveAppointment = value; + myAppointment = null; }); - } - }, + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _haveAppointment = HaveAppointment.NO; - myAppointment = null; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('No'), - leading: Radio( - value: HaveAppointment.NO, - groupValue: _haveAppointment, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _haveAppointment = value; - myAppointment = null; - }); - }, - ), - ), - ), - ), - ), - ], - ), - if (myAppointment != null) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - AppointmentCard( - appointment: myAppointment, - ) ], ), - SizedBox( - height: 12, - ), - Texts('Drop off Location'), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectHospitalDialog( - widget.amRequestViewModel.hospitals); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + if (myAppointment != null) + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(getHospitalName('Pickup Location')), - Icon( - Icons.arrow_drop_down, - size: 24, - color: Colors.black, + SizedBox( + height: 12, + ), + AppointmentCard( + appointment: myAppointment, ) ], ), + SizedBox( + height: 12, ), - ), - ], - ), - if (widget.patientER.direction == 0) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Pickup Location'), - SizedBox( - height: 15, - ), - InkWell( - onTap: () { - confirmSelectHospitalDialog( - widget.amRequestViewModel.hospitals); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Texts(TranslationBase.of(context).dropoffLocation), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectHospitalDialog( + widget.amRequestViewModel.hospitals); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName( + TranslationBase.of(context).pickupLocation)), + Icon( + Icons.arrow_drop_down, + size: 24, + color: Colors.black, + ) + ], + ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getHospitalName('Pickup Location')), - Icon( - Icons.arrow_drop_down, - size: 24, - color: Colors.black, - ) - ], + ), + ], + ), + if (widget.patientER.direction == 0) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).pickupLocation), + SizedBox( + height: 15, + ), + InkWell( + onTap: () { + confirmSelectHospitalDialog( + widget.amRequestViewModel.hospitals); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName( + TranslationBase.of(context).pickupLocation)), + Icon( + Icons.arrow_drop_down, + size: 24, + color: Colors.black, + ) + ], + ), ), ), - ), - SizedBox( - height: 12, - ), - Texts('Drop off Location'), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, - onPick: (value) { - setState(() { - _result = value; - }); - }, + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).dropoffLocation), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Texts(getSelectFromMapName(context))), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], ), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getSelectFromMapName()), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) - ], ), ), - ), - ], + ], + ), + SizedBox( + height: 45, ), - SizedBox( - height: 45, - ), - Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 76, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - if (_result == null || _selectedHospital == null) - AppToast.showErrorToast( - message: 'please select all fields'); - else - setState(() { - widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; - if (widget.patientER.direction == 0) { - widget.patientER.pickupLocationLattitude = _result.geometry.location.lat.toString(); - widget.patientER.pickupLocationLongitude = _result.geometry.location.lng.toString(); - widget.patientER.dropoffLocationLattitude = _selectedHospital.latitude; - widget.patientER.dropoffLocationLongitude = _selectedHospital.longitude; - } else { - widget.patientER.pickupLocationLattitude = _selectedHospital.latitude; - widget.patientER.pickupLocationLongitude = _selectedHospital.longitude; - widget.patientER.dropoffLocationLattitude = _result.geometry.location.lat.toString(); - widget.patientER.dropoffLocationLongitude = _result.geometry.location.lng.toString(); - } + ], + ), + ), + ), + bottomSheet: Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 90, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + if (_result == null || _selectedHospital == null) + AppToast.showErrorToast( + message: TranslationBase.of(context).selectAll); + else + setState(() { + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + if (widget.patientER.direction == 0) { + widget.patientER.pickupLocationLattitude = + _result.geometry.location.lat.toString(); + widget.patientER.pickupLocationLongitude = + _result.geometry.location.lng.toString(); + widget.patientER.dropoffLocationLattitude = + _selectedHospital.latitude; + widget.patientER.dropoffLocationLongitude = + _selectedHospital.longitude; + } else { + widget.patientER.pickupLocationLattitude = + _selectedHospital.latitude; + widget.patientER.pickupLocationLongitude = + _selectedHospital.longitude; + widget.patientER.dropoffLocationLattitude = + _result.geometry.location.lat.toString(); + widget.patientER.dropoffLocationLongitude = + _result.geometry.location.lng.toString(); + } - widget.patientER.latitude = widget.patientER.pickupLocationLattitude; - widget.patientER.longitude = widget.patientER.pickupLocationLongitude; - widget.patientER.dropoffLocationName = _selectedHospital.name; - widget.patientER.createdBy = widget.amRequestViewModel.user.patientID; - widget.patientER.isOutPatient = widget.amRequestViewModel.user.outSA; - widget.patientER.patientIdentificationID = widget.amRequestViewModel.user.patientIdentificationNo; - widget.patientER.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now()); - widget.patientER.pickupLocationName = _result.formattedAddress; - widget.patientER.projectID = widget.amRequestViewModel.user.projectID; - widget.patientER.requesterFileNo = widget.amRequestViewModel.user.patientID; - widget.patientER.requesterIsOutSA = false; - widget.patientER.lineItemNo =0; - widget.patientER.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber; + widget.patientER.latitude = + widget.patientER.pickupLocationLattitude; + widget.patientER.longitude = + widget.patientER.pickupLocationLongitude; + widget.patientER.dropoffLocationName = + _selectedHospital.name; + widget.patientER.createdBy = + widget.amRequestViewModel.user.patientID; + widget.patientER.isOutPatient = + widget.amRequestViewModel.user.outSA; + widget.patientER.patientIdentificationID = widget + .amRequestViewModel.user.patientIdentificationNo; + widget.patientER.pickupDateTime = + DateUtil.convertDateToStringLocation(DateTime.now()); + widget.patientER.pickupLocationName = + _result.formattedAddress; + widget.patientER.projectID = + widget.amRequestViewModel.user.projectID; + widget.patientER.requesterFileNo = + widget.amRequestViewModel.user.patientID; + widget.patientER.requesterIsOutSA = false; + widget.patientER.lineItemNo = 0; + widget.patientER.requesterMobileNo = + widget.amRequestViewModel.user.mobileNumber; - if (_haveAppointment == HaveAppointment.YES) { - widget.patientER.appointmentNo = myAppointment.appointmentNo.toString(); - widget.patientER.appointmentClinicName = myAppointment.clinicName; - widget.patientER.appointmentDoctorName = myAppointment.doctorNameObj; - widget.patientER.appointmentBranch = myAppointment.projectName; - widget.patientER.appointmentTime = myAppointment.appointmentDate; - widget.patientER.haveAppointment = true; - } else { - widget.patientER.appointmentNo = "0"; - widget.patientER.appointmentClinicName = null; - widget.patientER.appointmentDoctorName = null; - widget.patientER.appointmentBranch = null; - widget.patientER.appointmentTime = null; - widget.patientER.haveAppointment = false; - } + if (_haveAppointment == HaveAppointment.YES) { + widget.patientER.appointmentNo = + myAppointment.appointmentNo.toString(); + widget.patientER.appointmentClinicName = + myAppointment.clinicName; + widget.patientER.appointmentDoctorName = + myAppointment.doctorNameObj; + widget.patientER.appointmentBranch = + myAppointment.projectName; + widget.patientER.appointmentTime = + myAppointment.appointmentDate; + widget.patientER.haveAppointment = true; + } else { + widget.patientER.appointmentNo = "0"; + widget.patientER.appointmentClinicName = null; + widget.patientER.appointmentDoctorName = null; + widget.patientER.appointmentBranch = null; + widget.patientER.appointmentTime = null; + widget.patientER.haveAppointment = false; + } - widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; - widget.changeCurrentTab(2); - }); - }, - label: 'Next', - ), - ) - ], + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + widget.changeCurrentTab(2); + }); + }, + label: TranslationBase.of(context).next, ), ), ); @@ -455,12 +480,14 @@ class _PickupLocationState extends State { return _selectedHospital == null ? title : _selectedHospital.name; } - String getSelectFromMapName() { - return _result != null ? _result.formattedAddress : 'Select From Map'; + String getSelectFromMapName(context) { + return _result != null + ? _result.formattedAddress + : TranslationBase.of(context).selectMap; } getAppointment() { - ProgressDialogUtil.showProgressDialog(context); + GifLoaderDialogUtils.showMyDialog(context); widget.amRequestViewModel.getAppointmentHistory().then((value) { if (widget.amRequestViewModel.state == ViewState.Error || widget.amRequestViewModel.state == ViewState.ErrorLocal) { @@ -468,7 +495,7 @@ class _PickupLocationState extends State { } else if (widget .amRequestViewModel.appoitmentAllHistoryResultList.length > 0) { - ProgressDialogUtil.hideProgressDialog(context); + GifLoaderDialogUtils.hideDialog(context); Navigator.push( context, MaterialPageRoute( @@ -490,14 +517,15 @@ class _PickupLocationState extends State { } }); } else { - ProgressDialogUtil.hideProgressDialog(context); + GifLoaderDialogUtils.hideDialog(context); setState(() { _haveAppointment = HaveAppointment.NO; }); - AppToast.showErrorToast(message: 'You don\'t have any appointment'); + AppToast.showErrorToast( + message: TranslationBase.of(context).noAppointment); } }).catchError((e) { - ProgressDialogUtil.hideProgressDialog(context); + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: e); }); } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart index 01683b55..0770448e 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -1,14 +1,15 @@ import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; -import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; -import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; -import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; enum Direction { ToHospital, FromHospital } enum Way { OneWay, TwoWays } @@ -57,251 +58,267 @@ class _SelectTransportationMethodState @override Widget build(BuildContext context) { - return SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Texts('Select Transportation Method'), - ...List.generate( - widget.amRequestViewModel.amRequestModeList.length, - (index) => InkWell( - onTap: () { - setState(() { - _erTransportationMethod = - widget.amRequestViewModel.amRequestModeList[index]; - }); - }, - child: Container( - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - children: [ - Expanded( - flex: 3, - child: ListTile( - title: Text(widget.amRequestViewModel - .amRequestModeList[index].title), - leading: Radio( - value: widget - .amRequestViewModel.amRequestModeList[index], - groupValue: _erTransportationMethod, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _erTransportationMethod = value; - }); - }, + ProjectViewModel projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: false, + isShowDecPage: false, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).transportHeading), + ...List.generate( + widget.amRequestViewModel.amRequestModeList.length, + (index) => InkWell( + onTap: () { + setState(() { + _erTransportationMethod = + widget.amRequestViewModel.amRequestModeList[index]; + }); + }, + child: Container( + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + children: [ + Expanded( + flex: 3, + child: ListTile( + title: Texts(projectViewModel.isArabic + ? widget.amRequestViewModel + .amRequestModeList[index].titleAR + : widget.amRequestViewModel + .amRequestModeList[index].title), + leading: Radio( + value: widget + .amRequestViewModel.amRequestModeList[index], + groupValue: _erTransportationMethod, + onChanged: (value) { + setState(() { + _erTransportationMethod = value; + }); + }, + ), ), ), - ), - Expanded( - flex: 1, - child: Texts( - 'SR ${widget.amRequestViewModel.amRequestModeList[index].price}'), - ) - ], + Expanded( + flex: 1, + child: Texts(TranslationBase.of(context).sar + + ' ${widget.amRequestViewModel.amRequestModeList[index].price}'), + ) + ], + ), ), ), ), - ), - SizedBox( - height: 12, - ), - Texts('Select Direction'), - SizedBox( - height: 5, - ), - Container( - width: double.maxFinite, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _direction = Direction.ToHospital; - }); - }, - child: Container( - width: double.maxFinite, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('To Hospital'), - leading: Radio( - value: Direction.ToHospital, - groupValue: _direction, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _direction = value; - }); - }, + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).directionHeading), + SizedBox( + height: 5, + ), + Container( + width: double.maxFinite, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _direction = Direction.ToHospital; + }); + }, + child: Container( + width: double.maxFinite, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts(TranslationBase.of(context).toHospital), + leading: Radio( + value: Direction.ToHospital, + groupValue: _direction, + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _direction = Direction.FromHospital; - }); - }, - child: Container( - width: double.maxFinite, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('Form Hospital'), - leading: Radio( - value: Direction.FromHospital, - groupValue: _direction, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _direction = value; - }); - }, + Expanded( + child: InkWell( + onTap: () { + setState(() { + _direction = Direction.FromHospital; + }); + }, + child: Container( + width: double.maxFinite, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: + Texts(TranslationBase.of(context).fromHospital), + leading: Radio( + value: Direction.FromHospital, + groupValue: _direction, + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), ), ), ), ), - ), - ], + ], + ), ), - ), - if (_direction == Direction.ToHospital) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, - ), - Texts('Select Direction'), - SizedBox( - height: 5, - ), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _way = Way.OneWay; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('One Way'), - leading: Radio( - value: Way.OneWay, - groupValue: _way, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _way = value; - }); - }, + if (_direction == Direction.ToHospital) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, + ), + Texts(TranslationBase.of(context).directionHeading), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _way = Way.OneWay; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: + Texts(TranslationBase.of(context).oneDirec), + leading: Radio( + value: Way.OneWay, + groupValue: _way, + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _way = Way.TwoWays; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text('Two Ways'), - leading: Radio( - value: Way.TwoWays, - groupValue: _way, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _way = value; - }); - }, + Expanded( + child: InkWell( + onTap: () { + setState(() { + _way = Way.TwoWays; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: + Texts(TranslationBase.of(context).twoDirec), + leading: Radio( + value: Way.TwoWays, + groupValue: _way, + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), ), ), ), ), - ), - ], - ), - ], - ), - SizedBox( - height: 15, - ), - Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 76, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.patientER.transportationMethodId =(widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); - widget.patientER.direction = _direction == Direction.ToHospital ? 1 : 0; - widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1; - widget.patientER.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); - widget.patientER.patientERTransportationMethod = _erTransportationMethod; - widget.patientER.orderServiceID = _orderService.getIdOrderService(); - widget.patientER.pickupUrgency = 1; - widget.patientER.lineItemNo = 1; - widget.patientER.cost = _erTransportationMethod.price; - widget.patientER.vAT = _erTransportationMethod.vAT ?? 0; - widget.patientER.totalPrice = _erTransportationMethod.totalPrice; - widget.changeCurrentTab(1); - }); - }, - label: 'Next', + ], + ), + ], + ), + SizedBox( + height: 15, ), - ) - ], + ], + ), + ), + ), + bottomSheet: Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 90, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientER.transportationMethodId = (widget + .amRequestViewModel.amRequestModeList + .indexOf(_erTransportationMethod) + + 1); + widget.patientER.direction = + _direction == Direction.ToHospital ? 1 : 0; + widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1; + widget.patientER.selectedAmbulate = (widget + .amRequestViewModel.amRequestModeList + .indexOf(_erTransportationMethod) + + 1); + widget.patientER.patientERTransportationMethod = + _erTransportationMethod; + widget.patientER.orderServiceID = + _orderService.getIdOrderService(); + widget.patientER.pickupUrgency = 1; + widget.patientER.lineItemNo = 1; + widget.patientER.cost = _erTransportationMethod.price; + widget.patientER.vAT = _erTransportationMethod.vAT ?? 0; + widget.patientER.totalPrice = + _erTransportationMethod.totalPrice; + widget.changeCurrentTab(1); + }); + }, + label: TranslationBase.of(context).next, ), ), ); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart index 7696dd09..6140dc62 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; @@ -17,89 +19,93 @@ class Summary extends StatefulWidget { _SummaryState createState() => _SummaryState(); } -//TODO it should be dynamic class _SummaryState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Summary'), - SizedBox(height: 5,), - Container( - width: double.infinity, - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Transportation Method',color: Colors.grey,), - Texts('${widget.patientER.patientERTransportationMethod.title}',bold: true,), - SizedBox(height: 8,), + return AppScaffold( + isShowDecPage: false, + isShowAppBar: false, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).RRTSummary), + SizedBox(height: 5,), + Container( + width: double.infinity, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).transportMethod,color: Colors.grey,), + Texts('${widget.patientER.patientERTransportationMethod.title}',bold: true,), + SizedBox(height: 8,), - Texts('Direction',color: Colors.grey,), - Texts('From Hospital',bold: true,), - SizedBox(height: 8,), + Texts(TranslationBase.of(context).directions,color: Colors.grey,), + Texts(widget.patientER.direction ==0? TranslationBase.of(context).toHospital:TranslationBase.of(context).fromHospital,bold: true,), + SizedBox(height: 8,), - Texts('Pickup Location',color: Colors.grey,), - Texts('SZR Medical Center',bold: true,), - SizedBox(height: 8,), + Texts(TranslationBase.of(context).pickupLocation,color: Colors.grey,), + Texts('${widget.patientER.pickupLocationName}',bold: true,), + SizedBox(height: 8,), - Texts('Drop off location',color: Colors.grey,), - Texts('6199, Al Ameen wlfn nif',bold: true,), - SizedBox(height: 8,), + Texts(TranslationBase.of(context).dropoffLocation,color: Colors.grey,), + Texts('${widget.patientER.dropoffLocationName}',bold: true,), + SizedBox(height: 8,), - Texts('Select Ambulate',color: Colors.grey,), - Texts('${widget.patientER.ambulate.getAmbulateTitle(context)}',bold: true,), - SizedBox(height: 8,), + Texts(TranslationBase.of(context).selectAmbulate,color: Colors.grey,), + Texts('${widget.patientER.ambulate.getAmbulateTitle(context)}',bold: true,), + SizedBox(height: 8,), - Texts('Note',color: Colors.grey,), - Texts('${widget.patientER.requesterNote?? '---'}',bold: true,), - SizedBox(height: 8,), - ], - ), - ), - SizedBox(height: 20,), - Texts('Bill Amount',textAlign: TextAlign.start,), - SizedBox(height: 5,), - Container( - height: 55, - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8) + Texts(TranslationBase.of(context).notes,color: Colors.grey,), + Texts('${widget.patientER.requesterNote?? '---'}',bold: true,), + SizedBox(height: 8,), + ], + ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts('Total amount payable:'), - Texts('SR ${widget.patientER.patientERTransportationMethod.totalPrice}') - ], + SizedBox(height: 20,), + Texts(TranslationBase.of(context).billAmount,textAlign: TextAlign.start,), + SizedBox(height: 5,), + Container( + height: 55, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).patientShareTotal+':'), + Texts(TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.totalPrice}') + ], + ), ), - ), - SizedBox(height: 45,), - Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 76, - child:SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - label: 'Send', - onTap: () async { - await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER); + SizedBox(height: 45,), - } - ), - ) - ], + ], + ), + ), + ), + bottomSheet: Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 90, + child:SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + label: TranslationBase.of(context).send, + onTap: () async { + await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER); + + } ), ), ); diff --git a/lib/pages/ErService/NearestEr.dart b/lib/pages/ErService/NearestEr.dart index 227cfb3b..eaf0d4ef 100644 --- a/lib/pages/ErService/NearestEr.dart +++ b/lib/pages/ErService/NearestEr.dart @@ -20,6 +20,10 @@ class NearestEr extends StatelessWidget { @override Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double itemHeight = (size.height - kToolbarHeight - 24) / 2; + final double itemWidth = size.width / 2; + return BaseView( onModelReady: appointmentNo != null && projectID != null ? (model) => model.getProjectAvgERWaitingTimeOrders( @@ -27,14 +31,14 @@ class NearestEr extends StatelessWidget { : (model) => model.getProjectAvgERWaitingTimeOrders(), builder: (_, mode, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Nearest ER', + appBarTitle: TranslationBase.of(context).NearestEr, baseViewModel: mode, body: mode.ProjectAvgERWaitingTimeModeList.length > 0 ? Container( child: ListView( children: [ Text( - "\nThis service Displays nearest branch\n among all the branches of All Habib \n medical Group based on your current Location", + "${TranslationBase.of(context).NearestErDesc}", textAlign: TextAlign.center, style: TextStyle( fontSize: 18.0, @@ -42,301 +46,55 @@ class NearestEr extends StatelessWidget { fontWeight: FontWeight.w900, color: new Color(0xFF60686b))), Container( - margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - child: CardPosition( - text: mode - .ProjectAvgERWaitingTimeModeList[0] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[0] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[0].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[0] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[0] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[0] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[0] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[0] - .projectName, - ), - ), - - ), - Expanded( - child: Container( - child: CardPosition( - text: mode - .ProjectAvgERWaitingTimeModeList[1] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[1] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[1].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[1] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[1] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[1] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[1] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[1] - .projectName, - ), - ), - - ) - ], - ), - Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - child: CardPosition( - - text: mode - .ProjectAvgERWaitingTimeModeList[2] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - - subText: mode - .ProjectAvgERWaitingTimeModeList[2] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[2].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[2] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[2] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[2] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[2] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[2] - .projectName, - ), - ), - - ), - Expanded( - child: Container( - child: CardPosition( - - text: mode - .ProjectAvgERWaitingTimeModeList[3] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - - subText: mode - .ProjectAvgERWaitingTimeModeList[3] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[3].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[3] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[3] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[3] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[3] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[3] - .projectName, - ), - ), - flex: 0, - ) - ], - ), - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - child: CardPosition( - - text: mode - .ProjectAvgERWaitingTimeModeList[4] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - - subText: mode - .ProjectAvgERWaitingTimeModeList[4] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[4].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[4] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[4] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[4] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[4] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[4] - .projectName, - ), - ), - - ), - Expanded( - child: Container( - child: CardPosition( - text: mode - .ProjectAvgERWaitingTimeModeList[5] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[5] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[5].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[5] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[5] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[5] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[5] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[5] - .projectName, - ), - ), - - ) - ], + margin: EdgeInsets.fromLTRB(2.0, 10.0, 0.0, 10.0), + child: GridView.count( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemWidth), + crossAxisSpacing: 10, + mainAxisSpacing: 10, + controller: + new ScrollController(keepScrollOffset: false), + shrinkWrap: true, + padding: const EdgeInsets.all(4.0), + children: List.generate(7, (index) { + return Container( + child: CardPosition( + text: mode + .ProjectAvgERWaitingTimeModeList[index] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + subText: mode + .ProjectAvgERWaitingTimeModeList[index] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[index].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[index] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[index] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[index] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[index] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[index] + .projectName, + cardSize: itemWidth, ), - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - child: CardPosition( - text: mode - .ProjectAvgERWaitingTimeModeList[6] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[6] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[6].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[6] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[6] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[6] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[6] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[6] - .projectName, - ), - ), - flex: 0, - ), - ], - ), - ], - )), + ); + }), + ), + ), ], ), ) @@ -347,4 +105,3 @@ class NearestEr extends StatelessWidget { ); } } - diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index 6929cd0b..7d2a4a5b 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -30,28 +30,28 @@ class OrderLogPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ OrderLogItem( - title: 'Request ID', + title: TranslationBase.of(context).reqId, value: amRequestViewModel.patientAllPresOrdersList[index].iD .toString(), ), OrderLogItem( - title: 'Status', + title: TranslationBase.of(context).orderStatus, value: amRequestViewModel .patientAllPresOrdersList[index].description, ), OrderLogItem( - title: 'Pickup Date', + title: TranslationBase.of(context).pickupDate, value: DateUtil.getDayMonthYearDateFormatted( DateUtil.convertStringToDate(amRequestViewModel .patientAllPresOrdersList[index].createdOn)), ), OrderLogItem( - title: 'Pickup Location', + title: TranslationBase.of(context).pickupLocation, value: amRequestViewModel .patientAllPresOrdersList[index].pickupLocationName, ), OrderLogItem( - title: 'Drop off Location', + title: TranslationBase.of(context).dropoffLocation, value: amRequestViewModel .patientAllPresOrdersList[index].dropoffLocationName, ), diff --git a/lib/pages/ErService/widgets/StepsWidget.dart b/lib/pages/ErService/widgets/StepsWidget.dart index c5864710..56b3de6b 100644 --- a/lib/pages/ErService/widgets/StepsWidget.dart +++ b/lib/pages/ErService/widgets/StepsWidget.dart @@ -13,7 +13,8 @@ class StepsWidget extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return projectViewModel.isArabic? Stack( + return projectViewModel.isArabic? + Stack( children: [ Container( height: 50, @@ -29,7 +30,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - left: 0, + right: 0, child: InkWell( onTap: () => changeCurrentTab(0), child: Container( @@ -51,7 +52,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - left: MediaQuery.of(context).size.width * 0.3, + right: MediaQuery.of(context).size.width * 0.3, child: InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Container( @@ -73,7 +74,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - left: MediaQuery.of(context).size.width * 0.6, + right: MediaQuery.of(context).size.width * 0.6, child: InkWell( onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Container( @@ -95,7 +96,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - right: 0, + left: 0, child: InkWell( onTap: () => index == 2 ?changeCurrentTab(3):null, child: Container( @@ -117,7 +118,8 @@ class StepsWidget extends StatelessWidget { ), ), ], - ):Stack( + ): + Stack( children: [ Container( height: 50, @@ -133,7 +135,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - right: 0, + left: 0, child: InkWell( onTap: () => changeCurrentTab(0), child: Container( @@ -155,7 +157,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - right: MediaQuery.of(context).size.width * 0.3, + left: MediaQuery.of(context).size.width * 0.3, child: InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Container( @@ -177,7 +179,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - right: MediaQuery.of(context).size.width * 0.6, + left: MediaQuery.of(context).size.width * 0.6, child: InkWell( onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Container( @@ -199,7 +201,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - left: 0, + right: 0, child: InkWell( onTap: () => index == 2 ?changeCurrentTab(3):null, child: Container( diff --git a/lib/pages/ErService/widgets/card_position.dart b/lib/pages/ErService/widgets/card_position.dart index 8647ad62..69ccaffe 100644 --- a/lib/pages/ErService/widgets/card_position.dart +++ b/lib/pages/ErService/widgets/card_position.dart @@ -19,6 +19,8 @@ class CardPosition extends StatelessWidget { final latitude; final longitude; final projectname; + final cardSize; + const CardPosition( { @required this.image, @@ -30,6 +32,7 @@ class CardPosition extends StatelessWidget { @required this.latitude, @required this.longitude, @required this.projectname , + @required this.cardSize , }); @override @@ -40,17 +43,17 @@ class CardPosition extends StatelessWidget { }, child: Container( - width:MediaQuery.of(context).size.width * 0.47,//165, - margin: EdgeInsets.fromLTRB(7.0, 7.0, 7.0, 7.0), + // width:MediaQuery.of(context).size.width * 0.47,//165, + margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 8.0), decoration: BoxDecoration(boxShadow: [ BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) ], borderRadius: BorderRadius.circular(10), color: Colors.white), child: Column( - crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + height: cardSize * 0.2 - 8, + margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0), child: Text(this.text, overflow: TextOverflow.clip, style: TextStyle( @@ -59,12 +62,14 @@ class CardPosition extends StatelessWidget { fontSize: 2 * SizeConfig.textMultiplier)), ), Container( + height: cardSize * 0.5 - 8, alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), - child: Image.asset(this.image, width: 60.0, height: 60.0), + margin: EdgeInsets.fromLTRB(0.0, 0.0, 8.0, 8.0), + child: Image.asset(this.image, width: 60.0, height: cardSize * 0.4), ), Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), + height: cardSize * 0.2 - 8, child: Text(this.subText, overflow: TextOverflow.clip, style: TextStyle( diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index c4299e33..0d3ac2e5 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -166,7 +166,7 @@ class _ApointmentCardState extends State { ), Container( transform: - Matrix4.translationValues(15.0, -40.0, 0.0), + Matrix4.translationValues(15.0, -40.0, 0.0), child: projectViewModel.isArabic ? Image.asset( "assets/images/new-design/arrow_menu_black-ar.png", diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 1066ca15..383bedb3 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -13,7 +13,6 @@ import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; -import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -26,7 +25,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/countdown_timer_controller.dart'; import 'package:flutter_countdown_timer/current_remaining_time.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -95,249 +93,315 @@ class _ToDoState extends State { itemBuilder: (context, index) { return Container( margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Row( - children: [ - Image.asset( - "assets/images/new-design/time_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: - EdgeInsets.only(left: 10.0, right: 10.0), - child: Text( - DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - widget.appoList[index] - .appointmentDate), - projectViewModel.isArabic - ? "ar" - : "en") + - " " + - widget.appoList[index].startTime - .substring(0, 5), - style: TextStyle(fontSize: 10.0)), - ), - widget.appoList[index].isLiveCareAppointment - ? SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon.svg", - width: 20.0, - height: 20.0) - : Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: - EdgeInsets.only(left: 5.0, right: 5.0), - child: widget - .appoList[index].isLiveCareAppointment - ? Text( - TranslationBase.of(context) - .liveCareAppo, - style: TextStyle(fontSize: 12.0)) - : Text( - widget.appoList[index].projectName != - null - ? widget - .appoList[index].projectName - : "-", - overflow: TextOverflow.clip, - maxLines: 2, - style: TextStyle(fontSize: 10.0)), - ), - ], - ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), + child: Column( + children: [ + Container( + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * - 0.1, + child: Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Row( + children: [ + Image.asset( + "assets/images/new-design/time_icon.png", + width: 20.0, + height: 20.0), + Container( + margin: EdgeInsets.only( + left: 10.0, right: 10.0), + child: Text( + DateUtil.getWeekDayMonthDayYearDateFormatted( + DateUtil.convertStringToDate( + widget.appoList[index] + .appointmentDate), + projectViewModel.isArabic + ? "ar" + : "en") + + " " + + widget.appoList[index].startTime + .substring(0, 5), + style: TextStyle(fontSize: 10.0)), + ), + !widget.appoList[index] + .isLiveCareAppointment + ? Image.asset( + "assets/images/new-design/hospital_address_icon.png", + width: 20.0, + height: 20.0) + : Container(), + Container( + margin: EdgeInsets.only( + left: 5.0, right: 5.0), + child: widget.appoList[index] + .isLiveCareAppointment + ? Container() + : Text( + widget.appoList[index] + .projectName != + null + ? widget.appoList[index] + .projectName + : "-", + overflow: TextOverflow.clip, + maxLines: 2, + style: + TextStyle(fontSize: 10.0)), + ), + ], + ), + Container( margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: - BorderRadius.circular(100.0), - child: Image.network( - widget.appoList[index].doctorImageURL, - fit: BoxFit.fill), + child: Divider( + color: Colors.grey[500], ), ), - ), - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only( - top: 10.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - widget.appoList[index].doctorTitle + - " " + + Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 1, + child: Container( + height: MediaQuery.of(context) + .size + .height * + 0.1, + margin: EdgeInsets.only(top: 5.0), + child: ClipRRect( + borderRadius: + BorderRadius.circular(100.0), + child: Image.network( widget.appoList[index] - .doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only( - top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality(widget - .appoList[index] - .doctorSpeciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), + .doctorImageURL, + fit: BoxFit.fill), + ), ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: widget - .appoList[index] - .actualDoctorRate - .toDouble(), - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], + ), + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 10.0, + left: 20.0, + right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + widget.appoList[index] + .doctorTitle + + " " + + widget.appoList[index] + .doctorNameObj, + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + fontWeight: + FontWeight.bold, + letterSpacing: 1.0)), + Container( + margin: EdgeInsets.only( + top: 3.0, bottom: 3.0), + child: Text( + getDoctorSpeciality(widget + .appoList[index] + .doctorSpeciality) + .trim(), + style: TextStyle( + fontSize: 12.0, + color: Colors.grey[600], + letterSpacing: 1.0)), + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar.readOnly( + initialRating: widget + .appoList[index] + .actualDoctorRate + .toDouble(), + size: 20.0, + filledColor: + Colors.yellow[700], + emptyColor: + Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: + Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ], + ), + Container( + child: CountdownTimer( + controller: new CountdownTimerController( + endTime: DateTime.now() + .millisecondsSinceEpoch + + (widget + .appoList[ + index] + .remaniningHoursTocanPay * + 1000) * + 60), + widgetBuilder: (_, + CurrentRemainingTime + time) { + return time != null + ? Text( + '${time.days != null ? time.days : "0"}:${time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours}:${time.min}:${time.sec} ' + + TranslationBase.of( + context) + .upcomingTimeLeft, + style: TextStyle( + fontSize: 12.0, + color: Color( + 0xff40ACC9))) + : Container(); + }, + ), + ), + ], + ), ), - Container( - child: CountdownTimer( - controller: new CountdownTimerController( - endTime: DateTime.now() - .millisecondsSinceEpoch + - (widget.appoList[index] - .remaniningHoursTocanPay * - 1000) * - 60), - widgetBuilder: - (_, CurrentRemainingTime time) { - return time != null - ? Text( - '${time.days}:${time.hours}:${time.min}:${time.sec} ' + - TranslationBase.of( - context) - .upcomingTimeLeft, + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => performNextAction( + widget.appoList[index]), + child: Container( + margin: EdgeInsets.only(top: 20.0), + child: Column( + children: [ + Image.asset( + getNextActionImage(widget + .appoList[index] + .nextAction), + width: 50.0, + height: 50.0), + Container( + margin: + EdgeInsets.only(top: 5.0), + child: Text( + getNextActionText(widget + .appoList[index] + .nextAction), + textAlign: + TextAlign.center, style: TextStyle( - fontSize: 12.0, - color: Color( - 0xff40ACC9))) - : Container(); - }, + fontSize: 12.0)), + ) + ], + ), ), ), - ], - ), + ) + ], ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => performNextAction( - widget.appoList[index]), - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset( - getNextActionImage(widget + Divider( + color: Colors.grey[500], + ), + Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 2, + child: Container( + child: Text( + getNextActionDescription(widget .appoList[index].nextAction), - width: 50.0, - height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text( - getNextActionText(widget - .appoList[index] - .nextAction), - textAlign: TextAlign.center, - style: - TextStyle(fontSize: 12.0)), - ) - ], + style: TextStyle( + fontSize: 12.0, + color: Colors.grey[700])), + ), ), - ), + Expanded( + flex: 1, + child: GestureDetector( + onTap: () { + navigateToAppointmentDetails( + context, + widget.appoList[index]); + }, + child: Container( + child: Text( + TranslationBase.of(context) + .upcomingDetails, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 12.0, + color: + new Color(0xFF40ACC9), + decoration: TextDecoration + .underline)), + ), + ), + ) + ], ), - ) - ], - ), - Divider( - color: Colors.grey[500], + ], + ), ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text( - getNextActionDescription( - widget.appoList[index].nextAction), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[700])), - ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails( - context, widget.appoList[index]); - }, - child: Container( - child: Text( - TranslationBase.of(context) - .upcomingDetails, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12.0, - color: new Color(0xFF40ACC9), - decoration: - TextDecoration.underline)), + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(10.0), + bottomRight: Radius.circular(10.0)), + color: Color(0xff20bc44), + ), + height: 30.0, + margin: projectViewModel.isArabic ? EdgeInsets.fromLTRB(160.0, 0.0, 30.0, 0.0) : EdgeInsets.fromLTRB(30.0, 0.0, 160.0, 0.0), + transform: Matrix4.translationValues(0.0, -8.0, 0.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + widget.appoList[index].isLiveCareAppointment + ? Container( + margin: EdgeInsets.fromLTRB( + 5.0, 0.0, 5.0, 0.0), + child: Image.asset( + "assets/images/new-design/video.png"), + ) + : Container( + margin: EdgeInsets.fromLTRB( + 5.0, 0.0, 5.0, 0.0), + child: Image.asset( + "assets/images/new-design/walkin.png"), ), - ), - ) - ], - ), - ], + widget.appoList[index].isLiveCareAppointment + ? Container( + child: Text(TranslationBase.of(context).videoAppo, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), + ) + : Container( + child: Text(TranslationBase.of(context).walkinAppo, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), + ) + ], + ), ), - ), + ], ), ); }, @@ -567,12 +631,34 @@ class _ToDoState extends State { } getPatientShare(context, AppoitmentAllHistoryResultList appo) { - GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); + if (appo.isLiveCareAppointment) { + getLiveCareAppointmentPatientShare(context, service, appo); + } else { + 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); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + } + + getLiveCareAppointmentPatientShare(context, DoctorsListService service, + AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); service - .getPatientShare(appo.appointmentNo.toString(), appo.clinicID, - appo.projectID, context) + .getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), + appo.clinicID, appo.projectID, context) .then((res) { + print(res); GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); openPaymentDialog(appo, widget.patientShareResponse); @@ -674,7 +760,12 @@ class _ToDoState extends State { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - widget.browser); + widget.browser, + appo.isLiveCareAppointment, + appo.appointmentDate, + appo.appointmentNo, + appo.clinicID, + appo.doctorID); } onBrowserLoadStart(String url) { diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 04930e59..3fefe616 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -197,7 +197,7 @@ class _TodoListCardState extends State { ), ) ], - ) + ), ], ), ), diff --git a/lib/pages/feedback/feedback_home_page.dart b/lib/pages/feedback/feedback_home_page.dart index 309b5713..f7f998bf 100644 --- a/lib/pages/feedback/feedback_home_page.dart +++ b/lib/pages/feedback/feedback_home_page.dart @@ -73,8 +73,7 @@ class _FeedbackHomePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 4d511452..aded1a3b 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; @@ -417,27 +418,26 @@ class _SendFeedbackPageState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.13, + height: MediaQuery.of(context).size.height * 0.09, width: double.infinity, - padding: EdgeInsets.all(8.0), + padding: EdgeInsets.all(15.0), child: Center( child: Container( - height: MediaQuery.of(context).size.height * 0.1, - width: MediaQuery.of(context).size.width * 0.8, - child: Button( + height: MediaQuery.of(context).size.height * 0.8, + child: SecondaryButton( label: TranslationBase.of(context).send, - loading: model.state == ViewState.BusyLocal, + disabled: (titleController.text.toString().isEmpty || messageController.text.toString().isEmpty|| messageType == MessageType.NON), onTap: () { final form = formKey.currentState; - if (form.validate()) if (messageType != MessageType.NON) - model - .sendCOCItem( + if (form.validate()) + if (messageType != MessageType.NON){ + GifLoaderDialogUtils.showMyDialog(context); + model.sendCOCItem( title: titleController.text, attachment: images.length > 0 ? images[0] : "", details: messageController.text, cOCTypeName: getCOCName(), - appointHistory:messageType == - MessageType.ComplaintOnAnAppointment + appointHistory:messageType == MessageType.ComplaintOnAnAppointment ? appointHistory : null) .then((value) { @@ -448,12 +448,14 @@ class _SendFeedbackPageState extends State { images = []; }); setMessageType(MessageType.NON); + GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast( message: TranslationBase.of(context).yourFeedback); } else { AppToast.showErrorToast(message: model.error); + GifLoaderDialogUtils.hideDialog(context); } - }); + });} else { AppToast.showErrorToast(message: TranslationBase.of(context).selectPart); } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index cd8a8a2d..3a64fbd5 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -1,8 +1,9 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; @@ -73,7 +74,7 @@ class _HomePageState extends State { children: [ Expanded( child: Container( - height: 120, + height: 125, padding: EdgeInsets.all(5), margin: EdgeInsets.all(5), decoration: BoxDecoration( @@ -87,72 +88,50 @@ class _HomePageState extends State { borderRadius: BorderRadius.all( Radius.circular(5))), child: Container( - margin: EdgeInsets.only(top: 10.0), + child: Column( children: [ - Text("COVID-19 TEST", - style: TextStyle( - color: Colors.white, - fontWeight: - FontWeight.bold, - fontSize: 18.0)), + Texts(TranslationBase.of(context).covidTest, + color: Colors.white, + fontWeight: FontWeight.w700, + ), Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Container( margin: EdgeInsets.only( - top: 15.0, left: 3.5, right: 3.5), + top: 15.0,), child: SvgPicture.asset( 'assets/images/new-design/covid-19-car.svg', width: 45.0, height: 45.0), ), Container( - margin: EdgeInsets.only( - left: 10.0, - top: 10.0), + margin: EdgeInsets.only(top: 5.0), child: Column( children: [ - Text("Drive-Thru", - style: TextStyle( - color: Colors - .white, - fontWeight: - FontWeight - .bold, - fontSize: - 16.0)), + Texts(TranslationBase.of(context).driveThru, + fontWeight: FontWeight.w700, + color: Colors.white,), ButtonTheme( - shape: - RoundedRectangleBorder( + shape: RoundedRectangleBorder( borderRadius: - BorderRadius - .circular( - 5.0), - ), - minWidth: MediaQuery.of( - context) - .size - .width * - 0.15, + BorderRadius.circular(5.0),), + minWidth: MediaQuery.of(context).size.width * 0.15, height: 25.0, child: RaisedButton( - color: Colors - .red[800], - textColor: - Colors.white, - disabledTextColor: - Colors.white, - disabledColor: - new Color( - 0xFFbcc2c4), + color: Colors.red[800], + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), onPressed: () { navigateToCovidDriveThru(); }, - child: Text( - "BOOK NOW", - style: TextStyle( - fontSize: - 12.0)), + child: Texts( + TranslationBase.of(context).bookNow, + fontWeight: FontWeight.w700, + color: Colors.white, + ), ), ), ], @@ -170,7 +149,7 @@ class _HomePageState extends State { onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())), child: Container( - height: 120, + height: 125, padding: EdgeInsets.all(15), margin: EdgeInsets.all(5), decoration: BoxDecoration( @@ -193,7 +172,7 @@ class _HomePageState extends State { ], ), ), - Container(width: double.infinity, height: 80) + Container(width: double.infinity, height:projectViewModel.isArabic ?110: 80) ], ), Positioned( @@ -208,7 +187,7 @@ class _HomePageState extends State { Orientation.landscape ? 0.02 : 0.03), - child: (!model.isLogin && projectViewModel.user == null) + child: (!model.isLogin) ? Container( width: double.infinity, height: 125, @@ -229,17 +208,15 @@ class _HomePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 8, + height: 2, ), Texts( TranslationBase.of(context).myMedicalFile, color: Colors.black87, - bold: true, + fontWeight: FontWeight.w700, fontSize: 23, ), - SizedBox( - height: 5, - ), + Texts( TranslationBase.of(context) .myMedicalFileSubTitle, @@ -248,14 +225,14 @@ class _HomePageState extends State { ), Align( alignment: projectViewModel.isArabic - ? Alignment.bottomRight - : Alignment.bottomLeft, + ? Alignment.bottomLeft + : Alignment.bottomRight, child: InkWell( onTap: () { widget.goToMyProfile(); }, child: Container( - margin: EdgeInsets.all(2), + margin: EdgeInsets.only(left: 15,right: 15), width: 90, height: 30, decoration: BoxDecoration( @@ -265,13 +242,13 @@ class _HomePageState extends State { color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all( - Radius.circular(9)), + Radius.circular(0)), ), child: Center( child: Texts( - TranslationBase.of(context) - .viewMore, + TranslationBase.of(context).viewMore, color: Colors.white, + fontWeight: FontWeight.w700, fontSize: 12, ), ), @@ -284,7 +261,7 @@ class _HomePageState extends State { ) : Container( width: double.infinity, - height: 130, + height: projectViewModel.isArabic ? 160:130, decoration: BoxDecoration( color: HexColor('#A59E9E'), shape: BoxShape.rectangle, @@ -303,7 +280,7 @@ class _HomePageState extends State { children: [ Row( children: [ - if (model.user != null) + if (projectViewModel.user != null && model.isLogin) Expanded( child: Column( crossAxisAlignment: @@ -368,13 +345,9 @@ class _HomePageState extends State { ], ), Row( - //crossAxisAlignment: CrossAxisAlignment.center, - //mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, children: [ Image.asset( 'assets/images/height_icon.png', @@ -384,6 +357,7 @@ class _HomePageState extends State { Texts( "${model.heightCm}", color: Colors.white, + fontSize: 17, ) ], ), @@ -393,8 +367,6 @@ class _HomePageState extends State { ), Expanded( child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, children: [ Image.asset( 'assets/images/weight_icon.png', @@ -404,6 +376,7 @@ class _HomePageState extends State { Texts( '${model.weightKg}', color: Colors.white, + fontSize: 17 ) ], ), @@ -449,7 +422,7 @@ class _HomePageState extends State { Navigator.push( context, FadePage( - page: HomeHealthCareIndexPage(), + page: HomeHealthCarePage(), ), ); }, @@ -464,15 +437,14 @@ class _HomePageState extends State { height: 50, ), SizedBox( - height: 3, + height: 10, ), Texts( - TranslationBase.of(context) - .homeHealthCareService, + TranslationBase.of(context).cmcHeading, textAlign: TextAlign.center, color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, ) ], ), @@ -503,8 +475,8 @@ class _HomePageState extends State { TranslationBase.of(context).onlinePharmacy, textAlign: TextAlign.center, color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, ) ], ), @@ -519,7 +491,7 @@ class _HomePageState extends State { Navigator.push( context, FadePage( - page: CMCIndexPage(), + page: CMCPage(), ), ); }, @@ -534,14 +506,14 @@ class _HomePageState extends State { height: 50, ), SizedBox( - height: 3, + height:10, ), Texts( TranslationBase.of(context).emergencyService, textAlign: TextAlign.center, color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, ) ], ), @@ -811,10 +783,8 @@ class DashboardItem extends StatelessWidget { onTap: onTap, child: Container( width: width != null ? width : MediaQuery.of(context).size.width * 0.29, - height: height != null - ? height - : MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.19 + height: height != null ? height : MediaQuery.of(context).orientation == Orientation.portrait + ? MediaQuery.of(context).size.height * 0.17 : MediaQuery.of(context).size.height * 0.35, decoration: BoxDecoration( color: !hasBorder diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index e1dd6b63..e63df76c 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -158,12 +158,14 @@ class _LandingPageState extends State with WidgetsBindingObserver { }); }).checkAndConnectIfNoInternet(); + if (Platform.isIOS) { _firebaseMessaging.requestNotificationPermissions(); } - // Flip Permission Checks [Zohaib Kambrani] requestPermissions().then((results) { + registerGeofences(); + if (results[Permission.notification].isGranted) _firebaseMessaging.getToken().then((String token) { sharedPref.setString(PUSH_TOKEN, token); @@ -172,7 +174,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { checkUserStatus(token); } }); - if (results[Permission.location].isGranted); if (results[Permission.storage].isGranted); if (results[Permission.camera].isGranted); @@ -325,6 +326,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { Permission.notification, Permission.accessMediaLocation, Permission.calendar, + Permission.activityRecognition ].request(); var permissionsGranted = await deviceCalendarPlugin.hasPermissions(); @@ -376,17 +378,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { // themeNotifier.setTheme(defaultTheme); } - void checkUserStatus(token, {isLoader = true}) async { - if (isLoader) - //GifLoaderDialogUtils.showMyDialog(context); - authService - .selectDeviceImei(token) - .then((SelectDeviceIMEIRES value) => setUserValues(value)) - .catchError((err) { - //GifLoaderDialogUtils.hideDialog(context); - }); - } - static Future myBackgroundMessageHandler( Map message) async { Map myMap = new Map.from(message['data']); @@ -438,7 +429,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { }); } - requestPermissions().then((results) {}); } login() async { @@ -617,14 +607,36 @@ class _LandingPageState extends State with WidgetsBindingObserver { return TranslationBase.of(context).medicalProfile; case 2: return TranslationBase.of(context).bookAppo; + case 5: + return TranslationBase.of(context).bookAppo; case 3: return TranslationBase.of(context).services; case 4: - return TranslationBase - .of(context) - .bookAppo; + return TranslationBase.of(context).bookAppo; } } -} + void checkUserStatus(token, {isLoader = true}) async { + if (isLoader) + //GifLoaderDialogUtils.showMyDialog(context); + authService + .selectDeviceImei(token) + .then((SelectDeviceIMEIRES value) => setUserValues(value)) + .catchError((err) { + //GifLoaderDialogUtils.hideDialog(context); + }); + // if (await sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + // if (data != null) { + // authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {print(res)}); + // authService.getDashboard().then((value) => { + // setState(() { + // notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + // }) + // }); + // } + // } + } + +} diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index fda83fc2..3a46f45c 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -1,19 +1,29 @@ +import 'dart:convert'; + +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:barcode_scan_fix/barcode_scan.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/parent_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; -import '../offers_categorise_page.dart'; - class LandingPagePharmacy extends StatefulWidget { @override _LandingPagePharmacyState createState() => _LandingPagePharmacyState(); @@ -39,105 +49,107 @@ class _LandingPagePharmacyState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: currentTab == 0 || currentTab == 1 - ? AppBar( - backgroundColor: Color(0xff5AB145), - elevation: 0, - title: Container( - height: MediaQuery.of(context).size.height * 0.056, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - color: Colors.white, - ), - child: InkWell( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Row( - //crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.search, size: 25.0), - SizedBox( - width: 15.0, - ), - Texts( - TranslationBase.of(context).searchProductHere, - fontSize: 13, - ) - ], - ), + appBar: + + // currentTab == 0 || currentTab == 1 || currentTab == 2 + // ? + + AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + title: Container( + height: MediaQuery.of(context).size.height * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => SearchProductsPage()), - ); - }, + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => SearchProductsPage()), + ); + }, + ), + ), + leading: Builder( + builder: (BuildContext context) { + return InkWell( + onTap: () { + setState(() { + currentTab = 0; + pageController.jumpToPage(0); + }); + }, + child: Container( + height: 2.0, + width: 10.0, + child: Image.asset( + 'assets/images/pharmacy_logo.png', ), ), - leading: Builder( - builder: (BuildContext context) { - return InkWell( - onTap: (){ - setState(() { - currentTab = 0; - pageController.jumpToPage(0); - }); - }, - child: Container( - height: 2.0, - width: 10.0, - child: Image.asset( - 'assets/images/pharmacy_logo.png', - ), - ), - ); - }, + ); + }, + ), + actions: [ + IconButton( + // iconSize: 70, + icon: Image.asset( + 'assets/images/new-design/qr-code.png', ), - actions: [ - // IconButton( - // iconSize: 70, - // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', - // height: 100, width: 100, fit: BoxFit.cover), - // onPressed: () { - // triggerRobot(); - // } //do something, - // ) - ], - centerTitle: true, - ) - : currentTab == 4 - ? null - : AppBar( - backgroundColor: Color(0xff5AB145), - elevation: 0, - textTheme: TextTheme( - headline6: TextStyle( - color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text(getText(currentTab).toUpperCase()), - leading: Builder( - builder: (BuildContext context) { - return IconButton( - icon: Icon(Icons.arrow_back), - color: Colors.white, - onPressed: () => Scaffold.of(context).openDrawer(), - ); - }, - ), - actions: [ - // IconButton( - // iconSize: 70, - // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', - // height: 100, width: 100, fit: BoxFit.cover), - // onPressed: () { - // triggerRobot(); - // } //do something, - // ) - ], - centerTitle: true, - ), + onPressed: _scanQrAndGetProduct //do something, + ) + ], + centerTitle: true, + ), + // : currentTab == 4 + // ? null:null, + // : AppBar( + // backgroundColor: Color(0xff5AB145), + // elevation: 0, + // textTheme: TextTheme( + // headline6: TextStyle( + // color: Colors.white, fontWeight: FontWeight.bold), + // ), + // title: Text(getText(currentTab).toUpperCase()), + // leading: Builder( + // builder: (BuildContext context) { + // return IconButton( + // icon: Icon(Icons.arrow_back), + // color: Colors.white, + // onPressed: () => Scaffold.of(context).openDrawer(), + // ); + // }, + // ), + // actions: [ + // // IconButton( + // // iconSize: 70, + // // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // // height: 100, width: 100, fit: BoxFit.cover), + // // onPressed: () { + // // triggerRobot(); + // // } //do something, + // // ) + // ], + // centerTitle: true, + // ), extendBody: false, body: PageView( physics: NeverScrollableScrollPhysics(), @@ -162,6 +174,29 @@ class _LandingPagePharmacyState extends State { ); } + void _scanQrAndGetProduct() async { + try { + String result = await BarcodeScanner.scan(); + try { + String barcode = result; + GifLoaderDialogUtils.showMyDialog(context); + await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", + onSuccess: (dynamic response, int statusCode) { + print(response); + var product = PharmacyProduct.fromJson(response["products"][0]); + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: ProductDetailPage(product))); + }, onFailure: (String error, int statusCode) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: "Product not found"); + }); + } catch (apiEx) { + AppToast.showErrorToast( + message: "Something went wrong, please try again"); + } + } catch (barcodeEx) {} + } + getText(currentTab) { switch (currentTab) { case 2: diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index fc5c4eab..1974753f 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -49,6 +49,7 @@ class _LiveCareHomeState extends State child: Column(children: [ /// this is will not colored with theme data TabBar( + labelColor: Colors.black, tabs: [ Tab(text: TranslationBase.of(context).consultation), Tab(text: TranslationBase.of(context).logs), diff --git a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart index 4309cc62..19144263 100644 --- a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart +++ b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart @@ -21,7 +21,7 @@ class _ScheduleClinicCardState extends State { return Container( child: Card( margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 8.0), - color: widget.isSelected ? Colors.blue : Colors.white, + color: widget.isSelected ? Color(0xff06b806) : Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), @@ -35,8 +35,8 @@ class _ScheduleClinicCardState extends State { Container( child: Text( widget.languageID == 'ar' - ? widget.clinicsHaveScheduleList.clinicDescN - : widget.clinicsHaveScheduleList.clinicDesc, + ? widget.clinicsHaveScheduleList.clinicDescN != null ? widget.clinicsHaveScheduleList.clinicDescN: "" + : widget.clinicsHaveScheduleList.clinicDesc != null ? widget.clinicsHaveScheduleList.clinicDesc: "Dermatology", style: TextStyle( fontSize: 16.0, color: diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index 25ec8514..15c14557 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -42,10 +42,11 @@ class _LiveCareHistoryCardState extends State { ), child: Container( width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height * 0.22, + // height: MediaQuery.of(context).size.height * 0.22, padding: EdgeInsets.all(10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ Text("Requested date:", style: diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index fc27d92b..195d8879 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -283,7 +283,8 @@ class _clinic_listState extends State { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - browser); + browser, + false); } onBrowserLoadStart(String url) { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 646158db..58efff71 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -21,6 +22,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; @@ -44,6 +46,7 @@ class _ConfirmLogin extends State { var sharedPref = new AppSharedPreferences(); bool authenticated; final authService = new AuthProvider(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); int mobileNumber; String errorMsg = ''; SelectDeviceIMEIRES user; @@ -109,11 +112,11 @@ class _ConfirmLogin extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( - 'assets/images/DQ/dq_logo_icon.png', + 'assets/images/DQ/logo.png', height: 90, width: 90, ), - AppText( + Texts( TranslationBase.of(context).welcomeBack + ' ' + user.name, @@ -122,7 +125,7 @@ class _ConfirmLogin extends State { SizedBox( height: 20, ), - AppText( + Texts( TranslationBase.of(context).accountInfo, fontSize: SizeConfig.textMultiplier * 2.5, ), @@ -173,17 +176,17 @@ class _ConfirmLogin extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( - 'assets/images/DQ/dq_logo_icon.png', + 'assets/images/DQ/logo.png', height: 90, width: 90, ), this.onlySMSBox == false - ? AppText( + ? Texts( TranslationBase.of(context).verifyLoginWith, fontSize: SizeConfig.textMultiplier * 3.5, textAlign: TextAlign.left, ) - : AppText( + : Texts( TranslationBase.of(context) .verifyFingerprint2, fontSize: SizeConfig.textMultiplier * 2.5, @@ -591,6 +594,13 @@ class _ConfirmLogin extends State { Provider.of(context, listen: false) .setUser(authenticatedUserObject.user); getToDoCount(); + + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + if(pharmacyModuleViewModel.error.isNotEmpty) + await pharmacyModuleViewModel.createUser(); + }); + + appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { @@ -634,7 +644,7 @@ class _ConfirmLogin extends State { return InkWell( onTap: () => {authenticateUser(4, true)}, child: RoundedContainer( - height: 140, + height: 150, borderColor: Colors.grey, showBorder: true, child: Padding( @@ -649,7 +659,7 @@ class _ConfirmLogin extends State { SizedBox( height: 20, ), - AppText( + Texts( TranslationBase.of(context).verifyWhatsApp, fontSize: SizeConfig.textMultiplier * 2, ) @@ -661,7 +671,7 @@ class _ConfirmLogin extends State { return InkWell( onTap: () => {authenticateUser(1, true)}, child: RoundedContainer( - height: 140, + height: 150, borderColor: Colors.grey, showBorder: true, child: Padding( @@ -681,7 +691,7 @@ class _ConfirmLogin extends State { : SizedBox( height: 20, ), - AppText( + Texts( TranslationBase.of(context).verifySMS, fontSize: projectViewModel.isArabic ? SizeConfig.textMultiplier * 1.8 @@ -696,7 +706,7 @@ class _ConfirmLogin extends State { return InkWell( onTap: () => {authenticateUser(2, BiometricType.fingerprint.index)}, child: RoundedContainer( - height: 140, + height: 150, backgroundColor: BiometricType.fingerprint.index == 1 ? Colors.white : Colors.white.withOpacity(.7), @@ -714,7 +724,7 @@ class _ConfirmLogin extends State { SizedBox( height: 20, ), - AppText( + Texts( TranslationBase.of(context).verifyFingerprint, fontSize: SizeConfig.textMultiplier * 2, ) @@ -726,7 +736,7 @@ class _ConfirmLogin extends State { return InkWell( onTap: () => {authenticateUser(3, BiometricType.face.index)}, child: RoundedContainer( - height: 140, + height: 150, backgroundColor: checkIfBiometricAvailable(BiometricType.face) ? Colors.white : Colors.white.withOpacity(.7), @@ -745,7 +755,7 @@ class _ConfirmLogin extends State { SizedBox( height: 20, ), - AppText( + Texts( TranslationBase.of(context).verifyFaceID, fontSize: SizeConfig.textMultiplier * 2, ) @@ -762,7 +772,7 @@ class _ConfirmLogin extends State { }) }, child: RoundedContainer( - height: 140, + height: 150, backgroundColor: BiometricType.fingerprint.index == 1 ? Colors.white : Colors.white.withOpacity(.7), @@ -774,7 +784,7 @@ class _ConfirmLogin extends State { children: [ Image.asset( 'assets/images/login/more_icon.png', - height: SizeConfig.imageSizeMultiplier * 13, + height: 45, width: SizeConfig.imageSizeMultiplier * 16, ), projectViewModel.isArabic @@ -784,9 +794,9 @@ class _ConfirmLogin extends State { : SizedBox( height: 10, ), - AppText( + Texts( TranslationBase.of(context).moreVerification, - fontSize: SizeConfig.textMultiplier * 2, + fontSize: SizeConfig.textMultiplier * 1.8, textAlign: TextAlign.center, ) ], diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index c2a943d2..44be9a6d 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -18,6 +19,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; @@ -29,6 +31,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../Constants.dart'; + class Login extends StatefulWidget { @override _Login createState() => _Login(); @@ -44,11 +48,10 @@ class _Login extends State { final authService = new AuthProvider(); var sharedPref = new AppSharedPreferences(); bool isLoading = false; - AppointmentRateViewModel appointmentRateViewModel = - locator(); + AppointmentRateViewModel appointmentRateViewModel = locator(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); ProjectViewModel projectViewModel; ToDoCountProviderModel toDoProvider; @@ -82,7 +85,7 @@ class _Login extends State { children: [ Expanded( flex: 2, - child: AppText( + child: Texts( TranslationBase.of(context).enterNationalId, fontSize: SizeConfig.textMultiplier * 3.5, textAlign: TextAlign.start, @@ -92,7 +95,9 @@ class _Login extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), + Directionality( + textDirection: TextDirection.ltr, + child: MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value)), Directionality( textDirection: TextDirection.ltr, child: Container( @@ -105,7 +110,7 @@ class _Login extends State { loginType == 1 ? Icons.chrome_reader_mode : Icons.receipt, - color: Color(0xFF40ACC9)), + color: secondaryColor), padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), hintText: loginType == 1 @@ -133,9 +138,7 @@ class _Login extends State { child: DefaultButton( TranslationBase.of(context).login, () => {this.startLogin()}, - color: isButtonDisabled == true - ? Colors.grey - : Colors.grey[900], + color: isButtonDisabled == true ? Colors.grey : Colors.grey[900], textColor: Colors.white, )) ], @@ -156,8 +159,7 @@ class _Login extends State { } void validateForm() { - if (util.validateIDBox(nationalIDorFile.text, loginType) == true && - util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; }); @@ -242,50 +244,55 @@ class _Login extends State { this.authService.checkActivationCode(request, code).then((result) async { sharedPref.remove(FAMILY_FILE); // Register GeoZones after login - registerGeoZones(); - projectViewModel.setPrivilege(privilegeList: result); - result = CheckActivationCode.fromJson(result); - result.list.isFamily = false; - // this.sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']), - this.sharedPref.setObject(USER_PROFILE, result.list); - this.sharedPref.setObject(MAIN_USER, result.list); - this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); - this.sharedPref.setString(TOKEN, result.authenticationTokenID); - await authenticatedUserObject.getUser(getUser: true); - authenticatedUserObject.isLogin = true; - appointmentRateViewModel.isLogin = true; - projectViewModel.isLogin = true; - projectViewModel.user = authenticatedUserObject.user; - appointmentRateViewModel - .getIsLastAppointmentRatedList() - .then((value) => { - getToDoCount(), - GifLoaderDialogUtils.hideDialog(context), - if (appointmentRateViewModel.isHaveAppointmentNotRate) - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - (r) => false) - } - else - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false) - } - }) - .catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - }); + registerGeoZones(); + projectViewModel.setPrivilege(privilegeList: result); + result = CheckActivationCode.fromJson(result); + result.list.isFamily = false; + // this.sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']), + this.sharedPref.setObject(USER_PROFILE, result.list); + this.sharedPref.setObject(MAIN_USER, result.list); + this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); + this.sharedPref.setString(TOKEN, result.authenticationTokenID); + await authenticatedUserObject.getUser(getUser: true); + authenticatedUserObject.isLogin = true; + appointmentRateViewModel.isLogin = true; + projectViewModel.isLogin = true; + projectViewModel.user = authenticatedUserObject.user; - }); + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + if(pharmacyModuleViewModel.error.isNotEmpty) + await pharmacyModuleViewModel.createUser(); + }); + + appointmentRateViewModel + .getIsLastAppointmentRatedList() + .then((value) => { + getToDoCount(), + GifLoaderDialogUtils.hideDialog(context), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + } + }) + .catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + }); + }); } getToDoCount() { diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index a3005db5..fce664f7 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -238,15 +238,13 @@ class _AdvancePaymentPageState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.13, + height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, - padding: EdgeInsets.all(12), + padding: EdgeInsets.all(18), child: SecondaryButton( textColor: Colors.white, label: TranslationBase.of(context).submit, - disabled: amount.isEmpty || - _fileTextController.text.isEmpty || - _selectedHospital == null, + disabled: amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null, onTap: () { var mobileNum; var patientName; diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 8a69bf5d..eecb6abd 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -225,7 +225,8 @@ class ConfirmPaymentPage extends StatelessWidget { advanceModel.patientName, advanceModel.fileNumber, authenticatedUser, - browser); + browser, + false); } onBrowserLoadStart(String url) { diff --git a/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart b/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart index b004bc38..d7ce3fac 100644 --- a/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../Constants.dart'; import '../advance_payment_page.dart'; class SelectBeneficiaryDialog extends StatefulWidget { @@ -45,7 +46,7 @@ class _SelectBeneficiaryDialogState extends State { leading: Radio( value: BeneficiaryType.MyAccount, groupValue: beneficiaryType, - activeColor: Color(0xFF40ACC9), + activeColor: secondaryColor, onChanged: (BeneficiaryType value) { setState(() { beneficiaryType = value; diff --git a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart index 3d07c08c..19e4fea4 100644 --- a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart @@ -1,9 +1,11 @@ //import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class SelectCiteisDialog extends StatefulWidget { final List hospitals; @@ -12,6 +14,7 @@ class SelectCiteisDialog extends StatefulWidget { SelectCiteisDialog( {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); + @override _SelectCiteisDialogState createState() => _SelectCiteisDialogState(); } @@ -24,9 +27,10 @@ class _SelectCiteisDialogState extends State { widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; } - @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + return SimpleDialog( children: [ Column( @@ -34,7 +38,7 @@ class _SelectCiteisDialogState extends State { Divider(), ...List.generate( widget.hospitals.length, - (index) => Column( + (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( @@ -53,7 +57,9 @@ class _SelectCiteisDialogState extends State { child: ListTile( // title: Text(widget.hospitals[index].description + // ' ${widget.hospitals[index].distanceInKilometers} KM'), - title: Text(widget.hospitals[index].description), + title: Text(projectProvider.isArabic + ? widget.hospitals[index].descriptionN + : widget.hospitals[index].description), leading: Radio( value: widget.hospitals[index], groupValue: widget.selectedHospital, @@ -116,9 +122,9 @@ class _SelectCiteisDialogState extends State { padding: const EdgeInsets.all(8.0), child: Center( child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), ), ), ), diff --git a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart b/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart index 42bd66b7..a9a4fea2 100644 --- a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart @@ -4,6 +4,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../Constants.dart'; + class SelectHospitalDialog extends StatefulWidget { final List hospitals; final Function(HospitalsModel) onValueSelected; @@ -54,7 +56,7 @@ class _SelectHospitalDialogState extends State { leading: Radio( value: widget.hospitals[index], groupValue: widget.selectedHospital, - activeColor: Color(0xFF40ACC9), + activeColor: secondaryColor, onChanged: (value) { setState(() { widget.selectedHospital = value; diff --git a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart index bb9afd6c..ab2b48d5 100644 --- a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart @@ -4,6 +4,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../Constants.dart'; + class SelectPatientFamilyDialog extends StatefulWidget { final List getAllSharedRecordsByStatusList; final Function(GetAllSharedRecordsByStatusList) onValueSelected; @@ -53,7 +55,7 @@ class _SelectPatientFamilyDialogState extends State { leading: Radio( value: widget.getAllSharedRecordsByStatusList[index], groupValue: widget.selectedPatientFamily, - activeColor: Colors.red[800], + activeColor: secondaryColor, onChanged: (value) { setState(() { widget.selectedPatientFamily = value; diff --git a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart index bea4f694..3cce8e61 100644 --- a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart @@ -6,6 +6,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../Constants.dart'; + class SelectPatientInfoDialog extends StatefulWidget { final List patientInfoList ; final Function(PatientInfo) onValueSelected; @@ -55,7 +57,7 @@ class _SelectPatientInfoDialogState extends State { leading: Radio( value: widget.patientInfoList[index], groupValue: widget.selectedPatientInfo, - activeColor: Colors.red[800], + activeColor: secondaryColor, onChanged: (value) { setState(() { widget.selectedPatientInfo = value; diff --git a/lib/pages/medical/eye/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 3f4df55f..bce778b8 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -74,7 +74,7 @@ class _EyeHomePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index ade69f45..431990e8 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -54,15 +54,19 @@ class MedicalProfilePage extends StatefulWidget { class _MedicalProfilePageState extends State { var authProvider = new AuthProvider(); - List medical=List(); + List medical = List(); ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { - projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); var appoCountProvider = Provider.of(context); - - List myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel,context: context,count: appoCountProvider.count,isLogin: projectViewModel.isLogin); - return BaseView( + List myMedicalList = Utils.myMedicalList( + projectViewModel: projectViewModel, + context: context, + count: appoCountProvider.count, + isLogin: projectViewModel.isLogin); + return BaseView( onModelReady: (model) => model.getAppointmentHistory(), builder: (_, model, widget) => AppScaffold( isShowDecPage: false, @@ -97,25 +101,30 @@ class _MedicalProfilePageState extends State { itemCount: model .appoitmentAllHistoryResultList.length, scrollDirection: Axis.horizontal, - reverse: !projectViewModel.isArabic, + reverse: projectViewModel.isArabic, ), ], ), ), - SizedBox(height: 50,), + SizedBox( + height: 50, + ), Padding( padding: EdgeInsets.symmetric(vertical: 5.0), child: GridView.builder( shrinkWrap: true, primary: false, physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, - childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 2.40), + childAspectRatio: MediaQuery.of(context) + .size + .width / + (MediaQuery.of(context).size.height / 2.40), ), itemCount: myMedicalList.length, itemBuilder: (BuildContext context, int index) { - return myMedicalList[index]; }, ), @@ -123,8 +132,7 @@ class _MedicalProfilePageState extends State { ], ), SizedBox( - height: - MediaQuery.of(context).size.height * 0.12, + height: MediaQuery.of(context).size.height * 0.12, ), if (model.user != null && model.isLogin) Positioned( @@ -135,7 +143,7 @@ class _MedicalProfilePageState extends State { width: double.infinity, height: 80, decoration: BoxDecoration( - color: Theme.of(context).primaryColor, + color: Colors.grey[500], shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, width: 0.5), @@ -187,20 +195,13 @@ class _MedicalProfilePageState extends State { ), ); } - - fullMedicalData(){ - if(projectViewModel.havePrivilege(5)) - {} - } } -class Medical{ - - final String title; - final String imagePath; - final String subTitle; - final Widget page; - - Medical({this.title, this.imagePath, this.subTitle, this.page}); +class Medical { + final String title; + final String imagePath; + final String subTitle; + final Widget page; + Medical({this.title, this.imagePath, this.subTitle, this.page}); } diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index a7b23191..71799084 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -1,188 +1,283 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:feather_icons_flutter/feather_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:provider/provider.dart'; class AddWeightPage extends StatefulWidget { + final WeightPressureViewModel model; + final bool isUpdate; + final DateTime dayWeightDate; + final int lineItemNo; + final String weightValue; + final String measureTimeSelectedType; + final int weightUnit; + + AddWeightPage( + {Key key, + this.model, + this.isUpdate = false, + this.dayWeightDate, + this.lineItemNo, + this.weightValue, + this.measureTimeSelectedType, + this.weightUnit}) + : super(key: key); + @override _AddWeightPageState createState() => _AddWeightPageState(); } class _AddWeightPageState extends State { TextEditingController _weightValueController = TextEditingController(); - DateTime bloodSugarDate = DateTime.now(); - DateTime timeSugarDate = DateTime.now(); + DateTime dayWeightDate = DateTime.now(); + DateTime timeWeightDate = DateTime.now(); int weightUnit = 1; final List measureUnitEnList = [ 'Kg', 'Pound', ]; - final List measureUnitArList = [ - 'Kg', - 'Pound', - ]; - String measureTimeSelectedType = 'Kg'; + final List measureUnitArList = ["كيلو جرام", "باوند"]; + String measureTimeSelectedType; + @override + void initState() { + super.initState(); + if (widget.isUpdate) { + dayWeightDate = widget.dayWeightDate; + timeWeightDate = widget.dayWeightDate; + measureTimeSelectedType = widget.measureTimeSelectedType; + if (measureUnitEnList.contains(widget.measureTimeSelectedType)) + weightUnit = measureUnitEnList.indexOf(widget.measureTimeSelectedType); + else if (measureUnitArList.contains(widget.measureTimeSelectedType)) + weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType); + _weightValueController.text = widget.weightValue; + } + } @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return BaseView( - builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - appBarTitle: 'Add', - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: 'Enter Weight Value', - controller: _weightValueController, - keyboardType: TextInputType.number, - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureUnitEnList - : measureUnitArList); + return AppScaffold( + isShowAppBar: true, + appBarTitle: widget.isUpdate + ? TranslationBase.of(context).update + : TranslationBase.of(context).add, + appBarIcons:widget.isUpdate? [ + IconButton( + icon: Icon(Icons.delete), + color: Colors.white, + onPressed: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: 'Remove this measure', + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () async { + ConfirmDialog.closeAlertDialog(context); + + GifLoaderDialogUtils.showMyDialog(context); + widget.model + .deleteWeightResult(lineItemNo: widget.lineItemNo) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.ErrorLocal) + AppToast.showErrorToast( + message: widget.model.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast( + message: widget.model.error); + }); }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], - ), + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + ) + ]:null, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.all(15), + child: Column( + children: [ + SizedBox( + height: 15, + ), + NewTextFields( + hintText: TranslationBase.of(context).weightAdd, + controller: _weightValueController, + keyboardType: TextInputType.number, + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic + ? measureUnitArList + : measureUnitEnList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType ?? + TranslationBase.of(context).other), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], ), ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), onConfirm: (date) { - print('confirm $date'); + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { setState(() { - bloodSugarDate = date; + dayWeightDate = date; }); }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts('Date'), - Texts(getDate()), - ], - ), + currentTime: dayWeightDate, + locale: projectViewModel.localeType, + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], ), ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, - onConfirm: (date) { - print('confirm $date'); + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showTimePicker( + context, + showTitleActions: true, + onConfirm: (date) { setState(() { - timeSugarDate = date; + timeWeightDate = date; }); }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts('Time'), Texts(getTime())], - ), + currentTime: timeWeightDate, + locale: projectViewModel.localeType, + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).time), + Texts(getTime()) + ], ), ), - ], - ), + ), + ], ), ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.2, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: SecondaryButton( - loading: model.state == ViewState.BusyLocal, - label: 'SAVE', - textColor: Colors.white, - onTap: () { - if (_weightValueController.text.isNotEmpty ) { - model.addWeightResult( - weightDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + ), + bottomSheet: Container( + color: Colors.transparent, + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.2, + child: Padding( + padding: const EdgeInsets.all(15.0), + child: SecondaryButton( + loading: widget.model.state == ViewState.BusyLocal, + label: TranslationBase.of(context).save.toUpperCase(), + textColor: Colors.white, + onTap: () { + if (_weightValueController.text.isNotEmpty) { + if (widget.isUpdate) { + GifLoaderDialogUtils.showMyDialog(context); + widget.model.updateWeightResult( + weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', weightMeasured: _weightValueController.text.toString(), weightUnit: weightUnit, - ); - } - }), - ), + lineItemNo: widget.lineItemNo + ) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.Error) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }); + } else + widget.model.addWeightResult( + weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', + weightMeasured: _weightValueController.text.toString(), + weightUnit: weightUnit, + ) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.Error) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }); + } + }), ), ), ); } String getDate() { - return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}"; + return "${DateUtil.getMonth(dayWeightDate.month)} ${dayWeightDate.day}, ${dayWeightDate.year}"; } String getTime() { - return " ${timeSugarDate.hour}:${timeSugarDate.minute}"; + return " ${timeWeightDate.hour}:${timeWeightDate.minute}"; } void confirmSelectMeasureTimeDialog(List list) { @@ -190,7 +285,7 @@ class _AddWeightPageState extends State { context: context, child: RadioStringDialog( radioList: list, - title: 'Measure unit', + title: TranslationBase.of(context).measureUnit, selectedValue: measureTimeSelectedType, onValueSelected: (value) { setState(() { diff --git a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart index 8e6f808c..c90b29a7 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart @@ -1,12 +1,15 @@ -import 'dart:ui'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'AddWeightPage.dart'; import 'WeightMonthlyPage.dart'; import 'WeightYeaPage.dart'; @@ -35,73 +38,42 @@ class _WeightHomePageState extends State @override Widget build(BuildContext context) { - return BaseView( + return BaseView( onModelReady: (model) => model.getWeight(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Weight', + appBarTitle: TranslationBase.of(context).weight, + appBarIcons: [IconButton( + icon: Icon(Icons.email), + color: Colors.white, + onPressed: () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async{ + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if(model.state == ViewState.ErrorLocal){ + AppToast.showErrorToast(message: model.error); + }else{ + AppToast.showSuccessToast(message:TranslationBase.of(context).emailSentSuccessfully, ); + } + }).catchError((e){ + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: model.error); + }); + }, + ), + ); + }, + ),], baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(60.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 55.0, - color: Colors.white, - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Weekly'), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Monthly'), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Yearly'), - ), - ), - ], - ), - ), - ), - ), - ], - ), + appBar: TabBarWidget( + tabController: _tabController, ), body: Column( children: [ @@ -111,16 +83,13 @@ class _WeightHomePageState extends State controller: _tabController, children: [ WeightWeeklyPage( - data: model.getWeightWeeklySeries(), - diabtecPatientResult: model.weekWeightMeasurementResult, + model: model, ), WeightMonthlyPage( - data: model.getWeightMonthlyTimeSeriesSales(), - diabtecPatientResult: model.monthWeightMeasurementResult, + model: model, ), WeightYearPage( - data: model.getWeightYearTimeSeriesSales(), - diabtecPatientResult: model.yearWeightMeasurementResult, + model: model, ) ], ), @@ -129,13 +98,15 @@ class _WeightHomePageState extends State ), floatingActionButton: InkWell( onTap: () { - Navigator.push(context, FadePage(page: AddWeightPage())); + Navigator.push(context, FadePage(page: AddWeightPage(model: model,))); }, child: Container( width: 55, height: 55, decoration: BoxDecoration( - shape: BoxShape.circle, color: HexColor('515B5D')), + shape: BoxShape.circle, + color: Theme.of(context).primaryColor, + ), child: Center( child: Icon( Icons.add, diff --git a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart index 9f7063f1..6f64bacb 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart @@ -3,41 +3,48 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPa import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthLineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class WeightMonthlyPage extends StatelessWidget { - final List> data; - final List diabtecPatientResult; + final WeightPressureViewModel model; - const WeightMonthlyPage({Key key, this.data, this.diabtecPatientResult}) - : super(key: key); + const WeightMonthlyPage({ + Key key, + this.model, + }) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: ListView( + body: model.weighMonthTimeSeriesData.isEmpty?Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):ListView( children: [ Container( - width: double.maxFinite, - height: 180, - color: Colors.white, - child: charts.LineChart(data, - //animate: animate, - defaultRenderer: - new charts.LineRendererConfig(includePoints: true)), - ), + width: double.maxFinite, + color: Colors.white, + child: MonthLineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weighMonthTimeSeriesData, + indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, + )), SizedBox( height: 12, ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -49,7 +56,7 @@ class WeightMonthlyPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context, projectViewModel, model), ), ], ), @@ -59,21 +66,27 @@ class WeightMonthlyPage extends StatelessWidget { ); } - List fullData() { + List fullData(BuildContext context, + ProjectViewModel projectViewModel, WeightPressureViewModel model) { List tableRow = []; tableRow.add( TableRow( children: [ Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + topRight: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -82,11 +95,11 @@ class WeightMonthlyPage extends StatelessWidget { ), Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -94,11 +107,19 @@ class WeightMonthlyPage extends StatelessWidget { height: 40), Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), + topRight: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + ), ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), @@ -107,7 +128,7 @@ class WeightMonthlyPage extends StatelessWidget { ], ), ); - diabtecPatientResult.forEach( + model.monthWeightMeasurementResult.forEach( (diabtec) { tableRow.add( TableRow( @@ -119,7 +140,7 @@ class WeightMonthlyPage extends StatelessWidget { color: Colors.white, child: Center( child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', textAlign: TextAlign.center, fontSize: 12, ), diff --git a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart index 9c3363dd..866c2b5b 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart @@ -1,32 +1,41 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import 'AddWeightPage.dart'; class WeightWeeklyPage extends StatelessWidget { - final List> data; - final List diabtecPatientResult; + final WeightPressureViewModel model; - const WeightWeeklyPage({Key key, this.data, this.diabtecPatientResult}) - : super(key: key); + const WeightWeeklyPage({Key key, this.model}) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return AppScaffold( - body: ListView( + body: model.weightWeekTimeSeriesData.isEmpty?Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):ListView( children: [ Container( - width: double.maxFinite, - height: 180, + margin: EdgeInsets.only(top: 12, left: 8, right: 8), color: Colors.white, - child: charts.TimeSeriesChart( - data, - dateTimeFactory: const charts.LocalDateTimeFactory(), + child: LineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightWeekTimeSeriesData, + indexes: model.weightWeekTimeSeriesData.length ~/ 5.5, ), ), SizedBox( @@ -34,7 +43,7 @@ class WeightWeeklyPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -46,7 +55,7 @@ class WeightWeeklyPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context, projectViewModel, model), ), ], ), @@ -56,21 +65,27 @@ class WeightWeeklyPage extends StatelessWidget { ); } - List fullData() { + List fullData(BuildContext context, + ProjectViewModel projectViewModel, WeightPressureViewModel model) { List tableRow = []; tableRow.add( TableRow( children: [ Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + topRight: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -79,11 +94,11 @@ class WeightWeeklyPage extends StatelessWidget { ), Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -91,37 +106,40 @@ class WeightWeeklyPage extends StatelessWidget { height: 40), Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), ), height: 40), Container( - child: Container( - decoration: BoxDecoration( - color: HexColor('#515B5D'), - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), - ), + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), + topRight: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), ), - child: Center( - child: Texts( - 'Edit', - color: Colors.white, - fontSize: 15, - ), + ), + child: Center( + child: Texts( + TranslationBase.of(context).edit, + color: Colors.white, + fontSize: 15, ), - height: 40), - ), + ), + height: 40), ], ), ); - diabtecPatientResult.forEach( + model.weekWeightMeasurementResult.forEach( (diabtec) { tableRow.add( TableRow( @@ -133,7 +151,7 @@ class WeightWeeklyPage extends StatelessWidget { color: Colors.white, child: Center( child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', textAlign: TextAlign.center, fontSize: 12, ), @@ -166,12 +184,30 @@ class WeightWeeklyPage extends StatelessWidget { ), ), ), - Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddWeightPage( + isUpdate: true, + dayWeightDate: diabtec.weightDate, + measureTimeSelectedType: 'Kg', + weightValue: diabtec.weightMeasured.toString(), + lineItemNo: diabtec.lineItemNo, + weightUnit: int.parse(diabtec.unit), + model: model, + ), + ), + ); + }, + child: Container( + height: 70, + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Icon(Icons.edit), + ), ), ), ], diff --git a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart index 587cc3f6..7fa03819 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart @@ -2,41 +2,48 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPr import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class WeightYearPage extends StatelessWidget { - final List> data; - final List diabtecPatientResult; + final WeightPressureViewModel model; - const WeightYearPage({Key key, this.data, this.diabtecPatientResult}) + + const WeightYearPage({Key key, this.model, }) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: ListView( + body: model.weightYearTimeSeriesData.isEmpty ? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),) : ListView( children: [ Container( - width: double.maxFinite, - height: 180, - color: Colors.white, - child: charts.TimeSeriesChart( - data, - dateTimeFactory: const charts.LocalDateTimeFactory(), - ), + width: double.maxFinite, + color: Colors.white, + child: LineChartCurved( + horizontalInterval: 2.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightYearTimeSeriesData, + indexes: model.weightYearTimeSeriesData.length ~/ 5.5, + ) ), SizedBox( height: 12, ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -48,7 +55,7 @@ class WeightYearPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context, projectViewModel, model), ), ], ), @@ -58,21 +65,27 @@ class WeightYearPage extends StatelessWidget { ); } - List fullData() { + List fullData(BuildContext context, + ProjectViewModel projectViewModel, WeightPressureViewModel model) { List tableRow = []; tableRow.add( TableRow( children: [ Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + topRight: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -81,11 +94,11 @@ class WeightYearPage extends StatelessWidget { ), Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -93,11 +106,19 @@ class WeightYearPage extends StatelessWidget { height: 40), Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), + topRight: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + ), ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), @@ -106,8 +127,8 @@ class WeightYearPage extends StatelessWidget { ], ), ); - diabtecPatientResult.forEach( - (diabtec) { + model.yearWeightMeasurementResult.forEach( + (diabtec) { tableRow.add( TableRow( children: [ @@ -118,7 +139,7 @@ class WeightYearPage extends StatelessWidget { color: Colors.white, child: Center( child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', textAlign: TextAlign.center, fontSize: 12, ), diff --git a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart index b8d9a557..678ef7dc 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart @@ -1,21 +1,41 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:feather_icons_flutter/feather_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:provider/provider.dart'; class AddBloodPressurePage extends StatefulWidget { + final DateTime bloodSugarDate; + final String measureTimeSelectedType; + final bool isUpdate; + final int lineItemNo; + final String bloodSystolicValue; + final String bloodDiastolicValue; + final BloodPressureViewMode model; + + const AddBloodPressurePage( + {Key key, + this.bloodSugarDate, + this.measureTimeSelectedType, + this.isUpdate=false, + this.lineItemNo, + this.model, + this.bloodSystolicValue, + this.bloodDiastolicValue}) + : super(key: key); + @override _AddBloodPressurePageState createState() => _AddBloodPressurePageState(); } @@ -28,8 +48,8 @@ class _AddBloodPressurePageState extends State { DateTime timeSugarDate = DateTime.now(); int measuredArm = 1; final List measureTimeEnList = [ - 'Left Arm', - 'Right Arm', + 'Left', + 'Right', ]; final List measureTimeArList = [ 'الذراع الأيسر', @@ -37,152 +57,220 @@ class _AddBloodPressurePageState extends State { ]; String measureTimeSelectedType = 'Left Arm'; + @override + void initState() { + super.initState(); + if (widget.isUpdate) { + bloodSugarDate = widget.bloodSugarDate; + bloodSugarDate = widget.bloodSugarDate; + measureTimeSelectedType = widget.measureTimeSelectedType; + if (measureTimeEnList.contains(widget.measureTimeSelectedType)) + measuredArm = measureTimeEnList.indexOf(widget.measureTimeSelectedType); + else if (measureTimeArList.contains(widget.measureTimeSelectedType)) + measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType); + _bloodSystolicValueController.text = widget.bloodSystolicValue; + _bloodDiastolicValueController.text = widget.bloodDiastolicValue; + } + } @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return BaseView( - builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - appBarTitle: 'Add', - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: 'Enter Systolic Value', - controller: _bloodSystolicValueController, - keyboardType: TextInputType.number, - ), - SizedBox( - height: 8, - ), - NewTextFields( - hintText: 'Blood Diastolic Value', - controller: _bloodDiastolicValueController, - keyboardType: TextInputType.number, - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureTimeEnList - : measureTimeArList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], - ), + return AppScaffold( + isShowAppBar: true, + appBarTitle: widget.isUpdate + ? TranslationBase.of(context).update + : TranslationBase.of(context).add, + appBarIcons: widget.isUpdate?[ + IconButton( + icon: Icon(Icons.delete), + color: Colors.white, + onPressed: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: 'Remove this measure', + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () async { + ConfirmDialog.closeAlertDialog(context); + + GifLoaderDialogUtils.showMyDialog(context); + widget.model + .deactivateDiabeticStatus(lineItemNo: widget.lineItemNo) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.model.error); + }); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + ) + ]:null, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.all(15), + child: Column( + children: [ + SizedBox( + height: 15, + ), + NewTextFields( + hintText: TranslationBase.of(context).systolicAdd, + controller: _bloodSystolicValueController, + keyboardType: TextInputType.number, + ), + SizedBox( + height: 8, + ), + NewTextFields( + hintText: TranslationBase.of(context).diastolicAdd, + controller: _bloodDiastolicValueController, + keyboardType: TextInputType.number, + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic + ? measureTimeEnList + : measureTimeArList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], ), ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), onConfirm: (date) { - print('confirm $date'); - setState(() { + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), onConfirm: (date) { + setState( + () { bloodSugarDate = date; - }); - }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); + }, + ); }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts('Date'), - Texts(getDate()), - ], - ), + currentTime: bloodSugarDate, + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], ), ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, - onConfirm: (date) { - print('confirm $date'); - setState(() { + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, showTitleActions: true, + onConfirm: (date) { + setState( + () { timeSugarDate = date; - }); - }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); + }, + ); }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts('Time'), Texts(getTime())], - ), + currentTime: timeSugarDate, + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).time), + Texts(getTime()) + ], ), ), - ], - ), + ), + ], ), ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.2, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: SecondaryButton( - loading: model.state == ViewState.BusyLocal, - label: 'SAVE', - textColor: Colors.white, - onTap: () { - if (_bloodSystolicValueController.text.isNotEmpty && - _bloodDiastolicValueController.text.isNotEmpty) { - model.addDiabtecResult( - bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - diastolicPressure: _bloodDiastolicValueController.text.toString(), - systolicePressure: _bloodSystolicValueController.text.toString(), - measuredArm: measuredArm, - ); - } - }), - ), + ), + bottomSheet: Container( + color: Colors.transparent, + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.2, + child: Padding( + padding: const EdgeInsets.all(15.0), + child: SecondaryButton( + loading: widget.model.state == ViewState.BusyLocal, + label: TranslationBase.of(context).save.toUpperCase(), + textColor: Colors.white, + onTap: () async { + if (_bloodSystolicValueController.text.isNotEmpty && + _bloodDiastolicValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + + widget.model.addORUpdateDiabtecResult( + isUpdate: widget.isUpdate, + bloodPressureDate: + '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + diastolicPressure: + _bloodDiastolicValueController.text.toString(), + systolicePressure: + _bloodSystolicValueController.text.toString(), + measuredArm: measuredArm, + ).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if(widget.model.state == ViewState.BusyLocal) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); +; + }).catchError((e){ + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.model.error); + }); + } + }), ), ), ); diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index e6bb3ed4..723871cb 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -1,15 +1,15 @@ -import 'dart:ui'; - +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - import 'AddBloodPressurePage.dart'; import 'BloodPressureMonthly.dart'; import 'BloodPressureYeaPage.dart'; @@ -42,69 +42,37 @@ class _BloodPressureHomePageState extends State onModelReady: (model) => model.getBloodPressure(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Blood Pressure', + appBarTitle: TranslationBase.of(context).bloodPressure, baseViewModel: model, + appBarIcons: [IconButton( + icon: Icon(Icons.email), + color: Colors.white, + onPressed: () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async{ + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if(model.state == ViewState.ErrorLocal){ + AppToast.showErrorToast(message: model.error); + }else{ + AppToast.showSuccessToast(message:TranslationBase.of(context).emailSentSuccessfully, ); + } + }).catchError((e){ + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: model.error); + }); + }, + ), + ); + }, + ),], body: Scaffold( extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(60.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 55.0, - color: Colors.white, - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Weekly'), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Monthly'), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Yearly'), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), + appBar: TabBarWidget(tabController: _tabController,), body: Column( children: [ Expanded( @@ -113,16 +81,13 @@ class _BloodPressureHomePageState extends State controller: _tabController, children: [ BloodPressureWeeklyPage( - data: model.getBloodWeeklySeries(), - diabtecPatientResult: model.weekDiabtecPatientResult, + model: model, ), BloodPressureMonthlyPage( - data: model.getBloodMonthlyTimeSeriesSales(), - diabtecPatientResult: model.monthDiabtecPatientResult, + model: model, ), BloodPressureYearPage( - data: model.getBloodYearTimeSeriesSales(), - diabtecPatientResult: model.yearDiabtecPatientResult, + model: model, ) ], ), @@ -131,13 +96,13 @@ class _BloodPressureHomePageState extends State ), floatingActionButton: InkWell( onTap: () { - Navigator.push(context, FadePage(page: AddBloodPressurePage())); + Navigator.push(context, FadePage(page: AddBloodPressurePage(model: model,))); }, child: Container( width: 55, height: 55, decoration: BoxDecoration( - shape: BoxShape.circle, color: HexColor('515B5D')), + shape: BoxShape.circle, color: Theme.of(context).primaryColor), child: Center( child: Icon( Icons.add, diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart index 8b9e504f..04853689 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart @@ -1,43 +1,45 @@ -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class BloodPressureMonthlyPage extends StatelessWidget { - final List> data; - final List diabtecPatientResult; + final BloodPressureViewMode model; + + const BloodPressureMonthlyPage({Key key, this.model}) : super(key: key); - const BloodPressureMonthlyPage( - {Key key, this.data, this.diabtecPatientResult}) - : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return AppScaffold( - body: ListView( + body: model.weighMonthTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):ListView( children: [ - Container( - width: double.maxFinite, - height: 180, - color: Colors.white, - child: charts.LineChart(data, - //animate: animate, - defaultRenderer: - new charts.LineRendererConfig(includePoints: true)), - ), + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: MonthCurvedChartBloodPressure( + horizontalInterval: 20.0, + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weighMonthTimeSeriesDataTop, + timeSeries2: model.weighMonthTimeSeriesDataLow, + indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, + ), + ), SizedBox( height: 12, ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -49,7 +51,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context,projectViewModel,model), ), ], ), @@ -59,7 +61,8 @@ class BloodPressureMonthlyPage extends StatelessWidget { ); } - List fullData() { + List fullData(BuildContext context, + ProjectViewModel projectViewModel, BloodPressureViewMode model) { List tableRow = []; tableRow.add( TableRow( @@ -67,7 +70,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), ), @@ -85,7 +88,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( @@ -99,11 +102,11 @@ class BloodPressureMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + 'Arm', color: Colors.white, fontSize: 15, ), @@ -113,14 +116,14 @@ class BloodPressureMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Value', + 'SBP/DBP', color: Colors.white, fontSize: 15, ), @@ -130,68 +133,50 @@ class BloodPressureMonthlyPage extends StatelessWidget { ], ), ); - diabtecPatientResult.forEach( + model.monthDiabtecPatientResult.reversed.forEach( (diabtec) { tableRow.add( TableRow( children: [ Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), + color: Colors.white, + child: Center( + child: Texts( + '${projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate):DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}', + fontSize: 15, + textAlign: TextAlign.center, ), ), + height: 40, ), Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), color: Colors.white, child: Center( child: Texts( '${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', - textAlign: TextAlign.center, - fontSize: 12, + fontSize: 15, ), ), - ), - ), + height: 40), Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), color: Colors.white, child: Center( child: Texts( - '${diabtec.measuredArmDesc}', - textAlign: TextAlign.center, - fontSize: 12, + diabtec.measuredArmDesc, + fontSize: 15, ), ), - ), - ), + height: 40), Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), color: Colors.white, child: Center( child: Texts( '${diabtec.systolicePressure}/${diabtec.diastolicPressure}', - textAlign: TextAlign.center, - fontSize: 12, color: Colors.red, + fontSize: 15, ), ), - ), - ), + height: 40), ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart index 0c67be7c..b5b01f06 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart @@ -1,33 +1,34 @@ -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class BloodPressureYearPage extends StatelessWidget { - final List> data; - final List diabtecPatientResult; + final BloodPressureViewMode model; - const BloodPressureYearPage({Key key, this.data, this.diabtecPatientResult}) - : super(key: key); + const BloodPressureYearPage({Key key, this.model}) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: ListView( + body: model.weightYearTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):ListView( children: [ Container( - width: double.maxFinite, - height: 180, + margin: EdgeInsets.only(top: 12, left: 8, right: 8), color: Colors.white, - child: charts.TimeSeriesChart( - data, - dateTimeFactory: const charts.LocalDateTimeFactory(), + child: CurvedChartBloodPressure( + horizontalInterval: 3.0,// model.weightWeekTimeSeriesDataLow.length==1 ?1 :20.0, + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weightYearTimeSeriesDataTop, + timeSeries2: model.weightYearTimeSeriesDataLow, + indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), ), SizedBox( @@ -35,7 +36,7 @@ class BloodPressureYearPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -47,7 +48,7 @@ class BloodPressureYearPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context, projectViewModel, model), ), ], ), @@ -57,7 +58,10 @@ class BloodPressureYearPage extends StatelessWidget { ); } - List fullData() { + List fullData( + BuildContext context, + ProjectViewModel projectViewModel, + BloodPressureViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( @@ -65,14 +69,19 @@ class BloodPressureYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + topRight: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -83,11 +92,11 @@ class BloodPressureYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -97,11 +106,11 @@ class BloodPressureYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + TranslationBase.of(context).measured, color: Colors.white, fontSize: 15, ), @@ -111,14 +120,19 @@ class BloodPressureYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), + topRight: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), @@ -128,7 +142,7 @@ class BloodPressureYearPage extends StatelessWidget { ], ), ); - diabtecPatientResult.forEach( + model.yearDiabtecPatientResult.reversed.forEach( (diabtec) { tableRow.add( TableRow( diff --git a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart index 52313483..e4ff7332 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart @@ -1,33 +1,37 @@ -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import 'AddBloodPressurePage.dart'; class BloodPressureWeeklyPage extends StatelessWidget { - final List> data; - final List diabtecPatientResult; + final BloodPressureViewMode model; - const BloodPressureWeeklyPage({Key key, this.data, this.diabtecPatientResult}) - : super(key: key); + const BloodPressureWeeklyPage({Key key, this.model}) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: ListView( + body: model.weightWeekTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),): ListView( children: [ Container( - width: double.maxFinite, - height: 180, + margin: EdgeInsets.only(top: 12, left: 8, right: 8), color: Colors.white, - child: charts.TimeSeriesChart( - data, - dateTimeFactory: const charts.LocalDateTimeFactory(), + child: CurvedChartBloodPressure( + horizontalInterval:3.0, + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weightWeekTimeSeriesDataTop, + timeSeries2: model.weightWeekTimeSeriesDataLow, + indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), ), SizedBox( @@ -35,7 +39,7 @@ class BloodPressureWeeklyPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -47,7 +51,7 @@ class BloodPressureWeeklyPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context, projectViewModel, model), ), ], ), @@ -57,7 +61,10 @@ class BloodPressureWeeklyPage extends StatelessWidget { ); } - List fullData() { + List fullData( + BuildContext context, + ProjectViewModel projectViewModel, + BloodPressureViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( @@ -65,14 +72,19 @@ class BloodPressureWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + topRight: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -83,11 +95,11 @@ class BloodPressureWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -97,11 +109,11 @@ class BloodPressureWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + TranslationBase.of(context).measured, color: Colors.white, fontSize: 15, ), @@ -111,11 +123,11 @@ class BloodPressureWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), @@ -125,14 +137,19 @@ class BloodPressureWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), + topRight: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Edit', + TranslationBase.of(context).edit, color: Colors.white, fontSize: 15, ), @@ -142,7 +159,7 @@ class BloodPressureWeeklyPage extends StatelessWidget { ], ), ); - diabtecPatientResult.forEach( + model.weekDiabtecPatientResult.reversed.forEach( (diabtec) { tableRow.add( TableRow( @@ -202,7 +219,23 @@ class BloodPressureWeeklyPage extends StatelessWidget { ), ), ), - Container( + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodPressurePage( + model: model, + isUpdate: true, + lineItemNo: diabtec.lineItemNo, + bloodSugarDate: diabtec.bloodPressureDate, + bloodDiastolicValue: diabtec.diastolicPressure.toString(), + bloodSystolicValue: diabtec.systolicePressure.toString(), + measureTimeSelectedType: diabtec.measuredArmDesc, + ), + ), + ); + }, child: Container( height: 70, padding: EdgeInsets.all(10), diff --git a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart index 00f06a25..94e48b92 100644 --- a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart @@ -1,20 +1,41 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:feather_icons_flutter/feather_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:provider/provider.dart'; class AddBloodSugarPage extends StatefulWidget { + final DateTime bloodSugarDate; + final String measureUnitSelectedType; + final bool isUpdate; + final String measuredTime; + final String bloodSugarValue; + final int lineItemNo; + final BloodSugarViewMode bloodSugarViewMode; + + AddBloodSugarPage( + {Key key, + this.bloodSugarDate, + this.measureUnitSelectedType, + this.isUpdate = false, + this.measuredTime, + this.bloodSugarValue, + this.lineItemNo, + this.bloodSugarViewMode}) + : super(key: key); + @override _AddBloodSugarPageState createState() => _AddBloodSugarPageState(); } @@ -24,7 +45,7 @@ class _AddBloodSugarPageState extends State { DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); String measureUnitSelectedType = 'mg/dlt'; - int measuredTime=1; + int measuredTime = 1; final List measureUnitList = ['mg/dlt', 'mol/L']; final List measureTimeEnList = [ 'Before Breakfast', @@ -39,270 +60,268 @@ class _AddBloodSugarPageState extends State { 'Other', ]; final List measureTimeArList = [ - 'Before Breakfast', - 'After Breakfast', - 'Before Lunch', - 'After Lunch', - 'Before Dinner', - 'After Dinner', - 'Before Sleep', - 'After Sleep', - 'Fasting', - 'Other', + "قبل الإفطار", + "بعد الإفطار", + "بعد الغداء", + "بعد الغداء", + "قبل العشاء", + "بعد العشاء", + "قبل النوم", + "بعد النوم", + "صائم", + "آخر", ]; String measureTimeSelectedType; + @override + void initState() { + super.initState(); + if (widget.isUpdate) { + bloodSugarDate = widget.bloodSugarDate; + timeSugarDate = widget.bloodSugarDate; + measureUnitSelectedType = widget.measureUnitSelectedType; + if (measureTimeEnList.contains(widget.measuredTime)) + measuredTime = measureTimeEnList.indexOf(widget.measuredTime); + else if (measureTimeArList.contains(widget.measuredTime)) + measuredTime = measureTimeArList.indexOf(widget.measuredTime); + _bloodSugarValueController.text = widget.bloodSugarValue; + } + } @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - showTaskOptions() { - showModalBottomSheet( - backgroundColor: Colors.white, - context: context, - builder: (BuildContext bc) { - return Container( - padding: EdgeInsets.symmetric(vertical: 12.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.0), - topRight: Radius.circular(16.0))), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(3.0)), - width: 40.0, - height: 6.0, - ), - InkWell( - onTap: () { + return AppScaffold( + isShowAppBar: true, + appBarTitle: widget.isUpdate + ? TranslationBase.of(context).update + : TranslationBase.of(context).add, + appBarIcons: widget.isUpdate?[ + IconButton( + icon: Icon(Icons.delete), + color: Colors.white, + onPressed: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: 'Remove this measure', + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () async { + ConfirmDialog.closeAlertDialog(context); + + GifLoaderDialogUtils.showMyDialog(context); + widget.bloodSugarViewMode + .deactivateDiabeticStatus(lineItemNo: widget.lineItemNo) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast( + message: widget.bloodSugarViewMode.error); + else Navigator.pop(context); - }, - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 18.0), - child: Row( - children: [ - Icon( - FeatherIcons.share, - color: Theme - .of(context) - .primaryColor, - size: 18.0, - ), - SizedBox(width: 24.0), - Texts('Share Task', - variant: "body2Link", color: Colors.grey[800]), - ], - ), - ), + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast( + message: widget.bloodSugarViewMode.error); + }); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + ) + ]:null, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.all(15), + child: Column( + children: [ + SizedBox( + height: 15, + ), + NewTextFields( + hintText: TranslationBase.of(context).sugarAdd, + controller: _bloodSugarValueController, + keyboardType: TextInputType.number, + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureUnitDialog(); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureUnitSelectedType), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], ), - InkWell( - onTap: () { - Navigator.pop(context); - // Navigator.of(context).push(SlideUpPageRoute(widget: PostTaskIndex(task: new Task(category: task?.category, description: task?.description, title: task?.title)))); - }, - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 18.0), - child: Row( - children: [ - Icon( - FeatherIcons.copy, - color: Theme - .of(context) - .primaryColor, - size: 18.0, - ), - SizedBox(width: 24.0), - Texts('Post Similar Task', - variant: "body2Link", color: Colors.grey[800]), - ], - ), - ), + ), + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), onConfirm: (date) { + setState(() { + bloodSugarDate = date; + }); + }, + currentTime: bloodSugarDate, + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], ), - ], + ), ), - ); - }); - } - - return BaseView( - builder: (_, model, w) => - AppScaffold( - isShowAppBar: true, - appBarTitle: 'Add', - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: 'Enter Blood Sugar Value', - controller: _bloodSugarValueController, - keyboardType: TextInputType.number, - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureUnitDialog(); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureUnitSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], - ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(DateTime - .now() - .year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - print('confirm $date'); - setState(() { - bloodSugarDate = date; - }); - }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts('Date'), - Texts(getDate()), - ], - ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker( - context, showTitleActions: true, - onConfirm: (date) { - print('confirm $date'); - setState(() { - timeSugarDate = date; - }); - }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts('Time'), Texts(getTime())], - ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureTimeEnList - : measureTimeArList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType ?? 'Others'), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], - ), - ), - ), - ], + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, showTitleActions: true, + onConfirm: (date) { + setState(() { + timeSugarDate = date; + }); + }, + currentTime: timeSugarDate, + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).time), + Texts(getTime()) + ], + ), ), ), - ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery - .of(context) - .size - .width * 0.2, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: SecondaryButton( - loading: model.state == ViewState.BusyLocal, - label: 'SAVE', textColor: Colors.white, onTap: () { - if (_bloodSugarValueController.text.isNotEmpty) { - model.addDiabtecResult(diabtecUnit: measureUnitSelectedType, - measuredTime: measuredTime, - bloodSugerResult:_bloodSugarValueController.text.toString(), - bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - - ); - } - }), + SizedBox( + height: 8, ), - ), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic + ? measureTimeArList + : measureTimeEnList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType ?? + TranslationBase.of(context).other), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), + ), + ), + ], ), + ), + ), + bottomSheet: Container( + color: Colors.transparent, + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.2, + child: Padding( + padding: const EdgeInsets.all(15.0), + child: SecondaryButton( + label: TranslationBase.of(context).save.toUpperCase(), + textColor: Colors.white, + onTap: () { + if (_bloodSugarValueController.text.isNotEmpty) { + if (widget.isUpdate) { + GifLoaderDialogUtils.showMyDialog(context); + widget.bloodSugarViewMode + .updateDiabtecResult( + month: bloodSugarDate, + hour: timeSugarDate, + diabtecUnit: measureUnitSelectedType, + measuredTime: measuredTime, + lineItemNo: widget.lineItemNo, + bloodSugerResult: + _bloodSugarValueController.text.toString()) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast( + message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + }); + } else + widget.bloodSugarViewMode + .addDiabtecResult( + diabtecUnit: measureUnitSelectedType, + measuredTime: measuredTime, + bloodSugerResult: + _bloodSugarValueController.text.toString(), + bloodSugerDateChart: + '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + ) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.Error) + AppToast.showErrorToast( + message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + }); + } + }), + ), + ), ); } String getDate() { - return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate - .day}, ${bloodSugarDate.year}"; + return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}"; } String getTime() { @@ -314,7 +333,7 @@ class _AddBloodSugarPageState extends State { context: context, child: RadioStringDialog( radioList: measureUnitList, - title: 'Measure unit', + title: TranslationBase.of(context).measureUnit, selectedValue: measureUnitSelectedType, onValueSelected: (value) { setState(() { @@ -330,7 +349,7 @@ class _AddBloodSugarPageState extends State { context: context, child: RadioStringDialog( radioList: list, - title: 'Measure time', + title: TranslationBase.of(context).measureTime, selectedValue: measureTimeSelectedType, onValueSelected: (value) { setState(() { diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart index fdd7b348..1294c5dd 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart @@ -1,40 +1,47 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthLineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class BloodMonthlyPage extends StatelessWidget { - final List> data; final List diabtecPatientResult; + final List timeSeriesData ; - const BloodMonthlyPage({Key key, this.data, this.diabtecPatientResult}) + const BloodMonthlyPage({Key key, this.diabtecPatientResult, this.timeSeriesData}) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: ListView( + body: timeSeriesData.isEmpty?Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),): ListView( children: [ Container( - width: double.maxFinite, - height: 180, - color: Colors.white, - child: charts.LineChart(data, - //animate: animate, - defaultRenderer: - new charts.LineRendererConfig(includePoints: true)), + width: double.maxFinite, + color: Colors.white, + child: MonthLineChartCurved( + title: 'Sugar', + timeSeries: timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, + ) ), SizedBox( height: 12, ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -46,7 +53,7 @@ class BloodMonthlyPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context,projectViewModel), ), ], ), @@ -56,7 +63,7 @@ class BloodMonthlyPage extends StatelessWidget { ); } - List fullData() { + List fullData(BuildContext context,ProjectViewModel projectViewModel) { List tableRow = []; tableRow.add( TableRow( @@ -64,14 +71,15 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -82,11 +90,11 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -96,11 +104,11 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + TranslationBase.of(context).measured, color: Colors.white, fontSize: 15, ), @@ -110,20 +118,22 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), ), height: 40), ), + ], ), ); @@ -139,7 +149,7 @@ class BloodMonthlyPage extends StatelessWidget { color: Colors.white, child: Center( child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart):DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', textAlign: TextAlign.center, fontSize: 12, ), diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart index 47f87847..842d55f1 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart @@ -1,62 +1,75 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class BloodYearPage extends StatelessWidget { - final List> data; final List diabtecPatientResult; + final List timeSeriesData; - const BloodYearPage({Key key, this.data, this.diabtecPatientResult}) + const BloodYearPage({Key key, this.diabtecPatientResult, this.timeSeriesData}) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: ListView( - children: [ - Container( - width: double.maxFinite, - height: 180, - color: Colors.white, - child: charts.TimeSeriesChart( - data, - dateTimeFactory: const charts.LocalDateTimeFactory(), - ), - ), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts('Details'), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(), + body: timeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : ListView( + children: [ + Container( + width: double.maxFinite, + color: Colors.white, + child: LineChartCurved( + title: 'Sugar', + timeSeries: timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, + )), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + border: TableBorder.symmetric( + inside: + BorderSide(width: 2.0, color: Colors.grey[300]), + ), + children: fullData(context, projectViewModel), + ), + ], + ), + ) ], ), - ) - ], - ), ); } - List fullData() { + List fullData( + BuildContext context, ProjectViewModel projectViewModel) { List tableRow = []; tableRow.add( TableRow( @@ -64,14 +77,19 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + topRight: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -82,11 +100,11 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -96,11 +114,11 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + TranslationBase.of(context).measured, color: Colors.white, fontSize: 15, ), @@ -110,14 +128,19 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), + topRight: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), @@ -139,7 +162,7 @@ class BloodYearPage extends StatelessWidget { color: Colors.white, child: Center( child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', textAlign: TextAlign.center, fontSize: 12, ), diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart index 9259e286..7abbcceb 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart @@ -1,9 +1,14 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -42,70 +47,38 @@ class _BloodSugarHomePageState extends State return BaseView( onModelReady: (model) => model.getBloodSugar(), builder: (_, model, w) => AppScaffold( + appBarIcons: [IconButton( + icon: Icon(Icons.email), + color: Colors.white, + onPressed: () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async{ + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if(model.state == ViewState.ErrorLocal){ + AppToast.showErrorToast(message: model.error); + }else{ + AppToast.showSuccessToast(message:TranslationBase.of(context).emailSentSuccessfully, ); + } + }).catchError((e){ + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: model.error); + }); + }, + ), + ); + }, + ),], isShowAppBar: true, - appBarTitle: 'Blood Sugar', + appBarTitle: TranslationBase.of(context).bloodSugar, baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(60.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 55.0, - color: Colors.white, - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Weekly'), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Monthly'), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.27, - child: Center( - child: Texts('Yearly'), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), + appBar: TabBarWidget(tabController: _tabController,), body: Column( children: [ Expanded( @@ -114,15 +87,16 @@ class _BloodSugarHomePageState extends State controller: _tabController, children: [ BloodSugarWeeklyPage( - data: model.getBloodWeeklySeries(), + timeSeriesData: model.bloodWeekTimeSeriesData, diabtecPatientResult: model.weekDiabtecPatientResult, + bloodSugarViewMode: model, ), BloodMonthlyPage( - data: model.getBloodMonthlyTimeSeriesSales(), + timeSeriesData: model.monthTimeSeriesData, diabtecPatientResult: model.monthDiabtecPatientResult, ), BloodYearPage( - data: model.getBloodYearTimeSeriesSales(), + timeSeriesData: model.yearTimeSeriesData, diabtecPatientResult: model.yearDiabtecPatientResult, ) ], @@ -132,13 +106,13 @@ class _BloodSugarHomePageState extends State ), floatingActionButton: InkWell( onTap: () { - Navigator.push(context, FadePage(page: AddBloodSugarPage())); + Navigator.push(context, FadePage(page: AddBloodSugarPage(bloodSugarViewMode: model,))); }, child: Container( width: 55, height: 55, decoration: BoxDecoration( - shape: BoxShape.circle, color: HexColor('515B5D')), + shape: BoxShape.circle, color:Theme.of(context).primaryColor), child: Center( child: Icon( Icons.add, diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart index 4b007929..60f3293d 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart @@ -1,32 +1,45 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; +import 'AddBloodSugarPage.dart'; class BloodSugarWeeklyPage extends StatelessWidget { - final List> data; final List diabtecPatientResult; + final BloodSugarViewMode bloodSugarViewMode; + final List timeSeriesData; - const BloodSugarWeeklyPage({Key key, this.data, this.diabtecPatientResult}) + BloodSugarWeeklyPage( + {Key key, + this.diabtecPatientResult, + this.bloodSugarViewMode, + this.timeSeriesData}) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: ListView( + body:timeSeriesData.isEmpty?Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),): ListView( children: [ Container( - width: double.maxFinite, - height: 180, + margin: EdgeInsets.only(top: 12, left: 8, right: 8), color: Colors.white, - child: charts.TimeSeriesChart( - data, - dateTimeFactory: const charts.LocalDateTimeFactory(), + child: LineChartCurved( + title: 'Sugar', + timeSeries: timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, ), ), SizedBox( @@ -34,7 +47,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -46,7 +59,8 @@ class BloodSugarWeeklyPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: + fullData(context, projectViewModel, bloodSugarViewMode), ), ], ), @@ -56,7 +70,10 @@ class BloodSugarWeeklyPage extends StatelessWidget { ); } - List fullData() { + List fullData( + BuildContext context, + ProjectViewModel projectViewModel, + BloodSugarViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( @@ -64,14 +81,19 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + topRight: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -82,11 +104,11 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -96,11 +118,11 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + TranslationBase.of(context).measured, color: Colors.white, fontSize: 15, ), @@ -110,11 +132,11 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), @@ -124,14 +146,19 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), + topRight: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Edit', + TranslationBase.of(context).edit, color: Colors.white, fontSize: 15, ), @@ -153,7 +180,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { color: Colors.white, child: Center( child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)}', + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart):DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', textAlign: TextAlign.center, fontSize: 12, ), @@ -203,12 +230,30 @@ class BloodSugarWeeklyPage extends StatelessWidget { ), ), Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodSugarPage( + isUpdate: true, + bloodSugarDate: diabtec.dateChart, + measuredTime: diabtec.measuredDesc, + bloodSugarValue: diabtec.resultValue.toString(), + lineItemNo: diabtec.lineItemNo, + measureUnitSelectedType: diabtec.unit, + bloodSugarViewMode: bloodSugarViewMode, + ), + ), + ); + }, + child: Container( + height: 70, + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Icon(Icons.edit), + ), ), ), ), diff --git a/lib/pages/medical/my_trackers/my_trackers.dart b/lib/pages/medical/my_trackers/my_trackers.dart index ecdf5a53..5e5c4527 100644 --- a/lib/pages/medical/my_trackers/my_trackers.dart +++ b/lib/pages/medical/my_trackers/my_trackers.dart @@ -1,3 +1,5 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -11,7 +13,7 @@ class MyTrackers extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: 'My Tracker', + appBarTitle: TranslationBase.of(context).myTracker, isShowAppBar: true, body: SingleChildScrollView( child: Container( @@ -41,7 +43,7 @@ class MyTrackers extends StatelessWidget { children: [ Image.asset('assets/tracker/blood-suger.png',width: 60.0,), SizedBox(height: 15,), - Text('Blood Sugar'), + Texts(TranslationBase.of(context).bloodSugar), ], ), ), @@ -65,7 +67,7 @@ class MyTrackers extends StatelessWidget { children: [ Image.asset('assets/tracker/blood-pressure.png',width: 60.0,), SizedBox(height: 15,), - Text('Blood Pressure'), + Texts(TranslationBase.of(context).bloodPressure), ], ), ), @@ -94,7 +96,7 @@ class MyTrackers extends StatelessWidget { children: [ Image.asset('assets/tracker/weight.png',width: 60.0,), SizedBox(height: 15,), - Text('Weight'), + Texts(TranslationBase.of(context).weight), ], ), ), diff --git a/lib/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart b/lib/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart new file mode 100644 index 00000000..ac2349bc --- /dev/null +++ b/lib/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart @@ -0,0 +1,273 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +import '../../../../Constants.dart'; + +class CurvedChartBloodPressure extends StatelessWidget { + final String title; + final List timeSeries1; + final List timeSeries2; + final int indexes; + final double horizontalInterval; + + CurvedChartBloodPressure( + {this.title, + this.timeSeries1, + this.indexes, + this.timeSeries2, + this.horizontalInterval = 20.0}); + + List xAxixs = List(); + List yAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 15, + ), + Text( + title, + style: TextStyle( + color: Colors.black, fontSize: 15, letterSpacing: 2), + textAlign: TextAlign.center, + ), + SizedBox( + height: 10, + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + SizedBox( + height: 10, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + children: [ + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Theme.of(context).primaryColor), + ), + SizedBox( + width: 5, + ), + Texts(TranslationBase.of(context).systolicLng) + ], + ), + SizedBox( + width: 15, + ), + Row( + children: [ + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + shape: BoxShape.rectangle, color: secondaryColor), + ), + SizedBox( + width: 5, + ), + Texts(TranslationBase.of(context).diastolicLng) + ], + ), + ], + ) + ], + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries1.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries1.length) { + xAxixs.add(mIndex); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + + margin: 22, + getTitles: (value) { + if (timeSeries1.length < 15) { + if (timeSeries1.length > value.toInt()) { + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (value.toInt() == timeSeries1.length - 1) + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (xAxixs.contains(value.toInt())) { + return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + } + } + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + getTitles: (value) { + if (value.toInt() == 0) + return '${value.toInt()}'; + else if (value.toInt() % horizontalInterval == 0) + return '${value.toInt()}'; + else + return ''; + }, + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries1.length - 1).toDouble(), + maxY: getMaxY() + 0.3, + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + timeSeries2.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = timeSeries1[0].sales; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + timeSeries2.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries1.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); + } + + List spots2 = List(); + for (int index = 0; index < timeSeries2.length; index++) { + spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Colors.red], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + final LineChartBarData lineChartBarData2 = LineChartBarData( + spots: spots2, + isCurved: true, + colors: [Theme.of(context).primaryColor], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [lineChartBarData1, lineChartBarData2]; + } +} diff --git a/lib/pages/medical/my_trackers/widget/LineChartCurved.dart b/lib/pages/medical/my_trackers/widget/LineChartCurved.dart new file mode 100644 index 00000000..eeff06dd --- /dev/null +++ b/lib/pages/medical/my_trackers/widget/LineChartCurved.dart @@ -0,0 +1,222 @@ +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +import '../../../../Constants.dart'; + +class LineChartCurved extends StatelessWidget { + final String title; + final List timeSeries; + final int indexes; + final double horizontalInterval; + + LineChartCurved( + {this.title, + this.timeSeries, + this.indexes, + this.horizontalInterval = 20.0}); + + List xAxixs = List(); + List yAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + getYaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 4, + ), + Text( + title, + style: TextStyle( + color: Colors.black, fontSize: 15, letterSpacing: 2), + textAlign: TextAlign.center, + ), + SizedBox( + height: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + right: 18.0, left: 16.0, top: 15, bottom: 15), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + const SizedBox( + height: 10, + ), + ], + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries.length) { + xAxixs.add(mIndex); + } + } + } + + getYaxix() { + int indexess = (timeSeries.length * 0.30).toInt(); + for (int index = 0; index < timeSeries.length; index++) { + int mIndex = indexess * index; + if (mIndex < timeSeries.length) { + yAxixs.add(timeSeries[mIndex].sales); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + horizontalInterval: horizontalInterval, + show: true, + drawVerticalLine: true, + drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + // rotateAngle: 90, + //rotateAngle:-65, + margin: 22, + getTitles: (value) { + if (timeSeries.length < 15) { + if (timeSeries.length > value.toInt()) { + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (value.toInt() == timeSeries.length - 1) + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (xAxixs.contains(value.toInt())) { + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + } + } + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + getTitles: (value) { + if (value.toInt() == 0) + return '${value.toInt()}'; + else if (value.toInt() % horizontalInterval == 0) + return '${value.toInt()}'; + else + return ''; + }, + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries.length - 1).toDouble(), + maxY: getMaxY() + 0.3, + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = timeSeries[0].sales; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [secondaryColor], + barWidth: 5, + isStrokeCapRound: true, + curveSmoothness: 0.12, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [ + lineChartBarData1, + ]; + } +} diff --git a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart new file mode 100644 index 00000000..135d0a95 --- /dev/null +++ b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart @@ -0,0 +1,252 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class MonthCurvedChartBloodPressure extends StatelessWidget { + final String title; + final List timeSeries1; + final List timeSeries2; + final int indexes; + final double horizontalInterval; + + MonthCurvedChartBloodPressure( + {this.title, this.timeSeries1, this.indexes, this.timeSeries2, this.horizontalInterval = 20.0}); + + List xAxixs = List(); + List yAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 15, + ), + Text( + title, + style: TextStyle( + color: Colors.black, fontSize: 15, letterSpacing: 2), + textAlign: TextAlign.center, + ), + SizedBox( + height: 10, + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + SizedBox( + height: 10, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + children: [ + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Theme.of(context).primaryColor), + ), + SizedBox( + width: 5, + ), + Texts(TranslationBase.of(context).systolicLng) + ], + ), + SizedBox( + width: 15, + ), + Row( + children: [ + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + shape: BoxShape.rectangle, color: Colors.grey), + ), + SizedBox( + width: 5, + ), + Texts(TranslationBase.of(context).diastolicLng) + ], + ), + ], + ) + ], + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries1.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries1.length) { + xAxixs.add(mIndex); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + margin: 22, + getTitles: (value) { + return ''; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + getTitles: (value) { + if (value.toInt() == 0) + return '${value.toInt()}'; + else if (value.toInt() % horizontalInterval == 0) + return '${value.toInt()}'; + else + return ''; + }, + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries1.length - 1).toDouble(), + maxY: getMaxY() + 0.3, + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + timeSeries2.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = timeSeries1[0].sales; + timeSeries1.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + timeSeries2.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries1.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); + } + + List spots2 = List(); + for (int index = 0; index < timeSeries2.length; index++) { + spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [Colors.red], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + final LineChartBarData lineChartBarData2 = LineChartBarData( + spots: spots2, + isCurved: true, + colors: [Theme.of(context).primaryColor], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [lineChartBarData1, lineChartBarData2]; + } +} diff --git a/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart b/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart new file mode 100644 index 00000000..607f3ab0 --- /dev/null +++ b/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart @@ -0,0 +1,206 @@ +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +import '../../../../Constants.dart'; + +class MonthLineChartCurved extends StatelessWidget { + final String title; + final List timeSeries; + final int indexes; + final double horizontalInterval; + + MonthLineChartCurved( + {this.title, + this.timeSeries, + this.indexes, + this.horizontalInterval = 15.0}); + + List xAxixs = List(); + List yAxixs = List(); + + @override + Widget build(BuildContext context) { + getXaxix(); + getYaxix(); + return AspectRatio( + aspectRatio: 1.1, + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18)), + // color: Colors.white, + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox( + height: 4, + ), + Text( + title, + style: TextStyle( + color: Colors.black, fontSize: 15, letterSpacing: 2), + textAlign: TextAlign.center, + ), + SizedBox( + height: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + right: 18.0, left: 16.0, top: 15, bottom: 15), + child: LineChart( + sampleData1(context), + swapAnimationDuration: const Duration(milliseconds: 250), + ), + ), + ), + const SizedBox( + height: 10, + ), + ], + ), + ], + ), + ), + ); + } + + getXaxix() { + for (int index = 0; index < timeSeries.length; index++) { + int mIndex = indexes * index; + if (mIndex < timeSeries.length) { + xAxixs.add(mIndex); + } + } + } + + getYaxix() { + int indexess = (timeSeries.length * 0.30).toInt(); + for (int index = 0; index < timeSeries.length; index++) { + int mIndex = indexess * index; + if (mIndex < timeSeries.length) { + yAxixs.add(timeSeries[mIndex].sales); + } + } + } + + LineChartData sampleData1(context) { + return LineChartData( + lineTouchData: LineTouchData( + touchTooltipData: LineTouchTooltipData( + tooltipBgColor: Colors.white, + ), + touchCallback: (LineTouchResponse touchResponse) {}, + handleBuiltInTouches: true, + ), + gridData: FlGridData( + horizontalInterval: horizontalInterval, + show: true, + drawVerticalLine: true, + drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + margin: 22, + getTitles: (value) { + return '${value.toInt()}'; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + getTitles: (value) { + if (value.toInt() == 0) + return '${value.toInt()}'; + else if (value.toInt() % horizontalInterval == 0) + return '${value.toInt()}'; + else + return ''; + }, + margin: 12, + ), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide( + color: Colors.black, + width: 0.5, + ), + left: BorderSide( + color: Colors.black, + ), + right: BorderSide( + color: Colors.black, + ), + top: BorderSide( + color: Colors.transparent, + ), + ), + ), + minX: 0, + maxX: (timeSeries.length - 1).toDouble(), + maxY: getMaxY() + 0.3, + minY: getMinY(), + lineBarsData: getData(context), + ); + } + + double getMaxY() { + double max = 0; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble > max) max = resultValueDouble; + }); + + return max.roundToDouble(); + } + + double getMinY() { + double min = timeSeries[0].sales; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < min) min = resultValueDouble; + }); + int value = min.toInt(); + + return value.toDouble(); + } + + List getData(context) { + List spots = List(); + for (int index = 0; index < timeSeries.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); + } + + final LineChartBarData lineChartBarData1 = LineChartBarData( + spots: spots, + isCurved: true, + colors: [secondaryColor], + barWidth: 5, + isStrokeCapRound: true, + curveSmoothness: 0.0, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [ + lineChartBarData1, + ]; + } +} diff --git a/lib/pages/medical/my_trackers/widget/TabBarWidget.dart b/lib/pages/medical/my_trackers/widget/TabBarWidget.dart new file mode 100644 index 00000000..199dbc54 --- /dev/null +++ b/lib/pages/medical/my_trackers/widget/TabBarWidget.dart @@ -0,0 +1,73 @@ +import 'dart:ui'; + +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class TabBarWidget extends StatelessWidget with PreferredSizeWidget{ + final TabController tabController; + + const TabBarWidget({Key key, this.tabController}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Positioned( + bottom: 1, + left: 0, + right: 0, + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: Container( + color: + Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8), + height: 70.0, + ), + ), + ), + Center( + child: Container( + height: 55.0, + color: Colors.white, + child: Center( + child: TabBar( + isScrollable: true, + controller: tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.33, + child: Center( + child: Texts(TranslationBase.of(context).weekly), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.33, + child: Center( + child: Texts(TranslationBase.of(context).monthlyT), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.34, + child: Center( + child: Texts(TranslationBase.of(context).yearly), + ), + ), + ], + ), + ), + ), + ), + ], + ); + } + @override + Size get preferredSize => Size(double.maxFinite, 60); +} diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 96d4aba0..380d6284 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -71,12 +71,12 @@ class _HomePrescriptionsPageState extends State child: Container( height: 60.0, margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.of(context).size.width * 0.92, decoration: BoxDecoration( border: Border( bottom: BorderSide( color: Theme.of(context).dividerColor, - width: 0.7), + width: 0.9), //width: 0.7 ), color: Colors.white), child: Center( @@ -84,10 +84,10 @@ class _HomePrescriptionsPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( diff --git a/lib/pages/medical/reports/monthly_reports.dart b/lib/pages/medical/reports/monthly_reports.dart index ae9cc295..4484bd5f 100644 --- a/lib/pages/medical/reports/monthly_reports.dart +++ b/lib/pages/medical/reports/monthly_reports.dart @@ -2,10 +2,12 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/user_agreement_page.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/custom_switch.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -19,6 +21,8 @@ class MonthlyReportsPage extends StatefulWidget { class _MonthlyReportsPageState extends State { bool isAgree = false; bool isSummary = false; + String email = ""; + final formKey = GlobalKey(); @override Widget build(BuildContext context) { @@ -29,135 +33,161 @@ class _MonthlyReportsPageState extends State { body: SingleChildScrollView( child: Container( padding: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(9), - height: 55, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(8)), - shape: BoxShape.rectangle, - border: Border.all(color: Colors.grey)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).patientHealthSummaryReport, - bold: true, - ), - CustomSwitch( - value: isSummary, - activeColor: Colors.red, - inactiveColor: Colors.grey, - onChanged: () async { - setState(() { - isSummary = !isSummary; - }); - }, - ) - ], + child: Form( + key: formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(9), + height: 55, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(8)), + shape: BoxShape.rectangle, + border: Border.all(color: Colors.grey)), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + Texts( + TranslationBase.of(context).patientHealthSummaryReport, + bold: true, + ), + CustomSwitch( + value: isSummary, + activeColor: Colors.red, + inactiveColor: Colors.grey, + onChanged: () async { + setState(() { + isSummary = !isSummary; + }); + if(!isSummary) { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePatientHealthSummaryReport( + message: TranslationBase + .of(context) + .updateSuccessfully, isSummary: isSummary); + GifLoaderDialogUtils.hideDialog(context); + } + }, + ) + ], + ), ), - ), - SizedBox( - height: 15, - ), - Container( - margin: EdgeInsets.all(8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - model.user.emailAddress, - bold: true, - ), - ], + SizedBox( + height: 15, ), - ), - Divider( - height: 10.4, - thickness: 1.0, - ), - SizedBox( - height: 15, - ), - Container( - margin: EdgeInsets.all(8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + Container( + margin: EdgeInsets.all(8), + child: TextFields( + fillColor: Colors.red, + hintText: 'email@email.com', + fontSize: 20, + initialValue: model.user.emailAddress, + fontWeight: FontWeight.w600, + onChanged: (text) { + email = text; + }, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context).enterEmail; + else + return null; + }, + ), + ), + Divider( + height: 10.4, + thickness: 1.0, + ), + SizedBox( + height: 15, + ), + Container( + margin: EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Texts(TranslationBase.of(context) + .toViewTheTermsAndConditions), + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: UserAgreementContent(), + ), + ); + }, + child: Texts( + TranslationBase.of(context).clickHere, + color: Colors.blue, + ), + ) + ], + ), + ), + SizedBox( + height: 5, + ), + Row( crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: Texts(TranslationBase.of(context) - .toViewTheTermsAndConditions), - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: UserAgreementContent(), - ), - ); + Checkbox( + value: isAgree, + onChanged: (value) { + setState(() { + isAgree = !isAgree; + }); }, - child: Texts( - TranslationBase.of(context).clickHere, - color: Colors.blue, - ), - ) + activeColor: Colors.red, + ), + Texts(TranslationBase.of(context).iAgreeToTheTermsAndConditions), ], ), - ), - SizedBox( - height: 5, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Checkbox( - value: isAgree, - onChanged: (value) { - setState(() { - isAgree = !isAgree; - }); + Container( + margin: EdgeInsets.all(8), + width: double.infinity, + child: SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).save, + disabled: (!isAgree || !isSummary ), + onTap: () async { + final form = formKey.currentState; + if (form.validate()) { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePatientHealthSummaryReport( + message: TranslationBase + .of(context) + .updateSuccessfully, + isSummary: isSummary, + isUpdateEmail: true, + email: email.isNotEmpty ? email : model.user + .emailAddress); + GifLoaderDialogUtils.hideDialog(context); + } }, - activeColor: Colors.red, ), - Texts(TranslationBase.of(context) - .iAgreeToTheTermsAndConditions), - ], - ), - Container( - margin: EdgeInsets.all(8), - width: double.infinity, - child: SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).save, - disabled: !isAgree, - loading: model.state == ViewState.BusyLocal, - onTap: () { - model.updatePatientHealthSummaryReport( - message: TranslationBase.of(context) - .updateSuccessfully, - isSummary: isSummary); - }, ), - ), - Padding( - padding: const EdgeInsets.all(5.0), - child: Texts( - TranslationBase.of(context) - .iAgreeToTheTermsAndConditionsSubtitle, - fontWeight: FontWeight.normal, + Padding( + padding: const EdgeInsets.all(5.0), + child: Texts( + TranslationBase.of(context) + .instructionAgree, + fontWeight: FontWeight.normal, + ), + ), + SizedBox( + height: 12, ), - ), - SizedBox( - height: 12, - ), - Center(child: Image.asset('assets/images/report.jpg')) - ], + Center(child: Image.asset('assets/images/report.jpg')) + ], + ), ), ), ), diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index d3c818ff..42dcf40a 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -101,7 +101,7 @@ class _HomeReportPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, unselectedLabelColor: Colors.grey[800], tabs: [ diff --git a/lib/pages/medical/smart_watch_health_data/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/stepsTracker.dart new file mode 100644 index 00000000..467242e8 --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/stepsTracker.dart @@ -0,0 +1,248 @@ +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:diplomaticquarterapp/models/SmartWatch/YearlyStepsResModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class StepsTracker extends StatefulWidget { + @override + _StepsTrackerState createState() => _StepsTrackerState(); +} + +class _StepsTrackerState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + int weeklyStatsAvgValue = 0; + int monthlyStatsAvgValue = 0; + int yearlyStatsAvgValue = 0; + + int avgStepsValue = 0; + int dataLength = 0; + + List yearlyStepsList = List(); + + List yearlyTimeSeriesData = []; + + bool isDataLoaded = false; + + @override + void initState() { + _tabController = new TabController(length: 3, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getYearlyStepsData(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "Steps", + isShowDecPage: false, + body: Container( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).weekly), + Tab(text: TranslationBase.of(context).monthly), + Tab(text: TranslationBase.of(context).yearly), + ], + controller: _tabController, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isDataLoaded ? getWeeklyStepsDetails() : Container(), + isDataLoaded ? getMonthlyStepsDetails() : Container(), + isDataLoaded ? getYearlyStepsDetails() : Container() + ], + controller: _tabController, + ), + ), + ], + ), + ), + ); + } + + getYearlyStepsData() { + avgStepsValue = 0; + dataLength = 0; + + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(6, 3, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['Med_GetYearStepsTransactionsStsList']); + yearlyStepsList.clear(); + res['Med_GetYearStepsTransactionsStsList'].forEach((element) { + yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); + if (element['ValueSum'] != null) { + double value = element['ValueSum']; + avgStepsValue += value.toInt(); + dataLength++; + } + }); + + print(avgStepsValue); + print(dataLength); + setState(() { + yearlyStatsAvgValue = avgStepsValue ~/ dataLength; + isDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + // AppToast.showErrorToast(message: err); + print(err); + }); + } + + generateData() { + if (yearlyStepsList.length > 0) { + yearlyTimeSeriesData.clear(); + yearlyStepsList.forEach( + (element) { + yearlyTimeSeriesData.add( + TimeSeriesSales( + new DateTime(element.year, element.month, 1), + element.valueSum != null ? element.valueSum.toInt() : 0, + ), + ); + }, + ); + yearlyTimeSeriesData.forEach((element) { + print(element.sales); + print(element.time); + }); + } + return [ + new charts.Series( + id: 'Sales', + colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, + domainFn: (TimeSeriesSales sales, _) => sales.time, + measureFn: (TimeSeriesSales sales, _) => sales.sales, + data: yearlyTimeSeriesData, + ) + ]; + } + + getWeeklyStepsDetails() { + return Container( + child: Text("Weekly"), + ); + } + + getMonthlyStepsDetails() { + return Container( + child: Text("Monthly"), + ); + } + + getYearlyStepsDetails() { + return Container( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: AppTimeSeriesChart( + seriesList: generateData(), + chartName: "Steps", + startDate: DateTime( + yearlyStepsList[0].year, yearlyStepsList[0].month, 1), + endDate: DateTime( + yearlyStepsList[yearlyStepsList.length - 1].year, + yearlyStepsList[yearlyStepsList.length - 1].month, + 1), + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0), + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide(color: Colors.grey[400], width: 0.6)), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0), + child: + Text("Average Steps", style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(yearlyStatsAvgValue.toString() + " Steps", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Divider( + color: Colors.grey[500], + ), + ), + Container( + transform: Matrix4.translationValues(0.0, -10.0, 0.0), + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text("History", style: TextStyle(fontSize: 14.0)), + Row( + children: [ + Text("view more", style: TextStyle(fontSize: 14.0)), + Container( + margin: EdgeInsets.only(left: 3.0, right: 3.0), + transform: Matrix4.translationValues(0.0, 1.5, 0.0), + width: 30.0, + height: 30.0, + child: Image.asset( + "assets/images/new-design/view_more.png", + fit: BoxFit.contain), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide(color: Colors.grey[400], width: 0.6)), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0), + child: Text("Date", + style: TextStyle( + fontSize: 18.0, fontWeight: FontWeight.bold)), + ), + Container( + padding: EdgeInsets.fromLTRB(30.0, 0.0, 30.0, 0.0), + child: Text("Steps", style: TextStyle(fontSize: 18.0)), + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/medical/vital_sign/LineChartCurved.dart b/lib/pages/medical/vital_sign/LineChartCurved.dart index 7b7449a8..f2bc3d5f 100644 --- a/lib/pages/medical/vital_sign/LineChartCurved.dart +++ b/lib/pages/medical/vital_sign/LineChartCurved.dart @@ -2,6 +2,8 @@ import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; +import '../../../Constants.dart'; + class LineChartCurved extends StatelessWidget { final String title; final List timeSeries; @@ -199,7 +201,7 @@ class LineChartCurved extends StatelessWidget { final LineChartBarData lineChartBarData1 = LineChartBarData( spots: spots, isCurved: true, - colors: [Theme.of(context).primaryColor], + colors: [secondaryColor], barWidth: 5, isStrokeCapRound: true, dotData: FlDotData( diff --git a/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart b/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart index e8cb8b24..fa177b1a 100644 --- a/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart +++ b/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart @@ -228,7 +228,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { final LineChartBarData lineChartBarData1 = LineChartBarData( spots: spots, isCurved: true, - colors: [Theme.of(context).primaryColor], + colors: [Colors.red], barWidth: 5, isStrokeCapRound: true, dotData: FlDotData( @@ -241,7 +241,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { final LineChartBarData lineChartBarData2 = LineChartBarData( spots: spots2, isCurved: true, - colors: [Colors.grey], + colors: [Theme.of(context).primaryColor], barWidth: 5, isStrokeCapRound: true, dotData: FlDotData( diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart index 43bc9f0a..b09a579d 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_wideget.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:flutter/material.dart'; diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index c3a19917..cca506ec 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -74,7 +74,7 @@ class PaymentService extends StatelessWidget { ), ), ), - if(!projectViewModel.havePrivilege(33)) + //if(!projectViewModel.havePrivilege(33)) Expanded( child: InkWell( onTap: () => navigateToToDoPage(context), @@ -117,7 +117,7 @@ class PaymentService extends StatelessWidget { ) ], ), - if(!projectViewModel.havePrivilege(33)) + // if(!projectViewModel.havePrivilege(33)) Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -136,12 +136,12 @@ class PaymentService extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - 'My Balances', + TranslationBase.of(context).hmg, color: HexColor('#B61422'), bold: true, ), Texts( - TranslationBase.of(context).payment, + TranslationBase.of(context).wallet, fontSize: 14, fontWeight: FontWeight.normal, ), diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index 2040db11..6cd3a7d1 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -38,7 +39,7 @@ class __ProductDetailPageState extends State { dynamic wishlistItems; void initState() { - price = 0; + price = 1; specificationData = widget.product; setState(() { customerId = userInfo(widget.product.id, widget.product); @@ -79,18 +80,12 @@ class __ProductDetailPageState extends State { alignment: Alignment.centerRight, child: languageID == 'ar' ? Text( - widget.product - .discountDescriptionn, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), + widget.product.discountDescriptionn, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), ) : Text( - widget.product - .discountDescription, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), + widget.product.discountDescription, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), ), ), ), @@ -101,8 +96,7 @@ class __ProductDetailPageState extends State { flex: 0, child: Container( child: Image( - image: AssetImage( - 'assets/images/offer.png'), + image: AssetImage('assets/images/offer.png'), ), ), ), @@ -180,9 +174,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -210,9 +202,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -240,9 +230,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -270,10 +258,7 @@ class __ProductDetailPageState extends State { Container( child: Text( TranslationBase.of(context).description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), ), ), SizedBox( @@ -281,12 +266,26 @@ class __ProductDetailPageState extends State { ), Container( child: Text( - languageID == 'ar' - ? widget.product.fullDescriptionn - : widget.product.fullDescription, - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), + languageID == 'ar' ? widget.product.shortDescriptionn : widget.product.shortDescription ?? "", + style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + TranslationBase.of(context).howToUse, + style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription, + style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), ), ), ], @@ -294,162 +293,98 @@ class __ProductDetailPageState extends State { ) : isReviews ? BaseView( - onModelReady: (model) => - model.getProductReviewsData( - widget.product.id), - builder: (_, model, wi) => model - .productDetailService - .length != - 0 && - model.productDetailService[0] - .reviews.length != - 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model - .productDetailService[0] - .reviews - .length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, - int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[ - index] - .customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors - .grey, - fontWeight: - FontWeight - .w600), - ), + onModelReady: (model) => model.getProductReviewsData(widget.product.id), + builder: (_, model, wi) => + model.productDetailService.length != 0 && model.productDetailService[0].reviews.length != 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model.productDetailService[0].reviews.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model.productDetailService[0].reviews[index].customerId.toString(), + style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + ), + ), + Container( + margin: EdgeInsets.only(left: 210), + child: RatingBar.readOnly( + initialRating: model.productDetailService[0].reviews[index].rating.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ], ), - Container( - margin: - EdgeInsets.only( - left: 210), - child: RatingBar - .readOnly( - initialRating: model - .productDetailService[ - 0] - .reviews[ - index] - .rating - .toDouble(), - size: 15.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: Colors - .grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + model.productDetailService[0].reviews[index].reviewText, + style: TextStyle(fontSize: 20), ), - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[index] - .reviewText, - style: TextStyle( - fontSize: 20), - ), - ), - SizedBox( - height: 50, + ), + SizedBox( + height: 50, + ), + Divider(height: 1, color: Colors.grey), + ], ), - Divider( - height: 1, - color: Colors.grey), - ], - ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text('No Reviews Available'), - ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text('No Reviews Available'), + ), ) : isAvailabilty ? BaseView( - onModelReady: (model) => - model.getProductLocationData(), - builder: (_, model, wi) => model - .productLocationService - .length == - 0 + onModelReady: (model) => model.getProductLocationData(), + builder: (_, model, wi) => model.productLocationService.length == 0 ? Container( padding: EdgeInsets.all(15), alignment: Alignment.center, - child: Text( - 'No location Available'), + child: Text('No location Available'), ) : ListView.builder( physics: ScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model - .productLocationService - .length, - itemBuilder: - (BuildContext context, - int index) { + itemCount: model.productLocationService.length, + itemBuilder: (BuildContext context, int index) { return Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start, children: [ Row( // crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Expanded( flex: 1, - child: Image.network(model - .productLocationService[ - index] - .projectImageUrl), + child: Image.network(model.productLocationService[index].projectImageUrl), ), SizedBox( width: 10, @@ -457,48 +392,31 @@ class __ProductDetailPageState extends State { Expanded( flex: 4, child: Text( - model - .productLocationService[ - index] - .locationDescription + + model.productLocationService[index].locationDescription + "\n" + - fixingString(model - .productLocationService[ - 0] - .cityName - .toString()), - style: TextStyle( - fontSize: - 12), + fixingString(model.productLocationService[0].cityName.toString()), + style: TextStyle(fontSize: 12), ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons - .location_on), - color: - Colors.red, - onPressed: - () {}, + icon: Icon(Icons.location_on), + color: Colors.red, + onPressed: () {}, ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons - .phone), - color: - Colors.red, - onPressed: - () {}, + icon: Icon(Icons.phone), + color: Colors.red, + onPressed: () {}, ), ), ], ), - Divider( - height: 1.2, - color: Colors.grey) + Divider(height: 1.2, color: Colors.grey) ], ), ); @@ -513,12 +431,8 @@ class __ProductDetailPageState extends State { ], ), ), - bottomSheet: footerWidget( - widget.product.stockAvailability != 'Out of stock', - widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, - widget.product.stockQuantity, - widget.product), + bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product), ) : AppScaffold( appBarTitle: 'product detail page', @@ -551,18 +465,12 @@ class __ProductDetailPageState extends State { alignment: Alignment.centerRight, child: languageID == 'ar' ? Text( - widget.product - .discountDescriptionn, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), + widget.product.discountDescriptionn, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), ) : Text( - widget.product - .discountDescription, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), + widget.product.discountDescription, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), ), ), ), @@ -573,8 +481,7 @@ class __ProductDetailPageState extends State { flex: 0, child: Container( child: Image( - image: AssetImage( - 'assets/images/offer.png'), + image: AssetImage('assets/images/offer.png'), ), ), ), @@ -644,9 +551,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -674,9 +579,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -704,9 +607,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -734,10 +635,7 @@ class __ProductDetailPageState extends State { Container( child: Text( TranslationBase.of(context).description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), ), ), SizedBox( @@ -745,12 +643,8 @@ class __ProductDetailPageState extends State { ), Container( child: Text( - languageID == 'ar' - ? widget.product.fullDescriptionn - : widget.product.fullDescription, - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), + languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription, + style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), ), ), ], @@ -758,132 +652,79 @@ class __ProductDetailPageState extends State { ) : isReviews ? BaseView( - onModelReady: (model) => - model.getProductReviewsData( - widget.product.id), - builder: (_, model, wi) => model - .productDetailService - .length != - 0 && - model.productDetailService[0] - .reviews.length != - 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model - .productDetailService[0] - .reviews - .length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, - int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[ - index] - .customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors - .grey, - fontWeight: - FontWeight - .w600), - ), + onModelReady: (model) => model.getProductReviewsData(widget.product.id), + builder: (_, model, wi) => + model.productDetailService.length != 0 && model.productDetailService[0].reviews.length != 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model.productDetailService[0].reviews.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model.productDetailService[0].reviews[index].customerId.toString(), + style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + ), + ), + Container( + margin: EdgeInsets.only(left: 210), + child: RatingBar.readOnly( + initialRating: model.productDetailService[0].reviews[index].rating.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ], ), - Container( - margin: - EdgeInsets.only( - left: 210), - child: RatingBar - .readOnly( - initialRating: model - .productDetailService[ - 0] - .reviews[ - index] - .rating - .toDouble(), - size: 15.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: Colors - .grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + model.productDetailService[0].reviews[index].reviewText, + style: TextStyle(fontSize: 20), ), - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[index] - .reviewText, - style: TextStyle( - fontSize: 20), - ), - ), - SizedBox( - height: 50, + ), + SizedBox( + height: 50, + ), + Divider(height: 1, color: Colors.grey), + ], ), - Divider( - height: 1, - color: Colors.grey), - ], - ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text('No Reviews Available'), - ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text('No Reviews Available'), + ), ) : isAvailabilty ? BaseView( - onModelReady: (model) => - model.getProductLocationData(), - builder: (_, model, wi) => - ListView.builder( + onModelReady: (model) => model.getProductLocationData(), + builder: (_, model, wi) => ListView.builder( physics: ScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model - .productLocationService.length, - itemBuilder: (BuildContext context, - int index) { + itemCount: model.productLocationService.length, + itemBuilder: (BuildContext context, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Column( @@ -892,15 +733,11 @@ class __ProductDetailPageState extends State { children: [ Row( // crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Expanded( flex: 1, - child: Image.network(model - .productLocationService[ - index] - .projectImageUrl), + child: Image.network(model.productLocationService[index].projectImageUrl), ), SizedBox( width: 10, @@ -908,25 +745,16 @@ class __ProductDetailPageState extends State { Expanded( flex: 4, child: Text( - model - .productLocationService[ - index] - .locationDescription + + model.productLocationService[index].locationDescription + "\n" + - fixingString(model - .productLocationService[ - 0] - .cityName - .toString()), - style: TextStyle( - fontSize: 12), + fixingString(model.productLocationService[0].cityName.toString()), + style: TextStyle(fontSize: 12), ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons - .location_on), + icon: Icon(Icons.location_on), color: Colors.red, onPressed: () {}, ), @@ -934,17 +762,14 @@ class __ProductDetailPageState extends State { Expanded( flex: 1, child: IconButton( - icon: - Icon(Icons.phone), + icon: Icon(Icons.phone), color: Colors.red, onPressed: () {}, ), ), ], ), - Divider( - height: 1.2, - color: Colors.grey) + Divider(height: 1.2, color: Colors.grey) ], ), ); @@ -959,12 +784,8 @@ class __ProductDetailPageState extends State { ], ), ), - bottomSheet: footerWidget( - widget.product.stockAvailability != 'Out of stock', - widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, - widget.product.stockQuantity, - widget.product), + bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product), ); } } @@ -975,8 +796,7 @@ class footerWidget extends StatefulWidget { final int minQuantity; final int quantityLimit; final PharmacyProduct item; - footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item); + footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item); @override _footerWidgetState createState() => _footerWidgetState(); } @@ -1006,8 +826,7 @@ class _footerWidgetState extends State { padding: const EdgeInsets.all(8.0), child: Text( TranslationBase.of(context).quantity, - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), ), ), // ListView( @@ -1029,9 +848,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '1', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1056,9 +873,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '2', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1083,9 +898,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '3', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1110,9 +923,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '4', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1137,9 +948,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '5', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1164,9 +973,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '6', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1191,9 +998,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '7', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1218,9 +1023,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '8', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1245,9 +1048,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '9', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1272,9 +1073,7 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '10', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { @@ -1295,8 +1094,7 @@ class _footerWidgetState extends State { Container( width: 50.0, child: TextField( - decoration: - InputDecoration(labelText: 'quantity #'), + decoration: InputDecoration(labelText: 'quantity #'), onChanged: (text) { print(price); print(widget.quantityLimit); @@ -1375,10 +1173,7 @@ class _footerWidgetState extends State { alignment: Alignment.center, child: Text( TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), + style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), ), ), ) @@ -1393,10 +1188,7 @@ class _footerWidgetState extends State { color: Colors.green, child: Text( TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), + style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), ), ), ), @@ -1412,10 +1204,7 @@ class _footerWidgetState extends State { alignment: Alignment.center, child: Text( TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), + style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), ), ), ) @@ -1425,8 +1214,7 @@ class _footerWidgetState extends State { addToCartFunction(price, widget.item.id); Navigator.push( context, - MaterialPageRoute( - builder: (context) => CartOrderPage()), + MaterialPageRoute(builder: (context) => CartOrderPage()), ); }, child: Container( @@ -1436,10 +1224,7 @@ class _footerWidgetState extends State { color: Colors.blue, child: Text( TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), + style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), ), ), ), @@ -1480,57 +1265,57 @@ class _productNameAndPriceState extends State { widget.item.stockAvailability, style: widget.item.stockAvailability == 'Out of stock' ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) - : TextStyle( - fontWeight: FontWeight.bold, color: Colors.green), + : TextStyle(fontWeight: FontWeight.bold, color: Colors.green), ), SizedBox(width: 20), - widget.item.stockAvailability == 'Out of stock' - ? Text( - TranslationBase.of(context).notifyMe, - style: TextStyle( - color: Colors.blue, - decoration: TextDecoration.underline, - ), - ) - : Container(), - widget.item.stockAvailability == 'Out of stock' - ? Icon( - FontAwesomeIcons.bell, - color: Colors.blue, - size: 15.0, + widget.item.stockAvailability == 'Out of stock' && customerId != null + ? InkWell( + onTap: () => notifyMeWhenAvailable(context, widget.item.id), + child: Row(children: [ + Text( + TranslationBase.of(context).notifyMe, + style: TextStyle( + color: Colors.blue, + decoration: TextDecoration.underline, + ), + ), + SizedBox(width: 4), + Icon( + FontAwesomeIcons.bell, + color: Colors.blue, + size: 15.0, + ) + ]), ) - : Container(), - Container( - margin: languageID == 'ar' - ? EdgeInsets.only(right: 25) - : EdgeInsets.only(left: 25), - width: 40, - height: 40, - decoration: BoxDecoration( - color: Colors.grey, - borderRadius: BorderRadius.circular(30), - ), - child: !isInWishlit - ? IconButton( - icon: Icon(Icons.favorite_border), - color: Colors.white, - onPressed: () { - setState(() { - addToWishlistFunction(widget.item.id); - }); + : Container( + margin: languageID == 'ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25), + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(30), + ), + child: !isInWishlit + ? IconButton( + icon: Icon(Icons.favorite_border), + color: Colors.white, + onPressed: () { + setState(() { + addToWishlistFunction(widget.item.id); + }); // MyStatelessWidget(); - }, - ) - : IconButton( - icon: Icon(Icons.favorite), - color: Colors.red, - onPressed: () { - setState(() { - deleteFromWishlistFunction(widget.item.id); - }); + }, + ) + : IconButton( + icon: Icon(Icons.favorite), + color: Colors.red, + onPressed: () { + setState(() { + deleteFromWishlistFunction(widget.item.id); + }); // MyStatelessWidget(); - }, - )), + }, + )), ], ), ), @@ -1539,12 +1324,9 @@ class _productNameAndPriceState extends State { child: Container( margin: EdgeInsets.only(left: 5), child: Align( - alignment: - languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, + alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, child: Text( - languageID == 'ar' - ? widget.item.fullDescriptionn - : widget.item.fullDescription, + languageID == 'ar' ? widget.item.fullDescriptionn : widget.item.fullDescription, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), ), ), @@ -1576,9 +1358,7 @@ class _productNameAndPriceState extends State { child: Container( child: widget.item.rxMessage != null ? Text( - languageID == 'ar' - ? widget.item.rxMessagen.toString() - : widget.item.rxMessage.toString(), + languageID == 'ar' ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(), style: TextStyle(color: Colors.red, fontSize: 10), ) : Container()), @@ -1744,9 +1524,7 @@ slideDetail() { ), color: Colors.white, ), - child: const Text('1', - textAlign: TextAlign.center, - style: TextStyle(color: Color(0xFF000000))), + child: const Text('1', textAlign: TextAlign.center, style: TextStyle(color: Color(0xFF000000))), ), ) ], @@ -1776,6 +1554,11 @@ addToCartFunction(quantity, itemID) async { await x.addToCartData(quantity, itemID); } +notifyMeWhenAvailable(context, itemId) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.notifyMe(customerId, itemId); +} + addToWishlistFunction(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); isInWishlit = true; @@ -1823,13 +1606,7 @@ settingModalBottomSheet(context) { leading: new Icon(Icons.shopping_cart), title: new Text('Add to cart'), onTap: () => { - if (price > 0) - {addToCartFunction(price, itemID)} - else - { - AppToast.showErrorToast( - message: "you should add quantity") - } + if (price > 0) {addToCartFunction(price, itemID)} else {AppToast.showErrorToast(message: "you should add quantity")} }), new ListTile( leading: new Icon(Icons.favorite_border), @@ -1840,8 +1617,7 @@ settingModalBottomSheet(context) { leading: new Icon(Icons.compare), title: new Text('Compare'), onTap: () => { - Provider.of(context, listen: false) - .addItem(specificationData), + Provider.of(context, listen: false).addItem(specificationData), }, ), ], @@ -1850,13 +1626,14 @@ settingModalBottomSheet(context) { }); } -userInfo(id, product) async { +Future userInfo(id, product) async { customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); if (customerId != null) { itemID = id; product = product; checkWishlist(); } + print("customerId:$customerId"); return customerId; // getSpecificationData(itemID); } diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart index 51d93d71..6926f9f4 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -27,8 +27,7 @@ class CartOrderPage extends StatelessWidget { value: model.cartResponse, child: AppScaffold( appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isShowDecPage: false, + isShowAppBar: false, isPharmacy: true, baseViewModel: model, backgroundColor: Colors.white, diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index fd51d6ef..b41c1804 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; @@ -15,11 +16,21 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:rating_bar/rating_bar.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; import 'lacum-activitaion-vida-page.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; class PharmacyPage extends StatelessWidget { + @override + void initState() { +// print("model prescription " + model.prescriptionsList.length); +// cancelOrderDetail(order) + } + @override Widget build(BuildContext context) { return BaseView( @@ -37,8 +48,242 @@ class PharmacyPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - BannerPager(model), - GridViewButtons(model), + BannerPager(model), + // GridViewButtons(model), + Container( + margin: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).myPrescription, + bold: true, + ), + BorderedButton( + TranslationBase.of(context).viewAll, + hasBorder: true, + borderColor: Colors.green, + textColor: Colors.green, + vPadding: 6, + hPadding: 4, + handler: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + HomePrescriptionsPage())); + }, + ), + ], + ), + ), + + Container( + padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0), + height: MediaQuery.of(context).size.height * 0.30, +// width: 200.0, +// height: MediaQuery.of(context).size.height / 4 + 20, + margin: EdgeInsets.only(left: 10), + child: BaseView( + onModelReady: (model) => model.getPrescription(), + builder: (_, model, wi) => model.prescriptionsList.length != 0 +// model.getPrescription(); + ? ListView.builder( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: NeverScrollableScrollPhysics(), + // itemCount: 4, + itemCount: model.prescriptionsList.length, + itemBuilder: (context, index) { + return Container( +// width: 160.0, + height: MediaQuery.of(context).size.height * 0.6, + padding: EdgeInsets.only(bottom: 5.0, left: 5.0), + margin: EdgeInsets.only(right: 10.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey, + style: BorderStyle.solid, + width: 1.0, + ), + color: Colors.white, + borderRadius: BorderRadius.circular(10.0)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Column(children: [ + Container( + padding: EdgeInsets.only( + top: 10.0, + left: 10.0, + right: 3.0, + bottom: 15.0, + ), + child: Image.network( + model.prescriptionsList[index] + .doctorImageURL, + width: 60, + height: 60, + ), + ), + ]), + Column( +// crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(left: 1), + padding: EdgeInsets.only( + left: 15.0, right: 15.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 4.0, + ), + color: Colors.green, + borderRadius: + BorderRadius.circular( + 30.0)), + child: Text( + model.prescriptionsList[index] + .isInOutPatientDescription + .toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + )), + Row(children: [ + Image.asset( + 'assets/images/Icon-awesome-calendar.png', + width: 30, + height: 30, + ), + Text( + model.prescriptionsList[index] + .appointmentDate + .toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + ) + ]), + ], + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + Text( + model.prescriptionsList[index] + .doctorTitle + .toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + Text( + model.prescriptionsList[index] + .doctorName + .toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + model.prescriptionsList[index] + .clinicDescription + .toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( +// initialRating: productRate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ) + ]), + ]), + ); + }) + : Container(), + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).recommended, + bold: true, + ), + BorderedButton( + TranslationBase.of(context).viewAll, + hasBorder: true, + borderColor: Colors.green, + textColor: Colors.green, + vPadding: 6, + hPadding: 4, + handler: () {}, + ), + ], + ), + ), + Container( + height: MediaQuery.of(context).size.height / 4 + 20, + child: ListView.builder( + itemBuilder: (ctx, i) => + ProductTileItem(model.bestSellerProduct[i]), + scrollDirection: Axis.horizontal, + itemCount: model.bestSellerProduct.length, + ), + ), + Container( margin: EdgeInsets.fromLTRB(10, 0, 10, 0), child: Row( @@ -55,8 +300,9 @@ class PharmacyPage extends StatelessWidget { hPadding: 4, borderColor: Colors.green, textColor: Colors.green, - handler: () =>{ - Navigator.push(context,FadePage(page: ProductBrandsPage())), + handler: () => { + Navigator.push( + context, FadePage(page: ProductBrandsPage())), }, ), ], @@ -119,8 +365,9 @@ class PharmacyPage extends StatelessWidget { textColor: Colors.green, vPadding: 6, hPadding: 4, - handler: () =>{ - Navigator.push(context,FadePage(page: ProductBrandsPage())), + handler: () => { + Navigator.push( + context, FadePage(page: ProductBrandsPage())), }, ), ], @@ -180,15 +427,15 @@ class GridViewButtons extends StatelessWidget { hasColorFilter: false, child: GridViewCard(TranslationBase.of(context).medicationRefill, 'assets/images/pharmacy_module/medication_icon.png', () { - model.checkUserIsActivated().then((isActivated) { - if (isActivated) { - Navigator.push(context, FadePage(page: LakumMainPage())); - } else { - Navigator.push( - context, FadePage(page: LakumActivationVidaPage())); - } - }); - }), + model.checkUserIsActivated().then((isActivated) { + if (isActivated) { + Navigator.push(context, FadePage(page: LakumMainPage())); + } else { + Navigator.push( + context, FadePage(page: LakumActivationVidaPage())); + } + }); + }), ), DashboardItem( imageName: 'pharmacy_module/bg_3.png', @@ -196,8 +443,9 @@ class GridViewButtons extends StatelessWidget { hasColorFilter: false, child: GridViewCard(TranslationBase.of(context).myPrescriptions, 'assets/images/pharmacy_module/prescription_icon.png', () { - Navigator.push(context, FadePage(page: PharmacyAddressesPage())); - }), + Navigator.push( + context, FadePage(page: PharmacyAddressesPage())); + }), ), DashboardItem( imageName: 'pharmacy_module/bg_4.png', @@ -206,7 +454,7 @@ class GridViewButtons extends StatelessWidget { child: GridViewCard( TranslationBase.of(context).searchAndScanMedication, 'assets/images/pharmacy_module/search_scan_icon.png', - () {}), + () {}), ), ], ), diff --git a/lib/pages/pharmacies/widgets/BannerPager.dart b/lib/pages/pharmacies/widgets/BannerPager.dart index 989c7557..b088eefb 100644 --- a/lib/pages/pharmacies/widgets/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/BannerPager.dart @@ -1,5 +1,7 @@ import 'package:carousel_slider/carousel_slider.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -39,20 +41,25 @@ class _BannerPagerState extends State { items: widget._model .getBannerImagesUrl() .mapIndexed( - (item, index) => Container( - margin: EdgeInsets.symmetric(horizontal: 1.0), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5.0)), - child: Center( - child: index == 0 - ? Image.asset( - item, - fit: BoxFit.cover, - ) - : Image.network( - item, - fit: BoxFit.cover, - ), + (item, index) => InkWell( + onTap: () { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 1.0), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + child: Center( + child: index == 0 + ? Image.asset( + item, + fit: BoxFit.cover, + ) + : Image.network( + item, + fit: BoxFit.cover, + ), + ), ), ), ), diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 576bf2a0..4ef14389 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -31,11 +32,11 @@ class _OrderPageState extends State with SingleTickerProviderStateMix String customerId = ""; String order =""; - List orderList = [] ; - List deliveredOrderList = [] ; - List processingOrderList = []; - List cancelledOrderList = []; - List pendingOrderList = []; + List orderList = [] ; + List deliveredOrderList = [] ; + List processingOrderList = []; + List cancelledOrderList = []; + List pendingOrderList = []; TabController _tabController; // AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -66,6 +67,8 @@ class _OrderPageState extends State with SingleTickerProviderStateMix child: Column( children: [ TabBar( + labelPadding: + EdgeInsets.only(left: 3.0, right: 3.0), tabs: [ Tab(text: TranslationBase.of(context).delivered), Tab(text: TranslationBase.of(context).processing), @@ -103,16 +106,16 @@ class _OrderPageState extends State with SingleTickerProviderStateMix Widget getDeliveredOrder(OrderModelViewModel model){ - for(int i=0 ; i< model.order.length; i++){ - if( model.order[i].orderStatusId == 30 || model.order[i].orderStatusId == 997 - || model.order[i].orderStatusId == 994 + for(int i=0 ; i< model.orders.length; i++){ + if( model.orders[i].orderStatusId == 30 || model.orders[i].orderStatusId == 997 + || model.orders[i].orderStatusId == 994 ){ - deliveredOrderList.add(model.order[i]); + deliveredOrderList.add(model.orders[i]); } } return Container( width: MediaQuery.of(context).size.width, - child: model.order.length != 0 + child: model.orders.length != 0 ? SingleChildScrollView( child: Column( children: [ @@ -162,7 +165,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), ), Container( - child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,11), + child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,10), style: TextStyle(fontSize: 14.0, ), ), @@ -177,7 +180,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix child: InkWell( onTap: () { Navigator.push(context, - MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:deliveredOrderList[index]))); + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel: deliveredOrderList[index]),)); }, child: SvgPicture.asset( languageID == "ar" @@ -260,7 +263,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix Row( children: [ Container( - child: Text(deliveredOrderList[index].orderItems.length.toString(), + child: Text(deliveredOrderList[index].productCount.toString(), style: TextStyle(fontSize: 14.0, ), ), @@ -317,15 +320,15 @@ class _OrderPageState extends State with SingleTickerProviderStateMix } Widget getProcessingOrder(OrderModelViewModel model){ - for(int i=0 ; i< model.order.length; i++){ - if( model.order[i].orderStatusId == 20 || model.order[i].orderStatusId == 995 || - model.order[i].orderStatusId == 998 || model.order[i].orderStatusId == 999){ - processingOrderList.add(model.order[i]); + for(int i=0 ; i< model.orders.length; i++){ + if( model.orders[i].orderStatusId == 20 || model.orders[i].orderStatusId == 995 || + model.orders[i].orderStatusId == 998 || model.orders[i].orderStatusId == 999){ + processingOrderList.add(model.orders[i]); } } return Container( width: MediaQuery.of(context).size.width, - child: model.order.length != 0 + child: model.orders.length != 0 ? SingleChildScrollView( child: Column( children: [ @@ -375,7 +378,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), ), Container( - child: Text(processingOrderList[index].createdOnUtc.toString().substring(0,11), + child: Text(processingOrderList[index].createdOnUtc.toString().substring(0,10), style: TextStyle(fontSize: 14.0, ), ), @@ -390,8 +393,9 @@ class _OrderPageState extends State with SingleTickerProviderStateMix child: InkWell( onTap: () { Navigator.push(context, - MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[index]))); - }, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel :processingOrderList[index]))); + + }, child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' @@ -473,7 +477,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix Row( children: [ Container( - child: Text(processingOrderList[index].orderItems.length.toString(), + child: Text(processingOrderList[index].productCount.toString(), style: TextStyle(fontSize: 14.0, ), ), @@ -709,13 +713,13 @@ class _OrderPageState extends State with SingleTickerProviderStateMix } Widget getPendingOrder(OrderModelViewModel model){ - for(int i=0 ; i< model.order.length; i++){ - if( model.order[i].orderStatusId == 10){ - pendingOrderList.add(model.order[i]); + for(int i=0 ; i< model.orders.length; i++){ + if( model.orders[i].orderStatusId == 10){ + pendingOrderList.add(model.orders[i]); } } return Container( - child: model.order.length != 0 + child: model.orders.length != 0 ? SingleChildScrollView( child: Column( children: [ @@ -766,7 +770,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), ), Container( - child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,11), + child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,10), style: TextStyle(fontSize: 14.0, ), ), @@ -782,7 +786,8 @@ class _OrderPageState extends State with SingleTickerProviderStateMix onTap: () { Navigator.push(context, MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index]))); - }, + + }, child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' @@ -864,7 +869,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix Row( children: [ Container( - child: Text(pendingOrderList[index].orderItems.length.toString(), + child: Text(pendingOrderList[index].productCount.toString(), style: TextStyle(fontSize: 14.0, ), ), @@ -924,14 +929,14 @@ class _OrderPageState extends State with SingleTickerProviderStateMix } Widget getCancelledOrder(OrderModelViewModel model){ - for(int i=0 ; i< model.order.length; i++){ - if( model.order[i].orderStatusId == 40 || model.order[i].orderStatusId == 996 - || model.order[i].orderStatusId == 200){ - cancelledOrderList.add(model.order[i]); + for(int i=0 ; i< model.orders.length; i++){ + if( model.orders[i].orderStatusId == 40 || model.orders[i].orderStatus == 996 + || model.orders[i].orderStatusId == 200){ + cancelledOrderList.add(model.orders[i]); } } return Container( - child: model.order.length != 0 + child: model.orders.length != 0 ? SingleChildScrollView( child: Column( children: [ @@ -982,7 +987,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), ), Container( - child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,11), + child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,10), style: TextStyle(fontSize: 14.0, ), ), @@ -997,7 +1002,8 @@ class _OrderPageState extends State with SingleTickerProviderStateMix child: InkWell( onTap: () { Navigator.push(context, - MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:cancelledOrderList[index]))); + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel: cancelledOrderList[index]))); + }, child: SvgPicture.asset( languageID == "ar" @@ -1080,7 +1086,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix Row( children: [ Container( - child: Text(cancelledOrderList[index].orderItems.length.toString(), + child: Text(cancelledOrderList[index].productCount.toString(), style: TextStyle(fontSize: 14.0, ), ), @@ -1136,13 +1142,17 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), ), ); - } + int test = Test()["1"]; + } } - - - - - +class Test{ + static const values = { + "1":1, + "2":2, + "3":3 + }; + int operator [](String key) => values[key]; +} \ No newline at end of file diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 5438663d..670cb951 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/TrackDriver.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -17,15 +19,16 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:provider/provider.dart'; - - - dynamic languageID; -class OrderDetailsPage extends StatefulWidget { - OrderModel orderModel; +class OrderDetailsPage extends StatefulWidget { + Orders orderModel; OrderDetailsPage({@required this.orderModel}); + // Orders orderModel; +// OrderModel orderModelDetails; +// OrderDetailsPage({@required this.orderModel, this.orderModelDetails}); + @override _OrderDetailsPageState createState() => _OrderDetailsPageState(); } @@ -36,9 +39,8 @@ class _OrderDetailsPageState extends State { } // AppSharedPreferences sharedPref = AppSharedPreferences(); - String orderId = ""; String customerId; - List orderList = []; + List ordersList = []; List cancelledOrderList = []; @@ -46,6 +48,7 @@ class _OrderDetailsPageState extends State { var model; var isCancel = false; var isRefund = false; + var isActiveDelivery = true; var dataIsCancel; var dataIsRefund; @@ -53,8 +56,10 @@ class _OrderDetailsPageState extends State { void initState() { getLanguageID(); super.initState(); - print(widget.orderModel.orderItems.length); +// print(widget.orderModel.orderItems.length); getCancelOrder(widget.orderModel.id); + + print("ID is" + widget.orderModel.id); // cancelOrderDetail(order) } @@ -105,9 +110,11 @@ class _OrderDetailsPageState extends State { color: getStatusBackgroundColor(), borderRadius: BorderRadius.circular(30.0)), child: Text( - languageID == "ar" - ? widget.orderModel.orderStatusn.toString(): - widget.orderModel.orderStatus.toString().substring(12) , + languageID == "ar" + ? model.orderListModel[0].orderStatusn.toString() + : model.orderListModel[0].orderStatus + .toString() + .substring(12), // TranslationBase.of(context).delivered, style: TextStyle( color: Colors.white, @@ -124,11 +131,11 @@ class _OrderDetailsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - widget.orderModel.shippingAddress.firstName + model.orderListModel[0].shippingAddress.firstName .toString() .substring(10) + ' ' + - widget.orderModel.shippingAddress.lastName + model.orderListModel[0].shippingAddress.lastName .toString() .substring(9), style: TextStyle( @@ -141,19 +148,19 @@ class _OrderDetailsPageState extends State { Container( margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.orderModel.shippingAddress.address1 - .toString() - .substring(9), - style: TextStyle( - fontSize: 10.0, - fontWeight: FontWeight.bold, - color: Colors.grey, - ), - ),] - ), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.orderListModel[0].shippingAddress.address1 + .toString() + .substring(9), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ]), ), Container( margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), @@ -161,14 +168,15 @@ class _OrderDetailsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - widget.orderModel.shippingAddress.address2 + model.orderListModel[0].shippingAddress.address2 .toString() .substring(9) + ' ' + - widget.orderModel.shippingAddress.country + model.orderListModel[0].shippingAddress.country .toString() + ' ' + - widget.orderModel.shippingAddress.zipPostalCode + model.orderListModel[0].shippingAddress + .zipPostalCode .toString(), style: TextStyle( fontSize: 10.0, @@ -191,7 +199,7 @@ class _OrderDetailsPageState extends State { Container( margin: EdgeInsets.only(top: 5.0, bottom: 5.0), child: Text( - widget.orderModel.shippingAddress.phoneNumber + model.orderListModel[0].shippingAddress.phoneNumber .toString(), style: TextStyle( fontSize: 15.0, @@ -230,7 +238,8 @@ class _OrderDetailsPageState extends State { ), Container( child: flutterImage.Image.asset( - widget.orderModel.shippingRateComputationMethodSystemName != + model.orderListModel[0] + .shippingRateComputationMethodSystemName != "Shipping.Aramex" ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", @@ -282,7 +291,9 @@ class _OrderDetailsPageState extends State { Container( margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child: Text( - widget.orderModel.paymentName.toString().substring(12), + model.orderListModel[0].paymentName + .toString() + .substring(12), style: TextStyle( fontSize: 13.0, fontWeight: FontWeight.bold, @@ -318,23 +329,40 @@ class _OrderDetailsPageState extends State { scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), - itemCount:widget.orderModel.orderItems.length, - itemBuilder: (context, index){ - return Container( - child: productTile(productName: widget.orderModel.orderItems[index].product.name.toString(), - productPrice: widget.orderModel.orderItems[index].product.price.toString(), - productRate: widget.orderModel.orderItems[index].product.approvedRatingSum.toDouble(), - productReviews:widget.orderModel.orderItems[index].product.approvedTotalReviews, - totalPrice: "${(widget.orderModel.orderItems[index].product.price - * widget.orderModel.orderItems[index].quantity).toStringAsFixed(2)}", - qyt: widget.orderModel.orderItems[index].quantity.toString(), - isOrderDetails:true, - imgs: widget.orderModel.orderItems[index].product.images != null && - widget.orderModel.orderItems[index].product.images.length != 0 - ? widget.orderModel.orderItems[index].product.images [0].src.toString() - : null, - status: widget.orderModel.orderStatusId, - product: widget.orderModel.orderItems[index].product, + itemCount: model.orderListModel[0].orderItems.length, + itemBuilder: (context, index) { + return Container( + child: productTile( + productName: model + .orderListModel[0].orderItems[index].product.name + .toString(), + productPrice: model + .orderListModel[0].orderItems[index].product.price + .toString(), + productRate: model.orderListModel[0].orderItems[index] + .product.approvedRatingSum + .toDouble(), + productReviews: model.orderListModel[0] + .orderItems[index].product.approvedTotalReviews, + totalPrice: + "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", + qyt: model + .orderListModel[0].orderItems[index].quantity + .toString(), + isOrderDetails: true, + imgs: model.orderListModel[0].orderItems[index] + .product.images != + null && + model.orderListModel[0].orderItems[index] + .product.images.length != + 0 + ? model.orderListModel[0].orderItems[index] + .product.images[0].src + .toString() + : null, + status: model.orderListModel[0].orderStatusId, + product: + model.orderListModel[0].orderItems[index].product, ), ); }), @@ -383,7 +411,8 @@ class _OrderDetailsPageState extends State { ), ), Text( - widget.orderModel.orderSubtotalExclTax.toString(), + model.orderListModel[0].orderSubtotalExclTax + .toString(), style: TextStyle( fontSize: 13.0, ), @@ -421,7 +450,8 @@ class _OrderDetailsPageState extends State { ), ), Text( - widget.orderModel.orderShippingExclTax.toString(), + model.orderListModel[0].orderShippingExclTax + .toString(), style: TextStyle( fontSize: 13.0, ), @@ -459,7 +489,7 @@ class _OrderDetailsPageState extends State { ), ), Text( - widget.orderModel.orderTax.toString(), + model.orderListModel[0].orderTax.toString(), style: TextStyle( fontSize: 13.0, ), @@ -497,7 +527,7 @@ class _OrderDetailsPageState extends State { ), ), Text( - widget.orderModel.orderTotal.toString(), + model.orderListModel[0].orderTotal.toString(), style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.bold, @@ -508,10 +538,10 @@ class _OrderDetailsPageState extends State { ), ], ), - widget.orderModel.orderStatusId == 10 + model.orderListModel[0].orderStatusId == 10 ? InkWell( onTap: () { - model.makeOrder(); + model.makeOrder(); }, child: Container( // margin: EdgeInsets.only(top: 20.0), @@ -543,8 +573,8 @@ class _OrderDetailsPageState extends State { isCancel ? InkWell( onTap: () { - presentConfirmDialog(model, - widget.orderModel.id); //(widget.orderModel.id)); + presentConfirmDialog(model, widget.orderModel.id); + // model.orderListModel[0].id//(widget.orderModel.id)); // }, child: Container( @@ -563,6 +593,29 @@ class _OrderDetailsPageState extends State { ), ) : Container(), + isActiveDelivery + ? InkWell( + onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute(builder: (context) => TrackDriver(order: widget.orderModel), + // )); + }, + child: Container( + height: 50.0, + color: Colors.transparent, + child: Center( + child: Text( + TranslationBase.of(context).trackDeliveryDriver, + style: TextStyle( + color: Colors.green[900], + fontWeight: FontWeight.normal, + decoration: TextDecoration.none), + ), + ), + ), + ) + : Container(), ], ), ), @@ -630,6 +683,7 @@ class _OrderDetailsPageState extends State { context, MaterialPageRoute( builder: (context) => OrderPage( +// customerID: model.ordersList[0].customerId.toString() customerID: widget.orderModel.customerId.toString())), ); }), diff --git a/lib/pages/pharmacy/order/TrackDriver.dart b/lib/pages/pharmacy/order/TrackDriver.dart new file mode 100644 index 00000000..b9a8056f --- /dev/null +++ b/lib/pages/pharmacy/order/TrackDriver.dart @@ -0,0 +1,211 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_polyline_points/flutter_polyline_points.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:location/location.dart'; + + +class TrackDriver extends StatefulWidget { + final OrderModel order; + TrackDriver({this.order}); + + @override + State createState() => _TrackDriverState(); +} + +class _TrackDriverState extends State { + OrderModel _order; + + Completer _controller = Completer(); + + + double CAMERA_ZOOM = 16; + double CAMERA_TILT = 0; + double CAMERA_BEARING = 30; + LatLng SOURCE_LOCATION = null; + LatLng DEST_LOCATION = null; + + // for my drawn routes on the map + Set _polylines = Set(); + List polylineCoordinates = []; + PolylinePoints polylinePoints; + + Set _markers = Set(); + + BitmapDescriptor sourceIcon; // for my custom marker pins + BitmapDescriptor destinationIcon; // for my custom marker pins + Location location;// wrapper around the location API + + @override + void initState() { + _order = widget.order; + DEST_LOCATION = _order.shippingAddress.getLocation(); + location = new Location(); + polylinePoints = PolylinePoints(); + setSourceAndDestinationIcons(); + } + + @override + Widget build(BuildContext context) { + return new Scaffold( + body: GoogleMap( + myLocationEnabled: true, + compassEnabled: true, + markers: _markers, + polylines: _polylines, + mapType: MapType.normal, + initialCameraPosition: _orderDeliveryLocationCamera(), + onMapCreated: (GoogleMapController controller) { + _controller.complete(controller); + showPinsOnMap(); + }, + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: _goToDriver, + label: Text('To the lake!'), + icon: Icon(Icons.directions_boat), + ), + ); + } + + + void setSourceAndDestinationIcons() async { + sourceIcon = await BitmapDescriptor.fromAssetImage( + ImageConfiguration(devicePixelRatio: 2.5), + 'assets/images/map_markers/source_map_marker.png'); + + destinationIcon = await BitmapDescriptor.fromAssetImage( + ImageConfiguration(devicePixelRatio: 2.5), + 'assets/images/map_markers/destination_map_marker.png'); + } + + CameraPosition _orderDeliveryLocationCamera(){ + + final CameraPosition orderDeliveryLocCamera = CameraPosition( + bearing: CAMERA_BEARING, + target: DEST_LOCATION, + tilt: CAMERA_TILT, + zoom: CAMERA_ZOOM); + return orderDeliveryLocCamera; + } + + CameraPosition _driverLocationCamera(){ + final CameraPosition driverLocCamera = CameraPosition( + bearing: CAMERA_BEARING, + target: SOURCE_LOCATION, + tilt: CAMERA_TILT, + zoom: CAMERA_ZOOM); + return driverLocCamera; + } + + + Future _goToOrderDeliveryLocation() async { + final GoogleMapController controller = await _controller.future; + final CameraPosition orderDeliveryLocCamera = _orderDeliveryLocationCamera(); + controller.animateCamera(CameraUpdate.newCameraPosition(orderDeliveryLocCamera)); + } + + Future _goToDriver() async { + final GoogleMapController controller = await _controller.future; + final CameraPosition driverLocCamera = _driverLocationCamera(); + controller.animateCamera(CameraUpdate.newCameraPosition(driverLocCamera)); + } + + + Future _fitCameraBetweenBothPoints() async { + final GoogleMapController controller = await _controller.future; + final CameraPosition driverLocCamera = CameraPosition( + bearing: CAMERA_BEARING, + target: SOURCE_LOCATION, + tilt: CAMERA_TILT, + zoom: CAMERA_ZOOM); + controller.animateCamera(CameraUpdate.newCameraPosition(driverLocCamera)); + } + + void showPinsOnMap() { + // source pin + if(SOURCE_LOCATION != null){ + setState(() { + var pinPosition = SOURCE_LOCATION; + _markers.add(Marker( + markerId: MarkerId('sourcePin'), + position: pinPosition, + icon: sourceIcon + )); + }); + } + + // destination pin + if(DEST_LOCATION != null){ + setState(() { + var destPosition = DEST_LOCATION; + _markers.add(Marker( + markerId: MarkerId('destPin'), + position: destPosition, + icon: destinationIcon + )); + }); + } + // set the route lines on the map from source to destination + // for more info follow this tutorial + // drawRoute(); + } + + void updatePinOnMap() async { + // create a new CameraPosition instance + // every time the location changes, so the camera + // follows the pin as it moves with an animation + CameraPosition cPosition = CameraPosition( + zoom: CAMERA_ZOOM, + tilt: CAMERA_TILT, + bearing: CAMERA_BEARING, + target: SOURCE_LOCATION, + ); + final GoogleMapController controller = await _controller.future; + controller.animateCamera(CameraUpdate.newCameraPosition(cPosition)); + // do this inside the setState() so Flutter gets notified + // that a widget update is due + setState(() { + // updated position + var pinPosition = SOURCE_LOCATION; + + // the trick is to remove the marker (by id) + // and add it again at the updated location + _markers.removeWhere((m) => m.markerId.value == 'sourcePin'); + _markers.add(Marker( + markerId: MarkerId('sourcePin'), + position: pinPosition, // updated position + icon: sourceIcon + )); + }); + } + + void drawRoute() async { + return; // Ignore draw Route + + List result = await polylinePoints.getRouteBetweenCoordinates( + GOOGLE_API_KEY, + SOURCE_LOCATION.latitude, + SOURCE_LOCATION.longitude, + DEST_LOCATION.latitude, + DEST_LOCATION.longitude); + if(result.isNotEmpty){ + result.forEach((PointLatLng point){ + polylineCoordinates.add( + LatLng(point.latitude,point.longitude) + ); + }); + setState(() { + _polylines.add(Polyline( + width: 5, // set the width of the polylines + polylineId: PolylineId('poly'), + color: Color.fromARGB(255, 40, 122, 198), + points: polylineCoordinates + )); + }); + } + } +} \ No newline at end of file diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index ba742179..fb1e1c2a 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -6,6 +6,8 @@ import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/my_reviews.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; @@ -27,7 +29,8 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/my_reviews.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart'; -dynamic languageID ; +dynamic languageID; + class PharmacyProfilePage extends StatefulWidget { @override _ProfilePageState createState() => _ProfilePageState(); @@ -44,40 +47,43 @@ class _ProfilePageState extends State { String lastName, mobileNo, identificationNo; int languageId; - _ProfilePageState({this.customerId }); + _ProfilePageState({this.customerId}); getLanguageID() async { languageID = await sharedPref.getString(APP_LANGUAGE); } + getCustomer() async { String custID; custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID); setState(() { customerId = custID; }); - print("customer Id is"+ customerId); + print("customer Id is" + customerId); return customerId; } getUser() async { var userData = await sharedPref.getObject(USER_PROFILE); - if (userData != null){ user = AuthenticatedUser.fromJson(userData); - setState(() { - firstName = user.firstName.toString(); - print("this is user" + user.firstName.toString()); - print("this is user" + user.firstNameN.toString()); - }); - } else{ - if(userData == null){ - Navigator.push(context, - MaterialPageRoute(builder: (context) => - WelcomeLogin()), + if (userData != null) { + user = AuthenticatedUser.fromJson(userData); + setState(() { + firstName = user.firstName.toString(); + print("this is user" + user.firstName.toString()); + print("this is user" + user.firstNameN.toString()); + }); + } else { + if (userData == null) { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => WelcomeLogin()), ); } } // this.isLogin = user != null; } + void initState() { getCustomer(); getLanguageID(); @@ -88,539 +94,566 @@ class _ProfilePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getOrder(customerId, page_id), - builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).myAccount, - isShowAppBar:false, - isShowDecPage: false, - isPharmacy: true, - body: user != null ? Container( - child: SingleChildScrollView( - child: Column( - children: [ - Container( - child: Row( - children: [ - Container( - padding: EdgeInsets.only( - top: 20.0, - left: 10.0, - right: 10.0, - bottom: 10.0, - ), - child: LargeAvatar( - name: "profile", - url: '', - ), - ), - Container( + onModelReady: (model) => model.getOrder(customerId, page_id), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).myAccount, + isShowAppBar: false, + isShowDecPage: false, + isPharmacy: true, + body: user != null + ? Container( + child: SingleChildScrollView( child: Column( - children: [ - Text( - TranslationBase.of(context).welcome, - style: TextStyle(fontSize: 14.0, - fontWeight: FontWeight.bold, - color:Colors.grey + children: [ + Container( + child: Row( + children: [ + Container( + child: Row( + children: [ + Container( + padding: EdgeInsets.only( + top: 20.0, + left: 10.0, + right: 10.0, + bottom: 10.0, + ), + child: LargeAvatar( + name: "profile", + url: '', + ), + ), + Text( + languageID == "ar" + ? user.firstNameN.toString() + + " " + + user.lastNameN.toString() + : user.firstName.toString() + + " " + + user.lastName.toString(), + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold), + ), + ], + ), + ) + ], ), ), - Text( - languageID == "ar" - ? user.firstNameN.toString()+ " " + user.lastNameN.toString() - : user.firstName.toString()+ " " + user.lastName.toString(), - style: TextStyle( - fontSize: 14.0, fontWeight: FontWeight.bold), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, ), - ], - ), - - ) - ], - ), - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 5, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 15, - ), - Container( - child: Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - if(customerId == null){ - AppToast.showErrorToast(message: "Customer not found"); - return; - } - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => OrderPage(customerID: customerId))); - }, - child: Column( + SizedBox( + height: 15, + ), + Container( + child: Row( children: [ + Expanded( + child: InkWell( + onTap: () { + if (customerId == null) { + AppToast.showErrorToast( + message: "Customer not found"); + return; + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrderPage( + customerID: customerId))); + }, + child: Column( + children: [ // Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), - SvgPicture.asset( - 'assets/images/pharmacy/orders_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).orders, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, + SvgPicture.asset( + 'assets/images/pharmacy/orders_icon.svg', + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).orders, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), ), ), - ], - ), - ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => LakumMainPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/lakum_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).lakum, - style: TextStyle( - fontSize: 13.0, fontWeight: FontWeight.bold), + Expanded( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + LakumMainPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/lakum_icon.svg', + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).lakum, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold), + ), + ], + ), + ), ), - ], - ), - ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => WishlistPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/wishlist_icon.svg', - width: 50, - height: 50, - - ),SizedBox( - height: 5, + Expanded( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + WishlistPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/wishlist_icon.svg', + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).wishlist, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), ), - Text( - TranslationBase.of(context).wishlist, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, + Expanded( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + MyReviewsPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/review_icon.svg', + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), ), ), ], - ), - ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MyReviewsPage())); - },child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/review_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ), - ], - )), - SizedBox( - height: 15, - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 5, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 10, - ), - Container( - padding: EdgeInsets.only(left: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).myAccount, - style: TextStyle( - fontSize: 16.0, fontWeight: FontWeight.bold), - ), - SizedBox( - height: 10, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => HomePrescriptionsPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/my_prescription_icon.svg', - width: 28, - height: 28, - ), - SizedBox( - width: 15, - ), - Text( - TranslationBase.of(context).myPrescription, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ComparePage())); - }, - child: Row( - children: [ - Image.asset('assets/images/pharmacy/compare.png', - width: 35, height: 35), - SizedBox( - width: 15, - ), - Text( - TranslationBase.of(context).compare, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => HomePrescriptionsPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/medication_refill_icon.svg', - width: 30, - height: 30, - ), + )), SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).medicationsRefill, - style: TextStyle( - fontSize: 13.0, - ), + height: 15, ), - ], - ), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MyFamily())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/my_family_icon.svg', - width: 20, + Divider( + color: Colors.grey[350], height: 20, + thickness: 5, + indent: 0, + endIndent: 0, ), SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).family, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PharmacyAddressesPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/shipping_addresses_icon.svg', - width: 30, - height: 30, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).shippingAddresses, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PharmacyTermsConditions())); - }, - child: Row( - children: [ - Image.asset('assets/images/pharmacy/terms.png', - width: 25, - height: 25, - ), - - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context).conditionsHMG, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, - this.mobileNo, this.languageId))); - }, - child: Row( - children: [ - Image.asset('assets/images/pharmacy/terms.png', - width: 25, - height: 25, + height: 10, ), + Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).myAccount, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_prescription_icon.svg', + width: 28, + height: 28, + ), + SizedBox( + width: 15, + ), + Text( + TranslationBase.of(context) + .myPrescription, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + ComparePage())); + }, + child: Row( + children: [ + Image.asset( + 'assets/images/pharmacy/compare.png', + width: 35, + height: 35), + SizedBox( + width: 15, + ), + Text( + TranslationBase.of(context).compare, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/medication_refill_icon.svg', + width: 30, + height: 30, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context) + .medicationsRefill, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + MyFamily())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_family_icon.svg', + width: 20, + height: 20, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).family, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PharmacyAddressesPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/shipping_addresses_icon.svg', + width: 30, + height: 30, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context) + .shippingAddresses, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PharmacyTermsConditions())); + }, + child: Row( + children: [ + Image.asset( + 'assets/images/pharmacy/terms.png', + width: 25, + height: 25, + ), + SizedBox( + width: 10, + ), + Text( + TranslationBase.of(context) + .conditionsHMG, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + LakumTermsConditions( + this.identificationNo, + this.firstName, + this.lastName, + this.mobileNo, + this.languageId))); + }, + child: Row( + children: [ + Image.asset( + 'assets/images/pharmacy/terms.png', + width: 25, + height: 25, + ), // IconButton(icon: Icon(Icons.error_outline), iconSize: 30, // color: Colors.black,), - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context).conditions, - style: TextStyle( - fontSize: 13.0, + SizedBox( + width: 10, + ), + Text( + TranslationBase.of(context) + .conditions, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + ], ), ), - ], - ), - ), - ], - ), - ), - SizedBox( - height: 10, - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 5, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 10, - ), - Container( - padding: EdgeInsets.only(left: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).reachUs, - style: TextStyle( - fontSize: 16.0, fontWeight: FontWeight.bold), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => LiveChatPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/contact_us_icon.svg', - width: 20, - height: 20, - ), SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).contactUs, - style: TextStyle(fontSize: 13.0), + height: 10, ), - ], - ), - ), - SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => FindUsPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/our_locations_icon.svg', - width: 30, - height: 30, + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, ), SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).ourLocations, - style: TextStyle(fontSize: 13.0), + height: 10, ), + Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).reachUs, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + LiveChatPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/contact_us_icon.svg', + width: 20, + height: 20, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).contactUs, + style: TextStyle(fontSize: 13.0), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + FindUsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/our_locations_icon.svg', + width: 30, + height: 30, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context) + .ourLocations, + style: TextStyle(fontSize: 13.0), + ), + ], + ), + ) + ], + ), + ) ], ), - ) - ], - ), - ) - ], - ), - ), - ) : Container(), - )); - }} - - - - + ), + ) + : Container(), + )); + } +} diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index 06bba8c3..f0062a1c 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -29,9 +29,7 @@ class _PharmacyCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getCategorise(), - builder: (BuildContext context, PharmacyCategoriseViewModel model, - Widget child) => - AppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( isShowDecPage: false, baseViewModel: model, body: Column( @@ -59,9 +57,7 @@ class _PharmacyCategorisePageState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic - ? model.categorise[index].namen - : model.categorise[index].name, + projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, fontWeight: FontWeight.w600, ), ), @@ -70,15 +66,14 @@ class _PharmacyCategorisePageState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - model.categorise[index].id != '12' - ? ParentCategorisePage( - id: model.categorise[index].id, - titleName: model.categorise[index].name, - ) - : FinalProductsPage( - id: model.categorise[index].id, - ), + builder: (context) => model.categorise[index].id != '12' + ? ParentCategorisePage( + id: model.categorise[index].id, + titleName: model.categorise[index].name, + ) + : FinalProductsPage( + id: model.categorise[index].id, + ), ), ), }, @@ -91,10 +86,7 @@ class _PharmacyCategorisePageState extends State { height: 140, child: Column( children: [ - Divider( - height: 2.0, - thickness: 1.0, - color: Colors.black12.withOpacity(0.14)), + Divider(height: 2.0, thickness: 1.0, color: Colors.black12.withOpacity(0.14)), SizedBox( height: 10.0, ), @@ -103,20 +95,21 @@ class _PharmacyCategorisePageState extends State { Expanded( child: Padding( padding: EdgeInsets.all(4.0), - child: Container( - height: 50.0, - width: 55.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - color: Colors.green.shade300.withOpacity(0.34), - ), - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), - child: Texts( - projectViewModel.isArabic - ? 'الاكثر مبيعا' - : 'Best Sellers', - fontWeight: FontWeight.w600, + child: InkWell( + onTap: () {}, + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.green.shade300.withOpacity(0.34), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic ? 'الاكثر مبيعا' : 'Best Sellers', + fontWeight: FontWeight.w600, + ), ), ), ), @@ -129,16 +122,13 @@ class _PharmacyCategorisePageState extends State { height: 50.0, width: 55.0, decoration: BoxDecoration( - color: Colors.orangeAccent.shade200 - .withOpacity(0.34), + color: Colors.orangeAccent.shade200.withOpacity(0.34), borderRadius: BorderRadius.circular(5.0), ), child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic - ? 'الاكثر مشاهدة' - : 'Most Viewed', + projectViewModel.isArabic ? 'الاكثر مشاهدة' : 'Most Viewed', fontWeight: FontWeight.w600, ), ), @@ -162,9 +152,7 @@ class _PharmacyCategorisePageState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic - ? 'منتجات جديدة' - : 'New Products', + projectViewModel.isArabic ? 'منتجات جديدة' : 'New Products', fontWeight: FontWeight.w600, ), ), @@ -182,17 +170,13 @@ class _PharmacyCategorisePageState extends State { height: 50.0, width: 55.0, decoration: BoxDecoration( - color: - Colors.purple.shade200.withOpacity(0.34), + color: Colors.purple.shade200.withOpacity(0.34), borderRadius: BorderRadius.circular(5.0), ), child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 10.0), + padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic - ? 'شوهد مؤخرا' - : 'Recently Viewed', + projectViewModel.isArabic ? 'شوهد مؤخرا' : 'Recently Viewed', fontWeight: FontWeight.w600, ), ), @@ -220,7 +204,7 @@ class _PharmacyCategorisePageState extends State { /// int patientID = get from qr result String result = await BarcodeScanner.scan(); var data = json.decode(result); - if (data!=null) { + if (data != null) { var qRParkingID = data['QRParkingID']; await model.scanQr(); if (model.state == ViewState.ErrorLocal) { diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index f5ec34c3..bf0f4b4e 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -208,8 +208,8 @@ class _RateAppointmentClinicState extends State { } }, label: TranslationBase.of(context).submit, - disabled: model.state == ViewState.BusyLocal, - loading: model.state == ViewState.BusyLocal, + disabled: (model.state == ViewState.Busy || rating==0), + // loading: model.state == ViewState.BusyLocal, textColor: Theme.of(context).backgroundColor), ), SizedBox( diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index b3349704..71aacae2 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -206,7 +206,7 @@ class _RateAppointmentDoctorState extends State { } }, label: TranslationBase.of(context).next, - disabled: model.state == ViewState.BusyLocal|| rating==0, + disabled: (model.state == ViewState.BusyLocal || rating==0), loading: model.state == ViewState.BusyLocal, textColor: Theme.of(context).backgroundColor), ), diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index d26c74ad..72f18979 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -41,7 +41,8 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -105,7 +106,8 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -145,7 +147,8 @@ class DoctorsListService extends BaseService { Future getDoctorsProfile( int docID, int clinicID, int projectID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -177,10 +180,10 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsRating( - int docID, context) async { + Future getDoctorsRating(int docID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -203,17 +206,17 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_DOCTOR_RATING_NOTES, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } - Future getDoctorsRatingDetails( - int docID, context) async { + Future getDoctorsRatingDetails(int docID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -236,17 +239,18 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_DOCTOR_RATING_DETAILS, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } Future getDoctorFreeSlots( int docID, int clinicID, int projectID, BuildContext context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -281,7 +285,8 @@ class DoctorsListService extends BaseService { Future getDoctorScheduledFreeSlots(int docID, int clinicID, int projectID, int serviceID, BuildContext context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -324,7 +329,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": false, @@ -383,7 +389,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": true, @@ -437,7 +444,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -481,7 +489,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -526,7 +535,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -560,7 +570,8 @@ class DoctorsListService extends BaseService { Future getPatientAppointmentCurfewHistory( bool isActiveAppointment) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -601,7 +612,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -654,7 +666,8 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -701,7 +714,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -751,7 +765,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -802,7 +817,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -847,7 +863,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "ClientRequestID": transactionID, @@ -886,7 +903,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AdvanceNumber": advanceNumber, @@ -923,7 +941,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForAskYourDoctor": true, @@ -963,7 +982,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, @@ -999,7 +1019,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -1058,7 +1079,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appoNo, @@ -1133,7 +1155,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appo.appointmentNo, @@ -1174,7 +1197,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentDate": appoDate, @@ -1223,7 +1247,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "ProjectID": projectID, @@ -1282,7 +1307,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -1320,4 +1346,42 @@ class DoctorsListService extends BaseService { }, body: request); return Future.value(localRes); } + + Future getPatientHealthDataStats( + int medCategoryId, int medCategoryStsId, BuildContext context) async { + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + request = { + "MedCategoryID": medCategoryId, + "MedGetStsID": medCategoryStsId, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + dynamic localRes; + await baseAppClient.post(GET_PATIENT_HEALTH_STATS, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart index a3bb9976..b8ea8214 100644 --- a/lib/services/pharmacy_services/orderDetails_service.dart +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -16,20 +16,20 @@ class OrderDetailsService extends BaseService{ AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); - - List get orderDetails => orderDetails; +// String url =""; +// List get orderDetails => ordeDetails; List _orderList = List(); List get orderList => _orderList; - Future getOrderDetails(orderId) async { - print("step 2" + orderId); + Future getOrderDetails(OrderId) async { hasError = false; - await baseAppClient.getPharmacy(GET_ORDER_DETAILS+orderId, + await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId, onSuccess: (dynamic response, int statusCode) { _orderList.clear(); response['orders'].forEach((item) { _orderList.add(OrderModel.fromJson(item)); + print(response); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart index e426b801..3f1ece78 100644 --- a/lib/services/pharmacy_services/order_service.dart +++ b/lib/services/pharmacy_services/order_service.dart @@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; class OrderService extends BaseService{ @@ -14,21 +14,23 @@ class OrderService extends BaseService{ AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); - List _orderList = List(); - List get orderList => _orderList; + List _orderList = List(); + List get orderList => _orderList; String url =""; Future getOrder(customerId, pageId) async { hasError = false; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; - url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; + // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; + url =GET_ORDER+"customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId"; print(url); await baseAppClient.getPharmacy(url, onSuccess: (dynamic response, int statusCode) { _orderList.clear(); + response['orders'].forEach((item) { - _orderList.add(OrderModel.fromJson(item)); + _orderList.add(Orders.fromJson(item)); }); print(_orderList.length); print(response); @@ -39,25 +41,27 @@ class OrderService extends BaseService{ } - Future getProductReview(orderId) async { - print("step 1"); - hasError = false; - url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; -// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$page_id&limit=200&customer_id=$custmerId"; - print(url); - await baseAppClient.getPharmacy(url, - onSuccess: (dynamic response, int statusCode) { - _orderList.clear(); - response['orders'].forEach((item) { - _orderList.add(OrderModel.fromJson(item)); - }); - print(_orderList.length); - print(response); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); - } +// Future getProductReview(orderId) async { +// print("step 1"); +// hasError = false; +// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; +//// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$page_id&limit=200&customer_id=$custmerId"; +// print(url); +// await baseAppClient.getPharmacy(url, +// onSuccess: (dynamic response, int statusCode) { +// _orderList.clear(); +// response['orders'].forEach((item) { +// _orderList.add(OrderModel.fromJson(item)); +// }); +// print(_orderList.length); +// print(response); +// }, onFailure: (String error, int statusCode) { +// hasError = true; +// super.error = error; +// }); +// } + + // Future getOrder(BuildContext context ) async { // // if (await this.sharedPref.getObject(USER_PROFILE) != null) { diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart index 1bb6571c..592359ca 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -16,7 +16,7 @@ class PharmacyAddressService extends BaseService { hasError = false; Addresses selectedAddress; try { - await baseAppClient.get("$GET_CUSTOMERS_ADDRESSES$customerId", + await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) async { addresses.clear(); var savedAddress = @@ -45,7 +45,7 @@ class PharmacyAddressService extends BaseService { Future getCountries(String countryName) async { hasError = false; try { - await baseAppClient.get("$PHARMACY_GET_COUNTRY", + await baseAppClient.getPharmacy("$PHARMACY_GET_COUNTRY", onSuccess: (dynamic response, int statusCode) { // countries.clear(); response['countries'].forEach((item) { diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index 7a2947b0..e3e8403e 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -102,20 +102,24 @@ class ProductDetailService extends BaseService { }, body: request); } + Future notifyMe(customerId, itemID) async { + hasError = false; + await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) { + AppToast.showSuccessToast(message: 'You will be notified when product available'); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + AppToast.showErrorToast(message: 'something went wrong please try again'); + }); + } + Future addToWishlist(itemID) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; Map request; request = { - "shopping_cart_item": - { - "quantity": 1, - "shopping_cart_type": "Wishlist", - "product_id": itemID, - "customer_id": customerId, - "language_id": 1 - } + "shopping_cart_item": {"quantity": 1, "shopping_cart_type": "Wishlist", "product_id": itemID, "customer_id": customerId, "language_id": 1} }; await baseAppClient.post(GET_SHOPPING_CART, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/uitl/HMGNetworkConnectivity.dart b/lib/uitl/HMGNetworkConnectivity.dart index 228edf93..c4044573 100644 --- a/lib/uitl/HMGNetworkConnectivity.dart +++ b/lib/uitl/HMGNetworkConnectivity.dart @@ -47,18 +47,28 @@ class HMGNetworkConnectivity { void confirmFromUser() { TranslationBase translator = TranslationBase.of(context); - ConfirmDialog( - context: context, - confirmMessage: translator.wantToConnectWithHmgNetwork, - okText: translator.yes, - okFunction: () { - ConfirmDialog.closeAlertDialog(context); - callBack(); - }, - cancelText: translator.no, - cancelFunction: () { - ConfirmDialog.closeAlertDialog(context); - }).showAlertDialog(context); + + void doIt() { + ConfirmDialog( + context: context, + confirmMessage: translator.wantToConnectWithHmgNetwork, + okText: translator.yes, + okFunction: () { + ConfirmDialog.closeAlertDialog(context); + callBack(); + }, + cancelText: translator.no, + cancelFunction: () { + ConfirmDialog.closeAlertDialog(context); + }).showAlertDialog(context); + } + + if (Platform.isAndroid) + Wifi.list(SSID).then((value) { + if (!value.indexWhere((element) => element.ssid == SSID).isNegative) doIt(); + }); + else + doIt(); } void showFailDailog(String message) { diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 460a4066..9f959885 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -4,7 +4,7 @@ import 'package:intl/intl.dart'; class DateUtil { /// convert String To Date function /// [date] String we want to convert - static DateTime convertStringToDate(String date) { + static DateTime convertStringToDate(String date) { // /Date(1585774800000+0300)/ if (date != null) { const start = "/Date("; const end = "+0300)"; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 63cf8a44..c3acb5fd 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -58,11 +58,9 @@ class TranslationBase { String get nearestAppo => localizedValues['nearestAppo'][locale.languageCode]; - String get searchByDocText => - localizedValues['searchByDocText'][locale.languageCode]; + String get searchByDocText => localizedValues['searchByDocText'][locale.languageCode]; - String get enterDocName => - localizedValues['enterDocName'][locale.languageCode]; + String get enterDocName => localizedValues['enterDocName'][locale.languageCode]; String get search => localizedValues['search'][locale.languageCode]; @@ -72,18 +70,15 @@ class TranslationBase { String get appoInfo => localizedValues['appoInfo'][locale.languageCode]; - String get availableAppo => - localizedValues['availableAppo'][locale.languageCode]; + String get availableAppo => localizedValues['availableAppo'][locale.languageCode]; String get gender => localizedValues['gender'][locale.languageCode]; String get nationality => localizedValues['nationality'][locale.languageCode]; - String get docQualifications => - localizedValues['docQualifications'][locale.languageCode]; + String get docQualifications => localizedValues['docQualifications'][locale.languageCode]; - String get confirmAppoHeading => - localizedValues['confirmAppoHeading'][locale.languageCode]; + String get confirmAppoHeading => localizedValues['confirmAppoHeading'][locale.languageCode]; String get patientInfo => localizedValues['patientInfo'][locale.languageCode]; @@ -123,8 +118,7 @@ class TranslationBase { String get welcome => localizedValues['welcome'][locale.languageCode]; - String get welcomeText => - localizedValues['welcome_text'][locale.languageCode]; + String get welcomeText => localizedValues['welcome_text'][locale.languageCode]; String get welcomeText2 => localizedValues['welcome_text2'][locale.languageCode]; @@ -132,10 +126,8 @@ class TranslationBase { String get no => localizedValues['no'][locale.languageCode]; - String get logintypeRadio => - localizedValues['logintyperadio'][locale.languageCode]; - String get registerInfoFamily => - localizedValues['register-info-family'][locale.languageCode]; + String get logintypeRadio => localizedValues['logintyperadio'][locale.languageCode]; + String get registerInfoFamily => localizedValues['register-info-family'][locale.languageCode]; String get registerNow => localizedValues['registernow'][locale.languageCode]; @@ -145,17 +137,13 @@ class TranslationBase { String get fileNo => localizedValues['fileNo'][locale.languageCode]; String get fileno => localizedValues['fileno'][locale.languageCode]; - String get forgotPassword => - localizedValues['forgotFileNo'][locale.languageCode]; + String get forgotPassword => localizedValues['forgotFileNo'][locale.languageCode]; - String get forgotFileNoTitle => - localizedValues['forgotFileNoTitle'][locale.languageCode]; + String get forgotFileNoTitle => localizedValues['forgotFileNoTitle'][locale.languageCode]; - String get enterNationalId => - localizedValues['enter-national-id'][locale.languageCode]; + String get enterNationalId => localizedValues['enter-national-id'][locale.languageCode]; - String get profileInfo => - localizedValues['profile-info'][locale.languageCode]; + String get profileInfo => localizedValues['profile-info'][locale.languageCode]; String get submit => localizedValues['submit'][locale.languageCode]; @@ -165,42 +153,31 @@ class TranslationBase { String get hijriDate => localizedValues['hijri-date'][locale.languageCode]; - String get gregorianDate => - localizedValues['gregorian-date'][locale.languageCode]; + String get gregorianDate => localizedValues['gregorian-date'][locale.languageCode]; - String get verifyLoginWith => - localizedValues['verify-login-with'][locale.languageCode]; + String get verifyLoginWith => localizedValues['verify-login-with'][locale.languageCode]; String get register => localizedValues['register-user'][locale.languageCode]; - String get verifyFingerprint => - localizedValues['verify-with-fingerprint'][locale.languageCode]; + String get verifyFingerprint => localizedValues['verify-with-fingerprint'][locale.languageCode]; - String get verifyFaceID => - localizedValues['verify-with-faceid'][locale.languageCode]; + String get verifyFaceID => localizedValues['verify-with-faceid'][locale.languageCode]; - String get verifySMS => - localizedValues['verify-with-sms'][locale.languageCode]; + String get verifySMS => localizedValues['verify-with-sms'][locale.languageCode]; - String get verifyWhatsApp => - localizedValues['verify-with-whatsapp'][locale.languageCode]; + String get verifyWhatsApp => localizedValues['verify-with-whatsapp'][locale.languageCode]; String get lastLoginAt => localizedValues['last-login'][locale.languageCode]; - String get lastLoginWith => - localizedValues['last-login-with'][locale.languageCode]; + String get lastLoginWith => localizedValues['last-login-with'][locale.languageCode]; - String get verifyFingerprint2 => - localizedValues['verify-fingerprint'][locale.languageCode]; + String get verifyFingerprint2 => localizedValues['verify-fingerprint'][locale.languageCode]; - String get searchMedicine => - localizedValues['searchMedicine'][locale.languageCode]; + String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; - String get searchMedicineHere => - localizedValues['searchMedicineHere'][locale.languageCode]; + String get searchMedicineHere => localizedValues['searchMedicineHere'][locale.languageCode]; - String get pendingPayment => - localizedValues['pendingPayment'][locale.languageCode]; + String get pendingPayment => localizedValues['pendingPayment'][locale.languageCode]; String get payNow => localizedValues['payNow'][locale.languageCode]; @@ -210,33 +187,24 @@ class TranslationBase { String get livecare => localizedValues['livecare'][locale.languageCode]; - String get upcomingNoAction => - localizedValues['upcoming-noAction'][locale.languageCode]; + String get upcomingNoAction => localizedValues['upcoming-noAction'][locale.languageCode]; - String get upcomingConfirm => - localizedValues['upcoming-confirm'][locale.languageCode]; + String get upcomingConfirm => localizedValues['upcoming-confirm'][locale.languageCode]; - String get upcomingPaymentPending => - localizedValues['upcoming-payment-pending'][locale.languageCode]; - String get upcomingConfirmMore => - localizedValues['book-success-confirm-more-24-1-2'][locale.languageCode]; + String get upcomingPaymentPending => localizedValues['upcoming-payment-pending'][locale.languageCode]; + String get upcomingConfirmMore => localizedValues['book-success-confirm-more-24-1-2'][locale.languageCode]; - String get upcomingPaymentNow => - localizedValues['upcoming-payment-now'][locale.languageCode]; + String get upcomingPaymentNow => localizedValues['upcoming-payment-now'][locale.languageCode]; String get upcomingQR => localizedValues['upcoming-QR'][locale.languageCode]; - String get upcomingVirtual => - localizedValues['upcoming-virtual'][locale.languageCode]; + String get upcomingVirtual => localizedValues['upcoming-virtual'][locale.languageCode]; - String get upcomingLivecare => - localizedValues['upcoming-livecare'][locale.languageCode]; + String get upcomingLivecare => localizedValues['upcoming-livecare'][locale.languageCode]; - String get liveCareAppo => - localizedValues['livecareAppo'][locale.languageCode]; + String get liveCareAppo => localizedValues['livecareAppo'][locale.languageCode]; - String get upcomingDetails => - localizedValues['upcoming-details'][locale.languageCode]; + String get upcomingDetails => localizedValues['upcoming-details'][locale.languageCode]; String get reschedule => localizedValues['reschedule'][locale.languageCode]; @@ -254,36 +222,28 @@ class TranslationBase { String get payment => localizedValues['payment'][locale.languageCode]; - String get cancel_nocaps => - localizedValues['cancel-nocaps'][locale.languageCode]; + String get cancel_nocaps => localizedValues['cancel-nocaps'][locale.languageCode]; - String get cancelAppoMsg => - localizedValues['cancelAppoMsg'][locale.languageCode]; + String get cancelAppoMsg => localizedValues['cancelAppoMsg'][locale.languageCode]; - String get pharmaciesList => - localizedValues['pharmaciesList'][locale.languageCode]; + String get pharmaciesList => localizedValues['pharmaciesList'][locale.languageCode]; String get description => localizedValues['description'][locale.languageCode]; + String get howToUse => localizedValues['howToUse'][locale.languageCode]; String get price => localizedValues['price'][locale.languageCode]; - String get youCanFindItIn => - localizedValues['youCanFindItIn'][locale.languageCode]; + String get youCanFindItIn => localizedValues['youCanFindItIn'][locale.languageCode]; - String get pleaseEnterMedicineName => - localizedValues['pleaseEnterMedicineName'][locale.languageCode]; + String get pleaseEnterMedicineName => localizedValues['pleaseEnterMedicineName'][locale.languageCode]; - String get verificationMessage => - localizedValues['verification_message'][locale.languageCode]; + String get verificationMessage => localizedValues['verification_message'][locale.languageCode]; - String get validationMessage => - localizedValues['validation_message'][locale.languageCode]; + String get validationMessage => localizedValues['validation_message'][locale.languageCode]; - String get arabicChange => - localizedValues['arabic-change'][locale.languageCode]; + String get arabicChange => localizedValues['arabic-change'][locale.languageCode]; - String get notification => - localizedValues['notification'][locale.languageCode]; + String get notification => localizedValues['notification'][locale.languageCode]; String get appsetting => localizedValues['app-settings'][locale.languageCode]; @@ -300,29 +260,20 @@ class TranslationBase { String get moreVerification => localizedValues['more-verify'][locale.languageCode]; - String get welcomeBack => - localizedValues['welcome-back'][locale.languageCode]; + String get welcomeBack => localizedValues['welcome-back'][locale.languageCode]; - String get accountInfo => - localizedValues['account-info'][locale.languageCode]; + String get accountInfo => localizedValues['account-info'][locale.languageCode]; - String get useAnotherAccount => - localizedValues['another-acc'][locale.languageCode]; + String get useAnotherAccount => localizedValues['another-acc'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; - String get noNeedToWaitInLine => - localizedValues['noNeedToWaitInLine'][locale.languageCode]; - String get useQRAppoAttend => - localizedValues['useQRAppoAttend'][locale.languageCode]; - String get passQRAppoAttend => - localizedValues['passQRAppoAttend'][locale.languageCode]; - String get sitWaitingQR => - localizedValues['sitWaitingQR'][locale.languageCode]; - String get attendRegisterCode => - localizedValues['attendRegisterCode'][locale.languageCode]; - String get scanQRHospital => - localizedValues['scanQRHospital'][locale.languageCode]; + String get noNeedToWaitInLine => localizedValues['noNeedToWaitInLine'][locale.languageCode]; + String get useQRAppoAttend => localizedValues['useQRAppoAttend'][locale.languageCode]; + String get passQRAppoAttend => localizedValues['passQRAppoAttend'][locale.languageCode]; + String get sitWaitingQR => localizedValues['sitWaitingQR'][locale.languageCode]; + String get attendRegisterCode => localizedValues['attendRegisterCode'][locale.languageCode]; + String get scanQRHospital => localizedValues['scanQRHospital'][locale.languageCode]; String get sendEmail => localizedValues['sendEmail'][locale.languageCode]; String get close => localizedValues['close'][locale.languageCode]; String get booked => localizedValues['booked'][locale.languageCode]; @@ -363,21 +314,19 @@ class TranslationBase { String get myFamily => localizedValues['myFamily'][locale.languageCode]; String get oxygenation => localizedValues['oxygenation'][locale.languageCode]; - String get respirationRate => - localizedValues['respirationRate'][locale.languageCode]; + String get respirationRate => localizedValues['respirationRate'][locale.languageCode]; - String get bodyMeasurements => - localizedValues['bodyMeasurements'][locale.languageCode]; + String get bodyMeasurements => localizedValues['bodyMeasurements'][locale.languageCode]; String get height => localizedValues['height'][locale.languageCode]; - + String get heightUnit => localizedValues['heightUnit'][locale.languageCode]; + String get weightUnit => localizedValues['weightUnit'][locale.languageCode]; String get temperature => localizedValues['temperature'][locale.languageCode]; String get pulse => localizedValues['pulse'][locale.languageCode]; String get respiration => localizedValues['respiration'][locale.languageCode]; - String get bloodPressure => - localizedValues['bloodPressure'][locale.languageCode]; + String get bloodPressure => localizedValues['bloodPressure'][locale.languageCode]; String get painScale => localizedValues['painScale'][locale.languageCode]; String get heart => localizedValues['heart'][locale.languageCode]; @@ -386,8 +335,7 @@ class TranslationBase { String get request => localizedValues['request'][locale.languageCode]; String get memberName => localizedValues['member-name'][locale.languageCode]; String get switchUser => localizedValues['switch-login'][locale.languageCode]; - String get removeMember => - localizedValues['remove-membe'][locale.languageCode]; + String get removeMember => localizedValues['remove-membe'][locale.languageCode]; String get allowView => localizedValues['allow-view'][locale.languageCode]; String get rejectView => localizedValues['reject-view'][locale.languageCode]; String get deleteView => localizedValues['delete-view'][locale.languageCode]; @@ -396,49 +344,32 @@ class TranslationBase { String get companyName => localizedValues['companyName'][locale.languageCode]; String get receiptOn => localizedValues['receiptOn'][locale.languageCode]; String get expiryDate => localizedValues['expiryDate'][locale.languageCode]; - String get procedureName => - localizedValues['procedureName'][locale.languageCode]; - String get procedureStatus => - localizedValues['procedureStatus'][locale.languageCode]; + String get procedureName => localizedValues['procedureName'][locale.languageCode]; + String get procedureStatus => localizedValues['procedureStatus'][locale.languageCode]; String get usageStatus => localizedValues['usageStatus'][locale.languageCode]; String get unusedCount => localizedValues['unusedCount'][locale.languageCode]; - String get totalApproval => - localizedValues['totalApproval'][locale.languageCode]; + String get totalApproval => localizedValues['totalApproval'][locale.languageCode]; String get category => localizedValues['category'][locale.languageCode]; - String get expirationDate => - localizedValues['expirationDate'][locale.languageCode]; + String get expirationDate => localizedValues['expirationDate'][locale.languageCode]; String get patientCard => localizedValues['patientCard'][locale.languageCode]; - String get policyNumber => - localizedValues['policyNumber'][locale.languageCode]; + String get policyNumber => localizedValues['policyNumber'][locale.languageCode]; String get seeDetails => localizedValues['seeDetails'][locale.languageCode]; - String get insuranceCards => - localizedValues['insuranceCards'][locale.languageCode]; + String get insuranceCards => localizedValues['insuranceCards'][locale.languageCode]; String get requestType => localizedValues['requestType'][locale.languageCode]; - String get addFamilyMember => - localizedValues['add-new-member'][locale.languageCode]; - String get removeFamilyMember => - localizedValues['remove-family-member'][locale.languageCode]; - - String get myMedicalFile => - localizedValues['MyMedicalFile'][locale.languageCode]; - String get myMedicalFileSubTitle => - localizedValues['myMedicalFileSubTitle'][locale.languageCode]; + String get addFamilyMember => localizedValues['add-new-member'][locale.languageCode]; + String get removeFamilyMember => localizedValues['remove-family-member'][locale.languageCode]; + + String get myMedicalFile => localizedValues['MyMedicalFile'][locale.languageCode]; + String get myMedicalFileSubTitle => localizedValues['myMedicalFileSubTitle'][locale.languageCode]; String get viewMore => localizedValues['viewMore'][locale.languageCode]; - String get homeHealthCareService => - localizedValues['homeHealthCareService'][locale.languageCode]; - String get onlinePharmacy => - localizedValues['OnlinePharmacy'][locale.languageCode]; - String get emergencyService => - localizedValues['EmergencyService'][locale.languageCode]; - String get onlinePaymentService => - localizedValues['OnlinePaymentService'][locale.languageCode]; - String get offersAndPackages => - localizedValues['OffersAndPackages'][locale.languageCode]; - String get comprehensiveMedicalCheckup => - localizedValues['ComprehensiveMedicalCheckup'][locale.languageCode]; + String get homeHealthCareService => localizedValues['homeHealthCareService'][locale.languageCode]; + String get onlinePharmacy => localizedValues['OnlinePharmacy'][locale.languageCode]; + String get emergencyService => localizedValues['EmergencyService'][locale.languageCode]; + String get onlinePaymentService => localizedValues['OnlinePaymentService'][locale.languageCode]; + String get offersAndPackages => localizedValues['OffersAndPackages'][locale.languageCode]; + String get comprehensiveMedicalCheckup => localizedValues['ComprehensiveMedicalCheckup'][locale.languageCode]; String get hMGService => localizedValues['HMGService'][locale.languageCode]; - String get viewAllHabibMedicalService => - localizedValues['ViewAllHabibMedicalService'][locale.languageCode]; + String get viewAllHabibMedicalService => localizedValues['ViewAllHabibMedicalService'][locale.languageCode]; String get viewAll => localizedValues['viewAll'][locale.languageCode]; String get view => localizedValues['view'][locale.languageCode]; String get contactUs => localizedValues['ContactUs'][locale.languageCode]; @@ -457,182 +388,119 @@ class TranslationBase { String get emergencyServices => localizedValues['emergencyServices'][locale.languageCode]; String get nearester => localizedValues['nearester'][locale.languageCode]; String get locationa => localizedValues['locationa'][locale.languageCode]; - String get ambulancerequest => - localizedValues['ambulancerequest'][locale.languageCode]; + String get ambulancerequest => localizedValues['ambulancerequest'][locale.languageCode]; String get requestA => localizedValues['requestA'][locale.languageCode]; - String get consultation => - localizedValues['consultation'][locale.languageCode]; + String get consultation => localizedValues['consultation'][locale.languageCode]; String get logs => localizedValues['logs'][locale.languageCode]; - String get textToSpeech => - localizedValues['textToSpeech'][locale.languageCode]; - - String get myAppointments => - localizedValues['MyAppointments'][locale.languageCode]; - String get noBookedAppointments => - localizedValues['NoBookedAppointments'][locale.languageCode]; - String get noConfirmedAppointments => - localizedValues['NoConfirmedAppointments'][locale.languageCode]; - String get noArrivedAppointments => - localizedValues['noArrivedAppointments'][locale.languageCode]; - String get myAppointmentsList => - localizedValues['MyAppointmentsList'][locale.languageCode]; + String get textToSpeech => localizedValues['textToSpeech'][locale.languageCode]; + + String get myAppointments => localizedValues['MyAppointments'][locale.languageCode]; + String get noBookedAppointments => localizedValues['NoBookedAppointments'][locale.languageCode]; + String get noConfirmedAppointments => localizedValues['NoConfirmedAppointments'][locale.languageCode]; + String get noArrivedAppointments => localizedValues['noArrivedAppointments'][locale.languageCode]; + String get myAppointmentsList => localizedValues['MyAppointmentsList'][locale.languageCode]; String get radiology => localizedValues['Radiology'][locale.languageCode]; - String get radiologySubtitle => - localizedValues['RadiologySubtitle'][locale.languageCode]; + String get radiologySubtitle => localizedValues['RadiologySubtitle'][locale.languageCode]; String get lab => localizedValues['Lab'][locale.languageCode]; String get labSubtitle => localizedValues['LabSubtitle'][locale.languageCode]; String get medicines => localizedValues['Medicines'][locale.languageCode]; - String get medicinesSubtitle => - localizedValues['MedicinesSubtitle'][locale.languageCode]; + String get medicinesSubtitle => localizedValues['MedicinesSubtitle'][locale.languageCode]; String get vitalSigns => localizedValues['VitalSigns'][locale.languageCode]; - String get vitalSignsSubtitle => - localizedValues['VitalSignsSubTitle'][locale.languageCode]; + String get vitalSignsSubtitle => localizedValues['VitalSignsSubTitle'][locale.languageCode]; String get myMedical => localizedValues['MyMedical'][locale.languageCode]; - String get myMedicalSubtitle => - localizedValues['MyMedicalSubtitle'][locale.languageCode]; + String get myMedicalSubtitle => localizedValues['MyMedicalSubtitle'][locale.languageCode]; String get myDoctor => localizedValues['MyDoctor'][locale.languageCode]; - String get myDoctorSubtitle => - localizedValues['MyDoctorSubtitle'][locale.languageCode]; + String get myDoctorSubtitle => localizedValues['MyDoctorSubtitle'][locale.languageCode]; String get eye => localizedValues['Eye'][locale.languageCode]; String get eyeSubtitle => localizedValues['EyeSubtitle'][locale.languageCode]; String get insurance => localizedValues['Insurance'][locale.languageCode]; - String get insuranceSubtitle => - localizedValues['InsuranceSubtitle'][locale.languageCode]; - String get updateInsurance => - localizedValues['UpdateInsurance'][locale.languageCode]; - String get updateInsuranceSubtitle => - localizedValues['UpdateInsuranceSubtitle'][locale.languageCode]; - String get insuranceApproval => - localizedValues['InsuranceApproval'][locale.languageCode]; - String get insuranceApprovalSubtitle => - localizedValues['InsuranceApprovalSubtitle'][locale.languageCode]; + String get insuranceSubtitle => localizedValues['InsuranceSubtitle'][locale.languageCode]; + String get updateInsurance => localizedValues['UpdateInsurance'][locale.languageCode]; + String get updateInsuranceSubtitle => localizedValues['UpdateInsuranceSubtitle'][locale.languageCode]; + String get insuranceApproval => localizedValues['InsuranceApproval'][locale.languageCode]; + String get insuranceApprovalSubtitle => localizedValues['InsuranceApprovalSubtitle'][locale.languageCode]; String get allergies => localizedValues['Allergies'][locale.languageCode]; - String get allergiesSubtitle => - localizedValues['AllergiesSubtitle'][locale.languageCode]; + String get allergiesSubtitle => localizedValues['AllergiesSubtitle'][locale.languageCode]; String get myVaccines => localizedValues['MyVaccines'][locale.languageCode]; - String get myVaccinesSubtitle => - localizedValues['MyVaccinesSubtitle'][locale.languageCode]; + String get myVaccinesSubtitle => localizedValues['MyVaccinesSubtitle'][locale.languageCode]; String get medical => localizedValues['Medical'][locale.languageCode]; - String get medicalSubtitle => - localizedValues['MedicalSubtitle'][locale.languageCode]; + String get medicalSubtitle => localizedValues['MedicalSubtitle'][locale.languageCode]; String get monthly => localizedValues['Monthly'][locale.languageCode]; - String get monthlySubtitle => - localizedValues['MonthlySubtitle'][locale.languageCode]; + String get monthlySubtitle => localizedValues['MonthlySubtitle'][locale.languageCode]; String get sick => localizedValues['Sick'][locale.languageCode]; - String get sickSubtitle => - localizedValues['SickSubtitle'][locale.languageCode]; + String get sickSubtitle => localizedValues['SickSubtitle'][locale.languageCode]; String get myBalance => localizedValues['MyBalance'][locale.languageCode]; - String get myBalanceSubtitle => - localizedValues['MyBalanceSubtitle'][locale.languageCode]; + String get myBalanceSubtitle => localizedValues['MyBalanceSubtitle'][locale.languageCode]; String get patientCall => localizedValues['PatientCall'][locale.languageCode]; - String get patientCallSubtitle => - localizedValues['PatientCallSubtitle'][locale.languageCode]; - String get smartWatches => - localizedValues['SmartWatches'][locale.languageCode]; - String get smartWatchesSubtitle => - localizedValues['SmartWatchesSubtitle'][locale.languageCode]; + String get patientCallSubtitle => localizedValues['PatientCallSubtitle'][locale.languageCode]; + String get smartWatches => localizedValues['SmartWatches'][locale.languageCode]; + String get smartWatchesSubtitle => localizedValues['SmartWatchesSubtitle'][locale.languageCode]; String get myTrackers => localizedValues['MyTrackers'][locale.languageCode]; - String get myTrackersSubtitle => - localizedValues['MyTrackersSubtitle'][locale.languageCode]; + String get myTrackersSubtitle => localizedValues['MyTrackersSubtitle'][locale.languageCode]; String get askYour => localizedValues['AskYour'][locale.languageCode]; - String get askYourSubtitle => - localizedValues['AskYourSubtitle'][locale.languageCode]; + String get askYourSubtitle => localizedValues['AskYourSubtitle'][locale.languageCode]; String get internet => localizedValues['Internet'][locale.languageCode]; - String get internetSubtitle => - localizedValues['InternetSubtitle'][locale.languageCode]; + String get internetSubtitle => localizedValues['InternetSubtitle'][locale.languageCode]; String get chatbot => localizedValues['Chatbot'][locale.languageCode]; - String get chatbotSubtitle => - localizedValues['ChatbotSubtitle'][locale.languageCode]; + String get chatbotSubtitle => localizedValues['ChatbotSubtitle'][locale.languageCode]; String get timeLine => localizedValues['TimeLine'][locale.languageCode]; String get labOrders => localizedValues['LabOrders'][locale.languageCode]; String get billNo => localizedValues['BillNo'][locale.languageCode]; - String get prescriptions => - localizedValues['Prescriptions'][locale.languageCode]; + String get prescriptions => localizedValues['Prescriptions'][locale.languageCode]; String get history => localizedValues['History'][locale.languageCode]; String get orderNo => localizedValues['OrderNo'][locale.languageCode]; - String get orderDetails => - localizedValues['OrderDetails'][locale.languageCode]; + String get trackDeliveryDriver => localizedValues['trackDeliveryDriver'][locale.languageCode]; + String get orderDetails => localizedValues['OrderDetails'][locale.languageCode]; String get vitalSign => localizedValues['VitalSign'][locale.languageCode]; - String get monthlyReports => - localizedValues['MonthlyReports'][locale.languageCode]; + String get monthlyReports => localizedValues['MonthlyReports'][locale.languageCode]; - String get locationDialogMessage => - localizedValues['locationDialogMessage'][locale.languageCode]; - String get userViewRequest => - localizedValues['user-view-requester'][locale.languageCode]; + String get locationDialogMessage => localizedValues['locationDialogMessage'][locale.languageCode]; + String get userViewRequest => localizedValues['user-view-requester'][locale.languageCode]; String get userView => localizedValues['user-view'][locale.languageCode]; - String get sentRequest => - localizedValues['sent-requests'][locale.languageCode]; + String get sentRequest => localizedValues['sent-requests'][locale.languageCode]; String get km => localizedValues['km'][locale.languageCode]; - String get patientHealthSummaryReport => - localizedValues['PatientHealthSummaryReport'][locale.languageCode]; - String get toViewTheTermsAndConditions => - localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; + String get patientHealthSummaryReport => localizedValues['PatientHealthSummaryReport'][locale.languageCode]; + String get toViewTheTermsAndConditions => localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; String get clickHere => localizedValues['ClickHere'][locale.languageCode]; - String get iAgreeToTheTermsAndConditions => - localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode]; - String get iAgreeToTheTermsAndConditionsSubtitle => - localizedValues['IAgreeToTheTermsAndConditionsSubtitle'] - [locale.languageCode]; + String get iAgreeToTheTermsAndConditions => localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode]; + String get iAgreeToTheTermsAndConditionsSubtitle => localizedValues['IAgreeToTheTermsAndConditionsSubtitle'][locale.languageCode]; String get save => localizedValues['Save'][locale.languageCode]; - String get userAgreement => - localizedValues['UserAgreement'][locale.languageCode]; - String get updateSuccessfully => - localizedValues['UpdateSuccessfully'][locale.languageCode]; - String get emailSentSuccessfully => - localizedValues['EmailSentSuccessfully'][locale.languageCode]; - String get checkVaccineAvailability => - localizedValues['CHECK_VACCINE_AVAILABILITY'][locale.languageCode]; - String get myVaccinesAvailability => - localizedValues['MyVaccinesAvailability'][locale.languageCode]; - String get paymentService => - localizedValues['PaymentService'][locale.languageCode]; - String get paymentOnline => - localizedValues['PaymentOnline'][locale.languageCode]; - String get onlineCheckIn => - localizedValues['OnlineCheckIn'][locale.languageCode]; + String get userAgreement => localizedValues['UserAgreement'][locale.languageCode]; + String get updateSuccessfully => localizedValues['UpdateSuccessfully'][locale.languageCode]; + String get emailSentSuccessfully => localizedValues['EmailSentSuccessfully'][locale.languageCode]; + String get EmailSentError => localizedValues['EmailSentError'][locale.languageCode]; + String get checkVaccineAvailability => localizedValues['CHECK_VACCINE_AVAILABILITY'][locale.languageCode]; + String get myVaccinesAvailability => localizedValues['MyVaccinesAvailability'][locale.languageCode]; + String get paymentService => localizedValues['PaymentService'][locale.languageCode]; + String get paymentOnline => localizedValues['PaymentOnline'][locale.languageCode]; + String get onlineCheckIn => localizedValues['OnlineCheckIn'][locale.languageCode]; String get myBalances => localizedValues['MyBalances'][locale.languageCode]; - String get balanceAmount => - localizedValues['BalanceAmount'][locale.languageCode]; - String get totalBalance => - localizedValues['TotalBalance'][locale.languageCode]; - String get createAdvancedPayment => - localizedValues['CreateAdvancedPayment'][locale.languageCode]; - String get advancePayment => - localizedValues['AdvancePayment'][locale.languageCode]; - String get advancePaymentLabel => - localizedValues['AdvancePaymentLabel'][locale.languageCode]; + String get balanceAmount => localizedValues['BalanceAmount'][locale.languageCode]; + String get totalBalance => localizedValues['TotalBalance'][locale.languageCode]; + String get createAdvancedPayment => localizedValues['CreateAdvancedPayment'][locale.languageCode]; + String get advancePayment => localizedValues['AdvancePayment'][locale.languageCode]; + String get advancePaymentLabel => localizedValues['AdvancePaymentLabel'][locale.languageCode]; String get fileNumber => localizedValues['FileNumber'][locale.languageCode]; String get amount => localizedValues['Amount'][locale.languageCode]; - String get depositorEmail => - localizedValues['DepositorEmail'][locale.languageCode]; + String get depositorEmail => localizedValues['DepositorEmail'][locale.languageCode]; String get notes => localizedValues['Notes'][locale.languageCode]; - String get selectPatientName => - localizedValues['SelectPatientName'][locale.languageCode]; - String get selectFamilyPatientName => - localizedValues['SelectFamilyPatientName'][locale.languageCode]; - String get selectHospital => - localizedValues['SelectHospital'][locale.languageCode]; + String get selectPatientName => localizedValues['SelectPatientName'][locale.languageCode]; + String get selectFamilyPatientName => localizedValues['SelectFamilyPatientName'][locale.languageCode]; + String get selectHospital => localizedValues['SelectHospital'][locale.languageCode]; + String get selectCity => localizedValues['selectCity'][locale.languageCode]; String get myAccount => localizedValues['MyAccount'][locale.languageCode]; - String get otherAccount => - localizedValues['OtherAccount'][locale.languageCode]; - String get selectBeneficiary => - localizedValues['SelectBeneficiary'][locale.languageCode]; - String get confirmThePayment => - localizedValues['ConfirmThePayment'][locale.languageCode]; - String get depositorName => - localizedValues['DepositorName'][locale.languageCode]; - String get mobileNumber => - localizedValues['MobileNumber'][locale.languageCode]; + String get otherAccount => localizedValues['OtherAccount'][locale.languageCode]; + String get selectBeneficiary => localizedValues['SelectBeneficiary'][locale.languageCode]; + String get confirmThePayment => localizedValues['ConfirmThePayment'][locale.languageCode]; + String get depositorName => localizedValues['DepositorName'][locale.languageCode]; + String get mobileNumber => localizedValues['MobileNumber'][locale.languageCode]; String get ok => localizedValues['Ok'][locale.languageCode]; - String get theVerificationCodeExpiresIn => - localizedValues['TheVerificationCodeExpiresIn'][locale.languageCode]; - String get pleaseEnterTheVerificationCode => - localizedValues['PleaseEnterTheVerificationCode'][locale.languageCode]; - String get eyeMeasurements => - localizedValues['EyeMeasurements'][locale.languageCode]; - String get measurements => - localizedValues['Measurements'][locale.languageCode]; + String get waterConsumedInWeek => localizedValues['WaterConsumedInWeek'][locale.languageCode]; + String get waterConsumedInMonth => localizedValues['WaterConsumedInMonth'][locale.languageCode]; + String get theVerificationCodeExpiresIn => localizedValues['TheVerificationCodeExpiresIn'][locale.languageCode]; + String get pleaseEnterTheVerificationCode => localizedValues['PleaseEnterTheVerificationCode'][locale.languageCode]; + String get eyeMeasurements => localizedValues['EyeMeasurements'][locale.languageCode]; + String get measurements => localizedValues['Measurements'][locale.languageCode]; String get classes => localizedValues['Classes'][locale.languageCode]; String get contactLens => localizedValues['ContactLens'][locale.languageCode]; String get rightEye => localizedValues['RightEye'][locale.languageCode]; @@ -646,56 +514,41 @@ class TranslationBase { String get power => localizedValues['Power'][locale.languageCode]; String get diameter => localizedValues['Diameter'][locale.languageCode]; String get remarks => localizedValues['Remarks'][locale.languageCode]; - String get activeMedications => - localizedValues['ActiveMedications'][locale.languageCode]; + String get activeMedications => localizedValues['ActiveMedications'][locale.languageCode]; String get expDate => localizedValues['ExpDate'][locale.languageCode]; String get route => localizedValues['Route'][locale.languageCode]; String get frequency => localizedValues['Frequency'][locale.languageCode]; - String get dailyQuantity => - localizedValues['DailyQuantity'][locale.languageCode]; + String get dailyQuantity => localizedValues['DailyQuantity'][locale.languageCode]; String get addReminder => localizedValues['AddReminder'][locale.languageCode]; String get reminderDes => localizedValues['reminderDes'][locale.languageCode]; String get startDay => localizedValues['StartDay'][locale.languageCode]; String get endDay => localizedValues['EndDay'][locale.languageCode]; String get days => localizedValues['Days'][locale.languageCode]; - String get scheduleTime => - localizedValues['ScheduleTime'][locale.languageCode]; + String get scheduleTime => localizedValues['ScheduleTime'][locale.languageCode]; String get askDoctor => localizedValues['AskDoctor'][locale.languageCode]; - String get doctorResponses => - localizedValues['DoctorResponses'][locale.languageCode]; + String get doctorResponses => localizedValues['DoctorResponses'][locale.languageCode]; String get newDes => localizedValues['New'][locale.languageCode]; String get all => localizedValues['All'][locale.languageCode]; - String get questionHere => - localizedValues['QuestionHere'][locale.languageCode]; - String get viewDoctorResponses => - localizedValues['ViewDoctorResponses'][locale.languageCode]; - String get serviceInformationButton => - localizedValues['ServiceInformationButton'][locale.languageCode]; - String get serviceInformationTitle => - localizedValues['ServiceInformationTitle'][locale.languageCode]; + String get questionHere => localizedValues['QuestionHere'][locale.languageCode]; + String get viewDoctorResponses => localizedValues['ViewDoctorResponses'][locale.languageCode]; + String get serviceInformationButton => localizedValues['ServiceInformationButton'][locale.languageCode]; + String get serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode]; String get infoLab => localizedValues['info-lab'][locale.languageCode]; - String get infoRadiology => - localizedValues['info-radiology'][locale.languageCode]; + String get infoRadiology => localizedValues['info-radiology'][locale.languageCode]; String get orders => localizedValues['orders'][locale.languageCode]; String get lakum => localizedValues['lakum'][locale.languageCode]; String get wishlist => localizedValues['wishlist'][locale.languageCode]; String get reviews => localizedValues['reviews'][locale.languageCode]; - String get myPrescriptions => - localizedValues['myPrescriptions'][locale.languageCode]; - String get medicationRefill => - localizedValues['medicationRefill'][locale.languageCode]; - String get pillReminder => - localizedValues['pillReminder'][locale.languageCode]; - String get shippingAddresses => - localizedValues['shippingAddresses'][locale.languageCode]; + String get myPrescriptions => localizedValues['myPrescriptions'][locale.languageCode]; + String get medicationRefill => localizedValues['medicationRefill'][locale.languageCode]; + String get pillReminder => localizedValues['pillReminder'][locale.languageCode]; + String get shippingAddresses => localizedValues['shippingAddresses'][locale.languageCode]; String get reachUs => localizedValues['reachUs'][locale.languageCode]; - String get ourLocations => - localizedValues['ourLocations'][locale.languageCode]; + String get ourLocations => localizedValues['ourLocations'][locale.languageCode]; String get edit => localizedValues['edit'][locale.languageCode]; String get delete => localizedValues['delete'][locale.languageCode]; String get addAddress => localizedValues['addAddress'][locale.languageCode]; - String get addNewAddress => - localizedValues['addNewAddress'][locale.languageCode]; + String get addNewAddress => localizedValues['addNewAddress'][locale.languageCode]; String get order => localizedValues['order'][locale.languageCode]; String get delivered => localizedValues['delivered'][locale.languageCode]; String get processing => localizedValues['processing'][locale.languageCode]; @@ -703,16 +556,11 @@ class TranslationBase { String get cancelled => localizedValues['cancelled'][locale.languageCode]; String get writeReview => localizedValues['writeReview'][locale.languageCode]; String get shareReview => localizedValues['shareReview'][locale.languageCode]; - String get backMyAccount => - localizedValues['backMyAccount'][locale.languageCode]; - String get reviewSuccessful => - localizedValues['reviewSuccessful'][locale.languageCode]; - String get reviewShared => - localizedValues['reviewShared'][locale.languageCode]; - String get reviewComment => - localizedValues['reviewComment'][locale.languageCode]; - String get shippedMethod => - localizedValues['shippedMethod'][locale.languageCode]; + String get backMyAccount => localizedValues['backMyAccount'][locale.languageCode]; + String get reviewSuccessful => localizedValues['reviewSuccessful'][locale.languageCode]; + String get reviewShared => localizedValues['reviewShared'][locale.languageCode]; + String get reviewComment => localizedValues['reviewComment'][locale.languageCode]; + String get shippedMethod => localizedValues['shippedMethod'][locale.languageCode]; String get orderDetail => localizedValues['orderDetail'][locale.languageCode]; String get subtotal => localizedValues['subtotal'][locale.languageCode]; String get shipping => localizedValues['shipping'][locale.languageCode]; @@ -728,26 +576,16 @@ class TranslationBase { String get sar => localizedValues['sar'][locale.languageCode]; String get payOnline => localizedValues['payOnline'][locale.languageCode]; String get cancelOrder => localizedValues['cancelOrder'][locale.languageCode]; - String get confirmAddress => - localizedValues['confirmAddress'][locale.languageCode]; - String get confirmLocation => - localizedValues['confirmLocation'][locale.languageCode]; - String get confirmDeleteMsg => - localizedValues['confirmDeleteMsg'][locale.languageCode]; - String get confirmDelete => - localizedValues['confirmDelete'][locale.languageCode]; - String get confirmCancellation => - localizedValues['confirmCancellation'][locale.languageCode]; - String get serviceInformation => - localizedValues['ServiceInformation'][locale.languageCode]; - String get homeHealthCare => - localizedValues['HomeHealthCare'][locale.languageCode]; - String get HHCNotAuthMsg => - localizedValues['HHCNotAuthMsg'][locale.languageCode]; - String get homeHealthCareText => - localizedValues['HomeHealthCareText'][locale.languageCode]; - String get loginRegister => - localizedValues['LoginRegister'][locale.languageCode]; + String get confirmAddress => localizedValues['confirmAddress'][locale.languageCode]; + String get confirmLocation => localizedValues['confirmLocation'][locale.languageCode]; + String get confirmDeleteMsg => localizedValues['confirmDeleteMsg'][locale.languageCode]; + String get confirmDelete => localizedValues['confirmDelete'][locale.languageCode]; + String get confirmCancellation => localizedValues['confirmCancellation'][locale.languageCode]; + String get serviceInformation => localizedValues['ServiceInformation'][locale.languageCode]; + String get homeHealthCare => localizedValues['HomeHealthCare'][locale.languageCode]; + String get HHCNotAuthMsg => localizedValues['HHCNotAuthMsg'][locale.languageCode]; + String get homeHealthCareText => localizedValues['HomeHealthCareText'][locale.languageCode]; + String get loginRegister => localizedValues['LoginRegister'][locale.languageCode]; String get orderLog => localizedValues['OrderLog'][locale.languageCode]; // String get infoLab => localizedValues['info-lab'][locale.languageCode]; // String get infoRadiology => @@ -770,65 +608,44 @@ class TranslationBase { // pharmacy module - String get offersAndPromotions => - localizedValues['offersAndPromotions'][locale.languageCode]; + String get offersAndPromotions => localizedValues['offersAndPromotions'][locale.languageCode]; - String get searchAndScanMedication => - localizedValues['searchAndScanMedication'][locale.languageCode]; - String get shopByBrands => - localizedValues['shopByBrands'][locale.languageCode]; - String get recentlyViewed => - localizedValues['recentlyViewed'][locale.languageCode]; + String get searchAndScanMedication => localizedValues['searchAndScanMedication'][locale.languageCode]; + String get shopByBrands => localizedValues['shopByBrands'][locale.languageCode]; + String get recentlyViewed => localizedValues['recentlyViewed'][locale.languageCode]; String get bestSellers => localizedValues['bestSellers'][locale.languageCode]; - String get deleteAllItems => - localizedValues['deleteAllItems'][locale.languageCode]; - String get selectAddress => - localizedValues['selectAddress'][locale.languageCode]; - String get shippingAddress => - localizedValues['shippingAddress'][locale.languageCode]; - String get changeAddress => - localizedValues['changeAddress'][locale.languageCode]; - String get selectPaymentOption => - localizedValues['selectPaymentOption'][locale.languageCode]; - String get changeMethod => - localizedValues['changeMethod'][locale.languageCode]; + String get recommended => localizedValues['recommended'][locale.languageCode]; + String get deleteAllItems => localizedValues['deleteAllItems'][locale.languageCode]; + String get selectAddress => localizedValues['selectAddress'][locale.languageCode]; + String get shippingAddress => localizedValues['shippingAddress'][locale.languageCode]; + String get changeAddress => localizedValues['changeAddress'][locale.languageCode]; + String get selectPaymentOption => localizedValues['selectPaymentOption'][locale.languageCode]; + String get changeMethod => localizedValues['changeMethod'][locale.languageCode]; String get reviewOrder => localizedValues['reviewOrder'][locale.languageCode]; - String get orderSummary => - localizedValues['orderSummary'][locale.languageCode]; + String get orderSummary => localizedValues['orderSummary'][locale.languageCode]; String get active => localizedValues['active'][locale.languageCode]; String get inactive => localizedValues['inactive'][locale.languageCode]; String get balance => localizedValues['balance'][locale.languageCode]; String get gained => localizedValues['gained'][locale.languageCode]; String get consumed => localizedValues['consumed'][locale.languageCode]; String get transferred => localizedValues['transferred'][locale.languageCode]; - String get checkBeneficiary => - localizedValues['checkBeneficiary'][locale.languageCode]; - String get beneficiaryName => - localizedValues['beneficiaryName'][locale.languageCode]; - String get accountActivation => - localizedValues['accountActivation'][locale.languageCode]; + String get checkBeneficiary => localizedValues['checkBeneficiary'][locale.languageCode]; + String get beneficiaryName => localizedValues['beneficiaryName'][locale.languageCode]; + String get accountActivation => localizedValues['accountActivation'][locale.languageCode]; String get acceptLbl => localizedValues['acceptLbl'][locale.languageCode]; - String get termsService => - localizedValues['TermsService'][locale.languageCode]; + String get termsService => localizedValues['TermsService'][locale.languageCode]; String get beforeUsing => localizedValues['Beforeusing'][locale.languageCode]; String get accept => localizedValues['accept'][locale.languageCode]; - String get dataSafeInfo => - localizedValues['data-safe-info'][locale.languageCode]; + String get dataSafeInfo => localizedValues['data-safe-info'][locale.languageCode]; String get dataSafe => localizedValues['data-safe'][locale.languageCode]; - String get informational => - localizedValues['informational'][locale.languageCode]; - String get checkDiagnosis => - localizedValues['check-diagnosis'][locale.languageCode]; + String get informational => localizedValues['informational'][locale.languageCode]; + String get checkDiagnosis => localizedValues['check-diagnosis'][locale.languageCode]; String get remeberthat => localizedValues['remeberthat'][locale.languageCode]; - String get notUseInEmbergency => - localizedValues['not-use-in-emerbency'][locale.languageCode]; - String get notUseInEmbergencyDetails => - localizedValues['not-use-in-emerbency-details'][locale.languageCode]; - String get notUseInEmbergencyCall => - localizedValues['not-use-in-emerbency-details-call'][locale.languageCode]; - String get selectGender => - localizedValues['select-gender'][locale.languageCode]; + String get notUseInEmbergency => localizedValues['not-use-in-emerbency'][locale.languageCode]; + String get notUseInEmbergencyDetails => localizedValues['not-use-in-emerbency-details'][locale.languageCode]; + String get notUseInEmbergencyCall => localizedValues['not-use-in-emerbency-details-call'][locale.languageCode]; + String get selectGender => localizedValues['select-gender'][locale.languageCode]; String get iAma => localizedValues['i-am-a'][locale.languageCode]; String get selectAge => localizedValues['select-age'][locale.languageCode]; String get iAm => localizedValues['i-am'][locale.languageCode]; @@ -836,96 +653,66 @@ class TranslationBase { String get categorise => localizedValues['categorise'][locale.languageCode]; String get cart => localizedValues['cart'][locale.languageCode]; String get wishList => localizedValues['wishList'][locale.languageCode]; - String get searchProductHere => - localizedValues['searchProductHere'][locale.languageCode]; + String get searchProductHere => localizedValues['searchProductHere'][locale.languageCode]; String get email => localizedValues['email'][locale.languageCode]; String get book => localizedValues['Book'][locale.languageCode]; - String get appointmentLabel => - localizedValues['AppointmentLabel'][locale.languageCode]; + String get appointmentLabel => localizedValues['AppointmentLabel'][locale.languageCode]; String get bloodType => localizedValues['BloodType'][locale.languageCode]; - String get loginToUseService => - localizedValues['loginToUseService'][locale.languageCode]; - String get maritalStatus => - localizedValues['marital-status'][locale.languageCode]; + String get loginToUseService => localizedValues['loginToUseService'][locale.languageCode]; + String get maritalStatus => localizedValues['marital-status'][locale.languageCode]; String get general => localizedValues['general'][locale.languageCode]; String get profile => localizedValues['profile'][locale.languageCode]; - String get notifications => - localizedValues['notifications'][locale.languageCode]; - String get notificationDetails => - localizedValues['notificationDetails'][locale.languageCode]; - List get infoMyDoctorPoints => - localizedValues['info-my-doctor-points'][locale.languageCode]; - String get infoMyDoctor => - localizedValues['info-my-doctor'][locale.languageCode]; - String get infoPrescriptions => - localizedValues['info-prescriptions'][locale.languageCode]; - List get infoPrescriptionsPoints => - localizedValues['info-my-prescription-points'][locale.languageCode]; - - String get infoInsuranceCards => - localizedValues['info-insurance-cards'][locale.languageCode]; - List get infoInsuranceCardsPoints => - localizedValues['info-insurance-cards-points'][locale.languageCode]; - - String get infoAllergies => - localizedValues['info-allergies'][locale.languageCode]; + String get notifications => localizedValues['notifications'][locale.languageCode]; + String get notificationDetails => localizedValues['notificationDetails'][locale.languageCode]; + List get infoMyDoctorPoints => localizedValues['info-my-doctor-points'][locale.languageCode]; + String get infoMyDoctor => localizedValues['info-my-doctor'][locale.languageCode]; + String get infoPrescriptions => localizedValues['info-prescriptions'][locale.languageCode]; + List get infoPrescriptionsPoints => localizedValues['info-my-prescription-points'][locale.languageCode]; + + String get infoInsuranceCards => localizedValues['info-insurance-cards'][locale.languageCode]; + List get infoInsuranceCardsPoints => localizedValues['info-insurance-cards-points'][locale.languageCode]; + + String get infoAllergies => localizedValues['info-allergies'][locale.languageCode]; String get sickLeaves => localizedValues['sick-leaves'][locale.languageCode]; - String get infoSickLeaves => - localizedValues['info-sick-leaves'][locale.languageCode]; - List get infoSickLeavePoints => - localizedValues['info-sick-leave-points'][locale.languageCode]; - - String get infoApprovals => - localizedValues['info-approvals'][locale.languageCode]; - List get infoApprovalPoints => - localizedValues['info-approval-points'][locale.languageCode]; - - String get monthReport => - localizedValues['month-report'][locale.languageCode]; - String get infoMonthReport => - localizedValues['info-month-report'][locale.languageCode]; - String get languageSetting => - localizedValues['language-setting'][locale.languageCode]; + String get infoSickLeaves => localizedValues['info-sick-leaves'][locale.languageCode]; + List get infoSickLeavePoints => localizedValues['info-sick-leave-points'][locale.languageCode]; + + String get infoApprovals => localizedValues['info-approvals'][locale.languageCode]; + List get infoApprovalPoints => localizedValues['info-approval-points'][locale.languageCode]; + + String get monthReport => localizedValues['month-report'][locale.languageCode]; + String get infoMonthReport => localizedValues['info-month-report'][locale.languageCode]; + String get languageSetting => localizedValues['language-setting'][locale.languageCode]; String get alert => localizedValues['alert'][locale.languageCode]; String get emailAlert => localizedValues['email-alert'][locale.languageCode]; String get smsAlert => localizedValues['sms-alert'][locale.languageCode]; - String get contactInfo => - localizedValues['contact-info'][locale.languageCode]; + String get contactInfo => localizedValues['contact-info'][locale.languageCode]; String get emergencyName => localizedValues['emrg-name'][locale.languageCode]; - String get emergencyContact => - localizedValues['emrg-no'][locale.languageCode]; + String get emergencyContact => localizedValues['emrg-no'][locale.languageCode]; String get modes => localizedValues['modes'][locale.languageCode]; String get vibration => localizedValues['vibration'][locale.languageCode]; String get blindMode => localizedValues['blind-modes'][locale.languageCode]; - String get invertTheme => - localizedValues['invert-theme'][locale.languageCode]; + String get invertTheme => localizedValues['invert-theme'][locale.languageCode]; String get offTheme => localizedValues['off-theme'][locale.languageCode]; String get dimTheme => localizedValues['dim-theme'][locale.languageCode]; String get bwTheme => localizedValues['bw-theme'][locale.languageCode]; String get permissions => localizedValues['permissions'][locale.languageCode]; - String get cameraPermission => - localizedValues['camera-permission'][locale.languageCode]; - String get locationPermission => - localizedValues['location-permission'][locale.languageCode]; - String get accessibility => - localizedValues['accessibility'][locale.languageCode]; - String get selectClinic => - localizedValues['selectClinic'][locale.languageCode]; + String get cameraPermission => localizedValues['camera-permission'][locale.languageCode]; + String get locationPermission => localizedValues['location-permission'][locale.languageCode]; + String get accessibility => localizedValues['accessibility'][locale.languageCode]; + String get selectClinic => localizedValues['selectClinic'][locale.languageCode]; String get orderStatus => localizedValues['orderStatus'][locale.languageCode]; String get findUs => localizedValues['FindUs'][locale.languageCode]; String get feedback => localizedValues['Feedback'][locale.languageCode]; String get liveChat => localizedValues['LiveChat'][locale.languageCode]; String get service => localizedValues['Service'][locale.languageCode]; - String get hMGServiceLabel => - localizedValues['HMGServiceLabel'][locale.languageCode]; - String get healthWeatherIndicators => - localizedValues['HealthWeatherIndicators'][locale.languageCode]; - String get healthTipsBasedOnCurrentWeather => - localizedValues['HealthTipsBasedOnCurrentWeather'][locale.languageCode]; + String get hMGServiceLabel => localizedValues['HMGServiceLabel'][locale.languageCode]; + String get healthWeatherIndicators => localizedValues['HealthWeatherIndicators'][locale.languageCode]; + String get healthTipsBasedOnCurrentWeather => localizedValues['HealthTipsBasedOnCurrentWeather'][locale.languageCode]; String get moreDetails => localizedValues['MoreDetails'][locale.languageCode]; String get sendCopy => localizedValues['SendCopy'][locale.languageCode]; String get resendOrder => localizedValues['ResendOrder'][locale.languageCode]; @@ -936,11 +723,12 @@ class TranslationBase { String get period => localizedValues['Period'][locale.languageCode]; String get cm => localizedValues['cm'][locale.languageCode]; String get kg => localizedValues['kg'][locale.languageCode]; + String get lb => localizedValues['lb'][locale.languageCode]; + String get birth_date => localizedValues['birth_date'][locale.languageCode]; String get mass => localizedValues['mass'][locale.languageCode]; String get tempC => localizedValues['temp-c'][locale.languageCode]; String get bpm => localizedValues['bpm'][locale.languageCode]; - String get respirationSigns => - localizedValues['respiration-signs'][locale.languageCode]; + String get respirationSigns => localizedValues['respiration-signs'][locale.languageCode]; String get sysDias => localizedValues['sys-dias'][locale.languageCode]; String get body => localizedValues['body'][locale.languageCode]; String get feedbackTitle => localizedValues['feedback'][locale.languageCode]; @@ -949,29 +737,20 @@ class TranslationBase { String get likeToHear => localizedValues['like-to-hear'][locale.languageCode]; String get subject => localizedValues['subject'][locale.languageCode]; String get message => localizedValues['message'][locale.languageCode]; - String get emptySubject => - localizedValues['empty-subject'][locale.languageCode]; - String get emptyMessage => - localizedValues['empty-message'][locale.languageCode]; - String get selectAttachment => - localizedValues['select-attachment'][locale.languageCode]; - String get complainAppo => - localizedValues['complain-appo'][locale.languageCode]; - String get complainWithoutAppo => - localizedValues['complain-without-appo'][locale.languageCode]; + String get emptySubject => localizedValues['empty-subject'][locale.languageCode]; + String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; + String get selectAttachment => localizedValues['select-attachment'][locale.languageCode]; + String get complainAppo => localizedValues['complain-appo'][locale.languageCode]; + String get complainWithoutAppo => localizedValues['complain-without-appo'][locale.languageCode]; String get question => localizedValues['question'][locale.languageCode]; - String get messageType => - localizedValues['message-type'][locale.languageCode]; + String get messageType => localizedValues['message-type'][locale.languageCode]; String get compliment => localizedValues['compliment'][locale.languageCode]; String get suggestion => localizedValues['suggestion'][locale.languageCode]; - String get yourFeedback => - localizedValues['your-feedback'][locale.languageCode]; + String get yourFeedback => localizedValues['your-feedback'][locale.languageCode]; String get selectPart => localizedValues['select-part'][locale.languageCode]; String get number => localizedValues['number'][locale.languageCode]; - String get notClassified => - localizedValues['not-classified'][locale.languageCode]; - String get searchItemError => - localizedValues['searchItemError'][locale.languageCode]; + String get notClassified => localizedValues['not-classified'][locale.languageCode]; + String get searchItemError => localizedValues['searchItemError'][locale.languageCode]; String get youCanFind => localizedValues['YouCanFind'][locale.languageCode]; String get itemInSearch => localizedValues['ItemInSearch'][locale.languageCode]; String get wantToConnectWithHmgNetwork => localizedValues['wantConnectHmgNetwork'][locale.languageCode]; @@ -979,12 +758,9 @@ class TranslationBase { String get enablingWifi => localizedValues['enablingWifi'][locale.languageCode]; String get offerAndPackages => localizedValues['offerAndPackages'][locale.languageCode]; String get invoiceNo => localizedValues['InvoiceNo'][locale.languageCode]; - String get specialResult => - localizedValues['SpecialResult'][locale.languageCode]; - String get generalResult => - localizedValues['GeneralResult'][locale.languageCode]; - String get showMoreBtn => - localizedValues['show-more-btn'][locale.languageCode]; + String get specialResult => localizedValues['SpecialResult'][locale.languageCode]; + String get generalResult => localizedValues['GeneralResult'][locale.languageCode]; + String get showMoreBtn => localizedValues['show-more-btn'][locale.languageCode]; String get value => localizedValues['value'][locale.languageCode]; String get range => localizedValues['range'][locale.languageCode]; String get outpatient => localizedValues['out-patient'][locale.languageCode]; @@ -995,101 +771,73 @@ class TranslationBase { String get sendCopyRad => localizedValues['send-copy'][locale.languageCode]; String get appoSurvey => localizedValues['appoSurvey'][locale.languageCode]; String get labResults => localizedValues['labResults'][locale.languageCode]; - String get doctorRating => - localizedValues['doctorRating'][locale.languageCode]; + String get doctorRating => localizedValues['doctorRating'][locale.languageCode]; String get good => localizedValues['good'][locale.languageCode]; String get v_good => localizedValues['v-good'][locale.languageCode]; String get excellent => localizedValues['excellent'][locale.languageCode]; - String get below_average => - localizedValues['below-average'][locale.languageCode]; + String get below_average => localizedValues['below-average'][locale.languageCode]; String get infoSigns => localizedValues['info-signs'][locale.languageCode]; - String get infoAdvancePayment => - localizedValues['info-advance-payment'][locale.languageCode]; - String get infoMyBalance => - localizedValues['info-my-balance'][locale.languageCode]; + String get infoAdvancePayment => localizedValues['info-advance-payment'][locale.languageCode]; + String get infoMyBalance => localizedValues['info-my-balance'][locale.languageCode]; String get erContant => localizedValues['er-contant'][locale.languageCode]; String get er => localizedValues['er'][locale.languageCode]; - String get transportationService => - localizedValues['transportation-Service'][locale.languageCode]; - String get infoAmbulance => - localizedValues['info-ambulance'][locale.languageCode]; - String get transportHeading => - localizedValues['RRT-transport-heading'][locale.languageCode]; - String get directionHeading => - localizedValues['RRT-direction-heading'][locale.languageCode]; + String get transportationService => localizedValues['transportation-Service'][locale.languageCode]; + String get infoAmbulance => localizedValues['info-ambulance'][locale.languageCode]; + String get transportHeading => localizedValues['RRT-transport-heading'][locale.languageCode]; + String get directionHeading => localizedValues['RRT-direction-heading'][locale.languageCode]; String get toHospital => localizedValues['to-hospital'][locale.languageCode]; - String get fromHospital => - localizedValues['from-hospital'][locale.languageCode]; + String get fromHospital => localizedValues['from-hospital'][locale.languageCode]; String get oneDirec => localizedValues['one-direc'][locale.languageCode]; String get twoDirec => localizedValues['two-direc'][locale.languageCode]; - String get pickupLocation => - localizedValues['pickup-location'][locale.languageCode]; + String get pickupLocation => localizedValues['pickup-location'][locale.languageCode]; String get pickupSpot => localizedValues['pickup-spot'][locale.languageCode]; String get insideHome => localizedValues['inside-home'][locale.languageCode]; String get haveAppo => localizedValues['have-appo'][locale.languageCode]; - String get dropoffLocation => - localizedValues['dropoff-location'][locale.languageCode]; + String get dropoffLocation => localizedValues['dropoff-location'][locale.languageCode]; String get selectAll => localizedValues['select-all'][locale.languageCode]; String get selectMap => localizedValues['select-map'][locale.languageCode]; - String get noAppointment => - localizedValues['no-appointment'][locale.languageCode]; - String get patientShareB => - localizedValues['patient-share'][locale.languageCode]; - String get patientShareTax => - localizedValues['patient-share-tax'][locale.languageCode]; - String get patientShareTotal => - localizedValues['patient-share-total'][locale.languageCode]; - String get selectAmbulate => - localizedValues['select-ambulate'][locale.languageCode]; + String get noAppointment => localizedValues['no-appointment'][locale.languageCode]; + String get patientShareB => localizedValues['patient-share'][locale.languageCode]; + String get patientShareTax => localizedValues['patient-share-tax'][locale.languageCode]; + String get patientShareTotal => localizedValues['patient-share-total'][locale.languageCode]; + String get selectAmbulate => localizedValues['select-ambulate'][locale.languageCode]; String get wheelchair => localizedValues['wheelchair'][locale.languageCode]; - String get walker => localizedValues['walker"'][locale.languageCode]; + String get walker => localizedValues['walker'][locale.languageCode]; String get stretcher => localizedValues['stretcher'][locale.languageCode]; String get none => localizedValues['none'][locale.languageCode]; String get RRTSummary => localizedValues['RRT-Summary'][locale.languageCode]; String get billAmount => localizedValues['bill-amount'][locale.languageCode]; - String get transportMethod => - localizedValues['transport-method'][locale.languageCode]; + String get transportMethod => localizedValues['transport-method'][locale.languageCode]; String get directions => localizedValues['directions'][locale.languageCode]; - String get infoMyAppointments => - localizedValues['info-my-appointments'][locale.languageCode]; + String get infoMyAppointments => localizedValues['info-my-appointments'][locale.languageCode]; String get infoTodo => localizedValues['info-todo'][locale.languageCode]; String get familyInfo => localizedValues['family-info'][locale.languageCode]; - String get profileUpdate => - localizedValues['update-succ'][locale.languageCode]; - String get dentalComplaints => - localizedValues['dental-complains'][locale.languageCode]; - String get emptyResult => - localizedValues['empty-result'][locale.languageCode]; - - String get noBookedAppo => - localizedValues['no-booked-appointment'][locale.languageCode]; - String get noConfirmedAppo => - localizedValues['no-confirmed-appointment'][locale.languageCode]; - String get noArrivedAppo => - localizedValues['no-arrived-appointment'][locale.languageCode]; - String get upcomingEmpty => - localizedValues['upcoming-empty'][locale.languageCode]; - String get upcomingTimeLeft => - localizedValues['upcoming-timeLeft'][locale.languageCode]; - - String get covidTestAllServices => - localizedValues['covid-test-all-services'][locale.languageCode]; + String get profileUpdate => localizedValues['update-succ'][locale.languageCode]; + String get dentalComplaints => localizedValues['dental-complains'][locale.languageCode]; + String get emptyResult => localizedValues['empty-result'][locale.languageCode]; + + String get noBookedAppo => localizedValues['no-booked-appointment'][locale.languageCode]; + String get noConfirmedAppo => localizedValues['no-confirmed-appointment'][locale.languageCode]; + String get noArrivedAppo => localizedValues['no-arrived-appointment'][locale.languageCode]; + String get upcomingEmpty => localizedValues['upcoming-empty'][locale.languageCode]; + String get upcomingTimeLeft => localizedValues['upcoming-timeLeft'][locale.languageCode]; + + String get covidTestAllServices => localizedValues['covid-test-all-services'][locale.languageCode]; String get pharmacy => localizedValues['pharmacy'][locale.languageCode]; String get ereferral => localizedValues['ereferral'][locale.languageCode]; - String get childVaccine => - localizedValues['child-vaccine'][locale.languageCode]; + String get childVaccine => localizedValues['child-vaccine'][locale.languageCode]; String get calculators => localizedValues['calculators'][locale.languageCode]; String get converters => localizedValues['converters'][locale.languageCode]; String get h2o => localizedValues['h2o'][locale.languageCode]; + String get waterTracker => localizedValues['waterTracker'][locale.languageCode]; + String get ft => localizedValues['ft'][locale.languageCode]; String get vTour => localizedValues['v-tour'][locale.languageCode]; String get hmgNews => localizedValues['hmg-news'][locale.languageCode]; String get bloodD => localizedValues['blood-d'][locale.languageCode]; - String get symptomCheckerTitle => - localizedValues['symptomCheckerTitle'][locale.languageCode]; + String get symptomCheckerTitle => localizedValues['symptomCheckerTitle'][locale.languageCode]; String get latestNews => localizedValues['latest-news'][locale.languageCode]; - String get ourLocation => - localizedValues['our-location'][locale.languageCode]; + String get ourLocation => localizedValues['our-location'][locale.languageCode]; String get pharmacies => localizedValues['pharmacies'][locale.languageCode]; String get hospitals => localizedValues['hospitals'][locale.languageCode]; String get wallet => localizedValues['wallet'][locale.languageCode]; @@ -1097,24 +845,19 @@ class TranslationBase { String get requested => localizedValues['requested'][locale.languageCode]; String get ready => localizedValues['ready'][locale.languageCode]; String get completed => localizedValues['completed'][locale.languageCode]; - String get requestMedicalReport => - localizedValues['request-medical-report'][locale.languageCode]; + String get requestMedicalReport => localizedValues['request-medical-report'][locale.languageCode]; String get insurCards => localizedValues['insur-cards'][locale.languageCode]; String get labResult => localizedValues['labResult'][locale.languageCode]; String get details => localizedValues['details'][locale.languageCode]; String get age => localizedValues['age'][locale.languageCode]; - String get activeInsurence => - localizedValues['active-insurence'][locale.languageCode]; + String get activeInsurence => localizedValues['active-insurence'][locale.languageCode]; String get notActive => localizedValues['not-active'][locale.languageCode]; String get cardDetail => localizedValues['card-detail'][locale.languageCode]; String get dr => localizedValues['Dr'][locale.languageCode]; String get sendSuc => localizedValues['sendSuc'][locale.languageCode]; - String get instructions => - localizedValues['instructions'][locale.languageCode]; - String get instructionsPharmacies => - localizedValues['instructions-pharmacies'][locale.languageCode]; - String get selectHospitalDec => - localizedValues['select-hospital'][locale.languageCode]; + String get instructions => localizedValues['instructions'][locale.languageCode]; + String get instructionsPharmacies => localizedValues['instructions-pharmacies'][locale.languageCode]; + String get selectHospitalDec => localizedValues['select-hospital'][locale.languageCode]; String get start => localizedValues['start'][locale.languageCode]; String get infoChat => localizedValues['info-chat'][locale.languageCode]; @@ -1123,33 +866,22 @@ class TranslationBase { String get tapTitle => localizedValues['tap-title'][locale.languageCode]; String get later => localizedValues['later'][locale.languageCode]; - String get lastAppointment => - localizedValues['last-appointment'][locale.languageCode]; + String get lastAppointment => localizedValues['last-appointment'][locale.languageCode]; String get rateClinic => localizedValues['rate-clinic'][locale.languageCode]; String get fetchData => localizedValues['fetch-data'][locale.languageCode]; - String get sendConfEmail => - localizedValues['send-email'][locale.languageCode]; - String get updateEmail => - localizedValues['update-email'][locale.languageCode]; - String get noDataAvailable => - localizedValues['noDataAvailable'][locale.languageCode]; + String get sendConfEmail => localizedValues['send-email'][locale.languageCode]; + String get updateEmail => localizedValues['update-email'][locale.languageCode]; + String get noDataAvailable => localizedValues['noDataAvailable'][locale.languageCode]; String get theName => localizedValues['thename'][locale.languageCode]; - String get noSearchResult => - localizedValues['noSearchResult'][locale.languageCode]; - String get selectFileSouse => - localizedValues['selectFileSouse'][locale.languageCode]; + String get noSearchResult => localizedValues['noSearchResult'][locale.languageCode]; + String get selectFileSouse => localizedValues['selectFileSouse'][locale.languageCode]; String get rate => localizedValues['rate'][locale.languageCode]; - String get bookedSuccess => - localizedValues['booked-success'][locale.languageCode]; - String get appoReminder30 => - localizedValues['appo-reminder-select-option-30'][locale.languageCode]; - String get appoReminder60 => - localizedValues['appo-reminder-select-option-60'][locale.languageCode]; - String get appoReminder90 => - localizedValues['appo-reminder-select-option-90'][locale.languageCode]; - String get appoReminder120 => - localizedValues['appo-reminder-select-option-120'][locale.languageCode]; + String get bookedSuccess => localizedValues['booked-success'][locale.languageCode]; + String get appoReminder30 => localizedValues['appo-reminder-select-option-30'][locale.languageCode]; + String get appoReminder60 => localizedValues['appo-reminder-select-option-60'][locale.languageCode]; + String get appoReminder90 => localizedValues['appo-reminder-select-option-90'][locale.languageCode]; + String get appoReminder120 => localizedValues['appo-reminder-select-option-120'][locale.languageCode]; String get gallery => localizedValues['gallery'][locale.languageCode]; String get camera => localizedValues['camera'][locale.languageCode]; String get medReport => localizedValues['med-report'][locale.languageCode]; @@ -1172,33 +904,24 @@ class TranslationBase { String get infoInsurCards => localizedValues['info-insur-cards'][locale.languageCode]; String get scanNow => localizedValues['scan-now'][locale.languageCode]; String get pharmacyServiceTermsCondition => localizedValues['pharmacyServiceTermsCondition'][locale.languageCode]; + String get recordDeleted => localizedValues['recordDeleted'][locale.languageCode]; - String get referralStatus => - localizedValues['referralStatus'][locale.languageCode]; - String get referralDate => - localizedValues['referralDate'][locale.languageCode]; + String get referralStatus => localizedValues['referralStatus'][locale.languageCode]; + String get referralDate => localizedValues['referralDate'][locale.languageCode]; String get patientName => localizedValues['patientName'][locale.languageCode]; - String get referralNumber => - localizedValues['referralNumber'][locale.languageCode]; + String get referralNumber => localizedValues['referralNumber'][locale.languageCode]; String get requestID => localizedValues['requestID'][locale.languageCode]; String get OrderStatus => localizedValues['OrderStatus'][locale.languageCode]; String get pickupDate => localizedValues['pickupDate'][locale.languageCode]; String get serviceName => localizedValues['serviceName'][locale.languageCode]; - String get orderLocation => - localizedValues['orderLocation'][locale.languageCode]; - String get selectService => - localizedValues['selectService'][locale.languageCode]; - String get coveredService => - localizedValues['coveredService'][locale.languageCode]; - String get selectedService => - localizedValues['selectedService'][locale.languageCode]; - String get cancelOrderMsg => - localizedValues['cancelOrderMsg'][locale.languageCode]; - String get processDoneSuccessfully => - localizedValues['processDoneSuccessfully'][locale.languageCode]; - String get selectHomeHealthCareServices => - localizedValues['selectHomeHealthCareServices'][locale.languageCode]; + String get orderLocation => localizedValues['orderLocation'][locale.languageCode]; + String get selectService => localizedValues['selectService'][locale.languageCode]; + String get coveredService => localizedValues['coveredService'][locale.languageCode]; + String get selectedService => localizedValues['selectedService'][locale.languageCode]; + String get cancelOrderMsg => localizedValues['cancelOrderMsg'][locale.languageCode]; + String get processDoneSuccessfully => localizedValues['processDoneSuccessfully'][locale.languageCode]; + String get selectHomeHealthCareServices => localizedValues['selectHomeHealthCareServices'][locale.languageCode]; String get topBrands => localizedValues['topBrands'][locale.languageCode]; String get notifyMe => localizedValues['notifyMe'][locale.languageCode]; @@ -1209,42 +932,122 @@ class TranslationBase { String get buyNow => localizedValues['buyNow'][locale.languageCode]; String get quantityShortcut => localizedValues['quantityShortcut'][locale.languageCode]; - String get updatedEmail => - localizedValues['updated-email'][locale.languageCode]; - String get viewListChildren => - localizedValues['view-list-children'][locale.languageCode]; + String get updatedEmail => localizedValues['updated-email'][locale.languageCode]; + String get viewListChildren => localizedValues['view-list-children'][locale.languageCode]; String get addChild => localizedValues['add-child'][locale.languageCode]; - String get childName => localizedValues['child-name'][locale.languageCode]; String get childDob => localizedValues['childDob'][locale.languageCode]; - String get deletedChildMes => - localizedValues['deleted-child-mes'][locale.languageCode]; + String get deletedChildMes => localizedValues['deleted-child-mes'][locale.languageCode]; String get visit => localizedValues['visit'][locale.languageCode]; - String get descriptionVaccination => - localizedValues['description-vaccination'][locale.languageCode]; + String get descriptionVaccination => localizedValues['description-vaccination'][locale.languageCode]; String get dueDate => localizedValues['due-date'][locale.languageCode]; String get validEmail => localizedValues['valid-email'][locale.languageCode]; - String get confirmSend => - localizedValues['confirm-send'][locale.languageCode]; - String get emailSuccess => - localizedValues['email-success'][locale.languageCode]; - String get deletedChild => - localizedValues['deleted-child'][locale.languageCode]; - String get addInstructions => - localizedValues['add-instructions'][locale.languageCode]; + String get confirmSend => localizedValues['confirm-send'][locale.languageCode]; + String get emailSuccess => localizedValues['email-success'][locale.languageCode]; + String get deletedChild => localizedValues['deleted-child'][locale.languageCode]; + String get addInstructions => localizedValues['add-instructions'][locale.languageCode]; String get addedChild => localizedValues['added-child'][locale.languageCode]; String get appUpdate => localizedValues['appUpdate'][locale.languageCode]; - String get ereferralSaveSuccess => - localizedValues['ereferralSaveSuccess'][locale.languageCode]; + String get ereferralSaveSuccess => localizedValues['ereferralSaveSuccess'][locale.languageCode]; String get year => localizedValues['Year'][locale.languageCode]; String get month => localizedValues['Month'][locale.languageCode]; String get point => localizedValues['point'][locale.languageCode]; String get riyal => localizedValues['riyal'][locale.languageCode]; - String get termOfService => - localizedValues['termOfService'][locale.languageCode]; - String get shoppingCart => - localizedValues['shoppingCart'][locale.languageCode]; - - + String get termOfService => localizedValues['termOfService'][locale.languageCode]; + String get shoppingCart => localizedValues['shoppingCart'][locale.languageCode]; + String get covidTest => localizedValues['covidTest'][locale.languageCode]; + String get driveThru => localizedValues['driveThru'][locale.languageCode]; + String get NearestErDesc => localizedValues['NearestErDesc'][locale.languageCode]; + String get NearestEr => localizedValues['NearestEr'][locale.languageCode]; + String get infoCMC => localizedValues['infoCMC'][locale.languageCode]; + String get instructionAgree => localizedValues['instructionAgree'][locale.languageCode]; + String get reqId => localizedValues['reqId'][locale.languageCode]; + String get ordersLog => localizedValues['RRT-orders-log'][locale.languageCode]; + String get bloodSugar => localizedValues['blood-sugar'][locale.languageCode]; + String get myTracker => localizedValues['my-tracker'][locale.languageCode]; + String get weekly => localizedValues['weekly'][locale.languageCode]; + String get monthlyT => localizedValues['monthly'][locale.languageCode]; + String get yearly => localizedValues['yearly'][locale.languageCode]; + String get measured => localizedValues['measured'][locale.languageCode]; + String get sugarAdd => localizedValues['sugar-add'][locale.languageCode]; + String get other => localizedValues['other'][locale.languageCode]; + String get measureUnit => localizedValues['measure-unit'][locale.languageCode]; + String get measureTime => localizedValues['measure-time'][locale.languageCode]; + String get update => localizedValues['update'][locale.languageCode]; + + String get covid19_driveThrueTest => localizedValues['covid19_driveThrueTest'][locale.languageCode]; + String get eReferral => localizedValues['E-Referral'][locale.languageCode]; + String get vaccination => localizedValues["vaccination"][locale.languageCode]; + String get msg_email_address_up_to_date => localizedValues["msg_email_address_up_to_date"][locale.languageCode]; + String get updateEmailMsg => localizedValues["update-email-msg"][locale.languageCode]; + String get childName => localizedValues["childName"][locale.languageCode]; + String get addNewChild => localizedValues["add-new-child"][locale.languageCode]; + String get sendChildEmailMsg => localizedValues["send-child-email-msg"][locale.languageCode]; + String get vaccinationAddChildMsg => localizedValues["vaccination-add-child-msg"][locale.languageCode]; + String get childAddedSuccessfully => localizedValues["child_added_successfully"][locale.languageCode]; + + String get sugar => localizedValues["sugar"][locale.languageCode]; + String get bloodCholesterol => localizedValues["bloodCholesterol"][locale.languageCode]; + String get cholesterol => localizedValues["cholesterol"][locale.languageCode]; + String get triglycerides => localizedValues["triglycerides"][locale.languageCode]; + String get fatInBlood => localizedValues["fatInBlood"][locale.languageCode]; + String get calculate => localizedValues["calculate"][locale.languageCode]; + String get enterReadingValue => localizedValues["enterReadingValue"][locale.languageCode]; + String get convertBloodSugarStatement => localizedValues["convertBloodSugarStatement"][locale.languageCode]; + String get convertFrom => localizedValues["convertFrom"][locale.languageCode]; + String get result => localizedValues["result"][locale.languageCode]; + String get bloodSugarConversion => localizedValues["bloodSugarConversion"][locale.languageCode]; + String get convertCholesterolStatement => localizedValues["convertCholesterolStatement"][locale.languageCode]; + String get triglyceridesConvertStatement => localizedValues["triglyceridesConvertStatement"][locale.languageCode]; + + String get bloodDEnterDesc => localizedValues["bloodD-enter-desc"][locale.languageCode]; + String get viewTermsConditions => localizedValues["viewTermsConditions"][locale.languageCode]; + String get walkinAppo => localizedValues["WalkinAppo"][locale.languageCode]; + String get videoAppo => localizedValues["videoAppo"][locale.languageCode]; + String get weightAdd => localizedValues["weight-add"][locale.languageCode]; + String get systolicAdd => localizedValues["systolic-add"][locale.languageCode]; + String get diastolicAdd => localizedValues["systolic-add"][locale.languageCode]; + String get cmcHeading => localizedValues["cmc-heading"][locale.languageCode]; + + String get today => localizedValues["today"][locale.languageCode]; + String get week => localizedValues["week"][locale.languageCode]; + String get h2oAmountOfWater => localizedValues["h2o-amount-of-water"][locale.languageCode]; + String get updateUser => localizedValues["update-user"][locale.languageCode]; + String get editname => localizedValues["editname"][locale.languageCode]; + String get activityLevel => localizedValues["activity-level"][locale.languageCode]; + String get success => localizedValues["success"][locale.languageCode]; + String get enterNameHere => localizedValues["enterNameHere"][locale.languageCode]; + String get lightActive => localizedValues["light-active"][locale.languageCode]; + String get modActive => localizedValues["mod-active"][locale.languageCode]; + String get reminderLabel => localizedValues["reminder-label"][locale.languageCode]; + String get reminderTimesLabel => localizedValues["reminder-times-label"][locale.languageCode]; + String get times => localizedValues["times"][locale.languageCode]; + String get WaterCalculate => localizedValues["WaterCalculate"][locale.languageCode]; + String get notifTitle => localizedValues["notif-title"][locale.languageCode]; + String get notifText => localizedValues["notif-text"][locale.languageCode]; + String get custom => localizedValues["custom"][locale.languageCode]; + String get undo => localizedValues["undo"][locale.languageCode]; + String get drinking => localizedValues["drinking"][locale.languageCode]; + String get remaining => localizedValues["remaining"][locale.languageCode]; + String get taken => localizedValues["taken"][locale.languageCode]; + String get ml => localizedValues["ml"][locale.languageCode]; + String get l => localizedValues["l"][locale.languageCode]; + String get customLabel => localizedValues["custom-label"][locale.languageCode]; + String get selectUnit => localizedValues["select-unit"][locale.languageCode]; + String get customLabelInLitres => localizedValues["custom-label-in-litres"][locale.languageCode]; + String get customLabelInMililitres => localizedValues["custom-label-in-mililitres"][locale.languageCode]; + String get amount_ => localizedValues["amount"][locale.languageCode]; + String get targetReach => localizedValues["target-reach"][locale.languageCode]; + String get weekHeader => localizedValues["week-header"][locale.languageCode]; + String get monthHeader => localizedValues["month-header"][locale.languageCode]; + String get notifPermissionTitle => localizedValues["notif-permission-title"][locale.languageCode]; + String get notifPermissionMsg => localizedValues["notif-permission-msg"][locale.languageCode]; + String get verification_message_code => localizedValues["verification_message_code"][locale.languageCode]; + String get sms_code => localizedValues["sms_code"][locale.languageCode]; + String get code_failure => localizedValues["code_failure"][locale.languageCode]; + String get resend => localizedValues["resend"][locale.languageCode]; + String get submitncontinue => localizedValues["submitncontinue"][locale.languageCode]; + String get areyousure => localizedValues["areyousure"][locale.languageCode]; + String get preferredunit => localizedValues["preferredunit"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 58ef9421..b2c52b2b 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -4,7 +4,9 @@ import 'dart:typed_data'; import 'package:badges/badges.dart'; import 'package:connectivity/connectivity.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/Blood/my_balance_page.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; @@ -26,15 +28,19 @@ import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import '../Constants.dart'; import 'app_shared_preferences.dart'; import 'app_toast.dart'; +import 'gif_loader_dialog_utils.dart'; AppSharedPreferences sharedPref = new AppSharedPreferences(); @@ -488,13 +494,25 @@ class Utils { ), )); } - if (projectViewModel.havePrivilege(32)) { + if (projectViewModel.havePrivilege(32) || true) { medical.add(InkWell( - //TODO -// onTap: () { -// Navigator.push( -// context, FadePage(page: DoctorHomePage())); -// }, + onTap: () { + userData().then((userData_){ + if (projectViewModel.isLogin && userData_ != null) { + String patientID = userData_.patientID.toString(); + GifLoaderDialogUtils.showMyDialog(context); + projectViewModel.platformBridge().connectHMGInternetWifi(patientID).then((value) => {GifLoaderDialogUtils.hideDialog(context)}); + } else { + AlertDialogBox( + context: context, + confirmMessage: "Please login with your account first to use this feature", + okText: "OK", + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + }).showAlertDialog(context); + } + }); + }, child: MedicalProfileItem( title: TranslationBase.of(context).internet, imagePath: 'insurance_card_icon.png', @@ -521,6 +539,11 @@ class Utils { } } +Future userData() async { + var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER)); + return userData; +} + // extension function that use in iterations(list.. etc) to iterate items and get index and item it self extension IndexedIterable on Iterable { Iterable mapIndexed(T Function(E e, int i) f) { diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index 66a83224..107e730c 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -95,7 +95,7 @@ class _BottomNavBarState extends State { icon: EvaIcons.calendar, activeIcon: EvaIcons.calendar, changeIndex: _changeIndex, - index: _index, + index: widget.index, currentIndex: 2, name: TranslationBase.of(context).bookAppo, ), diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 46b4abfb..8884039b 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -23,7 +23,7 @@ class SecondaryButton extends StatefulWidget { this.icon, this.iconOnly = false, this.color , - this.textColor, + this.textColor = Colors.white, this.onTap, this.loading: false, this.small = false, diff --git a/lib/widgets/charts/app_bar_chart.dart b/lib/widgets/charts/app_bar_chart.dart index 98ef3cfa..439d5ae9 100644 --- a/lib/widgets/charts/app_bar_chart.dart +++ b/lib/widgets/charts/app_bar_chart.dart @@ -13,30 +13,38 @@ class AppBarChart extends StatelessWidget { Widget build(BuildContext context) { return Container( height: 400, - margin: EdgeInsets.only(top: 60), + //margin: EdgeInsets.only(top: 60), child: charts.BarChart( seriesList, // animate: animate, + domainAxis: charts.OrdinalAxisSpec( + renderSpec: charts.GridlineRendererSpec( + labelAnchor: charts.TickLabelAnchor.after, + labelRotation: -30, + labelOffsetFromAxisPx: 30, + labelOffsetFromTickPx: 15, + labelJustification: charts.TickLabelJustification.inside, + ), + ), /// Customize the primary measure axis using a small tick renderer. /// Use String instead of num for ordinal domain axis /// (typically bar charts). primaryMeasureAxis: new charts.NumericAxisSpec( renderSpec: new charts.GridlineRendererSpec( - // Display the measure axis labels below the gridline. - // - // 'Before' & 'after' follow the axis value direction. - // Vertical axes draw 'before' below & 'after' above the tick. - // Horizontal axes draw 'before' left & 'after' right the tick. - labelAnchor: charts.TickLabelAnchor.before, + // Display the measure axis labels below the gridline. + // + // 'Before' & 'after' follow the axis value direction. + // Vertical axes draw 'before' below & 'after' above the tick. + // Horizontal axes draw 'before' left & 'after' right the tick. + labelAnchor: charts.TickLabelAnchor.before, - // Left justify the text in the axis. - // - // Note: outside means that the secondary measure axis would right - // justify. - labelJustification: - charts.TickLabelJustification.outside, - )), + // Left justify the text in the axis. + // + // Note: outside means that the secondary measure axis would right + // justify. + labelJustification: charts.TickLabelJustification.outside, + )), ), ); } diff --git a/lib/widgets/charts/app_time_series_chart.dart b/lib/widgets/charts/app_time_series_chart.dart index d34bc591..24d632bc 100644 --- a/lib/widgets/charts/app_time_series_chart.dart +++ b/lib/widgets/charts/app_time_series_chart.dart @@ -69,3 +69,9 @@ class TimeSeriesSales2 { TimeSeriesSales2(this.time, this.sales); } +class TimeSeriesSales3 { + final int time; + final double sales; + + TimeSeriesSales3(this.time, this.sales); +} diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index 7fd97f52..1751e0e5 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -26,7 +26,6 @@ class MedicalProfileItem extends StatelessWidget { showBorder: true, borderWidth: 0, margin: 4, - height: 120, child: Container( padding: EdgeInsets.all(10), child: Column( diff --git a/lib/widgets/data_display/medical/time_line_widget.dart b/lib/widgets/data_display/medical/time_line_widget.dart index 6e946aa5..810fc0d8 100644 --- a/lib/widgets/data_display/medical/time_line_widget.dart +++ b/lib/widgets/data_display/medical/time_line_widget.dart @@ -72,9 +72,8 @@ class TimeLineWidget extends StatelessWidget { width: 15, height: 15, decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - border: Border.all( - color: Theme.of(context).primaryColor, width: 2), + color: Colors.yellow[700], + border: Border.all(color: Colors.yellow[700], width: 2), shape: BoxShape.rectangle, borderRadius: BorderRadius.all( Radius.circular(25.0), @@ -111,7 +110,7 @@ class TimeLineWidget extends StatelessWidget { child: Column( children: [ Texts( - appoitmentAllHistoryResul.clinicName, + appoitmentAllHistoryResul.clinicName.trim(), color: Colors.white, fontSize: 12.5, fontWeight: FontWeight.normal, @@ -132,9 +131,8 @@ class TimeLineWidget extends StatelessWidget { width: 15, height: 15, decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - border: Border.all( - color: Theme.of(context).primaryColor, width: 2), + color: Colors.yellow[700], + border: Border.all(color: Colors.yellow[700], width: 2), shape: BoxShape.rectangle, borderRadius: BorderRadius.all( Radius.circular(25.0), @@ -164,7 +162,7 @@ class TimeLineWidget extends StatelessWidget { height: 3, ), Texts( - appoitmentAllHistoryResul.doctorNameObj, + appoitmentAllHistoryResul.doctorNameObj.trim(), color: Colors.white, fontSize: 10.5, fontWeight: FontWeight.normal, diff --git a/lib/widgets/dialogs/select_location_dialog.dart b/lib/widgets/dialogs/select_location_dialog.dart new file mode 100644 index 00000000..77916ddc --- /dev/null +++ b/lib/widgets/dialogs/select_location_dialog.dart @@ -0,0 +1,139 @@ +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class SelectLocationDialog extends StatefulWidget { + final List addresses; + final Function(AddressInfo) onValueSelected; + AddressInfo selectedAddress; + + SelectLocationDialog( + {Key key, this.addresses, this.onValueSelected, this.selectedAddress}); + + @override + _SelectLocationDialogState createState() => _SelectLocationDialogState(); +} + +class _SelectLocationDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedAddress = widget.selectedAddress ?? widget.addresses[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + title: Texts(TranslationBase.of(context).selectAddress), + children: [ + Column( + children: [ + Container( + height: 150, + child: SingleChildScrollView( + child: Column( + children: [ + Divider(), + ...List.generate( + widget.addresses.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedAddress = widget.addresses[index]; + }); + }, + child: ListTile( + title: Text(widget.addresses[index].address1), + leading: Radio( + value: widget.addresses[index], + groupValue: widget.selectedAddress, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedAddress = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedAddress); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 461bfa7c..d46d9eba 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -43,6 +44,7 @@ class _AppDrawerState extends State { ProjectViewModel projectProvider; var sharedPref = new AppSharedPreferences(); var familyFileProvider = FamilyFilesProvider(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); AuthenticatedUser user; AuthenticatedUser mainUser; AuthenticatedUserObject authenticatedUserObject = @@ -523,6 +525,7 @@ class _AppDrawerState extends State { this.user = null; toDoProvider.setState(0, false); Navigator.of(context).pushNamed(HOME); + // projectProvider.platformBridge().unRegisterHmgGeofences(); } login() async { @@ -592,6 +595,11 @@ class _AppDrawerState extends State { authenticatedUserObject.user; Provider.of(context, listen: false) .setUser(authenticatedUserObject.user); + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + if(pharmacyModuleViewModel.error.isNotEmpty) + await pharmacyModuleViewModel.createUser(); + }); + appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index c46b5616..ba7dfd8b 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -1,8 +1,6 @@ import 'dart:convert'; -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -13,14 +11,14 @@ class MyInAppBrowser extends InAppBrowser { // 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 PREAUTH_SERVICE_URL = // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT - static String PREAUTH_SERVICE_URL = - 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + static String PREAUTH_SERVICE_URL = + 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store static List successURLS = [ 'success', @@ -42,6 +40,9 @@ class MyInAppBrowser extends InAppBrowser { String deviceToken; + double lat = 0.0; + double long = 0.0; + static bool isPaymentDone = false; MyInAppBrowser({this.onExitCallback, this.appo, this.onLoadStartCallback}); @@ -98,6 +99,11 @@ class MyInAppBrowser extends InAppBrowser { 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); + } } openPaymentBrowser( @@ -111,12 +117,33 @@ class MyInAppBrowser extends InAppBrowser { String patientName, dynamic patientID, AuthenticatedUser authenticatedUser, - InAppBrowser browser) { - getDeviceToken(); + InAppBrowser browser, + bool isLiveCareAppo, + [var appoDate, + var appoNo, + var clinicID, + var doctorID]) { this.browser = browser; - this.browser.openUrl( - url: generateURL(amount, orderDesc, transactionID, projId, emailId, - paymentMethod, patientType, patientName, patientID, authenticatedUser)); + getPatientData(); + generateURL( + amount, + orderDesc, + transactionID, + projId, + emailId, + paymentMethod, + patientType, + patientName, + patientID, + authenticatedUser, + isLiveCareAppo, + appoDate, + appoNo, + clinicID, + doctorID) + .then((value) { + this.browser.openUrl(url: value); + }); } openBrowser(String url) { @@ -124,7 +151,7 @@ class MyInAppBrowser extends InAppBrowser { this.browser.openUrl(url: url); } - String generateURL( + Future generateURL( double amount, String orderDesc, String transactionID, @@ -135,18 +162,19 @@ class MyInAppBrowser extends InAppBrowser { String patientName, dynamic patientID, AuthenticatedUser authUser, - [var patientData, + bool isLiveCareAppo, + [var appoDate, + var appoNo, + var clinicID, + var doctorID, + var patientData, var servID, - var LiveServID]) { - getPatientData(); + var LiveServID]) async { + getDeviceToken(); String currentLanguageID = getLanguageID() == 'ar' ? 'AR' : 'EN'; - String form = getForm(); + String form = isLiveCareAppo ? getLiveCareForm() : getForm(); - // if (authUser != null) { - // form = form.replaceFirst("EMAIL_VALUE", authUser.emailAddress); - // } else { - form = form.replaceFirst("EMAIL_VALUE", emailId); - // } + form = form.replaceFirst("EMAIL_VALUE", emailId); form = form.replaceFirst('AMOUNT_VALUE', amount.toString()); form = form.replaceFirst('ORDER_DESCRIPTION_VALUE', orderDesc); @@ -157,12 +185,13 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('LANG_VALUE', currentLanguageID); form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); - form = form.replaceFirst('PATIENT_TYPE_ID', - patientData == null ? patientType.toString() : "1"); + form = form.replaceFirst( + 'PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1"); -// form = form.replaceFirst('DEVICE_TOKEN', this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false) + "," + this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false)); -// form = form.replaceFirst('LATITUDE_VALUE', this.cs.sharedService.getSharedData('userLat', false)); -// form = form.replaceFirst('LONGITUDE_VALUE', this.cs.sharedService.getSharedData('userLong', false)); + form = form.replaceFirst( + 'DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); + form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString()); + form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString()); if (servID == "4") form = form.replaceFirst( @@ -178,17 +207,16 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('LIVE_SERVICE_ID', "2"); } - // if (patientData == null) { - form = form.replaceFirst('CUSTNAME_VALUE', patientName); - form = form.replaceFirst('CUSTID_VALUE', patientID.toString()); - // } else { - // form = form.replaceFirst('CUSTNAME_VALUE', patientData.depositorName); - // form = form.replaceFirst('CUSTID_VALUE', patientData.fileNumber); - // } + form = form.replaceFirst('CUSTNAME_VALUE', patientName); + form = form.replaceFirst('CUSTID_VALUE', patientID.toString()); - form = form.replaceFirst('LATITUDE_VALUE', "24.708488"); - form = form.replaceFirst('LONGITUDE_VALUE', "46.665925"); - form = form.replaceFirst('DEVICE_TOKEN', DEVICE_TOKEN); + if (isLiveCareAppo) { + form = form.replaceFirst('IS_SCHEDULE_VALUE', "true"); + form = form.replaceFirst('APPOINTMENT_DATE_VALUE', appoDate); + form = form.replaceFirst('APPOINTMENT_NO_VALUE', appoNo.toString()); + form = form.replaceFirst('DOCTOR_ID_VALUE', doctorID.toString()); + form = form.replaceFirst('CLINIC_ID_VALUE', clinicID.toString()); + } var bytes = utf8.encode(form); var base64Str = base64.encode(bytes); @@ -228,6 +256,42 @@ class MyInAppBrowser extends InAppBrowser { '' + ''; } + + String getLiveCareForm() { + return ' ' + + '' + + '' + + '
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
' + + '' + + '' + + ''; + } } class MyChromeSafariBrowser extends ChromeSafariBrowser { diff --git a/lib/widgets/input/text_field.dart b/lib/widgets/input/text_field.dart index 6e740fc8..55ebbc3d 100644 --- a/lib/widgets/input/text_field.dart +++ b/lib/widgets/input/text_field.dart @@ -46,8 +46,7 @@ class TextFields extends StatefulWidget { this.suffixIcon, this.autoFocus, this.onChanged, - - // this.initialValue, + this.initialValue, this.minLines, this.maxLines, this.inputFormatters, @@ -78,8 +77,7 @@ class TextFields extends StatefulWidget { : super(key: key); final String hintText; - - // final String initialValue; + final String initialValue; final String type; final bool autoFocus; final IconData suffixIcon; @@ -230,7 +228,7 @@ class _TextFieldsState extends State { minLines: widget.minLines ?? 1, maxLines: widget.maxLines ?? 1, maxLengthEnforced: widget.maxLengthEnforced, - // initialValue: widget.initialValue, + initialValue: widget.initialValue, onChanged: widget.onChanged, focusNode: _focusNode, maxLength: widget.maxLength ?? null, diff --git a/lib/widgets/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index 5b963b1f..d088586b 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -3,6 +3,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../Constants.dart'; + // OWNER : Ibrahim albitar // DATE : 12-04-2020 // DESCRIPTION : Customization for Texts in app @@ -102,7 +104,7 @@ class _MobileNo extends State { flex: 1, child: Icon( Icons.phone, - color: Color(0xFF40ACC9), + color: secondaryColor, )), Expanded( flex: 1, diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index a1c28f7e..e5381ccb 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -40,85 +40,93 @@ class AppScaffold extends StatelessWidget { final bool isPharmacy; final String title; final String description; - final String image; final bool isShowDecPage; final List infoList; final Color backgroundColor; final double preferredSize; + final bool showHomeAppBarIcon; final List appBarIcons; final List imagesInfo; AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); AppScaffold( {@required this.body, - this.appBarTitle = '', - this.isLoading = false, - this.isShowAppBar = false, - this.hasAppBarParam, - this.bottomSheet, - this.baseViewModel, - this.floatingActionButton, - this.isPharmacy = false, - this.title, - this.description, - this.isShowDecPage = true, - this.isBottomBar, - this.backgroundColor, - this.preferredSize = 0.0, - this.appBarIcons, - this.image, - this.infoList, this.imagesInfo}); + this.appBarTitle = '', + this.isLoading = false, + this.isShowAppBar = false, + this.hasAppBarParam, + this.bottomSheet, + this.baseViewModel, + this.floatingActionButton, + this.isPharmacy = false, + this.title, + this.description, + this.isShowDecPage = true, + this.isBottomBar, + this.backgroundColor, + this.preferredSize = 0.0, + this.showHomeAppBarIcon = true, + this.appBarIcons, + this.infoList, + this.imagesInfo}); @override Widget build(BuildContext context) { AppGlobal.context = context; return Scaffold( backgroundColor: - backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, - appBar: isShowAppBar? AppBarWidget( - appBarTitle:appBarTitle, - appBarIcons:appBarIcons, - isPharmacy: isPharmacy, - isShowDecPage: isShowDecPage, - image: image, - ):null, + backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, + appBar: isShowAppBar + ? AppBarWidget( + appBarTitle: appBarTitle, + appBarIcons: appBarIcons, + showHomeAppBarIcon: showHomeAppBarIcon, + isPharmacy: isPharmacy, + isShowDecPage: isShowDecPage, + ) + : null, + bottomSheet: bottomSheet, body: (!Provider.of(context, listen: false).isLogin && - isShowDecPage) + isShowDecPage) ? NotAutPage( - title: title ?? appBarTitle, - description: description, - infoList: infoList, - imagesInfo: imagesInfo, - ) + title: title ?? appBarTitle, + description: description, + infoList: infoList, + imagesInfo: imagesInfo, + ) : baseViewModel != null - ? NetworkBaseView( - child: body, - baseViewModel: baseViewModel, - ) - : body, + ? NetworkBaseView( + child: body, + baseViewModel: baseViewModel, + ) + : body, + floatingActionButton: floatingActionButton, ); } buildAppLoaderWidget(bool isLoading) { return isLoading ? AppLoaderWidget() : Container(); } - } class AppBarWidget extends StatelessWidget with PreferredSizeWidget { final AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); final String appBarTitle; + final bool showHomeAppBarIcon; final List appBarIcons; final bool isPharmacy; final bool isShowDecPage; - final String image; - AppBarWidget({this.appBarTitle, this.appBarIcons, - this.isPharmacy = true, this.isShowDecPage = true, this.image}); + AppBarWidget( + {this.appBarTitle, + this.showHomeAppBarIcon, + this.appBarIcons, + this.isPharmacy = true, + this.isShowDecPage = true}); @override Widget build(BuildContext context) { @@ -130,10 +138,9 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { return AppBar( elevation: 0, backgroundColor: - isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, + isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), title: Text( authenticatedUserObject.isLogin || !isShowDecPage @@ -142,8 +149,7 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { style: TextStyle( fontWeight: FontWeight.bold, color: Colors.white, - fontFamily: - projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), leading: Builder( builder: (BuildContext context) { return ArrowBack(); @@ -153,27 +159,25 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { actions: [ isPharmacy ? IconButton( - icon: Icon(Icons.shopping_cart), + icon: Icon(Icons.shopping_cart), + color: Colors.white, + onPressed: () { + Navigator.of(context).popUntil(ModalRoute.withName('/')); + }) + : Container(), + if (showHomeAppBarIcon) + IconButton( + icon: Icon(FontAwesomeIcons.home), color: Colors.white, onPressed: () { - Navigator.of(context) - .popUntil(ModalRoute.withName('/')); - }) - : Container(), - IconButton( - icon: Icon(FontAwesomeIcons.home), - color: Colors.white, - onPressed: () { - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute( - builder: (context) => LandingPage()), - (Route r) => false); - }, - ), + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute(builder: (context) => LandingPage()), + (Route r) => false); + }, + ), if (appBarIcons != null) ...appBarIcons ], - ); } diff --git a/lib/widgets/others/not_auh_page.dart b/lib/widgets/others/not_auh_page.dart index 0dbbee43..88f6cfde 100644 --- a/lib/widgets/others/not_auh_page.dart +++ b/lib/widgets/others/not_auh_page.dart @@ -20,17 +20,17 @@ class NotAutPage extends StatefulWidget { final List infoList; final List imagesInfo; - NotAutPage({@required this.title, @required this.description, this.infoList, this.imagesInfo}); + NotAutPage( + {@required this.title, + @required this.description, + this.infoList, + this.imagesInfo}); @override _NotAutPageState createState() => _NotAutPageState(); } class _NotAutPageState extends State { - - int _current = 0; - - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -47,7 +47,6 @@ class _NotAutPageState extends State { bold: true, color: Color(0xff60686b), ), - SizedBox( height: 12, ), @@ -63,7 +62,7 @@ class _NotAutPageState extends State { if (widget.infoList != null) ...List.generate( widget.infoList.length, - (index) => Container( + (index) => Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -76,14 +75,21 @@ class _NotAutPageState extends State { borderRadius: BorderRadius.circular(20), color: Theme.of(context).primaryColor), child: Center( - child: Texts('${index+1}',color: Colors.white,), + child: Texts( + '${index + 1}', + color: Colors.white, + ), ), ), - SizedBox(width: 6,), + SizedBox( + width: 6, + ), Expanded(child: Texts('${widget.infoList[index]}')) ], ), - SizedBox(height: 12,), + SizedBox( + height: 12, + ), ], ), ), @@ -91,34 +97,40 @@ class _NotAutPageState extends State { SizedBox( height: 22, ), - if(!projectViewModel.isInternetConnection) - Center( - child: SizedBox( - height: MediaQuery.of(context).size.height * 0.55, - width: MediaQuery.of(context).size.width * 0.50, - child: Image.asset(projectViewModel.isArabic - ? 'assets/images/Wifi-AR.png' - : 'assets/images/wifi-EN.png'), + if (!projectViewModel.isInternetConnection) + Center( + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.55, + width: MediaQuery.of(context).size.width * 0.50, + child: Image.asset(projectViewModel.isArabic + ? 'assets/images/Wifi-AR.png' + : 'assets/images/wifi-EN.png'), + ), ), - ), - if(projectViewModel.isInternetConnection && widget.imagesInfo!=null) + if (projectViewModel.isInternetConnection && + widget.imagesInfo != null) CarouselSlider( items: widget.imagesInfo.map((image) { return Builder( - builder: (BuildContext context){ + builder: (BuildContext context) { return SizedBox( width: MediaQuery.of(context).size.width * 0.50, - child: Image.network(projectViewModel.isArabic ? image.imageAr : image.imageEn)); + child: image.isAsset + ? Image.asset(projectViewModel.isArabic + ? image.imageAr + : image.imageEn) + : Image.network(projectViewModel.isArabic + ? image.imageAr + : image.imageEn)); }, ); }).toList(), options: CarouselOptions( height: MediaQuery.of(context).size.height * 0.55, - autoPlay: widget.imagesInfo.length>1, + autoPlay: widget.imagesInfo.length > 1, viewportFraction: 1.0, ), ), - SizedBox( height: 77, ), @@ -133,7 +145,7 @@ class _NotAutPageState extends State { Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( - onTap: (){ + onTap: () { loginCheck(context); }, label: TranslationBase.of(context).serviceInformationButton, @@ -145,7 +157,7 @@ class _NotAutPageState extends State { ); } - loginCheck(context) async{ + loginCheck(context) async { var data = await sharedPref.getObject(IMEI_USER_DATA); sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); if (data != null) { diff --git a/pubspec.yaml b/pubspec.yaml index 785e831d..24589cbb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -82,7 +82,8 @@ dependencies: google_maps_flutter: ^1.0.3 - + flutter_polyline_points: ^0.1.0 + location: ^2.3.5 # Qr code Scanner barcode_scan_fix: ^1.0.2 @@ -183,6 +184,7 @@ flutter: # assets: assets: - assets/images/ + - assets/images/map_markers/ - assets/images/pharmacy/ - assets/images/medical/ - assets/images/new-design/