diff --git a/.gitignore b/.gitignore index 4b016310..fd4aca5a 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ app.*.map.json # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +health_calculators.dart diff --git a/DQKey.jks b/DQKey.jks deleted file mode 100644 index 7c844584..00000000 Binary files a/DQKey.jks and /dev/null differ diff --git a/Keystore Pass.rtf b/Keystore Pass.rtf deleted file mode 100644 index cd33f08e..00000000 --- a/Keystore Pass.rtf +++ /dev/null @@ -1,9 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf2513 -\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 - -\f0\fs24 \cf0 keyPassword=HmGsa123\ -storePassword=HmGsa123} \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index d3e44cb9..19d22b13 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,7 +27,7 @@ apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 28 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -41,7 +41,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.cloud.diplomaticquarterapp" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true @@ -78,13 +78,21 @@ dependencies { // exclude group: 'com.google.protobuf',module: 'protobuf-lite' // }) implementation 'pub.devrel:easypermissions:0.4.0' + // implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0' implementation 'com.google.guava:guava:27.0.1-android' // Dependency on local binaries implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.google.code.gson:gson:2.8.6' // Dependency on a remote binary // implementation 'com.example.android:app-magic:12.3' - implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' - - + + + // Native Dependency + implementation "org.jetbrains.anko:anko-commons:0.10.4" + implementation 'com.github.kittinunf.fuel:fuel:2.3.0' //for JVM + implementation 'com.github.kittinunf.fuel:fuel-android:2.3.0' + implementation 'com.google.android.gms:play-services-location:17.1.0'//for Android + + } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index beeadd9e..d8fd4e88 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -3,6 +3,5 @@ - diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d0751535..1032b29b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ FlutterApplication and put your custom class here. --> + @@ -20,6 +21,14 @@ + + + + + + + + - @@ -68,13 +75,25 @@ - + + + + + + + + + + + + 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 b8a87c8c..8b73b0c7 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt @@ -1,11 +1,23 @@ package com.cloud.diplomaticquarterapp +import android.os.Bundle +import android.util.Log import androidx.annotation.NonNull; - import io.flutter.embedding.android.FlutterFragmentActivity +import com.cloud.diplomaticquarterapp.utils.FlutterText +import com.cloud.diplomaticquarterapp.utils.PlatformBridge +import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.engine.FlutterEngine - import io.flutter.plugins.GeneratedPluginRegistrant +import io.flutter.plugin.common.MethodChannel +import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity: FlutterFragmentActivity() { - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } + override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + // Create Flutter Platform Bridge + PlatformBridge(flutterEngine.dartExecutor.binaryMessenger, this).create() + + } + + override fun onResume() { + super.onResume() + } } \ No newline at end of file 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 new file mode 100644 index 00000000..7eba1ead --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt @@ -0,0 +1,56 @@ +package com.cloud.diplomaticquarterapp.geofence + +import com.google.android.gms.location.Geofence +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken + +class GeoZoneModel { + var GEOF_ID:Int = 0 + var Radius:Int = 0 + var Type:Int = 0 + var ProjectID:Int = 0 + + var Description:String? = null + var DescriptionN:String? = null + var Latitude:String? = null + var Longitude:String? = null + var ImageURL:String? = null + var IsCity:String? = null + + fun identifier():String{ + return "$GEOF_ID" + "_hmg" + } + + fun message():String{ + return Description ?: "nil" + } + + fun listFrom(jsonString: String) : List{ + val type = object : TypeToken?>() {}.getType() + return Gson().fromJson(jsonString, type) + } + + fun toGeofence() : Geofence?{ + if (!Latitude.isNullOrEmpty() && !Longitude.isNullOrEmpty() && Radius > 50) { + val lat = Latitude!!.trim().toDoubleOrNull() + val long = Longitude!!.trim().toDoubleOrNull() + val rad = Radius.toFloat() + if(lat != null && long != null){ + + return Geofence.Builder() + .setRequestId(identifier()) + .setCircularRegion( + lat, + long, + rad + ) + .setTransitionTypes(GeofenceTransition.ENTER_EXIT.value) +// .setNotificationResponsiveness(0) + .setExpirationDuration(Geofence.NEVER_EXPIRE) + .build() + } + } + return null + } + +} 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 new file mode 100644 index 00000000..8fc1faae --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt @@ -0,0 +1,13 @@ + + +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/GeofenceErrorMessages.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt new file mode 100755 index 00000000..4890f7cb --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt @@ -0,0 +1,34 @@ + + +package com.cloud.diplomaticquarterapp.geofence + +import android.content.Context +import com.cloud.diplomaticquarterapp.R +import com.google.android.gms.common.api.ApiException +import com.google.android.gms.location.GeofenceStatusCodes + +object GeofenceErrorMessages { + fun getErrorString(context: Context, e: Exception): String { + return if (e is ApiException) { + getErrorString(context, e.statusCode) + } else { + context.resources.getString(R.string.geofence_unknown_error) + } + } + + fun getErrorString(context: Context, errorCode: Int): String { + val resources = context.resources + return when (errorCode) { + GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE -> + resources.getString(R.string.geofence_not_available) + + GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES -> + resources.getString(R.string.geofence_too_many_geofences) + + GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS -> + resources.getString(R.string.geofence_too_many_pending_intents) + + else -> resources.getString(R.string.geofence_unknown_error) + } + } +} \ 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/GeofenceTransitionsJobIntentService.kt new file mode 100755 index 00000000..f28e1720 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceTransitionsJobIntentService.kt @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2018 Razeware LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * Notwithstanding the foregoing, you may not use, copy, modify, merge, publish, + * distribute, sublicense, create a derivative work, and/or sell copies of the + * Software in any work that is designed, intended, or marketed for pedagogical or + * instructional purposes related to programming, coding, application development, + * or information technology. Permission for such use, copying, modification, + * merger, publication, distribution, sublicensing, creation of derivative works, + * or sale is expressly withheld. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + +package com.cloud.diplomaticquarterapp.geofence + +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.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 + + fun enqueueWork(context: Context, intent: Intent) { + enqueueWork( + context, + GeofenceTransitionsJobIntentService::class.java, JOB_ID, + intent) + } + } + + override fun onHandleWork(intent: Intent) { + val geofencingEvent = GeofencingEvent.fromIntent(intent) + if (geofencingEvent.hasError()) { + val errorMessage = GeofenceErrorMessages.getErrorString(this, 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 -> + + hmg.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 = 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.😔") + }) + + } + } + + },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/GeofencingRebootBroadcastReceiver.kt new file mode 100644 index 00000000..08a0c93f --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofencingRebootBroadcastReceiver.kt @@ -0,0 +1,27 @@ + + +package com.cloud.diplomaticquarterapp.geofence + +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 + +class GeofencingRebootBroadcastReceiver : BroadcastReceiver(){ + override fun onReceive(context: Context, intent: Intent) { + + if (Intent.ACTION_BOOT_COMPLETED.equals(intent.action)) { + 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) + } + } + } + +} \ 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 new file mode 100644 index 00000000..4d2c48b3 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt @@ -0,0 +1,165 @@ +package com.cloud.diplomaticquarterapp.geofence + +import android.Manifest +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.content.SharedPreferences +import android.content.pm.PackageManager +import androidx.core.content.ContextCompat +import com.google.android.gms.location.Geofence +import com.google.android.gms.location.GeofencingClient +import com.google.android.gms.location.GeofencingRequest +import com.google.android.gms.location.LocationServices +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken + +enum class GeofenceTransition(val value: Int) { + ENTER(1), + EXIT(2), + ENTER_EXIT((ENTER.value or EXIT.value)), + DWELL(4); + + companion object { + fun fromInt(value: Int) = GeofenceTransition.values().first { it.value == value } + } + + fun named():String{ + if (value == 1)return "Enter" + if (value == 2)return "Exit" + if (value == (ENTER.value or EXIT.value))return "Enter or Exit" + if (value == 4)return "dWell" + 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 + + private lateinit var context: Context + private lateinit var preferences:SharedPreferences + private val gson = Gson() + + private lateinit var geofencingClient:GeofencingClient + private val geofencePendingIntent: PendingIntent by lazy { + val intent = Intent(context, GeofenceBroadcastReceiver::class.java) + PendingIntent.getBroadcast( + context, + 0, + intent, + PendingIntent.FLAG_UPDATE_CURRENT) + } + + companion object{ + + var instance: HMG_Geofence? = null + fun shared(context: Context) : HMG_Geofence { + if (instance == null) { + instance = HMG_Geofence() + instance?.context = context + instance?.geofencingClient = LocationServices.getGeofencingClient(context) + instance?.preferences = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) + } + return instance!! + } + } + + fun register(geoZones: List){ + if (geoZones.isEmpty()) + return + + fun buildGeofencingRequest(geofences: List): GeofencingRequest { + return GeofencingRequest.Builder() + .setInitialTrigger(0) + .addGeofences(geofences) + .build() + } + + getActiveGeofences({ active -> + + val geofences = mutableListOf() + geoZones.forEach { + it.toGeofence()?.let { geof -> + if(!active.contains(geof.requestId)){ // if not already registered then register + geofences.add(geof) + } + } + } + + if (checkPermission() && geofences.isNotEmpty()) { + geofencingClient + .addGeofences(buildGeofencingRequest(geofences), geofencePendingIntent) + .addOnSuccessListener { + saveActiveGeofence(geofences.map { it.requestId }, listOf()) + } + .addOnFailureListener { + print(it.localizedMessage) + } + } + },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 saveActiveGeofence(success: List, failed: List){ + val jsonSuccess = gson.toJson(success) + val jsonFailure = gson.toJson(failed) + preferences.edit().putString(PREF_KEY_SUCCESS, jsonSuccess).apply() + preferences.edit().putString(PREF_KEY_FAILED, jsonFailure).apply() + } + + fun removeActiveGeofences(){ + preferences.edit().putString(PREF_KEY_SUCCESS,"[]").apply() + preferences.edit().putString(PREF_KEY_FAILED,"[]").apply() + } + + fun getActiveGeofences(success: (success: List) -> Unit, failure: ((failed: List) -> Unit)?){ + val type = object : TypeToken?>() {}.type + + val jsonSuccess = preferences.getString(PREF_KEY_SUCCESS, "[]") + val success = gson.fromJson>(jsonSuccess, type) + success(success) + + if(failure != null){ + val jsonFailure = preferences.getString(PREF_KEY_FAILED, "[]") + val failed = gson.fromJson>(jsonFailure, type) + failure(failed) + } + + } + + private fun checkPermission() : Boolean{ + return ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED + } + + fun getPatientID():Int?{ + val profileJson = preferences.getString("flutter.imei-user-data", "{}") + val type = object : TypeToken?>() {}.type + return gson.fromJson?>(profileJson,type) + ?.get("PatientID") + .toString() + .toDoubleOrNull() + ?.toInt() + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/HMG_Guest.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/HMG_Guest.kt new file mode 100644 index 00000000..61433596 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/HMG_Guest.kt @@ -0,0 +1,172 @@ +package com.cloud.diplomaticquarterapp.hmgwifi + +import android.content.Context +import android.net.ConnectivityManager +import android.net.wifi.WifiConfiguration +import android.net.wifi.WifiInfo +import android.net.wifi.WifiManager +import android.os.Build +import android.util.Log +import android.widget.Toast +import com.cloud.diplomaticquarterapp.MainActivity +import com.cloud.diplomaticquarterapp.utils.FlutterText +import com.cloud.diplomaticquarterapp.utils.HMGUtils + + +class HMG_Guest(context: MainActivity) { + private var wifiManager: WifiManager? = context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager? + private var connectivityManager: ConnectivityManager? = context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager? + private var context = context + + private val TAG = "HMG_Guest" + private val TEST = false + private var SSID = """"HMG-MobileApp"""" + + private lateinit var completionListener: ((status: Boolean, message: String) -> Unit) + + fun completionOnUiThread(status: Boolean, message: String){ + completionListener(status, message) + } + + /* + * Helpful: + * http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-programmatically + */ + fun connectToHMGGuestNetwork(completion: (status: Boolean, message: String) -> Unit) { + wifiManager?.let { wm -> + completionListener = completion + + if (!wm.isWifiEnabled){ + wm.isWifiEnabled = true + HMGUtils.popFlutterText(context,"enablingWifi"); + HMGUtils.timer(2000,false){ + connect() + } + }else{ + connect() + } + + } + + } + + + private fun connect(){ + val security = "OPEN" + val networkPass = "" + Log.d(TAG, "Connecting to SSID \"$SSID\" with password \"$networkPass\" and with security \"$security\" ...") + + // You need to create WifiConfiguration instance like this: + val conf = WifiConfiguration() + conf.SSID = SSID + conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE) + conf.networkId = ssidToNetworkId(SSID) + + val wm = wifiManager!! + + if (conf.networkId == -1) { + wm.addNetwork(conf) + } else { + Log.v(TAG, "WiFi found - updating it.\n") + wm.updateNetwork(conf) + } + + conf.networkId = ssidToNetworkId(SSID) + Log.d(TAG, "Network ID: ${conf.networkId}") + + val networkIdToConnect = conf.networkId + if (networkIdToConnect >= 0) { + Log.v(TAG, "Start connecting to $SSID Wifi...") + + // We disable the network before connecting, because if this was the last connection before + // a disconnect(), this will not reconnect. + wm.disableNetwork(networkIdToConnect) + val result = wm.enableNetwork(networkIdToConnect, true) + if(result){ + HMGUtils.timer(8000,false){ + if(wm.getConnectionInfo().getSSID() == SSID){ + completionOnUiThread(true, "successConnectingHmgNetwork") + + }else{ + errorConnecting() + } + } + + }else{ + errorConnecting() + } + + + + }else{ + Log.v(TAG, "Cannot connect to $SSID network") + errorConnecting() + } + } + + private fun errorConnecting(){ + completionOnUiThread(false, "errorConnectingHmgNetwork") + } + + // If CompileSDK is greater and equals to APILevel 29 + private fun connectNewer(wm:WifiManager){ + +// Log.e(TAG, "connection wifi Q") +// +// val wifiNetworkSpecifier: WifiNetworkSpecifier = WifiNetworkSpecifier.Builder() +// .setSsid(ssid) +// .setWpa2Passphrase(password) +// .build() +// +// val networkRequest: NetworkRequest = NetworkRequest.Builder() +// .addTransportType(NetworkCapabilities.TRANSPORT_WIFI) +// .setNetworkSpecifier(wifiNetworkSpecifier) +// .build() +// +// var connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager +// var networkCallback = object : ConnectivityManager.NetworkCallback() { +// override fun onAvailable(network: Network) { +// super.onAvailable(network) +// connectivityManager.bindProcessToNetwork(network) +// Log.e(TAG, "onAvailable") +// } +// +// override fun onLosing(network: Network, maxMsToLive: Int) { +// super.onLosing(network, maxMsToLive) +// Log.e(TAG, "onLosing") +// } +// +// override fun onLost(network: Network) { +// super.onLost(network) +// Log.e(TAG, "onLosing") +// Log.e(TAG, "losing active connection") +// } +// +// override fun onUnavailable() { +// super.onUnavailable() +// Log.e(TAG, "onUnavailable") +// } +// } +// connectivityManager.requestNetwork(networkRequest, networkCallback) + } + + + /** + * This method takes a given String, searches the current list of configured WiFi + * networks, and returns the networkId for the network if the SSID matches. If not, + * it returns -1. + */ + private fun ssidToNetworkId(ssid: String): Int { + val currentNetworks = wifiManager!!.configuredNetworks + var networkId = -1 + + // For each network in the list, compare the SSID with the given one + for (test in currentNetworks) { + if (test.SSID == ssid) { + networkId = test.networkId + break + } + } + return networkId + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/HMG_Internet.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/HMG_Internet.kt new file mode 100644 index 00000000..332e60a5 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/HMG_Internet.kt @@ -0,0 +1,110 @@ +package com.cloud.diplomaticquarterapp.hmgwifi + +import android.annotation.SuppressLint +import com.cloud.diplomaticquarterapp.utils.API +import com.cloud.diplomaticquarterapp.MainActivity +import com.cloud.diplomaticquarterapp.utils.FlutterText +import com.github.kittinunf.fuel.core.extensions.jsonBody +import com.github.kittinunf.fuel.httpGet +import com.github.kittinunf.fuel.httpPost +import org.json.JSONObject +import java.util.* + + +@SuppressLint("MissingPermission") +class HMG_Internet(flutterMainActivity: MainActivity) { + private val TAG = "HMG_Wifi" + private val TEST = false + + private var context = flutterMainActivity; + + private lateinit var completionListener: ((status: Boolean, message: String) -> Unit) + + private var SSID = "GUEST-POC" + private var USER_NAME = "" + private var PASSWORD = "" + + fun completionOnUiThread(status: Boolean, message: String){ + completionListener(status, message) +// context.runOnUiThread { +// +// FlutterText.with(message){localized -> +// completionListener(status, localized) +// } +// } + } + + /* + * Helpful: + * http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-programmatically + */ + fun connectToHMGGuestNetwork(patientId: String, completion: (status: Boolean, message: String) -> Unit): HMG_Internet { + completionListener = completion + getWifiCredentials(patientId) { + WPA(context,SSID).connect(USER_NAME,PASSWORD) { status, message -> + completionOnUiThread(status,message) + } + } + return this + } + + private fun haveInternet(completion: ((status: Boolean) -> Unit)){ + if (TEST) + completion(true) + + "https://captive.apple.com".httpGet().response { request, response, result -> + result.fold(success = { + val html = String(it).toLowerCase(Locale.ENGLISH) + .replace(" ", "", true) + .replace("\n","",true) + val have = html.contains("success", true) + completion(have) + + },failure = { + completion(false) + }) + } + } + + private fun getWifiCredentials(patientId:String, success: (() -> Unit)){ + if (TEST){ + SSID = "GUEST-POC" + USER_NAME = "0696" + PASSWORD = "0000" + success() + return + } + + val jsonBody = """{"PatientID":$patientId}""" + API.WIFI_CREDENTIALS. + httpPost() + .jsonBody(jsonBody, Charsets.UTF_8) + .response { request, response, result -> + + result.fold(success = { data -> + val jsonString = String(data) + val jsonObject = JSONObject(jsonString) + if(!jsonObject.getString("ErrorMessage").equals("null")){ + val errorMsg = jsonObject.getString("ErrorMessage") + completionOnUiThread(false, errorMsg) + + }else{ + jsonObject.getJSONArray("Hmg_SMS_Get_By_ProjectID_And_PatientIDList").let { array -> + array.getJSONObject(0).let { object_ -> + if (object_.has("UserName") && object_.has("UserName")){ + USER_NAME = object_.getString("UserName") + PASSWORD = object_.getString("Password") + success() + }else{ + completionOnUiThread(false, "somethingWentWrong") + } + } + } + } + + },failure = { error -> + completionOnUiThread(false, "somethingWentWrong" ) + }) + } + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/WPA.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/WPA.kt new file mode 100644 index 00000000..86e67def --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/hmgwifi/WPA.kt @@ -0,0 +1,105 @@ +package com.cloud.diplomaticquarterapp.hmgwifi + +import android.annotation.SuppressLint +import android.content.Context +import android.net.ConnectivityManager +import android.net.wifi.* +import android.net.wifi.SupplicantState.ASSOCIATED +import android.net.wifi.SupplicantState.COMPLETED +import android.util.Log +import com.cloud.diplomaticquarterapp.MainActivity +import com.cloud.diplomaticquarterapp.utils.HMGUtils + +class WPA(mainActivity: MainActivity, SSID:String) { + private var TAG = "WPA" + private var SSID = "GUEST-POC" + private var wifiManager_: WifiManager? = null + private var connectivityManager_: ConnectivityManager? = null + + init { + wifiManager_ = mainActivity.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager? + connectivityManager_ = mainActivity.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager? + } + + fun connect(identity:String, password:String, completion: (status: Boolean, message: String) -> Unit) { + if(wifiManager_ == null || connectivityManager_ == null){ + completion(false,"errorConnectingHmgNetwork") + return + } + + val wifiManager = wifiManager_!! + val connectivityManager = connectivityManager_!! + + // Initialize the WifiConfiguration object + val enterpriseConfig = WifiEnterpriseConfig() + val wifi = WifiConfiguration() + wifi.SSID = """"$SSID"""" + wifi.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP) + wifi.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.IEEE8021X) + enterpriseConfig.eapMethod = WifiEnterpriseConfig.Eap.PEAP + enterpriseConfig.identity = identity + enterpriseConfig.password = password + wifi.enterpriseConfig = enterpriseConfig + wifi.networkId = ssidToNetworkId(wifi.SSID) + if (wifi.networkId == -1) { + wifiManager.addNetwork(wifi) + } else { + Log.v(TAG, "WiFi found - updating it.\n") + wifiManager.updateNetwork(wifi) + } + Log.v(TAG, "saving config.\n") + wifiManager.saveConfiguration() + wifi.networkId = ssidToNetworkId(wifi.SSID) + + Log.v(TAG, "wifi ID in device = " + wifi.networkId) + + var supState: SupplicantState + val networkIdToConnect = wifi.networkId + if (networkIdToConnect >= 0) { + Log.v(TAG, "Start connecting...\n") + + // We disable the network before connecting, because if this was the last connection before + // a disconnect(), this will not reconnect. + wifiManager.disableNetwork(networkIdToConnect) + wifiManager.enableNetwork(networkIdToConnect, true) + + val wifiInfo: WifiInfo = wifiManager.connectionInfo + + HMGUtils.timer(5000,false){ + supState = wifiInfo.supplicantState + Log.i(TAG, "WifiWizard: Done connect to network : status = $supState") + val successStates = listOf(COMPLETED, ASSOCIATED) + if (successStates.contains(COMPLETED /*supState*/)) + + completion(true,"Connected to internet Wifi") + + else + completion(false,"errorConnectingHmgNetwork") + } + + } else { + Log.v(TAG, "WifiWizard: cannot connect to network") + completion(false,"errorConnectingHmgNetwork") + } + } + + /** + * This method takes a given String, searches the current list of configured WiFi + * networks, and returns the networkId for the network if the SSID matches. If not, + * it returns -1. + */ + @SuppressLint("MissingPermission") + private fun ssidToNetworkId(ssid: String): Int { + val currentNetworks = wifiManager_!!.configuredNetworks + var networkId = -1 + + // For each network in the list, compare the SSID with the given one + for (test in currentNetworks) { + if (test.SSID == ssid) { + networkId = test.networkId + break + } + } + return networkId + } +} \ 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 new file mode 100644 index 00000000..30f57dde --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt @@ -0,0 +1,11 @@ +package com.cloud.diplomaticquarterapp.utils + +class API { + companion object{ + private val BASE = "https://uat.hmgwebservices.com" + private val SERVICE = "Services/Patients.svc/REST" + + val WIFI_CREDENTIALS = "$BASE/$SERVICE/Hmg_SMS_Get_By_ProjectID_And_PatientID" + val LOG_GEOFENCE = "$BASE/$SERVICE/GeoF_InsertPatientFileInfo" + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/FlutterText.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/FlutterText.kt new file mode 100644 index 00000000..419eb340 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/FlutterText.kt @@ -0,0 +1,36 @@ +package com.cloud.diplomaticquarterapp.utils + +import io.flutter.plugin.common.MethodChannel +import io.flutter.plugin.common.MethodChannel.Result + +class FlutterText{ + + companion object{ + fun with(key:String, completion:(String)->Unit){ + HMGUtils.getPlatformChannel().invokeMethod("localizedValue",key, object:MethodChannel.Result{ + override fun success(result: Any?) { + val localized = result as String? + if (localized != null){ + completion(localized) + }else{ + completion(key) + } + } + + override fun error(errorCode: String?, errorMessage: String?, errorDetails: Any?) { + completion(key) + require(false){ + "'localizedValue' $errorMessage" + } + } + + override fun notImplemented() { + require(false){ + "'localizedValue' method not implemented at flutter" + } + } + + }) + } + } +} \ 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 new file mode 100644 index 00000000..bebd0101 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt @@ -0,0 +1,160 @@ +package com.cloud.diplomaticquarterapp.utils + +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.os.Build +import android.widget.Toast +import androidx.annotation.Nullable +import androidx.core.app.NotificationCompat +import androidx.core.app.TaskStackBuilder +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.json.JSONArray +import org.json.JSONException +import org.json.JSONObject +import java.util.* +import kotlin.concurrent.timerTask + + +class HMGUtils { + + companion object{ + private lateinit var platformChannel: MethodChannel + fun getPlatformChannel():MethodChannel{ + return platformChannel + } + fun setPlatformChannel(channel: MethodChannel){ + platformChannel = channel + } + + fun timer(delay: Long, repeat: Boolean, tick: (Timer) -> Unit) : Timer{ + val timer = Timer() + if(repeat) + timer.schedule(timerTask { + tick(timer) + }, delay, delay) + else + timer.schedule(timerTask { + tick(timer) + }, delay) + + return timer + } + + fun popMessage(context: MainActivity, message: String){ + context.runOnUiThread { + Toast.makeText(context, message, Toast.LENGTH_LONG).show() + } + } + + fun popFlutterText(context: MainActivity, key: String){ + context.runOnUiThread { + FlutterText.with(key){ + Toast.makeText(context, it, Toast.LENGTH_LONG).show() + } + } + } + + 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 + } + + } + +} + +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?) { + val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O + && notificationManager.getNotificationChannel(NOTIFICATION_CHANNEL_ID) == null) { + val name = context.getString(R.string.app_name) + val channel = NotificationChannel(NOTIFICATION_CHANNEL_ID, + name, + NotificationManager.IMPORTANCE_DEFAULT) + + notificationManager.createNotificationChannel(channel) + } + + val intent = Intent(context, MainActivity::class.java) + + val stackBuilder = TaskStackBuilder.create(context) + .addParentStack(MainActivity::class.java) + .addNextIntent(intent) + val notificationPendingIntent = stackBuilder.getPendingIntent(getUniqueId(), PendingIntent.FLAG_UPDATE_CURRENT) + + val notification = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID) + .setSmallIcon(R.mipmap.ic_launcher) + .setContentIntent(notificationPendingIntent) + .setAutoCancel(true) + .setContentTitle(title) + + subtitle.let { notification.setContentText(it) } + message.let { notification.setSubText(it) } + + notificationManager.notify(getUniqueId(), notification.build()) +} + + +private fun getUniqueId() = ((System.currentTimeMillis() % 10000).toInt()) + +fun isJSONValid(jsonString: String?): Boolean { + try { JSONObject(jsonString) } catch (ex: JSONException) { + try { JSONArray(jsonString) } catch (ex1: JSONException) { + return false + } + } + return true +} + +class HTTPResponse(data: T){ + final var data:T = data +} +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","*/*") + .response { request, response, result -> + result.fold({ data -> + val dataString = String(data) + if(isJSONValid(dataString)){ + val responseData = gson.fromJson(dataString,type) + onSuccess(HTTPResponse(responseData)) + }else{ + onError(Exception("Invalid response from server (Not a valid JSON)")) + } + }, { + onError(it) + it.localizedMessage + }) + + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMG_Wifi_.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMG_Wifi_.kt new file mode 100644 index 00000000..decc9bdf --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMG_Wifi_.kt @@ -0,0 +1,351 @@ +//package com.cloud.diplomaticquarterapp.utils +// +//import android.annotation.SuppressLint +//import android.content.Context +//import android.net.ConnectivityManager +//import android.net.Network +//import android.net.NetworkCapabilities +//import android.net.NetworkRequest +//import android.net.wifi.ScanResult +//import android.net.wifi.WifiConfiguration +//import android.net.wifi.WifiManager +//import android.util.Log +//import com.cloud.diplomaticquarterapp.utils.API +//import com.cloud.diplomaticquarterapp.FlutterMainActivity +//import com.github.kittinunf.fuel.core.extensions.jsonBody +//import com.github.kittinunf.fuel.httpGet +//import com.github.kittinunf.fuel.httpPost +//import org.json.JSONObject +//import java.util.* +// +// +//@SuppressLint("MissingPermission") +//class HMG_Wifi_(flutterMainActivity: FlutterMainActivity) { +// val TAG = "WIFI" +// val TEST = true +// +// var context = flutterMainActivity; +// var completionListener: ((status: Boolean, message: String) -> Unit)? = null +// +// +// private var SSID = "HMG-GUEST" +// private var USER_NAME = "" +// private var PASSWORD = "" +// var NETWORK_ID = -1 // HMG-GUEST Assigned Network ID by Android +// private lateinit var PATIENT_ID:String +// /* +// * Helpful: +// * http://stackoverflow.com/questions/5452940/how-can-i-get-android-wifi-scan-results-into-a-list +// */ +// fun triggerWifiScan(context: Context) { +// val wifi = context.getSystemService(Context.WIFI_SERVICE) as WifiManager +// wifi.startScan() +// } +// +// /* +// * Helpful: +// * http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-programmatically +// */ +// fun connectToWifiNetworkWith(patientId: String): HMG_Wifi_ { +// +// val connectivityManager = context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager +// +// PATIENT_ID = patientId +// +// val security = "OPEN" +// val networkPass = "" +// Log.d(TAG, "Connecting to SSID \"$SSID\" with password \"$networkPass\" and with security \"$security\" ...") +// +// // You need to create WifiConfiguration instance like this: +// val conf = WifiConfiguration() +// conf.SSID = "\"" + SSID + "\"" +// +// if (security == "OPEN") { +// conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE) +// } else if (security == "WEP") { +// conf.wepKeys[0] = "\"" + networkPass + "\"" +// conf.wepTxKeyIndex = 0 +// conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE) +// conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40) +// } else { +// conf.preSharedKey = "\"" + networkPass + "\"" +// } +// +// // Then, you need to add it to Android wifi manager settings: +// val wifiManager = context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager +// +// NETWORK_ID = wifiManager.addNetwork(conf) +// Log.d(TAG, "Network ID: $NETWORK_ID") +// +// //wifiManager.disconnect(); +// val result = wifiManager.enableNetwork(NETWORK_ID, true) +// //wifiManager.reconnect(); +// wifiManager.saveConfiguration() +// +// if(result == true){ +// authNetworkConnection(NETWORK_ID); +// }else{ +// completionListener?.let { it(false, "Error connecting to HMG network") } +// } +// return this +// } +// +// private var authTimer:Timer? = null +// fun authNetworkConnection(networkId: Int){ +// authTimer = Timer() +// authTimer?.scheduleAtFixedRate(object : TimerTask() { +// override fun run() { +// if (connectedNetworkId() == networkId && connectedNetworkIPAddress() > 0) { +// authServerCall() +// authTimer?.cancel() +// } +// } +// +// }, 2000, 1000) +// +// // If wifi not connected in 5 sec terminate with fail status +// Timer().schedule(object : TimerTask() { +// override fun run() { +// if (null != authTimer) { +// authTimer?.cancel() +// completionListener?.let { it(false, "Error connecting to HMG network") } +// } +// } +// }, 5000) +// +// } +// +// fun authServerCall(){ +// +// fun call(){ +// +// forceNetworkCallOverWifi() +// +// val params = listOf("cmd" to "authenticate", "password" to PASSWORD, "user" to USER_NAME) +// val serverUrl = "https://captiveportal-login.hmg.com/cgi-bin/login" +//// val serverUrl = "http://192.168.102.223/cgi-bin/login" +// serverUrl +// .httpPost(params) +// .timeout(10000) +// .response { request, response, result -> +// Log.v(TAG, response.statusCode.toString()) +// +// haveInternet { have -> +// if(have){ +// Log.v(TAG, "Connected to internet via $SSID network at HMG") +// completionListener?.let { it(true, "Successfully connected to the internet") } +// }else{ +// Log.e(TAG, "failed to connect to internet via $SSID network at HMG") +// completionListener?.let { it(false, "Authentication failed or you are already using your credentials on another device") } +// } +// } +// } +// } +// +// haveInternet { has -> +// if (has){ +// getAuthCredentials { +// call() +// } +// }else{ +// completionListener?.let { it(false, "You must have active internet connection to connect with HMG Network") } +// } +// } +// } +// +// fun haveInternet(completion: ((status: Boolean) -> Unit)){ +// if (TEST) +// completion(true) +// +// "https://captive.apple.com".httpGet().response { request, response, result -> +// val have = response.statusCode == 200 && String(response.data).contains("Success", true) +// completion(have) +// } +// } +// +// fun getAuthCredentials(completion: (() -> Unit)){ +// if (TEST){ +// USER_NAME = "2300" +// PASSWORD = "1820" +// completion() +// return +// } +// +// val jsonBody = """{"PatientID":$PATIENT_ID}""" +// API.WIFI_CREDENTIALS +// .httpPost() +// .jsonBody(jsonBody, Charsets.UTF_8) +// .response { request, response, result -> +// val jsonString = String(response.data) +// Log.d(TAG, "JSON $jsonString") +// +// if (response.statusCode == 200){ +// +// val jsonObject = JSONObject(jsonString) +// if(!jsonObject.getString("ErrorMessage").equals("null")){ +// val errorMsg = jsonObject.getString("ErrorMessage") +// completionListener?.let { it(false, errorMsg) } +// +// }else{ +// jsonObject.getJSONArray("Hmg_SMS_Get_By_ProjectID_And_PatientIDList").let { array -> +// array.getJSONObject(0).let { object_ -> +// if (object_.has("UserName") && object_.has("UserName")){ +// USER_NAME = object_.getString("UserName") +// PASSWORD = object_.getString("Password") +// completion() +// }else{ +// completionListener?.let { it(false, "Failed to get your internet credentials") } +// } +// } +// } +// } +// +// }else{ +// completionListener?.let { it(false, "Failed to get your internet credentials") } +// } +// } +// } +// +// fun forceNetworkCallOverWifi(){ +// val connectivityManager = context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager +//// val network = Network +//// connectivityManager.activeNetwork +// // Exit app if Network disappears. +// // Exit app if Network disappears. +//// val networkCapabilities: NetworkCapabilities = ConnectivityManager.from(context).getNetworkCapabilities(network) +//// val networkCapabilities: NetworkCapabilities = connectivityManager.getNetworkCapabilities(network) +// +//// if (networkCapabilities == null) { +//// return +//// } +// +// val mNetworkCallback = object : ConnectivityManager.NetworkCallback() { +// override fun onLost(lostNetwork: Network?) { +//// if (network.equals(lostNetwork)){ +//// //GlyphLayout.done(false) +//// } +// } +// } +// val builder: NetworkRequest.Builder = NetworkRequest.Builder() +//// for (transportType in networkCapabilities.getTransportTypes()) { +//// builder.addTransportType(transportType) +//// } +// connectivityManager.registerNetworkCallback(builder.build(), mNetworkCallback) +// } +// +// /* +// * Helpful: +// * http://stackoverflow.com/questions/6517314/android-wifi-connection-programmatically +// */ +// fun getScanResultSecurity(result: ScanResult): String? { +// val capabilities: String = result.capabilities +// val securityModes = arrayOf("WEP", "PSK", "EAP") +// for (securityMode in securityModes) { +// if (capabilities.contains(securityMode)) { +// return securityMode +// } +// } +// return "OPEN" +// } +// +// //connects to the given ssid +// fun connectToWPAWiFi(ssid: String, password: String){ +// +// WifiUtils.withContext(context) +// .connectWith(ssid, "") +// .setTimeout(40000) +// .onConnectionResult(object : ConnectionSuccessListener { +// override fun success() { +// Log.v(TAG,"Success") +// } +// +// override fun failed(@NonNull errorCode: ConnectionErrorCode) { +// Log.v(TAG,"Failed") +// } +// }) +// .start() +// if(isConnectedTo(ssid)){ //see if we are already connected to the given ssid +// return +// } +// +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { +// Log.e(TAG, "connection wifi Q") +// +// val wifiNetworkSpecifier: WifiNetworkSpecifier = WifiNetworkSpecifier.Builder() +// .setSsid(ssid) +// .setWpa2Passphrase(password) +// .build() +// +// val networkRequest: NetworkRequest = NetworkRequest.Builder() +// .addTransportType(NetworkCapabilities.TRANSPORT_WIFI) +// .setNetworkSpecifier(wifiNetworkSpecifier) +// .build() +// +// var connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager +// var networkCallback = object : ConnectivityManager.NetworkCallback() { +// override fun onAvailable(network: Network) { +// super.onAvailable(network) +// connectivityManager.bindProcessToNetwork(network) +// Log.e(TAG, "onAvailable") +// } +// +// override fun onLosing(network: Network, maxMsToLive: Int) { +// super.onLosing(network, maxMsToLive) +// Log.e(TAG, "onLosing") +// } +// +// override fun onLost(network: Network) { +// super.onLost(network) +// Log.e(TAG, "onLosing") +// Log.e(TAG, "losing active connection") +// } +// +// override fun onUnavailable() { +// super.onUnavailable() +// Log.e(TAG, "onUnavailable") +// } +// } +// connectivityManager.requestNetwork(networkRequest, networkCallback) +// +// }else{ +// +// try { +// val wm:WifiManager= context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager +// +// Log.e(TAG, "connection wifi pre Q") +// +// var netId: Int = wm.addNetwork(getWifiConfig(ssid)) +// if (netId == -1) netId = getExistingNetworkId(ssid); +// wm.saveConfiguration() +// if(wm.enableNetwork(netId, true)){ +// Log.v(TAG,"HMG-GUEST Connected") +// }else{ +// Log.v(TAG,"HMG-GUEST failed to connect") +// } +// } catch (e: Exception) { +// e.printStackTrace() +// Log.v(TAG,"HMG-GUEST failed to connect") +// } +// } +// +// } +// +// fun connectedNetworkId():Int{ +// val wm:WifiManager= context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager +// return wm.connectionInfo.networkId +// } +// +// fun connectedNetworkIPAddress():Int{ +// val wm:WifiManager= context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager +// return wm.connectionInfo.ipAddress +// } +// +// fun isConnectedTo(bssid: String):Boolean{ +// val wm:WifiManager= context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager +// if(wm.connectionInfo.bssid == bssid){ +// return true +// } +// return false +// } +// +//} \ 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 new file mode 100644 index 00000000..ed1a62c8 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt @@ -0,0 +1,127 @@ +package com.cloud.diplomaticquarterapp.utils + +import android.content.Context +import android.net.wifi.WifiManager +import android.util.Log +import com.cloud.diplomaticquarterapp.MainActivity +import com.cloud.diplomaticquarterapp.hmgwifi.HMG_Guest +import com.cloud.diplomaticquarterapp.hmgwifi.HMG_Internet +import com.cloud.diplomaticquarterapp.geofence.GeoZoneModel +import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel + +class PlatformBridge(binaryMessenger: BinaryMessenger, flutterMainActivity: MainActivity) { + private var binaryMessenger = binaryMessenger + private var mainActivity = flutterMainActivity + + private lateinit var channel: MethodChannel + + companion object { + private const val CHANNEL = "HMG-Platform-Bridge" + private const val HMG_INTERNET_WIFI_CONNECT_METHOD = "connectHMGInternetWifi" + private const val HMG_GUEST_WIFI_CONNECT_METHOD = "connectHMGGuestWifi" + private const val ENABLE_WIFI_IF_NOT = "enableWifiIfNot" + private const val REGISTER_HMG_GEOFENCES = "registerHmgGeofences" + private const val UN_REGISTER_HMG_GEOFENCES = "unRegisterHmgGeofences" + } + + fun create(){ + channel = MethodChannel(binaryMessenger, CHANNEL) + HMGUtils.setPlatformChannel(channel) + channel.setMethodCallHandler { methodCall: MethodCall, result: MethodChannel.Result -> + + if (methodCall.method == HMG_INTERNET_WIFI_CONNECT_METHOD) { + connectHMGInternetWifi(methodCall,result) + + }else if (methodCall.method == HMG_GUEST_WIFI_CONNECT_METHOD) { + connectHMGGuestWifi(methodCall,result) + + }else if (methodCall.method == ENABLE_WIFI_IF_NOT) { + enableWifiIfNot(methodCall,result) + }else if (methodCall.method == REGISTER_HMG_GEOFENCES) { + registerHmgGeofences(methodCall,result) + }else if (methodCall.method == UN_REGISTER_HMG_GEOFENCES) { + unRegisterHmgGeofences(methodCall,result) + }else{ + + result.notImplemented() + } + + } + + val res = channel.invokeMethod("localizedValue","errorConnectingHmgNetwork") + print(res) + } + + private fun connectHMGInternetWifi(methodCall: MethodCall, result: MethodChannel.Result){ + (methodCall.arguments as ArrayList<*>).let { + require(it.size > 0 && (it[0] is String),lazyMessage = { + "Missing or invalid arguments (Must have one argument 'String at 0'" + }) + + val patientId = it[0].toString() + HMG_Internet(mainActivity) + .connectToHMGGuestNetwork(patientId){ status, message -> + + mainActivity.runOnUiThread { + result.success(if(status) 1 else 0) + + HMGUtils.popFlutterText(mainActivity, message) + Log.v(this.javaClass.simpleName, "$status | $message") + } + + } + } + } + + + private fun connectHMGGuestWifi(methodCall: MethodCall, result: MethodChannel.Result){ + HMG_Guest(mainActivity).connectToHMGGuestNetwork { status, message -> + mainActivity.runOnUiThread { + result.success(if(status) 1 else 0) + + HMGUtils.popFlutterText(mainActivity, message) + Log.v(this.javaClass.simpleName, "$status | $message") + } + } + } + + private fun enableWifiIfNot(methodCall: MethodCall, result: MethodChannel.Result) { + val wm = mainActivity.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager? + if (wm != null){ + if (!wm.isWifiEnabled) + wm.isWifiEnabled = true + result.success(true) + }else + result.error("101","Error while opening wifi, Please try to open wifi yourself and try again","'WifiManager' service failed"); + } + + + private fun registerHmgGeofences(methodCall: MethodCall, result: MethodChannel.Result) { + + channel.invokeMethod("getGeoZones",null, object : MethodChannel.Result{ + override fun success(result: Any?) { + if(result is String) { + val geoZones = GeoZoneModel().listFrom(result) + HMG_Geofence.shared(mainActivity).register(geoZones) + } + } + + override fun error(errorCode: String?, errorMessage: String?, errorDetails: Any?) { print(result) } + override fun notImplemented() { print(result) } + }) + + } + + private fun unRegisterHmgGeofences(methodCall: MethodCall, result: MethodChannel.Result) { + HMG_Geofence.shared(mainActivity).unRegisterAll { status, exception -> + if(status) + result.success(true) + else + result.error("101", exception?.localizedMessage, exception); + } + } + +} diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml new file mode 100755 index 00000000..8acc0c12 --- /dev/null +++ b/android/app/src/main/res/values/strings.xml @@ -0,0 +1,16 @@ + + HMG Patient App + + + Unknown error: the Geofence service is not available now. + + + Geofence service is not available now. Go to Settings>Location>Mode and choose High accuracy. + + + Your app has registered too many geofences. + + + You have provided too many PendingIntents to the addGeofences() call. + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 71c11607..d8fd4e88 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -4,5 +4,4 @@ to allow setting breakpoints, to provide hot reload, etc. --> - diff --git a/android/gradle.properties b/android/gradle.properties index 9c0729c9..38c8d454 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,4 @@ - +org.gradle.jvmargs=-Xmx1536M android.enableR8=true android.useAndroidX=true android.enableJetifier=true -org.gradle.jvmargs=-Xmx4608m diff --git a/assets/images/appointment_booking.png b/assets/images/appointment_booking.png new file mode 100644 index 00000000..14db8d89 Binary files /dev/null and b/assets/images/appointment_booking.png differ diff --git a/assets/images/appointment_booking_en.png b/assets/images/appointment_booking_en.png new file mode 100644 index 00000000..14db8d89 Binary files /dev/null and b/assets/images/appointment_booking_en.png differ diff --git a/assets/images/book_appointment_ar.png b/assets/images/book_appointment_ar.png new file mode 100644 index 00000000..f0bc5aff Binary files /dev/null and b/assets/images/book_appointment_ar.png differ diff --git a/assets/images/book_appointment_arabic.png b/assets/images/book_appointment_arabic.png new file mode 100644 index 00000000..f0bc5aff Binary files /dev/null and b/assets/images/book_appointment_arabic.png differ diff --git a/assets/images/booking_ar.png b/assets/images/booking_ar.png new file mode 100644 index 00000000..b562f288 Binary files /dev/null and b/assets/images/booking_ar.png differ diff --git a/assets/images/booking_en.png b/assets/images/booking_en.png new file mode 100644 index 00000000..a3ffa8be Binary files /dev/null and b/assets/images/booking_en.png differ diff --git a/assets/images/check-in.png b/assets/images/check-in.png new file mode 100644 index 00000000..f6effbeb Binary files /dev/null and b/assets/images/check-in.png differ diff --git a/assets/images/comments.png b/assets/images/comments.png new file mode 100644 index 00000000..353edf4e Binary files /dev/null and b/assets/images/comments.png differ diff --git a/assets/images/device_icon.png b/assets/images/device_icon.png new file mode 100644 index 00000000..8ad55c09 Binary files /dev/null and b/assets/images/device_icon.png differ diff --git a/assets/images/vital_sign_icon.png b/assets/images/medical/vital_sign_icon.png similarity index 100% rename from assets/images/vital_sign_icon.png rename to assets/images/medical/vital_sign_icon.png diff --git a/assets/images/new-design/check-in.png b/assets/images/new-design/check-in.png index 8bed2242..f6effbeb 100644 Binary files a/assets/images/new-design/check-in.png and b/assets/images/new-design/check-in.png differ diff --git a/assets/images/new-design/empty_box.png b/assets/images/new-design/empty_box.png new file mode 100644 index 00000000..af3551fd Binary files /dev/null and b/assets/images/new-design/empty_box.png differ diff --git a/assets/images/new-design/liveCare_white_logo.svg b/assets/images/new-design/liveCare_white_logo.svg new file mode 100644 index 00000000..494b3671 --- /dev/null +++ b/assets/images/new-design/liveCare_white_logo.svg @@ -0,0 +1,40 @@ + + + + + + Online Consultation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new-design/livecare_arabic_logo.svg b/assets/images/new-design/livecare_arabic_logo.svg new file mode 100644 index 00000000..c524a803 --- /dev/null +++ b/assets/images/new-design/livecare_arabic_logo.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + استشارة مباشرة + + diff --git a/assets/images/new-design/livecare_white_logo.png b/assets/images/new-design/livecare_white_logo.png new file mode 100644 index 00000000..dc223965 Binary files /dev/null and b/assets/images/new-design/livecare_white_logo.png differ diff --git a/assets/images/no-data-found.png b/assets/images/no-data-found.png new file mode 100644 index 00000000..a4ced5d3 Binary files /dev/null and b/assets/images/no-data-found.png differ diff --git a/assets/images/online_payment_icon.png b/assets/images/online_payment_icon.png index a6e0150a..6e167ace 100644 Binary files a/assets/images/online_payment_icon.png and b/assets/images/online_payment_icon.png differ diff --git a/assets/images/powerd-by.jpg b/assets/images/powerd-by.jpg new file mode 100644 index 00000000..93bdbb18 Binary files /dev/null and b/assets/images/powerd-by.jpg differ diff --git a/assets/images/progress-loading-red.gif b/assets/images/progress-loading-red.gif new file mode 100644 index 00000000..517c3dab Binary files /dev/null and b/assets/images/progress-loading-red.gif differ diff --git a/help/.gitignore b/help/.gitignore new file mode 100644 index 00000000..9d532b18 --- /dev/null +++ b/help/.gitignore @@ -0,0 +1,41 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json diff --git a/help/.metadata b/help/.metadata new file mode 100644 index 00000000..107fcb7b --- /dev/null +++ b/help/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 8874f21e79d7ec66d0457c7ab338348e31b17f1d + channel: stable + +project_type: app diff --git a/help/README.md b/help/README.md new file mode 100644 index 00000000..4ac021c0 --- /dev/null +++ b/help/README.md @@ -0,0 +1,16 @@ +# help + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/help/android/.gitignore b/help/android/.gitignore new file mode 100644 index 00000000..0a741cb4 --- /dev/null +++ b/help/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/help/android/app/build.gradle b/help/android/app/build.gradle new file mode 100644 index 00000000..f44ed6c9 --- /dev/null +++ b/help/android/app/build.gradle @@ -0,0 +1,63 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 29 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.help" + minSdkVersion 16 + targetSdkVersion 29 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/help/android/app/src/debug/AndroidManifest.xml b/help/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000..fa2c5cd4 --- /dev/null +++ b/help/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/help/android/app/src/main/AndroidManifest.xml b/help/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..125d6242 --- /dev/null +++ b/help/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + diff --git a/help/android/app/src/main/kotlin/com/example/help/MainActivity.kt b/help/android/app/src/main/kotlin/com/example/help/MainActivity.kt new file mode 100644 index 00000000..75298a08 --- /dev/null +++ b/help/android/app/src/main/kotlin/com/example/help/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.help + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/help/android/app/src/main/res/drawable/launch_background.xml b/help/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000..304732f8 --- /dev/null +++ b/help/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/help/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..db77bb4b Binary files /dev/null and b/help/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/help/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..17987b79 Binary files /dev/null and b/help/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/help/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..09d43914 Binary files /dev/null and b/help/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/help/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..d5f1c8d3 Binary files /dev/null and b/help/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/help/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..4d6372ee Binary files /dev/null and b/help/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/help/android/app/src/main/res/values/styles.xml b/help/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..1f83a33f --- /dev/null +++ b/help/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/help/android/app/src/profile/AndroidManifest.xml b/help/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 00000000..fa2c5cd4 --- /dev/null +++ b/help/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/help/android/build.gradle b/help/android/build.gradle new file mode 100644 index 00000000..3100ad2d --- /dev/null +++ b/help/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.3.50' + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/help/android/gradle.properties b/help/android/gradle.properties new file mode 100644 index 00000000..94adc3a3 --- /dev/null +++ b/help/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/help/android/gradle/wrapper/gradle-wrapper.properties b/help/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..296b146b --- /dev/null +++ b/help/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/help/android/settings.gradle b/help/android/settings.gradle new file mode 100644 index 00000000..44e62bcf --- /dev/null +++ b/help/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/help/ios/.gitignore b/help/ios/.gitignore new file mode 100644 index 00000000..e96ef602 --- /dev/null +++ b/help/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/help/ios/Flutter/AppFrameworkInfo.plist b/help/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 00000000..f2872cf4 --- /dev/null +++ b/help/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 9.0 + + diff --git a/help/ios/Flutter/Debug.xcconfig b/help/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000..592ceee8 --- /dev/null +++ b/help/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/help/ios/Flutter/Release.xcconfig b/help/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000..592ceee8 --- /dev/null +++ b/help/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/help/ios/Runner.xcodeproj/project.pbxproj b/help/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..4f158fea --- /dev/null +++ b/help/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,495 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.help; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.help; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.help; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/help/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/help/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/help/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/help/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/help/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..a28140cf --- /dev/null +++ b/help/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/help/ios/Runner.xcworkspace/contents.xcworkspacedata b/help/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/help/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/help/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/help/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/help/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/help/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/help/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/help/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/help/ios/Runner/AppDelegate.swift b/help/ios/Runner/AppDelegate.swift new file mode 100644 index 00000000..70693e4a --- /dev/null +++ b/help/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d36b1fab --- /dev/null +++ b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 00000000..dc9ada47 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000..28c6bf03 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000..f091b6b0 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000..4cde1211 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000..d0ef06e7 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000..dcdc2306 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000..c8f9ed8f Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000..75b2d164 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000..c4df70d3 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000..6a84f41e Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 00000000..d0e1f585 Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/help/ios/Runner/Base.lproj/LaunchScreen.storyboard b/help/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..f2e259c7 --- /dev/null +++ b/help/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/help/ios/Runner/Base.lproj/Main.storyboard b/help/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000..f3c28516 --- /dev/null +++ b/help/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/help/ios/Runner/Info.plist b/help/ios/Runner/Info.plist new file mode 100644 index 00000000..fe4c8174 --- /dev/null +++ b/help/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + help + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/help/ios/Runner/Runner-Bridging-Header.h b/help/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000..308a2a56 --- /dev/null +++ b/help/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/help/lib/main.dart b/help/lib/main.dart new file mode 100644 index 00000000..11655b66 --- /dev/null +++ b/help/lib/main.dart @@ -0,0 +1,117 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or simply save your changes to "hot reload" in a Flutter IDE). + // Notice that the counter didn't reset back to zero; the application + // is not restarted. + primarySwatch: Colors.blue, + // This makes the visual density adapt to the platform that you run + // the app on. For desktop platforms, the controls will be smaller and + // closer together (more dense) than on mobile platforms. + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + MyHomePage({Key key, this.title}) : super(key: key); + + // This widget is the home page of your application. It is stateful, meaning + // that it has a State object (defined below) that contains fields that affect + // how it looks. + + // This class is the configuration for the state. It holds the values (in this + // case the title) provided by the parent (in this case the App widget) and + // used by the build method of the State. Fields in a Widget subclass are + // always marked "final". + + final String title; + + @override + _MyHomePageState createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + // This call to setState tells the Flutter framework that something has + // changed in this State, which causes it to rerun the build method below + // so that the display can reflect the updated values. If we changed + // _counter without calling setState(), then the build method would not be + // called again, and so nothing would appear to happen. + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + // This method is rerun every time setState is called, for instance as done + // by the _incrementCounter method above. + // + // The Flutter framework has been optimized to make rerunning build methods + // fast, so that you can just rebuild anything that needs updating rather + // than having to individually change instances of widgets. + return Scaffold( + appBar: AppBar( + // Here we take the value from the MyHomePage object that was created by + // the App.build method, and use it to set our appbar title. + title: Text(widget.title), + ), + body: Center( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + child: Column( + // Column is also a layout widget. It takes a list of children and + // arranges them vertically. By default, it sizes itself to fit its + // children horizontally, and tries to be as tall as its parent. + // + // Invoke "debug painting" (press "p" in the console, choose the + // "Toggle Debug Paint" action from the Flutter Inspector in Android + // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) + // to see the wireframe for each widget. + // + // Column has various properties to control how it sizes itself and + // how it positions its children. Here we use mainAxisAlignment to + // center the children vertically; the main axis here is the vertical + // axis because Columns are vertical (the cross axis would be + // horizontal). + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headline4, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/help/pubspec.yaml b/help/pubspec.yaml new file mode 100644 index 00000000..66af3d9e --- /dev/null +++ b/help/pubspec.yaml @@ -0,0 +1,76 @@ +name: help +description: A new Flutter project. + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 + +environment: + sdk: ">=2.7.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.0 + +dev_dependencies: + flutter_test: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/help/test/widget_test.dart b/help/test/widget_test.dart new file mode 100644 index 00000000..9ca1523f --- /dev/null +++ b/help/test/widget_test.dart @@ -0,0 +1,32 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../lib/main.dart'; + + + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/ios/.gitignore b/ios/.gitignore index e67828a4..04b5cf29 100644 --- a/ios/.gitignore +++ b/ios/.gitignore @@ -30,6 +30,4 @@ Runner/GeneratedPluginRegistrant.* !default.mode2v3 !default.pbxuser !default.perspectivev3 -/Runner.xcworkspace/contents.xcworkspacedata -/Runner.xcodeproj/project.pbxproj /Flutter/.last_build_id diff --git a/ios/Flutter/.last_build_id b/ios/Flutter/.last_build_id index 44c4b26c..b8024672 100644 --- a/ios/Flutter/.last_build_id +++ b/ios/Flutter/.last_build_id @@ -1 +1 @@ -da98d9f0c1f407e541c636e84847ac81 \ No newline at end of file +59a6c452ee075b50114918f17f1ad8f5 \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index c2702b3e..5579d926 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' + platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -39,8 +39,11 @@ target 'Runner' do use_frameworks! use_modular_headers! + # Native Pods + pod 'NVActivityIndicatorView' + + # Flutter Pod - copied_flutter_dir = File.join(__dir__, 'Flutter') copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 00000000..a09481c1 --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,455 @@ +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 + +COCOAPODS: 1.10.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..009006ed --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,697 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 813F9CBA7DD5ED63B28B8BB6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 767C165F7ABF3BF1F829B9BF /* Pods_Runner.framework */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538D256AAA6500E96549 /* GlobalHelper.swift */; }; + E91B5397256AAA6500E96549 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538E256AAA6500E96549 /* Extensions.swift */; }; + E91B5398256AAA6500E96549 /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538F256AAA6500E96549 /* API.swift */; }; + E91B539A256AAA6500E96549 /* MainFlutterVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B5392256AAA6500E96549 /* MainFlutterVC.swift */; }; + E91B539B256AAA6500E96549 /* HMG_Internet.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B5394256AAA6500E96549 /* HMG_Internet.swift */; }; + E91B539C256AAA6500E96549 /* HMG_GUEST_bkp.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B5395256AAA6500E96549 /* HMG_GUEST_bkp.swift */; }; + E91B539F256AAC1400E96549 /* GuestPOC_Certificate.p12 in Resources */ = {isa = PBXBuildFile; fileRef = E91B539D256AAC1400E96549 /* GuestPOC_Certificate.p12 */; }; + E91B53A0256AAC1400E96549 /* GuestPOC_Certificate.cer in Resources */ = {isa = PBXBuildFile; fileRef = E91B539E256AAC1400E96549 /* GuestPOC_Certificate.cer */; }; + E91B53A3256AAD8200E96549 /* Main_Custom.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E91B53A1256AAD8200E96549 /* Main_Custom.storyboard */; }; + E923EFD225863FDF00E3E751 /* GeoZoneModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */; }; + E923EFD4258645C100E3E751 /* HMG_Geofence.swift in Sources */ = {isa = PBXBuildFile; fileRef = E923EFD3258645C100E3E751 /* HMG_Geofence.swift */; }; + 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 */; }; + E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */; }; + E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 308FEC658188F7D588BE7580 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 767C165F7ABF3BF1F829B9BF /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 969F0CEC868FD7C196987A3E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DCFFD369041FFFFA94CF7B26 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + E91B538D256AAA6500E96549 /* GlobalHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlobalHelper.swift; sourceTree = ""; }; + E91B538E256AAA6500E96549 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + E91B538F256AAA6500E96549 /* API.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = API.swift; sourceTree = ""; }; + E91B5392256AAA6500E96549 /* MainFlutterVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainFlutterVC.swift; sourceTree = ""; }; + E91B5394256AAA6500E96549 /* HMG_Internet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMG_Internet.swift; sourceTree = ""; }; + E91B5395256AAA6500E96549 /* HMG_GUEST_bkp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMG_GUEST_bkp.swift; sourceTree = ""; }; + E91B539D256AAC1400E96549 /* GuestPOC_Certificate.p12 */ = {isa = PBXFileReference; lastKnownFileType = file; path = GuestPOC_Certificate.p12; sourceTree = ""; }; + E91B539E256AAC1400E96549 /* GuestPOC_Certificate.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = GuestPOC_Certificate.cer; sourceTree = ""; }; + E91B53A2256AAD8200E96549 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_Custom.storyboard; sourceTree = ""; }; + E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeoZoneModel.swift; sourceTree = ""; }; + E923EFD3258645C100E3E751 /* HMG_Geofence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMG_Geofence.swift; sourceTree = ""; }; + E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMGPlatformBridge.swift; sourceTree = ""; }; + 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; }; + 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 = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 813F9CBA7DD5ED63B28B8BB6 /* Pods_Runner.framework in Frameworks */, + E9620805255C2ED100D3A35D /* NetworkExtension.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 555EAAA626EFB641859EF0BE /* Frameworks */ = { + isa = PBXGroup; + children = ( + E9620804255C2ED100D3A35D /* NetworkExtension.framework */, + 767C165F7ABF3BF1F829B9BF /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 605039E5DDF72C245F9765FE /* Pods */ = { + isa = PBXGroup; + children = ( + DCFFD369041FFFFA94CF7B26 /* Pods-Runner.debug.xcconfig */, + 969F0CEC868FD7C196987A3E /* Pods-Runner.release.xcconfig */, + 308FEC658188F7D588BE7580 /* Pods-Runner.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + E923EFD72588D17700E3E751 /* gpx.gpx */, + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 605039E5DDF72C245F9765FE /* Pods */, + 555EAAA626EFB641859EF0BE /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + E91B539E256AAC1400E96549 /* GuestPOC_Certificate.cer */, + E91B539D256AAC1400E96549 /* GuestPOC_Certificate.p12 */, + E91B5390256AAA6500E96549 /* Controllers */, + E91B538C256AAA6500E96549 /* Helper */, + E91B5393256AAA6500E96549 /* WifiConnect */, + E9620803255C2ED100D3A35D /* Runner.entitlements */, + E91B53A1256AAD8200E96549 /* Main_Custom.storyboard */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + E91B538C256AAA6500E96549 /* Helper */ = { + isa = PBXGroup; + children = ( + E91B538D256AAA6500E96549 /* GlobalHelper.swift */, + E91B538E256AAA6500E96549 /* Extensions.swift */, + E91B538F256AAA6500E96549 /* API.swift */, + E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */, + E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */, + E923EFD3258645C100E3E751 /* HMG_Geofence.swift */, + E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */, + ); + path = Helper; + sourceTree = ""; + }; + E91B5390256AAA6500E96549 /* Controllers */ = { + isa = PBXGroup; + children = ( + E91B5392256AAA6500E96549 /* MainFlutterVC.swift */, + ); + path = Controllers; + sourceTree = ""; + }; + E91B5393256AAA6500E96549 /* WifiConnect */ = { + isa = PBXGroup; + children = ( + E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */, + E91B5394256AAA6500E96549 /* HMG_Internet.swift */, + E91B5395256AAA6500E96549 /* HMG_GUEST_bkp.swift */, + ); + path = WifiConnect; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 299B8FE131E5BAE7FA7E2FC9 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 125A739F71A29FBAE7B4D5AC /* [CP] Embed Pods Frameworks */, + 940F4A376A48B060117A1E5D /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E91B53A0256AAC1400E96549 /* GuestPOC_Certificate.cer in Resources */, + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + E923EFD82588D17700E3E751 /* gpx.gpx in Resources */, + E91B539F256AAC1400E96549 /* GuestPOC_Certificate.p12 in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + E91B53A3256AAD8200E96549 /* Main_Custom.storyboard in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* 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; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 940F4A376A48B060117A1E5D /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E923EFD225863FDF00E3E751 /* GeoZoneModel.swift in Sources */, + E91B539A256AAA6500E96549 /* MainFlutterVC.swift in Sources */, + E91B539C256AAA6500E96549 /* HMG_GUEST_bkp.swift in Sources */, + E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */, + E923EFD4258645C100E3E751 /* HMG_Geofence.swift in Sources */, + E923EFD62587443800E3E751 /* HMGPlatformBridge.swift in Sources */, + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */, + E91B539B256AAA6500E96549 /* HMG_Internet.swift in Sources */, + E91B5397256AAA6500E96549 /* Extensions.swift in Sources */, + E91B5398256AAA6500E96549 /* API.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; + E91B53A1256AAD8200E96549 /* Main_Custom.storyboard */ = { + isa = PBXVariantGroup; + children = ( + E91B53A2256AAD8200E96549 /* Base */, + ); + name = Main_Custom.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140cf..fb2dffc4 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -27,8 +27,6 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + + - - + + + + + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 23dd69b8..e686619c 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -2,14 +2,46 @@ import UIKit import Flutter import GoogleMaps + @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - GMSServices.provideAPIKey("AIzaSyCiiJiHkocPbcziHt9O8rGWavDrxHRQys8") - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) + let locationManager = CLLocationManager() + + 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) + } + + if let _ = launchOptions?[.location] { + HMG_Geofence.initGeofencing() + } + + 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 locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) { + if region is CLCircularRegion { + } + } + + func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) { + if region is CLCircularRegion { + } } } diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard index 00abc512..8ae1ba59 100644 --- a/ios/Runner/Base.lproj/Main.storyboard +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -1,16 +1,16 @@ - + - + - + - + diff --git a/ios/Runner/Base.lproj/Main_Custom.storyboard b/ios/Runner/Base.lproj/Main_Custom.storyboard new file mode 100644 index 00000000..de2d580c --- /dev/null +++ b/ios/Runner/Base.lproj/Main_Custom.storyboard @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Controllers/MainFlutterVC.swift b/ios/Runner/Controllers/MainFlutterVC.swift new file mode 100644 index 00000000..4f91d052 --- /dev/null +++ b/ios/Runner/Controllers/MainFlutterVC.swift @@ -0,0 +1,118 @@ +// +// MainFlutterVC.swift +// Runner +// +// Created by ZiKambrani on 25/03/1442 AH. +// + +import UIKit +import Flutter +import NetworkExtension +import SystemConfiguration.CaptiveNetwork + +class MainFlutterVC: FlutterViewController { + + override func viewDidLoad() { + super.viewDidLoad() + +// flutterMethodChannel?.setMethodCallHandler { (methodCall, result) in +// +// if methodCall.method == "connectHMGInternetWifi"{ +// self.connectHMGInternetWifi(methodCall:methodCall, result: result) +// +// }else if methodCall.method == "connectHMGGuestWifi"{ +// self.connectHMGGuestWifi(methodCall:methodCall, result: result) +// +// }else if methodCall.method == "isHMGNetworkAvailable"{ +// self.isHMGNetworkAvailable(methodCall:methodCall, result: result) +// +// }else if methodCall.method == "registerHmgGeofences"{ +// self.registerHmgGeofences(result: result) +// } +// +// print("") +// } +// +// FlutterText.with(key: "errorConnectingHmgNetwork") { (localized) in +// print(localized) +// } + + } + + + // Connect HMG Wifi and Internet + func connectHMGInternetWifi(methodCall:FlutterMethodCall ,result: @escaping FlutterResult){ + + guard let pateintId = (methodCall.arguments as? [Any])?.first as? String + else { return assert(true, "Missing or invalid arguments (Must have one argument 'String at 0'") } + + + HMG_Internet.shared.connect(patientId: pateintId) { (status, message) in + result(status ? 1 : 0) + if status{ + self.showMessage(title:"Congratulations", message:message) + }else{ + self.showMessage(title:"Ooops,", message:message) + } + } + } + + // Connect HMG-Guest for App Access + func connectHMGGuestWifi(methodCall:FlutterMethodCall ,result: @escaping FlutterResult){ + HMG_GUEST.shared.connect() { (status, message) in + result(status ? 1 : 0) + if status{ + self.showMessage(title:"Congratulations", message:message) + }else{ + self.showMessage(title:"Ooops,", message:message) + } + } + } + + func isHMGNetworkAvailable(methodCall:FlutterMethodCall ,result: @escaping FlutterResult) -> Bool{ + guard let ssid = methodCall.arguments as? String else { + assert(true, "Missing or invalid arguments (Must have one argument 'String at 0'") + return false + } + + let queue = DispatchQueue.init(label: "com.hmg.wifilist") + NEHotspotHelper.register(options: nil, queue: queue) { (command) in + print(command) + + if(command.commandType == NEHotspotHelperCommandType.filterScanList) { + if let networkList = command.networkList{ + for network in networkList{ + print(network.ssid) + } + } + } + } + return false + + } + + + // Message Dailog + func showMessage(title:String, message:String){ + DispatchQueue.main.async { + let alert = UIAlertController(title: title, message: message, preferredStyle: .alert ) + alert.addAction(UIAlertAction(title: "OK", style: .destructive, handler: nil)) + self.present(alert, animated: true) { + + } + } + } + + // Register Geofence + func registerHmgGeofences(result: @escaping FlutterResult){ + flutterMethodChannel?.invokeMethod("getGeofencePreferenceKey", arguments: nil){ geoFencesJsonString in + if let jsonString = geoFencesJsonString as? String{ + let allZones = GeoZoneModel.list(from: jsonString) + HMG_Geofence().register(geoZones: allZones) + + }else{ + } + } + } + +} diff --git a/ios/Runner/GuestPOC_Certificate.cer b/ios/Runner/GuestPOC_Certificate.cer new file mode 100644 index 00000000..f3804f6e Binary files /dev/null and b/ios/Runner/GuestPOC_Certificate.cer differ diff --git a/ios/Runner/GuestPOC_Certificate.p12 b/ios/Runner/GuestPOC_Certificate.p12 new file mode 100644 index 00000000..8e289212 Binary files /dev/null and b/ios/Runner/GuestPOC_Certificate.p12 differ diff --git a/ios/Runner/Helper/API.swift b/ios/Runner/Helper/API.swift new file mode 100644 index 00000000..763147c8 --- /dev/null +++ b/ios/Runner/Helper/API.swift @@ -0,0 +1,17 @@ +// +// API.swift +// Runner +// +// Created by ZiKambrani on 04/04/1442 AH. +// + +import UIKit + +fileprivate let DOMAIN = "https://uat.hmgwebservices.com" +fileprivate let SERVICE = "Services/Patients.svc/REST" +fileprivate let BASE_URL = "\(DOMAIN)/\(SERVICE)" + +struct API { + static let WIFI_CREDENTIALS = "\(BASE_URL)/Hmg_SMS_Get_By_ProjectID_And_PatientID" + +} diff --git a/ios/Runner/Helper/Extensions.swift b/ios/Runner/Helper/Extensions.swift new file mode 100644 index 00000000..a8793617 --- /dev/null +++ b/ios/Runner/Helper/Extensions.swift @@ -0,0 +1,132 @@ +// +// Extensions.swift +// Runner +// +// Created by ZiKambrani on 04/04/1442 AH. +// + +import UIKit + + +extension String{ + func toUrl() -> URL?{ + return URL(string: self) + } + + func removeSpace() -> String?{ + return self.replacingOccurrences(of: " ", with: "") + } +} + +extension Bundle { + + func certificate(named name: String) -> SecCertificate { + let cerURL = self.url(forResource: name, withExtension: "cer")! + let cerData = try! Data(contentsOf: cerURL) + let cer = SecCertificateCreateWithData(nil, cerData as CFData)! + return cer + } + + func identity(named name: String, password: String) -> SecIdentity { + let p12URL = self.url(forResource: name, withExtension: "p12")! + let p12Data = try! Data(contentsOf: p12URL) + + var importedCF: CFArray? = nil + let options = [kSecImportExportPassphrase as String: password] + let err = SecPKCS12Import(p12Data as CFData, options as CFDictionary, &importedCF) + precondition(err == errSecSuccess) + let imported = importedCF! as NSArray as! [[String:AnyObject]] + precondition(imported.count == 1) + + return (imported[0][kSecImportItemIdentity as String]!) as! SecIdentity + } + + +} + +extension SecCertificate{ + func trust() -> Bool?{ + var optionalTrust: SecTrust? + let policy = SecPolicyCreateBasicX509() + + let status = SecTrustCreateWithCertificates([self] as AnyObject, + policy, + &optionalTrust) + guard status == errSecSuccess else { return false} + let trust = optionalTrust! + + let stat = optionalTrust?.evaluateAllowing(rootCertificates: [self]) + return stat + } + + func secTrustObject() -> SecTrust?{ + var optionalTrust: SecTrust? + let policy = SecPolicyCreateBasicX509() + + let status = SecTrustCreateWithCertificates([self] as AnyObject, + policy, + &optionalTrust) + return optionalTrust + } +} + + +extension SecTrust { + + func evaluate() -> Bool { + var trustResult: SecTrustResultType = .invalid + let err = SecTrustEvaluate(self, &trustResult) + guard err == errSecSuccess else { return false } + return [.proceed, .unspecified].contains(trustResult) + } + + func evaluateAllowing(rootCertificates: [SecCertificate]) -> Bool { + + // Apply our custom root to the trust object. + + var err = SecTrustSetAnchorCertificates(self, rootCertificates as CFArray) + guard err == errSecSuccess else { return false } + + // Re-enable the system's built-in root certificates. + + err = SecTrustSetAnchorCertificatesOnly(self, false) + guard err == errSecSuccess else { return false } + + // Run a trust evaluation and only allow the connection if it succeeds. + + return self.evaluate() + } +} + + +extension UIView{ + func show(){ + self.alpha = 0.0 + self.isHidden = false + UIView.animate(withDuration: 0.25, animations: { + self.alpha = 1 + }) { (complete) in + + } + } + + func hide(){ + UIView.animate(withDuration: 0.25, animations: { + self.alpha = 0.0 + }) { (complete) in + self.isHidden = true + } + } +} + + +extension UIViewController{ + func showAlert(withTitle: String, message: String){ + let alert = UIAlertController(title: withTitle, message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .destructive, handler: nil)) + present(alert, animated: true) { + + } + } +} + diff --git a/ios/Runner/Helper/GeoZoneModel.swift b/ios/Runner/Helper/GeoZoneModel.swift new file mode 100644 index 00000000..e703b64c --- /dev/null +++ b/ios/Runner/Helper/GeoZoneModel.swift @@ -0,0 +1,67 @@ +// +// GeoZoneModel.swift +// Runner +// +// Created by ZiKambrani on 13/12/2020. +// + +import UIKit +import CoreLocation + +class GeoZoneModel{ + var geofenceId:Int = -1 + var description:String = "" + var descriptionN:String? + var latitude:String? + var longitude:String? + var radius:Int? + var type:Int? + var projectID:Int? + var imageURL:String? + var isCity:String? + + func identifier() -> String{ + return "\(geofenceId)_hmg" + } + + func message() -> String{ + return description + } + + func toRegion(locationManager:CLLocationManager) -> CLCircularRegion?{ + if let rad = radius, let lat = latitude?.removeSpace(), let long = longitude?.removeSpace(), + let radius_d = Double("\(rad)"), let lat_d = Double(lat), let long_d = Double(long){ + + let coordinate = CLLocationCoordinate2D(latitude: lat_d, longitude: long_d) + let validatedRadius = min(radius_d, locationManager.maximumRegionMonitoringDistance) + + let region = CLCircularRegion(center: coordinate, radius: validatedRadius, identifier: identifier()) + region.notifyOnExit = true + region.notifyOnEntry = true + return region + } + return nil + } + + class func from(json:[String:Any]) -> GeoZoneModel{ + let model = GeoZoneModel() + model.geofenceId = json["GEOF_ID"] as? Int ?? 0 + model.radius = json["Radius"] as? Int + model.projectID = json["ProjectID"] as? Int + model.type = json["Type"] as? Int + model.description = json["Description"] as? String ?? "" + model.descriptionN = json["DescriptionN"] as? String + model.latitude = json["Latitude"] as? String + model.longitude = json["Longitude"] as? String + model.imageURL = json["ImageURL"] as? String + model.isCity = json["IsCity"] as? String + + return model + } + + class func list(from jsonString:String) -> [GeoZoneModel]{ + let value = dictionaryArray(from: jsonString) + let geoZones = value.map { GeoZoneModel.from(json: $0) } + return geoZones + } +} diff --git a/ios/Runner/Helper/GlobalHelper.swift b/ios/Runner/Helper/GlobalHelper.swift new file mode 100644 index 00000000..c5eb7295 --- /dev/null +++ b/ios/Runner/Helper/GlobalHelper.swift @@ -0,0 +1,85 @@ +// +// GlobalHelper.swift +// Runner +// +// Created by ZiKambrani on 29/03/1442 AH. +// + +import UIKit + +func dictionaryArray(from:String) -> [[String:Any]]{ + if let data = from.data(using: .utf8) { + do { + return try JSONSerialization.jsonObject(with: data, options: []) as? [[String: Any]] ?? [] + } catch { + print(error.localizedDescription) + } + } + return [] + +} + +func dictionary(from:String) -> [String:Any]?{ + if let data = from.data(using: .utf8) { + do { + return try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] + } catch { + print(error.localizedDescription) + } + } + return nil + +} + +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)") + } + } +} + + +func httpPostRequest(urlString:String, jsonBody:[String:Any], completion:((Bool,[String:Any]?)->Void)?){ + let json: [String: Any] = jsonBody + let jsonData = try? JSONSerialization.data(withJSONObject: json) + + // create post request + let url = URL(string: urlString)! + var request = URLRequest(url: url) + request.addValue("application/json", forHTTPHeaderField: "Content-Type") + request.addValue("*/*", forHTTPHeaderField: "Accept") + request.httpMethod = "POST" + request.httpBody = jsonData + + let task = URLSession.shared.dataTask(with: request) { data, response, error in + guard let data = data, error == nil else { + print(error?.localizedDescription ?? "No data") + return + } + + let responseJSON = try? JSONSerialization.jsonObject(with: data, options: []) + if let responseJSON = responseJSON as? [String: Any], let status = responseJSON["MessageStatus"] as? Int{ + print(responseJSON) + if status == 1{ + completion?(true,responseJSON) + }else{ + completion?(false,responseJSON) + } + + } + } + + task.resume() + +} diff --git a/ios/Runner/Helper/HMGPlatformBridge.swift b/ios/Runner/Helper/HMGPlatformBridge.swift new file mode 100644 index 00000000..f897188c --- /dev/null +++ b/ios/Runner/Helper/HMGPlatformBridge.swift @@ -0,0 +1,137 @@ +// +// HMGPlatformBridge.swift +// Runner +// +// Created by ZiKambrani on 14/12/2020. +// + +import UIKit +import NetworkExtension +import SystemConfiguration.CaptiveNetwork + +var flutterMethodChannel:FlutterMethodChannel? = nil +var mainViewController:MainFlutterVC! + +class HMGPlatformBridge{ + private let channelName = "HMG-Platform-Bridge" + private static var shared_:HMGPlatformBridge? + + class func initialize(flutterViewController:MainFlutterVC){ + shared_ = HMGPlatformBridge() + mainViewController = flutterViewController + shared_?.openChannel() + } + + func shared() -> HMGPlatformBridge{ + assert((HMGPlatformBridge.shared_ != nil), "HMGPlatformBridge is not initialized, call initialize(mainViewController:MainFlutterVC) function first.") + return HMGPlatformBridge.shared_! + } + + private func openChannel(){ + flutterMethodChannel = FlutterMethodChannel(name: channelName, binaryMessenger: mainViewController.binaryMessenger) + flutterMethodChannel?.setMethodCallHandler { (methodCall, result) in + print("Called function \(methodCall.method)") + if methodCall.method == "connectHMGInternetWifi"{ + self.connectHMGInternetWifi(methodCall:methodCall, result: result) + + }else if methodCall.method == "connectHMGGuestWifi"{ + self.connectHMGGuestWifi(methodCall:methodCall, result: result) + + }else if methodCall.method == "isHMGNetworkAvailable"{ + self.isHMGNetworkAvailable(methodCall:methodCall, result: result) + + }else if methodCall.method == "registerHmgGeofences"{ + self.registerHmgGeofences(result: result) + + }else if methodCall.method == "unRegisterHmgGeofences"{ + self.unRegisterHmgGeofences(result: result) + } + + print("") + } + } + + + + // Connect HMG Wifi and Internet + func connectHMGInternetWifi(methodCall:FlutterMethodCall ,result: @escaping FlutterResult){ + + guard let pateintId = (methodCall.arguments as? [Any])?.first as? String + else { return assert(true, "Missing or invalid arguments (Must have one argument 'String at 0'") } + + + HMG_Internet.shared.connect(patientId: pateintId) { (status, message) in + result(status ? 1 : 0) + if status{ + self.showMessage(title:"Congratulations", message:message) + }else{ + self.showMessage(title:"Ooops,", message:message) + } + } + } + + // Connect HMG-Guest for App Access + func connectHMGGuestWifi(methodCall:FlutterMethodCall ,result: @escaping FlutterResult){ + HMG_GUEST.shared.connect() { (status, message) in + result(status ? 1 : 0) + if status{ + self.showMessage(title:"Congratulations", message:message) + }else{ + self.showMessage(title:"Ooops,", message:message) + } + } + } + + func isHMGNetworkAvailable(methodCall:FlutterMethodCall ,result: @escaping FlutterResult) -> Bool{ + guard let ssid = methodCall.arguments as? String else { + assert(true, "Missing or invalid arguments (Must have one argument 'String at 0'") + return false + } + + let queue = DispatchQueue.init(label: "com.hmg.wifilist") + NEHotspotHelper.register(options: nil, queue: queue) { (command) in + print(command) + + if(command.commandType == NEHotspotHelperCommandType.filterScanList) { + if let networkList = command.networkList{ + for network in networkList{ + print(network.ssid) + } + } + } + } + return false + + } + + + // Message Dailog + func showMessage(title:String, message:String){ + DispatchQueue.main.async { + let alert = UIAlertController(title: title, message: message, preferredStyle: .alert ) + alert.addAction(UIAlertAction(title: "OK", style: .destructive, handler: nil)) + mainViewController.present(alert, animated: true) { + + } + } + } + + // Register Geofence + func registerHmgGeofences(result: @escaping FlutterResult){ + flutterMethodChannel?.invokeMethod("getGeoZones", arguments: nil){ geoFencesJsonString in + if let jsonString = geoFencesJsonString as? String{ + let allZones = GeoZoneModel.list(from: jsonString) + HMG_Geofence.shared().register(geoZones: allZones) + result(true) + }else{ + } + } + } + + // Register Geofence + func unRegisterHmgGeofences(result: @escaping FlutterResult){ + HMG_Geofence.shared().unRegisterAll() + result(true) + } + +} diff --git a/ios/Runner/Helper/HMG_Geofence.swift b/ios/Runner/Helper/HMG_Geofence.swift new file mode 100644 index 00000000..fb469165 --- /dev/null +++ b/ios/Runner/Helper/HMG_Geofence.swift @@ -0,0 +1,189 @@ +// +// HMG_Geofence.swift +// Runner +// +// Created by ZiKambrani on 13/12/2020. +// + +import UIKit +import CoreLocation + +fileprivate var df = DateFormatter() +fileprivate var transition = "" + +enum Transition:Int { + case entry = 1 + case exit = 2 + func name() -> String{ + return self.rawValue == 1 ? "Enter" : "Exit" + } +} + +class HMG_Geofence:NSObject{ + + var geoZones:[GeoZoneModel]? + var locationManager:CLLocationManager!{ + didSet{ + // https://developer.apple.com/documentation/corelocation/cllocationmanager/1423531-startmonitoringsignificantlocati + + locationManager.allowsBackgroundLocationUpdates = true + locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters + locationManager.activityType = .other + locationManager.delegate = self + locationManager.requestAlwaysAuthorization() + // locationManager.distanceFilter = 500 + // locationManager.startMonitoringSignificantLocationChanges() + } + } + + private static var shared_:HMG_Geofence? + class func shared() -> HMG_Geofence{ + if HMG_Geofence.shared_ == nil{ + HMG_Geofence.initGeofencing() + } + return shared_! + } + + class func initGeofencing(){ + shared_ = HMG_Geofence() + shared_?.locationManager = CLLocationManager() + } + + func register(geoZones:[GeoZoneModel]){ + + self.geoZones = geoZones + + let monitoredRegions_ = monitoredRegions() + self.geoZones?.forEach({ (zone) in + if let region = zone.toRegion(locationManager: locationManager){ + if let already = monitoredRegions_.first(where: {$0.identifier == zone.identifier()}){ + debugPrint("Already monitering region: \(already)") + }else{ + startMonitoring(region: region) + } + }else{ + debugPrint("Invalid region: \(zone.latitude ?? "invalid_latitude"),\(zone.longitude ?? "invalid_longitude"),r\(zone.radius ?? 0) | \(zone.identifier())") + } + }) + } + + func monitoredRegions() -> Set{ + return locationManager.monitoredRegions + } + + func unRegisterAll(){ + for region in locationManager.monitoredRegions { + locationManager.stopMonitoring(for: region) + } + } + +} + +// CLLocationManager Delegates +extension HMG_Geofence : CLLocationManagerDelegate{ + + func startMonitoring(region: CLCircularRegion) { + if !CLLocationManager.isMonitoringAvailable(for: CLCircularRegion.self) { + return + } + + if CLLocationManager.authorizationStatus() != .authorizedAlways { + let message = """ + Your geotification is saved but will only be activated once you grant + HMG permission to access the device location. + """ + debugPrint(message) + } + + locationManager.startMonitoring(for: region) + locationManager.requestState(for: region) + debugPrint("Starts monitering region: \(region)") + } + + func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) { + debugPrint("didEnterRegion: \(region)") + if region is CLCircularRegion { + handleEvent(for: region,transition: .entry, location: manager.location) + } + } + + func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) { + debugPrint("didExitRegion: \(region)") + if region is CLCircularRegion { + handleEvent(for: region,transition: .exit, location: manager.location) + } + } + + func locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion) { + debugPrint("didDetermineState: \(state)") + } + + func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { + debugPrint("didUpdateLocations: \(locations)") + } + + +} + +// Helpers +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) + } + + func geoZone(by id: String) -> GeoZoneModel? { + var zone:GeoZoneModel? = nil + if let zones_ = geoZones{ + zone = zones_.first(where: { $0.identifier() == id}) + }else{ + // let jsonArray = UserDefaults.standard.string(forKey: "hmg-geo-fences") + } + return zone + } + + + 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 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{ + + if let idString = forRegion.identifier.split(separator: "_").first, let idInt = Int(idString){ + let body:[String:Any] = [ + "PointsID":idInt, + "GeoType":transition.rawValue, + "PatientID":patientId + ] + + 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" + 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") + + } + } + } + } +} + diff --git a/ios/Runner/Helper/LocalizedFromFlutter.swift b/ios/Runner/Helper/LocalizedFromFlutter.swift new file mode 100644 index 00000000..88530649 --- /dev/null +++ b/ios/Runner/Helper/LocalizedFromFlutter.swift @@ -0,0 +1,22 @@ +// +// LocalizedFromFlutter.swift +// Runner +// +// Created by ZiKambrani on 10/04/1442 AH. +// + +import UIKit + +class FlutterText{ + + class func with(key:String,completion: @escaping (String)->Void){ + flutterMethodChannel?.invokeMethod("localizedValue", arguments: key, result: { (result) in + if let localized = result as? String{ + completion(localized) + }else{ + completion(key) + } + }) + } + +} diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index b807d9c6..ae084167 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -22,22 +22,38 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS - io.flutter.embedded_views_preview - + NSCalendarsUsageDescription + We need access to record you event in to calender. + NSCameraUsageDescription + Need camera access for uploading images + NSLocationAlwaysAndWhenInUseUsageDescription + This app will use your location to show cool stuffs near you. + NSLocationAlwaysUsageDescription + This app will use your location to show cool stuffs near you. + NSLocationUsageDescription + Need location access for updating nearby friends + NSLocationWhenInUseUsageDescription + This app will use your location to show cool stuffs near you. + NSMicrophoneUsageDescription + Need microphone access for uploading videos + NSPhotoLibraryUsageDescription + Need photo library access for uploading images + UIBackgroundModes + + fetch + location + processing + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main - NSMicrophoneUsageDescription - Need microphone access for uploading videos - NSCameraUsageDescription - Need camera access for uploading images - NSLocationUsageDescription - Need location access for updating nearby friends - NSLocationWhenInUseUsageDescription - This app will use your location to show cool stuffs near you. - NSPhotoLibraryUsageDescription - Need photo library access for uploading images + UIRequiredDeviceCapabilities + + location-services + gps + armv7 + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait @@ -53,5 +69,7 @@ UIViewControllerBasedStatusBarAppearance + io.flutter.embedded_views_preview + diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 903def2a..be2e0283 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -2,7 +2,13 @@ + + aps-environment development + com.apple.developer.networking.HotspotConfiguration + + com.apple.developer.networking.wifi-info + diff --git a/ios/Runner/WifiConnect/HMG_GUEST.swift b/ios/Runner/WifiConnect/HMG_GUEST.swift new file mode 100644 index 00000000..ad6d3922 --- /dev/null +++ b/ios/Runner/WifiConnect/HMG_GUEST.swift @@ -0,0 +1,77 @@ +// +// HMG_GUEST.swift +// HMG-iOS-Wifi +// +// Created by ZiKambrani on 23/03/1442 AH. +// Copyright © 1442 ZiKambrani. All rights reserved. +// + +import UIKit +import NetworkExtension +import SystemConfiguration.CaptiveNetwork + +fileprivate let SSID = "HMG-MobileApp" + +class HMG_GUEST{ + static let shared = HMG_GUEST() + + private var complete:((_ status:Bool, _ message:String) -> Void)! + func connect(completion:@escaping ((_ status:Bool, _ message:String) -> Void)){ + complete = completion + + if isAlreadyConnected() { + FlutterText.with(key: "alreadyConnectedHmgNetwork") { (localized) in + self.complete(true, localized ) + } + }else{ + connect() + } + } + + private func connect() { + + let hotspotConfig = NEHotspotConfiguration(ssid: "\(SSID)") + hotspotConfig.joinOnce = false + NEHotspotConfigurationManager.shared.apply(hotspotConfig) {[weak self] (error) in + guard let self = self else { return; } + + if let error = error { + FlutterText.with(key: "errorConnectingHmgNetwork") { (localized) in + self.complete(false, localized ) + } + }else{ + _ = Timer.scheduledTimer(withTimeInterval: 10, repeats: false) { (timer) in + let connected = self.isAlreadyConnected() + let message = connected ? "successConnectingHmgNetwork" : "failedConnectingHmgNetwork" + FlutterText.with(key: message) { (localized) in + self.complete(false, localized ) + } + } + } + } + + +// NSMutableURLRequest(url: URL(string: "www.google.com")!).bind(to: command) +// NEHotspotHelper.register(options: [:], queue: DispatchQueue.global()) { (command) in +// command +// print(command) +// } + + } + + private func isAlreadyConnected() -> Bool{ + var currentSSID: String? + if let interfaces = CNCopySupportedInterfaces() as NSArray? { + for interface in interfaces { + if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? { + currentSSID = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String + break + } + } + } + + print("CurrentConnectedSSID: \(currentSSID)") + return currentSSID == SSID + } + +} diff --git a/ios/Runner/WifiConnect/HMG_GUEST_bkp.swift b/ios/Runner/WifiConnect/HMG_GUEST_bkp.swift new file mode 100644 index 00000000..e3dfd468 --- /dev/null +++ b/ios/Runner/WifiConnect/HMG_GUEST_bkp.swift @@ -0,0 +1,129 @@ +//// +//// HMG_GUEST.swift +//// HMG-iOS-Wifi +//// +//// Created by ZiKambrani on 23/03/1442 AH. +//// Copyright © 1442 ZiKambrani. All rights reserved. +//// +// +//import UIKit +//import NetworkExtension +//import SystemConfiguration.CaptiveNetwork +// +// +//class HMG_GUEST{ +// static let shared = HMG_GUEST() +// private let SSID = "GUEST-POC" +// private let USER = "1301" +// private let PASS = "8928" +// +// var complete:((_ status:Bool, _ message:String) -> Void)! +// func connect(completion:@escaping ((_ status:Bool, _ message:String) -> Void)){ +// complete = completion +// +// if isAlreadyConnected() { +// hasInternet { (has) in +// if has == true{ +// self.complete(true, "You already connected to internet") +// return +// }else{ +// self.authenticate() +// } +// } +// }else{ +// connect() +// } +// } +// +// private func connect() { +// let hotspotConfig = NEHotspotConfiguration(ssid: SSID) +// hotspotConfig.joinOnce = true +// +// NEHotspotConfigurationManager.shared.apply(hotspotConfig) {[weak self] (error) in +// guard let self = self else { return; } +// +// if let error = error { +// self.complete(false, error.localizedDescription ?? "Error connecting to HMG wifi network" ) +// }else{ +// _ = Timer.scheduledTimer(withTimeInterval: 2, repeats: false) { (timer) in +// self.authenticate() +// } +// } +// } +// } +// +// func authenticate(){ +// +// func callLogin(){ +// +// let parameters = "Login=Log%20In&cmd=authenticate&password=1820&user=2300" +// let postData = parameters.data(using: .utf8) +// +// var request = URLRequest(url: URL(string: "https://captiveportal-login.hmg.com/cgi-bin/login")!,timeoutInterval: 5) +// request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") +// +// request.httpMethod = "POST" +// request.httpBody = postData +// +// let task = URLSession.shared.dataTask(with: request) { data, response, error in +// // guard let data = data else { +// // self.complete(false, "Error at authentication") +// // return +// // } +// +// self.hasInternet { (has) in +// self.complete(has, has ? "Successfully connected to the internet" : "Authentication failed or you are already using your credentials on another device") +// } +// } +// task.resume() +// +// } +// +// self.hasInternet { (has) in +// if has == true{ +// self.complete(true, "Your internet account is already authenticated") +// }else{ +// callLogin() +// } +// } +// +// } +// +// private func isAlreadyConnected() -> Bool{ +// var currentSSID: String? +// if let interfaces = CNCopySupportedInterfaces() as NSArray? { +// for interface in interfaces { +// if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? { +// currentSSID = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String +// break +// } +// } +// } +// +// print("CurrentConnectedSSID: \(currentSSID)") +// return currentSSID == SSID +// } +// +// +// func hasInternet( completion:@escaping ((Bool)->Void)){ +// +// let testUrl = "https://captive.apple.com" +// var request = URLRequest(url: URL(string: testUrl)!,timeoutInterval: 5) +// request.httpMethod = "GET" +// let task = URLSession.shared.dataTask(with: request) { data, response, error in +// guard let data = data else { +// completion(false) +// return +// } +// let resp = String(data: data, encoding: .utf8)! +// if resp.contains("Success"){ +// completion(true) +// }else{ +// completion(false) +// } +// +// } +// task.resume() +// } +// +//} diff --git a/ios/Runner/WifiConnect/HMG_Internet.swift b/ios/Runner/WifiConnect/HMG_Internet.swift new file mode 100644 index 00000000..00ac172f --- /dev/null +++ b/ios/Runner/WifiConnect/HMG_Internet.swift @@ -0,0 +1,193 @@ +// +// HMG_GUEST.swift +// HMG-iOS-Wifi +// +// Created by ZiKambrani on 23/03/1442 AH. +// Copyright © 1442 ZiKambrani. All rights reserved. +// + +import UIKit +import NetworkExtension +import SystemConfiguration.SCNetworkConnection + +fileprivate var TEST = false +fileprivate let SSID = "GUEST-POC" +fileprivate var USER = "" +fileprivate var PASS = "" + +fileprivate func supportedEAPTypes() -> [NSNumber]{ + let peap = NEHotspotEAPSettings.EAPType.EAPPEAP.rawValue + let fast = NEHotspotEAPSettings.EAPType.EAPFAST.rawValue + let tls = NEHotspotEAPSettings.EAPType.EAPTLS.rawValue + let ttls = NEHotspotEAPSettings.EAPType.EAPTTLS.rawValue + return [NSNumber(value: peap), NSNumber(value: fast), NSNumber(value: tls), NSNumber(value: ttls)] +} + +class HMG_Internet{ + static let shared = HMG_Internet() + + private var complete:((_ status:Bool, _ message:String) -> Void)! + func connect(patientId:String, completion:@escaping ((_ status:Bool, _ message:String) -> Void)){ + complete = completion + + if isAlreadyConnected() { + hasInternet { (has) in + if has == true{ + FlutterText.with(key: "alreadyConnectedHmgNetwork"){ localized in + self.complete(true, localized) + } + return + }else{ + FlutterText.with(key: "connectedToHmgNetworkWithNoInternet"){ localized in + self.complete(false, localized) + } + } + } + }else{ + connect(patientId: patientId) + } + } + + private func connect(patientId:String) { + + getWifiCredentials(patientId: patientId) { + let trust_cert = Bundle.main.certificate(named: "GuestPOC_Certificate") + guard trust_cert.trust() == true else{ + FlutterText.with(key: "notConnectedToHmgNetworkSecurityIssue"){ localized in + self.complete(false,localized) + } + return + } + + let eapSettings = NEHotspotEAPSettings() + eapSettings.username = USER + eapSettings.password = PASS + eapSettings.trustedServerNames = ["*.hmg.com","onboard.hmg.com","hmg.com"] + eapSettings.supportedEAPTypes = [supportedEAPTypes().first!] +// eapSettings.isTLSClientCertificateRequired = true +// eapSettings.ttlsInnerAuthenticationType = .eapttlsInnerAuthenticationMSCHAPv2 // MSCHAPv2 +// eapSettings.setIdentity(Bundle.main.identity(named: "GuestPOC_Certificate", password: "1")) +// eapSettings.setTrustedServerCertificates([trust_cert]) + + let hotspotConfig = NEHotspotConfiguration(ssid: SSID, eapSettings: eapSettings) + NEHotspotConfigurationManager.shared.apply(hotspotConfig) {[weak self] (error) in + guard let self = self else { return; } + + if let error = error { + + FlutterText.with(key: "errorConnectingHmgNetwork"){ localized in + self.complete(false,localized) + } + + }else{ + _ = Timer.scheduledTimer(withTimeInterval: 5, repeats: false) { (timer) in + self.hasInternet { (has) in + if has == true{ + FlutterText.with(key: "connectedHmgNetworkWithInternet"){ localized in + self.complete(true,localized) + } + return + }else{ + FlutterText.with(key: "connectedToHmgNetworkWithNoInternet"){ localized in + self.complete(false,localized) + } + } + } + } + } + } + + } + } + + private func isAlreadyConnected() -> Bool{ + var currentSSID: String? + if let interfaces = CNCopySupportedInterfaces() as NSArray? { + for interface in interfaces { + if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? { + currentSSID = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String + break + } + } + } + print("CurrentConnectedSSID: \(currentSSID)") + return currentSSID == SSID + } + + + private func getWifiCredentials(patientId:String, success: @escaping (() -> Void)){ + if TEST { + success() + return + } + + guard let url = API.WIFI_CREDENTIALS.toUrl() else { return assert(true, "Invalid URL: \(API.WIFI_CREDENTIALS)") } + + // JSON Body for HTTP Request + let json: [String: Any] = ["PatientID": patientId] + let jsonData = try? JSONSerialization.data(withJSONObject: json) + + var request = URLRequest(url: url, timeoutInterval: 20) + request.httpMethod = "POST" + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + request.httpBody = jsonData + + let task = URLSession.shared.dataTask(with: request) { data, response, error in + guard let data = data else { + self.somethingWentWrong() + return + } + + if let responseJSON = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]{ + if let requiredData = (responseJSON["Hmg_SMS_Get_By_ProjectID_And_PatientIDList"] as? [[String:Any]])?.first, + let userName = requiredData["UserName"] as? String, let password = requiredData["Password"] as? String{ + + USER = userName + PASS = password + success() + + }else if let errorMessage = responseJSON["ErrorMessage"] as? String{ + self.complete(false, errorMessage) + }else{ + self.somethingWentWrong() + } + }else{ + self.somethingWentWrong() + } + + } + task.resume() + + } + + private func somethingWentWrong(){ + FlutterText.with(key: "somethingWentWrong") { (localized) in + self.complete(false, localized) + } + } + + + func hasInternet( completion:@escaping ((Bool)->Void)){ + + let testUrl = "https://captive.apple.com" + var request = URLRequest(url: URL(string: testUrl)!,timeoutInterval: 5) + request.httpMethod = "GET" + let task = URLSession.shared.dataTask(with: request) { data, response, error in + guard let data = data else { + completion(false) + return + } + + completion( + String(data: data, encoding: .utf8)! + .replacingOccurrences(of: " ", with: "") + .replacingOccurrences(of: "\n", with: "") + .lowercased() + .contains("success") + ) + + } + task.resume() + } + +} diff --git a/ios/Runner/WifiConnect/HMG_Wifi.swift b/ios/Runner/WifiConnect/HMG_Wifi.swift new file mode 100644 index 00000000..1335f766 --- /dev/null +++ b/ios/Runner/WifiConnect/HMG_Wifi.swift @@ -0,0 +1,172 @@ +// +// HMG_GUEST.swift +// HMG-iOS-Wifi +// +// Created by ZiKambrani on 23/03/1442 AH. +// Copyright © 1442 ZiKambrani. All rights reserved. +// + +import UIKit +import NetworkExtension +import SystemConfiguration.CaptiveNetwork + +fileprivate var TEST = true +fileprivate let SSID = "GUEST-POC" +fileprivate var USER = "0696" +fileprivate var PASS = "0000" + +fileprivate func supportedEAPTypes() -> [NSNumber]{ + let peap = NEHotspotEAPSettings.EAPType.EAPPEAP.rawValue + let fast = NEHotspotEAPSettings.EAPType.EAPFAST.rawValue + let tls = NEHotspotEAPSettings.EAPType.EAPTLS.rawValue + let ttls = NEHotspotEAPSettings.EAPType.EAPTTLS.rawValue + return [NSNumber(value: peap), NSNumber(value: fast), NSNumber(value: tls), NSNumber(value: ttls)] +} + +class HMG_Internet{ + static let shared = HMG_Wifi() + + private var complete:((_ status:Bool, _ message:String) -> Void)! + func connect(patientId:String, completion:@escaping ((_ status:Bool, _ message:String) -> Void)){ + complete = completion + + if isAlreadyConnected() { + hasInternet { (has) in + if has == true{ + self.complete(true, "You already connected to HMG network to access internet") + return + }else{ + self.complete(false, "You are connected to HMG network but it have no internet access") + } + } + }else{ + connect(patientId: patientId) + } + } + + private func connect(patientId:String) { + + getWifiCredentials(patientId: patientId) { + let trust_cert = Bundle.main.certificate(named: "GuestPOC_Certificate") + guard trust_cert.trust() == true else{ + self.complete(false,"We are not able to connect you to HMG network due to security certificate") + return + } + + let eapSettings = NEHotspotEAPSettings() + eapSettings.username = USER + eapSettings.password = PASS + eapSettings.trustedServerNames = ["*.hmg.com","onboard.hmg.com","hmg.com"] + eapSettings.supportedEAPTypes = [supportedEAPTypes().first!] +// eapSettings.isTLSClientCertificateRequired = true +// eapSettings.ttlsInnerAuthenticationType = .eapttlsInnerAuthenticationMSCHAPv2 // MSCHAPv2 +// eapSettings.setIdentity(Bundle.main.identity(named: "GuestPOC_Certificate", password: "1")) +// eapSettings.setTrustedServerCertificates([trust_cert]) + + let hotspotConfig = NEHotspotConfiguration(ssid: SSID, eapSettings: eapSettings) + NEHotspotConfigurationManager.shared.apply(hotspotConfig) {[weak self] (error) in + guard let self = self else { return; } + + if let error = error { + self.complete(false, "Error connecting to HMG network" /*error.localizedDescription*/ ) + }else{ + _ = Timer.scheduledTimer(withTimeInterval: 3, repeats: false) { (timer) in + self.hasInternet { (has) in + if has == true{ + self.complete(true, "Successfully connected to the HMG network to access internet") + return + }else{ + self.complete(false, "Successfully connected to the HMG network but it have no internet access") + } + } + } + } + } + + } + } + + private func isAlreadyConnected() -> Bool{ + var currentSSID: String? + if let interfaces = CNCopySupportedInterfaces() as NSArray? { + for interface in interfaces { + if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? { + currentSSID = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String + break + } + } + } + + print("CurrentConnectedSSID: \(currentSSID)") + return currentSSID == SSID + } + + + private func getWifiCredentials(patientId:String, completion: @escaping (() -> Void)){ + if TEST { + completion() + return + } + + guard let url = API.WIFI_CREDENTIALS.toUrl() else { return assert(true, "Invalid URL: \(API.WIFI_CREDENTIALS)") } + + // JSON Body for HTTP Request + let json: [String: Any] = ["PatientID": patientId] + let jsonData = try? JSONSerialization.data(withJSONObject: json) + + var request = URLRequest(url: url, timeoutInterval: 20) + request.httpMethod = "POST" + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + request.httpBody = jsonData + + let task = URLSession.shared.dataTask(with: request) { data, response, error in + guard let data = data else { + self.complete(false, "Failed to get your internet credentials") + return + } + + if let responseJSON = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]{ + if let requiredData = responseJSON["Hmg_SMS_Get_By_ProjectID_And_PatientIDList"] as? [String:Any], + let userName = requiredData["UserName"] as? String, let password = requiredData["Password"] as? String{ + + USER = userName + PASS = password + completion() + + }else if let errorMessage = responseJSON["ErrorMessage"] as? String{ + self.complete(false, errorMessage) + } + }else{ + self.complete(false, "Failed to get your internet credentials") + } + + } + task.resume() + + } + + + func hasInternet( completion:@escaping ((Bool)->Void)){ + + let testUrl = "https://captive.apple.com" + var request = URLRequest(url: URL(string: testUrl)!,timeoutInterval: 5) + request.httpMethod = "GET" + let task = URLSession.shared.dataTask(with: request) { data, response, error in + guard let data = data else { + completion(false) + return + } + + completion( + String(data: data, encoding: .utf8)! + .replacingOccurrences(of: " ", with: "") + .replacingOccurrences(of: "\n", with: "") + .lowercased() + .contains("success") + ) + + } + task.resume() + } + +} diff --git a/ios/gpx.gpx b/ios/gpx.gpx new file mode 100644 index 00000000..9cc26956 --- /dev/null +++ b/ios/gpx.gpx @@ -0,0 +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 diff --git a/key.properties b/key.properties index 01c8cbe8..eec491b8 100644 --- a/key.properties +++ b/key.properties @@ -1,4 +1,4 @@ storePassword=HmGsa123 keyPassword=HmGsa123 -keyAlias=DQKey +keyAlias=key storeFile=DQKey.jks \ No newline at end of file diff --git a/lib/Constants.dart b/lib/Constants.dart new file mode 100644 index 00000000..5b8fd9da --- /dev/null +++ b/lib/Constants.dart @@ -0,0 +1,3 @@ +import 'package:flutter/material.dart'; + +final Color secondaryColor = Colors.red[800]; \ No newline at end of file diff --git a/lib/config/config.dart b/lib/config/config.dart index caf0bd5b..29d5e061 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,23 +1,45 @@ import 'dart:io'; +import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; const MAX_SMALL_SCREEN = 660; +// PACKAGES and OFFERS +const EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/exacartapi'; +const PACKAGES_CATEGORIES = '/api/categories'; +const PACKAGES_PRODUCTS = '/api/products'; const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; + //const BASE_PHARMACY_URL = 'http://swd-pharapp-01:7200/api/'; const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; + -// const BASE_URL = 'https://hmgwebservices.com/'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; +///Geofencing +const GET_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_GetAllPoints'; +const LOG_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_InsertPatientFileInfo'; +//weather +const WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo'; + +const GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege'; + + ///Doctor 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 = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating'; ///Prescriptions @@ -33,18 +55,22 @@ const GET_PRESCRIPTION_REPORT_ENH = ///Lab Order const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; -const GET_Patient_LAB_SPECIAL_RESULT = - 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; +const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; +const SEND_LAB_RESULT_EMAIL = + 'Services/Notifications.svc/REST/SendLabReportEmail'; const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_ORDERS_RESULT = + 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; /// const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; -const GET_PATIENT_ORDERS_DETAILS = - 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead'; +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'; -const SEND_RAD_REPORT_EMAIL = - 'Services/Notifications.svc/REST/SendRadReportEmail'; +const SEND_RAD_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendRadReportEmail'; ///Feedback const SEND_FEEDBACK = 'Services/COCWS.svc/REST/InsertCOCItemInSPList'; @@ -53,24 +79,17 @@ const GET_PATIENT_AppointmentHistory = 'Services' '/Doctors.svc/REST/PateintHasAppoimentHistory'; ///VITAL SIGN -const GET_PATIENT_VITAL_SIGN = - 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; ///Er Nearest -const GET_NEAREST_HOSPITAL = - 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; +const GET_NEAREST_HOSPITAL = 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; ///Er Nearest -const GET_AMBULANCE_REQUEST = - 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; -const GET_PATIENT_ALL_PRES_ORDERS = - 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID = - 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; -const UPDATE_PRESS_ORDER = - 'Services/Patients.svc/REST/PatientER_UpdatePresOrder'; -const INSERT_ER_INERT_PRES_ORDER = - 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; +const GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; +const GET_PATIENT_ALL_PRES_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID = 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; +const UPDATE_PRESS_ORDER = 'Services/Patients.svc/REST/PatientER_UpdatePresOrder'; +const INSERT_ER_INERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; ///FindUs const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; @@ -79,15 +98,13 @@ const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; const GET_LIVECHAT_REQUEST = 'Services/Patients.svc/REST/GetPatientICProjects'; ///babyInformation -const GET_BABYINFORMATION_REQUEST = - 'Services/Community.svc/REST/GetBabyByUserID'; +const GET_BABYINFORMATION_REQUEST = 'Services/Community.svc/REST/GetBabyByUserID'; ///Get Baby By User ID const GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID'; ///userInformation -const GET_USERINFORMATION_REQUEST = - 'Services/Community.svc/REST/GetUserInformation_New'; +const GET_USERINFORMATION_REQUEST = 'Services/Community.svc/REST/GetUserInformation_New'; ///Update email const UPDATE_PATENT_EMAIL = 'Services/Patients.svc/REST/UpdatePateintEmail'; @@ -100,7 +117,7 @@ const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby'; const GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New'; ///delete Child -const DELETE_CHILD_REQUEST = '/Services/Community.svc/REST/DeleteBaby'; +const DELETE_CHILD_REQUEST = 'Services/Community.svc/REST/DeleteBaby'; ///addNewTABLE const GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable'; @@ -109,19 +126,17 @@ const GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable'; const GET_CITIES_REQUEST = 'Services/Lists.svc/REST/GetAllCities'; ///BloodDetails -const GET_BLOOD_REQUEST = - 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails'; +const GET_BLOOD_REQUEST = 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails'; ///Reports const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; -const INSERT_REQUEST_FOR_MEDICAL_REPORT = - 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; +const INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; +const SEND_MEDICAL_REPORT_EMAIL = + 'Services/Notifications.svc/REST/SendMedicalReportEmail'; ///Rate -const IS_LAST_APPOITMENT_RATED = - 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; -const GET_APPOINTMENT_DETAILS_BY_NO = - 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; +const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; +const GET_APPOINTMENT_DETAILS_BY_NO = 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; const GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; @@ -133,8 +148,7 @@ const GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized"; //URL to get active appointment list -const GET_ACTIVE_APPOINTMENTS_LIST_URL = - "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber"; +const GET_ACTIVE_APPOINTMENTS_LIST_URL = "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber"; //URL to get projects list const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; @@ -143,109 +157,82 @@ const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime"; //URL to dental doctors list -const GET_DENTAL_DOCTORS_LIST_URL = - "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping"; +const GET_DENTAL_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping"; //URL to get doctor free slots const GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots"; //URL to insert appointment -const INSERT_SPECIFIC_APPOINTMENT = - "Services/Doctors.svc/REST/InsertSpecificAppointment"; +const INSERT_SPECIFIC_APPOINTMENT = "Services/Doctors.svc/REST/InsertSpecificAppointment"; //URL to get patient share -const GET_PATIENT_SHARE = - "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; +const GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; //URL to get patient appointment history -const GET_PATIENT_APPOINTMENT_HISTORY = - "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; +const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; //URL to get patient appointment curfew history -const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = - "Services/Doctors.svc/REST/AppoimentHistoryForCurfew"; +const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew"; //URL to confirm appointment -const CONFIRM_APPOINTMENT = - "Services/MobileNotifications.svc/REST/ConfirmAppointment"; +const CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment"; -const INSERT_VIDA_REQUEST = - "Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart"; +const INSERT_VIDA_REQUEST = "Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart"; //URL to cancel appointment const CANCEL_APPOINTMENT = "Services/Doctors.svc/REST/CancelAppointment"; //URL get appointment QR -const GENERATE_QR_APPOINTMENT = - "Services/Doctors.svc/REST/GenerateQRAppointmentNo"; +const GENERATE_QR_APPOINTMENT = "Services/Doctors.svc/REST/GenerateQRAppointmentNo"; //URL send email appointment QR -const EMAIL_QR_APPOINTMENT = - "Services/Notifications.svc/REST/sendEmailForOnLineCheckin"; +const EMAIL_QR_APPOINTMENT = "Services/Notifications.svc/REST/sendEmailForOnLineCheckin"; //URL check payment status -const CHECK_PAYMENT_STATUS = - "Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID"; +const CHECK_PAYMENT_STATUS = "Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID"; //URL create advance payment const CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment"; -const HIS_CREATE_ADVANCE_PAYMENT = - "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; +const HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; -const ADD_ADVANCE_NUMBER_REQUEST = - 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; +const ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; -const IS_ALLOW_ASK_DOCTOR = - 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; -const GET_CALL_REQUEST_TYPE = - 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; +const IS_ALLOW_ASK_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; +const GET_CALL_REQUEST_TYPE = 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; const SEND_CALL_REQUEST = 'Services/Doctors.svc/REST/InsertCallInfo'; -const GET_LIVECARE_CLINICS = - 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinics'; +const GET_LIVECARE_CLINICS = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinics'; -const GET_LIVECARE_SCHEDULE_CLINICS = - 'Services/Doctors.svc/REST/PatientER_GetClinicsHaveSchedule'; +const GET_LIVECARE_SCHEDULE_CLINICS = 'Services/Doctors.svc/REST/PatientER_GetClinicsHaveSchedule'; -const GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST = - 'Services/Doctors.svc/REST/PatientER_GetDoctorByClinicID'; +const GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST = 'Services/Doctors.svc/REST/PatientER_GetDoctorByClinicID'; -const GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS = - 'Services/Doctors.svc/REST/PatientER_GetDoctorFreeSlots'; +const GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS = 'Services/Doctors.svc/REST/PatientER_GetDoctorFreeSlots'; -const INSERT_LIVECARE_SCHEDULE_APPOINTMENT = - 'Services/Doctors.svc/REST/InsertSpecificAppoitmentForSchedule'; +const INSERT_LIVECARE_SCHEDULE_APPOINTMENT = 'Services/Doctors.svc/REST/InsertSpecificAppoitmentForSchedule'; -const GET_PATIENT_SHARE_LIVECARE = - "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare"; +const GET_PATIENT_SHARE_LIVECARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare"; -const GET_LIVECARE_CLINIC_TIMING = - 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; +const GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; -const GET_ER_APPOINTMENT_FEES = - 'Services/DoctorApplication.svc/REST/GetERAppointmentFees'; +const GET_ER_APPOINTMENT_FEES = 'Services/DoctorApplication.svc/REST/GetERAppointmentFees'; const GET_ER_APPOINTMENT_TIME = 'Services/ER_VirtualCall.svc/REST/GetRestTime'; -const ADD_NEW_CALL_FOR_PATIENT_ER = - 'Services/DoctorApplication.svc/REST/NewCallForPatientER'; +const ADD_NEW_CALL_FOR_PATIENT_ER = 'Services/DoctorApplication.svc/REST/NewCallForPatientER'; -const GET_LIVECARE_HISTORY = - 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory'; -const CANCEL_LIVECARE_REQUEST = - 'Services/ER_VirtualCall.svc/REST/DeleteErRequest'; -const SEND_LIVECARE_INVOICE_EMAIL = - 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; +const GET_LIVECARE_HISTORY = 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory'; +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 UPDATE_HEALTH_TERMS = '/services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; const IP_ADDRESS = '10.20.10.20'; -const VERSION_ID = 5.6; +const VERSION_ID = 5.8; const SETUP_ID = '91877'; const LANGUAGE = 2; const PATIENT_OUT_SA = 0; @@ -255,20 +242,21 @@ const PATIENT_TYPE = 1; const PATIENT_TYPE_ID = 1; var DEVICE_TOKEN = ""; var DeviceTypeID = Platform.isIOS ? 1 : 2; -const LANGUAGE_ID = 2; +const LANGUAGE_ID = 1; const GET_PHARMCY_ITEMS = "Services/Lists.svc/REST/GetPharmcyItems_Region"; const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList"; -const GET_PAtIENTS_INSURANCE = - "Services/Patients.svc/REST/Get_PatientInsuranceDetails"; -const GET_PAtIENTS_INSURANCE_UPDATED = - "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory"; +const GET_PAtIENTS_INSURANCE = "Services/Patients.svc/REST/Get_PatientInsuranceDetails"; +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_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; -const GET_PAtIENTS_INSURANCE_APPROVALS = - "Services/Patients.svc/REST/GetApprovalStatus"; +const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; const SEARCH_BOT = 'HabibiChatBotApi/BotInterface/GetVoiceCommandResponse'; const GET_VACCINATIONS_ITEMS = "/Services/ERP.svc/REST/GET_VACCINATIONS_ITEMS"; @@ -278,59 +266,38 @@ const GET_PATIENT_SICK_LEAVE = 'Services/Patients.svc/REST/GetPatientSickLeave'; const SendSickLeaveEmail = 'Services/Notifications.svc/REST/SendSickLeaveEmail'; -const GET_PATIENT_AdVANCE_BALANCE_AMOUNT = - 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount'; -const GET_PATIENT_INFO_BY_ID = - 'Services/Doctors.svc/REST/GetPatientInfoByPatientID'; -const GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = - 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber'; -const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = - 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment'; -const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = - 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; +const GET_PATIENT_AdVANCE_BALANCE_AMOUNT = 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount'; +const GET_PATIENT_INFO_BY_ID = 'Services/Doctors.svc/REST/GetPatientInfoByPatientID'; +const GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber'; +const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment'; +const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; -const GET_COVID_DRIVETHRU_PROJECT_LIST = - 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; +const GET_COVID_DRIVETHRU_PROJECT_LIST = 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; -const GET_COVID_DRIVETHRU_PAYMENT_INFO = - 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; +const GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; -const GET_COVID_DRIVETHRU_FREE_SLOTS = - 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; +const GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; ///Smartwatch Integration Services -const GET_PATIENT_LAST_RECORD = - 'Services/Patients.svc/REST/Med_GetPatientLastRecord'; +const GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord'; ///My Trackers -const GET_DIABETIC_RESULT_AVERAGE = - 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; -const GET_DIABTEC_RESULT = - 'Services/Patients.svc/REST/Patient_GetDiabtecResults'; -const ADD_DIABTEC_RESULT = - 'Services/Patients.svc/REST/Patient_AddDiabtecResult'; - -const GET_BLOOD_PRESSURE_RESULT_AVERAGE = - 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage'; -const GET_BLOOD_PRESSURE_RESULT = - 'Services/Patients.svc/REST/Patient_GetBloodPressureResult'; -const ADD_BLOOD_PRESSURE_RESULT = - 'Services/Patients.svc/REST/Patient_AddBloodPressureResult'; - -const GET_WEIGHT_PRESSURE_RESULT_AVERAGE = - 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage'; -const GET_WEIGHT_PRESSURE_RESULT = - 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; -const ADD_WEIGHT_PRESSURE_RESULT = - 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; - -const ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = - 'Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID'; - -const GET_CALL_INFO_HOURS_RESULT = - 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; -const GET_CALL_REQUEST_TYPE_LOV = - 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; +const GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; +const GET_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_GetDiabtecResults'; +const ADD_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_AddDiabtecResult'; + +const GET_BLOOD_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage'; +const GET_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetBloodPressureResult'; +const ADD_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddBloodPressureResult'; + +const GET_WEIGHT_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage'; +const GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; +const ADD_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; + +const ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = 'Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID'; + +const GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; +const GET_CALL_REQUEST_TYPE_LOV = 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; const GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse'; const UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus'; const INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; @@ -338,18 +305,13 @@ const INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; const GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; // H2O -const H2O_GET_USER_PROGRESS = - "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; -const H2O_INSERT_USER_ACTIVITY = - "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; +const H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; +const H2O_INSERT_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; //E_Referral Services -const GET_ALL_RELATIONSHIP_TYPES = - "Services/Patients.svc/REST/GetAllRelationshipTypes"; -const SEND_ACTIVATION_CODE_FOR_E_REFERRAL = - 'Services/Authentication.svc/REST/SendActivationCodeForEReferral'; -const CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = - 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral'; +const GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes"; +const SEND_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/SendActivationCodeForEReferral'; +const CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral'; const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities'; const CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral"; const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; @@ -359,6 +321,7 @@ const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; // pharmacy const PHARMACY_VERIFY_CUSTOMER = "epharmacy/api/VerifyCustomer"; +const PHARMACY_GET_COUNTRY = "epharmacy/api/countries"; const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer"; const GET_PHARMACY_BANNER = "epharmacy/api/promotionbanners"; const GET_PHARMACY_TOP_MANUFACTURER = "epharmacy/api/topmanufacturer"; @@ -367,6 +330,9 @@ const GET_PHARMACY_PRODUCTs_BY_IDS = "epharmacy/api/productsbyids/"; const GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/"; const GET_ORDER = "orders?"; const GET_ORDER_DETAILS = "epharmacy/api/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"; @@ -393,16 +359,11 @@ const LAKUM_GET_USER_TERMS_AND_CONDITIONS = const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; // Home Health Care -const HHC_GET_ALL_SERVICES = - "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; -const HHC_GET_ALL_CMC_SERVICES = - "Services/Patients.svc/REST/PatientER_CMC_GetAllServices"; -const PATIENT_ER_UPDATE_PRES_ORDER = - "Services/Patients.svc/REST/PatientER_UpdatePresOrder"; -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 HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; +const HHC_GET_ALL_CMC_SERVICES = "Services/Patients.svc/REST/PatientER_CMC_GetAllServices"; +const PATIENT_ER_UPDATE_PRES_ORDER = "Services/Patients.svc/REST/PatientER_UpdatePresOrder"; +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'; @@ -416,11 +377,14 @@ const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews'; //Pharmacy wishlist const GET_WISHLIST = "shopping_cart_items/"; +const DELETE_WISHLIST = "delete_shopping_cart_item_by_product?customer_id="; const GET_REVIEW = "customerreviews/"; const GET_BRANDS = "manufacturer"; const GET_TOP_BRANDS = "topmanufacturer?page=1&limit=8"; const GET_PRODUCT_DETAIL = "products/"; const GET_LOCATION = "Services/Patients.svc/REST/GetPharmcyListBySKU"; +const GET_SPECIFICATION = "productspecification/"; +const GET_BRAND_ITEMS = "products?ManufacturerId="; // External API const ADD_ADDRESS_INFO = @@ -445,6 +409,7 @@ const GET_SUB_PRODUCTS = 'epharmacy/api/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='; + const TIMER_MIN = 10; const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 95711339..05193cd9 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1,3 +1,27 @@ +// --------- - -- - - - - - - - - ---------------- +// Used for Native through Platform Method Channel +// --------- - -- - - - - - - - - ---------------- +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": "تم التصال بشبكة د.سليمان الحبيب بنجاح, تستطيع الان استخدام تطبيق الحبيب"}, + "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": "انت متصل مسبقاً بالشبكة تستطيع استخدام تطبيق الحبيب"}, + "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"}, + "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" + }, + "notConnectedToHmgNetworkSecurityIssue": { + "en": "We are not able to connect you to HMG network due to security reasons", + "ar": "We are not able to connect you to HMG network due to security reasons" + } +}; + const Map localizedValues = { 'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'}, 'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, @@ -21,10 +45,7 @@ const Map localizedValues = { 'clinicName': {'en': 'Clinic Name', 'ar': 'اسم العيادة'}, 'doctorName': {'en': 'Doctor Name', 'ar': 'إسم الطبيب'}, 'nearestAppo': {'en': 'Nearest appointment', 'ar': 'أقرب موعد'}, - 'searchByDocText': { - 'en': 'Type the name of the doctor to help you find him', - 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه' - }, + 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, 'search': {'en': 'Search', 'ar': 'بحث'}, 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, @@ -34,17 +55,11 @@ const Map localizedValues = { 'gender': {'en': 'Gender', 'ar': 'الجنس'}, 'nationality': {'en': 'Nationality', 'ar': 'الجنسية'}, 'docQualifications': {'en': 'Doctor Qualifications', 'ar': 'مؤهلات الطبيب'}, - 'confirmAppoHeading': { - 'en': 'Kindly confirm your Appointment', - 'ar': 'يرجى تأكيد موعدك' - }, + 'confirmAppoHeading': {'en': 'Kindly confirm your Appointment', 'ar': 'يرجى تأكيد موعدك'}, 'patientInfo': {'en': 'Patient Information', 'ar': 'معلومات المريض'}, 'bookSuccess': {'en': 'Book Success', 'ar': 'تم حجز الموعد بنجاح'}, 'patientShare': {'en': 'Patient Share', 'ar': 'المبلغ المستحق'}, - 'patientShareWithTax': { - 'en': 'Patient Share with Tax', - 'ar': 'المبلغ الإجمالي المستحق' - }, + 'patientShareWithTax': {'en': 'Patient Share with Tax', 'ar': 'المبلغ الإجمالي المستحق'}, 'confirmAppo': {'en': 'Confirm Appointment', 'ar': 'تأكيد الموعد'}, 'confirm': {'en': 'Confirm', 'ar': 'تأكيد'}, 'confirmLiveCare': {'en': 'Confirm LiveCare', 'ar': 'تأكيد لايف كير'}, @@ -66,36 +81,18 @@ const Map localizedValues = { 'ar': 'هل أنت متأكد أنك تريد إلغاء هذا الموعد؟' }, - 'upcoming-noAction': { - 'en': 'No Action Required', - 'ar': 'لا يوجد إجراء مطلوب' - }, - 'upcoming-confirm': { - 'en': 'Please confirm the appointment to avoid cancellation', - 'ar': 'يرجى تأكيد الموعد لتفادي الإلغاء' - }, - '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-livecare': { - 'en': 'This is a LiveCare 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.", + "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-livecare': {'en': 'This is a LiveCare appointment', 'ar': 'هذا موعد لايف كير'}, 'upcoming-details': {'en': 'More Details', 'ar': 'المزيد'}, 'reschedule': {'en': 'Reschedule', 'ar': 'إعادة جدولة'}, 'raise': {'en': 'Raise', 'ar': 'رفع'}, @@ -187,8 +184,8 @@ const Map localizedValues = { 'ar': 'الرجائ ادخال اسم الدواء' }, "verification_message": { - "en": "Please enter verification code", - "ar": "الرجاء إدخال رمز التحقق" + "en": "Please enter the Verification Code sent to", + "ar": "الرجاء ادخال رمز التحقق الذي تم إرساله إلى" }, "validation_message": { "en": "The verification code expires in", @@ -300,7 +297,7 @@ const Map localizedValues = { "recieved-requests": {"en": "Recieved Requests", "ar": "الطلبات المستلمة"}, "manage-files": {"en": "Manage Family Files", "ar": "إدارة ملفات العائلة"}, 'oxygenation': {'en': 'Oxygenation', 'ar': 'الأوكسجين'}, - 'bodyMeasurements': {'en': 'body Mass', 'ar': 'قياسات الجسم'}, + 'bodyMeasurements': {'en': 'body Mass Index', 'ar': 'مؤشر الكتلة'}, 'temperature': {'en': 'Temperature', 'ar': 'درجة الحرارة'}, 'pulse': {'en': 'Pulse', 'ar': 'النبض'}, 'respiration': {'en': 'Respiration', 'ar': 'التنفس'}, @@ -318,7 +315,7 @@ const Map localizedValues = { "reject-view": {"en": "Reject", "ar": "رفض"}, "delete-view": {"en": "Delete", "ar": "حذف"}, // "my-family": {"en": "MY FAMILY", "ar": "عائلتي"}, - "approvals": {"en": "Approvals", "ar": "موفقات التأمين"}, + "approvals": {"en": "Approvals", "ar": "موافقات التأمين"}, "approvalNo": {"en": "Approval No.: ", "ar": "رقم الموافقة: "}, "companyName": {"en": "Company Name ", "ar": "اسم الشركة: "}, "receiptOn": {"en": "Receipt on: ", "ar": "تاريخ الفاتورة: "}, @@ -338,68 +335,35 @@ const Map localizedValues = { "seeDetails": {"en": "SEE DETAILS", "ar": "منافعك التامينية"}, "insuranceCards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, "requestType": {"en": "Request Type", "ar": "نوع الاستفسار"}, - "register-info-family": { - "en": "How would like to add the new member?", - "ar": "كيف ترغب باضافة العضو الجديد؟" - }, - "remove-family-member": { - "en": "Remove this member?", - "ar": "إزالة ملف العضو؟" - }, + "register-info-family": {"en": "How would like to add the new member?", "ar": "كيف ترغب باضافة العضو الجديد؟"}, + "remove-family-member": {"en": "Remove this member?", "ar": "إزالة ملف العضو؟"}, "MyMedicalFile": {"en": "My Medical File", 'ar': 'ملف الطبي الالكتروني'}, - "myMedicalFileSubTitle": { - "en": "All your medical records", - 'ar': 'جميع سجلاتك الطبية' - }, + "myMedicalFileSubTitle": {"en": "All your medical records", 'ar': 'جميع سجلاتك الطبية'}, + "viewMore": {"en": "View More", 'ar': 'عرض المزيد'}, - "homeHealthCareService": { - "en": "Home Health Care Service", - 'ar': 'الرعاية الصحية المنزلية' - }, + "homeHealthCareService": {"en": "Home Health Care Service", 'ar': 'الرعاية الصحية المنزلية'}, "OnlinePharmacy": {"en": "Online Pharmacy", 'ar': 'صيدليات الحبيب'}, "EmergencyService": {"en": "Emergency Service", 'ar': 'الفحص الطبي الشامل'}, - "OnlinePaymentService": { - "en": "Online Payment Service", - 'ar': 'خدمة الدفع الإلكتدوني' - }, - "OffersAndPackages": { - "en": "Online transfer request", - 'ar': 'طلب التحويل الالكتروني' - }, - "ComprehensiveMedicalCheckup": { - "en": "Comprehensive Medical Check up", - 'ar': 'فحص طبي شامل' - }, + "OnlinePaymentService": {"en": "Online Payment Service", 'ar': 'خدمة الدفع الإلكتدوني'}, + "OffersAndPackages": {"en": "Online transfer request", 'ar': 'طلب التحويل الالكتروني'}, + "ComprehensiveMedicalCheckup": {"en": "Comprehensive Medical Check up", 'ar': 'فحص طبي شامل'}, "HMGService": {"en": "HMG Service", 'ar': 'جميع خدمات الحبيب'}, - "ViewAllHabibMedicalService": { - "en": "View All Habib Medical Service", - 'ar': 'عرض خدمات الحبيب الطبية' - }, + "ViewAllHabibMedicalService": {"en": "View All Habib Medical Service", 'ar': 'عرض خدمات الحبيب الطبية'}, "viewAll": {"en": "View All", 'ar': 'عرض الكل'}, + "view": {"en": "View", 'ar': 'عرض'}, "ContactUs": {"en": "Contact Us", 'ar': 'الوصول إلينا'}, - "ViewAllWaysReachUs": { - "en": "View All Ways Reach Us", - 'ar': 'جميع طرق الاتصال بنا' - }, + "ViewAllWaysReachUs": {"en": "View All Ways Reach Us", 'ar': 'جميع طرق الاتصال بنا'}, "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, "logs": {"en": "Logs", "ar": "السجلات"}, "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"}, "locationDialogMessage": { - "en": - "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", - "ar": - "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك." + "en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", + "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك." }, - "user-view-requester": { - "en": "User Wants To View Your Medical File", - "ar": "أشخاص يرغبون الاطلاع على ملفك الطبي" - }, - "user-view": { - "en": "User Can View Your Medical File", - "ar": "أشخاص يمكنهم الاطلاع على ملفك الطبي" - }, + "user-view-requester": {"en": "User Wants To View Your Medical File", "ar": "أشخاص يرغبون الاطلاع على ملفك الطبي"}, + "user-view": {"en": "User Can View Your Medical File", "ar": "أشخاص يمكنهم الاطلاع على ملفك الطبي"}, "parking": {"en": "Parking", "ar": "مواقف"}, "alhabiServices": {"en": "HMG Service", "ar": "خدمات الحبيب"}, @@ -483,7 +447,7 @@ const Map localizedValues = { "LabOrders": {"en": "Lab Orders", "ar": "تحاليل المختبر"}, "BillNo": {"en": "Bill No :", "ar": "رقم الفاتورة"}, "Prescriptions": {"en": "Prescriptions", "ar": "الوصفات الطبية"}, - "History": {"en": "History", "ar": "السجل"}, + "History": {"en": "History", "ar": "السجلات"}, "OrderNo": {"en": "Order No", "ar": "رقم الطلب"}, "OrderDetails": {"en": "Order Details", "ar": "تفاصيل الطلب"}, "VitalSign": {"en": "Vital Sign", "ar": "العلامة حيوية"}, @@ -524,22 +488,12 @@ const Map localizedValues = { "MyBalances": {"en": "My Balances", "ar": "رصيدي"}, "BalanceAmount": {"en": "Balance Amount", "ar": "رصيدالحساب"}, "TotalBalance": {"en": "Total Balance", "ar": "الرصيد الكلي"}, - "CreateAdvancedPayment": { - "en": "Create Advanced Payment", - "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": "البريد الإلكتروني للمودع *" - }, + "DepositorEmail": {"en": "Depositor Email *", "ar": "البريد الإلكتروني للمودع *"}, "Notes": {"en": "Notes", "ar": "ملاحظات"}, "SelectPatientName": {"en": "Select Patient Name", "ar": "اختر اسم المريض"}, "SelectFamilyPatientName": {"en": "Family Members", "ar": "أفراد الأسرة"}, @@ -679,9 +633,16 @@ const Map localizedValues = { "shippedMethod": {"en": "SHIP BY:", "ar": " الشحن بواسطة:"}, "orderDetail": {"en": "Order Details", "ar": " تفاصيل الطلب"}, "orderSummary": {"en": "Order Summary", "ar": " تفاصيل المنتج"}, - "subtotal": {"en": "Subtotal", "ar": " المجموع"}, + "subtotal": {"en": "Subtotal", "ar": " المجموع الفرعي"}, "shipping": {"en": "Shipping", "ar": " الشحن"}, + "shipBy": {"en": "SHIP BY:", "ar": "الشحن عن طريق:"}, + "lakumPoints": {"en": "Lakum Points", "ar": "نقاط لكم"}, + "use": {"en": "USE", "ar": "استخدم"}, + "proceedPay": {"en": "PROCEED TO PAY", "ar": "المتابعة للدفع"}, "vat": {"en": "VAT (15%)", "ar": "(15%) القيمة المضافة"}, + "inclusiveVat": {"en": "(inclusive VAT)", "ar": "(شامل الضريبة)"}, + "items": {"en": "item(s)", "ar": "عنصر"}, + "checkOut": {"en": "CHECK OUT", "ar": "الدفع"}, "sar": {"en": "SAR", "ar": " ر.س "}, "payOnline": {"en": "PAY ONLINE", "ar": "اتمام عملية الدفع "}, "cancelOrder": {"en": "CANCEL ORDER", "ar": "الغاء الطلب "}, @@ -747,15 +708,9 @@ const Map localizedValues = { // pharmacy module "medicationRefill": {"en": "MEDICATION REFILL", "ar": "إعادة تعبئة الدواء"}, - "offersAndPromotions": { - "en": "OFFERS & SPECIAL PROMOTIONS", - "ar": "العروض والترقيات الخاصة" - }, + "offersAndPromotions": {"en": "OFFERS & SPECIAL PROMOTIONS", "ar": "العروض والترقيات الخاصة"}, "myPrescriptions": {"en": "MY PRESCRIPTIONS", "ar": "وصفاتي"}, - "searchAndScanMedication": { - "en": "SEARCH & SCAN FOR MEDICATION", - "ar": "البحث والمسح للأدوية" - }, + "searchAndScanMedication": {"en": "SEARCH & SCAN FOR MEDICATION", "ar": "البحث والمسح للأدوية"}, "shopByBrands": {"en": "Shop By Brands", "ar": "تسوق حسب الماركات"}, "recentlyViewed": {"en": "Recently Viewed", "ar": "شوهدت مؤخرا"}, "bestSellers": {"en": "Best Sellers", "ar": "أفضل البائعين"}, @@ -813,10 +768,7 @@ const Map localizedValues = { "profile": {"en": "Profile", "ar": "ملفي"}, "notifications": {"en": "Notifications", "ar": "إشعارات"}, "notificationDetails": {"en": "Notification Details", "ar": "تفاصيل الاشعار"}, - "notificationDetailsa": { - "en": "Notification Details", - "ar": "تفاصيل الاشعار" - }, + "notificationDetailsa": {"en": "Notification Details", "ar": "تفاصيل الاشعار"}, "info-my-doctor-points": { "en": [ @@ -825,24 +777,15 @@ 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:", - "ar": - "خدمة اطبائي: هذه الخدمة تمكنك من الاطلاع على جميع الاطباء الذين قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" + "en": "This service allows you to see all the doctors you have visited in Al Habib Medical Group, and through this service:", + "ar": "خدمة اطبائي: هذه الخدمة تمكنك من الاطلاع على جميع الاطباء الذين قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" }, "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": - "خدمة الوصفات الطبية: هذه الخدمة تمكنك من الاطلاع على جميع الوصفات الطبية التي تم اصدارها في مجموعة الحبيب الطبية، كما تستطيع من خلال هذه الخدمة:" + "en": "This service allows you to view all the medical prescriptions issued by Al Habib Medical Group, and through this service, you can:", + "ar": "خدمة الوصفات الطبية: هذه الخدمة تمكنك من الاطلاع على جميع الوصفات الطبية التي تم اصدارها في مجموعة الحبيب الطبية، كما تستطيع من خلال هذه الخدمة:" }, "info-my-prescription-points": { "en": [ @@ -866,10 +809,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": - "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" + "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": "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" }, "info-insurance-cards-points": { @@ -1031,7 +972,7 @@ const Map localizedValues = { "en": "Please enter the subject", "ar": "يرجى ادخال الموضوع" }, - "empty-message": {"en": "Please enter message", "ar": "يرجى ادخال الموضوع"}, + "empty-message": {"en": "Please enter message", "ar": "يرجى ادخال الرسالة"}, "select-attachment": {"en": "Select Attachment", "ar": "إختر المرفق"}, "complain-appo": {"en": "Complaint for appointment", "ar": "شكوى على موعد"}, "complain-without-appo": { @@ -1042,7 +983,7 @@ const Map localizedValues = { "message-type": {"en": "Message Type", "ar": "نوع الرسالة"}, "compliment": {"en": "compliment", "ar": "ثناء"}, "suggestion": {"en": "Suggestion", "ar": "إقتراح"}, - "your-feedback": {"en": "Your feedback was sent", "ar": "إقتراح"}, + "your-feedback": {"en": "Your feedback was sent", "ar": "لقد تم ارسال اقراحك شكرا لك"}, "select-part": { "en": "Please select the part that complain about", "ar": "يرجى تحديد الجزء الذي تشكو منه" @@ -1054,8 +995,14 @@ const Map localizedValues = { "en": "Item name should be more than 3 character ", "ar": "يجب أن يكون اسم العنصر أكثر من 3 أحرف" }, - "YouCanFind": {"en": "YouCanFind", "ar": "باستطاعتك العثور على "}, + "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": "عزيز العميل لا يوجد اتصال بالإنترنت, هل تريد الاتصال بشبكة مستشفى د. سليمان الحبيب لاستخدام التطبيق. يجب عليك ان تكون في نطاق شبكة المستشفى" + }, + "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": "نتيجة خاصة"}, "GeneralResult": {"en": "General Result", "ar": "نتيجة عامة"}, @@ -1068,67 +1015,384 @@ const Map localizedValues = { "report": {"en": "Radiology Report", "ar": "تقرير الاشعة"}, "open-rad": {"en": "Open Image", "ar": "فتح صور الاشعة"}, "send-copy": {"en": "Email the Report", "ar": "أرسل التقرير"}, - - "vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"}, - "welcomeBack": {"en": "Welcome back", "ar": "مرحبا مرة أخرى"}, - "instructions": { + "appoSurvey": {"en": "Survey", "ar": "إستبيان"}, + "appoSurveySubtitle": {"en": "Survey", "ar": "إستبيان"}, + "labResults": {"en": "Lab Result", "ar": "نتيجة المختبر"}, + "doctorRating": {"en": "Doctor Rating", "ar": "تقييم الطبيب"}, + "good": {"en": "Good", "ar": "جيد"}, + "v-good": {"en": "Very Good", "ar": "جيد جدا"}, + "excellent": {"en": "Excellent", "ar": "ممتاز"}, + "average": {"en": "Average", "ar": "متوسط"}, + "below-average": {"en": "Below Average", "ar": "أقل من المتوسط"}, + "info-signs": { "en": - "Please ensure that the email address is up-to-date and process to view the schedule", - "ar": "يرجى التأكد من صحة عنوان البريد الالكتروني و المتابعة لعرض الجدول " + "This service allows you to view all vital signs were performed in the Habib Medical Group, e.x (height, weight, body mass index, heart rate, etc.) as well shows some statistics charts.", + "ar": + "خدمة المؤشرات الحيوية: هذه الخدمة تمكنك من الاطلاع على جميع المؤشرات الحيوية على سبيل المثال (الطول، الوزن، مؤشر كتلة الجسم، معدل نبضات القلب الخ..) التي تمت في مجموعة الحبيب الطبية وكذلك رسوم بيانية على مستوى المؤشر." }, - "update-email": {"en": "Update Email", "ar": "تحديث البريد الالكتروني"}, - - "updated-email": { - "en": "Updated email successfully", - "ar": "تم تحديث البريد الالكتروني" + "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": + "تم تصميم هذه الخدمة حتى تتمكن من دفع مبلغ مقدما او تحت الحساب سواء في حسابك او في حساب شخص اخر لدى مجموعة الحبيب الطبية." }, - - "view-list-children": { - "en": "View List of Children", - "ar": "عرض قائمة الأطفال" + "info-my-balance": { + "en": "This service allows you to check your balance in all branchs", + "ar": "هذه الخدمه تتيح لك الاطلاع رصيدك في كل الفروع" }, - - "add-child": {"en": "Add New Child", "ar": "اضافة طفل"}, - "child-name": {"en": "Child Name", "ar": "اسم الطفل"}, - "childDob": {"en": "Birth Date", "ar": "تاريخ الولادة"}, - "deleted-child-mes": { + "er-contant": { "en": - "The request was successful. The children have removed from the vaccination schedule subscription service.", - "ar": "تم حذف الطفل بنجاح" + "This service displays nearest branch among all the branches of Al Habib Medical Group based on your current location.", + "ar": + "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." }, - "deleted-child": {"en": "Delete child", "ar": "إالغاء الطفل"}, - "visit": {"en": "Visit", "ar": "زيارة"}, - "description-vaccination": {"en": "Description", "ar": "وصف"}, - "due-date": {"en": "Due date", "ar": "تاريخ الاستحقاق"}, - "valid-email": { - "en": "Please enter valid email", - "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": "حدد طريقة النقل" + }, + "RRT-direction-heading": {"en": "Select Direction", "ar": "حدد الاتجاه"}, + "to-hospital": {"en": "To Hospital", "ar": "الى المستشفى"}, + "from-hospital": {"en": "From Hospital", "ar": "من المستشفى"}, + "one-direc": {"en": "One Way", "ar": "ذهاب"}, + "two-direc": {"en": "Two Ways", "ar": "ذهاب وعودة"}, + "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": "هل لديك موعد؟"}, + "dropoff-location": {"en": "Dropoff Location", "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": "ليس لديك أي مواعيد حتى الآن" + }, + "patient-share": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, + "patient-share-tax": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, + "patient-share-total": { + "en": "Total amount payable: ", + "ar": "المبلغ الإجمالي المستحق:" }, - "confirm-send": { - "en": "Send the child's schedule to the email?", - "ar": "ارسال جدول التطعيمات الى بريدك الالكتروني؟" + "select-ambulate": {"en": "Select Ambulate", "ar": "بحاجة للتنقل بواسطة"}, + "wheelchair": {"en": "Wheelchair", "ar": "كرسي متحرك"}, + "walker": {"en": "Walker", "ar": "مشاية"}, + "stretcher": {"en": "Stretcher", "ar": "نقالة"}, + "none": {"en": "None", "ar": "لا شيء"}, + "RRT-Summary": {"en": "Summary", "ar": "ملخص الطلب"}, + "bill-amount": {"en": "Bill Amount", "ar": "مبلغ الفاتورة"}, + "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": + "خدمة مواعيدي: هذه الخدمة تمكنك من الاطلاع على جميع المواعيد التي قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" }, - "email-success": { + "info-todo": { "en": - " The request was successful. You will receive the Schedule in moments.", - "ar": "تم ارسال جدول التطعيمات " + "This service is designed to enable you to have a quick link to the list of tasks that need to be done", + "ar": + "هذه الخدمة تم تصميمها لتمكنك من الوصول الى رابط سريع لقائمة المهام التي يجب القيام بها" }, - "add-instructions": { + "family-info": { "en": - "Add the child's information below to recieve the schedule of vaccinations.", - "ar": "أضف معلومات الطفل لاستلام جدول التطعيمات" + "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": "تم تحديث البيانات بنجاح" + }, + "dental-complains": {"en": "Symptoms", "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": "لا توجد مواعيد مؤكدة" }, - "added-child": { + "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": "حساب كمية الماء"}, + "v-tour": {"en": "Virtual Tour", "ar": "جولة إفتراضية"}, + "hmg-news": {"en": "HMG News", "ar": "أخبار المجموعة"}, + "blood-d": {"en": "Blood Donation", "ar": "تبرع بالدم"}, + "symptomCheckerTitle": {"en": "Symptom Checker", "ar": "مدقق الأعراض"}, + "latest-news": {"en": "Latest News", "ar": "أحدث الأخبار"}, + "our-location": {"en": "Our Locations", "ar": "موقعنا"}, + "pharmacies": {"en": "Pharmacies", "ar": "الصيدليات"}, + "hospitals": {"en": "Hospitals", "ar": "المستشفيات"}, + "wallet": {"en": "Wallet", "ar": "محفظة نقود"}, + "hmg": {"en": "Al Habib", "ar": "الحبيب"}, + + "requested": {"en": "Requested", "ar": "مطلوب"}, + "ready": {"en": "Ready", "ar": "جاهز"}, + "completed": {"en": "Completed", "ar": "مكتمل"}, + + "request-medical-report": { + "en": "Request medical report", + "ar": "طلب تقرير طبي" + }, + "insur-cards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, + 'labResult': {"en": "Lab results", "ar": "نتائج التحاليل المخبرية"}, + 'details': {'en': 'Details', 'ar': 'التفاصيل'}, + "age": {"en": "Age", "ar": "العمر"}, + "active-insurence": {"en": "Active", "ar": "نشطة"}, + "not-active": {"en": "Not Active", "ar": "غير نشط"}, + "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": "كيف تقيم زيارتك الأخيرة للطبيب؟" + }, + "tap-title": {"en": "Please rate the doctor", "ar": "يرجى تقييم الطبيب"}, + "later": {"en": "Later", "ar": "لاحقاً"}, + "sendSuc": { + "en": "A copy has been sent to the email", + "ar": "تم إرسال نسخة إلى البريد الإلكتروني" + }, + "instructions": { "en": - "The request was successful. You have added a child to the vaccination schedule subscription service.", - "ar": "تمت الاضافة بنجاح." + "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": + "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال" }, - "appUpdate": {"en": "UPDATE THE APP", "ar": "تحديث التطبيق"}, - "ereferralSaveSuccess": { + "select-hospital": {"en": "Choose Hospital", "ar": "اختر المستشفى"}, + "start": {"en": "Start", "ar": "ابدأ"}, + "info-chat": { "en": - "The referral request has been submitted successfully, you will be contacted ASAP to complete the process. Referral request no is ", + "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": "أرسل نسخة من هذا التقرير إلى البريد الإلكتروني" + }, + "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": " لا يوجد بيانات متاحة " + }, + "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": "إرفاق صورة بطاقة التأمين" + }, + "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":"تخصيص" + }, + + "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", + "ar": " أوافق على شروط الخدمة وألتزم بها دون قيد أو شرط" }, "Year": {"en": "YEAR", "ar": "السنة"}, "Month": {"en": "MONTH", "ar": "الشهر"}, @@ -1164,4 +1428,26 @@ const Map localizedValues = { "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": "ارسال جدول التطعيمات الى بريدك الالكتروني؟" + }, + "vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"}, + "welcomeBack": {"en": "Welcome back", "ar": "مرحبا مرة أخرى"}, + + "updated-email": { + "en": "Updated email successfully", + "ar": "تم تحديث البريد الالكتروني" + }, + + "view-list-children": { + "en": "View List of Children", + "ar": "عرض قائمة الأطفال" + }, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 9e57990c..458040bb 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -20,4 +20,9 @@ const IS_VIBRATION = 'is_vibration'; const THEME_VALUE = 'is_vibration'; const MAIN_USER = 'main-user'; const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited'; +const HMG_GEOFENCES = 'hmg-geo-fences'; const PHARMACY_CUSTOMER_ID = 'costumer-id'; +const WEATHER = 'weather'; +const BLOOD_TYPE = 'blood-type'; +const NOTIFICATION_COUNT = 'notification-count'; +const PHARMACY_SELECTED_ADDRESS = 'selected-address'; diff --git a/lib/core/model/ImagesInfo.dart b/lib/core/model/ImagesInfo.dart new file mode 100644 index 00000000..5ab48fb3 --- /dev/null +++ b/lib/core/model/ImagesInfo.dart @@ -0,0 +1,6 @@ +class ImagesInfo { + final String imageAr; + final String imageEn; + + ImagesInfo({this.imageAr, this.imageEn}); +} diff --git a/lib/core/model/geofencing/requests/GeoZonesRequestModel.dart b/lib/core/model/geofencing/requests/GeoZonesRequestModel.dart new file mode 100644 index 00000000..219c46ae --- /dev/null +++ b/lib/core/model/geofencing/requests/GeoZonesRequestModel.dart @@ -0,0 +1,11 @@ +class GeoZonesRequestModel { + final String PatientID; + + GeoZonesRequestModel({this.PatientID}); + + Map toFlatMap() { + if (PatientID == null) return {}; + + return {"PatientID": PatientID.toString()}; + } +} diff --git a/lib/core/model/geofencing/requests/LogGeoZoneRequestModel.dart b/lib/core/model/geofencing/requests/LogGeoZoneRequestModel.dart new file mode 100644 index 00000000..e21a7d69 --- /dev/null +++ b/lib/core/model/geofencing/requests/LogGeoZoneRequestModel.dart @@ -0,0 +1,12 @@ +import 'package:flutter/cupertino.dart'; + +class LogGeoZoneRequestModel { + final int PointsID; + final int GeoType; + + LogGeoZoneRequestModel({@required this.PointsID, @required this.GeoType}); + + Map toFlatMap() { + return {"PointsID": PointsID.toString(), "GeoType": GeoType.toString()}; + } +} diff --git a/lib/core/model/geofencing/responses/GeoZonesResponseModel.dart b/lib/core/model/geofencing/responses/GeoZonesResponseModel.dart new file mode 100644 index 00000000..58771fab --- /dev/null +++ b/lib/core/model/geofencing/responses/GeoZonesResponseModel.dart @@ -0,0 +1,62 @@ +import 'package:diplomaticquarterapp/generated/json/base/json_convert_content.dart'; +import 'package:diplomaticquarterapp/generated/json/base/json_field.dart'; + +class GeoZonesResponseModel with JsonConvert { + @JSONField(name: "GEOF_ID") + int geofId; + @JSONField(name: "Description") + String description; + @JSONField(name: "DescriptionN") + String descriptionN; + @JSONField(name: "Latitude") + String latitude; + @JSONField(name: "Longitude") + String longitude; + @JSONField(name: "Radius") + int radius; + @JSONField(name: "Type") + int type; + @JSONField(name: "ProjectID") + int projectID; + @JSONField(name: "ImageURL") + String imageURL; + @JSONField(name: "IsCity") + bool isCity; + + // Outside Server Response + bool isRegistered = false; + bool onEntry = true; + bool onExit = true; + + String geofenceId() { + return "$geofId\_${description.replaceAll(" ", "")}"; + } + + static get(String coordinates, int radius, String name) { + coordinates = coordinates.replaceAll(" ", ""); + var geo = GeoZonesResponseModel(); + geo.latitude = coordinates.split(",").first; + geo.longitude = coordinates.split(",").last; + geo.radius = radius; + geo.description = name; + return geo; + } + + static GeoZonesResponseModel zkH() { + var geo = GeoZonesResponseModel(); + geo.latitude = "24.691136"; + geo.longitude = "46.650116"; + geo.radius = 150; + geo.description = "zkH"; + return geo; + } + + static GeoZonesResponseModel csO() { + var geo = GeoZonesResponseModel(); + geo.latitude = "24.7087913"; + geo.longitude = "46.6656461"; + geo.radius = 150; + geo.description = "csO"; + return geo; + } +} diff --git a/lib/core/model/geofencing/responses/LogGeoZoneResponseModel.dart b/lib/core/model/geofencing/responses/LogGeoZoneResponseModel.dart new file mode 100644 index 00000000..2242755f --- /dev/null +++ b/lib/core/model/geofencing/responses/LogGeoZoneResponseModel.dart @@ -0,0 +1,26 @@ +import 'package:diplomaticquarterapp/generated/json/base/json_convert_content.dart'; +import 'package:diplomaticquarterapp/generated/json/base/json_field.dart'; + +class LogGeoZoneResponseModel with JsonConvert { + @JSONField(name: "LanguageID") + int languageID; + @JSONField(name: "ErrorCode") + dynamic errorCode; + @JSONField(name: "ErrorEndUserMessage") + String errorEndUserMessage; + @JSONField(name: "ErrorEndUserMessageN") + dynamic errorEndUserMessageN; + @JSONField(name: "ErrorMessage") + dynamic errorMessage; + @JSONField(name: "ErrorType") + int errorType; + @JSONField(name: "IsAuthenticated") + bool isAuthenticated; + @JSONField(name: "SuccessMsg") + dynamic successMsg; + @JSONField(name: "SuccessMsgN") + dynamic successMsgN; + int statusCode; + @JSONField(name: "MessageStatus") + int messageStatus; +} diff --git a/lib/core/model/insurance/Insurance_card_details.dart b/lib/core/model/insurance/Insurance_card_details.dart new file mode 100644 index 00000000..ddc33b2e --- /dev/null +++ b/lib/core/model/insurance/Insurance_card_details.dart @@ -0,0 +1,88 @@ +class InsuranceCardDetailsModel { + int approvalLimit; + int companyGroupID; + String companyName; + String companyRemarks; + String dOB; + int deductible; + String effectiveFrom; + String effectiveTo; + String eligabilityFailureReason; + bool isMemberEligible; + String memberID; + String memberName; + String memberStatus; + dynamic message; + String nationalId; + String policyNumber; + String responseMessage; + String room; + String subCategory; + + InsuranceCardDetailsModel( + {this.approvalLimit, + this.companyGroupID, + this.companyName, + this.companyRemarks, + this.dOB, + this.deductible, + this.effectiveFrom, + this.effectiveTo, + this.eligabilityFailureReason, + this.isMemberEligible, + this.memberID, + this.memberName, + this.memberStatus, + this.message, + this.nationalId, + this.policyNumber, + this.responseMessage, + this.room, + this.subCategory}); + + InsuranceCardDetailsModel.fromJson(Map json) { + approvalLimit = json['ApprovalLimit']; + companyGroupID = json['CompanyGroupID']; + companyName = json['CompanyName']; + companyRemarks = json['CompanyRemarks']; + dOB = json['DOB']; + deductible = json['Deductible']; + effectiveFrom = json['EffectiveFrom']; + effectiveTo = json['EffectiveTo']; + eligabilityFailureReason = json['EligabilityFailureReason']; + isMemberEligible = json['IsMemberEligible']; + memberID = json['MemberID']; + memberName = json['MemberName']; + memberStatus = json['MemberStatus']; + message = json['Message']; + nationalId = json['NationalId']; + policyNumber = json['PolicyNumber']; + responseMessage = json['ResponseMessage']; + room = json['Room']; + subCategory = json['SubCategory']; + } + + Map toJson() { + final Map data = new Map(); + data['ApprovalLimit'] = this.approvalLimit; + data['CompanyGroupID'] = this.companyGroupID; + data['CompanyName'] = this.companyName; + data['CompanyRemarks'] = this.companyRemarks; + data['DOB'] = this.dOB; + data['Deductible'] = this.deductible; + data['EffectiveFrom'] = this.effectiveFrom; + data['EffectiveTo'] = this.effectiveTo; + data['EligabilityFailureReason'] = this.eligabilityFailureReason; + data['IsMemberEligible'] = this.isMemberEligible; + data['MemberID'] = this.memberID; + data['MemberName'] = this.memberName; + data['MemberStatus'] = this.memberStatus; + data['Message'] = this.message; + data['NationalId'] = this.nationalId; + data['PolicyNumber'] = this.policyNumber; + data['ResponseMessage'] = this.responseMessage; + data['Room'] = this.room; + data['SubCategory'] = this.subCategory; + return data; + } +} diff --git a/lib/core/model/insurance/insurance_card_update.dart b/lib/core/model/insurance/insurance_card_update_model.dart similarity index 100% rename from lib/core/model/insurance/insurance_card_update.dart rename to lib/core/model/insurance/insurance_card_update_model.dart diff --git a/lib/core/model/labs/LabOrderResult.dart b/lib/core/model/labs/LabOrderResult.dart new file mode 100644 index 00000000..ecb4ae65 --- /dev/null +++ b/lib/core/model/labs/LabOrderResult.dart @@ -0,0 +1,88 @@ +class LabOrderResult { + String description; + dynamic femaleInterpretativeData; + int gender; + int lineItemNo; + dynamic maleInterpretativeData; + dynamic notes; + String packageID; + int patientID; + String projectID; + String referanceRange; + String resultValue; + String sampleCollectedOn; + String sampleReceivedOn; + String setupID; + dynamic superVerifiedOn; + String testCode; + String uOM; + String verifiedOn; + String verifiedOnDateTime; + + LabOrderResult( + {this.description, + this.femaleInterpretativeData, + this.gender, + this.lineItemNo, + this.maleInterpretativeData, + this.notes, + this.packageID, + this.patientID, + this.projectID, + this.referanceRange, + this.resultValue, + this.sampleCollectedOn, + this.sampleReceivedOn, + this.setupID, + this.superVerifiedOn, + this.testCode, + this.uOM, + this.verifiedOn, + this.verifiedOnDateTime}); + + LabOrderResult.fromJson(Map json) { + description = json['Description']; + femaleInterpretativeData = json['FemaleInterpretativeData']; + gender = json['Gender']; + lineItemNo = json['LineItemNo']; + maleInterpretativeData = json['MaleInterpretativeData']; + notes = json['Notes']; + packageID = json['PackageID']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + referanceRange = json['ReferanceRange']; + resultValue = json['ResultValue']; + sampleCollectedOn = json['SampleCollectedOn']; + sampleReceivedOn = json['SampleReceivedOn']; + setupID = json['SetupID']; + superVerifiedOn = json['SuperVerifiedOn']; + testCode = json['TestCode']; + uOM = json['UOM']; + verifiedOn = json['VerifiedOn']; + verifiedOnDateTime = json['VerifiedOnDateTime']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['FemaleInterpretativeData'] = this.femaleInterpretativeData; + data['Gender'] = this.gender; + data['LineItemNo'] = this.lineItemNo; + data['MaleInterpretativeData'] = this.maleInterpretativeData; + data['Notes'] = this.notes; + data['PackageID'] = this.packageID; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ReferanceRange'] = this.referanceRange; + data['ResultValue'] = this.resultValue; + data['SampleCollectedOn'] = this.sampleCollectedOn; + data['SampleReceivedOn'] = this.sampleReceivedOn; + data['SetupID'] = this.setupID; + data['SuperVerifiedOn'] = this.superVerifiedOn; + data['TestCode'] = this.testCode; + data['UOM'] = this.uOM; + data['VerifiedOn'] = this.verifiedOn; + data['VerifiedOnDateTime'] = this.verifiedOnDateTime; + return data; + } +} diff --git a/lib/core/model/labs/lab_result.dart b/lib/core/model/labs/lab_result.dart index c9acd809..2deb13f3 100644 --- a/lib/core/model/labs/lab_result.dart +++ b/lib/core/model/labs/lab_result.dart @@ -1,9 +1,9 @@ class LabResult { String description; - Null femaleInterpretativeData; + dynamic femaleInterpretativeData; int gender; int lineItemNo; - Null maleInterpretativeData; + dynamic maleInterpretativeData; String notes; String packageID; int patientID; @@ -13,11 +13,11 @@ class LabResult { String sampleCollectedOn; String sampleReceivedOn; String setupID; - Null superVerifiedOn; + dynamic superVerifiedOn; String testCode; String uOM; String verifiedOn; - Null verifiedOnDateTime; + dynamic verifiedOnDateTime; LabResult( {this.description, @@ -92,8 +92,7 @@ class LabResultList { String filterName = ""; List patientLabResultList = List(); - LabResultList( - {this.filterName, LabResult lab}) { + LabResultList({this.filterName, LabResult lab}) { patientLabResultList.add(lab); } } diff --git a/lib/core/model/labs/patient_lab_orders.dart b/lib/core/model/labs/patient_lab_orders.dart index 26daaff0..3c49b80a 100644 --- a/lib/core/model/labs/patient_lab_orders.dart +++ b/lib/core/model/labs/patient_lab_orders.dart @@ -34,7 +34,7 @@ class PatientLabOrders { String qR; String setupID; List speciality; - + bool isLiveCareAppointment; PatientLabOrders( {this.actualDoctorRate, this.clinicDescription, @@ -68,7 +68,7 @@ class PatientLabOrders { this.projectNameN, this.qR, this.setupID, - this.speciality}); + this.speciality,this.isLiveCareAppointment}); PatientLabOrders.fromJson(Map json) { actualDoctorRate = json['ActualDoctorRate']; @@ -103,6 +103,7 @@ class PatientLabOrders { projectNameN = json['ProjectNameN']; qR = json['QR']; setupID = json['SetupID']; + isLiveCareAppointment = json['IsLiveCareAppointment']; // speciality = json['Speciality'].cast(); } @@ -141,6 +142,7 @@ class PatientLabOrders { data['QR'] = this.qR; data['SetupID'] = this.setupID; data['Speciality'] = this.speciality; + data['IsLiveCareAppointment'] = this.isLiveCareAppointment; return data; } } diff --git a/lib/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart b/lib/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart new file mode 100644 index 00000000..f2f4af11 --- /dev/null +++ b/lib/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart @@ -0,0 +1,11 @@ +class OffersCategoriesRequestModel { + final int limit; + final int page; + final int sinceId; + + OffersCategoriesRequestModel({this.limit, this.page, this.sinceId}); + + Map toFlatMap() { + return {"limit": limit.toString(), "page": page.toString(), "sinceId": sinceId.toString()}; + } +} diff --git a/lib/core/model/packages_offers/requests/OffersProductsRequestModel.dart b/lib/core/model/packages_offers/requests/OffersProductsRequestModel.dart new file mode 100644 index 00000000..84862568 --- /dev/null +++ b/lib/core/model/packages_offers/requests/OffersProductsRequestModel.dart @@ -0,0 +1,12 @@ +class OffersProductsRequestModel { + final int categoryId; + final int limit; + final int page; + final int sinceId; + + OffersProductsRequestModel({this.categoryId, this.limit, this.page, this.sinceId}); + + Map toFlatMap() { + return {"limit": limit.toString(), "page": page.toString(), "sinceId": sinceId.toString(), "categoryId": categoryId.toString()}; + } +} diff --git a/lib/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart b/lib/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart new file mode 100644 index 00000000..087f1961 --- /dev/null +++ b/lib/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart @@ -0,0 +1,65 @@ +import 'package:diplomaticquarterapp/generated/json/base/json_convert_content.dart'; +import 'package:diplomaticquarterapp/generated/json/base/json_field.dart'; + +class OfferCategoriesResponseModel with JsonConvert { + String id; + String name; + String namen; + @JSONField(name: "localized_names") + List localizedNames; + dynamic description; + @JSONField(name: "category_template_id") + int categoryTemplateId; + @JSONField(name: "meta_keywords") + String metaKeywords; + @JSONField(name: "meta_description") + String metaDescription; + @JSONField(name: "meta_title") + String metaTitle; + @JSONField(name: "parent_category_id") + int parentCategoryId; + @JSONField(name: "page_size") + int pageSize; + @JSONField(name: "page_size_options") + String pageSizeOptions; + @JSONField(name: "price_ranges") + dynamic priceRanges; + @JSONField(name: "show_on_home_page") + bool showOnHomePage; + @JSONField(name: "include_in_top_menu") + bool includeInTopMenu; + @JSONField(name: "has_discounts_applied") + dynamic hasDiscountsApplied; + bool published; + bool deleted; + @JSONField(name: "display_order") + int displayOrder; + @JSONField(name: "created_on_utc") + String createdOnUtc; + @JSONField(name: "updated_on_utc") + String updatedOnUtc; + @JSONField(name: "role_ids") + List roleIds; + @JSONField(name: "discount_ids") + List discountIds; + @JSONField(name: "store_ids") + List storeIds; + OfferCategoriesResponseModelImage image; + @JSONField(name: "se_name") + String seName; + @JSONField(name: "is_leaf") + bool isLeaf; +} + +class OfferCategoriesResponseModelLocalizedName with JsonConvert { + @JSONField(name: "language_id") + int languageId; + @JSONField(name: "localized_name") + String localizedName; +} + +class OfferCategoriesResponseModelImage with JsonConvert { + String src; + dynamic thumb; + dynamic attachment; +} diff --git a/lib/core/model/packages_offers/responses/OfferProductsResponseModel.dart b/lib/core/model/packages_offers/responses/OfferProductsResponseModel.dart new file mode 100644 index 00000000..58481a8b --- /dev/null +++ b/lib/core/model/packages_offers/responses/OfferProductsResponseModel.dart @@ -0,0 +1,235 @@ +import 'package:diplomaticquarterapp/generated/json/base/json_convert_content.dart'; +import 'package:diplomaticquarterapp/generated/json/base/json_field.dart'; + +class OfferProductsResponseModel with JsonConvert { + String id; + @JSONField(name: "visible_individually") + bool visibleIndividually; + String name; + String namen; + @JSONField(name: "localized_names") + List localizedNames; + @JSONField(name: "short_description") + String shortDescription; + @JSONField(name: "short_descriptionn") + String shortDescriptionn; + @JSONField(name: "full_description") + String fullDescription; + @JSONField(name: "full_descriptionn") + String fullDescriptionn; + @JSONField(name: "markas_new") + bool markasNew; + @JSONField(name: "show_on_home_page") + bool showOnHomePage; + @JSONField(name: "meta_keywords") + dynamic metaKeywords; + @JSONField(name: "meta_description") + dynamic metaDescription; + @JSONField(name: "meta_title") + dynamic metaTitle; + @JSONField(name: "allow_customer_reviews") + bool allowCustomerReviews; + @JSONField(name: "approved_rating_sum") + int approvedRatingSum; + @JSONField(name: "not_approved_rating_sum") + int notApprovedRatingSum; + @JSONField(name: "approved_total_reviews") + int approvedTotalReviews; + @JSONField(name: "not_approved_total_reviews") + int notApprovedTotalReviews; + String sku; + @JSONField(name: "is_rx") + bool isRx; + @JSONField(name: "prescription_required") + bool prescriptionRequired; + @JSONField(name: "rx_message") + dynamic rxMessage; + @JSONField(name: "rx_messagen") + dynamic rxMessagen; + @JSONField(name: "manufacturer_part_number") + dynamic manufacturerPartNumber; + dynamic gtin; + @JSONField(name: "is_gift_card") + bool isGiftCard; + @JSONField(name: "require_other_products") + bool requireOtherProducts; + @JSONField(name: "automatically_add_required_products") + bool automaticallyAddRequiredProducts; + @JSONField(name: "is_download") + bool isDownload; + @JSONField(name: "unlimited_downloads") + bool unlimitedDownloads; + @JSONField(name: "max_number_of_downloads") + int maxNumberOfDownloads; + @JSONField(name: "download_expiration_days") + dynamic downloadExpirationDays; + @JSONField(name: "has_sample_download") + bool hasSampleDownload; + @JSONField(name: "has_user_agreement") + bool hasUserAgreement; + @JSONField(name: "is_recurring") + bool isRecurring; + @JSONField(name: "recurring_cycle_length") + int recurringCycleLength; + @JSONField(name: "recurring_total_cycles") + int recurringTotalCycles; + @JSONField(name: "is_rental") + bool isRental; + @JSONField(name: "rental_price_length") + int rentalPriceLength; + @JSONField(name: "is_ship_enabled") + bool isShipEnabled; + @JSONField(name: "is_free_shipping") + bool isFreeShipping; + @JSONField(name: "ship_separately") + bool shipSeparately; + @JSONField(name: "additional_shipping_charge") + double additionalShippingCharge; + @JSONField(name: "is_tax_exempt") + bool isTaxExempt; + @JSONField(name: "is_telecommunications_or_broadcasting_or_electronic_services") + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + @JSONField(name: "use_multiple_warehouses") + bool useMultipleWarehouses; + @JSONField(name: "manage_inventory_method_id") + int manageInventoryMethodId; + @JSONField(name: "stock_quantity") + int stockQuantity; + @JSONField(name: "stock_availability") + String stockAvailability; + @JSONField(name: "stock_availabilityn") + String stockAvailabilityn; + @JSONField(name: "display_stock_availability") + bool displayStockAvailability; + @JSONField(name: "display_stock_quantity") + bool displayStockQuantity; + @JSONField(name: "min_stock_quantity") + int minStockQuantity; + @JSONField(name: "notify_admin_for_quantity_below") + int notifyAdminForQuantityBelow; + @JSONField(name: "allow_back_in_stock_subscriptions") + bool allowBackInStockSubscriptions; + @JSONField(name: "order_minimum_quantity") + int orderMinimumQuantity; + @JSONField(name: "order_maximum_quantity") + int orderMaximumQuantity; + @JSONField(name: "allowed_quantities") + dynamic allowedQuantities; + @JSONField(name: "allow_adding_only_existing_attribute_combinations") + bool allowAddingOnlyExistingAttributeCombinations; + @JSONField(name: "disable_buy_button") + bool disableBuyButton; + @JSONField(name: "disable_wishlist_button") + bool disableWishlistButton; + @JSONField(name: "available_for_pre_order") + bool availableForPreOrder; + @JSONField(name: "pre_order_availability_start_date_time_utc") + dynamic preOrderAvailabilityStartDateTimeUtc; + @JSONField(name: "call_for_price") + bool callForPrice; + double price; + @JSONField(name: "old_price") + double oldPrice; + @JSONField(name: "product_cost") + double productCost; + @JSONField(name: "special_price") + dynamic specialPrice; + @JSONField(name: "special_price_start_date_time_utc") + dynamic specialPriceStartDateTimeUtc; + @JSONField(name: "special_price_end_date_time_utc") + dynamic specialPriceEndDateTimeUtc; + @JSONField(name: "customer_enters_price") + bool customerEntersPrice; + @JSONField(name: "minimum_customer_entered_price") + double minimumCustomerEnteredPrice; + @JSONField(name: "maximum_customer_entered_price") + double maximumCustomerEnteredPrice; + @JSONField(name: "baseprice_enabled") + bool basepriceEnabled; + @JSONField(name: "baseprice_amount") + double basepriceAmount; + @JSONField(name: "baseprice_base_amount") + double basepriceBaseAmount; + @JSONField(name: "has_tier_prices") + bool hasTierPrices; + @JSONField(name: "has_discounts_applied") + bool hasDiscountsApplied; + @JSONField(name: "discount_name") + dynamic discountName; + @JSONField(name: "discount_namen") + dynamic discountNamen; + @JSONField(name: "discount_description") + dynamic discountDescription; + @JSONField(name: "discount_Descriptionn") + dynamic discountDescriptionn; + @JSONField(name: "discount_percentage") + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + double length; + double width; + double height; + @JSONField(name: "available_start_date_time_utc") + dynamic availableStartDateTimeUtc; + @JSONField(name: "available_end_date_time_utc") + dynamic availableEndDateTimeUtc; + @JSONField(name: "display_order") + int displayOrder; + bool published; + bool deleted; + @JSONField(name: "created_on_utc") + String createdOnUtc; + @JSONField(name: "updated_on_utc") + String updatedOnUtc; + @JSONField(name: "product_type") + String productType; + @JSONField(name: "parent_grouped_product_id") + int parentGroupedProductId; + @JSONField(name: "role_ids") + List roleIds; + @JSONField(name: "discount_ids") + List discountIds; + @JSONField(name: "store_ids") + List storeIds; + @JSONField(name: "manufacturer_ids") + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + @JSONField(name: "associated_product_ids") + List associatedProductIds; + List tags; + @JSONField(name: "vendor_id") + int vendorId; + @JSONField(name: "se_name") + String seName; +} + +class OfferProductsResponseModelLocalizedName with JsonConvert { + @JSONField(name: "language_id") + int languageId; + @JSONField(name: "localized_name") + String localizedName; +} + +class OfferProductsResponseModelImage with JsonConvert { + int id; + int position; + String src; + String thumb; + String attachment; +} + +class OfferProductsResponseModelSpecification with JsonConvert { + int id; + @JSONField(name: "display_order") + int displayOrder; + @JSONField(name: "default_value") + String defaultValue; + @JSONField(name: "default_valuen") + String defaultValuen; + String name; + String nameN; +} diff --git a/lib/core/model/pharmacies/Country.dart b/lib/core/model/pharmacies/Country.dart new file mode 100644 index 00000000..77f519d3 --- /dev/null +++ b/lib/core/model/pharmacies/Country.dart @@ -0,0 +1,32 @@ +class CountryData { + int id; + String name; + String namen; + String twoLetterIsoCode; + String threeLetterIsoCode; + + CountryData( + {this.id, + this.name, + this.namen, + this.twoLetterIsoCode, + this.threeLetterIsoCode}); + + CountryData.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + twoLetterIsoCode = json['two_letter_iso_code']; + threeLetterIsoCode = json['three_letter_iso_code']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + data['two_letter_iso_code'] = this.twoLetterIsoCode; + data['three_letter_iso_code'] = this.threeLetterIsoCode; + return data; + } +} diff --git a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart index 809277e1..c609fa0b 100644 --- a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart +++ b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart @@ -27,9 +27,9 @@ class LakumInquiryInformationObjVersion { int transferPoints; List transferPointsAmountPerYear; List transferPointsDetails; - int waitingPoints; - int loyalityAmount; - int loyalityPoints; + dynamic waitingPoints; + dynamic loyalityAmount; + dynamic loyalityPoints; int purchaseRate; LakumInquiryInformationObjVersion( diff --git a/lib/core/model/pharmacies/ShippingOption.dart b/lib/core/model/pharmacies/ShippingOption.dart index 309e1f4f..1b589537 100644 --- a/lib/core/model/pharmacies/ShippingOption.dart +++ b/lib/core/model/pharmacies/ShippingOption.dart @@ -45,8 +45,7 @@ class ShippingOption { this.allowShippingNoten}); ShippingOption.fromJson(Map json) { - shippingRateComputationMethodSystemName = - json['shipping_rate_computation_method_system_name']; + shippingRateComputationMethodSystemName = json['shipping_rate_computation_method_system_name']; rate = json['rate']; rateVat = json['rate_vat']; rateVatPercent = json['rate_vat_percent']; diff --git a/lib/core/model/pharmacy/parent_products_model.dart b/lib/core/model/pharmacy/parent_products_model.dart index e962c290..55495416 100644 --- a/lib/core/model/pharmacy/parent_products_model.dart +++ b/lib/core/model/pharmacy/parent_products_model.dart @@ -265,7 +265,7 @@ class ParentProductsModel { isGiftCard = json['is_gift_card']; requireOtherProducts = json['require_other_products']; automaticallyAddRequiredProducts = - json['automatically_add_required_products']; + json['automatically_add_required_products']; isDownload = json['is_download']; unlimitedDownloads = json['unlimited_downloads']; maxNumberOfDownloads = json['max_number_of_downloads']; @@ -283,7 +283,7 @@ class ParentProductsModel { additionalShippingCharge = json['additional_shipping_charge']; isTaxExempt = json['is_tax_exempt']; isTelecommunicationsOrBroadcastingOrElectronicServices = - json['is_telecommunications_or_broadcasting_or_electronic_services']; + json['is_telecommunications_or_broadcasting_or_electronic_services']; useMultipleWarehouses = json['use_multiple_warehouses']; manageInventoryMethodId = json['manage_inventory_method_id']; stockQuantity = json['stock_quantity']; @@ -298,12 +298,12 @@ class ParentProductsModel { orderMaximumQuantity = json['order_maximum_quantity']; allowedQuantities = json['allowed_quantities']; allowAddingOnlyExistingAttributeCombinations = - json['allow_adding_only_existing_attribute_combinations']; + json['allow_adding_only_existing_attribute_combinations']; disableBuyButton = json['disable_buy_button']; disableWishlistButton = json['disable_wishlist_button']; availableForPreOrder = json['available_for_pre_order']; preOrderAvailabilityStartDateTimeUtc = - json['pre_order_availability_start_date_time_utc']; + json['pre_order_availability_start_date_time_utc']; callForPrice = json['call_for_price']; price = json['price']; oldPrice = json['old_price']; @@ -538,11 +538,11 @@ class Specifications { Specifications( {this.id, - this.displayOrder, - this.defaultValue, - this.defaultValuen, - this.name, - this.nameN}); + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); Specifications.fromJson(Map json) { id = json['id']; diff --git a/lib/core/model/prescriptions/Prescriptions.dart b/lib/core/model/prescriptions/Prescriptions.dart index 1362f1c2..0169010f 100644 --- a/lib/core/model/prescriptions/Prescriptions.dart +++ b/lib/core/model/prescriptions/Prescriptions.dart @@ -27,6 +27,7 @@ class Prescriptions { bool isDoctorAllowVedioCall; bool isExecludeDoctor; bool isInOutPatient; + bool isLiveCareAppointment; String isInOutPatientDescription; String isInOutPatientDescriptionN; bool isInsurancePatient; @@ -68,7 +69,7 @@ class Prescriptions { this.nationalityFlagURL, this.noOfPatientsRate, this.qR, - this.speciality}); + this.speciality,this.isLiveCareAppointment}); Prescriptions.fromJson(Map json) { setupID = json['SetupID']; @@ -103,6 +104,7 @@ class Prescriptions { nationalityFlagURL = json['NationalityFlagURL']; noOfPatientsRate = json['NoOfPatientsRate']; qR = json['QR']; + isLiveCareAppointment = json['IsLiveCareAppointment']; // speciality = json['Speciality'].cast(); } @@ -141,6 +143,7 @@ class Prescriptions { data['NoOfPatientsRate'] = this.noOfPatientsRate; data['QR'] = this.qR; data['Speciality'] = this.speciality; + data['IsLiveCareAppointment'] = this.isLiveCareAppointment; return data; } } diff --git a/lib/core/model/prescriptions/request_prescription_report.dart b/lib/core/model/prescriptions/request_prescription_report.dart index df901a99..c8323740 100644 --- a/lib/core/model/prescriptions/request_prescription_report.dart +++ b/lib/core/model/prescriptions/request_prescription_report.dart @@ -82,7 +82,7 @@ class RequestPrescriptionReport { data['EpisodeID'] = this.episodeID; data['ClinicID'] = this.clinicID; data['ProjectID'] = this.projectID; - // data['DischargeNo'] = this.dischargeNo; + data['DischargeNo'] = this.dischargeNo; return data; } } diff --git a/lib/core/model/privilege/PrivilegeModel.dart b/lib/core/model/privilege/PrivilegeModel.dart new file mode 100644 index 00000000..3b629fde --- /dev/null +++ b/lib/core/model/privilege/PrivilegeModel.dart @@ -0,0 +1,24 @@ +class PrivilegeModel { + int iD; + String serviceName; + bool privilege; + dynamic region; + + PrivilegeModel({this.iD, this.serviceName, this.privilege, this.region}); + + PrivilegeModel.fromJson(Map json) { + iD = json['ID']; + serviceName = json['ServiceName']; + privilege = json['Previlege']; + region = json['Region']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['ServiceName'] = this.serviceName; + data['Previlege'] = this.privilege; + data['Region'] = this.region; + return data; + } +} diff --git a/lib/core/model/radiology/final_radiology.dart b/lib/core/model/radiology/final_radiology.dart index 2efe4481..ed47b51d 100644 --- a/lib/core/model/radiology/final_radiology.dart +++ b/lib/core/model/radiology/final_radiology.dart @@ -41,6 +41,7 @@ class FinalRadiology { List speciality; bool isCVI; bool isRadMedicalReport; + bool isLiveCareAppointment; FinalRadiology( {this.setupID, @@ -82,7 +83,7 @@ class FinalRadiology { this.reportDataTextString, this.speciality, this.isCVI, - this.isRadMedicalReport}); + this.isRadMedicalReport,this.isLiveCareAppointment}); FinalRadiology.fromJson(Map json) { try { @@ -121,11 +122,13 @@ class FinalRadiology { orderNo = json['OrderNo']; projectName = json['ProjectName']; qR = json['QR']; + isLiveCareAppointment = json['IsLiveCareAppointment']; reportDataHTML = json['ReportDataHTML']; reportDataTextString = json['ReportDataTextString']; // speciality = json['Speciality'].cast(); isCVI = json['isCVI']; isRadMedicalReport = json['isRadMedicalReport']; + } catch (e) { print(e); } diff --git a/lib/core/model/sick_leave/sick_leave.dart b/lib/core/model/sick_leave/sick_leave.dart index ff73e1da..6811a552 100644 --- a/lib/core/model/sick_leave/sick_leave.dart +++ b/lib/core/model/sick_leave/sick_leave.dart @@ -32,6 +32,7 @@ class SickLeave { String projectName; String qR; List speciality; + bool isLiveCareAppointment; SickLeave( {this.setupID, @@ -64,7 +65,7 @@ class SickLeave { this.patientName, this.projectName, this.qR, - this.speciality}); + this.speciality,this.isLiveCareAppointment}); SickLeave.fromJson(Map json) { setupID = json['SetupID']; @@ -97,6 +98,7 @@ class SickLeave { patientName = json['PatientName']; projectName = json['ProjectName']; qR = json['QR']; + isLiveCareAppointment = json['IsLiveCareAppointment']; if(json['Speciality']!=null) speciality = json['Speciality'].cast(); } diff --git a/lib/core/model/weahter/weather_model.dart b/lib/core/model/weahter/weather_model.dart new file mode 100644 index 00000000..37ee5983 --- /dev/null +++ b/lib/core/model/weahter/weather_model.dart @@ -0,0 +1,267 @@ +class WeatherIndicatorModel { + Null date; + int languageID; + int serviceName; + Null time; + Null androidLink; + Null authenticationTokenID; + Null data; + bool dataw; + int dietType; + Null errorCode; + Null errorEndUserMessage; + Null errorEndUserMessageN; + Null errorMessage; + int errorType; + int foodCategory; + Null iOSLink; + bool isAuthenticated; + int mealOrderStatus; + int mealType; + int messageStatus; + int numberOfResultRecords; + Null patientBlodType; + Null successMsg; + Null successMsgN; + Null citiesList; + Null cityName; + Null get5DaysWeatherForecastList; + List getCityInfoList; + Null getTodayWeatherForecastList; + Null iniciesList; + + WeatherIndicatorModel( + {this.date, + this.languageID, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenID, + this.data, + this.dataw, + this.dietType, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iOSLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.citiesList, + this.cityName, + this.get5DaysWeatherForecastList, + this.getCityInfoList, + this.getTodayWeatherForecastList, + this.iniciesList}); + + WeatherIndicatorModel.fromJson(Map json) { + date = json['Date']; + languageID = json['LanguageID']; + serviceName = json['ServiceName']; + time = json['Time']; + androidLink = json['AndroidLink']; + authenticationTokenID = json['AuthenticationTokenID']; + data = json['Data']; + dataw = json['Dataw']; + dietType = json['DietType']; + errorCode = json['ErrorCode']; + errorEndUserMessage = json['ErrorEndUserMessage']; + errorEndUserMessageN = json['ErrorEndUserMessageN']; + errorMessage = json['ErrorMessage']; + errorType = json['ErrorType']; + foodCategory = json['FoodCategory']; + iOSLink = json['IOSLink']; + isAuthenticated = json['IsAuthenticated']; + mealOrderStatus = json['MealOrderStatus']; + mealType = json['MealType']; + messageStatus = json['MessageStatus']; + numberOfResultRecords = json['NumberOfResultRecords']; + patientBlodType = json['PatientBlodType']; + successMsg = json['SuccessMsg']; + successMsgN = json['SuccessMsgN']; + citiesList = json['CitiesList']; + cityName = json['CityName']; + get5DaysWeatherForecastList = json['Get5DaysWeatherForecastList']; + if (json['GetCityInfo_List'] != null) { + getCityInfoList = new List(); + json['GetCityInfo_List'].forEach((v) { + getCityInfoList.add(new GetCityInfoList.fromJson(v)); + }); + } + getTodayWeatherForecastList = json['GetTodayWeatherForecastList']; + iniciesList = json['IniciesList']; + } + + Map toJson() { + final Map data = new Map(); + data['Date'] = this.date; + data['LanguageID'] = this.languageID; + data['ServiceName'] = this.serviceName; + data['Time'] = this.time; + data['AndroidLink'] = this.androidLink; + data['AuthenticationTokenID'] = this.authenticationTokenID; + data['Data'] = this.data; + data['Dataw'] = this.dataw; + data['DietType'] = this.dietType; + data['ErrorCode'] = this.errorCode; + data['ErrorEndUserMessage'] = this.errorEndUserMessage; + data['ErrorEndUserMessageN'] = this.errorEndUserMessageN; + data['ErrorMessage'] = this.errorMessage; + data['ErrorType'] = this.errorType; + data['FoodCategory'] = this.foodCategory; + data['IOSLink'] = this.iOSLink; + data['IsAuthenticated'] = this.isAuthenticated; + data['MealOrderStatus'] = this.mealOrderStatus; + data['MealType'] = this.mealType; + data['MessageStatus'] = this.messageStatus; + data['NumberOfResultRecords'] = this.numberOfResultRecords; + data['PatientBlodType'] = this.patientBlodType; + data['SuccessMsg'] = this.successMsg; + data['SuccessMsgN'] = this.successMsgN; + data['CitiesList'] = this.citiesList; + data['CityName'] = this.cityName; + data['Get5DaysWeatherForecastList'] = this.get5DaysWeatherForecastList; + if (this.getCityInfoList != null) { + data['GetCityInfo_List'] = + this.getCityInfoList.map((v) => v.toJson()).toList(); + } + data['GetTodayWeatherForecastList'] = this.getTodayWeatherForecastList; + data['IniciesList'] = this.iniciesList; + return data; + } +} + +class GetCityInfoList { + CategoriesNames categoriesNames; + String category; + String categoryValue; + int cityID; + String cityName; + String cityNameN; + String colorName; + String createdOn; + String iD; + int iniceID; + bool isOrderEmpty; + bool isValuesReversed; + bool language; + double latitude; + double longitude; + String name; + int orderNum; + double temperature; + String value; + + GetCityInfoList( + {this.categoriesNames, + this.category, + this.categoryValue, + this.cityID, + this.cityName, + this.cityNameN, + this.colorName, + this.createdOn, + this.iD, + this.iniceID, + this.isOrderEmpty, + this.isValuesReversed, + this.language, + this.latitude, + this.longitude, + this.name, + this.orderNum, + this.temperature, + this.value}); + + GetCityInfoList.fromJson(Map json) { + categoriesNames = json['CategoriesNames'] != null + ? new CategoriesNames.fromJson(json['CategoriesNames']) + : null; + category = json['Category']; + categoryValue = json['CategoryValue']; + cityID = json['CityID']; + cityName = json['CityName']; + cityNameN = json['CityNameN']; + colorName = json['ColorName']; + createdOn = json['CreatedOn']; + iD = json['ID']; + iniceID = json['IniceID']; + isOrderEmpty = json['IsOrderEmpty']; + isValuesReversed = json['IsValuesReversed']; + language = json['Language']; + latitude = json['Latitude']; + longitude = json['Longitude']; + name = json['Name']; + orderNum = json['OrderNum']; + temperature = json['Temperature']; + value = json['Value']; + } + + Map toJson() { + final Map data = new Map(); + if (this.categoriesNames != null) { + data['CategoriesNames'] = this.categoriesNames.toJson(); + } + data['Category'] = this.category; + data['CategoryValue'] = this.categoryValue; + data['CityID'] = this.cityID; + data['CityName'] = this.cityName; + data['CityNameN'] = this.cityNameN; + data['ColorName'] = this.colorName; + data['CreatedOn'] = this.createdOn; + data['ID'] = this.iD; + data['IniceID'] = this.iniceID; + data['IsOrderEmpty'] = this.isOrderEmpty; + data['IsValuesReversed'] = this.isValuesReversed; + data['Language'] = this.language; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['Name'] = this.name; + data['OrderNum'] = this.orderNum; + data['Temperature'] = this.temperature; + data['Value'] = this.value; + return data; + } +} + +class CategoriesNames { + String category1; + String category2; + String category3; + String category4; + String category5; + + CategoriesNames( + {this.category1, + this.category2, + this.category3, + this.category4, + this.category5}); + + CategoriesNames.fromJson(Map json) { + category1 = json['Category1']; + category2 = json['Category2']; + category3 = json['Category3']; + category4 = json['Category4']; + category5 = json['Category5']; + } + + Map toJson() { + final Map data = new Map(); + data['Category1'] = this.category1; + data['Category2'] = this.category2; + data['Category3'] = this.category3; + data['Category4'] = this.category4; + data['Category5'] = this.category5; + return data; + } +} + diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index 9e99f3ad..dffa6683 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -1,5 +1,4 @@ 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'; @@ -48,9 +47,8 @@ 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'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) + if (data['ServiceID'] == 3) cmcAllPresOrdersList .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); @@ -106,7 +104,7 @@ class CMCService extends BaseService { Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { hasError = false; - await baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, + await baseAppClient.post(PATIENT_ER_UPDATE_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 cb457735..da12b48b 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -1,13 +1,4 @@ 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'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_request_model.dart'; -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/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import 'package:intl/intl.dart'; @@ -41,10 +32,10 @@ class CustomerAddressesService extends BaseService { addressesList .add(AddressInfo.fromJson(data)); }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: addNewAddressRequestModel.toJson(), isExternal: true, isAllowAny: true); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: addNewAddressRequestModel.toJson(), isExternal: true, isAllowAny: true); } Future getCustomerAddresses() async { @@ -59,10 +50,10 @@ class CustomerAddressesService extends BaseService { addressesList .add(AddressInfo.fromJson(data)); }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, queryParams: queryParams, isExternal: true); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams, isExternal: true); } diff --git a/lib/core/service/AlHabibMedicalService/e_referral_service.dart b/lib/core/service/AlHabibMedicalService/e_referral_service.dart index 3670e965..6c356f5c 100644 --- a/lib/core/service/AlHabibMedicalService/e_referral_service.dart +++ b/lib/core/service/AlHabibMedicalService/e_referral_service.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; @@ -11,18 +10,11 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; class EReferralService extends BaseService { List _relationTypes = List(); - List get relationTypes => _relationTypes; List _allCities = List(); - List get allCities => _allCities; - List _allProjects = List(); - - List get allProjects => _allProjects; - List _allReferral = List(); - List get allReferral => _allReferral; String _activationCode; String _logInTokenID; @@ -50,106 +42,84 @@ class EReferralService extends BaseService { Future getAllCities() async { await baseAppClient.post(GET_ALL_CITIES, onSuccess: (dynamic response, int statusCode) { - _allCities.clear(); - response['ListCities'].forEach((city) { - _allCities.add(GetAllCitiesResponseModel.fromJson(city)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: {}); - } - - Future getAllProjects() async { - await baseAppClient.post(GET_PROJECT, - onSuccess: (dynamic response, int statusCode) { - _allProjects.clear(); - response['ListProject'].forEach((city) { - _allProjects.add(GetAllProjectsResponseModel.fromJson(city)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: {}); + _allCities.clear(); + response['ListCities'].forEach((city) { + _allCities + .add(GetAllCitiesResponseModel.fromJson(city)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {}); } Future sendActivationCodeForEReferral( + SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { hasError = false; await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_E_REFERRAL, onSuccess: (dynamic response, int statusCode) { - print(response["VerificationCode"]); _activationCode = response["VerificationCode"]; _logInTokenID = response["LogInTokenID"]; + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: sendActivationCodeForEReferralRequestModel.toJson()); } + + Future checkActivationCodeForEReferral( CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel) async { checkActivationCodeForEReferralRequestModel.isDentalAllowedBackend = false; - checkActivationCodeForEReferralRequestModel.logInTokenID = _logInTokenID; - hasError = false; + checkActivationCodeForEReferralRequestModel.logInTokenID= _logInTokenID; + hasError =false; await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_E_REFERRAL, onSuccess: (dynamic response, int statusCode) { - _isActivationCodeValid = true; + _isActivationCodeValid = true; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: checkActivationCodeForEReferralRequestModel.toJson()); } - Future createEReferral( - CreateEReferralRequestModel createEReferralRequestModel) async { - hasError = false; - dynamic localRes; - await baseAppClient.post( - CREATE_E_REFERRAL /*'Services/Patients.svc/REST/CreateEReferral'*/, - onSuccess: (dynamic response, int statusCode) { - // TODO Waiting for fix service - localRes = response; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: createEReferralRequestModel.toJson()); - return Future.value(localRes); - } - - Future getEReferrals( - SearchEReferralRequestModel searchEReferralRequestModel) async { - hasError = false; - dynamic localRes; - await baseAppClient.post(GET_E_REFERRALS, + Future createEReferral( + CreateEReferralRequestModel createEReferralRequestModel + ) async { + hasError = false; + await baseAppClient.post(CREATE_E_REFERRAL/*'Services/Patients.svc/REST/CreateEReferral'*/, onSuccess: (dynamic response, int statusCode) { - print("EEEEEE"); - _allReferral.clear(); - localRes = response; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: searchEReferralRequestModel.toJson()); - return Future.value(localRes); - } + // TODO Waiting for fix service + var asd= ("EEEEEE"); - Future getEReferralsIfLogin(String mobileNo) async { - hasError = false; - dynamic localRes; - Map request = {}; - request['PatientMobileNumber'] = mobileNo; - await baseAppClient.post(GET_E_REFERRALS, - onSuccess: (dynamic response, int statusCode) { - print("EEEEEE"); - _allReferral.clear(); - localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: request); - return Future.value(localRes); + }, body: createEReferralRequestModel.toJson()); } + Future getEReferrals( + SearchEReferralRequestModel searchEReferralRequestModel + ) async { + hasError = false; + // TODO return this code when the fix the server + // await baseAppClient.post(GET_E_REFERRALS, + // onSuccess: (dynamic response, int statusCode) { + // print("EEEEEE"); + // // TODO Waiting for fix service + // // ToDo change this one when you have data + // _allReferral.clear(); + // // response['ListCities'].forEach((city) { + // // _allReferral + // // .add(SearchEReferralResponseModel.fromJson(city)); + // // }); + // + // }, onFailure: (String error, int statusCode) { + // hasError = true; + // super.error = error; + // }, body: searchEReferralRequestModel.toJson()); + } } diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index 2ec1e310..e636321b 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -1,5 +1,4 @@ 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'; @@ -8,8 +7,6 @@ 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'; @@ -18,10 +15,9 @@ class HomeHealthCareService extends BaseService { List hhcAllPresOrdersList = List(); List hhcAllOrderDetail = List(); - List addressesList = List(); bool isOrderUpdated; - CustomerInfo customerInfo; + Future getHHCAllServices( HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; @@ -41,11 +37,11 @@ class HomeHealthCareService extends BaseService { GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_PATIENT_ALL_PRES_ORD, + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { hhcAllPresOrdersList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) + if (data['ServiceID'] == 2) hhcAllPresOrdersList .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); @@ -95,5 +91,3 @@ class HomeHealthCareService extends BaseService { }, body: order.toJson()); } } - - diff --git a/lib/core/service/AuthenticatedUserObject.dart b/lib/core/service/AuthenticatedUserObject.dart index f48b1179..8dd2583d 100644 --- a/lib/core/service/AuthenticatedUserObject.dart +++ b/lib/core/service/AuthenticatedUserObject.dart @@ -11,14 +11,14 @@ class AuthenticatedUserObject { getUser(); } - getUser() async { - if (user == null) { + getUser({bool getUser = false}) async { + if (getUser) { + var userData = await sharedPref.getObject(USER_PROFILE); + if (userData != null) user = AuthenticatedUser.fromJson(userData); + } else if (user == null) { var userData = await sharedPref.getObject(USER_PROFILE); if (userData != null) user = AuthenticatedUser.fromJson(userData); } - - // var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID); - this.isLogin = user != null; } logout() async { diff --git a/lib/core/service/childvaccines/add_new_child_service.dart b/lib/core/service/childvaccines/add_new_child_service.dart index 98e87100..5e4a4d86 100644 --- a/lib/core/service/childvaccines/add_new_child_service.dart +++ b/lib/core/service/childvaccines/add_new_child_service.dart @@ -14,12 +14,19 @@ class CreteNewBabyService extends BaseService { Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { hasError = false; + await getUser(); Map body = Map.from(newChild.toJson()); body['CreatedBy'] = 102; body['EditedBy'] = 102; body['UserID'] = userID; body['AlertBy'] = 2; + body['EmailAddress'] = user.emailAddress; body['IsLogin'] = true; + body['LogInTokenID'] = await sharedPref.getString(TOKEN); + body['MobileNumber'] = user.mobileNumber; + body['NationalID'] = user.nationalityID; + body['ZipCode'] = user.zipCode; + body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_NEWCHILD_REQUEST, diff --git a/lib/core/service/childvaccines/delete_baby_service.dart b/lib/core/service/childvaccines/delete_baby_service.dart index 49cbd29e..115d13c5 100644 --- a/lib/core/service/childvaccines/delete_baby_service.dart +++ b/lib/core/service/childvaccines/delete_baby_service.dart @@ -1,5 +1,4 @@ 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/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart'; @@ -18,13 +17,22 @@ class DeleteBabyService extends BaseService{ List deleteBabyModelList= List(); - Future getDeleteBabyOrder({List_BabyInformationModel babyInfo}) async { + Future getDeleteBabyOrder({DeleteBaby deleteChild,int babyID}) async { hasError = false; await getUser(); - Map body = Map(); + Map body = Map.from(deleteChild.toJson()); + // body['CreatedBy'] = 102; body['EditedBy'] = 102; + //body['BabyID'] = babyID; + //body['BabyID'] = createNewBabyModelList ; + // body['AlertBy'] = 2; + // body['EmailAddress'] = user.emailAddress; body['IsLogin'] = true; - body['BabyID'] = babyInfo.babyID; + body['LogInTokenID'] = await sharedPref.getString(TOKEN); + body['MobileNumber'] = user.mobileNumber; + body['NationalID'] = user.nationalityID; + body['ZipCode'] = user.zipCode; + body['isDentalAllowedBackend'] = false; await baseAppClient.post(DELETE_CHILD_REQUEST, @@ -37,6 +45,31 @@ class DeleteBabyService extends BaseService{ }, body: body); } - + // Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { + // hasError = false; + // await getUser(); + // Map body = Map.from(newChild.toJson()); + // body['CreatedBy'] = 102; + // body['EditedBy'] = 102; + // body['UserID'] = userID; + // body['AlertBy'] = 2; + // body['EmailAddress'] = user.emailAddress; + // body['IsLogin'] = true; + // body['LogInTokenID'] = await sharedPref.getString(TOKEN); + // body['MobileNumber'] = user.mobileNumber; + // body['NationalID'] = user.nationalityID; + // body['ZipCode'] = user.zipCode; + // + // body['isDentalAllowedBackend'] = false; + // + // await baseAppClient.post(GET_NEWCHILD_REQUEST, + // onSuccess: (dynamic response, int statusCode) { + // var asd =""; + // }, + // onFailure: (String error, int statusCode) { + // hasError = true; + // super.error = error; + // }, body: body); + // } } \ No newline at end of file diff --git a/lib/core/service/childvaccines/get_vaccinations_item_services.dart b/lib/core/service/childvaccines/get_vaccinations_item_services.dart new file mode 100644 index 00000000..5ff936af --- /dev/null +++ b/lib/core/service/childvaccines/get_vaccinations_item_services.dart @@ -0,0 +1,27 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/get_vacainations_itemsmodel.dart'; + +import '../base_service.dart'; + +class GetVccinationsItemsService extends BaseService { + List getVaccinationsItemModelList = List(); + Map body = Map(); + + + + Future getaccinationsitemOrders() async { + hasError = false; + await baseAppClient.post(GET_TABLE_REQUEST, + onSuccess: (dynamic response, int statusCode) { + getVaccinationsItemModelList.clear(); + response['List_CreateVaccinationTableModel'].forEach((vital) { + getVaccinationsItemModelList.add( + GET_VACCINATIONS_ITEMSMODEL.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + +} \ No newline at end of file diff --git a/lib/core/service/childvaccines/user_information_service.dart b/lib/core/service/childvaccines/user_information_service.dart index 55ddc259..0628920c 100644 --- a/lib/core/service/childvaccines/user_information_service.dart +++ b/lib/core/service/childvaccines/user_information_service.dart @@ -4,11 +4,11 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_m import '../base_service.dart'; class UserInformationService extends BaseService { - List_UserInformationModel userInformationModel = List_UserInformationModel(); + List userInformationModelList = List(); + Map body = Map(); Future getUserInformationOrders() async { hasError = false; - Map body = Map(); await getUser(); body['CreatedBy'] = 102; body['EditedBy'] = 102; @@ -22,44 +22,14 @@ class UserInformationService extends BaseService { await baseAppClient.post(GET_USERINFORMATION_REQUEST, onSuccess: (dynamic response, int statusCode) { + userInformationModelList.clear(); + response['List_UserInformationModel_New'].forEach((vital) { - userInformationModel = List_UserInformationModel.fromJson(vital); + userInformationModelList.add(List_UserInformationModel.fromJson(vital)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } - - Future updateEmail(String email) async { - hasError = false; - Map body = Map(); - body['IsInternalRequest'] = true; - body['EmailAddress'] = email; - body['IsLogin'] = true; - body['isDentalAllowedBackend'] = false; - await baseAppClient.post(UPDATE_PATENT_EMAIL, - onSuccess: (dynamic response, int statusCode) { - var asd = ""; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); - } - - Future updateUserInfo(String email) async { - hasError = false; - Map body = Map(); - body['IsInternalRequest'] = true; - body['EmailAddress'] = email; - body['IsLogin'] = true; - body['isDentalAllowedBackend'] = false; - await baseAppClient.post(UPDATE_PATENT_INFO, - onSuccess: (dynamic response, int statusCode) { - var asd = ""; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); - } } diff --git a/lib/core/service/childvaccines/vaccination_table_service.dart b/lib/core/service/childvaccines/vaccination_table_service.dart index da3c8518..7f987b76 100644 --- a/lib/core/service/childvaccines/vaccination_table_service.dart +++ b/lib/core/service/childvaccines/vaccination_table_service.dart @@ -1,9 +1,7 @@ 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 { @@ -12,16 +10,19 @@ class VaccinationTableService extends BaseService { - Future getCreateVaccinationTableOrders({List_BabyInformationModel babyInfo, List_UserInformationModel informationModel, bool isSendEmail=false}) async { + Future getCreateVaccinationTableOrders() async { hasError = false; await getUser(); - body['BabyName']=babyInfo.babyName; - body['DOB'] = DateUtil.convertDateToString(babyInfo.dOB); - body['EmailAddress'] = informationModel.emailAddress; + body['BabyName']="fffffffffff eeeeeeeeeeeeee"; + body['DOB'] = "/Date(1585774800000+0300)/"; + body['EmailAddress'] = user.emailAddress; body['isDentalAllowedBackend'] = false; - body['SendEmail'] = isSendEmail; + body['SendEmail'] = false; 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 ae25eb56..04f599f1 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -4,8 +4,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -159,8 +160,14 @@ class BaseAppClient { } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - } else if (!parsed['IsAuthenticated']) { - await logout(); + } + else if(parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']){ + onFailure( + parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } + else if (!parsed['IsAuthenticated']) { + await logout(); //helpers.showErrorToast('Your session expired Please login agian'); } else { @@ -186,7 +193,6 @@ class BaseAppClient { onFailure(e.toString(), -1); } } - Future navigateToAppUpdate(context, String text) async { Navigator.pushReplacement( context, @@ -196,9 +202,9 @@ class BaseAppClient { get(String endPoint, {Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, - Map queryParams, - bool isExternal = false}) async { + Function(String error, int statusCode) onFailure, + Map queryParams, + bool isExternal = false}) async { String url; if (isExternal) { url = endPoint; @@ -266,19 +272,70 @@ class BaseAppClient { } } + simpleGet(String fullUrl, {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams}) async { + String url = fullUrl; + var haveParams = (queryParams != null); + if (haveParams) { + String queryString = Uri(queryParameters: queryParams).query; + url += '?' + queryString; + print("URL Query String: $url"); + } + + if (await Utils.checkConnection()) { + final response = await http.get( + url.trim(), + headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, + ); + + final int statusCode = response.statusCode; + print("statusCode :$statusCode"); + + if (statusCode < 200 || statusCode >= 400 || json == null) { + onFailure('Error While Fetching data', statusCode); + } else { + onSuccess(response.body.toString(), statusCode); + } + } else { + onFailure('Please Check The Internet Connection', -1); + } + } + logout() async { await sharedPref.remove(LOGIN_TOKEN_ID); await sharedPref.remove(PHARMACY_CUSTOMER_ID); await authenticatedUserObject.getUser(); Provider.of(AppGlobal.context, listen: false).isLogin = false; + var model = Provider.of(AppGlobal.context,listen: false); _vitalSignService.weightKg = ""; _vitalSignService.heightCm = ""; + model.setState(0, false); Navigator.of(AppGlobal.context).pushReplacementNamed(HOME); } String getSessionId(String id) { ///return id.replaceAll(RegExp('/[^\w\s]/'), ''); - // return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); + return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); + } + + static defaultHttpParameters() async { + String token = await sharedPref.getString(TOKEN); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var user = await sharedPref.getObject(USER_PROFILE); + var params = {}; + if (user != null) { + params['TokenID'] = token; + params['PatientID'] = user['PatientID']; + params['PatientOutSA'] = user['OutSA']; + params['SessionID'] = SESSION_ID; //getSessionId(token); + } + + params['IPAdress'] = IP_ADDRESS; + params['generalid'] = GENERAL_ID; + params['VersionID'] = VERSION_ID; + params['Channel'] = CHANNEL; + params['LanguageID'] = languageID == 'ar' ? 1 : 2; + + return params; } } \ No newline at end of file diff --git a/lib/core/service/contactus/livechat_service.dart b/lib/core/service/contactus/livechat_service.dart index b806d56b..025073ca 100644 --- a/lib/core/service/contactus/livechat_service.dart +++ b/lib/core/service/contactus/livechat_service.dart @@ -8,6 +8,7 @@ class LiveChatService extends BaseService { List LivechatModelList = List(); Map body = Map(); + // body['body'] Future getAllLiveChatOrders() async { hasError = false; diff --git a/lib/core/service/geofencing/GeofencingServices.dart b/lib/core/service/geofencing/GeofencingServices.dart new file mode 100644 index 00000000..56b4f56e --- /dev/null +++ b/lib/core/service/geofencing/GeofencingServices.dart @@ -0,0 +1,66 @@ +import 'dart:convert'; +import 'dart:developer'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/requests/LogGeoZoneRequestModel.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/responses/LogGeoZoneResponseModel.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; + +import '../../../locator.dart'; + +class GeofencingServices extends BaseService { + List geoZones = List(); + bool testZones = true; + + Future> getAllGeoZones(GeoZonesRequestModel request) async { + hasError = false; + + var _zonesJsonString; + await baseAppClient.post(GET_GEO_ZONES, onSuccess: (dynamic response, int statusCode) { + var zones = response['GeoF_PointsList']; + zones.forEach((json) { + geoZones.add(GeoZonesResponseModel().fromJson(json)); + }); + + if (kDebugMode || testZones) addTestingGeoZones(zones); + + _zonesJsonString = json.encode(zones); + }, onFailure: (String error, int statusCode) { + hasError = true; + return Future.error(error); + }, body: request.toFlatMap()); + + AppSharedPreferences pref = AppSharedPreferences(); + await pref.setString(HMG_GEOFENCES, _zonesJsonString); + debugPrint("Finished Fetching GEO ZONES from HMG service..."); + debugPrint("GEO ZONES saved to AppPreferences with key '$HMG_GEOFENCES'"); + + return geoZones; + } + + LogGeoZoneResponseModel logResponse; + Future logGeoZone(LogGeoZoneRequestModel request) async { + hasError = false; + await baseAppClient.post(LOG_GEO_ZONES, onSuccess: (dynamic response, int statusCode) { + logResponse = LogGeoZoneResponseModel().fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + return Future.error(error); + }, body: request.toFlatMap()); + return logResponse; + } + + addTestingGeoZones(List zones) { + // zones.add({"GEOF_ID": 12, "Description": "ZiK Home", "Latitude": "24.691136", "Longitude": "46.650116", "Radius": 100, "Type": 1}); + // zones.add({"GEOF_ID": 13, "Description": "CS Office", "Latitude": "24.7087913", "Longitude": "46.6656461", "Radius": 100, "Type": 1}); + // zones.add({"GEOF_ID": 14, "Description": "Mahmoud Shrouf Home", "Latitude": "24.777577", "Longitude": "46.652675", "Radius": 100, "Type": 1}); + // zones.add({"GEOF_ID": 14, "Description": "Panorama Mall", "Latitude": "24.692453", "Longitude": "46.669168", "Radius": 450, "Type": 1}); + // zones.add({"GEOF_ID": 16, "Description": "Saudi Architects Crossing", "Latitude": "24.698375", "Longitude": "46.668567", "Radius": 140, "Type": 1}); + } +} diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index 194b8256..312d7fd7 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -13,14 +13,13 @@ class HospitalService extends BaseService { double _longitude; _getCurrentLocation() async { - await getLastKnownPosition().then((value) { + await Geolocator.getLastKnownPosition().then((value) { _latitude = value.latitude; _longitude = value.longitude; }).catchError((e) { _longitude = 0; _latitude = 0; }); - // currentLocation = LatLng(position.latitude, position.longitude); } Future getHospitals() async { @@ -28,6 +27,8 @@ class HospitalService extends BaseService { Map body = Map(); body['Latitude'] = _latitude; body['Longitude'] = _longitude; + body['IsOnlineCheckIn'] = true; + body['PatientOutSA'] = 0; await baseAppClient.post(GET_PROJECT, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart index 790003e9..0b626342 100644 --- a/lib/core/service/insurance_service.dart +++ b/lib/core/service/insurance_service.dart @@ -1,8 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/Insurance_card_details.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_approval.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; -import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart'; @@ -20,6 +21,10 @@ class InsuranceCardService extends BaseService { List get insuranceApproval => _insuranceApproval; + InsuranceCardDetailsModel insuranceCardDetails; + List insuranceCardDetailsList = List(); + bool isHaveInsuranceCard = false; + GetAllSharedRecordsByStatusResponse getAllSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse(); @@ -136,4 +141,42 @@ class InsuranceCardService extends BaseService { }, body:{'CompanyID': data.companyID,'SubCategoryID':data.subCategoryID },); return Future.value(localRes); } + + Future getPatientInsuranceDetails({String setupID, int projectID, String patientIdentificationID,int patientID}) async{ + error = ""; + hasError = false; + insuranceCardDetails = null; + isHaveInsuranceCard = false; + await baseAppClient.post(GET_PATIENT_INSURANCE_DETAILS, + onSuccess: (dynamic response, int statusCode) { + insuranceCardDetailsList.clear(); + isHaveInsuranceCard = true; + response['List_PatientInsuranceDetails'].forEach((item) { + insuranceCardDetailsList.add(InsuranceCardDetailsModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body:{'SetupID': setupID,'ProjectID':projectID,'PatientIdentificationID':patientIdentificationID ,'isDentalAllowedBackend':false,'PatientID':patientID},); + + } + + Future uploadInsuranceCard({ String patientIdentificationID,int patientID,String image=""}) async{ + error = ""; + Map body = Map(); + body['PatientID']=patientID; + body['PatientType']=user.patientType; + body['MobileNo']=user.mobileNumber; + body['PatientIdentificationID']=patientIdentificationID; + body['InsuranceCardImage']= image; + + await baseAppClient.post(UPLOAD_INSURANCE_CARD, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body:body,); + + } } diff --git a/lib/core/service/medical/PatientSickLeaveService.dart b/lib/core/service/medical/PatientSickLeaveService.dart index b2bb16ef..bb60ee3b 100644 --- a/lib/core/service/medical/PatientSickLeaveService.dart +++ b/lib/core/service/medical/PatientSickLeaveService.dart @@ -21,7 +21,11 @@ class PatientSickLeaveService extends BaseService { } sendSickLeaveEmail( - {int requestNo, String projectName, String doctorName, int projectID,String setupID}) async { + {int requestNo, + String projectName, + String doctorName, + int projectID, + String setupID}) async { hasError = false; super.error = ""; Map body = Map(); @@ -33,8 +37,8 @@ class PatientSickLeaveService extends BaseService { body['PatientName'] = user.firstName + " " + user.firstName; body['ProjectName'] = projectName; body['DoctorName'] = doctorName; - body['ProjectID'] = 12; - body['SetupID'] = 12; + body['ProjectID'] = projectID; + body['SetupID'] = setupID; await baseAppClient .post(SendSickLeaveEmail, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index b9b9a16c..11592956 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; @@ -32,6 +33,7 @@ class LabsService extends BaseService { List patientLabSpecialResult = List(); List labResultList = List(); + List labOrdersResultsList = List(); Future getLaboratoryResult( {String projectID, @@ -68,6 +70,7 @@ class LabsService extends BaseService { await baseAppClient.post(GET_Patient_LAB_RESULT, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult.clear(); + labResultList.clear(); response['ListPLR'].forEach((lab) { labResultList.add(LabResult.fromJson(lab)); }); @@ -77,6 +80,28 @@ class LabsService extends BaseService { }, body: body); } + Future getPatientLabOrdersResults({PatientLabOrders patientLabOrder,String procedure}) async { + hasError = false; + Map body = Map(); + body['InvoiceNo'] = patientLabOrder.invoiceNo; + body['OrderNo'] = patientLabOrder.orderNo; + body['isDentalAllowedBackend'] = false; + body['SetupID'] = patientLabOrder.setupID; + body['ProjectID'] = patientLabOrder.projectID; + body['ClinicID'] = patientLabOrder.clinicID; + body['Procedure'] = procedure; + await baseAppClient.post(GET_Patient_LAB_ORDERS_RESULT, + onSuccess: (dynamic response, int statusCode) { + labOrdersResultsList.clear(); + response['ListPLR'].forEach((lab) { + labOrdersResultsList.add(LabOrderResult.fromJson(lab)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail(); @@ -85,19 +110,19 @@ class LabsService extends BaseService { _requestSendLabReportEmail.invoiceNo = patientLabOrder.invoiceNo; _requestSendLabReportEmail.doctorName = patientLabOrder.doctorName; _requestSendLabReportEmail.clinicName = patientLabOrder.clinicDescription; - _requestSendLabReportEmail.patientName = user.firstName + user.lastName; + _requestSendLabReportEmail.patientName = user.firstName +" "+ user.lastName; _requestSendLabReportEmail.patientIditificationNum = user.patientIdentificationNo; _requestSendLabReportEmail.dateofBirth = user.dateofBirth; _requestSendLabReportEmail.to = user.emailAddress; - _requestSendLabReportEmail.orderDate = - '${patientLabOrder.orderDate.year}-${patientLabOrder.orderDate.month}-${patientLabOrder.orderDate.day}'; + _requestSendLabReportEmail.orderDate = '${patientLabOrder.orderDate.year}-${patientLabOrder.orderDate.month}-${patientLabOrder.orderDate.day}'; _requestSendLabReportEmail.patientMobileNumber = user.mobileNumber; _requestSendLabReportEmail.projectName = patientLabOrder.projectName; + _requestSendLabReportEmail.setupID = user.setupID; - await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT, + await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) { - AppToast.showSuccessToast(message: 'A copy has been sent to the email'); + }, 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 e3be9bcf..86e925b8 100644 --- a/lib/core/service/medical/my_balance_service.dart +++ b/lib/core/service/medical/my_balance_service.dart @@ -1,3 +1,5 @@ +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'; @@ -25,6 +27,10 @@ class MyBalanceService extends BaseService { AuthenticatedUserObject authenticatedUserObject = locator(); + MyBalanceService(){ + getFamilyFiles(); + } + getPatientAdvanceBalanceAmount() async { hasError = false; super.error = ""; diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index d6ad3732..e9741a7f 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -72,6 +72,7 @@ class PrescriptionsService extends BaseService { prescriptionReportEnhList.clear(); if(prescriptions.isInOutPatient){ response['ListPRM'].forEach((prescriptions) { + prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions)); prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions)); }); }else{ diff --git a/lib/core/service/medical/radiology_service.dart b/lib/core/service/medical/radiology_service.dart index b3cb737b..965fa752 100644 --- a/lib/core/service/medical/radiology_service.dart +++ b/lib/core/service/medical/radiology_service.dart @@ -67,7 +67,7 @@ class RadiologyService extends BaseService { _requestSendRadReportEmail.patientName = user.firstName + " " + user.lastName; _requestSendRadReportEmail.patientIditificationNum = user.patientIdentificationNo; _requestSendRadReportEmail.projectName = finalRadiology.projectName; - _requestSendRadReportEmail.radResult = 'asd'; //finalRadiology.reportData; + _requestSendRadReportEmail.radResult = finalRadiology.reportData; _requestSendRadReportEmail.to = user.emailAddress; _requestSendRadReportEmail.dateofBirth = user.dateofBirth; diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index 19f86e2e..b2f90e61 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -9,11 +9,11 @@ class ReportsService extends BaseService { List appointHistoryList = List(); String userAgreementContent = ""; RequestReports _requestReports = RequestReports( - isReport: true, - encounterType: 1, - requestType: 1, - patientOutSA: 0, - ); + isReport: true, + encounterType: 1, + requestType: 1, + patientOutSA: 0, + ); Future getReports() async { hasError = false; @@ -56,22 +56,18 @@ class ReportsService extends BaseService { }, body: Map()); } - Future updatePatientHealthSummaryReport({bool isSummary}) async { Map body = Map(); body['RSummaryReport'] = isSummary; hasError = false; await baseAppClient.post(UPDATE_HEALTH_TERMS, - onSuccess: (dynamic response, int statusCode) { - - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + 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(); @@ -96,4 +92,44 @@ class ReportsService extends BaseService { super.error = error; }, body: body); } + + Future sendEmailForMedicalReport( + String projectName, + String clinicName, + String doctorName, + String requestDate, + String invoiceNo, + int projectID, + String stamp, + String setupID) async { + Map body = new Map(); + body['SetupID'] = setupID; + body['PrintDate'] = requestDate; + body['ProcedureID'] = "05005009"; + body['Reporttype'] = "MEDICAL REPORT"; + body['stamp'] = stamp; + body['To'] = user.emailAddress; + body['DateofBirth'] = user.dateofBirth; + body['PatientIditificationNum'] = user.patientIdentificationNo; + body['PatientMobileNumber'] = user.mobileNumber; + body['PatientName'] = user.firstName + " " + user.lastName; + body['ProjectName'] = projectName; + body['ClinicName'] = clinicName; + body['ProjectID'] = projectID; + body['InvoiceNo'] = invoiceNo; + body['PrintedByName'] = user.firstName + " " + user.lastName; + + dynamic response; + + hasError = false; + await baseAppClient.post(SEND_MEDICAL_REPORT_EMAIL, + onSuccess: (dynamic res, int statusCode) { + response = res; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return response; + } } diff --git a/lib/core/service/medical/vital_sign_service.dart b/lib/core/service/medical/vital_sign_service.dart index 16909fd9..d1fbbf1c 100644 --- a/lib/core/service/medical/vital_sign_service.dart +++ b/lib/core/service/medical/vital_sign_service.dart @@ -5,14 +5,14 @@ import '../base_service.dart'; class VitalSignService extends BaseService { List vitalSignResModelList = List(); - Map body = Map(); + String weightKg = ""; String heightCm = ""; String bloadType = ""; Future getPatientRadOrders({int appointmentNo, int projectID}) async { hasError = false; - + Map body = Map(); if (appointmentNo != null && projectID != null) { body['TransNo'] = appointmentNo; body['ProjectID'] = projectID; @@ -24,9 +24,17 @@ class VitalSignService extends BaseService { response['List_DoctorPatientVitalSign'].forEach((vital) { vitalSignResModelList.add(VitalSignResModel.fromJson(vital)); }); + bool isHaveWeight = false; + bool isHaveHeight = false; vitalSignResModelList.forEach((element) { - weightKg = '${element.weightKg}'; - heightCm = '${element.heightCm}'; + if (element.weightKg != 0 && !isHaveWeight) { + weightKg = '${element.weightKg}'; + isHaveWeight = true; + } + if (element.heightCm != 0 && !isHaveHeight) { + heightCm = '${element.heightCm}'; + isHaveHeight = true; + } }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/packages_offers/PackagesOffersServices.dart b/lib/core/service/packages_offers/PackagesOffersServices.dart new file mode 100644 index 00000000..e58c3fa3 --- /dev/null +++ b/lib/core/service/packages_offers/PackagesOffersServices.dart @@ -0,0 +1,51 @@ +import 'dart:convert'; +import 'dart:developer'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; + +import '../../../locator.dart'; + +class OffersAndPackagesServices extends BaseService { + List categoryList = List(); + + Future> getAllCategories(OffersCategoriesRequestModel request) async { + hasError = false; + var url = EXA_CART_API_BASE_URL + PACKAGES_CATEGORIES; + await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + if (statusCode == 200) { + var jsonResponse = json.decode(stringResponse); + jsonResponse['categories'].forEach((json) { + categoryList.add(OfferCategoriesResponseModel().fromJson(json)); + }); + } + }, onFailure: (String error, int statusCode) { + log(error); + }, queryParams: request.toFlatMap()); + + return categoryList; + } + + List productList = List(); + Future> getAllProducts(OffersProductsRequestModel request) async { + hasError = false; + var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS; + await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + if (statusCode == 200) { + var jsonResponse = json.decode(stringResponse); + jsonResponse['products'].forEach((json) { + productList.add(OfferProductsResponseModel().fromJson(json)); + }); + } + }, onFailure: (String error, int statusCode) { + log(error); + }, queryParams: request.toFlatMap()); + + return productList; + } +} diff --git a/lib/core/service/pharmacies_service.dart b/lib/core/service/pharmacies_service.dart index f89fb425..dbd4fae1 100644 --- a/lib/core/service/pharmacies_service.dart +++ b/lib/core/service/pharmacies_service.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; +import 'package:geolocator/geolocator.dart'; class PharmacyService extends BaseService { List _medicineItem = List(); @@ -59,10 +60,30 @@ class PharmacyService extends BaseService { projectID: 15, ); + double _latitude=0; + double _longitude=0; + + _getCurrentLocation() async { + await Geolocator.getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); + } + Future getMedicineList({String drugName}) async { hasError = false; - _requestGetPharmaciesModel.pHRItemName = drugName; - try { + await _getCurrentLocation(); + Map body = Map(); + body['PHR_itemName'] = drugName.trim(); + body['isLoginForDoctorApp'] = true; + body['isDentalAllowedBackend'] = true; + body['PageSize'] = 25; + body['Latitude'] = _latitude; + body['Longitude'] = _longitude; + await baseAppClient.post(GET_PHARMCY_ITEMS, onSuccess: (dynamic response, int statusCode) { _medicineItem.clear(); @@ -72,15 +93,18 @@ class PharmacyService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _requestGetPharmaciesModel.toJson()); - } catch (error) { - throw error; - } + }, body: body); + } Future getPharmaciesList({int itemID}) async { - _pharmaciesListModel.itemID = itemID; - try { + + await _getCurrentLocation(); + Map body = Map(); + body['ItemID'] = itemID; + body['Latitude'] = _latitude; + body['Longitude'] = _longitude; + await baseAppClient.post(GET_PHARMACY_LIST, onSuccess: (dynamic response, int statusCode) { _pharmaciesList.clear(); @@ -91,9 +115,7 @@ class PharmacyService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _pharmaciesListModel.toJson()); - } catch (error) { - throw error; - } + }, body:body); + } } diff --git a/lib/core/service/privilege_service.dart b/lib/core/service/privilege_service.dart new file mode 100644 index 00000000..5beef992 --- /dev/null +++ b/lib/core/service/privilege_service.dart @@ -0,0 +1,22 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class PrivilegeService extends BaseService { + + List privilegeModelList = List(); + + Future getPrivilege() async { + Map body = Map(); + body['PatientType'] = 4; + await baseAppClient.post(GET_PRIVILEGE, + onSuccess: (dynamic response, int statusCode) { + response['ServicePrivilegeList'].forEach((item) { + privilegeModelList.add(PrivilegeModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/weather_service.dart b/lib/core/service/weather_service.dart new file mode 100644 index 00000000..10ab1adf --- /dev/null +++ b/lib/core/service/weather_service.dart @@ -0,0 +1,36 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class WeatherService extends BaseService { + List weatherIndicatorData = List(); + + Map body = Map(); + String Latitude = ""; + String Longitude = ""; + String PhoneNumber = ""; + + Future getWeatherData() async { + hasError = false; + + var lat = await sharedPref.getDouble(USER_LAT); + var long = await sharedPref.getDouble(USER_LONG); + body['Latitude'] = lat ?? 0; + body['Longitude'] = long ?? 0; + + await baseAppClient.post(WEATHER_INDICATOR, + onSuccess: (dynamic response, int statusCode) { + weatherIndicatorData = []; + response['GetCityInfo_List'].forEach((data) { + weatherIndicatorData.add(GetCityInfoList.fromJson(data)); + }); + print(weatherIndicatorData); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + await this.sharedPref.setObject(WEATHER, weatherIndicatorData[0]); + return Future.value(weatherIndicatorData[0]); + } +} diff --git a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart index 0774e5a7..f2c81956 100644 --- a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart @@ -99,6 +99,7 @@ class CMCViewModel extends BaseViewModel { await _cMCService .getOrderDetailByOrderID(getOrderDetailByOrderIDRequestModel); } + //TODO check it in uat Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { setState(ViewState.Busy); order.createdBy = user.patientID; diff --git a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart index 047e06f2..1972e08f 100644 --- a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart +++ b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart @@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; @@ -19,108 +18,74 @@ class EReferralViewModel extends BaseViewModel { List get relationTypes => _eReferralService.relationTypes; - List get allCities => _eReferralService.allCities; + List get allReferral => _eReferralService.allReferral; - List get allHospitals => - _eReferralService.allProjects; - List get allReferral => - _eReferralService.allReferral; - void getRelationTypes() async { + void getRelationTypes() async { setState(ViewState.Busy); await _eReferralService.getRelationTypes(); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.Error); - } else { + } else{ setState(ViewState.Idle); } } - - void getAllCities() async { + void getAllCities() async { setState(ViewState.Busy); await _eReferralService.getAllCities(); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.Error); - } else { + } else{ setState(ViewState.Idle); } } - void getAllProjects() async { - setState(ViewState.Busy); - await _eReferralService.getAllProjects(); - if (_eReferralService.hasError) { - error = _eReferralService.error; - setState(ViewState.Error); - } else { - setState(ViewState.Idle); - } - } - - void sendActivationCodeForEReferral( - SendActivationCodeForEReferralRequestModel - sendActivationCodeForEReferralRequestModel) async { + void sendActivationCodeForEReferral(SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { setState(ViewState.BusyLocal); - await _eReferralService.sendActivationCodeForEReferral( - sendActivationCodeForEReferralRequestModel); + await _eReferralService.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); - } else { + } else{ setState(ViewState.Idle); } } - checkActivationCodeForEReferral( - CheckActivationCodeForEReferralResponseModel - checkActivationCodeForEReferralRequestModel) async { + checkActivationCodeForEReferral(CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel) async { setState(ViewState.BusyLocal); - await _eReferralService.checkActivationCodeForEReferral( - checkActivationCodeForEReferralRequestModel); + await _eReferralService.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); - } else { + } else{ setState(ViewState.Idle); } } - Future createEReferral( + void createEReferral( CreateEReferralRequestModel createEReferralRequestModel) async { - dynamic localRes; setState(ViewState.BusyLocal); - await _eReferralService - .createEReferral(createEReferralRequestModel) - .then((response) { - localRes = response; - }); + await _eReferralService.createEReferral(createEReferralRequestModel); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } - return Future.value(localRes); } - Future getEReferrals(SearchEReferralRequestModel searchEReferralRequestModel) async { + getEReferrals(SearchEReferralRequestModel searchEReferralRequestModel) async { setState(ViewState.BusyLocal); - dynamic localRes; - await _eReferralService.getEReferrals(searchEReferralRequestModel).then((response) { - localRes = response; - }); + await _eReferralService.getEReferrals(searchEReferralRequestModel); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } - - return Future.value(localRes); - } } diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index d8ea5196..aab267e9 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -29,11 +29,16 @@ class BaseViewModel extends ChangeNotifier { if (hasListeners) notifyListeners(); } + setUser(AuthenticatedUser user){ + this.user = user; + notifyListeners(); + } + BaseViewModel() { //authenticatedUserObject.getUser(); user = authenticatedUserObject.user; this.isLogin = authenticatedUserObject.isLogin; - _getUser(); + } _getUser() async { diff --git a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart index 2559c074..eebaca02 100644 --- a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart +++ b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart @@ -13,6 +13,7 @@ class AddNewChildViewModel extends BaseViewModel { CreteNewBabyService _creteNewBabyService = locator(); ChildVaccinesService _childVaccinesService = locator(); + // DeleteBabyService _deleteBabyService = locator(); bool isAdded = false; ///create new baby createNewBabyOrders({ CreateNewBaby newChild}) async { @@ -24,7 +25,13 @@ class AddNewChildViewModel extends BaseViewModel { } else { isAdded = true; setState(ViewState.Idle); + await _childVaccinesService.getAllBabyInformationOrders(); + if (_childVaccinesService.hasError) { + error = _childVaccinesService.error; + setState(ViewState.Error); + } else{ + } } } diff --git a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart index a713b6ec..7c4af285 100644 --- a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart +++ b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart @@ -16,11 +16,14 @@ class ChildVaccinesViewModel extends BaseViewModel{ List get babyInformationModelList=> _childVaccinesService.babyInformationModelList; + +//=========== CreteNewBabyService _creteNewBabyService = locator(); DeleteBabyService _deleteBabyService = locator(); bool isAdded = false; bool isDeleted = false; + //============ getNewUserOrders() async { @@ -45,15 +48,25 @@ class ChildVaccinesViewModel extends BaseViewModel{ ///delete baby - deleteBabyOrders({ List_BabyInformationModel babyInfo}) async { + deleteBabyOrders({ DeleteBaby newChild}) async { setState(ViewState.Busy); - await _deleteBabyService.getDeleteBabyOrder(babyInfo: babyInfo); - if (_deleteBabyService.hasError) { - error = _deleteBabyService.error; + //await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID); + await _deleteBabyService.getDeleteBabyOrder(deleteChild: newChild,babyID: newChild.babyID); + //getDeleteBabyOrder(deleteChild: newChild,); + // getDeleteBabyOrder + if (_creteNewBabyService.hasError) { + error = _creteNewBabyService.error; setState(ViewState.Error); } else { isDeleted = true; - getBabyInformatioRequestOrders(); + setState(ViewState.Idle); + await _childVaccinesService.getAllBabyInformationOrders(); + if (_childVaccinesService.hasError) { + error = _childVaccinesService.error; + setState(ViewState.Error); + } else{ + + } } } diff --git a/lib/core/viewModels/child_vaccines/user_information_view_model.dart b/lib/core/viewModels/child_vaccines/user_information_view_model.dart index e183ee42..43269f42 100644 --- a/lib/core/viewModels/child_vaccines/user_information_view_model.dart +++ b/lib/core/viewModels/child_vaccines/user_information_view_model.dart @@ -8,7 +8,8 @@ class UserInformationViewModel extends BaseViewModel { UserInformationService _userInformationService = locator(); - List_UserInformationModel get userInformationModelList => _userInformationService.userInformationModel; + List get userInformationModelList => + _userInformationService.userInformationModelList; getUserInformationRequestOrders() async { setState(ViewState.Busy); @@ -19,15 +20,4 @@ class UserInformationViewModel extends BaseViewModel { } else setState(ViewState.Idle); } - - updateEmail(String email)async{ - setState(ViewState.Busy); - await _userInformationService.updateEmail(email); - await _userInformationService.updateUserInfo(email); - if (_userInformationService.hasError) { - error = _userInformationService.error; - setState(ViewState.Error); - } else - await getUserInformationRequestOrders(); - } } 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 25559b81..3b72dd50 100644 --- a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart +++ b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart @@ -1,27 +1,30 @@ 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/model/childvaccines/user_information_model.dart'; +import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/vaccination_table_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; -class VaccinationTableViewModel extends BaseViewModel { - VaccinationTableService _creteVaccinationTableService = - locator(); - List get creteVaccinationTableModelList => - _creteVaccinationTableService.createVaccinationTableModelList; +class VaccinationTableViewModel extends BaseViewModel{ - getCreateVaccinationTable({List_BabyInformationModel babyInfo, List_UserInformationModel informationModel, bool isSendEmail =false}) async { + VaccinationTableService _creteVaccinationTableService = locator(); + + // String get creteVaccinationTableContent => _creteVaccinationTableService.userAgreementContent; + //String get userAgreementContent => _creteNewBabyService.v//_reportsService.userAgreementContent; + List get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;//.createNewBabyModelList; + getCreateVaccinationTable() async { setState(ViewState.Busy); - await _creteVaccinationTableService.getCreateVaccinationTableOrders(babyInfo: babyInfo,informationModel: informationModel,isSendEmail: isSendEmail); - if (_creteVaccinationTableService.hasError) { - error = _creteVaccinationTableService.error; + await _creteVaccinationTableService.getCreateVaccinationTableOrders();//getCreateNewBabyOrders(); + + if ( _creteVaccinationTableService.hasError) { + error = _creteVaccinationTableService.error; setState(ViewState.Error); } else setState(ViewState.Idle); } + } diff --git a/lib/core/viewModels/dashboard_view_model.dart b/lib/core/viewModels/dashboard_view_model.dart index 4cf22b23..e085e476 100644 --- a/lib/core/viewModels/dashboard_view_model.dart +++ b/lib/core/viewModels/dashboard_view_model.dart @@ -1,13 +1,21 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import '../../locator.dart'; class DashboardViewModel extends BaseViewModel { VitalSignService _vitalSignService = locator(); - String get weightKg => _vitalSignService.weightKg; - String get heightCm => _vitalSignService.heightCm; - String bloadType = ""; + + String get weightKg => _vitalSignService.weightKg; + + String get heightCm => _vitalSignService.heightCm; + String booldType = "-"; + + // ToDoCountProviderModel toDoProvider = + // Provider.of(AppGlobal.context); getPatientRadOrders() async { if (isLogin && _vitalSignService.weightKg.isEmpty) { @@ -15,9 +23,24 @@ class DashboardViewModel extends BaseViewModel { await _vitalSignService.getPatientRadOrders(); if (_vitalSignService.hasError) { error = _vitalSignService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); + setState(ViewState.ErrorLocal); + } else { + booldType = await sharedPref.getString(BLOOD_TYPE) ?? "-"; + setState(ViewState.Idle); + } } } + +// getToDoCount() { +// toDoProvider.setState(0); +// ClinicListService service = new ClinicListService(); +// service.getActiveAppointmentNo(AppGlobal.context).then((res) { +// print(res['AppointmentActiveNumber']); +// if (res['MessageStatus'] == 1) { +// toDoProvider.setState(res['AppointmentActiveNumber']); +// } else {} +// }).catchError((err) { +// print(err); +// }); +// } } diff --git a/lib/core/viewModels/feedback/feedback_view_model.dart b/lib/core/viewModels/feedback/feedback_view_model.dart index 4956024d..6793c786 100644 --- a/lib/core/viewModels/feedback/feedback_view_model.dart +++ b/lib/core/viewModels/feedback/feedback_view_model.dart @@ -21,59 +21,8 @@ class FeedbackViewModel extends BaseViewModel { FeedbackService _feedbackService = locator(); List get cOCItemList => _feedbackService.cOCItemList; - MessageType messageType = MessageType.NON; - MessageType messageTypeDialog = MessageType.NON; - - String getSelected(BuildContext context) { - switch (messageType) { - case MessageType.ComplaintOnAnAppointment: - return TranslationBase.of(context).complainAppo; - break; - case MessageType.ComplaintWithoutAppointment: - return TranslationBase.of(context).complainWithoutAppo; - break; - case MessageType.Question: - return TranslationBase.of(context).question; - break; - case MessageType.Compliment: - return TranslationBase.of(context).compliment; - break; - case MessageType.Suggestion: - return TranslationBase.of(context).suggestion; - break; - case MessageType.NON: - return TranslationBase.of(context).notClassified; - break; - } - return TranslationBase.of(context).notClassified; - } - - setMessageDialogType(MessageType messageType) { - messageTypeDialog = messageType; - notifyListeners(); - } - - setMessageType(MessageType messageType) { - this.messageType = messageType; - switch (messageType) { - case MessageType.ComplaintOnAnAppointment: - break; - case MessageType.ComplaintWithoutAppointment: - break; - case MessageType.Question: - break; - case MessageType.Compliment: - break; - case MessageType.Suggestion: - break; - case MessageType.NON: - break; - } - notifyListeners(); - } - List get appointHistoryList => _feedbackService.appointHistoryList; @@ -93,11 +42,9 @@ class FeedbackViewModel extends BaseViewModel { if (_feedbackService.hasError) { error = _feedbackService.error; setState(ViewState.ErrorLocal); - setMessageType(MessageType.NON); return false; } else { setState(ViewState.Idle); - setMessageType(MessageType.NON); return true; } } diff --git a/lib/core/viewModels/insurance_card_View_model.dart b/lib/core/viewModels/insurance_card_View_model.dart index 7029f082..234db5d4 100644 --- a/lib/core/viewModels/insurance_card_View_model.dart +++ b/lib/core/viewModels/insurance_card_View_model.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_approval.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; -import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update_model.dart'; import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; @@ -72,5 +72,14 @@ class InsuranceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + Future uploadInsuranceCard({String patientIdentificationID, int patientID,String image =""}) async { + setState(ViewState.BusyLocal); + await _insuranceCardService.uploadInsuranceCard(patientIdentificationID: patientIdentificationID,patientID: patientID,image: image); + if (_insuranceCardService.hasError) { + error = _insuranceCardService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 582ee745..9e3f09e5 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -1,9 +1,11 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/labs/LabOrderResult.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; @@ -12,6 +14,9 @@ class LabsViewModel extends BaseViewModel { FilterType filterType = FilterType.Clinic; LabsService _labsService = locator(); + List get labOrdersResultsList => _labsService.labOrdersResultsList; + + List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); @@ -105,43 +110,54 @@ class LabsViewModel extends BaseViewModel { getPatientLabResult({PatientLabOrders patientLabOrder}) async { setState(ViewState.Busy); - await _labsService.getPatientLabResult( - patientLabOrder: patientLabOrder - ); + await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); } else { _labsService.labResultList.forEach((element) { - List patientLabOrdersClinic = - labResultLists - .where((elementClinic) => - elementClinic.filterName == element.testCode) - .toList(); + List patientLabOrdersClinic = labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList(); if (patientLabOrdersClinic.length != 0) { - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] - .patientLabResultList - .add(element); + + var value= labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList + .where((e) => e.sampleCollectedOn== element.sampleCollectedOn && e.resultValue ==element.resultValue ).toList(); + if(value.isEmpty) + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList.add(element); } else { - labResultLists.add(LabResultList( - filterName: element.testCode, - lab: element)); + labResultLists.add(LabResultList(filterName: element.testCode, lab: element)); } - }); setState(ViewState.Idle); } } - sendLabReportEmail({PatientLabOrders patientLabOrder}) async { + + getPatientLabOrdersResults({PatientLabOrders patientLabOrder,String procedure}) async { setState(ViewState.Busy); - await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); + await _labsService.getPatientLabOrdersResults(patientLabOrder: patientLabOrder,procedure: procedure); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); } else { + bool isShouldClear = false; + if(_labsService.labOrdersResultsList.length==1) + { + labOrdersResultsList.forEach((element) { + if(element.resultValue.contains('/') ||element.resultValue.contains('*' )|| element.resultValue.isEmpty ) + isShouldClear = true; + });} + if(isShouldClear) + _labsService.labOrdersResultsList.clear(); setState(ViewState.Idle); } } + + sendLabReportEmail({PatientLabOrders patientLabOrder,String mes}) async { + await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); + if (_labsService.hasError) { + error = _labsService.error; + }else + AppToast.showSuccessToast(message: mes); + } } diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index 62b7868b..f9554d94 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -74,11 +74,10 @@ class MyBalanceViewModel extends BaseViewModel { setState(ViewState.Idle); } - //============== + Future getCities() async { setState(ViewState.Busy); await _bloodDonationService.getAllCitiesOrders(); - // getHospitals(); if (_bloodDonationService.hasError) { error = _bloodDonationService.error; setState(ViewState.Error); @@ -89,8 +88,6 @@ class MyBalanceViewModel extends BaseViewModel { Future getBlood() async { setState(ViewState.Busy); await _bloodDetailsService.getAllBloodOrders(); - ; - if (_bloodDetailsService.hasError) { error = _bloodDetailsService.error; setState(ViewState.Error); @@ -98,7 +95,6 @@ class MyBalanceViewModel extends BaseViewModel { setState(ViewState.Idle); } - //=============== Future getPatientInfoByPatientID({String id}) async { setState(ViewState.Busy); @@ -154,7 +150,7 @@ class MyBalanceViewModel extends BaseViewModel { Future getFamilyFiles() async { setState(ViewState.Busy); - await _myBalanceService.getSharedRecordByStatus(); + await _myBalanceService.getFamilyFiles(); if (_myBalanceService.hasError) { error = _myBalanceService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 1cd934e2..2c32a081 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -119,6 +119,7 @@ class PrescriptionsViewModel extends BaseViewModel { int patientID, String clinicName, String doctorName, + String mes, int projectID}) async { setState(ViewState.BusyLocal); await _prescriptionsService.sendPrescriptionEmail( @@ -128,7 +129,7 @@ class PrescriptionsViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); AppToast.showErrorToast(message: error); } else { - AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail'); + AppToast.showSuccessToast(message: mes); setState(ViewState.Idle); } } diff --git a/lib/core/viewModels/medical/radiology_view_model.dart b/lib/core/viewModels/medical/radiology_view_model.dart index 26d40361..076707dc 100644 --- a/lib/core/viewModels/medical/radiology_view_model.dart +++ b/lib/core/viewModels/medical/radiology_view_model.dart @@ -80,7 +80,7 @@ class RadiologyViewModel extends BaseViewModel { } sendRadReportEmail( - {FinalRadiology finalRadiology}) async { + {FinalRadiology finalRadiology,String mes}) async { setState(ViewState.BusyLocal); await _radiologyService.sendRadReportEmail( finalRadiology: finalRadiology @@ -89,7 +89,7 @@ class RadiologyViewModel extends BaseViewModel { error = _radiologyService.error; AppToast.showErrorToast(message: error); } else { - AppToast.showSuccessToast(message: 'A copy has been sent to the email'); + AppToast.showSuccessToast(message: mes); } setState(ViewState.Idle); } diff --git a/lib/core/viewModels/medical/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index e0fdfaa3..271b5463 100644 --- a/lib/core/viewModels/medical/reports_view_model.dart +++ b/lib/core/viewModels/medical/reports_view_model.dart @@ -69,7 +69,7 @@ class ReportsViewModel extends BaseViewModel { } - insertRequestForMedicalReport(AppointmentHistory appointmentHistory)async{ + insertRequestForMedicalReport(AppointmentHistory appointmentHistory,String mes)async{ setState(ViewState.Busy); await _reportsService.insertRequestForMedicalReport(appointmentHistory); if (_reportsService.hasError) { @@ -77,7 +77,7 @@ class ReportsViewModel extends BaseViewModel { AppToast.showErrorToast(message: error); setState(ViewState.ErrorLocal); } else { - AppToast.showSuccessToast(message: 'The order was send '); + AppToast.showSuccessToast(message: mes); setState(ViewState.Idle); } } diff --git a/lib/core/viewModels/medical/vital_sign_view_model.dart b/lib/core/viewModels/medical/vital_sign_view_model.dart index f534140f..b2110187 100644 --- a/lib/core/viewModels/medical/vital_sign_view_model.dart +++ b/lib/core/viewModels/medical/vital_sign_view_model.dart @@ -11,7 +11,15 @@ class VitalSignViewModel extends BaseViewModel { List get vitalSignResModelList => _vitalSignService.vitalSignResModelList; - getPatientRadOrders({int appointmentNo, int projectID}) async { + String heightCm = "0"; + String weightKg = "0"; + String bodyMax = "0"; + String temperatureCelcius = "0"; + String hartRat = "0"; + String respirationBeatPerMinute = "0"; + String bloodPressure = "0 / 0"; + + getPatientVitalSign({int appointmentNo, int projectID}) async { setState(ViewState.Busy); if (appointmentNo != null && projectID != null) { @@ -23,7 +31,41 @@ class VitalSignViewModel extends BaseViewModel { if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.Error); - } else + } else { + _vitalSignService.vitalSignResModelList.forEach((element) { + if (heightCm == "0" || heightCm == null || heightCm == 'null') { + heightCm = element.heightCm.toString(); + } + if (weightKg == "0" || weightKg == null || weightKg == 'null') { + weightKg = element.weightKg.toString(); + } + if (bodyMax == "0" || + bodyMax == null || + bodyMax == 'null') { + bodyMax = element.bodyMassIndex.toString(); + } + if (temperatureCelcius == "0" || + temperatureCelcius == null || + temperatureCelcius == 'null') { + temperatureCelcius = element.temperatureCelcius.toString(); + } + if (hartRat == "0" || hartRat == null || hartRat == 'null') { + hartRat = element.pulseBeatPerMinute.toString(); + } + if (respirationBeatPerMinute == "0" || + respirationBeatPerMinute == null || + respirationBeatPerMinute == 'null') { + respirationBeatPerMinute = + element.respirationBeatPerMinute.toString(); + } + if (bloodPressure == "0 / 0" || + bloodPressure == null || + bloodPressure == 'null') { + bloodPressure = element.bloodPressure.toString(); + } + }); + setState(ViewState.Idle); + } } } diff --git a/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart b/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart new file mode 100644 index 00000000..21df52bc --- /dev/null +++ b/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart @@ -0,0 +1,19 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +class OfferCategoriesViewModel extends BaseViewModel { + OffersAndPackagesServices service = locator(); + List get list => service.categoryList; +} + +class OfferProductsViewModel extends BaseViewModel { + OffersAndPackagesServices service = locator(); + List get list => service.productList; +} diff --git a/lib/core/viewModels/pharmacies_view_model.dart b/lib/core/viewModels/pharmacies_view_model.dart index 01ad4e72..b9e162fc 100644 --- a/lib/core/viewModels/pharmacies_view_model.dart +++ b/lib/core/viewModels/pharmacies_view_model.dart @@ -23,9 +23,11 @@ class PharmacyViewModel extends BaseViewModel { setState(ViewState.Error); } else setState(ViewState.Idle); - //_pharmacyService.clearPharmaciesList(); } + clearMedicineSearch(){ + _pharmacyService.clearMedicineList(); + } Future getMedicine({String name}) async { hasError = false; _pharmacyService.clearMedicineList(); diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index a2e3b924..485c92fb 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -1,24 +1,117 @@ - +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyAddressesModel.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; class PharmacyAddressesViewModel extends BaseViewModel { - PharmacyAddressService _pharmacyAddressService = locator(); - List get address => _pharmacyAddressService.address; + PharmacyAddressService _pharmacyAddressService = + locator(); + + List get addresses => _pharmacyAddressService.addresses; + + int get selectedAddressIndex => _pharmacyAddressService.selectedAddressIndex; + CountryData get country => _pharmacyAddressService.country; + + setSelectedAddressIndex(int index) { + _pharmacyAddressService.selectedAddressIndex = index; + } - Future getAddress(address) async { + Future getAddressesList() async { setState(ViewState.Busy); - await _pharmacyAddressService.getAddress(address); + await _pharmacyAddressService.getAddresses(); if (_pharmacyAddressService.hasError) { error = _pharmacyAddressService.error; setState(ViewState.Error); } else { - print(address.length); + setState(ViewState.Idle); } } -} \ No newline at end of file +/* Future getCountries(String countryName) async { + setState(ViewState.Busy); + await _pharmacyAddressService.getCountries(countryName); + if (_pharmacyAddressService.hasError) { + error = _pharmacyAddressService.error; + // setState(ViewState.Error); + } else { + // setState(ViewState.Idle); + } + }*/ + + Future addEditAddress(PickResult value, Addresses editedAddress) async { + setState(ViewState.Busy); + + Addresses sendingAddress; + + if (editedAddress == null) { + sendingAddress = Addresses(); + sendingAddress.id = "0"; + sendingAddress.firstName = user.firstName; + sendingAddress.lastName = user.lastName; + sendingAddress.email = user.emailAddress; + sendingAddress.company = null; + } else { + sendingAddress = editedAddress; + } + value.addressComponents.forEach((element) { + if (element.types.contains("country")) { + sendingAddress.country = element.longName; + } + if (element.types.contains("administrative_area_level_1")) { + sendingAddress.city = element.longName; + } + if (element.types.contains("postal_code")) { + sendingAddress.zipPostalCode = element.longName; + } + if (element.types.contains("administrative_area_level_2")) { + sendingAddress.province = element.longName; + } + }); + sendingAddress.latLong = value.geometry.location.toString(); + + await _pharmacyAddressService.getCountries(sendingAddress.country); + sendingAddress.countryId = country.id; + sendingAddress.stateProvinceId = null; + sendingAddress.address1 = value.formattedAddress; + sendingAddress.address2 = ""; + sendingAddress.phoneNumber = user.mobileNumber; + sendingAddress.faxNumber = user.faxNumber; + sendingAddress.customerAttributes = ""; + sendingAddress.createdOnUtc = DateTime.now().toString(); + + if (editedAddress == null) { + await _pharmacyAddressService.addCustomerAddress(sendingAddress); + } else { + await _pharmacyAddressService.editCustomerAddress(sendingAddress); + } + + if (_pharmacyAddressService.hasError) { + error = _pharmacyAddressService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future deleteAddresses(Addresses sendingAddress) async { + setState(ViewState.Busy); + await _pharmacyAddressService.deleteCustomerAddress(sendingAddress); + if (_pharmacyAddressService.hasError) { + error = _pharmacyAddressService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future saveSelectedAddressLocally(Addresses selectedAddress) async { + await sharedPref.setObject(PHARMACY_SELECTED_ADDRESS, selectedAddress); + } +} diff --git a/lib/core/viewModels/pharmacyModule/brand_view_model.dart b/lib/core/viewModels/pharmacyModule/brand_view_model.dart index 2984632b..c981b2b3 100644 --- a/lib/core/viewModels/pharmacyModule/brand_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/brand_view_model.dart @@ -14,6 +14,9 @@ class BrandsViewModel extends BaseViewModel{ BrandsService _topBrandsService = locator(); List get topBrandsListList => _topBrandsService.topBrandsList; + List get searchList => + _brandsService.searchList; + bool hasError = false; @@ -38,4 +41,17 @@ class BrandsViewModel extends BaseViewModel{ } else setState(ViewState.Idle); } + + + Future searchProducts({String productName}) async { + hasError = false; + _brandsService.clearSearchList(); + setState(ViewState.Busy); + await _brandsService.searchProducts(productName: productName); + if (_brandsService.hasError) { + error = _brandsService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index aa693602..47a3bb11 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -1,26 +1,36 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; import '../../../locator.dart'; class ProductDetailViewModel extends BaseViewModel{ ProductDetailService _productDetailService = locator(); + ProductDetailService _productLocationService = locator(); + ProductDetailService _productWishlistService = locator(); + ProductDetailService _productSpecification = locator(); List get productDetailService => _productDetailService.productDetailList; - List get productLocationService => _productDetailService.productLocationList; + List get productLocationService => _productLocationService.productLocationList; + + List get wishListItems => _productWishlistService.wishListProducts; + + List get productSpecification => _productSpecification.productSpecification; bool hasError = false; - Future getProductReviewsData() async { + Future getProductReviewsData(productID) async { + print('ENAD REview'); hasError = false; setState(ViewState.Busy); - await _productDetailService.getProductReviews(); + await _productDetailService.getProductReviews(productID); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); @@ -29,15 +39,72 @@ class ProductDetailViewModel extends BaseViewModel{ } Future getProductLocationData() async { + print('ENAD in model view'); hasError = false; setState(ViewState.Busy); - await _productDetailService.getProductAvailabiltyDetail(); - if (_productDetailService.hasError) { - error = _productDetailService.error; + await _productLocationService.getProductAvailabiltyDetail(); + if (_productLocationService.hasError) { + error = _productLocationService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future addToCartData(quantity, itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productLocationService.addToCart(quantity, itemID); + if (_productLocationService.hasError) { + error = _productLocationService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future addToWishlistData(itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productLocationService.addToWishlist(itemID); + if (_productLocationService.hasError) { + error = _productLocationService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future checkWishlistData() async { + hasError = false; + setState(ViewState.Busy); + await _productWishlistService.getWishlistItems(); + if (_productWishlistService.hasError) { + error = _productWishlistService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + Future deletWishlistData(itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productWishlistService.delteItemFromWishlist(itemID); + if (_productWishlistService.hasError) { + error = _productWishlistService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } + Future productSpecificationData(itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productWishlistService.productSpecificationData(itemID); + if (_productWishlistService.hasError) { + error = _productWishlistService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } \ No newline at end of file diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart index 81179091..5e1f4f9f 100644 --- a/lib/core/viewModels/pharmacy_categorise_view_model.dart +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -17,7 +17,7 @@ import 'base_view_model.dart'; class PharmacyCategoriseViewModel extends BaseViewModel { bool hasError = false; PharmacyCategoriseService _pharmacyCategoriseService = - locator(); + locator(); List get categorise => _pharmacyCategoriseService.categoriseList; diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index d2b7cf8b..baaf6b5b 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -2,13 +2,21 @@ import 'dart:async'; import 'package:connectivity/connectivity.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; +import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; class ProjectViewModel extends BaseViewModel { + // Platform Bridge + PlatformBridge platformBridge() { + return PlatformBridge.shared(); + } + AppSharedPreferences sharedPref = AppSharedPreferences(); Locale _appLocale = Locale('ar'); String currentLanguage = 'ar'; @@ -18,9 +26,7 @@ class ProjectViewModel extends BaseViewModel { bool isError = false; String error = ''; dynamic searchvalue; - bool isLogin - = false; - + bool isLogin = false; dynamic get searchValue => searchvalue; @@ -30,12 +36,18 @@ class ProjectViewModel extends BaseViewModel { bool get isArabic => _isArabic; - // BaseViewModel baseViewModel = locator() + + bool isLoginChild = false; + List privilegeRootUser = List(); + List privilegeChildUser = List(); + + List get privileges => + isLoginChild ? privilegeChildUser : privilegeChildUser; + StreamSubscription subscription; ProjectViewModel() { loadSharedPrefLanguage(); - subscription = Connectivity() .onConnectivityChanged .listen((ConnectivityResult result) { @@ -54,9 +66,8 @@ class ProjectViewModel extends BaseViewModel { }); } - void loadSharedPrefLanguage() async { - currentLanguage = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Future loadSharedPrefLanguage() async { + currentLanguage = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); _appLocale = Locale(currentLanguage); _isArabic = currentLanguage == 'ar'; notifyListeners(); @@ -78,6 +89,49 @@ class ProjectViewModel extends BaseViewModel { notifyListeners(); } + setPrivilegeModelList( + {List privilege}) { + this.isLoginChild = isLoginChild; + privilegeRootUser = privilege; + + notifyListeners(); + } + + setPrivilege({privilegeList, bool isLoginChild = false}) { + List privilege = List(); + + privilegeList['List'][0]['ListPrivilege'].forEach((item) { + privilege.add(PrivilegeModel.fromJson(item)); + }); + + this.isLoginChild = isLoginChild; + if (isLoginChild) + privilegeChildUser = privilege; + else + privilegeRootUser = privilege; + + notifyListeners(); + } + + setIsLoginChild({@required bool isLoginChild}){ + this.isLoginChild = isLoginChild; + notifyListeners(); + } + + bool havePrivilege(int id) { + bool isHavePrivilege = false; + if(isLoginChild) + privilegeChildUser.forEach((element) { + if (element.iD == id) isHavePrivilege = element.privilege; + }); + else{ + privilegeRootUser.forEach((element) { + if (element.iD == id) isHavePrivilege = element.privilege; + }); + } + return isHavePrivilege; + } + @override void dispose() { if (subscription != null) subscription.cancel(); diff --git a/lib/core/viewModels/weather/weather_view_model.dart b/lib/core/viewModels/weather/weather_view_model.dart new file mode 100644 index 00000000..bb201843 --- /dev/null +++ b/lib/core/viewModels/weather/weather_view_model.dart @@ -0,0 +1,31 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; +import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; + +import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; +import 'package:diplomaticquarterapp/core/service/weather_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; + +import '../../../locator.dart'; + +class WeatherViewModel extends BaseViewModel { + WeatherService _weatherService = locator(); + List get weatherIndicatorData => + _weatherService.weatherIndicatorData; + getWeatherData() async { + setState(ViewState.Busy); + + // if (id != null && projectID != null) { + // await _erService.getProjectAvgERWaitingTimeOrders( + // id: id, projectID: projectID); + // } else { + await _weatherService.getWeatherData(); + // } + if (_weatherService.hasError) { + error = _weatherService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/generated/json/GeoZonesResponseModel_helper.dart b/lib/generated/json/GeoZonesResponseModel_helper.dart new file mode 100644 index 00000000..7cf3cc5f --- /dev/null +++ b/lib/generated/json/GeoZonesResponseModel_helper.dart @@ -0,0 +1,50 @@ +import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart'; + +geoZonesResponseModelEntityFromJson(GeoZonesResponseModel data, Map json) { + if (json['GEOF_ID'] != null) { + data.geofId = json['GEOF_ID']?.toInt(); + } + if (json['Description'] != null) { + data.description = json['Description']?.toString(); + } + if (json['DescriptionN'] != null) { + data.descriptionN = json['DescriptionN']?.toString(); + } + if (json['Latitude'] != null) { + data.latitude = json['Latitude']?.toString(); + } + if (json['Longitude'] != null) { + data.longitude = json['Longitude']?.toString(); + } + if (json['Radius'] != null) { + data.radius = json['Radius']?.toInt(); + } + if (json['Type'] != null) { + data.type = json['Type']?.toInt(); + } + if (json['ProjectID'] != null) { + data.projectID = json['ProjectID']?.toInt(); + } + if (json['ImageURL'] != null) { + data.imageURL = json['ImageURL']?.toString(); + } + if (json['IsCity'] != null) { + data.isCity = json['IsCity']; + } + return data; +} + +Map geoZonesResponseModelEntityToJson(GeoZonesResponseModel entity) { + final Map data = new Map(); + data['GEOF_ID'] = entity.geofId; + data['Description'] = entity.description; + data['DescriptionN'] = entity.descriptionN; + data['Latitude'] = entity.latitude; + data['Longitude'] = entity.longitude; + data['Radius'] = entity.radius; + data['Type'] = entity.type; + data['ProjectID'] = entity.projectID; + data['ImageURL'] = entity.imageURL; + data['IsCity'] = entity.isCity; + return data; +} diff --git a/lib/generated/json/OfferCategoriesResponseModel_helper.dart b/lib/generated/json/OfferCategoriesResponseModel_helper.dart new file mode 100644 index 00000000..e5ebc914 --- /dev/null +++ b/lib/generated/json/OfferCategoriesResponseModel_helper.dart @@ -0,0 +1,172 @@ +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart'; + +offerCategoriesResponseModelFromJson(OfferCategoriesResponseModel data, Map json) { + if (json['id'] != null) { + data.id = json['id']?.toString(); + } + if (json['name'] != null) { + data.name = json['name']?.toString(); + } + if (json['namen'] != null) { + data.namen = json['namen']?.toString(); + } + if (json['localized_names'] != null) { + data.localizedNames = new List(); + (json['localized_names'] as List).forEach((v) { + data.localizedNames.add(new OfferCategoriesResponseModelLocalizedName().fromJson(v)); + }); + } + if (json['description'] != null) { + data.description = json['description']; + } + if (json['category_template_id'] != null) { + data.categoryTemplateId = json['category_template_id']?.toInt(); + } + if (json['meta_keywords'] != null) { + data.metaKeywords = json['meta_keywords']?.toString(); + } + if (json['meta_description'] != null) { + data.metaDescription = json['meta_description']?.toString(); + } + if (json['meta_title'] != null) { + data.metaTitle = json['meta_title']?.toString(); + } + if (json['parent_category_id'] != null) { + data.parentCategoryId = json['parent_category_id']?.toInt(); + } + if (json['page_size'] != null) { + data.pageSize = json['page_size']?.toInt(); + } + if (json['page_size_options'] != null) { + data.pageSizeOptions = json['page_size_options']?.toString(); + } + if (json['price_ranges'] != null) { + data.priceRanges = json['price_ranges']; + } + if (json['show_on_home_page'] != null) { + data.showOnHomePage = json['show_on_home_page']; + } + if (json['include_in_top_menu'] != null) { + data.includeInTopMenu = json['include_in_top_menu']; + } + if (json['has_discounts_applied'] != null) { + data.hasDiscountsApplied = json['has_discounts_applied']; + } + if (json['published'] != null) { + data.published = json['published']; + } + if (json['deleted'] != null) { + data.deleted = json['deleted']; + } + if (json['display_order'] != null) { + data.displayOrder = json['display_order']?.toInt(); + } + if (json['created_on_utc'] != null) { + data.createdOnUtc = json['created_on_utc']?.toString(); + } + if (json['updated_on_utc'] != null) { + data.updatedOnUtc = json['updated_on_utc']?.toString(); + } + if (json['role_ids'] != null) { + data.roleIds = new List(); + data.roleIds.addAll(json['role_ids']); + } + if (json['discount_ids'] != null) { + data.discountIds = new List(); + data.discountIds.addAll(json['discount_ids']); + } + if (json['store_ids'] != null) { + data.storeIds = new List(); + data.storeIds.addAll(json['store_ids']); + } + if (json['image'] != null) { + data.image = new OfferCategoriesResponseModelImage().fromJson(json['image']); + } + if (json['se_name'] != null) { + data.seName = json['se_name']?.toString(); + } + if (json['is_leaf'] != null) { + data.isLeaf = json['is_leaf']; + } + return data; +} + +Map offerCategoriesResponseModelToJson(OfferCategoriesResponseModel entity) { + final Map data = new Map(); + data['id'] = entity.id; + data['name'] = entity.name; + data['namen'] = entity.namen; + if (entity.localizedNames != null) { + data['localized_names'] = entity.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = entity.description; + data['category_template_id'] = entity.categoryTemplateId; + data['meta_keywords'] = entity.metaKeywords; + data['meta_description'] = entity.metaDescription; + data['meta_title'] = entity.metaTitle; + data['parent_category_id'] = entity.parentCategoryId; + data['page_size'] = entity.pageSize; + data['page_size_options'] = entity.pageSizeOptions; + data['price_ranges'] = entity.priceRanges; + data['show_on_home_page'] = entity.showOnHomePage; + data['include_in_top_menu'] = entity.includeInTopMenu; + data['has_discounts_applied'] = entity.hasDiscountsApplied; + data['published'] = entity.published; + data['deleted'] = entity.deleted; + data['display_order'] = entity.displayOrder; + data['created_on_utc'] = entity.createdOnUtc; + data['updated_on_utc'] = entity.updatedOnUtc; + if (entity.roleIds != null) { + data['role_ids'] = []; + } + if (entity.discountIds != null) { + data['discount_ids'] = []; + } + if (entity.storeIds != null) { + data['store_ids'] = []; + } + if (entity.image != null) { + data['image'] = entity.image.toJson(); + } + data['se_name'] = entity.seName; + data['is_leaf'] = entity.isLeaf; + return data; +} + +offerCategoriesResponseModelLocalizedNameFromJson(OfferCategoriesResponseModelLocalizedName data, Map json) { + if (json['language_id'] != null) { + data.languageId = json['language_id']?.toInt(); + } + if (json['localized_name'] != null) { + data.localizedName = json['localized_name']?.toString(); + } + return data; +} + +Map offerCategoriesResponseModelLocalizedNameToJson(OfferCategoriesResponseModelLocalizedName entity) { + final Map data = new Map(); + data['language_id'] = entity.languageId; + data['localized_name'] = entity.localizedName; + return data; +} + +offerCategoriesResponseModelImageFromJson(OfferCategoriesResponseModelImage data, Map json) { + if (json['src'] != null) { + data.src = json['src']?.toString(); + } + if (json['thumb'] != null) { + data.thumb = json['thumb']; + } + if (json['attachment'] != null) { + data.attachment = json['attachment']; + } + return data; +} + +Map offerCategoriesResponseModelImageToJson(OfferCategoriesResponseModelImage entity) { + final Map data = new Map(); + data['src'] = entity.src; + data['thumb'] = entity.thumb; + data['attachment'] = entity.attachment; + return data; +} diff --git a/lib/generated/json/OfferProductsResponseModel_helper.dart b/lib/generated/json/OfferProductsResponseModel_helper.dart new file mode 100644 index 00000000..dc0edeca --- /dev/null +++ b/lib/generated/json/OfferProductsResponseModel_helper.dart @@ -0,0 +1,569 @@ +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart'; + +offerProductsResponseModelFromJson(OfferProductsResponseModel data, Map json) { + if (json['id'] != null) { + data.id = json['id']?.toString(); + } + if (json['visible_individually'] != null) { + data.visibleIndividually = json['visible_individually']; + } + if (json['name'] != null) { + data.name = json['name']?.toString(); + } + if (json['namen'] != null) { + data.namen = json['namen']?.toString(); + } + if (json['localized_names'] != null) { + data.localizedNames = new List(); + (json['localized_names'] as List).forEach((v) { + data.localizedNames.add(new OfferProductsResponseModelLocalizedName().fromJson(v)); + }); + } + if (json['short_description'] != null) { + data.shortDescription = json['short_description']?.toString(); + } + if (json['short_descriptionn'] != null) { + data.shortDescriptionn = json['short_descriptionn']?.toString(); + } + if (json['full_description'] != null) { + data.fullDescription = json['full_description']?.toString(); + } + if (json['full_descriptionn'] != null) { + data.fullDescriptionn = json['full_descriptionn']?.toString(); + } + if (json['markas_new'] != null) { + data.markasNew = json['markas_new']; + } + if (json['show_on_home_page'] != null) { + data.showOnHomePage = json['show_on_home_page']; + } + if (json['meta_keywords'] != null) { + data.metaKeywords = json['meta_keywords']; + } + if (json['meta_description'] != null) { + data.metaDescription = json['meta_description']; + } + if (json['meta_title'] != null) { + data.metaTitle = json['meta_title']; + } + if (json['allow_customer_reviews'] != null) { + data.allowCustomerReviews = json['allow_customer_reviews']; + } + if (json['approved_rating_sum'] != null) { + data.approvedRatingSum = json['approved_rating_sum']?.toInt(); + } + if (json['not_approved_rating_sum'] != null) { + data.notApprovedRatingSum = json['not_approved_rating_sum']?.toInt(); + } + if (json['approved_total_reviews'] != null) { + data.approvedTotalReviews = json['approved_total_reviews']?.toInt(); + } + if (json['not_approved_total_reviews'] != null) { + data.notApprovedTotalReviews = json['not_approved_total_reviews']?.toInt(); + } + if (json['sku'] != null) { + data.sku = json['sku']?.toString(); + } + if (json['is_rx'] != null) { + data.isRx = json['is_rx']; + } + if (json['prescription_required'] != null) { + data.prescriptionRequired = json['prescription_required']; + } + if (json['rx_message'] != null) { + data.rxMessage = json['rx_message']; + } + if (json['rx_messagen'] != null) { + data.rxMessagen = json['rx_messagen']; + } + if (json['manufacturer_part_number'] != null) { + data.manufacturerPartNumber = json['manufacturer_part_number']; + } + if (json['gtin'] != null) { + data.gtin = json['gtin']; + } + if (json['is_gift_card'] != null) { + data.isGiftCard = json['is_gift_card']; + } + if (json['require_other_products'] != null) { + data.requireOtherProducts = json['require_other_products']; + } + if (json['automatically_add_required_products'] != null) { + data.automaticallyAddRequiredProducts = json['automatically_add_required_products']; + } + if (json['is_download'] != null) { + data.isDownload = json['is_download']; + } + if (json['unlimited_downloads'] != null) { + data.unlimitedDownloads = json['unlimited_downloads']; + } + if (json['max_number_of_downloads'] != null) { + data.maxNumberOfDownloads = json['max_number_of_downloads']?.toInt(); + } + if (json['download_expiration_days'] != null) { + data.downloadExpirationDays = json['download_expiration_days']; + } + if (json['has_sample_download'] != null) { + data.hasSampleDownload = json['has_sample_download']; + } + if (json['has_user_agreement'] != null) { + data.hasUserAgreement = json['has_user_agreement']; + } + if (json['is_recurring'] != null) { + data.isRecurring = json['is_recurring']; + } + if (json['recurring_cycle_length'] != null) { + data.recurringCycleLength = json['recurring_cycle_length']?.toInt(); + } + if (json['recurring_total_cycles'] != null) { + data.recurringTotalCycles = json['recurring_total_cycles']?.toInt(); + } + if (json['is_rental'] != null) { + data.isRental = json['is_rental']; + } + if (json['rental_price_length'] != null) { + data.rentalPriceLength = json['rental_price_length']?.toInt(); + } + if (json['is_ship_enabled'] != null) { + data.isShipEnabled = json['is_ship_enabled']; + } + if (json['is_free_shipping'] != null) { + data.isFreeShipping = json['is_free_shipping']; + } + if (json['ship_separately'] != null) { + data.shipSeparately = json['ship_separately']; + } + if (json['additional_shipping_charge'] != null) { + data.additionalShippingCharge = json['additional_shipping_charge']?.toDouble(); + } + if (json['is_tax_exempt'] != null) { + data.isTaxExempt = json['is_tax_exempt']; + } + if (json['is_telecommunications_or_broadcasting_or_electronic_services'] != null) { + data.isTelecommunicationsOrBroadcastingOrElectronicServices = json['is_telecommunications_or_broadcasting_or_electronic_services']; + } + if (json['use_multiple_warehouses'] != null) { + data.useMultipleWarehouses = json['use_multiple_warehouses']; + } + if (json['manage_inventory_method_id'] != null) { + data.manageInventoryMethodId = json['manage_inventory_method_id']?.toInt(); + } + if (json['stock_quantity'] != null) { + data.stockQuantity = json['stock_quantity']?.toInt(); + } + if (json['stock_availability'] != null) { + data.stockAvailability = json['stock_availability']?.toString(); + } + if (json['stock_availabilityn'] != null) { + data.stockAvailabilityn = json['stock_availabilityn']?.toString(); + } + if (json['display_stock_availability'] != null) { + data.displayStockAvailability = json['display_stock_availability']; + } + if (json['display_stock_quantity'] != null) { + data.displayStockQuantity = json['display_stock_quantity']; + } + if (json['min_stock_quantity'] != null) { + data.minStockQuantity = json['min_stock_quantity']?.toInt(); + } + if (json['notify_admin_for_quantity_below'] != null) { + data.notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']?.toInt(); + } + if (json['allow_back_in_stock_subscriptions'] != null) { + data.allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + } + if (json['order_minimum_quantity'] != null) { + data.orderMinimumQuantity = json['order_minimum_quantity']?.toInt(); + } + if (json['order_maximum_quantity'] != null) { + data.orderMaximumQuantity = json['order_maximum_quantity']?.toInt(); + } + if (json['allowed_quantities'] != null) { + data.allowedQuantities = json['allowed_quantities']; + } + if (json['allow_adding_only_existing_attribute_combinations'] != null) { + data.allowAddingOnlyExistingAttributeCombinations = json['allow_adding_only_existing_attribute_combinations']; + } + if (json['disable_buy_button'] != null) { + data.disableBuyButton = json['disable_buy_button']; + } + if (json['disable_wishlist_button'] != null) { + data.disableWishlistButton = json['disable_wishlist_button']; + } + if (json['available_for_pre_order'] != null) { + data.availableForPreOrder = json['available_for_pre_order']; + } + if (json['pre_order_availability_start_date_time_utc'] != null) { + data.preOrderAvailabilityStartDateTimeUtc = json['pre_order_availability_start_date_time_utc']; + } + if (json['call_for_price'] != null) { + data.callForPrice = json['call_for_price']; + } + if (json['price'] != null) { + data.price = json['price']?.toDouble(); + } + if (json['old_price'] != null) { + data.oldPrice = json['old_price']?.toDouble(); + } + if (json['product_cost'] != null) { + data.productCost = json['product_cost']?.toDouble(); + } + if (json['special_price'] != null) { + data.specialPrice = json['special_price']; + } + if (json['special_price_start_date_time_utc'] != null) { + data.specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + } + if (json['special_price_end_date_time_utc'] != null) { + data.specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + } + if (json['customer_enters_price'] != null) { + data.customerEntersPrice = json['customer_enters_price']; + } + if (json['minimum_customer_entered_price'] != null) { + data.minimumCustomerEnteredPrice = json['minimum_customer_entered_price']?.toDouble(); + } + if (json['maximum_customer_entered_price'] != null) { + data.maximumCustomerEnteredPrice = json['maximum_customer_entered_price']?.toDouble(); + } + if (json['baseprice_enabled'] != null) { + data.basepriceEnabled = json['baseprice_enabled']; + } + if (json['baseprice_amount'] != null) { + data.basepriceAmount = json['baseprice_amount']?.toDouble(); + } + if (json['baseprice_base_amount'] != null) { + data.basepriceBaseAmount = json['baseprice_base_amount']?.toDouble(); + } + if (json['has_tier_prices'] != null) { + data.hasTierPrices = json['has_tier_prices']; + } + if (json['has_discounts_applied'] != null) { + data.hasDiscountsApplied = json['has_discounts_applied']; + } + if (json['discount_name'] != null) { + data.discountName = json['discount_name']; + } + if (json['discount_namen'] != null) { + data.discountNamen = json['discount_namen']; + } + if (json['discount_description'] != null) { + data.discountDescription = json['discount_description']; + } + if (json['discount_Descriptionn'] != null) { + data.discountDescriptionn = json['discount_Descriptionn']; + } + if (json['discount_percentage'] != null) { + data.discountPercentage = json['discount_percentage']; + } + if (json['currency'] != null) { + data.currency = json['currency']?.toString(); + } + if (json['currencyn'] != null) { + data.currencyn = json['currencyn']?.toString(); + } + if (json['weight'] != null) { + data.weight = json['weight']?.toDouble(); + } + if (json['length'] != null) { + data.length = json['length']?.toDouble(); + } + if (json['width'] != null) { + data.width = json['width']?.toDouble(); + } + if (json['height'] != null) { + data.height = json['height']?.toDouble(); + } + if (json['available_start_date_time_utc'] != null) { + data.availableStartDateTimeUtc = json['available_start_date_time_utc']; + } + if (json['available_end_date_time_utc'] != null) { + data.availableEndDateTimeUtc = json['available_end_date_time_utc']; + } + if (json['display_order'] != null) { + data.displayOrder = json['display_order']?.toInt(); + } + if (json['published'] != null) { + data.published = json['published']; + } + if (json['deleted'] != null) { + data.deleted = json['deleted']; + } + if (json['created_on_utc'] != null) { + data.createdOnUtc = json['created_on_utc']?.toString(); + } + if (json['updated_on_utc'] != null) { + data.updatedOnUtc = json['updated_on_utc']?.toString(); + } + if (json['product_type'] != null) { + data.productType = json['product_type']?.toString(); + } + if (json['parent_grouped_product_id'] != null) { + data.parentGroupedProductId = json['parent_grouped_product_id']?.toInt(); + } + if (json['role_ids'] != null) { + data.roleIds = new List(); + data.roleIds.addAll(json['role_ids']); + } + if (json['discount_ids'] != null) { + data.discountIds = new List(); + data.discountIds.addAll(json['discount_ids']); + } + if (json['store_ids'] != null) { + data.storeIds = new List(); + data.storeIds.addAll(json['store_ids']); + } + if (json['manufacturer_ids'] != null) { + data.manufacturerIds = json['manufacturer_ids']?.map((v) => v?.toInt())?.toList()?.cast(); + } + if (json['reviews'] != null) { + data.reviews = new List(); + data.reviews.addAll(json['reviews']); + } + if (json['images'] != null) { + data.images = new List(); + (json['images'] as List).forEach((v) { + data.images.add(new OfferProductsResponseModelImage().fromJson(v)); + }); + } + if (json['attributes'] != null) { + data.attributes = new List(); + data.attributes.addAll(json['attributes']); + } + if (json['specifications'] != null) { + data.specifications = new List(); + (json['specifications'] as List).forEach((v) { + data.specifications.add(new OfferProductsResponseModelSpecification().fromJson(v)); + }); + } + if (json['associated_product_ids'] != null) { + data.associatedProductIds = new List(); + data.associatedProductIds.addAll(json['associated_product_ids']); + } + if (json['tags'] != null) { + data.tags = new List(); + data.tags.addAll(json['tags']); + } + if (json['vendor_id'] != null) { + data.vendorId = json['vendor_id']?.toInt(); + } + if (json['se_name'] != null) { + data.seName = json['se_name']?.toString(); + } + return data; +} + +Map offerProductsResponseModelToJson(OfferProductsResponseModel entity) { + final Map data = new Map(); + data['id'] = entity.id; + data['visible_individually'] = entity.visibleIndividually; + data['name'] = entity.name; + data['namen'] = entity.namen; + if (entity.localizedNames != null) { + data['localized_names'] = entity.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = entity.shortDescription; + data['short_descriptionn'] = entity.shortDescriptionn; + data['full_description'] = entity.fullDescription; + data['full_descriptionn'] = entity.fullDescriptionn; + data['markas_new'] = entity.markasNew; + data['show_on_home_page'] = entity.showOnHomePage; + data['meta_keywords'] = entity.metaKeywords; + data['meta_description'] = entity.metaDescription; + data['meta_title'] = entity.metaTitle; + data['allow_customer_reviews'] = entity.allowCustomerReviews; + data['approved_rating_sum'] = entity.approvedRatingSum; + data['not_approved_rating_sum'] = entity.notApprovedRatingSum; + data['approved_total_reviews'] = entity.approvedTotalReviews; + data['not_approved_total_reviews'] = entity.notApprovedTotalReviews; + data['sku'] = entity.sku; + data['is_rx'] = entity.isRx; + data['prescription_required'] = entity.prescriptionRequired; + data['rx_message'] = entity.rxMessage; + data['rx_messagen'] = entity.rxMessagen; + data['manufacturer_part_number'] = entity.manufacturerPartNumber; + data['gtin'] = entity.gtin; + data['is_gift_card'] = entity.isGiftCard; + data['require_other_products'] = entity.requireOtherProducts; + data['automatically_add_required_products'] = entity.automaticallyAddRequiredProducts; + data['is_download'] = entity.isDownload; + data['unlimited_downloads'] = entity.unlimitedDownloads; + data['max_number_of_downloads'] = entity.maxNumberOfDownloads; + data['download_expiration_days'] = entity.downloadExpirationDays; + data['has_sample_download'] = entity.hasSampleDownload; + data['has_user_agreement'] = entity.hasUserAgreement; + data['is_recurring'] = entity.isRecurring; + data['recurring_cycle_length'] = entity.recurringCycleLength; + data['recurring_total_cycles'] = entity.recurringTotalCycles; + data['is_rental'] = entity.isRental; + data['rental_price_length'] = entity.rentalPriceLength; + data['is_ship_enabled'] = entity.isShipEnabled; + data['is_free_shipping'] = entity.isFreeShipping; + data['ship_separately'] = entity.shipSeparately; + data['additional_shipping_charge'] = entity.additionalShippingCharge; + data['is_tax_exempt'] = entity.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = entity.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = entity.useMultipleWarehouses; + data['manage_inventory_method_id'] = entity.manageInventoryMethodId; + data['stock_quantity'] = entity.stockQuantity; + data['stock_availability'] = entity.stockAvailability; + data['stock_availabilityn'] = entity.stockAvailabilityn; + data['display_stock_availability'] = entity.displayStockAvailability; + data['display_stock_quantity'] = entity.displayStockQuantity; + data['min_stock_quantity'] = entity.minStockQuantity; + data['notify_admin_for_quantity_below'] = entity.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = entity.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = entity.orderMinimumQuantity; + data['order_maximum_quantity'] = entity.orderMaximumQuantity; + data['allowed_quantities'] = entity.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = entity.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = entity.disableBuyButton; + data['disable_wishlist_button'] = entity.disableWishlistButton; + data['available_for_pre_order'] = entity.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = entity.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = entity.callForPrice; + data['price'] = entity.price; + data['old_price'] = entity.oldPrice; + data['product_cost'] = entity.productCost; + data['special_price'] = entity.specialPrice; + data['special_price_start_date_time_utc'] = entity.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = entity.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = entity.customerEntersPrice; + data['minimum_customer_entered_price'] = entity.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = entity.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = entity.basepriceEnabled; + data['baseprice_amount'] = entity.basepriceAmount; + data['baseprice_base_amount'] = entity.basepriceBaseAmount; + data['has_tier_prices'] = entity.hasTierPrices; + data['has_discounts_applied'] = entity.hasDiscountsApplied; + data['discount_name'] = entity.discountName; + data['discount_namen'] = entity.discountNamen; + data['discount_description'] = entity.discountDescription; + data['discount_Descriptionn'] = entity.discountDescriptionn; + data['discount_percentage'] = entity.discountPercentage; + data['currency'] = entity.currency; + data['currencyn'] = entity.currencyn; + data['weight'] = entity.weight; + data['length'] = entity.length; + data['width'] = entity.width; + data['height'] = entity.height; + data['available_start_date_time_utc'] = entity.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = entity.availableEndDateTimeUtc; + data['display_order'] = entity.displayOrder; + data['published'] = entity.published; + data['deleted'] = entity.deleted; + data['created_on_utc'] = entity.createdOnUtc; + data['updated_on_utc'] = entity.updatedOnUtc; + data['product_type'] = entity.productType; + data['parent_grouped_product_id'] = entity.parentGroupedProductId; + if (entity.roleIds != null) { + data['role_ids'] = []; + } + if (entity.discountIds != null) { + data['discount_ids'] = []; + } + if (entity.storeIds != null) { + data['store_ids'] = []; + } + data['manufacturer_ids'] = entity.manufacturerIds; + if (entity.reviews != null) { + data['reviews'] = []; + } + if (entity.images != null) { + data['images'] = entity.images.map((v) => v.toJson()).toList(); + } + if (entity.attributes != null) { + data['attributes'] = []; + } + if (entity.specifications != null) { + data['specifications'] = entity.specifications.map((v) => v.toJson()).toList(); + } + if (entity.associatedProductIds != null) { + data['associated_product_ids'] = []; + } + if (entity.tags != null) { + data['tags'] = []; + } + data['vendor_id'] = entity.vendorId; + data['se_name'] = entity.seName; + return data; +} + +offerProductsResponseModelLocalizedNameFromJson(OfferProductsResponseModelLocalizedName data, Map json) { + if (json['language_id'] != null) { + data.languageId = json['language_id']?.toInt(); + } + if (json['localized_name'] != null) { + data.localizedName = json['localized_name']?.toString(); + } + return data; +} + +Map offerProductsResponseModelLocalizedNameToJson(OfferProductsResponseModelLocalizedName entity) { + final Map data = new Map(); + data['language_id'] = entity.languageId; + data['localized_name'] = entity.localizedName; + return data; +} + +offerProductsResponseModelImageFromJson(OfferProductsResponseModelImage data, Map json) { + if (json['id'] != null) { + data.id = json['id']?.toInt(); + } + if (json['position'] != null) { + data.position = json['position']?.toInt(); + } + if (json['src'] != null) { + data.src = json['src']?.toString(); + } + if (json['thumb'] != null) { + data.thumb = json['thumb']?.toString(); + } + if (json['attachment'] != null) { + data.attachment = json['attachment']?.toString(); + } + return data; +} + +Map offerProductsResponseModelImageToJson(OfferProductsResponseModelImage entity) { + final Map data = new Map(); + data['id'] = entity.id; + data['position'] = entity.position; + data['src'] = entity.src; + data['thumb'] = entity.thumb; + data['attachment'] = entity.attachment; + return data; +} + +offerProductsResponseModelSpecificationFromJson(OfferProductsResponseModelSpecification data, Map json) { + if (json['id'] != null) { + data.id = json['id']?.toInt(); + } + if (json['display_order'] != null) { + data.displayOrder = json['display_order']?.toInt(); + } + if (json['default_value'] != null) { + data.defaultValue = json['default_value']?.toString(); + } + if (json['default_valuen'] != null) { + data.defaultValuen = json['default_valuen']?.toString(); + } + if (json['name'] != null) { + data.name = json['name']?.toString(); + } + if (json['nameN'] != null) { + data.nameN = json['nameN']?.toString(); + } + return data; +} + +Map offerProductsResponseModelSpecificationToJson(OfferProductsResponseModelSpecification entity) { + final Map data = new Map(); + data['id'] = entity.id; + data['display_order'] = entity.displayOrder; + data['default_value'] = entity.defaultValue; + data['default_valuen'] = entity.defaultValuen; + data['name'] = entity.name; + data['nameN'] = entity.nameN; + return data; +} diff --git a/lib/generated/json/base/json_convert_content.dart b/lib/generated/json/base/json_convert_content.dart new file mode 100644 index 00000000..9fab946e --- /dev/null +++ b/lib/generated/json/base/json_convert_content.dart @@ -0,0 +1,128 @@ +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: camel_case_types +// ignore_for_file: prefer_single_quotes + +// This file is automatically generated. DO NOT EDIT, all your changes would be lost. +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart'; +import 'package:diplomaticquarterapp/generated/json/OfferCategoriesResponseModel_helper.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/responses/LogGeoZoneResponseModel.dart'; +import 'package:diplomaticquarterapp/generated/json/log_geo_zone_response_model_entity_helper.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart'; +import 'package:diplomaticquarterapp/generated/json/OfferProductsResponseModel_helper.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart'; +import 'package:diplomaticquarterapp/generated/json/GeoZonesResponseModel_helper.dart'; + +class JsonConvert { + T fromJson(Map json) { + return _getFromJson(runtimeType, this, json); + } + + Map toJson() { + return _getToJson(runtimeType, this); + } + + static _getFromJson(Type type, data, json) { + switch (type) { + case OfferCategoriesResponseModel: + return offerCategoriesResponseModelFromJson(data as OfferCategoriesResponseModel, json) as T; + case OfferCategoriesResponseModelLocalizedName: + return offerCategoriesResponseModelLocalizedNameFromJson(data as OfferCategoriesResponseModelLocalizedName, json) as T; + case OfferCategoriesResponseModelImage: + return offerCategoriesResponseModelImageFromJson(data as OfferCategoriesResponseModelImage, json) as T; + case LogGeoZoneResponseModel: + return logGeoZoneResponseModelEntityFromJson(data as LogGeoZoneResponseModel, json) as T; + case OfferProductsResponseModel: + return offerProductsResponseModelFromJson(data as OfferProductsResponseModel, json) as T; + case OfferProductsResponseModelLocalizedName: + return offerProductsResponseModelLocalizedNameFromJson(data as OfferProductsResponseModelLocalizedName, json) as T; + case OfferProductsResponseModelImage: + return offerProductsResponseModelImageFromJson(data as OfferProductsResponseModelImage, json) as T; + case OfferProductsResponseModelSpecification: + return offerProductsResponseModelSpecificationFromJson(data as OfferProductsResponseModelSpecification, json) as T; + case GeoZonesResponseModel: + return geoZonesResponseModelEntityFromJson(data as GeoZonesResponseModel, json) as T; + } + return data as T; + } + + static _getToJson(Type type, data) { + switch (type) { + case OfferCategoriesResponseModel: + return offerCategoriesResponseModelToJson(data as OfferCategoriesResponseModel); + case OfferCategoriesResponseModelLocalizedName: + return offerCategoriesResponseModelLocalizedNameToJson(data as OfferCategoriesResponseModelLocalizedName); + case OfferCategoriesResponseModelImage: + return offerCategoriesResponseModelImageToJson(data as OfferCategoriesResponseModelImage); + case LogGeoZoneResponseModel: + return logGeoZoneResponseModelEntityToJson(data as LogGeoZoneResponseModel); + case OfferProductsResponseModel: + return offerProductsResponseModelToJson(data as OfferProductsResponseModel); + case OfferProductsResponseModelLocalizedName: + return offerProductsResponseModelLocalizedNameToJson(data as OfferProductsResponseModelLocalizedName); + case OfferProductsResponseModelImage: + return offerProductsResponseModelImageToJson(data as OfferProductsResponseModelImage); + case OfferProductsResponseModelSpecification: + return offerProductsResponseModelSpecificationToJson(data as OfferProductsResponseModelSpecification); + case GeoZonesResponseModel: + return geoZonesResponseModelEntityToJson(data as GeoZonesResponseModel); + } + return data as T; + } + + //Go back to a single instance by type + static _fromJsonSingle(json) { + String type = M.toString(); + if (type == (OfferCategoriesResponseModel).toString()) { + return OfferCategoriesResponseModel().fromJson(json); + } else if (type == (OfferCategoriesResponseModelLocalizedName).toString()) { + return OfferCategoriesResponseModelLocalizedName().fromJson(json); + } else if (type == (OfferCategoriesResponseModelImage).toString()) { + return OfferCategoriesResponseModelImage().fromJson(json); + } else if (type == (LogGeoZoneResponseModel).toString()) { + return LogGeoZoneResponseModel().fromJson(json); + } else if (type == (OfferProductsResponseModel).toString()) { + return OfferProductsResponseModel().fromJson(json); + } else if (type == (OfferProductsResponseModelLocalizedName).toString()) { + return OfferProductsResponseModelLocalizedName().fromJson(json); + } else if (type == (OfferProductsResponseModelImage).toString()) { + return OfferProductsResponseModelImage().fromJson(json); + } else if (type == (OfferProductsResponseModelSpecification).toString()) { + return OfferProductsResponseModelSpecification().fromJson(json); + } else if (type == (GeoZonesResponseModel).toString()) { + return GeoZonesResponseModel().fromJson(json); + } + return null; + } + + //list is returned by type + static M _getListChildType(List data) { + if (List() is M) { + return data.map((e) => OfferCategoriesResponseModel().fromJson(e)).toList() as M; + } else if (List() is M) { + return data.map((e) => OfferCategoriesResponseModelLocalizedName().fromJson(e)).toList() as M; + } else if (List() is M) { + return data.map((e) => OfferCategoriesResponseModelImage().fromJson(e)).toList() as M; + } else if (List() is M) { + return data.map((e) => LogGeoZoneResponseModel().fromJson(e)).toList() as M; + } else if (List() is M) { + return data.map((e) => OfferProductsResponseModel().fromJson(e)).toList() as M; + } else if (List() is M) { + return data.map((e) => OfferProductsResponseModelLocalizedName().fromJson(e)).toList() as M; + } else if (List() is M) { + return data.map((e) => OfferProductsResponseModelImage().fromJson(e)).toList() as M; + } else if (List() is M) { + return data.map((e) => OfferProductsResponseModelSpecification().fromJson(e)).toList() as M; + } else if (List() is M) { + return data.map((e) => GeoZonesResponseModel().fromJson(e)).toList() as M; + } + return null; + } + + static M fromJsonAsT(json) { + if (json is List) { + return _getListChildType(json); + } else { + return _fromJsonSingle(json) as M; + } + } +} diff --git a/lib/generated/json/base/json_field.dart b/lib/generated/json/base/json_field.dart new file mode 100644 index 00000000..bc92972b --- /dev/null +++ b/lib/generated/json/base/json_field.dart @@ -0,0 +1,21 @@ +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: camel_case_types +// ignore_for_file: prefer_single_quotes + +// This file is automatically generated. DO NOT EDIT, all your changes would be lost. + +class JSONField { + //Specify the parse field name + final String name; + + //Specify the time resolution format + final String format; + + //Whether to participate in toJson + final bool serialize; + + //Whether to participate in fromMap + final bool deserialize; + + const JSONField({this.name, this.format, this.serialize, this.deserialize}); +} diff --git a/lib/generated/json/log_geo_zone_response_model_entity_helper.dart b/lib/generated/json/log_geo_zone_response_model_entity_helper.dart new file mode 100644 index 00000000..28b8c996 --- /dev/null +++ b/lib/generated/json/log_geo_zone_response_model_entity_helper.dart @@ -0,0 +1,54 @@ +import 'package:diplomaticquarterapp/core/model/geofencing/responses/LogGeoZoneResponseModel.dart'; + +logGeoZoneResponseModelEntityFromJson(LogGeoZoneResponseModel data, Map json) { + if (json['LanguageID'] != null) { + data.languageID = json['LanguageID']?.toInt(); + } + if (json['ErrorCode'] != null) { + data.errorCode = json['ErrorCode']; + } + if (json['ErrorEndUserMessage'] != null) { + data.errorEndUserMessage = json['ErrorEndUserMessage']?.toString(); + } + if (json['ErrorEndUserMessageN'] != null) { + data.errorEndUserMessageN = json['ErrorEndUserMessageN']; + } + if (json['ErrorMessage'] != null) { + data.errorMessage = json['ErrorMessage']; + } + if (json['ErrorType'] != null) { + data.errorType = json['ErrorType']?.toInt(); + } + if (json['IsAuthenticated'] != null) { + data.isAuthenticated = json['IsAuthenticated']; + } + if (json['SuccessMsg'] != null) { + data.successMsg = json['SuccessMsg']; + } + if (json['SuccessMsgN'] != null) { + data.successMsgN = json['SuccessMsgN']; + } + if (json['statusCode'] != null) { + data.statusCode = json['statusCode']?.toInt(); + } + if (json['MessageStatus'] != null) { + data.messageStatus = json['MessageStatus']?.toInt(); + } + return data; +} + +Map logGeoZoneResponseModelEntityToJson(LogGeoZoneResponseModel entity) { + final Map data = new Map(); + data['LanguageID'] = entity.languageID; + data['ErrorCode'] = entity.errorCode; + data['ErrorEndUserMessage'] = entity.errorEndUserMessage; + data['ErrorEndUserMessageN'] = entity.errorEndUserMessageN; + data['ErrorMessage'] = entity.errorMessage; + data['ErrorType'] = entity.errorType; + data['IsAuthenticated'] = entity.isAuthenticated; + data['SuccessMsg'] = entity.successMsg; + data['SuccessMsgN'] = entity.successMsgN; + data['statusCode'] = entity.statusCode; + data['MessageStatus'] = entity.messageStatus; + return data; +} diff --git a/lib/locator.dart b/lib/locator.dart index 12510f8a..5e523456 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_ import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:get_it/get_it.dart'; import 'core/service/AlHabibMedicalService/cmc_service.dart'; @@ -33,6 +34,7 @@ import 'core/service/dashboard_service.dart'; import 'core/service/er/am_service.dart'; import 'core/service/er/er_service.dart'; import 'core/service/feedback/feedback_service.dart'; +import 'core/service/geofencing/GeofencingServices.dart'; import 'core/service/hospital_service.dart'; import 'core/service/medical/ActiveMedicationsService.dart'; import 'core/service/medical/AllergiesService.dart'; @@ -50,12 +52,15 @@ import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; import 'core/service/medical/reports_monthly_service.dart'; import 'core/service/medical/vital_sign_service.dart'; +import 'core/service/packages_offers/PackagesOffersServices.dart'; import 'core/service/parmacyModule/lacum-registration-service.dart'; import 'core/service/parmacyModule/lacum-service.dart'; import 'core/service/parmacyModule/lacum-transfer-service.dart'; 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/weather_service.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'core/service/parmacyModule/parmacy_module_service.dart'; @@ -94,6 +99,7 @@ import 'core/viewModels/medical/reports_view_model.dart'; import 'core/viewModels/medical/weight_pressure_view_model.dart'; import 'core/viewModels/notifications_view_model.dart'; import 'core/viewModels/offers_Categorise_view_model.dart'; +import 'core/viewModels/packages_offers/PackagesOffersViewModel.dart'; import 'core/viewModels/pharmacies_view_model.dart'; import 'core/service/pharmacies_service.dart'; import 'core/service/insurance_service.dart'; @@ -106,6 +112,7 @@ import 'core/viewModels/pharmacyModule/wishlist_view_model.dart'; import 'core/viewModels/qr_view_model.dart'; import 'core/viewModels/vaccine_view_model.dart'; import 'core/service/vaccine_service.dart'; +import 'core/viewModels/weather/weather_view_model.dart'; import 'services/pharmacy_services/brands_service.dart'; import 'services/pharmacy_services/product_detail_service.dart'; import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; @@ -125,6 +132,9 @@ GetIt locator = GetIt.instance; ///di void setupLocator() { + /// Others + locator.registerLazySingleton(() => FlutterLocalNotificationsPlugin()); + /// Services locator.registerLazySingleton(() => AuthenticatedUserObject()); locator.registerLazySingleton(() => HospitalService()); @@ -195,8 +205,8 @@ void setupLocator() { locator.registerLazySingleton(() => CancelOrderService()); locator.registerLazySingleton(() => PrescriptionService()); - - + locator.registerLazySingleton(() => PrivilegeService()); + locator.registerLazySingleton(() => WeatherService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -250,7 +260,7 @@ void setupLocator() { locator.registerFactory(() => ReviewViewModel()); locator.registerFactory(() => BrandsViewModel()); locator.registerFactory(() => ProductDetailViewModel()); - + locator.registerFactory(() => WeatherViewModel()); locator.registerFactory(() => OrderPreviewViewModel()); locator.registerFactory(() => LacumViewModel()); @@ -260,4 +270,18 @@ void setupLocator() { //pharmacy locator.registerFactory(() => PharmacyCategoriseViewModel()); locator.registerFactory(() => OffersCategoriseViewModel()); + + // Offer And Packages + //---------------------- + locator.registerLazySingleton( + () => OffersAndPackagesServices()); // offerPackagesServices Service + locator.registerFactory( + () => OfferCategoriesViewModel()); // Categories View Model + locator + .registerFactory(() => OfferProductsViewModel()); // Products View Model + + // Geofencing + // --------------------- + locator.registerLazySingleton( + () => GeofencingServices()); // Geofencing Services } diff --git a/lib/main.dart b/lib/main.dart index 218fbf07..fe129e01 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,27 +4,38 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; +import 'package:diplomaticquarterapp/uitl/HMG_Geofence.dart'; +import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; +import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import 'Constants.dart'; import 'config/size_config.dart'; +import 'core/model/geofencing/requests/GeoZonesRequestModel.dart'; +import 'core/service/geofencing/GeofencingServices.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; +import 'pages/pharmacies/compare-list.dart'; void main() async { setupLocator(); - runApp(ChangeNotifierProvider( - create: (context) => ThemeNotifier(defaultTheme), child: MyApp() )); + runApp(ChangeNotifierProvider(create: (context) => ThemeNotifier(defaultTheme), child: MyApp())); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - final themeNotifier = Provider.of(context); + PlatformBridge.init(context); + LocalNotification.init(onNotificationClick: (payload){ + LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); + }); + final themeNotifier = Provider.of(context); + precacheImage(AssetImage('assets/images/powerd-by.jpg'), context); return LayoutBuilder( builder: (context, constraints) { return OrientationBuilder( @@ -35,17 +46,17 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), - ChangeNotifierProvider( - create: (context) => ToDoCountProviderModel()), - ChangeNotifierProvider( - create: (context) => SearchProvider()), + ChangeNotifierProvider(create: (context) => ToDoCountProviderModel()), + ChangeNotifierProvider(create: (context) => SearchProvider()), ChangeNotifierProvider.value( value: SearchProvider(), ), StreamProvider.value( value: RobotProvider().intStream(), initialData: RobotProvider().setValue({}), - ) + ), + ChangeNotifierProvider( + create: (context) => CompareList()), ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( @@ -63,9 +74,8 @@ class MyApp extends StatelessWidget { const Locale('ar', ''), // Arabic const Locale('en', ''), // English ], - // theme: themeNotifier.getTheme(), - theme:ThemeData( - fontFamily:projectProvider.isArabic ? 'Cairo' : 'WorkSans', + theme: ThemeData( + fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.light, @@ -91,8 +101,9 @@ class MyApp extends StatelessWidget { highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Colors.grey, - bottomSheetTheme: BottomSheetThemeData( - backgroundColor: HexColor('#E0E0E0')), + toggleableActiveColor: secondaryColor, + indicatorColor: secondaryColor, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), cursorColor: Colors.grey, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( diff --git a/lib/models/Appointments/AppoimentAllHistoryResultList.dart b/lib/models/Appointments/AppoimentAllHistoryResultList.dart index 20eace25..045f759e 100644 --- a/lib/models/Appointments/AppoimentAllHistoryResultList.dart +++ b/lib/models/Appointments/AppoimentAllHistoryResultList.dart @@ -50,6 +50,7 @@ class AppoitmentAllHistoryResultList { bool isExecludeDoctor; int isFollowup; bool isLiveCareAppointment; + bool isInOutPatient; bool isMedicalReportRequested; bool isOnlineCheckedIN; String latitude; @@ -188,6 +189,7 @@ class AppoitmentAllHistoryResultList { isExecludeDoctor = json['IsExecludeDoctor']; isFollowup = json['IsFollowup']; isLiveCareAppointment = json['IsLiveCareAppointment']; + isInOutPatient = json['IsInOutPatient']; isMedicalReportRequested = json['IsMedicalReportRequested']; isOnlineCheckedIN = json['IsOnlineCheckedIN']; latitude = json['Latitude']; @@ -259,6 +261,7 @@ class AppoitmentAllHistoryResultList { data['IsExecludeDoctor'] = this.isExecludeDoctor; data['IsFollowup'] = this.isFollowup; data['IsLiveCareAppointment'] = this.isLiveCareAppointment; + data['IsInOutPatient'] = this.isInOutPatient; data['IsMedicalReportRequested'] = this.isMedicalReportRequested; data['IsOnlineCheckedIN'] = this.isOnlineCheckedIN; data['Latitude'] = this.latitude; diff --git a/lib/models/Appointments/DoctorRateDetails.dart b/lib/models/Appointments/DoctorRateDetails.dart new file mode 100644 index 00000000..b29a5db9 --- /dev/null +++ b/lib/models/Appointments/DoctorRateDetails.dart @@ -0,0 +1,32 @@ +class DoctorRateDetails { + dynamic doctorID; + dynamic projectID; + dynamic clinicID; + dynamic rate; + dynamic patientNumber; + + DoctorRateDetails( + {this.doctorID, + this.projectID, + this.clinicID, + this.rate, + this.patientNumber}); + + DoctorRateDetails.fromJson(Map json) { + doctorID = json['DoctorID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + rate = json['Rate']; + patientNumber = json['PatientNumber']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['Rate'] = this.rate; + data['PatientNumber'] = this.patientNumber; + return data; + } +} diff --git a/lib/models/Appointments/toDoCountProviderModel.dart b/lib/models/Appointments/toDoCountProviderModel.dart index 0fd83491..e44a0ebb 100644 --- a/lib/models/Appointments/toDoCountProviderModel.dart +++ b/lib/models/Appointments/toDoCountProviderModel.dart @@ -2,11 +2,15 @@ import 'package:flutter/cupertino.dart'; class ToDoCountProviderModel with ChangeNotifier { int _count; + bool _isShowBadge = false; int get count => _count == null ? 0 : _count; - void setState(int count) { + bool get isShowBadge => _isShowBadge; + + void setState(int count, bool isShowBadge) { _count = count; + _isShowBadge = isShowBadge; notifyListeners(); } } diff --git a/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart b/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart index b21d940f..750cf0be 100644 --- a/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart +++ b/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart @@ -25,7 +25,7 @@ class GetAllSharedRecordsByStatusResponse { dynamic successMsgN; dynamic doctorInformationList; List getAllPendingRecordsList; - List getAllSharedRecordsByStatusList; + List getAllSharedRecordsByStatusList = List(); List getResponseFileList; bool isHMGPatient; bool isLoginSuccessfully; @@ -92,7 +92,7 @@ class GetAllSharedRecordsByStatusResponse { this.successMsgN, this.doctorInformationList, this.getAllPendingRecordsList, - this.getAllSharedRecordsByStatusList, + this.getAllSharedRecordsByStatusList , this.getResponseFileList, this.isHMGPatient, this.isLoginSuccessfully, diff --git a/lib/models/pharmacy/addToCartModel.dart b/lib/models/pharmacy/addToCartModel.dart new file mode 100644 index 00000000..3253e6f7 --- /dev/null +++ b/lib/models/pharmacy/addToCartModel.dart @@ -0,0 +1,924 @@ +// To parse this JSON data, do +// +// final shoppingCart = shoppingCartFromJson(jsonString); + +import 'dart:convert'; + +ShoppingCart shoppingCartFromJson(String str) => ShoppingCart.fromJson(json.decode(str)); + +String shoppingCartToJson(ShoppingCart data) => json.encode(data.toJson()); + +class ShoppingCart { + ShoppingCart({ + this.itemCount, + this.quantityCount, + this.subtotal, + this.subtotalWithVat, + this.subtotalVatAmount, + this.subtotalVatRate, + this.shoppingCarts, + }); + + int itemCount; + int quantityCount; + double subtotal; + double subtotalWithVat; + double subtotalVatAmount; + int subtotalVatRate; + List shoppingCarts; + + factory ShoppingCart.fromJson(Map json) => ShoppingCart( + itemCount: json["item_count"], + quantityCount: json["quantity_count"], + subtotal: json["subtotal"].toDouble(), + subtotalWithVat: json["subtotal_with_vat"].toDouble(), + subtotalVatAmount: json["subtotal_vat_amount"].toDouble(), + subtotalVatRate: json["subtotal_vat_rate"], + shoppingCarts: List.from(json["shopping_carts"].map((x) => ShoppingCartElement.fromJson(x))), + ); + + Map toJson() => { + "item_count": itemCount, + "quantity_count": quantityCount, + "subtotal": subtotal, + "subtotal_with_vat": subtotalWithVat, + "subtotal_vat_amount": subtotalVatAmount, + "subtotal_vat_rate": subtotalVatRate, + "shopping_carts": List.from(shoppingCarts.map((x) => x.toJson())), + }; +} + +class ShoppingCartElement { + ShoppingCartElement({ + this.languageId, + this.id, + this.productAttributes, + this.customerEnteredPrice, + this.quantity, + this.discountAmountInclTax, + this.subtotal, + this.subtotalWithVat, + this.subtotalVatAmount, + this.subtotalVatRate, + this.currency, + this.currencyn, + this.rentalStartDateUtc, + this.rentalEndDateUtc, + this.createdOnUtc, + this.updatedOnUtc, + this.shoppingCartType, + this.productId, + this.product, + this.customerId, + this.customer, + }); + + int languageId; + String id; + List productAttributes; + int customerEnteredPrice; + int quantity; + dynamic discountAmountInclTax; + String subtotal; + String subtotalWithVat; + String subtotalVatAmount; + String subtotalVatRate; + String currency; + String currencyn; + dynamic rentalStartDateUtc; + dynamic rentalEndDateUtc; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String shoppingCartType; + int productId; + Product product; + int customerId; + Customer customer; + + factory ShoppingCartElement.fromJson(Map json) => ShoppingCartElement( + languageId: json["language_id"], + id: json["id"], + productAttributes: List.from(json["product_attributes"].map((x) => x)), + customerEnteredPrice: json["customer_entered_price"], + quantity: json["quantity"], + discountAmountInclTax: json["discount_amount_incl_tax"], + subtotal: json["subtotal"], + subtotalWithVat: json["subtotal_with_vat"], + subtotalVatAmount: json["subtotal_vat_amount"], + subtotalVatRate: json["subtotal_vat_rate"], + currency: json["currency"], + currencyn: json["currencyn"], + rentalStartDateUtc: json["rental_start_date_utc"], + rentalEndDateUtc: json["rental_end_date_utc"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + shoppingCartType: json["shopping_cart_type"], + productId: json["product_id"], + product: Product.fromJson(json["product"]), + customerId: json["customer_id"], + customer: Customer.fromJson(json["customer"]), + ); + + Map toJson() => { + "language_id": languageId, + "id": id, + "product_attributes": List.from(productAttributes.map((x) => x)), + "customer_entered_price": customerEnteredPrice, + "quantity": quantity, + "discount_amount_incl_tax": discountAmountInclTax, + "subtotal": subtotal, + "subtotal_with_vat": subtotalWithVat, + "subtotal_vat_amount": subtotalVatAmount, + "subtotal_vat_rate": subtotalVatRate, + "currency": currency, + "currencyn": currencyn, + "rental_start_date_utc": rentalStartDateUtc, + "rental_end_date_utc": rentalEndDateUtc, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "shopping_cart_type": shoppingCartType, + "product_id": productId, + "product": product.toJson(), + "customer_id": customerId, + "customer": customer.toJson(), + }; +} + +class Customer { + Customer({ + this.billingAddress, + this.shippingAddress, + this.addresses, + this.id, + this.username, + this.email, + this.firstName, + this.lastName, + this.languageId, + this.adminComment, + this.isTaxExempt, + this.hasShoppingCartItems, + this.active, + this.deleted, + this.isSystemAccount, + this.systemName, + this.lastIpAddress, + this.createdOnUtc, + this.lastLoginDateUtc, + this.lastActivityDateUtc, + this.registeredInStoreId, + this.roleIds, + }); + + Address billingAddress; + Address shippingAddress; + List
addresses; + String id; + String username; + String email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + bool isTaxExempt; + bool hasShoppingCartItems; + bool active; + bool deleted; + bool isSystemAccount; + dynamic systemName; + String lastIpAddress; + DateTime createdOnUtc; + DateTime lastLoginDateUtc; + DateTime lastActivityDateUtc; + int registeredInStoreId; + List roleIds; + + factory Customer.fromJson(Map json) => Customer( + billingAddress: Address.fromJson(json["billing_address"]), + shippingAddress: Address.fromJson(json["shipping_address"]), + addresses: List
.from(json["addresses"].map((x) => Address.fromJson(x))), + id: json["id"], + username: json["username"], + email: json["email"], + firstName: json["first_name"], + lastName: json["last_name"], + languageId: json["language_id"], + adminComment: json["admin_comment"], + isTaxExempt: json["is_tax_exempt"], + hasShoppingCartItems: json["has_shopping_cart_items"], + active: json["active"], + deleted: json["deleted"], + isSystemAccount: json["is_system_account"], + systemName: json["system_name"], + lastIpAddress: 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"]), + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "billing_address": billingAddress.toJson(), + "shipping_address": shippingAddress.toJson(), + "addresses": List.from(addresses.map((x) => x.toJson())), + "id": id, + "username": username, + "email": email, + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc.toIso8601String(), + "last_login_date_utc": lastLoginDateUtc.toIso8601String(), + "last_activity_date_utc": lastActivityDateUtc.toIso8601String(), + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +class Address { + Address({ + this.id, + this.firstName, + this.lastName, + this.email, + this.company, + this.countryId, + this.country, + this.stateProvinceId, + this.city, + this.address1, + this.address2, + this.zipPostalCode, + this.phoneNumber, + this.faxNumber, + this.customerAttributes, + this.createdOnUtc, + this.province, + this.latLong, + }); + + String id; + FirstName firstName; + LastName lastName; + Email email; + dynamic company; + int countryId; + Country country; + dynamic stateProvinceId; + City city; + String address1; + String address2; + String zipPostalCode; + String phoneNumber; + dynamic faxNumber; + String customerAttributes; + DateTime createdOnUtc; + dynamic province; + String latLong; + + factory Address.fromJson(Map json) => Address( + id: json["id"], + firstName: firstNameValues.map[json["first_name"]], + lastName: lastNameValues.map[json["last_name"]], + email: emailValues.map[json["email"]], + company: json["company"], + countryId: json["country_id"], + country: countryValues.map[json["country"]], + stateProvinceId: json["state_province_id"], + city: cityValues.map[json["city"]], + address1: json["address1"], + address2: json["address2"], + zipPostalCode: json["zip_postal_code"], + phoneNumber: json["phone_number"], + faxNumber: json["fax_number"], + customerAttributes: json["customer_attributes"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + province: json["province"], + latLong: json["lat_long"], + ); + + Map toJson() => { + "id": id, + "first_name": firstNameValues.reverse[firstName], + "last_name": lastNameValues.reverse[lastName], + "email": emailValues.reverse[email], + "company": company, + "country_id": countryId, + "country": countryValues.reverse[country], + "state_province_id": stateProvinceId, + "city": cityValues.reverse[city], + "address1": address1, + "address2": address2, + "zip_postal_code": zipPostalCode, + "phone_number": phoneNumber, + "fax_number": faxNumber, + "customer_attributes": customerAttributes, + "created_on_utc": createdOnUtc.toIso8601String(), + "province": province, + "lat_long": latLong, + }; +} + +enum City { CALIFORNIA, RIYADH, AL_OYUN } + +final cityValues = EnumValues({ + "Al Oyun": City.AL_OYUN, + "California": City.CALIFORNIA, + "Riyadh": City.RIYADH +}); + +enum Country { UNITED_STATES, SAUDI_ARABIA } + +final countryValues = EnumValues({ + "Saudi Arabia": Country.SAUDI_ARABIA, + "United States": Country.UNITED_STATES +}); + +enum Email { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM, TAMER_F_CLOUDSOLUTION_SA_COM } + +final emailValues = EnumValues({ + "Tamer.dasdasdas@gmail.com": Email.TAMER_DASDASDAS_GMAIL_COM, + "Tamer.fanasheh@gmail.com": Email.TAMER_FANASHEH_GMAIL_COM, + "Tamer.F@cloudsolution-sa.com": Email.TAMER_F_CLOUDSOLUTION_SA_COM +}); + +enum FirstName { TAMER, TAMER_FANASHEH } + +final firstNameValues = EnumValues({ + "TAMER": FirstName.TAMER, + "TAMER FANASHEH": FirstName.TAMER_FANASHEH +}); + +enum LastName { FANASHEH, MUSA } + +final lastNameValues = EnumValues({ + "FANASHEH": LastName.FANASHEH, + "MUSA": LastName.MUSA +}); + +class Product { + Product({ + this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName, + }); + + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + String metaKeywords; + String metaDescription; + String metaTitle; + bool allowCustomerReviews; + int approvedRatingSum; + int notApprovedRatingSum; + int approvedTotalReviews; + int notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + int maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + int recurringCycleLength; + int recurringTotalCycles; + bool isRental; + int rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + int additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + int manageInventoryMethodId; + int stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + int minStockQuantity; + int notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + int orderMinimumQuantity; + int orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + double price; + int oldPrice; + double productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + int minimumCustomerEnteredPrice; + int maximumCustomerEnteredPrice; + bool basepriceEnabled; + int basepriceAmount; + int basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + int length; + int width; + int height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + int displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String productType; + int parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + int vendorId; + String seName; + + factory Product.fromJson(Map json) => Product( + id: json["id"], + visibleIndividually: json["visible_individually"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + shortDescription: json["short_description"], + shortDescriptionn: json["short_descriptionn"], + fullDescription: json["full_description"], + fullDescriptionn: json["full_descriptionn"], + markasNew: json["markas_new"], + showOnHomePage: json["show_on_home_page"], + metaKeywords: json["meta_keywords"] == null ? null : json["meta_keywords"], + metaDescription: json["meta_description"] == null ? null : json["meta_description"], + metaTitle: json["meta_title"] == null ? null : json["meta_title"], + allowCustomerReviews: json["allow_customer_reviews"], + approvedRatingSum: json["approved_rating_sum"], + notApprovedRatingSum: json["not_approved_rating_sum"], + approvedTotalReviews: json["approved_total_reviews"], + notApprovedTotalReviews: json["not_approved_total_reviews"], + sku: json["sku"], + isRx: json["is_rx"], + prescriptionRequired: json["prescription_required"], + rxMessage: json["rx_message"], + rxMessagen: json["rx_messagen"], + manufacturerPartNumber: json["manufacturer_part_number"], + gtin: json["gtin"], + isGiftCard: json["is_gift_card"], + requireOtherProducts: json["require_other_products"], + automaticallyAddRequiredProducts: json["automatically_add_required_products"], + isDownload: json["is_download"], + unlimitedDownloads: json["unlimited_downloads"], + maxNumberOfDownloads: json["max_number_of_downloads"], + downloadExpirationDays: json["download_expiration_days"], + hasSampleDownload: json["has_sample_download"], + hasUserAgreement: json["has_user_agreement"], + isRecurring: json["is_recurring"], + recurringCycleLength: json["recurring_cycle_length"], + recurringTotalCycles: json["recurring_total_cycles"], + isRental: json["is_rental"], + rentalPriceLength: json["rental_price_length"], + isShipEnabled: json["is_ship_enabled"], + isFreeShipping: json["is_free_shipping"], + shipSeparately: json["ship_separately"], + additionalShippingCharge: json["additional_shipping_charge"], + isTaxExempt: json["is_tax_exempt"], + isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"], + useMultipleWarehouses: json["use_multiple_warehouses"], + manageInventoryMethodId: json["manage_inventory_method_id"], + stockQuantity: json["stock_quantity"], + stockAvailability: json["stock_availability"], + stockAvailabilityn: json["stock_availabilityn"], + displayStockAvailability: json["display_stock_availability"], + displayStockQuantity: json["display_stock_quantity"], + minStockQuantity: json["min_stock_quantity"], + notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"], + allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], + orderMinimumQuantity: json["order_minimum_quantity"], + orderMaximumQuantity: json["order_maximum_quantity"], + allowedQuantities: json["allowed_quantities"], + allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"], + disableBuyButton: json["disable_buy_button"], + disableWishlistButton: json["disable_wishlist_button"], + availableForPreOrder: json["available_for_pre_order"], + preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"], + callForPrice: json["call_for_price"], + price: json["price"].toDouble(), + oldPrice: json["old_price"], + productCost: json["product_cost"].toDouble(), + specialPrice: json["special_price"], + specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], + specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], + customerEntersPrice: json["customer_enters_price"], + minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], + maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], + basepriceEnabled: json["baseprice_enabled"], + basepriceAmount: json["baseprice_amount"], + basepriceBaseAmount: json["baseprice_base_amount"], + hasTierPrices: json["has_tier_prices"], + hasDiscountsApplied: json["has_discounts_applied"], + discountName: json["discount_name"], + discountNamen: json["discount_namen"], + discountDescription: json["discount_description"], + discountDescriptionn: json["discount_Descriptionn"], + discountPercentage: json["discount_percentage"], + currency: json["currency"], + currencyn: json["currencyn"], + weight: json["weight"].toDouble(), + length: json["length"], + width: json["width"], + height: json["height"], + availableStartDateTimeUtc: json["available_start_date_time_utc"], + availableEndDateTimeUtc: json["available_end_date_time_utc"], + displayOrder: json["display_order"], + published: json["published"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + productType: json["product_type"], + parentGroupedProductId: json["parent_grouped_product_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + discountIds: List.from(json["discount_ids"].map((x) => x)), + storeIds: List.from(json["store_ids"].map((x) => x)), + manufacturerIds: List.from(json["manufacturer_ids"].map((x) => x)), + reviews: List.from(json["reviews"].map((x) => x)), + images: List.from(json["images"].map((x) => Image.fromJson(x))), + attributes: List.from(json["attributes"].map((x) => x)), + specifications: List.from(json["specifications"].map((x) => Specification.fromJson(x))), + associatedProductIds: List.from(json["associated_product_ids"].map((x) => x)), + tags: List.from(json["tags"].map((x) => x)), + vendorId: json["vendor_id"], + seName: json["se_name"], + ); + + Map toJson() => { + "id": id, + "visible_individually": visibleIndividually, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "short_description": shortDescription, + "short_descriptionn": shortDescriptionn, + "full_description": fullDescription, + "full_descriptionn": fullDescriptionn, + "markas_new": markasNew, + "show_on_home_page": showOnHomePage, + "meta_keywords": metaKeywords == null ? null : metaKeywords, + "meta_description": metaDescription == null ? null : metaDescription, + "meta_title": metaTitle == null ? null : metaTitle, + "allow_customer_reviews": allowCustomerReviews, + "approved_rating_sum": approvedRatingSum, + "not_approved_rating_sum": notApprovedRatingSum, + "approved_total_reviews": approvedTotalReviews, + "not_approved_total_reviews": notApprovedTotalReviews, + "sku": sku, + "is_rx": isRx, + "prescription_required": prescriptionRequired, + "rx_message": rxMessage, + "rx_messagen": rxMessagen, + "manufacturer_part_number": manufacturerPartNumber, + "gtin": gtin, + "is_gift_card": isGiftCard, + "require_other_products": requireOtherProducts, + "automatically_add_required_products": automaticallyAddRequiredProducts, + "is_download": isDownload, + "unlimited_downloads": unlimitedDownloads, + "max_number_of_downloads": maxNumberOfDownloads, + "download_expiration_days": downloadExpirationDays, + "has_sample_download": hasSampleDownload, + "has_user_agreement": hasUserAgreement, + "is_recurring": isRecurring, + "recurring_cycle_length": recurringCycleLength, + "recurring_total_cycles": recurringTotalCycles, + "is_rental": isRental, + "rental_price_length": rentalPriceLength, + "is_ship_enabled": isShipEnabled, + "is_free_shipping": isFreeShipping, + "ship_separately": shipSeparately, + "additional_shipping_charge": additionalShippingCharge, + "is_tax_exempt": isTaxExempt, + "is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices, + "use_multiple_warehouses": useMultipleWarehouses, + "manage_inventory_method_id": manageInventoryMethodId, + "stock_quantity": stockQuantity, + "stock_availability": stockAvailability, + "stock_availabilityn": stockAvailabilityn, + "display_stock_availability": displayStockAvailability, + "display_stock_quantity": displayStockQuantity, + "min_stock_quantity": minStockQuantity, + "notify_admin_for_quantity_below": notifyAdminForQuantityBelow, + "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, + "order_minimum_quantity": orderMinimumQuantity, + "order_maximum_quantity": orderMaximumQuantity, + "allowed_quantities": allowedQuantities, + "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, + "disable_buy_button": disableBuyButton, + "disable_wishlist_button": disableWishlistButton, + "available_for_pre_order": availableForPreOrder, + "pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc, + "call_for_price": callForPrice, + "price": price, + "old_price": oldPrice, + "product_cost": productCost, + "special_price": specialPrice, + "special_price_start_date_time_utc": specialPriceStartDateTimeUtc, + "special_price_end_date_time_utc": specialPriceEndDateTimeUtc, + "customer_enters_price": customerEntersPrice, + "minimum_customer_entered_price": minimumCustomerEnteredPrice, + "maximum_customer_entered_price": maximumCustomerEnteredPrice, + "baseprice_enabled": basepriceEnabled, + "baseprice_amount": basepriceAmount, + "baseprice_base_amount": basepriceBaseAmount, + "has_tier_prices": hasTierPrices, + "has_discounts_applied": hasDiscountsApplied, + "discount_name": discountName, + "discount_namen": discountNamen, + "discount_description": discountDescription, + "discount_Descriptionn": discountDescriptionn, + "discount_percentage": discountPercentage, + "currency": currency, + "currencyn": currencyn, + "weight": weight, + "length": length, + "width": width, + "height": height, + "available_start_date_time_utc": availableStartDateTimeUtc, + "available_end_date_time_utc": availableEndDateTimeUtc, + "display_order": displayOrder, + "published": published, + "deleted": deleted, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "product_type": productType, + "parent_grouped_product_id": parentGroupedProductId, + "role_ids": List.from(roleIds.map((x) => x)), + "discount_ids": List.from(discountIds.map((x) => x)), + "store_ids": List.from(storeIds.map((x) => x)), + "manufacturer_ids": List.from(manufacturerIds.map((x) => x)), + "reviews": List.from(reviews.map((x) => x)), + "images": List.from(images.map((x) => x.toJson())), + "attributes": List.from(attributes.map((x) => x)), + "specifications": List.from(specifications.map((x) => x.toJson())), + "associated_product_ids": List.from(associatedProductIds.map((x) => x)), + "tags": List.from(tags.map((x) => x)), + "vendor_id": vendorId, + "se_name": seName, + }; +} + +class Image { + Image({ + this.id, + this.position, + this.src, + this.thumb, + this.attachment, + }); + + int id; + int position; + String src; + String thumb; + String attachment; + + factory Image.fromJson(Map json) => Image( + id: json["id"], + position: json["position"], + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "id": id, + "position": position, + "src": src, + "thumb": thumb, + "attachment": attachment, + }; +} + +class LocalizedName { + LocalizedName({ + this.languageId, + this.localizedName, + }); + + int languageId; + String localizedName; + + factory LocalizedName.fromJson(Map json) => LocalizedName( + languageId: json["language_id"], + localizedName: json["localized_name"], + ); + + Map toJson() => { + "language_id": languageId, + "localized_name": localizedName, + }; +} + +class Specification { + Specification({ + this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN, + }); + + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + factory Specification.fromJson(Map json) => Specification( + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: json["name"], + nameN: json["nameN"], + ); + + Map toJson() => { + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": name, + "nameN": nameN, + }; +} + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} diff --git a/lib/models/pharmacy/brandModel.dart b/lib/models/pharmacy/brandModel.dart index b20afa33..2855d492 100644 --- a/lib/models/pharmacy/brandModel.dart +++ b/lib/models/pharmacy/brandModel.dart @@ -40,7 +40,7 @@ class Brand { dynamic metaDescription; dynamic metaTitle; int pageSize; - PageSizeOptions pageSizeOptions; + String pageSizeOptions; dynamic priceRanges; bool published; bool deleted; @@ -60,7 +60,7 @@ class Brand { metaDescription: json["meta_description"], metaTitle: json["meta_title"], pageSize: json["page_size"], - pageSizeOptions: pageSizeOptionsValues.map[json["page_size_options"]], + pageSizeOptions: json["page_size_options"], priceRanges: json["price_ranges"], published: json["published"], deleted: json["deleted"], @@ -81,7 +81,7 @@ class Brand { "meta_description": metaDescription, "meta_title": metaTitle, "page_size": pageSize, - "page_size_options": pageSizeOptionsValues.reverse[pageSizeOptions], + "page_size_options": pageSizeOptions, "price_ranges": priceRanges, "published": published, "deleted": deleted, @@ -135,23 +135,3 @@ class LocalizedName { "localized_name": localizedName, }; } - -enum PageSizeOptions { THE_2460100 } - -final pageSizeOptionsValues = EnumValues({ - "24, 60, 100": PageSizeOptions.THE_2460100 -}); - -class EnumValues { - Map map; - Map reverseMap; - - EnumValues(this.map); - - Map get reverse { - if (reverseMap == null) { - reverseMap = map.map((k, v) => new MapEntry(v, k)); - } - return reverseMap; - } -} diff --git a/lib/models/pharmacy/specification.dart b/lib/models/pharmacy/specification.dart new file mode 100644 index 00000000..6ef69191 --- /dev/null +++ b/lib/models/pharmacy/specification.dart @@ -0,0 +1,61 @@ +// To parse this JSON data, do +// +// final specificationModel = specificationModelFromJson(jsonString); + +import 'dart:convert'; + +SpecificationModel specificationModelFromJson(String str) => SpecificationModel.fromJson(json.decode(str)); + +String specificationModelToJson(SpecificationModel data) => json.encode(data.toJson()); + +class SpecificationModel { + SpecificationModel({ + this.specification, + }); + + List specification; + + factory SpecificationModel.fromJson(Map json) => SpecificationModel( + specification: List.from(json["specification"].map((x) => Specification.fromJson(x))), + ); + + Map toJson() => { + "specification": List.from(specification.map((x) => x.toJson())), + }; +} + +class Specification { + Specification({ + this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN, + }); + + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + factory Specification.fromJson(Map json) => Specification( + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: json["name"], + nameN: json["nameN"], + ); + + Map toJson() => { + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": name, + "nameN": nameN, + }; +} diff --git a/lib/models/pharmacy/topBrandsModel.dart b/lib/models/pharmacy/topBrandsModel.dart index e27ee270..0cd833b7 100644 --- a/lib/models/pharmacy/topBrandsModel.dart +++ b/lib/models/pharmacy/topBrandsModel.dart @@ -34,7 +34,7 @@ class TopBrand { String name; String namen; List localizedNames; - dynamic description; + String description; int manufacturerTemplateId; String metaKeywords; dynamic metaDescription; @@ -54,7 +54,7 @@ class TopBrand { name: json["name"], namen: json["namen"], localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), - description: json["description"], + description: json["description"] == null ? null : json["description"], manufacturerTemplateId: json["manufacturer_template_id"], metaKeywords: json["meta_keywords"], metaDescription: json["meta_description"], @@ -67,7 +67,7 @@ class TopBrand { displayOrder: json["display_order"], createdOnUtc: DateTime.parse(json["created_on_utc"]), updatedOnUtc: DateTime.parse(json["updated_on_utc"]), - image: Image.fromJson(json["image"]), + image: json["image"] == null ? null : Image.fromJson(json["image"]), ); Map toJson() => { @@ -75,7 +75,7 @@ class TopBrand { "name": name, "namen": namen, "localized_names": List.from(localizedNames.map((x) => x.toJson())), - "description": description, + "description": description == null ? null : description, "manufacturer_template_id": manufacturerTemplateId, "meta_keywords": metaKeywords, "meta_description": metaDescription, @@ -88,7 +88,7 @@ class TopBrand { "display_order": displayOrder, "created_on_utc": createdOnUtc.toIso8601String(), "updated_on_utc": updatedOnUtc.toIso8601String(), - "image": image.toJson(), + "image": image == null ? null : image.toJson(), }; } 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 549f90b8..45bf01b7 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( - TranslationBase.of(context).confirm, + "Confirm", color: Colors.black, ), ), @@ -40,7 +40,7 @@ class _ConfirmCancelOrderDialogState extends State { Divider(), Center( child: Texts( - TranslationBase.of(context).cancelOrderMsg , + "Are you sure!! want to cancel this order", 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 deleted file mode 100644 index c584a21e..00000000 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ /dev/null @@ -1,148 +0,0 @@ -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 ecfe31fb..532396cc 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -3,18 +3,15 @@ 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'; @@ -49,7 +46,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].descriptionN, + selectedServiceNameAR: widget.model.cmcAllServicesList[0].description, recordID: 1, totalPrice: widget.model.cmcAllServicesList[0].totalPrice, vAT: widget.model.cmcAllServicesList[0].vAT); @@ -88,8 +85,6 @@ class _NewCMCPageState extends State @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( CMCViewModel model, GetOrderDetailByOrderIDResponseModel order) { showDialog( @@ -106,7 +101,7 @@ class _NewCMCPageState extends State if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); + AppToast.showSuccessToast(message: "Done Successfully"); await model.getCmcAllPresOrders(); } }, @@ -139,192 +134,183 @@ class _NewCMCPageState extends State children: [ widget.model.cmcAllOrderDetail.length != 0 ? FractionallySizedBox( + heightFactor: 0.8, widthFactor: 0.9, - child: SingleChildScrollView( + 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: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 12, + ), Container( width: double.infinity, - margin: EdgeInsets.only(top: 15), + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // 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: 12, + height: 4, ), - 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, - ), - ], - ), + Texts( + widget.model.cmcAllOrderDetail[0].iD.toString(), + 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( + "Status", + 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( + "Pending", + 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: 12, + height: 4, + ), + Texts( + DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate( + widget.model.cmcAllOrderDetail[0] + .createdOn)), + fontSize: 22, ), - 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), + ], + ), + ), + 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( + "Service Name", + bold: false, + fontSize: 13, + ), SizedBox( - height: 22, + height: 4, + ), + Texts( + widget.model.cmcAllOrderDetail[0].description + .toString() ?? + widget.model.cmcAllOrderDetail[0] + .descriptionN + .toString(), + fontSize: 22, ), ], ), ), SizedBox( - height: 22, + 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, ), ], ), 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 b80d125a..02d099b4 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,16 +1,11 @@ -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; @@ -36,8 +31,6 @@ class _NewCMCStepOnePageState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( isShowAppBar: false, baseViewModel: widget.model, @@ -57,17 +50,17 @@ class _NewCMCStepOnePageState extends State { height: 20, ), Texts( - TranslationBase.of(context).selectService, + "Select Home Health Care Services", 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( @@ -79,53 +72,50 @@ 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.descriptionN, - recordID: 1, - totalPrice: - service.totalPrice, - vAT: service.vAT); + patientERCMCInsertServicesList = + new PatientERCMCInsertServicesList( + price: service.price, + serviceID: service.serviceID + .toString(), + selectedServiceName: + service.description, + selectedServiceNameAR: + service.description, + 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( - projectViewModel.isArabic ? service - .descriptionN : service - .description, + service.description, fontSize: 15, ), ), @@ -147,67 +137,52 @@ class _NewCMCStepOnePageState extends State { color: Colors.white, width: double.infinity, child: Column( - 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: 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: [ - Container(margin: EdgeInsets.only( - right: 10, left: 10), - child: Texts( - item.itemName, - fontSize: 15, fontWeight: FontWeight.bold - ), - ), - ], + children: [ + Texts( + item.itemName, + fontSize: 15, ), - ), - SizedBox( - height: 12, - ), - ], + ], + ), ), - ), + SizedBox( + height: 12, + ), + ], ), - ); - }).toList()), - ], - ), + ), + ), + ); + }).toList()), ) ], ), @@ -222,48 +197,28 @@ class _NewCMCStepOnePageState extends State { Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( - 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) { + label: "Next", + textColor: Theme.of(context).backgroundColor, + onTap: () { + if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length = 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].descriptionN, - 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].description, + recordID: 1, + totalPrice: widget.model.cmcAllServicesList[index-1].totalPrice, + vAT: widget.model.cmcAllServicesList[index-1].vAT); widget.cMCInsertPresOrderRequestModel .patientERCMCInsertServicesList = [ patientERCMCInsertServicesList ]; - await widget.model.getCustomerInfo(); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(); - } else { - widget.changePageViewIndex(1); - } + + 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 eea9853b..e48bb5d5 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,16 +2,15 @@ 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/project_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.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; @@ -64,23 +63,19 @@ 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: 500, + height: 400, width: double.maxFinite, margin: EdgeInsets.only(left: 12, right: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).orderDetails, - fontWeight: FontWeight.bold, - ), + Texts('Order Details'), SizedBox( height: 12, ), @@ -92,9 +87,7 @@ class _NewCMCStepThreePageState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase - .of(context) - .orderLocation + " : ", fontWeight: FontWeight.bold,), + Texts('Location :'), SizedBox( height: 12, ), @@ -115,40 +108,30 @@ class _NewCMCStepThreePageState SizedBox( height: 12, ), - Texts(TranslationBase - .of(context) - .selectedService), + Texts('Selected Service :'), ...List.generate( - 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, - ), - ], + 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, ), - ), + ], + ), + ), ) ], ), @@ -165,20 +148,14 @@ class _NewCMCStepThreePageState Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( - label: TranslationBase - .of(context) - .confirm, - color: Colors.grey[800], + label: "Confirm", 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 cc8ea8dd..27cddfe3 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,22 +1,19 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; -import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.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/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_flutter/google_maps_flutter.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:provider/provider.dart'; -import 'cmc_location_page.dart'; - class NewCMCStepTowPage extends StatefulWidget { final Function(PickResult) onPick; final double latitude; @@ -44,13 +41,12 @@ class _NewCMCStepTowPageState extends State { double latitude = 0; double longitude = 0; - AddressInfo _selectedAddress; - @override void initState() { if (widget.cmcInsertPresOrderRequestModel.latitude == null) { - setLatitudeAndLongitude(); + latitude = widget.latitude; + longitude = widget.longitude; } else { latitude = widget.cmcInsertPresOrderRequestModel.latitude; longitude = widget.cmcInsertPresOrderRequestModel.longitude; @@ -58,152 +54,60 @@ 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: 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, + 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, + ), ), - ], - ) - ), - ); - }, - 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 new file mode 100644 index 00000000..e8e9eccc --- /dev/null +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart @@ -0,0 +1,68 @@ +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 06a83cc1..385d0da3 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -40,8 +40,7 @@ class _CMCPageState extends State }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - description: TranslationBase.of(context).HHCNotAuthMsg, - appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, + appBarTitle: TranslationBase.of(context).homeHealthCare, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -89,8 +88,7 @@ class _CMCPageState extends State Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts(TranslationBase.of(context) - .comprehensiveMedicalCheckup), + child: Texts("CMC Service"), ), ), Container( diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index ec686e70..6c915a4c 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -2,16 +2,13 @@ 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'; @@ -22,9 +19,6 @@ class OrdersLogDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { - - ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( CMCViewModel model, GetHHCAllPresOrdersResponseModel order) { showDialog( @@ -41,7 +35,7 @@ class OrdersLogDetailsPage extends StatelessWidget { if(model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); + AppToast.showSuccessToast(message: "Done Successfully"); await model.getCmcAllPresOrders(); } }, @@ -84,7 +78,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -95,12 +89,11 @@ class OrdersLogDetailsPage extends StatelessWidget { // borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Texts( - TranslationBase - .of(context) - .requestID, + "Request ID", bold: false, fontSize: 13, ), @@ -117,7 +110,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -128,12 +121,11 @@ class OrdersLogDetailsPage extends StatelessWidget { // borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Texts( - TranslationBase - .of(context) - .OrderStatus, + "Status", bold: false, fontSize: 13, ), @@ -141,9 +133,7 @@ class OrdersLogDetailsPage extends StatelessWidget { height: 4, ), Texts( - - projectViewModel.isArabic ? order - .descriptionN : order.description, + order.description, fontSize: 22, ), ], @@ -152,7 +142,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -163,10 +153,11 @@ class OrdersLogDetailsPage extends StatelessWidget { // borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).pickupDate, + "Pickup Date", bold: false, fontSize: 13, ), @@ -175,7 +166,8 @@ class OrdersLogDetailsPage extends StatelessWidget { ), Texts( DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(order.createdOn)), + DateUtil.convertStringToDate( + order.createdOn)), fontSize: 22, ), ], @@ -184,7 +176,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -199,7 +191,7 @@ class OrdersLogDetailsPage extends StatelessWidget { CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).orderLocation, + "Location", bold: false, fontSize: 13, ), @@ -207,11 +199,10 @@ class OrdersLogDetailsPage extends StatelessWidget { height: 4, ), Texts( - !projectViewModel.isArabic?order. - projectDescription.toString() : - order - .projectDescriptionN - .toString(), + order.nearestProjectDescription + .toString() ?? + order.nearestProjectDescriptionN + .toString(), fontSize: 22, ), ], @@ -221,33 +212,32 @@ 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: TranslationBase.of(context).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: "Cancel".toUpperCase(), + onTap: () { + showConfirmMessage(model, order); + } + , + color: Colors.red[800], + disabled: false, + textColor: Theme + .of(context) + .backgroundColor), + ), ), - ), SizedBox( - height: 22, - ), - ], - ), - ); + height: 12, + ), + ], + ), + ); }).toList()) ], ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart index 2cb179b8..fb2b94c6 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart @@ -40,32 +40,34 @@ class _StartIndexForNewEReferralState extends State @override Widget build(BuildContext context) { return Scaffold( - body: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.9, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - NewEReferralStepOnePage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - NewEReferralStepTowPage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - NewEReferralStepThreePage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - ], + body: SafeArea( + child: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 0.9, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + NewEReferralStepOnePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepTowPage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepThreePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + ], + ), ), ), ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index e486d9aa..62799c6d 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -6,9 +6,9 @@ import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -19,17 +19,15 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; + class NewEReferralStepOnePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; - const NewEReferralStepOnePage( - {Key key, this.createEReferralRequestModel, this.changePageViewIndex}) - : super(key: key); + const NewEReferralStepOnePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); @override - _NewEReferralStepOnePageState createState() => - _NewEReferralStepOnePageState(); + _NewEReferralStepOnePageState createState() => _NewEReferralStepOnePageState(); } class _NewEReferralStepOnePageState extends State { @@ -66,25 +64,27 @@ class _NewEReferralStepOnePageState extends State { context: context, barrierDismissible: false, child: EReferralConfirmSMSDialog( - phoneNumber: _selectedCountry['code'] + _mobileTextController.text, - onSucces: () { - Navigator.of(context).pop(); - widget.changePageViewIndex(1); - widget.createEReferralRequestModel.requesterName = - _nameTextController.text; - widget.createEReferralRequestModel.requesterContactNo = - _selectedCountry['code'].toString().substring(1) + - _mobileTextController.text; - widget.createEReferralRequestModel.requesterRelationship = - _selectedRelation.iD; - }), + phoneNumber: _selectedCountry['code']+_mobileTextController.text, + onSucces: (){ + Navigator.of(context).pop(); + widget.changePageViewIndex(1); + widget.createEReferralRequestModel.requesterName=_nameTextController.text; + widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text; + widget.createEReferralRequestModel.requesterRelationship=_selectedRelation.iD; + + + } + + + ), ).then((value) { print("dialog dismissed"); print(value); - if (value != null && value) {} + if (value != null && value) { + + } }); } - return BaseView( onModelReady: (model) => model.getRelationTypes(), builder: (_, model, widget) => AppScaffold( @@ -92,7 +92,7 @@ class _NewEReferralStepOnePageState extends State { body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - margin: EdgeInsets.all(10), + margin: EdgeInsets.all(12), child: Center( child: FractionallySizedBox( widthFactor: 0.9, @@ -100,10 +100,11 @@ class _NewEReferralStepOnePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 80, + height: 20, ), Center( child: Texts( +// TranslationBase.of(context).advancePaymentLabel, "Referral requester information", textAlign: TextAlign.center, ), @@ -184,30 +185,34 @@ class _NewEReferralStepOnePageState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery + .of(context) + .size + .height * 0.1, width: double.infinity, padding: EdgeInsets.all(9), child: SecondaryButton( textColor: Colors.white, - label: TranslationBase.of(context).next, - onTap: () async { - SendActivationCodeForEReferralRequestModel - sendActivationCodeForEReferralRequestModel = - SendActivationCodeForEReferralRequestModel( + label: "Next", + onTap: () async { + SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel = + SendActivationCodeForEReferralRequestModel( zipCode: _selectedCountry['code'], - patientMobileNumber: int.parse(_mobileTextController.text), - ); - await model.sendActivationCodeForEReferral( - sendActivationCodeForEReferralRequestModel); + patientMobileNumber: int.parse( + _mobileTextController.text),); + await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); showSMSDialog(); }, loading: model.state == ViewState.BusyLocal, - disabled: _nameTextController.text.isEmpty || + disabled: + _nameTextController.text.isEmpty || _selectedRelation == null || _mobileTextController.text.isEmpty, ), ))); + + } void confirmSelectRelationTypeDialog( @@ -256,8 +261,12 @@ class _NewEReferralStepOnePageState extends State { } class MobileNumberTextFiled extends StatelessWidget { - const MobileNumberTextFiled({Key key, this.controller, this.code}) - : super(key: key); + const MobileNumberTextFiled({ + Key key, + this.controller, + this.code + }) : super(key: key); + final TextEditingController controller; final String code; diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart index cb9f03df..a823c154 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart @@ -1,23 +1,21 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import '../dialogs/select_city_dialog.dart'; +import 'dart:io'; class NewEReferralStepThreePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; @@ -34,8 +32,7 @@ class NewEReferralStepThreePage extends StatefulWidget { class _NewEReferralStepThreePageState extends State { TextEditingController _nameTextController = TextEditingController(); TextEditingController _mobileTextController = TextEditingController(); - - GetAllProjectsResponseModel _selectedHospital; + GetAllCitiesResponseModel _selectedCity; GetAllSharedRecordsByStatusList selectedPatientFamily; List medicalReportImages = []; @@ -53,7 +50,6 @@ class _NewEReferralStepThreePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getAllProjects(), builder: (_, model, widget) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( @@ -68,7 +64,7 @@ class _NewEReferralStepThreePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 80, + height: 20, ), Center( child: Texts( @@ -105,7 +101,7 @@ class _NewEReferralStepThreePageState extends State { InkWell( onTap: () { ImageOptions.showImageOptions(context, - (String image) { + (String image,File file) { setState(() { EReferralAttachment eReferralAttachment = new EReferralAttachment( @@ -115,7 +111,7 @@ class _NewEReferralStepThreePageState extends State { medicalReportImages .add(eReferralAttachment); }); - }); + }, ); }, child: Container( margin: EdgeInsets.only( @@ -216,7 +212,7 @@ class _NewEReferralStepThreePageState extends State { ), InkWell( onTap: () => - confirmSelectHospital(model.allHospitals), + confirmSelectCityDialog(model.allCities), child: Container( padding: EdgeInsets.all(12), width: double.infinity, @@ -290,7 +286,7 @@ class _NewEReferralStepThreePageState extends State { InkWell( onTap: () { ImageOptions.showImageOptions(context, - (String image) { + (String image,File file) { setState(() { EReferralAttachment eReferralAttachment = @@ -410,27 +406,19 @@ class _NewEReferralStepThreePageState extends State { isPatientInsured; // ToDo make the preferred Branch info dynamic this.widget.createEReferralRequestModel.preferredBranchCode = - _selectedHospital.iD; + 15; this.widget.createEReferralRequestModel.preferredBranchName = - _selectedHospital.desciption; + "Arryan Hospital"; + // this.widget.createEReferralRequestModel.fullName= ""; this.widget.createEReferralRequestModel.otherRelationship = ""; + // this.widget.createEReferralRequestModel.; + // this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; + // this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; await model - .createEReferral(this.widget.createEReferralRequestModel) - .then((value) { - AlertDialogBox( - context: context, - confirmMessage: - TranslationBase.of(context).ereferralSaveSuccess + - value['ReferralNumber'].toString(), - okText: TranslationBase.of(context).ok, - okFunction: () { - AlertDialogBox.closeAlertDialog(context); - navigateToHome(context); - }).showAlertDialog(context); - }); + .createEReferral(this.widget.createEReferralRequestModel); }, loading: model.state == ViewState.BusyLocal, disabled: medicalReportImages.length == 0, @@ -438,19 +426,15 @@ class _NewEReferralStepThreePageState extends State { ))); } - Future navigateToHome(context) async { - Navigator.of(context).popAndPushNamed(HOME); - } - - void confirmSelectHospital(List projects) { + void confirmSelectCityDialog(List cities) { showDialog( context: context, - child: SelectHospitalDialog( - hospitals: projects, - selectedHospital: _selectedHospital, + child: SelectCityDialog( + cities: cities, + selectedCity: _selectedCity, onValueSelected: (value) { setState(() { - _selectedHospital = value; + _selectedCity = value; }); }, ), @@ -458,9 +442,9 @@ class _NewEReferralStepThreePageState extends State { } String getRelationName() { - if (_selectedHospital != null) - return _selectedHospital.desciption; + if (_selectedCity != null) + return _selectedCity.description; else - return "Select Hospital*" /*TranslationBase.of(context).selectHospital*/; + return "Select Relationship" /*TranslationBase.of(context).selectHospital*/; } } diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart index 1ecd2e07..5f85fe12 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -8,7 +8,6 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dial import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -72,7 +71,7 @@ class _NewEReferralStepTowPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 80, + height: 30, ), Center( child: Texts( @@ -180,7 +179,7 @@ class _NewEReferralStepTowPageState extends State { padding: EdgeInsets.all(9), child: SecondaryButton( textColor: Colors.white, - label: TranslationBase.of(context).next, + label: "Next", onTap: () async { this.widget.changePageViewIndex(2); this.widget.createEReferralRequestModel.identificationNo = int.parse( _patientIdentificationTextController.text); diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart deleted file mode 100644 index 3a3cc083..00000000 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart +++ /dev/null @@ -1,129 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/material.dart'; - -class SelectHospitalDialog extends StatefulWidget { - - final List hospitals; - final Function(GetAllProjectsResponseModel) onValueSelected; - GetAllProjectsResponseModel selectedHospital; - - SelectHospitalDialog( - {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); - - @override - _SelectHospitalDialogState createState() => _SelectHospitalDialogState(); -} - -class _SelectHospitalDialogState extends State { - - @override - void initState() { - super.initState(); - widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Divider(), - ...List.generate( - widget.hospitals.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedHospital = widget.hospitals[index]; - }); - }, - child: ListTile( - title: Text(widget.hospitals[index].desciption), - leading: Radio( - value: widget.hospitals[index], - groupValue: widget.selectedHospital, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - widget.selectedHospital = 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.selectedHospital); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart index f50e67fa..9f836860 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart @@ -88,13 +88,13 @@ class _EReferralPageState extends State Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts("New Referral", fontSize: 14.0), + child: Texts("New Referral"), ), ), Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts("Search for Referrals", fontSize: 14.0), + child: Texts("Search for Referrals"), ), ), ], diff --git a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart deleted file mode 100644 index 925d20cd..00000000 --- a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart +++ /dev/null @@ -1,100 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_ereferral_response_model.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - -class ReferralDetails extends StatefulWidget { - GetEReferralResponseModel getEReferralResponseModel; - - ReferralDetails({@required this.getEReferralResponseModel}); - - @override - _ReferralDetailsState createState() => _ReferralDetailsState(); -} - -class _ReferralDetailsState extends State { - @override - Widget build(BuildContext context) { - return AppScaffold( - isShowDecPage: false, - isShowAppBar: true, - appBarTitle: "Referral Details", - body: Container( - margin: EdgeInsets.only(top: 20.0, left: 20.0, right: 20.0), - child: Table( - border: TableBorder.all(color: Colors.grey[600]), - children: [ - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).referralStatus)), - TableCell( - child: - _getNormalText(widget.getEReferralResponseModel.status)), - ]), - TableRow(children: [ - TableCell( - child: - _getNormalText(TranslationBase.of(context).patientName)), - TableCell( - child: _getNormalText( - widget.getEReferralResponseModel.patientName)), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).referralNumber)), - TableCell( - child: _getNormalText(widget - .getEReferralResponseModel.referralNumber - .toString())), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).referralDate)), - TableCell( - child: _getNormalText(DateUtil.getMonthDayYearDateFormatted( - DateUtil.convertStringToDateNoTimeZone( - widget.getEReferralResponseModel.referralDate)))), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText(TranslationBase.of(context).hospital)), - TableCell( - child: _getNormalText( - widget.getEReferralResponseModel.preferredBranchName)), - ]), - ], - ), - ), - ); - } - - _getNormalText(text) { - return Container( - color: Colors.white, - padding: EdgeInsets.only(top: 12.0, bottom: 12.0), - child: Text(text, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.grey[800])), - ); - } - - _getHeadingText(text) { - return Container( - padding: EdgeInsets.only(bottom: 10.0), - child: Text(text, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 26.0, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.white))); - } -} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart index 49c5dd60..0b75705d 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -1,25 +1,17 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_ereferral_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; -import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/e_referral_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/referral_details.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../locator.dart'; import 'New_E_Referral/new_e_referral_step_one_page.dart'; import 'dialogs/select_country_ingo_Dialog.dart'; import 'dialogs/select_search_criteria_dialog.dart'; @@ -36,9 +28,6 @@ class _SearchForReferralsPageState extends State { TextEditingController _mobileTextController = TextEditingController(); bool _isSubmitted = false; - AuthenticatedUser authUser; - - List allReferrals = List(); dynamic _selectedCountry = { "name": "Saudi Arabia", @@ -52,13 +41,6 @@ class _SearchForReferralsPageState extends State { SearchCriteriaModel selectedCriteria = SearchCriteriaModel( name: "Identification Number", nameAr: "رقم المحول", value: 1); - @override - void initState() { - authUser = new AuthenticatedUser(); - WidgetsBinding.instance.addPostFrameCallback((_) => getPatientData()); - super.initState(); - } - @override Widget build(BuildContext context) { return BaseView( @@ -135,102 +117,35 @@ class _SearchForReferralsPageState extends State { ? "11" : _selectedCountry["code"], ), - allReferrals.length != 0 - ? Container( - transform: - Matrix4.translationValues(0.0, -40.0, 0.0), - child: ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.vertical, - physics: ScrollPhysics(), - itemCount: allReferrals.length, - itemBuilder: - (BuildContext context, int index) { - return Container( - child: InkWell( - onTap: () { - navigateToReferralDetails( - allReferrals[index]); - }, - child: Card( - margin: EdgeInsets.only(bottom: 10.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10), - ), - child: Container( - margin: EdgeInsets.only( - left: 10.0, right: 10.0), - padding: EdgeInsets.all(5.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: - EdgeInsets.all(5.0), - child: Text( - allReferrals[index] - .status, - style: TextStyle( - fontSize: 16.0))), - Container( - margin: - EdgeInsets.all(5.0), - child: Text( - allReferrals[index] - .patientName, - style: TextStyle( - fontSize: 16.0, - color: Colors - .grey[600]))), - Container( - margin: - EdgeInsets.all(5.0), - child: Text( - allReferrals[index] - .preferredBranchName, - style: TextStyle( - fontSize: 16.0, - color: Colors - .grey[600]))), - Container( - margin: - EdgeInsets.all(5.0), - child: Text( - DateUtil.getMonthDayYearDateFormatted( - DateUtil.convertStringToDateNoTimeZone( - allReferrals[ - index] - .referralDate)), - style: TextStyle( - fontSize: 16.0, - color: Colors - .grey[600]))), - ], - ), - Container( - child: Icon(Icons.arrow_forward, - size: 20.0, - color: Colors.grey[700]), - ), - ], - ), - ), - ), - )); - }, - ), - ) - : Container(), SizedBox( - height: 70.0, - ) + height: 12, + ), + if ((model.state == ViewState.Idle && + model.allReferral.length == 0)) + Text("There's No Referral To deliver"), + if (( + model.state == ViewState.ErrorLocal)) + AppEmbeddedError( error:model.error), + NetworkBaseView( + baseViewModel: model, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: model.allReferral == null + ? 0 + : model.allReferral.length < 3 + ? model.allReferral.length + : 3, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 0.2), + child: Container( + child: Texts("TODO add referral info"), + ), + ); + }, + ), + ), ], ), ), @@ -245,13 +160,10 @@ class _SearchForReferralsPageState extends State { textColor: Colors.white, label: "Search", onTap: () async { - GifLoaderDialogUtils.showMyDialog(context); SearchEReferralRequestModel searchEReferralRequestModel = new SearchEReferralRequestModel( - patientMobileNumber: _selectedCountry['code'] - .toString() - .replaceFirst("+", "") + - _mobileTextController.text, + patientMobileNumber: + _selectedCountry['code'] + _mobileTextController.text, ); if (selectedCriteria.value == 1) { searchEReferralRequestModel.identificationNo = @@ -262,19 +174,9 @@ class _SearchForReferralsPageState extends State { int.parse(_searchTextController.text); searchEReferralRequestModel.identificationNo = ''; } - await model - .getEReferrals(searchEReferralRequestModel) - .then((response) { - GifLoaderDialogUtils.hideDialog(context); - print(response['List_EReferrals']); - allReferrals.clear(); - setState(() { - response['List_EReferrals'].forEach((data) { - allReferrals - .add(GetEReferralResponseModel.fromJson(data)); - _isSubmitted = true; - }); - }); + await model.getEReferrals(searchEReferralRequestModel); + setState(() { + _isSubmitted = true; }); }, loading: model.state == ViewState.BusyLocal, @@ -284,49 +186,6 @@ class _SearchForReferralsPageState extends State { ))); } - void getEreferralsIsLogin() { - EReferralService _eReferralService = locator(); - - String mobileNumber; - String zipCode; - - if (authUser.mobileNumber.length > 9) { - mobileNumber = - authUser.mobileNumber.substring(1, authUser.mobileNumber.length); - } else { - mobileNumber = authUser.mobileNumber; - } - - if (authUser.outSA == 0) { - zipCode = "966"; - } else { - zipCode = "971"; - } - - _eReferralService - .getEReferralsIfLogin(zipCode + mobileNumber) - .then((response) { - allReferrals.clear(); - setState(() { - response['List_EReferrals'].forEach((data) { - allReferrals.add(GetEReferralResponseModel.fromJson(data)); - }); - }); - }).catchError(() {}); - } - - getPatientData() async { - AppSharedPreferences sharedPref = AppSharedPreferences(); - if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - getEreferralsIsLogin(); - }); - } - } - void confirmSelectCountryTypeDialog() { showDialog( context: context, @@ -341,15 +200,6 @@ class _SearchForReferralsPageState extends State { ); } - navigateToReferralDetails( - GetEReferralResponseModel getEReferralResponseModel) { - Navigator.push( - context, - FadePage( - page: ReferralDetails( - getEReferralResponseModel: getEReferralResponseModel))); - } - String getCountryName() { if (_selectedCountry != null) return _selectedCountry["name"]; 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 bfab0324..17be8edd 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( - TranslationBase.of(context).confirm, + "Confirm", color: Colors.black, ), ), @@ -39,7 +39,7 @@ class _ConfirmCancelOrderDialogState extends State { Divider(), Center( child: Texts( - TranslationBase.of(context).cancelOrderMsg , + "Are you sure!! want to cancel this order", color: Colors.grey, ), ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart deleted file mode 100644 index d7434b97..00000000 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ /dev/null @@ -1,146 +0,0 @@ -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 447ba177..1dbee1b5 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,16 +2,15 @@ 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/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.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 @@ -46,8 +45,6 @@ class _NewHomeHealthCareStepOnePageState extends State { double latitude = 0; double longitude = 0; - AddressInfo _selectedAddress; @override void initState() { if (widget.patientERInsertPresOrderRequestModel.latitude == null) { - setLatitudeAndLongitude(); + latitude = widget.latitude; + longitude = widget.longitude; } 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: 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; - }); + 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, + ), + ), + ); }, + 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 d9bf67d8..87a33c6d 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,19 +3,16 @@ 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'; @@ -87,7 +84,7 @@ class _NewHomeHealthCarePageState extends State if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); + AppToast.showSuccessToast(message: "Done Successfully"); await model.getHHCAllPresOrders(); // await model.getHHCAllServices(); } @@ -95,8 +92,6 @@ class _NewHomeHealthCarePageState extends State )); } - ProjectViewModel projectViewModel = Provider.of(context); - return Scaffold( body: SafeArea( child: SingleChildScrollView( @@ -104,6 +99,7 @@ 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( @@ -142,7 +138,7 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -156,9 +152,7 @@ class _NewHomeHealthCarePageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase - .of(context) - .requestID, + "Request ID", bold: false, fontSize: 13, ), @@ -175,7 +169,7 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -189,9 +183,7 @@ class _NewHomeHealthCarePageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase - .of(context) - .OrderStatus, + "Status", bold: false, fontSize: 13, ), @@ -199,11 +191,7 @@ class _NewHomeHealthCarePageState extends State height: 4, ), Texts( - - projectViewModel.isArabic ? widget - .model.pendingOrder - .descriptionN : widget.model - .pendingOrder.description, + widget.model.pendingOrder.description, fontSize: 22, ), ], @@ -212,7 +200,7 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -226,7 +214,7 @@ class _NewHomeHealthCarePageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).pickupDate, + "Pickup Date", bold: false, fontSize: 13, ), @@ -247,7 +235,7 @@ class _NewHomeHealthCarePageState extends State (index) => Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, bottom: 15, top: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -262,9 +250,7 @@ class _NewHomeHealthCarePageState extends State CrossAxisAlignment.start, children: [ Texts( - TranslationBase - .of(context) - .serviceName, + "Service Name", bold: false, fontSize: 13, ), @@ -272,12 +258,7 @@ class _NewHomeHealthCarePageState extends State height: 4, ), Texts( - projectViewModel.isArabic - ? widget.model - .hhcAllOrderDetail[index] - .descriptionN - : widget.model - .hhcAllOrderDetail[index] + widget.model.hhcAllOrderDetail[index] .description, fontSize: 22, bold: true, @@ -294,7 +275,7 @@ class _NewHomeHealthCarePageState extends State width: MediaQuery.of(context).size.width * 0.85, child: SecondaryButton( - label: TranslationBase.of(context).cancel.toUpperCase(), + label: "Cancel".toUpperCase(), onTap: () { showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart new file mode 100644 index 00000000..fa0799f9 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart @@ -0,0 +1,69 @@ +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 'home_health_care_page.dart'; + +class HomeHealthCareIndexPage 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( + TranslationBase.of(context).homeHealthCare, + fontWeight: FontWeight.normal, + fontSize: 25, + color: Color(0xff60686b), + ), + SizedBox( + height: 12, + ), + Texts( + TranslationBase.of(context).homeHealthCareText, + 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: HomeHealthCarePage(), + ), + ), + label: TranslationBase.of(context).loginRegister, + textColor: Theme.of(context).backgroundColor), + ), + ], + ), + )); + } +} diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart index fcdc144a..8f4821f6 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart @@ -42,7 +42,6 @@ class _HomeHealthCarePageState extends State }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - description: TranslationBase.of(context).HHCNotAuthMsg, appBarTitle: TranslationBase.of(context).homeHealthCare, body: Scaffold( extendBodyBehindAppBar: true, diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index f0ca5fe4..0cfedb41 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -2,16 +2,13 @@ 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'; @@ -22,8 +19,6 @@ class OrdersLogDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( HomeHealthCareViewModel model, GetHHCAllPresOrdersResponseModel order) { showDialog( @@ -34,219 +29,212 @@ 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:TranslationBase.of(context).processDoneSuccessfully ); + AppToast.showSuccessToast(message: "Done Successfully"); 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, 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, - ), - ], + 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, + 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) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - - projectViewModel.isArabic ? order.descriptionN : order.description, - fontSize: 22, - ), - ], + // 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, + ), + ], + ), ), - ), - 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, + 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) - .pickupDate, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(order.createdOn)), - 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( + order.description, + 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, + 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).orderLocation, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - !projectViewModel.isArabic ?order.nearestProjectDescription - .toString() : - order.nearestProjectDescriptionN - .toString(), - fontSize: 22, - ), - ], + // 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, + ), + ], + ), ), - ), - 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), + 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, + 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, ), ], ), diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index ea699381..1359ab8d 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -1,9 +1,12 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/weather_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_converter.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/my_web_view.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; @@ -21,13 +24,17 @@ import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/services)contaniner.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class AllHabibMedicalService extends StatefulWidget { @@ -43,17 +50,25 @@ class AllHabibMedicalService extends StatefulWidget { class _AllHabibMedicalServiceState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser = new AuthenticatedUser(); - + LocationUtils locationUtils; + var weather = '--'; + WeatherService _weatherService = WeatherService(); @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - getAuthUser(); + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => { + Geolocator.getLastKnownPosition() + .then((value) => setLocation(value)) + }); }); super.initState(); } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).alhabiServices, @@ -98,17 +113,41 @@ class _AllHabibMedicalServiceState extends State { ], ), Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Image.asset('assets/images/Weather_ico.png',width: 80,height: 80,), - Texts( - TranslationBase.of(context).moreDetails, - color: Colors.white, - decoration: TextDecoration.underline, - ), - ], - ), + flex: 2, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HealthWeatherIndicator(), + ), + ); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/Weather_ico.png', + width: 60, + height: 60, + ), + Directionality( + textDirection: TextDirection.ltr, + child: AppText(weather, + fontSize: 22, + color: Colors.white)) + ], + ), + Texts( + TranslationBase.of(context).moreDetails, + color: Colors.white, + decoration: TextDecoration.underline, + ), + ], + )), ) ], ), @@ -222,6 +261,7 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/family_menu_icon_red.png', title: 'My Family', ), + if(projectViewModel.havePrivilege(35)) ServicesContainer( onTap: () => Navigator.push( context, @@ -235,13 +275,14 @@ class _AllHabibMedicalServiceState extends State { onTap: () => Navigator.push( context, FadePage( - page: ToDo(), + page: ToDo(isShowAppBar: true), ), ), imageLocation: 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), + if(projectViewModel.havePrivilege(42)) ServicesContainer( onTap: () => Navigator.push( context, @@ -249,7 +290,8 @@ class _AllHabibMedicalServiceState extends State { ), imageLocation: 'assets/images/new-design/body_icon.png', title: 'Symptom Checker'), - ServicesContainer( + if(projectViewModel.havePrivilege(36)) + ServicesContainer( onTap: () => Navigator.push( context, FadePage(page: BloodDonationPage()), @@ -279,6 +321,7 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/health_convertor_icon.png', title: 'Health Converter', ), + if(projectViewModel.havePrivilege(38)) ServicesContainer( onTap: () => Navigator.push( context, @@ -289,6 +332,7 @@ class _AllHabibMedicalServiceState extends State { imageLocation: 'assets/images/new-design/water_icon.png', title: 'H2O', ), + if(projectViewModel.havePrivilege(41)) ServicesContainer( onTap: () => Navigator.push( context, @@ -313,7 +357,7 @@ class _AllHabibMedicalServiceState extends State { "https://hmgwebservices.com/vt_mobile/html/index.html"), imageLocation: 'assets/images/new-design/virtual_tour_icon.png', - title: 'Virtual Tour', + title: TranslationBase.of(context).vTour, ), ServicesContainer( onTap: () { @@ -336,7 +380,7 @@ class _AllHabibMedicalServiceState extends State { ), ), imageLocation: 'assets/images/new-design/find_us_icon.png', - title: 'Find Us', + title: TranslationBase.of(context).findUs, ), ], ), @@ -353,7 +397,25 @@ class _AllHabibMedicalServiceState extends State { setState(() { authUser = data; }); - print(authUser.patientID); } + var data = await this.sharedPref.getObject(WEATHER); + if (data == null) { + var d = await _weatherService.getWeatherData(); + print(d); + setState(() { + weather = d != null ? d.temperature.toString() + '\u2103' : '--'; + }); + } else { + setState(() { + weather = + data != null ? data['Temperature'].toString() + '\u2103' : '--'; + }); + } + } + + void setLocation(Position position) { + this.sharedPref.setDouble(USER_LAT, position.latitude ?? 0.0); + this.sharedPref.setDouble(USER_LONG, position.longitude ?? 0.0); + getAuthUser(); } } diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart new file mode 100644 index 00000000..dbb46eee --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -0,0 +1,140 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:diplomaticquarterapp/widgets/weather_slider/weather_slider.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; + +class HealthWeatherIndicator extends StatefulWidget { + @override + _HospitalsPageState createState() => _HospitalsPageState(); +} + +class _HospitalsPageState extends State { + var data; + LocationUtils locationUtils; + AppSharedPreferences sharedPref = AppSharedPreferences(); + var weather = '--'; + @override + void initState() { + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance + .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + getWeather(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getWeatherData(), + allowAny: true, + builder: (_, mode, widget) => AppScaffold( + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).healthWeatherIndicators, + isShowAppBar: true, + body: mode.weatherIndicatorData.length > 0 + ? SingleChildScrollView( + child: Column(children: [ + Container( + margin: EdgeInsets.all(8), + width: double.infinity, + height: 150, + decoration: BoxDecoration( + image: DecorationImage( + image: + ExactAssetImage('assets/images/Weather_img.png'), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(8.0)), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .healthWeatherIndicators, + color: Colors.white, + fontWeight: FontWeight.w600, + ), + AppText( + TranslationBase.of(context) + .healthTipsBasedOnCurrentWeather, + color: Colors.white, + fontSize: 14, + ), + ], + )), + Expanded( + flex: 2, + child: InkWell( + onTap: () {}, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/Weather_ico.png', + width: 60, + height: 60, + ), + Directionality( + textDirection: TextDirection.ltr, + child: AppText(weather, + fontSize: 22, + color: Colors.white)) + ], + ), + ], + )), + ) + ], + ), + ), + ), + Padding( + padding: EdgeInsets.all(15), + child: AppText( + projectViewModel.isArabic + ? mode.weatherIndicatorData[0].cityNameN + : mode.weatherIndicatorData[0].cityName, + fontSize: 24, + fontWeight: FontWeight.bold, + )), + Padding( + padding: EdgeInsets.all(15), + child: Column( + children: mode.weatherIndicatorData.map((data) { + return WeatherSlider(data); + }).toList())) + ])) + : Center(child: AppCircularProgressIndicator())), + ); + } + + getWeather() async { + var data = await this.sharedPref.getObject(WEATHER); + setState(() { + weather = data['Temperature'].toString() + '\u2103' ?? '--'; + }); + } +} diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index 9ad6d68f..75282190 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -2,6 +2,7 @@ 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'; @@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -18,7 +20,6 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'dialogs/ConfirmSMSDialog.dart'; import 'new_text_Field.dart'; @@ -159,16 +160,16 @@ class ConfirmPaymentPage extends StatelessWidget { label: TranslationBase.of(context).confirm.toUpperCase(), disabled: model.state == ViewState.Busy, onTap: () { + GifLoaderDialogUtils.showMyDialog(context); model .sendActivationCodeForAdvancePayment( patientID: int.parse(advanceModel.fileNumber), projectID: advanceModel.hospitalsModel.iD) .then((value) { + GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(); - }).showProgressBar( - text: "Loading", - backgroundColor: Colors.blue.withOpacity(0.6)); + }); }, ), ), @@ -248,12 +249,14 @@ class ConfirmPaymentPage extends StatelessWidget { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); service .checkPaymentStatus( Utils.getAppointmentTransID( appo.projectID, appo.clinicID, appo.appointmentNo), AppGlobal.context) .then((res) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); print("Printing Payment Status Reponse!!!!"); print(res); String paymentInfo = res['Response_Message']; @@ -263,18 +266,21 @@ class ConfirmPaymentPage extends StatelessWidget { AppToast.showErrorToast(message: res['Response_Message']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); 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) .then((res) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); addAdvancedNumberRequest( res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), @@ -282,24 +288,28 @@ class ConfirmPaymentPage extends StatelessWidget { appo.appointmentNo.toString(), appo); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); service .addAdvancedNumberRequest( advanceNumber, paymentReference, appointmentID, AppGlobal.context) .then((res) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); print(res); navigateToHome(AppGlobal.context); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Future navigateToHome(context) async { diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index fa69d913..d7e08a66 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -2,9 +2,11 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.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'; @@ -14,8 +16,8 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'BookSuccess.dart'; @@ -43,6 +45,8 @@ class BookConfirm extends StatefulWidget { } class _BookConfirmState extends State { + ToDoCountProviderModel toDoProvider; + @override void initState() { widget.authUser = new AuthenticatedUser(); @@ -54,6 +58,7 @@ class _BookConfirmState extends State { @override Widget build(BuildContext context) { + toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, @@ -236,7 +241,7 @@ class _BookConfirmState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: Text( TranslationBase.of(context).date + ": " + @@ -320,7 +325,7 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(top: 5.0), child: Text( - "Gender: " + + TranslationBase.of(context).gender + ": " + widget.authUser.genderDescription, style: TextStyle( fontSize: 12.0, @@ -330,7 +335,7 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(top: 5.0, bottom: 3.0), child: Text( - "Age: " + widget.authUser.age.toString(), + TranslationBase.of(context).age + ": " + widget.authUser.age.toString(), style: TextStyle( fontSize: 12.0, color: Colors.grey[600], @@ -418,12 +423,13 @@ class _BookConfirmState extends State { context) .then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: "Appointment Booked Successfully"); + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); - Future.delayed(new Duration(milliseconds: 1800), () { + Future.delayed(new Duration(milliseconds: 500), () { getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); + getToDoCount(); }); } else { GifLoaderDialogUtils.hideDialog(context); @@ -471,9 +477,10 @@ class _BookConfirmState extends State { AppToast.showSuccessToast(message: "Appointment Booked Successfully"); print(res['AppointmentNo']); - Future.delayed(new Duration(milliseconds: 1800), () { + Future.delayed(new Duration(milliseconds: 500), () { getLiveCareAppointmentPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); + getToDoCount(); }); } else { GifLoaderDialogUtils.hideDialog(context); @@ -499,10 +506,23 @@ class _BookConfirmState extends State { dialog.showAlertDialog(context); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); + } + + getToDoCount() { + toDoProvider.setState(0, true); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true); + } else {} + }).catchError((err) { + print(err); + }); } getPatientShare(context, String appointmentNo, int clinicID, int projectID, diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 82248560..f513c434 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'QRCode.dart'; @@ -166,6 +165,173 @@ class _BookSuccessState extends State { ], ), ), + bottomNavigationBar: getBottomContainer(), + ); + } + + Widget getBottomContainer() { + switch (widget.patientShareResponse.nextAction) { + case 0: + return Container(); + break; + case 10: + return _getConfirmAppoButtons(); + break; + case 15: + return _getPaymentPendingAppo(); + break; + case 20: + return _getPayNowButtons(); + break; + case 30: + return _getQRButtons(); + break; + case 50: + return _getConfirmAppoButtons(); + break; + } + } + + Widget _getQRButtons() { + return Container( + alignment: Alignment.bottomCenter, + height: MediaQuery.of(context).size.height * 0.18, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { +// navigateToQR(context); + getAppoQR(context); + }, + child: Text(TranslationBase.of(context).viewQR.toUpperCase(), + style: TextStyle(fontSize: 18.0)), + ), + ), + ], + ), + ); + } + + Widget _getPayNowButtons() { + return Container( + alignment: Alignment.bottomCenter, + height: MediaQuery.of(context).size.height * 0.2, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + startPaymentProcess(); + }, + child: Text(TranslationBase.of(context).payNow.toUpperCase(), + style: TextStyle(fontSize: 18.0)), + ), + ), + ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF40ACC9), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + navigateToHome(context); + }, + child: Text(TranslationBase.of(context).payLater.toUpperCase(), + style: TextStyle(fontSize: 18.0)), + ), + ), + ], + ), + ); + } + + Widget _getConfirmAppoButtons() { + return Container( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(bottom: 5.0), + height: MediaQuery.of(context).size.height * 0.15, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + AppoitmentAllHistoryResultList appo = + new AppoitmentAllHistoryResultList(); + appo.clinicID = widget.docObject.clinicID; + appo.projectID = widget.docObject.projectID; + appo.appointmentNo = widget.patientShareResponse.appointmentNo; + appo.serviceID = widget.patientShareResponse.serviceID; + appo.isLiveCareAppointment = + widget.patientShareResponse.isLiveCareAppointment; + appo.doctorID = widget.patientShareResponse.doctorID; + confirmAppointment(appo); + }, + child: Text( + widget.patientShareResponse.isLiveCareAppointment + ? TranslationBase.of(context) + .confirmLiveCare + .toUpperCase() + : TranslationBase.of(context).confirm.toUpperCase(), + style: TextStyle(fontSize: 18.0)), + ), + ), + ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF40ACC9), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + navigateToHome(context); + }, + child: Text( + TranslationBase.of(context).confirmLater.toUpperCase(), + style: TextStyle(fontSize: 18.0)), + ), + ), + ], + ), ); } @@ -239,8 +405,7 @@ class _BookSuccessState extends State { _getBulletPoint("1"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - "Please confirm the appointment to avoid the cancellation", + child: Text(TranslationBase.of(context).upcomingConfirm, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)), ), @@ -264,7 +429,7 @@ class _BookSuccessState extends State { Container( width: MediaQuery.of(context).size.width * 0.8, child: Text( - "The online payment process will be available 24 hours before the appointment.", + TranslationBase.of(context).upcomingConfirmMore, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)), ), @@ -278,67 +443,6 @@ class _BookSuccessState extends State { margin: EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), child: Image.asset("assets/images/new-design/payment-method.png"), ), - Container( - alignment: Alignment.bottomCenter, - height: MediaQuery.of(context).size.height * 0.32, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - AppoitmentAllHistoryResultList appo = - new AppoitmentAllHistoryResultList(); - appo.clinicID = widget.docObject.clinicID; - appo.projectID = widget.docObject.projectID; - appo.appointmentNo = - widget.patientShareResponse.appointmentNo; - appo.serviceID = widget.patientShareResponse.serviceID; - appo.isLiveCareAppointment = - widget.patientShareResponse.isLiveCareAppointment; - appo.doctorID = widget.patientShareResponse.doctorID; - confirmAppointment(appo); - }, - child: Text( - widget.patientShareResponse.isLiveCareAppointment - ? TranslationBase.of(context) - .confirmLiveCare - .toUpperCase() - : TranslationBase.of(context).confirm.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF40ACC9), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - navigateToHome(context); - }, - child: Text( - TranslationBase.of(context).confirmLater.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ], - ), - ), ], ); } @@ -349,36 +453,37 @@ class _BookSuccessState extends State { confirmAppointment(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); service .confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context) .then((res) { - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }) - .catchError((err) { - print(err); - }) - .showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) - .then((value) { - if (appo.isLiveCareAppointment) { - insertLiveCareVIDARequest(appo); - } else { - navigateToHome(context); - } - }); + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + if (appo.isLiveCareAppointment) { + insertLiveCareVIDARequest(appo); + } else { + navigateToHome(context); + } + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); } insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); service .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); navigateToHome(context); @@ -386,9 +491,10 @@ class _BookSuccessState extends State { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Widget _getPayNowAppo() { @@ -462,52 +568,6 @@ class _BookSuccessState extends State { ), ], ), - Container( - alignment: Alignment.bottomCenter, - height: MediaQuery.of(context).size.height * 0.2, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - startPaymentProcess(); - }, - child: Text(TranslationBase.of(context).payNow.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF40ACC9), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - navigateToHome(context); - }, - child: Text( - TranslationBase.of(context).payLater.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ], - ), - ), ], ); } @@ -554,7 +614,7 @@ class _BookSuccessState extends State { AppoitmentAllHistoryResultList appo) async { if (paymentMethod == "ApplePay") { await widget.chromeBrowser.open( - url: "https://flutter.dev/", + url: "https://applepay-datatrans-sample.herokuapp.com/", options: ChromeSafariBrowserClassOptions( android: AndroidChromeCustomTabsOptions( addDefaultShareMenuItem: false), @@ -633,6 +693,7 @@ class _BookSuccessState extends State { } getApplePayAPQ(AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .checkPaymentStatus( @@ -640,6 +701,7 @@ class _BookSuccessState extends State { appo.projectID, appo.clinicID, appo.appointmentNo), context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); print("Printing Payment Status Reponse!!!!"); print(res); String paymentInfo = res['Response_Message']; @@ -649,9 +711,10 @@ class _BookSuccessState extends State { AppToast.showErrorToast(message: res['Response_Message']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { @@ -766,34 +829,34 @@ class _BookSuccessState extends State { ), ], ), - Container( - alignment: Alignment.bottomCenter, - height: MediaQuery.of(context).size.height * 0.18, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { -// navigateToQR(context); - getAppoQR(context); - }, - child: Text(TranslationBase.of(context).viewQR.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ], - ), - ), +// Container( +// alignment: Alignment.bottomCenter, +// height: MediaQuery.of(context).size.height * 0.18, +// child: Column( +// mainAxisAlignment: MainAxisAlignment.end, +// children: [ +// ButtonTheme( +// shape: RoundedRectangleBorder( +// borderRadius: BorderRadius.circular(10.0), +// ), +// minWidth: MediaQuery.of(context).size.width * 0.7, +// height: 45.0, +// child: RaisedButton( +// color: new Color(0xFF60686b), +// textColor: Colors.white, +// disabledTextColor: Colors.white, +// disabledColor: new Color(0xFFbcc2c4), +// onPressed: () { +// // navigateToQR(context); +// getAppoQR(context); +// }, +// child: Text(TranslationBase.of(context).viewQR.toUpperCase(), +// style: TextStyle(fontSize: 18.0)), +// ), +// ), +// ], +// ), +// ), ], ); } diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 6864e6b1..392eb24c 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -1,11 +1,14 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/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'; @@ -42,23 +45,14 @@ class _DoctorProfileState extends State AppSharedPreferences sharedPref = AppSharedPreferences(); + List doctorDetailsList = List(); + @override void initState() { _tabController = new TabController( length: 2, vsync: this, initialIndex: widget.isOpenAppt == true ? 1 : 0); - - // event.controller.stream.listen((p) { - // if (p['clinic_id'] != null && - // p['doctor_id'] != null && - // p['project_id'] != null) { - // setState(() { - // // need to take the data from here - // // dropdownValue = p['clinic_id']; - // }); - // } - // }); _tabController = new TabController(length: 2, vsync: this); widget.authUser = new AuthenticatedUser(); widget.doctor.speciality = widget.docProfileList.specialty; @@ -150,19 +144,26 @@ class _DoctorProfileState extends State emptyIcon: Icons.star, ), ), - Container( - margin: EdgeInsets.only(top: 5.0), - alignment: Alignment.center, - child: Text( - "(" + - widget.doctor.noOfPatientsRate.toString() + - " " + TranslationBase.of(context).reviews + ")", - style: TextStyle( - fontSize: 14.0, - color: Colors.blue[800], - letterSpacing: 1.0, - decoration: TextDecoration.underline, - )), + InkWell( + onTap: () { + getDoctorRatingsDetails(); + }, + child: Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: Text( + "(" + + widget.docProfileList.noOfPatientsRate.toString() + + " " + + TranslationBase.of(context).reviews + + ")", + style: TextStyle( + fontSize: 14.0, + color: Colors.blue[800], + letterSpacing: 1.0, + decoration: TextDecoration.underline, + )), + ), ), Container( margin: EdgeInsets.only(top: 10.0), @@ -213,6 +214,281 @@ class _DoctorProfileState extends State ); } + getDoctorRatings() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service.getDoctorsRating(widget.doctor.doctorID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + print(res['NotesDoctorRatingList']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + getDoctorRatingsDetails() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service + .getDoctorsRatingDetails(widget.doctor.doctorID, context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + doctorDetailsList.clear(); + res['DoctorRatingDetailsList'].forEach((v) { + doctorDetailsList.add(new DoctorRateDetails.fromJson(v)); + }); + showRatingDialog(doctorDetailsList); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + void showRatingDialog(List doctorDetailsList) { + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + // height: 400.0, + width: MediaQuery.of(context).size.width * 0.8, + color: Colors.white, + child: Column( + children: [ + Container( + alignment: Alignment.center, + width: MediaQuery.of(context).size.width, + color: Theme.of(context).primaryColor, + margin: EdgeInsets.only(bottom: 5.0), + padding: EdgeInsets.all(10.0), + child: Text(TranslationBase.of(context).doctorRating, + style: TextStyle( + fontSize: 22.0, color: Colors.white))), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Text( + this + .widget + .doctor + .actualDoctorRate + .ceilToDouble() + .toString(), + style: TextStyle( + fontSize: 32.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: RatingBar.readOnly( + initialRating: + this.widget.doctor.actualDoctorRate.toDouble(), + size: 35.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(top: 10.0), + child: Text( + this.widget.doctor.noOfPatientsRate.toString() + + " " + + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 14.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).excellent, + style: TextStyle( + fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[0].patientNumber), + height: 6.0, + child: Container( + color: Colors.green[700], + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).v_good, + style: TextStyle( + fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[1].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffB7B723), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).good, + style: TextStyle( + fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[2].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEBA727), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).average, + style: TextStyle( + fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[3].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEB7227), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).below_average, + style: TextStyle( + fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[4].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffE20C0C), + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 40.0), child: Divider()), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Align( + alignment: FractionalOffset.bottomCenter, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 40.0, + child: RaisedButton( + elevation: 0.0, + color: Colors.white, + textColor: Colors.red, + hoverColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(TranslationBase.of(context).cancel, + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); + } + + double getRatingWidth(int patientNumber) { + var width = (patientNumber / this.widget.docProfileList.noOfPatientsRate) * 100; + return width; + } + getPatientData() async { if (await sharedPref.getObject(USER_PROFILE) != null) { var data = diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 095d72a6..94308c1c 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -6,9 +6,12 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; +import 'components/SearchByClinic.dart'; + class Search extends StatefulWidget { final int type; final List clnicIds; @@ -31,34 +34,40 @@ class _SearchState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { AppGlobal.context = context; - return Scaffold( - appBar: AppBar( - bottom: TabBar( - tabs: [ - Tab(text: TranslationBase.of(context).clinicName), - Tab( - text: TranslationBase.of(context).doctorName, - ) - ], - controller: _tabController, - ), - title: Text(TranslationBase.of(context).bookAppo, - style: TextStyle(color: Colors.white)), - leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); - }, - ), - ), - body: TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - SearchByClinic( - clnicIds: widget.clnicIds, - ), - SearchByDoctor() - ], - controller: _tabController), - ); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).bookAppo, + body: Container( + child: Column( + children: [ + TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).clinicName), + Tab( + text: TranslationBase.of(context).doctorName, + ) + ], + controller: _tabController, + ), + Divider( + color: Colors.grey[600], + thickness: 0.5, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + SearchByClinic( + clnicIds: widget.clnicIds, + ), + SearchByDoctor() + ], + controller: _tabController, + ), + ) + ], + ), + )); } } diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 055b0c41..0c65a789 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -36,7 +36,7 @@ class _SearchResultsState extends State { ...List.generate( widget.patientDoctorAppointmentListHospital.length, (index) => AppExpandableNotifier( - isExpand: index == 1 ? true : false, + // isExpand: index == 0 ? true : false, title: widget.patientDoctorAppointmentListHospital[index] .filterName + " - " + diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 70b6aaa0..7caf1977 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -178,7 +178,8 @@ class _DocAvailableAppointmentsState extends State holidayStyle: TextStyle().copyWith(color: Colors.blue[800]), ), daysOfWeekStyle: DaysOfWeekStyle( - weekendStyle: TextStyle().copyWith(color: Colors.blue[600]), + weekendStyle: TextStyle().copyWith(color: Colors.black, fontSize: 14.0), + weekdayStyle: TextStyle().copyWith(color: Colors.black, fontSize: 14.0), ), headerStyle: HeaderStyle( centerHeaderTitle: true, @@ -190,7 +191,7 @@ class _DocAvailableAppointmentsState extends State opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController), child: Container( margin: const EdgeInsets.all(4.0), - padding: const EdgeInsets.only(top: 5.0, left: 6.0), + padding: const EdgeInsets.only(top: 5.0, left: 5.0), color: Colors.transparent, width: 0, height: 0, @@ -380,6 +381,7 @@ class _DocAvailableAppointmentsState extends State AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); }); } diff --git a/lib/pages/BookAppointment/components/DocInfo.dart b/lib/pages/BookAppointment/components/DocInfo.dart index aa6e3b9f..89b9e4d0 100644 --- a/lib/pages/BookAppointment/components/DocInfo.dart +++ b/lib/pages/BookAppointment/components/DocInfo.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -13,31 +14,29 @@ class DoctorInformation extends StatelessWidget { return Container( margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), child: Column( + mainAxisSize: MainAxisSize.min, children: [ - Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + AppExpandableNotifier( + isExpand: true, + headerWidget: Container( + margin: EdgeInsets.all(10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + "assets/images/DQ/doctor_information_icon.svg"), + Container( + margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), + child: Text(TranslationBase.of(context).docInfo, + style: TextStyle(fontSize: 16.0, letterSpacing: 0.8)), + ), + ], + ), ), - child: Column( + bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.asset( - "assets/images/DQ/doctor_information_icon.svg"), - Container( - margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), - child: Text(TranslationBase.of(context).docInfo, - style: - TextStyle(fontSize: 16.0, letterSpacing: 0.8)), - ), - ], - ), - ), Container( padding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 10.0), child: Table( @@ -78,34 +77,32 @@ class DoctorInformation extends StatelessWidget { ], ), ), - Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + // ), + AppExpandableNotifier( + isExpand: true, + headerWidget: Container( + margin: EdgeInsets.all(10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + "assets/images/DQ/doctor_qualification_icon.svg"), + Container( + margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), + child: Text(TranslationBase.of(context).docQualifications, + style: TextStyle(fontSize: 16.0, letterSpacing: 0.8)), + ), + ], + ), ), - child: Column( + bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.asset( - "assets/images/DQ/doctor_qualification_icon.svg"), - Container( - margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), - child: Text( - TranslationBase.of(context).docQualifications, - style: - TextStyle(fontSize: 16.0, letterSpacing: 0.8)), - ), - ], - ), - ), Container( margin: EdgeInsets.fromLTRB(20.0, 0.0, 10.0, 5.0), child: Column( + mainAxisSize: MainAxisSize.min, children: [ _getNormalText(docProfileList.doctorProfileInfo) ], @@ -123,7 +120,6 @@ class DoctorInformation extends StatelessWidget { return Text(text, style: TextStyle( fontSize: 13, - fontFamily: 'Open-Sans', fontWeight: FontWeight.bold, letterSpacing: 0.5, color: Colors.grey[800])); @@ -133,11 +129,9 @@ class DoctorInformation extends StatelessWidget { return Container( margin: EdgeInsets.only(top: 5.0), child: Text(text, + maxLines: 16, style: TextStyle( - fontSize: 13, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.grey[700])), + fontSize: 13, letterSpacing: 0.5, color: Colors.grey[700])), ); } @@ -150,10 +144,7 @@ class DoctorInformation extends StatelessWidget { children: [ Text(text.trim(), style: TextStyle( - fontSize: 13, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.grey[700])), + fontSize: 13, letterSpacing: 0.5, color: Colors.grey[700])), Container( margin: EdgeInsets.only(left: 5.0, right: 5.0), child: Image.network(icon, width: 18.0, height: 18.0), diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 7943e423..01c9ee92 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -34,6 +34,7 @@ class _SearchByClinicState extends State { List projectsList = []; bool isMobileAppDentalAllow = false; bool isLoaded = false; + bool isProjectLoaded = false; @override void initState() { @@ -56,6 +57,11 @@ class _SearchByClinicState extends State { onChanged: (bool value) { setState(() { nearestAppo = value; + print(nearestAppo); + if (nearestAppo) + getProjectsList(); + else + isProjectLoaded = false; }); }, ), @@ -121,7 +127,8 @@ class _SearchByClinicState extends State { }, ), )), - isDentalSelectedAndSupported() == true || nearestAppo + isDentalSelectedAndSupported() == true || + (nearestAppo && isProjectLoaded) ? Container( height: 60.0, decoration: BoxDecoration( @@ -177,24 +184,30 @@ class _SearchByClinicState extends State { }); }); getProjectsList(); + GifLoaderDialogUtils.hideDialog(context); } else {} }).catchError((err) { print(err); + GifLoaderDialogUtils.hideDialog(context); }); } getProjectsList() { ClinicListService service = new ClinicListService(); + List projectsListLocal = []; service.getProjectsList(context).then((res) { if (res['MessageStatus'] == 1) { setState(() { res['ListProject'].forEach((v) { - projectsList.add(new HospitalsModel.fromJson(v)); + projectsListLocal.add(new HospitalsModel.fromJson(v)); }); + projectsList = projectsListLocal; }); - GifLoaderDialogUtils.hideDialog(context); filterClinic(); - } else {} + isProjectLoaded = true; + } else { + isProjectLoaded = false; + } }).catchError((err) { print(err); }); @@ -216,6 +229,9 @@ class _SearchByClinicState extends State { List arrDistance = []; List result; int numAll; + List _patientDoctorAppointmentListHospital = + List(); + DoctorsListService service = new DoctorsListService(); service .getDoctorsList( @@ -228,15 +244,34 @@ class _SearchByClinicState extends State { if (res['MessageStatus'] == 1) { setState(() { if (res['DoctorList'].length != 0) { - print(res['DoctorList']); + // print(res['DoctorList']); doctorsList.clear(); res['DoctorList'].forEach((v) { doctorsList.add(new DoctorList.fromJson(v)); + }); + doctorsList.forEach((element) { + List doctorByHospital = + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); - arr.add(new DoctorList.fromJson(v).projectName); - arrDistance.add(new DoctorList.fromJson(v) - .projectDistanceInKiloMeters - .toString()); + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[ + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + _patientDoctorAppointmentListHospital.add( + PatientDoctorAppointmentList( + filterName: element.projectName, + distanceInKMs: + element.projectDistanceInKiloMeters.toString(), + patientDoctorAppointment: element)); + } }); } else {} }); @@ -244,7 +279,7 @@ class _SearchByClinicState extends State { result = LinkedHashSet.from(arr).toList(); numAll = result.length; navigateToSearchResults( - context, doctorsList, result, numAll, arrDistance); + context, doctorsList, _patientDoctorAppointmentListHospital); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -267,24 +302,26 @@ class _SearchByClinicState extends State { } Future navigateToSearchResults( - context, docList, result, numAll, resultDistance) async { - Navigator.push( context, - MaterialPageRoute( - builder: (context) => BranchView( - doctorsList: docList, - result: result, - num: numAll, - resultDistance: resultDistance), - ), - ).then((value) { + List docList, + List + patientDoctorAppointmentListHospital) async { + isProjectLoaded = false; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchResults( + isLiveCareAppointment: false, + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))).then((value) { getProjectsList(); }); } filterClinic() { setState(() { - if (widget.clnicIds.length > 0) { + if (widget.clnicIds != null && widget.clnicIds.length > 0) { clinicsList = clinicsList .where((i) => widget.clnicIds.indexOf(i.clinicID) > -1) .toList(); diff --git a/lib/pages/BookAppointment/widgets/CardCommon.dart b/lib/pages/BookAppointment/widgets/CardCommon.dart index e56ba965..b03e9b24 100644 --- a/lib/pages/BookAppointment/widgets/CardCommon.dart +++ b/lib/pages/BookAppointment/widgets/CardCommon.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:flutter/material.dart'; +import '../../../Constants.dart'; + class CardCommon extends StatelessWidget { final image; final text; @@ -31,7 +33,7 @@ class CardCommon extends StatelessWidget { child: Text(this.text, overflow: TextOverflow.clip, style: TextStyle( - color: new Color(0xFF40ACC9), + color: secondaryColor, letterSpacing: 1.0, fontSize: 20.0)), ), diff --git a/lib/pages/ChildVaccines/ChidDetailsWidget.dart b/lib/pages/ChildVaccines/ChidDetailsWidget.dart deleted file mode 100644 index c06c5422..00000000 --- a/lib/pages/ChildVaccines/ChidDetailsWidget.dart +++ /dev/null @@ -1,120 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; -import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_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/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; - -import 'dialogs/delete_child.dart'; - -class ChildDetailsWidget extends StatelessWidget { - final ChildVaccinesViewModel model; - final List_BabyInformationModel babyInfo; - final List_UserInformationModel informationModel; - final Function onTapDelete; - - ChildDetailsWidget({this.model, this.babyInfo, this.informationModel, this.onTapDelete}); - - @override - Widget build(BuildContext context) { - return InkWell( - onTap: (){ - Navigator.push( - context, - FadePage( - page: VaccinationTablePage( - babyInfo: babyInfo, - informationModel: informationModel, - ), - ), - ); - }, - child: Container( - margin: EdgeInsets.only(left: 5, right: 5, bottom: 10), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.white, - ), - padding: EdgeInsets.all(12), - width: 200, - //double.infinity, - child: Column( - children: [ - Row(children: [ - Texts(TranslationBase.of(context).childName), - ]), - Row(children: [ - Texts(babyInfo.babyName.trim()), - ]), - Row(children: [ - IconButton( - icon: Image.asset(babyInfo.gender == 1 - ? 'assets/images/new-design/male.png' - : 'assets/images/new-design/female.png'), - tooltip: '', - onPressed: () { - }, - ), - Texts(babyInfo.genderDescription), - IconButton( - icon: Icon( - Icons.remove_red_eye, - color: Colors.red, - ), - tooltip: '', - onPressed: () { - Navigator.push( - context, - FadePage( - page: VaccinationTablePage( - babyInfo: babyInfo, - informationModel: informationModel, - ), - ), - ); - }, - ) - ]), - Row(children: [ - Texts(TranslationBase.of(context).childDob), - ]), - Row( - children: [ - IconButton( - icon: new Image.asset( - 'assets/images/new-design/calender-secondary.png'), - tooltip: '', - ), - Texts( - DateUtil.yearMonthDay(babyInfo.dOB), - ), - ], - ), - Row(children: [ - IconButton( - icon: new Image.asset('assets/images/new-design/garbage.png'), - tooltip: '', - onPressed: () async { - onTapDelete(); - }, - ), - Texts(TranslationBase.of(context).delete), - ]), - SizedBox( - height: 12, - ), - ], - ), - ), - ); - } -} diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index 10dea666..51b89f98 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -11,7 +11,6 @@ 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'; @@ -22,16 +21,39 @@ import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; enum Gender { Male, Female, NON } +enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } class AddNewChildPage extends StatefulWidget { + final int frequency; + final int days; + final String itemDescription; String dateAdd; + List _scheduleList = List(); + List daysOfWeek = [ + DayOfWeek.Monday, + DayOfWeek.Tuesday, + DayOfWeek.Wednesday, + DayOfWeek.Thursday, + DayOfWeek.Friday, + DayOfWeek.Saturday, + DayOfWeek.Sunday + ]; + DateTime startDay; DateTime endDay; - AddNewChildPage() { + //AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key); + AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) { startDay = DateTime.now(); - endDay = DateTime.now(); + endDay = + DateTime.now(); //endDay = DateTime.now().add(Duration(days: days)); + int hour = 24; //(24 / frequency).round(); + int durations = 24 ~/ hour; + for (int count = 0; count < durations; count++) { + _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, + DateTime.now().day, (hour * count))); + } } @override @@ -39,140 +61,150 @@ class AddNewChildPage extends StatefulWidget { } class _AddNewChildPageState extends State { + int tappedIndex; int checkedValue; + @override + void initState() { + super.initState(); + tappedIndex = -1; + } + TextEditingController _firstTextController = TextEditingController(); TextEditingController _secondTextController = TextEditingController(); + TextEditingController _notesTextController = TextEditingController(); + BeneficiaryType beneficiaryType = BeneficiaryType.NON; Gender gender = Gender.Male; CreateNewUser_New newUserChild = CreateNewUser_New(); + //ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel(); + List_BabyInformationModel addvancedModel = List_BabyInformationModel(); CreateNewBaby newChild = CreateNewBaby(); - - String firstName = ""; - String secondName = ""; + List_UserInformationModel informationModel = List_UserInformationModel(); @override Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).vaccination, + appBarTitle: "Vaccintion", body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( margin: EdgeInsets.all(12), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( - height: 25, + height: 50, + ), + Texts( + "Add the child's information below to recieve the schedule of vaccinations.", + //+model.user.firstName, + textAlign: TextAlign.center, ), - Texts(TranslationBase.of(context).addInstructions), SizedBox( - height: 20, + height: 12, ), NewTextFields( - hintText: TranslationBase.of(context).firstName, + hintText: "First Name", controller: _firstTextController, - onChanged: (value) { - setState(() { - firstName = value; - }); - }, ), SizedBox( height: 12, ), NewTextFields( - hintText: TranslationBase.of(context).lastName, + hintText: "Second Name", controller: _secondTextController, - onChanged: (value) { - secondName = value; - }, ), SizedBox( - height: 20, + height: 12, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).gender + " :", + "Gender:", textAlign: TextAlign.end, ), ], ), - SizedBox( - height: 15, - ), Container( - height: 60, + height: MediaQuery.of(context).size.height * 0.12, width: double.infinity, + padding: EdgeInsets.all(12), + + child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.center, children: [ - Expanded( - child: AnimatedContainer( - duration: Duration(milliseconds: 400), - height: 60, - 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; - }); - }, - ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: 175, + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 1 ? Colors.white : Colors.black, + color: checkedValue == 1 ? Colors.red : Colors.white, + + label: "Male", + // + onTap: () { + + setState(() { + checkedValue = 1; + print("checkedValue=" + checkedValue.toString()); + }); + + // bloodDetails. + }, ), ), - Expanded( - child: AnimatedContainer( - duration: Duration(milliseconds: 400), - height: 60, - 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; - }); - }, - ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: 175, + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 2 ? Colors.white : Colors.black, + color: checkedValue == 2 ? Colors.red : Colors.white, + label: "Female", + // + onTap: () { + setState(() { + checkedValue = 2; + print("checkedValue=" + checkedValue.toString()); + }); + // bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, ), ) ], ), ), + //========== SizedBox( - height: 20, + height: 6, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).dob + " :", + "Date Of Birth::", textAlign: TextAlign.end, ), ], ), - SizedBox( - height: 8, - ), InkWell( onTap: () { DatePicker.showDatePicker( context, showTitleActions: true, + // minTime: DateTime( + // DateTime.now().year, DateTime.now().month - 1, 1), minTime: DateTime(1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { @@ -181,6 +213,7 @@ class _AddNewChildPageState extends State { }); }, currentTime: widget.startDay, + // locale: projectViewModel.localeType ); }, child: Container( @@ -191,63 +224,99 @@ class _AddNewChildPageState extends State { borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Texts(//getStartDay() + // DateUtil.yearMonthDay(DateTime.now()) + getStartDay()), Icon( Icons.calendar_today, color: Colors.black, - ), - SizedBox( - width: 25, - ), - Expanded(child: Texts(getStartDay())), + ) ], ), ), ), SizedBox( - height: 25, + height: 12, ), Container( - height: 60, + height: MediaQuery.of(context).size.height * 0.12, width: double.infinity, + padding: EdgeInsets.all(15), child: SecondaryButton( textColor: Colors.white, - color: Colors.grey[800], - disabled: (checkedValue == null || - firstName.isEmpty || - secondName.isEmpty), - label: TranslationBase.of(context).add, - onTap: () async { - newChild.babyName = _firstTextController.text + - " " + - _secondTextController.text; + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: "Add", + // + onTap: () async{ + newChild.babyName = _firstTextController.text + " " + _secondTextController.text; newChild.gender = checkedValue.toString(); - newChild.strDOB = widget.startDay.toIso8601String(); + newChild.strDOB = getStartDay(); newChild.tempValue = true; newChild.isLogin = true; await model.createNewBabyOrders(newChild: newChild); - if (model.isAdded) { - AppToast.showSuccessToast( - message: TranslationBase.of(context).addedChild); - Navigator.pop(context, model.isAdded); - } else { - AppToast.showSuccessToast(message: model.error); + if(model.isAdded){ + AppToast.showSuccessToast(message: "Record Added"); + Navigator.pop(context,model.isAdded); + }else{ + + //TODO handling error } + }, ), ), + //========= ], ), ), ), - // bottomSheet: + // bottomSheet: ), ); } String getStartDay() { - return "${widget.startDay.day}-${widget.startDay.month}-${widget.startDay.year}"; + return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}"; + } + + String getEndDay() { + return "${DateUtil.getMonth(widget.endDay.month)} ${widget.endDay.day}, ${widget.endDay.year}"; + } + + String getDateTime(DateTime dateTime) { + return '${dateTime.hour}:${dateTime.minute}'; + } + + String getDays() { + String days = ""; + widget.daysOfWeek.forEach((element) { + days += "${DateUtil.getDay(element)},"; + }); + return days; + } + + void confirmSelectDayDialog() { + showDialog( + context: context, + child: DayCheckBoxDialog( + title: 'Select Day', + selectedDaysOfWeek: widget.daysOfWeek, + onValueSelected: (value) { + setState(() { + widget.daysOfWeek = value; + }); + }, + ), + ); } } diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart index 45020f79..806a5b71 100644 --- a/lib/pages/ChildVaccines/child_page.dart +++ b/lib/pages/ChildVaccines/child_page.dart @@ -1,12 +1,10 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/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'; @@ -14,109 +12,191 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; -import 'ChidDetailsWidget.dart'; import 'dialogs/delete_child.dart'; class ChildPage extends StatefulWidget { - final List_UserInformationModel informationModel; - - const ChildPage({Key key, this.informationModel}) : super(key: key); - @override _ChildPageState createState() => _ChildPageState(); } class _ChildPageState extends State with SingleTickerProviderStateMixin { + DeleteBaby deleteBaby = DeleteBaby(); @override Widget build(BuildContext context) { var checkedValue = true; return BaseView( - onModelReady: (model) => model.getNewUserOrders(), - builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).vaccination, - baseViewModel: model, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 10), - child: Column( - children: [ - GridView.builder( - shrinkWrap: true, - primary: false, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - childAspectRatio: MediaQuery.of(context).size.width / - (MediaQuery.of(context).size.height / 1.45), - ), - itemCount: model.babyInformationModelList.length, - itemBuilder: (BuildContext context, int index) { - return ChildDetailsWidget( - model: model, - babyInfo: model.babyInformationModelList[index], - informationModel: widget.informationModel, - onTapDelete: () { - showDialog( - context: context, - child: DeleteChild(onTap: () async { - await model.deleteBabyOrders(babyInfo: model.babyInformationModelList[index]); - if (model.isDeleted) { - AppToast.showSuccessToast( - message: - TranslationBase.of(context).emailSuccess, - toastLength: Toast.LENGTH_LONG); - } else { - AppToast.showSuccessToast(message: model.error); - } - }), - ); - }, - ); + onModelReady: (model) => model.getNewUserOrders(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: " Vaccination", + baseViewModel: model, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 15, right: 15, top: 70), + child: Column( + children: [ + ...List.generate( + model.babyInformationModelList.length, + (index) => Container( + margin: EdgeInsets.only( + left: 0, right: 0, bottom: 20), + + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.white, width: 0.5), + borderRadius: + BorderRadius.all(Radius.circular(5)), + color: Colors.white, + ), + padding: EdgeInsets.all(12), + width: 200,//double.infinity, + child: Column( + children: [ + Row(children: [ + Texts("CHILD NAME"), + ]), + Row(children: [ + Texts(model + .babyInformationModelList[index] + .babyName + .trim()), + ]), + Row(children: [ + IconButton( + icon: Image.asset(model + .babyInformationModelList[ + index] + .gender == + 1 + ? 'assets/images/new-design/male.png' + : 'assets/images/new-design/female.png'), + tooltip: '', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts(model + .babyInformationModelList[index] + .genderDescription), + IconButton( + icon: Icon( + Icons.remove_red_eye, + color: Colors.red, + ), + tooltip: '', + onPressed: () { + Navigator.push( + context, + FadePage( + + + page: VaccinationTablePage(), + + + ), + ); + + }, + ) + ]), + Row(children: [ + Texts("Birthday"), + ]), + Row(children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/calender-secondary.png'), + tooltip: '', + onPressed: () { + setState(() { + + }); + }, + ), + Texts(DateUtil.yearMonthDay(model + .babyInformationModelList[index] + .dOB)), + ]), + Row(children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/garbage.png'), + tooltip: '', + onPressed: ()async { + + //===================== + await model.deleteBabyOrders(newChild:deleteBaby ); + + + deleteBaby.babyID=model.babyInformationModelList[index] + .babyID; + + await model.deleteBabyOrders(newChild:deleteBaby ); + if(model.isDeleted){ + AppToast.showSuccessToast(message: "Record Deleted"); + Navigator.pop(context,model.isDeleted); + }else{ + + //TODO handling error + } + + + + + + }, + ), + Texts("Delete"), + ]), + SizedBox( + height: 12, + ), + ], + ), + + ), + + + ) + ], + )) + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + padding: EdgeInsets.all(15), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: "ADD NEW CHILD ", + // + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddNewChildPage(), + ), + ).then((value) { + if (value) model.getNewUserOrders(); + }); }, ), - SizedBox( - height: 15, - ), - ], - ), - ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: TranslationBase.of(context).addChild, - // - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AddNewChildPage(), - ), - ).then((value) { - if (value!=null) - model.getNewUserOrders(); - }); - }, - ), - ), - ), - ); + ), + )); } } diff --git a/lib/pages/ChildVaccines/child_vaccines_page.dart b/lib/pages/ChildVaccines/child_vaccines_page.dart index e3503894..92f3a0be 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,142 +13,214 @@ 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 = ""; - final updateEmailFormKey = GlobalKey(); - + 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: TranslationBase.of(context).vaccination, - 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).welcomeBackV, - fontSize: 20, + 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, ), - ), - ), - 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).instructions, - fontSize: 20, + + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + child: Texts("Welcome back",fontSize: 20,), + ) , ), - ), - ), - Divider( - color: Colors.black, - indent: 10, - endIndent: 10, - ), - Form( - key: updateEmailFormKey, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - fillColor: Colors.red, - initialValue: model.userInformationModelList.emailAddress, - fontSize: 20, - hintColor: Colors.black, - fontWeight: FontWeight.w600, - onChanged: (text) { - setState(() { - addEmail = text; - }); - }, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context).enterEmail; - else if (!RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(value)) - return TranslationBase.of(context).validEmail; - return null; - }, + Divider(color:Colors.black , indent: 10, + endIndent: 10,), + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + child: Texts("Please ensure that the email address is up-to-date and process to view the schedule",fontSize: 20,), + ) , + ), + + Divider(color:Colors.black , indent: 10, + endIndent: 10,), + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + fillColor: Colors.red, + + hintText: model.user.emailAddress, + controller: titleController, + fontSize: 20, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + onChanged: (text) { + addEmail=text; + model.user.emailAddress==addEmail?checkedValue=false:checkedValue=true; + + + }, + validator: (value) { + + if (value == null) + { + return model.user.emailAddress; + + } + else + + { + return model.user.emailAddress;} + }, + ), ), ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: model.userInformationModelList.emailAddress == addEmail ? Colors.white24 : Color.fromRGBO(63, 72, 74, 1,), - disabled: addEmail.isEmpty, - label: TranslationBase.of(context).updateEmail, - onTap: () async{ - final form = updateEmailFormKey.currentState; - if (form.validate()) { - form.save(); - await model.updateEmail(addEmail); - AppToast.showSuccessToast(message: TranslationBase.of(context).updatedEmail); - } - - }, - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: Color.fromRGBO( - 63, - 72, - 74, - 1, + 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. + }, + + + ), ), - label: TranslationBase.of(context).viewListChildren, - onTap: () => Navigator.push( - context, - FadePage( - page: ChildPage(informationModel: model.userInformationModelList,), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + + padding: EdgeInsets.all(15), + child: SecondaryButton( + textColor: Colors.white, + color: Color.fromRGBO(63, 72, 74, 1,), + label: " VIEW LIST OF CHILDREN", + // + onTap: () => Navigator.push( + context, + FadePage( + page: ChildPage(), + + + + ), + ), + + ), ), - ), + + // Texts( + // // TranslationBase.of(context).advancePaymentLabel, + // model.user.emailAddress, + // textAlign: TextAlign.center, + // ), + SizedBox( + height: 12, + ), + SizedBox( + height: 12, + ), + SizedBox( + height: 12, + ), + + SizedBox( + height: 12, + ), + + SizedBox( + height: 12, + ), + + SizedBox( + height: 10, + ), + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Center( + // child: Container( + // color: Colors.white, + // width: 350, + // child: InkWell( + // onTap: () { + // showDialog( + // context: context, + // builder: (_) => + // AssetGiffyDialog( + // title: Text( + // "", + // style: TextStyle( + // fontSize: 22.0, + // fontWeight: + // FontWeight + // .w600), + // ), + // image: Image.asset( + // 'assets/images/BloodChrt_EN.png'), + // buttonCancelText: + // Text('cancel'), + // buttonCancelColor: + // Colors.grey, + // onlyCancelButton: true, + // )); + // }, + // child: Container( + // width: 250, + // height: 200, + // child:Image.asset( + // 'assets/images/BloodChrt_EN.png')), + // ), + // ), + // ), + // ], + // ), + + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + + ), ), - ), - ), ); } } + diff --git a/lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart similarity index 70% rename from lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart rename to lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart index 2279dd51..259bbdb7 100644 --- a/lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart +++ b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart @@ -5,18 +5,15 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class ConfirmSendEmailDialog extends StatefulWidget { - final email; - final Function onTap; - - const ConfirmSendEmailDialog({Key key, this.email, this.onTap}) - : super(key: key); +class SelectGenderDialog extends StatefulWidget { + final Email; + const SelectGenderDialog({Key key, this.Email}) : super(key: key); @override - _ConfirmSendEmailDialogState createState() => _ConfirmSendEmailDialogState(); + _SelectGenderDialogState createState() => _SelectGenderDialogState(); } -class _ConfirmSendEmailDialogState extends State { +class _SelectGenderDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( @@ -24,15 +21,22 @@ class _ConfirmSendEmailDialogState extends State { Container( child: Column( children: [ - Texts(TranslationBase.of(context).confirm), Divider(), Row( children: [ Expanded( flex: 1, - child: ListTile( - title: Text(TranslationBase.of(context).confirmSend + - "\n ${widget.email} "), + child: InkWell( + onTap: () { + setState(() { + //beneficiaryType = Gender.Male; + }); + }, + child: ListTile( + title: Text("Send the child's schedule to the email\n Tamer.dasdasdas@gmail.com "), + + + ), ), ) ], @@ -40,7 +44,15 @@ class _ConfirmSendEmailDialogState extends State { SizedBox( height: 5.0, ), + + SizedBox( + height: 5.0, + ), + SizedBox( + height: 5.0, + ), Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 1, @@ -70,7 +82,8 @@ class _ConfirmSendEmailDialogState extends State { flex: 1, child: InkWell( onTap: () { - widget.onTap(); + AppToast.showSuccessToast(message: "Email Sended"); + // widget.onValueSelected(beneficiaryType); Navigator.pop(context); }, child: Padding( @@ -92,4 +105,7 @@ class _ConfirmSendEmailDialogState extends State { ], ); } + + + } diff --git a/lib/pages/ChildVaccines/dialogs/delete_child.dart b/lib/pages/ChildVaccines/dialogs/delete_child.dart index 41b02bd5..250f40d3 100644 --- a/lib/pages/ChildVaccines/dialogs/delete_child.dart +++ b/lib/pages/ChildVaccines/dialogs/delete_child.dart @@ -6,10 +6,6 @@ import 'package:flutter/material.dart'; class DeleteChild extends StatefulWidget { - final Function onTap; - - const DeleteChild({Key key, this.onTap}) : super(key: key); - @override _DeleteChildState createState() => _DeleteChildState(); } @@ -22,14 +18,21 @@ class _DeleteChildState extends State { Container( child: Column( children: [ - Texts(TranslationBase.of(context).confirm), Divider(), Row( children: [ Expanded( - child: ListTile( - title: Texts(TranslationBase.of(context).deletedChild), + flex: 1, + child: InkWell( + onTap: () { + setState(() { + //beneficiaryType = Gender.Male; + }); + }, + child: ListTile( + title: Text("Delete the child "), + ), ), ) ], @@ -37,7 +40,15 @@ class _DeleteChildState extends State { SizedBox( height: 5.0, ), + + SizedBox( + height: 5.0, + ), + SizedBox( + height: 5.0, + ), Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 1, @@ -67,7 +78,7 @@ class _DeleteChildState extends State { flex: 1, child: InkWell( onTap: () { - widget.onTap(); + // widget.onValueSelected(beneficiaryType); Navigator.pop(context); }, child: Padding( diff --git a/lib/pages/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart index 68734c9a..c160acfb 100644 --- a/lib/pages/ChildVaccines/vaccinationtable_page.dart +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -1,181 +1,101 @@ -import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.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'; -import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'dialogs/ConfirmSendEmailDialog.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -class VaccinationTablePage extends StatelessWidget { - final List_BabyInformationModel babyInfo; - final List_UserInformationModel informationModel; - - const VaccinationTablePage({Key key, this.babyInfo, this.informationModel}) - : super(key: key); +import 'dialogs/SelectGenderDialog.dart'; +class VaccinationTablePage extends StatelessWidget { @override Widget build(BuildContext context) { var checkedValue; return BaseView( - onModelReady: (model) => model.getCreateVaccinationTable(babyInfo: babyInfo, informationModel: informationModel), + onModelReady: (model) => model.getCreateVaccinationTable(),//getUserTermsAndConditions(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, - appBarTitle: TranslationBase.of(context).vaccination, + appBarTitle: "Vaccination", body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 15, right: 15, top: 10), + child:Container( + margin: EdgeInsets.only(left: 15,right: 15,top: 70), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Column( - children: [ - Texts(TranslationBase.of(context).childName), - Texts( - babyInfo.babyName ?? '', - fontWeight: FontWeight.w600, - ), - ], - ), - ), - Expanded( - child: Column( - children: [ - Texts(TranslationBase.of(context).childDob), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - FontAwesomeIcons.calendarCheck, - color: Colors.red, - ), - SizedBox( - width: 15, - ), - Texts(DateUtil.yearMonthDay(babyInfo.dOB) ?? ''), - ], - ), - ], - ), - ), - ], - ), - SizedBox( - height: 15, - ), - Divider(), - Column( - children: [ - Row( - children: [ - Texts(TranslationBase.of(context).visit), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context) - .descriptionVaccination), - ], - ), + 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, + ), - Texts(TranslationBase.of(context).dueDate), - ], - ), - ], - ), - ...List.generate( - model.creteVaccinationTableModelList.length, - (index) => Container( - padding: EdgeInsets.all(12), - width: double.infinity, - child: Column( - children: [ - Row( + padding: EdgeInsets.all(12), + width: double.infinity, + child: Column( + children: [ - Texts(model - .creteVaccinationTableModelList[index].visit), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Html( - data: model - .creteVaccinationTableModelList[index] - .vaccinesDescription, - ), - ], - ), - ), - Texts(model - .creteVaccinationTableModelList[index].givenAt), + 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 ,), + ], - ), - Divider( - color: Colors.white, - height: 3, - thickness: 1.0, - ), - ], - ), - ), + ) + + + ) + ) ], ), - ), + ), - bottomSheet: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: TranslationBase.of(context).sendEmail, - onTap: () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: informationModel.emailAddress, - onTap: () async { - await model.getCreateVaccinationTable(babyInfo: babyInfo, informationModel: informationModel,isSendEmail: true); - AppToast.showSuccessToast(message: TranslationBase.of(context).emailSuccess,toastLength: Toast.LENGTH_LONG); - - }, - ), - ); - }, - ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), + label: "Send Email ", + // + onTap: () { + //SelectGenderDialog(); +//=============== + showDialog( + context: context, + child: SelectGenderDialog( + ), + ); + //========= + } + + ), ), ), diff --git a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart index 5bffe17c..d85971bb 100644 --- a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart @@ -1,11 +1,15 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/contactus/livechat_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -27,13 +31,14 @@ class _HospitalsLiveChatPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getLiveChatRequestOrders(), builder: (_, model, widget) => AppScaffold( baseViewModel: model, + isShowDecPage: false, body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(left: 15, right: 15), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -43,11 +48,11 @@ class _HospitalsLiveChatPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 20, + height: 70, ), Container( width: double.infinity, - height: 200, + height: 230, decoration: BoxDecoration( image: DecorationImage( image: ExactAssetImage( @@ -56,10 +61,29 @@ class _HospitalsLiveChatPageState extends State { ), child: Padding( padding: const EdgeInsets.all(8.0), - child: Texts( - 'You can now talk directly to the appointments department by chat or request a call back\n \nChoose Hospital :', - color: Colors.white, - textAlign: TextAlign.start, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: projectViewModel.isArabic? 10:20, + ), + Texts( + TranslationBase.of(context).instructions, + color: Colors.white, + textAlign: TextAlign.start, + ), + SizedBox( + height:projectViewModel.isArabic? 8:25, + ), + Texts( + TranslationBase.of(context) + .selectHospitalDec + + " :", + color: Colors.white, + fontWeight: FontWeight.w700, + textAlign: TextAlign.start, + ), + ], ), ), ), @@ -91,7 +115,7 @@ class _HospitalsLiveChatPageState extends State { borderRadius: BorderRadius.all( Radius.circular(5)), color: tappedIndex == index - ? Colors.red + ? Theme.of(context).primaryColor : Colors.white, ), child: Padding( @@ -104,8 +128,7 @@ class _HospitalsLiveChatPageState extends State { onTap: () { setState(() { tappedIndex = index; - chat = - "http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=en&WorkGroup=${model.LiveChatModelList[index].value}"; + chat = "http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=${projectViewModel.currentLanguage}&WorkGroup=${model.LiveChatModelList[index].value}"; }); }, child: Row( @@ -135,7 +158,8 @@ class _HospitalsLiveChatPageState extends State { .black, textAlign: TextAlign .center, - ))), //model.cOCItemList[index].cOCTitl + ))), + //model.cOCItemList[index].cOCTitl IconButton( icon: Icon( Icons.arrow_forward_ios, @@ -171,18 +195,19 @@ class _HospitalsLiveChatPageState 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(8.0), child: Center( child: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.07, width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label: 'ٍStart', + child: SecondaryButton( + label: TranslationBase.of(context).start, loading: model.state == ViewState.BusyLocal, + textColor: Colors.white, + disabled: chat.isEmpty, onTap: () { - print("chat=" + chat); launch(chat); }, ), diff --git a/lib/pages/ContactUs/LiveChat/livechat_page.dart b/lib/pages/ContactUs/LiveChat/livechat_page.dart index b870234a..a747db3d 100644 --- a/lib/pages/ContactUs/LiveChat/livechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/livechat_page.dart @@ -1,6 +1,8 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/pharmaciesLivechat_page.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'; @@ -16,9 +18,15 @@ class LiveChatPage extends StatefulWidget { class _LiveChatPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; + List imagesInfo = List(); + @override void initState() { super.initState(); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/1.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/2.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/2.png')); + _tabController = TabController(length: 2, vsync: this); } @@ -33,7 +41,10 @@ class _LiveChatPageState extends State Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Locations', + imagesInfo: imagesInfo, + title: TranslationBase.of(context).liveChat, + description: TranslationBase.of(context).infoChat, + appBarTitle: TranslationBase.of(context).service, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -71,25 +82,22 @@ class _LiveChatPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.tab, - - indicatorColor: Colors.red[800], + indicatorColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), + labelPadding: EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: Texts(' Hospitals '), + child: Texts(TranslationBase.of(context).hospitals), ), ), Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: Texts(' Pharmacies '), + child: Texts(TranslationBase.of(context).pharmacies), ), ), ], diff --git a/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart b/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart index cbda0828..c5300b5d 100644 --- a/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart @@ -1,12 +1,15 @@ import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/contactus/livechat_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -28,10 +31,11 @@ class _PhamaciesLiveChatPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getLiveChatRequestOrders(), builder: (_, model, widget) => AppScaffold( baseViewModel: model, + isShowDecPage: false, body: SingleChildScrollView( child: Container( margin: EdgeInsets.only(left: 15, right: 15), @@ -43,12 +47,9 @@ class _PhamaciesLiveChatPageState extends State { Container( width: double.infinity, height: 200, - decoration: BoxDecoration( - image: DecorationImage( - image: ExactAssetImage(''), fit: BoxFit.cover), - ), + child: Texts( - 'You can now talk directly to the pharmacist by chat or request a call back', + TranslationBase.of(context).instructionsPharmacies, color: Colors.black, textAlign: TextAlign.center, ), @@ -63,20 +64,20 @@ class _PhamaciesLiveChatPageState 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(8.0), child: Center( child: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.87, width: MediaQuery.of(context).size.width * 0.8, child: Button( - label: 'ٍStart', + label: TranslationBase.of(context).start, loading: model.state == ViewState.BusyLocal, onTap: () { print("chat=" + chat); chat = - "http://chat.dshmg.com:7788/EPharmacyChat/EIndex.aspx?CustomerID=undefined&Name=${model.user.firstName}&MobileNo=${model.user.mobileNumber}&Language=1"; + "http://chat.dshmg.com:7788/EPharmacyChat/EIndex.aspx?CustomerID=undefined&Name=${model.user.firstName}&MobileNo=${model.user.mobileNumber}&Language=${projectViewModel.isArabic? 1:2}"; launch(chat); }, ), diff --git a/lib/pages/ContactUs/findus/findus_page.dart b/lib/pages/ContactUs/findus/findus_page.dart index 807ac1c7..5cf59e21 100644 --- a/lib/pages/ContactUs/findus/findus_page.dart +++ b/lib/pages/ContactUs/findus/findus_page.dart @@ -81,7 +81,7 @@ class _FindUsPageState extends State //indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.red[800], + 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/findus/hospitrals_page.dart b/lib/pages/ContactUs/findus/hospitrals_page.dart index 7aa968a5..308dbeca 100644 --- a/lib/pages/ContactUs/findus/hospitrals_page.dart +++ b/lib/pages/ContactUs/findus/hospitrals_page.dart @@ -116,9 +116,9 @@ class _HospitalsPageState extends State { CrossAxisAlignment.center, children: [ IconButton( - // icon: Icon(Icons.location_on,color: Colors.red,), - icon: new Image.asset( - 'assets/images/new-design/navigate.png'), + icon: Icon(Icons.location_on,color: Theme.of(context).primaryColor,size: 35,), + // icon: new Image.asset( + // 'assets/images/new-design/navigate.png'), tooltip: '', onPressed: () { setState(() { @@ -139,9 +139,9 @@ class _HospitalsPageState extends State { }, ), IconButton( - // icon: Icon(Icons.phone,color: Colors.red,), - icon: new Image.asset( - 'assets/images/new-design/call.png'), + icon: Icon(Icons.phone,color: Theme.of(context).primaryColor,size: 35,), + // icon: new Image.asset( + // 'assets/images/new-design/call.png'), tooltip: '', onPressed: () { setState(() { diff --git a/lib/pages/ContactUs/findus/pharmacies_page.dart b/lib/pages/ContactUs/findus/pharmacies_page.dart index cab201e3..6cf94728 100644 --- a/lib/pages/ContactUs/findus/pharmacies_page.dart +++ b/lib/pages/ContactUs/findus/pharmacies_page.dart @@ -140,13 +140,7 @@ class _PharmaciesPageState extends State { child: Row( children: [ IconButton( - // icon: Icon( - // Icons - // .location_on, - // color: Colors.red, - // ), - icon: new Image.asset( - 'assets/images/new-design/navigate.png'), + icon: Icon(Icons.location_on,color: Theme.of(context).primaryColor,size: 35,), tooltip: '', onPressed: () { setState(() { @@ -163,21 +157,15 @@ class _PharmaciesPageState extends State { .findusPharmaciesModelList[ index] .locationName); - // _volume += 10; }); }, ), IconButton( - // icon: Icon( - // Icons.phone, - // color: Colors.red, - // ), - icon: new Image.asset( - 'assets/images/new-design/call.png'), + icon: Icon(Icons.phone,color: Theme.of(context).primaryColor,size: 35,), tooltip: 'I', onPressed: () { setState(() { - // _volume += 10; + launch("tel://" + widget .findusPharmaciesModelList[ diff --git a/lib/pages/ContactUs/widgets/card_common_contat.dart b/lib/pages/ContactUs/widgets/card_common_contat.dart index 67580dbf..cfb9108b 100644 --- a/lib/pages/ContactUs/widgets/card_common_contat.dart +++ b/lib/pages/ContactUs/widgets/card_common_contat.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -34,19 +35,16 @@ class CardCommonContact extends StatelessWidget { children: [ Container( margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), - child: Text(this.text, - overflow: TextOverflow.clip, - style: TextStyle( - color: new Color(0xFFc5272d), - letterSpacing: 1.0, - fontSize: 20.0)), + child: Texts(this.text, + // overflow: TextOverflow.clip, + color:Theme.of(context).primaryColor, + fontWeight: FontWeight.w700, + fontSize: 20.0), ), Container( margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Text(this.subText, - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), + child: Texts(this.subText, + color: Colors.black, fontSize: 15.0), ), Align( alignment: projectViewModel.isArabic? Alignment.bottomLeft:Alignment.bottomRight, diff --git a/lib/pages/DrawerPages/family/add-family-member.dart b/lib/pages/DrawerPages/family/add-family-member.dart index 084b43e6..35b19ccd 100644 --- a/lib/pages/DrawerPages/family/add-family-member.dart +++ b/lib/pages/DrawerPages/family/add-family-member.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; @@ -145,7 +144,7 @@ class _AddMember extends State { request.zipCode = countryCode; request.isRegister = false; request.patientStatus = 2; - GifLoaderDialogUtils.showMyDialog(context); + loading(true); familyFileProvider .addFamilyFile(request) .then((value) => manageFamily(value)) @@ -155,21 +154,18 @@ class _AddMember extends State { } manageFamily(addMemberResult) { - GifLoaderDialogUtils.hideDialog(context); - if(addMemberResult is String ==false){ - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: addMemberResult['ShareFamilyFileObj']['Message'], - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => { - insertFamilyData(addMemberResult), - ConfirmDialog.closeAlertDialog(context) - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - } - + loading(false); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: addMemberResult['ShareFamilyFileObj']['Message'], + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + insertFamilyData(addMemberResult), + ConfirmDialog.closeAlertDialog(context) + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); } insertFamilyData(addMemberResult) { diff --git a/lib/pages/DrawerPages/family/add-family_type.dart b/lib/pages/DrawerPages/family/add-family_type.dart index 2c85b043..33e39397 100644 --- a/lib/pages/DrawerPages/family/add-family_type.dart +++ b/lib/pages/DrawerPages/family/add-family_type.dart @@ -27,7 +27,7 @@ class AddFamilyMemberType extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( - 'assets/images/habib-logo.png', + 'assets/images/DQ/dq_logo_icon.png', height: 80, width: 80, ), @@ -75,7 +75,7 @@ class AddFamilyMemberType extends StatelessWidget { ), AppText( TranslationBase.of(context) - .idNo, + .nationalID, fontSize: SizeConfig .textMultiplier * 2, @@ -113,10 +113,9 @@ class AddFamilyMemberType extends StatelessWidget { AppText( TranslationBase.of(context) .fileNo, - textAlign: TextAlign.center, fontSize: SizeConfig .textMultiplier * - 1.8, + 2, ) ], ), diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 0e6d86bf..2d7e4270 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -1,12 +1,23 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; +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/project_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' + as list; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -16,130 +27,159 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:provider/provider.dart'; class MyFamily extends StatefulWidget { final bool isAppbarVisible; - MyFamily({this.isAppbarVisible =true}); + + MyFamily({this.isAppbarVisible = true}); + @override _MyFamily createState() => _MyFamily(); } class _MyFamily extends State with TickerProviderStateMixin { + List imagesInfo = List(); final familyFileProvider = FamilyFilesProvider(); AppSharedPreferences sharedPref = new AppSharedPreferences(); var userID; TabController _tabController; int _tabIndex = 0; + AuthenticatedUserObject authenticatedUserObject = + locator(); + AppointmentRateViewModel appointmentRateViewModel = + locator(); + ProjectViewModel projectViewModel; + AuthenticatedUser user; + VitalSignService _vitalSignService = locator(); + var isVaiable = false; @override void initState() { _tabController = new TabController(length: 2, vsync: this, initialIndex: 0); - + checkUserData(); super.initState(); } bool expandFlag = false; + Widget build(BuildContext context) { - return AppScaffold( - appBarTitle: TranslationBase.of(context).myFamilyFiles, - isShowAppBar: widget.isAppbarVisible, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.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, - ), + imagesInfo.add( + ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'), + ); + + imagesInfo.add( + ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'), + ); + projectViewModel = Provider.of(context); + return AppScaffold( + appBarTitle: TranslationBase.of(context).myFamilyFiles, + isShowAppBar: widget.isAppbarVisible, + imagesInfo: imagesInfo, + description: TranslationBase.of(context).familyInfo, + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.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: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.92, // 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.9), //width: 0.7 - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, - indicatorSize: TabBarIndicatorSize.tab, - - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: AppText(TranslationBase.of(context).family), - ), + ), + Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 0.92, + // 0.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.9), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + 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: 35.0, right: 35.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: AppText(TranslationBase.of(context).family), ), - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: AppText(TranslationBase.of(context).request), - ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: AppText(TranslationBase.of(context).request), ), - ], - ), + ), + ], ), ), ), - ], - ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - myFamilyDetails(context), - myFamilyRequest(context) - ], - ), - ) + ), ], ), ), - ); - - - + body: Column( + children: [ + Expanded( + child: (user != null && projectViewModel.isLogin) + ? TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + myFamilyDetails(context), + myFamilyRequest(context) + ], + ) + : Container(child: AppText('Loading..')), + ) + ], + ), + ), + ); return AppScaffold( appBarTitle: TranslationBase.of(context).myFamilyFiles, isShowAppBar: widget.isAppbarVisible, body: SingleChildScrollView( child: Container( - height: SizeConfig.screenHeight *.9, + height: SizeConfig.screenHeight * .9, width: SizeConfig.realScreenWidth, padding: EdgeInsets.all(20), child: Stack( @@ -148,11 +188,13 @@ class _MyFamily extends State with TickerProviderStateMixin { controller: _tabController, indicatorColor: Colors.red, tabs: [ - Tab( // padding: EdgeInsets.all(6), - child:AppText(TranslationBase.of(context).family)), Tab( // padding: EdgeInsets.all(6), - child:AppText(TranslationBase.of(context).request)), + child: AppText(TranslationBase.of(context).family)), + Tab( + // padding: EdgeInsets.all(6), + child: + AppText(TranslationBase.of(context).request)), ], ), TabBarView( @@ -169,7 +211,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget myFamilyDetails(context) { return Container( height: MediaQuery.of(context).size.height, - margin: EdgeInsets.fromLTRB(20.0, 0, 20.0, 0.0), + margin: EdgeInsets.fromLTRB(20.0, 25.0, 20.0, 0.0), child: Column( children: [ Expanded( @@ -188,7 +230,8 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text("No data found")); + child: Text( + TranslationBase.of(context).noDataAvailable)); else return Padding( padding: EdgeInsets.only(top: 50), @@ -286,13 +329,13 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget myFamilyRequest(context) { return //Padding( - // padding: const EdgeInsets.symmetric(horizontal: 10.0), - // child: - SingleChildScrollView( - child: Container( + // padding: const EdgeInsets.symmetric(horizontal: 10.0), + // child: + SingleChildScrollView( + child: Container( height: MediaQuery.of(context).size.height, - margin: EdgeInsets.only(top:65), - child: Column( + margin: EdgeInsets.only(top: 65), + child: Column( children: [ RoundedContainer( child: ExpansionTile( @@ -314,7 +357,8 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text('No data found')); + child: Text(TranslationBase.of(context) + .noDataAvailable)); else return Column( children: [ @@ -344,13 +388,29 @@ class _MyFamily extends State with TickerProviderStateMixin { // )), Column(children: [ Padding( - padding: EdgeInsets.only(left:10, right:10), child:Row(children: [ - Expanded(flex: 3, child: AppText('Name')), - Expanded(flex: 1, child: AppText('Allow')), - Expanded(flex: 1, child: AppText('Reject')), - ])), + padding: EdgeInsets.only( + left: 10, right: 10), + child: Row(children: [ + Expanded( + flex: 3, + child: AppText( + TranslationBase.of(context) + .theName)), + Expanded( + flex: 1, + child: AppText( + TranslationBase.of(context) + .allowView)), + Expanded( + flex: 1, + child: AppText( + TranslationBase.of(context) + .rejectView)), + ])), Column( - children:familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList + children: familyFileProvider + .allSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList .map((result) { return Padding( padding: EdgeInsets.all(10), @@ -369,7 +429,9 @@ class _MyFamily extends State with TickerProviderStateMixin { ), onPressed: () { acceptRemoveRequest( - result.iD, 3, context); + result.iD, + 3, + context); }, )), Expanded( @@ -381,7 +443,9 @@ class _MyFamily extends State with TickerProviderStateMixin { ), onPressed: () { acceptRemoveRequest( - result.iD,4, context); + result.iD, + 4, + context); }, )) ], @@ -416,12 +480,25 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text('No data found')); + child: Text(TranslationBase.of(context) + .noDataAvailable)); else - return SingleChildScrollView( - child: Container( - height: SizeConfig.screenHeight * .3, - child: ListView( + return Container( + height: SizeConfig.screenHeight * .3, + child: SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: EdgeInsets.only( + left: 10, right: 10), + child: Row(children: [ + Expanded( + flex: 3, + child: AppText( + TranslationBase.of(context) + .theName)) + ])), + Column( children: snapshot .data.getAllSharedRecordsByStatusList .map((result) { @@ -431,18 +508,25 @@ class _MyFamily extends State with TickerProviderStateMixin { children: [ Expanded( flex: 3, - child: - Text(result.patientName)), + child: Text( + result.patientName)), Expanded( flex: 2, child: AppText( result.statusDescription, - color: result.status==3 ? Colors.green: Colors.red, + color: result.status == 3 + ? Colors.green + : result.status == 2 + ? Colors + .yellow[800] + : Colors.red, )), ], )); }).toList(), - ))); + ) + ], + ))); } }) ], @@ -456,8 +540,8 @@ class _MyFamily extends State with TickerProviderStateMixin { children: [ FutureBuilder( future: getUserViewRequest(), // async work - builder: - (BuildContext context, AsyncSnapshot snapshot) { + builder: (BuildContext context, + AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: return Padding( @@ -467,64 +551,59 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text('No data found')); + child: Text(TranslationBase.of(context) + .noDataAvailable)); else return Column( children: [ - // Padding( - // padding:EdgeInsets.only(left:10, right:10), - // child: Row( - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // children: [ - // Expanded( - // flex: 3, - // child: AppText( - // TranslationBase.of(context).request), - // ), - // Expanded( - // flex: 2, - // child: AppText( - // TranslationBase.of(context).switchUser, - // )), - // Expanded( - // flex: 1, - // child: AppText( - // TranslationBase.of(context).deleteView, - // )), - // ], - // )), Column(children: [ - Padding( - padding:EdgeInsets.only(left:10, right:10), - child: Row(children: [ - Expanded(flex: 3, child: AppText('Name')), - Expanded(flex: 1, child: AppText('Delete')), - ])), + Padding( + padding: + EdgeInsets.only(left: 10, right: 10), + child: Row(children: [ + Expanded( + flex: 3, + child: AppText( + TranslationBase.of(context) + .theName)), + Expanded( + flex: 1, + child: AppText( + TranslationBase.of(context) + .deleteView)), + ])), Column( - children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList + children: familyFileProvider + .allSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: AppText(result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deactivateRequest(result.iD, - 5, context); - }, - )), - ], - )); + return result.status == 3 + ? Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: AppText( + result.patientName)), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + deactivateRequest( + result.iD, + 5, + context); + }, + )), + ], + )) + : Container( + child: AppText(isAvailable())); }).toList()) ]) ], @@ -539,13 +618,24 @@ class _MyFamily extends State with TickerProviderStateMixin { ); } - Future getFamilyFiles() async { - if (await sharedPref.getObject(FAMILY_FILE) != null) { - // print(await sharedPref.getObject(FAMILY_FILE)); - return Future.value(GetAllSharedRecordsByStatusResponse.fromJson( - await sharedPref.getObject(FAMILY_FILE))); + String isAvailable() { + if (isVaiable == false) { + this.isVaiable = true; + return TranslationBase.of(context).noDataAvailable; } else { - return familyFileProvider.getSharedRecordByStatus(); + return ""; + } + } + + Future getFamilyFiles() async { + if (user != null) { + if (await sharedPref.getObject(FAMILY_FILE) != null) { + // print(await sharedPref.getObject(FAMILY_FILE)); + return Future.value(GetAllSharedRecordsByStatusResponse.fromJson( + await sharedPref.getObject(FAMILY_FILE))); + } else { + return familyFileProvider.getSharedRecordByStatus(); + } } } @@ -593,25 +683,80 @@ class _MyFamily extends State with TickerProviderStateMixin { switchUser(user, context) { GifLoaderDialogUtils.showMyDialog(context); + // this + // .familyFileProvider + // .silentLoggin(user) + // .then((value) => loginAfter(value, context)); + + // Utils.showProgressDialog(context); this .familyFileProvider - .silentLoggin(user) - .then((value) => loginAfter(value, context)); + .silentLoggin(user is AuthenticatedUser ? null : user, + mainUser: user is AuthenticatedUser) + .then((value) { + _vitalSignService.heightCm = ""; + _vitalSignService.weightKg = ""; + loginAfter(value, context); + }).catchError((err) { + print(err); + AppToast.showErrorToast(message: err); + Navigator.of(context).pop(); + }); } - loginAfter(result, context) async{ - GifLoaderDialogUtils.hideDialog(context); + loginAfter(result, context) async { + //GifLoaderDialogUtils.hideDialog(context); + Provider.of(context, listen: false).setPrivilege(privilegeList: result,isLoginChild: true); + var currentLang = await sharedPref.getString(APP_LANGUAGE); + result = list.CheckActivationCode.fromJson(result); var familyFile = await sharedPref.getObject(FAMILY_FILE); - result = CheckActivationCode.fromJson(result); + var mainUser = await sharedPref.getObject(MAIN_USER); + var bloodType = await sharedPref.getString(BLOOD_TYPE); this.sharedPref.clear(); - this.sharedPref.setObject(FAMILY_FILE, familyFile); + if (mainUser["PatientID"] != result.list.patientID) { + result.list.isFamily = true; + } + this.sharedPref.setString(APP_LANGUAGE, currentLang); + this.sharedPref.setObject(MAIN_USER, mainUser); + this.sharedPref.setString(BLOOD_TYPE, bloodType); this.sharedPref.setObject(USER_PROFILE, result.list); + this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID); - //this.checkIfUserAgreedBefore(result), - Navigator.of(context).pushNamed( - HOME, - ); + await authenticatedUserObject.getUser(getUser: true); + Provider.of(context, listen: false).user = + authenticatedUserObject.user; + Provider.of(context, listen: false) + .setUser(authenticatedUserObject.user); + appointmentRateViewModel + .getIsLastAppointmentRatedList() + .then((value) => { + //getToDoCount(), + // Utils.hideProgressDialog(), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + } + }) + .catchError((err) { + print(err); + // Utils.hideProgressDialog(); + // GifLoaderDialogUtils.hideDialog(context); + }); } deactivateRequest(ID, status, context) { @@ -619,19 +764,30 @@ class _MyFamily extends State with TickerProviderStateMixin { Map request = {}; request["ID"] = ID; request["Status"] = status; - this.familyFileProvider.deactivateFamily(request).then((value) => { - GifLoaderDialogUtils.hideDialog(context), - refreshFamily(context) - }); + this.familyFileProvider.deactivateFamily(request).then((value) => + {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); } + acceptRemoveRequest(ID, status, context) { GifLoaderDialogUtils.showMyDialog(context); Map request = {}; request["ID"] = ID; request["Status"] = status; - this.familyFileProvider.acceptRejectFamily(request).then((value) => { - GifLoaderDialogUtils.hideDialog(context), - refreshFamily(context) - }); + this.familyFileProvider.acceptRejectFamily(request).then((value) => + {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); + } + + checkUserData() async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + + var data2 = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(MAIN_USER)); + print(data2); + setState(() { + this.user = data; + }); + } } } diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index 413d80e6..1690254a 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -24,6 +25,7 @@ class AmbulanceReq extends StatefulWidget { class _AmbulanceReqState extends State with SingleTickerProviderStateMixin { TabController _tabController; + List imagesInfo = List(); @override void initState() { @@ -39,11 +41,19 @@ class _AmbulanceReqState extends State @override Widget build(BuildContext context) { + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/Ambulance/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/Ambulance/ar/0.png')); + return BaseView( onModelReady: (model) => model.getAmRequestOrders(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: "Ambulance Request", + appBarTitle: TranslationBase.of(context).transportationService, + description: TranslationBase.of(context).infoAmbulance, + imagesInfo: imagesInfo, baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, @@ -92,8 +102,7 @@ class _AmbulanceReqState extends State Container( width: MediaQuery.of(context).size.width * 0.40, child: Center( - child: Texts( - "Ambulance Request"), //TranslationBase.of(context).prescriptions + child: Texts(TranslationBase.of(context).transportationService), ), ), Container( @@ -118,8 +127,8 @@ class _AmbulanceReqState extends State controller: _tabController, children: [ AmbulanceRequestIndexPage( - amRequestViewModel: model, - ), + amRequestViewModel: model, + ), OrderLogPage( amRequestViewModel: model, ) diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 109af9d1..17b6d57b 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -1,11 +1,17 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookConfirm.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/DocAvailableAppointments.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/material.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import 'widgets/AppointmentActions.dart'; @@ -26,46 +32,51 @@ class _AppointmentDetailsState extends State with SingleTickerProviderStateMixin { static TabController _tabController; + List doctorDetailsList = List(); + @override void initState() { _tabController = new TabController(length: 2, vsync: this); + AppointmentDetails.showFooterButton = false; super.initState(); } + @override void dispose() { - // TODO: implement dispose super.dispose(); _tabController.dispose(); + AppointmentDetails.showFooterButton = false; } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: widget.appo.doctorNameObj, isShowAppBar: true, bottomSheet: AppointmentDetails.showFooterButton ? Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: goToBookConfirm, - child: Text(TranslationBase.of(context).bookNow, - style: TextStyle(fontSize: 18.0)), - ), - ), - ) + width: MediaQuery.of(context).size.width, + height: 50.0, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: goToBookConfirm, + child: Text(TranslationBase.of(context).bookNow, + style: TextStyle(fontSize: 18.0)), + ), + ), + ) : null, body: Container( color: new Color(0xFFf6f6f6), @@ -88,7 +99,8 @@ class _AppointmentDetailsState extends State ), ), Container( - margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), + margin: + EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), alignment: Alignment.center, child: Text( widget.appo.doctorTitle + @@ -103,7 +115,7 @@ class _AppointmentDetailsState extends State Container( margin: EdgeInsets.only(top: 10.0), alignment: Alignment.center, - child: Text(widget.appo.clinicName, + child: Text(getDoctorSpeciality(widget.appo.doctorSpeciality), style: TextStyle( fontSize: 12.0, color: Colors.grey[900], @@ -123,19 +135,37 @@ class _AppointmentDetailsState extends State emptyIcon: Icons.star, ), ), + InkWell( + onTap: () { + getDoctorRatingsDetails(); + }, + child: Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: Text( + "(" + + widget.appo.noOfPatientsRate.toString() + + " " + + TranslationBase.of(context).reviews + + ")", + style: TextStyle( + fontSize: 14.0, + color: Colors.blue[800], + letterSpacing: 1.0, + decoration: TextDecoration.underline, + )), + ), + ), Container( - margin: EdgeInsets.only(top: 5.0), alignment: Alignment.center, - child: Text( - "(" + - widget.appo.noOfPatientsRate.toString() + - " Reviews)", - style: TextStyle( - fontSize: 14.0, - color: Colors.blue[800], - letterSpacing: 1.0, - decoration: TextDecoration.underline, - )), + child: Text(DateUtil.getWeekDayMonthDayYearDateFormatted( + DateUtil.convertStringToDate( + widget.appo.appointmentDate), + projectViewModel.isArabic ? "ar" : "en")), + ), + Container( + alignment: Alignment.center, + child: Text(widget.appo.startTime.substring(0, 5)), ), Container( margin: EdgeInsets.only(top: 10.0), @@ -171,8 +201,14 @@ class _AppointmentDetailsState extends State child: TabBarView( physics: NeverScrollableScrollPhysics(), children: [ - AppointmentActions(appo: widget.appo, tabController: _tabController, enableFooterButton: enableFooterButton), - DocAvailableAppointments(doctor: getDoctorObject(), isLiveCareAppointment: widget.appo.isLiveCareAppointment) + AppointmentActions( + appo: widget.appo, + tabController: _tabController, + enableFooterButton: enableFooterButton), + DocAvailableAppointments( + doctor: getDoctorObject(), + isLiveCareAppointment: + widget.appo.isLiveCareAppointment) ], controller: _tabController, ), @@ -203,12 +239,296 @@ class _AppointmentDetailsState extends State MaterialPageRoute( builder: (context) => BookConfirm( doctor: getDoctorObject(), - isLiveCareAppointment: widget.appo.isLiveCareAppointment, selectedDate: DocAvailableAppointments.selectedDate, selectedTime: DocAvailableAppointments.selectedTime))); } + getDoctorRatingsDetails() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service.getDoctorsRatingDetails(widget.appo.doctorID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + doctorDetailsList.clear(); + res['DoctorRatingDetailsList'].forEach((v) { + doctorDetailsList.add(new DoctorRateDetails.fromJson(v)); + }); + showRatingDialog(doctorDetailsList); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + void showRatingDialog(List doctorDetailsList) { + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + // height: 400.0, + width: MediaQuery.of(context).size.width * 0.8, + color: Colors.white, + child: Column( + children: [ + Container( + alignment: Alignment.center, + width: MediaQuery.of(context).size.width, + color: Theme.of(context).primaryColor, + margin: EdgeInsets.only(bottom: 5.0), + padding: EdgeInsets.all(10.0), + child: Text( + TranslationBase.of(context).doctorRating, + style: TextStyle( + fontSize: 22.0, color: Colors.white))), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Text( + this + .widget + .appo + .actualDoctorRate + .ceilToDouble() + .toString(), + style: TextStyle( + fontSize: 32.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: RatingBar.readOnly( + initialRating: + this.widget.appo.actualDoctorRate.toDouble(), + size: 35.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(top: 10.0), + child: Text( + this.widget.appo.noOfPatientsRate.toString() + + " " + + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 14.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).excellent, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[0].patientNumber), + height: 6.0, + child: Container( + color: Colors.green[700], + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).v_good, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[1].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffB7B723), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).good, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[2].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEBA727), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).average, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[3].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEB7227), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context) + .below_average, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[4].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffE20C0C), + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 40.0), + child: Divider()), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Align( + alignment: FractionalOffset.bottomCenter, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 40.0, + child: RaisedButton( + elevation: 0.0, + color: Colors.white, + textColor: Colors.red, + hoverColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text( + TranslationBase.of(context).cancel, + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); + } + + double getRatingWidth(int patientNumber) { + var width = (patientNumber / this.widget.appo.noOfPatientsRate) * 100; + return width; + } + + String getDate(String date) { + DateTime dateObj = DateUtil.convertStringToDate(date); + return DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString(); + } + + String getDoctorSpeciality(List docSpecial) { + String docSpeciality = ""; + docSpecial.forEach((v) { + docSpeciality = docSpeciality + v + " "; + }); + return docSpeciality; + } DoctorList getDoctorObject() { DoctorList docObj = new DoctorList(); diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 95485da5..a49149b5 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -1,4 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -27,6 +29,10 @@ class MyAppointments extends StatefulWidget { List(); List _patientArrivedAppointmentListHospital = List(); + List _patientBookedAppointmentListClinic = List(); + List _patientConfirmedAppointmentListClinic = List(); + List _patientArrivedAppointmentListClinic = List(); + @override _MyAppointmentsState createState() => _MyAppointmentsState(); } @@ -40,12 +46,28 @@ class _MyAppointmentsState extends State AuthenticatedUserObject authenticatedUserObject = locator(); + List imagesInfo = List(); + + FilterType filterType; + @override void initState() { _tabController = new TabController(length: 3, vsync: this); + filterType = FilterType.Clinic; WidgetsBinding.instance.addPostFrameCallback((_) { - if (Provider.of(context, listen: false).isLogin) getPatientAppointmentHistory(); + if (Provider.of(context, listen: false).isLogin) + getPatientAppointmentHistory(); }); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/0.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/1.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/1.png')); super.initState(); } @@ -54,6 +76,8 @@ class _MyAppointmentsState extends State return AppScaffold( appBarTitle: TranslationBase.of(context).myAppointments, isShowAppBar: true, + imagesInfo: imagesInfo, + description: TranslationBase.of(context).infoMyAppointments, body: Container( child: Column(children: [ TabBar( @@ -68,17 +92,55 @@ class _MyAppointmentsState extends State color: Colors.grey[600], thickness: 0.5, ), - Expanded( - child: new TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - isDataLoaded ? getBookedAppointments() : Container(), - isDataLoaded ? getConfirmedAppointments() : Container(), - isDataLoaded ? getArrivedAppointments() : Container() - ], - controller: _tabController, - ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () => setFilterType(FilterType.Clinic), + child: ListTile( + title: Text(TranslationBase.of(context).clinic), + leading: Radio( + value: FilterType.Clinic, + groupValue: filterType, + activeColor: Theme.of(context).primaryColor, + onChanged: (FilterType value) { + setFilterType(value); + }, + ), + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => setFilterType(FilterType.Hospital), + child: ListTile( + title: Text(TranslationBase.of(context).hospital), + leading: Radio( + value: FilterType.Hospital, + groupValue: filterType, + activeColor: Theme.of(context).primaryColor, + onChanged: (FilterType value) => setFilterType(value), + ), + ), + ), + ) + ], ), + isDataLoaded + ? Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + getBookedAppointments(), + getConfirmedAppointments(), + getArrivedAppointments() + ], + controller: _tabController, + ), + ) + : Container(), ]), ), ); @@ -96,24 +158,30 @@ class _MyAppointmentsState extends State widget._patientConfirmedAppointmentListHospital.clear(); widget._patientArrivedAppointmentListHospital.clear(); + widget._patientBookedAppointmentListClinic.clear(); + widget._patientConfirmedAppointmentListClinic.clear(); + widget._patientArrivedAppointmentListClinic.clear(); + service.getPatientAppointmentHistory(false, context).then((res) { print(res['AppoimentAllHistoryResultList'].length); - if (res['MessageStatus'] == 1) { - GifLoaderDialogUtils.hideDialog(context); - setState(() { + GifLoaderDialogUtils.hideDialog(context); + setState(() { + if (res['MessageStatus'] == 1) { + // setState(() { if (res['AppoimentAllHistoryResultList'].length != 0) { + // isDataLoaded = true; res['AppoimentAllHistoryResultList'].forEach((v) { widget.appoList .add(new AppoitmentAllHistoryResultList.fromJson(v)); }); sortAppointmentList(); - openAppointmentsTab(); - isDataLoaded = true; } else {} - }); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } + // }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + isDataLoaded = true; + }); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); @@ -150,11 +218,31 @@ class _MyAppointmentsState extends State }); widget.bookedAppoList.forEach((element) { + List doctorByClinic = + widget._patientBookedAppointmentListClinic + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByClinic.length != 0) { + widget + ._patientBookedAppointmentListClinic[widget + ._patientBookedAppointmentListClinic + .indexOf(doctorByClinic[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientBookedAppointmentListClinic.add(PatientAppointmentList( + filterName: element.clinicName, patientDoctorAppointment: element)); + } + List doctorByHospital = widget._patientBookedAppointmentListHospital .where( (elementClinic) => - elementClinic.filterName == element.clinicName, + elementClinic.filterName == element.projectName, ) .toList(); @@ -167,16 +255,39 @@ class _MyAppointmentsState extends State .add(element); } else { widget._patientBookedAppointmentListHospital.add(PatientAppointmentList( - filterName: element.clinicName, patientDoctorAppointment: element)); + filterName: element.projectName, + patientDoctorAppointment: element)); } }); widget.confirmedAppoList.forEach((element) { + List doctorByClinic = + widget._patientConfirmedAppointmentListClinic + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByClinic.length != 0) { + widget + ._patientConfirmedAppointmentListClinic[widget + ._patientConfirmedAppointmentListClinic + .indexOf(doctorByClinic[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientConfirmedAppointmentListClinic.add( + PatientAppointmentList( + filterName: element.clinicName, + patientDoctorAppointment: element)); + } + List doctorByHospital = widget._patientConfirmedAppointmentListHospital .where( (elementClinic) => - elementClinic.filterName == element.clinicName, + elementClinic.filterName == element.projectName, ) .toList(); @@ -190,17 +301,37 @@ class _MyAppointmentsState extends State } else { widget._patientConfirmedAppointmentListHospital.add( PatientAppointmentList( - filterName: element.clinicName, + filterName: element.projectName, patientDoctorAppointment: element)); } }); widget.arrivedAppoList.forEach((element) { + List doctorByClinic = + widget._patientArrivedAppointmentListClinic + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByClinic.length != 0) { + widget + ._patientArrivedAppointmentListClinic[widget + ._patientArrivedAppointmentListClinic + .indexOf(doctorByClinic[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList( + filterName: element.clinicName, patientDoctorAppointment: element)); + } + List doctorByHospital = widget._patientArrivedAppointmentListHospital .where( (elementClinic) => - elementClinic.filterName == element.clinicName, + elementClinic.filterName == element.projectName, ) .toList(); @@ -214,9 +345,11 @@ class _MyAppointmentsState extends State } else { widget._patientArrivedAppointmentListHospital.add( PatientAppointmentList( - filterName: element.clinicName, + filterName: element.projectName, patientDoctorAppointment: element)); } + + openAppointmentsTab(); }); } @@ -230,11 +363,11 @@ class _MyAppointmentsState extends State } else if (flag == 3) { _tabController.index = 2; } else { - if (widget._patientBookedAppointmentListHospital.length != 0) { + if (widget._patientBookedAppointmentListClinic.length != 0) { _tabController.index = 0; - } else if (widget._patientConfirmedAppointmentListHospital.length != 0) { + } else if (widget._patientConfirmedAppointmentListClinic.length != 0) { _tabController.index = 1; - } else if (widget._patientArrivedAppointmentListHospital.length != 0) { + } else if (widget._patientArrivedAppointmentListClinic.length != 0) { _tabController.index = 2; return; } @@ -250,24 +383,42 @@ class _MyAppointmentsState extends State child: Column( children: [ ...List.generate( - widget._patientBookedAppointmentListHospital.length, + filterType == FilterType.Clinic + ? widget._patientBookedAppointmentListClinic.length + : widget._patientBookedAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget - ._patientBookedAppointmentListHospital[index] - .filterName, + title: filterType == FilterType.Clinic + ? widget + ._patientBookedAppointmentListClinic[index] + .filterName + : widget + ._patientBookedAppointmentListHospital[index] + .filterName, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientBookedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), + children: filterType == FilterType.Clinic + ? widget + ._patientBookedAppointmentListClinic[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList() + : widget + ._patientBookedAppointmentListHospital[ + index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), )), ) ], @@ -283,7 +434,7 @@ class _MyAppointmentsState extends State "assets/images/new-design/noAppointmentIcon.png"), Container( margin: EdgeInsets.only(top: 10.0), - child: Text("No Booked Appointments", + child: Text(TranslationBase.of(context).noBookedAppo, style: TextStyle( fontSize: 16.0, )), @@ -305,24 +456,43 @@ class _MyAppointmentsState extends State child: Column( children: [ ...List.generate( - widget._patientConfirmedAppointmentListHospital.length, + filterType == FilterType.Clinic + ? widget._patientConfirmedAppointmentListClinic.length + : widget + ._patientConfirmedAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget - ._patientConfirmedAppointmentListHospital[index] - .filterName, + title: filterType == FilterType.Clinic + ? widget + ._patientConfirmedAppointmentListClinic[index] + .filterName + : widget + ._patientConfirmedAppointmentListHospital[index] + .filterName, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientConfirmedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), + children: filterType == FilterType.Clinic + ? widget + ._patientConfirmedAppointmentListClinic[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList() + : widget + ._patientConfirmedAppointmentListHospital[ + index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), )), ) ], @@ -338,8 +508,7 @@ class _MyAppointmentsState extends State Image.asset("assets/images/new-design/noAppointmentIcon.png"), Container( margin: EdgeInsets.only(top: 10.0), - child: Text( - TranslationBase.of(context).noConfirmedAppointments, + child: Text(TranslationBase.of(context).noConfirmedAppo, style: TextStyle( fontSize: 16.0, )), @@ -359,24 +528,38 @@ class _MyAppointmentsState extends State child: Column( children: [ ...List.generate( - widget._patientArrivedAppointmentListHospital.length, + filterType == FilterType.Clinic + ? widget._patientArrivedAppointmentListClinic.length + : widget._patientArrivedAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget - ._patientArrivedAppointmentListHospital[index] - .filterName, + title: filterType == FilterType.Clinic + ? widget._patientArrivedAppointmentListClinic[index] + .filterName + : widget._patientArrivedAppointmentListHospital[index] + .filterName, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientArrivedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), + children: filterType == FilterType.Clinic + ? widget._patientArrivedAppointmentListClinic[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList() + : widget + ._patientArrivedAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), ), ), ) @@ -393,15 +576,20 @@ class _MyAppointmentsState extends State Image.asset("assets/images/new-design/noAppointmentIcon.png"), Container( margin: EdgeInsets.only(top: 10.0), - child: - Text(TranslationBase.of(context).noArrivedAppointments, - style: TextStyle( - fontSize: 16.0, - )), + child: Text(TranslationBase.of(context).noArrivedAppo, + style: TextStyle( + fontSize: 16.0, + )), ), ], ), ), ); } + + setFilterType(FilterType filterType) { + setState(() { + this.filterType = filterType; + }); + } } diff --git a/lib/pages/MyAppointments/VisitTicket.dart b/lib/pages/MyAppointments/VisitTicket.dart index 54dcf13f..6f1dbdf8 100644 --- a/lib/pages/MyAppointments/VisitTicket.dart +++ b/lib/pages/MyAppointments/VisitTicket.dart @@ -2,11 +2,11 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; class VisitTicket extends StatefulWidget { List appoList = []; @@ -48,9 +48,10 @@ class _VisitTicketState extends State { } getPatientAppointmentCurfewHistory(BuildContext context) { - loading(true); DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); service.getPatientAppointmentHistory(true, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res['AppoimentAllHistoryResultList']); if (res['MessageStatus'] == 1) { setState(() { @@ -61,20 +62,13 @@ class _VisitTicketState extends State { }); } else {} }); - loading(false); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - loading(false); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); - loading(false); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); - } - - loading(bool flag) { - setState(() { - isLoading = flag; }); } } diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index a89253c6..136bd30f 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -2,34 +2,28 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class ArrivedButtons { - static var buttons = [ + var buttons = [ { - "title": "Arrived", - "subtitle": "Status", - "icon": "assets/images/new-design/waiting-room.png", - "caller": "openReschedule" - }, - { - "title": "Medicines", - "subtitle": "Prescriptions", + "title": TranslationBase.of(AppGlobal.context).medicines, + "subtitle": TranslationBase.of(AppGlobal.context).medicinesSubtitle, "icon": "assets/images/new-design/medicine_prescriptions_icon.png", "caller": "prescriptions" }, { - "title": "Radiology", - "subtitle": "Services", + "title": TranslationBase.of(AppGlobal.context).radiology, + "subtitle": TranslationBase.of(AppGlobal.context).radiologySubtitle, "icon": "assets/images/new-design/radiology_service_icon.png", "caller": "radiology" }, { - "title": "Lab", - "subtitle": "Result", + "title": TranslationBase.of(AppGlobal.context).lab, + "subtitle": TranslationBase.of(AppGlobal.context).labSubtitle, "icon": "assets/images/new-design/lab_result_icon.png", "caller": "labResult" }, { - "title": "Vital Signs", - "subtitle": "Values", + "title": TranslationBase.of(AppGlobal.context).vitalSigns, + "subtitle": TranslationBase.of(AppGlobal.context).vitalSignsSubtitle, "icon": "assets/images/new-design/vital_signs.png", "caller": "VitalSigns" }, @@ -40,22 +34,22 @@ class ArrivedButtons { "caller": "insertComplaint" }, { - "title": "Insurance", - "subtitle": "Approvals", + "title": TranslationBase.of(AppGlobal.context).insuranceApproval, + "subtitle": TranslationBase.of(AppGlobal.context).insuranceSubtitle, "icon": "assets/images/new-design/insurance_approvals_icon.png", "caller": "Insurance" }, { - "title": "Ask Your", - "subtitle": "Doctor", + "title": TranslationBase.of(AppGlobal.context).askDoctor, + "subtitle": TranslationBase.of(AppGlobal.context).askYourSubtitle, "icon": "assets/images/new-design/ask_doctor_icon.png", "caller": "askDoc" }, { - "title": "Survey", - "subtitle": "Service", + "title": TranslationBase.of(AppGlobal.context).appoSurvey, + "subtitle": TranslationBase.of(AppGlobal.context).service, "icon": "assets/images/new-design/survey.png", "caller": "Survey" } ]; -} +} \ No newline at end of file diff --git a/lib/pages/MyAppointments/models/BookedButtons.dart b/lib/pages/MyAppointments/models/BookedButtons.dart index 1a76be63..709b3b1f 100644 --- a/lib/pages/MyAppointments/models/BookedButtons.dart +++ b/lib/pages/MyAppointments/models/BookedButtons.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class BookedButtons { - static var buttons = [ + var buttons = [ { "title": TranslationBase.of(AppGlobal.context).confirm, "subtitle": TranslationBase.of(AppGlobal.context).appointment, diff --git a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart index 374ebf45..9548b7c8 100644 --- a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class BookedButtonsAllowCheckIn { - static var buttons = [ + var buttons = [ { "title": TranslationBase.of(AppGlobal.context).confirm, "subtitle": TranslationBase.of(AppGlobal.context).appointment, diff --git a/lib/pages/MyAppointments/models/ConfirmedButtons.dart b/lib/pages/MyAppointments/models/ConfirmedButtons.dart index d5b7836e..b02021c7 100644 --- a/lib/pages/MyAppointments/models/ConfirmedButtons.dart +++ b/lib/pages/MyAppointments/models/ConfirmedButtons.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class ConfirmedButtons { - static var buttons = [ + var buttons = [ { "title": TranslationBase.of(AppGlobal.context).reschedule, "subtitle": TranslationBase.of(AppGlobal.context).appointment, diff --git a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart index 1368e3f3..07ba333e 100644 --- a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class ConfirmedButtonsAllowCheckIn { - static var buttons = [ + var buttons = [ { "title": TranslationBase.of(AppGlobal.context).reschedule, "subtitle": TranslationBase.of(AppGlobal.context).appointment, diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 7bb45bad..60035ee1 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart'; @@ -14,9 +17,11 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.d import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; +import 'package:diplomaticquarterapp/pages/medical/labs/laboratory_result_page.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_page.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.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'; @@ -24,6 +29,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class AppointmentActions extends StatefulWidget { @@ -44,6 +50,8 @@ class AppointmentActions extends StatefulWidget { class _AppointmentActionsState extends State { List appoButtonsList = []; + ToDoCountProviderModel toDoProvider; + @override void initState() { _getAppointmentActionButtons(); @@ -52,8 +60,12 @@ class _AppointmentActionsState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + toDoProvider = Provider.of(context); var size = MediaQuery.of(context).size; - final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; + final double itemHeight = projectViewModel.isArabic + ? ((size.height - kToolbarHeight - 24) * 0.5) / 2 + : ((size.height - kToolbarHeight - 24) * 0.45) / 2; final double itemWidth = size.width / 2; return Container( @@ -72,51 +84,62 @@ class _AppointmentActionsState extends State { onTap: () { _handleButtonClicks(e); }, - child: Container( - height: 100.0, - margin: EdgeInsets.all(9.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.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - margin: - EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), - child: Text(e.title, - overflow: TextOverflow.clip, - style: TextStyle( - color: new Color(0xFF40ACC9), - letterSpacing: 1.0, - fontSize: 20.0)), - ), - Container( - margin: - EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Text(e.subtitle, - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.black, - letterSpacing: 1.0, - fontSize: 15.0)), - ), - Container( - alignment: Alignment.bottomRight, - margin: - EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 7.0), - child: Image.asset(e.icon, - width: 45.0, height: 45.0), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + // height: 100.0, + margin: EdgeInsets.all(7.0), + padding: EdgeInsets.only(bottom: 4.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.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + margin: + EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0), + child: Text(e.title, + overflow: TextOverflow.clip, + style: TextStyle( + color: new Color(0xFF40ACC9), + letterSpacing: 1.0, + fontSize: 18.0)), + ), + Container( + margin: + EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), + child: Text(e.subtitle, + overflow: TextOverflow.clip, + style: TextStyle( + color: Colors.black, + letterSpacing: 1.0, + fontSize: 15.0)), + ), + Container( + alignment: projectViewModel.isArabic + ? Alignment.bottomLeft + : Alignment.bottomRight, + margin: projectViewModel.isArabic + ? EdgeInsets.fromLTRB( + 10.0, 7.0, 0.0, 8.0) + : EdgeInsets.fromLTRB( + 0.0, 7.0, 10.0, 8.0), + child: Image.asset(e.icon, + width: 45.0, height: 45.0), + ), + ], ), - ], - ), + ), + ], ), )) .toList(), @@ -175,6 +198,10 @@ class _AppointmentActionsState extends State { openAppointmentRadiology(); break; + case "labResult": + openAppointmentLabResults(); + break; + case "prescriptions": openPrescriptionReport(); break; @@ -249,14 +276,15 @@ class _AppointmentActionsState extends State { Future> _getBookedAppoActionsList() async { print("_getBookedAppoActionsList"); - print(BookedButtons.buttons); + BookedButtons bookedButtons = new BookedButtons(); + print(bookedButtons.buttons); List buttonsList = []; - for (var i = 0; i < BookedButtons.buttons.length; i++) { + for (var i = 0; i < bookedButtons.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: BookedButtons.buttons[i]['title'], - subtitle: BookedButtons.buttons[i]['subtitle'], - icon: BookedButtons.buttons[i]['icon'], - caller: BookedButtons.buttons[i]['caller'], + title: bookedButtons.buttons[i]['title'], + subtitle: bookedButtons.buttons[i]['subtitle'], + icon: bookedButtons.buttons[i]['icon'], + caller: bookedButtons.buttons[i]['caller'], )); } setState(() { @@ -266,14 +294,16 @@ class _AppointmentActionsState extends State { Future> _getBookedCheckInAppoActionsList() async { print("_getBookedCheckInAppoActionsList"); - print(BookedButtonsAllowCheckIn.buttons); + BookedButtonsAllowCheckIn bookedButtonsAllowCheckIn = + new BookedButtonsAllowCheckIn(); + print(bookedButtonsAllowCheckIn.buttons); List buttonsList = []; - for (var i = 0; i < BookedButtonsAllowCheckIn.buttons.length; i++) { + for (var i = 0; i < bookedButtonsAllowCheckIn.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: BookedButtonsAllowCheckIn.buttons[i]['title'], - subtitle: BookedButtonsAllowCheckIn.buttons[i]['subtitle'], - icon: BookedButtonsAllowCheckIn.buttons[i]['icon'], - caller: BookedButtonsAllowCheckIn.buttons[i]['caller'], + title: bookedButtonsAllowCheckIn.buttons[i]['title'], + subtitle: bookedButtonsAllowCheckIn.buttons[i]['subtitle'], + icon: bookedButtonsAllowCheckIn.buttons[i]['icon'], + caller: bookedButtonsAllowCheckIn.buttons[i]['caller'], )); } setState(() { @@ -283,14 +313,15 @@ class _AppointmentActionsState extends State { Future> _getConfirmedAppoActionsList() async { print("_getConfirmedAppoActionsList"); - print(ConfirmedButtons.buttons); + ConfirmedButtons confirmedButtons = new ConfirmedButtons(); + print(confirmedButtons.buttons); List buttonsList = []; - for (var i = 0; i < ConfirmedButtons.buttons.length; i++) { + for (var i = 0; i < confirmedButtons.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: ConfirmedButtons.buttons[i]['title'], - subtitle: ConfirmedButtons.buttons[i]['subtitle'], - icon: ConfirmedButtons.buttons[i]['icon'], - caller: ConfirmedButtons.buttons[i]['caller'], + title: confirmedButtons.buttons[i]['title'], + subtitle: confirmedButtons.buttons[i]['subtitle'], + icon: confirmedButtons.buttons[i]['icon'], + caller: confirmedButtons.buttons[i]['caller'], )); } setState(() { @@ -300,14 +331,16 @@ class _AppointmentActionsState extends State { Future> _getConfirmedCheckInAppoActionsList() async { print("_getConfirmedAllowCheckInAppoActionsList"); - print(ConfirmedButtonsAllowCheckIn.buttons); + ConfirmedButtonsAllowCheckIn confirmedButtonsAllowCheckIn = + new ConfirmedButtonsAllowCheckIn(); + print(confirmedButtonsAllowCheckIn.buttons); List buttonsList = []; - for (var i = 0; i < ConfirmedButtonsAllowCheckIn.buttons.length; i++) { + for (var i = 0; i < confirmedButtonsAllowCheckIn.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: ConfirmedButtonsAllowCheckIn.buttons[i]['title'], - subtitle: ConfirmedButtonsAllowCheckIn.buttons[i]['subtitle'], - icon: ConfirmedButtonsAllowCheckIn.buttons[i]['icon'], - caller: ConfirmedButtonsAllowCheckIn.buttons[i]['caller'], + title: confirmedButtonsAllowCheckIn.buttons[i]['title'], + subtitle: confirmedButtonsAllowCheckIn.buttons[i]['subtitle'], + icon: confirmedButtonsAllowCheckIn.buttons[i]['icon'], + caller: confirmedButtonsAllowCheckIn.buttons[i]['caller'], )); } setState(() { @@ -317,14 +350,15 @@ class _AppointmentActionsState extends State { Future> _getArrivedAppoActionsList() async { print("_getArrivedAppoActionsList"); - print(ArrivedButtons.buttons); + ArrivedButtons arrivedButtons = new ArrivedButtons(); + print(arrivedButtons.buttons); List buttonsList = []; - for (var i = 0; i < ArrivedButtons.buttons.length; i++) { + for (var i = 0; i < arrivedButtons.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: ArrivedButtons.buttons[i]['title'], - subtitle: ArrivedButtons.buttons[i]['subtitle'], - icon: ArrivedButtons.buttons[i]['icon'], - caller: ArrivedButtons.buttons[i]['caller'], + title: arrivedButtons.buttons[i]['title'], + subtitle: arrivedButtons.buttons[i]['subtitle'], + icon: arrivedButtons.buttons[i]['icon'], + caller: arrivedButtons.buttons[i]['caller'], )); } setState(() { @@ -334,14 +368,14 @@ class _AppointmentActionsState extends State { Future> _getArrivedInvoiceAppoActionsList() async { print("_getArrivedInvoiceAppoActionsList"); - print(ArrivedButtons.buttons); + ArrivedButtons arrivedButtons = new ArrivedButtons(); List buttonsList = []; - for (var i = 0; i < ArrivedButtons.buttons.length; i++) { + for (var i = 0; i < arrivedButtons.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: ArrivedButtons.buttons[i]['title'], - subtitle: ArrivedButtons.buttons[i]['subtitle'], - icon: ArrivedButtons.buttons[i]['icon'], - caller: ArrivedButtons.buttons[i]['caller'], + title: arrivedButtons.buttons[i]['title'], + subtitle: arrivedButtons.buttons[i]['subtitle'], + icon: arrivedButtons.buttons[i]['icon'], + caller: arrivedButtons.buttons[i]['caller'], )); } setState(() { @@ -357,6 +391,7 @@ class _AppointmentActionsState extends State { GifLoaderDialogUtils.hideDialog(context); print(res); if (res['MessageStatus'] == 1) { + getToDoCount(); AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); Navigator.of(context).pop(); } else { @@ -368,6 +403,49 @@ class _AppointmentActionsState extends State { }); } + getToDoCount() { + toDoProvider.setState(0, true); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true); + } else {} + }).catchError((err) { + print(err); + }); + } + + openAppointmentLabResults() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + PatientLabOrders patientLabOrders = new PatientLabOrders(); + service + .getPatientLabOrdersByAppoNo(widget.appo.appointmentNo, + widget.appo.projectID, widget.appo.clinicID, context) + .then((res) { + print(res['ListLabResultsByAppNo']); + GifLoaderDialogUtils.hideDialog(context); + if (res['ListLabResultsByAppNo'] != null) { + patientLabOrders.orderNo = + res['ListLabResultsByAppNo'][0]['OrderNo'].toString(); + patientLabOrders.invoiceNo = + res['ListLabResultsByAppNo'][0]['InvoiceNo'].toString(); + patientLabOrders.clinicID = widget.appo.clinicID; + patientLabOrders.projectID = widget.appo.projectID.toString(); + print(patientLabOrders.invoiceNo); + print(patientLabOrders.orderNo); + navigateToLabResults(patientLabOrders); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + openAppointmentRadiology() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); @@ -376,11 +454,15 @@ class _AppointmentActionsState extends State { .getPatientRadOrders(widget.appo.appointmentNo.toString(), context) .then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res['FinalRadiologyList']); - finalRadiology = - new FinalRadiology.fromJson(res['FinalRadiologyList'][0]); - print(finalRadiology.reportData); - navigateToRadiologyDetails(finalRadiology); + if (res['FinalRadiologyList'] != null) { + print(res['FinalRadiologyList']); + finalRadiology = + new FinalRadiology.fromJson(res['FinalRadiologyList'][0]); + print(finalRadiology.reportData); + navigateToRadiologyDetails(finalRadiology); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); @@ -394,19 +476,19 @@ class _AppointmentActionsState extends State { DoctorsListService service = new DoctorsListService(); service.getPatientPrescriptionReports(widget.appo, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - res['ListPRM'].forEach((report) { - prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(report)); - }); - print(prescriptionReportEnhList.length); - if (prescriptionReportEnhList.length != 0) { + if (res['ListPRM'].length != 0) { + res['ListPRM'].forEach((report) { + prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(report)); + }); + print(prescriptionReportEnhList.length); navigateToMedicinePrescriptionReport( prescriptionReportEnhList, res['ListPRM']); } else { - AppToast.showErrorToast(message: "Sorry there is no data"); + AppToast.showErrorToast(message: TranslationBase.of(context).noRecords); } }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); print(err); + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); }); } @@ -423,6 +505,15 @@ class _AppointmentActionsState extends State { appo: widget.appo))); } + Future navigateToLabResults(PatientLabOrders patientLabOrders) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + LaboratoryResultPage(patientLabOrders: patientLabOrders))) + .then((value) {}); + } + Future navigateToRadiologyDetails(FinalRadiology finalRadiology) async { Navigator.push( context, @@ -577,7 +668,7 @@ class _AppointmentActionsState extends State { context, FadePage( page: VitalSignDetailsScreen( - appointmentNo: appoNo, projectID: projectID))); + appointmentNo: appoNo, projectID: projectID,isNotOneAppointment: false,))); } navigateToInsertComplaint() { diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index 71bde484..c4299e33 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -1,6 +1,13 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; 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:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import '../AppointmentDetails.dart'; @@ -17,8 +24,20 @@ class AppointmentCard extends StatefulWidget { } class _ApointmentCardState extends State { + CountdownTimerController controller; + + @override + void initState() { + super.initState(); + int endTime = DateTime.now().millisecondsSinceEpoch + 1000 * 30; + controller = CountdownTimerController( + endTime: endTime, + ); + } + @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return InkWell( onTap: () { navigateToAppointmentDetails(context, widget.appo); @@ -36,75 +55,157 @@ class _ApointmentCardState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ + Container( + width: projectViewModel.isArabic ? 27 : 20, + height: projectViewModel.isArabic ? 165 : 140, + decoration: BoxDecoration( + //Colors.red[900] Color(0xff404545) + color: widget.appo.isLiveCareAppointment + ? Color(0xff404545) + : !widget.appo.isInOutPatient + ? Colors.red[900] + : Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + bottomLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + topRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0), + bottomRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0), + ), + ), + child: RotatedBox( + quarterTurns: 3, + child: Center( + child: Text( + widget.appo.isLiveCareAppointment + ? TranslationBase.of(context) + .liveCare + .toUpperCase() + : !widget.appo.isInOutPatient + ? TranslationBase.of(context) + .inPatient + .toUpperCase() + : TranslationBase.of(context) + .outpatient + .toUpperCase(), + style: TextStyle(color: Colors.white), + ), + )), + ), + SizedBox(width: 8,), ClipRRect( borderRadius: BorderRadius.circular(100.0), child: Image.network(widget.appo.doctorImageURL, fit: BoxFit.fill, height: 60.0, width: 60.0), ), - Container( - width: MediaQuery.of(context).size.width * 0.57, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.appo.doctorTitle + - " " + - widget.appo.doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0), - child: Text(widget.appo.clinicName, - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 3.0), - child: Text(widget.appo.projectName, - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDate(widget.appo.appointmentDate).trim(), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width * 0.61, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.appo.doctorTitle + + " " + + widget.appo.doctorNameObj, style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], + fontSize: 14.0, + color: Colors.grey[700], letterSpacing: 1.0)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: - widget.appo.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( - transform: - Matrix4.translationValues(15.0, -40.0, 0.0), - child: Image.asset( - "assets/images/new-design/arrow.png", - width: 25.0, - height: 25.0), - ), - ], - ), - ], + Container( + margin: EdgeInsets.only(top: 3.0), + child: Text(widget.appo.clinicName, + style: TextStyle( + fontSize: 12.0, + color: Colors.grey[600], + letterSpacing: 1.0)), + ), + Container( + margin: EdgeInsets.only(top: 3.0), + child: Text(widget.appo.projectName, + style: TextStyle( + fontSize: 12.0, + color: Colors.grey[600], + letterSpacing: 1.0)), + ), + Container( + margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + child: Text( + DateUtil.getWeekDayMonthDayYearDateFormatted( + DateUtil.convertStringToDate( + widget.appo.appointmentDate), + projectViewModel.isArabic ? "ar" : "en") + .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.appo.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( + transform: + Matrix4.translationValues(15.0, -40.0, 0.0), + child: projectViewModel.isArabic + ? Image.asset( + "assets/images/new-design/arrow_menu_black-ar.png", + width: 25.0, + height: 25.0) + : Image.asset( + "assets/images/new-design/arrow_menu_black-en.png", + width: 25.0, + height: 25.0), + ), + ], + ), + (widget.appo.patientStatusType == AppointmentType.BOOKED || + widget.appo.patientStatusType == + AppointmentType.CONFIRMED) + ? Container( + child: CountdownTimer( + controller: new CountdownTimerController( + endTime: + DateTime.now().millisecondsSinceEpoch + + (widget.appo.remaniningHoursTocanPay * + 1000) * + 60), + widgetBuilder: (_, CurrentRemainingTime time) { + return time != null + ? Text( + '${time.days}:${time.hours}:${time.min}:${time.sec} ' + + TranslationBase.of(context) + .upcomingTimeLeft, + style: TextStyle( + fontSize: 12.0, + color: Color(0xff40ACC9))) + : Container(); + }, + ), + ) + : Container(), + ], + ), ), ), ], diff --git a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart index 932211ba..213e28e1 100644 --- a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart +++ b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart @@ -4,7 +4,7 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -16,7 +16,10 @@ class PrescriptionReportPage extends StatefulWidget { dynamic listPres; AppoitmentAllHistoryResultList appo; - PrescriptionReportPage({@required this.prescriptionReportEnhList, @required this.listPres, @required this.appo}); + PrescriptionReportPage( + {@required this.prescriptionReportEnhList, + @required this.listPres, + @required this.appo}); @override _PrescriptionReportState createState() => _PrescriptionReportState(); @@ -113,12 +116,18 @@ class _PrescriptionReportState extends State { sendPrescriptionReportEmail() { DoctorsListService service = new DoctorsListService(); - service.sendPrescriptionEmail(widget.appo.appointmentDate, widget.appo.setupID, widget.listPres, context).then((res) { + GifLoaderDialogUtils.showMyDialog(context); + service + .sendPrescriptionEmail(widget.appo.appointmentDate, widget.appo.setupID, + widget.listPres, context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail'); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } navigateToPrescriptionDetails(PrescriptionReportEnh prescriptionReportEnh) { diff --git a/lib/pages/MyAppointments/widgets/custom_radio.dart b/lib/pages/MyAppointments/widgets/custom_radio.dart index 2ea9a39c..b21e34ec 100644 --- a/lib/pages/MyAppointments/widgets/custom_radio.dart +++ b/lib/pages/MyAppointments/widgets/custom_radio.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; class CustomRadio extends StatefulWidget { @@ -21,17 +22,23 @@ class CustomRadioState extends State { void initState() { super.initState(); - if (widget.requestData != null) { - widget.requestData.forEach((element) { - sampleData.add( - new RadioModel(false, element.description, element.parameterCode)); - }); - } else { - sampleData.add(new RadioModel(false, "Before 30 Mins", 30)); - sampleData.add(new RadioModel(false, 'Before 1 Hour', 60)); - sampleData.add(new RadioModel(false, 'Before 2 Hours', 120)); - sampleData.add(new RadioModel(false, 'Before 4 Hours', 240)); - } + WidgetsBinding.instance.addPostFrameCallback((_) { + if (widget.requestData != null) { + widget.requestData.forEach((element) { + sampleData.add(new RadioModel( + false, element.description, element.parameterCode)); + }); + } else { + sampleData.add(new RadioModel( + false, TranslationBase.of(context).appoReminder30, 30)); + sampleData.add(new RadioModel( + false, TranslationBase.of(context).appoReminder60, 60)); + sampleData.add(new RadioModel( + false, TranslationBase.of(context).appoReminder90, 90)); + sampleData.add(new RadioModel( + false, TranslationBase.of(context).appoReminder120, 120)); + } + }); } @override @@ -96,7 +103,7 @@ class RadioItem extends StatelessWidget { ), ), new Container( - margin: new EdgeInsets.only(left: 15.0), + margin: new EdgeInsets.only(left: 15.0, right: 15.0), child: new Text(_item.text, style: TextStyle(fontSize: 16.0)), ), ], diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog.dart b/lib/pages/MyAppointments/widgets/reminder_dialog.dart index 13955e5b..b8803469 100644 --- a/lib/pages/MyAppointments/widgets/reminder_dialog.dart +++ b/lib/pages/MyAppointments/widgets/reminder_dialog.dart @@ -27,19 +27,18 @@ class _ReminderDialogState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( - height: MediaQuery.of(context).size.height * 0.57, + // height: MediaQuery.of(context).size.height * 0.57, width: 450.0, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, + mainAxisSize: MainAxisSize.min, children: [ Container( margin: EdgeInsets.all(20.0), child: Text(TranslationBase.of(context).setReminder, style: TextStyle( fontSize: 20.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans-Bold")), + fontWeight: FontWeight.bold)), ), Container( transform: Matrix4.translationValues(0.0, -30.0, 0.0), @@ -61,13 +60,12 @@ class _ReminderDialogState extends State { child: Text(TranslationBase.of(context).confirm, style: TextStyle( color: Colors.white, - fontWeight: FontWeight.bold, - fontFamily: 'Open-Sans-Bold')), + fontWeight: FontWeight.bold)), ), ), Container( width: MediaQuery.of(context).size.width, - margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0), + margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0, bottom: 20.0), child: OutlineButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0)), @@ -81,8 +79,7 @@ class _ReminderDialogState extends State { child: Text(TranslationBase.of(context).cancel_nocaps, style: TextStyle( color: Colors.red, - fontWeight: FontWeight.bold, - fontFamily: 'Open-Sans-Bold')), + fontWeight: FontWeight.bold)), ), ), ]), diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 96835d7b..1066ca15 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,14 +1,19 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; +import 'package:diplomaticquarterapp/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'; @@ -18,7 +23,11 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_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'; class ToDo extends StatefulWidget { @@ -27,6 +36,10 @@ class ToDo extends StatefulWidget { var languageID; MyInAppBrowser browser; + bool isShowAppBar = true; + + ToDo({@required this.isShowAppBar}); + @override _ToDoState createState() => _ToDoState(); } @@ -38,19 +51,37 @@ class _ToDoState extends State { AuthenticatedUserObject authenticatedUserObject = locator(); + List imagesInfo = List(); + + ToDoCountProviderModel toDoProvider; + CountdownTimerController controller; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { - if (authenticatedUserObject.isLogin) getPatientAppointmentHistory(); + if (authenticatedUserObject.isLogin) getPatientData(); }); super.initState(); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png')); + int endTime = DateTime.now().millisecondsSinceEpoch + 1000 * 30; + controller = CountdownTimerController(endTime: endTime); } @override Widget build(BuildContext context) { + toDoProvider = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, + imagesInfo: imagesInfo, + isShowAppBar: widget.isShowAppBar, + isShowDecPage: true, + description: TranslationBase.of(context).infoTodo, body: SingleChildScrollView( child: Column( children: [ @@ -85,11 +116,19 @@ class _ToDoState extends State { height: 20.0), Container( margin: - EdgeInsets.only(left: 5.0, right: 20.0), + EdgeInsets.only(left: 10.0, right: 10.0), child: Text( - getDate(widget - .appoList[index].appointmentDate), - style: TextStyle(fontSize: 11.0)), + 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( @@ -117,7 +156,7 @@ class _ToDoState extends State { : "-", overflow: TextOverflow.clip, maxLines: 2, - style: TextStyle(fontSize: 11.0)), + style: TextStyle(fontSize: 10.0)), ), ], ), @@ -197,6 +236,31 @@ class _ToDoState extends State { ), ], ), + 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, + style: TextStyle( + fontSize: 12.0, + color: Color( + 0xff40ACC9))) + : Container(); + }, + ), + ), ], ), ), @@ -426,7 +490,8 @@ class _ToDoState extends State { } getLanguageID() async { - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); setState(() { widget.languageID = languageID; }); @@ -477,6 +542,7 @@ class _ToDoState extends State { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getPatientAppointmentHistory(true, context).then((res) { + widget.appoList.clear(); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { @@ -486,11 +552,9 @@ class _ToDoState extends State { widget.appoList .add(new AppoitmentAllHistoryResultList.fromJson(v)); }); - } else {} - }); - widget.appoList.forEach((element) { - print(element.isLiveCareAppointment); - print(element.nextAction); + } else { + Navigator.of(context).popAndPushNamed(HOME); + } }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -498,7 +562,7 @@ class _ToDoState extends State { }).catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); + err != null ?? AppToast.showErrorToast(message: err); }); } @@ -666,8 +730,8 @@ class _ToDoState extends State { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); service - .createAdvancePayment( - appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context) + .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], + res['Fort_id'], res['PaymentMethod'], context) .then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); @@ -699,6 +763,19 @@ class _ToDoState extends State { }); } + getPatientData() async { + AppSharedPreferences sharedPref = AppSharedPreferences(); + if (await sharedPref.getObject(USER_PROFILE) != null) { + var data = + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + setState(() { + print(data); + authUser = data; + }); + getPatientAppointmentHistory(); + } + } + Future navigateToPaymentMethod( context, PatientShareResponse patientShareResponse, diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index a189128a..3a0734dc 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -218,7 +218,7 @@ class _PaymentMethodState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), - minWidth: MediaQuery.of(context).size.width * 0.7, + minWidth: MediaQuery.of(context).size.height * 0.1, height: 45.0, child: RaisedButton( color: new Color(0xFF60686b), diff --git a/lib/pages/base/base_view.dart b/lib/pages/base/base_view.dart index 80fe1b41..5977e97e 100644 --- a/lib/pages/base/base_view.dart +++ b/lib/pages/base/base_view.dart @@ -33,10 +33,10 @@ class _BaseViewState extends State> { @override void initState() { - if (widget.allowAny && widget.onModelReady != null) { + if(widget.allowAny && widget.onModelReady != null){ widget.onModelReady(model); - } else if (widget.onModelReady != null && - Provider.of(context, listen: false).isLogin) { + } + else if (widget.onModelReady != null && Provider.of(context, listen: false).isLogin) { widget.onModelReady(model); } super.initState(); @@ -63,4 +63,4 @@ class _BaseViewState extends State> { super.dispose(); } -} \ No newline at end of file +} diff --git a/lib/pages/feedback/feedback_home_page.dart b/lib/pages/feedback/feedback_home_page.dart index 3d761bd3..309b5713 100644 --- a/lib/pages/feedback/feedback_home_page.dart +++ b/lib/pages/feedback/feedback_home_page.dart @@ -74,7 +74,7 @@ class _FeedbackHomePageState extends State controller: _tabController, indicatorWeight: 5.0, indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Theme.of(context).primaryColor, + indicatorColor: Colors.red[800], 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 14463825..4d511452 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_mode 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/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; @@ -14,7 +15,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; - +import 'dart:convert'; +import 'dart:io'; import 'appointment_history.dart'; class SendFeedbackPage extends StatefulWidget { @@ -31,6 +33,41 @@ class _SendFeedbackPageState extends State { bool isShowListAppointHistory = true; String message; final formKey = GlobalKey(); + MessageType messageType = MessageType.NON; + + + String getSelected(BuildContext context) { + switch (messageType) { + case MessageType.ComplaintOnAnAppointment: + return TranslationBase.of(context).complainAppo; + break; + case MessageType.ComplaintWithoutAppointment: + return TranslationBase.of(context).complainWithoutAppo; + break; + case MessageType.Question: + return TranslationBase.of(context).question; + break; + case MessageType.Compliment: + return TranslationBase.of(context).compliment; + break; + case MessageType.Suggestion: + return TranslationBase.of(context).suggestion; + break; + case MessageType.NON: + return TranslationBase.of(context).notClassified; + break; + } + return TranslationBase.of(context).notClassified; + } + + + + setMessageType(MessageType messageType) { + setState(() { + this.messageType = messageType; + }); + + } @override Widget build(BuildContext context) { @@ -55,7 +92,6 @@ class _SendFeedbackPageState extends State { child: Texts( TranslationBase.of(context).likeToHear, textAlign: TextAlign.center, - variant: 'body2Link', ), ), InkWell( @@ -75,9 +111,8 @@ class _SendFeedbackPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - child: Texts( - model.getSelected(context), + getSelected(context), variant: 'bodyText', ), margin: EdgeInsets.only(left: 10,right: 10), @@ -91,7 +126,7 @@ class _SendFeedbackPageState extends State { ), ), ), - if (appointHistory != null && model.messageType == + if (appointHistory != null && messageType == MessageType.ComplaintOnAnAppointment) InkWell( onTap: () { @@ -167,12 +202,10 @@ class _SendFeedbackPageState extends State { ), ), ), - if (model.messageType == - MessageType.ComplaintOnAnAppointment && - model.appointHistoryList.length != 0 && + if (messageType == MessageType.ComplaintOnAnAppointment && model.appointHistoryList.length != 0 && isShowListAppointHistory) Container( - height: MediaQuery.of(context).size.height * 0.4, + height: model.appointHistoryList.length>2?MediaQuery.of(context).size.height * 0.25:MediaQuery.of(context).size.height * 0.15, child: ListView.builder( itemCount: model.appointHistoryList.length, itemBuilder: (context, index) => InkWell( @@ -285,7 +318,7 @@ class _SendFeedbackPageState extends State { hintColor: Colors.black, fontWeight: FontWeight.w600, validator: (value) { - if (value == null) + if (value.isEmpty) return TranslationBase.of(context).emptySubject; else return null; @@ -303,7 +336,7 @@ class _SendFeedbackPageState extends State { minLines: 13, controller: messageController, validator: (value) { - if (value == null) + if (value.isEmpty) return TranslationBase.of(context).emptyMessage; else return null; @@ -311,11 +344,11 @@ class _SendFeedbackPageState extends State { ), InkWell( onTap: () { - ImageOptions.showImageOptions(context, (String image) { + ImageOptions.showImageOptions(context, (String image,File file) { setState(() { images.add(image); }); - }); + } ); }, child: Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), @@ -376,7 +409,7 @@ class _SendFeedbackPageState extends State { ), )), SizedBox( - height: 30, + height: 45, ), ], ), @@ -396,14 +429,14 @@ class _SendFeedbackPageState extends State { loading: model.state == ViewState.BusyLocal, onTap: () { final form = formKey.currentState; - if (form.validate()) if (model.messageType != MessageType.NON) + if (form.validate()) if (messageType != MessageType.NON) model .sendCOCItem( title: titleController.text, attachment: images.length > 0 ? images[0] : "", details: messageController.text, - cOCTypeName: getCOCName(model), - appointHistory: model.messageType == + cOCTypeName: getCOCName(), + appointHistory:messageType == MessageType.ComplaintOnAnAppointment ? appointHistory : null) @@ -414,7 +447,7 @@ class _SendFeedbackPageState extends State { messageController.text = ""; images = []; }); - model.setMessageType(MessageType.NON); + setMessageType(MessageType.NON); AppToast.showSuccessToast( message: TranslationBase.of(context).yourFeedback); } else { @@ -433,8 +466,8 @@ class _SendFeedbackPageState extends State { ); } - String getCOCName(FeedbackViewModel model) { - switch (model.messageType) { + String getCOCName() { + switch (messageType) { case MessageType.ComplaintOnAnAppointment: return "1"; break; @@ -462,15 +495,18 @@ class _SendFeedbackPageState extends State { showDialog( context: context, child: FeedbackTypeDialog( + messageTypeDialog: messageType, onValueSelected: (MessageType value) { if (value == MessageType.ComplaintOnAnAppointment) { + GifLoaderDialogUtils.showMyDialog(context); model.getPatentAppointmentHistory().then((value) { + GifLoaderDialogUtils.hideDialog(context); setState(() { appointHistory = null; }); }); } - model.setMessageType(value); + setMessageType(value); }, )); } @@ -478,14 +514,30 @@ class _SendFeedbackPageState extends State { class FeedbackTypeDialog extends StatefulWidget { final Function(MessageType) onValueSelected; + final MessageType messageTypeDialog; - const FeedbackTypeDialog({Key key, this.onValueSelected}) : super(key: key); + const FeedbackTypeDialog({Key key, this.onValueSelected, this.messageTypeDialog=MessageType.NON}) : super(key: key); @override State createState() => new FeedbackTypeDialogState(); } class FeedbackTypeDialogState extends State { + + + MessageType messageTypeDialog = MessageType.NON; + + setMessageDialogType(MessageType messageType) { + setState(() { + messageTypeDialog = messageType; + }); + } + @override + void initState() { + messageTypeDialog = widget.messageTypeDialog; + super.initState(); + } + Widget build(BuildContext context) { return BaseView( builder: (_, model, widge) => SimpleDialog( @@ -507,16 +559,16 @@ class FeedbackTypeDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () => model.setMessageDialogType( + onTap: () => setMessageDialogType( MessageType.ComplaintOnAnAppointment), child: ListTile( title: Texts(TranslationBase.of(context).complainAppo), leading: Radio( value: MessageType.ComplaintOnAnAppointment, - groupValue: model.messageTypeDialog, + groupValue: messageTypeDialog, activeColor: Theme.of(context).primaryColor, onChanged: (MessageType value) => - model.setMessageDialogType(value), + setMessageDialogType(value), ), ), ), @@ -531,16 +583,16 @@ class FeedbackTypeDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () => model.setMessageDialogType( + onTap: () => setMessageDialogType( MessageType.ComplaintWithoutAppointment), child: ListTile( title: Texts(TranslationBase.of(context).complainWithoutAppo), leading: Radio( value: MessageType.ComplaintWithoutAppointment, - groupValue: model.messageTypeDialog, + groupValue: messageTypeDialog, activeColor: Theme.of(context).primaryColor, onChanged: (MessageType value) => - model.setMessageDialogType(value), + setMessageDialogType(value), ), ), ), @@ -556,15 +608,15 @@ class FeedbackTypeDialogState extends State { flex: 1, child: InkWell( onTap: () => - model.setMessageDialogType(MessageType.Question), + setMessageDialogType(MessageType.Question), child: ListTile( title: Texts(TranslationBase.of(context).question), leading: Radio( value: MessageType.Question, - groupValue: model.messageTypeDialog, + groupValue: messageTypeDialog, activeColor: Theme.of(context).primaryColor, onChanged: (MessageType value) => - model.setMessageDialogType(value), + setMessageDialogType(value), ), ), ), @@ -580,15 +632,15 @@ class FeedbackTypeDialogState extends State { flex: 1, child: InkWell( onTap: () => - model.setMessageDialogType(MessageType.Compliment), + setMessageDialogType(MessageType.Compliment), child: ListTile( title: Texts(TranslationBase.of(context).compliment), leading: Radio( value: MessageType.Compliment, - groupValue: model.messageTypeDialog, + groupValue: messageTypeDialog, activeColor: Theme.of(context).primaryColor, onChanged: (MessageType value) => - model.setMessageDialogType(value), + setMessageDialogType(value), ), ), ), @@ -604,15 +656,14 @@ class FeedbackTypeDialogState extends State { flex: 1, child: InkWell( onTap: () => - model.setMessageDialogType(MessageType.Suggestion), + setMessageDialogType(MessageType.Suggestion), child: ListTile( title: Texts(TranslationBase.of(context).suggestion), leading: Radio( value: MessageType.Suggestion, - groupValue: model.messageTypeDialog, + groupValue: messageTypeDialog, activeColor: Theme.of(context).primaryColor, - onChanged: (MessageType value) => - model.setMessageDialogType(value), + onChanged: (MessageType value) => setMessageDialogType(value), ), ), ), @@ -660,7 +711,7 @@ class FeedbackTypeDialogState extends State { flex: 1, child: InkWell( onTap: () { - widget.onValueSelected(model.messageTypeDialog); + widget.onValueSelected(messageTypeDialog); Navigator.pop(context); }, child: Padding( diff --git a/lib/pages/feedback/status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart index 457ded60..59d68fa2 100644 --- a/lib/pages/feedback/status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -14,73 +14,92 @@ class StatusFeedbackPage extends StatefulWidget { } class _StatusFeedbackPageState extends State { - @override Widget build(BuildContext context) { return BaseView( - allowAny: true, onModelReady: (model) => model.getCOC(), builder: (_, model, widget) => AppScaffold( baseViewModel: model, isShowDecPage: false, - body: Container( - margin: EdgeInsets.only(top: 8.0,left: 8.0,right: 8.0 ), - padding: EdgeInsets.all(15.0), - child: ListView.builder( - itemCount: model.cOCItemList.length, - itemBuilder: (context, 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, - ), - margin: EdgeInsets.all(4), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 8,), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts('${model.cOCItemList[index].cOCTitle}'), - Texts( - TranslationBase.of(context).number + ' : ${model.cOCItemList[index].itemID}', - variant: 'overline', - ), - ], - ), + body: model.cOCItemList.isNotEmpty + ? Container( + margin: EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0), + padding: EdgeInsets.all(15.0), + child: ListView.builder( + itemCount: model.cOCItemList.length, + itemBuilder: (context, 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, ), - Expanded( + margin: EdgeInsets.all(4), + child: Padding( + padding: const EdgeInsets.all(8.0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts('${model.cOCItemList[index].status}'), - Texts( - '${model.cOCItemList[index].date}', - variant: 'overline', + SizedBox( + height: 8, ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + '${model.cOCItemList[index].cOCTitle}'), + Texts( + TranslationBase.of(context).number + + ' : ${model.cOCItemList[index].itemID}', + variant: 'overline', + ), + ], + ), + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + '${model.cOCItemList[index].status}'), + Texts( + '${model.cOCItemList[index].date}', + variant: 'overline', + ), + ], + ), + ), + ], + ), + Texts('${model.cOCItemList[index].formType}'), + Divider( + height: 4.5, + color: Colors.grey[500], + ) ], ), ), - ], - ), - Texts('${model.cOCItemList[index].formType}'), - Divider(height: 4.5,color: Colors.grey[500],) + )), + ) + : Container( + child: Center( + child: Column( + children: [ + SizedBox(height: MediaQuery.of(context).size.height*0.4,), + Image.asset('assets/images/comments.png',width: 80,height: 80,), + SizedBox(height: 15,), + Texts(TranslationBase.of(context).noSearchResult), ], ), ), - )), - ), + ), ), ); } diff --git a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart new file mode 100644 index 00000000..20e17593 --- /dev/null +++ b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart @@ -0,0 +1,147 @@ +import 'dart:io'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AttachInsuranceCardImageDialog extends StatefulWidget { + final String name; + final String fileNo; + final Function(File file, String image) image; + + const AttachInsuranceCardImageDialog( + {Key key, this.name, this.fileNo, this.image}) + : super(key: key); + + @override + _AttachInsuranceCardImageDialogState createState() => + _AttachInsuranceCardImageDialogState(); +} + +class _AttachInsuranceCardImageDialogState + extends State { + @override + void initState() { + super.initState(); + } + + String image; + File file; + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts(TranslationBase.of(context).attachInsuraceImage), + Divider(), + Texts(widget.name), + SizedBox( + height: 3, + ), + Texts(TranslationBase.of(context).fileNo + " " + widget.fileNo), + SizedBox( + height: 5.0, + ), + InkWell( + onTap: () { + ImageOptions.showImageOptions(context, (String image,File file) { + setState(() { + this.image = image; + this.file = file; + }); + }); + }, + child: image == null + ? Padding( + padding: const EdgeInsets.all(18.0), + child: Container( + width: double.maxFinite, + height: 250, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + border: Border.all(color: Colors.grey, width: 1.5)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment., + children: [ + SizedBox(height: 25,), + Icon( + Icons.camera_enhance_rounded, + size: 85, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.attach_file), + Texts(TranslationBase.of(context).selectAttachment.toUpperCase()) + ], + ), + ], + ), + ), + ) + : Image.file( + file, + fit: BoxFit.fill, + height: 250, + ), + ), + SizedBox( + height: 25.0, + ), + Divider(), + Row( + 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: () { + Navigator.pop(context); + widget.image(file, image); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 3b19e670..d81e704e 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.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/others/rounded_container.dart'; import 'package:flutter/cupertino.dart'; @@ -18,8 +20,20 @@ class InsuranceApproval extends StatefulWidget { } class _InsuranceApprovalState extends State { + List imagesInfo = List(); + @override Widget build(BuildContext context) { + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/ar/0.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/en/1.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/ar/1.png')); return BaseView( onModelReady: widget.appointmentNo != null ? (model) => @@ -32,6 +46,7 @@ class _InsuranceApprovalState extends State { appBarTitle: TranslationBase.of(context).approvals, description: TranslationBase.of(context).infoApprovals, infoList: TranslationBase.of(context).infoApprovalPoints, + imagesInfo: imagesInfo, body: SingleChildScrollView( child: Container( margin: EdgeInsets.only( @@ -48,27 +63,24 @@ class _InsuranceApprovalState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Text( + Texts( TranslationBase.of(context).totalApproval, - style: TextStyle( color: Color(0xff60688B), fontSize: 19.0, fontWeight: FontWeight.w600, - ), ), if (model.insuranceApproval.length > 0) Container( - width: SizeConfig.widthMultiplier * 18.0, - height: SizeConfig.heightMultiplier * 2.8, + width: 60, + height: 40, decoration: BoxDecoration( - color: Color(0xffC5272D), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.circular(19.0)), child: Center( - child: Text( + child: Texts( model.insuranceApproval[0].unUsedCount .toString(), - style: TextStyle( - color: Colors.white, fontSize: 19.0), + color: Colors.white, fontSize: 17.0, ), )) ], @@ -87,29 +99,21 @@ class _InsuranceApprovalState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - model.insuranceApproval[index] - .patientDescription == - "In Patient" + model.insuranceApproval[index].patientDescription == "In Patient" ? Container( decoration: BoxDecoration( - color: Color(0xffB8372C), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.circular( 16.0)), - width: 95.0, + width: 115.0, padding: EdgeInsets.only(left: 11.5), - child: Text( - model.insuranceApproval[index] - .patientDescription == - null - ? '' - : model - .insuranceApproval[ - index] - .patientDescription, - style: TextStyle( - color: Colors.white), + child: Center( + child: Texts( + TranslationBase.of(context).inPatient, + color: Colors.white, + ), ), ) : Container( @@ -118,41 +122,31 @@ class _InsuranceApprovalState extends State { borderRadius: BorderRadius.circular( 16.0)), - width: 95.0, + width: 115.0, padding: EdgeInsets.only(left: 11.5), - child: Text( - model.insuranceApproval[index] - .patientDescription == - null - ? '' - : model - .insuranceApproval[ - index] - .patientDescription, - style: TextStyle( - color: Colors.white), + child: Center( + child: Texts( + TranslationBase.of(context).outpatient, + color: Colors.white, + ), ), ), Padding( padding: EdgeInsets.symmetric( vertical: 10.0), - child: Text( + child: Texts( model.insuranceApproval[index] .clinicName, - style: TextStyle( - fontSize: 20.0, - color: Color(0xff60686B), - fontWeight: FontWeight.w600, - ), + fontSize: 20.0, + color: Color(0xff60686B), + fontWeight: FontWeight.w600, ), ), - Text( + Texts( model.insuranceApproval[index] .doctorName, - style: TextStyle( - fontSize: 17.0, - fontStyle: FontStyle.italic), + fontSize: 17.0, ), ], ), @@ -165,45 +159,53 @@ class _InsuranceApprovalState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - TranslationBase.of(context) - .approvalNo + - model.insuranceApproval[index] - .approvalNo - .toString(), - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.w600, - ), + Row( + children: [ + Texts( + TranslationBase.of(context).approvalNo, + fontSize: 18.0, + ), + Texts(model.insuranceApproval[index].approvalNo.toString(), + fontSize: 18.0, + fontWeight: FontWeight.w600,), + ], ), Divider( color: Colors.black, height: 25.0, thickness: 1.0, ), - Text( - TranslationBase.of(context) - .procedureStatus + - model.insuranceApproval[index] - .approvalStatusDescption, - style: TextStyle( + Row( + children: [ + Texts( + TranslationBase.of(context).procedureStatus , + fontSize: 17.5, + ), + SizedBox(width: 12,), + Texts( + model.insuranceApproval[index].approvalStatusDescption, fontWeight: FontWeight.w600, - fontSize: 17.5), + fontSize: 17.5, + ), + ], ), Divider( color: Colors.black, height: 25.0, thickness: 1.0, ), - Text( - TranslationBase.of(context) - .unusedCount + - model.insuranceApproval[index] - .unUsedCount - .toString(), - style: TextStyle( + Row( + children: [ + Texts( + TranslationBase.of(context).unusedCount, fontSize: 17.5, - fontWeight: FontWeight.w600), + ), + Texts( + model.insuranceApproval[index].unUsedCount.toString(), + fontSize: 17.5, + fontWeight: FontWeight.w600, + ), + ], ), Divider( color: Colors.black, @@ -222,13 +224,10 @@ class _InsuranceApprovalState extends State { // fontSize: 17.5, // fontWeight: FontWeight.w600), // ), - Text( - TranslationBase.of(context) - .companyName, - style: TextStyle( + Texts( + TranslationBase.of(context).companyName, fontWeight: FontWeight.w600, fontSize: 17.5, - ), ), Divider( @@ -236,32 +235,42 @@ class _InsuranceApprovalState extends State { height: 25.0, thickness: 1.0, ), - Text( - TranslationBase.of(context) - .receiptOn + - convertDateFormat(model - .insuranceApproval[index] - .rceiptOn), - style: TextStyle( - fontSize: 17.5, - fontWeight: FontWeight.w600, - ), + Row( + children: [ + Texts( + TranslationBase.of(context).receiptOn , + fontSize: 17.5, + fontWeight: FontWeight.w600, + + ), + Texts( + convertDateFormat(model.insuranceApproval[index].rceiptOn), + fontSize: 17.5, + fontWeight: FontWeight.w600, + + ), + ], ), Divider( color: Colors.black, height: 25.0, thickness: 1.0, ), - Text( - TranslationBase.of(context) - .expiryDate + - convertDateFormat(model - .insuranceApproval[index] - .expiryDate), - style: TextStyle( - fontSize: 17.5, - fontWeight: FontWeight.w600, - ), + Row( + children: [ + Texts( + TranslationBase.of(context).expiryDate, + fontSize: 17.5, + fontWeight: FontWeight.w600, + + ), + Texts( + convertDateFormat(model.insuranceApproval[index].expiryDate), + fontSize: 17.5, + fontWeight: FontWeight.w600, + + ), + ], ), Divider( color: Colors.black, diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index d5fac63f..42efc179 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -24,21 +25,29 @@ class InsuranceCard extends StatefulWidget { @override _InsuranceCardState createState() => _InsuranceCardState(); } -//TODO fix it + class _InsuranceCardState extends State { InsuranceCardService _insuranceCardService = locator(); + List imagesInfo = List(); + @override Widget build(BuildContext context) { + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png')); + return BaseView( onModelReady: (model) => model.getInsurance(), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( isShowAppBar: true, baseViewModel: model, - image: 'assets/images/medical/insurance_card_icon.png', appBarTitle: TranslationBase.of(context).insuranceCards, description: TranslationBase.of(context).infoInsuranceCards, infoList: TranslationBase.of(context).infoInsuranceCardsPoints, + imagesInfo: imagesInfo, body: Container( margin: EdgeInsets.only( left: SizeConfig.screenWidth * 0.004, @@ -74,16 +83,16 @@ class _InsuranceCardState extends State { padding: EdgeInsets.all(14), width: double.infinity, decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.grey,width: 0.2), - borderRadius: BorderRadius.all(Radius.circular(2)), - boxShadow: [ - BoxShadow( - color: Colors.white70, - ), - - ] - ), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.grey, width: 0.2), + borderRadius: + BorderRadius.all(Radius.circular(2)), + boxShadow: [ + BoxShadow( + color: Colors.white70, + ), + ]), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -91,6 +100,7 @@ class _InsuranceCardState extends State { TranslationBase.of(context).companyName + model.insurance[index].companyName, fontSize: 20.0, + fontWeight: FontWeight.w700, ), Divider( color: Colors.black, @@ -98,45 +108,59 @@ class _InsuranceCardState extends State { thickness: 0.5, ), Column( - crossAxisAlignment: CrossAxisAlignment.stretch, + crossAxisAlignment: + CrossAxisAlignment.stretch, children: [ - Text( - TranslationBase.of(context).category + - model.insurance[index].subCategoryDesc, - style: TextStyle(fontSize: 18.5), + Texts( + TranslationBase.of(context).category +": "+ + model.insurance[index] + .subCategoryDesc, + fontSize: 18.5, ), - Text( - TranslationBase.of(context).expirationDate + - convertDateFormat( - model.insurance[index].cardValidTo), - style: TextStyle(fontSize: 18.5), + Row( + children: [ + Texts( + TranslationBase.of(context) + .expirationDate +": "+ + convertDateFormat(model + .insurance[index].cardValidTo), + fontSize: 18.5, + ), + Expanded( + child: Column( + children: [ + model.insurance[index].isActive == true + ? Texts( + TranslationBase.of(context) + .activeInsurence, + color: Colors.green, + fontWeight: FontWeight.w900, + fontSize: 17.9) + : Texts( + TranslationBase.of(context) + .notActive, + color: Colors.red, + fontWeight: FontWeight.w900, + fontSize: 17.9) + ], + ), + ), + ], ), - Text( - TranslationBase.of(context).patientCard + - model.insurance[index].patientCardID, - style: TextStyle(fontSize: 18.5), - ), - Text( - TranslationBase.of(context).policyNumber + + Texts( + TranslationBase.of(context) + .patientCard +": "+ model - .insurance[index].insurancePolicyNumber, - style: TextStyle(fontSize: 18.5), + .insurance[index].patientCardID, + fontSize: 18.5, + ), + Texts( + TranslationBase.of(context) + .policyNumber +" "+ + model.insurance[index] + .insurancePolicyNumber, + fontSize: 18.5, ), - ], - ), - Column( - children: [ - model.insurance[index].isActive == true - ? Text('Active', - style: TextStyle( - color: Colors.green, - fontWeight: FontWeight.w900, - fontSize: 17.9)) - : Text('Not Active', - style: TextStyle( - color: Colors.red, - fontWeight: FontWeight.w900, - fontSize: 17.9)) ], ), SizedBox( @@ -146,8 +170,11 @@ class _InsuranceCardState extends State { Container( color: Colors.transparent, child: SecondaryButton( - onTap:()=>{ getDetails(model.insurance[index])}, - label: TranslationBase.of(context).seeDetails, + onTap: () => { + getDetails(model.insurance[index]) + }, + label: TranslationBase.of(context) + .seeDetails, textColor: Colors.white, ), width: double.infinity, @@ -155,8 +182,6 @@ class _InsuranceCardState extends State { ], ), ), - - ], ), ], @@ -186,13 +211,13 @@ class _InsuranceCardState extends State { return newDate.toString(); } - getDetails(data){ + + getDetails(data) { GifLoaderDialogUtils.showMyDialog(context); _insuranceCardService.getInsuranceDetails(data).then((value) => { - GifLoaderDialogUtils.hideDialog(context), - Navigator.push(context, - FadePage(page: InsuranceCardDetails(data:value[0]['CheckList']))) - - }); + GifLoaderDialogUtils.hideDialog(context), + Navigator.push(context, + FadePage(page: InsuranceCardDetails(data: value[0]['CheckList']))) + }); } } diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart new file mode 100644 index 00000000..5e9db38a --- /dev/null +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -0,0 +1,346 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/Insurance_card_details.dart'; +import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/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'; +import 'AttachInsuranceCardImageDialog.dart'; + +class InsuranceCardUpdateDetails extends StatelessWidget { + final List insuranceCardDetailsModel; + final String patientIdentificationID; + final int patientID; + final String name; + + const InsuranceCardUpdateDetails( + {Key key, + this.insuranceCardDetailsModel, + this.patientIdentificationID, + this.patientID, + this.name}) + : super(key: key); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + builder: (context, model, w) => AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).cardDetail, + body: SingleChildScrollView( + child: Column( + children: [ + ...List.generate( + insuranceCardDetailsModel.length, + (index) => Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + width: double.maxFinite, + margin: EdgeInsets.only(left: 8, right: 8, top: 8), + height: projectViewModel.isArabic ? 320 : 240, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: Color(0xff515B5D), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + insuranceCardDetailsModel[index].memberID, + textScaleFactor: 2.1, + style: TextStyle( + color: Colors.white, + letterSpacing: 8.0, + fontWeight: FontWeight.w400, + fontSize: 15), + ), + SizedBox( + height: 5, + ), + Texts( + insuranceCardDetailsModel[index].companyName, + fontSize: 14, + color: Colors.white, + ), + SizedBox( + height: 25, + ), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).policyHolder, + color: Colors.white, + fontSize: 14, + ), + Texts( + insuranceCardDetailsModel[index] + .memberName, + color: Colors.white, + fontSize: 14, + ), + ], + ), + ), + Expanded( + child: Column( + children: [ + Texts(TranslationBase.of(context).policyNo, + color: Colors.white), + Texts( + insuranceCardDetailsModel[index] + .policyNumber, + color: Colors.white), + ], + ), + ), + ], + ), + SizedBox( + height: 25, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .expiryDateTitle, + color: Colors.white, + fontSize: 12, + ), + Texts( + insuranceCardDetailsModel[index].dOB, + color: Colors.white, + fontSize: 12, + ), + ], + ), + ), + Expanded( + child: Column( + children: [ + Texts( + TranslationBase.of(context).classTitle, + color: Colors.white, + fontSize: 12, + ), + Texts( + insuranceCardDetailsModel[index] + .subCategory, + color: Colors.white, + fontSize: 12, + ), + ], + ), + ), + Expanded( + child: Column( + children: [ + Texts( + TranslationBase.of(context).approval, + color: Colors.white, + fontSize: 12, + ), + Texts( + insuranceCardDetailsModel[index] + .approvalLimit + .toString(), + color: Colors.white, + fontSize: 12, + ), + ], + ), + ), + ], + ) + ], + ), + ), + ), + ), + ), + if(insuranceCardDetailsModel.isEmpty) + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.all(10.0), + child: Card( + margin: EdgeInsets.fromLTRB( + 8.0, 16.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: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 2.0, + left: 10.0, + right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts( + name, + fontSize: 14, + color: Colors.black, + fontWeight: + FontWeight.w500, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of( + context) + .fileno + + ": " +patientID.toString(), + fontSize: 14, + color: Colors.black, + fontWeight: + FontWeight.w500, + ) + ], + ), + ), + ), + ], + ), + ), + ), + ), + SizedBox(height: 150,), + Image.asset('assets/images/no-data-found.png',width: 80,height: 80,), + SizedBox(height: 8,), + Texts(TranslationBase.of(context).noDataAvailable) + ], + ) + ], + ), + ), + bottomSheet: Container( + width: double.infinity, + height:insuranceCardDetailsModel.isEmpty? MediaQuery.of(context).size.height * 0.14:MediaQuery.of(context).size.height * 0.21, + child: Container( + margin: EdgeInsets.only(left: 8, right: 8), + child: Column( + children: [ + SizedBox( + height: 8, + ), + if(insuranceCardDetailsModel.isEmpty) + SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).scanNow.toUpperCase(), + color: Theme.of(context).primaryColor, + onTap: () async { + confirmAttachInsuranceCardImageDialogDialog( + context: context, + name: name, + fileNo: patientID.toString(), + model: model); + }, + ), + if(insuranceCardDetailsModel.isNotEmpty) + SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).agree.toUpperCase(), + color: Theme.of(context).primaryColor, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.uploadInsuranceCard( + patientIdentificationID: patientIdentificationID, + patientID: patientID); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase.of(context).requestSent); + } + }, + ),if(insuranceCardDetailsModel.isNotEmpty) + SizedBox( + height: 12, + ),if(insuranceCardDetailsModel.isNotEmpty) + SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).disagree.toUpperCase(), + color: Colors.grey[800], + onTap: () async { + confirmAttachInsuranceCardImageDialogDialog( + context: context, + name: name, + fileNo: patientID.toString(), + model: model); + }, + ) + ], + ), + ), + ), + ), + ); + } + + void confirmAttachInsuranceCardImageDialogDialog( + {BuildContext context, + String name, + String fileNo, + InsuranceViewModel model}) { + showDialog( + context: context, + child: AttachInsuranceCardImageDialog( + fileNo: fileNo, + name: name, + image: (file, image) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.uploadInsuranceCard( + patientIdentificationID: patientIdentificationID, + patientID: patientID, + image: image); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal || + model.state == ViewState.Error) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase.of(context).requestSent); + } + Navigator.pop(context); + }, + ), + ); + } +} diff --git a/lib/pages/insurance/insurance_details.dart b/lib/pages/insurance/insurance_details.dart index d0a829be..16745e9e 100644 --- a/lib/pages/insurance/insurance_details.dart +++ b/lib/pages/insurance/insurance_details.dart @@ -1,35 +1,29 @@ import 'package:diplomaticquarterapp/config/size_config.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_html/flutter_html.dart'; import 'package:html/dom.dart' as dom; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class InsuranceCardDetails extends StatefulWidget { +class InsuranceCardDetails extends StatelessWidget { final String data; InsuranceCardDetails({this.data}); - @override - _InsuranceCardInsuranceCardDetailsState createState() => _InsuranceCardInsuranceCardDetailsState(); -} -//TODO fix it -class _InsuranceCardInsuranceCardDetailsState extends State { @override Widget build(BuildContext context) { - return - AppScaffold( - isShowAppBar: true, - - body: Center( - child: SingleChildScrollView( + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).cardDetail, + body: Center( + child: SingleChildScrollView( child: Html( - data:widget.data, - ) - ) + data: data, + ), + ), ), ); } - } diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart new file mode 100644 index 00000000..f938d9e5 --- /dev/null +++ b/lib/pages/insurance/insurance_page.dart @@ -0,0 +1,261 @@ +import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/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/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../../locator.dart'; +import 'insurance_card_update_details.dart'; + +class InsurancePage extends StatelessWidget { + final InsuranceViewModel model; + InsuranceCardService _insuranceCardService = locator(); + + InsurancePage({Key key, this.model}) : super(key: key); + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: 65, + ), + Container( + margin: EdgeInsets.all(10.0), + color: Colors.white, + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + if (model.user != null) + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 2.0, + left: 10.0, + right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + model.user.firstName ?? '' + " " + model.user.lastName ?? '', + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context) + .fileno + + ": " + + model.user.patientID + .toString(), + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ) + ], + ), + ), + ), + Expanded( + flex: 2, + child: Container( + margin: EdgeInsets.only(top: 2.0), + child: Column( + children: [ + Container( + child: SecondaryButton( + label: TranslationBase.of( + context) + .fetchData, + small: true, + textColor: Colors.white, + onTap: () { + getDetails( + setupID: '010266', + projectID: 15, + patientIdentificationID: + model.user + .patientIdentificationNo, + patientID: model + .user.patientID, + name: model.user + .firstName + + " " + + model + .user.lastName,context: context); + }, + ), + ), + ], + ), + ), + ) + ], + ), + ), + if(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList != null ?? false) + ...List.generate(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, (index) => + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 + ? Container( + margin: EdgeInsets.all(10.0), + child: Card( + margin: EdgeInsets.fromLTRB( + 8.0, 16.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: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 2.0, + left: 10.0, + right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts( + model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList[ + index] + .patientName, + fontSize: 14, + color: Colors.black, + fontWeight: + FontWeight.w500, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of( + context) + .fileno + + ": " + + model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList[ + index] + .patientID + .toString(), + fontSize: 14, + color: Colors.black, + fontWeight: + FontWeight.w500, + ) + ], + ), + ), + ), + Expanded( + flex: 2, + child: Container( + margin: + EdgeInsets.only(top: 2.0), + child: Column( + children: [ + Container( + child: SecondaryButton( + label: TranslationBase + .of(context) + .fetchData, + small: true, + textColor: + Colors.white, + onTap: () { + getDetails( + projectID: 15, + patientIdentificationID: model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList[ + index] + .patientIdenficationNumber, + setupID: + '010266', + patientID: model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList[ + index] + .responseID, + name: model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList[ + index].patientName,context: context); + }, + ), + ), + ], + ), + ), + ) + ], + ), + ), + ), + ) + : Container() + ), + + ], + ), + ); + } + + getDetails( + {String setupID, + int projectID, + String patientIdentificationID, + int patientID, + String name,BuildContext context}) { + GifLoaderDialogUtils.showMyDialog(context); + _insuranceCardService + .getPatientInsuranceDetails( + setupID: setupID, + projectID: projectID, + patientID: patientID, + patientIdentificationID: patientIdentificationID) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (!_insuranceCardService.hasError && _insuranceCardService.isHaveInsuranceCard) { + Navigator.push( + context, + FadePage( + page: InsuranceCardUpdateDetails( + insuranceCardDetailsModel: _insuranceCardService.insuranceCardDetailsList, + patientID: patientID, + patientIdentificationID: patientIdentificationID, + name: name, + ))); + } else { + AppToast.showErrorToast(message: _insuranceCardService.error); + } + }); + } +} diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart index 1e616108..36b424a8 100644 --- a/lib/pages/insurance/insurance_update_screen.dart +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -1,14 +1,22 @@ +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:flutter/cupertino.dart'; import '../base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; -import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; -import 'package:rating_bar/rating_bar.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; + +import 'insurance_card_update_details.dart'; +import 'insurance_page.dart'; class InsuranceUpdate extends StatefulWidget { @override @@ -18,11 +26,13 @@ class InsuranceUpdate extends StatefulWidget { class _InsuranceUpdateState extends State with SingleTickerProviderStateMixin { TabController _tabController; - + List imagesInfo = List(); @override void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); + + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png')); } void dispose() { @@ -35,8 +45,12 @@ class _InsuranceUpdateState extends State onModelReady: (model) => model.getInsuranceUpdated(), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( - appBarTitle: 'Insurance Cards', + appBarTitle: TranslationBase.of(context).insurCards, + description: TranslationBase.of(context).infoInsurCards, + infoList: TranslationBase.of(context).infoPrescriptionsPoints, + imagesInfo: imagesInfo, isShowAppBar: true, + isShowDecPage: true, baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, @@ -63,7 +77,7 @@ class _InsuranceUpdateState extends State controller: _tabController, isScrollable: true, indicatorWeight: 4.0, - indicatorColor: Colors.red, + indicatorColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.symmetric( horizontal: 13.0, vertical: 2.0), @@ -72,13 +86,14 @@ class _InsuranceUpdateState extends State Container( width: MediaQuery.of(context).size.width * 0.35, child: Center( - child: Texts('Card'), + child: Texts(TranslationBase.of(context) + .updateInsuranceSubtitle), ), ), Container( width: MediaQuery.of(context).size.width * 0.35, child: Center( - child: Texts('History'), + child: Texts(TranslationBase.of(context).history), ), ), ], @@ -96,85 +111,7 @@ class _InsuranceUpdateState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - Container( - child: ListView.builder( - itemCount: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, - itemBuilder: (BuildContext context, int index) { - return Container( - margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.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: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only( - top: 2.0, left: 10.0, right: 20.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - model.getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index].patientName, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.w500, - letterSpacing: 1.0)), - Text( - 'File No.' + - model.getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index].patientID.toString(), - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.w500, - letterSpacing: 1.0)), - ], - ), - ), - ), - Expanded( - flex: 2, - child: Container( - // height: MediaQuery.of(context).size.height * 0.12, - margin: EdgeInsets.only(top: 2.0), - child: Column( - children: [ - Container( - child: SecondaryButton( - label: 'Update', - small: true, - textColor: Colors.white, - // color: Colors.grey, - ), - //height: 45, - // width:90 - ), - ], - ), - ), - ) - ], - ), - ), - ), - ); - }), - ), + InsurancePage(model:model), Container( child: ListView.builder( itemCount: model.insuranceUpdate == null @@ -210,35 +147,40 @@ class _InsuranceUpdateState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("TAMER FANASHEH ", - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: - FontWeight.w500, - letterSpacing: 1.0)), - Text( - 'File No.' + - model - .insuranceUpdate[ - index] - .patientID - .toString(), - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: - FontWeight.w500, - letterSpacing: 1.0)), - Text( - model.insuranceUpdate[index] - .createdOn, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: - FontWeight.w500, - letterSpacing: 1.0)), + Texts( + model.user.firstName + + " " + + model.user.lastName, + fontSize: 14, + fontWeight: FontWeight.w500, + color: Colors.black, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context) + .fileno + + ": " + + model + .insuranceUpdate[ + index] + .patientID + .toString(), + fontSize: 14, + fontWeight: FontWeight.w500, + color: Colors.black, + ), + SizedBox( + height: 8, + ), + Texts( + model.insuranceUpdate[index] + .createdOn, + fontSize: 14, + fontWeight: FontWeight.w500, + color: Colors.black, + ), ], ), ), @@ -246,7 +188,6 @@ class _InsuranceUpdateState extends State Expanded( flex: 1, child: Container( -// height: MediaQuery.of(context).size.height * 0.12, margin: EdgeInsets.only(top: 20.0), child: Column( children: [ @@ -257,15 +198,13 @@ class _InsuranceUpdateState extends State Container( margin: EdgeInsets.only( top: 13.5, left: 2.0), - child: Text( - model - .insuranceUpdate[ - index] - .statusDescription, - textAlign: - TextAlign.center, - style: TextStyle( - fontSize: 12.0)), + child: Texts( + model.insuranceUpdate[index] + .statusDescription, + textAlign: TextAlign.center, + fontSize: 12, + color: Colors.black, + ), ), ], ), @@ -288,4 +227,6 @@ class _InsuranceUpdateState extends State ), ); } + + } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 6c7f0009..cd8a8a2d 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -1,8 +1,8 @@ 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_page.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_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'; @@ -11,13 +11,6 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -75,7 +68,7 @@ class _HomePageState extends State { right: 5, child: Container( width: - MediaQuery.of(context).size.width * 0.8, + MediaQuery.of(context).size.width * 0.8, child: Row( children: [ Expanded( @@ -90,7 +83,7 @@ class _HomePageState extends State { fit: BoxFit.fill, ), color: - Colors.white.withOpacity(0.3), + Colors.white.withOpacity(0.3), borderRadius: BorderRadius.all( Radius.circular(5))), child: Container( @@ -101,15 +94,13 @@ class _HomePageState extends State { style: TextStyle( color: Colors.white, fontWeight: - FontWeight.bold, + FontWeight.bold, fontSize: 18.0)), Row( children: [ Container( margin: EdgeInsets.only( - top: 15.0, - left: 3.5, - right: 3.5), + top: 15.0, left: 3.5, right: 3.5), child: SvgPicture.asset( 'assets/images/new-design/covid-19-car.svg', width: 45.0, @@ -126,34 +117,34 @@ class _HomePageState extends State { color: Colors .white, fontWeight: - FontWeight - .bold, + FontWeight + .bold, fontSize: - 16.0)), + 16.0)), ButtonTheme( shape: - RoundedRectangleBorder( + RoundedRectangleBorder( borderRadius: - BorderRadius - .circular( - 5.0), + BorderRadius + .circular( + 5.0), ), minWidth: MediaQuery.of( - context) - .size - .width * + context) + .size + .width * 0.15, height: 25.0, child: RaisedButton( color: Colors .red[800], textColor: - Colors.white, + Colors.white, disabledTextColor: - Colors.white, + Colors.white, disabledColor: - new Color( - 0xFFbcc2c4), + new Color( + 0xFFbcc2c4), onPressed: () { navigateToCovidDriveThru(); }, @@ -161,7 +152,7 @@ class _HomePageState extends State { "BOOK NOW", style: TextStyle( fontSize: - 12.0)), + 12.0)), ), ), ], @@ -209,358 +200,360 @@ class _HomePageState extends State { top: 155, left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == - Orientation.landscape + Orientation.landscape ? 0.02 : 0.03), right: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == - Orientation.landscape + Orientation.landscape ? 0.02 : 0.03), child: (!model.isLogin && projectViewModel.user == null) ? Container( - width: double.infinity, - height: 125, - decoration: BoxDecoration( - color: HexColor('#A59E9E'), - shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, width: 0.5), - borderRadius: - BorderRadius.all(Radius.circular(9)), - image: DecorationImage( - image: ExactAssetImage( - 'assets/images/bg_graphic.png'), - fit: BoxFit.cover)), - child: Container( - margin: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, - ), - Texts( - TranslationBase.of(context).myMedicalFile, - color: Colors.black87, - bold: true, - fontSize: 23, - ), - SizedBox( - height: 5, + width: double.infinity, + height: 125, + decoration: BoxDecoration( + color: HexColor('#A59E9E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, width: 0.5), + borderRadius: + BorderRadius.all(Radius.circular(9)), + image: DecorationImage( + image: ExactAssetImage( + 'assets/images/bg_graphic.png'), + fit: BoxFit.cover)), + child: Container( + margin: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context).myMedicalFile, + color: Colors.black87, + bold: true, + fontSize: 23, + ), + SizedBox( + height: 5, + ), + Texts( + TranslationBase.of(context) + .myMedicalFileSubTitle, + color: Colors.black, + fontSize: 16, + ), + Align( + alignment: projectViewModel.isArabic + ? Alignment.bottomRight + : Alignment.bottomLeft, + child: InkWell( + onTap: () { + widget.goToMyProfile(); + }, + child: Container( + margin: EdgeInsets.all(2), + width: 90, + height: 30, + decoration: BoxDecoration( + color: HexColor('#D81A2E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, + width: 0.5), + borderRadius: BorderRadius.all( + Radius.circular(9)), ), - Texts( - TranslationBase.of(context) - .myMedicalFileSubTitle, - color: Colors.black, - fontSize: 16, + child: Center( + child: Texts( + TranslationBase.of(context) + .viewMore, + color: Colors.white, + fontSize: 12, + ), ), - Align( - alignment: projectViewModel.isArabic - ? Alignment.bottomRight - : Alignment.bottomLeft, - child: InkWell( - onTap: () { - widget.goToMyProfile(); - }, - child: Container( - margin: EdgeInsets.all(2), - width: 90, - height: 30, - decoration: BoxDecoration( - color: HexColor('#D81A2E'), - shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, - width: 0.5), - borderRadius: BorderRadius.all( - Radius.circular(9)), + ), + ), + ) + ], + ), + ), + ) + : Container( + width: double.infinity, + height: 130, + decoration: BoxDecoration( + color: HexColor('#A59E9E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, width: 0.5), + borderRadius: + BorderRadius.all(Radius.circular(9)), + image: DecorationImage( + image: ExactAssetImage( + 'assets/images/bg_graphic.png'), + fit: BoxFit.cover), + ), + child: Container( + margin: EdgeInsets.all(5), + child: Column( + children: [ + Row( + children: [ + if (model.user != null) + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, ), - child: Center( - child: Texts( - TranslationBase.of(context) - .viewMore, - color: Colors.white, - fontSize: 12, - ), + Texts( + model.user.firstName + + " " + + model.user.lastName, + color: Colors.grey[100], + bold: true, + fontSize: 15, + ), + Texts( + '${model.user.patientID}', + color: Colors.white, + fontSize: 14, + ), + SizedBox( + height: 5, + ), + Texts( + '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}', + color: Colors.grey[100], + fontWeight: FontWeight.normal, + fontSize: 14, ), + ], + ), + ), + InkWell( + onTap: () { + widget.goToMyProfile(); + }, + child: Container( + margin: EdgeInsets.all(2), + width: 90, + height: 30, + decoration: BoxDecoration( + color: HexColor('#D81A2E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, + width: 0.5), + borderRadius: BorderRadius.all( + Radius.circular(5), ), ), - ) - ], - ), - ), - ) - : Container( - width: double.infinity, - height: 130, - decoration: BoxDecoration( - color: HexColor('#A59E9E'), - shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, width: 0.5), - borderRadius: - BorderRadius.all(Radius.circular(9)), - image: DecorationImage( - image: ExactAssetImage( - 'assets/images/bg_graphic.png'), - fit: BoxFit.cover), + child: Center( + child: Texts( + TranslationBase.of(context) + .viewMore, + color: Colors.white, + fontSize: 12, + ), + ), + ), + ) + ], ), - child: Container( - margin: EdgeInsets.all(5), - child: Column( - children: [ - Row( + Row( + //crossAxisAlignment: CrossAxisAlignment.center, + //mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - if (model.user != null) - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, - ), - Texts( - model.user.firstName + - " " + - model.user.lastName, - color: Colors.grey[100], - bold: true, - fontSize: 15, - ), - Texts( - '${model.user.patientID}', - color: Colors.white, - fontSize: 14, - ), - SizedBox( - height: 5, - ), - Texts( - '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}', - color: Colors.grey[100], - fontWeight: FontWeight.normal, - fontSize: 14, - ), - ], - ), - ), - InkWell( - onTap: () { - widget.goToMyProfile(); - }, - child: Container( - margin: EdgeInsets.all(2), - width: 90, - height: 30, - decoration: BoxDecoration( - color: HexColor('#D81A2E'), - shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, - width: 0.5), - borderRadius: BorderRadius.all( - Radius.circular(5), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context) - .viewMore, - color: Colors.white, - fontSize: 12, - ), - ), - ), + Image.asset( + 'assets/images/height_icon.png', + width: 35, + height: 40, + ), + Texts( + "${model.heightCm}", + color: Colors.white, ) ], ), - Row( - //crossAxisAlignment: CrossAxisAlignment.center, - //mainAxisAlignment: MainAxisAlignment.spaceAround, + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Image.asset( - 'assets/images/height_icon.png', - width: 35, - height: 40, - ), - Texts( - "${model.heightCm}", - color: Colors.white, - ) - ], - ), - ), - SizedBox( - width: 3, - ), - Expanded( - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Image.asset( - 'assets/images/weight_icon.png', - width: 25, - height: 40, - ), - Texts( - '${model.weightKg}', - color: Colors.white, - ) - ], - ), + Image.asset( + 'assets/images/weight_icon.png', + width: 25, + height: 40, ), - SizedBox( - width: 3, - ), - Expanded( - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Image.asset( - 'assets/images/blood_icon.png', - width: 35, - height: 40, - ), - Texts( - '${model.bloadType}', - color: Colors.white, - ) - ], - ), + Texts( + '${model.weightKg}', + color: Colors.white, + ) + ], + ), + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Image.asset( + 'assets/images/blood_icon.png', + width: 35, + height: 40, ), + Texts( + '${model.booldType}', + color: Colors.white, + ) ], - ) - ], - ), - ), - ), + ), + ), + ], + ) + ], + ), + ), + ), ), ], ), - Container( - margin: EdgeInsets.only(left: 15, right: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - DashboardItem( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomeHealthCarePage(), - ), - ); - }, - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/home_health_care_icon.png', - width: 50, - height: 50, + if(projectViewModel.havePrivilege(64)||projectViewModel.havePrivilege(65)||projectViewModel.havePrivilege(67)) + Container( + margin: EdgeInsets.only(left: 15, right: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if(projectViewModel.havePrivilege(64)) + DashboardItem( + onTap: () { + Navigator.push( + context, + FadePage( + page: HomeHealthCareIndexPage(), ), - SizedBox( - height: 3, + ); + }, + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/home_health_care_icon.png', + width: 50, + height: 50, + ), + SizedBox( + height: 3, + ), + Texts( + TranslationBase.of(context) + .homeHealthCareService, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), - Texts( - TranslationBase.of(context) - .homeHealthCareService, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, - ) - ], + ), ), + height: MediaQuery.of(context).size.width * 0.4, + imageName: 'home_healthcare_service_bg.png', + opacity: 0.5, ), - ), - height: MediaQuery.of(context).size.width * 0.4, - imageName: 'home_healthcare_service_bg.png', - opacity: 0.5, - ), - DashboardItem( - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/pharmacy_logo.png', - width: 40, - height: 40, - ), - SizedBox( - height: 20, + if(projectViewModel.havePrivilege(65)) + DashboardItem( + onTap: () => Navigator.push(context, FadePage(page: LandingPagePharmacy())), + + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/pharmacy_logo.png', + width: 40, + height: 40, + ), + SizedBox( + height: 20, + ), + Texts( + TranslationBase.of(context).onlinePharmacy, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), - Texts( - TranslationBase.of(context).onlinePharmacy, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, - ) - ], + ), ), + height: MediaQuery.of(context).size.width * 0.4, + imageName: 'al-habib_onlne_pharmacy_bg.png', ), - ), - height: MediaQuery.of(context).size.width * 0.4, - imageName: 'al-habib_onlne_pharmacy_bg.png', - onTap: () => Navigator.push( - context, - FadePage(page: LandingPagePharmacy()), - ), - ), - DashboardItem( - onTap: () { - Navigator.push( - context, - FadePage( - page: CMCPage(), - ), - ); - }, - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/comprehensive_medical_checkup_logo.png', - width: 50, - height: 50, + if(projectViewModel.havePrivilege(67)) + DashboardItem( + onTap: (){ + Navigator.push( + context, + FadePage( + page: CMCIndexPage(), ), - SizedBox( - height: 3, + ); + }, + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/comprehensive_medical_checkup_logo.png', + width: 50, + height: 50, + ), + SizedBox( + height: 3, + ), + Texts( + TranslationBase.of(context).emergencyService, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), - Texts( - TranslationBase.of(context).emergencyService, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: SizeConfig.textMultiplier * 1.7, - ) - ], + ), ), + height: MediaQuery.of(context).size.width * 0.4, + color: HexColor("#747C80"), + imageName: 'emergency_service_image.png', ), - ), - height: MediaQuery.of(context).size.width * 0.4, - color: HexColor("#747C80"), - imageName: 'emergency_service_image.png', - ), - ], + ], + ), ), - ), SizedBox( height: 8, ), @@ -636,47 +629,48 @@ class _HomePageState extends State { borderRadius: BorderRadius.circular(6.0), color: Colors.white, )), - Container( - width: MediaQuery.of(context).size.width * 0.29, - child: InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: ErOptions( - isAppbar: true, - ))), - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/Dr_Schedule_report.png', - width: 50, - height: 50, - ), - SizedBox( - height: 10, - ), - Texts( - TranslationBase.of(context) - .emergencyServices, - textAlign: TextAlign.center, - color: Colors.black87, - bold: false, - fontSize: SizeConfig.textMultiplier * 1.7, - ) - ], + if(projectViewModel.havePrivilege(60)) + Container( + width: MediaQuery.of(context).size.width * 0.29, + child: InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: ErOptions( + isAppbar: true, + ))), + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/Dr_Schedule_report.png', + width: 50, + height: 50, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context) + .emergencyServices, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], + ), ), ), ), + height: MediaQuery.of(context).size.width * 0.4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Colors.white, + ), ), - height: MediaQuery.of(context).size.width * 0.4, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, - ), - ), ], ), ), @@ -772,7 +766,7 @@ class _HomePageState extends State { ), ), SizedBox( - height: 80, + height: 120, ) ], ), @@ -791,15 +785,15 @@ class _HomePageState extends State { class DashboardItem extends StatelessWidget { const DashboardItem( {this.hasBorder = false, - this.imageName, - @required this.child, - this.onTap, - Key key, - this.width, - this.height, - this.color, - this.opacity = 0.4, - this.hasColorFilter = true}) + this.imageName, + @required this.child, + this.onTap, + Key key, + this.width, + this.height, + this.color, + this.opacity = 0.4, + this.hasColorFilter = true}) : super(key: key); final bool hasBorder; final String imageName; @@ -820,13 +814,13 @@ class DashboardItem extends StatelessWidget { height: height != null ? height : MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.19 - : MediaQuery.of(context).size.height * 0.35, + ? MediaQuery.of(context).size.height * 0.19 + : MediaQuery.of(context).size.height * 0.35, decoration: BoxDecoration( color: !hasBorder ? color != null - ? color - : HexColor('#050705').withOpacity(opacity) + ? color + : HexColor('#050705').withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), border: hasBorder @@ -834,13 +828,11 @@ class DashboardItem extends StatelessWidget { : Border.all(width: 0.0, color: Colors.transparent), image: imageName != null ? DecorationImage( - image: ExactAssetImage('assets/images/$imageName'), - fit: BoxFit.cover, - colorFilter: hasColorFilter - ? new ColorFilter.mode( - Colors.black.withOpacity(0.2), BlendMode.dstIn) - : null, - ) + image: ExactAssetImage('assets/images/$imageName'), + fit: BoxFit.cover, + colorFilter: hasColorFilter ? new ColorFilter.mode( + Colors.black.withOpacity(0.2), BlendMode.dstIn) : null, + ) : null, ), child: Center( diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index b47a1e75..e1dd6b63 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,9 +1,10 @@ import 'dart:io'; -import 'dart:typed_data'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; @@ -14,11 +15,16 @@ import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' + as family; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; -import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; -import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; +import 'package:diplomaticquarterapp/uitl/HMGNetworkConnectivity.dart'; +import 'package:diplomaticquarterapp/uitl/HMG_Geofence.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; +import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; @@ -31,7 +37,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import '../../locator.dart'; import '../../routes.dart'; import 'home_page.dart'; @@ -46,31 +52,36 @@ class LandingPage extends StatefulWidget { } class _LandingPageState extends State with WidgetsBindingObserver { + var authProvider = new AuthProvider(); + int currentTab = 0; PageController pageController; ProjectViewModel projectViewModel; var notificationCount = ''; var themeNotifier; + ///inject the user data - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator< + AuthenticatedUserObject>(); final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final authService = new AuthProvider(); var event = RobotProvider(); + var familyFileProvider = family.FamilyFilesProvider(); void _requestIOSPermissions() { flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< - IOSFlutterLocalNotificationsPlugin>() + IOSFlutterLocalNotificationsPlugin>() ?.requestPermissions( - alert: true, - badge: true, - sound: true, - ); + alert: true, + badge: true, + sound: true, + ); } bool isPageNavigated = false; + LocationUtils locationUtils; _changeCurrentTab(int tab) { setState(() { @@ -93,16 +104,16 @@ class _LandingPageState extends State with WidgetsBindingObserver { print("didChangeAppLifecycleState"); print('state = $state'); AppGlobal.context = context; - if (state == AppLifecycleState.resumed) { print(LandingPage.isOpenCallPage); if (LandingPage.isOpenCallPage) { if (!isPageNavigated) { isPageNavigated = true; Navigator.push( - context, - MaterialPageRoute( - builder: (context) => IncomingCall( + context, + MaterialPageRoute( + builder: (context) => + IncomingCall( incomingCallData: LandingPage.incomingCallData))) .then((value) { isPageNavigated = false; @@ -138,27 +149,41 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); - - + // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] + HMGNetworkConnectivity(context, () { + GifLoaderDialogUtils.showMyDialog(context); + PlatformBridge().connectHMGGuestWifi().then((value) => + { + GifLoaderDialogUtils.hideDialog(context) + }); + }).checkAndConnectIfNoInternet(); if (Platform.isIOS) { _firebaseMessaging.requestNotificationPermissions(); } - _firebaseMessaging.getToken().then((String token) async { - sharedPref.setString(PUSH_TOKEN, token); - if (token != null && await sharedPref.getObject(USER_PROFILE) ==null) { - DEVICE_TOKEN = token; - checkUserStatus(token); - } - requestPermissions(); - }).catchError((err) { - print(err); + // Flip Permission Checks [Zohaib Kambrani] + requestPermissions().then((results) { + if (results[Permission.notification].isGranted) + _firebaseMessaging.getToken().then((String token) { + sharedPref.setString(PUSH_TOKEN, token); + if (token != null && DEVICE_TOKEN == "") { + DEVICE_TOKEN = token; + checkUserStatus(token); + } + }); + + if (results[Permission.location].isGranted); + if (results[Permission.storage].isGranted); + if (results[Permission.camera].isGranted); + if (results[Permission.photos].isGranted); + if (results[Permission.accessMediaLocation].isGranted); + if (results[Permission.calendar].isGranted); }); + requestPermissions(); + // }); // // //_firebase Background message handler - Future.delayed(Duration.zero, () => setTheme()); - //_firebase Background message handler // _firebaseMessaging.configure( // // onMessage: (Map message) async { // // showDialog("onMessage: $message"); @@ -279,16 +304,21 @@ class _LandingPageState extends State with WidgetsBindingObserver { ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: message, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, + okText: TranslationBase + .of(context) + .confirm, + cancelText: TranslationBase + .of(context) + .cancel_nocaps, okFunction: () => {}, cancelFunction: () => {}); dialog.showAlertDialog(context); } - void requestPermissions() async { - await [ + Future> requestPermissions() async { + var permissionResults = [ Permission.location, + Permission.locationAlways, Permission.storage, Permission.camera, Permission.photos, @@ -300,57 +330,183 @@ class _LandingPageState extends State with WidgetsBindingObserver { var permissionsGranted = await deviceCalendarPlugin.hasPermissions(); if (permissionsGranted.isSuccess && !permissionsGranted.data) { permissionsGranted = await deviceCalendarPlugin.requestPermissions(); - if (!permissionsGranted.isSuccess || !permissionsGranted.data) { - return; - } + if (!permissionsGranted.isSuccess || !permissionsGranted.data) {} + } + return permissionResults; + } + + setTheme() async { + // + // defaultTheme = + // ThemeData( + // fontFamily:projectViewModel.isArabic ? 'Cairo' : 'WorkSans', + // primarySwatch: Colors.blue, + // visualDensity: VisualDensity.adaptivePlatformDensity, + // brightness: Brightness.light, + // pageTransitionsTheme: const PageTransitionsTheme( + // builders: { + // TargetPlatform.android: ZoomPageTransitionsBuilder(), + // TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + // }, + // ), + // hintColor: Colors.grey[400], + // disabledColor: Colors.grey[300], + // errorColor: Color.fromRGBO(235, 80, 60, 1.0), + // scaffoldBackgroundColor: Color(0xffEEEEEE), + // textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + // textSelectionHandleColor: Colors.grey, + // canvasColor: Colors.white, + // backgroundColor: Colors.white, + // highlightColor: Colors.grey[100].withOpacity(0.4), + // splashColor: Colors.transparent, + // primaryColor: Color(0xff40ACC9), + // bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + // cursorColor: Colors.grey, + // cardColor: Colors.white, + // iconTheme: IconThemeData(), + // appBarTheme: AppBarTheme( + // color: Color(0xff40ACC9), + // brightness: Brightness.dark, + // elevation: 10.0, + // actionsIconTheme: IconThemeData( + // color: Color(0xff40ACC9), + // ), + // ), + // ); + // 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']); + if (message.containsKey('data')) { + print("myBackgroundMessageHandler Inside"); + LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + print(LandingPage.incomingCallData.doctorname); + LandingPage.isOpenCallPage = true; + } + + if (message.containsKey('notification')) { + final dynamic notification = message['notification']; + print(notification); + } + } + + void setUserValues(value) async { + if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); + } + + Future getUserInformation() async { + var userInfoJson = sharedPref.getObject(IMEI_USER_DATA); + return userInfoJson; + } + + checkValue(projectProvider) { + if (projectProvider.searchValue != null) { + _changeCurrentTab(2); + } + } + + registerGeofences() async { + await locator().getAllGeoZones(GeoZonesRequestModel()); + + void doIt() { + getUserInformation().then((value) { + if (value != null) projectViewModel.platformBridge() + .registerHmgGeofences(); + }); + } + + if (await Permission.location.isGranted) { + doIt(); + } else { + [Permission.location].request().then((value) async { + if (await Permission.location.isGranted) { + doIt(); + } + }); + } + + requestPermissions().then((results) {}); + } + + login() async { + var data = await sharedPref.getObject(IMEI_USER_DATA); + sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + GifLoaderDialogUtils.showMyDialog(context); + authService + .selectDeviceImei(DEVICE_TOKEN) + .then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + setUserValues(value); + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + }); } } - Future _scheduleNotification() async { - var scheduledNotificationDateTime = - DateTime.now().add(Duration(seconds: 5)); - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; - - var androidPlatformChannelSpecifics = AndroidNotificationDetails( - 'your other channel id', - 'your other channel name', - 'your other channel description', - // icon: 'secondary_icon', - sound: RawResourceAndroidNotificationSound('slow_spring_board'), - largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'), - vibrationPattern: vibrationPattern, - enableLights: true, - color: const Color.fromARGB(255, 255, 0, 0), - ledColor: const Color.fromARGB(255, 255, 0, 0), - ledOnMs: 1000, - ledOffMs: 500); - var iOSPlatformChannelSpecifics = - IOSNotificationDetails(sound: 'slow_spring_board.aiff'); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.schedule( - // 0, - // 'scheduled title', - // 'scheduled body', - // scheduledNotificationDateTime, - // platformChannelSpecifics); + getNotificationCount(token) async { + 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'] > + 99 + ? '99+' + : value['List_PatientDashboard'][0] + ['UnreadPatientNotificationCount'] + .toString(); + + sharedPref.setString(NOTIFICATION_COUNT, notificationCount); + }) + }); + familyFileProvider.getSharedRecordByStatus(); + } + } } + @override Widget build(BuildContext context) { - projectViewModel = Provider.of(context); - themeNotifier = Provider.of(context); - //setTheme(); + projectViewModel = Provider.of(context); + return Scaffold( appBar: AppBar( elevation: 0, textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + headline6: TextStyle( + color: Colors.white, fontWeight: FontWeight.bold), ), title: Text( getText(currentTab).toUpperCase(), @@ -372,28 +528,28 @@ class _LandingPageState extends State with WidgetsBindingObserver { ), notificationCount != '' ? new Positioned( - right: projectViewModel.isArabic ? 35 : 0, - top: 5, - child: new Container( - padding: EdgeInsets.all(4), - decoration: new BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(20), - ), - constraints: BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: new Text( - notificationCount, - style: new TextStyle( - color: Colors.white, - fontSize: projectViewModel.isArabic ? 8 : 9, - ), - textAlign: TextAlign.center, - ), - ), - ) + right: projectViewModel.isArabic ? 35 : 0, + top: 5, + child: new Container( + padding: EdgeInsets.all(4), + decoration: new BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + notificationCount, + style: new TextStyle( + color: Colors.white, + fontSize: projectViewModel.isArabic ? 8 : 9, + ), + textAlign: TextAlign.center, + ), + ), + ) : SizedBox() ], ); @@ -412,7 +568,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { SETTINGS, ); else - login(); + login(); }, //do something, ) ], @@ -432,7 +588,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { MedicalProfilePage(), BookingOptions(), MyFamily(isAppbarVisible: false), - ToDo(), + ToDo(isShowAppBar: false), ], // Please do not remove the BookingOptions from this array ), bottomNavigationBar: BottomNavBar( @@ -442,10 +598,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: currentTab == 0 ? FloatingButton( - elevation: true, - onTap: () { - _changeCurrentTab(2); - }) + elevation: true, + onTap: () { + _changeCurrentTab(2); + }) : null); } @@ -464,104 +620,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { case 3: return TranslationBase.of(context).services; case 4: - return TranslationBase.of(context).bookAppo; - } - } - setTheme() async{ - // - // defaultTheme = - // ThemeData( - // fontFamily:projectViewModel.isArabic ? 'Cairo' : 'WorkSans', - // primarySwatch: Colors.blue, - // visualDensity: VisualDensity.adaptivePlatformDensity, - // brightness: Brightness.light, - // pageTransitionsTheme: const PageTransitionsTheme( - // builders: { - // TargetPlatform.android: ZoomPageTransitionsBuilder(), - // TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), - // }, - // ), - // hintColor: Colors.grey[400], - // disabledColor: Colors.grey[300], - // errorColor: Color.fromRGBO(235, 80, 60, 1.0), - // scaffoldBackgroundColor: Color(0xffEEEEEE), - // textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - // textSelectionHandleColor: Colors.grey, - // canvasColor: Colors.white, - // backgroundColor: Colors.white, - // highlightColor: Colors.grey[100].withOpacity(0.4), - // splashColor: Colors.transparent, - // primaryColor: Color(0xff40ACC9), - // bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), - // cursorColor: Colors.grey, - // cardColor: Colors.white, - // iconTheme: IconThemeData(), - // appBarTheme: AppBarTheme( - // color: Color(0xff40ACC9), - // brightness: Brightness.dark, - // elevation: 10.0, - // actionsIconTheme: IconThemeData( - // color: Color(0xff40ACC9), - // ), - // ), - // ); - // themeNotifier.setTheme(defaultTheme); - } - void checkUserStatus(token) async { - authService - .selectDeviceImei(token) - .then((SelectDeviceIMEIRES value) => setUserValues(value)); - 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(); - }) - }); - } - } - } - - static Future myBackgroundMessageHandler( - Map message) async { - Map myMap = new Map.from(message['data']); - if (message.containsKey('data')) { - print("myBackgroundMessageHandler Inside"); - LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - print(LandingPage.incomingCallData.doctorname); - LandingPage.isOpenCallPage = true; - } - - if (message.containsKey('notification')) { - final dynamic notification = message['notification']; - print(notification); + return TranslationBase + .of(context) + .bookAppo; } } +} - void setUserValues(value) async { - sharedPref.setObject(IMEI_USER_DATA, value); - } - checkValue(projectProvider) { - if (projectProvider.searchValue != null) { - _changeCurrentTab(2); - } - } - login() async { - var data = await sharedPref.getObject(IMEI_USER_DATA); - sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); - if (data != null) { - Navigator.of(context).pushNamed(CONFIRM_LOGIN); - } else { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); - } - } -} diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 59492370..52bbb888 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import '../offers_categorise_page.dart'; @@ -136,7 +137,8 @@ class _LandingPagePharmacyState extends State { children: [ PharmacyPage(), PharmacyCategorisePage(), - OffersCategorisePage(), +// OffersCategorisePage(), + WishlistPage(), PharmacyProfilePage(), // Container( // child: Text('text'), diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 8ce3b7b0..fc27d92b 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -17,13 +17,13 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; class ClinicList extends StatefulWidget { final Function getLiveCareHistory; @@ -79,31 +79,27 @@ class _clinic_listState extends State { void startLiveCare() { bool isError = false; LiveCareService service = new LiveCareService(); + GifLoaderDialogUtils.showMyDialog(context); ERAppointmentFeesResponse erAppointmentFeesResponse = new ERAppointmentFeesResponse(); - service - .getERAppointmentFees(selectedClinicID, context) - .then((res) { - if (res['HasAppointment'] == true) { - isError = true; - showLiveCareCancelDialog(res['ErrorEndUserMessage'], res); - } else { - erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res); - isError = false; - } - }) - .catchError((err) { - print(err); - isError = true; - AppToast.showErrorToast(message: err); - }) - .showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) - .then((value) { - if (!isError) - getERAppointmentTime( - erAppointmentFeesResponse.getERAppointmentFeesList); - }); + service.getERAppointmentFees(selectedClinicID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['HasAppointment'] == true) { + isError = true; + showLiveCareCancelDialog(res['ErrorEndUserMessage'], res); + } else { + erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res); + isError = false; + } + if (!isError) + getERAppointmentTime( + erAppointmentFeesResponse.getERAppointmentFeesList); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + isError = true; + AppToast.showErrorToast(message: err); + }); } showLiveCareCancelDialog(String msg, res) { @@ -112,8 +108,7 @@ class _clinic_listState extends State { confirmMessage: msg, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => - {cancelAppointment(res)}, + okFunction: () => {cancelAppointment(res)}, cancelFunction: () => {}); dialog.showAlertDialog(context); } @@ -132,38 +127,37 @@ class _clinic_listState extends State { appo.appointmentDate = res['AppointmentDate']; ConfirmDialog.closeAlertDialog(context); + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .cancelAppointment(appo, context) - .then((res) { - print(res); - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }) - .catchError((err) { - print(err); - }) - .showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) - .then((value) { - startLiveCare(); - }); + service.cancelAppointment(appo, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + startLiveCare(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); } getERAppointmentTime(GetERAppointmentFeesList getERAppointmentFeesList) { LiveCareService service = new LiveCareService(); + GifLoaderDialogUtils.showMyDialog(context); service.getERAppointmentTime(selectedClinicID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res); showLiveCarePaymentDialog( getERAppointmentFeesList, res['WatingtimeInteger']); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } showLiveCarePaymentDialog( @@ -320,12 +314,14 @@ class _clinic_listState extends State { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); service .checkPaymentStatus( Utils.getAppointmentTransID( appo.projectID, appo.clinicID, appo.appointmentNo), context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); print("Printing Payment Status Reponse!!!!"); print(res); String paymentInfo = res['Response_Message']; @@ -336,27 +332,27 @@ class _clinic_listState extends State { AppToast.showErrorToast(message: res['Response_Message']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } addNewCallForPatientER(String clientRequestID) { LiveCareService service = new LiveCareService(); + GifLoaderDialogUtils.showMyDialog(context); service .addNewCallForPatientER(selectedClinicID, clientRequestID, context) .then((res) { - AppToast.showSuccessToast( - message: "New Call has been added successfully"); - }) - .catchError((err) { - print(err); - }) - .showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) - .then((value) { - widget.getLiveCareHistory(); - }); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast( + message: "New Call has been added successfully"); + widget.getLiveCareHistory(); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); } getLanguageID() async { @@ -366,7 +362,9 @@ class _clinic_listState extends State { getLiveCareClinicsList() { isDataLoaded = false; LiveCareService service = new LiveCareService(); + GifLoaderDialogUtils.showMyDialog(context); service.getLivecareClinics(context).then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res['PatientER_GetClinicsList'].length); if (res['MessageStatus'] == 1) { setState(() { @@ -384,15 +382,18 @@ class _clinic_listState extends State { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } getLiveCareScheduleClinicsList() { isDataLoaded = false; LiveCareService service = new LiveCareService(); + GifLoaderDialogUtils.showMyDialog(context); service.getLiveCareScheduledClinics(context).then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res['ClinicsHaveScheduleList'].length); if (res['MessageStatus'] == 1) { setState(() { @@ -411,9 +412,10 @@ class _clinic_listState extends State { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } openLiveCareSelectionDialog() { @@ -605,13 +607,13 @@ class _clinic_listState extends State { void startScheduleLiveCare() { List doctorsList = []; LiveCareService service = new LiveCareService(); + GifLoaderDialogUtils.showMyDialog(context); List _patientDoctorAppointmentListHospital = List(); service .getLiveCareScheduledDoctorList(context, selectedClinicID) .then((res) { - print(res['DoctorByClinicIDList']); - print(res['DoctorByClinicIDList'].length); + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['DoctorByClinicIDList'].length != 0) { @@ -650,9 +652,10 @@ class _clinic_listState extends State { context, doctorsList, _patientDoctorAppointmentListHospital); } else {} }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Future navigateToSearchResults( diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 87eaf1ce..646158db 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -4,12 +4,16 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.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'; @@ -20,13 +24,14 @@ import 'package:diplomaticquarterapp/widgets/card/rounded_container.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'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; +// import 'package:smart_progress_bar/smart_progress_bar.dart'; class ConfirmLogin extends StatefulWidget { @override @@ -69,11 +74,12 @@ class _ConfirmLogin extends State { int fingrePrintBefore; AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); AppointmentRateViewModel appointmentRateViewModel = - locator(); + locator(); ProjectViewModel projectViewModel; + ToDoCountProviderModel toDoProvider; @override void initState() { @@ -85,6 +91,7 @@ class _ConfirmLogin extends State { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); + toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).confirm, isShowAppBar: true, @@ -96,127 +103,132 @@ class _ConfirmLogin extends State { width: SizeConfig.realScreenWidth, child: Column( children: [ - Expanded( - flex: 3, - child: user != null && isMoreOption == false - ? Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/DQ/dq_logo_icon.png', - height: 90, - width: 90, - ), - AppText( - TranslationBase.of(context).welcomeBack + - ' ' + - user.name, - fontSize: SizeConfig.textMultiplier * 3.5, - ), - AppText( - TranslationBase.of(context).accountInfo, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - Card( - color: Colors.grey[300], - child: Row( - children: [ - Expanded( - child: ListTile( - title: Text( - TranslationBase.of(context).lastLoginAt, - textAlign: TextAlign.center, - ), - subtitle: Text( - user.editedOn != null + user != null && isMoreOption == false + ? Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + 'assets/images/DQ/dq_logo_icon.png', + height: 90, + width: 90, + ), + AppText( + TranslationBase.of(context).welcomeBack + + ' ' + + user.name, + fontSize: SizeConfig.textMultiplier * 3.5, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).accountInfo, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 20, + ), + Card( + color: Colors.grey[300], + child: Row( + children: [ + Flexible( + child: ListTile( + title: Text( + TranslationBase.of(context).lastLoginAt, + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + ), + subtitle: Text( + user.editedOn != null + ? formatDate( + DateUtil.convertStringToDate( + user.editedOn)) + : user.createdOn != null ? formatDate( DateUtil.convertStringToDate( - user.editedOn)) + user.createdOn)) : '--', - textAlign: TextAlign.center), - )), - Expanded( - child: ListTile( - title: Text( - TranslationBase.of(context) - .lastLoginWith, - textAlign: TextAlign.center), - subtitle: Text( - getType(user.logInType, context), - textAlign: TextAlign.center), - )) - ], + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center), + )), + Flexible( + child: ListTile( + title: Text( + TranslationBase.of(context).lastLoginWith, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center), + subtitle: Text( + getType(user.logInType, context), + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center), )) - ], - ) - : Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/DQ/dq_logo_icon.png', - height: 90, - width: 90, - ), - this.onlySMSBox == false - ? AppText( - TranslationBase.of(context) - .verifyLoginWith, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - ) - : AppText( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: SizeConfig.textMultiplier * 2.5, - textAlign: TextAlign.start, - ), - ])), + ], + )), + ], + ) + : Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + 'assets/images/DQ/dq_logo_icon.png', + height: 90, + width: 90, + ), + this.onlySMSBox == false + ? AppText( + TranslationBase.of(context).verifyLoginWith, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.left, + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: SizeConfig.textMultiplier * 2.5, + textAlign: TextAlign.start, + ), + ]), user != null && isMoreOption == false - ? Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: InkWell( - onTap: () => { - authenticateUser( - 3, BiometricType.face.index) - }, - child: getButton(user.logInType))), - Expanded(child: getButton(5)) - ]) - ])) - : Expanded( - flex: 4, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: getButton(3)), - Expanded(child: getButton(2)) - ], - ) - : SizedBox(), - Row( + ? Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Expanded(child: getButton(1)), - Expanded(child: getButton(4)) - ], - ), - ]), - ), + Expanded( + child: InkWell( + onTap: () => { + authenticateUser( + 3, BiometricType.face.index) + }, + child: getButton(user.logInType))), + Expanded(child: getButton(5)) + ]) + ]) + : Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + onlySMSBox == false + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded(child: getButton(3)), + Expanded(child: getButton(2)) + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded(child: getButton(1)), + Expanded(child: getButton(4)) + ], + ), + ]), Expanded( flex: 1, child: Column( @@ -262,6 +274,7 @@ class _ConfirmLogin extends State { } authenticateUser(type, isActive) { + GifLoaderDialogUtils.showMyDialog(context); if (type == 2 || type == 3) { fingrePrintBefore = type; } @@ -308,7 +321,6 @@ class _ConfirmLogin extends State { req.logInTokenID = ""; var request = CheckPatientAuthenticationReq.fromJson(req.toJson()); - GifLoaderDialogUtils.showMyDialog(context); sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); authService @@ -353,8 +365,11 @@ class _ConfirmLogin extends State { context, type, this.mobileNumber, - (value) => {this.checkActivationCode(value: value)}, + (value) { + this.checkActivationCode(value: value); + }, () => { + Navigator.pop(context), print('Faild..'), }, ).displayDialog(context); @@ -367,68 +382,47 @@ class _ConfirmLogin extends State { localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true); - - if (authenticated == true) { - if(user !=null && (user.logInType==2 || user.logInType ==3)){ - this.checkActivationCode(); - }else{ - var request = this.getCommonRequest(type: type); - this.getMobileInfo(request); - } - + if (authenticated == true) { + if (user != null && (user.logInType == 2 || user.logInType == 3)) { + this.checkActivationCode(); + } else { + var request = this.getCommonRequest(type: type); + this.getMobileInfo(request); + } } } } getMobileInfo(request) { - this - .authService - .getLoginInfo(request) - .then((result) => { - if (result['SMSLoginRequired'] == false) - { - this.loginTokenID = result.logInTokenID, - this.patientOutSA = result.patientOutSA, - // sms for register the biometric - if (result.isSMSSent) - { - this.onlySMSBox = false, - //this.button(); - } - else - {checkActivationCode()} - } - else - { - if (result['IsAuthenticated'] == true) - { - setState(() { - isMoreOption = true; - this.onlySMSBox = true; - // this.fingrePrintBefore = true; - }), - - //sharedPref.setBool(ONLY_SMS, true), - // this.cs.sharedService.setSharedData(true, AuthenticationService.ONLY_SMS); - //this.cs.sharedService.setSharedData(this.selectedOption, AuthenticationService.FINGUREPRINT_BEFORE); - // this.cs.confirmLogin(); - //this.button(); - } - // else - // { - // // this.cs.presentAlert(result.ErrorEndUserMessage); - // } - } - }) - .catchError((err) { + // GifLoaderDialogUtils.showMyDialog(context); + this.authService.getLoginInfo(request).then((result) { + GifLoaderDialogUtils.hideDialog(context); + if (result['SMSLoginRequired'] == false) { + this.loginTokenID = result.logInTokenID; + this.patientOutSA = result.patientOutSA; + // sms for register the biometric + if (result.isSMSSent) { + this.onlySMSBox = false; + //this.button(); + } else { + checkActivationCode(); + } + } else { + if (result['IsAuthenticated'] == true) { + setState(() { + isMoreOption = true; + this.onlySMSBox = true; + // this.fingrePrintBefore = true; + }); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } - setUser() async {} - setDefault() async { if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson( @@ -460,7 +454,9 @@ class _ConfirmLogin extends State { this.deviceToken = await sharedPref.getString(PUSH_TOKEN); this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) - : user !=null ? user.logInType : null; + : user != null + ? user.logInType + : null; //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); } @@ -514,8 +510,8 @@ class _ConfirmLogin extends State { .then((result) => { if (result is Map) { - - result = CheckActivationCode.fromJson(result), + projectViewModel.setPrivilege(privilegeList: result), + result = CheckActivationCode.fromJson(result), if (this.registerd_data != null && this.registerd_data.isRegister == true) { @@ -528,6 +524,8 @@ class _ConfirmLogin extends State { sharedPref.remove(FAMILY_FILE), result.list.isFamily = false, userData = result.list, + // sharedPref.setString( + // BLOOD_TYPE, result['PatientBloodType']), sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(USER_PROFILE, result.list), loginTokenID = result.logInTokenID, @@ -548,11 +546,13 @@ class _ConfirmLogin extends State { .catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: err); + }); }); } checkIfUserAgreedBefore(CheckActivationCode result) { - print(result); if (result.isNeedUserAgreement == true) { //move to agreement page. } else { @@ -569,12 +569,57 @@ class _ConfirmLogin extends State { }); } - goToHome() { + getToDoCount() { + toDoProvider.setState(0, true); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true); + } else {} + }).catchError((err) { + print(err); + }); + } + goToHome() async { + await authenticatedUserObject.getUser(getUser: true); authenticatedUserObject.isLogin = true; appointmentRateViewModel.isLogin = true; projectViewModel.isLogin = true; - Navigator.of(context).pushNamed(HOME); + projectViewModel.user = authenticatedUserObject.user; + Provider.of(context, listen: false) + .setUser(authenticatedUserObject.user); + getToDoCount(); + 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); + }); + // SMSOTP.showLoadingDialog(context, false), } loading(flag) { @@ -589,10 +634,11 @@ class _ConfirmLogin extends State { return InkWell( onTap: () => {authenticateUser(4, true)}, child: RoundedContainer( + height: 140, borderColor: Colors.grey, showBorder: true, child: Padding( - padding: EdgeInsets.fromLTRB(25, 10, 25, 10), + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), child: Column( children: [ Image.asset( @@ -615,10 +661,11 @@ class _ConfirmLogin extends State { return InkWell( onTap: () => {authenticateUser(1, true)}, child: RoundedContainer( + height: 140, borderColor: Colors.grey, showBorder: true, child: Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -627,12 +674,19 @@ class _ConfirmLogin extends State { height: SizeConfig.imageSizeMultiplier * 13, width: SizeConfig.imageSizeMultiplier * 16, ), - SizedBox( - height: 20, - ), + projectViewModel.isArabic + ? SizedBox( + height: 20, + ) + : SizedBox( + height: 20, + ), AppText( TranslationBase.of(context).verifySMS, - fontSize: SizeConfig.textMultiplier * 2, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.8 + : SizeConfig.textMultiplier * 2, + textAlign: TextAlign.center, ) ], ), @@ -642,13 +696,14 @@ class _ConfirmLogin extends State { return InkWell( onTap: () => {authenticateUser(2, BiometricType.fingerprint.index)}, child: RoundedContainer( + height: 140, backgroundColor: BiometricType.fingerprint.index == 1 ? Colors.white : Colors.white.withOpacity(.7), borderColor: Colors.grey, showBorder: true, child: Padding( - padding: EdgeInsets.fromLTRB(25, 10, 25, 10), + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), child: Column( children: [ Image.asset( @@ -671,13 +726,14 @@ class _ConfirmLogin extends State { return InkWell( onTap: () => {authenticateUser(3, BiometricType.face.index)}, child: RoundedContainer( + height: 140, backgroundColor: checkIfBiometricAvailable(BiometricType.face) ? Colors.white : Colors.white.withOpacity(.7), borderColor: Colors.grey, showBorder: true, child: Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -706,13 +762,14 @@ class _ConfirmLogin extends State { }) }, child: RoundedContainer( + height: 140, backgroundColor: BiometricType.fingerprint.index == 1 ? Colors.white : Colors.white.withOpacity(.7), borderColor: Colors.grey, showBorder: true, child: Padding( - padding: EdgeInsets.fromLTRB(0, 0, 0, 5), + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), child: Column( children: [ Image.asset( @@ -720,9 +777,13 @@ class _ConfirmLogin extends State { height: SizeConfig.imageSizeMultiplier * 13, width: SizeConfig.imageSizeMultiplier * 16, ), - SizedBox( - height: 20, - ), + projectViewModel.isArabic + ? SizedBox( + height: 15, + ) + : SizedBox( + height: 10, + ), AppText( TranslationBase.of(context).moreVerification, fontSize: SizeConfig.textMultiplier * 2, @@ -756,7 +817,7 @@ class _ConfirmLogin extends State { bool checkIfBiometricAvailable(BiometricType biometricType) { bool isAvailable = false; - if(_availableBiometrics != null) { + if (_availableBiometrics != null) { for (var i = 0; i < _availableBiometrics.length; i++) { if (biometricType == _availableBiometrics[i]) isAvailable = true; } diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index dcd58b9d..6113fb71 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -14,159 +14,168 @@ class LoginType extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).login, + appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, isShowDecPage: false, - body: Padding( - padding: EdgeInsets.all(20), - child: Column( - children: [ - Expanded( - flex: 4, - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/DQ/dq_logo_icon.png', - height: 90, - width: 90, - ), - AppText( - TranslationBase.of(context).logintypeRadio, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.start, - marginBottom: 20.0, - marginTop: 20.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, + body: SingleChildScrollView( + child: Container( + padding: + EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column( + children: [ + Expanded( + flex: 4, + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: InkWell( - onTap: () => { - LoginType.loginType = 1, - Navigator.of(context) - .pushNamed(LOGIN_PAGE) - }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 20, 10, 20, 10), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/id_card_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, + Image.asset( + 'assets/images/DQ/dq_logo_icon.png', + height: 90, + width: 90, + ), + AppText( + TranslationBase.of(context).logintypeRadio, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.start, + marginBottom: 20.0, + marginTop: 20.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => { + LoginType.loginType = 1, + Navigator.of(context) + .pushNamed(LOGIN_PAGE) + }, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB( + 20, 10, 20, 10), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/id_card_icon.png', + height: SizeConfig + .imageSizeMultiplier * + 12, + width: SizeConfig + .imageSizeMultiplier * + 15, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .idNo, + fontSize: SizeConfig + .textMultiplier * + 2, + fontWeight: FontWeight.bold, + ) + ], ), - AppText( - TranslationBase.of(context) - .idNo, - fontSize: - SizeConfig.textMultiplier * + )))), + Expanded( + child: InkWell( + onTap: () => { + LoginType.loginType = 2, + Navigator.of(context) + .pushNamed(LOGIN_PAGE) + }, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB( + 25, 10, 25, 10), + child: Column( + children: [ + Image.asset( + 'assets/images/my_file_white_icon.png', + height: SizeConfig + .imageSizeMultiplier * + 12, + width: SizeConfig + .imageSizeMultiplier * + 15, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .fileNo, + fontSize: SizeConfig + .textMultiplier * 2, - fontWeight: FontWeight.bold, - ) - ], - ), - )))), - Expanded( + fontWeight: FontWeight.bold, + ) + ], + ), + )))) + ], + ), + SizedBox( + height: 25, + ), + Divider( + color: Colors.grey, + height: 2, + ), + Center( child: InkWell( onTap: () => { - LoginType.loginType = 2, Navigator.of(context) - .pushNamed(LOGIN_PAGE) + .pushNamed(FORGOT_PASSWORD) }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 25, 10, 25, 10), - child: Column( - children: [ - Image.asset( - 'assets/images/my_file_white_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .fileNo, - fontSize: - SizeConfig.textMultiplier * - 2, - fontWeight: FontWeight.bold, - ) - ], - ), - )))) - ], - ), - SizedBox(height: 25,), - Divider( - color: Colors.grey, - height: 2, - ), - Center( - child: InkWell( - onTap: () => { - Navigator.of(context) - .pushNamed(FORGOT_PASSWORD) - }, - child: AppText( - TranslationBase.of(context).forgotPassword, - fontSize: SizeConfig.textMultiplier * 2.5, - marginTop: 20.0, - underline: true))) - ]), - ), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Divider( - color: Colors.grey, - height: 2, - ), - SizedBox(height: 10,), - Row( + child: AppText( + TranslationBase.of(context) + .forgotPassword, + fontSize: + SizeConfig.textMultiplier * 2.5, + marginTop: 20.0, + underline: true))) + ]), + ), + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, children: [ - - Expanded( - child: DefaultButton( - TranslationBase.of(context).registerNow, - () => { - Navigator.of(context).pushNamed( - REGISTER, - ) - }, - )), + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).registerNow, + () => { + Navigator.of(context).pushNamed( + REGISTER, + ) + }, + )), + ], + ), ], - ), - ], - )) - ], - ))); + )) + ], + )))); } } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 5a5a8b19..c2a943d2 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; @@ -11,6 +12,7 @@ import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -20,6 +22,7 @@ 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'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -48,6 +51,7 @@ class _Login extends State { locator(); ProjectViewModel projectViewModel; + ToDoCountProviderModel toDoProvider; @override void initState() { @@ -64,6 +68,7 @@ class _Login extends State { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); + toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, @@ -87,26 +92,26 @@ class _Login extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - MobileNo( - onNumberChange: (value) => - {mobileNo = value, validateForm()}, - onCountryChange: (value) => countryCode = value), - Container( - child: TextFields( - fontWeight: FontWeight.normal, - controller: nationalIDorFile, - onChanged: (value) => {validateForm()}, - prefixIcon: Icon( - loginType == 1 - ? Icons.chrome_reader_mode - : Icons.receipt, - color: Color(0xFF40ACC9)), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: loginType == 1 - ? TranslationBase.of(context).nationalID - : TranslationBase.of(context).fileNo, - )) + MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), + Directionality( + textDirection: TextDirection.ltr, + child: Container( + child: TextFields( + keyboardType: TextInputType.number, + fontWeight: FontWeight.normal, + controller: nationalIDorFile, + onChanged: (value) => {validateForm()}, + prefixIcon: Icon( + loginType == 1 + ? Icons.chrome_reader_mode + : Icons.receipt, + color: Color(0xFF40ACC9)), + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + hintText: loginType == 1 + ? TranslationBase.of(context).nationalID + : TranslationBase.of(context).fileNo, + ))) ], ), ), @@ -151,18 +156,14 @@ class _Login extends State { } void validateForm() { - //TODO fix login - if (util.validateIDBox(nationalIDorFile.text, loginType) == - true /*&& - mobileNo.length >= 9 */ - && + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; }); } else { setState(() { - isButtonDisabled = false; + isButtonDisabled = true; }); } } @@ -238,22 +239,27 @@ class _Login extends State { request['PatientID'] = int.parse(nationalIDorFile.text); } // request.isRegister = false; - this.authService.checkActivationCode(request, code).then((result) => { - sharedPref.remove(FAMILY_FILE), - result = CheckActivationCode.fromJson(result), - result.list.isFamily = false, - 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), - authenticatedUserObject.getUser(), - // authenticatedUserObject.user = AuthenticatedUser.fromJson(result.list), - authenticatedUserObject.isLogin = true, - appointmentRateViewModel.isLogin = true, - projectViewModel.isLogin = true, + 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) { @@ -277,11 +283,28 @@ class _Login extends State { .catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); - }), - // SMSOTP.showLoadingDialog(context, false), + }); + }); } + getToDoCount() { + toDoProvider.setState(0, true); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true); + } else {} + }).catchError((err) { + print(err); + }); + } + + void registerGeoZones() { + projectViewModel.platformBridge().registerHmgGeofences(); + } + // showLoader(bool isTrue) { // setState(() { // isLoading = isTrue; diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 4ede2683..467068cc 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -1,9 +1,5 @@ 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/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/register_user_requet.dart'; @@ -11,7 +7,6 @@ import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -25,7 +20,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hijri/hijri_calendar.dart'; import 'package:intl/intl.dart'; -import 'package:provider/provider.dart'; class RegisterInfo extends StatefulWidget { @override @@ -51,11 +45,6 @@ class _RegisterInfo extends State { String email = ''; String location = '1'; - AuthenticatedUserObject authenticatedUserObject = - locator(); - AppointmentRateViewModel appointmentRateViewModel = - locator(); - ProjectViewModel projectViewModel; @override void initState() { @@ -67,7 +56,6 @@ class _RegisterInfo extends State { @override Widget build(BuildContext context) { - projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).register, isShowAppBar: true, @@ -308,34 +296,27 @@ class _RegisterInfo extends State { }else { - sharedPref.remove(FAMILY_FILE), - result['List'][0]['IsFamily'] = false, - sharedPref.setObject(USER_PROFILE, result['List'][0]), - this.sharedPref.setObject(MAIN_USER, result['List'][0]), - sharedPref.setObject(LOGIN_TOKEN_ID, result["LogInTokenID"]), - sharedPref.setString(TOKEN, result["AuthenticationTokenID"]), - authenticatedUserObject.isLogin = true, - appointmentRateViewModel.isLogin = true, - projectViewModel.isLogin = true, - - Navigator.of(context).pushNamed(HOME), - AppToast.showSuccessToast(message: result["ErrorEndUserMessage"]) + result.list.isFamily = false, + sharedPref.setObject(USER_PROFILE, result.list), + this.sharedPref.setObject(MAIN_USER, result.list), + sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + sharedPref.setString(TOKEN, result.authenticationTokenID), + Navigator.of(context).pushNamed(HOME) } - }); - // .catchError((err) { - // GifLoaderDialogUtils.hideDialog(context); - // ConfirmDialog dialog = new ConfirmDialog( - // context: context, - // confirmMessage: err, - // okText: TranslationBase.of(context).confirm, - // cancelText: TranslationBase.of(context).cancel_nocaps, - // okFunction: () => { - // ConfirmDialog.closeAlertDialog(context) - // }, - // cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); - // dialog.showAlertDialog(context); - // - // }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context) + }, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + dialog.showAlertDialog(context); + + }); } getRegisterInfo() async { @@ -368,15 +349,15 @@ class _RegisterInfo extends State { "PatientOutSA": registerd_data.zipCode == '966' ? 0 : 1, "FirstNameN":registerInfo.firstNameAr =='-' ?"": registerInfo.firstNameAr, "FirstName": registerInfo.firstNameEn =='-' ?"":registerInfo.firstNameEn, - "MiddleNameN":registerInfo.secondNameAr, - "MiddleName":registerInfo.secondNameEn, + "MiddleNameN":registerInfo.secondNameAr =='-' ? "" : registerInfo.secondNameAr, + "MiddleName":registerInfo.secondNameEn == '-' ? "": registerInfo.secondNameEn, "LastNameN": registerInfo.lastNameAr =='-'? "" : registerInfo.lastNameAr, "LastName": registerInfo.lastNameEn =='-' ? "": registerInfo.lastNameEn, "StrDateofBirth": registerInfo.dateOfBirth, "DateofBirth": DateUtil.convertISODateToJsonDate( registerInfo.dateOfBirth.replaceAll('/', '-')), "Gender": registerInfo.gender == 'M' ? 1 : 2, - "NationalityID": registerInfo.nationalityCode, + "NationalityID": registerInfo.nationality, "DateofBirthN": date, "EmailAddress": email, "SourceType": location, @@ -393,8 +374,8 @@ class _RegisterInfo extends State { } bool isValid() { - if (location != null && - language != null && + if (location != null || + language != null || Utils.validEmail(email) == true) { return true; } else { diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 042f56fe..131db748 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -72,112 +72,113 @@ class _Register extends State { onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - Container( - child: TextFields( - controller: nationalIDorFile, - onChanged: (value) => validateForm(), - prefixIcon: - Icon(Icons.chrome_reader_mode, color: Color(0xFF40ACC9)), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: TranslationBase.of(context).nationalID, - )), - Row( + Container( + child: TextFields( + controller: nationalIDorFile, + onChanged: (value) => validateForm(), + keyboardType: TextInputType.number, + prefixIcon: Icon(Icons.chrome_reader_mode, + color: Color(0xFF40ACC9)), + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + hintText: TranslationBase.of(context).nationalID, + )), + Row( + children: [ + Expanded( + child: Row( children: [ - Expanded( - child: Row( - children: [ - Radio( - value: 1, - groupValue: isHijri, - onChanged: (value) { - setState(() { - isHijri = value; - }); - validateForm(); - }, - ), - Text(TranslationBase.of(context).hijriDate), - ], - ), + Radio( + value: 1, + groupValue: isHijri, + onChanged: (value) { + setState(() { + isHijri = value; + }); + validateForm(); + }, ), - Expanded( - child: Row( - children: [ - Radio( - value: 0, - groupValue: isHijri, - onChanged: (value) { - setState(() { - isHijri = value; - }); - validateForm(); - }, - ), - Text(TranslationBase.of(context) - .gregorianDate), - ], - ), + Text(TranslationBase.of(context).hijriDate), + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: 0, + groupValue: isHijri, + onChanged: (value) { + setState(() { + isHijri = value; + }); + validateForm(); + }, ), + Text(TranslationBase.of(context).gregorianDate), ], ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( width: SizeConfig.realScreenWidth * .9, - height:60, - child: isHijri == 1 - ? TextFields( - onChanged: (value) => {dob = value}, - hintText: 'DD/MM/YYYY', - prefixIcon: Icon(Icons.date_range), - ) - : RaisedButton.icon( - shape: RoundedRectangleBorder( + height: 60, + child: isHijri == 1 + ? TextFields( + onChanged: (value) => {dob = value}, + hintText: 'DD/MM/YYYY', + prefixIcon: Icon(Icons.date_range), + ) + : RaisedButton.icon( + shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15.0), - - ), - color:Colors.white, - onPressed: () => { - if (isHijri != null) - _selectDate(context) - }, - icon: Icon(Icons.date_range), - label: Text(selectedDate != null - ? "${selectedDate.toLocal()}" - .split(' ')[0] - : TranslationBase.of(context).dob))) - ]) + ), + color: Colors.white, + onPressed: () => { + if (isHijri != null) + _selectDate(context) + }, + icon: Icon(Icons.date_range), + label: Text(selectedDate != null + ? "${selectedDate.toLocal()}" + .split(' ')[0] + : TranslationBase.of(context).dob))) + ]) + ], + ), + ), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).registerNow, + () => {startRegistration()}, + textColor: Colors.white, + color: isButtonDisabled == true + ? Colors.grey + : Colors.grey[900])) ], ), - ), - Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Divider( - color: Colors.grey, - height: 2, - ), - SizedBox(height: 10,), - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).registerNow, - () => {startRegistration()}, - textColor: Colors.white, - color: isButtonDisabled == true - ? Colors.grey - : Colors.grey[900])) - ], - ), - ], - )) - ]), - ))); + ], + )) + ]), + ))); } Future _selectDate(BuildContext context) async { @@ -215,7 +216,8 @@ class _Register extends State { this .authService .checkPatientForRegisteration(request) - .then((response) => {checkUserStatus(response, request)}).catchError((err) { + .then((response) => {checkUserStatus(response, request)}) + .catchError((err) { GifLoaderDialogUtils.hideDialog(context); ConfirmDialog dialog = new ConfirmDialog( context: context, @@ -223,15 +225,13 @@ class _Register extends State { okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - ConfirmDialog.closeAlertDialog(context), - Navigator.of(context).pushNamed( - REGISTER, - ), - - }, + ConfirmDialog.closeAlertDialog(context), + Navigator.of(context).pushNamed( + REGISTER, + ), + }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); - }); } @@ -256,7 +256,7 @@ class _Register extends State { var nRequest = request.toJson(); nRequest['LogInTokenID'] = response['LogInTokenID']; if (response['hasFile'] == true) { - // AppToast.showErrorToast(message: response['ErrorEndUserMessage']); + // AppToast.showErrorToast(message: response['ErrorEndUserMessage']); AlertDialogBox( context: context, confirmMessage: response['ErrorEndUserMessage'], @@ -307,7 +307,7 @@ class _Register extends State { request.isHijri = isHijri; request.patientOutSA = countryCode == '966' ? 0 : 1; this.authService.checkUserStatus(request).then((result) => { - GifLoaderDialogUtils.hideDialog(context), + GifLoaderDialogUtils.hideDialog(context), if (result is Map) { result = CheckUserStatusResponse.fromJson(result), diff --git a/lib/pages/medical/allergies_page.dart b/lib/pages/medical/allergies_page.dart index 7fe30a8a..459ef0f8 100644 --- a/lib/pages/medical/allergies_page.dart +++ b/lib/pages/medical/allergies_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/AllergiesViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -7,8 +8,10 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class AllergiesPage extends StatelessWidget { + List imagesInfo = List(); @override Widget build(BuildContext context) { + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/alllergies/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/alllergies/ar/0.png')); return BaseView( onModelReady: (model) => model.getAllergies(), builder: (_, model, w) => AppScaffold( @@ -16,6 +19,7 @@ class AllergiesPage extends StatelessWidget { appBarTitle: TranslationBase.of(context).allergies, baseViewModel: model, description: TranslationBase.of(context).infoAllergies, + imagesInfo: imagesInfo, body: ListView.builder( itemCount: model.allergies.length, itemBuilder: (context, index) => Container( diff --git a/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart index 5f1938fd..902225b1 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart @@ -77,8 +77,6 @@ class _AskDoctorHomPageState extends State 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: 18.0, right: 18.0), unselectedLabelColor: Colors.grey[800], diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 9b255711..a3005db5 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; @@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -49,10 +51,17 @@ class _AdvancePaymentPageState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; + List imagesInfo = List(); + @override void initState() { super.initState(); getAuthUser(); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/advance-payment/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/advance-payment/ar/0.png')); } @override @@ -61,7 +70,9 @@ class _AdvancePaymentPageState extends State { onModelReady: (model) => model.getHospitals(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, + imagesInfo: imagesInfo, appBarTitle: TranslationBase.of(context).advancePayment, + description: TranslationBase.of(context).infoAdvancePayment, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( @@ -101,13 +112,13 @@ class _AdvancePaymentPageState extends State { if (beneficiaryType == BeneficiaryType.MyFamilyFiles) InkWell( onTap: () { + GifLoaderDialogUtils.showMyDialog(context); model.getFamilyFiles().then((value) { + GifLoaderDialogUtils.hideDialog(context); confirmSelectFamilyDialog(model .getAllSharedRecordsByStatusResponse .getAllSharedRecordsByStatusList); - }).showProgressBar( - text: "Loading", - backgroundColor: Colors.blue.withOpacity(0.6)); + }); }, child: Container( padding: EdgeInsets.all(12), @@ -139,17 +150,16 @@ class _AdvancePaymentPageState extends State { if (beneficiaryType == BeneficiaryType.OtherAccount) InkWell( onTap: () { - if (_fileTextController.text.isNotEmpty) + if (_fileTextController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); model .getPatientInfoByPatientID( id: _fileTextController.text) .then((value) { + GifLoaderDialogUtils.hideDialog(context); confirmSelectPatientDialog(model.patientInfoList); - }).showProgressBar( - text: "Loading", - backgroundColor: - Colors.blue.withOpacity(0.6)); - else + }); + } else AppToast.showErrorToast( message: 'Please Enter The File Number'); }, @@ -205,6 +215,7 @@ class _AdvancePaymentPageState extends State { SizedBox( height: 12, ), + if(model.user!=null) NewTextFields( hintText: TranslationBase.of(context).depositorEmail, initialValue: model.user.emailAddress, @@ -227,7 +238,7 @@ class _AdvancePaymentPageState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.13, width: double.infinity, padding: EdgeInsets.all(12), child: SecondaryButton( @@ -262,10 +273,11 @@ class _AdvancePaymentPageState extends State { advanceModel.amount = amount; advanceModel.mobileNumber = mobileNum; advanceModel.patientName = patientName; - + GifLoaderDialogUtils.showMyDialog(context); model .getPatientInfoByPatientIDAndMobileNumber(advanceModel) .then((value) { + GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { Utils.hideKeyboard(context); @@ -289,9 +301,7 @@ class _AdvancePaymentPageState extends State { }, ); } - }).showProgressBar( - text: "Loading", - backgroundColor: Colors.blue.withOpacity(0.6)); + }); }, ), )), diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 4954653d..8a69bf5d 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -19,7 +19,6 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'dialogs/ConfirmSMSDialog.dart'; import 'new_text_Field.dart'; @@ -157,24 +156,25 @@ class ConfirmPaymentPage extends StatelessWidget { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.13, width: double.infinity, padding: EdgeInsets.all(12), child: SecondaryButton( textColor: Colors.white, + color: Theme.of(context).primaryColor, label: TranslationBase.of(context).confirm.toUpperCase(), disabled: model.state == ViewState.Busy, onTap: () { + GifLoaderDialogUtils.showMyDialog(context); model .sendActivationCodeForAdvancePayment( patientID: int.parse(advanceModel.fileNumber), projectID: advanceModel.hospitalsModel.iD) .then((value) { + GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(); - }).showProgressBar( - text: "Loading", - backgroundColor: Colors.blue.withOpacity(0.6)); + }); }, ), ), diff --git a/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart b/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart index 10d61f68..380f250c 100644 --- a/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart +++ b/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart @@ -175,7 +175,7 @@ class _ConfirmSMSDialogState extends State { fontSize: SizeConfig.textMultiplier * 3, ), focusNode: focusD1, - maxLength: 1, + //maxLength: 1, controller: digit1, textAlign: TextAlign.center, keyboardType: TextInputType.number, @@ -200,7 +200,7 @@ class _ConfirmSMSDialogState extends State { focusNode: focusD2, controller: digit2, textInputAction: TextInputAction.next, - maxLength: 1, + //maxLength: 1, textAlign: TextAlign.center, style: TextStyle( fontSize: SizeConfig.textMultiplier * 3, @@ -227,7 +227,7 @@ class _ConfirmSMSDialogState extends State { focusNode: focusD3, controller: digit3, textInputAction: TextInputAction.next, - maxLength: 1, + //maxLength: 1, textAlign: TextAlign.center, style: TextStyle( fontSize: SizeConfig.textMultiplier * 3, @@ -253,7 +253,7 @@ class _ConfirmSMSDialogState extends State { child: TextFormField( focusNode: focusD4, controller: digit4, - maxLength: 1, + // maxLength: 1, textAlign: TextAlign.center, style: TextStyle( fontSize: SizeConfig.textMultiplier * 3, diff --git a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart index 7d69f084..bb9afd6c 100644 --- a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart @@ -35,11 +35,9 @@ class _SelectPatientFamilyDialogState extends State { (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if(widget.getAllSharedRecordsByStatusList[index].status==3) SizedBox( height: 2, ), - if(widget.getAllSharedRecordsByStatusList[index].status==3) Row( children: [ Expanded( @@ -67,8 +65,6 @@ class _SelectPatientFamilyDialogState extends State { ) ], ), - if(widget.getAllSharedRecordsByStatusList[index].status==3) - SizedBox( height: 5.0, ), diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index 421e2bed..1edbcbf6 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -12,83 +13,95 @@ import 'package:hexcolor/hexcolor.dart'; import 'advance_payment_page.dart'; class MyBalancePage extends StatelessWidget { + + List imagesInfo = List(); + @override Widget build(BuildContext context) { + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/ar/0.png')); return BaseView( onModelReady: (model) => model.getPatientAdvanceBalanceAmount(), builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, appBarTitle: TranslationBase.of(context).myBalances, - body: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).balanceAmount, - color: Colors.black, - bold: true, - ), - SizedBox( - height: 15, - ), - Container( - padding: EdgeInsets.all(8), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - color: HexColor('#B61422'), - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(7), + imagesInfo: imagesInfo, + description: TranslationBase.of(context).infoMyBalance, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).balanceAmount, + color: Colors.black, + bold: true, ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).totalBalance, - color: Colors.white, - ), - Texts( - '${model.totalAdvanceBalanceAmount ?? 0} SAR', - color: Colors.white, - bold: true, - ), - ], + SizedBox( + height: 15, ), - ), - SizedBox( - height: 9, - ), - ...List.generate( - model.patientAdvanceBalanceAmountList.length, - (index) => Container( + Container( padding: EdgeInsets.all(8), + width: double.infinity, height: 65, - margin: EdgeInsets.only(top: 8), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).primaryColor, shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(7), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(model.patientAdvanceBalanceAmountList[index] - .projectDescription), + Texts( - '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} SAR', + '${model.totalAdvanceBalanceAmount ?? 0} '+ TranslationBase.of(context).sar, + color: Colors.white, bold: true, ), + Texts( + TranslationBase.of(context).totalBalance, + color: Colors.white, + ), ], ), ), - ), - ], + SizedBox( + height: 9, + ), + ...List.generate( + model.patientAdvanceBalanceAmountList.length, + (index) => Container( + padding: EdgeInsets.all(8), + height: 65, + margin: EdgeInsets.only(top: 8), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(7), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + Texts( + '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} '+TranslationBase.of(context).sar, + bold: true, + ), + Texts(model.patientAdvanceBalanceAmountList[index] + .projectDescription), + ], + ), + ), + ), + SizedBox(height: MediaQuery.of(context).size.height * 0.13 ,) + ], + ), ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.12, + color: Colors.white, width: double.infinity, padding: EdgeInsets.all(12), child: SecondaryButton( diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index 9687b931..c8fad3ce 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_doctor_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; @@ -15,8 +16,11 @@ import 'package:flutter/material.dart'; import 'doctor_profile_page.dart'; class DoctorHomePage extends StatelessWidget { + List imagesInfo = List(); @override Widget build(BuildContext context) { + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/1.png')); return BaseView( onModelReady: (model) => model.getMyDoctor(), builder: (context, MyDoctorViewModel model, widget) => AppScaffold( @@ -25,6 +29,7 @@ class DoctorHomePage extends StatelessWidget { appBarTitle: TranslationBase.of(context).myDoctor, description: TranslationBase.of(context).infoMyDoctor, infoList: TranslationBase.of(context).infoMyDoctorPoints, + imagesInfo: imagesInfo, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: FractionallySizedBox( @@ -43,7 +48,6 @@ class DoctorHomePage extends StatelessWidget { leading: Radio( value: FilterType.Clinic, groupValue: model.filterType, - activeColor: Colors.red[800], onChanged: (FilterType value) { model.setFilterType(value); }, @@ -60,7 +64,6 @@ class DoctorHomePage extends StatelessWidget { leading: Radio( value: FilterType.Hospital, groupValue: model.filterType, - activeColor: Colors.red[800], onChanged: (FilterType value) => model.setFilterType(value), ), diff --git a/lib/pages/medical/eye/ContactLensPage.dart b/lib/pages/medical/eye/ContactLensPage.dart index 26503c89..373c3c79 100644 --- a/lib/pages/medical/eye/ContactLensPage.dart +++ b/lib/pages/medical/eye/ContactLensPage.dart @@ -1,10 +1,12 @@ import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.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'; class ContactLensPage extends StatelessWidget { final ListHISGetContactLensPerscription listHISGetContactLensPerscription; @@ -14,6 +16,7 @@ class ContactLensPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( body: SingleChildScrollView( child: Container( @@ -82,6 +85,7 @@ class ContactLensPage extends StatelessWidget { SizedBox( height: 17, ), + if(projectViewModel.havePrivilege(15)) Container( width: double.infinity, child: SecondaryButton( diff --git a/lib/pages/medical/eye/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 18cc9b77..3f4df55f 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -75,7 +75,6 @@ class _EyeHomePageState 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: 5.0, right: 5.0), diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index 01cb6725..a251a1ce 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -1,36 +1,50 @@ import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/laboratory_result_widget.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/LabResult/laboratory_result_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class LaboratoryResultPage extends StatelessWidget { +class LaboratoryResultPage extends StatefulWidget { final PatientLabOrders patientLabOrders; LaboratoryResultPage({Key key, this.patientLabOrders}); + @override + _LaboratoryResultPageState createState() => _LaboratoryResultPageState(); +} + +class _LaboratoryResultPageState extends State { + + @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getLaboratoryResult( - invoiceNo: patientLabOrders.invoiceNo, - clinicID: patientLabOrders.clinicID, - projectID: patientLabOrders.projectID, - orderNo: patientLabOrders.orderNo), - builder: (_, model, widget) => AppScaffold( + invoiceNo: widget.patientLabOrders.invoiceNo, + clinicID: widget.patientLabOrders.clinicID, + projectID: widget.patientLabOrders.projectID, + orderNo: widget.patientLabOrders.orderNo), + builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Laboratory result', + appBarTitle: TranslationBase.of(context).labResults, baseViewModel: model, body: Scaffold( body: ListView.builder( itemBuilder: (context, index) => LaboratoryResultWidget( - onTap: () => model.sendLabReportEmail(patientLabOrder: patientLabOrders), - billNo: patientLabOrders.invoiceNo, + onTap: ()async { + GifLoaderDialogUtils.showMyDialog(context); + await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders,mes: TranslationBase.of(context).sendSuc); + GifLoaderDialogUtils.hideDialog(context); + }, + billNo: widget.patientLabOrders.invoiceNo, details: model.patientLabSpecialResult[index].resultDataHTML, - orderNo: patientLabOrders.orderNo, - patientLabOrder: patientLabOrders, + orderNo: widget.patientLabOrders.orderNo, + patientLabOrder: widget.patientLabOrders, ), itemCount: model.patientLabSpecialResult.length, ), diff --git a/lib/pages/medical/labs/labs_home_page.dart b/lib/pages/medical/labs/labs_home_page.dart index f459a057..ce78a7dc 100644 --- a/lib/pages/medical/labs/labs_home_page.dart +++ b/lib/pages/medical/labs/labs_home_page.dart @@ -1,5 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -9,12 +11,17 @@ 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:provider/provider.dart'; import 'laboratory_result_page.dart'; class LabsHomePage extends StatelessWidget { + List imagesInfo =List(); + @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/ar/0.png')); return BaseView( onModelReady: (model) => model.getLabs(), builder: (context, LabsViewModel model, widget) => AppScaffold( @@ -22,6 +29,7 @@ class LabsHomePage extends StatelessWidget { isShowAppBar: true, description: TranslationBase.of(context).infoLab, appBarTitle: TranslationBase.of(context).labOrders, + imagesInfo: imagesInfo, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: FractionallySizedBox( @@ -40,7 +48,6 @@ class LabsHomePage extends StatelessWidget { leading: Radio( value: FilterType.Clinic, groupValue: model.filterType, - activeColor: Theme.of(context).primaryColor, onChanged: (FilterType value) { model.setFilterType(value); }, @@ -57,7 +64,6 @@ class LabsHomePage extends StatelessWidget { leading: Radio( value: FilterType.Hospital, groupValue: model.filterType, - activeColor: Theme.of(context).primaryColor, onChanged: (FilterType value) => model.setFilterType(value), ), @@ -86,10 +92,11 @@ class LabsHomePage extends StatelessWidget { ), ),isInOutPatient: labOrder.isInOutPatient, name: labOrder.doctorName, + billNo: ' ${labOrder.invoiceNo}', profileUrl: labOrder.doctorImageURL, - subName: TranslationBase.of(context).billNo+' ${labOrder.invoiceNo}', - date: DateUtil.getMonthDayYearDateFormatted( - labOrder.orderDate), + subName: labOrder.projectName, + isLiveCareAppointment: labOrder.isLiveCareAppointment, + date: projectViewModel.isArabic?DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate):DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), ); }).toList(), ), diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 052b196e..ade69f45 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -7,6 +7,9 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart'; import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; @@ -17,9 +20,12 @@ import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_widget.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/sliver_app_bar_delegate.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -28,6 +34,7 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; import 'package:provider/provider.dart'; import '../../locator.dart'; +import '../../uitl/gif_loader_dialog_utils.dart'; import 'active_medications/ActiveMedicationsPage.dart'; import 'allergies_page.dart'; import 'ask_doctor/ask_doctor_home_page.dart'; @@ -47,12 +54,15 @@ class MedicalProfilePage extends StatefulWidget { class _MedicalProfilePageState extends State { var authProvider = new AuthProvider(); - + List medical=List(); + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); var appoCountProvider = Provider.of(context); - 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, @@ -92,457 +102,30 @@ class _MedicalProfilePageState extends State { ], ), ), + SizedBox(height: 50,), Padding( padding: EdgeInsets.symmetric(vertical: 5.0), - child: Column( - children: [ - if(model.isLogin) - Container( - width: double.infinity, - height: 55, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: MyAppointments(), - ), - ); - }, - child: authProvider.isLogin - ? Stack(children: [ - MedicalProfileItem( - title: - TranslationBase.of(context) - .myAppointments, - imagePath: - 'my_appointment_icon.png', - subTitle: - TranslationBase.of(context) - .myAppointmentsList, - hasBadge: true, - ), - Positioned( - right: 0.0, - child: Badge( - toAnimate: false, - position: - BadgePosition.topEnd(), - shape: BadgeShape.circle, - badgeColor: Colors - .red[800].withOpacity(1.0), - borderRadius: - BorderRadius.circular(8), - badgeContent: Container( - padding: - EdgeInsets.all(2.0), - child: Text( - appoCountProvider.count - .toString(), - style: TextStyle( - color: Colors.white, - fontSize: 16.0)), - ), - ), - ), - ]) - : MedicalProfileItem( - title: TranslationBase.of(context) - .myAppointments, - imagePath: - 'my_appointment_icon.png', - subTitle: - TranslationBase.of(context) - .myAppointmentsList, - hasBadge: true, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: LabsHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).lab, - imagePath: 'lab_result_icon.png', - subTitle: TranslationBase.of(context).labSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: RadiologyHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context) - .radiology, - imagePath: 'radiology_icon.png', - subTitle: TranslationBase.of(context) - .radiologySubtitle, - ), - ), - ), - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .medicines, - imagePath: 'prescription_icon.png', - subTitle: TranslationBase.of(context) - .medicinesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: VitalSignDetailsScreen(), - ), - ), - child: MedicalProfileItem( - title: TranslationBase.of(context) - .vitalSigns, - imagePath: 'vital_signs.png', - subTitle: TranslationBase.of(context) - .vitalSignsSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: ActiveMedicationsPage())), - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myMedical, - imagePath: 'active_medications.png', - subTitle: TranslationBase.of(context) - .myMedicalSubtitle, - ), - ), - ), - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: DoctorHomePage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myDoctor, - imagePath: 'doctor_icon.png', - subTitle: TranslationBase.of(context) - .myDoctorSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: EyeMeasurementsPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).eye, - imagePath: 'eye_measurement_icon.png', - subTitle: TranslationBase.of(context) - .eyeSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceCard())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .insurance, - imagePath: 'insurance_card_icon.png', - subTitle: TranslationBase.of(context) - .insuranceSubtitle, - ), - ), - ), - ], - ), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceUpdate())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .updateInsurance, - imagePath: 'insurance_update_icon_.png', - subTitle: TranslationBase.of(context) - .updateInsuranceSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceApproval())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .insuranceApproval, - imagePath: 'insurance_approvals_icon.png', - subTitle: TranslationBase.of(context) - .insuranceApprovalSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap:()=> Navigator.push(context, FadePage(page: AllergiesPage())) , - child: MedicalProfileItem( - title: TranslationBase.of(context).allergies, - imagePath: 'my_allergies_icon.png', - subTitle: TranslationBase.of(context) - .allergiesSubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MyVaccines())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myVaccines, - imagePath: 'my_vaccines_icon.png', - subTitle: TranslationBase.of(context) - .myVaccinesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: HomeReportPage())); - }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).medical, - imagePath: 'medical_reports_icon.png', - subTitle: TranslationBase.of(context) - .medicalSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MonthlyReportsPage())); - }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).monthly, - imagePath: 'monthly_reports_icon.png', - subTitle: TranslationBase.of(context) - .monthlySubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PatientSickLeavePage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).sick, - imagePath: 'sick_leaves_icons.png', - subTitle: TranslationBase.of(context) - .sickSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MyBalancePage())); - }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).myBalance, - imagePath: 'check-in.png', - subTitle: TranslationBase.of(context) - .myBalanceSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: MedicalProfileItem( - title: - TranslationBase.of(context).patientCall, - imagePath: 'medical_history_icon.png', - subTitle: TranslationBase.of(context) - .patientCallSubtitle, - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - //TODO - onTap: () { - Navigator.push( - context, FadePage(page: SmartWatchInstructions())); + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 2.40), + ), + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + + return myMedicalList[index]; }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .smartWatches, - imagePath: 'smartwatch_icon.png', - subTitle: TranslationBase.of(context) - .smartWatchesSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MyTrackers())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myTrackers, - imagePath: 'my_tracker_icon.png', - subTitle: TranslationBase.of(context) - .myTrackersSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: (){ - Navigator.push(context, - FadePage(page: AskDoctorHomPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).askYour, - imagePath: 'ask_doctor_icon.png', - subTitle: TranslationBase.of(context) - .askYourSubtitle, - ), - ), - ), - ]), - Row(children: [ - Expanded( - flex: 1, - child: InkWell( - //TODO -// onTap: () { -// Navigator.push( -// context, FadePage(page: DoctorHomePage())); -// }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).internet, - imagePath: 'insurance_card_icon.png', - subTitle: TranslationBase.of(context) - .internetSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( -// onTap: () { -// Navigator.push( -// context, FadePage(page: InsuranceApproval())); -// }, - child: MedicalProfileItem( - title: - TranslationBase.of(context).chatbot, - imagePath: 'insurance_approvals_icon.png', - subTitle: TranslationBase.of(context) - .chatbotSubtitle, - ), - ), - ), - Expanded( - flex: 1, - child: Container(), - ), - ]), - SizedBox( - height: - MediaQuery.of(context).size.height * 0.12, - ) - ], ), ) ], ), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.12, + ), if (model.user != null && model.isLogin) Positioned( top: 185, @@ -604,4 +187,20 @@ 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}); + } diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index d2bcde47..e6bb3ed4 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -74,7 +74,6 @@ class _BloodPressureHomePageState 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: 5.0, right: 5.0), diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart index c8c7fa4a..9259e286 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 @@ -75,7 +75,6 @@ class _BloodSugarHomePageState 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: 5.0, right: 5.0), diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index dcb6eea3..196b5d79 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -1,10 +1,16 @@ +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/patient_sick_leave_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.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 PatientSickLeavePage extends StatefulWidget { @override @@ -12,8 +18,19 @@ class PatientSickLeavePage extends StatefulWidget { } class _PatientSickLeavePageState extends State { + List imagesInfo = List(); + + @override + void initState() { + imagesInfo.add(ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/en/0.png', + imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/ar/0.png')); + super.initState(); + } + @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getSickLeave(), builder: (_, model, w) => AppScaffold( @@ -21,28 +38,22 @@ class _PatientSickLeavePageState extends State { appBarTitle: TranslationBase.of(context).sickLeaves, description: TranslationBase.of(context).infoSickLeaves, infoList: TranslationBase.of(context).infoSickLeavePoints, + imagesInfo: imagesInfo, baseViewModel: model, body: Container( margin: EdgeInsets.all(12), child: ListView.builder( itemCount: model.sickLeaveList.length, itemBuilder: (context, index) => DoctorCard( + isLiveCareAppointment: model.sickLeaveList[index].isLiveCareAppointment, name: model.sickLeaveList[index].doctorName, - date: DateUtil.getMonthDayYearDateFormatted( - model.sickLeaveList[index].requestDate), + date:projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.sickLeaveList[index].requestDate):DateUtil.getMonthDayYearDateFormatted(model.sickLeaveList[index].requestDate), profileUrl: model.sickLeaveList[index].doctorImageURL, rat: model.sickLeaveList[index].actualDoctorRate.toDouble(), subName: model.sickLeaveList[index].projectName, - isInOutPatient: - model.sickLeaveList[index].isInOutPatient, + isInOutPatient: model.sickLeaveList[index].isInOutPatient, onEmailTap: () { - model.sendSickLeaveEmail( - message: TranslationBase.of(context).emailSentSuccessfully, - requestNo: model.sickLeaveList[index].requestNo, - doctorName: model.sickLeaveList[index].doctorName, - projectName: model.sickLeaveList[index].projectName, - setupID: model.sickLeaveList[index].setupID, - projectID: model.sickLeaveList[index].projectID); + showConfirmMessage(model, index); }, ), ), @@ -50,4 +61,22 @@ class _PatientSickLeavePageState extends State { ), ); } + + void showConfirmMessage(PatientSickLeaveViewMode model, int index) { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () { + model.sendSickLeaveEmail( + message: TranslationBase.of(context).emailSentSuccessfully, + requestNo: model.sickLeaveList[index].requestNo, + doctorName: model.sickLeaveList[index].doctorName, + projectName: model.sickLeaveList[index].projectName, + setupID: model.sickLeaveList[index].setupID, + projectID: model.sickLeaveList[index].projectID); + }, + ), + ); + } } diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 024de17c..d59bc06d 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -105,22 +105,29 @@ class PrescriptionDetailsPage extends StatelessWidget { color: Colors.white, height: 30, width: double.infinity, - child: Center(child: Texts(TranslationBase.of(context).way))), + child: Center( + child: Texts(TranslationBase.of(context).way))), Container( color: Colors.white, height: 30, width: double.infinity, - child: Center(child: Texts(TranslationBase.of(context).average))), + child: Center( + child: + Texts(TranslationBase.of(context).average))), Container( color: Colors.white, height: 30, width: double.infinity, - child: Center(child: Texts(TranslationBase.of(context).dailyDoses))), + child: Center( + child: Texts( + TranslationBase.of(context).dailyDoses))), Container( color: Colors.white, height: 30, width: double.infinity, - child: Center(child: Texts(TranslationBase.of(context).period))), + child: Center( + child: + Texts(TranslationBase.of(context).period))), ], ), TableRow( @@ -136,7 +143,8 @@ class PrescriptionDetailsPage extends StatelessWidget { height: 50, width: double.infinity, child: Center( - child: Text(prescriptionReport.frequencyN?? ''))), + child: + Text(prescriptionReport.frequencyN ?? ''))), Container( color: Colors.white, height: 50, @@ -174,7 +182,7 @@ class PrescriptionDetailsPage extends StatelessWidget { SizedBox( height: 5, ), - Texts(prescriptionReport.remarks), + Texts(prescriptionReport.remarks ?? ''), ], ), ), diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 696ea2db..6fb07f68 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_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/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -11,6 +12,8 @@ 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:provider/provider.dart'; +import '../../../widgets/dialogs/confirm_send_email_dialog.dart'; class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; @@ -19,6 +22,7 @@ class PrescriptionItemsPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPrescriptionReport(prescriptions: prescriptions), @@ -30,147 +34,198 @@ class PrescriptionItemsPage extends StatelessWidget { height: MediaQuery.of(context).size.height * 0.8, child: Column( children: [ - - if(!prescriptions.isInOutPatient) - ...List.generate(model.prescriptionReportList.length, (index) => InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport: model.prescriptionReportList[index], - ), - ), - ), - child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.prescriptionReportList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(model.prescriptionReportList[index].itemDescription.isNotEmpty? - model.prescriptionReportList[index].itemDescription :model - .prescriptionReportList[index].itemDescriptionN)), - )), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], - ) - ], - ), - ), - )) - - else - ...List.generate( - model.prescriptionReportEnhList.length, + if (!prescriptions.isInOutPatient) + ...List.generate( + model.prescriptionReportList.length, (index) => InkWell( - onTap: (){ - PrescriptionReport prescriptionReport = PrescriptionReport( - imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl, - itemDescription: model.prescriptionReportEnhList[index].itemDescription, - itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription, - routeN: model.prescriptionReportEnhList[index].route, - frequency: model.prescriptionReportEnhList[index].frequency, - frequencyN: model.prescriptionReportEnhList[index].frequency, - doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, - days: model.prescriptionReportEnhList[index].days, - itemID: model.prescriptionReportEnhList[index].itemID, - remarks: model.prescriptionReportEnhList[index].remarks - ); - Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport:prescriptionReport, + onTap: () => Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: + model.prescriptionReportList[index], + ), ), ), - ); - }, - child: Container( - margin: EdgeInsets.all(8.0), - color: Colors.white, - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Container( + width: double.infinity, + margin: + EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], width: 0.5), + ), + child: Row( children: [ - Texts(model.prescriptionReportEnhList[index] - .itemDescription), + ClipRRect( + borderRadius: + BorderRadius.all(Radius.circular(5)), + child: Image.network( + model.prescriptionReportList[index] + .imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(model + .prescriptionReportList[index] + .itemDescription + .isNotEmpty + ? model.prescriptionReportList[index] + .itemDescription + : model.prescriptionReportList[index] + .itemDescriptionN)), + )), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) ], ), ), + )) + else + ...List.generate( + model.prescriptionReportEnhList.length, + (index) => InkWell( + onTap: () { + PrescriptionReport prescriptionReport = + PrescriptionReport( + imageSRCUrl: model + .prescriptionReportEnhList[index].imageSRCUrl, + itemDescription: model + .prescriptionReportEnhList[index] + .itemDescription, + itemDescriptionN: model + .prescriptionReportEnhList[index] + .itemDescription, + routeN: + model.prescriptionReportEnhList[index].route, + frequency: model + .prescriptionReportEnhList[index].frequency, + frequencyN: model + .prescriptionReportEnhList[index].frequency, + doseDailyQuantity: model + .prescriptionReportEnhList[index] + .doseDailyQuantity, + days: model.prescriptionReportEnhList[index].days, + itemID: + model.prescriptionReportEnhList[index].itemID, + remarks: model + .prescriptionReportEnhList[index].remarks); + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: prescriptionReport, + ), ), - ], - ), - ), + ); + }, + child: Container( + margin: EdgeInsets.all(8.0), + color: Colors.white, + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + model + .prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(model.prescriptionReportEnhList[index] + .itemDescription), + ], + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) + ], + ), ), - ) + ), + ) ], ), ), bottomSheet: Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.23, + height: MediaQuery.of(context).size.height * 0.14, color: Colors.grey[100], child: Column( children: [ Divider(), + if(projectViewModel.havePrivilege(13)) Container( width: MediaQuery.of(context).size.width * 0.8, child: Button( label: TranslationBase.of(context).sendCopy, - onTap: () => model.sendPrescriptionEmail( - appointmentDate: prescriptions.appointmentDate, - patientID: prescriptions.patientID, - clinicName: prescriptions.companyName, - doctorName: prescriptions.doctorName, - projectID: prescriptions.projectID), + onTap: () { + showConfirmMessage(context,model); + }, loading: model.state == ViewState.BusyLocal, ), ), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label:TranslationBase.of(context).resendOrder, - backgroundColor: Colors.green[200], - )) + if (false) + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: TranslationBase.of(context).resendOrder, + backgroundColor: Colors.green[200], + )) ], ), ), ), ); } + + void showConfirmMessage(BuildContext context, PrescriptionsViewModel model) { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () { + model.sendPrescriptionEmail( + appointmentDate: prescriptions.appointmentDate, + patientID: prescriptions.patientID, + clinicName: prescriptions.companyName, + doctorName: prescriptions.doctorName, + mes: TranslationBase.of(context).sendSuc, + projectID: prescriptions.projectID); + }, + ), + ); + } } diff --git a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart index 5061a8ba..30bfa13e 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart @@ -24,7 +24,6 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { appBarTitle: TranslationBase.of(context).orderDetails, baseViewModel: model, body: SingleChildScrollView( - physics: BouncingScrollPhysics(), child: Container( margin: EdgeInsets.all(15.0), child: Column( @@ -33,9 +32,17 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { SizedBox( height: 5, ), - Texts(TranslationBase.of(context).orderStatus +' : ${prescriptionsOrder.descriptionN}'), + Container( + width: double.infinity, + decoration: BoxDecoration( + color: prescriptionsOrder.status == 3 ?Colors.green : prescriptionsOrder.status ==2 ? Colors.grey: Colors.red, + borderRadius: BorderRadius.circular(5)), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).orderStatus +' : ${prescriptionsOrder.descriptionN}',color: Colors.white,), + )), SizedBox( - height: 5, + height: 15, ), Table( border: TableBorder.symmetric( @@ -60,17 +67,17 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { ]), TableRow(children: [ Container( - height: 50, + height: 70, color: Colors.white, child: Center( child: Texts('${prescriptionsOrder.iD}'), ), ), Container( - height: 50, + height: 70, color: Colors.white, child: Center( - child: Texts('${prescriptionsOrder.createdOn}'), + child: Texts('${prescriptionsOrder.createdOn.year}-${prescriptionsOrder.createdOn.day}-${prescriptionsOrder.createdOn.day} ${prescriptionsOrder.createdOn.hour}:${prescriptionsOrder.createdOn.minute}'), ), ), ]) @@ -110,7 +117,8 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { ], ), ), - ) + ), + SizedBox(height: 120,) ], ), ), diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index 9d63bf7d..84691773 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_details_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -7,6 +8,7 @@ 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:provider/provider.dart'; class PrescriptionsHistoryPage extends StatelessWidget { final PrescriptionsViewModel prescriptionsViewModel; @@ -15,6 +17,8 @@ class PrescriptionsHistoryPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return AppScaffold( baseViewModel: prescriptionsViewModel, body: ListView.builder( @@ -41,9 +45,7 @@ class PrescriptionsHistoryPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - DateUtil.getDayMonthYearHourMinuteDateFormatted( - prescriptionsViewModel - .prescriptionsHistory[index].createdOn), + DateUtil.getDayMonthYearHourMinuteDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), fontWeight: FontWeight.w300, ), SizedBox( diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index dad6fd17..96d4aba0 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; @@ -10,6 +11,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../Constants.dart'; + class HomePrescriptionsPage extends StatefulWidget { @override _HomePrescriptionsPageState createState() => _HomePrescriptionsPageState(); @@ -18,11 +21,14 @@ class HomePrescriptionsPage extends StatefulWidget { class _HomePrescriptionsPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; + List imagesInfo = List(); @override void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/1.png')); } @override @@ -40,6 +46,7 @@ class _HomePrescriptionsPageState extends State appBarTitle: TranslationBase.of(context).prescriptions, description: TranslationBase.of(context).infoPrescriptions, infoList: TranslationBase.of(context).infoPrescriptionsPoints, + imagesInfo: imagesInfo, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -78,7 +85,6 @@ class _HomePrescriptionsPageState 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), diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart index 6b852db9..abf68328 100644 --- a/lib/pages/medical/prescriptions/prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -9,6 +10,7 @@ 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:provider/provider.dart'; class PrescriptionsPage extends StatelessWidget { final PrescriptionsViewModel prescriptionsViewModel; @@ -18,6 +20,7 @@ class PrescriptionsPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( baseViewModel: prescriptionsViewModel, body: FractionallySizedBox( @@ -37,7 +40,6 @@ class PrescriptionsPage extends StatelessWidget { leading: Radio( value: FilterType.Clinic, groupValue: prescriptionsViewModel.filterType, - activeColor: Colors.red[800], onChanged: (FilterType value) { prescriptionsViewModel.setFilterType(value); }, @@ -55,7 +57,6 @@ class PrescriptionsPage extends StatelessWidget { leading: Radio( value: FilterType.Hospital, groupValue: prescriptionsViewModel.filterType, - activeColor: Colors.red[800], onChanged: (FilterType value) { prescriptionsViewModel.setFilterType(value); }, @@ -88,9 +89,9 @@ class PrescriptionsPage extends StatelessWidget { profileUrl: prescriptions.doctorImageURL, rat: prescriptions.actualDoctorRate.toDouble(), subName: prescriptions.name, - isInOutPatient: prescriptions.isInOutPatient, - date: DateUtil.getMonthDayYearDateFormatted( - prescriptions.dischargeDate), + isInOutPatient: prescriptions.isInOutPatient, + isLiveCareAppointment: prescriptions.isLiveCareAppointment, + date:projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), ), ); }).toList(), diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index 9f8a0640..742e3ddf 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -1,12 +1,17 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.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:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class RadiologyDetailsPage extends StatelessWidget { @@ -16,6 +21,7 @@ class RadiologyDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getRadImageURL( projectId: finalRadiology.projectID, @@ -27,34 +33,58 @@ class RadiologyDetailsPage extends StatelessWidget { baseViewModel: model, body: SingleChildScrollView( child: Column( + mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text('${finalRadiology.reportData}',textAlign: TextAlign.center,), + Texts( + '${finalRadiology.reportData}', + textAlign: TextAlign.center, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + '${finalRadiology.reportData}', + textAlign: TextAlign.start, + fontSize: 17, + ), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.2, + ) ], ), ), - bottomSheet: Container( + bottomSheet: (projectViewModel.havePrivilege(9) || + projectViewModel.havePrivilege(8)) + ? Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.2, + height: finalRadiology.dIAPACSURL != "" + ? MediaQuery.of(context).size.height * 0.25 + : MediaQuery.of(context).size.height * 0.14, color: Colors.grey[100], child: Column( + mainAxisSize: MainAxisSize.min, children: [ Divider(), + if (finalRadiology.dIAPACSURL != "" && projectViewModel.havePrivilege(9)) + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + onTap: () { + launch(model.radImageURL); + }, + label: TranslationBase.of(context).openRad, + backgroundColor: Colors.grey[800], + ), + ), + if (projectViewModel.havePrivilege(8)) Container( width: MediaQuery.of(context).size.width * 0.8, child: Button( onTap: () { - launch(model.radImageURL); + showConfirmMessage( + finalRadiology: finalRadiology, model: model); }, - label: TranslationBase.of(context).openRad, - backgroundColor: Colors.grey[800], - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - onTap: () => model.sendRadReportEmail( - finalRadiology: finalRadiology), label: TranslationBase.of(context).sendCopyRad, loading: model.state == ViewState.BusyLocal, backgroundColor: Theme.of(context).primaryColor, @@ -62,7 +92,22 @@ class RadiologyDetailsPage extends StatelessWidget { ) ], ), - )), + ):Container()), + ); + } + + void showConfirmMessage( + {FinalRadiology finalRadiology, RadiologyViewModel model}) { + showDialog( + context: AppGlobal.context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () { + model.sendRadReportEmail( + mes: TranslationBase.of(AppGlobal.context).sendSuc, + finalRadiology: finalRadiology); + }, + ), ); } } diff --git a/lib/pages/medical/radiology/radiology_home_page.dart b/lib/pages/medical/radiology/radiology_home_page.dart index 1233a89a..2123172a 100644 --- a/lib/pages/medical/radiology/radiology_home_page.dart +++ b/lib/pages/medical/radiology/radiology_home_page.dart @@ -1,5 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_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/radiology/radiology_details_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -10,10 +12,15 @@ 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:provider/provider.dart'; class RadiologyHomePage extends StatelessWidget { + List imagesInfo = List(); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/ar/1.png')); return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, widget) => AppScaffold( @@ -21,6 +28,7 @@ class RadiologyHomePage extends StatelessWidget { appBarTitle: TranslationBase.of(context).radiology, baseViewModel: model, description: TranslationBase.of(context).infoRadiology, + imagesInfo: imagesInfo, body: FractionallySizedBox( widthFactor: 1.0, child: ListView( @@ -38,7 +46,6 @@ class RadiologyHomePage extends StatelessWidget { leading: Radio( value: FilterType.Clinic, groupValue: model.filterType, - activeColor: Theme.of(context).primaryColor, onChanged: (FilterType value) { model.setFilterType(value); }, @@ -56,7 +63,6 @@ class RadiologyHomePage extends StatelessWidget { leading: Radio( value: FilterType.Hospital, groupValue: model.filterType, - activeColor: Theme.of(context).primaryColor, onChanged: (FilterType value) { model.setFilterType(value); }, @@ -86,11 +92,12 @@ class RadiologyHomePage extends StatelessWidget { ), child: DoctorCard( isInOutPatient: radiology.isInOutPatient, + isLiveCareAppointment: radiology.isLiveCareAppointment, name: radiology.doctorName, profileUrl: radiology.doctorImageURL, - subName: '${radiology.projectName} \n${TranslationBase.of(context).billNo} ${radiology.invoiceNo}', - date: DateUtil.getMonthDayYearDateFormatted( - radiology.orderDate), + billNo: '${radiology.invoiceNo}', + subName: '${radiology.projectName}', + date: projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(radiology.orderDate):DateUtil.getMonthDayYearDateFormatted(radiology.orderDate), ), ); }).toList(), diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 5c6812e2..d3c818ff 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -1,6 +1,8 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_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/reports/report_list_widget.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart'; @@ -11,6 +13,7 @@ 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:provider/provider.dart'; class HomeReportPage extends StatefulWidget { @override @@ -20,6 +23,7 @@ class HomeReportPage extends StatefulWidget { class _HomeReportPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; + List imagesInfo = List(); @override void initState() { @@ -35,15 +39,31 @@ class _HomeReportPageState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); return BaseView( onModelReady: (model) => model.getReports(), //model.getPrescriptions(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).monthReport, + appBarTitle: TranslationBase.of(context).newMedReport, + title: TranslationBase.of(context).medReport, description: TranslationBase.of(context).infoMonthReport, baseViewModel: model, - //bottomSheet: Container(), - + imagesInfo: imagesInfo, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -82,32 +102,33 @@ class _HomeReportPageState extends State controller: _tabController, indicatorWeight: 5.0, indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, unselectedLabelColor: Colors.grey[800], tabs: [ Container( - width: MediaQuery.of(context).size.width * 0.22, + width: MediaQuery.of(context).size.width * 0.15, child: Center( - child: Texts('Requested'), + child: Texts(TranslationBase.of(context).requested,fontSize: 11,), ), ), Container( - width: MediaQuery.of(context).size.width * 0.22, + width: MediaQuery.of(context).size.width * 0.15, child: Center( - child: Texts('Ready'), + child: Texts(TranslationBase.of(context).ready,fontSize: 11,), ), ), Container( - width: MediaQuery.of(context).size.width * 0.22, + width: MediaQuery.of(context).size.width * 0.15, child: Center( - child: Texts('Completed'), + child: + Texts(TranslationBase.of(context).completed,fontSize: 11,), ), ), Container( - width: MediaQuery.of(context).size.width * 0.22, + width: MediaQuery.of(context).size.width * 0.15, child: Center( - child: Texts('Cancelled'), + child: + Texts(TranslationBase.of(context).cancelled,fontSize: 11,), ), ), ], @@ -120,6 +141,7 @@ class _HomeReportPageState extends State ), body: Column( children: [ + if(model.user!=null) Expanded( child: TabBarView( physics: BouncingScrollPhysics(), @@ -127,28 +149,34 @@ class _HomeReportPageState extends State children: [ ReportListWidget( reportList: model.reportsOrderRequestList, + emailAddress: model.user.emailAddress ), ReportListWidget( reportList: model.reportsOrderReadyList, + emailAddress: model.user.emailAddress ), ReportListWidget( reportList: model.reportsOrderCompletedList, + emailAddress: model.user.emailAddress ), ReportListWidget( reportList: model.reportsOrderCanceledList, + emailAddress: model.user.emailAddress ), ], ), ), - SizedBox(height: 110,) + SizedBox( + height: 110, + ) ], ), - bottomSheet: Container( + bottomSheet: projectViewModel.havePrivilege(21) ?Container( width: double.infinity, height: 90, margin: EdgeInsets.all(8.0), child: Button( - label: 'Resend order & deliver', + label: TranslationBase.of(context).requestMedicalReport, backgroundColor: Colors.grey[800], onTap: () => Navigator.push( context, @@ -157,7 +185,7 @@ class _HomeReportPageState extends State ), ), ), - ), + ):null, ), ), ); diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 6408074a..72d0422b 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -1,13 +1,22 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/reports/Reports.dart'; +import 'package:diplomaticquarterapp/core/service/medical/reports_service.dart'; +import 'package:diplomaticquarterapp/locator.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/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ReportListWidget extends StatelessWidget { final List reportList; + final String emailAddress; - ReportListWidget({@required this.reportList}); + ReportListWidget({@required this.reportList, this.emailAddress}); @override Widget build(BuildContext context) { @@ -16,7 +25,8 @@ class ReportListWidget extends StatelessWidget { itemBuilder: (context, index) => Padding( padding: const EdgeInsets.all(8.0), child: Container( - width: double.infinity,margin: EdgeInsets.only(left: 8,right: 8,top: 3), + width: double.infinity, + margin: EdgeInsets.only(left: 8, right: 8, top: 3), decoration: BoxDecoration( color: Colors.white, border: Border.all(color: Colors.white, width: 2), @@ -40,15 +50,39 @@ class ReportListWidget extends StatelessWidget { flex: 4, child: Padding( padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 12,), - Texts(reportList[index].projectName), - Texts(reportList[index].clinicDescription), - Texts('invoice No: ${reportList[index].invoiceNo}'), - SizedBox(height: 12,), - + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Texts(reportList[index].projectName), + Texts(reportList[index].clinicDescription), + Texts(TranslationBase.of(context).invoiceNo + + ': ${reportList[index].invoiceNo}'), + SizedBox(height: 12), + ], + ), + reportList[index].status == 2 + ? Container( + margin: + EdgeInsets.only(left: 15.0, right: 15.0), + child: InkWell( + onTap: () { + showConfirmMessage(reportList[index]); + // sendReportEmail(reportList[index]); + }, + child: Icon( + Icons.email, + color: Theme.of(context).primaryColor, + size: 35.0, + ), + ), + ) + : Container(), ], ), ), @@ -61,4 +95,39 @@ class ReportListWidget extends StatelessWidget { ), ); } + + void showConfirmMessage(Reports report) { + showDialog( + context: AppGlobal.context, + child: ConfirmSendEmailDialog( + email: emailAddress, + onTapSendEmail: () { + sendReportEmail(report); + }, + ), + ); + } + + sendReportEmail(Reports report) { + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); + ReportsService _reportsService = locator(); + _reportsService + .sendEmailForMedicalReport( + report.projectName, + report.clinicDescription, + report.doctorName, + DateUtil.convertDateToString(report.requestDate), + report.invoiceNo.toString(), + report.projectID, + DateUtil.convertDateToString(report.requestDate), + report.setupId) + .then((value) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showSuccessToast( + message: TranslationBase.of(AppGlobal.context).emailSentSuccessfully); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + print(err); + }); + } } diff --git a/lib/pages/medical/reports/reports_page.dart b/lib/pages/medical/reports/reports_page.dart index 5b64bc4e..d8cb2ca0 100644 --- a/lib/pages/medical/reports/reports_page.dart +++ b/lib/pages/medical/reports/reports_page.dart @@ -1,13 +1,16 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.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 MedicalReports extends StatelessWidget { @override @@ -18,17 +21,17 @@ class MedicalReports extends StatelessWidget { context: context, child: ConfirmDialog( appointmentHistory: model, - onOkSelected: (model) => reportsViewModel.insertRequestForMedicalReport(model), + onOkSelected: (model) => reportsViewModel.insertRequestForMedicalReport(model,TranslationBase.of(context).successSendReport), ), ); } - + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPatentAppointmentHistory(), builder: (_, model, widget) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: 'Medical Reports', + appBarTitle: TranslationBase.of(context).medReport, body: ListView.builder( itemCount: model.appointHistoryList.length, itemBuilder: (context, index) => Padding( @@ -69,8 +72,7 @@ class MedicalReports extends StatelessWidget { ), Texts(model.appointHistoryList[index].projectName), Texts(model.appointHistoryList[index].clinicName), - Texts(DateUtil.getMonthDayYearDateFormatted( - model.appointHistoryList[index].appointmentDate)), + Texts(projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.appointHistoryList[index].appointmentDate):DateUtil.getMonthDayYearDateFormatted(model.appointHistoryList[index].appointmentDate)), StarRating( totalAverage: model .appointHistoryList[index].actualDoctorRate @@ -89,7 +91,7 @@ class MedicalReports extends StatelessWidget { onTap: () => confirmBox(model.appointHistoryList[index], model), child: Container( - width: 80, + width: 85, height: 50, decoration: BoxDecoration( color: Colors.black54, @@ -102,7 +104,7 @@ class MedicalReports extends StatelessWidget { ), child: Center( child: Texts( - 'Request', + TranslationBase.of(context).requestReport, fontSize: 12, color: Colors.white, ), @@ -137,13 +139,13 @@ class _ConfirmDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( - title: Text('Confirm'), + title: Texts(TranslationBase.of(context).confirm), children: [ Container( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Texts('Request a medical report'), + Texts(TranslationBase.of(context).confirmMsgReport), SizedBox( height: 5.0, ), @@ -166,7 +168,7 @@ class _ConfirmDialogState extends State { child: Container( child: Center( child: Texts( - 'cancel', + TranslationBase.of(context).cancel, color: Colors.red, ), ), @@ -190,7 +192,7 @@ class _ConfirmDialogState extends State { padding: const EdgeInsets.all(8.0), child: Center( child: Texts( - 'ok', + TranslationBase.of(context).ok, fontWeight: FontWeight.w400, ), ), diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart index 763948c0..2f9a3e60 100644 --- a/lib/pages/medical/smart_watch_health_data/health_data_list.dart +++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart @@ -1,6 +1,5 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; class HealthDataList extends StatefulWidget { @@ -9,19 +8,6 @@ class HealthDataList extends StatefulWidget { } class _HealthDataListState extends State { - List dataTypes = List(); - - @override - void initState() { - dataTypes.add(DataType.DISTANCE); - dataTypes.add(DataType.STEP_COUNT); - dataTypes.add(DataType.HEART_RATE); - dataTypes.add(DataType.SLEEP); - dataTypes.add(DataType.ENERGY); - - super.initState(); - } - @override Widget build(BuildContext context) { return AppScaffold( @@ -146,7 +132,7 @@ class _HealthDataListState extends State { width: MediaQuery.of(context).size.width * 0.8, child: Button( onTap: () { - readAll(); +// launch(model.radImageURL); }, label: 'Sync Health Data', backgroundColor: Colors.grey[800], @@ -156,26 +142,4 @@ class _HealthDataListState extends State { ), )); } - - void readLast() async { - final result = await FitKit.readLast(DataType.DISTANCE); - print(result); - print(result); - } - - void readAll() async { - if (await FitKit.requestPermissions(dataTypes)) { - for (DataType type in dataTypes) { - final results = await FitKit.read( - type, - dateFrom: DateTime.now().subtract(Duration(days: 15)), - dateTo: DateTime.now(), - limit: 100, - ); - print(results); - print(results.length); - } - readLast(); - } - } } diff --git a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart index 3f07693b..eb0c1675 100644 --- a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -31,7 +31,6 @@ class _SmartWatchInstructionsState extends State { return AppScaffold( appBarTitle: "Sync Health Data", isShowAppBar: true, - isShowDecPage: false, body: Container( child: Platform.isIOS ? _getAppleWatchInstructions() @@ -89,8 +88,6 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - margin: EdgeInsets.only(left: 5.0), - width: 105.0, child: Text( "Apple Watch Series 1", style: TextStyle( @@ -111,12 +108,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - margin: EdgeInsets.only(left: 5.0), - width: 105.0, child: Text( "Apple Watch Series 2", - overflow: TextOverflow.clip, - softWrap: true, style: TextStyle( fontSize: 12.0)), ) @@ -142,8 +135,6 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - margin: EdgeInsets.only(left: 5.0), - width: 105.0, child: Text( "Apple Watch Series 3", style: TextStyle( @@ -164,8 +155,6 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - margin: EdgeInsets.only(left: 5.0), - width: 105.0, child: Text( "Apple Watch Series 4", style: TextStyle( @@ -193,8 +182,6 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - margin: EdgeInsets.only(left: 5.0), - width: 105.0, child: Text( "Apple Watch Series 5", style: TextStyle( @@ -215,8 +202,6 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - margin: EdgeInsets.only(left: 5.0), - width: 105.0, child: Text( "Apple Watch Series 6", style: TextStyle( @@ -442,7 +427,7 @@ class _SmartWatchInstructionsState extends State { width: MediaQuery.of(context).size.width, margin: EdgeInsets.symmetric(horizontal: 5.0), child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 0.0), + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), color: Colors.white.withOpacity(1.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -672,7 +657,7 @@ class _SmartWatchInstructionsState extends State { style: TextStyle(fontSize: 17.0)), ), Container( - margin: EdgeInsets.all(12.0), + margin: EdgeInsets.all(15.0), child: ButtonTheme( shape: RoundedRectangleBorder( borderRadius: diff --git a/lib/pages/medical/vital_sign/LineChartCurved.dart b/lib/pages/medical/vital_sign/LineChartCurved.dart new file mode 100644 index 00000000..7b7449a8 --- /dev/null +++ b/lib/pages/medical/vital_sign/LineChartCurved.dart @@ -0,0 +1,217 @@ +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartCurved extends StatelessWidget { + final String title; + final List timeSeries; + final int indexes; + + LineChartCurved({this.title, this.timeSeries, this.indexes}); + + 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), + 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( + show: true, drawVerticalLine: true, drawHorizontalLine: true), + titlesData: FlTitlesData( + bottomTitles: SideTitles( + showTitles: true, + getTextStyles: (value) => const TextStyle( + color: Colors.black, + fontSize: 10, + ), + rotateAngle:-65, + //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 (timeSeries.length < 10) { + // return '${value.toInt()}'; + // } else { + // if (value == getMinY()) + // return '${value.toInt()}'; + // if (value == getMaxY()) + // return '${value.toInt()}'; + // if (yAxixs.contains(value)) { + // return '${value.toInt()}'; + // } + // return ''; + // } + return '${value.toInt()}'; + }, + 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: [Theme.of(context).primaryColor], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [ + lineChartBarData1, + ]; + } +} diff --git a/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart b/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart new file mode 100644 index 00000000..e8cb8b24 --- /dev/null +++ b/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart @@ -0,0 +1,257 @@ +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 LineChartCurvedBloodPressure extends StatelessWidget { + final String title; + final List timeSeries1; + final List timeSeries2; + final int indexes; + + LineChartCurvedBloodPressure( + {this.title, this.timeSeries1, this.indexes, this.timeSeries2}); + + 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, + ), + rotateAngle: -65, + //rotateAngle:-65, + 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) { + return '${value.toInt()}'; + }, + 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: [Theme.of(context).primaryColor], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + final LineChartBarData lineChartBarData2 = LineChartBarData( + spots: spots2, + isCurved: true, + colors: [Colors.grey], + barWidth: 5, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + belowBarData: BarAreaData( + show: false, + ), + ); + + return [lineChartBarData1, lineChartBarData2]; + } +} diff --git a/lib/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart b/lib/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart new file mode 100644 index 00000000..e28b52e1 --- /dev/null +++ b/lib/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart @@ -0,0 +1,146 @@ +import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class VitalSignBloodPressureWidget extends StatefulWidget { + final List vitalList; + final String title1; + final String title2; + final String title3; + final String viewKey1; + final String viewKey2; + + VitalSignBloodPressureWidget( + {Key key, this.vitalList, this.title1, this.title2, this.viewKey1, this.title3, this.viewKey2}); + + @override + _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); +} + +class _VitalSignDetailsWidgetState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)), + border: Border.all(color: Colors.grey, width: 1), + ), + margin: EdgeInsets.all(20), + child: Container( + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 2.0, color: Colors.grey[300]), + ), + children: fullData(projectViewModel), + ), + ], + ), + ), + ); + } + + List fullData(ProjectViewModel projectViewModel) { + List tableRow = []; + tableRow.add(TableRow(children: [ + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + 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( + TranslationBase.of(context).date, + color: Colors.white, + ), + ), + height: 60, + ), + ), + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + + ), + child: Center( + child: Texts(widget.title2, color: Colors.white), + ), + height: 60), + ), + Container( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) + ), + ), + child: Center( + child: Texts(widget.title3, color: Colors.white), + ), + height: 60), + ), + ])); + widget.vitalList.forEach((vital) { + var data = vital.toJson()[widget.viewKey1]; + if (data != 0) + tableRow.add(TableRow(children: [ + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(vital.vitalSignDate.weekday) : DateUtil.getWeekDay(vital.vitalSignDate.weekday)}, ${vital.vitalSignDate.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(vital.vitalSignDate.month) : DateUtil.getMonth(vital.vitalSignDate.month)}, ${vital.vitalSignDate.year} ', + textAlign: TextAlign.center, + ), + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${vital.toJson()[widget.viewKey1]}', + textAlign: TextAlign.center, + ), + ), + ), + ), + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${vital.toJson()[widget.viewKey2]}', + textAlign: TextAlign.center, + ), + ), + ), + ), + ])); + }); + return tableRow; + } +} diff --git a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart index 667620a2..4d141b5f 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/patient_lookup.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/vital_sign_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_item.dart'; @@ -16,19 +17,26 @@ class VitalSignDetailsScreen extends StatelessWidget { int appointmentNo; int projectID; - VitalSignDetailsScreen({this.appointmentNo, this.projectID}); + bool isNotOneAppointment; + VitalSignDetailsScreen({this.appointmentNo, this.projectID,this.isNotOneAppointment=true}); + List imagesInfo = List(); + @override Widget build(BuildContext context) { + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/1.png')); return BaseView( onModelReady: appointmentNo != null && projectID != null - ? (model) => model.getPatientRadOrders( + ? (model) => model.getPatientVitalSign( appointmentNo: appointmentNo, projectID: projectID) - : (model) => model.getPatientRadOrders(), + : (model) => model.getPatientVitalSign(), builder: (_, mode, widget) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).vitalSigns, baseViewModel: mode, + description: TranslationBase.of(context).infoSigns, + imagesInfo: imagesInfo, body: mode.vitalSignResModelList.length > 0 ? Container( child: ListView( @@ -36,7 +44,7 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () => Navigator.push( + onTap: () =>isNotOneAppointment? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -45,22 +53,18 @@ class VitalSignDetailsScreen extends StatelessWidget { vitalList: mode.vitalSignResModelList, ), ), - ), + ):null, child: Container( child: VitalSignItem( des: TranslationBase.of(context).height, icon: DQIcons.height, - lastVal: mode - .vitalSignResModelList[ - mode.vitalSignResModelList.length - 1] - .heightCm - .toString(), + lastVal: mode.heightCm, unit: TranslationBase.of(context).cm, ), ), ), InkWell( - onTap: () => Navigator.push( + onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -69,16 +73,12 @@ class VitalSignDetailsScreen extends StatelessWidget { vitalList: mode.vitalSignResModelList, ), ), - ), + ):null, child: VitalSignItem( des: TranslationBase.of(context).weight, icon: DQIcons.weight_scale, unit: TranslationBase.of(context).kg, - lastVal: mode - .vitalSignResModelList[ - mode.vitalSignResModelList.length - 1] - .weightKg - .toString(), + lastVal: mode.weightKg, ), ), ], @@ -86,7 +86,7 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () => Navigator.push( + onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -96,18 +96,16 @@ class VitalSignDetailsScreen extends StatelessWidget { vitalList: mode.vitalSignResModelList, ), ), - ), + ): null, child: VitalSignItem( des: TranslationBase.of(context).body, icon: DQIcons.bmi, - lastVal: mode - .vitalSignResModelList[0].pulseBeatPerMinute - .toString(), + lastVal: mode.bodyMax, unit: TranslationBase.of(context).mass, ), ), InkWell( - onTap: () => Navigator.push( + onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -117,14 +115,12 @@ class VitalSignDetailsScreen extends StatelessWidget { vitalList: mode.vitalSignResModelList, ), ), - ), + ):null, child: Container( child: VitalSignItem( des: TranslationBase.of(context).temperature, icon: DQIcons.thermometer, - lastVal: mode - .vitalSignResModelList[0].temperatureCelcius - .toString(), + lastVal: mode.temperatureCelcius, unit: TranslationBase.of(context).tempC, ), ), @@ -134,7 +130,7 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () => Navigator.push( + onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -143,20 +139,16 @@ class VitalSignDetailsScreen extends StatelessWidget { vitalList: mode.vitalSignResModelList, ), ), - ), + ):null, child: VitalSignItem( des: TranslationBase.of(context).heart, icon: DQIcons.heart, - lastVal: mode - .vitalSignResModelList[ - mode.vitalSignResModelList.length - 1] - .pulseBeatPerMinute - .toString(), + lastVal: mode.hartRat, unit: TranslationBase.of(context).bpm, ), ), InkWell( - onTap: () => Navigator.push( + onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -166,15 +158,11 @@ class VitalSignDetailsScreen extends StatelessWidget { vitalList: mode.vitalSignResModelList, ), ), - ), + ):null, child: VitalSignItem( des: TranslationBase.of(context).respirationRate, icon: DQIcons.outline, - lastVal: mode - .vitalSignResModelList[ - mode.vitalSignResModelList.length - 1] - .respirationBeatPerMinute - .toString(), + lastVal: mode.respirationBeatPerMinute, unit: TranslationBase.of(context).respirationSigns, ), ), @@ -184,24 +172,20 @@ class VitalSignDetailsScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ InkWell( - onTap: () => Navigator.push( + onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( pageKey: VitalSignDetails.BloodPressure, - pageTitle: TranslationBase.of(context).pulse, + pageTitle: TranslationBase.of(context).bloodPressure, vitalList: mode.vitalSignResModelList, ), ), - ), + ):null, child: VitalSignItem( - des: TranslationBase.of(context).pulse, + des: TranslationBase.of(context).bloodPressure, icon: DQIcons.blood_pressure, - lastVal: mode - .vitalSignResModelList[ - mode.vitalSignResModelList.length - 1] - .bloodPressure - .toString(), + lastVal: mode.bloodPressure, unit: TranslationBase.of(context).sysDias, ), ), diff --git a/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart b/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart index 589284a1..113e29a6 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart @@ -1,9 +1,12 @@ import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class VitalSignDetailsWidget extends StatefulWidget { final List vitalList; @@ -21,6 +24,7 @@ class VitalSignDetailsWidget extends StatefulWidget { class _VitalSignDetailsWidgetState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( decoration: BoxDecoration( color: Colors.transparent, @@ -38,7 +42,7 @@ class _VitalSignDetailsWidgetState extends State { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(projectViewModel), ), ], ), @@ -46,20 +50,21 @@ class _VitalSignDetailsWidgetState extends State { ); } - List fullData() { + List fullData(ProjectViewModel projectViewModel) { List tableRow = []; tableRow.add(TableRow(children: [ 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( - widget.title1, + TranslationBase.of(context).date, color: Colors.white, ), ), @@ -69,9 +74,10 @@ class _VitalSignDetailsWidgetState extends State { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0) ), ), child: Center( @@ -81,32 +87,34 @@ class _VitalSignDetailsWidgetState extends State { ) ])); widget.vitalList.forEach((vital) { - tableRow.add(TableRow(children: [ - Container( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${DateUtil.getWeekDay(vital.vitalSignDate.weekday)}, ${vital.vitalSignDate.day} ${DateUtil.getMonth(vital.vitalSignDate.month)}, ${vital.vitalSignDate.year} ', - textAlign: TextAlign.center, + var data = vital.toJson()[widget.viewKey]; + if (data != 0) + tableRow.add(TableRow(children: [ + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(vital.vitalSignDate.weekday) : DateUtil.getWeekDay(vital.vitalSignDate.weekday)}, ${vital.vitalSignDate.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(vital.vitalSignDate.month) : DateUtil.getMonth(vital.vitalSignDate.month)}, ${vital.vitalSignDate.year} ', + textAlign: TextAlign.center, + ), ), ), ), - ), - Container( - child: Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${vital.toJson()[widget.viewKey]}', - textAlign: TextAlign.center, + Container( + child: Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Texts( + '${vital.toJson()[widget.viewKey]}', + textAlign: TextAlign.center, + ), ), ), ), - ), - ])); + ])); }); return tableRow; } diff --git a/lib/pages/medical/vital_sign/vital_sign_item.dart b/lib/pages/medical/vital_sign/vital_sign_item.dart index a42e26d5..fb44772d 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item.dart @@ -46,7 +46,7 @@ class VitalSignItem extends StatelessWidget { des, style: TextStyle( fontSize: 1.7 * SizeConfig.textMultiplier, - color: Theme.of(context).textTheme.headline1.color, + color: HexColor('#B8382C'), fontWeight: FontWeight.bold, ), ), @@ -76,11 +76,11 @@ class VitalSignItem extends StatelessWidget { text: TextSpan( style: TextStyle(color: Colors.black), children: [ - TextSpan(text: lastVal + " "), + TextSpan(text: lastVal), TextSpan( text: unit, style: TextStyle( - color: Theme.of(context).textTheme.headline1.color, + color: HexColor('#B8382C'), ), ), ]), diff --git a/lib/pages/medical/vital_sign/vital_sign_item_details_screen.dart b/lib/pages/medical/vital_sign/vital_sign_item_details_screen.dart index 802aae38..6db865b6 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item_details_screen.dart @@ -1,8 +1,11 @@ import 'package:diplomaticquarterapp/core/enum/patient_lookup.dart'; import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sing_chart_and_detials.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class VitalSignItemDetailsScreen extends StatelessWidget { final VitalSignDetails pageKey; @@ -15,45 +18,19 @@ class VitalSignItemDetailsScreen extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); switch (pageKey) { case VitalSignDetails.BodyMeasurements: VSchart = [ { - 'name': 'Height', + 'name': 'BMI', + 'nameAr': 'مؤشر الكتلة', 'title1': 'Date', - 'title2': 'Cm', - 'viewKey': 'HeightCm', - }, - { - 'name': 'Weight Kg', - 'title1': 'Date', - 'title2': 'Kg', - 'viewKey': 'WeightKg', - }, - { - 'name': 'BodyMassIndex', - 'title1': 'Date', - 'title2': 'BodyMass', + 'title2': 'BMI', + 'title2Ar': 'الكتلة', 'viewKey': 'BodyMassIndex', }, - { - 'name': 'HeadCircumCm', - 'title1': 'Date', - 'title2': 'Cm', - 'viewKey': 'HeadCircumCm', - }, - { - 'name': 'Ideal Body Weight (Lbs)', - 'title1': 'Date', - 'title2': 'Ideal Weight', - 'viewKey': 'IdealBodyWeightLbs', - }, - { - 'name': 'LeanBodyWeightLbs (Lbs)', - 'title1': 'Date', - 'title2': 'Lean Weight', - 'viewKey': 'LeanBodyWeightLbs', - } + ]; break; @@ -61,9 +38,11 @@ class VitalSignItemDetailsScreen extends StatelessWidget { case VitalSignDetails.Temperature: VSchart = [ { - 'name': 'Temperature In Celcius', + 'name': 'Temperature In Celsius', + 'nameAr': 'درجة الحرارة بالدرجة المئوية', 'title1': 'Date', 'title2': 'C', + 'title2Ar': 'ْس', 'viewKey': 'TemperatureCelcius', }, ]; @@ -73,8 +52,10 @@ class VitalSignItemDetailsScreen extends StatelessWidget { VSchart = [ { 'name': 'Pulse Beat Per Minute', + 'nameAr': 'نبضة نبضة في الدقيقة', 'title1': 'Date', 'title2': 'Minute', + 'title2Ar': 'دقيقة', 'viewKey': 'PulseBeatPerMinute', }, ]; @@ -84,8 +65,10 @@ class VitalSignItemDetailsScreen extends StatelessWidget { VSchart = [ { 'name': 'Respiration Beat Per Minute', + 'nameAr': 'ضربات التنفس في الدقيقة', 'title1': 'Date', 'title2': 'Beat Per Minute', + 'title2Ar': 'نفس في الدقيقة', 'viewKey': 'RespirationBeatPerMinute', }, ]; @@ -94,17 +77,16 @@ class VitalSignItemDetailsScreen extends StatelessWidget { case VitalSignDetails.BloodPressure: VSchart = [ { - 'name': 'Blood Pressure Higher', + 'name': 'Blood Pressure Systolic Diastolic', + 'nameAr': 'ضغط الدم الإنقباض الإنبساط', 'title1': 'Date', - 'title2': 'Minute', - 'viewKey': 'BloodPressureHigher', + 'title2': 'systolic', + 'title3': 'Diastolic', + 'title2Ar': 'الإنقباض', + 'title3Ar': 'الإنبساط', + 'viewKey': 'BloodPressure', }, - { - 'name': 'Blood Pressure Lower', - 'title1': 'Date', - 'title2': 'Minute', - 'viewKey': 'BloodPressureLower', - } + ]; break; @@ -112,8 +94,10 @@ class VitalSignItemDetailsScreen extends StatelessWidget { VSchart = [ { 'name': 'Respiration Rate', + 'nameAr': 'معدل التنفس', 'title1': 'Date', 'title2': 'bpm', + 'title2Ar': 'نفس', 'viewKey': 'RespirationBeatPerMinute', }, ]; @@ -122,9 +106,11 @@ class VitalSignItemDetailsScreen extends StatelessWidget { case VitalSignDetails.heart: VSchart = [ { - 'name': 'FIO2', + 'name': 'Heart rate', + 'nameAr': 'معدل النبض بالدقيقة', 'title1': 'Date', 'title2': 'bpm', + 'title2Ar': 'نبضة', 'viewKey': 'PulseBeatPerMinute', }, ]; @@ -134,8 +120,10 @@ class VitalSignItemDetailsScreen extends StatelessWidget { VSchart = [ { 'name': 'PainScore', + 'nameAr': 'نقاط الألم', 'title1': 'Date', 'title2': 'Cm', + 'title2Ar': 'سم', 'viewKey': 'PainScore', }, ]; @@ -145,8 +133,10 @@ class VitalSignItemDetailsScreen extends StatelessWidget { VSchart = [ { 'name': 'Weight Kg', + 'nameAr': 'الوزن كجم', 'title1': 'Date', 'title2': 'Kg', + 'title2Ar': 'كجم', 'viewKey': 'WeightKg', }, ]; @@ -157,8 +147,10 @@ class VitalSignItemDetailsScreen extends StatelessWidget { VSchart = [ { 'name': 'Height Cm', + 'nameAr': 'الطول سم', 'title1': 'Date', 'title2': 'Cm', + 'title2Ar': 'سم', 'viewKey': 'HeightCm', }, ]; @@ -174,12 +166,26 @@ class VitalSignItemDetailsScreen extends StatelessWidget { var vitalListTemp = vitalList.where( (element) => element.toJson()[chartInfo['viewKey']] != null, ); + + if(vitalListTemp.length != 0 && chartInfo['viewKey']=='BloodPressure'){ + return VitalSingChartBloodPressure( + vitalList: vitalList, + name:projectViewModel.isArabic? chartInfo['nameAr']:chartInfo['name'], + title1: chartInfo['title1'], + title2:projectViewModel.isArabic?chartInfo['title2Ar']: chartInfo['title2'], + title3:projectViewModel.isArabic?chartInfo['title3Ar']: chartInfo['title3'], + viewKey1: 'BloodPressureHigher', + viewKey2: 'BloodPressureLower', + + ); + } + return vitalListTemp.length != 0 ? VitalSingChartAndDetials( vitalList: vitalList, - name: chartInfo['name'], + name:projectViewModel.isArabic? chartInfo['nameAr']:chartInfo['name'], title1: chartInfo['title1'], - title2: chartInfo['title2'], + title2:projectViewModel.isArabic?chartInfo['title2Ar']: chartInfo['title2'], viewKey: chartInfo['viewKey']) : Container(); }).toList(), 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 299605ef..43bc9f0a 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 @@ -6,6 +6,8 @@ import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; +import 'LineChartCurved.dart'; + class VitalSingChartAndDetials extends StatelessWidget { VitalSingChartAndDetials({ Key key, @@ -21,31 +23,18 @@ class VitalSingChartAndDetials extends StatelessWidget { final String viewKey; final String title1; final String title2; - List timeSeriesData = []; + List timeSeriesData = []; @override Widget build(BuildContext context) { + generateData(); return Column( children: [ AppExpandableNotifier( - headerWidget: AppTimeSeriesChart( - seriesList: generateData(), - chartName: name, - startDate: DateTime( - vitalList[vitalList.length - 1] - .vitalSignDate - .year, - vitalList[vitalList.length - 1] - .vitalSignDate - .month + - 3, - vitalList[vitalList.length - 1] - .vitalSignDate - .day), - endDate: vitalList[0].vitalSignDate, - ), + isExpand: true, + headerWidget: LineChartCurved(title: name,timeSeries:timeSeriesData,indexes: timeSeriesData.length~/5.5,), bodyWidget: VitalSignDetailsWidget( - vitalList: vitalList.reversed.toList(), + vitalList: vitalList, title1: title1, title2: title2, viewKey: viewKey, @@ -57,26 +46,18 @@ class VitalSingChartAndDetials extends StatelessWidget { generateData() { if (vitalList.length > 0) { - vitalList.forEach( + vitalList.reversed.toList().forEach( (element) { + if( element.toJson()[viewKey]!=null && element.toJson()[viewKey]?.toInt()!=0) timeSeriesData.add( - TimeSeriesSales( - new DateTime(element.vitalSignDate.year, - element.vitalSignDate.month, element.vitalSignDate.day), - element.toJson()[viewKey]?.toInt(), + TimeSeriesSales2( + new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day), + element.toJson()[viewKey].toDouble(), ), ); }, ); } - return [ - new charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (TimeSeriesSales sales, _) => sales.time, - measureFn: (TimeSeriesSales sales, _) => sales.sales, - data: timeSeriesData, - ) - ]; + return timeSeriesData.reversed.toList(); } } diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart b/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart new file mode 100644 index 00000000..84a2eb51 --- /dev/null +++ b/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart @@ -0,0 +1,85 @@ +import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_wideget.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'; + +import 'package:charts_flutter/flutter.dart' as charts; + +import 'LineChartCurved.dart'; +import 'LineChartCurvedBloodPressure.dart'; + +class VitalSingChartBloodPressure extends StatelessWidget { + VitalSingChartBloodPressure({ + Key key, + @required this.vitalList, + @required this.name, + @required this.viewKey1, + @required this.viewKey2, + @required this.title1, + @required this.title2, + @required this.title3, + }) : super(key: key); + + final List vitalList; + final String name; + final String viewKey1; + final String viewKey2; + final String title1; + final String title2; + final String title3; + List timeSeriesData1 = []; + List timeSeriesData2 = []; + + @override + Widget build(BuildContext context) { + generateData(); + return Column( + children: [ + AppExpandableNotifier( + isExpand: true, + headerWidget: LineChartCurvedBloodPressure( + title: name, + timeSeries1: timeSeriesData1, + timeSeries2: timeSeriesData2, + indexes: timeSeriesData1.length ~/ 5.5, + ), + bodyWidget: VitalSignBloodPressureWidget( + vitalList: vitalList, + title1: title1, + title2: title2, + title3: title3, + viewKey1: viewKey1, + viewKey2: viewKey2, + ), + ), + ], + ); + } + + generateData() { + if (vitalList.length > 0) { + vitalList.reversed.toList().forEach( + (element) { + if (element.toJson()[viewKey1]?.toInt() != 0) + timeSeriesData1.add( + TimeSeriesSales2( + new DateTime(element.vitalSignDate.year, + element.vitalSignDate.month, element.vitalSignDate.day), + element.toJson()[viewKey1].toDouble(), + ), + ); + if (element.toJson()[viewKey2]?.toInt() != 0) + timeSeriesData2.add( + TimeSeriesSales2( + new DateTime(element.vitalSignDate.year, + element.vitalSignDate.month, element.vitalSignDate.day), + element.toJson()[viewKey2].toDouble(), + ), + ); + }, + ); + } + } +} diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 4acb3b68..414106b1 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; @@ -52,766 +53,970 @@ class _ParentCategorisePageState extends State { backgroundColor: Colors.white, isShowDecPage: false, baseViewModel: model, - body: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 5.90, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Image.network( - id == '1' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' - : id == '2' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' - : id == '3' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' - : id == '4' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' - : id == '5' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' - : id == '6' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' - : id == '7' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' - : id == '8' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' - : id == '9' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : id == '10' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' - : '', - fit: BoxFit.fill, - height: 160.0, - width: double.infinity), - ), - if (model.categoriseParent.length > 8) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + body: Container( + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + id == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : id == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : id == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : id == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : id == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : id == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : id == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : id == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : id == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : id == '10' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' + : '', + fit: BoxFit.fill, + height: 160.0, + width: double.infinity), + ), + if (model.categoriseParent.length > 8) + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: InkWell( - child: Container( - child: Texts( - 'View All Categories', - fontWeight: FontWeight.w300, - ), - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return Container( - height: MediaQuery.of(context) - .size - .height * - 0.89, - color: Colors.white, - child: Center( - child: ListView.builder( - scrollDirection: - Axis.vertical, - itemCount: model - .categoriseParent.length, - itemBuilder: - (BuildContext context, - int index) { - return Container( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Texts(model - .categoriseParent[ - index] - .name), - Divider( - thickness: 0.6, - color: Colors - .black12, - ) - ], + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: InkWell( + child: Container( + child: Texts( + 'View All Categories', + fontWeight: FontWeight.w300, + ), + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return Container( + height: MediaQuery.of(context) + .size + .height * + 0.89, + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: + Axis.vertical, + itemCount: model + .categoriseParent + .length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Padding( + padding: + EdgeInsets.all( + 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts(model + .categoriseParent[ + index] + .name), + Divider( + thickness: + 0.6, + color: Colors + .black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + SubCategorisePage( + title: model.categoriseParent[index].name, + id: model.categoriseParent[index].id, + parentId: id, + )), + ); + }, + ), ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - SubCategorisePage( - title: - model.categoriseParent[index].name, - id: model.categoriseParent[index].id, - parentId: - id, - )), - ); - }, - ), - ), - ); - }), - ), + ); + }), + ), + ); + }, ); }, - ); - }, - ), + ), + ), + Icon(Icons.arrow_forward) + ], + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, ), - Icon(Icons.arrow_forward) ], ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - ], - ), //Expanded widget heree if nassery - Padding( - padding: EdgeInsets.only(top: 35.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.2, - child: Center( - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: model.categoriseParent.length > 8 - ? 8 - : model.categoriseParent.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: - EdgeInsets.symmetric(horizontal: 8.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: 13.0), - child: Container( - height: 60.0, - width: 65.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.orange.shade200 - .withOpacity(0.45), - ), - child: Center( - child: Icon( - Icons.apps_sharp, - size: 32.0, + Padding( + padding: EdgeInsets.only(top: 35.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.2, + child: Center( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.categoriseParent.length > 8 + ? 8 + : model.categoriseParent.length, + itemBuilder: + (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 13.0), + child: Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors + .orange.shade200 + .withOpacity(0.45), + ), + child: Center( + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), ), ), - ), - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.197, - height: MediaQuery.of(context) - .size - .height * - 0.08, - child: Center( - child: Texts( - projectViewModel.isArabic - ? model - .categoriseParent[index] - .namen - : model - .categoriseParent[index] - .name, - fontSize: 13.4, - fontWeight: FontWeight.w600, - maxLines: 3, + Container( + width: MediaQuery.of(context) + .size + .width * + 0.197, + height: MediaQuery.of(context) + .size + .height * + 0.08, + child: Center( + child: Texts( + projectViewModel.isArabic + ? model + .categoriseParent[ + index] + .namen + : model + .categoriseParent[ + index] + .name, + fontSize: 13.4, + fontWeight: FontWeight.w600, + maxLines: 3, + ), + ), ), - ), + ], ), - ], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - SubCategorisePage( - title: model - .categoriseParent[index] - .name, - id: model - .categoriseParent[index] - .id, - parentId: id, - )), - ); - print(id); - }, - ), - ); - }), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + SubCategorisePage( + title: model + .categoriseParent[ + index] + .name, + id: model + .categoriseParent[ + index] + .id, + parentId: id, + )), + ); + print(id); + }, + ), + ); + }), + ), + ), ), - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - 'Refine', - fontWeight: FontWeight.w600, + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: FontWeight.w600, + ), + ], ), - ], - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return DraggableScrollableSheet( - initialChildSize: 0.95, - maxChildSize: 0.95, - minChildSize: 0.9, - builder: (BuildContext context, - ScrollController scrollController) { - return SingleChildScrollView( - controller: scrollController, - child: Container( - height: MediaQuery.of(context) - .size - .height * - 1.95, - child: Column( - children: [ - Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - 'Refine', - fontWeight: - FontWeight.w600, - ), - SizedBox( - width: 250.0, - ), - InkWell( - child: Texts( - 'Close', - color: Colors.red, - fontWeight: - FontWeight.w600, - fontSize: 15.0, - ), - onTap: () { - Navigator.pop( - context); - }, - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - Column( + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.95, + maxChildSize: 0.95, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController + scrollController) { + return SingleChildScrollView( + controller: scrollController, + child: Container( + height: MediaQuery.of(context) + .size + .height * + 1.95, + child: Column( children: [ - ExpansionTile( - title: - Texts('Categorise'), - children: [ - Container( - height: 350, - child: ListView - .builder( - controller: - scrollController, - scrollDirection: - Axis - .vertical, - shrinkWrap: - true, - itemCount: model - .categoriseParent - .length, - itemBuilder: - (BuildContext - context, - int index) { - return CheckboxListTile( - tristate: - true, - title: Texts(model - .categoriseParent[index] - .name), - controlAffinity: - ListTileControlAffinity.leading, - value: - checkedCategorise, - onChanged: - (bool - value) { - setState( - () { - checkedCategorise = - value; - }); - }, - ); - }), - ) - ], + Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: + FontWeight + .w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( + 'Close', + color: + Colors.red, + fontWeight: + FontWeight + .w600, + fontSize: 15.0, + ), + onTap: () { + Navigator.pop( + context); + }, + ), + ], + ), ), Divider( thickness: 1.0, color: Colors.black12, ), - ExpansionTile( - title: Texts('Brands'), + Column( children: [ - Container( - height: 350, - child: ListView - .builder( - scrollDirection: - Axis - .vertical, - shrinkWrap: - true, - itemCount: model - .brandsList - .length, - itemBuilder: - (BuildContext - context, - int index) { - return CheckboxListTile( - tristate: + ExpansionTile( + title: Texts( + 'Categorise'), + children: [ + Container( + height: 350, + child: ListView + .builder( + controller: + scrollController, + scrollDirection: + Axis + .vertical, + shrinkWrap: true, - title: Texts(model - .brandsList[index] - .name), - controlAffinity: - ListTileControlAffinity.leading, - value: - checkedBrands, - onChanged: - (bool - value) { - setState( - () { - checkedBrands = - value; - }); - }, - autofocus: + itemCount: model + .categoriseParent + .length, + itemBuilder: + (BuildContext context, + int index) { + return CheckboxListTile( + tristate: + true, + title: + Texts(model.categoriseParent[index].name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedCategorise, + onChanged: + (bool value) { + setState(() { + checkedCategorise = value; + }); + }, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + ExpansionTile( + title: + Texts('Brands'), + children: [ + Container( + height: 350, + child: ListView + .builder( + scrollDirection: + Axis + .vertical, + shrinkWrap: true, - ); - }), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts('Price'), - children: [ - Container( - color: Color( - 0xffEEEEEE), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - children: [ - Column( + itemCount: model + .brandsList + .length, + itemBuilder: + (BuildContext context, + int index) { + return CheckboxListTile( + tristate: + true, + title: + Texts(model.brandsList[index].name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedBrands, + onChanged: + (bool value) { + setState(() { + checkedBrands = value; + }); + }, + autofocus: + true, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + ExpansionTile( + title: + Texts('Price'), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( mainAxisAlignment: MainAxisAlignment - .start, + .spaceAround, children: [ - Texts( - 'Min'), - Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Min'), + Container( + color: + Colors.white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: OutlineInputBorder(), + ), + ), ), - ), + ], ), - ], - ), - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Texts( - 'Max'), - Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Max'), + Container( + color: + Colors.white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: OutlineInputBorder(), + ), + ), ), - ), + ], ), ], ), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.4, + ), + Padding( + padding: + EdgeInsets.all( + 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, + children: [ + Container( + width: 100, + child: Button( + label: + 'Reset', + backgroundColor: + Colors + .red, + ), + ), + SizedBox( + width: 30, + ), + Container( + width: 200, + child: Button( + label: + 'Apply', + backgroundColor: + Colors + .green, + ), + ), ], ), - ) + ), ], ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.4, - ), - Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceEvenly, - children: [ - Container( - width: 100, - child: Button( - label: 'Reset', - backgroundColor: + ], + ), + ), + ); + }); + }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, +//width: 0.3, +// indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + styleOne == true + ? Container( + height: SizeConfig.screenHeight * 7.8, + child: GridView.builder( + physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.9, + ), + itemCount: model.parentProducts.length, + itemBuilder: + (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.parentProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: + Radius.circular(110.0), + ), + color: Colors.white, + ), + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Stack( + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + RotatedBox( + quarterTurns: 4, + child: Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + right: 5.0, + top: 20.0, + bottom: 5.0, + ), + child: Texts( + 'offer' + .toUpperCase(), + color: Colors.red, + fontSize: 13.0, + fontWeight: + FontWeight + .w900, ), ), - SizedBox( - width: 30, + transform: new Matrix4 + .rotationZ( + 5.837200), + ), + ), + Container( + margin: + EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model + .parentProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: + Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + model + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + Container( + margin: + EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + Container( + width: + double.infinity, + height: 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), ), - Container( - width: 200, - child: Button( - label: 'Apply', - backgroundColor: - Colors - .green, + child: Center( + child: Texts( + model + .parentProducts[ + index] + .discountName, + regular: true, + color: Colors + .white, + fontSize: 10.4, ), ), + ), + Texts( + model + .parentProducts[ + index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w700, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .parentProducts[ + index] + .approvedRatingSum > + 0 + ? (model.parentProducts[index].approvedRatingSum.toDouble() / + model.parentProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) ], ), - ), - ], + ], + ), ), ], ), ), - ); - }); - }, - ); - }, - ), - Row( - children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 1.0, -//width: 0.3, -// indent: 0.0, - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: styleIcon, - onTap: () { - setState(() { - if (styleOne == true) { - styleOne = false; - styleTwo = true; - styleIcon = Icon( - Icons.auto_awesome_mosaic, - color: Colors.blue, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: Colors.blue, - size: 29.0, - ); - } - }); + )); }, ), - ), - ], - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - styleOne == true - ? Container( - height: MediaQuery.of(context).size.height * 4.89, - child: GridView.builder( - physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 0.9, - ), - itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: Card( - color: model.parentProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), - ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + ) + : Container( + height: + MediaQuery.of(context).size.height * 5.0, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.parentProducts.length, + itemBuilder: + (BuildContext context, int index) { + return Card( + child: Row( children: [ Stack( children: [ - if (model - .parentProducts[index] - .discountName != - null) - RotatedBox( - quarterTurns: 4, - child: Container( + Column( + children: [ + Container( decoration: BoxDecoration(), child: Padding( padding: EdgeInsets.only( - right: 5.0, - top: 20.0, - bottom: 5.0, - ), - child: Texts( - 'offer' - .toUpperCase(), - color: Colors.red, - fontSize: 13.0, - fontWeight: - FontWeight.w900, + left: 9.0, + top: 8.0, + right: 10.0, ), ), - transform: new Matrix4 - .rotationZ( - 5.837200), ), - ), - Container( - margin: EdgeInsets.fromLTRB( - 0, 16, 0, 0), - alignment: Alignment.center, - child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, - ), + Container( + margin: + EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.contain, + height: 80, + ), + ), + ], ), - Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? MediaQuery.of(context) - .size - .width / - 5 - : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular(6)), - ), - child: Texts( - model + Column( + children: [ + Container( + width: model + .parentProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: + Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + model + .parentProducts[ + index] + .rxMessage != + null + ? model .parentProducts[ index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ), + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], ), ], ), Container( + height: 100.0, margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (model - .parentProducts[ - index] - .discountName != - null) - Container( - width: double.infinity, - height: 13.0, - decoration: - BoxDecoration( - color: - Color(0xff5AB145), - ), - child: Center( - child: Texts( - model - .parentProducts[ - index] - .discountName, - regular: true, - color: Colors.white, - fontSize: 10.4, - ), - ), - ), + SizedBox( + height: 4.0, + ), Texts( model .parentProducts[index] .name, regular: true, - fontSize: 12, + fontSize: 13.2, fontWeight: - FontWeight.w700, + FontWeight.w500, + maxLines: 5, + ), + SizedBox( + height: 8.0, ), Padding( padding: @@ -855,176 +1060,13 @@ class _ParentCategorisePageState extends State { ), ], ), - ), - )); - }, - ), - ) - : Container( - height: MediaQuery.of(context).size.height * 5.0, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - itemCount: model.parentProducts.length, - itemBuilder: - (BuildContext context, int index) { - return Card( - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: BoxDecoration(), - child: Padding( - padding: EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, - ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB( - 0, 0, 0, 0), - alignment: Alignment.center, - child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.contain, - height: 80, - ), - ), - ], - ), - Column( - children: [ - Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? MediaQuery.of(context) - .size - .width / - 5 - : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular(6)), - ), - child: Texts( - model - .parentProducts[ - index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ), - ), - ], - ), - ], - ), - Container( - height: 100.0, - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 4.0, - ), - Texts( - model.parentProducts[index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: FontWeight.w500, - maxLines: 5, - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets.only( - top: 4, bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .parentProducts[ - index] - .approvedRatingSum > - 0 - ? (model - .parentProducts[ - index] - .approvedRatingSum - .toDouble() / - model - .parentProducts[ - index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), - ], - ), - ), - ], - ), - ); - }), - ) - ], - ), + ); + }), + ) + ], + ), + ), + ], ), ), )); diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index c31981f7..c3a19917 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -1,6 +1,9 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/advance_payment_page.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -11,9 +14,13 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class PaymentService extends StatelessWidget { + ToDoCountProviderModel model; + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); + model = Provider.of(context); return AppScaffold( isShowAppBar: true, isShowDecPage: false, @@ -50,53 +57,67 @@ class PaymentService extends StatelessWidget { fontSize: 14, fontWeight: FontWeight.normal, ), - Image.asset( - 'assets/images/al-habib_online_payment_service_icon.png', - fit: BoxFit.fill, - height: 55, - width: double.infinity, + SizedBox( + height: 12, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + child: Image.asset( + 'assets/images/online_payment_icon.png', + fit: BoxFit.fill, + height: 55, + width: double.infinity, + ), ), ], ), ), ), ), + if(!projectViewModel.havePrivilege(33)) Expanded( - child: Container( - margin: EdgeInsets.all(5.0), - padding: EdgeInsets.all(9), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0), - shape: BoxShape.rectangle), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).onlineCheckIn, - color: HexColor('#B61422'), - bold: true, - ), - Texts( - TranslationBase.of(context).appointment, - fontSize: 14, - fontWeight: FontWeight.normal, - ), - Align( - alignment: projectViewModel.isArabic - ? Alignment.centerRight - : Alignment.centerLeft, - child: Image.asset( - 'assets/images/al-habib_online_payment_service_icon.png', - height: 55, + child: InkWell( + onTap: () => navigateToToDoPage(context), + child: Container( + margin: EdgeInsets.all(5.0), + padding: EdgeInsets.all(9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + shape: BoxShape.rectangle), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).onlineCheckIn, + color: HexColor('#B61422'), + bold: true, + ), + Texts( + TranslationBase.of(context).appointment, + fontSize: 14, + fontWeight: FontWeight.normal, + ), + SizedBox( + height: 12, + ), + Align( + alignment: !projectViewModel.isArabic + ? Alignment.centerRight + : Alignment.centerLeft, + child: Image.asset( + 'assets/images/device_icon.png', + height: 55, + ), ), - ), - ], + ], + ), ), ), ) ], ), + if(!projectViewModel.havePrivilege(33)) Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -124,12 +145,15 @@ class PaymentService extends StatelessWidget { fontSize: 14, fontWeight: FontWeight.normal, ), + SizedBox( + height: 12, + ), Align( - alignment: projectViewModel.isArabic + alignment: !projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, child: Image.asset( - 'assets/images/al-habib_online_payment_service_icon.png', + 'assets/images/new-design/check-in.png', height: 55, ), ), @@ -149,4 +173,17 @@ class PaymentService extends StatelessWidget { ), ); } + + navigateToToDoPage(BuildContext context) { + if (projectViewModel.isLogin) { + if (model.count != 0) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } else { + AppToast.showErrorToast( + message: TranslationBase.of(context).upcomingEmpty); + } + } else { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } + } } diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index f2d87529..878544e1 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -1,12 +1,21 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/product_tile.dart'; import 'package:flutter/material.dart'; +AppSharedPreferences sharedPref = AppSharedPreferences(); +var languageID; class ProductCheckTypeWidget extends StatelessWidget { final List wishlist; final bool isTrue; ProductCheckTypeWidget(this.isTrue, this.wishlist); + + void initState() { + getLanguageID(); + } + @override Widget build(BuildContext context) { return isTrue @@ -18,15 +27,16 @@ class ProductCheckTypeWidget extends StatelessWidget { Container( child: isTrue ? productTile( - productName: wishlist[index].product.name, + productName: languageID == 'ar' ? wishlist[index].product.namen : wishlist[index].product.name, productPrice: wishlist[index].subtotal, productRate: double.parse(wishlist[index].subtotalVatRate), productImage: wishlist[index].product.images[0].src, showLine: isTrue, + productID: wishlist[index].product.id, ) : productTile( - productName: wishlist[index].product.name, + productName: languageID == 'ar' ? wishlist[index].product.namen : wishlist[index].product.name, productPrice: wishlist[index].subtotal, productRate: double.parse(wishlist[index].subtotalVatRate), @@ -53,3 +63,8 @@ class ProductCheckTypeWidget extends StatelessWidget { ); } } + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} + diff --git a/lib/pages/pharmacies/compare-list.dart b/lib/pages/pharmacies/compare-list.dart new file mode 100644 index 00000000..37e2fc8c --- /dev/null +++ b/lib/pages/pharmacies/compare-list.dart @@ -0,0 +1,36 @@ +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; + +class CompareList with ChangeNotifier { + List _product = []; + + List get productListItems => _product; + + void addItem(data) { + if (_product.length == 0) { + _product.add(data); + AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); + } else { + for (int i = 0; i < _product.length; i++) { + if (_product.length <= 4 && _product[i].id != data.id) { + _product.add(data); + AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); + break; + } else if(_product[i].id == data.id){ + AppToast.showErrorToast(message: 'the item is already in the list'); + } else if(_product.length == 4){ + AppToast.showErrorToast(message: 'your compare list is full'); + } + } + } + notifyListeners(); + } + + void deleteItem(data) { + for (int i = 0; i < _product.length; i++) { + if (_product[i].id == data) _product.remove(_product[i]); + } + notifyListeners(); + } +} diff --git a/lib/pages/pharmacies/compare.dart b/lib/pages/pharmacies/compare.dart index ffb3dd06..d1872187 100644 --- a/lib/pages/pharmacies/compare.dart +++ b/lib/pages/pharmacies/compare.dart @@ -2,14 +2,18 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:provider/provider.dart'; -void main() => runApp(ComparePage()); +int counter = 0; class ComparePage extends StatefulWidget { @override _ComparePageState createState() => _ComparePageState(); } +//CompareList compareItems = CompareList(); class _ComparePageState extends State { @override Widget build(BuildContext context) { @@ -24,574 +28,301 @@ class _ComparePageState extends State { } } -compareList() { - return CarouselSlider( - options: CarouselOptions( - height: 800.0, viewportFraction: 0.95, enableInfiniteScroll: false), - items: [1, 2].map((i) { - return Builder( - builder: (BuildContext context) { - return Padding( - padding: const EdgeInsets.only(top: 8), - child: Container( - width: MediaQuery.of(context).size.width, - margin: EdgeInsets.symmetric(horizontal: 10.0), - child: slideDetail(), - ), - ); - }, - ); - }).toList(), - ); -} - -slideDetail() { - return ListView( - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 800, - width: 150, - margin: EdgeInsets.symmetric(horizontal: 10.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - border: Border( - top: BorderSide(width: 0.5, color: Colors.grey), - left: BorderSide(width: 0.5, color: Colors.grey), - right: BorderSide(width: 0.5, color: Colors.grey), - bottom: BorderSide(width: 0.5, color: Colors.grey), - ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), +class compareList extends StatelessWidget { + @override + Widget build(BuildContext context) { + final productItemData = Provider.of(context); + final productItem = productItemData.productListItems; + return productItem.length == 0 + ? Container( + child: Center( child: Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - child: Align( - alignment: Alignment.topRight, - child: Icon(FontAwesomeIcons.trashAlt, size: 15)), - ), - SizedBox(height: 20,), - Image( - image: AssetImage( - 'assets/images/al-habib_onlne_pharmacy_bg.png'), - fit: BoxFit.cover, - width: 100, - height: 60, - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'SAR 999.99', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ), - ), - ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'ENAD test', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ), - ), - ), - ), Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ), - ), - ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ), - ), + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), ), Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ), - ), + padding: const EdgeInsets.all(8.0), + child: Text( + 'There is no data', + style: TextStyle(fontSize: 30), ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ), - ), - ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), + ) + ], + ), + ), + ) + : CarouselSlider( + options: CarouselOptions( + height: 800.0, + viewportFraction: 0.87, + enableInfiniteScroll: false), + items: productItem.map((i) { + return Builder( + builder: (BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 8), child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ), - ), - ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ), - ), + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.symmetric(horizontal: 10.0), + child: productItem.length != 0 + ? slideDetail(productItem) + : Container(), ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + ); + }, + ); + }).toList(), + ); + } +} + +class slideDetail extends StatefulWidget { + final List data; + + slideDetail(this.data); + + @override + _slideDetailState createState() => _slideDetailState(); +} + +class _slideDetailState extends State { + @override + Widget build(BuildContext context) { + return ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: widget.data.length, + itemBuilder: (BuildContext contx, int index) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 550, + width: 150, + margin: EdgeInsets.symmetric(horizontal: 10.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + border: Border( + top: BorderSide(width: 0.5, color: Colors.grey), + left: BorderSide(width: 0.5, color: Colors.grey), + right: BorderSide(width: 0.5, color: Colors.grey), + bottom: BorderSide(width: 0.5, color: Colors.grey), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Container( + child: Align( + alignment: Alignment.topRight, + child: IconButton( + icon: Icon(FontAwesomeIcons.trashAlt, size: 15), + onPressed: () { + setState(() { + Provider.of(context, listen: false) + .deleteItem(widget.data[index].id); + }); + }, ), ), ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ), - ), + SizedBox( + height: 20, ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ), - ), + Image.network( + widget.data[index].images[0].src.trim(), + fit: BoxFit.cover, + width: 100, + height: 60, ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, ), ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - ], - ), - ), - ), - Container( - height: 800, - width: 150, - margin: EdgeInsets.symmetric(horizontal: 10.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - border: Border( - top: BorderSide(width: 0.5, color: Colors.grey), - left: BorderSide(width: 0.5, color: Colors.grey), - right: BorderSide(width: 0.5, color: Colors.grey), - bottom: BorderSide(width: 0.5, color: Colors.grey), - ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Container( - child: Align( - alignment: Alignment.topRight, - child: Icon(FontAwesomeIcons.trashAlt, size: 15)), - ), - SizedBox(height: 20,), - Image( - image: AssetImage( - 'assets/images/al-habib_onlne_pharmacy_bg.png'), - fit: BoxFit.cover, - width: 100, - height: 60, - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'SAR 999.99', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), ), ), ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'ENAD test', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].price.toString(), + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), ), ), ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, ), ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[0].name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), ), ), ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[1].name, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), ), ), ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, ), ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[2].name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), ), ), ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[3].name, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), ), ), ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, ), ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[4].name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), ), ), ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'Primary Unit Of Measure', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[5].name, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), ), ), ), - ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - 'Each', - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, ), ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color:Colors.grey,), - ), - ], + ], + ), ), ), - ), - ], - ), - ], - ); + ], + ); + }, + ); + } +} + +String returnString(data) { + for (int i = 0; i < data.length; i++) { + print(data[i]); +// if(data[i] == null){ +// if(counter == i){ +// +// } +// } + } + return "ENAD HILAL"; } diff --git a/lib/pages/pharmacies/medicine_search_screen.dart b/lib/pages/pharmacies/medicine_search_screen.dart index a41fde16..7a61dabe 100644 --- a/lib/pages/pharmacies/medicine_search_screen.dart +++ b/lib/pages/pharmacies/medicine_search_screen.dart @@ -21,6 +21,8 @@ class MedicineSearch extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( + allowAny: true, + onModelReady: (model) => model.clearMedicineSearch(), builder: (BuildContext context, PharmacyViewModel model, Widget child) => AppScaffold( baseViewModel: model, diff --git a/lib/pages/pharmacies/my_reviews.dart b/lib/pages/pharmacies/my_reviews.dart index 725743c3..7b17a359 100644 --- a/lib/pages/pharmacies/my_reviews.dart +++ b/lib/pages/pharmacies/my_reviews.dart @@ -3,42 +3,76 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:rating_bar/rating_bar.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; - -void main() => runApp(MyReviewsPage()); +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class MyReviewsPage extends StatefulWidget { @override _MyReviewsPageState createState() => _MyReviewsPageState(); } +var languageID; + class _MyReviewsPageState extends State { + void initState() { + getLanguageID(); + } + @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getReviewData(), builder: (_, model, wi) => AppScaffold( - appBarTitle: 'Wishlist page', + appBarTitle: 'My Reviews', isShowAppBar: true, isPharmacy: true, - body: Container( - child: ListView.builder( - itemCount: model.reviewListList.length, - itemBuilder: (BuildContext context, int index) { - return Column( - children: [ - Container( - child: reviewDetails( - model.reviewListList[index], - double.parse(model.reviewListList[index].product - .approvedTotalReviews.toString()), - double.parse(model.reviewListList[index].rating.toString()), + baseViewModel: model, + body: model.reviewListList.length == 0 + ? Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, + ), ), - ), - Divider(height: 1, color: Colors.grey) - ], - ); - }), - ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), + ), + ) + : Container( + child: ListView.builder( + itemCount: model.reviewListList.length, + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + Container( + child: reviewDetails( + model.reviewListList[index], + double.parse(model.reviewListList[index].product + .approvedTotalReviews + .toString()), + double.parse(model.reviewListList[index].rating + .toString()), + ), + ), + Divider(height: 1, color: Colors.grey) + ], + ); + }), + ), ), ); } @@ -47,7 +81,7 @@ class _MyReviewsPageState extends State { reviewDetails(data, rate, myRate) { return Container( child: Padding( - padding: const EdgeInsets.only(bottom: 10.0), + padding: EdgeInsets.only(bottom: 10.0), child: Container( height: 200, width: double.infinity, @@ -59,7 +93,9 @@ reviewDetails(data, rate, myRate) { Row( children: [ Container( - margin: EdgeInsets.only(top: 10, left: 10), + margin: languageID == 'ar' + ? EdgeInsets.only(top: 10, right: 10) + : EdgeInsets.only(top: 10, left: 10), child: Image.network( data.product.images[0].src.trim(), fit: BoxFit.cover, @@ -74,13 +110,17 @@ reviewDetails(data, rate, myRate) { Container( margin: EdgeInsets.all(5), child: Align( - alignment: Alignment.topLeft, + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, child: RichText( text: TextSpan( - text: data.product.name, + text: languageID == 'ar' + ? data.product.namen + : data.product.name, style: TextStyle( color: Colors.black54, - fontSize: 13, + fontSize: languageID == 'ar' ? 7 : 13, fontWeight: FontWeight.bold), ), ), @@ -91,7 +131,9 @@ reviewDetails(data, rate, myRate) { Container( margin: EdgeInsets.all(5), child: Align( - alignment: Alignment.topLeft, + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, child: RichText( text: TextSpan( text: data.product.price.toString() + @@ -110,7 +152,9 @@ reviewDetails(data, rate, myRate) { Container( margin: EdgeInsets.all(5), child: Align( - alignment: Alignment.topLeft, + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, child: RatingBar.readOnly( initialRating: rate, size: 15.0, @@ -139,7 +183,9 @@ reviewDetails(data, rate, myRate) { mainAxisAlignment: MainAxisAlignment.start, children: [ Container( - padding: EdgeInsets.only(left: 10), + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10) + : EdgeInsets.only(left: 10), child: Text(data.createdOnUtc.toString())), ], ), @@ -150,7 +196,9 @@ reviewDetails(data, rate, myRate) { mainAxisAlignment: MainAxisAlignment.end, children: [ Container( - padding: EdgeInsets.only(left: 60), + padding: languageID == 'ar' + ? EdgeInsets.only(right: 60) + : EdgeInsets.only(left: 60), child: RatingBar.readOnly( initialRating: myRate, size: 15.0, @@ -173,7 +221,9 @@ reviewDetails(data, rate, myRate) { ), Expanded( child: Container( - padding: EdgeInsets.only(left: 10), + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10) + : EdgeInsets.only(left: 10), child: Text(fixingString(data.reviewText.toString())), ), ), @@ -184,7 +234,7 @@ reviewDetails(data, rate, myRate) { ); } -fixingString(txt){ +fixingString(txt) { String stringTxt; String newTxt; stringTxt = txt.toString(); @@ -192,3 +242,7 @@ fixingString(txt){ return newTxt; } + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} diff --git a/lib/pages/pharmacies/pharmacies_list_screen.dart b/lib/pages/pharmacies/pharmacies_list_screen.dart index 040e5bee..a35a77c9 100644 --- a/lib/pages/pharmacies/pharmacies_list_screen.dart +++ b/lib/pages/pharmacies/pharmacies_list_screen.dart @@ -1,20 +1,19 @@ -import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/material.dart'; +import 'dart:convert'; +import 'dart:typed_data'; + import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:maps_launcher/maps_launcher.dart'; -import '../base/base_view.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.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/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; -import 'dart:typed_data'; -import 'dart:convert'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart'; -import 'package:map_launcher/map_launcher.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../base/base_view.dart'; + class PharmaciesList extends StatelessWidget { final int medicineID; final String imageURL; @@ -25,11 +24,14 @@ class PharmaciesList extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( + allowAny: true, onModelReady: (model) => model.getPharmacies(id: medicineID), builder: (BuildContext context, PharmacyViewModel model, Widget child) => AppScaffold( appBarTitle: TranslationBase.of(context).pharmaciesList, baseViewModel: model, + isShowAppBar: true, + isShowDecPage: false, body: Container( height: SizeConfig.screenHeight, child: ListView( @@ -146,7 +148,7 @@ class PharmaciesList extends StatelessWidget { child: InkWell( child: Icon( Icons.phone, - color: Colors.red, + color: Theme.of(context).primaryColor, ), onTap: () => launch("tel://" + model.pharmacyList[index].phoneNumber), @@ -157,7 +159,7 @@ class PharmaciesList extends StatelessWidget { child: InkWell( child: Icon( Icons.local_pharmacy, - color: Colors.red, + color: Theme.of(context).primaryColor, ), onTap: () { MapsLauncher.launchCoordinates( diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index 86013a9c..b9e6db95 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -1,35 +1,59 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/pages/login/register-info.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/search_brands_page.dart'; +import 'package:diplomaticquarterapp/pages/search_products_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; - -void main() => runApp(ProductBrandsPage()); +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class ProductBrandsPage extends StatefulWidget { @override _ProductBrandsPageState createState() => _ProductBrandsPageState(); } +var languageID; class _ProductBrandsPageState extends State { + + @override + void initState() { + super.initState(); + getLanguageID(); + } + @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getTopBrandsData(), + onModelReady: (model) => model.getBrandsData(), builder: (_, model, wi) => AppScaffold( appBarTitle: 'Brands page', isShowAppBar: true, isPharmacy: true, + isShowDecPage: false, body: Container( child: Column( children: [ Container( color: Colors.white, - alignment: Alignment.topLeft, - padding: EdgeInsets.only(left: 10.0, top: 10.0), + alignment: languageID == 'ar'? + Alignment.topRight : + Alignment.topLeft, + padding: languageID == 'ar' ? + EdgeInsets.only( + right: 10.0, + top: 10.0 + ): + EdgeInsets.only( + left: 10.0, + top: 10.0 + ), child: Text( - 'Top Brands', + TranslationBase.of(context).topBrands, style: TextStyle( - fontWeight: FontWeight.bold + fontWeight: FontWeight.bold, ), ), ), @@ -43,13 +67,35 @@ class _ProductBrandsPageState extends State { height: 10, ), Container( - height: 100, - width: double.infinity, - color: Colors.white, - child: IconButton( - icon: Icon(Icons.search), - onPressed: () { - showSearch(context: context, delegate: SearchBar()); + 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, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchBrandsPage()), + ); }, ), ), @@ -57,25 +103,30 @@ class _ProductBrandsPageState extends State { height: 10, ), Container( - height: 280, + height: 230, width: double.infinity, color: Colors.white, child: ListView.builder( itemCount: model.brandsListList.length, - itemBuilder: (BuildContext ctxt, int index) { - return Container( - margin: EdgeInsets.only(top: 50, left: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text(model.brandsListList[index].name), - SizedBox( - height: 3, - ), - Divider(height: 1, color: Colors.grey) - ], + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: Container( + margin: EdgeInsets.only(top: 50, left: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + languageID == 'ar' ? Text(model.brandsListList[index].namen):Text(model.brandsListList[index].name), + SizedBox( + height: 3, + ), + Divider(height: 1, color: Colors.grey) + ], + ), ), + onTap: (){ + print("ENAD"); + }, ); }), ), @@ -87,96 +138,6 @@ class _ProductBrandsPageState extends State { } } -//topBrand() { -// return BaseView( -// onModelReady: (model) => model.getBrandsData(), -// builder: (_, model, wi) => Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// Container( -// padding: EdgeInsets.all(10), -// child: Text( -// 'Top Brands', -// ), -// ), -// Row( -// children: [ -// Container( -// margin: EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 0.0), -// child: Container( -// margin: EdgeInsets.only(bottom: 10.0), -// child: Container( -// margin: EdgeInsets.only(bottom: 10.0), -// child: Container( -// child: Container( -// padding: EdgeInsets.symmetric( -// horizontal: 10.0, vertical: 10.0), -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(10), -// border: Border( -// top: BorderSide(width: 1.0, color: Colors.grey), -// left: BorderSide(width: 1.0, color: Colors.grey), -// right: BorderSide(width: 1.0, color: Colors.grey), -// bottom: BorderSide(width: 1.0, color: Colors.grey), -// ), -// color: Colors.white, -// ), -// child: Image( -// image: AssetImage( -// 'assets/images/al-habib_onlne_pharmacy_bg.png'), -// fit: BoxFit.cover, -// width: 60, -// height: 40, -// ), -// ), -// ), -// ), -// ), -// ), -// ], -// ), -// Row( -// children: [ -// Container( -// margin: EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 0.0), -// child: Container( -// margin: EdgeInsets.only(bottom: 10.0), -// child: Container( -// margin: EdgeInsets.only(bottom: 10.0), -// child: Container( -// padding: EdgeInsets.only(left: 5), -// child: Container( -// padding: EdgeInsets.symmetric( -// horizontal: 10.0, vertical: 10.0), -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(10), -// border: Border( -// top: BorderSide(width: 1.0, color: Colors.grey), -// left: BorderSide(width: 1.0, color: Colors.grey), -// right: BorderSide(width: 1.0, color: Colors.grey), -// bottom: BorderSide(width: 1.0, color: Colors.grey), -// ), -// color: Colors.white, -// ), -// child: Image( -// image: AssetImage( -// 'assets/images/al-habib_onlne_pharmacy_bg.png'), -// fit: BoxFit.cover, -// width: 60, -// height: 40, -// ), -// ), -// ), -// ), -// ), -// ), -// ], -// ), -// ], -// ), -// ); -//} topBrand() { return BaseView( @@ -187,35 +148,40 @@ topBrand() { model.topBrandsListList.length, (index) => Column( children: [ - Container( - margin: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 0.0), + InkWell( child: Container( + margin: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 0.0), child: Container( child: Container( -// padding: EdgeInsets.only(left: 5), child: Container( - padding: EdgeInsets.symmetric( - horizontal: 10.0, vertical: 10.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - border: Border( - top: BorderSide(width: 1.0, color: Colors.grey), - left: BorderSide(width: 1.0, color: Colors.grey), - right: BorderSide(width: 1.0, color: Colors.grey), - bottom: BorderSide(width: 1.0, color: Colors.grey), +// padding: EdgeInsets.only(left: 5), + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 10.0, vertical: 10.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + border: Border( + top: BorderSide(width: 1.0, color: Colors.grey), + left: BorderSide(width: 1.0, color: Colors.grey), + right: BorderSide(width: 1.0, color: Colors.grey), + bottom: BorderSide(width: 1.0, color: Colors.grey), + ), + color: Colors.white, ), - color: Colors.white, - ), - child: Image.network( - model.topBrandsListList[index].image.src.trim(), - fit: BoxFit.cover, - width: 60, - height: 40, + child: model.topBrandsListList[index].image != null ?Image.network( + model.topBrandsListList[index].image.src, + fit: BoxFit.cover, + width: 60, + height: 40, + ): Text(model.topBrandsListList[index].name) ), ), ), ), ), + onTap: (){ + print("ENAD"); + }, ), ], ), @@ -282,3 +248,7 @@ class SearchBar extends SearchDelegate { ); } } + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index aa91f072..2040db11 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -1,15 +1,31 @@ +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:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:rating_bar/rating_bar.dart'; import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; int price = 0; -void main() => runApp(ProductDetailPage()); +var languageID; +bool isOverQuantity = false; +bool isInWishlit = false; +var itemID; +var product; +var customerId; +CompareList compareItems = new CompareList(); +PharmacyProduct specificationData; class ProductDetailPage extends StatefulWidget { + final PharmacyProduct product; + ProductDetailPage(this.product); @override __ProductDetailPageState createState() => __ProductDetailPageState(); } @@ -19,377 +35,948 @@ class __ProductDetailPageState extends State { bool isDetails = true; bool isReviews = false; bool isAvailabilty = false; + dynamic wishlistItems; + + void initState() { + price = 0; + specificationData = widget.product; + setState(() { + customerId = userInfo(widget.product.id, widget.product); + }); + super.initState(); + } Widget build(BuildContext context) { - return AppScaffold( - appBarTitle: 'product detail page', - isShowAppBar: true, - isPharmacy: true, - body: SingleChildScrollView( - child: Column( - children: [ - Container( - width: double.infinity, - color: Colors.white, + return customerId != null + ? DetailPageScafold( + appBarTitle: 'product detail page', + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + body: SingleChildScrollView( child: Column( children: [ - Image( - image: AssetImage('assets/images/timeline_bg.png'), - ), Container( width: double.infinity, - height: 50, - color: Colors.yellowAccent, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, + color: Colors.white, + child: Column( + children: [ + Image.network( + widget.product.images[0].src.trim(), + ), + widget.product.discountDescription != null + ? Container( + width: double.infinity, + height: 50, + color: Colors.yellowAccent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: languageID == 'ar' + ? Text( + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ) + : Text( + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 0, + child: Container( + child: Image( + image: AssetImage( + 'assets/images/offer.png'), + ), + ), + ), + ], + ), + ) + : Container(), + ], + ), + ), + SizedBox( + height: 4, + ), + Container( + width: 500, + height: 150, + color: Colors.white, + child: productNameAndPrice(context, widget.product), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + height: 120, + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - flex: 1, + Padding( + padding: const EdgeInsets.all(8.0), child: Container( - alignment: Alignment.centerRight, child: Text( - "Discount on Second item", - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 17), + TranslationBase.of(context).specification, + style: TextStyle(fontWeight: FontWeight.bold), ), ), ), - SizedBox( - width: 10, - ), - Expanded( - flex: 0, + Divider(color: Colors.grey), + Padding( + padding: const EdgeInsets.all(8.0), child: Container( - child: Image( - image: AssetImage('assets/images/offer.png'), + child: Text( + "there is no data", ), ), ), ], ), ), - ], - ), - ), - SizedBox( - height: 4, - ), - Container( - width: 500, - height: 150, - color: Colors.white, - child: productNameAndPrice(), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - height: 120, - color: Colors.white, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - "Specificaion", - style: TextStyle(fontWeight: FontWeight.bold), - ), + SizedBox( + height: 6, + ), + Container( + width: 500, + margin: EdgeInsets.only(bottom: 100), +// height: 350, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = true; + isReviews = false; + isAvailabilty = false; + }); + }, + child: Text( + TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isDetails + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container() + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = true; + isAvailabilty = false; + }); + }, + child: Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isReviews + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = false; + isAvailabilty = true; + }); + }, + child: Text( + TranslationBase.of(context).availability, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isAvailabilty + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + isDetails + ? Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text( + TranslationBase.of(context).description, + 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'), + ), + ), + ], + ), + ) + : 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), + ), + ), + 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: 50, + ), + Divider( + height: 1, + color: Colors.grey), + ], + ), + ); + }, + ) + : 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 + ? Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + 'No location Available'), + ) + : ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .productLocationService + .length, + itemBuilder: + (BuildContext context, + int index) { + return Padding( + padding: + EdgeInsets.all(8.0), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( +// crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Expanded( + flex: 1, + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + model + .productLocationService[ + index] + .locationDescription + + "\n" + + fixingString(model + .productLocationService[ + 0] + .cityName + .toString()), + style: TextStyle( + fontSize: + 12), + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .location_on), + color: + Colors.red, + onPressed: + () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .phone), + color: + Colors.red, + onPressed: + () {}, + ), + ), + ], + ), + Divider( + height: 1.2, + color: Colors.grey) + ], + ), + ); + }, + ), + ) + : Container(), + ], ), ), - Divider(color: Colors.grey) +// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), ], ), ), - SizedBox( - height: 6, - ), - Container( - width: 500, - margin: EdgeInsets.only(bottom: 100), -// height: 350, - color: Colors.white, + bottomSheet: footerWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product), + ) + : AppScaffold( + appBarTitle: 'product detail page', + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + body: SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = true; - isReviews = false; - isAvailabilty = false; - }); - }, - child: Text( - 'DETAILS', - style: TextStyle( - fontSize: 16, fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isDetails - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container() - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = true; - isAvailabilty = false; - }); - }, - child: Text( - 'REVIEWS', - style: TextStyle( - fontSize: 16, fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isReviews - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = false; - isAvailabilty = true; - }); - }, + Container( + width: double.infinity, + color: Colors.white, + child: Column( + children: [ + Image.network( + widget.product.images[0].src.trim(), + ), + widget.product.discountDescription != null + ? Container( + width: double.infinity, + height: 50, + color: Colors.yellowAccent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: languageID == 'ar' + ? Text( + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ) + : Text( + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 0, + child: Container( + child: Image( + image: AssetImage( + 'assets/images/offer.png'), + ), + ), + ), + ], + ), + ) + : Container(), + ], + ), + ), + SizedBox( + height: 4, + ), + Container( + width: 500, + height: 150, + color: Colors.white, + child: productNameAndPrice(context, widget.product), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + height: 120, + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( child: Text( - 'AVAILABILTY', - style: TextStyle( - fontSize: 16, fontWeight: FontWeight.bold), + TranslationBase.of(context).specification, + style: TextStyle(fontWeight: FontWeight.bold), ), - color: Colors.white, ), - isAvailabilty - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - ], + ), + Divider(color: Colors.grey) + ], + ), ), SizedBox( - height: 10, + height: 6, ), - isDetails - ? Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Text( - 'Description', - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + Container( + width: 500, + margin: EdgeInsets.only(bottom: 100), +// height: 350, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = true; + isReviews = false; + isAvailabilty = false; + }); + }, + child: Text( + TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - 'Body Mosturizing and nourishing lotion', - style: TextStyle(fontSize: 20), + isDetails + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container() + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = true; + isAvailabilty = false; + }); + }, + child: Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, ), - ), - ], - ), - ) - : isReviews - ? BaseView( - onModelReady: (model) => - model.getProductReviewsData(), - builder: (_, model, wi) => ListView.builder( - physics: const 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].id - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), - ), - Container( - margin: EdgeInsets.only(left: 232), - 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, + isReviews + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = false; + isAvailabilty = true; + }); + }, + child: Text( + TranslationBase.of(context).availability, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isAvailabilty + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + isDetails + ? Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text( + TranslationBase.of(context).description, + 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'), + ), + ), + ], + ), + ) + : 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), + ), + ), + 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: 50, + ), + Divider( + height: 1, + color: Colors.grey), + ], ), - ), - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model.productDetailService[0].reviews[index] - .reviewText, - style: TextStyle(fontSize: 20), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text('No Reviews Available'), ), - ), - SizedBox( - height: 50, - ), - Divider(height: 1, color: Colors.grey), - ], - ), - ); - }, - ), - ) - : isAvailabilty - ? BaseView( - onModelReady: (model) => - model.getProductLocationData(), - builder: (_, model, wi) => ListView.builder( - physics: const ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model.productLocationService.length, - itemBuilder: (BuildContext context, int index){ - return Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + ) + : isAvailabilty + ? BaseView( + 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) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( + children: [ + Row( // crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Image.network(model - .productLocationService[index] - .projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - model.productLocationService[index] - .locationDescription + - "\n" + - fixingString(model + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(model .productLocationService[ - 0] - .cityName - .toString()), - style: TextStyle(fontSize: 12), - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.location_on), - color: Colors.red, - onPressed: () {}, + index] + .projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + model + .productLocationService[ + index] + .locationDescription + + "\n" + + fixingString(model + .productLocationService[ + 0] + .cityName + .toString()), + style: TextStyle( + fontSize: 12), + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .location_on), + color: Colors.red, + onPressed: () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: + Icon(Icons.phone), + color: Colors.red, + onPressed: () {}, + ), + ), + ], ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, - ), - ), - ], - ), - Divider(height: 1.2, color: Colors.grey) - ], + Divider( + height: 1.2, + color: Colors.grey) + ], + ), + ); + }, ), - ); - }, - - ), - ) - : Container(), + ) + : Container(), + ], + ), + ), +// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), ], ), ), -// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), - ], - ), - ), - bottomSheet: footerWidget(), - ); + bottomSheet: footerWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product), + ); } } class footerWidget extends StatefulWidget { + final bool isAvailble; + final int maxQuantity; + final int minQuantity; + final int quantityLimit; + final PharmacyProduct item; + footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, + this.quantityLimit, this.item); @override _footerWidgetState createState() => _footerWidgetState(); } @@ -418,7 +1005,7 @@ class _footerWidgetState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - 'Quantity', + TranslationBase.of(context).quantity, style: TextStyle( fontSize: 15, fontWeight: FontWeight.bold), ), @@ -450,7 +1037,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 1; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -472,7 +1064,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 2; - // return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -494,7 +1091,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 3; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -516,7 +1118,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 4; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -538,7 +1145,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 5; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -560,7 +1172,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 6; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -582,7 +1199,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 7; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -604,7 +1226,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 8; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -626,7 +1253,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 9; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -648,7 +1280,12 @@ class _footerWidgetState extends State { onTap: () { setState(() { price = 10; - return price; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } }); }, ), @@ -661,11 +1298,18 @@ class _footerWidgetState extends State { decoration: InputDecoration(labelText: 'quantity #'), onChanged: (text) { + print(price); + print(widget.quantityLimit); if (int.tryParse(text) == null) { text = ''; } else { setState(() { price = int.parse(text); + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + } }); } }, @@ -703,7 +1347,7 @@ class _footerWidgetState extends State { Expanded( flex: 5, child: Text( - "QTY", + TranslationBase.of(context).quantityShortcut, style: TextStyle(fontSize: 16), ), ), @@ -722,41 +1366,83 @@ class _footerWidgetState extends State { }, ), ), - InkWell( - onTap: () {}, - child: Container( - alignment: Alignment.center, - width: 190, - height: 46, - color: Colors.green, - child: Text( - 'Add to Cart', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ), + !widget.isAvailble && price > 0 || price > widget.quantityLimit + ? Container( + width: 190, + height: 46, + color: Colors.grey, + child: Align( + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).addToCart, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ) + : InkWell( + onTap: () { + addToCartFunction(price, widget.item.id); + }, + child: Container( + alignment: Alignment.center, + width: 190, + height: 46, + color: Colors.green, + child: Text( + TranslationBase.of(context).addToCart, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ), SizedBox( width: 5, ), - InkWell( - onTap: () {}, - child: Container( - alignment: Alignment.center, - width: 120, - height: 46, - color: Colors.blue, - child: Text( - 'Buy Now', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ), + !widget.isAvailble && price > 0 || price > widget.quantityLimit + ? Container( + width: 120, + height: 46, + color: Colors.grey, + child: Align( + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).buyNow, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ) + : InkWell( + onTap: () { + print('buy now'); + addToCartFunction(price, widget.item.id); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CartOrderPage()), + ); + }, + child: Container( + alignment: Alignment.center, + width: 120, + height: 46, + color: Colors.blue, + child: Text( + TranslationBase.of(context).buyNow, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ), ], ), ], @@ -765,92 +1451,281 @@ class _footerWidgetState extends State { } } -productNameAndPrice() { - return Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Text( - "22 SR", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), - ), - SizedBox( - width: 100, - ), - Text( - "Out Of Stock", - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.red), - ), - SizedBox(width: 30), - Text( - "notify me ", - style: TextStyle( - color: Colors.blue, - decoration: TextDecoration.underline, +class productNameAndPrice extends StatefulWidget { + BuildContext context; + PharmacyProduct item; + productNameAndPrice(this.context, this.item); + @override + _productNameAndPriceState createState() => _productNameAndPriceState(); +} + +class _productNameAndPriceState extends State { + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Text( + widget.item.price.toString(), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), ), - ), - Icon( - FontAwesomeIcons.bell, - color: Colors.blue, - size: 15.0, - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - margin: EdgeInsets.only(left: 5), - child: Text( - "Johnson And Jonson Vita-Rich Smoothing Body Cream - With Papaya Extract 200 ML", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + SizedBox( + width: 40, + ), + Text( + widget.item.stockAvailability, + style: widget.item.stockAvailability == 'Out of stock' + ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) + : 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, + ) + : 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); + }); +// MyStatelessWidget(); + }, + ) + : IconButton( + icon: Icon(Icons.favorite), + color: Colors.red, + onPressed: () { + setState(() { + deleteFromWishlistFunction(widget.item.id); + }); +// MyStatelessWidget(); + }, + )), + ], ), ), - ), - Row( - children: [ - Expanded( - flex: 2, - child: Container( - margin: EdgeInsets.only(right: 150), - child: Align( - alignment: Alignment.bottomLeft, - child: RatingBar.readOnly( - initialRating: 3, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: + languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, + child: Text( + languageID == 'ar' + ? widget.item.fullDescriptionn + : widget.item.fullDescription, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), ), ), ), - Expanded( - flex: 1, - child: Container( - child: Text( - 'Prescription attachment required', - style: TextStyle(color: Colors.red, fontSize: 10), + ), + Row( + children: [ + Expanded( + flex: 2, + child: Container( + margin: EdgeInsets.only(right: 150), + child: Align( + alignment: Alignment.bottomLeft, + child: RatingBar.readOnly( + initialRating: 3, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), ), ), - ), - Icon( - FontAwesomeIcons.questionCircle, - color: Colors.red, - size: 15.0, - ), - ], - ), - ], - ); + Expanded( + flex: 1, + child: Container( + child: widget.item.rxMessage != null + ? Text( + languageID == 'ar' + ? widget.item.rxMessagen.toString() + : widget.item.rxMessage.toString(), + style: TextStyle(color: Colors.red, fontSize: 10), + ) + : Container()), + ), + widget.item.rxMessage != null + ? Icon( + FontAwesomeIcons.questionCircle, + color: Colors.red, + size: 15.0, + ) + : Container(), + ], + ), + ], + ); + } } +//productNameAndPrice(BuildContext context, item) { +// return Column( +// mainAxisAlignment: MainAxisAlignment.start, +// children: [ +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// children: [ +// Text( +// item.price.toString(), +// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), +// ), +// SizedBox( +// width: 40, +// ), +// Text( +// item.stockAvailability, +// style: item.stockAvailability == 'Out of stock' +// ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) +// : TextStyle(fontWeight: FontWeight.bold, color: Colors.green), +// ), +// SizedBox(width: 20), +// item.stockAvailability == 'Out of stock' +// ? Text( +// TranslationBase.of(context).notifyMe, +// style: TextStyle( +// color: Colors.blue, +// decoration: TextDecoration.underline, +// ), +// ) +// : Container(), +// item.stockAvailability == 'Out of stock' +// ? 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: () { +// addToWishlistFunction(item.id); +//// MyStatelessWidget(); +// +// }, +// ):IconButton( +// icon: Icon(Icons.favorite), +// color: Colors.red, +// onPressed: () { +// deleteFromWishlistFunction(item.id); +//// MyStatelessWidget(); +// +// }, +// ) +// ), +// +// ], +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: +// languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, +// child: Text( +// languageID == 'ar' ? item.fullDescriptionn : item.fullDescription, +// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), +// ), +// ), +// ), +// ), +// Row( +// children: [ +// Expanded( +// flex: 2, +// child: Container( +// margin: EdgeInsets.only(right: 150), +// child: Align( +// alignment: Alignment.bottomLeft, +// child: RatingBar.readOnly( +// initialRating: 3, +// size: 15.0, +// filledColor: Colors.yellow[700], +// emptyColor: Colors.grey[500], +// isHalfAllowed: true, +// halfFilledIcon: Icons.star_half, +// filledIcon: Icons.star, +// emptyIcon: Icons.star, +// ), +// ), +// ), +// ), +// Expanded( +// flex: 1, +// child: Container( +// child: item.rxMessage != null +// ? Text( +// languageID == 'ar' +// ? item.rxMessagen.toString() +// : item.rxMessage.toString(), +// style: TextStyle(color: Colors.red, fontSize: 10), +// ) +// : Container()), +// ), +// item.rxMessage != null +// ? Icon( +// FontAwesomeIcons.questionCircle, +// color: Colors.red, +// size: 15.0, +// ) +// : Container(), +// ], +// ), +// ], +// ); +//} + slideDetail() { return Row( mainAxisAlignment: MainAxisAlignment.start, @@ -886,3 +1761,102 @@ fixingString(txt) { return newTxt; } + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} + +getSpecificationData(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + specificationData = await x.productSpecificationData(itemID); +} + +addToCartFunction(quantity, itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.addToCartData(quantity, itemID); +} + +addToWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlit = true; + await x.addToWishlistData(itemID); +} + +deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlit = false; + await x.addToWishlistData(itemID); +} + +checkWishlist() async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); + for (int i = 0; i < x.wishListItems.length; i++) { +// print(itemID); +// print(x.wishListItems[i].product.id); + if (itemID == x.wishListItems[i].product.id) { + isInWishlit = true; +// print('in wishlist'); + break; + } else { + isInWishlit = false; +// print('not in wishlist'); + } + } +} + +class sttingModalBottomSheet extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container(); + } +} + +settingModalBottomSheet(context) { + showModalBottomSheet( + context: context, + builder: (BuildContext bc) { + return Container( + child: new Wrap( + children: [ + new ListTile( + 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") + } + }), + new ListTile( + leading: new Icon(Icons.favorite_border), + title: new Text('Add to wishlist'), + onTap: () => {addToWishlistFunction(itemID)}, + ), + new ListTile( + leading: new Icon(Icons.compare), + title: new Text('Compare'), + onTap: () => { + Provider.of(context, listen: false) + .addItem(specificationData), + }, + ), + ], + ), + ); + }); +} + +userInfo(id, product) async { + customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + itemID = id; + product = product; + checkWishlist(); + } + 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 d8a274d7..c5576900 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-preview.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; @@ -95,13 +96,13 @@ class CartOrderPage extends StatelessWidget { MainAxisAlignment.spaceBetween, children: [ Texts( - "Subtotal", + TranslationBase.of(context).subtotal, fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, ), Texts( - "SAR ${(cart.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -120,13 +121,13 @@ class CartOrderPage extends StatelessWidget { MainAxisAlignment.spaceBetween, children: [ Texts( - "VAT (15%)", + "${TranslationBase.of(context).vat}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, ), Texts( - "SAR ${(cart.subtotalVatAmount).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(cart.subtotalVatAmount).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -151,7 +152,7 @@ class CartOrderPage extends StatelessWidget { fontWeight: FontWeight.bold, ), Texts( - "SAR ${(cart.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -181,7 +182,9 @@ class CartOrderPage extends StatelessWidget { : Container(), bottomSheet: Container( height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) ? height * 0.15 : 0, + model.cartResponse.shoppingCarts.length == 0) + ? height * 0.15 + : 0, color: Colors.white, child: OrderBottomWidget(model.addresses, height), ), @@ -206,6 +209,8 @@ class _OrderBottomWidgetState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + return Container( margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), child: Consumer( @@ -238,7 +243,9 @@ class _OrderBottomWidgetState extends State { width: 25.0, height: widget.height * 0.070, decoration: new BoxDecoration( - color: !isAgree ? Color(0xffeeeeee) : Colors.green, + color: !isAgree + ? Color(0xffeeeeee) + : Colors.green, shape: BoxShape.circle, ), child: !isAgree @@ -258,7 +265,8 @@ class _OrderBottomWidgetState extends State { padding: EdgeInsets.symmetric(horizontal: 4), margin: const EdgeInsets.symmetric(vertical: 4), child: Texts( - "I agree with the terms of service and I adhere to them unconditionally", + TranslationBase.of(context) + .pharmacyServiceTermsCondition, fontSize: 13, color: Colors.grey.shade800, fontWeight: FontWeight.normal, @@ -267,10 +275,8 @@ class _OrderBottomWidgetState extends State { ), InkWell( onTap: () => { - Navigator.push( - context, - FadePage( - page: PharmacyTermsConditions())) + Navigator.push(context, + FadePage(page: PharmacyTermsConditions())) }, child: Container( child: Icon( @@ -290,39 +296,43 @@ class _OrderBottomWidgetState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 4), - child: Row( - children: [ - Texts( - "SAR ${(cart.subtotal).toStringAsFixed(2)}", - fontSize: 14, - fontWeight: FontWeight.bold, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 4), - child: Texts( - "(inclusive VAT)", - fontSize: 8, - color: Colors.grey, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.symmetric( + horizontal: 0, vertical: 0), + child: Row( + children: [ + Texts( + "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", + fontSize: + projectProvider.isArabic ? 12 : 14, fontWeight: FontWeight.bold, ), - ), - ], + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 4), + child: Texts( + "${TranslationBase.of(context).inclusiveVat}", + fontSize: 8, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ), + ], + ), ), - ), - Texts( - "${cart.quantityCount} item(s)", - fontSize: 10, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ], + Texts( + "${cart.quantityCount} ${TranslationBase.of(context).items}", + fontSize: 10, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ], + ), ), RaisedButton( onPressed: isAgree @@ -335,7 +345,7 @@ class _OrderBottomWidgetState extends State { } : null, child: new Text( - "CHECK OUT", + "${TranslationBase.of(context).checkOut}", style: new TextStyle( color: isAgree ? Colors.white @@ -345,19 +355,9 @@ class _OrderBottomWidgetState extends State { color: Color(0xff005aff), disabledColor: Color(0xff005aff), ), - /* SecondaryButton( - label: "CHECK OUT", - color: Colors.blueAccent, - textColor: Colors.white, - onTap: (() { - Navigator.push( - context, FadePage(page: OrderPreviewPage(widget.addresses))); - }), - disabled: isAgree ? false : true, - )*/ ], ), - ) + ), ], ) : Container(), diff --git a/lib/pages/pharmacies/screens/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-order-preview.dart index aed2dbc5..b4736d7a 100644 --- a/lib/pages/pharmacies/screens/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-order-preview.dart @@ -2,11 +2,13 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/address-select-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.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'; @@ -22,7 +24,8 @@ class OrderPreviewPage extends StatelessWidget { @override Widget build(BuildContext context) { - PreferredSizeWidget appBarWidget = AppBarWidget("Check out", null, true); + PreferredSizeWidget appBarWidget = + AppBarWidget("${TranslationBase.of(context).checkOut}", null, true); final mediaQuery = MediaQuery.of(context); final height = mediaQuery.size.height - appBarWidget.preferredSize.height - @@ -33,8 +36,9 @@ class OrderPreviewPage extends StatelessWidget { builder: (_, model, wi) => ChangeNotifierProvider.value( value: model.paymentCheckoutData, child: AppScaffold( - title: "Check out", + title: "${TranslationBase.of(context).checkOut}", isShowAppBar: true, + isPharmacy: true, isShowDecPage: false, appBarWidget: appBarWidget, backgroundColor: Colors.white, @@ -114,13 +118,13 @@ class OrderPreviewPage extends StatelessWidget { MainAxisAlignment.spaceBetween, children: [ Texts( - "Subtotal", + "${TranslationBase.of(context).subtotal}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, ), Texts( - "SAR ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -139,13 +143,13 @@ class OrderPreviewPage extends StatelessWidget { MainAxisAlignment.spaceBetween, children: [ Texts( - "Shipping", + "${TranslationBase.of(context).shipping}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, ), Texts( - "SAR ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -164,13 +168,13 @@ class OrderPreviewPage extends StatelessWidget { MainAxisAlignment.spaceBetween, children: [ Texts( - "VAT (15%)", + "${TranslationBase.of(context).vat}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, ), Texts( - "SAR ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -195,7 +199,7 @@ class OrderPreviewPage extends StatelessWidget { fontWeight: FontWeight.bold, ), Texts( - "SAR ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -215,7 +219,9 @@ class OrderPreviewPage extends StatelessWidget { ), ), bottomSheet: Container( - height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, + height: model.cartResponse.shoppingCarts != null + ? height * 0.10 + : 0, color: Colors.white, child: PaymentBottomWidget(model), ), @@ -238,12 +244,14 @@ class _SelectAddressWidgetState extends State { Addresses address; _navigateToAddressPage() { - Navigator.push( - context, FadePage(page: AddressSelectPageTest(widget.addresses))) + Navigator.push(context, FadePage(page: PharmacyAddressesPage())) .then((result) { - address = result; - widget.model.paymentCheckoutData.address = address; - widget.model.getInformationsByAddress(); + if (result != null) { + address = result; + widget.model.paymentCheckoutData.address = address; + widget.model.getInformationsByAddress(); + } + /* setState(() { if (result != null) { address = result; @@ -396,7 +404,7 @@ class _SelectAddressWidgetState extends State { padding: EdgeInsets.symmetric( vertical: 0, horizontal: 6), child: Texts( - "SHIP BY:", + "${TranslationBase.of(context).shipBy}", fontSize: 12, fontWeight: FontWeight.bold, color: Colors.black, @@ -562,6 +570,8 @@ class _LakumWidgetState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + return Container( color: Colors.white, padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), @@ -579,7 +589,7 @@ class _LakumWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "Lakum Points", + "${TranslationBase.of(context).lakumPoints}", fontSize: 12, fontWeight: FontWeight.bold, ), @@ -599,23 +609,29 @@ class _LakumWidgetState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ Texts( - "Riyal", + "${TranslationBase.of(context).riyal}", fontSize: 12, fontWeight: FontWeight.bold, ), Container( - margin: EdgeInsets.only(left: 4), + margin: projectProvider.isArabic + ? EdgeInsets.only(right: 4) + : EdgeInsets.only(left: 4), width: 60, - height: 40, + height: 50, child: TextField( decoration: InputDecoration( border: OutlineInputBorder( borderSide: BorderSide(color: Colors.black, width: 0.2), gapPadding: 0, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8)), + borderRadius: projectProvider.isArabic + ? BorderRadius.only( + topRight: Radius.circular(8), + bottomRight: Radius.circular(8)) + : BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8)), ), disabledBorder: OutlineInputBorder( borderSide: @@ -670,21 +686,25 @@ class _LakumWidgetState extends State { ), ), Container( - height: 40, + height: 50, padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), decoration: new BoxDecoration( color: Color(0xff3666E0), shape: BoxShape.rectangle, - borderRadius: BorderRadius.only( - topRight: Radius.circular(6), - bottomRight: Radius.circular(6)), + borderRadius: projectProvider.isArabic + ? BorderRadius.only( + topLeft: Radius.circular(6), + bottomLeft: Radius.circular(6)) + : BorderRadius.only( + topRight: Radius.circular(6), + bottomRight: Radius.circular(6)), border: Border.fromBorderSide(BorderSide( color: Color(0xff3666E0), width: 0.8, )), ), child: Texts( - "USE", + "${TranslationBase.of(context).use}", fontSize: 12, color: Colors.white, fontWeight: FontWeight.bold, @@ -727,7 +747,7 @@ class PaymentBottomWidget extends StatelessWidget { child: Row( children: [ Texts( - "SAR ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", fontSize: 14, fontWeight: FontWeight.bold, color: Color(0xff929295), @@ -736,7 +756,7 @@ class PaymentBottomWidget extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 4), child: Texts( - "(inclusive VAT)", + "${TranslationBase.of(context).inclusiveVat}", fontSize: 8, color: Color(0xff929295), fontWeight: FontWeight.w600, @@ -746,7 +766,7 @@ class PaymentBottomWidget extends StatelessWidget { ), ), Texts( - "${model.cartResponse.quantityCount} item(s)", + "${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}", fontSize: 10, color: Colors.grey, fontWeight: FontWeight.bold, @@ -785,7 +805,7 @@ class PaymentBottomWidget extends StatelessWidget { child: Padding( padding: const EdgeInsets.symmetric(vertical: 16), child: new Text( - "PROCEED TO PAY", + "${TranslationBase.of(context).proceedPay}", style: new TextStyle( color: (paymentData.address != null && paymentData.paymentOption != null) diff --git a/lib/pages/pharmacies/screens/order-preview-page.dart b/lib/pages/pharmacies/screens/order-preview-page.dart new file mode 100644 index 00000000..d9646fcf --- /dev/null +++ b/lib/pages/pharmacies/screens/order-preview-page.dart @@ -0,0 +1,48 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class OrderPreviewPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Shopping Cart", + isShowAppBar: true, + isShowDecPage: false, + baseViewModel: model, + backgroundColor: Colors.white, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureIconButton( + TranslationBase.of(context).deleteAllItems, + Icon(Icons.delete_outline_sharp, color: Colors.grey.shade800,), + onTap: () => {}, + ), + const Divider( + color: Colors.grey, + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + + ], + ), + ), + ), + ), + ), + ); + } +} + diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index eb368cfa..ffdc6be6 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.da import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/manufacturerItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -17,12 +18,13 @@ 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); @@ -65,34 +67,35 @@ class PharmacyPage extends StatelessWidget { textColor: Colors.green, vPadding: 6, hPadding: 4, - handler: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => HomePrescriptionsPage())); - }, + handler: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + HomePrescriptionsPage())); + }, ), ], ), ), // model.getPrescription(), Container( - padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0), + 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), + margin: EdgeInsets.only(left: 10), // model.getPrescription(); child: ListView.builder( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - physics: ScrollPhysics(), + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), // physics: NeverScrollableScrollPhysics(), // itemCount: 4, - itemCount: model.prescriptionsList.length, - itemBuilder: (context, index){ - return - Container( + 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), @@ -104,30 +107,35 @@ class PharmacyPage extends StatelessWidget { width: 1.0, ), color: Colors.white, - borderRadius: BorderRadius.circular(10.0) - ), + 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(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), + padding: EdgeInsets.only( + left: 15.0, right: 15.0), decoration: BoxDecoration( border: Border.all( color: Colors.green, @@ -135,33 +143,36 @@ class PharmacyPage extends StatelessWidget { width: 4.0, ), color: Colors.green, - borderRadius: BorderRadius.circular(30.0) - ), - - child:Text(model.prescriptionsList[index].isInOutPatientDescription.toString(), + 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, + )), + 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, - ), - ) - ] - ), + ), + ) + ]), ], ), ], @@ -171,21 +182,28 @@ class PharmacyPage extends StatelessWidget { children: [ Container( margin: EdgeInsets.only(left: 5), - child: Row( - children: [ - Text(model.prescriptionsList[index].doctorTitle.toString(), + 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, - ),), - Text(model.prescriptionsList[index].doctorName.toString(), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ),), - ] ), + ), + ), + ]), ), ], ), @@ -194,17 +212,22 @@ class PharmacyPage extends StatelessWidget { children: [ Container( margin: EdgeInsets.only(left: 5), - child: Text(model.prescriptionsList[index].clinicDescription.toString(), + child: Text( + model.prescriptionsList[index] + .clinicDescription + .toString(), style: TextStyle( color: Colors.green, fontSize: 15.0, // fontWeight: FontWeight.bold, - ),), + ), + ), ), ], ), Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.only(left: 5), @@ -222,13 +245,10 @@ class PharmacyPage extends StatelessWidget { ), ), ) - ] - ), - ] - ), + ]), + ]), ); - } - ), + }), ), Container( @@ -278,7 +298,10 @@ class PharmacyPage extends StatelessWidget { hPadding: 4, borderColor: Colors.green, textColor: Colors.green, - handler: () {}, + handler: () => { + Navigator.push( + context, FadePage(page: ProductBrandsPage())), + }, ), ], ), @@ -340,7 +363,10 @@ class PharmacyPage extends StatelessWidget { textColor: Colors.green, vPadding: 6, hPadding: 4, - handler: () {}, + handler: () => { + Navigator.push( + context, FadePage(page: ProductBrandsPage())), + }, ), ], ), @@ -372,62 +398,65 @@ class GridViewButtons extends StatelessWidget { Widget build(BuildContext context) { final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; return Container( -// child: SizedBox( -// height: gridHeight, -// child: GridView.count( -// childAspectRatio: 2.2, -// crossAxisSpacing: 10, -// mainAxisSpacing: 10, -// controller: new ScrollController(keepScrollOffset: false), -// shrinkWrap: true, -// padding: const EdgeInsets.all(4.0), -// crossAxisCount: 2, -// children: [ -// DashboardItem( -// imageName: 'pharmacy_module/bg_1.png', -// hasColorFilter: false, -// opacity: 0.8, -// child: GridViewCard( -// TranslationBase.of(context).offersAndPromotions, -// 'assets/images/pharmacy_module/offer_icon.png', () { -// Navigator.push(context, FadePage(page: OffersCategorisePage())); -// }), -// ), -// DashboardItem( -// imageName: 'pharmacy_module/bg_2.png', -// opacity: 0, -// 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())); -// } -// }); -// }), -// ), -// DashboardItem( -// imageName: 'pharmacy_module/bg_3.png', -// opacity: 0, -// hasColorFilter: false, -// child: GridViewCard(TranslationBase.of(context).myPrescriptions, -// 'assets/images/pharmacy_module/prescription_icon.png', () {}), -// ), -// DashboardItem( -// imageName: 'pharmacy_module/bg_4.png', -// opacity: 0, -// hasColorFilter: false, -// child: GridViewCard( -// TranslationBase.of(context).searchAndScanMedication, -// 'assets/images/pharmacy_module/search_scan_icon.png', -// () {}), -// ), -// ], -// ), -// ), + child: SizedBox( + height: gridHeight, + child: GridView.count( + childAspectRatio: 2.2, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + controller: new ScrollController(keepScrollOffset: false), + shrinkWrap: true, + padding: const EdgeInsets.all(4.0), + crossAxisCount: 2, + children: [ + DashboardItem( + imageName: 'pharmacy_module/bg_1.png', + hasColorFilter: false, + opacity: 0.8, + child: GridViewCard( + TranslationBase.of(context).offersAndPromotions, + 'assets/images/pharmacy_module/offer_icon.png', () { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + }), + ), + DashboardItem( + imageName: 'pharmacy_module/bg_2.png', + opacity: 0, + 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())); + } + }); + }), + ), + DashboardItem( + imageName: 'pharmacy_module/bg_3.png', + opacity: 0, + hasColorFilter: false, + child: GridViewCard(TranslationBase.of(context).myPrescriptions, + 'assets/images/pharmacy_module/prescription_icon.png', () { + Navigator.push( + context, FadePage(page: PharmacyAddressesPage())); + }), + ), + DashboardItem( + imageName: 'pharmacy_module/bg_4.png', + opacity: 0, + hasColorFilter: false, + child: GridViewCard( + TranslationBase.of(context).searchAndScanMedication, + 'assets/images/pharmacy_module/search_scan_icon.png', + () {}), + ), + ], + ), + ), ); } } diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart new file mode 100644 index 00000000..8f771490 --- /dev/null +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -0,0 +1,145 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/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'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; + +class SearchBrandsPage extends StatefulWidget { + @override + _SearchBrandsPageState createState() => _SearchBrandsPageState(); +} + +class _SearchBrandsPageState extends State { + final textController = TextEditingController(); + final _formKey = GlobalKey(); + String msg = ''; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.searchProducts(), + builder: (BuildContext context, model, Widget child) => + PharmacyAppScaffold( + appBarTitle: 'Search', + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + //baseViewModel: model, + body: SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight, + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.79, + child: Form( + key: _formKey, + child: TextFields( + autoFocus: true, + hintText: 'Search', + fontSize: 19.0, + prefixIcon: Icon(Icons.search), + inputAction: TextInputAction.search, + onSaved: (value) { + //searchMedicine(model, context); + }, + onSubmit: (value) { + searchMedicine(model, context); + msg = 'No Result Found'; + }, + controller: textController, + validator: (value) { + if (value.isEmpty) { + return 'please Enter Product Name'; + } + return null; + }, + ), + ), + ), + SizedBox( + width: 10.0, + ), + InkWell( + child: Texts( + 'Cancel', + fontSize: 17.0, + fontWeight: FontWeight.w500, + ), + onTap: () { + Navigator.pop(context); + }, + ), + + // child: Container( + // child: Button( + // backgroundColor: Colors.green, + // loading: model.state == ViewState.BusyLocal, + // label: 'Search', + // onTap: () { + // searchMedicine(model, context); + // }), + // width: MediaQuery.of(context).size.width * 0.09, + // ), + ], + ), + ), + model.searchList.length == 0 + ? Container( + child: Text( + 'no data' + model.searchList.length.toString()), + ) + : Expanded( + child: Container( + child: ListView.builder( + itemCount: model.searchList.length, + itemBuilder: (BuildContext ctx, index) { + return Padding( + padding:EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + model.searchList[index].name, + style: TextStyle(fontSize: 20), + ), + ), + ), + Divider(height: 1, color: Colors.grey) + ],), + ); + }, + ), + ), + ), + ], + ), + ), + ), + ), + ); + } + + searchMedicine(model, BuildContext context) { + Utils.hideKeyboard(context); + if (_formKey.currentState.validate()) + model.searchProducts(productName: textController.text); + } +} diff --git a/lib/pages/pharmacies/widgets/BannerPager.dart b/lib/pages/pharmacies/widgets/BannerPager.dart index 0f29014d..989c7557 100644 --- a/lib/pages/pharmacies/widgets/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/BannerPager.dart @@ -26,7 +26,6 @@ class _BannerPagerState extends State { enlargeCenterPage: true, enableInfiniteScroll: false, initialPage: 0, - viewportFraction: 0.8, autoPlay: true, autoPlayInterval: Duration(seconds: 3), autoPlayAnimationDuration: Duration(milliseconds: 800), diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 2dea5a93..20d6b730 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -17,13 +18,12 @@ class ProductTileItem extends StatelessWidget { void productOnClick(BuildContext ctx) { _saveLastVisitProducts(); - Navigator.push(ctx, FadePage(page: ProductDetailScreen(item))); + Navigator.push(ctx, FadePage(page: ProductDetailPage(item))); } void _saveLastVisitProducts() async { String lastVisited = ""; bool isIdExist = false; - // var data = await sharedPref.getObject(USER_PROFILE) ; // data['PatientID'] if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { lastVisited = diff --git a/lib/pages/pharmacies/widgets/lakum-banner-widget.dart b/lib/pages/pharmacies/widgets/lakum-banner-widget.dart new file mode 100644 index 00000000..14a53e72 --- /dev/null +++ b/lib/pages/pharmacies/widgets/lakum-banner-widget.dart @@ -0,0 +1,289 @@ +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +class LakumBannerWidget extends StatefulWidget { + final LacumViewModel model; + final MediaQueryData mediaQuery; + final bool isLacumHomePage; + + LakumBannerWidget(this.model, this.mediaQuery, this.isLacumHomePage); + + @override + _LakumBannerWidgetState createState() => _LakumBannerWidgetState(); +} + +class _LakumBannerWidgetState extends State { + int _current = 0; + + @override + Widget build(BuildContext context) { + return Container( + child: Stack( + children: [ + CarouselSlider( + options: CarouselOptions( + enableInfiniteScroll: false, + enlargeCenterPage: false, + viewportFraction: 1.0, + scrollPhysics: widget.isLacumHomePage + ? ScrollPhysics() + : NeverScrollableScrollPhysics(), + initialPage: 0, + onPageChanged: (index, reason) { + setState(() { + _current = index; + }); + }, + ), + items: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(4), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey, + width: 0.4, + )), + ), + margin: EdgeInsets.symmetric(horizontal: 16), + child: Stack( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + width: widget.mediaQuery.size.width * 1.0, + height: widget.mediaQuery.size.width * 1.0, + ), + Container( + margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + "${widget.model.lacumInformation.yahalaAccountNo}", + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + BorderedButton( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus == "Active" + ? TranslationBase.of(context).active + : TranslationBase.of(context).inactive, + textColor: widget.model.lacumInformation + .accountStatus == + 1 + ? Colors.green + : Colors.red, + hasBorder: true, + borderColor: widget.model.lacumInformation + .accountStatus == + 1 + ? Colors.green + : Colors.red, + radius: 16, + rPadding: 16, + icon: widget.model.lacumInformation + .accountStatus == + 1 + ? Icon( + Icons.check_circle, + size: 25, + color: Colors.green, + ) + : Image.asset( + "assets/images/pharmacy_module/lakum/inactive_cross.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "IDENTIFICATION #", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumInformation + .identificationNo, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + "MEMBER SINCE", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.formatCreatedDateToString(), + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "MOBILE #", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + TranslationBase.of(context).language, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumInformation.prefLang == + "1" + ? TranslationBase.of(context).lanEnglish + : TranslationBase.of(context).lanArabic, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + ], + ), + ], + ), + ), + ], + ), + ), + widget.isLacumHomePage + ? Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(4), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey, + width: 0.4, + )), + ), + margin: EdgeInsets.symmetric(horizontal: 16), + child: Stack( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + width: widget.mediaQuery.size.width * 1.0, + height: widget.mediaQuery.size.width * 1.0, + ), + Container( + margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + child: widget.model.convertBase64ToBarCodeImage() != + null + ? Image.memory( + widget.model.convertBase64ToBarCodeImage()) + : Container(), + ), + ], + ), + ) + : Container(), + ], + ), + widget.isLacumHomePage + ? Positioned( + bottom: 1, + left: 1, + right: 1, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: _current == 0 ? 12.0 : 8.0, + height: 4.0, + margin: EdgeInsets.symmetric( + vertical: 0.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: _current == 0 + ? Color(0xff5ab145) + : Color.fromRGBO(0, 0, 0, 0.4), + ), + ), + Container( + width: _current == 1 ? 12.0 : 8.0, + height: 4.0, + margin: EdgeInsets.symmetric( + vertical: 0.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: _current == 1 + ? Color(0xff5ab145) + : Color.fromRGBO(0, 0, 0, 0.4), + ), + ), + ], + ), + ), + ) + : Container(), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart b/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart new file mode 100644 index 00000000..bddd2e3b --- /dev/null +++ b/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart @@ -0,0 +1,116 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/points-expandable-notifier.dart'; +import 'package:expandable/expandable.dart'; +import 'package:flutter/material.dart'; + +class LakumPointTableRowWidget extends StatefulWidget { + final bool isTableTitle; // true : title , false: row + final String rowTitle; + final double points; + final double riyal; + final Function onTap; + final int rowIndex; + final Widget collapsed; + final bool expandFlag; + + LakumPointTableRowWidget(this.isTableTitle, this.rowTitle, this.points, + this.riyal, this.onTap, this.rowIndex, + {this.collapsed, this.expandFlag = false}); + + @override + _LakumPointTableRowWidgetState createState() => + _LakumPointTableRowWidgetState(); +} + +class _LakumPointTableRowWidgetState extends State { + @override + Widget build(BuildContext context) { + return InkWell( + onTap: widget.onTap, + child: Column( + children: [ + Column( + children: [ + widget.collapsed != null + ? PointsExpandableNotifier( + headerWidget: buildPointRowBody(), + // bodyWidget: widget.collapsed != null ? widget.collapsed : null, + bodyWidget: widget.collapsed, + isExpand: widget.expandFlag, + ) + : buildPointRowBody(), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } + + Widget buildPointRowBody() { + bool isEven = widget.rowIndex % 2 == 0; + return Container( + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + color: widget.expandFlag ? Color(0xffe4e4e4) : isEven && !widget.isTableTitle ? Color(0xffefefef) : Colors.white, + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Container( + child: Texts( + widget.rowTitle, + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: Container( + child: Texts( + widget.isTableTitle ? "POINTS" : "${widget.points}", + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: Container( + child: Texts( + widget.isTableTitle ? "RIYAL" : "${widget.riyal}", + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: widget.isTableTitle + ? Container() + : Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + widget.collapsed == null + ? Icons.keyboard_arrow_right + : widget.expandFlag + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + size: 25, + color: Colors.grey.shade700, + ), + ], + )), + ], + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart index 3a09031b..822dfe89 100644 --- a/lib/pages/pharmacies/wishlist.dart +++ b/lib/pages/pharmacies/wishlist.dart @@ -4,11 +4,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dar import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; - -void main() => runApp(WishlistPage()); - class WishlistPage extends StatefulWidget { - @override _WishlistPageState createState() => _WishlistPageState(); } @@ -21,52 +17,52 @@ class _WishlistPageState extends State { onModelReady: (model) => model.getWishlistData(), builder: (_, model, wi) => AppScaffold( appBarTitle: 'Wishlist page', - isShowAppBar: true, - isPharmacy: true, - body: Container( -// child: ListView.builder( -// itemCount: 3, -// itemBuilder: (BuildContext context, int index) { -// return Column( -// children: [ -// Container( -// child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00,), -// ), -// Divider(height: 1, color: Colors.grey) -// ], -// ); -// }), - child: Column( - children: [ -// Expanded( -// flex: 1, -// child: Container( -// color: Colors.white, -// width: double.infinity, -// height: 30, -// child: IconButton( -// alignment: Alignment.topRight, -// icon: Icon(Icons.art_track), -// color: Colors.blueAccent, -// onPressed: () { -// setState(() { -// isTrue = !isTrue; -// }); -// }, -// ), -// ), -// ), - Expanded( - flex: 20, - child: Container( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.85, //250, - child: ProductCheckTypeWidget(isTrue, model.wishListList), + isShowAppBar: false, + isShowDecPage: false, + isPharmacy: false, + baseViewModel: model, + body: model.wishListList.length == 0 + ? Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), + ), + ) + : Container( + child: Column( + children: [ + Expanded( + flex: 20, + child: Container( + width: double.infinity, + height: + MediaQuery.of(context).size.height * 0.85, //250, + child: + ProductCheckTypeWidget(isTrue, model.wishListList), + ), + ), + ], + ), ), - ), - ], - ), - ), ), ); } diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index 30fd4cd6..7e8763e1 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -1,127 +1,82 @@ -import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_html/style.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; class AddAddressPage extends StatefulWidget { + final Addresses editedAddress; + final Function(PickResult) onPick; + + AddAddressPage(this.editedAddress, this.onPick); + @override - _AddAddressState createState() => _AddAddressState(); + _AddAddressPageState createState() => _AddAddressPageState(); } -class _AddAddressState extends State { +class _AddAddressPageState extends State { + double _latitude; + double _longitude; - void onMapCreated(controller){ - setState(() { - mapController= controller; - }); - } - void _getAddressFromLatLng() {} - _onMapTypeButtonPressed(){} - _onAddMarkerButtonPressed(){} - - LatLng _initialPosition; - GoogleMapController mapController; @override void initState() { - // TODO: implement initState - _initialPosition = LatLng(24.662617030, 46.7334844); super.initState(); + if (widget.editedAddress != null && + widget.editedAddress.latLong != null && + widget.editedAddress.latLong != "") { + List latLng = widget.editedAddress.latLong.split(","); + _latitude = double.parse(latLng[0]); + _longitude = double.parse(latLng[1]); + } else { + _getCurrentLocation(); + } } - void _onMapCreated(GoogleMapController controller) { - mapController = controller; + _getCurrentLocation() async { + await Geolocator.getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); } - @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - centerTitle: true, - title: Text(TranslationBase.of(context).addNewAddress, style: TextStyle(color:Colors.white)), - backgroundColor: Colors.green, - ), - body: Stack( - children: [ - GoogleMap( - zoomControlsEnabled: true, - myLocationButtonEnabled: true, - myLocationEnabled: true, - onMapCreated: _onMapCreated, - onCameraMove: (object) { -// widget.currentLat = object.target.latitude; -// widget.currentLong = object.target.longitude; - }, - onCameraIdle: _getAddressFromLatLng, - padding: EdgeInsets.only(bottom: 90.0), - initialCameraPosition: CameraPosition( - target: _initialPosition, - zoom: 13.0, - ), - ), -// Align( -// alignment: Alignment.topRight, -// child: Column( -// children: [ -// button(_onMapTypeButtonPressed,Icons.map), -// SizedBox( -// height:16.0, -// ), -// button(_onAddMarkerButtonPressed, Icons.add_location) -// ], -// ), -// ), - ] - ), - bottomSheet: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return AddAddressPage(); - }), - ); - }, - child: Container( - height: 50.0, - color: Colors.green, - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 1.0 - ), - color: Colors.green, - borderRadius: BorderRadius.circular(10.0) - ), - child: Center( - child: Text(TranslationBase.of(context).confirmLocation, - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - ), + PreferredSizeWidget appBarWidget = AppBarWidget( + "${TranslationBase.of(context).changeAddress}", null, true); + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top; + + return BaseView( + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).changeAddress, + isShowAppBar: true, + isPharmacy: true, + backgroundColor: Colors.white, + appBarWidget: appBarWidget, + body: Container( + height: height * 1, + child: PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + isWithAppBar: false, + buttonColor: Color(0xFF5AB145), + buttonLabel: TranslationBase.of(context).save, + onPick: (value) { + widget.onPick(value); + }, ), ), ), - ); + ); } - - -// Widget button(Function function, IconData icon){ -// return FloatingActionButton( -// onPressed: function, -// materialTapTargetSize: MaterialTapTargetSize.padded, -// backgroundColor: Colors.red, -// child: Icon( -// icon, -// size: 18.0, -// ),); -// } - } - diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 07862645..e3651e21 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -1,378 +1,320 @@ - +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.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'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyAddressesModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; -class PharmacyAddressesPage extends StatefulWidget{ + +class PharmacyAddressesPage extends StatefulWidget { @override _PharmacyAddressesState createState() => _PharmacyAddressesState(); - } - -class _PharmacyAddressesState extends State{ - String address=""; - int selectedRadio; - bool _value = false; +} - AppSharedPreferences sharedPref = AppSharedPreferences(); - @override - void initState(){ -// WidgetsBinding.instance.addPostFrameCallback((_) => getAllAddress()); +class _PharmacyAddressesState extends State { - super.initState(); - selectedRadio=0; - } - setSelectedRadio(int val){ - setState(() { - selectedRadio = val; - }); + void navigateToAddressPage( + BuildContext ctx, PharmacyAddressesViewModel model, Addresses address) { + Navigator.push( + ctx, + FadePage( + page: AddAddressPage(address, (pickResult) { + model.addEditAddress(pickResult, address); + }))); } - Widget build (BuildContext context){ + Widget build(BuildContext context) { + PreferredSizeWidget appBarWidget = AppBarWidget( + "${TranslationBase.of(context).changeAddress}", null, true); + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top; + return BaseView( - onModelReady: (model) => model.getAddress(address), - builder: (_,model, wi )=> AppScaffold( - appBarTitle:TranslationBase.of(context).changeAddress, - baseViewModel: model, + onModelReady: (model) => model.getAddressesList(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).changeAddress, isShowAppBar: true, - isPharmacy:true , + isPharmacy: true, + baseViewModel: model, + backgroundColor: Colors.white, + appBarWidget: appBarWidget, body: Container( - child:SingleChildScrollView( + height: height * 0.90, + child: SingleChildScrollView( child: Column( - children:[ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model.address.length, - itemBuilder: (context, index){ - return Container( - child: Padding( - padding:EdgeInsets.only(top:10.0, left:5.0, right:5.0, bottom:5.0,), - child: Column( - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InkWell( - onTap: () { - setState(() { - _value = !_value; - }); - }, - child: Container( - margin: EdgeInsets.only(right: 20), - - child: Padding( - padding: const EdgeInsets.all(5.0), - child: _value - ? Container( - child: SvgPicture.asset( - 'assets/images/pharmacy/check_icon.svg', - height: 25, - width: 25,), - ) - : Container( - child: SvgPicture.asset( - 'assets/images/pharmacy/check_icon.svg', - height: 23, - width: 23, - color: Colors.transparent, - ), - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey, - style: BorderStyle.solid, - width: 1.0 - ), - color: Colors.transparent, - borderRadius: BorderRadius.circular(50.0) - ), - ), - ), - ), - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('name', -// model.address[0].customers[0].addresses[0].firstName, - style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 5,), - Expanded( - child: Text(model.address[0].customers[0].addresses[0].address1+ ''+ - model.address[0].customers[0].addresses[0].address2+ '' + - model.address[0].customers[0].addresses[0].zipPostalCode, - style: TextStyle(fontSize: 15.0, color: Colors.grey, - ), - ), - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - margin: EdgeInsets.only(bottom: 8), - child: SvgPicture.asset( - 'assets/images/pharmacy/mobile_number_icon.svg', - height: 13,), - ), - Container( - margin: EdgeInsets.only(left: 10, bottom: 8), - child: Text('588888778', - style: TextStyle(fontSize: 15.0, - ), - ), - ), - ], - ), - SizedBox( - height: 15,), - Row( - children: [ - Column( - children: [ - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return AddAddressPage(); - }), - ); - }, - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right:10, bottom: 15), - child: SvgPicture.asset( - 'assets/images/pharmacy/edit_icon.svg', - height: 15,), - ), - Container( - margin: EdgeInsets.only(right:5, bottom: 15), - padding: EdgeInsets.only(right: 10.0), - child: Text(TranslationBase.of(context).edit, - style: TextStyle(fontSize: 15.0, - color: Colors.blue, - ), - ), - decoration: BoxDecoration( - border: Border( - right: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - ), - ), - ], - ), - ), - ], - ), - Column( - children: [ - InkWell( - onTap: () { -// confirmDelete(snapshot.data[index]["id"]); - confirmDelete("address"); - }, - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 15, right: 10, bottom: 15), - child: SvgPicture.asset( - 'assets/images/pharmacy/delete_red_icon.svg', - height: 15,), - ), - Container( - margin: EdgeInsets.only(bottom: 15), - child: Text(TranslationBase.of(context).delete, - style: TextStyle(fontSize: 15.0, - color: Colors.redAccent, - ), - ), - ), - ], - ), - ), - ], - ) - ], - ), - ], - ), - SizedBox( - height: 10, - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 6, - indent: 0, - endIndent: 0, - ), - ], - ), - ), - ); - } - ), - SizedBox( - height: 10, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return AddAddressPage(); + children: [ + ...List.generate( + model.addresses != null ? model.addresses.length : 0, + (index) => AddressItemWidget( + model, + model.addresses[index], + () { + setState(() { + model.setSelectedAddressIndex(index); + }); + }, + model.selectedAddressIndex == index, + (address) { + navigateToAddressPage(context, model, address); }), - ); - }, - child: Container( - margin: EdgeInsets.only(bottom: 100.0), - height: 50.0, - color: Colors.transparent, - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 1.0 - ), - color: Colors.transparent, - borderRadius: BorderRadius.circular(5.0) - ), - child: Center( - child: Text( - TranslationBase.of(context).addAddress, - style: TextStyle( - color: Colors.green, - fontWeight: FontWeight.bold, - ), - ), - ), - ), + ), + Container( + color: Colors.white, + margin: EdgeInsets.all(8), + child: BorderedButton( + TranslationBase.of(context).addAddress, + hasBorder: true, + borderColor: Color(0xFF0fca6d), + textColor: Color(0xFF0fca6d), + fontWeight: FontWeight.bold, + backgroundColor: Colors.white, + fontSize: 14, + vPadding: 12, + hasShadow: true, + handler: () { + navigateToAddressPage(context, model, null); + }, ), ), ], ), ), ), - bottomSheet: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return AddAddressPage(); - }), - ); - }, - child: Container( - height: 50.0, - color: Colors.green, - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 1.0 - ), - color: Colors.green, - borderRadius: BorderRadius.circular(5.0) + bottomSheet: Container( + height: height * 0.10, + color: Colors.white, + child: Column( + children: [ + Divider( + color: Colors.grey.shade300, + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, ), - child: Center( - child: Text(TranslationBase.of(context).confirmAddress, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - ), + Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8), + child: BorderedButton( + TranslationBase.of(context).confirmAddress, + hasBorder: true, + borderColor: Color(0xFF5AB145), + textColor: Colors.white, + fontWeight: FontWeight.bold, + backgroundColor: Color(0xFF5AB145), + fontSize: 14, + vPadding: 12, + handler: () { + model.saveSelectedAddressLocally( + model.addresses[model.selectedAddressIndex]); + Navigator.pop(context, + model.addresses[model.selectedAddressIndex]); + }, ), ), - ), + ], ), ), ), ); } - confirmDelete(address){ - showDialog( - context: context, - builder: (BuildContext context)=> AlertDialog( - title: Text(TranslationBase.of(context).confirmDeleteMsg, - style: TextStyle( - fontWeight: FontWeight.bold, - ),), - content: Text("address"), - actions:[ - FlatButton( - child: Text(TranslationBase.of(context).cancel, - style: TextStyle( - color: Colors.red, - fontWeight: FontWeight.bold, - fontSize: 16, - ),), - onPressed: (){ - Navigator.pop(context); - }, - ), - FlatButton( - child: Text(TranslationBase.of(context).confirmDelete, - style: TextStyle( - color: Colors.grey, - fontWeight: FontWeight.bold, - fontSize: 16, - ),), - onPressed: (){ -// http.delete("https://uat.hmgwebservices.com/epharmacy/api/Customers/272843?fields=addresses/$id"); - Navigator.push(context, - MaterialPageRoute(builder: (context)=> PharmacyAddressesPage() )); - }, - ), - ], - ) - ); - } } -getAllAddress() { +class AddressItemWidget extends StatelessWidget { + final PharmacyAddressesViewModel model; + final Addresses address; + final Function selectAddress; + final bool isSelected; + final Function(Addresses) onTabEditAddress; -} - - - - getConfirmAddress(){ - - } - getEditAddress(){ - - } - getDeleteAddress(){ + AddressItemWidget(this.model, this.address, this.selectAddress, + this.isSelected, this.onTabEditAddress); + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Padding( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 0), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + InkWell( + onTap: selectAddress, + child: Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Container( + decoration: new BoxDecoration( + color: !isSelected ? Colors.white : Colors.green, + shape: BoxShape.circle, + border: Border.all( + color: Colors.grey, + style: BorderStyle.solid, + width: 1.0), + ), + child: Padding( + padding: const EdgeInsets.all(0.0), + child: Icon( + Icons.check, + color: isSelected + ? Colors.white + : Colors.transparent, + size: 25, + ), + ), + ), + ), + ), + ), + ], + ), + Expanded( + child: Container( + child: Container( + margin: + EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 0), + child: Texts( + "${address.firstName} ${address.lastName}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 4), + child: Texts( + "${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}", + fontSize: 12, + fontWeight: FontWeight.normal, + color: Colors.grey.shade500, + ), + ), + Row( + children: [ + Container( + margin: const EdgeInsets.only(right: 8), + child: Icon( + Icons.phone, + size: 20, + color: Colors.black, + ), + ), + Texts( + "${address.phoneNumber}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ], + ), + SizedBox( + height: 10, + ), + Container( + height: 25, + child: Row( + children: [ + BorderedButton( + TranslationBase.of(context).edit, + backgroundColor: Colors.transparent, + hasBorder: true, + borderColor: Colors.transparent, + textColor: Color(0x990000FF), + handler: () { + onTabEditAddress(address); + }, + icon: Icon( + Icons.edit, + size: 15, + color: Color(0x990000FF), + ), + ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 8), + child: SizedBox( + child: Container( + width: 1, + color: Colors.grey.shade400, + ), + ), + ), + BorderedButton( + TranslationBase.of(context).delete, + backgroundColor: Colors.transparent, + hasBorder: true, + borderColor: Colors.transparent, + textColor: Color(0x99FF0000), + handler: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + title: "Are you sure want to delete", + confirmMessage: + "${address.address1} ${address.address2}", + okText: + TranslationBase.of(context).delete, + cancelText: TranslationBase.of(context) + .cancel_nocaps, + okFunction: () => { + model + .deleteAddresses(address) + .then((_) { + ConfirmDialog.closeAlertDialog( + context); + AppToast.showErrorToast( + message: + "Address has been deleted"); + }) + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + icon: Icon( + Icons.delete, + size: 15, + color: Color(0x99FF0000), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), + Divider( + color: Colors.grey.shade200, + height: 10, + thickness: 10, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + ); + } } - - - - - diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 3a27a98d..85305c99 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; @@ -15,20 +16,29 @@ import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +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(); } class _ProfilePageState extends State { - + AppSharedPreferences sharedPref = AppSharedPreferences(); + String page_id = ""; AuthenticatedUser user; bool isLogin = false; @@ -42,35 +52,38 @@ class _ProfilePageState extends State { 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(); @@ -80,546 +93,559 @@ class _ProfilePageState extends State { @override Widget build(BuildContext context) { - return AppScaffold( - appBarTitle: TranslationBase.of(context).myAccount, - isShowAppBar: true, - isPharmacy: true, - body: 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: "", -// url: "" ,), -// ), - Row( - children: [ - Column( - children: [ - Container( - padding:EdgeInsets.only(top:10.0, left:10.0, right:10.0, bottom:15.0,), - child: SvgPicture.asset( - 'assets/images/pharmacy/user.svg', - width: 60, - height: 60, - ), - ),] - ), - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - TranslationBase.of(context).welcome, - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold, - color: Colors.grey), - ), - Text( - languageID == "ar" - ? user.firstNameN.toString()+ " " + user.lastNameN.toString() - : user.firstName.toString()+ " " + user.lastName.toString(), - style: TextStyle( - fontSize: 14.0, fontWeight: FontWeight.bold), + 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: 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( + child: Column( + children: [ + Text( + TranslationBase.of(context).welcome, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.grey), + ), + 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, - ), - 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, - ), - ), - ], ), - ), - ), - 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), - ), - ], + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, ), - ), - ), - 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, - ), - ), - ], + SizedBox( + height: 15, ), - ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MyReviewsPage())); - }, - child: Column( + Container( + child: Row( 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: () { + 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, + ), + ), + ], + ), ), ), - ], - ), - ), - ), - ], - )), - 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, + 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), + ), + ], + ), ), ), - ], - ), - ), - 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, + 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, + ), + ), + ], + ), ), ), - ], - ), - ), - 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, + 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, ), - ), - 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, - ), - ), - ], + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 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: 10, ), - ), - 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, + 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: 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, - ), + 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), - ), - ], + SizedBox( + 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, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).ourLocations, - style: TextStyle(fontSize: 13.0), - ), - ], + 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), + ), + ], + ), + ), + 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), + ), + ], + ), + ) + ], + ), + ) + ], + ), ), - ) - ], - ), - ), - ), - ); + ), + )); } -// getUser() async { -// var userData = await sharedPref.getObject(USER_PROFILE); -// if (userData != null) user = AuthenticatedUser.fromJson(userData); -// } } diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index 169fb92d..06bba8c3 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -1,3 +1,6 @@ +import 'dart:convert'; + +import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:charts_flutter/flutter.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; @@ -9,7 +12,6 @@ import 'package:diplomaticquarterapp/uitl/utils.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:barcode_scan/platform_wrapper.dart'; import 'package:provider/provider.dart'; import 'base/base_view.dart'; import 'final_products_page.dart'; @@ -212,15 +214,14 @@ class _PharmacyCategorisePageState extends State { BuildContext context, PharmacyCategoriseViewModel model, ) async { + //TODO fix it /// When give qr we will change this method to get data /// var result = await BarcodeScanner.scan(); /// int patientID = get from qr result - var result = await BarcodeScanner.scan(); - if (result.rawContent == "") { - List listOfParams = result.rawContent.split(','); - // ScanQrRequestModel _scanQrRequestModel = ScanQrRequestModel( - // deliveryOrderID: int.parse(listOfParams[0]), groupID: 0); - String patientType = "1"; + String result = await BarcodeScanner.scan(); + var data = json.decode(result); + if (data!=null) { + var qRParkingID = data['QRParkingID']; await model.scanQr(); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index 38fdd008..f5ec34c3 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -72,7 +73,7 @@ class _RateAppointmentClinicState extends State { height: 25, ), Texts( - 'How would you rate your last visit to the Clinic', + TranslationBase.of(context).lastAppointment, bold: true, color: Colors.black, ), @@ -122,7 +123,7 @@ class _RateAppointmentClinicState extends State { ), Center( child: Texts( - 'Please rate the Clinic', + TranslationBase.of(context).rateClinic, textAlign: TextAlign.center, )), SizedBox( @@ -145,7 +146,7 @@ class _RateAppointmentClinicState extends State { child: Container( key: ValueKey(rating), child: IconButton( - iconSize: 55.0, + iconSize: 45.0, onPressed: () { setState(() { rating = index + 1; @@ -206,7 +207,7 @@ class _RateAppointmentClinicState extends State { message: 'please rate the clinic'); } }, - label: "Rate", + label: TranslationBase.of(context).submit, disabled: model.state == ViewState.BusyLocal, loading: model.state == ViewState.BusyLocal, textColor: Theme.of(context).backgroundColor), @@ -224,7 +225,7 @@ class _RateAppointmentClinicState extends State { ); }, child: Texts( - 'Later', + TranslationBase.of(context).later, decoration: TextDecoration.underline, color: HexColor('#151DFE'), fontSize: 18, diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index b79911ef..b3349704 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -40,7 +40,7 @@ class _RateAppointmentDoctorState extends State { headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), - title: Text('Rate'), + title: Text(TranslationBase.of(context).rate), leading: Builder( builder: (BuildContext context) { return IconButton( @@ -61,10 +61,10 @@ class _RateAppointmentDoctorState extends State { child: Column( children: [ SizedBox( - height: 25, + height: 25, //5598 ), Texts( - 'How would you rate your last visit to the doctor', + TranslationBase.of(context).lastVisit, bold: true, color: Colors.black, ), @@ -94,7 +94,7 @@ class _RateAppointmentDoctorState extends State { height: 22, ), Texts( - model.appointmentDetails.doctorName, + TranslationBase.of(context).dr + " " + model.appointmentDetails.doctorName, bold: true, ), SizedBox( @@ -115,7 +115,7 @@ class _RateAppointmentDoctorState extends State { ), Center( child: Texts( - 'Please rate the doctor', + TranslationBase.of(context).tapTitle, textAlign: TextAlign.center, )), SizedBox( @@ -138,7 +138,7 @@ class _RateAppointmentDoctorState extends State { child: Container( key: ValueKey(rating), child: IconButton( - iconSize: 55.0, + iconSize: 45.0, onPressed: () { setState(() { rating = index + 1; @@ -162,15 +162,15 @@ class _RateAppointmentDoctorState extends State { Form( key: formKey, child: TextFields( - hintText: "Notes", + hintText: TranslationBase.of(context).notes, minLines: 4, maxLines: 4, - validator: (value) { - if (value.isEmpty) - return 'Please enter your note'; - else if (rating == 0) return 'Rating cannot be \"0\"'; - return null; - }, + // validator: (value) { + // if (value.isEmpty) + // return 'Please enter your note'; + // else if (rating == 0) return 'Rating cannot be \"0\"'; + // return null; + // }, onChanged: (value) { setState(() { note = value; @@ -190,7 +190,7 @@ class _RateAppointmentDoctorState extends State { child: SecondaryButton( onTap: () async { final form = formKey.currentState; - if (form.validate()) { + if (form.validate() && rating>0 ) { form.save(); Navigator.push( context, @@ -206,7 +206,7 @@ class _RateAppointmentDoctorState extends State { } }, label: TranslationBase.of(context).next, - disabled: model.state == ViewState.BusyLocal, + disabled: model.state == ViewState.BusyLocal|| rating==0, loading: model.state == ViewState.BusyLocal, textColor: Theme.of(context).backgroundColor), ), @@ -223,7 +223,7 @@ class _RateAppointmentDoctorState extends State { ); }, child: Texts( - 'Later', + TranslationBase.of(context).later, decoration: TextDecoration.underline, color: HexColor('#151DFE'), fontSize: 18, diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 86167b7d..7085150a 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -19,14 +19,14 @@ class GeneralSettings extends StatefulWidget { class _GeneralSettings extends State with TickerProviderStateMixin { var themeNotifier; - var mediaQueryData; int blindValue = 0; - bool vibration =false; - bool accsibility =false; - bool camera =false; - bool location =false; + bool vibration =false; + bool accsibility =false; + bool camera =false; + bool location =false; var sharedPref = new AppSharedPreferences(); var permission = new PermissionService(); + var mediaQueryData; @override void initState() { getValues(); @@ -81,104 +81,104 @@ class _GeneralSettings extends State setState(() { accsibility = value; }); - permission.openSettings(); + //setAccisibility(value); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, ) ], )), - // Container( - // padding: EdgeInsets.all(10), - // child: AppText( - // TranslationBase.of(context).blindMode, - // color: Colors.black, - // fontWeight: FontWeight.bold, - // ), - // ), - // new Container( - // color: Colors.white, - // padding: EdgeInsets.all(8.0), - // child: new Column( - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // new Column( - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // new Text( - // TranslationBase.of(context).offTheme, - // style: new TextStyle(fontSize: 16.0), - // ), - // Radio( - // value: 0, - // groupValue: blindValue, - // onChanged: (value) { - // setState(() => {this.blindValue = value}); - // setTheme(value); - // }, - // ), - // ], - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // new Text( - // TranslationBase.of(context).invertTheme, - // style: new TextStyle( - // fontSize: 16.0, - // ), - // ), - // new Radio( - // value: 1, - // groupValue: blindValue, - // onChanged: (value) { - // setState(() => {this.blindValue = value}); - // setTheme(value); - // }, - // ) - // ], - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // new Text( - // TranslationBase.of(context).dimTheme, - // style: new TextStyle(fontSize: 16.0), - // ), - // new Radio( - // value: 2, - // groupValue: blindValue, - // onChanged: (value) { - // setState(() => {this.blindValue = value}); - // setTheme(value); - // }, - // ), - // ], - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // new Text( - // TranslationBase.of(context).bwTheme, - // style: new TextStyle(fontSize: 16.0), - // ), - // new Radio( - // value: 3, - // groupValue: blindValue, - // onChanged: (value) { - // setState(() => {this.blindValue = value}); - // - // setTheme(value); - // }, - // ), - // ], - // ), - // ], - // ) - // ])), + Container( + padding: EdgeInsets.all(10), + child: AppText( + TranslationBase.of(context).blindMode, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + new Container( + color: Colors.white, + padding: EdgeInsets.all(8.0), + child: new Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + new Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Text( + TranslationBase.of(context).offTheme, + style: new TextStyle(fontSize: 16.0), + ), + Radio( + value: 0, + groupValue: blindValue, + onChanged: (value) { + setState(() => {this.blindValue = value}); + setTheme(value); + }, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Text( + TranslationBase.of(context).invertTheme, + style: new TextStyle( + fontSize: 16.0, + ), + ), + new Radio( + value: 1, + groupValue: blindValue, + onChanged: (value) { + setState(() => {this.blindValue = value}); + setTheme(value); + }, + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Text( + TranslationBase.of(context).dimTheme, + style: new TextStyle(fontSize: 16.0), + ), + new Radio( + value: 2, + groupValue: blindValue, + onChanged: (value) { + setState(() => {this.blindValue = value}); + setTheme(value); + }, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Text( + TranslationBase.of(context).bwTheme, + style: new TextStyle(fontSize: 16.0), + ), + new Radio( + value: 3, + groupValue: blindValue, + onChanged: (value) { + setState(() => {this.blindValue = value}); + + setTheme(value); + }, + ), + ], + ), + ], + ) + ])), Container( padding: EdgeInsets.all(10), child: AppText( @@ -200,7 +200,6 @@ class _GeneralSettings extends State setState(() { camera = value; }); - permission.setCameraLocationPermission(context); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, @@ -220,7 +219,6 @@ class _GeneralSettings extends State setState(() { location = value; }); - permission.setCameraLocationPermission(context); }, activeTrackColor: Colors.lightGreenAccent, activeColor: Colors.green, @@ -240,7 +238,43 @@ class _GeneralSettings extends State break; case 1: { - themeNotifier.setTheme(await getTheme(value)); + themeNotifier.setTheme(ThemeData( + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.grey, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + cardColor: Colors.black, + buttonColor: Colors.grey[400], + disabledColor: Colors.grey[300], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Colors.grey, + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.white, + backgroundColor: Colors.grey, + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + cursorColor: Colors.grey, + + iconTheme: IconThemeData(), + appBarTheme: AppBarTheme( + color: Colors.grey, + brightness: Brightness.dark, + elevation: 10.0, + actionsIconTheme: IconThemeData( + color: Colors.grey, + ), + ), + )); Screen.setBrightness(1.0); } break; @@ -261,31 +295,28 @@ class _GeneralSettings extends State } break; } - permission.setTheme(value); + //permission.setTheme(value); } setVibration(value){ permission.setVibrationPermission(value); } + setAccisibility(){ + if(!accsibility){ + + } + // permission.setVibrationPermission(value); + } getValues() async{ - blindValue= permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); - vibration = permission.isVibrationEnabled() ==null ? false : permission.isVibrationEnabled(); - camera = await permission.isCameraEnabled(); - location = await permission.isLocationEnabled(); - setState(() { - location =location; - camera = camera; - vibration = vibration; - blindValue =blindValue; - accsibility = mediaQueryData.accessibleNavigation; - }); + blindValue= permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); + vibration = permission.isVibrationEnabled() ==null ? false : permission.isVibrationEnabled(); + accsibility =mediaQueryData.accessibleNavigation; } getTheme(value) async{ - if(value ==1){ return ThemeData( - fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'en' ? 'WorkSans' : 'Cairo', + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', primarySwatch: Colors.grey, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.light, @@ -324,7 +355,7 @@ class _GeneralSettings extends State }else if(value ==3){ return ThemeData( - fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'en' ? 'WorkSans' : 'Cairo', + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', primarySwatch: Colors.grey, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.light, @@ -363,7 +394,7 @@ class _GeneralSettings extends State }else { return ThemeData( - fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'en' ? 'WorkSans' : 'Cairo', + fontFamily: await sharedPref.getString(APP_LANGUAGE) == 'ar' ? 'Cairo' : 'WorkSans', primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.light, diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index c9089351..dcfdb8a8 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -9,6 +10,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:provider/provider.dart'; class ProfileSettings extends StatefulWidget { @@ -28,203 +31,210 @@ class _ProfileSettings extends State @override void initState() { Future.delayed(new Duration(seconds: 0), () { - getSettings(context); + ProjectViewModel projectProvider; + projectProvider = Provider.of(context); + if (projectProvider.isLogin == true) getSettings(context); }); super.initState(); } - Widget build(BuildContext context) { + Widget build(BuildContext context) { return BaseView( - onModelReady: (model) =>{}, + onModelReady: (model) => {}, builder: (_, model, wi) => Container( - child: - ListView(scrollDirection: Axis.vertical, children: [ - Container( - padding: EdgeInsets.all(15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context).fileNo, - color: Colors.black, + child: model.user != null + ? ListView(scrollDirection: Axis.vertical, children: [ + Container( + padding: EdgeInsets.all(15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context).fileNo, + color: Colors.black, + ), + AppText( + model.user.patientID.toString(), + color: Colors.black, + ), + ], + ), ), - AppText( - model.user.patientID.toString(), - color: Colors.black, + SizedBox( + height: 1, + width: MediaQuery.of(context).size.width, + child: Container( + color: Colors.grey[300], + ), ), - ], - ), - ), - SizedBox( - height: 1, - width: MediaQuery.of(context).size.width, - child: Container( - color: Colors.grey[300], - ), - ), - Padding( - child: AppText(TranslationBase.of(context).languageSetting, - fontWeight: FontWeight.bold), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: - EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).english), - new Radio( - value: 2, - groupValue: language, - onChanged: (value) { - setState(() { - language = value; - }); - - }, - ) - ], - )), - Container( - color: Colors.white, - padding: - EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).arabic), - new Radio( - value: 1, - groupValue: language, - onChanged: (value) { - setState(() { - language = value; - }); - - }, - ) - ], - )), - Padding( - child: AppText(TranslationBase.of(context).alert), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: - EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).emailAlert), - Switch( - value: emailAlert, - onChanged: (value) { - setState(() { - emailAlert = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Colors.white, - padding: - EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).smsAlert), - Switch( - value: smsAlert, - onChanged: (value) { - setState(() { - smsAlert = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Padding( - child: AppText(TranslationBase.of(context).contactInfo), - padding: EdgeInsets.all(10), - ), - Container( - color: Colors.white, - padding: - EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).email), - TextField( - controller: emailController, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Colors.white, - padding: - EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).emergencyName), - TextField( - controller: emergencyContactName, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Colors.white, - padding: - EdgeInsets.only(top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).emergencyContact), - TextField( - controller: emergencyContact, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - ), - ) - ], - )), - Container( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).submit, - () { - saveSettings(); - }, - )), - ], - )) - ]))); + Padding( + child: AppText( + TranslationBase.of(context).languageSetting, + fontWeight: FontWeight.bold), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: EdgeInsets.only( + top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).english), + new Radio( + value: 2, + groupValue: language, + onChanged: (value) { + setState(() { + language = value; + }); + }, + ) + ], + )), + Container( + color: Colors.white, + padding: EdgeInsets.only( + top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).arabic), + new Radio( + value: 1, + groupValue: language, + onChanged: (value) { + setState(() { + language = value; + }); + }, + ) + ], + )), + Padding( + child: AppText(TranslationBase.of(context).alert), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: EdgeInsets.only( + top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).emailAlert), + Switch( + value: emailAlert, + onChanged: (value) { + setState(() { + emailAlert = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Container( + color: Colors.white, + padding: EdgeInsets.only( + top: 0, left: 10, right: 10, bottom: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(TranslationBase.of(context).smsAlert), + Switch( + value: smsAlert, + onChanged: (value) { + setState(() { + smsAlert = value; + }); + }, + activeTrackColor: Colors.lightGreenAccent, + activeColor: Colors.green, + ) + ], + )), + Padding( + child: AppText(TranslationBase.of(context).contactInfo), + padding: EdgeInsets.all(10), + ), + Container( + color: Colors.white, + padding: EdgeInsets.only( + top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).email), + TextField( + controller: emailController, + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + )) + ], + )), + Container( + color: Colors.white, + padding: EdgeInsets.only( + top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText(TranslationBase.of(context).emergencyName), + TextField( + controller: emergencyContactName, + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + )) + ], + )), + Container( + color: Colors.white, + padding: EdgeInsets.only( + top: 0, left: 10, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).emergencyContact), + TextField( + controller: emergencyContact, + decoration: InputDecoration( + suffixIcon: Icon(Icons.edit), + ), + ) + ], + )), + Container( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).save, + () { + saveSettings(); + }, + )), + ], + )) + ]) + : Center( + child: + AppText(TranslationBase.of(context).loginToUseService), + ))); } - getSettings(context){ + getSettings(context) { GifLoaderDialogUtils.showMyDialog(context); - authService.getSettings().then((result)=>{ - GifLoaderDialogUtils.hideDialog(context), - setValue(result["PateintInfoForUpdateList"][0]) - }); + authService.getSettings().then((result) => { + GifLoaderDialogUtils.hideDialog(context), + setValue(result["PateintInfoForUpdateList"][0]) + }); } - setValue(value){ + + setValue(value) { setState(() { this.language = int.parse(value["PreferredLanguage"]); this.emailAlert = value["IsEmailAlertRequired"]; @@ -233,20 +243,21 @@ class _ProfileSettings extends State this.emergencyContact.text = value["EmergencyContactNo"]; this.emergencyContactName.text = value["EmergencyContactName"]; }); - } - saveSettings(){ + + saveSettings() { GifLoaderDialogUtils.showMyDialog(context); Map request = {}; - request["EmailAddress"] =this.emailController.text; + request["EmailAddress"] = this.emailController.text; request["EmergencyContactName"] = this.emergencyContactName.text; request["EmergencyContactNo"] = this.emergencyContact.text; request["IsEmailAlertRequired"] = this.emailAlert; request["IsSMSAlertRequired"] = this.smsAlert; request["PreferredLanguage"] = this.language.toString(); - authService.saveSettings(request).then((result)=>{ - print(result), - GifLoaderDialogUtils.hideDialog(context) - }); + authService.saveSettings(request).then((result) => { + AppToast.showSuccessToast( + message: TranslationBase.of(context).profileUpdate), + GifLoaderDialogUtils.hideDialog(context) + }); } } diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index abdac118..0c63b900 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -21,6 +21,10 @@ class _Settings extends State with TickerProviderStateMixin { _tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type); + if(widget.type==1){ + _tabController.animateTo(1); + } + super.initState(); } @@ -30,6 +34,14 @@ class _Settings extends State with TickerProviderStateMixin { return Scaffold( appBar: AppBar( bottom: TabBar( + // isScrollable: true, + + indicatorWeight: 5.0, + //indicatorSize: TabBarIndicatorSize.label, + // indicatorSize: TabBarIndicatorSize.tab, + + indicatorColor: Theme.of(context).primaryColor, + // labelColor: Theme.of(context).primaryColor, tabs: [ Tab(text: TranslationBase.of(context).general), Tab( diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index 02d67cac..169e5cd5 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -6,6 +7,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:flutter/cupertino.dart'; +import 'package:provider/provider.dart'; import '../base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; @@ -14,6 +16,7 @@ import 'package:popup_box/popup_box.dart'; import 'my_vaccines_item_screen.dart'; +//TODO fix by jammal we have a static data class MyVaccines extends StatefulWidget { @override _MyVaccinesState createState() => _MyVaccinesState(); @@ -22,6 +25,7 @@ class MyVaccines extends StatefulWidget { class _MyVaccinesState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getVaccine(), builder: (BuildContext context, VaccineViewModel model, Widget child) => @@ -171,6 +175,7 @@ class _MyVaccinesState extends State { Navigator.push(context, FadePage(page: MyVaccinesItemPage())), ), ), + if(projectViewModel.havePrivilege(27)) Container( width: double.infinity, // height: 80.0, diff --git a/lib/routes.dart b/lib/routes.dart index 1fdff27b..b11025c2 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family-member.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family_type.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; -import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; @@ -36,7 +35,6 @@ const String SYMPTOM_CHECKER = 'symptom-checker'; const String SYMPTOM_CHECKER_INFO = 'symptom-checker-info'; const String SELECT_GENDER = 'select-gender'; const String SETTINGS = 'settings'; -const String APP_UPDATE = 'app_update'; var routes = { SPLASH: (_) => SplashScreen(), HOME: (_) => LandingPage(), @@ -54,6 +52,5 @@ var routes = { SYMPTOM_CHECKER: (_) => SymptomChecker(), SYMPTOM_CHECKER_INFO: (_) => SymptomInfo(), SELECT_GENDER: (_) => SelectGender(), - SETTINGS: (_) => Settings(), - APP_UPDATE: (_) => AppUpdatePage() + SETTINGS: (_) => Settings() }; diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 579c0e10..d26c74ad 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -177,6 +177,72 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getDoctorsRating( + int docID, context) async { + Map request; + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": authUser.outSA, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "SessionID": null, + "doctorID": docID, + "PatientID": 0, + "License": true, + "IsRegistered": true, + "isDentalAllowedBackend": false + }; + + dynamic localRes; + + await baseAppClient.post(GET_DOCTOR_RATING_NOTES, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getDoctorsRatingDetails( + int docID, context) async { + Map request; + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": authUser.outSA, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "SessionID": null, + "DoctorID": docID, + "PatientID": 0, + "License": true, + "IsRegistered": true, + "isDentalAllowedBackend": false + }; + + dynamic localRes; + + await baseAppClient.post(GET_DOCTOR_RATING_DETAILS, + onSuccess: (response, statusCode) async { + 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; @@ -1021,6 +1087,44 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getPatientLabOrdersByAppoNo(dynamic appoNo, dynamic projID, dynamic clinicID, 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 = { + "AppointmentNo": appoNo, + "ProjectID": projID, + "ClinicID": clinicID, + "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_LAB_ORDERS_BY_APPOINTMENT, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getPatientPrescriptionReports( AppoitmentAllHistoryResultList appo, BuildContext context) async { Map request; diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 4dedb37f..8f0ea470 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -50,6 +50,7 @@ const FORGOT_PATIENT_ID = const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard'; const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate'; const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo'; + class AuthProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; @@ -159,8 +160,7 @@ class AuthProvider with ChangeNotifier { }, body: request); return Future.value(localRes); } catch (error) { - print(error); - //throw error; + return Future.value(null); } } @@ -172,15 +172,19 @@ class AuthProvider with ChangeNotifier { request.generalid = GENERAL_ID; request.languageID = LANGUAGE_ID; request.patientOutSA = request.zipCode == '966' ? 0 : 1; - - dynamic localRes; - await new BaseAppClient().post(CHECK_PATIENT_AUTH, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { + try { + dynamic localRes; + await new BaseAppClient().post(CHECK_PATIENT_AUTH, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request.toJson()); + return Future.value(localRes); + } catch (error) { throw error; - }, body: request.toJson()); - return Future.value(localRes); + //throw error; + } } Future getLoginInfo(request) async { @@ -232,7 +236,7 @@ class AuthProvider with ChangeNotifier { neRequest.channel = CHANNEL; neRequest.iPAdress = IP_ADDRESS; neRequest.generalid = GENERAL_ID; - neRequest.languageID = LANGUAGE_ID; + // neRequest.languageID = LANGUAGE_ID; neRequest.deviceTypeID = DeviceTypeID; neRequest.patientOutSA = neRequest.zipCode == '966' ? 0 : 1; neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true; @@ -251,9 +255,10 @@ class AuthProvider with ChangeNotifier { return Future.value(error); // throw error; }, body: neRequest.toJson()); + sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); return Future.value(localRes); } catch (error) { - throw error; + throw localRes; //return Future.value(error); } } @@ -458,36 +463,36 @@ class AuthProvider with ChangeNotifier { //return Future.value(error); } } - getSettings() async{ + getSettings() async { dynamic localRes; try { await new BaseAppClient().post(PROFILE_SETTING, onSuccess: (dynamic response, int statusCode) { - localRes = response; //CheckActivationCode.fromJson(); - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - // throw error; - }, body: {}); + localRes = response; //CheckActivationCode.fromJson(); + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + // throw error; + }, body: {}); return Future.value(localRes); } catch (error) { throw error; //return Future.value(error); } } - Future saveSettings(request) async{ + Future saveSettings(request) async { dynamic localRes; try { await new BaseAppClient().post(SAVE_SETTING, onSuccess: (dynamic response, int statusCode) { - localRes = response; //CheckActivationCode.fromJson(); - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - // throw error; - }, body: request); + localRes = response; //CheckActivationCode.fromJson(); + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + // throw error; + }, body: request); return Future.value(localRes); } catch (error) { throw error; diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index ea2b87fd..7a2dec81 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -37,8 +37,10 @@ const String SENT_REQUEST_URL = 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus'; const String RECEVIED_REQUEST_URL = 'Services/Authentication.svc/REST/GetAllPendingRecordsByResponseId'; -const ACCEPT_REJECT_FAMILY = 'Services/Authentication.svc/REST/Update_FileStatus'; -const DEACTIVATE_FAMILY = 'Services/Authentication.svc/REST/DeactivateRequestByRensponse'; +const ACCEPT_REJECT_FAMILY = + 'Services/Authentication.svc/REST/Update_FileStatus'; +const DEACTIVATE_FAMILY = + 'Services/Authentication.svc/REST/DeactivateRequestByRensponse'; class FamilyFilesProvider with ChangeNotifier { bool isLogin = false; @@ -49,7 +51,9 @@ class FamilyFilesProvider with ChangeNotifier { try { dynamic localRes; var request = GetAllSharedRecordsByStatusReq(); + var result = await sharedPref.getObject(MAIN_USER); request.status = 0; + request.patientID = result["PatientID"]; await new BaseAppClient().post(GET_SHARED_RECORD_BY_STATUS, onSuccess: (dynamic response, int statusCode) { localRes = response; @@ -57,7 +61,7 @@ class FamilyFilesProvider with ChangeNotifier { AppToast.showErrorToast(message: error); throw error; }, body: request.toJson()); - + sharedPref.setObject(FAMILY_FILE, localRes); return Future.value( GetAllSharedRecordsByStatusResponse.fromJson(localRes)); @@ -80,7 +84,7 @@ class FamilyFilesProvider with ChangeNotifier { return Future.error(error); }, body: request); if (localRes != null) { - sharedPref.setObject(FAMILY_FILE, localRes); + // sharedPref.setObject(FAMILY_FILE, localRes); allSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(localRes); return Future.value(allSharedRecordsByStatusResponse); @@ -105,7 +109,7 @@ class FamilyFilesProvider with ChangeNotifier { //AppToast.showErrorToast(message: error); //throw error; }, body: request); - sharedPref.setObject(FAMILY_FILE, localRes); + //sharedPref.setObject(FAMILY_FILE, localRes); return Future.value( GetAllSharedRecordsByStatusResponse.fromJson(localRes)); } catch (error) { @@ -251,9 +255,9 @@ class FamilyFilesProvider with ChangeNotifier { Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, {onSuccess, mainUser}) async { Map request = {}; - if(mainUser ==true){ + if (mainUser == true) { var currentUser = - AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER)); + AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER)); //const request = new SwitchUserRequest(); request['LogInTokenID'] = ''; request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; @@ -267,9 +271,9 @@ class FamilyFilesProvider with ChangeNotifier { request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; request['activationCode'] = '0000'; request['isRegister'] = false; - }else { + } else { var currentUser = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); //const request = new SwitchUserRequest(); request['LogInTokenID'] = ''; @@ -295,7 +299,7 @@ class FamilyFilesProvider with ChangeNotifier { AppToast.showErrorToast(message: error); throw error; }, body: request); - + sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); return Future.value(localRes); } catch (error) { print(error); @@ -309,11 +313,11 @@ class FamilyFilesProvider with ChangeNotifier { await new BaseAppClient().post(ACCEPT_REJECT_FAMILY, onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - AppToast.showErrorToast(message: error); - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + AppToast.showErrorToast(message: error); + throw error; + }, body: request); return Future.value(localRes); } catch (error) { @@ -321,17 +325,18 @@ class FamilyFilesProvider with ChangeNotifier { throw error; } } + Future deactivateFamily(request) async { try { dynamic localRes; await new BaseAppClient().post(DEACTIVATE_FAMILY, onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - AppToast.showErrorToast(message: error); - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + AppToast.showErrorToast(message: error); + throw error; + }, body: request); return Future.value(localRes); } catch (error) { @@ -339,6 +344,4 @@ class FamilyFilesProvider with ChangeNotifier { throw error; } } - - } diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart index 2d618f34..ea408ce2 100644 --- a/lib/services/permission/permission_service.dart +++ b/lib/services/permission/permission_service.dart @@ -1,4 +1,3 @@ -import 'package:android_intent/android_intent.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; @@ -35,7 +34,6 @@ class PermissionService extends BaseService { }else{ callback(); } - } diff --git a/lib/services/pharmacy_services/brands_service.dart b/lib/services/pharmacy_services/brands_service.dart index e4a40d6c..32024f2f 100644 --- a/lib/services/pharmacy_services/brands_service.dart +++ b/lib/services/pharmacy_services/brands_service.dart @@ -14,6 +14,13 @@ class BrandsService extends BaseService { List _topBrandsList = List(); List get topBrandsList => _topBrandsList; + List _searchList = List(); + List get searchList => _searchList; + + clearSearchList() { + _searchList.clear(); + } + Future getBrands() async { hasError = false; await baseAppClient.getPharmacy(GET_BRANDS, @@ -41,4 +48,26 @@ class BrandsService extends BaseService { super.error = error; }); } + + Future searchProducts({String productName}) async { + RegExp exp = new RegExp(productName.toUpperCase()); + hasError = false; + _searchList.clear(); + await baseAppClient.getPharmacy( + GET_BRANDS, + onSuccess: (dynamic response, int statusCode) { + response['manufacturer'].forEach((item) { + if(exp.hasMatch(item['name'])){ + _searchList.add(Brand.fromJson(item)); + }else{ + } + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + } diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart index 3ff2a2d3..1bb6571c 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -1,38 +1,102 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; 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/PharmacyAddressesModel.dart'; +class PharmacyAddressService extends BaseService { + List addresses = List(); + CountryData country; + int selectedAddressIndex = 0; -class PharmacyAddressService extends BaseService{ + Future getAddresses() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + Map queryParams = {'fields': 'addresses'}; + hasError = false; + Addresses selectedAddress; + try { + await baseAppClient.get("$GET_CUSTOMERS_ADDRESSES$customerId", + onSuccess: (dynamic response, int statusCode) async { + addresses.clear(); + var savedAddress = + await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS); + if (savedAddress != null) { + selectedAddress = Addresses.fromJson(savedAddress); + } + int index = 0; + response['customers'][0]['addresses'].forEach((item) { + Addresses address = Addresses.fromJson(item); + if (selectedAddress != null && selectedAddress.id == item["id"]) { + selectedAddressIndex = index; + } + addresses.add(address); + index++; + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future getCountries(String countryName) async { + hasError = false; + try { + await baseAppClient.get("$PHARMACY_GET_COUNTRY", + onSuccess: (dynamic response, int statusCode) { + // countries.clear(); + response['countries'].forEach((item) { + if (CountryData.fromJson(item).name == countryName || + CountryData.fromJson(item).namen == countryName) { + country = CountryData.fromJson(item); + } + // countries.add(CountryData.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } catch (error) { + throw error; + } + } - AppSharedPreferences sharedPref = AppSharedPreferences(); - AppGlobal appGlobal = new AppGlobal(); - AuthenticatedUser authUser = new AuthenticatedUser(); - AuthProvider authProvider = new AuthProvider(); + Future addCustomerAddress(Addresses address) async { + makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS); + } - List get address => address; - List _addressList = List(); - List get reviewList => _addressList; - String url =""; + Future editCustomerAddress(Addresses address) async { + makeCustomerAddress(address, EDIT_CUSTOMER_ADDRESS); + } - Future getAddress(address) async { - print("step 1"); + Future deleteCustomerAddress(Addresses address) async { + makeCustomerAddress(address, DELETE_CUSTOMER_ADDRESS); + } + + Future makeCustomerAddress(Addresses address, String url) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; - url =GET_ADDRESS+"272843?fields=addresses"; - print(url); - await baseAppClient.getPharmacy(url, - onSuccess: (dynamic response, int statusCode) { - _addressList.clear(); - response['customers'].forEach((item) { - _addressList.add(PharmacyAddressesModel.fromJson(item)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); - }} \ No newline at end of file + super.error = ""; + + Map customerObject = Map(); + customerObject["addresses"] = [address]; + customerObject["id"] = customerId; + customerObject["email"] = address.email; + customerObject["role_ids"] = [3]; + Map body = Map(); + body["customer"] = customerObject; + + await baseAppClient.post("$url", onSuccess: (response, statusCode) async { + addresses.clear(); + response['customers'][0]['addresses'].forEach((item) { + addresses.add(Addresses.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index f9bbb7e3..7a2947b0 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -1,11 +1,14 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/addToCartModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; class ProductDetailService extends BaseService { - AppSharedPreferences sharedPref = AppSharedPreferences(); bool isLogin = false; List _productDetailList = List(); @@ -14,10 +17,20 @@ class ProductDetailService extends BaseService { List _productLocationList = List(); List get productLocationList => _productLocationList; + List _addToCartModel = List(); + List get addToCartModel => _addToCartModel; - Future getProductReviews() async { + List _wishListProducts = List(); + List get wishListProducts => _wishListProducts; + + List _productSpecification = List(); + List get productSpecification => _productSpecification; + + + + Future getProductReviews(productID) async { hasError = false; - await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+"1480?fields=reviews", + await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+productID+"?fields=reviews", onSuccess: (dynamic response, int statusCode) { _productDetailList.clear(); response['products'].forEach((item) { @@ -51,11 +64,115 @@ class ProductDetailService extends BaseService { _productLocationList.clear(); response['PharmList'].forEach((item) { _productLocationList.add(LocationModel.fromJson(item)); + print(_productLocationList); + print(response); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + Future addToCart(quantity, itemID) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + Map request; + + request = { + "shopping_cart_item": + { + "quantity": quantity, + "shopping_cart_type": "1", + "product_id": itemID, + "customer_id": customerId, + "language_id": 1 + } + }; + await baseAppClient.post(GET_SHOPPING_CART, + onSuccess: (dynamic response, int statusCode) { + _addToCartModel.clear(); + response['shopping_carts'].forEach((item) { + _addToCartModel.add(Wishlist.fromJson(item)); + }); + AppToast.showSuccessToast(message: 'You have added a product to the cart'); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + AppToast.showErrorToast(message: 'something went wrong please try again'); + }, body: request); + } + + 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 + } + }; + await baseAppClient.post(GET_SHOPPING_CART, + onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + AppToast.showSuccessToast(message: 'You have added a product to the Wishlist'); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; + AppToast.showErrorToast(message: 'something went wrong please try again'); }, body: request); } + Future getWishlistItems() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2", + onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + Future delteItemFromWishlist(itemID) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist", + onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future productSpecificationData(itemID) async { + hasError = false; + + await baseAppClient.getPharmacy(GET_SPECIFICATION+itemID, + onSuccess: (dynamic response, int statusCode) { + _productSpecification.clear(); + response['specification'].forEach((item) { + _productSpecification.add(SpecificationModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + } diff --git a/lib/services/pharmacy_services/review_service.dart b/lib/services/pharmacy_services/review_service.dart index 67434643..44839955 100644 --- a/lib/services/pharmacy_services/review_service.dart +++ b/lib/services/pharmacy_services/review_service.dart @@ -1,19 +1,29 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/pharmacy/reviewModel.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class ReviewService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + bool isLogin = false; List _reviewList = List(); List get reviewList => _reviewList; Future getReview() async { + + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; - await baseAppClient.getPharmacy(GET_REVIEW+"1367368", + await baseAppClient.getPharmacy(GET_REVIEW+customerId, onSuccess: (dynamic response, int statusCode) { _reviewList.clear(); response['reviews'].forEach((item) { diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart index d4a00230..5404a2bd 100644 --- a/lib/services/pharmacy_services/wishList_service.dart +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -55,8 +55,9 @@ class WishListService extends BaseService { // } Future getWishlist() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; - await baseAppClient.getPharmacy(GET_WISHLIST+"1367368?shopping_cart_type=2", + await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2", onSuccess: (dynamic response, int statusCode) { _wishListProducts.clear(); response['shopping_carts'].forEach((item) { diff --git a/lib/splashPage.dart b/lib/splashPage.dart index d367d3ec..20da2ba6 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -1,14 +1,19 @@ import 'dart:async'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'config/shared_pref_kay.dart'; +import 'config/size_config.dart'; import 'core/service/AuthenticatedUserObject.dart'; +import 'core/service/privilege_service.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; import 'models/Authentication/authenticated_user.dart'; +import 'widgets/transitions/slide_up_page.dart'; AppSharedPreferences sharedPref = new AppSharedPreferences(); AuthenticatedUserObject authenticatedUserObject = @@ -20,44 +25,36 @@ class SplashScreen extends StatefulWidget { } class _SplashScreenState extends State { - //Provider.of(context, listen: false).isLogin + PrivilegeService _privilegeService = locator(); @override void initState() { super.initState(); Timer( Duration(seconds: 1, milliseconds: 500), - () { - getUserData().then((value) { - Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (BuildContext context) => LandingPage(), - ), - ); - }); + () { + loadPrivilege().then((value) { + Navigator.of(context).pushReplacement( + MaterialPageRoute( + builder: (BuildContext context) => LandingPage(), + ), + ); + }); + }, ); } - Future getUserData() async { - var data = await sharedPref.getObject(USER_PROFILE); - if (data != null) { - AuthenticatedUser userData = AuthenticatedUser.fromJson(data); - Provider.of(context, listen: false).isLogin = true; - authenticatedUserObject.isLogin = true; - authenticatedUserObject.user = userData; - } + /// load the Privilege from service + Future loadPrivilege() async { + await _privilegeService.getPrivilege(); + Provider.of(context, listen: false).setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - body: Center( - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Image.asset('assets/images/DQ/DQ_logo.png'), - ), - ), + body: Image.asset('assets/images/powerd-by.jpg',fit: BoxFit.fitWidth,width: MediaQuery.of(context).size.width,), ); } } diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index aedd0fbf..d19e13b2 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -53,7 +53,7 @@ final blueBackground = Color(0xFFFFFFFF); ), ); - var defaultTheme = ThemeData( + final defaultTheme = ThemeData( //fontFamily: ProjectViewModel().isArabic? 'Cairo' : 'WorkSans', primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, @@ -65,7 +65,6 @@ final blueBackground = Color(0xFFFFFFFF); }, ), hintColor: Colors.grey[400], - accentColor: Color(0xffB8382C), disabledColor: Colors.grey[300], errorColor: Color.fromRGBO(235, 80, 60, 1.0), scaffoldBackgroundColor: Color(0xffEEEEEE), diff --git a/lib/uitl/HMGNetworkConnectivity.dart b/lib/uitl/HMGNetworkConnectivity.dart new file mode 100644 index 00000000..228edf93 --- /dev/null +++ b/lib/uitl/HMGNetworkConnectivity.dart @@ -0,0 +1,120 @@ +import 'dart:developer'; +import 'dart:io'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:wifi/wifi.dart'; + +import 'gif_loader_dialog_utils.dart'; + +class HMGNetworkConnectivity { + final BuildContext context; + final Function callBack; + + final String SSID = "HMG-MobileApp"; + + HMGNetworkConnectivity(this.context, this.callBack); + + void checkAndConnectIfNoInternet() async { + String pingUrl = "$BASE_URL$PING_SERVICE"; + // pingUrl = "https://captive.apple.com"; + + String ssid = await Wifi.ssid.catchError((error) { + log(error.toString()); + }); + + bool alreadyConnected = ssid == SSID; + + BaseAppClient().simpleGet(pingUrl, onSuccess: (dynamic response, int statusCode) { + log("Having internet with status code: $statusCode"); + }, onFailure: (String error, int statusCode) { + if (alreadyConnected) + showFailDailog(TranslationBase.of(context).failedToAccessHmgServices); + else { + confirmFromUser(); + } + }); + } + + 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 showFailDailog(String message) { + TranslationBase translator = TranslationBase.of(context); + AlertDialogBox( + context: context, + okText: translator.ok, + confirmMessage: message, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + }).showAlertDialog(context); + } + + // void next() { + // if (Platform.isIOS) { + // confirmFromUser_iOS(); + // } else if (Platform.isAndroid) { + // confirmFromUser(); + // } + // } + + // void confirmFromUser_iOS() { + // String message = "You don't have internet access, Do you want to connect with HMG Network to use App.\n\nMake sure you are in HMG Network range"; + // ConfirmDialog( + // context: context, + // confirmMessage: message, + // okText: "Yes", + // okFunction: () { + // ConfirmDialog.closeAlertDialog(context); + // callBack(); + // }, + // cancelText: "No", + // cancelFunction: () { + // ConfirmDialog.closeAlertDialog(context); + // }).showAlertDialog(context); + // } + + // void connect_Android() { + // // enable the Wifi if its off + // PlatformBridge() + // .enableWifiIfNot() + // .then((value) => { + // if (value == true) + // { + // callBack() + // // Wifi.list(SSID) + // // .then((value1) => { + // // if (value1.length > 0) {callBack()} else {log("No HMG network in range")} + // // }) + // // .catchError((e) { + // // log(e); + // // }) + // } + // }) + // .catchError((error) { + // showFailDailog(error); + // }); + // } +} diff --git a/lib/uitl/HMG_Geofence.dart b/lib/uitl/HMG_Geofence.dart new file mode 100644 index 00000000..54c789ba --- /dev/null +++ b/lib/uitl/HMG_Geofence.dart @@ -0,0 +1,189 @@ +// import 'dart:convert'; +// import 'dart:core'; +// import 'dart:io'; +// import 'dart:isolate'; +// import 'dart:math'; +// import 'dart:ui'; +// +// import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +// import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart'; +// import 'package:diplomaticquarterapp/core/model/geofencing/requests/LogGeoZoneRequestModel.dart'; +// import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart'; +// import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart'; +// import 'package:diplomaticquarterapp/locator.dart'; +// import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; +// import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter/foundation.dart'; +// import 'package:geofencing/geofencing.dart'; +// +// class HMG_Geofencing { +// var _testTrigger = false; +// static var _isolatePortName = "hmg_geofencing_send_port"; +// +// List _zones; +// List registeredGeofences = []; +// +// final AndroidGeofencingSettings androidSettings = AndroidGeofencingSettings(initialTrigger: [GeofenceEvent.enter, GeofenceEvent.exit, GeofenceEvent.dwell], loiteringDelay: 1000 * 60); +// +// final BuildContext context; +// final List triggers = List(); +// +// HMG_Geofencing(this.context) { +// triggers.add(GeofenceEvent.enter); +// triggers.add(GeofenceEvent.exit); +// // triggers.add(GeofenceEvent.dwell); +// } +// +// Future loadZones() async{ +// _zones = await locator().getAllGeoZones(GeoZonesRequestModel()); +// return this; +// } +// +// void init() async { +// // debug check (Testing Geo Zones) +// if (kDebugMode) { +// addTestingGeofences(); +// } +// _saveZones(); +// await GeofencingManager.initialize(); +// await Future.delayed(Duration(seconds: 2)); +// _registerIsolatePort(); +// _registerGeofences().then((value) { +// debugPrint(value.toString()); +// if(_testTrigger) { +// var events = [GeofenceEvent.enter,GeofenceEvent.exit]; +// events.shuffle(); +// transitionTrigger(value, null, events.first); +// } +// }); +// +// } +// +// void _saveZones() { +// var list = List(); +// _zones.forEach((element) { +// list.add(element.toJson()); +// }); +// +// var jsonString = jsonEncode(list); +// AppSharedPreferences pref = AppSharedPreferences(); +// pref.setString(HMG_GEOFENCES, jsonString); +// } +// +// Future> _registerGeofences() async { +// registeredGeofences = await GeofencingManager.getRegisteredGeofenceIds(); +// +// var maxLimit = Platform.isIOS ? 20 : 100; +// +// if (registeredGeofences.length < maxLimit) { +// var notRegistered = _zones.where((element) => !(registeredGeofences.contains(element.geofenceId()))).toList(); +// for (int i = 0; i < notRegistered.length; i++) { +// var zone = notRegistered.elementAt(i); +// var lat = double.tryParse(zone.latitude); +// var lon = double.tryParse(zone.longitude); +// var rad = double.tryParse(zone.radius.toString()); +// +// if (lat != null || lon != null || rad != null) { +// await GeofencingManager.registerGeofence(GeofenceRegion(zone.geofenceId(), lat, lon, rad, triggers), transitionTrigger); +// registeredGeofences.add(zone.geofenceId()); +// if (registeredGeofences.length >= maxLimit) { +// break; +// } +// await Future.delayed(Duration(milliseconds: 100)); +// debugPrint("Geofence: ${zone.description} registered"); +// } else { +// debugPrint("Geofence: ${zone.description} registered"); +// } +// } +// } +// return registeredGeofences; +// } +// +// void addTestingGeofences() { +// _zones.add(GeoZonesResponseModel.get("24.777577,46.652675", 150, "msH")); +// _zones.add(GeoZonesResponseModel.get("24.691136,46.650116", 150, "zkH")); +// _zones.add(GeoZonesResponseModel.get("24.7087913,46.6656461", 150, "csO")); +// } +// +// static void transitionTrigger(List id, Location location, GeofenceEvent event) { +// var dataToSend = id.map((element) => {"event": event, "geofence_id": element}).toList() ?? []; +// final SendPort send = IsolateNameServer.lookupPortByName(_isolatePortName); +// send?.send(dataToSend); +// } +// +// ReceivePort _port = ReceivePort(); +// void _registerIsolatePort() async{ +// IsolateNameServer.registerPortWithName(_port.sendPort, _isolatePortName); +// _port.listen((dynamic data) { +// +// Future result = AppSharedPreferences().getStringWithDefaultValue(HMG_GEOFENCES,"[]"); +// result.then((jsonString){ +// +// List jsonList = json.decode(jsonString) ?? []; +// List geoList = jsonList.map((e) => GeoZonesResponseModel().fromJson(e)).toList() ?? []; +// +// (data as List).forEach((element) async { +// GeofenceEvent geofenceEvent = element["event"]; +// String geofence_id = element["geofence_id"]; +// +// GeoZonesResponseModel geoZone = _findByGeofenceFrom(geoList, by: geofence_id); +// if(geoZone != null) { +// LocalNotification.getInstance().showNow( +// title: "GeofenceEvent: ${_nameOf(geofenceEvent)}", +// subtitle: geoZone.description, +// payload: json.encode(geoZone.toJson())); +// +// _logGeoZoneToServer(zoneId: geoZone.geofId, transition: _idOf(geofenceEvent)); +// } +// +// await Future.delayed(Duration(milliseconds: 700)); +// +// }); +// +// }); +// }); +// } +// +// _logGeoZoneToServer({int zoneId, int transition}){ +// locator() +// .logGeoZone(LogGeoZoneRequestModel(GeoType: transition, PointsID: zoneId ?? 1)) +// .then((response){ +// +// }).catchError((error){ +// +// }); +// +// } +// +// GeoZonesResponseModel _findByGeofenceFrom(List list, { String by}) { +// var have = list.where((element) => element.geofenceId() == by).toList().first; +// return have; +// } +// +// String _nameOf(GeofenceEvent event) { +// switch (event) { +// case GeofenceEvent.enter: +// return "Enter"; +// case GeofenceEvent.exit: +// return "Exit"; +// case GeofenceEvent.dwell: +// return "dWell"; +// default: +// return event.toString(); +// } +// } +// +// int _idOf(GeofenceEvent event){ +// switch (event) { +// case GeofenceEvent.enter: +// return 1; +// case GeofenceEvent.exit: +// return 2; +// case GeofenceEvent.dwell: +// return 3; +// default: +// return -1; +// } +// } +// } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index 5b826f00..e0367ba3 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -1,17 +1,63 @@ +import 'dart:math'; import 'dart:typed_data'; import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); +final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); class LocalNotification { - static Future scheduleNotification( - {@required DateTime scheduledNotificationDateTime, - @required String title, - @required String description}) async { + Function(String payload) _onNotificationClick; + static LocalNotification _instance; + static LocalNotification getInstance(){ + return _instance; + } + static init({Function(String payload) onNotificationClick}){ + if(_instance == null){ + _instance = LocalNotification(); + _instance._onNotificationClick = onNotificationClick; + _instance._initialize(); + }else{ + // assert(false,(){ + // //TODO fix it + // "LocalNotification Already Initialized"; + // }); + } + } + + _initialize(){ + var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); + var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null); + var initializationSettings = InitializationSettings(initializationSettingsAndroid, initializationSettingsIOS); + flutterLocalNotificationsPlugin.initialize(initializationSettings, onSelectNotification: _onNotificationClick); + } + + var _random = new Random(); + _randomNumber({int from = 100000}){ + return _random.nextInt(from); + } + + _vibrationPattern(){ + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + return vibrationPattern; + } + + Future showNow({@required String title, @required String subtitle, String payload}) { + Future.delayed(Duration(seconds: 1)).then((result) async { + var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern()); + var iOSPlatformChannelSpecifics = IOSNotificationDetails(); + var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload); + }); + } + + Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { ///vibrationPattern var vibrationPattern = Int64List(4); vibrationPattern[0] = 0; @@ -19,10 +65,7 @@ class LocalNotification { vibrationPattern[2] = 5000; vibrationPattern[3] = 2000; - var androidPlatformChannelSpecifics = AndroidNotificationDetails( - 'active-prescriptions', - 'ActivePrescriptions', - 'ActivePrescriptionsDescription', + var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', 'ActivePrescriptionsDescription', // icon: 'secondary_icon', sound: RawResourceAndroidNotificationSound('slow_spring_board'), @@ -34,8 +77,7 @@ class LocalNotification { ledColor: const Color.fromARGB(255, 255, 0, 0), ledOnMs: 1000, ledOffMs: 500); - var iOSPlatformChannelSpecifics = - IOSNotificationDetails(sound: 'slow_spring_board.aiff'); + var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); ///change it to be as ionic // var platformChannelSpecifics = NotificationDetails( @@ -45,12 +87,9 @@ class LocalNotification { } ///Repeat notification every day at approximately 10:00:00 am - static Future showDailyAtTime() async { + Future showDailyAtTime() async { var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails( - 'repeatDailyAtTime channel id', - 'repeatDailyAtTime channel name', - 'repeatDailyAtTime description'); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', 'repeatDailyAtTime description'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); @@ -63,12 +102,9 @@ class LocalNotification { } ///Repeat notification weekly on Monday at approximately 10:00:00 am - static Future showWeeklyAtDayAndTime() async { + Future showWeeklyAtDayAndTime() async { var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails( - 'show weekly channel id', - 'show weekly channel name', - 'show weekly description'); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', 'show weekly description'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); @@ -81,15 +117,15 @@ class LocalNotification { // platformChannelSpecifics); } - static String _toTwoDigitString(int value) { + String _toTwoDigitString(int value) { return value.toString().padLeft(2, '0'); } - static Future cancelNotification() async { + Future cancelNotification() async { await flutterLocalNotificationsPlugin.cancel(0); } - static Future cancelAllNotifications() async { + Future cancelAllNotifications() async { await flutterLocalNotificationsPlugin.cancelAll(); } } diff --git a/lib/uitl/PlatformBridge.dart b/lib/uitl/PlatformBridge.dart new file mode 100644 index 00000000..3ad91cdd --- /dev/null +++ b/lib/uitl/PlatformBridge.dart @@ -0,0 +1,152 @@ +import 'dart:developer'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/localized_values.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; + +class PlatformBridge { + static const platform = const MethodChannel("HMG-Platform-Bridge"); + static PlatformBridge _shared; + static BuildContext _context; + + // // Singleton + // static final PlatformBridge _singleton = PlatformBridge._internal(); + // factory PlatformBridge() { + // return _singleton; + // } + // PlatformBridge._internal(); + + static PlatformBridge shared() { + if (_shared == null) { + assert(true, "PlatformBridge is not initialized, (Initialized it by calling 'PlatformBridge.init(BuildContext))'."); + } + return _shared; + } + + static void init(BuildContext context) { + _context = context; + _shared = PlatformBridge(); + + Future incoming(MethodCall methodCall) async { + switch (methodCall.method) { + case 'localizedValue': + String key = methodCall.arguments.toString(); + return localizedValue(key); + + case 'getGeoZones': + return getGeoZones(); + + case 'getLogGeofenceFullUrl': + return getLogGeofenceFullUrl(); + + case 'getDefaultHttpParameters': + return getDefaultHttpParameters(); + + default: + throw MissingPluginException('notImplemented'); + } + } + + platform.setMethodCallHandler(incoming); + } + + //--------------------------------- + // Incoming below + //--------------------------------- + static Future localizedValue(String forKey) async { + String currentLanguage = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Object localized = platformLocalizedValues[forKey][currentLanguage]; + return (localized != null || (localized is String)) ? localized : forKey; + } + + static Future getGeoZones() async { + var res = await sharedPref.getStringWithDefaultValue(HMG_GEOFENCES, "[]"); + return res; + } + + static Future getLogGeofenceFullUrl() async { + var res = BASE_URL + LOG_GEO_ZONES; + return res; + } + + static Future getDefaultHttpParameters() async { + return BaseAppClient.defaultHttpParameters(); + } + + //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// + //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// + + //--------------------------------- + // Outgoing below + //--------------------------------- + // Method Names + static const hmg_internet_wifi_connect_method = "connectHMGInternetWifi"; + static const hmg_guest_wifi_connect_method = "connectHMGGuestWifi"; + static const is_hmg_network_available_method = "isHMGNetworkAvailable"; + static const enable_wifi_if_not = "enableWifiIfNot"; + static const show_loading_method = "loading"; + static const register_Hmg_Geofences = "registerHmgGeofences"; + static const un_register_Hmg_Geofences = "unRegisterHmgGeofences"; + + Future connectHMGInternetWifi(String patientId) { + print("Invoking platform method: $hmg_internet_wifi_connect_method"); + try { + return platform.invokeMethod(hmg_internet_wifi_connect_method, [patientId]); + } on PlatformException catch (e) { + print(e); + return Future.error(e); + } + } + + Future connectHMGGuestWifi() { + print("Invoking platform method: $hmg_guest_wifi_connect_method"); + try { + return platform.invokeMethod(hmg_guest_wifi_connect_method); + } on PlatformException catch (e) { + print(e); + return Future.error(e); + } + } + + Future isHMGNetworkAvailable(String ssid) { + print("Invoking platform method: $is_hmg_network_available_method"); + try { + return platform.invokeMethod(is_hmg_network_available_method, ssid); + } on PlatformException catch (e) { + print(e); + return Future.error(e); + } + } + + Future enableWifiIfNot() async { + print("Invoking platform method: $enable_wifi_if_not"); + try { + return platform.invokeMethod(enable_wifi_if_not); + } on PlatformException catch (e) { + print(e); + return Future.error(e); + } + } + + void showLoading(String message, bool show) async { + print("Invoking platform method: $show_loading_method"); + try { + var result = await platform.invokeMethod(show_loading_method, [message, show]); + } on PlatformException catch (e) { + print(e); + } + } + + // GEO Fences + void registerHmgGeofences() async { + var result = await platform.invokeMethod(register_Hmg_Geofences); + } + + void unRegisterHmgGeofences() async { + var result = await platform.invokeMethod(un_register_Hmg_Geofences); + } +} diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index 8e45e3ce..5c917009 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -64,7 +64,7 @@ class AppToast { FlutterFlexibleToast.showToast( message: message, toastLength: toastLength, - timeInSeconds: timeInSeconds, + timeInSeconds: timeInSeconds=2, fontSize: fontSize, toastGravity: toastGravity, backgroundColor: Colors.green, @@ -87,7 +87,7 @@ class AppToast { static void showErrorToast({ @required String message, Toast toastLength = Toast.LENGTH_LONG, - int timeInSeconds, + int timeInSeconds=2, double fontSize = 16, ToastGravity toastGravity = ToastGravity.TOP, Color textColor = Colors.white, diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 2d963988..460a4066 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -19,24 +19,26 @@ class DateUtil { return DateTime.now(); } - static DateTime convertStringToDateNoTimeZone(String date) { + static DateTime convertStringToDateTime(String date) { if (date != null) { - const start = "/Date("; - const end = ")/"; - final startIndex = date.indexOf(start); - final endIndex = date.indexOf(end, startIndex + start.length); - return DateTime.fromMillisecondsSinceEpoch( - int.parse( - date.substring(startIndex + start.length, endIndex), - ), - ); + try { + var dateT = date.split('/'); + var year = dateT[2].substring(0, 4); + var dateP = + DateTime(int.parse(year), int.parse(dateT[1]), int.parse(dateT[0])); + return dateP; + } catch (e) { + print(e); + } + + return DateTime.now(); } else return DateTime.now(); } static String convertDateToString(DateTime date) { const start = "/Date("; - const end = "+0300)/"; + const end = "+0300)"; int milliseconds = date.millisecondsSinceEpoch; return start + "$milliseconds" + end; @@ -251,6 +253,18 @@ class DateUtil { else return ""; } + /// get data formatted like Apr 26,2020 + /// [dateTime] convert DateTime to data formatted Arabic + static String getMonthDayYearDateFormattedAr(DateTime dateTime) { + if (dateTime != null) + return getMonthArabic(dateTime.month) + + " " + + dateTime.day.toString() + + ", " + + dateTime.year.toString(); + else + return ""; + } /// get data formatted like Thursday, Apr 26,2020 /// [dateTime] convert DateTime to date formatted @@ -276,6 +290,24 @@ class DateUtil { return ""; } + static String getMonthDayYearLangDateFormatted( + DateTime dateTime, String lang) { + if (dateTime != null) + return lang == 'en' + ? getMonth(dateTime.month) + + " " + + dateTime.day.toString() + + " " + + dateTime.year.toString() + : dateTime.day.toString() + + " " + + getMonthArabic(dateTime.month) + + " " + + dateTime.year.toString(); + else + return ""; + } + /// get data formatted like 26/4/2020 /// [dateTime] convert DateTime to data formatted static String getDayMonthYearDateFormatted(DateTime dateTime) { @@ -329,7 +361,7 @@ class DateUtil { return DateFormat(formattedString) .format(dateTime); } - + static convertISODateToJsonDate(String isoDate) { return "/Date(" + DateFormat('mm-dd-yyy') diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index e3012734..c3799425 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -15,12 +15,13 @@ class LocationUtils { void getCurrentLocation() async { print("current location"); - isLocationServiceEnabled().then((value) { + Geolocator.isLocationServiceEnabled().then((value) { if (value) { - checkPermission().then((permission) { + Geolocator.checkPermission().then((permission) { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - getLastKnownPosition().then((value) => setLocation(value)); + Geolocator.getLastKnownPosition() + .then((value) => setLocation(value)); } if (permission == LocationPermission.denied || @@ -48,18 +49,21 @@ class LocationUtils { okFunction: () => { ConfirmDialog.closeAlertDialog(context), if (isPermissionError) - openAppSettings() + Geolocator.openAppSettings() else - openLocationSettings() + Geolocator.openLocationSettings() }, cancelFunction: () => {}); return dialog.showAlertDialog(context); } void setLocation(Position position) { - print(position); - this.sharedPref.setDouble(USER_LAT, position.latitude); - this.sharedPref.setDouble(USER_LONG, position.longitude); + this + .sharedPref + .setDouble(USER_LAT, position != null ? position.latitude : 0.0); + this + .sharedPref + .setDouble(USER_LONG, position != null ? position.longitude : 0.0); } void setZeroLocation() { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index d67a2e98..b84e3c69 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:diplomaticquarterapp/config/localized_values.dart'; +import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; import 'package:flutter/foundation.dart' show SynchronousFuture; import 'package:flutter/material.dart'; @@ -13,8 +14,11 @@ class TranslationBase { return Localizations.of(context, TranslationBase); } - String get dashboardScreenToolbarTitle => - localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; + String by(String key) { + return localizedValues[key][locale.languageCode]; + } + + String get dashboardScreenToolbarTitle => localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; String get settings => localizedValues['settings'][locale.languageCode]; @@ -85,24 +89,19 @@ class TranslationBase { String get bookSuccess => localizedValues['bookSuccess'][locale.languageCode]; - String get patientShare => - localizedValues['patientShare'][locale.languageCode]; + String get patientShare => localizedValues['patientShare'][locale.languageCode]; - String get patientShareWithTax => - localizedValues['patientShareWithTax'][locale.languageCode]; + String get patientShareWithTax => localizedValues['patientShareWithTax'][locale.languageCode]; String get confirmAppo => localizedValues['confirmAppo'][locale.languageCode]; String get confirm => localizedValues['confirm'][locale.languageCode]; - String get confirmLiveCare => - localizedValues['confirmLiveCare'][locale.languageCode]; + String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode]; - String get waitingForDoctor => - localizedValues['waitingForDoctor'][locale.languageCode]; + String get waitingForDoctor => localizedValues['waitingForDoctor'][locale.languageCode]; - String get confirmLater => - localizedValues['confirmLater'][locale.languageCode]; + String get confirmLater => localizedValues['confirmLater'][locale.languageCode]; String get todoList => localizedValues['todoList'][locale.languageCode]; @@ -118,8 +117,7 @@ class TranslationBase { String get login => localizedValues['login'][locale.languageCode]; - String get loginregister => - localizedValues['loginregister'][locale.languageCode]; + String get loginregister => localizedValues['loginregister'][locale.languageCode]; String get poweredBy => localizedValues['poweredBy'][locale.languageCode]; @@ -128,8 +126,7 @@ class TranslationBase { String get welcomeText => localizedValues['welcome_text'][locale.languageCode]; - String get welcomeText2 => - localizedValues['welcome_text2'][locale.languageCode]; + String get welcomeText2 => localizedValues['welcome_text2'][locale.languageCode]; String get yes => localizedValues['yes'][locale.languageCode]; @@ -221,6 +218,8 @@ class TranslationBase { 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]; @@ -289,24 +288,17 @@ class TranslationBase { String get appsetting => localizedValues['app-settings'][locale.languageCode]; String get rateApp => localizedValues['rate-app'][locale.languageCode]; - String get setReminder => - localizedValues['set-reminder'][locale.languageCode]; + String get setReminder => localizedValues['set-reminder'][locale.languageCode]; String get before => localizedValues['before'][locale.languageCode]; String get minute => localizedValues['minute'][locale.languageCode]; String get hour => localizedValues['hour'][locale.languageCode]; - String get reminderSuccess => - localizedValues['reminderSuccess'][locale.languageCode]; - String get patientShareToDo => - localizedValues['patientShareToDo'][locale.languageCode]; - String get patientTaxToDo => - localizedValues['patientTaxToDo'][locale.languageCode]; - String get patientShareTotalToDo => - localizedValues['patientShareTotalToDo'][locale.languageCode]; - String get paymentMethod => - localizedValues['paymentMethod'][locale.languageCode]; - - String get moreVerification => - localizedValues['more-verify'][locale.languageCode]; + String get reminderSuccess => localizedValues['reminderSuccess'][locale.languageCode]; + String get patientShareToDo => localizedValues['patientShareToDo'][locale.languageCode]; + String get patientTaxToDo => localizedValues['patientTaxToDo'][locale.languageCode]; + String get patientShareTotalToDo => localizedValues['patientShareTotalToDo'][locale.languageCode]; + String get paymentMethod => localizedValues['paymentMethod'][locale.languageCode]; + + String get moreVerification => localizedValues['more-verify'][locale.languageCode]; String get welcomeBack => localizedValues['welcome-back'][locale.languageCode]; @@ -336,15 +328,11 @@ class TranslationBase { String get booked => localizedValues['booked'][locale.languageCode]; String get confirmed => localizedValues['confirmed'][locale.languageCode]; String get arrived => localizedValues['arrived'][locale.languageCode]; - String get payNowBookSuccess => - localizedValues['payNowBookSuccess'][locale.languageCode]; - String get payNowBookSuccesstext1 => - localizedValues['payNowBookSuccesstext1'][locale.languageCode]; - String get payNowBookSuccesstext2 => - localizedValues['payNowBookSuccesstext2'][locale.languageCode]; + String get payNowBookSuccess => localizedValues['payNowBookSuccess'][locale.languageCode]; + String get payNowBookSuccesstext1 => localizedValues['payNowBookSuccesstext1'][locale.languageCode]; + String get payNowBookSuccesstext2 => localizedValues['payNowBookSuccesstext2'][locale.languageCode]; String get payLater => localizedValues['payLater'][locale.languageCode]; - String get askDocNotAllowed => - localizedValues['askDocNotAllowed'][locale.languageCode]; + String get askDocNotAllowed => localizedValues['askDocNotAllowed'][locale.languageCode]; String get firstName => localizedValues['first-name'][locale.languageCode]; String get middleName => localizedValues['middle-name'][locale.languageCode]; @@ -355,15 +343,13 @@ class TranslationBase { String get female => localizedValues['female'][locale.languageCode]; - String get prefferedLanguage => - localizedValues['preferred-language'][locale.languageCode]; + String get prefferedLanguage => localizedValues['preferred-language'][locale.languageCode]; String get english => localizedValues['english'][locale.languageCode]; String get arabic => localizedValues['arabic'][locale.languageCode]; - String get registrLocation => - localizedValues['locations-register'][locale.languageCode]; + String get registrLocation => localizedValues['locations-register'][locale.languageCode]; String get ksa => localizedValues['ksa'][locale.languageCode]; @@ -373,8 +359,7 @@ class TranslationBase { String get family => localizedValues['family'][locale.languageCode]; - String get myFamilyFiles => - localizedValues['family-title'][locale.languageCode]; + String get myFamilyFiles => localizedValues['family-title'][locale.languageCode]; String get myFamily => localizedValues['myFamily'][locale.languageCode]; String get oxygenation => localizedValues['oxygenation'][locale.languageCode]; @@ -455,16 +440,13 @@ class TranslationBase { 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]; - String get viewAllWaysReachUs => - localizedValues['ViewAllWaysReachUs'][locale.languageCode]; - String get medicalProfile => - localizedValues['medicalProfile'][locale.languageCode]; + String get viewAllWaysReachUs => localizedValues['ViewAllWaysReachUs'][locale.languageCode]; + String get medicalProfile => localizedValues['medicalProfile'][locale.languageCode]; String get parking => localizedValues['parking'][locale.languageCode]; - String get alhabiServices => - localizedValues['alhabiServices'][locale.languageCode]; - String get parkingTitle => - localizedValues['parkingTitle'][locale.languageCode]; + String get alhabiServices => localizedValues['alhabiServices'][locale.languageCode]; + String get parkingTitle => localizedValues['parkingTitle'][locale.languageCode]; String get readBarcode => localizedValues['readBarcode'][locale.languageCode]; String get showMyPark => localizedValues['showMyPark'][locale.languageCode]; String get clearMyData => localizedValues['clearMyData'][locale.languageCode]; @@ -472,8 +454,7 @@ class TranslationBase { String get gate => localizedValues['gate'][locale.languageCode]; String get building => localizedValues['building'][locale.languageCode]; String get branch => localizedValues['branch'][locale.languageCode]; - String get emergencyServices => - localizedValues['emergencyServices'][locale.languageCode]; + String get emergencyServices => localizedValues['emergencyServices'][locale.languageCode]; String get nearester => localizedValues['nearester'][locale.languageCode]; String get locationa => localizedValues['locationa'][locale.languageCode]; String get ambulancerequest => @@ -735,7 +716,14 @@ class TranslationBase { String get orderDetail => localizedValues['orderDetail'][locale.languageCode]; String get subtotal => localizedValues['subtotal'][locale.languageCode]; String get shipping => localizedValues['shipping'][locale.languageCode]; + String get shipBy => localizedValues['shipBy'][locale.languageCode]; + String get lakumPoints => localizedValues['lakumPoints'][locale.languageCode]; + String get use => localizedValues['use'][locale.languageCode]; + String get proceedPay => localizedValues['proceedPay'][locale.languageCode]; String get vat => localizedValues['vat'][locale.languageCode]; + String get inclusiveVat => localizedValues['inclusiveVat'][locale.languageCode]; + String get items => localizedValues['items'][locale.languageCode]; + String get checkOut => localizedValues['checkOut'][locale.languageCode]; String get total => localizedValues['total'][locale.languageCode]; String get sar => localizedValues['sar'][locale.languageCode]; String get payOnline => localizedValues['payOnline'][locale.languageCode]; @@ -986,8 +974,11 @@ class TranslationBase { String get searchItemError => localizedValues['searchItemError'][locale.languageCode]; String get youCanFind => localizedValues['YouCanFind'][locale.languageCode]; - String get itemInSearch => - localizedValues['ItemInSearch'][locale.languageCode]; + String get itemInSearch => localizedValues['ItemInSearch'][locale.languageCode]; + String get wantToConnectWithHmgNetwork => localizedValues['wantConnectHmgNetwork'][locale.languageCode]; + String get failedToAccessHmgServices => localizedValues['failedToAccessHmgServices'][locale.languageCode]; + 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]; @@ -999,16 +990,226 @@ class TranslationBase { String get range => localizedValues['range'][locale.languageCode]; String get outpatient => localizedValues['out-patient'][locale.languageCode]; String get inPatient => localizedValues['in-patient'][locale.languageCode]; + String get liveCare => localizedValues['liveCare'][locale.languageCode]; String get report => localizedValues['report'][locale.languageCode]; String get openRad => localizedValues['open-rad'][locale.languageCode]; String get sendCopyRad => localizedValues['send-copy'][locale.languageCode]; - String get vaccination => localizedValues['vaccination'][locale.languageCode]; - String get welcomeBackV => - localizedValues['welcomeBack'][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 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 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 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 toHospital => localizedValues['to-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 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 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 wheelchair => localizedValues['wheelchair'][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 directions => localizedValues['directions'][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 pharmacy => localizedValues['pharmacy'][locale.languageCode]; + String get ereferral => localizedValues['ereferral'][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 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 latestNews => localizedValues['latest-news'][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]; + String get hmg => localizedValues['hmg'][locale.languageCode]; + 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 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 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 start => localizedValues['start'][locale.languageCode]; + String get infoChat => localizedValues['info-chat'][locale.languageCode]; + + String get noRecords => localizedValues['empty'][locale.languageCode]; + String get lastVisit => localizedValues['last-visit'][locale.languageCode]; + 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 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 theName => localizedValues['thename'][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 gallery => localizedValues['gallery'][locale.languageCode]; + String get camera => localizedValues['camera'][locale.languageCode]; + String get medReport => localizedValues['med-report'][locale.languageCode]; + String get newMedReport => localizedValues['new-med-report'][locale.languageCode]; + String get requestReport => localizedValues['requestReport'][locale.languageCode]; + String get confirmMsgReport => localizedValues['confirm-msg-report'][locale.languageCode]; + String get successSendReport => localizedValues['successSendReport'][locale.languageCode]; + String get pulseTitle => localizedValues['pulseTitle'][locale.languageCode]; + String get systolicLng => localizedValues['systolic-lng'][locale.languageCode]; + String get diastolicLng => localizedValues['diastolic-lng'][locale.languageCode]; + String get policyHolder => localizedValues['policy-holder'][locale.languageCode]; + String get policyNo => localizedValues['policy-no'][locale.languageCode]; + String get expiryDateTitle => localizedValues['expiry-date'][locale.languageCode]; + String get classTitle => localizedValues['class'][locale.languageCode]; + String get approval => localizedValues['approval'][locale.languageCode]; + String get agree => localizedValues['agree'][locale.languageCode]; + String get disagree => localizedValues['disagree'][locale.languageCode]; + String get requestSent => localizedValues['request-sent'][locale.languageCode]; + String get attachInsuraceImage => localizedValues['attach-insurace-image'][locale.languageCode]; + 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 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 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 topBrands => localizedValues['topBrands'][locale.languageCode]; + String get notifyMe => localizedValues['notifyMe'][locale.languageCode]; + String get specification => localizedValues['specification'][locale.languageCode]; + String get availability => localizedValues['availability'][locale.languageCode]; + String get quantitySize => localizedValues['quantitySize'][locale.languageCode]; + String get addToCart => localizedValues['addToCart'][locale.languageCode]; + 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 => @@ -1044,32 +1245,7 @@ class TranslationBase { String get shoppingCart => localizedValues['shoppingCart'][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 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]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 3e1e4892..58ef9421 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -2,10 +2,37 @@ import 'dart:convert'; import 'dart:core'; import 'dart:typed_data'; +import 'package:badges/badges.dart'; import 'package:connectivity/connectivity.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/medical/active_medications/ActiveMedicationsPage.dart'; +import 'package:diplomaticquarterapp/pages/medical/allergies_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/ask_doctor/ask_doctor_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/eye/EyeMeasurementsPage.dart'; +import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/my_trackers.dart'; +import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart'; +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/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../Constants.dart'; import 'app_shared_preferences.dart'; import 'app_toast.dart'; @@ -160,7 +187,340 @@ class Utils { .hasMatch(email); } + static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) { + List medical = List(); + if (projectViewModel.havePrivilege(5)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: MyAppointments(), + ), + ); + }, + child: isLogin + ? Container( + height: 120, + child: Stack(children: [ + MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + ), + Positioned( + right: 0.0, + child: Badge( + toAnimate: false, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: + TextStyle(color: Colors.white, fontSize: 16.0)), + ), + ), + ), + ]), + ) + : MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + ), + )); + } + if (projectViewModel.havePrivilege(10)) { + medical.add(InkWell( + onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).lab, + imagePath: 'lab_result_icon.png', + subTitle: TranslationBase.of(context).labSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(7)) { + medical.add(InkWell( + onTap: () => + Navigator.push(context, FadePage(page: RadiologyHomePage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).radiology, + imagePath: 'radiology_icon.png', + subTitle: TranslationBase.of(context).radiologySubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(12)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HomePrescriptionsPage(), + ), + ); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).medicines, + imagePath: 'prescription_icon.png', + subTitle: TranslationBase.of(context).medicinesSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(25)) { + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: VitalSignDetailsScreen(), + ), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).vitalSigns, + imagePath: 'vital_signs.png', + subTitle: TranslationBase.of(context).vitalSignsSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(48)) { + medical.add(InkWell( + onTap: () => + Navigator.push(context, FadePage(page: ActiveMedicationsPage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).myMedical, + imagePath: 'active_medications.png', + subTitle: TranslationBase.of(context).myMedicalSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(6)) { + medical.add(InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: DoctorHomePage(), + ), + ); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myDoctor, + imagePath: 'doctor_icon.png', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(14)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: EyeMeasurementsPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).eye, + imagePath: 'eye_measurement_icon.png', + subTitle: TranslationBase.of(context).eyeSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(22)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceCard())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).insurance, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).insuranceSubtitle, + ), + )); + } + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceUpdate())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).updateInsurance, + imagePath: 'insurance_update_icon_.png', + subTitle: TranslationBase.of(context).updateInsuranceSubtitle, + ), + )); + + if (projectViewModel.havePrivilege(18)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceApproval())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).insuranceApproval, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).insuranceApprovalSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(23)) { + medical.add(InkWell( + onTap: () => Navigator.push(context, FadePage(page: AllergiesPage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).allergies, + imagePath: 'my_allergies_icon.png', + subTitle: TranslationBase.of(context).allergiesSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(26)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyVaccines())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myVaccines, + imagePath: 'my_vaccines_icon.png', + subTitle: TranslationBase.of(context).myVaccinesSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(20)) + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: HomeReportPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).medical, + imagePath: 'medical_reports_icon.png', + subTitle: TranslationBase.of(context).medicalSubtitle, + ), + )); + + if (projectViewModel.havePrivilege(19)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MonthlyReportsPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).monthly, + imagePath: 'monthly_reports_icon.png', + subTitle: TranslationBase.of(context).monthlySubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(16)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: PatientSickLeavePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).sick, + imagePath: 'sick_leaves_icons.png', + subTitle: TranslationBase.of(context).sickSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(47)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyBalancePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myBalance, + imagePath: 'check-in.png', + subTitle: TranslationBase.of(context).myBalanceSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(61)) { + medical.add(MedicalProfileItem( + title: TranslationBase.of(context).patientCall, + imagePath: 'medical_history_icon.png', + subTitle: TranslationBase.of(context).patientCallSubtitle, + )); + } + + if (projectViewModel.havePrivilege(24)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyTrackers())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myTrackers, + imagePath: 'my_tracker_icon.png', + subTitle: TranslationBase.of(context).myTrackersSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(30)) + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: SmartWatchInstructions())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).smartWatches, + imagePath: 'smartwatch_icon.png', + subTitle: TranslationBase.of(context).smartWatchesSubtitle, + ), + )); + + if (projectViewModel.havePrivilege(28)) { + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: AskDoctorHomPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).askYour, + imagePath: 'ask_doctor_icon.png', + subTitle: TranslationBase.of(context).askYourSubtitle, + ), + )); + } + if (projectViewModel.havePrivilege(32)) { + medical.add(InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: TranslationBase.of(context).internet, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).internetSubtitle, + ), + )); + } + + if (projectViewModel.havePrivilege(40)) { + medical.add(InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: TranslationBase.of(context).chatbot, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).chatbotSubtitle, + ), + )); + } + + return medical; + } } + // 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/Loader/gif_loader_container.dart b/lib/widgets/Loader/gif_loader_container.dart index 06c151c9..b7a20339 100644 --- a/lib/widgets/Loader/gif_loader_container.dart +++ b/lib/widgets/Loader/gif_loader_container.dart @@ -36,7 +36,7 @@ class _GifLoaderContainerState extends State child: GifImage( controller: controller1, image: AssetImage( - "assets/images/progress-loading.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), + "assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), ), )); } diff --git a/lib/widgets/avatar/large_avatar.dart b/lib/widgets/avatar/large_avatar.dart index ed904d03..fcfcaa94 100644 --- a/lib/widgets/avatar/large_avatar.dart +++ b/lib/widgets/avatar/large_avatar.dart @@ -37,7 +37,7 @@ class LargeAvatar extends StatelessWidget { borderRadius: BorderRadius.all(Radius.circular(radius)), child: Image.network( url.trim(), - fit: BoxFit.cover, + fit: BoxFit.fill, width: width, height: height, ), diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index 21cbebba..66a83224 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -1,9 +1,15 @@ +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../d_q_icons_icons.dart'; import 'bottom_navigation_item.dart'; @@ -20,12 +26,31 @@ class BottomNavBar extends StatefulWidget { class _BottomNavBarState extends State { int _index = 0; + ToDoCountProviderModel model; + AuthenticatedUserObject authenticatedUserObject = + locator(); + _changeIndex(int index) { - widget.changeIndex(index); + if (index != 4) + widget.changeIndex(index); + else { + if (authenticatedUserObject.isLogin) { + if (model.count != 0) { + widget.changeIndex(index); + } else { + AppToast.showErrorToast( + message: TranslationBase.of(context).upcomingEmpty); + } + } else { + widget.changeIndex(index); + } + } } @override Widget build(BuildContext context) { + model = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); return BottomAppBar( elevation: 4, shape: CircularNotchedRectangle(), @@ -52,7 +77,7 @@ class _BottomNavBarState extends State { currentIndex: 1, name: TranslationBase.of(context).medicalProfile, ), - if(widget.index == 0) + if(widget.index == 0 && projectViewModel.havePrivilege(34)) Expanded( child: SizedBox( height: 50, @@ -65,7 +90,7 @@ class _BottomNavBarState extends State { ), ), ), - if(widget.index != 0) + if(widget.index != 0 && projectViewModel.havePrivilege(34)) BottomNavigationItem( icon: EvaIcons.calendar, activeIcon: EvaIcons.calendar, @@ -83,6 +108,7 @@ class _BottomNavBarState extends State { currentIndex: 3, name: TranslationBase.of(context).myFamily, ), + if(projectViewModel.havePrivilege(51)) BottomNavigationItem( icon: EvaIcons.calendar, activeIcon: EvaIcons.calendar, @@ -103,6 +129,7 @@ class _BottomNavBarState extends State { } Future navigateToToDoList(context) async { - Navigator.push(context, MaterialPageRoute(builder: (context) => ToDo())); + Navigator.push(context, + MaterialPageRoute(builder: (context) => ToDo(isShowAppBar: false))); } } diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index 31ed59dc..391b6a3d 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -8,6 +8,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../Constants.dart'; + class BottomNavigationItem extends StatelessWidget { final IconData icon; final IconData activeIcon; @@ -49,7 +51,7 @@ class BottomNavigationItem extends StatelessWidget { Container( child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index - ? Theme.of(context).primaryColor + ? secondaryColor : Theme.of(context).dividerColor, size: 22.0), ), @@ -60,7 +62,7 @@ class BottomNavigationItem extends StatelessWidget { name, textAlign: TextAlign.center, color: currentIndex == index - ? Theme.of(context).primaryColor + ? secondaryColor : Colors.grey, fontSize: 11, ), @@ -69,7 +71,7 @@ class BottomNavigationItem extends StatelessWidget { ), ], ) - : authenticatedUserObject.isLogin + : (authenticatedUserObject.isLogin && model.isShowBadge) ? Stack( alignment: AlignmentDirectional.center, children: [ @@ -80,8 +82,7 @@ class BottomNavigationItem extends StatelessWidget { toAnimate: false, position: BadgePosition.topEnd(), shape: BadgeShape.circle, - badgeColor: Colors - .red[800].withOpacity(1.0), + badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), @@ -102,7 +103,7 @@ class BottomNavigationItem extends StatelessWidget { child: Icon( currentIndex == index ? activeIcon : icon, color: currentIndex == index - ? Theme.of(context).primaryColor + ? secondaryColor : Theme.of(context).dividerColor, size: 22.0), ), @@ -135,7 +136,7 @@ class BottomNavigationItem extends StatelessWidget { child: Icon( currentIndex == index ? activeIcon : icon, color: currentIndex == index - ? Theme.of(context).primaryColor + ? secondaryColor : Theme.of(context).dividerColor, size: 22.0), ), @@ -146,7 +147,7 @@ class BottomNavigationItem extends StatelessWidget { name, textAlign: TextAlign.center, color: currentIndex == index - ? Theme.of(context).primaryColor + ? secondaryColor : Colors.grey, fontSize: 11, ), diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart index f8a99c17..7bbadd8c 100644 --- a/lib/widgets/bottom_options/BottomSheet.dart +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -1,13 +1,14 @@ import 'dart:convert'; import 'dart:io'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:feather_icons_flutter/feather_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; class ImageOptions { - static showImageOptions(BuildContext context, Function(String) image) { + static showImageOptions(BuildContext context, Function(String,File) image,) { showModalBottomSheet( backgroundColor: Colors.transparent, context: context, @@ -15,10 +16,10 @@ class ImageOptions { return _BottomSheet( children: [ _BottomSheetItem( - title: "Select file source", + title: TranslationBase.of(context).selectFileSouse, ), _BottomSheetItem( - title: "Gallery", + title: TranslationBase.of(context).gallery, icon: FeatherIcons.image, onTap: () async { File _image = @@ -27,12 +28,12 @@ class ImageOptions { final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); if (base64Encode != null) { - image(base64Encode); + image(base64Encode,_image); } }, ), _BottomSheetItem( - title: "Camera", + title: TranslationBase.of(context).camera, icon: FeatherIcons.camera, onTap: () async { File _image = @@ -41,13 +42,15 @@ class ImageOptions { final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); if (base64Encode != null) { - image(base64Encode); + image(base64Encode,_image); } }, ), _BottomSheetItem( - title: "Cancel", - onTap: (){}, + title: TranslationBase.of(context).cancel, + onTap: (){ + + }, ) ], ); diff --git a/lib/widgets/buttons/GestureIconButton.dart b/lib/widgets/buttons/GestureIconButton.dart index 62265985..841d7ea6 100644 --- a/lib/widgets/buttons/GestureIconButton.dart +++ b/lib/widgets/buttons/GestureIconButton.dart @@ -3,12 +3,12 @@ import 'package:flutter/material.dart'; class GestureIconButton extends StatefulWidget { GestureIconButton( - this.label, - this.icon, { - Key key, - this.onTap, - this.backgroundColor, - }) : super(key: key); + this.label, + this.icon, { + Key key, + this.onTap, + this.backgroundColor, + }) : super(key: key); final String label; final Widget icon; @@ -29,7 +29,6 @@ class _GestureIconButtonState extends State { setState(() => _buttonLongPress = !_buttonLongPress), onLongPressEnd: (_) => setState(() => _buttonLongPress = !_buttonLongPress), - onTap: () => {widget.onTap()}, child: Wrap( children: [ Container( diff --git a/lib/widgets/buttons/borderedButton.dart b/lib/widgets/buttons/borderedButton.dart index e297a10e..b0bbdaf0 100644 --- a/lib/widgets/buttons/borderedButton.dart +++ b/lib/widgets/buttons/borderedButton.dart @@ -18,6 +18,7 @@ class BorderedButton extends StatelessWidget { final double fontSize; final Widget icon; final FontWeight fontWeight; + final bool hasShadow; BorderedButton( this.text, { @@ -36,6 +37,7 @@ class BorderedButton extends StatelessWidget { this.fontSize = 0, this.icon, this.fontWeight, + this.hasShadow = false, }); @override @@ -46,14 +48,21 @@ class BorderedButton extends StatelessWidget { }, child: Container( decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: backgroundColor ?? Colors.white, - borderRadius: BorderRadius.circular(radius), - border: Border.fromBorderSide(BorderSide( - color: hasBorder ? borderColor : Colors.white, - width: 0.8, - )), - ), + shape: BoxShape.rectangle, + color: backgroundColor ?? Colors.white, + borderRadius: BorderRadius.circular(radius), + border: Border.fromBorderSide(BorderSide( + color: hasBorder ? borderColor : Colors.white, + width: 0.8, + )), + boxShadow: [ + BoxShadow( + color: !hasShadow ? Colors.transparent : Colors.grey.withOpacity(0.5), + // spreadRadius: 5, + blurRadius: 15.0, + offset: Offset(0.0, 0.75) // changes position of shadow + ), + ]), child: Container( child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -69,8 +78,11 @@ class BorderedButton extends StatelessWidget { text, textAlign: TextAlign.center, style: TextStyle( - fontSize: fontSize == 0 ? SizeConfig.textMultiplier * 1.6 : fontSize, - fontWeight: fontWeight != null ? fontWeight : FontWeight.normal, + fontSize: fontSize == 0 + ? SizeConfig.textMultiplier * 1.6 + : fontSize, + fontWeight: + fontWeight != null ? fontWeight : FontWeight.normal, color: textColor ?? Color(0xffc4aa54)), ), ), diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart index 457a1d42..5d7c9257 100644 --- a/lib/widgets/buttons/button.dart +++ b/lib/widgets/buttons/button.dart @@ -1,7 +1,9 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; /// Button widget /// [label] button label @@ -80,6 +82,7 @@ class _ButtonState extends State