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 e4d2cb78..7a09b3ca 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,12 +26,6 @@ apply plugin: 'kotlin-android' apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" -def keystoreProperties = new Properties() -def keystorePropertiesFile = rootProject.file('key.properties') -if (keystorePropertiesFile.exists()) { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} - android { compileSdkVersion 30 @@ -40,9 +34,7 @@ android { } lintOptions { -// disable 'InvalidPackage' - checkReleaseBuilds false - abortOnError false + disable 'InvalidPackage' } defaultConfig { @@ -56,35 +48,21 @@ android { } - signingConfigs { - release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null - storePassword keystoreProperties['storePassword'] - } - } - buildTypes { debug {} 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 -// useProguard true - -// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - - signingConfigs.release + signingConfig signingConfigs.debug + } + staging { + // Specifies a sorted list of fallback build types that the + // plugin should try to use when a dependency does not include a + // "staging" build type. You may specify as many fallbacks as you + // like, and the plugin selects the first build type that's + // available in the dependency. + matchingFallbacks = ['debug', 'qa', 'release'] } -// staging { -// // Specifies a sorted list of fallback build types that the -// // plugin should try to use when a dependency does not include a -// // "staging" build type. You may specify as many fallbacks as you -// // like, and the plugin selects the first build type that's -// // available in the dependency. -// matchingFallbacks = ['debug', 'qa', 'release'] -// } } } @@ -94,15 +72,28 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "com.google.firebase:firebase-messaging:20.3.0" + implementation "com.google.firebase:firebase-messaging:21.0.0" +// implementation ('com.google.firebase:firebase-inappmessaging-display:19.1.2',{ +// exclude group: 'com.google.protobuf',module: 'protobuf-javalite' +// 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.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' + // 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/google-services.json b/android/app/google-services.json index a4655794..f86832ad 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,37 +1,39 @@ { "project_info": { - "project_number": "864393916058", - "firebase_url": "https://diplomaticquarter-d2385.firebaseio.com", - "project_id": "diplomaticquarter-d2385", - "storage_bucket": "diplomaticquarter-d2385.appspot.com" + "project_number": "815750722565", + "firebase_url": "https://api-project-815750722565.firebaseio.com", + "project_id": "api-project-815750722565", + "storage_bucket": "api-project-815750722565.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:864393916058:android:5b5a65cd6d8c18b4b97923", + "mobilesdk_app_id": "1:815750722565:android:62281cd3e5df4063", "android_client_info": { "package_name": "com.cloud.diplomaticquarterapp" } }, "oauth_client": [ { - "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com", + "client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyBdV3mos1BPhUzNKCj2KANJtiO3o2zh9IM" + "current_key": "AIzaSyDUfg6AKM1-00WyzpvLImUBC46wFrq9-qw" } ], "services": { + "analytics_service": { + "status": 1 + }, "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com", - "client_type": 3 - } - ] + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 } } } 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 12ced804..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,11 +21,19 @@ + + + + + + + + + android:label="diplomaticquarterapp"> - @@ -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 100644 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 100644 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..ceecd65b --- /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 = json?.let { GeoZoneModel().listFrom(it) } + 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/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index 81bc6ebb..db77bb4b 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index a35f0ed7..17987b79 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 4bfdccb8..09d43914 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index fc595a38..d5f1c8d3 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 605c7e4a..4d6372ee 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml new file mode 100644 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/build.gradle b/android/build.gradle index 8c57e18a..433bc8ad 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,9 +6,9 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.6.2' + classpath 'com.android.tools.build:gradle:4.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.google.gms:google-services:4.3.2' + classpath 'com.google.gms:google-services:4.3.4' } } 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/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 5ffeb56f..c935be88 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Nov 25 14:25:50 AST 2020 +#Thu Sep 03 16:26:30 EEST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/assets/images/DQ/logo.png b/assets/images/DQ/logo.png new file mode 100644 index 00000000..29719b35 Binary files /dev/null and b/assets/images/DQ/logo.png differ diff --git a/assets/images/DQ/logo_big.png b/assets/images/DQ/logo_big.png new file mode 100644 index 00000000..0d9e4a56 Binary files /dev/null and b/assets/images/DQ/logo_big.png differ 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/covid-19-car.svg b/assets/images/new-design/covid-19-car.svg new file mode 100644 index 00000000..b5c9cb85 --- /dev/null +++ b/assets/images/new-design/covid-19-car.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new-design/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/no_image.png b/assets/images/no_image.png new file mode 100644 index 00000000..ebe05472 Binary files /dev/null and b/assets/images/no_image.png differ diff --git a/assets/images/offer.png b/assets/images/offer.png new file mode 100644 index 00000000..b9977670 Binary files /dev/null and b/assets/images/offer.png differ diff --git a/assets/images/offer_ar.png b/assets/images/offer_ar.png new file mode 100644 index 00000000..1fdbf749 Binary files /dev/null and b/assets/images/offer_ar.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/pharmacy/Group 1206.svg b/assets/images/pharmacy/Group 1206.svg new file mode 100644 index 00000000..ef8f7473 --- /dev/null +++ b/assets/images/pharmacy/Group 1206.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/Group 1207.svg b/assets/images/pharmacy/Group 1207.svg new file mode 100644 index 00000000..fd2ffd41 --- /dev/null +++ b/assets/images/pharmacy/Group 1207.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/Logo Parmacy-green.png b/assets/images/pharmacy/Logo Parmacy-green.png new file mode 100644 index 00000000..72862b33 Binary files /dev/null and b/assets/images/pharmacy/Logo Parmacy-green.png differ diff --git a/assets/images/pharmacy/aramex_shipping_logo.svg b/assets/images/pharmacy/aramex_shipping_logo.svg new file mode 100644 index 00000000..30cc03b8 --- /dev/null +++ b/assets/images/pharmacy/aramex_shipping_logo.svg @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/assets/images/pharmacy/arrow-left-png.png b/assets/images/pharmacy/arrow-left-png.png new file mode 100644 index 00000000..18d58c87 Binary files /dev/null and b/assets/images/pharmacy/arrow-left-png.png differ diff --git a/assets/images/pharmacy/arrow-left.png b/assets/images/pharmacy/arrow-left.png new file mode 100644 index 00000000..18d58c87 Binary files /dev/null and b/assets/images/pharmacy/arrow-left.png differ diff --git a/assets/images/pharmacy/arrow-right-png.png b/assets/images/pharmacy/arrow-right-png.png new file mode 100644 index 00000000..19af7c0b Binary files /dev/null and b/assets/images/pharmacy/arrow-right-png.png differ diff --git a/assets/images/pharmacy/arrow.png b/assets/images/pharmacy/arrow.png new file mode 100644 index 00000000..19af7c0b Binary files /dev/null and b/assets/images/pharmacy/arrow.png differ diff --git a/assets/images/pharmacy/arrow_lef.png b/assets/images/pharmacy/arrow_lef.png new file mode 100644 index 00000000..19af7c0b Binary files /dev/null and b/assets/images/pharmacy/arrow_lef.png differ diff --git a/assets/images/pharmacy/arrow_left.svg b/assets/images/pharmacy/arrow_left.svg new file mode 100644 index 00000000..00fa7556 --- /dev/null +++ b/assets/images/pharmacy/arrow_left.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/arrow_right.svg b/assets/images/pharmacy/arrow_right.svg new file mode 100644 index 00000000..b4243287 --- /dev/null +++ b/assets/images/pharmacy/arrow_right.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/check_icon.svg b/assets/images/pharmacy/check_icon.svg new file mode 100644 index 00000000..cfa4f441 --- /dev/null +++ b/assets/images/pharmacy/check_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/compare.png b/assets/images/pharmacy/compare.png new file mode 100644 index 00000000..11a49dfb Binary files /dev/null and b/assets/images/pharmacy/compare.png differ diff --git a/assets/images/pharmacy/contact_us_icon.svg b/assets/images/pharmacy/contact_us_icon.svg new file mode 100644 index 00000000..fa591d47 --- /dev/null +++ b/assets/images/pharmacy/contact_us_icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/pharmacy/credit_card_icon.svg b/assets/images/pharmacy/credit_card_icon.svg new file mode 100644 index 00000000..9ba6c2bf --- /dev/null +++ b/assets/images/pharmacy/credit_card_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/delete_red_icon.svg b/assets/images/pharmacy/delete_red_icon.svg new file mode 100644 index 00000000..8897a683 --- /dev/null +++ b/assets/images/pharmacy/delete_red_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/edit_icon.svg b/assets/images/pharmacy/edit_icon.svg new file mode 100644 index 00000000..df7cca2f --- /dev/null +++ b/assets/images/pharmacy/edit_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/empty_box.svg b/assets/images/pharmacy/empty_box.svg new file mode 100644 index 00000000..05816608 --- /dev/null +++ b/assets/images/pharmacy/empty_box.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/hmg_shipping_greenlogo.svg b/assets/images/pharmacy/hmg_shipping_greenlogo.svg new file mode 100644 index 00000000..449712a5 --- /dev/null +++ b/assets/images/pharmacy/hmg_shipping_greenlogo.svg @@ -0,0 +1,25 @@ + + + diff --git a/assets/images/pharmacy/hmg_shipping_logo.svg b/assets/images/pharmacy/hmg_shipping_logo.svg new file mode 100644 index 00000000..8e9db3d6 --- /dev/null +++ b/assets/images/pharmacy/hmg_shipping_logo.svg @@ -0,0 +1,17 @@ + + + diff --git a/assets/images/pharmacy/lakum_icon.svg b/assets/images/pharmacy/lakum_icon.svg new file mode 100644 index 00000000..e2b223de --- /dev/null +++ b/assets/images/pharmacy/lakum_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/medication_refill_icon.svg b/assets/images/pharmacy/medication_refill_icon.svg new file mode 100644 index 00000000..d5951130 --- /dev/null +++ b/assets/images/pharmacy/medication_refill_icon.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/mobile_number_icon.svg b/assets/images/pharmacy/mobile_number_icon.svg new file mode 100644 index 00000000..d98aaf29 --- /dev/null +++ b/assets/images/pharmacy/mobile_number_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/my_family_icon.svg b/assets/images/pharmacy/my_family_icon.svg new file mode 100644 index 00000000..838b357e --- /dev/null +++ b/assets/images/pharmacy/my_family_icon.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/my_prescription_icon.svg b/assets/images/pharmacy/my_prescription_icon.svg new file mode 100644 index 00000000..bda0e22e --- /dev/null +++ b/assets/images/pharmacy/my_prescription_icon.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/orders_icon.svg b/assets/images/pharmacy/orders_icon.svg new file mode 100644 index 00000000..f09ae19d --- /dev/null +++ b/assets/images/pharmacy/orders_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/our_locations_icon.svg b/assets/images/pharmacy/our_locations_icon.svg new file mode 100644 index 00000000..2be16631 --- /dev/null +++ b/assets/images/pharmacy/our_locations_icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/pharmacy/pill_reminder_icon.svg b/assets/images/pharmacy/pill_reminder_icon.svg new file mode 100644 index 00000000..f4fb4ddc --- /dev/null +++ b/assets/images/pharmacy/pill_reminder_icon.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/quote_end.svg b/assets/images/pharmacy/quote_end.svg new file mode 100644 index 00000000..083ff39a --- /dev/null +++ b/assets/images/pharmacy/quote_end.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/quote_start.svg b/assets/images/pharmacy/quote_start.svg new file mode 100644 index 00000000..74216f14 --- /dev/null +++ b/assets/images/pharmacy/quote_start.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/review_icon.svg b/assets/images/pharmacy/review_icon.svg new file mode 100644 index 00000000..bb826f21 --- /dev/null +++ b/assets/images/pharmacy/review_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/shipping_addresses_icon.svg b/assets/images/pharmacy/shipping_addresses_icon.svg new file mode 100644 index 00000000..ebb8692f --- /dev/null +++ b/assets/images/pharmacy/shipping_addresses_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/shipping_mark_icon.svg b/assets/images/pharmacy/shipping_mark_icon.svg new file mode 100644 index 00000000..5cf9606b --- /dev/null +++ b/assets/images/pharmacy/shipping_mark_icon.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/shipping_truck_icon.svg b/assets/images/pharmacy/shipping_truck_icon.svg new file mode 100644 index 00000000..8ffda974 --- /dev/null +++ b/assets/images/pharmacy/shipping_truck_icon.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/success_check_icon.svg b/assets/images/pharmacy/success_check_icon.svg new file mode 100644 index 00000000..ed1379b8 --- /dev/null +++ b/assets/images/pharmacy/success_check_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/success_review_icon.svg b/assets/images/pharmacy/success_review_icon.svg new file mode 100644 index 00000000..f6951456 --- /dev/null +++ b/assets/images/pharmacy/success_review_icon.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/terms.png b/assets/images/pharmacy/terms.png new file mode 100644 index 00000000..76cfacab Binary files /dev/null and b/assets/images/pharmacy/terms.png differ diff --git a/assets/images/pharmacy/user.svg b/assets/images/pharmacy/user.svg new file mode 100644 index 00000000..8e978105 --- /dev/null +++ b/assets/images/pharmacy/user.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/user_icon.svg b/assets/images/pharmacy/user_icon.svg new file mode 100644 index 00000000..8e978105 --- /dev/null +++ b/assets/images/pharmacy/user_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/wishklist_icon.svg b/assets/images/pharmacy/wishklist_icon.svg new file mode 100644 index 00000000..cd0ce16d --- /dev/null +++ b/assets/images/pharmacy/wishklist_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/wishlist_icon.svg b/assets/images/pharmacy/wishlist_icon.svg new file mode 100644 index 00000000..910a3ab8 --- /dev/null +++ b/assets/images/pharmacy/wishlist_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy_module/ic_payment_option.png b/assets/images/pharmacy_module/ic_payment_option.png new file mode 100644 index 00000000..5f3fca8f Binary files /dev/null and b/assets/images/pharmacy_module/ic_payment_option.png differ diff --git a/assets/images/pharmacy_module/ic_shipping_address.png b/assets/images/pharmacy_module/ic_shipping_address.png new file mode 100644 index 00000000..9566fb30 Binary files /dev/null and b/assets/images/pharmacy_module/ic_shipping_address.png differ diff --git a/assets/images/pharmacy_module/ic_shipping_mark.png b/assets/images/pharmacy_module/ic_shipping_mark.png new file mode 100644 index 00000000..cc4b272d Binary files /dev/null and b/assets/images/pharmacy_module/ic_shipping_mark.png differ diff --git a/assets/images/pharmacy_module/ic_shipping_truck.png b/assets/images/pharmacy_module/ic_shipping_truck.png new file mode 100644 index 00000000..274ae1da Binary files /dev/null and b/assets/images/pharmacy_module/ic_shipping_truck.png differ diff --git a/assets/images/pharmacy_module/lakum/Account_activation_icon.png b/assets/images/pharmacy_module/lakum/Account_activation_icon.png new file mode 100644 index 00000000..dc93366c Binary files /dev/null and b/assets/images/pharmacy_module/lakum/Account_activation_icon.png differ diff --git a/assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png b/assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png new file mode 100644 index 00000000..b7d33dd6 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png differ diff --git a/assets/images/pharmacy_module/lakum/expired_icon.png b/assets/images/pharmacy_module/lakum/expired_icon.png new file mode 100644 index 00000000..9a980984 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/expired_icon.png differ diff --git a/assets/images/pharmacy_module/lakum/inactive_cross.png b/assets/images/pharmacy_module/lakum/inactive_cross.png new file mode 100644 index 00000000..5a592b7a Binary files /dev/null and b/assets/images/pharmacy_module/lakum/inactive_cross.png differ diff --git a/assets/images/pharmacy_module/lakum/lakum_card_front_bg.png b/assets/images/pharmacy_module/lakum/lakum_card_front_bg.png new file mode 100644 index 00000000..73323a0e Binary files /dev/null and b/assets/images/pharmacy_module/lakum/lakum_card_front_bg.png differ diff --git a/assets/images/pharmacy_module/lakum/lakum_checkout.png b/assets/images/pharmacy_module/lakum/lakum_checkout.png new file mode 100644 index 00000000..e0230a00 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/lakum_checkout.png differ diff --git a/assets/images/pharmacy_module/lakum/waiting_gained_icon.png b/assets/images/pharmacy_module/lakum/waiting_gained_icon.png new file mode 100644 index 00000000..37ff1ac9 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/waiting_gained_icon.png differ diff --git a/assets/images/pharmacy_module/lakum/will_be_expired_icon.png b/assets/images/pharmacy_module/lakum/will_be_expired_icon.png new file mode 100644 index 00000000..7f31f622 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/will_be_expired_icon.png differ diff --git a/assets/images/pharmacy_module/payment/LogoParmacyGreen.png b/assets/images/pharmacy_module/payment/LogoParmacyGreen.png new file mode 100644 index 00000000..72862b33 Binary files /dev/null and b/assets/images/pharmacy_module/payment/LogoParmacyGreen.png differ diff --git a/assets/images/pharmacy_module/payment/aramex_shipping_logo.png b/assets/images/pharmacy_module/payment/aramex_shipping_logo.png new file mode 100644 index 00000000..e7b45d9c Binary files /dev/null and b/assets/images/pharmacy_module/payment/aramex_shipping_logo.png differ diff --git a/assets/images/pharmacy_module/payment/hmg_shipping_logo.png b/assets/images/pharmacy_module/payment/hmg_shipping_logo.png new file mode 100644 index 00000000..725b2e5e Binary files /dev/null and b/assets/images/pharmacy_module/payment/hmg_shipping_logo.png differ diff --git a/assets/images/pharmacy_module/payment/installment.png b/assets/images/pharmacy_module/payment/installment.png new file mode 100644 index 00000000..034497ef Binary files /dev/null and b/assets/images/pharmacy_module/payment/installment.png differ diff --git a/assets/images/pharmacy_module/payment/mada.png b/assets/images/pharmacy_module/payment/mada.png new file mode 100644 index 00000000..f65b970c Binary files /dev/null and b/assets/images/pharmacy_module/payment/mada.png differ diff --git a/assets/images/pharmacy_module/payment/mastercard.png b/assets/images/pharmacy_module/payment/mastercard.png new file mode 100644 index 00000000..1d48b854 Binary files /dev/null and b/assets/images/pharmacy_module/payment/mastercard.png differ diff --git a/assets/images/pharmacy_module/payment/sadad.png b/assets/images/pharmacy_module/payment/sadad.png new file mode 100644 index 00000000..35e0426c Binary files /dev/null and b/assets/images/pharmacy_module/payment/sadad.png differ diff --git a/assets/images/pharmacy_module/payment/visa.png b/assets/images/pharmacy_module/payment/visa.png new file mode 100644 index 00000000..8d29703c Binary files /dev/null and b/assets/images/pharmacy_module/payment/visa.png differ diff --git a/assets/images/pharmacy_module/payment_image.png b/assets/images/pharmacy_module/payment_image.png new file mode 100644 index 00000000..ebf7a929 Binary files /dev/null and b/assets/images/pharmacy_module/payment_image.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..71ce57cb --- /dev/null +++ b/help/ios/Runner/Info.plist @@ -0,0 +1,48 @@ + + + + + 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 + + + < key >NSCameraUsageDescription< /key > + < string >Camera permission is required for barcode scanning.< /string > + + 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 6bca0336..b8024672 100644 --- a/ios/Flutter/.last_build_id +++ b/ios/Flutter/.last_build_id @@ -1 +1 @@ -f4a819c27119d0f472892c1088ad1ca3 \ No newline at end of file +59a6c452ee075b50114918f17f1ad8f5 \ No newline at end of file diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index f2872cf4..6b4c0f78 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 9.0 + 8.0 diff --git a/ios/GoogleService-Info.plist b/ios/GoogleService-Info.plist new file mode 100644 index 00000000..0c093a2a --- /dev/null +++ b/ios/GoogleService-Info.plist @@ -0,0 +1,36 @@ + + + + + CLIENT_ID + 864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r + API_KEY + AIzaSyA_6ayGCk4fly7o7eTVBrj9kuHBYHMAOfs + GCM_SENDER_ID + 864393916058 + PLIST_VERSION + 1 + BUNDLE_ID + com.cloud.diplomaticquarterapp + PROJECT_ID + diplomaticquarter-d2385 + STORAGE_BUCKET + diplomaticquarter-d2385.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:864393916058:ios:13f787bbfe6051f8b97923 + DATABASE_URL + https://diplomaticquarter-d2385.firebaseio.com + + \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 1d1a003e..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' @@ -10,32 +10,85 @@ project 'Runner', { 'Release' => :release, } -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end +# pod 'FBSDKCoreKit' +# pod 'FBSDKLoginKit' - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches +def parse_KV_file(file, separator='=') + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return []; + end + generated_key_values = {} + skip_line_start_symbols = ["#", "/"] + File.foreach(file_abs_path) do |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + generated_key_values[podname] = podpath + else + puts "Invalid plugin specification: #{line}" + end end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" + generated_key_values end -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_ios_podfile_setup - target 'Runner' do use_frameworks! use_modular_headers! - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + # 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') + unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) + # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. + # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. + # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. + + generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') + unless File.exist?(generated_xcode_build_settings_path) + raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) + cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; + + unless File.exist?(copied_framework_path) + FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) + end + unless File.exist?(copied_podspec_path) + FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) + end + end + + # Keep pod path relative so it can be checked into Podfile.lock. + pod 'Flutter', :path => 'Flutter' + + # Plugin Pods + + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + system('rm -rf .symlinks') + system('mkdir -p .symlinks/plugins') + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.each do |name, path| + symlink = File.join('.symlinks', 'plugins', name) + File.symlink(path, symlink) + pod name, :path => File.join(symlink, 'ios') + end end post_install do |installer| installer.pods_project.targets.each do |target| - flutter_additional_ios_build_settings(target) + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + end end -end \ No newline at end of file +end + diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 00000000..77dfa5e1 --- /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.8.0) + - 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: c13a51ceca375e91620eb7578d2573c90cf53b46 + 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..0f0f942c --- /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 */, + CBB18A5CEEEB971DCFC36E00 /* [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"; + }; + 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"; + }; + CBB18A5CEEEB971DCFC36E00 /* [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; + }; +/* 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 31d8d1f5..fb2dffc4 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + + + + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings index 58d01805..f9b0d7c5 100644 --- a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -2,8 +2,6 @@ - DisableBuildSystemDeprecationWarning - PreviewsEnabled diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 70693e4a..e686619c 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,13 +1,47 @@ import UIKit import Flutter +import GoogleMaps + @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) + 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/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index 65b74d7e..d36b1fab 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1 +1,122 @@ -{"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"72x72","expected-size":"72","filename":"72.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"76x76","expected-size":"152","filename":"152.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"50x50","expected-size":"100","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"76x76","expected-size":"76","filename":"76.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"50x50","expected-size":"50","filename":"50.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"72x72","expected-size":"144","filename":"144.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"40x40","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"83.5x83.5","expected-size":"167","filename":"167.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"20x20","expected-size":"20","filename":"20.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"}]} \ No newline at end of file +{ + "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/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 00000000..dc9ada47 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000..28c6bf03 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000..f091b6b0 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000..4cde1211 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000..d0ef06e7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000..dcdc2306 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000..c8f9ed8f Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000..75b2d164 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000..c4df70d3 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000..6a84f41e Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/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/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/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/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/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/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard index f3c28516..8ae1ba59 100644 --- a/ios/Runner/Base.lproj/Main.storyboard +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -1,26 +1,29 @@ - - + + + - + + - + - + - + - + + 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/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist new file mode 100644 index 00000000..0c093a2a --- /dev/null +++ b/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,36 @@ + + + + + CLIENT_ID + 864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.864393916058-ekeb4s8tgfo58dutv0l54399t7ivr06r + API_KEY + AIzaSyA_6ayGCk4fly7o7eTVBrj9kuHBYHMAOfs + GCM_SENDER_ID + 864393916058 + PLIST_VERSION + 1 + BUNDLE_ID + com.cloud.diplomaticquarterapp + PROJECT_ID + diplomaticquarter-d2385 + STORAGE_BUCKET + diplomaticquarter-d2385.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:864393916058:ios:13f787bbfe6051f8b97923 + DATABASE_URL + https://diplomaticquarter-d2385.firebaseio.com + + \ No newline at end of file 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 6a2a87ce..ae084167 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -4,8 +4,6 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Dr. Alhabib MC CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -13,7 +11,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - DiplomaticQuarter + diplomaticquarterapp CFBundlePackageType APPL CFBundleShortVersionString @@ -24,47 +22,43 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS - NSBluetoothAlwaysUsageDescription - This App requires access to Bluetooth to connect blood pressure & blood sugar devices with the app to analyze the data. - NSBluetoothPeripheralUsageDescription - This App requires access to Bluetooth to connect blood pressure & blood sugar devices with the app to analyze the data. NSCalendarsUsageDescription - This app requires calendar access to set reminders for Virtual & Normal Appointments. + We need access to record you event in to calender. NSCameraUsageDescription - This app requires camera access to enable virtual consultation between patient & doctor - NSContactsUsageDescription - This app requires contacts access to show incoming virtual consultation request. - NSFaceIDUsageDescription - This app requires Face ID to allow biometric authentication for app login. + Need camera access for uploading images NSLocationAlwaysAndWhenInUseUsageDescription - This App requires access to your location to show the nearest hospitals & ER Locations from your location. + This app will use your location to show cool stuffs near you. NSLocationAlwaysUsageDescription - This App requires access to your location to show the nearest hospitals from your location. + This app will use your location to show cool stuffs near you. + NSLocationUsageDescription + Need location access for updating nearby friends NSLocationWhenInUseUsageDescription - This App requires access to your location to show the nearest hospitals from your location. + This app will use your location to show cool stuffs near you. NSMicrophoneUsageDescription - This app requires microphone access to enable virtual consultation between patient & doctor - NSMotionUsageDescription - This app requires motion detection access to function properly. + Need microphone access for uploading videos NSPhotoLibraryUsageDescription - This app requires photo library access to select image as document & upload it. - NSRemindersUsageDescription - This app requires calendar access to set reminders for Virtual & Normal Appointments. - NSSpeechRecognitionUsageDescription - This app requires access to speech recognition to identify which words are spoken into the microphone. - NSAppleMusicUsageDescription - Required usage description for a Flutter dependency + Need photo library access for uploading images UIBackgroundModes - remote-notification + fetch + location + processing UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main + UIRequiredDeviceCapabilities + + location-services + gps + armv7 + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad 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/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 786c323b..3f5f8755 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,22 +1,35 @@ 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; -//const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; -const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// 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://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 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'; @@ -42,11 +55,18 @@ const GET_PRESCRIPTION_REPORT_ENH = const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; +const SEND_LAB_RESULT_EMAIL = + 'Services/Notifications.svc/REST/SendLabReportEmail'; const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_ORDERS_RESULT = + 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; /// const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; +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'; @@ -107,7 +127,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'; @@ -131,6 +151,8 @@ const SAVE_BLOOD_AGREEMENT = const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; const INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; +const SEND_MEDICAL_REPORT_EMAIL = + 'Services/Notifications.svc/REST/SendMedicalReportEmail'; ///Rate const IS_LAST_APPOITMENT_RATED = @@ -252,18 +274,15 @@ const CANCEL_LIVECARE_REQUEST = const SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; -const GET_USER_TERMS = '/Services/Patients.svc/REST/GetUserTermsAndConditions'; +const GET_USER_TERMS = 'Services/Patients.svc/REST/GetUserTermsAndConditions'; const UPDATE_HEALTH_TERMS = - '/services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; - -/// -const GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege'; + '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; @@ -282,6 +301,10 @@ 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"; @@ -372,12 +395,46 @@ 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"; +//Pharmacy wishlist +// const GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/"; + // pharmacy +const PHARMACY_VERIFY_CUSTOMER = "epharmacy/api/VerifyCustomer"; +const PHARMACY_GET_COUNTRY = "epharmacy/api/countries"; +const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer"; const GET_PHARMACY_BANNER = "epharmacy/api/promotionbanners"; const GET_PHARMACY_TOP_MANUFACTURER = "epharmacy/api/topmanufacturer"; const GET_PHARMACY_BEST_SELLER_PRODUCT = "epharmacy/api/bestsellerproducts"; const GET_PHARMACY_PRODUCTs_BY_IDS = "epharmacy/api/productsbyids/"; const GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/"; +const GET_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"; +const GET_SHOPPING_CART = "epharmacy/api/shopping_cart_items/"; +const GET_SHIPPING_OPTIONS = "epharmacy/api/get_shipping_option/"; +const DELETE_SHOPPING_CART = "epharmacy/api/delete_shopping_cart_items/"; +const DELETE_SHOPPING_CART_ALL = + "epharmacy/api/delete_shopping_cart_item_by_customer/"; +const ORDER_SHOPPING_CART = "epharmacy/api/orders"; +const GET_LACUM_ACCOUNT_INFORMATION = + "Services/Patients.svc/REST/GetLakumAccountInformation"; +const GET_LACUM_GROUP_INFORMATION = + "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping"; +const LACUM_ACCOUNT_ACTIVATE = + "Services/Patients.svc/REST/LakumAccountActivation"; +const LACUM_ACCOUNT_DEACTIVATE = + "Services/Patients.svc/REST/LakumAccountDeactivation"; +const CREATE_LAKUM_ACCOUNT = + "Services/Patients.svc/REST/PHR_CreateLakumAccount"; +const TRANSFER_YAHALA_LOYALITY_POINTS = + "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; +const LAKUM_GET_USER_TERMS_AND_CONDITIONS = + "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; // Home Health Care const HHC_GET_ALL_SERVICES = @@ -399,6 +456,18 @@ const GET_PATIENT_ALL_PRES_ORD = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; const PATIENT_ER_INSERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; +const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews'; + +//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 = @@ -408,10 +477,32 @@ const GET_CUSTOMER_ADDRESSES = const GET_CUSTOMER_INFO = "https://mdlaboratories.com/exacartapi/api/VerifyCustomer"; +//Pharmacy + +const GET_PHARMACY_CATEGORISE = + 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; +const GET_OFFERS_CATEGORISE = 'epharmacy/api/discountcategories'; +const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/'; +const GET_CATEGORISE_PARENT = + 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; +const GET_PARENT_PRODUCTS = 'epharmacy/api/products?categoryid='; +const GET_SUB_CATEGORISE = + 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; +const GET_SUB_PRODUCTS = 'epharmacy/api/products?categoryid='; +const GET_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"; +const GET_BRANDS_LIST = 'epharmacy/api/categoryManufacturer?categoryids='; + +const GET_SEARCH_PRODUCTS = + 'epharmacy/api/searchproducts?fields=id,discount_ids,reviews,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&search_key='; + +const SCAN_QR_CODE = 'epharmacy/api/productbysku/'; + class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 1f933203..8eea6cbb 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1,3 +1,49 @@ +// --------- - -- - - - - - - - - ---------------- +// 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': 'الاعدادات'}, @@ -74,6 +120,11 @@ const Map localizedValues = { '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', @@ -291,7 +342,7 @@ const Map localizedValues = { }, "ksa": {"en": "KSA", "ar": "السعودية"}, "dubai": {"en": "Dubai", "ar": "دبي"}, - "enter-email": {"en": "Enter Email", "ar": "ادخل البريد الالكتروني"}, + "enter-email": {"en": "Please Enter Email", "ar": "ادخل البريد الالكتروني"}, "family": {"en": "My Family", "ar": "عائلتي"}, "family-title": {"en": "My Family Files", "ar": "ملفات العائلة"}, "myFamily": {"en": "My Family", "ar": "ملفات العائلة"}, @@ -300,7 +351,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 +369,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": "تاريخ الفاتورة: "}, @@ -351,6 +402,7 @@ const Map localizedValues = { "en": "All your medical records", 'ar': 'جميع سجلاتك الطبية' }, + "viewMore": {"en": "View More", 'ar': 'عرض المزيد'}, "homeHealthCareService": { "en": "Home Health Care Service", @@ -376,6 +428,7 @@ const Map localizedValues = { 'ar': 'عرض خدمات الحبيب الطبية' }, "viewAll": {"en": "View All", 'ar': 'عرض الكل'}, + "view": {"en": "View", 'ar': 'عرض'}, "ContactUs": {"en": "Contact Us", 'ar': 'الوصول إلينا'}, "ViewAllWaysReachUs": { "en": "View All Ways Reach Us", @@ -483,7 +536,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": "العلامة حيوية"}, @@ -629,6 +682,82 @@ const Map localizedValues = { "ar": "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." }, + "orders": {"en": "Orders", "ar": "الطلبات"}, + "lakum": {"en": "Lakum", "ar": "لكم"}, + "wishlist": {"en": "Wishlist", "ar": "الرغبات"}, + "reviews": {"en": "Reviews", "ar": "التقيمات"}, + // "myPrescriptions": {"en": "My Prescriptions", "ar": "وصفاتي"}, + // "medicationRefill": {"en": "Medication Refill", "ar": "تعبئة الأدوية"}, + "pillReminder": {"en": "Pill Reminder", "ar": "تذكير الأدويه"}, + "shippingAddresses": {"en": "Shipping Addresses", "ar": "عناوين الشحن"}, + "reachUs": {"en": "Reach Us", "ar": "الوصول لنا"}, + "ourLocations": {"en": "Our Locations", "ar": "مواقعنا"}, + "edit": {"en": "Edit", "ar": "تعديل"}, + "delete": {"en": "Delete", "ar": " حذف"}, + "addAddress": {"en": "ADD A NEW ADDRESS", "ar": " اضافة عنوان جديد"}, + "addNewAddress": {"en": "Add New Address", "ar": " اضافة عنوان جديد"}, + "order": {"en": "My Order", "ar": " طلباتي"}, + "delivered": {"en": "Delivered", "ar": " تم التوصيل"}, + "pending": {"en": "Pending", "ar": " معلقة "}, + "processing": {"en": "Processing", "ar": " تحت المعالجة"}, + "cancelled": {"en": "Cancelled", "ar": " ملغي"}, + "writeReview": {"en": "Write Review", "ar": " اكتب تقييمك"}, + "shareReview": {"en": "SHARE REVIEW", "ar": " اكتب تقييمك"}, + "review": {"en": " reviews", "ar": " تقييمات"}, + "pendingOrder": {"en": " PENDING", "ar": " معلقة"}, + "deliveredOrder": {"en": " DELIVERED", "ar": " تم التوصيل"}, + "processingOrder": {"en": " PROCESSING", "ar": "قيد التنفيذ"}, + "cancelledOrder": {"en": " CANCELLED", "ar": "ملغي"}, + "compare": {"en": " Compare", "ar": "مقارنه"}, + "medicationsRefill": {"en": " Medication Refill", "ar": "طلب أعادة صرف"}, + "myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"}, + "quantity": {"en": " QTY ", "ar": "الكمية"}, + "backMyAccount": { + "en": "BACK TO MY ACCOUNT ", + "ar": " الرجوع لحسابي الشخصي" + }, + "reviewSuccessful": {"en": "Review Successful", "ar": " تقييم ناجح"}, + "reviewShared": { + "en": "Your review has been shared on product review section", + "ar": " تمت مشاركة تقييمك في قسم تقييم المنتج" + }, + "reviewComment": { + "en": "Your reviews help other to choose better product", + "ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل" + }, + "shippedMethod": {"en": "SHIP BY:", "ar": " الشحن بواسطة:"}, + "orderDetail": {"en": "Order Details", "ar": " تفاصيل الطلب"}, + "orderSummary": {"en": "Order Summary", "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": "الغاء الطلب "}, + "confirmAddress": {"en": "CONFIRM ADDRESS ", "ar": " تأكيد العنوان "}, + "confirmLocation": {"en": "CONFIRM LOCATION ", "ar": " تأكيد الموقع "}, + "conditionsHMG": {"en": "Terms & Conditions ", "ar": "الشروط و الأحكام "}, + "conditions": {"en": "Terms & Conditions of Lakum", "ar": "شروط و احكام لكم"}, + "confirmDeleteMsg": { + "en": "Are you sure! want to delete ", + "ar": "هل انت متأكد تريد الحذف " + }, + "confirmDelete": {"en": "DELETE", "ar": "حذف"}, + "confirmCancellation": { + "en": "Are you sure! want to cancel this order ", + "ar": "هل انت متأكد تريد حذف هذا المنتج " + }, + "orderNumber": {"en": "Order#: ", "ar": "الطلب: "}, + "orderDate": {"en": "Date", "ar": "التاريخ:"}, + "itemsNo": {"en": "items(s)", "ar": "عناصر"}, + "noOrder": {"en": "You Don't have any orders.", "ar": "ليس لديك طلبات"}, "TermsService": {"en": "Terms of Service", "ar": "شروط الخدمه"}, "Beforeusing": { @@ -687,6 +816,26 @@ const Map localizedValues = { "recentlyViewed": {"en": "Recently Viewed", "ar": "شوهدت مؤخرا"}, "bestSellers": {"en": "Best Sellers", "ar": "أفضل البائعين"}, "deleteAllItems": {"en": "Delete All Items", "ar": "حذف كافة العناصر"}, + "total": {"en": "Total", "ar": "المجموع"}, + "selectAddress": {"en": "Select Address", "ar": "حدد العنوان"}, + "shippingAddress": {"en": "SHIPPING ADDRESS", "ar": "عنوان الشحن"}, + "changeAddress": {"en": "Change Address", "ar": "تغيير العنوان"}, + "selectPaymentOption": { + "en": "Select Payment Option", + "ar": "حدد خيار الدفع" + }, + "changeMethod": {"en": "Change Method", "ar": "تغيير خيار الدفع"}, + "reviewOrder": {"en": "Review Order", "ar": "مراجعة الطلب"}, + "active": {"en": "ACTIVE", "ar": "فعال"}, + "inactive": {"en": "INACTIVE", "ar": "غير فعال"}, + "balance": {"en": "BALANCE", "ar": "الحالي"}, + "gained": {"en": "GAINED", "ar": "المكتسب"}, + "consumed": {"en": "CONSUMED", "ar": "المستهلك"}, + "transferred": {"en": "TRANSFERRED", "ar": "المحول"}, + "checkBeneficiary": {"en": "CHECK BENEFICIARY", "ar": "تحقق من المستفيد"}, + "beneficiaryName": {"en": "Beneficiary Name", "ar": "اسم المستفيد"}, + "accountActivation": {"en": "Account Activation", "ar": "تفعيل الحساب"}, + "acceptLbl": {"en": "Accept", "ar": "موافقة"}, "select-gender": {"en": "Select Gender", "ar": "اختر الجنس"}, "i-am-a": {"en": "I am a ...", "ar": "أنا ..."}, "select-age": {"en": "Select Your Age", "ar": "حدد العمر"}, @@ -696,6 +845,15 @@ const Map localizedValues = { "en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك" }, + + "categorise": {"en": "Categories", "ar": "التطبيقات"}, + "wishList": {"en": "WishList", "ar": "الرغبات"}, + "myAccount": {"en": "My Account", "ar": "حسابي"}, + "cart": {"en": "Cart", "ar": "التسوق"}, + "searchProductHere": { + "en": "Search Product here", + "ar": "ابحث في الطلب الخاص بك" + }, "HHCNotAuthMsg": { "en": "This service provides a set of home health care services, continuous and comprehensive follow-up in their places of residence for those who cannot access health facilities, such as (laboratory analyzes - radiology - vaccinations - physical therapy), etc.", @@ -929,7 +1087,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": { @@ -940,7 +1098,10 @@ 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": "يرجى تحديد الجزء الذي تشكو منه" @@ -948,7 +1109,6 @@ const Map localizedValues = { "number": {"en": "Number", "ar": "الرقم"}, "not-classified": {"en": "Not classified", "ar": "غير محدد"}, "selectClinic": {"en": "Select Clinic", "ar": " بحث بالعيادة"}, - "reviews": {"en": "Reviews", "ar": "تقييمات"}, "searchItemError": { "en": "Item name should be more than 3 character ", "ar": "يجب أن يكون اسم العنصر أكثر من 3 أحرف" @@ -965,6 +1125,17 @@ const Map localizedValues = { "en": "To view the terms and conditions", "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": "نتيجة عامة"}, @@ -1020,7 +1191,6 @@ const Map localizedValues = { "en": "Select Transportation Method", "ar": "حدد طريقة النقل" }, - "sar": {"en": "SR", "ar": "ر.س"}, "RRT-direction-heading": {"en": "Select Direction", "ar": "حدد الاتجاه"}, "to-hospital": {"en": "To Hospital", "ar": "الى المستشفى"}, "from-hospital": {"en": "From Hospital", "ar": "من المستشفى"}, @@ -1029,7 +1199,7 @@ const Map localizedValues = { "pickup-location": {"en": "Pickup Location", "ar": "نقطة الانطلاق"}, "pickup-spot": {"en": "Pickup Spot", "ar": "نقطة اللقاء"}, "inside-home": {"en": "Inside Home", "ar": "داخل المنزل"}, - "have-appo": {"en": "Do you have an appointment?", "ar": "هل لديك موعد؟"}, + "have-appo": {"en": "Do you have an appointment ?", "ar": "هل لديك موعد ؟"}, "dropoff-location": {"en": "Dropoff Location", "ar": "نقطة الوصول"}, "select-all": { "en": "Please select all fields", @@ -1073,6 +1243,10 @@ const Map localizedValues = { "ar": "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." }, + "update-succ": { + "en": "Successfully updated profile", + "ar": "تم تحديث البيانات بنجاح" + }, "dental-complains": {"en": "Symptoms", "ar": "الأعراض"}, "empty-result": { "en": "There is no search results found", @@ -1123,36 +1297,178 @@ const Map localizedValues = { "requested": {"en": "Requested", "ar": "مطلوب"}, "ready": {"en": "Ready", "ar": "جاهز"}, "completed": {"en": "Completed", "ar": "مكتمل"}, - "cancelled": {"en": "Cancelled", "ar": "ملغى"}, "request-medical-report": { "en": "Request medical report", "ar": "طلب تقرير طبي" }, - - "vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"}, - "welcomeBack": {"en": "Welcome back", "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": - "Please ensure that the email address is up-to-date and process to view the schedule", - "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": + "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال" + }, + "select-hospital": {"en": "Choose Hospital", "ar": "اختر المستشفى"}, + "start": {"en": "Start", "ar": "ابدأ"}, + "info-chat": { + "en": + "This service allows you to chat with customer service directly without the need to call.", + "ar": + "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." + }, + "last-appointment": { + "en": "How was your appointment?", + "ar": "كيف كان موعدك الطبي ؟" + }, + "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": "تحديث البريد الالكتروني"}, - - "updated-email": { - "en": "Updated email successfully", - "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": "اعلى العلامات التجارية"}, - "view-list-children": { - "en": "View List of Children", - "ar": "عرض قائمة الأطفال" + "notifyMe": {"en": "notify me", "ar": "اعلمني"}, + "specification": {"en": "Specification", "ar": "تخصيص"}, + + "availability": {"en": "Availability", "ar": "التوفر"}, + + "vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"}, + "welcomeBack": {"en": "Welcome back", "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": "الشهر"}, + "point": {"en": "POINT", "ar": "النقاط"}, + "riyal": {"en": "RIYAL", "ar": "الريال"}, + "termOfService": {"en": "Terms of service", "ar": "شروط الخدمة"}, + "shoppingCart": {"en": "Shopping Cart", "ar": "عربة التسوق"}, "add-child": {"en": "Add New Child", "ar": "اضافة طفل"}, "child-name": {"en": "Child Name", "ar": "اسم الطفل"}, "childDob": {"en": "Birth Date", "ar": "تاريخ الولادة"}, - "delete": {"en": "Delete", "ar": "حذف"}, "deleted-child-mes": { "en": "The request was successful. The children have removed from the vaccination schedule subscription service.", @@ -1160,6 +1476,33 @@ const Map localizedValues = { }, "deleted-child": {"en": "Delete child", "ar": "إالغاء الطفل"}, "visit": {"en": "Visit", "ar": "زيارة"}, + "referralStatus": {"en": "Referral Status", "ar": "حالة الإحالة"}, + "referralDate": {"en": "Referral Date", "ar": "تاريخ الإحالة"}, + "patientName": {"en": "Patient Name", "ar": "اسم المريض"}, + "referralNumber": {"en": "Referral Number", "ar": "رقم الإحالة"}, + "requestID": {"en": "Request ID", "ar": " رقم الطلب"}, + "OrderStatus": {"en": "Status", "ar": "الحاله"}, + "pickupDate": {"en": "Pickup Date", "ar": "التاريخ"}, + "serviceName": {"en": "Service Name", "ar": " اسم الخدمة"}, + "orderLocation": {"en": "Location", "ar": "الموقع"}, + "selectService": {"en": "Select Service", "ar": "حدد الخدمة"}, + "coveredService": {"en": "Covered Service : ", "ar": " الخدمات المغطاة : "}, + "selectedService": { + "en": "Selected Service : ", + "ar": " الخدمات المختارة : " + }, + "cancelOrderMsg": { + "en": "Are you sure!! want to cancel this order", + "ar": "هل أنت واثق!! تريد إلغاء هذا الطلب" + }, + "processDoneSuccessfully": { + "en": "Process Done Successfully", + "ar": "تمت العملية بنجاح" + }, + "selectHomeHealthCareServices": { + "en": "Select Home Health Care Services", + "ar": " حدد خدمات الرعاية الصحية المنزلية" + }, "description-vaccination": {"en": "Description", "ar": "وصف"}, "due-date": {"en": "Due date", "ar": "تاريخ الاستحقاق"}, "valid-email": { @@ -1192,28 +1535,6 @@ const Map localizedValues = { "ar": " تم إرسال طلب الإحالة بنجاح ، وسيتم الاتصال بك في أسرع وقت ممكن لإكمال العملية. رقم طلب الإحالة" }, - "Year": {"en": "YEAR", "ar": "السنة"}, - "Month": {"en": "MONTH", "ar": "الشهر"}, - "point": {"en": "POINT", "ar": "النقاط"}, - "riyal": {"en": "RIYAL", "ar": "الريال"}, - "termOfService": {"en": "Terms of service", "ar": "شروط الخدمة"}, - "shoppingCart": {"en": "Shopping Cart", "ar": "عربة التسوق"}, - - "referralStatus": {"en": "Referral Status", "ar": "حالة الإحالة"}, - "referralDate": {"en": "Referral Date", "ar": "تاريخ الإحالة"}, - "patientName": {"en": "Patient Name", "ar": "اسم المريض"}, - "referralNumber": {"en": "Referral Number", "ar": "رقم الإحالة"}, - "requestID": {"en": "Request ID", "ar": " رقم الطلب"}, - "OrderStatus": {"en": "Status", "ar": "الحاله"}, - "pickupDate": {"en": "Pickup Date", "ar": "التاريخ"}, - "serviceName": {"en": "Service Name", "ar": " اسم الخدمة"}, - "orderLocation": {"en": "Location", "ar": "الموقع"}, - "selectService": {"en": "Select Service", "ar": "حدد الخدمة"}, - "coveredService": {"en": "Covered Service : ", "ar": " الخدمات المغطاة : "}, - "selectedService": { - "en": "Selected Service : ", - "ar": " الخدمات المختارة : " - }, "help": {"en": "Help", "ar": "مساعدة"}, @@ -1222,19 +1543,35 @@ const Map localizedValues = { "Hi, This is HABIB, your personal assistant. I'm here to assist you by voice commands. How can I help?", "ar": "مرحباً ، معك حبيب مساعدك الشخصي. أنا هنا لمساعدتك بالأوامر الصوتية." }, + "updated-email": { + "en": "Updated email successfully", + "ar": "تم تحديث البريد الالكتروني" + }, - "selectAddress": {"en": "Select Address", "ar": "حدد العنوان"}, - "addNewAddress": {"en": "Add New Address", "ar": "أضف عنوان جديد"}, - "cancelOrderMsg": { - "en": "Are you sure!! want to cancel this order", - "ar": "هل أنت واثق!! تريد إلغاء هذا الطلب" + "view-list-children": { + "en": "View List of Children", + "ar": "عرض قائمة الأطفال" }, - "processDoneSuccessfully": { - "en": "Process Done Successfully", - "ar": "تمت العملية بنجاح" + "covidTest": {"en": "COVID-19 TEST", "ar": "فحص كورونا"}, + "driveThru": {"en": "Drive-Thru", "ar": "من السيارة"}, + "NearestErDesc": { + "en": + "\nThis service Displays nearest branch\n among all the branches of All Habib \n medical Group based on your current Location", + "ar": + "\nتعرض هذه الخدمة أقرب فرع\n من بين جميع فروع مجموعة \nالحبيب الطبية بناءً على موقعك الحالي." }, - "selectHomeHealthCareServices": { - "en": "Select Home Health Care Services", - "ar": " حدد خدمات الرعاية الصحية المنزلية" + "NearestEr": {"en": "Nearest ER", "ar": "أقرب ER"}, + "infoCMC": { + "en": + "Through this service, you can request a set of tests that help you and your doctor to understand the current health condition and then identify potential risks.", + "ar": + "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" + }, + "instructionAgree": { + "en": + "This monthly Health Summary Report reflects the health indicators and analysis results of the latest visits. Please note that this will be sent automatically from the system and it's not considered as an official report so no medical decisions should be taken based on it.", + "ar": + "هذا ملخص التقرير الصحي الشهري و الذي يسرد المؤشرات الصحية و نتائج التحاليل لأخر الزيارات. يرجى ملاحظة أن هذا التقرير هو تقرير يتم ارساله بشكل آلي من النظام و لا يعتبر رسمي و لا تؤخذ عليه أي قرارات طبية" }, + "reqId": {"en": "Request ID:", "ar": " رقم الطلب"}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 39e2649d..4f7b2646 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -19,8 +19,12 @@ const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; const IS_VIBRATION = 'is_vibration'; const THEME_VALUE = 'is_vibration'; const MAIN_USER = 'main-user'; -const WEATHER = 'weather'; const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited'; const PHARMACY_CUSTOMER_ID = 'costumer-id'; const IS_ROBOT_VISIBLE = 'robot-visible'; const IS_ROBOT_INIT = 'robot-init'; +const HMG_GEOFENCES = 'hmg-geo-fences'; +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 index 5ab48fb3..54e8042b 100644 --- a/lib/core/model/ImagesInfo.dart +++ b/lib/core/model/ImagesInfo.dart @@ -1,6 +1,7 @@ class ImagesInfo { final String imageAr; final String imageEn; + final bool isAsset; - ImagesInfo({this.imageAr, this.imageEn}); + ImagesInfo({this.imageAr, this.imageEn, this.isAsset = false}); } diff --git a/lib/core/model/er/PickUpRequestPresOrder.dart b/lib/core/model/er/PickUpRequestPresOrder.dart index 376e30ae..c4f359f5 100644 --- a/lib/core/model/er/PickUpRequestPresOrder.dart +++ b/lib/core/model/er/PickUpRequestPresOrder.dart @@ -18,8 +18,8 @@ class PickUpRequestPresOrder { int pickupSpot; dynamic dropoffLocationId; int transportationMethodId; - double cost; - double vAT; + dynamic cost; + dynamic vAT; double totalPrice; int amountCollected; int selectedAmbulate; diff --git a/lib/core/model/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/Addresses.dart b/lib/core/model/pharmacies/Addresses.dart index 74d5a591..b00b1a17 100644 --- a/lib/core/model/pharmacies/Addresses.dart +++ b/lib/core/model/pharmacies/Addresses.dart @@ -17,6 +17,7 @@ class Addresses { String createdOnUtc; String province; String latLong; + bool isChecked; Addresses( {this.id, @@ -36,7 +37,8 @@ class Addresses { this.customerAttributes, this.createdOnUtc, this.province, - this.latLong}); + this.latLong, + this.isChecked = false}); Addresses.fromJson(Map json) { id = json['id']; @@ -57,6 +59,7 @@ class Addresses { createdOnUtc = json['created_on_utc']; province = json['province']; latLong = json['lat_long']; + isChecked = json['isChecked']; } Map toJson() { @@ -79,6 +82,7 @@ class Addresses { data['created_on_utc'] = this.createdOnUtc; data['province'] = this.province; data['lat_long'] = this.latLong; + data['isChecked'] = this.isChecked; return data; } diff --git a/lib/core/model/pharmacies/BillingAddress.dart b/lib/core/model/pharmacies/BillingAddress.dart new file mode 100644 index 00000000..765ac54d --- /dev/null +++ b/lib/core/model/pharmacies/BillingAddress.dart @@ -0,0 +1,84 @@ +class BillingAddress { + String id; + String firstName; + String lastName; + String email; + String company; + int countryId; + String country; + String stateProvinceId; + String city; + String address1; + String address2; + String zipPostalCode; + String phoneNumber; + String faxNumber; + String customerAttributes; + String createdOnUtc; + String province; + String latLong; + + BillingAddress( + {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}); + + BillingAddress.fromJson(Map json) { + id = json['id']; + firstName = json['first_name']; + lastName = json['last_name']; + email = json['email']; + company = json['company']; + countryId = json['country_id']; + country = json['country']; + stateProvinceId = json['state_province_id']; + city = 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 = json['created_on_utc']; + province = json['province']; + latLong = json['lat_long']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['first_name'] = this.firstName; + data['last_name'] = this.lastName; + data['email'] = this.email; + data['company'] = this.company; + data['country_id'] = this.countryId; + data['country'] = this.country; + data['state_province_id'] = this.stateProvinceId; + data['city'] = this.city; + data['address1'] = this.address1; + data['address2'] = this.address2; + data['zip_postal_code'] = this.zipPostalCode; + data['phone_number'] = this.phoneNumber; + data['fax_number'] = this.faxNumber; + data['customer_attributes'] = this.customerAttributes; + data['created_on_utc'] = this.createdOnUtc; + data['province'] = this.province; + data['lat_long'] = this.latLong; + return data; + } +} 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/Customer.dart b/lib/core/model/pharmacies/Customer.dart index a5311489..e3defbbe 100644 --- a/lib/core/model/pharmacies/Customer.dart +++ b/lib/core/model/pharmacies/Customer.dart @@ -1,4 +1,10 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/BillingAddress.dart'; + class Customer { + BillingAddress billingAddress; + BillingAddress shippingAddress; + List addresses; String fileNumber; String iqamaNumber; int isOutSa; @@ -8,8 +14,6 @@ class Customer { String phone; String countryCode; String yahalaAccountno; - String billingAddress; - String shippingAddress; String id; String username; String email; @@ -17,50 +21,63 @@ class Customer { String lastName; String languageId; String adminComment; - String isTaxExempt; - String hasShoppingCartItems; - String active; - String deleted; - String isSystemAccount; + bool isTaxExempt; + bool hasShoppingCartItems; + bool active; + bool deleted; + bool isSystemAccount; String systemName; String lastIpAddress; String createdOnUtc; String lastLoginDateUtc; String lastActivityDateUtc; - String registeredInStoreId; + int registeredInStoreId; Customer( - {this.fileNumber, - this.iqamaNumber, - this.isOutSa, - this.patientType, - this.gender, - this.birthDate, - this.phone, - this.countryCode, - this.yahalaAccountno, - this.billingAddress, - this.shippingAddress, - 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.billingAddress, + this.shippingAddress, + this.addresses, + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + 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}); Customer.fromJson(Map json) { + billingAddress = json['billing_address'] != null + ? new BillingAddress.fromJson(json['billing_address']) + : null; + shippingAddress = json['shipping_address'] != null + ? new BillingAddress.fromJson(json['shipping_address']) + : null; + if (json['addresses'] != null) { + addresses = new List(); + json['addresses'].forEach((v) { + addresses.add(new Addresses.fromJson(v)); + }); + } fileNumber = json['file_number']; iqamaNumber = json['iqama_number']; isOutSa = json['is_out_sa']; @@ -70,8 +87,6 @@ class Customer { phone = json['phone']; countryCode = json['country_code']; yahalaAccountno = json['yahala_accountno']; - billingAddress = json['billing_address']; - shippingAddress = json['shipping_address']; id = json['id']; username = json['username']; email = json['email']; @@ -94,6 +109,15 @@ class Customer { Map toJson() { final Map data = new Map(); + if (this.billingAddress != null) { + data['billing_address'] = this.billingAddress.toJson(); + } + if (this.shippingAddress != null) { + data['shipping_address'] = this.shippingAddress.toJson(); + } + if (this.addresses != null) { + data['addresses'] = this.addresses.map((v) => v.toJson()).toList(); + } data['file_number'] = this.fileNumber; data['iqama_number'] = this.iqamaNumber; data['is_out_sa'] = this.isOutSa; @@ -103,8 +127,6 @@ class Customer { data['phone'] = this.phone; data['country_code'] = this.countryCode; data['yahala_accountno'] = this.yahalaAccountno; - data['billing_address'] = this.billingAddress; - data['shipping_address'] = this.shippingAddress; data['id'] = this.id; data['username'] = this.username; data['email'] = this.email; @@ -125,4 +147,4 @@ class Customer { data['registered_in_store_id'] = this.registeredInStoreId; return data; } -} \ No newline at end of file +} diff --git a/lib/core/model/pharmacies/LacumAccountInformation.dart b/lib/core/model/pharmacies/LacumAccountInformation.dart new file mode 100644 index 00000000..4f1d0455 --- /dev/null +++ b/lib/core/model/pharmacies/LacumAccountInformation.dart @@ -0,0 +1,1926 @@ +import 'LakumInquiryInformationObjVersion.dart'; + +class LacumAccountInformation { + + String date; + int languageID; + int serviceName; + String time; + String androidLink; + String authenticationTokenID; + String data; + bool dataw; + int dietType; + String errorCode; + String errorEndUserMessage; + String errorEndUserMessageN; + String errorMessage; + int errorType; + int foodCategory; + String iOSLink; + bool isAuthenticated; + int mealOrderStatus; + int mealType; + int messageStatus; + int numberOfResultRecords; + String patientBlodType; + String successMsg; + String successMsgN; + int accountStatus; + String activeArchiveObject; + int activeMedicationCount; + String allMedicationTakenDuringAdmissionList; + int appointmentNo; + String arePatientsOnlineList; + String balanceAmount; + String bloodGroupList; + int cVIUnreadCount; + String checkUserHasAccount; + int complaintNo; + String dischargeList; + int episodeID; + String finalRadiologyList; + String fullName; + String geoFPointsList; + String geoGetPateintInfo; + String getAllDoctorsByProjectAndClinicList; + String getAppointmentNumbersForDoctorList; + String getCheckUpItemsList; + String getCosmeticConferenceForTodayList; + String getDoctorERClinicResult; + String getInvoiceApprovalList; + String getNearestProjectList; + String getPatientAdmissionOrAppoinmentNoList; + String getPatientBloodType; + String getPatientInsuranceCardStatusStatisticsList; + String getSurveyList; + String getTotalRegisteredPatientList; + String getUserDetailsList; + String getCustomerPointInfo; + String hISApprovalList; + String hISInpAdmissionList; + String hISProgNoteAssesmentModelList; + String hMGGetAllOffersList; + bool hasApproval; + bool hasConsultation; + bool hasDental; + bool hasLab; + bool hasPharmacy; + bool hasRad; + String hmgSMSGetByProjectIDAndPatientIDList; + int hoursLeft; + String iNPMGetAllAdmissionList; + String iNPMGetPatientInfoForSickLeaveReportList; + String iNPMHISPatientMedicalStatusUnreadCount; + String iNPMLABGetPatientLabOrdersResultsList; + String iNPMLABGetPatientLabResultsList; + String iNPMLABGetPatientRADReportList; + String iNPMLABGetPatientRadResultsList; + String iNPMRadGetPatientRadOrdersCVIList; + String iNPMRadGetPatientRadOrdersList; + String iNPMRadGetRadMedicalRecordsList; + String iNPGetPrescriptionDischargesList; + String iNPGetPrescriptionReportList; + String identificationNo; + bool isHomeMedicineDeliverySupported; + int isInsertedOrUpdated; + bool isMainAcoountEqualPatienID; + bool isPatientAlreadyAgreed; + bool isPatientCallBackBlackList; + bool isPatientHaveFingerPrint; + bool isPatientOnline; + bool isPatientTokenRemoved; + bool isPaused; + bool isProjectWorkingHours; + String isStoreRateAllowed; + String isStoreRateInserted; + String isStoreRateUpdated; + int labRadUpdatedToRead; + int labReportUnreadNo; + String lakumInquiryInformationObj; + LakumInquiryInformationObjVersion lakumInquiryInformationObjVersion; + String lakumResponseList; + String laserGetBodyPartsByCategoryList; + String laserGetCategoriesList; + String list; + int listCount; + int listCountDeliverd; + int listCountUnDeliverd; + String listDeviceInfo; + String listFamilyAppointments; + String listLabResultsByAppNo; + String listLakumInquiryInformationObj; + String listOpinionGetAllPeriod; + String listOpinionGetAllServices; + String listOpinionGetIsAgreeValue; + String listOpinionGetOpinionLogin; + String listOpinionGetRequestedSerives; + String listOpinionGetShareServicesDetails; + String listOpinionUserTerms; + String listPLO; + String listPLR; + String listPLSR; + String listPRM; + String listPatientFamilyFiles; + String listPatientFileInfo; + String listRAD; + String listRADAPI; + String listActiveGetPrescriptionReportByPatientID; + String listAppointmentsForDentalClinic; + String listBabyInfoResult; + String listCheckInsuranceCoverage; + String listCompanyClass; + String listConsentMedicalReport; + String listDentalAppointments; + String listDeviceTokenIDByAppointmentNo; + String listDischargeDiagnosis; + String listDischargeMedicine; + String listDischargeSummary; + String listDoctorResponse; + String listDoneVaccines; + String listEReferralResult; + String listEReferrals; + String listGetAllPatientsLiveCareAdmin; + String listGetDataForExcel; + String listGetMainCountID; + String listGetPrescriptionReportByPatientID; + String listGetSickLeave; + String listHISInvoice; + String listHISInvoiceProcedures; + String listInpatientInvoices; + String listInsuranceCheckList; + String listInsuranceCompanies; + String listInsuranceCompaniesGroup; + String listInsuranceUpdateDetails; + String listInvoiceApprovalProcedureInfo; + String listIsLastSatisfactionSurveyReviewedModel; + String listLabOrderDetailsModel; + String listMedicalReport; + String listMedicalReportApprovals; + String listMedicalReportStatus; + String listMonthBloodPressureResult; + String listMonthBloodPressureResultAverage; + String listMonthDiabtecPatientResult; + String listMonthDiabtectResultAverage; + String listMonthWeightMeasurementResult; + String listMonthWeightMeasurementResultAverage; + String listOnlinePrescriptionResult; + String listOutPatientInvoices; + String listPHRInvoice; + String listPHRInvoiceItems; + String listPHRPaymentMethods; + String listPateintDetails; + String listPateintInformation; + String listPatientAdmissionInfo; + String listPatientAdvanceBalanceAmount; + String listPatientCallBackLogs; + String listPatientCallBackToUpdateFromICServer; + String listPatientCount; + String listPatientDashboard; + String listPatientERGetAdminClinicsModel; + String listPatientERGetAdminProjectsModel; + String listPatientERGetAllClinicsModel; + String listPatientHISInvoices; + String listPatientICProjects; + String listPatientICProjectsByID; + String listPatientICProjectsTimings; + String listPatientIDByUID; + String listPatientIDForSurveyResult; + String listPatientInfo; + String listPatientInfoForDDScreen; + String listPatientInfoForSickleaveReport; + String listPatientInsuranceCard; + String listPatientInsuranceCardHistory; + String listPatientInsuranceDetails; + String listPatientPHRInvoices; + String listPatientServicePoint; + String listPatientStatusCount; + String listPatientChatRequestMapModel; + String listPatientChatRequestModel; + String listPatientChatRequestVCModel; + String listPaymentMethods; + String listPointServices; + String listPregnancyStagesInfo; + String listProjectAvgERWaitingTime; + String listProjectAvgERWaitingTimeHourly; + String listRadMedicalRecords; + String listRadMedicalRecordsAPI; + String listRadMedicalRecordsCVI; + String listRadMedicalRecordsCVIAPI; + String listRadMedicalRecordsResults; + String listSickLeave; + String listTransaction; + String listVideoConferenceSessions; + String listWeekBloodPressureResult; + String listWeekBloodPressureResultAverage; + String listWeekDiabtecPatientResult; + String listWeekDiabtectResultAverage; + String listWeekWeightMeasurementResult; + String listWeekWeightMeasurementResultAverage; + String listYearBloodPressureResult; + String listYearBloodPressureResultAverage; + String listYearDiabtecPatientResult; + String listYearDiabtecResultAverage; + String listYearWeightMeasurementResult; + String listYearWeightMeasurementResultAverage; + String listEInvoiceForDental; + String listEInvoiceForOnlineCheckIn; + String medGetActivitiesTransactionsStsList; + String medGetAvgMonthTransactionsStsList; + String medGetAvgWeekTransactionsStsList; + String medGetCategoriesList; + String medGetMonthActivitiesTransactionsStsList; + String medGetMonthStepsTransactionsStsList; + String medGetMonthTransactionsStsList; + String medGetPatientLastRecordList; + String medGetSubCategoriesList; + String medGetTransactionsAndActTransactionsResult; + String medGetTransactionsList; + String medGetWeekActivitiesTransactionsStsList; + String medGetWeekStepsTransactionsStsList; + String medGetWeekTransactionsStsList; + String medGetYearActivitiesTransactionsStsList; + String medGetYearSleepTransactionsStsList; + String medGetYearStepsTransactionsStsList; + String medGetYearTransactionsStsList; + String medInsertTransactionsOutputsList; + String medicalRecordImages; + int medicalReportToRead; + int medicalReportUnreadNo; + bool missingIDCardAttachment; + bool missingInsuranceCardAttachment; + bool missingMedicalReportAttachment; + bool missingOtherRelationship; + bool missingPatientContactNo; + bool missingPatientId; + bool missingPatientIdentityNumber; + bool missingPatientName; + bool missingReferralContactNo; + bool missingReferralRelationship; + bool missingReferralRequesterName; + String mobileNumber; + int nationalityNumber; + String onlineCheckInAppointments; + String opinionUserAgreementContent; + bool orderInsert; + String pateintInfoForUpdateList; + String pateintUpatedList; + String patientBirthdayCertificate; + String patientERCMCRequestSummaryByProject; + String patientERCMCRequestWithTotal; + String patientERCMCGetAllServicesList; + String patientERCMCGetTransactionsForOrderList; + String patientERCoordinates; + String patientERCountOrderList; + String patientERCountsForApprovalOffice; + String patientERDeleteOldCurrentDoctorsOutputsList; + String patientERDeliveryGetAllDeliverdOrderList; + String patientERDeliveryGetAllOrderList; + bool patientERDeliveryIsOrderInserted; + bool patientERDeliveryIsOrderUpdated; + bool patientERDeliveryIsPausedChanged; + String patientERDeliveryNextOrder; + int patientERDeliveryOrderInsert; + int patientERDeliveryUpdateOrderStatus; + bool patientERDriverUpdate; + String patientERExacartCheckIsDispenseAccpetableList; + String patientERExacartGetDispenseQuantitiesByOrderIDList; + String patientERExacartGetOrderDetailsByePharmacyOrderNoList; + String patientERExacartGetOrderDetailsList; + String patientERExacartGetTotalDispenseQuantitiesByPresNoList; + bool patientERExacartIsDispenseAdded; + String patientERExacartIsDispenseAddedList; + bool patientERExacartIsOrderCompleted; + String patientERGetAdminByProjectAndRoleList; + String patientERGetAdminProjectsList; + String patientERGetAllDriversList; + String patientERGetAllNeedAproveStatusList; + String patientERGetAllPresOrdersStatusList; + String patientERGetAllProjectsList; + String patientERGetArchiveInformationList; + String patientERGetAskDoctorTotalByDateFilterList; + String patientERGetBookScheduleConfigsList; + String patientERGetClinicAndTimeAndEpisodeForAppointmentList; + String patientERGetClinicAndTimeForDischargeList; + String patientERGetDashboardDataforApporvalSectionForAdminList; + String patientERGetDashboardDataforApporvalSectionList; + String patientERGetDashboardDataforHHCSectionForAdminList; + String patientERGetDashboardDataforHHCSectionList; + String patientERGetDashboardDataforPrescriptionSectionForAdminList; + String patientERGetDashboardDataforPrescriptionSectionList; + String patientERGetDoctorDashboardDataModelList; + String patientERGetDriverLocationList; + String patientERGetInsuranceCardRequestByDateFilterList; + String patientERGetLiveCareSummaryBookedAppoinmentStatusList; + String patientERGetLiveCareSummaryCovidList; + String patientERGetLiveCareSummaryForCMCList; + String patientERGetLiveCareSummaryForHHCList; + String patientERGetLiveCareSummaryForHomeDeliveryList; + String patientERGetLiveCareSummaryForInsuranceCardRequestList; + String patientERGetLiveCareSummaryForNewFilesList; + String patientERGetLiveCareSummaryForOnlinePaymetRequestList; + String patientERGetLiveCareSummaryForOnlinePharmacyOrdersList; + String patientERGetLiveCareSummaryForTrasnportationList; + String patientERGetLiveCareSummaryLiveCareCountsList; + String patientERGetMedicalRequestTotalByDateFilterList; + String patientERGetNearestPendingOrdersList; + String patientERGetNeedAproveHistoryForOrderList; + String patientERGetNeedAprovePendingOrdersList; + String patientERGetNeedAproveStatusStatisticsList; + String patientERGetPatientAllPresOrdersList; + String patientERGetPendingPatientsCountList; + String patientERGetPresOrdersHistoryForAdminList; + String patientERGetPresOrdersHistoryForOrderList; + String patientERGetPresOrdersStatusStatisticsList; + String patientERHHCRequest; + String patientERHHCRequestSummaryByProject; + String patientERHHCRequestWithTotal; + String patientERHHCGetAllServicesList; + String patientERHHCGetTransactionsForOrderList; + String patientERHomeDeliveryCounts; + bool patientERInsertDriver; + String patientERInsertNewCurrentDoctorsOutputsList; + String patientERInsuranceStatusCountList; + bool patientERIsNearestProjectUpdated; + bool patientERIsNeedAproveReturnedToQueue; + bool patientERIsNeedAproveUpdated; + bool patientERIsOrderClientRequestUpdated; + bool patientERIsOrderReturnedToQueue; + bool patientERIsPresOrderInserted; + bool patientERIsPresOrderUpdated; + bool patientERIsProjectUpdated; + String patientERNotCompletedDetails; + String patientERPatientsCountByCallStatus; + String patientERPeakHourCounts; + String patientERPresOrderInfo; + String patientERPrescriptionCounts; + String patientERProjectsContribution; + String patientERRRTGetAllQuestionsList; + String patientERRRTGetAllTransportationMethodList; + String patientERRRTGetPickUpRequestByPresOrderIDList; + String patientERRealRRTGetAllServicesList; + String patientERRealRRTGetOrderDetailsList; + String patientERRealRRTGetTransactionsForOrderList; + bool patientERRealRRTIsTransInserted; + String patientERRequestList; + String patientERTransportationRequestWithTotal; + String patientERealRRTGetServicePriceList; + String patientInfoByAdmissionNoList; + String patientMonitorGetPatientHeartRate; + int patientNotServedCounts; + String patientPrescriptionList; + String patientAllergies; + String patientCheckAppointmentValidationList; + String patientLoginTokenList; + String patientQRLoginInfoList; + String patientSELECTDeviceIMEIbyIMEIList; + String pharmList; + String prefLang; + int radReportUnreadNo; + String radGetPatientRadOrdersForDentalList; + int referralNumber; + String reminderConfigurations; + String requestNo; + int rowCount; + String servicePrivilegeList; + String shareFamilyFileObj; + String status; + int successCode; + String surveyRate; + String symptomCheckerConditionList; + String symptomCheckerGetAllDefaultQuestionsList; + String symptomCheckerGetBodyPartSymptomsList; + String symptomCheckerGetBodyPartsByCodeList; + String symptomCheckerGetBodyPartsList; + String symptomCheckerJsonResponseInString; + int timerTime; + int totalAdvanceBalanceAmount; + int totalPatientsCount; + int totalPendingApprovalCount; + int totalUnUsedCount; + int transactionNo; + int unReadCounts; + bool updateStatus; + String userAgreementContent; + int yahalaAccountNo; + bool check24HourComplaint; + String currency; + String message; + int patientID; + int returnValue; + String returnValueStr; + int statusCode; + + LacumAccountInformation( + {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.accountStatus, + this.activeArchiveObject, + this.activeMedicationCount, + this.allMedicationTakenDuringAdmissionList, + this.appointmentNo, + this.arePatientsOnlineList, + this.balanceAmount, + this.bloodGroupList, + this.cVIUnreadCount, + this.checkUserHasAccount, + this.complaintNo, + this.dischargeList, + this.episodeID, + this.finalRadiologyList, + this.fullName, + this.geoFPointsList, + this.geoGetPateintInfo, + this.getAllDoctorsByProjectAndClinicList, + this.getAppointmentNumbersForDoctorList, + this.getCheckUpItemsList, + this.getCosmeticConferenceForTodayList, + this.getDoctorERClinicResult, + this.getInvoiceApprovalList, + this.getNearestProjectList, + this.getPatientAdmissionOrAppoinmentNoList, + this.getPatientBloodType, + this.getPatientInsuranceCardStatusStatisticsList, + this.getSurveyList, + this.getTotalRegisteredPatientList, + this.getUserDetailsList, + this.getCustomerPointInfo, + this.hISApprovalList, + this.hISInpAdmissionList, + this.hISProgNoteAssesmentModelList, + this.hMGGetAllOffersList, + this.hasApproval, + this.hasConsultation, + this.hasDental, + this.hasLab, + this.hasPharmacy, + this.hasRad, + this.hmgSMSGetByProjectIDAndPatientIDList, + this.hoursLeft, + this.iNPMGetAllAdmissionList, + this.iNPMGetPatientInfoForSickLeaveReportList, + this.iNPMHISPatientMedicalStatusUnreadCount, + this.iNPMLABGetPatientLabOrdersResultsList, + this.iNPMLABGetPatientLabResultsList, + this.iNPMLABGetPatientRADReportList, + this.iNPMLABGetPatientRadResultsList, + this.iNPMRadGetPatientRadOrdersCVIList, + this.iNPMRadGetPatientRadOrdersList, + this.iNPMRadGetRadMedicalRecordsList, + this.iNPGetPrescriptionDischargesList, + this.iNPGetPrescriptionReportList, + this.identificationNo, + this.isHomeMedicineDeliverySupported, + this.isInsertedOrUpdated, + this.isMainAcoountEqualPatienID, + this.isPatientAlreadyAgreed, + this.isPatientCallBackBlackList, + this.isPatientHaveFingerPrint, + this.isPatientOnline, + this.isPatientTokenRemoved, + this.isPaused, + this.isProjectWorkingHours, + this.isStoreRateAllowed, + this.isStoreRateInserted, + this.isStoreRateUpdated, + this.labRadUpdatedToRead, + this.labReportUnreadNo, + this.lakumInquiryInformationObj, + this.lakumInquiryInformationObjVersion, + this.lakumResponseList, + this.laserGetBodyPartsByCategoryList, + this.laserGetCategoriesList, + this.list, + this.listCount, + this.listCountDeliverd, + this.listCountUnDeliverd, + this.listDeviceInfo, + this.listFamilyAppointments, + this.listLabResultsByAppNo, + this.listLakumInquiryInformationObj, + this.listOpinionGetAllPeriod, + this.listOpinionGetAllServices, + this.listOpinionGetIsAgreeValue, + this.listOpinionGetOpinionLogin, + this.listOpinionGetRequestedSerives, + this.listOpinionGetShareServicesDetails, + this.listOpinionUserTerms, + this.listPLO, + this.listPLR, + this.listPLSR, + this.listPRM, + this.listPatientFamilyFiles, + this.listPatientFileInfo, + this.listRAD, + this.listRADAPI, + this.listActiveGetPrescriptionReportByPatientID, + this.listAppointmentsForDentalClinic, + this.listBabyInfoResult, + this.listCheckInsuranceCoverage, + this.listCompanyClass, + this.listConsentMedicalReport, + this.listDentalAppointments, + this.listDeviceTokenIDByAppointmentNo, + this.listDischargeDiagnosis, + this.listDischargeMedicine, + this.listDischargeSummary, + this.listDoctorResponse, + this.listDoneVaccines, + this.listEReferralResult, + this.listEReferrals, + this.listGetAllPatientsLiveCareAdmin, + this.listGetDataForExcel, + this.listGetMainCountID, + this.listGetPrescriptionReportByPatientID, + this.listGetSickLeave, + this.listHISInvoice, + this.listHISInvoiceProcedures, + this.listInpatientInvoices, + this.listInsuranceCheckList, + this.listInsuranceCompanies, + this.listInsuranceCompaniesGroup, + this.listInsuranceUpdateDetails, + this.listInvoiceApprovalProcedureInfo, + this.listIsLastSatisfactionSurveyReviewedModel, + this.listLabOrderDetailsModel, + this.listMedicalReport, + this.listMedicalReportApprovals, + this.listMedicalReportStatus, + this.listMonthBloodPressureResult, + this.listMonthBloodPressureResultAverage, + this.listMonthDiabtecPatientResult, + this.listMonthDiabtectResultAverage, + this.listMonthWeightMeasurementResult, + this.listMonthWeightMeasurementResultAverage, + this.listOnlinePrescriptionResult, + this.listOutPatientInvoices, + this.listPHRInvoice, + this.listPHRInvoiceItems, + this.listPHRPaymentMethods, + this.listPateintDetails, + this.listPateintInformation, + this.listPatientAdmissionInfo, + this.listPatientAdvanceBalanceAmount, + this.listPatientCallBackLogs, + this.listPatientCallBackToUpdateFromICServer, + this.listPatientCount, + this.listPatientDashboard, + this.listPatientERGetAdminClinicsModel, + this.listPatientERGetAdminProjectsModel, + this.listPatientERGetAllClinicsModel, + this.listPatientHISInvoices, + this.listPatientICProjects, + this.listPatientICProjectsByID, + this.listPatientICProjectsTimings, + this.listPatientIDByUID, + this.listPatientIDForSurveyResult, + this.listPatientInfo, + this.listPatientInfoForDDScreen, + this.listPatientInfoForSickleaveReport, + this.listPatientInsuranceCard, + this.listPatientInsuranceCardHistory, + this.listPatientInsuranceDetails, + this.listPatientPHRInvoices, + this.listPatientServicePoint, + this.listPatientStatusCount, + this.listPatientChatRequestMapModel, + this.listPatientChatRequestModel, + this.listPatientChatRequestVCModel, + this.listPaymentMethods, + this.listPointServices, + this.listPregnancyStagesInfo, + this.listProjectAvgERWaitingTime, + this.listProjectAvgERWaitingTimeHourly, + this.listRadMedicalRecords, + this.listRadMedicalRecordsAPI, + this.listRadMedicalRecordsCVI, + this.listRadMedicalRecordsCVIAPI, + this.listRadMedicalRecordsResults, + this.listSickLeave, + this.listTransaction, + this.listVideoConferenceSessions, + this.listWeekBloodPressureResult, + this.listWeekBloodPressureResultAverage, + this.listWeekDiabtecPatientResult, + this.listWeekDiabtectResultAverage, + this.listWeekWeightMeasurementResult, + this.listWeekWeightMeasurementResultAverage, + this.listYearBloodPressureResult, + this.listYearBloodPressureResultAverage, + this.listYearDiabtecPatientResult, + this.listYearDiabtecResultAverage, + this.listYearWeightMeasurementResult, + this.listYearWeightMeasurementResultAverage, + this.listEInvoiceForDental, + this.listEInvoiceForOnlineCheckIn, + this.medGetActivitiesTransactionsStsList, + this.medGetAvgMonthTransactionsStsList, + this.medGetAvgWeekTransactionsStsList, + this.medGetCategoriesList, + this.medGetMonthActivitiesTransactionsStsList, + this.medGetMonthStepsTransactionsStsList, + this.medGetMonthTransactionsStsList, + this.medGetPatientLastRecordList, + this.medGetSubCategoriesList, + this.medGetTransactionsAndActTransactionsResult, + this.medGetTransactionsList, + this.medGetWeekActivitiesTransactionsStsList, + this.medGetWeekStepsTransactionsStsList, + this.medGetWeekTransactionsStsList, + this.medGetYearActivitiesTransactionsStsList, + this.medGetYearSleepTransactionsStsList, + this.medGetYearStepsTransactionsStsList, + this.medGetYearTransactionsStsList, + this.medInsertTransactionsOutputsList, + this.medicalRecordImages, + this.medicalReportToRead, + this.medicalReportUnreadNo, + this.missingIDCardAttachment, + this.missingInsuranceCardAttachment, + this.missingMedicalReportAttachment, + this.missingOtherRelationship, + this.missingPatientContactNo, + this.missingPatientId, + this.missingPatientIdentityNumber, + this.missingPatientName, + this.missingReferralContactNo, + this.missingReferralRelationship, + this.missingReferralRequesterName, + this.mobileNumber, + this.nationalityNumber, + this.onlineCheckInAppointments, + this.opinionUserAgreementContent, + this.orderInsert, + this.pateintInfoForUpdateList, + this.pateintUpatedList, + this.patientBirthdayCertificate, + this.patientERCMCRequestSummaryByProject, + this.patientERCMCRequestWithTotal, + this.patientERCMCGetAllServicesList, + this.patientERCMCGetTransactionsForOrderList, + this.patientERCoordinates, + this.patientERCountOrderList, + this.patientERCountsForApprovalOffice, + this.patientERDeleteOldCurrentDoctorsOutputsList, + this.patientERDeliveryGetAllDeliverdOrderList, + this.patientERDeliveryGetAllOrderList, + this.patientERDeliveryIsOrderInserted, + this.patientERDeliveryIsOrderUpdated, + this.patientERDeliveryIsPausedChanged, + this.patientERDeliveryNextOrder, + this.patientERDeliveryOrderInsert, + this.patientERDeliveryUpdateOrderStatus, + this.patientERDriverUpdate, + this.patientERExacartCheckIsDispenseAccpetableList, + this.patientERExacartGetDispenseQuantitiesByOrderIDList, + this.patientERExacartGetOrderDetailsByePharmacyOrderNoList, + this.patientERExacartGetOrderDetailsList, + this.patientERExacartGetTotalDispenseQuantitiesByPresNoList, + this.patientERExacartIsDispenseAdded, + this.patientERExacartIsDispenseAddedList, + this.patientERExacartIsOrderCompleted, + this.patientERGetAdminByProjectAndRoleList, + this.patientERGetAdminProjectsList, + this.patientERGetAllDriversList, + this.patientERGetAllNeedAproveStatusList, + this.patientERGetAllPresOrdersStatusList, + this.patientERGetAllProjectsList, + this.patientERGetArchiveInformationList, + this.patientERGetAskDoctorTotalByDateFilterList, + this.patientERGetBookScheduleConfigsList, + this.patientERGetClinicAndTimeAndEpisodeForAppointmentList, + this.patientERGetClinicAndTimeForDischargeList, + this.patientERGetDashboardDataforApporvalSectionForAdminList, + this.patientERGetDashboardDataforApporvalSectionList, + this.patientERGetDashboardDataforHHCSectionForAdminList, + this.patientERGetDashboardDataforHHCSectionList, + this.patientERGetDashboardDataforPrescriptionSectionForAdminList, + this.patientERGetDashboardDataforPrescriptionSectionList, + this.patientERGetDoctorDashboardDataModelList, + this.patientERGetDriverLocationList, + this.patientERGetInsuranceCardRequestByDateFilterList, + this.patientERGetLiveCareSummaryBookedAppoinmentStatusList, + this.patientERGetLiveCareSummaryCovidList, + this.patientERGetLiveCareSummaryForCMCList, + this.patientERGetLiveCareSummaryForHHCList, + this.patientERGetLiveCareSummaryForHomeDeliveryList, + this.patientERGetLiveCareSummaryForInsuranceCardRequestList, + this.patientERGetLiveCareSummaryForNewFilesList, + this.patientERGetLiveCareSummaryForOnlinePaymetRequestList, + this.patientERGetLiveCareSummaryForOnlinePharmacyOrdersList, + this.patientERGetLiveCareSummaryForTrasnportationList, + this.patientERGetLiveCareSummaryLiveCareCountsList, + this.patientERGetMedicalRequestTotalByDateFilterList, + this.patientERGetNearestPendingOrdersList, + this.patientERGetNeedAproveHistoryForOrderList, + this.patientERGetNeedAprovePendingOrdersList, + this.patientERGetNeedAproveStatusStatisticsList, + this.patientERGetPatientAllPresOrdersList, + this.patientERGetPendingPatientsCountList, + this.patientERGetPresOrdersHistoryForAdminList, + this.patientERGetPresOrdersHistoryForOrderList, + this.patientERGetPresOrdersStatusStatisticsList, + this.patientERHHCRequest, + this.patientERHHCRequestSummaryByProject, + this.patientERHHCRequestWithTotal, + this.patientERHHCGetAllServicesList, + this.patientERHHCGetTransactionsForOrderList, + this.patientERHomeDeliveryCounts, + this.patientERInsertDriver, + this.patientERInsertNewCurrentDoctorsOutputsList, + this.patientERInsuranceStatusCountList, + this.patientERIsNearestProjectUpdated, + this.patientERIsNeedAproveReturnedToQueue, + this.patientERIsNeedAproveUpdated, + this.patientERIsOrderClientRequestUpdated, + this.patientERIsOrderReturnedToQueue, + this.patientERIsPresOrderInserted, + this.patientERIsPresOrderUpdated, + this.patientERIsProjectUpdated, + this.patientERNotCompletedDetails, + this.patientERPatientsCountByCallStatus, + this.patientERPeakHourCounts, + this.patientERPresOrderInfo, + this.patientERPrescriptionCounts, + this.patientERProjectsContribution, + this.patientERRRTGetAllQuestionsList, + this.patientERRRTGetAllTransportationMethodList, + this.patientERRRTGetPickUpRequestByPresOrderIDList, + this.patientERRealRRTGetAllServicesList, + this.patientERRealRRTGetOrderDetailsList, + this.patientERRealRRTGetTransactionsForOrderList, + this.patientERRealRRTIsTransInserted, + this.patientERRequestList, + this.patientERTransportationRequestWithTotal, + this.patientERealRRTGetServicePriceList, + this.patientInfoByAdmissionNoList, + this.patientMonitorGetPatientHeartRate, + this.patientNotServedCounts, + this.patientPrescriptionList, + this.patientAllergies, + this.patientCheckAppointmentValidationList, + this.patientLoginTokenList, + this.patientQRLoginInfoList, + this.patientSELECTDeviceIMEIbyIMEIList, + this.pharmList, + this.prefLang, + this.radReportUnreadNo, + this.radGetPatientRadOrdersForDentalList, + this.referralNumber, + this.reminderConfigurations, + this.requestNo, + this.rowCount, + this.servicePrivilegeList, + this.shareFamilyFileObj, + this.status, + this.successCode, + this.surveyRate, + this.symptomCheckerConditionList, + this.symptomCheckerGetAllDefaultQuestionsList, + this.symptomCheckerGetBodyPartSymptomsList, + this.symptomCheckerGetBodyPartsByCodeList, + this.symptomCheckerGetBodyPartsList, + this.symptomCheckerJsonResponseInString, + this.timerTime, + this.totalAdvanceBalanceAmount, + this.totalPatientsCount, + this.totalPendingApprovalCount, + this.totalUnUsedCount, + this.transactionNo, + this.unReadCounts, + this.updateStatus, + this.userAgreementContent, + this.yahalaAccountNo, + this.check24HourComplaint, + this.currency, + this.message, + this.patientID, + this.returnValue, + this.returnValueStr, + this.statusCode}); + + LacumAccountInformation.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']; + accountStatus = json['AccountStatus']; + activeArchiveObject = json['ActiveArchiveObject']; + activeMedicationCount = json['ActiveMedicationCount']; + allMedicationTakenDuringAdmissionList = + json['AllMedicationTakenDuringAdmission_List']; + appointmentNo = json['AppointmentNo']; + arePatientsOnlineList = json['ArePatientsOnlineList']; + balanceAmount = json['BalanceAmount']; + bloodGroupList = json['BloodGroupList']; + cVIUnreadCount = json['CVI_UnreadCount']; + checkUserHasAccount = json['CheckUserHasAccount']; + complaintNo = json['ComplaintNo']; + dischargeList = json['DischargeList']; + episodeID = json['EpisodeID']; + finalRadiologyList = json['FinalRadiologyList']; + fullName = json['FullName']; + geoFPointsList = json['GeoF_PointsList']; + geoGetPateintInfo = json['GeoGetPateintInfo']; + getAllDoctorsByProjectAndClinicList = + json['GetAllDoctorsByProjectAndClinicList']; + getAppointmentNumbersForDoctorList = + json['GetAppointmentNumbersForDoctorList']; + getCheckUpItemsList = json['GetCheckUpItemsList']; + getCosmeticConferenceForTodayList = + json['GetCosmeticConferenceForTodayList']; + getDoctorERClinicResult = json['GetDoctorERClinicResult']; + getInvoiceApprovalList = json['GetInvoiceApprovalList']; + getNearestProjectList = json['GetNearestProjectList']; + getPatientAdmissionOrAppoinmentNoList = + json['GetPatientAdmissionOrAppoinmentNo_List']; + getPatientBloodType = json['GetPatientBloodType']; + getPatientInsuranceCardStatusStatisticsList = + json['GetPatientInsuranceCardStatusStatisticsList']; + getSurveyList = json['GetSurveyList']; + getTotalRegisteredPatientList = json['GetTotalRegisteredPatientList']; + getUserDetailsList = json['GetUserDetailsList']; + getCustomerPointInfo = json['Get_CustomerPointInfo']; + hISApprovalList = json['HIS_Approval_List']; + hISInpAdmissionList = json['HIS_InpAdmission_List']; + hISProgNoteAssesmentModelList = json['HIS_ProgNoteAssesmentModel_List']; + hMGGetAllOffersList = json['HMG_GetAllOffersList']; + hasApproval = json['Has_Approval']; + hasConsultation = json['Has_Consultation']; + hasDental = json['Has_Dental']; + hasLab = json['Has_Lab']; + hasPharmacy = json['Has_Pharmacy']; + hasRad = json['Has_Rad']; + hmgSMSGetByProjectIDAndPatientIDList = + json['Hmg_SMS_Get_By_ProjectID_And_PatientIDList']; + hoursLeft = json['HoursLeft']; + iNPMGetAllAdmissionList = json['INPM_GetAllAdmission_List']; + iNPMGetPatientInfoForSickLeaveReportList = + json['INPM_GetPatientInfoForSickLeaveReport_List']; + iNPMHISPatientMedicalStatusUnreadCount = + json['INPM_HIS_PatientMedicalStatus_UnreadCount']; + iNPMLABGetPatientLabOrdersResultsList = + json['INPM_LAB_GetPatientLabOrdersResults_List']; + iNPMLABGetPatientLabResultsList = + json['INPM_LAB_GetPatientLabResults_List']; + iNPMLABGetPatientRADReportList = json['INPM_LAB_GetPatientRADReport_List']; + iNPMLABGetPatientRadResultsList = + json['INPM_LAB_GetPatientRadResults_List']; + iNPMRadGetPatientRadOrdersCVIList = + json['INPM_Rad_GetPatientRadOrders_CVI_List']; + iNPMRadGetPatientRadOrdersList = json['INPM_Rad_GetPatientRadOrders_List']; + iNPMRadGetRadMedicalRecordsList = + json['INPM_Rad_GetRadMedicalRecords_List']; + iNPGetPrescriptionDischargesList = + json['INP_GetPrescriptionDischarges_List']; + iNPGetPrescriptionReportList = json['INP_GetPrescriptionReport_List']; + identificationNo = json['IdentificationNo']; + isHomeMedicineDeliverySupported = json['IsHomeMedicineDeliverySupported']; + isInsertedOrUpdated = json['IsInsertedOrUpdated']; + isMainAcoountEqualPatienID = json['IsMainAcoountEqualPatienID']; + isPatientAlreadyAgreed = json['IsPatientAlreadyAgreed']; + isPatientCallBackBlackList = json['IsPatientCallBackBlackList']; + isPatientHaveFingerPrint = json['IsPatientHaveFingerPrint']; + isPatientOnline = json['IsPatientOnline']; + isPatientTokenRemoved = json['IsPatientTokenRemoved']; + isPaused = json['IsPaused']; + isProjectWorkingHours = json['IsProjectWorkingHours']; + isStoreRateAllowed = json['IsStoreRateAllowed']; + isStoreRateInserted = json['IsStoreRateInserted']; + isStoreRateUpdated = json['IsStoreRateUpdated']; + labRadUpdatedToRead = json['LabRadUpdatedToRead']; + labReportUnreadNo = json['LabReportUnreadNo']; + lakumInquiryInformationObj = json['LakumInquiryInformationObj']; + lakumInquiryInformationObjVersion = + json['LakumInquiryInformationObjVersion'] != null + ? new LakumInquiryInformationObjVersion.fromJson( + json['LakumInquiryInformationObjVersion']) + : null; + lakumResponseList = json['LakumResponseList']; + laserGetBodyPartsByCategoryList = json['Laser_GetBodyPartsByCategoryList']; + laserGetCategoriesList = json['Laser_GetCategoriesList']; + list = json['List']; + listCount = json['ListCount']; + listCountDeliverd = json['ListCountDeliverd']; + listCountUnDeliverd = json['ListCountUnDeliverd']; + listDeviceInfo = json['ListDeviceInfo']; + listFamilyAppointments = json['ListFamilyAppointments']; + listLabResultsByAppNo = json['ListLabResultsByAppNo']; + listLakumInquiryInformationObj = json['ListLakumInquiryInformationObj']; + listOpinionGetAllPeriod = json['ListOpinion_GetAllPeriod']; + listOpinionGetAllServices = json['ListOpinion_GetAllServices']; + listOpinionGetIsAgreeValue = json['ListOpinion_GetIsAgreeValue']; + listOpinionGetOpinionLogin = json['ListOpinion_GetOpinionLogin']; + listOpinionGetRequestedSerives = json['ListOpinion_GetRequestedSerives']; + listOpinionGetShareServicesDetails = + json['ListOpinion_GetShareServicesDetails']; + listOpinionUserTerms = json['ListOpinion_UserTerms']; + listPLO = json['ListPLO']; + listPLR = json['ListPLR']; + listPLSR = json['ListPLSR']; + listPRM = json['ListPRM']; + listPatientFamilyFiles = json['ListPatientFamilyFiles']; + listPatientFileInfo = json['ListPatientFileInfo']; + listRAD = json['ListRAD']; + listRADAPI = json['ListRADAPI']; + listActiveGetPrescriptionReportByPatientID = + json['List_ActiveGetPrescriptionReportByPatientID']; + listAppointmentsForDentalClinic = json['List_AppointmentsForDentalClinic']; + listBabyInfoResult = json['List_BabyInfoResult']; + listCheckInsuranceCoverage = json['List_CheckInsuranceCoverage']; + listCompanyClass = json['List_CompanyClass']; + listConsentMedicalReport = json['List_ConsentMedicalReport']; + listDentalAppointments = json['List_DentalAppointments']; + listDeviceTokenIDByAppointmentNo = + json['List_DeviceTokenIDByAppointmentNo']; + listDischargeDiagnosis = json['List_DischargeDiagnosis']; + listDischargeMedicine = json['List_DischargeMedicine']; + listDischargeSummary = json['List_DischargeSummary']; + listDoctorResponse = json['List_DoctorResponse']; + listDoneVaccines = json['List_DoneVaccines']; + listEReferralResult = json['List_EReferralResult']; + listEReferrals = json['List_EReferrals']; + listGetAllPatientsLiveCareAdmin = + json['List_GetAllPatients_LiveCare_Admin']; + listGetDataForExcel = json['List_GetDataForExcel']; + listGetMainCountID = json['List_GetMainCountID']; + listGetPrescriptionReportByPatientID = + json['List_GetPrescriptionReportByPatientID']; + listGetSickLeave = json['List_GetSickLeave']; + listHISInvoice = json['List_HISInvoice']; + listHISInvoiceProcedures = json['List_HISInvoiceProcedures']; + listInpatientInvoices = json['List_InpatientInvoices']; + listInsuranceCheckList = json['List_InsuranceCheckList']; + listInsuranceCompanies = json['List_InsuranceCompanies']; + listInsuranceCompaniesGroup = json['List_InsuranceCompaniesGroup']; + listInsuranceUpdateDetails = json['List_InsuranceUpdateDetails']; + listInvoiceApprovalProcedureInfo = + json['List_InvoiceApprovalProcedureInfo']; + listIsLastSatisfactionSurveyReviewedModel = + json['List_IsLastSatisfactionSurveyReviewedModel']; + listLabOrderDetailsModel = json['List_LabOrderDetailsModel']; + listMedicalReport = json['List_MedicalReport']; + listMedicalReportApprovals = json['List_MedicalReportApprovals']; + listMedicalReportStatus = json['List_MedicalReportStatus']; + listMonthBloodPressureResult = json['List_MonthBloodPressureResult']; + listMonthBloodPressureResultAverage = + json['List_MonthBloodPressureResultAverage']; + listMonthDiabtecPatientResult = json['List_MonthDiabtecPatientResult']; + listMonthDiabtectResultAverage = json['List_MonthDiabtectResultAverage']; + listMonthWeightMeasurementResult = + json['List_MonthWeightMeasurementResult']; + listMonthWeightMeasurementResultAverage = + json['List_MonthWeightMeasurementResultAverage']; + listOnlinePrescriptionResult = json['List_OnlinePrescriptionResult']; + listOutPatientInvoices = json['List_OutPatientInvoices']; + listPHRInvoice = json['List_PHRInvoice']; + listPHRInvoiceItems = json['List_PHRInvoiceItems']; + listPHRPaymentMethods = json['List_PHRPaymentMethods']; + listPateintDetails = json['List_PateintDetails']; + listPateintInformation = json['List_PateintInformation']; + listPatientAdmissionInfo = json['List_PatientAdmissionInfo']; + listPatientAdvanceBalanceAmount = json['List_PatientAdvanceBalanceAmount']; + listPatientCallBackLogs = json['List_PatientCallBackLogs']; + listPatientCallBackToUpdateFromICServer = + json['List_PatientCallBackToUpdateFromICServer']; + listPatientCount = json['List_PatientCount']; + listPatientDashboard = json['List_PatientDashboard']; + listPatientERGetAdminClinicsModel = + json['List_PatientER_GetAdminClinicsModel']; + listPatientERGetAdminProjectsModel = + json['List_PatientER_GetAdminProjectsModel']; + listPatientERGetAllClinicsModel = json['List_PatientER_GetAllClinicsModel']; + listPatientHISInvoices = json['List_PatientHISInvoices']; + listPatientICProjects = json['List_PatientICProjects']; + listPatientICProjectsByID = json['List_PatientICProjectsByID']; + listPatientICProjectsTimings = json['List_PatientICProjectsTimings']; + listPatientIDByUID = json['List_PatientIDByUID']; + listPatientIDForSurveyResult = json['List_PatientIDForSurveyResult']; + listPatientInfo = json['List_PatientInfo']; + listPatientInfoForDDScreen = json['List_PatientInfoForDDScreen']; + listPatientInfoForSickleaveReport = + json['List_PatientInfoForSickleaveReport']; + listPatientInsuranceCard = json['List_PatientInsuranceCard']; + listPatientInsuranceCardHistory = json['List_PatientInsuranceCardHistory']; + listPatientInsuranceDetails = json['List_PatientInsuranceDetails']; + listPatientPHRInvoices = json['List_PatientPHRInvoices']; + listPatientServicePoint = json['List_PatientServicePoint']; + listPatientStatusCount = json['List_PatientStatusCount']; + listPatientChatRequestMapModel = json['List_Patient_ChatRequestMapModel']; + listPatientChatRequestModel = json['List_Patient_ChatRequestModel']; + listPatientChatRequestVCModel = json['List_Patient_ChatRequestVCModel']; + listPaymentMethods = json['List_PaymentMethods']; + listPointServices = json['List_PointServices']; + listPregnancyStagesInfo = json['List_PregnancyStagesInfo']; + listProjectAvgERWaitingTime = json['List_ProjectAvgERWaitingTime']; + listProjectAvgERWaitingTimeHourly = + json['List_ProjectAvgERWaitingTimeHourly']; + listRadMedicalRecords = json['List_RadMedicalRecords']; + listRadMedicalRecordsAPI = json['List_RadMedicalRecordsAPI']; + listRadMedicalRecordsCVI = json['List_RadMedicalRecordsCVI']; + listRadMedicalRecordsCVIAPI = json['List_RadMedicalRecordsCVIAPI']; + listRadMedicalRecordsResults = json['List_RadMedicalRecordsResults']; + listSickLeave = json['List_SickLeave']; + listTransaction = json['List_Transaction']; + listVideoConferenceSessions = json['List_VideoConferenceSessions']; + listWeekBloodPressureResult = json['List_WeekBloodPressureResult']; + listWeekBloodPressureResultAverage = + json['List_WeekBloodPressureResultAverage']; + listWeekDiabtecPatientResult = json['List_WeekDiabtecPatientResult']; + listWeekDiabtectResultAverage = json['List_WeekDiabtectResultAverage']; + listWeekWeightMeasurementResult = json['List_WeekWeightMeasurementResult']; + listWeekWeightMeasurementResultAverage = + json['List_WeekWeightMeasurementResultAverage']; + listYearBloodPressureResult = json['List_YearBloodPressureResult']; + listYearBloodPressureResultAverage = + json['List_YearBloodPressureResultAverage']; + listYearDiabtecPatientResult = json['List_YearDiabtecPatientResult']; + listYearDiabtecResultAverage = json['List_YearDiabtecResultAverage']; + listYearWeightMeasurementResult = json['List_YearWeightMeasurementResult']; + listYearWeightMeasurementResultAverage = + json['List_YearWeightMeasurementResultAverage']; + listEInvoiceForDental = json['List_eInvoiceForDental']; + listEInvoiceForOnlineCheckIn = json['List_eInvoiceForOnlineCheckIn']; + medGetActivitiesTransactionsStsList = + json['Med_GetActivitiesTransactionsStsList']; + medGetAvgMonthTransactionsStsList = + json['Med_GetAvgMonthTransactionsStsList']; + medGetAvgWeekTransactionsStsList = + json['Med_GetAvgWeekTransactionsStsList']; + medGetCategoriesList = json['Med_GetCategoriesList']; + medGetMonthActivitiesTransactionsStsList = + json['Med_GetMonthActivitiesTransactionsStsList']; + medGetMonthStepsTransactionsStsList = + json['Med_GetMonthStepsTransactionsStsList']; + medGetMonthTransactionsStsList = json['Med_GetMonthTransactionsStsList']; + medGetPatientLastRecordList = json['Med_GetPatientLastRecordList']; + medGetSubCategoriesList = json['Med_GetSubCategoriesList']; + medGetTransactionsAndActTransactionsResult = + json['Med_GetTransactionsAndActTransactionsResult']; + medGetTransactionsList = json['Med_GetTransactionsList']; + medGetWeekActivitiesTransactionsStsList = + json['Med_GetWeekActivitiesTransactionsStsList']; + medGetWeekStepsTransactionsStsList = + json['Med_GetWeekStepsTransactionsStsList']; + medGetWeekTransactionsStsList = json['Med_GetWeekTransactionsStsList']; + medGetYearActivitiesTransactionsStsList = + json['Med_GetYearActivitiesTransactionsStsList']; + medGetYearSleepTransactionsStsList = + json['Med_GetYearSleepTransactionsStsList']; + medGetYearStepsTransactionsStsList = + json['Med_GetYearStepsTransactionsStsList']; + medGetYearTransactionsStsList = json['Med_GetYearTransactionsStsList']; + medInsertTransactionsOutputsList = + json['Med_InsertTransactionsOutputsList']; + medicalRecordImages = json['MedicalRecordImages']; + medicalReportToRead = json['MedicalReportToRead']; + medicalReportUnreadNo = json['MedicalReportUnreadNo']; + missingIDCardAttachment = json['Missing_IDCardAttachment']; + missingInsuranceCardAttachment = json['Missing_InsuranceCardAttachment']; + missingMedicalReportAttachment = json['Missing_MedicalReportAttachment']; + missingOtherRelationship = json['Missing_OtherRelationship']; + missingPatientContactNo = json['Missing_PatientContactNo']; + missingPatientId = json['Missing_PatientId']; + missingPatientIdentityNumber = json['Missing_PatientIdentityNumber']; + missingPatientName = json['Missing_PatientName']; + missingReferralContactNo = json['Missing_ReferralContactNo']; + missingReferralRelationship = json['Missing_ReferralRelationship']; + missingReferralRequesterName = json['Missing_ReferralRequesterName']; + mobileNumber = json['MobileNumber']; + nationalityNumber = json['NationalityNumber']; + onlineCheckInAppointments = json['OnlineCheckInAppointments']; + opinionUserAgreementContent = json['Opinion_UserAgreementContent']; + orderInsert = json['OrderInsert']; + pateintInfoForUpdateList = json['PateintInfoForUpdateList']; + pateintUpatedList = json['PateintUpatedList']; + patientBirthdayCertificate = json['PatientBirthdayCertificate']; + patientERCMCRequestSummaryByProject = + json['PatientER_CMCRequestSummaryByProject']; + patientERCMCRequestWithTotal = json['PatientER_CMCRequestWithTotal']; + patientERCMCGetAllServicesList = json['PatientER_CMC_GetAllServicesList']; + patientERCMCGetTransactionsForOrderList = + json['PatientER_CMC_GetTransactionsForOrderList']; + patientERCoordinates = json['PatientER_Coordinates']; + patientERCountOrderList = json['PatientER_CountOrderList']; + patientERCountsForApprovalOffice = + json['PatientER_CountsForApprovalOffice']; + patientERDeleteOldCurrentDoctorsOutputsList = + json['PatientER_DeleteOldCurrentDoctorsOutputsList']; + patientERDeliveryGetAllDeliverdOrderList = + json['PatientER_Delivery_GetAllDeliverdOrderList']; + patientERDeliveryGetAllOrderList = + json['PatientER_Delivery_GetAllOrderList']; + patientERDeliveryIsOrderInserted = + json['PatientER_Delivery_IsOrderInserted']; + patientERDeliveryIsOrderUpdated = json['PatientER_Delivery_IsOrderUpdated']; + patientERDeliveryIsPausedChanged = + json['PatientER_Delivery_IsPausedChanged']; + patientERDeliveryNextOrder = json['PatientER_Delivery_NextOrder']; + patientERDeliveryOrderInsert = json['PatientER_Delivery_OrderInsert']; + patientERDeliveryUpdateOrderStatus = + json['PatientER_Delivery_UpdateOrderStatus']; + patientERDriverUpdate = json['PatientER_DriverUpdate']; + patientERExacartCheckIsDispenseAccpetableList = + json['PatientER_Exacart_CheckIsDispenseAccpetableList']; + patientERExacartGetDispenseQuantitiesByOrderIDList = + json['PatientER_Exacart_GetDispenseQuantitiesByOrderIDList']; + patientERExacartGetOrderDetailsByePharmacyOrderNoList = + json['PatientER_Exacart_GetOrderDetailsByePharmacyOrderNoList']; + patientERExacartGetOrderDetailsList = + json['PatientER_Exacart_GetOrderDetailsList']; + patientERExacartGetTotalDispenseQuantitiesByPresNoList = + json['PatientER_Exacart_GetTotalDispenseQuantitiesByPresNoList']; + patientERExacartIsDispenseAdded = json['PatientER_Exacart_IsDispenseAdded']; + patientERExacartIsDispenseAddedList = + json['PatientER_Exacart_IsDispenseAddedList']; + patientERExacartIsOrderCompleted = + json['PatientER_Exacart_IsOrderCompleted']; + patientERGetAdminByProjectAndRoleList = + json['PatientER_GetAdminByProjectAndRoleList']; + patientERGetAdminProjectsList = json['PatientER_GetAdminProjectsList']; + patientERGetAllDriversList = json['PatientER_GetAllDriversList']; + patientERGetAllNeedAproveStatusList = + json['PatientER_GetAllNeedAproveStatusList']; + patientERGetAllPresOrdersStatusList = + json['PatientER_GetAllPresOrdersStatusList']; + patientERGetAllProjectsList = json['PatientER_GetAllProjectsList']; + patientERGetArchiveInformationList = + json['PatientER_GetArchiveInformation_List']; + patientERGetAskDoctorTotalByDateFilterList = + json['PatientER_GetAskDoctorTotalByDateFilterList']; + patientERGetBookScheduleConfigsList = + json['PatientER_GetBookScheduleConfigsList']; + patientERGetClinicAndTimeAndEpisodeForAppointmentList = + json['PatientER_GetClinicAndTimeAndEpisodeForAppointmentList']; + patientERGetClinicAndTimeForDischargeList = + json['PatientER_GetClinicAndTimeForDischargeList']; + patientERGetDashboardDataforApporvalSectionForAdminList = + json['PatientER_GetDashboardDataforApporvalSectionForAdminList']; + patientERGetDashboardDataforApporvalSectionList = + json['PatientER_GetDashboardDataforApporvalSectionList']; + patientERGetDashboardDataforHHCSectionForAdminList = + json['PatientER_GetDashboardDataforHHCSectionForAdminList']; + patientERGetDashboardDataforHHCSectionList = + json['PatientER_GetDashboardDataforHHCSectionList']; + patientERGetDashboardDataforPrescriptionSectionForAdminList = + json['PatientER_GetDashboardDataforPrescriptionSectionForAdminList']; + patientERGetDashboardDataforPrescriptionSectionList = + json['PatientER_GetDashboardDataforPrescriptionSectionList']; + patientERGetDoctorDashboardDataModelList = + json['PatientER_GetDoctorDashboardDataModelList']; + patientERGetDriverLocationList = json['PatientER_GetDriverLocationList']; + patientERGetInsuranceCardRequestByDateFilterList = + json['PatientER_GetInsuranceCardRequestByDateFilterList']; + patientERGetLiveCareSummaryBookedAppoinmentStatusList = + json['PatientER_GetLiveCareSummaryBookedAppoinmentStatusList']; + patientERGetLiveCareSummaryCovidList = + json['PatientER_GetLiveCareSummaryCovidList']; + patientERGetLiveCareSummaryForCMCList = + json['PatientER_GetLiveCareSummaryForCMCList']; + patientERGetLiveCareSummaryForHHCList = + json['PatientER_GetLiveCareSummaryForHHCList']; + patientERGetLiveCareSummaryForHomeDeliveryList = + json['PatientER_GetLiveCareSummaryForHomeDeliveryList']; + patientERGetLiveCareSummaryForInsuranceCardRequestList = + json['PatientER_GetLiveCareSummaryForInsuranceCardRequestList']; + patientERGetLiveCareSummaryForNewFilesList = + json['PatientER_GetLiveCareSummaryForNewFilesList']; + patientERGetLiveCareSummaryForOnlinePaymetRequestList = + json['PatientER_GetLiveCareSummaryForOnlinePaymetRequestList']; + patientERGetLiveCareSummaryForOnlinePharmacyOrdersList = + json['PatientER_GetLiveCareSummaryForOnlinePharmacyOrdersList']; + patientERGetLiveCareSummaryForTrasnportationList = + json['PatientER_GetLiveCareSummaryForTrasnportationList']; + patientERGetLiveCareSummaryLiveCareCountsList = + json['PatientER_GetLiveCareSummaryLiveCareCountsList']; + patientERGetMedicalRequestTotalByDateFilterList = + json['PatientER_GetMedicalRequestTotalByDateFilterList']; + patientERGetNearestPendingOrdersList = + json['PatientER_GetNearestPendingOrdersList']; + patientERGetNeedAproveHistoryForOrderList = + json['PatientER_GetNeedAproveHistoryForOrderList']; + patientERGetNeedAprovePendingOrdersList = + json['PatientER_GetNeedAprovePendingOrdersList']; + patientERGetNeedAproveStatusStatisticsList = + json['PatientER_GetNeedAproveStatusStatisticsList']; + patientERGetPatientAllPresOrdersList = + json['PatientER_GetPatientAllPresOrdersList']; + patientERGetPendingPatientsCountList = + json['PatientER_GetPendingPatientsCountList']; + patientERGetPresOrdersHistoryForAdminList = + json['PatientER_GetPresOrdersHistoryForAdminList']; + patientERGetPresOrdersHistoryForOrderList = + json['PatientER_GetPresOrdersHistoryForOrderList']; + patientERGetPresOrdersStatusStatisticsList = + json['PatientER_GetPresOrdersStatusStatisticsList']; + patientERHHCRequest = json['PatientER_HHCRequest']; + patientERHHCRequestSummaryByProject = + json['PatientER_HHCRequestSummaryByProject']; + patientERHHCRequestWithTotal = json['PatientER_HHCRequestWithTotal']; + patientERHHCGetAllServicesList = json['PatientER_HHC_GetAllServicesList']; + patientERHHCGetTransactionsForOrderList = + json['PatientER_HHC_GetTransactionsForOrderList']; + patientERHomeDeliveryCounts = json['PatientER_HomeDeliveryCounts']; + patientERInsertDriver = json['PatientER_InsertDriver']; + patientERInsertNewCurrentDoctorsOutputsList = + json['PatientER_InsertNewCurrentDoctorsOutputsList']; + patientERInsuranceStatusCountList = + json['PatientER_InsuranceStatusCountList']; + patientERIsNearestProjectUpdated = + json['PatientER_IsNearestProjectUpdated']; + patientERIsNeedAproveReturnedToQueue = + json['PatientER_IsNeedAproveReturnedToQueue']; + patientERIsNeedAproveUpdated = json['PatientER_IsNeedAproveUpdated']; + patientERIsOrderClientRequestUpdated = + json['PatientER_IsOrderClientRequestUpdated']; + patientERIsOrderReturnedToQueue = json['PatientER_IsOrderReturnedToQueue']; + patientERIsPresOrderInserted = json['PatientER_IsPresOrderInserted']; + patientERIsPresOrderUpdated = json['PatientER_IsPresOrderUpdated']; + patientERIsProjectUpdated = json['PatientER_IsProjectUpdated']; + patientERNotCompletedDetails = json['PatientER_NotCompletedDetails']; + patientERPatientsCountByCallStatus = + json['PatientER_PatientsCountByCallStatus']; + patientERPeakHourCounts = json['PatientER_PeakHourCounts']; + patientERPresOrderInfo = json['PatientER_PresOrderInfo']; + patientERPrescriptionCounts = json['PatientER_PrescriptionCounts']; + patientERProjectsContribution = json['PatientER_ProjectsContribution']; + patientERRRTGetAllQuestionsList = json['PatientER_RRT_GetAllQuestionsList']; + patientERRRTGetAllTransportationMethodList = + json['PatientER_RRT_GetAllTransportationMethodList']; + patientERRRTGetPickUpRequestByPresOrderIDList = + json['PatientER_RRT_GetPickUpRequestByPresOrderIDList']; + patientERRealRRTGetAllServicesList = + json['PatientER_RealRRT_GetAllServicesList']; + patientERRealRRTGetOrderDetailsList = + json['PatientER_RealRRT_GetOrderDetailsList']; + patientERRealRRTGetTransactionsForOrderList = + json['PatientER_RealRRT_GetTransactionsForOrderList']; + patientERRealRRTIsTransInserted = json['PatientER_RealRRT_IsTransInserted']; + patientERRequestList = json['PatientER_RequestList']; + patientERTransportationRequestWithTotal = + json['PatientER_TransportationRequestWithTotal']; + patientERealRRTGetServicePriceList = + json['PatientE_RealRRT_GetServicePriceList']; + patientInfoByAdmissionNoList = json['PatientInfoByAdmissionNo_List']; + patientMonitorGetPatientHeartRate = + json['PatientMonitor_GetPatientHeartRate']; + patientNotServedCounts = json['PatientNotServedCounts']; + patientPrescriptionList = json['PatientPrescriptionList']; + patientAllergies = json['Patient_Allergies']; + patientCheckAppointmentValidationList = + json['Patient_CheckAppointmentValidationList']; + patientLoginTokenList = json['Patient_LoginTokenList']; + patientQRLoginInfoList = json['Patient_QRLoginInfoList']; + patientSELECTDeviceIMEIbyIMEIList = + json['Patient_SELECTDeviceIMEIbyIMEIList']; + pharmList = json['PharmList']; + prefLang = json['PrefLang']; + radReportUnreadNo = json['RadReportUnreadNo']; + radGetPatientRadOrdersForDentalList = + json['Rad_GetPatientRadOrdersForDental_List']; + referralNumber = json['ReferralNumber']; + reminderConfigurations = json['ReminderConfigurations']; + requestNo = json['RequestNo']; + rowCount = json['RowCount']; + servicePrivilegeList = json['ServicePrivilegeList']; + shareFamilyFileObj = json['ShareFamilyFileObj']; + status = json['Status']; + successCode = json['SuccessCode']; + surveyRate = json['SurveyRate']; + symptomCheckerConditionList = json['SymptomChecker_ConditionList']; + symptomCheckerGetAllDefaultQuestionsList = + json['SymptomChecker_GetAllDefaultQuestionsList']; + symptomCheckerGetBodyPartSymptomsList = + json['SymptomChecker_GetBodyPartSymptomsList']; + symptomCheckerGetBodyPartsByCodeList = + json['SymptomChecker_GetBodyPartsByCodeList']; + symptomCheckerGetBodyPartsList = json['SymptomChecker_GetBodyPartsList']; + symptomCheckerJsonResponseInString = + json['SymptomChecker_JsonResponseInString']; + timerTime = json['TimerTime']; + totalAdvanceBalanceAmount = json['TotalAdvanceBalanceAmount']; + totalPatientsCount = json['TotalPatientsCount']; + totalPendingApprovalCount = json['TotalPendingApprovalCount']; + totalUnUsedCount = json['TotalUnUsedCount']; + transactionNo = json['TransactionNo']; + unReadCounts = json['UnReadCounts']; + updateStatus = json['UpdateStatus']; + userAgreementContent = json['UserAgreementContent']; + yahalaAccountNo = json['YahalaAccountNo']; + check24HourComplaint = json['check24HourComplaint']; + currency = json['currency']; + message = json['message']; + patientID = json['patientID']; + returnValue = json['returnValue']; + returnValueStr = json['returnValueStr']; + statusCode = json['statusCode']; + } + + 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['AccountStatus'] = this.accountStatus; + data['ActiveArchiveObject'] = this.activeArchiveObject; + data['ActiveMedicationCount'] = this.activeMedicationCount; + data['AllMedicationTakenDuringAdmission_List'] = + this.allMedicationTakenDuringAdmissionList; + data['AppointmentNo'] = this.appointmentNo; + data['ArePatientsOnlineList'] = this.arePatientsOnlineList; + data['BalanceAmount'] = this.balanceAmount; + data['BloodGroupList'] = this.bloodGroupList; + data['CVI_UnreadCount'] = this.cVIUnreadCount; + data['CheckUserHasAccount'] = this.checkUserHasAccount; + data['ComplaintNo'] = this.complaintNo; + data['DischargeList'] = this.dischargeList; + data['EpisodeID'] = this.episodeID; + data['FinalRadiologyList'] = this.finalRadiologyList; + data['FullName'] = this.fullName; + data['GeoF_PointsList'] = this.geoFPointsList; + data['GeoGetPateintInfo'] = this.geoGetPateintInfo; + data['GetAllDoctorsByProjectAndClinicList'] = + this.getAllDoctorsByProjectAndClinicList; + data['GetAppointmentNumbersForDoctorList'] = + this.getAppointmentNumbersForDoctorList; + data['GetCheckUpItemsList'] = this.getCheckUpItemsList; + data['GetCosmeticConferenceForTodayList'] = + this.getCosmeticConferenceForTodayList; + data['GetDoctorERClinicResult'] = this.getDoctorERClinicResult; + data['GetInvoiceApprovalList'] = this.getInvoiceApprovalList; + data['GetNearestProjectList'] = this.getNearestProjectList; + data['GetPatientAdmissionOrAppoinmentNo_List'] = + this.getPatientAdmissionOrAppoinmentNoList; + data['GetPatientBloodType'] = this.getPatientBloodType; + data['GetPatientInsuranceCardStatusStatisticsList'] = + this.getPatientInsuranceCardStatusStatisticsList; + data['GetSurveyList'] = this.getSurveyList; + data['GetTotalRegisteredPatientList'] = this.getTotalRegisteredPatientList; + data['GetUserDetailsList'] = this.getUserDetailsList; + data['Get_CustomerPointInfo'] = this.getCustomerPointInfo; + data['HIS_Approval_List'] = this.hISApprovalList; + data['HIS_InpAdmission_List'] = this.hISInpAdmissionList; + data['HIS_ProgNoteAssesmentModel_List'] = + this.hISProgNoteAssesmentModelList; + data['HMG_GetAllOffersList'] = this.hMGGetAllOffersList; + data['Has_Approval'] = this.hasApproval; + data['Has_Consultation'] = this.hasConsultation; + data['Has_Dental'] = this.hasDental; + data['Has_Lab'] = this.hasLab; + data['Has_Pharmacy'] = this.hasPharmacy; + data['Has_Rad'] = this.hasRad; + data['Hmg_SMS_Get_By_ProjectID_And_PatientIDList'] = + this.hmgSMSGetByProjectIDAndPatientIDList; + data['HoursLeft'] = this.hoursLeft; + data['INPM_GetAllAdmission_List'] = this.iNPMGetAllAdmissionList; + data['INPM_GetPatientInfoForSickLeaveReport_List'] = + this.iNPMGetPatientInfoForSickLeaveReportList; + data['INPM_HIS_PatientMedicalStatus_UnreadCount'] = + this.iNPMHISPatientMedicalStatusUnreadCount; + data['INPM_LAB_GetPatientLabOrdersResults_List'] = + this.iNPMLABGetPatientLabOrdersResultsList; + data['INPM_LAB_GetPatientLabResults_List'] = + this.iNPMLABGetPatientLabResultsList; + data['INPM_LAB_GetPatientRADReport_List'] = + this.iNPMLABGetPatientRADReportList; + data['INPM_LAB_GetPatientRadResults_List'] = + this.iNPMLABGetPatientRadResultsList; + data['INPM_Rad_GetPatientRadOrders_CVI_List'] = + this.iNPMRadGetPatientRadOrdersCVIList; + data['INPM_Rad_GetPatientRadOrders_List'] = + this.iNPMRadGetPatientRadOrdersList; + data['INPM_Rad_GetRadMedicalRecords_List'] = + this.iNPMRadGetRadMedicalRecordsList; + data['INP_GetPrescriptionDischarges_List'] = + this.iNPGetPrescriptionDischargesList; + data['INP_GetPrescriptionReport_List'] = this.iNPGetPrescriptionReportList; + data['IdentificationNo'] = this.identificationNo; + data['IsHomeMedicineDeliverySupported'] = + this.isHomeMedicineDeliverySupported; + data['IsInsertedOrUpdated'] = this.isInsertedOrUpdated; + data['IsMainAcoountEqualPatienID'] = this.isMainAcoountEqualPatienID; + data['IsPatientAlreadyAgreed'] = this.isPatientAlreadyAgreed; + data['IsPatientCallBackBlackList'] = this.isPatientCallBackBlackList; + data['IsPatientHaveFingerPrint'] = this.isPatientHaveFingerPrint; + data['IsPatientOnline'] = this.isPatientOnline; + data['IsPatientTokenRemoved'] = this.isPatientTokenRemoved; + data['IsPaused'] = this.isPaused; + data['IsProjectWorkingHours'] = this.isProjectWorkingHours; + data['IsStoreRateAllowed'] = this.isStoreRateAllowed; + data['IsStoreRateInserted'] = this.isStoreRateInserted; + data['IsStoreRateUpdated'] = this.isStoreRateUpdated; + data['LabRadUpdatedToRead'] = this.labRadUpdatedToRead; + data['LabReportUnreadNo'] = this.labReportUnreadNo; + data['LakumInquiryInformationObj'] = this.lakumInquiryInformationObj; + if (this.lakumInquiryInformationObjVersion != null) { + data['LakumInquiryInformationObjVersion'] = + this.lakumInquiryInformationObjVersion.toJson(); + } + data['LakumResponseList'] = this.lakumResponseList; + data['Laser_GetBodyPartsByCategoryList'] = + this.laserGetBodyPartsByCategoryList; + data['Laser_GetCategoriesList'] = this.laserGetCategoriesList; + data['List'] = this.list; + data['ListCount'] = this.listCount; + data['ListCountDeliverd'] = this.listCountDeliverd; + data['ListCountUnDeliverd'] = this.listCountUnDeliverd; + data['ListDeviceInfo'] = this.listDeviceInfo; + data['ListFamilyAppointments'] = this.listFamilyAppointments; + data['ListLabResultsByAppNo'] = this.listLabResultsByAppNo; + data['ListLakumInquiryInformationObj'] = + this.listLakumInquiryInformationObj; + data['ListOpinion_GetAllPeriod'] = this.listOpinionGetAllPeriod; + data['ListOpinion_GetAllServices'] = this.listOpinionGetAllServices; + data['ListOpinion_GetIsAgreeValue'] = this.listOpinionGetIsAgreeValue; + data['ListOpinion_GetOpinionLogin'] = this.listOpinionGetOpinionLogin; + data['ListOpinion_GetRequestedSerives'] = + this.listOpinionGetRequestedSerives; + data['ListOpinion_GetShareServicesDetails'] = + this.listOpinionGetShareServicesDetails; + data['ListOpinion_UserTerms'] = this.listOpinionUserTerms; + data['ListPLO'] = this.listPLO; + data['ListPLR'] = this.listPLR; + data['ListPLSR'] = this.listPLSR; + data['ListPRM'] = this.listPRM; + data['ListPatientFamilyFiles'] = this.listPatientFamilyFiles; + data['ListPatientFileInfo'] = this.listPatientFileInfo; + data['ListRAD'] = this.listRAD; + data['ListRADAPI'] = this.listRADAPI; + data['List_ActiveGetPrescriptionReportByPatientID'] = + this.listActiveGetPrescriptionReportByPatientID; + data['List_AppointmentsForDentalClinic'] = + this.listAppointmentsForDentalClinic; + data['List_BabyInfoResult'] = this.listBabyInfoResult; + data['List_CheckInsuranceCoverage'] = this.listCheckInsuranceCoverage; + data['List_CompanyClass'] = this.listCompanyClass; + data['List_ConsentMedicalReport'] = this.listConsentMedicalReport; + data['List_DentalAppointments'] = this.listDentalAppointments; + data['List_DeviceTokenIDByAppointmentNo'] = + this.listDeviceTokenIDByAppointmentNo; + data['List_DischargeDiagnosis'] = this.listDischargeDiagnosis; + data['List_DischargeMedicine'] = this.listDischargeMedicine; + data['List_DischargeSummary'] = this.listDischargeSummary; + data['List_DoctorResponse'] = this.listDoctorResponse; + data['List_DoneVaccines'] = this.listDoneVaccines; + data['List_EReferralResult'] = this.listEReferralResult; + data['List_EReferrals'] = this.listEReferrals; + data['List_GetAllPatients_LiveCare_Admin'] = + this.listGetAllPatientsLiveCareAdmin; + data['List_GetDataForExcel'] = this.listGetDataForExcel; + data['List_GetMainCountID'] = this.listGetMainCountID; + data['List_GetPrescriptionReportByPatientID'] = + this.listGetPrescriptionReportByPatientID; + data['List_GetSickLeave'] = this.listGetSickLeave; + data['List_HISInvoice'] = this.listHISInvoice; + data['List_HISInvoiceProcedures'] = this.listHISInvoiceProcedures; + data['List_InpatientInvoices'] = this.listInpatientInvoices; + data['List_InsuranceCheckList'] = this.listInsuranceCheckList; + data['List_InsuranceCompanies'] = this.listInsuranceCompanies; + data['List_InsuranceCompaniesGroup'] = this.listInsuranceCompaniesGroup; + data['List_InsuranceUpdateDetails'] = this.listInsuranceUpdateDetails; + data['List_InvoiceApprovalProcedureInfo'] = + this.listInvoiceApprovalProcedureInfo; + data['List_IsLastSatisfactionSurveyReviewedModel'] = + this.listIsLastSatisfactionSurveyReviewedModel; + data['List_LabOrderDetailsModel'] = this.listLabOrderDetailsModel; + data['List_MedicalReport'] = this.listMedicalReport; + data['List_MedicalReportApprovals'] = this.listMedicalReportApprovals; + data['List_MedicalReportStatus'] = this.listMedicalReportStatus; + data['List_MonthBloodPressureResult'] = this.listMonthBloodPressureResult; + data['List_MonthBloodPressureResultAverage'] = + this.listMonthBloodPressureResultAverage; + data['List_MonthDiabtecPatientResult'] = this.listMonthDiabtecPatientResult; + data['List_MonthDiabtectResultAverage'] = + this.listMonthDiabtectResultAverage; + data['List_MonthWeightMeasurementResult'] = + this.listMonthWeightMeasurementResult; + data['List_MonthWeightMeasurementResultAverage'] = + this.listMonthWeightMeasurementResultAverage; + data['List_OnlinePrescriptionResult'] = this.listOnlinePrescriptionResult; + data['List_OutPatientInvoices'] = this.listOutPatientInvoices; + data['List_PHRInvoice'] = this.listPHRInvoice; + data['List_PHRInvoiceItems'] = this.listPHRInvoiceItems; + data['List_PHRPaymentMethods'] = this.listPHRPaymentMethods; + data['List_PateintDetails'] = this.listPateintDetails; + data['List_PateintInformation'] = this.listPateintInformation; + data['List_PatientAdmissionInfo'] = this.listPatientAdmissionInfo; + data['List_PatientAdvanceBalanceAmount'] = + this.listPatientAdvanceBalanceAmount; + data['List_PatientCallBackLogs'] = this.listPatientCallBackLogs; + data['List_PatientCallBackToUpdateFromICServer'] = + this.listPatientCallBackToUpdateFromICServer; + data['List_PatientCount'] = this.listPatientCount; + data['List_PatientDashboard'] = this.listPatientDashboard; + data['List_PatientER_GetAdminClinicsModel'] = + this.listPatientERGetAdminClinicsModel; + data['List_PatientER_GetAdminProjectsModel'] = + this.listPatientERGetAdminProjectsModel; + data['List_PatientER_GetAllClinicsModel'] = + this.listPatientERGetAllClinicsModel; + data['List_PatientHISInvoices'] = this.listPatientHISInvoices; + data['List_PatientICProjects'] = this.listPatientICProjects; + data['List_PatientICProjectsByID'] = this.listPatientICProjectsByID; + data['List_PatientICProjectsTimings'] = this.listPatientICProjectsTimings; + data['List_PatientIDByUID'] = this.listPatientIDByUID; + data['List_PatientIDForSurveyResult'] = this.listPatientIDForSurveyResult; + data['List_PatientInfo'] = this.listPatientInfo; + data['List_PatientInfoForDDScreen'] = this.listPatientInfoForDDScreen; + data['List_PatientInfoForSickleaveReport'] = + this.listPatientInfoForSickleaveReport; + data['List_PatientInsuranceCard'] = this.listPatientInsuranceCard; + data['List_PatientInsuranceCardHistory'] = + this.listPatientInsuranceCardHistory; + data['List_PatientInsuranceDetails'] = this.listPatientInsuranceDetails; + data['List_PatientPHRInvoices'] = this.listPatientPHRInvoices; + data['List_PatientServicePoint'] = this.listPatientServicePoint; + data['List_PatientStatusCount'] = this.listPatientStatusCount; + data['List_Patient_ChatRequestMapModel'] = + this.listPatientChatRequestMapModel; + data['List_Patient_ChatRequestModel'] = this.listPatientChatRequestModel; + data['List_Patient_ChatRequestVCModel'] = + this.listPatientChatRequestVCModel; + data['List_PaymentMethods'] = this.listPaymentMethods; + data['List_PointServices'] = this.listPointServices; + data['List_PregnancyStagesInfo'] = this.listPregnancyStagesInfo; + data['List_ProjectAvgERWaitingTime'] = this.listProjectAvgERWaitingTime; + data['List_ProjectAvgERWaitingTimeHourly'] = + this.listProjectAvgERWaitingTimeHourly; + data['List_RadMedicalRecords'] = this.listRadMedicalRecords; + data['List_RadMedicalRecordsAPI'] = this.listRadMedicalRecordsAPI; + data['List_RadMedicalRecordsCVI'] = this.listRadMedicalRecordsCVI; + data['List_RadMedicalRecordsCVIAPI'] = this.listRadMedicalRecordsCVIAPI; + data['List_RadMedicalRecordsResults'] = this.listRadMedicalRecordsResults; + data['List_SickLeave'] = this.listSickLeave; + data['List_Transaction'] = this.listTransaction; + data['List_VideoConferenceSessions'] = this.listVideoConferenceSessions; + data['List_WeekBloodPressureResult'] = this.listWeekBloodPressureResult; + data['List_WeekBloodPressureResultAverage'] = + this.listWeekBloodPressureResultAverage; + data['List_WeekDiabtecPatientResult'] = this.listWeekDiabtecPatientResult; + data['List_WeekDiabtectResultAverage'] = this.listWeekDiabtectResultAverage; + data['List_WeekWeightMeasurementResult'] = + this.listWeekWeightMeasurementResult; + data['List_WeekWeightMeasurementResultAverage'] = + this.listWeekWeightMeasurementResultAverage; + data['List_YearBloodPressureResult'] = this.listYearBloodPressureResult; + data['List_YearBloodPressureResultAverage'] = + this.listYearBloodPressureResultAverage; + data['List_YearDiabtecPatientResult'] = this.listYearDiabtecPatientResult; + data['List_YearDiabtecResultAverage'] = this.listYearDiabtecResultAverage; + data['List_YearWeightMeasurementResult'] = + this.listYearWeightMeasurementResult; + data['List_YearWeightMeasurementResultAverage'] = + this.listYearWeightMeasurementResultAverage; + data['List_eInvoiceForDental'] = this.listEInvoiceForDental; + data['List_eInvoiceForOnlineCheckIn'] = this.listEInvoiceForOnlineCheckIn; + data['Med_GetActivitiesTransactionsStsList'] = + this.medGetActivitiesTransactionsStsList; + data['Med_GetAvgMonthTransactionsStsList'] = + this.medGetAvgMonthTransactionsStsList; + data['Med_GetAvgWeekTransactionsStsList'] = + this.medGetAvgWeekTransactionsStsList; + data['Med_GetCategoriesList'] = this.medGetCategoriesList; + data['Med_GetMonthActivitiesTransactionsStsList'] = + this.medGetMonthActivitiesTransactionsStsList; + data['Med_GetMonthStepsTransactionsStsList'] = + this.medGetMonthStepsTransactionsStsList; + data['Med_GetMonthTransactionsStsList'] = + this.medGetMonthTransactionsStsList; + data['Med_GetPatientLastRecordList'] = this.medGetPatientLastRecordList; + data['Med_GetSubCategoriesList'] = this.medGetSubCategoriesList; + data['Med_GetTransactionsAndActTransactionsResult'] = + this.medGetTransactionsAndActTransactionsResult; + data['Med_GetTransactionsList'] = this.medGetTransactionsList; + data['Med_GetWeekActivitiesTransactionsStsList'] = + this.medGetWeekActivitiesTransactionsStsList; + data['Med_GetWeekStepsTransactionsStsList'] = + this.medGetWeekStepsTransactionsStsList; + data['Med_GetWeekTransactionsStsList'] = this.medGetWeekTransactionsStsList; + data['Med_GetYearActivitiesTransactionsStsList'] = + this.medGetYearActivitiesTransactionsStsList; + data['Med_GetYearSleepTransactionsStsList'] = + this.medGetYearSleepTransactionsStsList; + data['Med_GetYearStepsTransactionsStsList'] = + this.medGetYearStepsTransactionsStsList; + data['Med_GetYearTransactionsStsList'] = this.medGetYearTransactionsStsList; + data['Med_InsertTransactionsOutputsList'] = + this.medInsertTransactionsOutputsList; + data['MedicalRecordImages'] = this.medicalRecordImages; + data['MedicalReportToRead'] = this.medicalReportToRead; + data['MedicalReportUnreadNo'] = this.medicalReportUnreadNo; + data['Missing_IDCardAttachment'] = this.missingIDCardAttachment; + data['Missing_InsuranceCardAttachment'] = + this.missingInsuranceCardAttachment; + data['Missing_MedicalReportAttachment'] = + this.missingMedicalReportAttachment; + data['Missing_OtherRelationship'] = this.missingOtherRelationship; + data['Missing_PatientContactNo'] = this.missingPatientContactNo; + data['Missing_PatientId'] = this.missingPatientId; + data['Missing_PatientIdentityNumber'] = this.missingPatientIdentityNumber; + data['Missing_PatientName'] = this.missingPatientName; + data['Missing_ReferralContactNo'] = this.missingReferralContactNo; + data['Missing_ReferralRelationship'] = this.missingReferralRelationship; + data['Missing_ReferralRequesterName'] = this.missingReferralRequesterName; + data['MobileNumber'] = this.mobileNumber; + data['NationalityNumber'] = this.nationalityNumber; + data['OnlineCheckInAppointments'] = this.onlineCheckInAppointments; + data['Opinion_UserAgreementContent'] = this.opinionUserAgreementContent; + data['OrderInsert'] = this.orderInsert; + data['PateintInfoForUpdateList'] = this.pateintInfoForUpdateList; + data['PateintUpatedList'] = this.pateintUpatedList; + data['PatientBirthdayCertificate'] = this.patientBirthdayCertificate; + data['PatientER_CMCRequestSummaryByProject'] = + this.patientERCMCRequestSummaryByProject; + data['PatientER_CMCRequestWithTotal'] = this.patientERCMCRequestWithTotal; + data['PatientER_CMC_GetAllServicesList'] = + this.patientERCMCGetAllServicesList; + data['PatientER_CMC_GetTransactionsForOrderList'] = + this.patientERCMCGetTransactionsForOrderList; + data['PatientER_Coordinates'] = this.patientERCoordinates; + data['PatientER_CountOrderList'] = this.patientERCountOrderList; + data['PatientER_CountsForApprovalOffice'] = + this.patientERCountsForApprovalOffice; + data['PatientER_DeleteOldCurrentDoctorsOutputsList'] = + this.patientERDeleteOldCurrentDoctorsOutputsList; + data['PatientER_Delivery_GetAllDeliverdOrderList'] = + this.patientERDeliveryGetAllDeliverdOrderList; + data['PatientER_Delivery_GetAllOrderList'] = + this.patientERDeliveryGetAllOrderList; + data['PatientER_Delivery_IsOrderInserted'] = + this.patientERDeliveryIsOrderInserted; + data['PatientER_Delivery_IsOrderUpdated'] = + this.patientERDeliveryIsOrderUpdated; + data['PatientER_Delivery_IsPausedChanged'] = + this.patientERDeliveryIsPausedChanged; + data['PatientER_Delivery_NextOrder'] = this.patientERDeliveryNextOrder; + data['PatientER_Delivery_OrderInsert'] = this.patientERDeliveryOrderInsert; + data['PatientER_Delivery_UpdateOrderStatus'] = + this.patientERDeliveryUpdateOrderStatus; + data['PatientER_DriverUpdate'] = this.patientERDriverUpdate; + data['PatientER_Exacart_CheckIsDispenseAccpetableList'] = + this.patientERExacartCheckIsDispenseAccpetableList; + data['PatientER_Exacart_GetDispenseQuantitiesByOrderIDList'] = + this.patientERExacartGetDispenseQuantitiesByOrderIDList; + data['PatientER_Exacart_GetOrderDetailsByePharmacyOrderNoList'] = + this.patientERExacartGetOrderDetailsByePharmacyOrderNoList; + data['PatientER_Exacart_GetOrderDetailsList'] = + this.patientERExacartGetOrderDetailsList; + data['PatientER_Exacart_GetTotalDispenseQuantitiesByPresNoList'] = + this.patientERExacartGetTotalDispenseQuantitiesByPresNoList; + data['PatientER_Exacart_IsDispenseAdded'] = + this.patientERExacartIsDispenseAdded; + data['PatientER_Exacart_IsDispenseAddedList'] = + this.patientERExacartIsDispenseAddedList; + data['PatientER_Exacart_IsOrderCompleted'] = + this.patientERExacartIsOrderCompleted; + data['PatientER_GetAdminByProjectAndRoleList'] = + this.patientERGetAdminByProjectAndRoleList; + data['PatientER_GetAdminProjectsList'] = this.patientERGetAdminProjectsList; + data['PatientER_GetAllDriversList'] = this.patientERGetAllDriversList; + data['PatientER_GetAllNeedAproveStatusList'] = + this.patientERGetAllNeedAproveStatusList; + data['PatientER_GetAllPresOrdersStatusList'] = + this.patientERGetAllPresOrdersStatusList; + data['PatientER_GetAllProjectsList'] = this.patientERGetAllProjectsList; + data['PatientER_GetArchiveInformation_List'] = + this.patientERGetArchiveInformationList; + data['PatientER_GetAskDoctorTotalByDateFilterList'] = + this.patientERGetAskDoctorTotalByDateFilterList; + data['PatientER_GetBookScheduleConfigsList'] = + this.patientERGetBookScheduleConfigsList; + data['PatientER_GetClinicAndTimeAndEpisodeForAppointmentList'] = + this.patientERGetClinicAndTimeAndEpisodeForAppointmentList; + data['PatientER_GetClinicAndTimeForDischargeList'] = + this.patientERGetClinicAndTimeForDischargeList; + data['PatientER_GetDashboardDataforApporvalSectionForAdminList'] = + this.patientERGetDashboardDataforApporvalSectionForAdminList; + data['PatientER_GetDashboardDataforApporvalSectionList'] = + this.patientERGetDashboardDataforApporvalSectionList; + data['PatientER_GetDashboardDataforHHCSectionForAdminList'] = + this.patientERGetDashboardDataforHHCSectionForAdminList; + data['PatientER_GetDashboardDataforHHCSectionList'] = + this.patientERGetDashboardDataforHHCSectionList; + data['PatientER_GetDashboardDataforPrescriptionSectionForAdminList'] = + this.patientERGetDashboardDataforPrescriptionSectionForAdminList; + data['PatientER_GetDashboardDataforPrescriptionSectionList'] = + this.patientERGetDashboardDataforPrescriptionSectionList; + data['PatientER_GetDoctorDashboardDataModelList'] = + this.patientERGetDoctorDashboardDataModelList; + data['PatientER_GetDriverLocationList'] = + this.patientERGetDriverLocationList; + data['PatientER_GetInsuranceCardRequestByDateFilterList'] = + this.patientERGetInsuranceCardRequestByDateFilterList; + data['PatientER_GetLiveCareSummaryBookedAppoinmentStatusList'] = + this.patientERGetLiveCareSummaryBookedAppoinmentStatusList; + data['PatientER_GetLiveCareSummaryCovidList'] = + this.patientERGetLiveCareSummaryCovidList; + data['PatientER_GetLiveCareSummaryForCMCList'] = + this.patientERGetLiveCareSummaryForCMCList; + data['PatientER_GetLiveCareSummaryForHHCList'] = + this.patientERGetLiveCareSummaryForHHCList; + data['PatientER_GetLiveCareSummaryForHomeDeliveryList'] = + this.patientERGetLiveCareSummaryForHomeDeliveryList; + data['PatientER_GetLiveCareSummaryForInsuranceCardRequestList'] = + this.patientERGetLiveCareSummaryForInsuranceCardRequestList; + data['PatientER_GetLiveCareSummaryForNewFilesList'] = + this.patientERGetLiveCareSummaryForNewFilesList; + data['PatientER_GetLiveCareSummaryForOnlinePaymetRequestList'] = + this.patientERGetLiveCareSummaryForOnlinePaymetRequestList; + data['PatientER_GetLiveCareSummaryForOnlinePharmacyOrdersList'] = + this.patientERGetLiveCareSummaryForOnlinePharmacyOrdersList; + data['PatientER_GetLiveCareSummaryForTrasnportationList'] = + this.patientERGetLiveCareSummaryForTrasnportationList; + data['PatientER_GetLiveCareSummaryLiveCareCountsList'] = + this.patientERGetLiveCareSummaryLiveCareCountsList; + data['PatientER_GetMedicalRequestTotalByDateFilterList'] = + this.patientERGetMedicalRequestTotalByDateFilterList; + data['PatientER_GetNearestPendingOrdersList'] = + this.patientERGetNearestPendingOrdersList; + data['PatientER_GetNeedAproveHistoryForOrderList'] = + this.patientERGetNeedAproveHistoryForOrderList; + data['PatientER_GetNeedAprovePendingOrdersList'] = + this.patientERGetNeedAprovePendingOrdersList; + data['PatientER_GetNeedAproveStatusStatisticsList'] = + this.patientERGetNeedAproveStatusStatisticsList; + data['PatientER_GetPatientAllPresOrdersList'] = + this.patientERGetPatientAllPresOrdersList; + data['PatientER_GetPendingPatientsCountList'] = + this.patientERGetPendingPatientsCountList; + data['PatientER_GetPresOrdersHistoryForAdminList'] = + this.patientERGetPresOrdersHistoryForAdminList; + data['PatientER_GetPresOrdersHistoryForOrderList'] = + this.patientERGetPresOrdersHistoryForOrderList; + data['PatientER_GetPresOrdersStatusStatisticsList'] = + this.patientERGetPresOrdersStatusStatisticsList; + data['PatientER_HHCRequest'] = this.patientERHHCRequest; + data['PatientER_HHCRequestSummaryByProject'] = + this.patientERHHCRequestSummaryByProject; + data['PatientER_HHCRequestWithTotal'] = this.patientERHHCRequestWithTotal; + data['PatientER_HHC_GetAllServicesList'] = + this.patientERHHCGetAllServicesList; + data['PatientER_HHC_GetTransactionsForOrderList'] = + this.patientERHHCGetTransactionsForOrderList; + data['PatientER_HomeDeliveryCounts'] = this.patientERHomeDeliveryCounts; + data['PatientER_InsertDriver'] = this.patientERInsertDriver; + data['PatientER_InsertNewCurrentDoctorsOutputsList'] = + this.patientERInsertNewCurrentDoctorsOutputsList; + data['PatientER_InsuranceStatusCountList'] = + this.patientERInsuranceStatusCountList; + data['PatientER_IsNearestProjectUpdated'] = + this.patientERIsNearestProjectUpdated; + data['PatientER_IsNeedAproveReturnedToQueue'] = + this.patientERIsNeedAproveReturnedToQueue; + data['PatientER_IsNeedAproveUpdated'] = this.patientERIsNeedAproveUpdated; + data['PatientER_IsOrderClientRequestUpdated'] = + this.patientERIsOrderClientRequestUpdated; + data['PatientER_IsOrderReturnedToQueue'] = + this.patientERIsOrderReturnedToQueue; + data['PatientER_IsPresOrderInserted'] = this.patientERIsPresOrderInserted; + data['PatientER_IsPresOrderUpdated'] = this.patientERIsPresOrderUpdated; + data['PatientER_IsProjectUpdated'] = this.patientERIsProjectUpdated; + data['PatientER_NotCompletedDetails'] = this.patientERNotCompletedDetails; + data['PatientER_PatientsCountByCallStatus'] = + this.patientERPatientsCountByCallStatus; + data['PatientER_PeakHourCounts'] = this.patientERPeakHourCounts; + data['PatientER_PresOrderInfo'] = this.patientERPresOrderInfo; + data['PatientER_PrescriptionCounts'] = this.patientERPrescriptionCounts; + data['PatientER_ProjectsContribution'] = this.patientERProjectsContribution; + data['PatientER_RRT_GetAllQuestionsList'] = + this.patientERRRTGetAllQuestionsList; + data['PatientER_RRT_GetAllTransportationMethodList'] = + this.patientERRRTGetAllTransportationMethodList; + data['PatientER_RRT_GetPickUpRequestByPresOrderIDList'] = + this.patientERRRTGetPickUpRequestByPresOrderIDList; + data['PatientER_RealRRT_GetAllServicesList'] = + this.patientERRealRRTGetAllServicesList; + data['PatientER_RealRRT_GetOrderDetailsList'] = + this.patientERRealRRTGetOrderDetailsList; + data['PatientER_RealRRT_GetTransactionsForOrderList'] = + this.patientERRealRRTGetTransactionsForOrderList; + data['PatientER_RealRRT_IsTransInserted'] = + this.patientERRealRRTIsTransInserted; + data['PatientER_RequestList'] = this.patientERRequestList; + data['PatientER_TransportationRequestWithTotal'] = + this.patientERTransportationRequestWithTotal; + data['PatientE_RealRRT_GetServicePriceList'] = + this.patientERealRRTGetServicePriceList; + data['PatientInfoByAdmissionNo_List'] = this.patientInfoByAdmissionNoList; + data['PatientMonitor_GetPatientHeartRate'] = + this.patientMonitorGetPatientHeartRate; + data['PatientNotServedCounts'] = this.patientNotServedCounts; + data['PatientPrescriptionList'] = this.patientPrescriptionList; + data['Patient_Allergies'] = this.patientAllergies; + data['Patient_CheckAppointmentValidationList'] = + this.patientCheckAppointmentValidationList; + data['Patient_LoginTokenList'] = this.patientLoginTokenList; + data['Patient_QRLoginInfoList'] = this.patientQRLoginInfoList; + data['Patient_SELECTDeviceIMEIbyIMEIList'] = + this.patientSELECTDeviceIMEIbyIMEIList; + data['PharmList'] = this.pharmList; + data['PrefLang'] = this.prefLang; + data['RadReportUnreadNo'] = this.radReportUnreadNo; + data['Rad_GetPatientRadOrdersForDental_List'] = + this.radGetPatientRadOrdersForDentalList; + data['ReferralNumber'] = this.referralNumber; + data['ReminderConfigurations'] = this.reminderConfigurations; + data['RequestNo'] = this.requestNo; + data['RowCount'] = this.rowCount; + data['ServicePrivilegeList'] = this.servicePrivilegeList; + data['ShareFamilyFileObj'] = this.shareFamilyFileObj; + data['Status'] = this.status; + data['SuccessCode'] = this.successCode; + data['SurveyRate'] = this.surveyRate; + data['SymptomChecker_ConditionList'] = this.symptomCheckerConditionList; + data['SymptomChecker_GetAllDefaultQuestionsList'] = + this.symptomCheckerGetAllDefaultQuestionsList; + data['SymptomChecker_GetBodyPartSymptomsList'] = + this.symptomCheckerGetBodyPartSymptomsList; + data['SymptomChecker_GetBodyPartsByCodeList'] = + this.symptomCheckerGetBodyPartsByCodeList; + data['SymptomChecker_GetBodyPartsList'] = + this.symptomCheckerGetBodyPartsList; + data['SymptomChecker_JsonResponseInString'] = + this.symptomCheckerJsonResponseInString; + data['TimerTime'] = this.timerTime; + data['TotalAdvanceBalanceAmount'] = this.totalAdvanceBalanceAmount; + data['TotalPatientsCount'] = this.totalPatientsCount; + data['TotalPendingApprovalCount'] = this.totalPendingApprovalCount; + data['TotalUnUsedCount'] = this.totalUnUsedCount; + data['TransactionNo'] = this.transactionNo; + data['UnReadCounts'] = this.unReadCounts; + data['UpdateStatus'] = this.updateStatus; + data['UserAgreementContent'] = this.userAgreementContent; + data['YahalaAccountNo'] = this.yahalaAccountNo; + data['check24HourComplaint'] = this.check24HourComplaint; + data['currency'] = this.currency; + data['message'] = this.message; + data['patientID'] = this.patientID; + data['returnValue'] = this.returnValue; + data['returnValueStr'] = this.returnValueStr; + data['statusCode'] = this.statusCode; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart new file mode 100644 index 00000000..c609fa0b --- /dev/null +++ b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart @@ -0,0 +1,179 @@ +import 'PointsAmountPerYear.dart'; +import 'PointsDetails.dart'; + +class LakumInquiryInformationObjVersion { + int accountNumber; + String accountStatus; + String barCode; + int consumedPoints; + String consumedPointsAmount; + List consumedPointsAmountPerYear; + List consumedPointsDetails; + String createdDate; + int expiredPoints; + String expiryDate; + int gainedPoints; + List gainedPointsAmountPerYear; + List gainedPointsDetails; + String lakumMessageStatus; + String memberName; + String memberUniversalId; + String mobileNumber; + int pointsBalance; + int pointsBalanceAmount; + int pointsWillBeExpired; + String prefLang; + int statusCode; + int transferPoints; + List transferPointsAmountPerYear; + List transferPointsDetails; + dynamic waitingPoints; + dynamic loyalityAmount; + dynamic loyalityPoints; + int purchaseRate; + + LakumInquiryInformationObjVersion( + {this.accountNumber, + this.accountStatus, + this.barCode, + this.consumedPoints, + this.consumedPointsAmount, + this.consumedPointsAmountPerYear, + this.consumedPointsDetails, + this.createdDate, + this.expiredPoints, + this.expiryDate, + this.gainedPoints, + this.gainedPointsAmountPerYear, + this.gainedPointsDetails, + this.lakumMessageStatus, + this.memberName, + this.memberUniversalId, + this.mobileNumber, + this.pointsBalance, + this.pointsBalanceAmount, + this.pointsWillBeExpired, + this.prefLang, + this.statusCode, + this.transferPoints, + this.transferPointsAmountPerYear, + this.transferPointsDetails, + this.waitingPoints, + this.loyalityAmount, + this.loyalityPoints, + this.purchaseRate}); + + LakumInquiryInformationObjVersion.fromJson(Map json) { + accountNumber = json['AccountNumber']; + accountStatus = json['AccountStatus']; + barCode = json['BarCode']; + consumedPoints = json['ConsumedPoints']; + consumedPointsAmount = json['ConsumedPointsAmount']; + if (json['ConsumedPointsAmountPerYear'] != null) { + consumedPointsAmountPerYear = new List(); + json['ConsumedPointsAmountPerYear'].forEach((v) { + consumedPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v)); + }); + } + if (json['ConsumedPointsDetails'] != null) { + consumedPointsDetails = new List(); + json['ConsumedPointsDetails'].forEach((v) { + consumedPointsDetails.add(PointsDetails.fromJson(v)); + }); + } + createdDate = json['CreatedDate']; + expiredPoints = json['ExpiredPoints']; + expiryDate = json['ExpiryDate']; + gainedPoints = json['GainedPoints']; + if (json['GainedPointsAmountPerYear'] != null) { + gainedPointsAmountPerYear = new List(); + json['GainedPointsAmountPerYear'].forEach((v) { + gainedPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v)); + }); + } + if (json['GainedPointsDetails'] != null) { + gainedPointsDetails = new List(); + json['GainedPointsDetails'].forEach((v) { + gainedPointsDetails.add(PointsDetails.fromJson(v)); + }); + } + lakumMessageStatus = json['LakumMessageStatus']; + memberName = json['MemberName']; + memberUniversalId = json['MemberUniversalId']; + mobileNumber = json['MobileNumber']; + pointsBalance = json['PointsBalance']; + pointsBalanceAmount = json['PointsBalanceAmount']; + pointsWillBeExpired = json['PointsWillBeExpired']; + prefLang = json['PrefLang']; + statusCode = json['StatusCode']; + transferPoints = json['TransferPoints']; + if (json['TransferPointsAmountPerYear'] != null) { + transferPointsAmountPerYear = new List(); + json['TransferPointsAmountPerYear'].forEach((v) { + transferPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v)); + }); + } + if (json['TransferPointsDetails'] != null) { + transferPointsDetails = new List(); + json['TransferPointsDetails'].forEach((v) { + transferPointsDetails.add(PointsDetails.fromJson(v)); + }); + } + waitingPoints = json['WaitingPoints']; + loyalityAmount = json['loyalityAmount']; + loyalityPoints = json['loyalityPoints']; + purchaseRate = json['purchaseRate']; + } + + Map toJson() { + final Map data = new Map(); + data['AccountNumber'] = this.accountNumber; + data['AccountStatus'] = this.accountStatus; + data['BarCode'] = this.barCode; + data['ConsumedPoints'] = this.consumedPoints; + data['ConsumedPointsAmount'] = this.consumedPointsAmount; + if (this.consumedPointsAmountPerYear != null) { + data['ConsumedPointsAmountPerYear'] = + this.consumedPointsAmountPerYear.map((v) => v).toList(); + } + if (this.consumedPointsDetails != null) { + data['ConsumedPointsDetails'] = + this.consumedPointsDetails.map((v) => v).toList(); + } + data['CreatedDate'] = this.createdDate; + data['ExpiredPoints'] = this.expiredPoints; + data['ExpiryDate'] = this.expiryDate; + data['GainedPoints'] = this.gainedPoints; + if (this.gainedPointsAmountPerYear != null) { + data['GainedPointsAmountPerYear'] = + this.gainedPointsAmountPerYear.map((v) => v).toList(); + } + if (this.gainedPointsDetails != null) { + data['GainedPointsDetails'] = + this.gainedPointsDetails.map((v) => v).toList(); + } + data['LakumMessageStatus'] = this.lakumMessageStatus; + data['MemberName'] = this.memberName; + data['MemberUniversalId'] = this.memberUniversalId; + data['MobileNumber'] = this.mobileNumber; + data['PointsBalance'] = this.pointsBalance; + data['PointsBalanceAmount'] = this.pointsBalanceAmount; + data['PointsWillBeExpired'] = this.pointsWillBeExpired; + data['PrefLang'] = this.prefLang; + data['StatusCode'] = this.statusCode; + data['TransferPoints'] = this.transferPoints; + if (this.transferPointsAmountPerYear != null) { + data['TransferPointsAmountPerYear'] = + this.transferPointsAmountPerYear.map((v) => v).toList(); + } + if (this.transferPointsDetails != null) { + data['TransferPointsDetails'] = + this.transferPointsDetails.map((v) => v).toList(); + } + data['WaitingPoints'] = this.waitingPoints; + data['loyalityAmount'] = this.loyalityAmount; + data['loyalityPoints'] = this.loyalityPoints; + data['purchaseRate'] = this.purchaseRate; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/ListUserAgreement.dart b/lib/core/model/pharmacies/ListUserAgreement.dart new file mode 100644 index 00000000..4237e304 --- /dev/null +++ b/lib/core/model/pharmacies/ListUserAgreement.dart @@ -0,0 +1,28 @@ +class ListUserAgreement { + String userAgreementLAKUM; + String userAgreementLAKUMn; + String userAgreementTxt; + String userAgreementTxtn; + + ListUserAgreement( + {this.userAgreementLAKUM, + this.userAgreementLAKUMn, + this.userAgreementTxt, + this.userAgreementTxtn}); + + ListUserAgreement.fromJson(Map json) { + userAgreementLAKUM = json['UserAgreementLAKUM']; + userAgreementLAKUMn = json['UserAgreementLAKUMn']; + userAgreementTxt = json['UserAgreementTxt']; + userAgreementTxtn = json['UserAgreementTxtn']; + } + + Map toJson() { + final Map data = new Map(); + data['UserAgreementLAKUM'] = this.userAgreementLAKUM; + data['UserAgreementLAKUMn'] = this.userAgreementLAKUMn; + data['UserAgreementTxt'] = this.userAgreementTxt; + data['UserAgreementTxtn'] = this.userAgreementTxtn; + return data; + } +} diff --git a/lib/core/model/pharmacies/PharmacyAddressesModel.dart b/lib/core/model/pharmacies/PharmacyAddressesModel.dart new file mode 100644 index 00000000..db9c20ae --- /dev/null +++ b/lib/core/model/pharmacies/PharmacyAddressesModel.dart @@ -0,0 +1,170 @@ + +import 'dart:convert'; + +PharmacyAddressesModel pharmacyAddressesModelFromJson(String str) => PharmacyAddressesModel.fromJson(json.decode(str)); + +String pharmacyAddressesModelToJson(PharmacyAddressesModel data) => json.encode(data.toJson()); + +class PharmacyAddressesModel { + PharmacyAddressesModel({ + this.customers, + }); + + List customers; + + factory PharmacyAddressesModel.fromJson(Map json) => PharmacyAddressesModel( + customers: List.from(json["customers"].map((x) => Customer.fromJson(x))), + ); + + Map toJson() => { + "customers": List.from(customers.map((x) => x.toJson())), + }; +} + +class Customer { + Customer({ + this.addresses, + }); + + List
addresses; + + factory Customer.fromJson(Map json) => Customer( + addresses: List
.from(json["addresses"].map((x) => Address.fromJson(x))), + ); + + Map toJson() => { + "addresses": List.from(addresses.map((x) => x.toJson())), + }; +} + +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 { RIYADH, AL_OYUN } + +final cityValues = EnumValues({ + "Al Oyun": City.AL_OYUN, + "Riyadh": City.RIYADH +}); + +enum Country { SAUDI_ARABIA } + +final countryValues = EnumValues({ + "Saudi Arabia": Country.SAUDI_ARABIA +}); + +enum Email { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM } + +final emailValues = EnumValues({ + "Tamer.dasdasdas@gmail.com": Email.TAMER_DASDASDAS_GMAIL_COM, + "Tamer.fanasheh@gmail.com": Email.TAMER_FANASHEH_GMAIL_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 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/core/model/pharmacies/PharmacyProduct.dart b/lib/core/model/pharmacies/PharmacyProduct.dart index cd461ae5..c472cb4c 100644 --- a/lib/core/model/pharmacies/PharmacyProduct.dart +++ b/lib/core/model/pharmacies/PharmacyProduct.dart @@ -1,149 +1,538 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Specifications.dart'; + import 'PharmacyImageObject.dart'; import 'Reviews.dart'; class PharmacyProduct { String id; + bool visibleIndividually; String name; String namen; 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; String rxMessage; String rxMessagen; + String manufacturerPartNumber; + String gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + int maxNumberOfDownloads; + String downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + int recurringCycleLength; + int recurringTotalCycles; + bool isRental; + int rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + double 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; + String allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + String preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; double price; double oldPrice; + double productCost; + String specialPrice; + String specialPriceStartDateTimeUtc; + String specialPriceEndDateTimeUtc; + bool customerEntersPrice; + double minimumCustomerEnteredPrice; + double maximumCustomerEnteredPrice; + bool basepriceEnabled; + double basepriceAmount; + double basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; String discountName; String discountNamen; + String discountDescription; + String discountDescriptionn; String discountPercentage; + String currency; + String currencyn; + double weight; + double length; + double width; + double height; + String availableStartDateTimeUtc; + String availableEndDateTimeUtc; int displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String 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; + PharmacyProduct( {this.id, + this.visibleIndividually, this.name, this.namen, 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.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName}); PharmacyProduct.fromJson(Map json) { - try { - id = json['id']; - name = json['name']; - namen = json['namen']; - shortDescription = json['short_description']; - fullDescription = json['full_description']; - fullDescriptionn = json['full_descriptionn']; - approvedRatingSum = json['approved_rating_sum']; - approvedTotalReviews = json['approved_total_reviews']; - sku = json['sku']; - isRx = json['is_rx']; - rxMessage = json['rx_message']; - rxMessagen = json['rx_messagen']; - stockQuantity = json['stock_quantity']; - stockAvailability = json['stock_availability']; - stockAvailabilityn = json['stock_availabilityn']; - allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; - orderMinimumQuantity = json['order_minimum_quantity']; - orderMaximumQuantity = json['order_maximum_quantity']; - price = json['price']; - oldPrice = json['old_price']; - discountName = json['discount_name']; - discountNamen = json['discount_namen']; - discountPercentage = json['discount_percentage']; - displayOrder = json['display_order']; - if (json['discount_ids'] != null) { - discountIds = new List(); - json['discount_ids'].forEach((v) { - discountIds.add(v); - }); - } - if (json['reviews'] != null) { - reviews = new List(); - json['reviews'].forEach((v) { - reviews.add(new Reviews.fromJson(v)); - }); - } - if (json['images'] != null) { - images = new List(); - json['images'].forEach((v) { - images.add(new PharmacyImageObject.fromJson(v)); - }); - } - } catch (e) { - print(e); + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + namen = json['namen']; + 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']; + metaDescription = json['meta_description']; + metaTitle = 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']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + 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']; + 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 = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + if (json['role_ids'] != null) { + roleIds = new List(); + json['role_ids'].forEach((v) { + roleIds.add(v); + }); + } + if (json['discount_ids'] != null) { + discountIds = new List(); + json['discount_ids'].forEach((v) { + discountIds.add(v); + }); + } + if (json['store_ids'] != null) { + storeIds = new List(); + json['store_ids'].forEach((v) { + storeIds.add(v); + }); + } + if (json['manufacturer_ids'] != null) { + manufacturerIds = new List(); + json['manufacturer_ids'].forEach((v) { + manufacturerIds.add(v); + }); + } + if (json['reviews'] != null) { + reviews = new List(); + json['reviews'].forEach((v) { + reviews.add(new Reviews.fromJson(v)); + }); + } + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new PharmacyImageObject.fromJson(v)); + }); + } + if (json['attributes'] != null) { + attributes = new List(); + json['attributes'].forEach((v) { + attributes.add(v); + }); + } + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); } + if (json['associated_product_ids'] != null) { + associatedProductIds = new List(); + json['associated_product_ids'].forEach((v) { + associatedProductIds.add(v); + }); + } + if (json['tags'] != null) { + tags = new List(); + json['tags'].forEach((v) { + tags.add(v); + }); + } + vendorId = json['vendor_id']; + seName = json['se_name']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; data['name'] = this.name; data['namen'] = this.namen; data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; data['full_description'] = this.fullDescription; data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; data['sku'] = this.sku; data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; data['rx_message'] = this.rxMessage; data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; data['stock_quantity'] = this.stockQuantity; data['stock_availability'] = this.stockAvailability; data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; data['allow_back_in_stock_subscriptions'] = this.allowBackInStockSubscriptions; data['order_minimum_quantity'] = this.orderMinimumQuantity; data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; data['price'] = this.price; data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; data['discount_name'] = this.discountName; data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; data['display_order'] = this.displayOrder; - if (this.discountIds != String) { + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v).toList(); + } + if (this.discountIds != null) { data['discount_ids'] = this.discountIds.map((v) => v).toList(); } - if (this.reviews != String) { + if (this.storeIds != null) { + data['store_ids'] = this.storeIds.map((v) => v).toList(); + } + data['manufacturer_ids'] = this.manufacturerIds; + if (this.reviews != null) { data['reviews'] = this.reviews.map((v) => v.toJson()).toList(); } - if (this.images != String) { + if (this.images != null) { data['images'] = this.images.map((v) => v.toJson()).toList(); } + if (this.attributes != null) { + data['attributes'] = this.attributes.map((v) => v).toList(); + } + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + if (this.associatedProductIds != null) { + data['associated_product_ids'] = + this.associatedProductIds.map((v) => v).toList(); + } + if (this.tags != null) { + data['tags'] = this.tags.map((v) => v).toList(); + } + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; return data; } } diff --git a/lib/core/model/pharmacies/PointsAmountPerMonth.dart b/lib/core/model/pharmacies/PointsAmountPerMonth.dart new file mode 100644 index 00000000..71cf3498 --- /dev/null +++ b/lib/core/model/pharmacies/PointsAmountPerMonth.dart @@ -0,0 +1,42 @@ +import 'PointsAmountPerday.dart'; + +class PointsAmountPerMonth { + double amountPerMonth; + String month; + int monthNumber; + List pointsAmountPerday; + double pointsPerMonth; + + PointsAmountPerMonth( + {this.amountPerMonth, + this.month, + this.monthNumber, + this.pointsAmountPerday, + this.pointsPerMonth}); + + PointsAmountPerMonth.fromJson(Map json) { + amountPerMonth = json['AmountPerMonth']; + month = json['Month']; + monthNumber = json['MonthNumber']; + if (json['PointsAmountPerday'] != null) { + pointsAmountPerday = new List(); + json['PointsAmountPerday'].forEach((v) { + pointsAmountPerday.add(new PointsAmountPerday.fromJson(v)); + }); + } + pointsPerMonth = json['PointsPerMonth']; + } + + Map toJson() { + final Map data = new Map(); + data['AmountPerMonth'] = this.amountPerMonth; + data['Month'] = this.month; + data['MonthNumber'] = this.monthNumber; + if (this.pointsAmountPerday != null) { + data['PointsAmountPerday'] = + this.pointsAmountPerday.map((v) => v.toJson()).toList(); + } + data['PointsPerMonth'] = this.pointsPerMonth; + return data; + } +} diff --git a/lib/core/model/pharmacies/PointsAmountPerYear.dart b/lib/core/model/pharmacies/PointsAmountPerYear.dart new file mode 100644 index 00000000..eef74064 --- /dev/null +++ b/lib/core/model/pharmacies/PointsAmountPerYear.dart @@ -0,0 +1,38 @@ +import 'PointsAmountPerMonth.dart'; + +class PointsAmountPerYear { + int amountPerYear; + List pointsAmountPerMonth; + int pointsPerYear; + int year; + + PointsAmountPerYear( + {this.amountPerYear, + this.pointsAmountPerMonth, + this.pointsPerYear, + this.year}); + + PointsAmountPerYear.fromJson(Map json) { + amountPerYear = json['AmountPerYear']; + if (json['PointsAmountPerMonth'] != null) { + pointsAmountPerMonth = new List(); + json['PointsAmountPerMonth'].forEach((v) { + pointsAmountPerMonth.add(new PointsAmountPerMonth.fromJson(v)); + }); + } + pointsPerYear = json['PointsPerYear']; + year = json['Year']; + } + + Map toJson() { + final Map data = new Map(); + data['AmountPerYear'] = this.amountPerYear; + if (this.pointsAmountPerMonth != null) { + data['PointsAmountPerMonth'] = + this.pointsAmountPerMonth.map((v) => v.toJson()).toList(); + } + data['PointsPerYear'] = this.pointsPerYear; + data['Year'] = this.year; + return data; + } +} diff --git a/lib/core/model/pharmacies/PointsAmountPerday.dart b/lib/core/model/pharmacies/PointsAmountPerday.dart new file mode 100644 index 00000000..e78e87b7 --- /dev/null +++ b/lib/core/model/pharmacies/PointsAmountPerday.dart @@ -0,0 +1,42 @@ +import 'PointsDetails.dart'; + +class PointsAmountPerday { + double amountPerDay; + String day; + List pointsDetails; + double pointsPerDay; + String transationDate; + + PointsAmountPerday( + {this.amountPerDay, + this.day, + this.pointsDetails, + this.pointsPerDay, + this.transationDate}); + + PointsAmountPerday.fromJson(Map json) { + amountPerDay = json['AmountPerDay']; + day = json['Day']; + if (json['PointsDetails'] != null) { + pointsDetails = new List(); + json['PointsDetails'].forEach((v) { + pointsDetails.add(new PointsDetails.fromJson(v)); + }); + } + pointsPerDay = json['PointsPerDay']; + transationDate = json['TransationDate']; + } + + Map toJson() { + final Map data = new Map(); + data['AmountPerDay'] = this.amountPerDay; + data['Day'] = this.day; + if (this.pointsDetails != null) { + data['PointsDetails'] = + this.pointsDetails.map((v) => v.toJson()).toList(); + } + data['PointsPerDay'] = this.pointsPerDay; + data['TransationDate'] = this.transationDate; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/PointsDetails.dart b/lib/core/model/pharmacies/PointsDetails.dart new file mode 100644 index 00000000..7b342af9 --- /dev/null +++ b/lib/core/model/pharmacies/PointsDetails.dart @@ -0,0 +1,57 @@ +class PointsDetails { + int accNumber; + String accountStatus; + double amount; + int lineItemNo; + String operationType; + double points; + double purchasePoints; + int subTransactionType; + String subTransactionTypeDescription; + String transactionDate; + + PointsDetails( + {this.accNumber, + this.accountStatus, + this.amount, + this.lineItemNo, + this.operationType, + this.points, + this.purchasePoints, + this.subTransactionType, + this.subTransactionTypeDescription, + this.transactionDate}); + + PointsDetails.fromJson(Map json) { + accNumber = json['AccNumber']; + accountStatus = json['AccountStatus']; + amount = json['Amount']; + lineItemNo = json['LineItemNo']; + operationType = json['OperationType']; + points = json['Points']; + var purchasePoints = json['PurchasePoints']; + if(purchasePoints is int){ + this.purchasePoints = (purchasePoints).roundToDouble(); + }else { + this.purchasePoints = purchasePoints; + } + subTransactionType = json['SubTransactionType']; + subTransactionTypeDescription = json['SubTransactionTypeDescription']; + transactionDate = json['TransactionDate']; + } + + Map toJson() { + final Map data = new Map(); + data['AccNumber'] = this.accNumber; + data['AccountStatus'] = this.accountStatus; + data['Amount'] = this.amount; + data['LineItemNo'] = this.lineItemNo; + data['OperationType'] = this.operationType; + data['Points'] = this.points; + data['PurchasePoints'] = this.purchasePoints; + data['SubTransactionType'] = this.subTransactionType; + data['SubTransactionTypeDescription'] = this.subTransactionTypeDescription; + data['TransactionDate'] = this.transactionDate; + return data; + } +} diff --git a/lib/core/model/pharmacies/ShippingOption.dart b/lib/core/model/pharmacies/ShippingOption.dart new file mode 100644 index 00000000..1b589537 --- /dev/null +++ b/lib/core/model/pharmacies/ShippingOption.dart @@ -0,0 +1,97 @@ +class ShippingOption { + String shippingRateComputationMethodSystemName; + double rate; + double rateVat; + double rateVatPercent; + String name; + String namen; + String description; + String descriptionn; + bool allowShippingSunday; + bool allowShippingMonday; + bool allowShippingTuesday; + bool allowShippingWednesday; + bool allowShippingThursday; + bool allowShippingFriday; + bool allowShippingSaturday; + String allowShippingTime1From; + String allowShippingTime1To; + String allowShippingTime2From; + String allowShippingTime2To; + String allowShippingNote; + String allowShippingNoten; + + ShippingOption( + {this.shippingRateComputationMethodSystemName, + this.rate, + this.rateVat, + this.rateVatPercent, + this.name, + this.namen, + this.description, + this.descriptionn, + this.allowShippingSunday, + this.allowShippingMonday, + this.allowShippingTuesday, + this.allowShippingWednesday, + this.allowShippingThursday, + this.allowShippingFriday, + this.allowShippingSaturday, + this.allowShippingTime1From, + this.allowShippingTime1To, + this.allowShippingTime2From, + this.allowShippingTime2To, + this.allowShippingNote, + this.allowShippingNoten}); + + ShippingOption.fromJson(Map json) { + shippingRateComputationMethodSystemName = json['shipping_rate_computation_method_system_name']; + rate = json['rate']; + rateVat = json['rate_vat']; + rateVatPercent = json['rate_vat_percent']; + name = json['name']; + namen = json['namen']; + description = json['description']; + descriptionn = json['descriptionn']; + allowShippingSunday = json['AllowShippingSunday']; + allowShippingMonday = json['AllowShippingMonday']; + allowShippingTuesday = json['AllowShippingTuesday']; + allowShippingWednesday = json['AllowShippingWednesday']; + allowShippingThursday = json['AllowShippingThursday']; + allowShippingFriday = json['AllowShippingFriday']; + allowShippingSaturday = json['AllowShippingSaturday']; + allowShippingTime1From = json['AllowShippingTime1From']; + allowShippingTime1To = json['AllowShippingTime1To']; + allowShippingTime2From = json['AllowShippingTime2From']; + allowShippingTime2To = json['AllowShippingTime2To']; + allowShippingNote = json['AllowShippingNote']; + allowShippingNoten = json['AllowShippingNoten']; + } + + Map toJson() { + final Map data = new Map(); + data['shipping_rate_computation_method_system_name'] = + this.shippingRateComputationMethodSystemName; + data['rate'] = this.rate; + data['rate_vat'] = this.rateVat; + data['rate_vat_percent'] = this.rateVatPercent; + data['name'] = this.name; + data['namen'] = this.namen; + data['description'] = this.description; + data['descriptionn'] = this.descriptionn; + data['AllowShippingSunday'] = this.allowShippingSunday; + data['AllowShippingMonday'] = this.allowShippingMonday; + data['AllowShippingTuesday'] = this.allowShippingTuesday; + data['AllowShippingWednesday'] = this.allowShippingWednesday; + data['AllowShippingThursday'] = this.allowShippingThursday; + data['AllowShippingFriday'] = this.allowShippingFriday; + data['AllowShippingSaturday'] = this.allowShippingSaturday; + data['AllowShippingTime1From'] = this.allowShippingTime1From; + data['AllowShippingTime1To'] = this.allowShippingTime1To; + data['AllowShippingTime2From'] = this.allowShippingTime2From; + data['AllowShippingTime2To'] = this.allowShippingTime2To; + data['AllowShippingNote'] = this.allowShippingNote; + data['AllowShippingNoten'] = this.allowShippingNoten; + return data; + } +} diff --git a/lib/core/model/pharmacies/ShoppingCart.dart b/lib/core/model/pharmacies/ShoppingCart.dart new file mode 100644 index 00000000..f965203a --- /dev/null +++ b/lib/core/model/pharmacies/ShoppingCart.dart @@ -0,0 +1,115 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Customer.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; + +class ShoppingCart { + int languageId; + String id; + // List productAttributes; + double customerEnteredPrice; + int quantity; + String discountAmountInclTax; + String subtotal; + String subtotalWithVat; + String subtotalVatAmount; + String subtotalVatRate; + String currency; + String currencyn; + String rentalStartDateUtc; + String rentalEndDateUtc; + String createdOnUtc; + String updatedOnUtc; + String shoppingCartType; + int productId; + PharmacyProduct product; + int customerId; + Customer customer; + + ShoppingCart( + {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}); + + ShoppingCart.fromJson(Map json) { + languageId = json['language_id']; + id = json['id']; + /*if (json['product_attributes'] != null) { + productAttributes = new List(); + json['product_attributes'].forEach((v) { + productAttributes.add(new Null.fromJson(v)); + }); + }*/ + 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 = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + shoppingCartType = json['shopping_cart_type']; + productId = json['product_id']; + product = json['product'] != null + ? new PharmacyProduct.fromJson(json['product']) + : null; + customerId = json['customer_id']; + customer = json['customer'] != null + ? new Customer.fromJson(json['customer']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['id'] = this.id; + /*if (this.productAttributes != null) { + data['product_attributes'] = + this.productAttributes.map((v) => v.toJson()).toList(); + }*/ + data['customer_entered_price'] = this.customerEnteredPrice; + data['quantity'] = this.quantity; + data['discount_amount_incl_tax'] = this.discountAmountInclTax; + data['subtotal'] = this.subtotal; + data['subtotal_with_vat'] = this.subtotalWithVat; + data['subtotal_vat_amount'] = this.subtotalVatAmount; + data['subtotal_vat_rate'] = this.subtotalVatRate; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['rental_start_date_utc'] = this.rentalStartDateUtc; + data['rental_end_date_utc'] = this.rentalEndDateUtc; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['shopping_cart_type'] = this.shoppingCartType; + data['product_id'] = this.productId; + if (this.product != null) { + data['product'] = this.product.toJson(); + } + data['customer_id'] = this.customerId; + if (this.customer != null) { + data['customer'] = this.customer.toJson(); + } + return data; + } +} diff --git a/lib/core/model/pharmacies/ShoppingCartResponse.dart b/lib/core/model/pharmacies/ShoppingCartResponse.dart new file mode 100644 index 00000000..96b751ae --- /dev/null +++ b/lib/core/model/pharmacies/ShoppingCartResponse.dart @@ -0,0 +1,55 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:flutter/material.dart'; + +class ShoppingCartResponse with ChangeNotifier { + int itemCount; + int quantityCount; + double subtotal; + double subtotalWithVat; + double subtotalVatAmount; + double subtotalVatRate; + List shoppingCarts; + + ShoppingCartResponse( + {this.itemCount, + this.quantityCount, + this.subtotal, + this.subtotalWithVat, + this.subtotalVatAmount, + this.subtotalVatRate, + this.shoppingCarts}); + + void updateShoppingCard() { + notifyListeners(); + } + + ShoppingCartResponse.fromJson(Map json) { + itemCount = json['item_count']; + quantityCount = json['quantity_count']; + subtotal = json['subtotal']; + subtotalWithVat = json['subtotal_with_vat']; + subtotalVatAmount = json['subtotal_vat_amount']; + subtotalVatRate = json['subtotal_vat_rate']; + if (json['shopping_carts'] != null) { + shoppingCarts = new List(); + json['shopping_carts'].forEach((v) { + shoppingCarts.add(new ShoppingCart.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['item_count'] = this.itemCount; + data['quantity_count'] = this.quantityCount; + data['subtotal'] = this.subtotal; + data['subtotal_with_vat'] = this.subtotalWithVat; + data['subtotal_vat_amount'] = this.subtotalVatAmount; + data['subtotal_vat_rate'] = this.subtotalVatRate; + if (this.shoppingCarts != null) { + data['shopping_carts'] = + this.shoppingCarts.map((v) => v.toJson()).toList(); + } + return data; + } +} diff --git a/lib/core/model/pharmacies/Specifications.dart b/lib/core/model/pharmacies/Specifications.dart new file mode 100644 index 00000000..f227de69 --- /dev/null +++ b/lib/core/model/pharmacies/Specifications.dart @@ -0,0 +1,36 @@ +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/pharmacies/order_model.dart b/lib/core/model/pharmacies/order_model.dart new file mode 100644 index 00000000..027d1f81 --- /dev/null +++ b/lib/core/model/pharmacies/order_model.dart @@ -0,0 +1,1456 @@ + +import 'dart:convert'; + +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; + +List orderModelFromJson(String str) => List.from(json.decode(str).map((x) => OrderModel.fromJson(x))); + +String orderModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class OrderModel { + OrderModel({ + this.id, + this.storeId, + this.orderGuid, + this.pickUpInStore, + this.paymentMethodSystemName, + this.paymentName, + this.paymentNamen, + this.customerCurrencyCode, + this.currencyRate, + this.customerTaxDisplayTypeId, + this.vatNumber, + this.orderSubtotalInclTax, + this.orderSubtotalExclTax, + this.orderSubTotalDiscountInclTax, + this.orderSubTotalDiscountExclTax, + this.orderShippingInclTax, + this.orderShippingExclTax, + this.paymentMethodAdditionalFeeInclTax, + this.paymentMethodAdditionalFeeExclTax, + this.taxRates, + this.orderTax, + this.orderDiscount, + this.orderTotal, + this.refundedAmount, + this.rewardPointsWereAdded, + this.rxAttachments, + this.checkoutAttributeDescription, + this.customerLanguageId, + this.affiliateId, + this.customerIp, + this.authorizationTransactionId, + this.authorizationTransactionCode, + this.authorizationTransactionResult, + this.captureTransactionId, + this.captureTransactionResult, + this.subscriptionTransactionId, + this.paidDateUtc, + this.shippingMethod, + this.shippingRateComputationMethodSystemName, + this.customValuesXml, + this.deleted, + this.createdOnUtc, + this.customer, + this.customerId, + this.billingAddress, + this.shippingAddress, + this.orderItems, + this.orderStatusId, + this.orderStatus, + this.orderStatusn, + this.paymentStatusId, + this.paymentStatus, + this.paymentStatusn, + this.shippingStatus, + this.shippingStatusn, + this.customerTaxDisplayType, + this.canCancel, + this.canRefund, + this.lakumAmount, + this.preferDeliveryDate, + this.preferDeliveryTime, + this.preferDeliveryTimen, + }); + + String id; + dynamic storeId; + String orderGuid; + bool pickUpInStore; + PaymentMethodSystemName paymentMethodSystemName; + PaymentName paymentName; + PaymentName paymentNamen; + CustomerCurrencyCode customerCurrencyCode; + dynamic currencyRate; + dynamic customerTaxDisplayTypeId; + dynamic vatNumber; + double orderSubtotalInclTax; + double orderSubtotalExclTax; + dynamic orderSubTotalDiscountInclTax; + dynamic orderSubTotalDiscountExclTax; + double orderShippingInclTax; + dynamic orderShippingExclTax; + dynamic paymentMethodAdditionalFeeInclTax; + dynamic paymentMethodAdditionalFeeExclTax; + String taxRates; + double orderTax; + dynamic orderDiscount; + double orderTotal; + dynamic refundedAmount; + dynamic rewardPointsWereAdded; + String rxAttachments; + CheckoutAttributeDescription checkoutAttributeDescription; + dynamic customerLanguageId; + dynamic affiliateId; + CustomerIp customerIp; + String authorizationTransactionId; + dynamic authorizationTransactionCode; + dynamic authorizationTransactionResult; + dynamic captureTransactionId; + dynamic captureTransactionResult; + dynamic subscriptionTransactionId; + DateTime paidDateUtc; + ShippingMethod shippingMethod; + ShippingRateComputationMethodSystemName shippingRateComputationMethodSystemName; + String customValuesXml; + bool deleted; + DateTime createdOnUtc; + OrderModelCustomer customer; + dynamic customerId; + IngAddress billingAddress; + IngAddress shippingAddress; + List orderItems; + dynamic orderStatusId; + OrderStatus orderStatus; + OrderStatusn orderStatusn; + dynamic paymentStatusId; + PaymentStatus paymentStatus; + PaymentStatusn paymentStatusn; + ShippingStatus shippingStatus; + ShippingStatusn shippingStatusn; + CustomerTaxDisplayType customerTaxDisplayType; + bool canCancel; + bool canRefund; + dynamic lakumAmount; + DateTime preferDeliveryDate; + PreferDeliveryTime preferDeliveryTime; + PreferDeliveryTimen preferDeliveryTimen; + + factory OrderModel.fromJson(Map json) => OrderModel( + id: json["id"], + storeId: json["store_id"], + orderGuid: json["order_guid"], + pickUpInStore: json["pick_up_in_store"], + paymentMethodSystemName: paymentMethodSystemNameValues.map[json["payment_method_system_name"]], + paymentName: paymentNameValues.map[json["payment_name"]], + paymentNamen: paymentNameValues.map[json["payment_namen"]], + customerCurrencyCode: customerCurrencyCodeValues.map[json["customer_currency_code"]], + currencyRate: json["currency_rate"], + customerTaxDisplayTypeId: json["customer_tax_display_type_id"], + vatNumber: json["vat_number"], + orderSubtotalInclTax: json["order_subtotal_incl_tax"].toDouble(), + orderSubtotalExclTax: json["order_subtotal_excl_tax"].toDouble(), + orderSubTotalDiscountInclTax: json["order_sub_total_discount_incl_tax"], + orderSubTotalDiscountExclTax: json["order_sub_total_discount_excl_tax"], + orderShippingInclTax: json["order_shipping_incl_tax"].toDouble(), + orderShippingExclTax: json["order_shipping_excl_tax"], + paymentMethodAdditionalFeeInclTax: json["payment_method_additional_fee_incl_tax"], + paymentMethodAdditionalFeeExclTax: json["payment_method_additional_fee_excl_tax"], + taxRates: json["tax_rates"], + orderTax: json["order_tax"].toDouble(), + orderDiscount: json["order_discount"], + orderTotal: json["order_total"].toDouble(), + refundedAmount: json["refunded_amount"], + rewardPointsWereAdded: json["reward_points_were_added"], + rxAttachments: json["rx_attachments"] == null ? null : json["rx_attachments"], + checkoutAttributeDescription: checkoutAttributeDescriptionValues.map[json["checkout_attribute_description"]], + customerLanguageId: json["customer_language_id"], + affiliateId: json["affiliate_id"], + customerIp: customerIpValues.map[json["customer_ip"]], + authorizationTransactionId: json["authorization_transaction_id"] == null ? null : json["authorization_transaction_id"], + authorizationTransactionCode: json["authorization_transaction_code"], + authorizationTransactionResult: json["authorization_transaction_result"], + captureTransactionId: json["capture_transaction_id"], + captureTransactionResult: json["capture_transaction_result"], + subscriptionTransactionId: json["subscription_transaction_id"], + paidDateUtc: json["paid_date_utc"] == null ? null : DateTime.parse(json["paid_date_utc"]), + shippingMethod: shippingMethodValues.map[json["shipping_method"]], + shippingRateComputationMethodSystemName: shippingRateComputationMethodSystemNameValues.map[json["shipping_rate_computation_method_system_name"]], + customValuesXml: json["custom_values_xml"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: OrderModelCustomer.fromJson(json["customer"]), + customerId: json["customer_id"], + billingAddress: IngAddress.fromJson(json["billing_address"]), + shippingAddress: IngAddress.fromJson(json["shipping_address"]), + orderItems: List.from(json["order_items"].map((x) => OrderItem.fromJson(x))), + orderStatusId: json["order_status_id"], + orderStatus: orderStatusValues.map[json["order_status"]], + orderStatusn: orderStatusnValues.map[json["order_statusn"]], + paymentStatusId: json["payment_status_id"], + paymentStatus: paymentStatusValues.map[json["payment_status"]], + paymentStatusn: paymentStatusnValues.map[json["payment_statusn"]], + shippingStatus: shippingStatusValues.map[json["shipping_status"]], + shippingStatusn: shippingStatusnValues.map[json["shipping_statusn"]], + customerTaxDisplayType: customerTaxDisplayTypeValues.map[json["customer_tax_display_type"]], + canCancel: json["can_cancel"], + canRefund: json["can_refund"], + lakumAmount: json["lakum_amount"], + preferDeliveryDate: json["prefer_delivery_date"] == null ? null : DateTime.parse(json["prefer_delivery_date"]), + preferDeliveryTime: json["prefer_delivery_time"] == null ? null : preferDeliveryTimeValues.map[json["prefer_delivery_time"]], + preferDeliveryTimen: json["prefer_delivery_timen"] == null ? null : preferDeliveryTimenValues.map[json["prefer_delivery_timen"]], + ); + + Map toJson() => { + "id": id, + "store_id": storeId, + "order_guid": orderGuid, + "pick_up_in_store": pickUpInStore, + "payment_method_system_name": paymentMethodSystemNameValues.reverse[paymentMethodSystemName], + "payment_name": paymentNameValues.reverse[paymentName], + "payment_namen": paymentNameValues.reverse[paymentNamen], + "customer_currency_code": customerCurrencyCodeValues.reverse[customerCurrencyCode], + "currency_rate": currencyRate, + "customer_tax_display_type_id": customerTaxDisplayTypeId, + "vat_number": vatNumber, + "order_subtotal_incl_tax": orderSubtotalInclTax, + "order_subtotal_excl_tax": orderSubtotalExclTax, + "order_sub_total_discount_incl_tax": orderSubTotalDiscountInclTax, + "order_sub_total_discount_excl_tax": orderSubTotalDiscountExclTax, + "order_shipping_incl_tax": orderShippingInclTax, + "order_shipping_excl_tax": orderShippingExclTax, + "payment_method_additional_fee_incl_tax": paymentMethodAdditionalFeeInclTax, + "payment_method_additional_fee_excl_tax": paymentMethodAdditionalFeeExclTax, + "tax_rates": taxRates, + "order_tax": orderTax, + "order_discount": orderDiscount, + "order_total": orderTotal, + "refunded_amount": refundedAmount, + "reward_points_were_added": rewardPointsWereAdded, + "rx_attachments": rxAttachments == null ? null : rxAttachments, + "checkout_attribute_description": checkoutAttributeDescriptionValues.reverse[checkoutAttributeDescription], + "customer_language_id": customerLanguageId, + "affiliate_id": affiliateId, + "customer_ip": customerIpValues.reverse[customerIp], + "authorization_transaction_id": authorizationTransactionId == null ? null : authorizationTransactionId, + "authorization_transaction_code": authorizationTransactionCode, + "authorization_transaction_result": authorizationTransactionResult, + "capture_transaction_id": captureTransactionId, + "capture_transaction_result": captureTransactionResult, + "subscription_transaction_id": subscriptionTransactionId, + "paid_date_utc": paidDateUtc == null ? null : paidDateUtc.toIso8601String(), + "shipping_method": shippingMethodValues.reverse[shippingMethod], + "shipping_rate_computation_method_system_name": shippingRateComputationMethodSystemNameValues.reverse[shippingRateComputationMethodSystemName], + "custom_values_xml": customValuesXml, + "deleted": deleted, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "customer_id": customerId, + "billing_address": billingAddress.toJson(), + "shipping_address": shippingAddress.toJson(), + "order_items": List.from(orderItems.map((x) => x.toJson())), + "order_status_id": orderStatusId, + "order_status": orderStatusValues.reverse[orderStatus], + "order_statusn": orderStatusnValues.reverse[orderStatusn], + "payment_status_id": paymentStatusId, + "payment_status": paymentStatusValues.reverse[paymentStatus], + "payment_statusn": paymentStatusnValues.reverse[paymentStatusn], + "shipping_status": shippingStatusValues.reverse[shippingStatus], + "shipping_statusn": shippingStatusnValues.reverse[shippingStatusn], + "customer_tax_display_type": customerTaxDisplayTypeValues.reverse[customerTaxDisplayType], + "can_cancel": canCancel, + "can_refund": canRefund, + "lakum_amount": lakumAmount, + "prefer_delivery_date": preferDeliveryDate == null ? null : "${preferDeliveryDate.year.toString().padLeft(4, '0')}-${preferDeliveryDate.month.toString().padLeft(2, '0')}-${preferDeliveryDate.day.toString().padLeft(2, '0')}", + "prefer_delivery_time": preferDeliveryTime == null ? null : preferDeliveryTimeValues.reverse[preferDeliveryTime], + "prefer_delivery_timen": preferDeliveryTimen == null ? null : preferDeliveryTimenValues.reverse[preferDeliveryTimen], + }; +} + +class IngAddress { + IngAddress({ + 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; + BillingAddressEmail email; + dynamic company; + dynamic countryId; + Country country; + dynamic stateProvinceId; + City city; + Address1 address1; + Address2 address2; + String zipPostalCode; + String phoneNumber; + dynamic faxNumber; + String customerAttributes; + DateTime createdOnUtc; + dynamic province; + LatLong latLong; + + factory IngAddress.fromJson(Map json) => IngAddress( + id: json["id"], + firstName: firstNameValues.map[json["first_name"]], + lastName: lastNameValues.map[json["last_name"]], + email: billingAddressEmailValues.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: address1Values.map[json["address1"]], + address2: address2Values.map[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: latLongValues.map[json["lat_long"]], + ); + + Map toJson() => { + "id": id, + "first_name": firstNameValues.reverse[firstName], + "last_name": lastNameValues.reverse[lastName], + "email": billingAddressEmailValues.reverse[email], + "company": company, + "country_id": countryId, + "country": countryValues.reverse[country], + "state_province_id": stateProvinceId, + "city": cityValues.reverse[city], + "address1": address1Values.reverse[address1], + "address2": address2Values.reverse[address2], + "zip_postal_code": zipPostalCode, + "phone_number": phoneNumber, + "fax_number": faxNumber, + "customer_attributes": customerAttributes, + "created_on_utc": createdOnUtc.toIso8601String(), + "province": province, + "lat_long": latLongValues.reverse[latLong], + }; +} + +enum Address1 { THE_7960_MOSAB_IBN_UMAIR_STREET_AL_RIYADH, THE_6500_AL_AMEEN_ABDULLAH_AL_ALI_AL_NAEEM_STREET_AL_RIYADH, THE_6603_IBRAHIM_IBN_AL_HAMASI_AR_RIYAD, THE_9626_SALAH_AD_DIN_AL_AYYUBI_ROAD_AL_RIYADH, THE_3075_PRINCE_MANSUR_BIN_ABDULAZIZ_STREET_AL_RIYADH, THE_40, THE_7801_AL_IHSA_AL_RIYADH } + +final address1Values = EnumValues({ + "3075, Prince Mansur Bin Abdulaziz Street, Al Riyadh, ": Address1.THE_3075_PRINCE_MANSUR_BIN_ABDULAZIZ_STREET_AL_RIYADH, + "40,": Address1.THE_40, + "6500, Al Ameen Abdullah Al Ali Al Naeem Street, Al Riyadh, ": Address1.THE_6500_AL_AMEEN_ABDULLAH_AL_ALI_AL_NAEEM_STREET_AL_RIYADH, + "6603, Ibrahim Ibn Al Hamasi, Ar-Riyad, ": Address1.THE_6603_IBRAHIM_IBN_AL_HAMASI_AR_RIYAD, + "7801, Al Ihsa, Al Riyadh, ": Address1.THE_7801_AL_IHSA_AL_RIYADH, + "7960, Mosab Ibn Umair Street, Al Riyadh, ": Address1.THE_7960_MOSAB_IBN_UMAIR_STREET_AL_RIYADH, + "9626, Salah Ad Din Al Ayyubi Road, Al Riyadh, ": Address1.THE_9626_SALAH_AD_DIN_AL_AYYUBI_ROAD_AL_RIYADH +}); + +enum Address2 { AL_MALAZ_RIYADH_PROVINCE_3460, AL_MALAZ_RIYADH_PROVINCE_2817, AR_RAHMANIYYAH_RIYADH_PROVINCE_3816, AL_MALAZ_RIYADH_PROVINCE_3815, AL_WIZARAT_RIYADH_PROVINCE_7039, EASTERN_PROVINCE, AL_MALAZ_RIYADH_PROVINCE_3084 } + +final address2Values = EnumValues({ + "Al Malaz, Riyadh Province, 2817, ": Address2.AL_MALAZ_RIYADH_PROVINCE_2817, + "Al Malaz, Riyadh Province, 3084, ": Address2.AL_MALAZ_RIYADH_PROVINCE_3084, + "Al Malaz, Riyadh Province, 3460, ": Address2.AL_MALAZ_RIYADH_PROVINCE_3460, + "Al Malaz, Riyadh Province, 3815, ": Address2.AL_MALAZ_RIYADH_PROVINCE_3815, + "Al Wizarat, Riyadh Province, 7039, ": Address2.AL_WIZARAT_RIYADH_PROVINCE_7039, + "Ar Rahmaniyyah, Riyadh Province, 3816, ": Address2.AR_RAHMANIYYAH_RIYADH_PROVINCE_3816, + "Eastern Province,": Address2.EASTERN_PROVINCE +}); + +enum City { RIYADH, DAMMAM } + +final cityValues = EnumValues({ + "Dammam": City.DAMMAM, + "Riyadh": City.RIYADH +}); + +enum Country { SAUDI_ARABIA } + +final countryValues = EnumValues({ + "Saudi Arabia": Country.SAUDI_ARABIA +}); + +enum BillingAddressEmail { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM, TAMER_FANASHEH_DRSULAIMANALHABIB_COM } + +final billingAddressEmailValues = EnumValues({ + "Tamer.dasdasdas@gmail.com": BillingAddressEmail.TAMER_DASDASDAS_GMAIL_COM, + "tamer.fanasheh@drsulaimanalhabib.com": BillingAddressEmail.TAMER_FANASHEH_DRSULAIMANALHABIB_COM, + "Tamer.fanasheh@gmail.com": BillingAddressEmail.TAMER_FANASHEH_GMAIL_COM +}); + +enum FirstName { TAMER, TAMER_FANASHEH, FIRST_NAME_TAMER } + +final firstNameValues = EnumValues({ + "tamer": FirstName.FIRST_NAME_TAMER, + "TAMER": FirstName.TAMER, + "TAMER FANASHEH": FirstName.TAMER_FANASHEH +}); + +enum LastName { FANASHEH, MUSA, LAST_NAME_FANASHEH } + +final lastNameValues = EnumValues({ + "FANASHEH": LastName.FANASHEH, + "Fanasheh": LastName.LAST_NAME_FANASHEH, + "MUSA": LastName.MUSA +}); + +enum LatLong { THE_246784385694919524674091019299842, THE_24664749106968054673501121876645, THE_2470993657522702246664724647270134, THE_246626170308533764673348444086107, THE_24664875225999005467347443322574, THE_24674331807435784671024726818286, THE_263430228396836664991113909164471, THE_246767400793488074673774399406786, THE_24665374673515 } + +final latLongValues = EnumValues({ + "24.662617030853376,46.73348444086107": LatLong.THE_246626170308533764673348444086107, + "24.66474910696805,46.73501121876645": LatLong.THE_24664749106968054673501121876645, + "24.664875225999005,46.7347443322574": LatLong.THE_24664875225999005467347443322574, + "24.66537,46.73515": LatLong.THE_24665374673515, + "24.67433180743578,46.71024726818286": LatLong.THE_24674331807435784671024726818286, + "24.676740079348807,46.73774399406786": LatLong.THE_246767400793488074673774399406786, + "24.678438569491952,46.74091019299842": LatLong.THE_246784385694919524674091019299842, + "24.709936575227022,46.664724647270134": LatLong.THE_2470993657522702246664724647270134, + "26.343022839683666, 49.91113909164471": LatLong.THE_263430228396836664991113909164471 +}); + +enum CheckoutAttributeDescription { EMPTY, CHECKOUT_ATTRIBUTE_DESCRIPTION } + +final checkoutAttributeDescriptionValues = EnumValues({ + "ارفاق وصفة: ": CheckoutAttributeDescription.CHECKOUT_ATTRIBUTE_DESCRIPTION, + "": CheckoutAttributeDescription.EMPTY +}); + +class OrderModelCustomer { + OrderModelCustomer({ + 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, + }); + + String id; + Username username; + BillingAddressEmail email; + FirstName firstName; + LastName lastName; + String languageId; + dynamic adminComment; + bool isTaxExempt; + bool hasShoppingCartItems; + bool active; + bool deleted; + bool isSystemAccount; + dynamic systemName; + LastIpAddress lastIpAddress; + DateTime createdOnUtc; + DateTime lastLoginDateUtc; + DateTime lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory OrderModelCustomer.fromJson(Map json) => OrderModelCustomer( + id: json["id"], + username: usernameValues.map[json["username"]], + email: billingAddressEmailValues.map[json["email"]], + firstName: firstNameValues.map[json["first_name"]], + lastName: lastNameValues.map[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: lastIpAddressValues.map[json["last_ip_address"]], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + lastLoginDateUtc: DateTime.parse(json["last_login_date_utc"]), + lastActivityDateUtc: DateTime.parse(json["last_activity_date_utc"]), + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "id": id, + "username": usernameValues.reverse[username], + "email": billingAddressEmailValues.reverse[email], + "first_name": firstNameValues.reverse[firstName], + "last_name": lastNameValues.reverse[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": lastIpAddressValues.reverse[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)), + }; +} + +enum LastIpAddress { THE_1050220126 } + +final lastIpAddressValues = EnumValues({ + "10.50.220.126": LastIpAddress.THE_1050220126 +}); + +enum Username { TAMERF } + +final usernameValues = EnumValues({ + "tamerf": Username.TAMERF +}); + +enum CustomerCurrencyCode { SAR } + +final customerCurrencyCodeValues = EnumValues({ + "SAR": CustomerCurrencyCode.SAR +}); + +enum CustomerIp { THE_105010210, THE_127001, THE_1020200101, THE_102020041, THE_10501028, THE_102020033, THE_1020200170, THE_102020011 } + +final customerIpValues = EnumValues({ + "10.20.200.101": CustomerIp.THE_1020200101, + "10.20.200.11": CustomerIp.THE_102020011, + "10.20.200.170": CustomerIp.THE_1020200170, + "10.20.200.33": CustomerIp.THE_102020033, + "10.20.200.41": CustomerIp.THE_102020041, + "10.50.102.10": CustomerIp.THE_105010210, + "10.50.102.8": CustomerIp.THE_10501028, + "127.0.0.1": CustomerIp.THE_127001 +}); + +enum CustomerTaxDisplayType { EXCLUDING_TAX } + +final customerTaxDisplayTypeValues = EnumValues({ + "ExcludingTax": CustomerTaxDisplayType.EXCLUDING_TAX +}); + +class OrderItem { + OrderItem({ + this.quantity, + this.unitPriceInclTax, + this.unitPriceExclTax, + this.priceInclTax, + this.priceExclTax, + this.discountAmountInclTax, + this.discountAmountExclTax, + this.originalProductCost, + this.attributeDescription, + this.downloadCount, + this.isDownloadActivated, + this.licenseDownloadId, + this.itemWeight, + this.rentalStartDateUtc, + this.rentalEndDateUtc, + this.product, + this.productId, + }); + + dynamic quantity; + double unitPriceInclTax; + double unitPriceExclTax; + double priceInclTax; + double priceExclTax; + double discountAmountInclTax; + double discountAmountExclTax; + double originalProductCost; + String attributeDescription; + dynamic downloadCount; + bool isDownloadActivated; + dynamic licenseDownloadId; + double itemWeight; + dynamic rentalStartDateUtc; + dynamic rentalEndDateUtc; + Product product; + dynamic productId; + + factory OrderItem.fromJson(Map json) => OrderItem( + quantity: json["quantity"], + unitPriceInclTax: json["unit_price_incl_tax"].toDouble(), + unitPriceExclTax: json["unit_price_excl_tax"].toDouble(), + priceInclTax: json["price_incl_tax"].toDouble(), + priceExclTax: json["price_excl_tax"].toDouble(), + discountAmountInclTax: json["discount_amount_incl_tax"].toDouble(), + discountAmountExclTax: json["discount_amount_excl_tax"].toDouble(), + originalProductCost: json["original_product_cost"].toDouble(), + attributeDescription: json["attribute_description"], + downloadCount: json["download_count"], + isDownloadActivated: json["isDownload_activated"], + licenseDownloadId: json["license_download_id"], + itemWeight: json["item_weight"].toDouble(), + rentalStartDateUtc: json["rental_start_date_utc"], + rentalEndDateUtc: json["rental_end_date_utc"], + product: Product.fromJson(json["product"]), + productId: json["product_id"], + ); + + Map toJson() => { + "quantity": quantity, + "unit_price_incl_tax": unitPriceInclTax, + "unit_price_excl_tax": unitPriceExclTax, + "price_incl_tax": priceInclTax, + "price_excl_tax": priceExclTax, + "discount_amount_incl_tax": discountAmountInclTax, + "discount_amount_excl_tax": discountAmountExclTax, + "original_product_cost": originalProductCost, + "attribute_description": attributeDescription, + "download_count": downloadCount, + "isDownload_activated": isDownloadActivated, + "license_download_id": licenseDownloadId, + "item_weight": itemWeight, + "rental_start_date_utc": rentalStartDateUtc, + "rental_end_date_utc": rentalEndDateUtc, + "product": product.toJson(), + "product_id": productId, + }; +} + +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; + dynamic localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + String metaKeywords; + String metaDescription; + String metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic 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; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + dynamic stockAvailability; + dynamic stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + double price; + dynamic oldPrice; + double productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + dynamic currency; + dynamic currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + ProductType productType; + dynamic parentGroupedProductId; + dynamic roleIds; + dynamic discountIds; + dynamic storeIds; + dynamic manufacturerIds; + List reviews; + List images; + dynamic attributes; + dynamic specifications; + dynamic associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + factory Product.fromJson(Map json) => Product( + id: json["id"], + visibleIndividually: json["visible_individually"], + name: json["name"], + namen: json["namen"], + localizedNames: json["localized_names"], + shortDescription: json["short_description"] == null ? null : json["short_description"], + shortDescriptionn: json["short_descriptionn"] == null ? null : 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: productTypeValues.map[json["product_type"]], + parentGroupedProductId: json["parent_grouped_product_id"], + roleIds: json["role_ids"], + discountIds: json["discount_ids"], + storeIds: json["store_ids"], + manufacturerIds: json["manufacturer_ids"], + reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), + images: List.from(json["images"].map((x) => PharmacyImageObject.fromJson(x))), + attributes: json["attributes"], + specifications: json["specifications"], + associatedProductIds: json["associated_product_ids"], + 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": localizedNames, + "short_description": shortDescription == null ? null : shortDescription, + "short_descriptionn": shortDescriptionn == null ? null : 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": productTypeValues.reverse[productType], + "parent_grouped_product_id": parentGroupedProductId, + "role_ids": roleIds, + "discount_ids": discountIds, + "store_ids": storeIds, + "manufacturer_ids": manufacturerIds, + "reviews": List.from(reviews.map((x) => x.toJson())), + "images": List.from(images.map((x) => x.toJson())), + "attributes": attributes, + "specifications": specifications, + "associated_product_ids": associatedProductIds, + "tags": List.from(tags.map((x) => x)), + "vendor_id": vendorId, + "se_name": seName, + }; +} + +enum ProductType { SIMPLE_PRODUCT } + +final productTypeValues = EnumValues({ + "SimpleProduct": ProductType.SIMPLE_PRODUCT +}); + +class Review { + Review({ + this.id, + this.position, + this.reviewId, + this.customerId, + this.productId, + this.storeId, + this.isApproved, + this.title, + this.reviewText, + this.replyText, + this.rating, + this.helpfulYesTotal, + this.helpfulNoTotal, + this.createdOnUtc, + this.customer, + this.product, + }); + + dynamic id; + dynamic position; + dynamic reviewId; + dynamic customerId; + dynamic productId; + dynamic storeId; + bool isApproved; + Title title; + ReviewText reviewText; + dynamic replyText; + dynamic rating; + dynamic helpfulYesTotal; + dynamic helpfulNoTotal; + DateTime createdOnUtc; + ReviewCustomer customer; + dynamic product; + + factory Review.fromJson(Map json) => Review( + id: json["id"], + position: json["position"], + reviewId: json["review_id"], + customerId: json["customer_id"], + productId: json["product_id"], + storeId: json["store_id"], + isApproved: json["is_approved"], + title: titleValues.map[json["title"]], + reviewText: reviewTextValues.map[json["review_text"]], + replyText: json["reply_text"], + rating: json["rating"], + helpfulYesTotal: json["helpful_yes_total"], + helpfulNoTotal: json["helpful_no_total"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: ReviewCustomer.fromJson(json["customer"]), + product: json["product"], + ); + + Map toJson() => { + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": titleValues.reverse[title], + "review_text": reviewTextValues.reverse[reviewText], + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product, + }; +} + +class ReviewCustomer { + ReviewCustomer({ + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + 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, + }); + + dynamic fileNumber; + dynamic iqamaNumber; + dynamic isOutSa; + dynamic patientType; + dynamic gender; + DateTime birthDate; + dynamic phone; + dynamic countryCode; + dynamic yahalaAccountno; + dynamic billingAddress; + dynamic shippingAddress; + List addresses; + String id; + String username; + PurpleEmail email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + dynamic isTaxExempt; + dynamic hasShoppingCartItems; + dynamic active; + dynamic deleted; + dynamic isSystemAccount; + dynamic systemName; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory ReviewCustomer.fromJson(Map json) => ReviewCustomer( + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + addresses: List.from(json["addresses"].map((x) => x)), + id: json["id"], + username: json["username"], + email: purpleEmailValues.map[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: json["created_on_utc"], + lastLoginDateUtc: json["last_login_date_utc"], + lastActivityDateUtc: json["last_activity_date_utc"], + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "addresses": List.from(addresses.map((x) => x)), + "id": id, + "username": username, + "email": purpleEmailValues.reverse[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, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +enum PurpleEmail { STEVE_GATES_NOP_COMMERCE_COM, TAMER_FANASHEH_DRSULAIMANALHABIB_COM, ASIF_RAZA_DRSULAIMANALHABIB_COM, ABOSAMI_YMAIL_COM } + +final purpleEmailValues = EnumValues({ + "abosami@ymail.com": PurpleEmail.ABOSAMI_YMAIL_COM, + "asif.raza@drsulaimanalhabib.com": PurpleEmail.ASIF_RAZA_DRSULAIMANALHABIB_COM, + "steve_gates@nopCommerce.com": PurpleEmail.STEVE_GATES_NOP_COMMERCE_COM, + "tamer.fanasheh@drsulaimanalhabib.com": PurpleEmail.TAMER_FANASHEH_DRSULAIMANALHABIB_COM +}); + +enum ReviewText { GOOD, NICE_PRICE, GREAT, REVIEW_TEXT_GOOD, GG, ENAD_TEST_REVIEW_001, ENAD, ENADDD, ENAD_TEST_0001, PURPLE_GOOD, EMPTY } + +final reviewTextValues = EnumValues({ + "افضل علاج للزكام": ReviewText.EMPTY, + "ENAD ": ReviewText.ENAD, + "enaddd": ReviewText.ENADDD, + "ENAD TEST 0001": ReviewText.ENAD_TEST_0001, + "Enad Test Review 001": ReviewText.ENAD_TEST_REVIEW_001, + "gg": ReviewText.GG, + "good ": ReviewText.GOOD, + "great": ReviewText.GREAT, + "nice price": ReviewText.NICE_PRICE, + "Good": ReviewText.PURPLE_GOOD, + "good": ReviewText.REVIEW_TEXT_GOOD +}); + +enum Title { EMPTY, GOOD, TITLE } + +final titleValues = EnumValues({ + "": Title.EMPTY, + "Good": Title.GOOD, + "ممتاز": Title.TITLE +}); + +enum OrderStatus { ORDER_SUBMITTED, PENDING, ORDER_IN_PROGRESS, ORDER_COMPLETED, CANCELLED, PROCESSING, ORDER_REFUNDED, COMPLETE } + +final orderStatusValues = EnumValues({ + "Cancelled": OrderStatus.CANCELLED, + "Complete": OrderStatus.COMPLETE, + "OrderCompleted": OrderStatus.ORDER_COMPLETED, + "OrderInProgress": OrderStatus.ORDER_IN_PROGRESS, + "OrderRefunded": OrderStatus.ORDER_REFUNDED, + "OrderSubmitted": OrderStatus.ORDER_SUBMITTED, + "Pending": OrderStatus.PENDING, + "Processing": OrderStatus.PROCESSING +}); + +enum OrderStatusn { ORDER_SUBMITTED, EMPTY, ORDER_IN_PROGRESS, ORDER_COMPLETED, ORDER_STATUSN, PURPLE, FLUFFY, TENTACLED } + +final orderStatusnValues = EnumValues({ + "معلقة": OrderStatusn.EMPTY, + "تم ارجاع مبلغ الطلبية المدفوع للعميل": OrderStatusn.FLUFFY, + "Order Completed": OrderStatusn.ORDER_COMPLETED, + "Order In Progress": OrderStatusn.ORDER_IN_PROGRESS, + "ملغي": OrderStatusn.ORDER_STATUSN, + "Order Submitted": OrderStatusn.ORDER_SUBMITTED, + "قيد التنفيذ": OrderStatusn.PURPLE, + "مكتمل": OrderStatusn.TENTACLED +}); + +enum PaymentMethodSystemName { PAYMENTS_PAY_FORT, PAYMENTS_CASH_ON_DELIVERY } + +final paymentMethodSystemNameValues = EnumValues({ + "Payments.CashOnDelivery": PaymentMethodSystemName.PAYMENTS_CASH_ON_DELIVERY, + "Payments.PayFort": PaymentMethodSystemName.PAYMENTS_PAY_FORT +}); + +enum PaymentName { CREDIT_DEBIT_CARD_PAYFORT, CASH_ON_DELIVERY_COD } + +final paymentNameValues = EnumValues({ + "Cash On Delivery (COD)": PaymentName.CASH_ON_DELIVERY_COD, + "Credit / Debit Card Payfort": PaymentName.CREDIT_DEBIT_CARD_PAYFORT +}); + +enum PaymentStatus { PAID, PENDING } + +final paymentStatusValues = EnumValues({ + "Paid": PaymentStatus.PAID, + "Pending": PaymentStatus.PENDING +}); + +enum PaymentStatusn { EMPTY, PAYMENT_STATUSN } + +final paymentStatusnValues = EnumValues({ + "تم الدفع": PaymentStatusn.EMPTY, + "قيد الإنتظار": PaymentStatusn.PAYMENT_STATUSN +}); + +enum PreferDeliveryTime { THE_1000_AM_330_PM, THE_530_PM_730_PM } + +final preferDeliveryTimeValues = EnumValues({ + "10:00 AM - 3:30 PM": PreferDeliveryTime.THE_1000_AM_330_PM, + "5:30 PM - 7:30 PM": PreferDeliveryTime.THE_530_PM_730_PM +}); + +enum PreferDeliveryTimen { THE_1000330, THE_530730 } + +final preferDeliveryTimenValues = EnumValues({ + "10:00 ص - 3:30 م": PreferDeliveryTimen.THE_1000330, + "5:30 م - 7:30 م": PreferDeliveryTimen.THE_530730 +}); + +enum ShippingMethod { EMPTY, FIXED_PRICE } + +final shippingMethodValues = EnumValues({ + "سعر ثابت ": ShippingMethod.EMPTY, + "Fixed Price": ShippingMethod.FIXED_PRICE +}); + +enum ShippingRateComputationMethodSystemName { SHIPPING_FIXED_OR_BY_WEIGHT } + +final shippingRateComputationMethodSystemNameValues = EnumValues({ + "Shipping.FixedOrByWeight": ShippingRateComputationMethodSystemName.SHIPPING_FIXED_OR_BY_WEIGHT +}); + +enum ShippingStatus { NOT_YET_SHIPPED } + +final shippingStatusValues = EnumValues({ + "NotYetShipped": ShippingStatus.NOT_YET_SHIPPED +}); + +enum ShippingStatusn { EMPTY } + +final shippingStatusnValues = EnumValues({ + "لم يتم شحنها بعد": ShippingStatusn.EMPTY +}); + +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/core/model/pharmacies/payment-checkout-data.dart b/lib/core/model/pharmacies/payment-checkout-data.dart new file mode 100644 index 00000000..dd9e0e54 --- /dev/null +++ b/lib/core/model/pharmacies/payment-checkout-data.dart @@ -0,0 +1,21 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:flutter/material.dart'; + +import 'ShippingOption.dart'; + +class PaymentCheckoutData with ChangeNotifier{ + Addresses address; + PaymentOption paymentOption; + LacumAccountInformation lacumInformation; + bool cartDataVisible; + ShippingOption shippingOption; + int usedLakumPoints; + + PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0}); + + void updateData() { + notifyListeners(); + } +} diff --git a/lib/core/model/pharmacies/pharmacies_list_model.dart b/lib/core/model/pharmacies/pharmacies_list_model.dart index a10389b5..01a43a0a 100644 --- a/lib/core/model/pharmacies/pharmacies_list_model.dart +++ b/lib/core/model/pharmacies/pharmacies_list_model.dart @@ -4,7 +4,7 @@ class PharmaciesListModel { int languageID; String stamp; String iPAdress; - dynamic versionID; + double versionID; String tokenID; String sessionID; bool isLoginForDoctorApp; @@ -14,7 +14,7 @@ class PharmaciesListModel { int editedBy; int projectID; int clinicID; - dynamic price; + double price; String imageLocation; String desLocation; String itemDes; diff --git a/lib/core/model/pharmacy/brands_model.dart b/lib/core/model/pharmacy/brands_model.dart new file mode 100644 index 00000000..03cd689e --- /dev/null +++ b/lib/core/model/pharmacy/brands_model.dart @@ -0,0 +1,24 @@ +class BrandsModel { + String id; + String name; + String namen; + Null image; + + BrandsModel({this.id, this.name, this.namen, this.image}); + + BrandsModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + image = json['image']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + data['image'] = this.image; + return data; + } +} diff --git a/lib/core/model/pharmacy/categorise_parent_model.dart b/lib/core/model/pharmacy/categorise_parent_model.dart new file mode 100644 index 00000000..82c5b55f --- /dev/null +++ b/lib/core/model/pharmacy/categorise_parent_model.dart @@ -0,0 +1,75 @@ +class CategoriseParentModel { + String id; + String name; + String namen; + List localizedNames; + dynamic description; + int parentCategoryId; + int displayOrder; + dynamic image; + bool isLeaf; + + CategoriseParentModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.parentCategoryId, + this.displayOrder, + this.image, + this.isLeaf}); + + CategoriseParentModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + description = json['description']; + parentCategoryId = json['parent_category_id']; + displayOrder = json['display_order']; + image = json['image']; + isLeaf = json['is_leaf']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['parent_category_id'] = this.parentCategoryId; + data['display_order'] = this.displayOrder; + data['image'] = this.image; + data['is_leaf'] = this.isLeaf; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} diff --git a/lib/core/model/pharmacy/final_products_model.dart b/lib/core/model/pharmacy/final_products_model.dart new file mode 100644 index 00000000..52ab1d2d --- /dev/null +++ b/lib/core/model/pharmacy/final_products_model.dart @@ -0,0 +1,184 @@ +class FinalProductsModel { + String id; + String name; + String namen; + List localizedNames; + String shortDescription; + String fullDescription; + String fullDescriptionn; + dynamic approvedRatingSum; + dynamic approvedTotalReviews; + String sku; + bool isRx; + dynamic rxMessage; + dynamic rxMessagen; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic price; + dynamic oldPrice; + dynamic discountName; + dynamic discountNamen; + dynamic discountPercentage; + dynamic displayOrder; + List discountIds; + List reviews; + List images; + + FinalProductsModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.fullDescription, + this.fullDescriptionn, + this.approvedRatingSum, + this.approvedTotalReviews, + this.sku, + this.isRx, + this.rxMessage, + this.rxMessagen, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.price, + this.oldPrice, + this.discountName, + this.discountNamen, + this.discountPercentage, + this.displayOrder, + this.discountIds, + this.reviews, + this.images}); + + FinalProductsModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + shortDescription = json['short_description']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + approvedRatingSum = json['approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + price = json['price']; + oldPrice = json['old_price']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountPercentage = json['discount_percentage']; + displayOrder = json['display_order']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['approved_rating_sum'] = this.approvedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_percentage'] = this.discountPercentage; + data['display_order'] = this.displayOrder; + + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/model/pharmacy/offer_products_model.dart b/lib/core/model/pharmacy/offer_products_model.dart new file mode 100644 index 00000000..f41b731b --- /dev/null +++ b/lib/core/model/pharmacy/offer_products_model.dart @@ -0,0 +1,579 @@ +class OfferProductsModel { + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic 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; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + String discountName; + String discountNamen; + String discountDescription; + String discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + dynamic weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + OfferProductsModel( + {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}); + + OfferProductsModel.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + 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']; + metaDescription = json['meta_description']; + metaTitle = 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']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + 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']; + 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 = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + + discountIds = json['discount_ids'].cast(); + + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v.toJson()).toList(); + } + data['discount_ids'] = this.discountIds; + if (this.storeIds != null) { + data['store_ids'] = this.storeIds.map((v) => v.toJson()).toList(); + } + if (this.manufacturerIds != null) { + data['manufacturer_ids'] = + this.manufacturerIds.map((v) => v.toJson()).toList(); + } + if (this.reviews != null) { + data['reviews'] = this.reviews.map((v) => v.toJson()).toList(); + } + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + if (this.attributes != null) { + data['attributes'] = this.attributes.map((v) => v.toJson()).toList(); + } + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + if (this.associatedProductIds != null) { + data['associated_product_ids'] = + this.associatedProductIds.map((v) => v.toJson()).toList(); + } + if (this.tags != null) { + data['tags'] = this.tags.map((v) => v.toJson()).toList(); + } + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/pharmacy/offers_model.dart b/lib/core/model/pharmacy/offers_model.dart new file mode 100644 index 00000000..3add1d3d --- /dev/null +++ b/lib/core/model/pharmacy/offers_model.dart @@ -0,0 +1,175 @@ +class OffersModel { + String id; + String name; + String namen; + List localizedNames; + Null description; + int categoryTemplateId; + String metaKeywords; + String metaDescription; + String metaTitle; + int parentCategoryId; + int pageSize; + String pageSizeOptions; + Null priceRanges; + bool showOnHomePage; + bool includeInTopMenu; + Null hasDiscountsApplied; + bool published; + bool deleted; + int displayOrder; + String createdOnUtc; + String updatedOnUtc; + List roleIds; + List discountIds; + List storeIds; + Image image; + String seName; + bool isLeaf; + + OffersModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.categoryTemplateId, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.parentCategoryId, + this.pageSize, + this.pageSizeOptions, + this.priceRanges, + this.showOnHomePage, + this.includeInTopMenu, + this.hasDiscountsApplied, + this.published, + this.deleted, + this.displayOrder, + this.createdOnUtc, + this.updatedOnUtc, + this.roleIds, + this.discountIds, + this.storeIds, + this.image, + this.seName, + this.isLeaf}); + + OffersModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + description = json['description']; + categoryTemplateId = json['category_template_id']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + parentCategoryId = json['parent_category_id']; + pageSize = json['page_size']; + pageSizeOptions = json['page_size_options']; + priceRanges = json['price_ranges']; + showOnHomePage = json['show_on_home_page']; + includeInTopMenu = json['include_in_top_menu']; + hasDiscountsApplied = json['has_discounts_applied']; + published = json['published']; + deleted = json['deleted']; + displayOrder = json['display_order']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + + image = json['image'] != null ? new Image.fromJson(json['image']) : null; + seName = json['se_name']; + isLeaf = json['is_leaf']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['category_template_id'] = this.categoryTemplateId; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['parent_category_id'] = this.parentCategoryId; + data['page_size'] = this.pageSize; + data['page_size_options'] = this.pageSizeOptions; + data['price_ranges'] = this.priceRanges; + data['show_on_home_page'] = this.showOnHomePage; + data['include_in_top_menu'] = this.includeInTopMenu; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['display_order'] = this.displayOrder; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v.toJson()).toList(); + } + if (this.discountIds != null) { + data['discount_ids'] = this.discountIds.map((v) => v.toJson()).toList(); + } + if (this.storeIds != null) { + data['store_ids'] = this.storeIds.map((v) => v.toJson()).toList(); + } + if (this.image != null) { + data['image'] = this.image.toJson(); + } + data['se_name'] = this.seName; + data['is_leaf'] = this.isLeaf; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Image { + String src; + Null thumb; + Null attachment; + + Image({this.src, this.thumb, this.attachment}); + + Image.fromJson(Map json) { + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/model/pharmacy/parent_products_model.dart b/lib/core/model/pharmacy/parent_products_model.dart new file mode 100644 index 00000000..55495416 --- /dev/null +++ b/lib/core/model/pharmacy/parent_products_model.dart @@ -0,0 +1,566 @@ +class ParentProductsModel { + dynamic id; + dynamic visibleIndividually; + dynamic name; + dynamic namen; + List localizedNames; + dynamic shortDescription; + dynamic shortDescriptionn; + dynamic fullDescription; + dynamic fullDescriptionn; + dynamic markasNew; + dynamic showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + dynamic allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + dynamic sku; + dynamic isRx; + dynamic prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + dynamic isGiftCard; + dynamic requireOtherProducts; + dynamic automaticallyAddRequiredProducts; + dynamic isDownload; + dynamic unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + dynamic hasSampleDownload; + dynamic hasUserAgreement; + dynamic isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + dynamic isRental; + dynamic rentalPriceLength; + dynamic isShipEnabled; + dynamic isFreeShipping; + dynamic shipSeparately; + dynamic additionalShippingCharge; + dynamic isTaxExempt; + dynamic isTelecommunicationsOrBroadcastingOrElectronicServices; + dynamic useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + dynamic stockAvailability; + dynamic stockAvailabilityn; + dynamic displayStockAvailability; + dynamic displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + dynamic allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + dynamic allowAddingOnlyExistingAttributeCombinations; + dynamic disableBuyButton; + dynamic disableWishlistButton; + dynamic availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + dynamic callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + dynamic customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + dynamic basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + dynamic hasTierPrices; + dynamic hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + dynamic currency; + dynamic currencyn; + dynamic weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + dynamic published; + dynamic deleted; + dynamic createdOnUtc; + dynamic updatedOnUtc; + dynamic productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + ParentProductsModel( + {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}); + + ParentProductsModel.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + 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']; + metaDescription = json['meta_description']; + metaTitle = 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']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + 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']; + 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 = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + + manufacturerIds = json['manufacturer_ids'].cast(); + + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); + } + + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + + data['manufacturer_ids'] = this.manufacturerIds; + + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/pharmacy/pharmacy_categorise.dart b/lib/core/model/pharmacy/pharmacy_categorise.dart new file mode 100644 index 00000000..33ac26f1 --- /dev/null +++ b/lib/core/model/pharmacy/pharmacy_categorise.dart @@ -0,0 +1,103 @@ +class PharmacyCategorise { + dynamic id; + String name; + dynamic namen; + List localizedNames; + dynamic description; + dynamic parentCategoryId; + dynamic displayOrder; + dynamic image; + dynamic isLeaf; + + PharmacyCategorise( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.parentCategoryId, + this.displayOrder, + this.image, + this.isLeaf}); + + PharmacyCategorise.fromJson(Map json) { + try { + id = json['id']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + description = json['description']; + parentCategoryId = json['parent_category_id']; + displayOrder = json['display_order']; + image = json['image'] != null ? new Image.fromJson(json['image']) : null; + isLeaf = json['is_leaf']; + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['parent_category_id'] = this.parentCategoryId; + data['display_order'] = this.displayOrder; + if (this.image != null) { + data['image'] = this.image.toJson(); + } + data['is_leaf'] = this.isLeaf; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Image { + String src; + Null thumb; + Null attachment; + + Image({this.src, this.thumb, this.attachment}); + + Image.fromJson(Map json) { + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/model/pharmacy/scan_qr_model.dart b/lib/core/model/pharmacy/scan_qr_model.dart new file mode 100644 index 00000000..71e25e8d --- /dev/null +++ b/lib/core/model/pharmacy/scan_qr_model.dart @@ -0,0 +1,584 @@ +class ScanQrModel { + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic 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; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + ScanQrModel( + {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}); + + ScanQrModel.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + 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']; + metaDescription = json['meta_description']; + metaTitle = 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']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + 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']; + 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 = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + if (json['role_ids'] != null) { + roleIds = new List(); + } + if (json['discount_ids'] != null) { + discountIds = new List(); + } + if (json['store_ids'] != null) { + storeIds = new List(); + } + manufacturerIds = json['manufacturer_ids'].cast(); + if (json['reviews'] != null) { + reviews = new List(); + } + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + if (json['attributes'] != null) { + attributes = new List(); + } + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); + } + if (json['associated_product_ids'] != null) { + associatedProductIds = new List(); + } + if (json['tags'] != null) { + tags = new List(); + } + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + + data['manufacturer_ids'] = this.manufacturerIds; + + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/pharmacy/sub_categories_model.dart b/lib/core/model/pharmacy/sub_categories_model.dart new file mode 100644 index 00000000..916ec023 --- /dev/null +++ b/lib/core/model/pharmacy/sub_categories_model.dart @@ -0,0 +1,75 @@ +class SubCategoriesModel { + String id; + String name; + String namen; + List localizedNames; + String description; + int parentCategoryId; + int displayOrder; + dynamic image; + bool isLeaf; + + SubCategoriesModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.parentCategoryId, + this.displayOrder, + this.image, + this.isLeaf}); + + SubCategoriesModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + description = json['description']; + parentCategoryId = json['parent_category_id']; + displayOrder = json['display_order']; + image = json['image']; + isLeaf = json['is_leaf']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['parent_category_id'] = this.parentCategoryId; + data['display_order'] = this.displayOrder; + data['image'] = this.image; + data['is_leaf'] = this.isLeaf; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} diff --git a/lib/core/model/pharmacy/sub_products_model.dart b/lib/core/model/pharmacy/sub_products_model.dart new file mode 100644 index 00000000..6e8964c9 --- /dev/null +++ b/lib/core/model/pharmacy/sub_products_model.dart @@ -0,0 +1,562 @@ +class SubProductsModel { + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic 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; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + SubProductsModel( + {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}); + + SubProductsModel.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + 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']; + metaDescription = json['meta_description']; + metaTitle = 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']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + 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']; + 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 = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + + manufacturerIds = json['manufacturer_ids'].cast(); + + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); + } + + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + + data['manufacturer_ids'] = this.manufacturerIds; + + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} 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/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/reports/Reports.dart b/lib/core/model/reports/Reports.dart index a8a5869d..6791a3d4 100644 --- a/lib/core/model/reports/Reports.dart +++ b/lib/core/model/reports/Reports.dart @@ -11,24 +11,24 @@ class Reports { String setupId; int patientID; int doctorID; - Null clinicID; + dynamic clinicID; DateTime requestDate; bool isRead; DateTime isReadOn; int actualDoctorRate; String clinicDescription; - Null clinicDescriptionN; + dynamic clinicDescriptionN; String docName; Null docNameN; String doctorImageURL; - Null doctorName; - Null doctorNameN; + dynamic doctorName; + dynamic doctorNameN; int doctorRate; bool isDoctorAllowVedioCall; bool isExecludeDoctor; int noOfPatientsRate; String projectName; - Null projectNameN; + dynamic projectNameN; Reports( {this.status, @@ -61,37 +61,41 @@ class Reports { this.projectNameN}); Reports.fromJson(Map json) { - status = json['Status']; - encounterDate = DateUtil.convertStringToDate( - json['EncounterDate']); //json['EncounterDate']; - projectID = json['ProjectID']; - invoiceNo = json['InvoiceNo']; - encounterNo = json['EncounterNo']; - procedureId = json['ProcedureId']; - requestType = json['RequestType']; - setupId = json['SetupId']; - patientID = json['PatientID']; - doctorID = json['DoctorID']; - clinicID = json['ClinicID']; - requestDate = DateUtil.convertStringToDate( - json['RequestDate']); //json['RequestDate']; - isRead = json['IsRead']; - isReadOn = - DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn']; - actualDoctorRate = json['ActualDoctorRate']; - clinicDescription = json['ClinicDescription']; - clinicDescriptionN = json['ClinicDescriptionN']; - docName = json['DocName']; - docNameN = json['DocNameN']; - doctorImageURL = json['DoctorImageURL']; - doctorName = json['DoctorName']; - doctorNameN = json['DoctorNameN']; - doctorRate = json['DoctorRate']; - isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; - isExecludeDoctor = json['IsExecludeDoctor']; - noOfPatientsRate = json['NoOfPatientsRate']; - projectName = json['ProjectName']; - projectNameN = json['ProjectNameN']; + try { + status = json['Status']; + encounterDate = DateUtil.convertStringToDate( + json['EncounterDate']); //json['EncounterDate']; + projectID = json['ProjectID']; + invoiceNo = json['InvoiceNo']; + encounterNo = json['EncounterNo']; + procedureId = json['ProcedureId']; + requestType = json['RequestType']; + setupId = json['SetupId']; + patientID = json['PatientID']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + requestDate = DateUtil.convertStringToDate( + json['RequestDate']); //json['RequestDate']; + isRead = json['IsRead']; + isReadOn = + DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn']; + actualDoctorRate = json['ActualDoctorRate']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + docName = json['DocName']; + docNameN = json['DocNameN']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + doctorRate = json['DoctorRate']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + noOfPatientsRate = json['NoOfPatientsRate']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + }catch(e){ + print(e); + } } Map toJson() { diff --git a/lib/core/model/search_products_model.dart b/lib/core/model/search_products_model.dart new file mode 100644 index 00000000..d63fd4b0 --- /dev/null +++ b/lib/core/model/search_products_model.dart @@ -0,0 +1,185 @@ +class SearchProductsModel { + String id; + String name; + String namen; + List localizedNames; + String shortDescription; + String fullDescription; + String fullDescriptionn; + dynamic approvedRatingSum; + dynamic approvedTotalReviews; + String sku; + bool isRx; + dynamic rxMessage; + dynamic rxMessagen; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + double price; + dynamic oldPrice; + dynamic discountName; + dynamic discountNamen; + dynamic discountPercentage; + dynamic displayOrder; + List discountIds; + List reviews; + List images; + + SearchProductsModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.fullDescription, + this.fullDescriptionn, + this.approvedRatingSum, + this.approvedTotalReviews, + this.sku, + this.isRx, + this.rxMessage, + this.rxMessagen, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.price, + this.oldPrice, + this.discountName, + this.discountNamen, + this.discountPercentage, + this.displayOrder, + this.discountIds, + this.reviews, + this.images}); + + SearchProductsModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + shortDescription = json['short_description']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + approvedRatingSum = json['approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + price = json['price']; + oldPrice = json['old_price']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountPercentage = json['discount_percentage']; + displayOrder = json['display_order']; + + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['approved_rating_sum'] = this.approvedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_percentage'] = this.discountPercentage; + data['display_order'] = this.displayOrder; + + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} 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 index 7ee84bac..37ee5983 100644 --- a/lib/core/model/weahter/weather_model.dart +++ b/lib/core/model/weahter/weather_model.dart @@ -32,35 +32,35 @@ class WeatherIndicatorModel { 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}); + 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']; @@ -162,24 +162,24 @@ class GetCityInfoList { 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}); + 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 @@ -241,10 +241,10 @@ class CategoriesNames { CategoriesNames( {this.category1, - this.category2, - this.category3, - this.category4, - this.category5}); + this.category2, + this.category3, + this.category4, + this.category5}); CategoriesNames.fromJson(Map json) { category1 = json['Category1']; @@ -264,3 +264,4 @@ class CategoriesNames { return data; } } + 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/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 89c0775c..3788cf98 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'; @@ -58,15 +59,7 @@ class BaseAppClient { body['VersionID'] = VERSION_ID; body['Channel'] = CHANNEL; - body['LanguageID'] = body.containsKey('LanguageID') - ? body['LanguageID'] != null - ? body['LanguageID'] - : languageID == 'ar' - ? 1 - : 2 - : languageID == 'en' - ? 2 - : 1; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; body['IPAdress'] = IP_ADDRESS; body['generalid'] = GENERAL_ID; @@ -148,13 +141,25 @@ class BaseAppClient { } else if (parsed['Result'] == 'OK') { onSuccess(parsed, statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + if (parsed != null) { + onSuccess(parsed, statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + logout(); + } } } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 2 && + parsed['IsAuthenticated']) { + onFailure( + parsed['message'] ?? + parsed['ErrorEndUserMessage'] ?? + parsed['ErrorMessage'], + statusCode); } else if (!parsed['IsAuthenticated']) { await logout(); @@ -163,9 +168,13 @@ class BaseAppClient { if (parsed['SameClinicApptList'] != null) { onSuccess(parsed, statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + if (parsed['message'] != null) { + onFailure(parsed['message'] ?? parsed['message'], statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } } } } @@ -175,8 +184,7 @@ class BaseAppClient { } } catch (e) { print(e); - onFailure('Failed to connect to the server', -1); - // onFailure(e.toString(), -1); + onFailure(e.toString(), -1); } } @@ -227,18 +235,110 @@ class BaseAppClient { } } + getPharmacy(String endPoint, + {Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + bool isAllowAny = false, + Map queryParams}) async { + String url = PHARMACY_BASE_URL + endPoint; + if (queryParams != null) { + String queryString = Uri(queryParameters: queryParams).query; + url += '?' + queryString; + } + + print("URL : $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 { + var parsed = json.decode(response.body.toString()); + onSuccess(parsed, statusCode); + } + } else { + onFailure('Please Check The Internet Connection', -1); + } + } + + 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; } } 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..bf340814 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,31 @@ 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) { + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } - }, onFailure: (String error, int statusCode) { + Future updateEmail({String email}) async { + Map body = Map(); + body['EmailAddress'] = email; + body['isDentalAllowedBackend'] = false; + hasError = false; + await baseAppClient.post(UPDATE_PATENT_EMAIL, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } - - Future insertRequestForMedicalReport( AppointmentHistory appointmentHistory) async { Map body = new Map(); @@ -96,4 +105,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/offers_service.dart b/lib/core/service/offers_service.dart new file mode 100644 index 00000000..2247c833 --- /dev/null +++ b/lib/core/service/offers_service.dart @@ -0,0 +1,56 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offer_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offers_model.dart'; + +import 'base_service.dart'; + +class OffersCategoriseService extends BaseService { + List _offersList = List(); + List get offersList => _offersList; + List _offerProducts = List(); + List get offersProducts => _offerProducts; + + clearCategorise() { + _offerProducts.clear(); + } + + // clearCategorise2() { + // _offersList.clear(); + // } + + Future getOffersCategorise() async { + hasError = false; + _offersList.clear(); + await baseAppClient.get( + GET_OFFERS_CATEGORISE, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _offersList.add(OffersModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getOffersProducts({String id}) async { + hasError = false; + _offerProducts.clear(); + String endPoint = + id != null ? GET_OFFERS_PRODUCTS + "$id" : GET_OFFERS_PRODUCTS + "1"; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _offerProducts.add(OfferProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } +} 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/parmacyModule/lacum-registration-service.dart b/lib/core/service/parmacyModule/lacum-registration-service.dart new file mode 100644 index 00000000..b3e64e69 --- /dev/null +++ b/lib/core/service/parmacyModule/lacum-registration-service.dart @@ -0,0 +1,50 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; + +import 'lacum-service.dart'; + +class LacumRegistrationService extends LacumService{ + + ListUserAgreement listUserAgreement; + + Future getLacumAccountInformationById(String patientIdentificationNo) async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = patientIdentificationNo; + + try { + await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, + onSuccess: (response, statusCode) async { + lacumInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future getUserTermsAndConditionsForEPharmcy() async { + hasError = false; + super.error = ""; + + Map body = Map(); + + try { + await baseAppClient.post(LAKUM_GET_USER_TERMS_AND_CONDITIONS, + onSuccess: (response, statusCode) async { + listUserAgreement = ListUserAgreement.fromJson(response['ListUserAgreement'][0]); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + +} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/lacum-service.dart b/lib/core/service/parmacyModule/lacum-service.dart new file mode 100644 index 00000000..c7117303 --- /dev/null +++ b/lib/core/service/parmacyModule/lacum-service.dart @@ -0,0 +1,133 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class LacumService extends BaseService{ + bool isFinished = true; + bool hasError = false; + String errorMsg = ''; + String successMsg = ''; + + LacumAccountInformation lacumInformation; + LacumAccountInformation lacumGroupInformation; + + Future getLacumAccountInformation() async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + + try { + await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, + onSuccess: (response, statusCode) async { + lacumInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future getLacumGroupInformation() async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; + body['IsDetailsRequired'] = true; + + try { + await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, + onSuccess: (response, statusCode) async { + lacumGroupInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future makeAccountActivate() async { + hasError = false; + super.error = ""; + int yahalaAccountNo = lacumInformation.yahalaAccountNo; + + Map body = Map(); + body['CreatedBy'] = 103; + body['YahalaAccountNumber'] = yahalaAccountNo; + + try { + await baseAppClient.post(LACUM_ACCOUNT_ACTIVATE, + onSuccess: (response, statusCode) async { + // lacumInformation = LacumAccountInformation.fromJson(response); + // lacumInformation.yahalaAccountNo = yahalaAccountNo; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future makeAccountDeactivate() async { + hasError = false; + super.error = ""; + int yahalaAccountNo = lacumInformation.yahalaAccountNo; + + Map body = Map(); + body['CreatedBy'] = 103; + body['YahalaAccountNumber'] = yahalaAccountNo; + + try { + await baseAppClient.post(LACUM_ACCOUNT_DEACTIVATE, + onSuccess: (response, statusCode) async { + // lacumInformation = LacumAccountInformation.fromJson(response); + // lacumInformation.yahalaAccountNo = yahalaAccountNo; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future createLakumAccount(String name, String phone, int accountID, String patientIdentificationID, var prefLang) async { + hasError = false; + super.error = ""; + if(prefLang == null){ + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); + prefLang = languageID == 'ar' ? 1 : 2; + } + + + Map body = Map(); + body['PrefLang'] = prefLang; + body['AccountID'] = accountID; + body['FullName'] = name; + body['MobileNo'] = phone; + body['PatientIdentificationID'] = patientIdentificationID; + body['PatientID'] = user.patientID; + + try { + await baseAppClient.post(CREATE_LAKUM_ACCOUNT, + onSuccess: (response, statusCode) async { + successMsg = LacumAccountInformation.fromJson(response).message; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } +} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/lacum-transfer-service.dart b/lib/core/service/parmacyModule/lacum-transfer-service.dart new file mode 100644 index 00000000..b15696f9 --- /dev/null +++ b/lib/core/service/parmacyModule/lacum-transfer-service.dart @@ -0,0 +1,57 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; + +import 'lacum-service.dart'; + +class LacumTransferService extends LacumService{ + LacumAccountInformation lacumReceiverInformation; + + Future getLacumGroupDataBuAccountId(String accountId) async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + body['AccountNumber'] = accountId; + + try { + await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, + onSuccess: (response, statusCode) async { + lacumReceiverInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + return null; + }, body: body); + } catch (error) { + throw error; + } + } + + Future transferYaHalaLoyaltyPoints(String points) async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['MobileNo'] = lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber; + body['UserName'] = lacumGroupInformation.lakumInquiryInformationObjVersion.memberName; + body['YaHalaSenderAccNumber'] = lacumGroupInformation.lakumInquiryInformationObjVersion.accountNumber; + body['Yahala_IdentificationNo'] = lacumGroupInformation.lakumInquiryInformationObjVersion.memberUniversalId; + body['YaHalaPointsToTransfer'] = points; + body['YaHalaReceiverAccNumber'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.accountNumber; + body['YaHalaReceiverMobileNumber'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.mobileNumber; + body['YaHalaReceiverName'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.memberName; + + try { + await baseAppClient.post(TRANSFER_YAHALA_LOYALITY_POINTS, + onSuccess: (response, statusCode) async { + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + +} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 1f3f9ddd..5648ff6d 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -1,29 +1,248 @@ 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/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -class OrderPreviewService extends BaseService{ +class OrderPreviewService extends BaseService { bool isFinished = true; bool hasError = false; String errorMsg = ''; List addresses = List(); + LacumAccountInformation lacumInformation; + LacumAccountInformation lacumGroupInformation; - Future getBannerListList() async { + Future getAddresses() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + Map queryParams = {'fields': 'addresses'}; hasError = false; try { - await baseAppClient.get(GET_CUSTOMERS_ADDRESSES, + await baseAppClient.get("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) { - addresses.clear(); - response['customers'][0]['addresses'].forEach((item) { - addresses.add(Addresses.fromJson(item)); - }); + addresses.clear(); + response['customers'][0]['addresses'].forEach((item) { + addresses.add(Addresses.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future getShippingOption(Addresses selectedAddress) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + Map queryParams = Map(); + dynamic localRes; + hasError = false; + try { + await baseAppClient.get("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}", + onSuccess: (dynamic response, int statusCode) { + localRes = response['shipping_option'][0]; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }); + }, queryParams: queryParams); } catch (error) { throw error; } + return Future.value(localRes); + } + + Future getShoppingCart() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + Map queryParams = {'shopping_cart_type': '1'}; + dynamic localRes; + hasError = false; + try { + await baseAppClient.get("$GET_SHOPPING_CART$customerId", + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + return Future.value(localRes); + } + + Future changeProductQuantity( + String productId, ShoppingCart product) async { + hasError = false; + super.error = ""; + dynamic localRes; + Map choppingCartObject = Map(); + choppingCartObject['id'] = product.id; + choppingCartObject['quantity'] = product.quantity; + choppingCartObject['shopping_cart_type'] = "1"; + choppingCartObject['product_id'] = product.productId; + choppingCartObject['customer_id'] = product.customerId; + + Map body = Map(); + body["shopping_cart_item"] = choppingCartObject; + + await baseAppClient.post("$GET_SHOPPING_CART$productId", + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + + return Future.value(localRes); + } + + Future deleteProduct(String productId) async { + hasError = false; + super.error = ""; + dynamic localRes; + + Map body = Map(); + + await baseAppClient.post("$DELETE_SHOPPING_CART$productId", + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + + return Future.value(localRes); + } + + Future deleteShoppingCart() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + hasError = false; + super.error = ""; + dynamic localRes; + + await baseAppClient.get("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart", + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + + return Future.value(localRes); + } + + Future getLacumAccountInformation() async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + + try { + await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, + onSuccess: (response, statusCode) async { + lacumInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future getLacumGroupInformation() async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; + + try { + await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, + onSuccess: (response, statusCode) async { + lacumGroupInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future makeOrder(PaymentCheckoutData paymentCheckoutData, List shoppingCarts) async { + paymentCheckoutData.address.isChecked = true; + hasError = false; + super.error = ""; + + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + Map orderBody = Map(); + orderBody['rx_attachments'] = ""; + orderBody['customer_language_id'] = languageID == 'ar' ? 1 : 2; + orderBody['billing_address'] = paymentCheckoutData.address; + orderBody['pick_up_in_store'] = false; + orderBody['payment_method_system_name'] = "Payments.PayFort"; + orderBody['shipping_method'] = languageID == 'ar' ? paymentCheckoutData.shippingOption.namen : paymentCheckoutData.shippingOption.name ; + orderBody['shipping_rate_computation_method_system_name'] = paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName; + orderBody['customer_id'] = customerId; + orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; + orderBody['shippingOption'] = paymentCheckoutData.shippingOption; + orderBody['shipping_address'] = paymentCheckoutData.address; + orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; + + List> itemsList = List(); + shoppingCarts.forEach((item) { + Map orderItemsBody = Map(); + orderItemsBody['product_id'] = item.product.id; + orderItemsBody['quantity'] = item.quantity; + itemsList.add(orderItemsBody); + }); + orderBody['order_items'] = itemsList; + + Map body = Map(); + body['order'] = orderBody; + + try { + await baseAppClient.post(ORDER_SHOPPING_CART, + onSuccess: (response, statusCode) async { + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + String getPaymentOptionName(PaymentOption paymentOption) { + switch (paymentOption.index) { + case 0: + return "MADA"; + break; + case 1: + return "SADAD"; + break; + case 2: + return "VISA"; + break; + case 3: + return "MASTERCARD"; + break; + case 4: + return "INSTALLMENT"; + break; + default: + return ""; + } } -} \ No newline at end of file +} diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index 8584e140..c3bce324 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -4,8 +4,10 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; class PharmacyModuleService extends BaseService { + final AppSharedPreferences sharedPref = AppSharedPreferences(); bool isFinished = true; bool hasError = false; String errorMsg = ''; @@ -15,6 +17,55 @@ class PharmacyModuleService extends BaseService { List bestSellerProducts = List(); List lastVisitedProducts = List(); + Future makeVerifyCustomer(dynamic data) async { + Map queryParams = {'FileNumber': data['PatientID'].toString()}; + hasError = false; + try { + await baseAppClient.get(PHARMACY_VERIFY_CUSTOMER, + onSuccess: (dynamic response, int statusCode) { + if (response['UserName'] != null) { + sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); + print(response); + } else { + createUser(); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future createUser() async { + var data = await sharedPref.getObject(USER_PROFILE); + var languageID = await sharedPref.getString(APP_LANGUAGE); + Map queryParams = { + 'Phone': data['MobileNumber'], + 'Email': data['EmailAddress'], + 'FileNumber': data['PatientID'].toString(), + 'Language': languageID.toString(), + 'Gender': data['Gender'].toString(), + 'FirstName': data['FirstName'], + 'LastName': data['LastName'], + 'LanguageId': languageID.toString(), + 'CountryCode': data['ZipCode'], + }; + hasError = false; + try { + await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, + onSuccess: (dynamic response, int statusCode) { + if (!response['IsRegistered']) {} + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + Future getBannerListList() async { hasError = false; try { @@ -40,7 +91,10 @@ class PharmacyModuleService extends BaseService { onSuccess: (dynamic response, int statusCode) { manufacturerList.clear(); response['manufacturer'].forEach((item) { - manufacturerList.add(Manufacturer.fromJson(item)); + Manufacturer manufacturer = Manufacturer.fromJson(item); + if(manufacturer.image != null){ + manufacturerList.add(Manufacturer.fromJson(item)); + } }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -81,14 +135,14 @@ class PharmacyModuleService extends BaseService { try { await baseAppClient.get("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) { - lastVisitedProducts.clear(); - response['products'].forEach((item) { - lastVisitedProducts.add(PharmacyProduct.fromJson(item)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + lastVisitedProducts.clear(); + response['products'].forEach((item) { + lastVisitedProducts.add(PharmacyProduct.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); } catch (error) { throw error; } diff --git a/lib/core/service/parmacyModule/terms-condition-service.dart b/lib/core/service/parmacyModule/terms-condition-service.dart new file mode 100644 index 00000000..68fac632 --- /dev/null +++ b/lib/core/service/parmacyModule/terms-condition-service.dart @@ -0,0 +1,33 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; + +import '../base_service.dart'; + +class TermsConditionService extends BaseService{ + bool isFinished = true; + bool hasError = false; + String errorMsg = ''; + String successMsg = ''; + + ListUserAgreement listUserAgreement; + + Future getUserTermsAndConditionsForEPharmcy() async { + hasError = false; + super.error = ""; + + Map body = Map(); + + try { + await baseAppClient.post(LAKUM_GET_USER_TERMS_AND_CONDITIONS, + onSuccess: (response, statusCode) async { + listUserAgreement = ListUserAgreement.fromJson(response['ListUserAgreement'][0]); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + +} \ No newline at end of file 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/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart new file mode 100644 index 00000000..b55a755d --- /dev/null +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -0,0 +1,225 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/scan_qr_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/sub_categories_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/sub_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/search_products_model.dart'; + +import 'base_service.dart'; + +class PharmacyCategoriseService extends BaseService { + //service one + List _categoriseList = List(); + List get categoriseList => _categoriseList; + + //service two + List _parentCategoriseList = List(); + List get parentCategoriseList => _parentCategoriseList; + + //service three + List _parentProductsList = List(); + List get parentProductsList => _parentProductsList; + + //service four + List _subCategoriseList = List(); + List get subCategoriseList => _subCategoriseList; + + //service five + List _subProductsList = List(); + List get subProductsList => _subProductsList; + + //service six + List _finalProducts = List(); + List get finalProducts => _finalProducts; + + //service 7 + + List _brandsList = List(); + List get brandsList => _brandsList; + + // service 8 + + List _searchList = List(); + List get searchList => _searchList; + + List _scanList = List(); + List get scanList => _scanList; + + clearSearchList() { + _searchList.clear(); + } + + Future getCategorise() async { + hasError = false; + _categoriseList.clear(); + await baseAppClient.get( + GET_PHARMACY_CATEGORISE, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _categoriseList.add(PharmacyCategorise.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future scanQr({String id}) async { + hasError = false; + _scanList.clear(); + String endPoint = id != null ? SCAN_QR_CODE + "$id" : SCAN_QR_CODE + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _scanList.add(ScanQrModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future searchProducts({String productName}) async { + hasError = false; + _searchList.clear(); + String endPoint = productName != null + ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' + : GET_SEARCH_PRODUCTS + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _searchList.add(SearchProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getBrands() async { + hasError = false; + _brandsList.clear(); + await baseAppClient.get( + GET_BRANDS_LIST, + onSuccess: (dynamic response, int statusCode) { + response['manufacturer'].forEach((item) { + _brandsList.add(BrandsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getCategoriseParent({String id}) async { + hasError = false; + _parentCategoriseList.clear(); + String endPoint = + id != null ? GET_CATEGORISE_PARENT + "$id" : GET_CATEGORISE_PARENT + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _parentCategoriseList.add(CategoriseParentModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getParentProducts({String id}) async { + hasError = false; + _parentProductsList.clear(); + String endPoint = id != null + ? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50' + : GET_PARENT_PRODUCTS + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _parentProductsList.add(ParentProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getSubCategorise({String id}) async { + hasError = false; + _subCategoriseList.clear(); + + String endPoint = + id != null ? GET_SUB_CATEGORISE + "$id" : GET_SUB_CATEGORISE + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _subCategoriseList.add(SubCategoriesModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getSubProducts({String id}) async { + hasError = false; + _subProductsList.clear(); + String endPoint = id != null + ? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50' + : GET_SUB_PRODUCTS + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _subProductsList.add(SubProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getFinalProducts({String id}) async { + hasError = false; + _finalProducts.clear(); + String endPoint = + id != null ? GET_FINAL_PRODUCTS + "$id" : GET_FINAL_PRODUCTS + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _finalProducts.add(FinalProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } +} diff --git a/lib/core/service/weather_service.dart b/lib/core/service/weather_service.dart index b2dcf0ef..10ab1adf 100644 --- a/lib/core/service/weather_service.dart +++ b/lib/core/service/weather_service.dart @@ -21,17 +21,16 @@ class WeatherService extends BaseService { 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]); + 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/appointment_rate_view_model.dart b/lib/core/viewModels/appointment_rate_view_model.dart index 23d00366..e1bdfc9e 100644 --- a/lib/core/viewModels/appointment_rate_view_model.dart +++ b/lib/core/viewModels/appointment_rate_view_model.dart @@ -40,7 +40,7 @@ class AppointmentRateViewModel extends BaseViewModel { Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { - setState(ViewState.BusyLocal); + setState(ViewState.Busy); await _appointmentRateService.sendAppointmentRate( rate, appointmentNo, projectID, doctorID, clinicID, note); if (_appointmentRateService.hasError) { diff --git a/lib/core/viewModels/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 e98ca341..e085e476 100644 --- a/lib/core/viewModels/dashboard_view_model.dart +++ b/lib/core/viewModels/dashboard_view_model.dart @@ -1,7 +1,9 @@ +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 { @@ -10,7 +12,7 @@ class DashboardViewModel extends BaseViewModel { String get weightKg => _vitalSignService.weightKg; String get heightCm => _vitalSignService.heightCm; - String bloadType = ""; + String booldType = "-"; // ToDoCountProviderModel toDoProvider = // Provider.of(AppGlobal.context); @@ -21,10 +23,11 @@ class DashboardViewModel extends BaseViewModel { await _vitalSignService.getPatientRadOrders(); if (_vitalSignService.hasError) { error = _vitalSignService.error; - setState(ViewState.Error); - } else + setState(ViewState.ErrorLocal); + } else { + booldType = await sharedPref.getString(BLOOD_TYPE) ?? "-"; setState(ViewState.Idle); - // getToDoCount(); + } } } 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 f9e549a4..e38a8a73 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_monthly_view_model.dart b/lib/core/viewModels/medical/reports_monthly_view_model.dart index 3ae196f5..adb7223e 100644 --- a/lib/core/viewModels/medical/reports_monthly_view_model.dart +++ b/lib/core/viewModels/medical/reports_monthly_view_model.dart @@ -13,11 +13,9 @@ class ReportsMonthlyViewModel extends BaseViewModel { ReportsService _reportsService = locator(); - - String get userAgreementContent => _reportsService.userAgreementContent; - getUserTermsAndConditions() async{ + getUserTermsAndConditions() async { setState(ViewState.Busy); await _reportsService.getUserTermsAndConditions(); if (_reportsService.hasError) { @@ -28,19 +26,33 @@ class ReportsMonthlyViewModel extends BaseViewModel { } } - updatePatientHealthSummaryReport({String message, bool isSummary})async{ + updatePatientHealthSummaryReport( + {String message, + bool isSummary, + bool isUpdateEmail = false, + String email}) async { setState(ViewState.BusyLocal); - await _reportsService.updatePatientHealthSummaryReport(isSummary: isSummary); + await _reportsService.updatePatientHealthSummaryReport( + isSummary: isSummary); if (_reportsService.hasError) { error = _reportsService.error; AppToast.showErrorToast(message: error); setState(ViewState.ErrorLocal); } else { - AppToast.showSuccessToast(message: message); - setState(ViewState.Idle); + if (isUpdateEmail) { + await _reportsService.updateEmail(email: email); + if (_reportsService.hasError) { + error = _reportsService.error; + AppToast.showErrorToast(message: error); + setState(ViewState.ErrorLocal); + } else { + AppToast.showSuccessToast(message: message); + setState(ViewState.Idle); + } + } else { + AppToast.showSuccessToast(message: message); + setState(ViewState.Idle); + } } } - - - } diff --git a/lib/core/viewModels/medical/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/offers_Categorise_view_model.dart b/lib/core/viewModels/offers_Categorise_view_model.dart new file mode 100644 index 00000000..b63dd553 --- /dev/null +++ b/lib/core/viewModels/offers_Categorise_view_model.dart @@ -0,0 +1,48 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offer_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offers_model.dart'; +import 'package:diplomaticquarterapp/core/service/offers_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +import 'base_view_model.dart'; + +class OffersCategoriseViewModel extends BaseViewModel { + bool hasError = false; + + OffersCategoriseService _offersCategoriseService = + locator(); + List get categorise => _offersCategoriseService.offersList; + + List get products => + _offersCategoriseService.offersProducts; + + Future getOffersCategorise() async { + hasError = false; + _offersCategoriseService.clearCategorise(); + setState(ViewState.Busy); + await _offersCategoriseService.getOffersCategorise(); + if (_offersCategoriseService.hasError) { + error = _offersCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + await getOffersProducts(); + } + + Future getOffersProducts({String i}) async { + hasError = false; + + setState(ViewState.Busy); + await _offersCategoriseService.getOffersProducts(id: i); + if (_offersCategoriseService.hasError) { + error = _offersCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} +// await _offersCategoriseService.getOffersProducts(); +// if (_offersCategoriseService.hasError) { +// error = _offersCategoriseService.error; +// setState(ViewState.ErrorLocal); +// } else +// 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/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index 00f4819b..06295188 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -1,3 +1,11 @@ +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/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShippingOption.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; import '../../../locator.dart'; @@ -5,4 +13,183 @@ import '../base_view_model.dart'; class OrderPreviewViewModel extends BaseViewModel { OrderPreviewService _orderService = locator(); + + List get addresses => _orderService.addresses; + LacumAccountInformation get lacumInformation => + _orderService.lacumInformation; + ShoppingCartResponse cartResponse = ShoppingCartResponse(); + PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); + double totalAdditionalShippingCharge = 0; + + Future getOrderPreviewData() async { + setState(ViewState.Busy); + await _orderService.getAddresses(); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + getShoppingCart(); + } + } + + getShoppingCart() async { + setState(ViewState.Busy); + await _orderService.getShoppingCart().then((res) { + _handleGetShoppingCartResponse(res); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + if (paymentCheckoutData != null) { + paymentCheckoutData.cartDataVisible = true; + } + setState(ViewState.Idle); + } + } + + changeProductQuantity(ShoppingCart product) async { + setState(ViewState.Busy); + await _orderService.changeProductQuantity(product.id, product).then((res) { + _handleGetShoppingCartResponse(res); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + deleteProduct(ShoppingCart product) async { + setState(ViewState.Busy); + await _orderService.deleteProduct(product.id).then((res) { + _handleGetShoppingCartResponse(res); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + deleteShoppingCart() async { + setState(ViewState.Busy); + await _orderService.deleteShoppingCart().then((res) { + _handleGetShoppingCartResponse(res); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + _handleGetShoppingCartResponse(Map res) { + totalAdditionalShippingCharge = 0; + if (res == null) { + error = "response is null"; + setState(ViewState.Error); + return; + } + print(res); + cartResponse.itemCount = res["item_count"]; + cartResponse.quantityCount = res["quantity_count"]; + cartResponse.subtotal = res["subtotal"]; + cartResponse.subtotalWithVat = res["subtotal_with_vat"]; + cartResponse.subtotalVatAmount = res["subtotal_vat_amount"]; + cartResponse.subtotalVatRate = res["subtotal_vat_rate"]; + cartResponse.shoppingCarts = List(); + res["shopping_carts"].forEach((item) { + ShoppingCart shoppingCart = ShoppingCart.fromJson(item); + cartResponse.shoppingCarts.add(shoppingCart); + totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge; + }); + cartResponse.updateShoppingCard(); + } + + String getPaymentOptionImage(PaymentOption paymentOption) { + String assetFile = "assets/images/pharmacy_module/payment/"; + switch (paymentOption.index) { + case 0: + return "${assetFile}mada.png"; + break; + case 1: + return "${assetFile}sadad.png"; + break; + case 2: + return "${assetFile}visa.png"; + break; + case 3: + return "${assetFile}mastercard.png"; + break; + case 4: + return "${assetFile}installment.png"; + break; + default: + return ""; + } + } + + String getPaymentOptionName(PaymentOption paymentOption) { + return _orderService.getPaymentOptionName(paymentOption); + } + + getInformationsByAddress() async { + await getLacumAccountInformation(); + await getShippingOption(); + } + + getLacumAccountInformation() async { + setState(ViewState.Busy); + await _orderService.getLacumAccountInformation(); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + getLacumGroupData(); + } + } + + Future getLacumGroupData() async { + setState(ViewState.Busy); + await _orderService.getLacumGroupInformation(); + paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation; + paymentCheckoutData.usedLakumPoints = paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + getShippingOption() async { + setState(ViewState.Busy); + await _orderService.getShippingOption(paymentCheckoutData.address).then((res) { + paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); + paymentCheckoutData.updateData(); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future makeOrder() async { + setState(ViewState.Busy); + await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } } + +enum PaymentOption { meda, sadad, visa, mastercard, installments } diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart new file mode 100644 index 00000000..485c92fb --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -0,0 +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 addresses => _pharmacyAddressService.addresses; + + int get selectedAddressIndex => _pharmacyAddressService.selectedAddressIndex; + + CountryData get country => _pharmacyAddressService.country; + + setSelectedAddressIndex(int index) { + _pharmacyAddressService.selectedAddressIndex = index; + } + + Future getAddressesList() async { + setState(ViewState.Busy); + await _pharmacyAddressService.getAddresses(); + if (_pharmacyAddressService.hasError) { + error = _pharmacyAddressService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + +/* 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 new file mode 100644 index 00000000..c981b2b3 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/brand_view_model.dart @@ -0,0 +1,57 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/brandModel.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/topBrandsModel.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/brands_service.dart'; + + +import '../../../locator.dart'; + +class BrandsViewModel extends BaseViewModel{ + BrandsService _brandsService = locator(); + List get brandsListList => _brandsService.brandsList; + + BrandsService _topBrandsService = locator(); + List get topBrandsListList => _topBrandsService.topBrandsList; + + List get searchList => + _brandsService.searchList; + + bool hasError = false; + + + Future getBrandsData() async { + hasError = false; + setState(ViewState.Busy); + await _brandsService.getBrands(); + if (_brandsService.hasError) { + error = _brandsService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getTopBrandsData() async { + hasError = false; + setState(ViewState.Busy); + await _topBrandsService.getTopBrands(); + if (_topBrandsService.hasError) { + error = _topBrandsService.error; + setState(ViewState.ErrorLocal); + } 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/lacum-registration-viewModel.dart b/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart new file mode 100644 index 00000000..f8f5ea05 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart @@ -0,0 +1,55 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-registration-service.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-transfer-service.dart'; + +import '../../../locator.dart'; +import 'lacum-viewmodel.dart'; + +class LacumRegistrationViewModel extends LacumViewModel { + LacumRegistrationService _lacumService = locator(); + + ListUserAgreement get listUserAgreement => _lacumService.listUserAgreement; + + Future checkLacumAccountActivation(String patientIdentificationNo) async { + setState(ViewState.Busy); + await _lacumService.getLacumAccountInformationById(patientIdentificationNo); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + if(_lacumService.lacumInformation.yahalaAccountNo != 0){ + error = "The account has already been activated"; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } + + Future getUserTermsAndConditionsForEPharmcy() async { + setState(ViewState.Busy); + await _lacumService.getUserTermsAndConditionsForEPharmcy(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future createNewLakumAccount(String name, String phone, String identificationNo, int languageId) async { + setState(ViewState.Busy); + await _lacumService.createLakumAccount(name, phone, 0, identificationNo, languageId); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + return 404; + } else { + setState(ViewState.Idle); + return 200; + } + } + +} diff --git a/lib/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart b/lib/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart new file mode 100644 index 00000000..cd19a40f --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart @@ -0,0 +1,42 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-transfer-service.dart'; + +import '../../../locator.dart'; +import 'lacum-viewmodel.dart'; + +class LacumTranferViewModel extends LacumViewModel { + LacumTransferService _lacumService = locator(); + + LacumAccountInformation get lacumReceiverInformation => + _lacumService.lacumReceiverInformation; + + Future getLacumGroupDataBuAccountId(String accountId) async { + setState(ViewState.Busy); + await _lacumService.getLacumGroupDataBuAccountId(accountId); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future transferYaHalaLoyaltyPoints(String points) async { + setState(ViewState.Busy); + await _lacumService.transferYaHalaLoyaltyPoints(points); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + return 404; + } else { + setState(ViewState.Idle); + return 200; + } + } + + setLakumData(LacumAccountInformation lacumInformation, LacumAccountInformation lacumGroupInformation){ + _lacumService.lacumInformation = lacumInformation; + _lacumService.lacumGroupInformation = lacumGroupInformation; + } +} diff --git a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart new file mode 100644 index 00000000..ba8d70d9 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart @@ -0,0 +1,111 @@ +import 'dart:typed_data'; + +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-service.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'dart:async'; +import 'dart:convert' as convert; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class LacumViewModel extends BaseViewModel { + LacumService _lacumService = locator(); + + LacumAccountInformation get lacumInformation => + _lacumService.lacumInformation; + + LacumAccountInformation get lacumGroupInformation => + _lacumService.lacumGroupInformation; + + Future getLacumData() async { + await getLacumAccountData(); + getLacumGroupData(); + } + + Future getLacumAccountData() async { + setState(ViewState.Busy); + await _lacumService.getLacumAccountInformation(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getLacumGroupData() async { + setState(ViewState.Busy); + await _lacumService.getLacumGroupInformation(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future makeAccountActivate() async { + setState(ViewState.Busy); + await _lacumService.makeAccountActivate(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus = "Active"; + getLacumAccountData(); + } + } + + Future makeAccountDeactivate() async { + setState(ViewState.Busy); + await _lacumService.makeAccountDeactivate(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus = "Cancelled"; + getLacumAccountData(); + } + } + + Future createLakumAccount(String name, String phone) async { + setState(ViewState.Busy); + await _lacumService.createLakumAccount(name, phone, lacumInformation.yahalaAccountNo, lacumInformation.identificationNo, null); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + return 404; + } else { + setState(ViewState.Idle); + return 200; + } + } + + String formatCreatedDateToString() { + DateTime createdDate = DateUtil.convertStringToDate( + lacumGroupInformation.lakumInquiryInformationObjVersion.createdDate); + return DateUtil.getFormattedDate(createdDate, "MMM dd,yyyy"); + } + + Uint8List convertBase64ToBarCodeImage() { + try { + final _byteImage = convert.base64Decode( + lacumGroupInformation.lakumInquiryInformationObjVersion.barCode); + return _byteImage; + } catch (e) { + print(e); + return null; + } + } + + setLakumData(LacumAccountInformation lacumInformation, LacumAccountInformation lacumGroupInformation){ + _lacumService.lacumInformation = lacumInformation; + _lacumService.lacumGroupInformation = lacumGroupInformation; + } + + clearLakumGroupData(){ + _lacumService.lacumGroupInformation = null; + } +} diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart new file mode 100644 index 00000000..b7ddb528 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -0,0 +1,127 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:flutter/material.dart'; +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class OrderModelViewModel extends BaseViewModel { + OrderService _orderService = locator(); + + List get order => _orderService.orderList; + + OrderDetailsService _orderDetailsService = locator(); + + List get orderDetails => _orderDetailsService.orderDetails; + + CancelOrderService _cancelOrderService = locator(); + + List get cancelOrder => _cancelOrderService.cancelOrderList; + + + OrderPreviewService _orderServices = locator(); + List get addresses => _orderServices.addresses; + LacumAccountInformation get lacumInformation => + _orderServices.lacumInformation; + ShoppingCartResponse cartResponse = ShoppingCartResponse(); + PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); + double totalAdditionalShippingCharge = 0; + + + + Future getOrder(customerId, pageID) async { + print("this is customer id" + customerId); + setState(ViewState.Busy); + await _orderService.getOrder(customerId, pageID); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + //order = _orderService.orderList; + setState(ViewState.Idle); + } + } + + Future getOrderDetails(orderId) async { + setState(ViewState.Busy); + await _orderDetailsService.getOrderDetails(orderId); + if (_orderDetailsService.hasError) { + error = _orderDetailsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getProductReview() async { + setState(ViewState.Busy); + // await _orderService.getProductReview(); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + //order = _orderService.orderList; + setState(ViewState.Idle); + } + } + + Future getCanceledOrder(order, context) async { + print("this is order id" + order); + setState(ViewState.Busy); + dynamic res; + await _cancelOrderService.getCanceledOrder(order).then((value) { + res = value['success']['SuccessEndUserMsg']; + print(value['success']['SuccessEndUserMsg']); + AppToast.showSuccessToast(message: "Request Sent Successfully"); +// Navigator.pop(context); + }); + if (_cancelOrderService.hasError) { + error = _cancelOrderService.error; + setState(ViewState.Error); + AppToast.showErrorToast(message: error); + } else { + setState(ViewState.Idle); +// AppToast.showSuccessToast(message: "Request Sent Successfully"); +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => OrderPage())); + + } + + return res; + } + + Future makeReview(Product product, double rating, String reviewText) async { + setState(ViewState.Busy); + await _orderDetailsService.makeReview(product, rating, reviewText); + if (_orderDetailsService.hasError) { + error = _orderDetailsService.error; + setState(ViewState.Error); + AppToast.showErrorToast(message: error); + } else { + setState(ViewState.Idle); + AppToast.showSuccessToast( + message: "Your review has been Submitted successfully"); + } + } + Future makeOrder() async { + setState(ViewState.Busy); + await _orderServices.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); + if (_orderServices.hasError) { + error = _orderServices.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + +} diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index f8c574f7..4dfc6a26 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; @@ -21,6 +22,25 @@ class PharmacyModuleViewModel extends BaseViewModel { _pharmacyService.lastVisitedProducts; Future getPharmacyHomeData() async { + setState(ViewState.Busy); + var data = await sharedPref.getObject(USER_PROFILE); + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + if (authenticatedUserObject.isLogin && data != null && customerId == null) { + await _pharmacyService.makeVerifyCustomer(data); + // here must call getShoppingCard() + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.Error); + } else { + await getBannerList(); + } + } else { + await getBannerList(); + } + } + + Future getBannerList() async { setState(ViewState.Busy); await _pharmacyService.getBannerListList(); if (_pharmacyService.hasError) { @@ -47,6 +67,7 @@ class PharmacyModuleViewModel extends BaseViewModel { error = _pharmacyService.error; setState(ViewState.Error); } else { + setState(ViewState.Idle); _getBestSellerProducts(); } } @@ -70,4 +91,18 @@ class PharmacyModuleViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future checkUserIsActivated() async { + if (authenticatedUserObject.isLogin) { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + return true; + } else { + return false; + } + } else { + // go to login page + return false; + } + } } diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart new file mode 100644 index 00000000..47a3bb11 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -0,0 +1,110 @@ +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 => _productLocationService.productLocationList; + + List get wishListItems => _productWishlistService.wishListProducts; + + List get productSpecification => _productSpecification.productSpecification; + + bool hasError = false; + + + Future getProductReviewsData(productID) async { + print('ENAD REview'); + hasError = false; + setState(ViewState.Busy); + await _productDetailService.getProductReviews(productID); + if (_productDetailService.hasError) { + error = _productDetailService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getProductLocationData() async { + print('ENAD in model view'); + hasError = false; + setState(ViewState.Busy); + 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/pharmacyModule/review_view_model.dart b/lib/core/viewModels/pharmacyModule/review_view_model.dart new file mode 100644 index 00000000..3661820b --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/review_view_model.dart @@ -0,0 +1,26 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/reviewModel.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/review_service.dart'; + +import '../../../locator.dart'; + +class ReviewViewModel extends BaseViewModel{ + ReviewService _reviewService = locator(); + + List get reviewListList => _reviewService.reviewList; + + bool hasError = false; + + + Future getReviewData() async { + hasError = false; + setState(ViewState.Busy); + await _reviewService.getReview(); + if (_reviewService.hasError) { + error = _reviewService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart b/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart new file mode 100644 index 00000000..6a5bd476 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart @@ -0,0 +1,24 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/terms-condition-service.dart'; +import 'dart:async'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class TermsConditionViewModel extends BaseViewModel { + TermsConditionService _termsConditionService = locator(); + + ListUserAgreement get listUserAgreement => _termsConditionService.listUserAgreement; + + Future getUserTermsAndConditionsForEPharmcy() async { + setState(ViewState.Busy); + await _termsConditionService.getUserTermsAndConditionsForEPharmcy(); + if (_termsConditionService.hasError) { + error = _termsConditionService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } +} diff --git a/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart b/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart new file mode 100644 index 00000000..788b7f3c --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart @@ -0,0 +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/services/pharmacy_services/wishList_service.dart'; + +import '../../../locator.dart'; + +class WishListViewModel extends BaseViewModel{ + WishListService _wishlistService = locator(); + + List get wishListList => _wishlistService.wishListProducts; + bool hasError = false; + + +// Future getWishlistData() async { +// setState(ViewState.Busy); +// await _wishlistService.getWishlist(); +// if (_wishlistService.hasError) { +// error = _wishlistService.error; +// setState(ViewState.Error); +// } else { +// setState(ViewState.Idle); +// } +// } + + Future getWishlistData() async { + hasError = false; + setState(ViewState.Busy); + await _wishlistService.getWishlist(); + if (_wishlistService.hasError) { + error = _wishlistService.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 new file mode 100644 index 00000000..5e1f4f9f --- /dev/null +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -0,0 +1,158 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/scan_qr_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/sub_categories_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/sub_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/search_products_model.dart'; + +import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +import 'base_view_model.dart'; + +class PharmacyCategoriseViewModel extends BaseViewModel { + bool hasError = false; + PharmacyCategoriseService _pharmacyCategoriseService = + locator(); + + List get categorise => + _pharmacyCategoriseService.categoriseList; + + List get categoriseParent => + _pharmacyCategoriseService.parentCategoriseList; + + List get parentProducts => + _pharmacyCategoriseService.parentProductsList; + + List get subCategorise => + _pharmacyCategoriseService.subCategoriseList; + + List get subProducts => + _pharmacyCategoriseService.subProductsList; + + List get finalProducts => + _pharmacyCategoriseService.finalProducts; + List get brandsList => _pharmacyCategoriseService.brandsList; + + List get searchList => + _pharmacyCategoriseService.searchList; + + List get scanList => _pharmacyCategoriseService.scanList; + + Future getCategorise() async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getCategorise(); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getBrands() async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getBrands(); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future scanQr({String id}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.scanQr(id: id); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + clearSearchList() { + _pharmacyCategoriseService.clearSearchList(); + } + + Future searchProducts({String productName}) async { + hasError = false; + _pharmacyCategoriseService.clearSearchList(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.searchProducts(productName: productName); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getCategoriseParent({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getCategoriseParent(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + await getParentProducts(i: i); + await getBrands(); + } + + Future getParentProducts({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getParentProducts(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getSubCategorise({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getSubCategorise(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + getSubProducts(i: i); + } + + Future getSubProducts({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getSubProducts(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getFinalProducts({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getFinalProducts(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 700ab2a4..baaf6b5b 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -6,11 +6,17 @@ 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'; @@ -60,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(); 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 68557d01..7830e395 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,6 +1,5 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/service/qr_service.dart'; -import 'package:diplomaticquarterapp/core/service/weather_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; @@ -9,7 +8,14 @@ import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model. // import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; // import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; // import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/review_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/wishList_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +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'; @@ -31,6 +37,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'; @@ -48,12 +55,20 @@ 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'; +import 'core/service/offers_service.dart'; +import 'core/service/pharmacy_categorise_service.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; import 'core/viewModels/blooddonation/blood_details_view_model.dart'; @@ -86,20 +101,43 @@ import 'core/viewModels/medical/vital_sign_view_model.dart'; 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'; import 'core/viewModels/insurance_card_View_model.dart'; +import 'core/viewModels/pharmacyModule/brand_view_model.dart'; +import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'core/viewModels/pharmacyModule/review_view_model.dart'; +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'; +import 'core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; +import 'core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart'; +import 'core/viewModels/pharmacyModule/lacum-viewmodel.dart'; import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'core/viewModels/pharmacyModule/tems-condition-viewmodel.dart'; +import 'core/viewModels/pharmacy_categorise_view_model.dart'; import 'core/viewModels/qr_view_model.dart'; import 'core/viewModels/vaccine_view_model.dart'; import 'core/service/vaccine_service.dart'; +import 'services/pharmacy_services/orderDetails_service.dart'; +import 'services/pharmacy_services/pharmacyAddress_service.dart'; GetIt locator = GetIt.instance; ///di void setupLocator() { + /// Others + locator.registerLazySingleton(() => FlutterLocalNotificationsPlugin()); + /// Services locator.registerLazySingleton(() => AuthenticatedUserObject()); locator.registerLazySingleton(() => HospitalService()); @@ -124,6 +162,7 @@ void setupLocator() { locator.registerLazySingleton(() => EReferralService()); locator.registerLazySingleton(() => HomeHealthCareService()); locator.registerLazySingleton(() => CMCService()); + locator.registerLazySingleton(() => PatientSickLeaveService()); locator.registerLazySingleton(() => MyBalanceService()); locator.registerLazySingleton(() => BloodSugarService()); @@ -136,25 +175,43 @@ void setupLocator() { locator.registerLazySingleton(() => FindusService()); locator.registerLazySingleton(() => LiveChatService()); locator.registerLazySingleton(() => H2OService()); + locator.registerLazySingleton(() => BloodDonationService()); locator.registerLazySingleton(() => BloodDetailsService()); locator.registerLazySingleton(() => ChildVaccinesService()); locator.registerLazySingleton(() => UserInformationService()); locator.registerLazySingleton(() => CreteNewBabyService()); locator.registerLazySingleton(() => DeleteBabyService()); + locator.registerLazySingleton(() => VaccinationTableService()); //pharmacy // locator.registerLazySingleton(() => PharmacyCategoriseService()); // locator.registerLazySingleton(() => OffersCategoriseService()); + locator.registerLazySingleton(() => PharmacyCategoriseService()); + locator.registerLazySingleton(() => OffersCategoriseService()); locator.registerLazySingleton(() => NotificationService()); - locator.registerLazySingleton(() => WeatherService()); locator.registerLazySingleton(() => PharmacyModuleService()); + locator.registerLazySingleton(() => WishListService()); + locator.registerLazySingleton(() => ReviewService()); + locator.registerLazySingleton(() => BrandsService()); + locator.registerLazySingleton(() => ProductDetailService()); + locator.registerLazySingleton(() => OrderPreviewService()); + locator.registerLazySingleton(() => LacumService()); + locator.registerLazySingleton(() => LacumTransferService()); + locator.registerLazySingleton(() => LacumRegistrationService()); + locator.registerLazySingleton(() => OrderService()); + locator.registerLazySingleton(() => PharmacyAddressService()); + locator.registerLazySingleton(() => OrderDetailsService()); locator.registerLazySingleton(() => CustomerAddressesService()); // locator.registerLazySingleton(() => TermsConditionService()); locator.registerLazySingleton(() => PrivilegeService()); + locator.registerLazySingleton(() => TermsConditionService()); + locator.registerLazySingleton(() => CancelOrderService()); + locator.registerLazySingleton(() => PrivilegeService()); + locator.registerLazySingleton(() => WeatherService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -174,7 +231,6 @@ void setupLocator() { locator.registerFactory(() => QrViewModel()); locator.registerFactory(() => ReportsMonthlyViewModel()); locator.registerFactory(() => NearHospitalViewModel()); - locator.registerFactory(() => WeatherViewModel()); locator.registerFactory(() => AmRequestViewModel()); locator.registerFactory(() => PatientSickLeaveViewMode()); locator.registerFactory(() => MyBalanceViewModel()); @@ -186,6 +242,10 @@ void setupLocator() { locator.registerFactory(() => ChildVaccinesViewModel()); locator.registerFactory(() => UserInformationViewModel()); locator.registerFactory(() => VaccinationTableViewModel()); + locator.registerFactory(() => OrderModelViewModel()); + locator.registerFactory(() => PharmacyAddressesViewModel()); + locator.registerFactory(() => TermsConditionViewModel()); + locator.registerFactory(() => AddNewChildViewModel()); locator.registerFactory(() => H2OViewModel()); locator.registerFactory(() => BloodSugarViewMode()); @@ -201,9 +261,35 @@ void setupLocator() { locator.registerFactory(() => NotificationViewModel()); locator.registerFactory(() => PharmacyModuleViewModel()); + locator.registerFactory(() => WishListViewModel()); + locator.registerFactory(() => ReviewViewModel()); + locator.registerFactory(() => BrandsViewModel()); + locator.registerFactory(() => ProductDetailViewModel()); + locator.registerFactory(() => WeatherViewModel()); + locator.registerFactory(() => OrderPreviewViewModel()); + locator.registerFactory(() => LacumViewModel()); + locator.registerFactory(() => LacumTranferViewModel()); + locator.registerFactory(() => LacumRegistrationViewModel()); + + //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 //pharmacy // locator.registerFactory(() => PharmacyCategoriseViewModel()); // locator.registerFactory(() => OffersCategoriseViewModel()); + // Geofencing + // --------------------- + locator.registerLazySingleton( + () => GeofencingServices()); // Geofencing Services } diff --git a/lib/main.dart b/lib/main.dart index 218fbf07..e0444a32 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, @@ -90,13 +100,14 @@ class MyApp extends StatelessWidget { backgroundColor: Color.fromRGBO(255, 255, 255, 1), highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Colors.grey, - bottomSheetTheme: BottomSheetThemeData( - backgroundColor: HexColor('#E0E0E0')), + primaryColor: Color(0xff515A5D), + toggleableActiveColor: secondaryColor, + indicatorColor: secondaryColor, + bottomSheetTheme: BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), cursorColor: Colors.grey, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( - color: Colors.grey[700], + color: Color(0xff515A5D), brightness: Brightness.light, elevation: 0.0, actionsIconTheme: IconThemeData( diff --git a/lib/models/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/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/Authentication/check_activation_code_response.dart b/lib/models/Authentication/check_activation_code_response.dart index 55ba6559..3a0aed65 100644 --- a/lib/models/Authentication/check_activation_code_response.dart +++ b/lib/models/Authentication/check_activation_code_response.dart @@ -270,7 +270,7 @@ class CheckActivationCode { } } -class Lists { +class List { String setupID; int patientType; int patientID; @@ -330,7 +330,7 @@ class Lists { dynamic tempAddress; dynamic zipCode; - Lists({ + List({ this.setupID, this.patientType, this.patientID, @@ -391,7 +391,7 @@ class Lists { this.zipCode, }); - Lists.fromJson(Map json) { + List.fromJson(Map json) { setupID = json['SetupID']; patientType = json['PatientType']; patientID = json['PatientID']; 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/id-name-pair.dart b/lib/models/id-name-pair.dart new file mode 100644 index 00000000..00336572 --- /dev/null +++ b/lib/models/id-name-pair.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class IdNamePair with ChangeNotifier{ + var id; + var name; + + IdNamePair(this.id, this.name); + + void updateData() { + notifyListeners(); + } +} \ No newline at end of file diff --git a/lib/models/pharmacy/Wishlist.dart b/lib/models/pharmacy/Wishlist.dart new file mode 100644 index 00000000..41704ede --- /dev/null +++ b/lib/models/pharmacy/Wishlist.dart @@ -0,0 +1,881 @@ +// To parse this JSON data, do +// +// final wishlist = wishlistFromJson(jsonString); + +import 'dart:convert'; + +List wishlistFromJson(String str) => List.from(json.decode(str).map((x) => Wishlist.fromJson(x))); + +String wishlistToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class Wishlist { + Wishlist({ + 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, + }); + + dynamic languageId; + dynamic id; + List productAttributes; + dynamic customerEnteredPrice; + dynamic quantity; + dynamic discountAmountInclTax; + dynamic subtotal; + dynamic subtotalWithVat; + dynamic subtotalVatAmount; + dynamic subtotalVatRate; + dynamic currency; + dynamic currencyn; + dynamic rentalStartDateUtc; + dynamic rentalEndDateUtc; + dynamic createdOnUtc; + dynamic updatedOnUtc; + dynamic shoppingCartType; + dynamic productId; + dynamic product; + dynamic customerId; + Customer customer; + + factory Wishlist.fromJson(Map json) => Wishlist( + 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; + dynamic 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; + dynamic 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 { RIYADH, AL_OYUN } + +final cityValues = EnumValues({ + "Al Oyun": City.AL_OYUN, + "Riyadh": City.RIYADH +}); + +enum Country { SAUDI_ARABIA } + +final countryValues = EnumValues({ + "Saudi Arabia": Country.SAUDI_ARABIA +}); + +enum Email { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM } + +final emailValues = EnumValues({ + "Tamer.dasdasdas@gmail.com": Email.TAMER_DASDASDAS_GMAIL_COM, + "Tamer.fanasheh@gmail.com": Email.TAMER_FANASHEH_GMAIL_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; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic 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; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + double price; + dynamic oldPrice; + double productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic 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"], + metaDescription: json["meta_description"], + metaTitle: 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, + "meta_description": metaDescription, + "meta_title": 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, + }); + + dynamic id; + dynamic 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, + }); + + dynamic 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, + }); + + dynamic id; + dynamic 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/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 new file mode 100644 index 00000000..2855d492 --- /dev/null +++ b/lib/models/pharmacy/brandModel.dart @@ -0,0 +1,137 @@ +// To parse this JSON data, do +// +// final brand = brandFromJson(jsonString); + +import 'dart:convert'; + +List brandFromJson(String str) => List.from(json.decode(str).map((x) => Brand.fromJson(x))); + +String brandToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class Brand { + Brand({ + this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.manufacturerTemplateId, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.pageSize, + this.pageSizeOptions, + this.priceRanges, + this.published, + this.deleted, + this.displayOrder, + this.createdOnUtc, + this.updatedOnUtc, + this.image, + }); + + String id; + String name; + String namen; + List localizedNames; + String description; + int manufacturerTemplateId; + String metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + int pageSize; + String pageSizeOptions; + dynamic priceRanges; + bool published; + bool deleted; + int displayOrder; + DateTime createdOnUtc; + DateTime updatedOnUtc; + Image image; + + factory Brand.fromJson(Map json) => Brand( + id: json["id"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + description: json["description"] == null ? null : json["description"], + manufacturerTemplateId: json["manufacturer_template_id"], + metaKeywords: json["meta_keywords"], + metaDescription: json["meta_description"], + metaTitle: json["meta_title"], + pageSize: json["page_size"], + pageSizeOptions: json["page_size_options"], + priceRanges: json["price_ranges"], + published: json["published"], + deleted: json["deleted"], + displayOrder: json["display_order"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + image: json["image"] == null ? null : Image.fromJson(json["image"]), + ); + + Map toJson() => { + "id": id, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "description": description == null ? null : description, + "manufacturer_template_id": manufacturerTemplateId, + "meta_keywords": metaKeywords, + "meta_description": metaDescription, + "meta_title": metaTitle, + "page_size": pageSize, + "page_size_options": pageSizeOptions, + "price_ranges": priceRanges, + "published": published, + "deleted": deleted, + "display_order": displayOrder, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "image": image == null ? null : image.toJson(), + }; +} + +class Image { + Image({ + this.src, + this.thumb, + this.attachment, + }); + + String src; + dynamic thumb; + dynamic attachment; + + factory Image.fromJson(Map json) => Image( + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "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, + }; +} diff --git a/lib/models/pharmacy/locationModel.dart b/lib/models/pharmacy/locationModel.dart new file mode 100644 index 00000000..36ee7350 --- /dev/null +++ b/lib/models/pharmacy/locationModel.dart @@ -0,0 +1,159 @@ +// To parse this JSON data, do +// +// final locationModel = locationModelFromJson(jsonString); + +import 'dart:convert'; + +List locationModelFromJson(String str) => List.from(json.decode(str).map((x) => LocationModel.fromJson(x))); + +String locationModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class LocationModel { + LocationModel({ + this.expiryDate, + this.sellingPrice, + this.quantity, + this.itemId, + this.locationId, + this.projectId, + this.setupId, + this.locationDescription, + this.locationDescriptionN, + this.itemDescription, + this.itemDescriptionN, + this.alias, + this.locationTypeId, + this.barcode, + this.companybarcode, + this.cityId, + this.cityName, + this.distanceInKilometers, + this.latitude, + this.locationType, + this.longitude, + this.phoneNumber, + this.projectImageUrl, + this.sortOrder, + }); + + ExpiryDate expiryDate; + double sellingPrice; + int quantity; + int itemId; + int locationId; + int projectId; + String setupId; + String locationDescription; + dynamic locationDescriptionN; + ItemDescription itemDescription; + dynamic itemDescriptionN; + Alias alias; + int locationTypeId; + int barcode; + dynamic companybarcode; + int cityId; + CityName cityName; + int distanceInKilometers; + String latitude; + int locationType; + String longitude; + String phoneNumber; + String projectImageUrl; + int sortOrder; + + factory LocationModel.fromJson(Map json) => LocationModel( + expiryDate: expiryDateValues.map[json["ExpiryDate"]], + sellingPrice: json["SellingPrice"].toDouble(), + quantity: json["Quantity"], + itemId: json["ItemID"], + locationId: json["LocationID"], + projectId: json["ProjectID"], + setupId: json["SetupID"], + locationDescription: json["LocationDescription"], + locationDescriptionN: json["LocationDescriptionN"], + itemDescription: itemDescriptionValues.map[json["ItemDescription"]], + itemDescriptionN: json["ItemDescriptionN"], + alias: aliasValues.map[json["Alias"]], + locationTypeId: json["LocationTypeID"], + barcode: json["Barcode"], + companybarcode: json["Companybarcode"], + cityId: json["CityID"], + cityName: cityNameValues.map[json["CityName"]], + distanceInKilometers: json["DistanceInKilometers"], + latitude: json["Latitude"], + locationType: json["LocationType"], + longitude: json["Longitude"], + phoneNumber: json["PhoneNumber"], + projectImageUrl: json["ProjectImageURL"], + sortOrder: json["SortOrder"], + ); + + Map toJson() => { + "ExpiryDate": expiryDateValues.reverse[expiryDate], + "SellingPrice": sellingPrice, + "Quantity": quantity, + "ItemID": itemId, + "LocationID": locationId, + "ProjectID": projectId, + "SetupID": setupId, + "LocationDescription": locationDescription, + "LocationDescriptionN": locationDescriptionN, + "ItemDescription": itemDescriptionValues.reverse[itemDescription], + "ItemDescriptionN": itemDescriptionN, + "Alias": aliasValues.reverse[alias], + "LocationTypeID": locationTypeId, + "Barcode": barcode, + "Companybarcode": companybarcode, + "CityID": cityId, + "CityName": cityNameValues.reverse[cityName], + "DistanceInKilometers": distanceInKilometers, + "Latitude": latitude, + "LocationType": locationType, + "Longitude": longitude, + "PhoneNumber": phoneNumber, + "ProjectImageURL": projectImageUrl, + "SortOrder": sortOrder, + }; +} + +enum Alias { CAPSULE } + +final aliasValues = EnumValues({ + "CAPSULE": Alias.CAPSULE +}); + +enum CityName { RIYADH, KHOBAR, QASSIM } + +final cityNameValues = EnumValues({ + "Khobar": CityName.KHOBAR, + "Qassim": CityName.QASSIM, + "Riyadh": CityName.RIYADH +}); + +enum ExpiryDate { DATE_16223220000000300, DATE_16250004000000300, DATE_16538580000000300 } + +final expiryDateValues = EnumValues({ + "/Date(1622322000000+0300)/": ExpiryDate.DATE_16223220000000300, + "/Date(1625000400000+0300)/": ExpiryDate.DATE_16250004000000300, + "/Date(1653858000000+0300)/": ExpiryDate.DATE_16538580000000300 +}); + +enum ItemDescription { XERACTAN_20_MG_CAP_30_S } + +final itemDescriptionValues = EnumValues({ + "XERACTAN 20 MG CAP 30'S": ItemDescription.XERACTAN_20_MG_CAP_30_S +}); + +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/productDetailModel.dart b/lib/models/pharmacy/productDetailModel.dart new file mode 100644 index 00000000..d2e8f010 --- /dev/null +++ b/lib/models/pharmacy/productDetailModel.dart @@ -0,0 +1,249 @@ +// To parse this JSON data, do +// +// final productDetail = productDetailFromJson(jsonString); + +import 'dart:convert'; + +List productDetailFromJson(String str) => List.from(json.decode(str).map((x) => ProductDetail.fromJson(x))); + +String productDetailToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class ProductDetail { + ProductDetail({ + this.reviews, + }); + + List reviews; + + factory ProductDetail.fromJson(Map json) => ProductDetail( + reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), + ); + + Map toJson() => { + "reviews": List.from(reviews.map((x) => x.toJson())), + }; +} + +class Review { + Review({ + this.id, + this.position, + this.reviewId, + this.customerId, + this.productId, + this.storeId, + this.isApproved, + this.title, + this.reviewText, + this.replyText, + this.rating, + this.helpfulYesTotal, + this.helpfulNoTotal, + this.createdOnUtc, + this.customer, + this.product, + }); + + int id; + int position; + int reviewId; + int customerId; + int productId; + int storeId; + bool isApproved; + String title; + String reviewText; + dynamic replyText; + int rating; + int helpfulYesTotal; + int helpfulNoTotal; + DateTime createdOnUtc; + Customer customer; + dynamic product; + + factory Review.fromJson(Map json) => Review( + id: json["id"], + position: json["position"], + reviewId: json["review_id"], + customerId: json["customer_id"], + productId: json["product_id"], + storeId: json["store_id"], + isApproved: json["is_approved"], + title: json["title"], + reviewText: json["review_text"], + replyText: json["reply_text"], + rating: json["rating"], + helpfulYesTotal: json["helpful_yes_total"], + helpfulNoTotal: json["helpful_no_total"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: Customer.fromJson(json["customer"]), + product: json["product"], + ); + + Map toJson() => { + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": title, + "review_text": reviewText, + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product, + }; +} + +class Customer { + Customer({ + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + this.billingAddress, + this.shippingAddress, + 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, + }); + + dynamic fileNumber; + dynamic iqamaNumber; + int isOutSa; + int patientType; + dynamic gender; + DateTime birthDate; + dynamic phone; + dynamic countryCode; + dynamic yahalaAccountno; + dynamic billingAddress; + dynamic shippingAddress; + String id; + Email username; + Email email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + dynamic isTaxExempt; + dynamic hasShoppingCartItems; + dynamic active; + dynamic deleted; + dynamic isSystemAccount; + dynamic systemName; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; + dynamic registeredInStoreId; + + factory Customer.fromJson(Map json) => Customer( + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + id: json["id"], + username: emailValues.map[json["username"]], + email: emailValues.map[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: json["created_on_utc"], + lastLoginDateUtc: json["last_login_date_utc"], + lastActivityDateUtc: json["last_activity_date_utc"], + registeredInStoreId: json["registered_in_store_id"], + ); + + Map toJson() => { + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "id": id, + "username": emailValues.reverse[username], + "email": emailValues.reverse[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, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + }; +} + +enum Email { STEVE_GATES_NOP_COMMERCE_COM } + +final emailValues = EnumValues({ + "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM +}); + +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/products.dart b/lib/models/pharmacy/products.dart new file mode 100644 index 00000000..b4833c64 --- /dev/null +++ b/lib/models/pharmacy/products.dart @@ -0,0 +1,835 @@ +// To parse this JSON data, do +// +// final products = productsFromJson(jsonString); + +import 'dart:convert'; + +Products productsFromJson(String str) => Products.fromJson(json.decode(str)); + +String productsToJson(Products data) => json.encode(data.toJson()); + +class Products { + Products({ + this.messageStatus, + this.products, + }); + + dynamic messageStatus; + List products; + + factory Products.fromJson(Map json) => Products( + messageStatus: json["MessageStatus"], + products: List.from(json["products"].map((x) => Product.fromJson(x))), + ); + + Map toJson() => { + "MessageStatus": messageStatus, + "products": List.from(products.map((x) => x.toJson())), + }; +} + +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; + String rxMessage; + String 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; + String discountName; + String discountNamen; + String discountDescription; + String discountDescriptionn; + String 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"] == null ? null : json["short_description"], + shortDescriptionn: json["short_descriptionn"] == null ? null : 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"] == null ? null : json["rx_message"], + rxMessagen: json["rx_messagen"] == null ? null : 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"] == null ? null : json["discount_name"], + discountNamen: json["discount_namen"] == null ? null : json["discount_namen"], + discountDescription: json["discount_description"] == null ? null : json["discount_description"], + discountDescriptionn: json["discount_Descriptionn"] == null ? null : json["discount_Descriptionn"], + discountPercentage: json["discount_percentage"] == null ? null : 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) => Review.fromJson(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 == null ? null : shortDescription, + "short_descriptionn": shortDescriptionn == null ? null : 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 == null ? null : rxMessage, + "rx_messagen": rxMessagen == null ? null : 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 == null ? null : discountName, + "discount_namen": discountNamen == null ? null : discountNamen, + "discount_description": discountDescription == null ? null : discountDescription, + "discount_Descriptionn": discountDescriptionn == null ? null : discountDescriptionn, + "discount_percentage": discountPercentage == null ? null : 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.toJson())), + "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 Review { + Review({ + this.id, + this.position, + this.reviewId, + this.customerId, + this.productId, + this.storeId, + this.isApproved, + this.title, + this.reviewText, + this.replyText, + this.rating, + this.helpfulYesTotal, + this.helpfulNoTotal, + this.createdOnUtc, + this.customer, + this.product, + }); + + int id; + int position; + int reviewId; + int customerId; + int productId; + int storeId; + bool isApproved; + String title; + String reviewText; + dynamic replyText; + int rating; + int helpfulYesTotal; + int helpfulNoTotal; + DateTime createdOnUtc; + Customer customer; + dynamic product; + + factory Review.fromJson(Map json) => Review( + id: json["id"], + position: json["position"], + reviewId: json["review_id"], + customerId: json["customer_id"], + productId: json["product_id"], + storeId: json["store_id"], + isApproved: json["is_approved"], + title: json["title"], + reviewText: json["review_text"], + replyText: json["reply_text"], + rating: json["rating"], + helpfulYesTotal: json["helpful_yes_total"], + helpfulNoTotal: json["helpful_no_total"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: Customer.fromJson(json["customer"]), + product: json["product"], + ); + + Map toJson() => { + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": title, + "review_text": reviewText, + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product, + }; +} + +class Customer { + Customer({ + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + 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, + }); + + dynamic fileNumber; + dynamic iqamaNumber; + int isOutSa; + int patientType; + dynamic gender; + DateTime birthDate; + dynamic phone; + dynamic countryCode; + dynamic yahalaAccountno; + dynamic billingAddress; + dynamic shippingAddress; + List addresses; + String id; + Username username; + Email email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + dynamic isTaxExempt; + dynamic hasShoppingCartItems; + dynamic active; + dynamic deleted; + dynamic isSystemAccount; + dynamic systemName; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory Customer.fromJson(Map json) => Customer( + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + addresses: List.from(json["addresses"].map((x) => x)), + id: json["id"], + username: usernameValues.map[json["username"]], + email: emailValues.map[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: json["created_on_utc"], + lastLoginDateUtc: json["last_login_date_utc"], + lastActivityDateUtc: json["last_activity_date_utc"], + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "addresses": List.from(addresses.map((x) => x)), + "id": id, + "username": usernameValues.reverse[username], + "email": emailValues.reverse[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, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +enum Email { MEMO17299_GMAIL_COM, STEVE_GATES_NOP_COMMERCE_COM } + +final emailValues = EnumValues({ + "Memo17299@gmail.com": Email.MEMO17299_GMAIL_COM, + "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM +}); + +enum Username { AMAL_26, STEVE_GATES_NOP_COMMERCE_COM } + +final usernameValues = EnumValues({ + "amal_26": Username.AMAL_26, + "steve_gates@nopCommerce.com": Username.STEVE_GATES_NOP_COMMERCE_COM +}); + +class Specification { + Specification({ + this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN, + }); + + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + Name name; + NameN nameN; + + factory Specification.fromJson(Map json) => Specification( + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: nameValues.map[json["name"]], + nameN: nameNValues.map[json["nameN"]], + ); + + Map toJson() => { + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": nameValues.reverse[name], + "nameN": nameNValues.reverse[nameN], + }; +} + +enum Name { PRIMARY_UNIT_OF_MEASURE, BRAND, MANUFACTURER_COUNTRY_NAME, STORAGE, COMPOSITION, SPF } + +final nameValues = EnumValues({ + "BRAND": Name.BRAND, + "COMPOSITION": Name.COMPOSITION, + "MANUFACTURER COUNTRY NAME": Name.MANUFACTURER_COUNTRY_NAME, + "Primary Unit Of Measure": Name.PRIMARY_UNIT_OF_MEASURE, + "SPF": Name.SPF, + "STORAGE": Name.STORAGE +}); + +enum NameN { EMPTY, NAME_N, PURPLE, FLUFFY, TENTACLED, SPF } + +final nameNValues = EnumValues({ + "وحدة القياس الأولية": NameN.EMPTY, + "تخزين": NameN.FLUFFY, + "علامة تجارية": NameN.NAME_N, + "اسم البلد المصنع": NameN.PURPLE, + "SPF": NameN.SPF, + "المكونات": NameN.TENTACLED +}); + +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/reviewModel.dart b/lib/models/pharmacy/reviewModel.dart new file mode 100644 index 00000000..da30212c --- /dev/null +++ b/lib/models/pharmacy/reviewModel.dart @@ -0,0 +1,803 @@ +// To parse this JSON data, do +// +// final review = reviewFromJson(jsonString); + +import 'dart:convert'; + +List reviewFromJson(String str) => List.from(json.decode(str).map((x) => Review.fromJson(x))); + +String reviewToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +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; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic 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; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic 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"], + metaDescription: json["meta_description"], + metaTitle: 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"], + oldPrice: json["old_price"], + productCost: json["product_cost"], + 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) => Review.fromJson(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, + "meta_description": metaDescription, + "meta_title": 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.toJson())), + "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 Review { + Review({ + this.id, + this.position, + this.reviewId, + this.customerId, + this.productId, + this.storeId, + this.isApproved, + this.title, + this.reviewText, + this.replyText, + this.rating, + this.helpfulYesTotal, + this.helpfulNoTotal, + this.createdOnUtc, + this.customer, + this.product, + }); + + dynamic id; + dynamic position; + dynamic reviewId; + dynamic customerId; + dynamic productId; + dynamic storeId; + bool isApproved; + String title; + ReviewText reviewText; + dynamic replyText; + dynamic rating; + dynamic helpfulYesTotal; + dynamic helpfulNoTotal; + DateTime createdOnUtc; + Customer customer; + Product product; + + factory Review.fromJson(Map json) => Review( + id: json["id"], + position: json["position"], + reviewId: json["review_id"], + customerId: json["customer_id"], + productId: json["product_id"], + storeId: json["store_id"], + isApproved: json["is_approved"], + title: json["title"], + reviewText: reviewTextValues.map[json["review_text"]], + replyText: json["reply_text"], + rating: json["rating"], + helpfulYesTotal: json["helpful_yes_total"], + helpfulNoTotal: json["helpful_no_total"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: Customer.fromJson(json["customer"]), + product: json["product"] == null ? null : Product.fromJson(json["product"]), + ); + + Map toJson() => { + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": title, + "review_text": reviewText, + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product == null ? null : product.toJson(), + }; +} + +class Image { + Image({ + this.id, + this.position, + this.src, + this.thumb, + this.attachment, + }); + + dynamic id; + dynamic 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, + }); + + dynamic 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, + }); + + dynamic id; + dynamic 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 Customer { + Customer({ + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + 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, + }); + + dynamic fileNumber; + dynamic iqamaNumber; + dynamic isOutSa; + dynamic patientType; + dynamic gender; + DateTime birthDate; + dynamic phone; + dynamic countryCode; + dynamic yahalaAccountno; + dynamic billingAddress; + dynamic shippingAddress; + List addresses; + String id; + Username username; + Email email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + dynamic isTaxExempt; + dynamic hasShoppingCartItems; + dynamic active; + dynamic deleted; + dynamic isSystemAccount; + dynamic systemName; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory Customer.fromJson(Map json) => Customer( + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + addresses: List.from(json["addresses"].map((x) => x)), + id: json["id"], + username: usernameValues.map[json["username"]], + email: emailValues.map[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: json["created_on_utc"], + lastLoginDateUtc: json["last_login_date_utc"], + lastActivityDateUtc: json["last_activity_date_utc"], + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "addresses": List.from(addresses.map((x) => x)), + "id": id, + "username": usernameValues.reverse[username], + "email": emailValues.reverse[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, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +enum Email { TAMER_FANASHEH_DRSULAIMANALHABIB_COM, STEVE_GATES_NOP_COMMERCE_COM } + +final emailValues = EnumValues({ + "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM, + "tamer.fanasheh@drsulaimanalhabib.com": Email.TAMER_FANASHEH_DRSULAIMANALHABIB_COM +}); + +enum Username { TAMERF, STEVE_GATES_NOP_COMMERCE_COM } + +final usernameValues = EnumValues({ + "steve_gates@nopCommerce.com": Username.STEVE_GATES_NOP_COMMERCE_COM, + "tamerf": Username.TAMERF +}); + +enum ReviewText { ENADDD, ENAD_TEST_0001, GOOD, ENAD_TEST_REVIEW_001, ENAD } + +final reviewTextValues = EnumValues({ + "ENAD ": ReviewText.ENAD, + "enaddd": ReviewText.ENADDD, + "ENAD TEST 0001": ReviewText.ENAD_TEST_0001, + "Enad Test Review 001": ReviewText.ENAD_TEST_REVIEW_001, + "good": ReviewText.GOOD +}); + +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 new file mode 100644 index 00000000..0cd833b7 --- /dev/null +++ b/lib/models/pharmacy/topBrandsModel.dart @@ -0,0 +1,137 @@ +// To parse this JSON data, do +// +// final topBrand = topBrandFromJson(jsonString); + +import 'dart:convert'; + +List topBrandFromJson(String str) => List.from(json.decode(str).map((x) => TopBrand.fromJson(x))); + +String topBrandToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class TopBrand { + TopBrand({ + this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.manufacturerTemplateId, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.pageSize, + this.pageSizeOptions, + this.priceRanges, + this.published, + this.deleted, + this.displayOrder, + this.createdOnUtc, + this.updatedOnUtc, + this.image, + }); + + String id; + String name; + String namen; + List localizedNames; + String description; + int manufacturerTemplateId; + String metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + int pageSize; + String pageSizeOptions; + dynamic priceRanges; + bool published; + bool deleted; + int displayOrder; + DateTime createdOnUtc; + DateTime updatedOnUtc; + Image image; + + factory TopBrand.fromJson(Map json) => TopBrand( + id: json["id"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + description: json["description"] == null ? null : json["description"], + manufacturerTemplateId: json["manufacturer_template_id"], + metaKeywords: json["meta_keywords"], + metaDescription: json["meta_description"], + metaTitle: json["meta_title"], + pageSize: json["page_size"], + pageSizeOptions: json["page_size_options"], + priceRanges: json["price_ranges"], + published: json["published"], + deleted: json["deleted"], + displayOrder: json["display_order"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + image: json["image"] == null ? null : Image.fromJson(json["image"]), + ); + + Map toJson() => { + "id": id, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "description": description == null ? null : description, + "manufacturer_template_id": manufacturerTemplateId, + "meta_keywords": metaKeywords, + "meta_description": metaDescription, + "meta_title": metaTitle, + "page_size": pageSize, + "page_size_options": pageSizeOptions, + "price_ranges": priceRanges, + "published": published, + "deleted": deleted, + "display_order": displayOrder, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "image": image == null ? null : image.toJson(), + }; +} + +class Image { + Image({ + this.src, + this.thumb, + this.attachment, + }); + + String src; + dynamic thumb; + dynamic attachment; + + factory Image.fromJson(Map json) => Image( + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "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, + }; +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart index c584a21e..4e396427 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -50,99 +50,99 @@ class _CMCLocationPageState 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); + 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: "") - ]), - ); + }, + 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; - } - }); + 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, - ), - ], - ), + 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, - ), - )); + ), + ); + }, + 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..2a7696b7 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -119,13 +119,16 @@ class _NewCMCPageState extends State height: MediaQuery.of(context).size.height * 0.8, child: Column( children: [ - Container( - margin: EdgeInsets.only(left: MediaQuery.of(context).size.width*0.05, right: MediaQuery.of(context).size.width*0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: changePageViewIndex, + if (widget.model.cmcAllOrderDetail.length == 0) + Container( + margin: EdgeInsets.only( + left: MediaQuery.of(context).size.width * 0.05, + right: MediaQuery.of(context).size.width * 0.05), + child: StepsWidget( + index: _currentIndex, + changeCurrentTab: changePageViewIndex, + ), ), - ), Expanded( child: PageView( physics: NeverScrollableScrollPhysics(), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart index 06a83cc1..b745e0c9 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -35,12 +36,14 @@ class _CMCPageState extends State @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model){ - model.getCmcAllPresOrders(); + onModelReady: (model) async{ + await model.getCmcAllPresOrders(); + }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - description: TranslationBase.of(context).HHCNotAuthMsg, + description:TranslationBase.of(context).infoCMC, + imagesInfo: [ImagesInfo(imageAr: 'assets/images/AlHabibMedicalService/Wifi-AR.png',imageEn: 'assets/images/AlHabibMedicalService/Wifi-EN.png', isAsset: true)], appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, body: Scaffold( extendBodyBehindAppBar: true, @@ -79,7 +82,7 @@ class _CMCPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: 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..a0583434 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart @@ -78,7 +78,7 @@ class _EReferralPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: @@ -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/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart index d7434b97..4bf3a762 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -49,98 +49,98 @@ class _LocationPageState 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); + 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: "") - ]), - ); + }, + 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; - } - }); + 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, - ), - ], - ), + 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, - ), - )); + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + )); } } 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..3180cf18 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart @@ -81,7 +81,7 @@ class _HomeHealthCarePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index f40e32cc..e1720258 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -1,4 +1,5 @@ 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'; @@ -32,6 +33,7 @@ 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'; @@ -182,7 +184,6 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/booking_icon_active.png', title: TranslationBase.of(context).bookAppo, ), - if(projectViewModel.havePrivilege(58)) ServicesContainer( onTap: () => Navigator.push( context, @@ -257,46 +258,46 @@ class _AllHabibMedicalServiceState extends State { ), imageLocation: 'assets/images/new-design/family_menu_icon_red.png', - title: TranslationBase.of(context).family, + title: 'My Family', ), - if(projectViewModel.havePrivilege(35)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(page: ChildVaccinesPage()), + if (projectViewModel.havePrivilege(35)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: ChildVaccinesPage()), + ), + imageLocation: + 'assets/images/new-design/children_vaccines_icon.png', + title: 'Child Vaccines', ), - imageLocation: - 'assets/images/new-design/children_vaccines_icon.png', - title: 'Child Vaccines', - ), ServicesContainer( 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, - FadePage(page: SymptomInfo()), - ), - imageLocation: 'assets/images/new-design/body_icon.png', - title: 'Symptom Checker'), - if(projectViewModel.havePrivilege(36)) + if (projectViewModel.havePrivilege(42)) ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(page: BloodDonationPage()), + onTap: () => Navigator.push( + context, + FadePage(page: SymptomInfo()), + ), + imageLocation: 'assets/images/new-design/body_icon.png', + title: 'Symptom Checker'), + if (projectViewModel.havePrivilege(36)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: BloodDonationPage()), + ), + imageLocation: 'assets/images/new-design/blood_icon.png', + title: 'Blood Donation', ), - imageLocation: 'assets/images/new-design/blood_icon.png', - title: 'Blood Donation', - ), ServicesContainer( onTap: () => Navigator.push( context, @@ -319,26 +320,27 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/health_convertor_icon.png', title: 'Health Converter', ), - if(projectViewModel.havePrivilege(38)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage( - page: H2OPageIndexPage(), + if (projectViewModel.havePrivilege(38)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: H2OPageIndexPage(), + ), ), + imageLocation: 'assets/images/new-design/water_icon.png', + title: 'H2O', ), - imageLocation: 'assets/images/new-design/water_icon.png', - title: 'H2O', - ), - if(projectViewModel.havePrivilege(41)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(), + if (projectViewModel.havePrivilege(41)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(), + ), + imageLocation: + 'assets/images/new-design/smartwatch_icon.png', + title: TranslationBase.of(context).smartWatches, ), - imageLocation: 'assets/images/new-design/smartwatch_icon.png', - title: TranslationBase.of(context).smartWatches, - ), ServicesContainer( onTap: () => Navigator.push( context, @@ -359,19 +361,16 @@ class _AllHabibMedicalServiceState extends State { ), ServicesContainer( onTap: () { - Navigator.of(context).push( - MaterialPageRoute( + Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => MyWebView( - title: TranslationBase.of(context).hmgNews, - selectedUrl: - "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", - ), - ), - ); + title: "HMG News", + selectedUrl: + "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + ))); }, imageLocation: 'assets/images/new-design/twitter_dashboard_icon.png', - title: TranslationBase.of(context).latestNews, + title: 'Latest News', ), ServicesContainer( onTap: () => Navigator.push( @@ -398,7 +397,6 @@ class _AllHabibMedicalServiceState extends State { setState(() { authUser = data; }); - print(authUser.patientID); } var data = await this.sharedPref.getObject(WEATHER); weather = data != null ? data['Temperature'].toString() + '\u2103' : '--'; diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index ad2c6ece..8ac7b437 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -68,7 +68,7 @@ class _H2OPageState extends State isScrollable: false, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index a63125d0..bc1de1f6 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -98,8 +98,11 @@ class _HospitalsPageState extends State { width: 60, height: 60, ), - AppText(weather, - fontSize: 22, color: Colors.white) + Directionality( + textDirection: TextDirection.ltr, + child: AppText(weather, + fontSize: 22, + color: Colors.white)) ], ), ], diff --git a/lib/pages/AlHabibMedicalService/parking_page.dart b/lib/pages/AlHabibMedicalService/parking_page.dart index a49a4b20..82c390ea 100644 --- a/lib/pages/AlHabibMedicalService/parking_page.dart +++ b/lib/pages/AlHabibMedicalService/parking_page.dart @@ -18,7 +18,6 @@ class ParkingPage extends StatelessWidget { onModelReady: (model) => model.getIsSaveParking(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - isShowDecPage: false, appBarTitle: TranslationBase.of(context).parking, body: SingleChildScrollView( padding: EdgeInsets.all(12), diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index bb91a79e..1eaa02da 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -32,6 +32,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:giffy_dialog/giffy_dialog.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; //import '../../../core/model/my_balance/AdvanceModel.dart'; import 'confirm_payment_page.dart'; diff --git a/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart b/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart index e08d2f28..d165a895 100644 --- a/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart +++ b/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart @@ -8,13 +8,13 @@ import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobi import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class ConfirmSMSDialog extends StatefulWidget { final String phoneNumber; @@ -112,31 +112,32 @@ class _ConfirmSMSDialogState extends State { height: 40, color: Theme.of(context).primaryColor, child: Stack( + children: [ Center( - child: Texts( - 'SMS', - color: Colors.white, - textAlign: TextAlign.center, - ), - ), - Positioned( - child: Container( - child: InkWell( - onTap: () => Navigator.pop(context), - child: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, color: Colors.white), - child: Icon( - Icons.clear, - color: Colors.grey[900], - )), + child: Texts( + 'SMS', + color: Colors.white, + textAlign: TextAlign.center, ), + ), + Positioned(child: Container( + child: InkWell( + onTap: () => Navigator.pop(context), + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, color: Colors.white), + child: Icon( + Icons.clear, + color: Colors.grey[900], + )), ), - left: projectViewModel.isArabic ? 2 : 0, - right: projectViewModel.isArabic ? 0 : 2, + ), + left: projectViewModel.isArabic? 2:0, + right: projectViewModel.isArabic? 0:2, ) ], + ), ), Image.asset( @@ -333,14 +334,15 @@ class _ConfirmSMSDialogState extends State { } void submit(MyBalanceViewModel model) { - GifLoaderDialogUtils.showMyDialog(context); if (verifyAccountForm.currentState.validate()) { final activationCode = digit1.text + digit2.text + digit3.text + digit4.text; model .checkActivationCodeForAdvancePayment(activationCode: activationCode) + .then((value) {}) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) .then((value) { - GifLoaderDialogUtils.hideDialog(context); Navigator.pop(context, true); }); } diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 7a247b78..d7e08a66 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -241,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 + ": " + @@ -325,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, @@ -335,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], @@ -423,7 +423,7 @@ 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: 500), () { @@ -513,12 +513,12 @@ class _BookConfirmState extends State { } getToDoCount() { - toDoProvider.setState(0); + toDoProvider.setState(0, true); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber']); + toDoProvider.setState(res['AppointmentActiveNumber'], true); } else {} }).catchError((err) { print(err); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 70a5b1fb..f513c434 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -165,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)), + ), + ), + ], + ), ); } @@ -238,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)), ), @@ -263,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)), ), @@ -277,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)), - ), - ), - ], - ), - ), ], ); } @@ -463,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)), - ), - ), - ], - ), - ), ], ); } @@ -770,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/BookingOptions.dart b/lib/pages/BookAppointment/BookingOptions.dart index b90c3b34..83af454f 100644 --- a/lib/pages/BookAppointment/BookingOptions.dart +++ b/lib/pages/BookAppointment/BookingOptions.dart @@ -52,10 +52,11 @@ class _BookingOptionsState extends State { children: [ Expanded( child: CardCommon( - image: 'assets/images/new-design/search_by_clinic.png', - text: TranslationBase.of(context).clinic, - subText: TranslationBase.of(context).name, - type: 0), + image: 'assets/images/new-design/search_by_clinic.png', + text: TranslationBase.of(context).clinic, + subText: TranslationBase.of(context).name, + type: 0, + ), ), Expanded( child: CardCommon( diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index 043eaff1..34a7e1e1 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -2,13 +2,12 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DentalComplaintCard.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.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/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:smart_progress_bar/smart_progress_bar.dart'; class DentalComplaints extends StatefulWidget { SearchInfo searchInfo; @@ -36,8 +35,7 @@ class _DentalComplaintsState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).dentalComplaints, - isShowDecPage: false, + appBarTitle: "Symptoms", body: Container( margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: ListView.builder( @@ -61,14 +59,12 @@ class _DentalComplaintsState extends State { } getChiefComplaintsList() { - GifLoaderDialogUtils.showMyDialog(context); getLanguageID(); ClinicListService service = new ClinicListService(); service .getChiefComplaintsList( widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, context) .then((res) { - GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { print(res['List_DentalChiefComplain']); setState(() { @@ -77,13 +73,10 @@ class _DentalComplaintsState extends State { }); print(complaintsList.length); }); - } else { - - } + } else {} }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); print(err); - }); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } } diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 20e4ae09..392eb24c 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -53,17 +53,6 @@ class _DoctorProfileState extends State 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; @@ -164,7 +153,7 @@ class _DoctorProfileState extends State alignment: Alignment.center, child: Text( "(" + - widget.doctor.noOfPatientsRate.toString() + + widget.docProfileList.noOfPatientsRate.toString() + " " + TranslationBase.of(context).reviews + ")", @@ -496,7 +485,7 @@ class _DoctorProfileState extends State } double getRatingWidth(int patientNumber) { - var width = (patientNumber / this.widget.doctor.noOfPatientsRate) * 100; + var width = (patientNumber / this.widget.docProfileList.noOfPatientsRate) * 100; return width; } diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 487d1be7..e92c2348 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -10,11 +10,11 @@ import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsLis import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class QRCode extends StatefulWidget { PatientShareResponse patientShareResponse; @@ -235,7 +235,6 @@ class _QRCodeState extends State { okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () { - GifLoaderDialogUtils.showMyDialog(context); service .sendAppointmentQREmail( widget.authUser.emailAddress, @@ -248,15 +247,15 @@ class _QRCodeState extends State { widget.patientShareResponse.doctorSpeciality), context) .then((res) { - GifLoaderDialogUtils.hideDialog(context); print(res); ConfirmDialog.closeAlertDialog(context); }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); ConfirmDialog.closeAlertDialog(context); AppToast.showErrorToast(message: err); print(err); - }); + }).showProgressBar( + text: "Loading", + backgroundColor: Colors.blue.withOpacity(0.6)); }, cancelFunction: () => {}); dialog.showAlertDialog(context); diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 44cf46c3..94308c1c 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,16 +1,21 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; 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; - Search({this.type = 0, this.clnicIds}); - @override _SearchState createState() => _SearchState(); } @@ -29,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 72226c2e..0c65a789 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -27,7 +27,6 @@ class _SearchResultsState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, - isShowDecPage: false, body: Container( margin: EdgeInsets.all(10.0), child: SingleChildScrollView( @@ -37,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 355bb52b..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'; @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class SearchByClinic extends StatefulWidget { final List clnicIds; @@ -33,6 +34,7 @@ class _SearchByClinicState extends State { List projectsList = []; bool isMobileAppDentalAllow = false; bool isLoaded = false; + bool isProjectLoaded = false; @override void initState() { @@ -55,6 +57,11 @@ class _SearchByClinicState extends State { onChanged: (bool value) { setState(() { nearestAppo = value; + print(nearestAppo); + if (nearestAppo) + getProjectsList(); + else + isProjectLoaded = false; }); }, ), @@ -120,7 +127,8 @@ class _SearchByClinicState extends State { }, ), )), - isDentalSelectedAndSupported() == true || nearestAppo + isDentalSelectedAndSupported() == true || + (nearestAppo && isProjectLoaded) ? Container( height: 60.0, decoration: BoxDecoration( @@ -136,8 +144,7 @@ class _SearchByClinicState extends State { margin: EdgeInsets.only(top: 15.0), child: DropdownButtonHideUnderline( child: DropdownButton( - hint: - new Text(TranslationBase.of(context).selectHospital), + hint: new Text("Select Project"), value: projectDropdownValue, items: projectsList.map((item) { return new DropdownMenuItem( @@ -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/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 8d2b9387..1e1945b5 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -4,6 +4,7 @@ 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:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import '../SearchResults.dart'; @@ -128,12 +129,9 @@ class _SearchByDoctorState extends State { navigateToSearchResults( context, doctorsList, _patientDoctorAppointmentListHospital); } else { - GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); print(err); }); } diff --git a/lib/pages/BookAppointment/widgets/CardCommon.dart b/lib/pages/BookAppointment/widgets/CardCommon.dart index 6a7e2bdd..b03e9b24 100644 --- a/lib/pages/BookAppointment/widgets/CardCommon.dart +++ b/lib/pages/BookAppointment/widgets/CardCommon.dart @@ -1,16 +1,14 @@ -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; + +import '../../../Constants.dart'; class CardCommon extends StatelessWidget { - var languageID; final image; final text; final subText; final type; - - CardCommon( + const CardCommon( {@required this.image, @required this.text, @required this.subText, @@ -18,7 +16,6 @@ class CardCommon extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); return GestureDetector( onTap: () { navigateToSearch(context, this.type); @@ -36,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)), ), @@ -48,12 +45,8 @@ class CardCommon extends StatelessWidget { color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), ), Container( - alignment: projectViewModel.isArabic - ? Alignment.bottomLeft - : Alignment.bottomRight, - margin: projectViewModel.isArabic - ? EdgeInsets.fromLTRB(10.0, 0.0, 00.0, 8.0) - : EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), + alignment: Alignment.bottomRight, + margin: EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), child: Image.asset(this.image, width: 60.0, height: 60.0), ), ], diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart index eb434cad..27f37d0a 100644 --- a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -3,9 +3,8 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.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'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; // ignore: must_be_immutable class DentalComplaintCard extends StatefulWidget { @@ -70,15 +69,14 @@ class _DentalComplaintCardState extends State { List doctorsList = []; List _patientDoctorAppointmentListHospital = List(); - GifLoaderDialogUtils.showMyDialog(context); + ClinicListService service = new ClinicListService(); service .getChiefComplaintDoctorList(widget.listDentalChiefComplain.iD, widget.listDentalChiefComplain.projectID, context) .then((res) { - GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - print(res['ErrorEndUserMessage']); + print(res['List_DentalDoctorChiefComplaintMapping']); setState(() { doctorsList.clear(); res['List_DentalDoctorChiefComplaintMapping'].forEach((v) { @@ -109,21 +107,16 @@ class _DentalComplaintCardState extends State { patientDoctorAppointment: element)); } }); - if (doctorsList.length != 0) { - navigateToSearchResults( - context, doctorsList, _patientDoctorAppointmentListHospital); - } else { - AppToast.showErrorToast(message: TranslationBase.of(context).emptyResult); - } + navigateToSearchResults( + context, doctorsList, _patientDoctorAppointmentListHospital); }); } else { 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)); } Future navigateToSearchResults( diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index bd4fb429..d419e4af 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import '../DoctorProfile.dart'; 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 f920de9f..80648292 100644 --- a/lib/pages/ContactUs/findus/findus_page.dart +++ b/lib/pages/ContactUs/findus/findus_page.dart @@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model import 'package:diplomaticquarterapp/pages/ContactUs/findus/hospitrals_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/pharmacies_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -40,7 +39,7 @@ class _FindUsPageState extends State builder: (_, model, w) => AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: TranslationBase.of(context).ourLocation, + appBarTitle: 'Locations', baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, @@ -79,10 +78,7 @@ class _FindUsPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.tab, - - indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), @@ -91,13 +87,13 @@ class _FindUsPageState extends State Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: Texts(TranslationBase.of(context).hospitals), + child: Texts(' Hospitals '), ), ), Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: Texts(TranslationBase.of(context).pharmacies), + child: Texts(' Pharmacies '), ), ), ], 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..8848e2ff 100644 --- a/lib/pages/ContactUs/widgets/card_common_contat.dart +++ b/lib/pages/ContactUs/widgets/card_common_contat.dart @@ -2,10 +2,13 @@ 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'; +import '../../../Constants.dart'; + class CardCommonContact extends StatelessWidget { final image; final text; @@ -34,19 +37,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:secondaryColor, + 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/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 8375e337..3e58b657 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -9,13 +9,13 @@ import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.da import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:intl/intl.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:table_calendar/table_calendar.dart'; class CovidTimeSlots extends StatefulWidget { @@ -481,7 +481,6 @@ class _CovidTimeSlotsState extends State insertAppointmentCovidTest(context, DoctorList docObject) { DoctorsListService service = new DoctorsListService(); - GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; service .insertAppointment( @@ -492,7 +491,7 @@ class _CovidTimeSlotsState extends State CovidTimeSlots.selectedDate, context) .then((res) { - GifLoaderDialogUtils.hideDialog(context); + print(res); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Appointment Booked Successfully"); Future.delayed(new Duration(milliseconds: 1800), () { @@ -522,19 +521,17 @@ class _CovidTimeSlotsState 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)); } cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { ConfirmDialog.closeAlertDialog(context); - GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.cancelAppointment(appo, context).then((res) { - GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { Future.delayed(new Duration(milliseconds: 1500), () { insertAppointmentCovidTest(context, docObject); @@ -543,27 +540,28 @@ class _CovidTimeSlotsState 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)); } getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { - GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .getPatientShare(appointmentNo, clinicID, projectID, context) .then((res) { - GifLoaderDialogUtils.hideDialog(context); - widget.patientShareResponse = new PatientShareResponse.fromJson(res); - navigateToPaymentAlert(); - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); - print(err); - }); + print(res); + widget.patientShareResponse = new PatientShareResponse.fromJson(res); + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + navigateToPaymentAlert(); + }); } navigateToPaymentAlert() { @@ -575,10 +573,8 @@ class _CovidTimeSlotsState extends State } getCovidFreeSlots(BuildContext context, int projectID) { - GifLoaderDialogUtils.showMyDialog(context); CovidDriveThruService service = new CovidDriveThruService(); service.getCovidFreeSlots(context, projectID).then((res) { - GifLoaderDialogUtils.hideDialog(context); print(res['COVID19_FreeTimeSlots']); if (res['MessageStatus'] == 1) { if (res['COVID19_FreeTimeSlots'].length != 0) { @@ -599,9 +595,8 @@ class _CovidTimeSlotsState 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)); } } diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart index 245bcbaf..0563c4bd 100644 --- a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -3,12 +3,11 @@ import 'package:diplomaticquarterapp/models/CovidDriveThru/DriveThroughTestingCe import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-details.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:maps_launcher/maps_launcher.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class CovidDrivethruLocation extends StatefulWidget { @override @@ -259,38 +258,37 @@ class _CovidDrivethruLocationState extends State { CovidPaymentInfoResponse covidPaymentInfoResponse = new CovidPaymentInfoResponse(); - GifLoaderDialogUtils.showMyDialog(context); - service .getCovidPaymentInformation(context, int.parse(projectID)) .then((res) { - GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { covidPaymentInfoResponse = CovidPaymentInfoResponse.fromJson( res['COVID19_PatientShare']); + print(covidPaymentInfoResponse.procedureNameField); }); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CovidPaymentDetails( - covidPaymentInfoResponse: covidPaymentInfoResponse, - projectID: int.parse(projectID), - ))); } else {} }) .catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CovidPaymentDetails( + covidPaymentInfoResponse: covidPaymentInfoResponse, + projectID: int.parse(projectID), + ))); }); } getProjectsList(BuildContext context) { CovidDriveThruService service = new CovidDriveThruService(); - GifLoaderDialogUtils.showMyDialog(context); service.getCovidProjectsList(context).then((res) { - GifLoaderDialogUtils.hideDialog(context); + print(res); if (res['MessageStatus'] == 1) { print(res); setState(() { @@ -300,9 +298,8 @@ class _CovidDrivethruLocationState extends State { }); } else {} }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); print(err); - }); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } } 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 791c33b3..b161c6e0 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -1,25 +1,33 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; 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'; @@ -35,6 +43,7 @@ class MyFamily extends StatefulWidget { } class _MyFamily extends State with TickerProviderStateMixin { + List imagesInfo = List(); final familyFileProvider = FamilyFilesProvider(); AppSharedPreferences sharedPref = new AppSharedPreferences(); var userID; @@ -46,7 +55,8 @@ class _MyFamily extends State with TickerProviderStateMixin { locator(); ProjectViewModel projectViewModel; AuthenticatedUser user; - List imagesInfo = List(); + VitalSignService _vitalSignService = locator(); + var isVaiable = false; @override void initState() { _tabController = new TabController(length: 2, vsync: this, initialIndex: 0); @@ -219,7 +229,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), @@ -345,7 +356,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: [ @@ -459,12 +471,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) { @@ -487,7 +512,9 @@ class _MyFamily extends State with TickerProviderStateMixin { ], )); }).toList(), - ))); + ) + ], + ))); } }) ], @@ -512,7 +539,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: [ @@ -590,6 +618,15 @@ class _MyFamily extends State with TickerProviderStateMixin { ); } + String isAvailable() { + if (isVaiable == false) { + this.isVaiable = true; + return TranslationBase.of(context).noDataAvailable; + } else { + return ""; + } + } + Future getFamilyFiles() async { if (user != null) { if (await sharedPref.getObject(FAMILY_FILE) != null) { @@ -671,22 +708,54 @@ class _MyFamily extends State with TickerProviderStateMixin { var familyFile = await sharedPref.getObject(FAMILY_FILE); Provider.of(context, listen: false) .setPrivilege(privilegeList: result, isLoginChild: true); - result = CheckActivationCode.fromJson(result); + result = list.CheckActivationCode.fromJson(result); var mainUser = await sharedPref.getObject(MAIN_USER); + var bloodType = await sharedPref.getString(BLOOD_TYPE); this.sharedPref.clear(); 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(APP_LANGUAGE, currentLang); 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) { diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index 1690254a..fe245133 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -79,7 +79,7 @@ class _AmbulanceReqState extends State child: Container( height: 60.0, margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.93, + width: MediaQuery.of(context).size.width * 0.90, decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -93,7 +93,6 @@ class _AmbulanceReqState extends State controller: _tabController, indicatorWeight: 5.0, indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index 5f303846..c07adabc 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -46,7 +46,7 @@ class _AmbulanceRequestIndexPageState extends State { @override Widget build(BuildContext context) { return AppScaffold( - body: widget.amRequestViewModel.pickUpRequestPresOrder != null + body: false ? Column( children: [ SizedBox( @@ -62,18 +62,18 @@ class _AmbulanceRequestIndexPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ OrderLogItem( - title: 'Request ID', + title: TranslationBase.of(context).reqId, value: widget.amRequestViewModel.pickUpRequestPresOrder .presOrderID .toString(), ), OrderLogItem( - title: 'Status', + title: TranslationBase.of(context).status, value: widget.amRequestViewModel.pickUpRequestPresOrder .ambulateDescription, ), OrderLogItem( - title: 'Last edit time', + title: TranslationBase.of(context).pickupDate, value: DateUtil.getDayMonthYearDateFormatted( DateUtil.convertStringToDate(widget .amRequestViewModel @@ -81,17 +81,17 @@ class _AmbulanceRequestIndexPageState extends State { .lastEditDate)), ), OrderLogItem( - title: 'Pickup Location', + title: TranslationBase.of(context).pickupLocation, value: widget.amRequestViewModel.pickUpRequestPresOrder .pickupLocationName, ), OrderLogItem( - title: 'Drop off Location', + title: TranslationBase.of(context).dropoffLocation, value: widget.amRequestViewModel.pickUpRequestPresOrder .dropoffLocationName, ), OrderLogItem( - title: 'Trasfaer way', + title: TranslationBase.of(context).transportMethod, value: widget .amRequestViewModel.pickUpRequestPresOrder.title, ), diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart index 16945a1e..aeb61609 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart @@ -201,7 +201,7 @@ class _BillAmountState extends State { leading: Radio( value: Ambulate.Wheelchair, groupValue: _ambulate, - activeColor: Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _ambulate = value; @@ -232,7 +232,7 @@ class _BillAmountState extends State { leading: Radio( value: Ambulate.Walker, groupValue: _ambulate, - activeColor: Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _ambulate = value; @@ -268,7 +268,7 @@ class _BillAmountState extends State { leading: Radio( value: Ambulate.Stretcher, groupValue: _ambulate, - activeColor: Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _ambulate = value; @@ -299,7 +299,7 @@ class _BillAmountState extends State { leading: Radio( value: Ambulate.None, groupValue: _ambulate, - activeColor: Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _ambulate = value; diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index 78574e06..f6ebfde9 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -183,7 +183,7 @@ class _PickupLocationState extends State { color: Colors.white, ), child: ListTile( - title: Text(TranslationBase.of(context).yes), + title: Texts(TranslationBase.of(context).yes), leading: Radio( value: HaveAppointment.YES, groupValue: _haveAppointment, @@ -218,7 +218,7 @@ class _PickupLocationState extends State { color: Colors.white, ), child: ListTile( - title: Text(TranslationBase.of(context).no), + title: Texts(TranslationBase.of(context).no), leading: Radio( value: HaveAppointment.NO, groupValue: _haveAppointment, @@ -287,7 +287,7 @@ class _PickupLocationState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts('Pickup Location'), + Texts(TranslationBase.of(context).pickupLocation), SizedBox( height: 15, ), @@ -456,7 +456,7 @@ class _PickupLocationState extends State { return _selectedHospital == null ? title : _selectedHospital.name; } - String getSelectFromMapName(BuildContext context) { + String getSelectFromMapName(context) { return _result != null ? _result.formattedAddress : TranslationBase.of(context).selectMap; } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart index 952716c8..69669ed3 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -97,7 +97,7 @@ class _SelectTransportationMethodState value: widget .amRequestViewModel.amRequestModeList[index], groupValue: _erTransportationMethod, - activeColor: Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _erTransportationMethod = value; @@ -149,7 +149,7 @@ class _SelectTransportationMethodState leading: Radio( value: Direction.ToHospital, groupValue: _direction, - activeColor: Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _direction = value; @@ -180,7 +180,7 @@ class _SelectTransportationMethodState leading: Radio( value: Direction.FromHospital, groupValue: _direction, - activeColor: Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _direction = value; @@ -227,7 +227,7 @@ class _SelectTransportationMethodState leading: Radio( value: Way.OneWay, groupValue: _way, - activeColor:Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _way = value; @@ -258,7 +258,7 @@ class _SelectTransportationMethodState leading: Radio( value: Way.TwoWays, groupValue: _way, - activeColor: Theme.of(context).primaryColor, + activeColor: Colors.red[800], onChanged: (value) { setState(() { _way = value; diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart index 66da39df..8fd72b8f 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -18,7 +18,7 @@ class Summary extends StatefulWidget { _SummaryState createState() => _SummaryState(); } -//TODO it should be dynamic fix it +//TODO it should be dynamic class _SummaryState extends State { @override Widget build(BuildContext context) { @@ -67,7 +67,7 @@ class _SummaryState extends State { ), ), SizedBox(height: 20,), - Texts(TranslationBase.of(context).RRTSummary,textAlign: TextAlign.start,), + Texts('Bill Amount',textAlign: TextAlign.start,), SizedBox(height: 5,), Container( height: 55, diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index e3438af5..886d47d2 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -31,13 +31,13 @@ class _ErOptionsState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: widget.isAppbar, - isShowDecPage: false, appBarTitle: TranslationBase.of(context).bookAppo, body: Container( margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), child: Row( diff --git a/lib/pages/ErService/NearestEr.dart b/lib/pages/ErService/NearestEr.dart index 1c786954..eaf0d4ef 100644 --- a/lib/pages/ErService/NearestEr.dart +++ b/lib/pages/ErService/NearestEr.dart @@ -20,6 +20,10 @@ class NearestEr extends StatelessWidget { @override Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double itemHeight = (size.height - kToolbarHeight - 24) / 2; + final double itemWidth = size.width / 2; + return BaseView( onModelReady: appointmentNo != null && projectID != null ? (model) => model.getProjectAvgERWaitingTimeOrders( @@ -27,15 +31,14 @@ class NearestEr extends StatelessWidget { : (model) => model.getProjectAvgERWaitingTimeOrders(), builder: (_, mode, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).er, - description: TranslationBase.of(context).erContant, + appBarTitle: TranslationBase.of(context).NearestEr, baseViewModel: mode, body: mode.ProjectAvgERWaitingTimeModeList.length > 0 ? Container( child: ListView( children: [ Text( - TranslationBase.of(context).erContant, + "${TranslationBase.of(context).NearestErDesc}", textAlign: TextAlign.center, style: TextStyle( fontSize: 18.0, @@ -43,301 +46,55 @@ class NearestEr extends StatelessWidget { fontWeight: FontWeight.w900, color: new Color(0xFF60686b))), Container( - margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - child: CardPosition( - text: mode - .ProjectAvgERWaitingTimeModeList[0] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[0] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[0].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[0] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[0] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[0] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[0] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[0] - .projectName, - ), - ), - - ), - Expanded( - child: Container( - child: CardPosition( - text: mode - .ProjectAvgERWaitingTimeModeList[1] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[1] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[1].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[1] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[1] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[1] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[1] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[1] - .projectName, - ), - ), - - ) - ], - ), - Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - child: CardPosition( - - text: mode - .ProjectAvgERWaitingTimeModeList[2] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - - subText: mode - .ProjectAvgERWaitingTimeModeList[2] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[2].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[2] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[2] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[2] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[2] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[2] - .projectName, - ), - ), - - ), - Expanded( - child: Container( - child: CardPosition( - - text: mode - .ProjectAvgERWaitingTimeModeList[3] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - - subText: mode - .ProjectAvgERWaitingTimeModeList[3] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[3].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[3] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[3] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[3] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[3] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[3] - .projectName, - ), - ), - flex: 0, - ) - ], - ), - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - child: CardPosition( - - text: mode - .ProjectAvgERWaitingTimeModeList[4] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - - subText: mode - .ProjectAvgERWaitingTimeModeList[4] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[4].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[4] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[4] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[4] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[4] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[4] - .projectName, - ), - ), - - ), - Expanded( - child: Container( - child: CardPosition( - text: mode - .ProjectAvgERWaitingTimeModeList[5] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[5] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[5].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[5] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[5] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[5] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[5] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[5] - .projectName, - ), - ), - - ) - ], + margin: EdgeInsets.fromLTRB(2.0, 10.0, 0.0, 10.0), + child: GridView.count( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemWidth), + crossAxisSpacing: 10, + mainAxisSpacing: 10, + controller: + new ScrollController(keepScrollOffset: false), + shrinkWrap: true, + padding: const EdgeInsets.all(4.0), + children: List.generate(7, (index) { + return Container( + child: CardPosition( + text: mode + .ProjectAvgERWaitingTimeModeList[index] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + subText: mode + .ProjectAvgERWaitingTimeModeList[index] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[index].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[index] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[index] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[index] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[index] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[index] + .projectName, + cardSize: itemWidth, ), - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - child: CardPosition( - text: mode - .ProjectAvgERWaitingTimeModeList[6] - .projectName - .toString(), - image: - 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[6] - .distanceInKilometers - .toString(), - type: mode - .ProjectAvgERWaitingTimeModeList[6].iD - .toString(), - telephone: mode - .ProjectAvgERWaitingTimeModeList[6] - .phoneNumber - .toString(), - networkImage: mode - .ProjectAvgERWaitingTimeModeList[6] - .projectImageURL - .toString(), - latitude: mode - .ProjectAvgERWaitingTimeModeList[6] - .latitude, - longitude: mode - .ProjectAvgERWaitingTimeModeList[6] - .longitude, - projectname: mode - .ProjectAvgERWaitingTimeModeList[6] - .projectName, - ), - ), - flex: 0, - ), - ], - ), - ], - )), + ); + }), + ), + ), ], ), ) @@ -348,4 +105,3 @@ class NearestEr extends StatelessWidget { ); } } - diff --git a/lib/pages/ErService/widgets/StepsWidget.dart b/lib/pages/ErService/widgets/StepsWidget.dart index 40af61d0..c5864710 100644 --- a/lib/pages/ErService/widgets/StepsWidget.dart +++ b/lib/pages/ErService/widgets/StepsWidget.dart @@ -13,7 +13,7 @@ class StepsWidget extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return !projectViewModel.isArabic? Stack( + return projectViewModel.isArabic? Stack( children: [ Container( height: 50, diff --git a/lib/pages/ErService/widgets/card_common.dart b/lib/pages/ErService/widgets/card_common.dart index 0796a5bc..35ece966 100644 --- a/lib/pages/ErService/widgets/card_common.dart +++ b/lib/pages/ErService/widgets/card_common.dart @@ -11,7 +11,6 @@ class CardCommonEr extends StatelessWidget { final text; final subText; final type; - const CardCommonEr( {@required this.image, @required this.text, @@ -23,6 +22,7 @@ class CardCommonEr extends StatelessWidget { return GestureDetector( onTap: () { navigateToSearch(context, this.type); + }, child: Container( margin: EdgeInsets.fromLTRB(9.0, 9.0, 9.0, 9.0), @@ -60,10 +60,24 @@ class CardCommonEr extends StatelessWidget { } Future navigateToSearch(context, type) async { - if (type == 0) { - Navigator.push(context, FadePage(page: AmbulanceReq())); - } else { - Navigator.push(context, FadePage(page: NearestEr())); +//===Switch case=== + if(type==0) + { + + Navigator.push( + context, + FadePage( + page: AmbulanceReq())); + } + else{ + + Navigator.push( + context, + FadePage( + page: NearestEr())); + } + + } } diff --git a/lib/pages/ErService/widgets/card_position.dart b/lib/pages/ErService/widgets/card_position.dart index 8647ad62..69ccaffe 100644 --- a/lib/pages/ErService/widgets/card_position.dart +++ b/lib/pages/ErService/widgets/card_position.dart @@ -19,6 +19,8 @@ class CardPosition extends StatelessWidget { final latitude; final longitude; final projectname; + final cardSize; + const CardPosition( { @required this.image, @@ -30,6 +32,7 @@ class CardPosition extends StatelessWidget { @required this.latitude, @required this.longitude, @required this.projectname , + @required this.cardSize , }); @override @@ -40,17 +43,17 @@ class CardPosition extends StatelessWidget { }, child: Container( - width:MediaQuery.of(context).size.width * 0.47,//165, - margin: EdgeInsets.fromLTRB(7.0, 7.0, 7.0, 7.0), + // width:MediaQuery.of(context).size.width * 0.47,//165, + margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 8.0), decoration: BoxDecoration(boxShadow: [ BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) ], borderRadius: BorderRadius.circular(10), color: Colors.white), child: Column( - crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + height: cardSize * 0.2 - 8, + margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0), child: Text(this.text, overflow: TextOverflow.clip, style: TextStyle( @@ -59,12 +62,14 @@ class CardPosition extends StatelessWidget { fontSize: 2 * SizeConfig.textMultiplier)), ), Container( + height: cardSize * 0.5 - 8, alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), - child: Image.asset(this.image, width: 60.0, height: 60.0), + margin: EdgeInsets.fromLTRB(0.0, 0.0, 8.0, 8.0), + child: Image.asset(this.image, width: 60.0, height: cardSize * 0.4), ), Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), + height: cardSize * 0.2 - 8, child: Text(this.subText, overflow: TextOverflow.clip, style: TextStyle( diff --git a/lib/pages/MyAppointments/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 aa3b72ae..a49149b5 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -1,4 +1,5 @@ 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'; @@ -28,6 +29,10 @@ class MyAppointments extends StatefulWidget { List(); List _patientArrivedAppointmentListHospital = List(); + List _patientBookedAppointmentListClinic = List(); + List _patientConfirmedAppointmentListClinic = List(); + List _patientArrivedAppointmentListClinic = List(); + @override _MyAppointmentsState createState() => _MyAppointmentsState(); } @@ -43,9 +48,12 @@ class _MyAppointmentsState extends State 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(); @@ -84,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(), ]), ), ); @@ -112,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(() { - isDataLoaded = true; + GifLoaderDialogUtils.hideDialog(context); + setState(() { + if (res['MessageStatus'] == 1) { + // setState(() { if (res['AppoimentAllHistoryResultList'].length != 0) { - isDataLoaded = true; + // isDataLoaded = true; res['AppoimentAllHistoryResultList'].forEach((v) { widget.appoList .add(new AppoitmentAllHistoryResultList.fromJson(v)); }); sortAppointmentList(); } else {} - }); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } + // }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + isDataLoaded = true; + }); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); @@ -166,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(); @@ -183,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(); @@ -206,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(); @@ -230,9 +345,10 @@ class _MyAppointmentsState extends State } else { widget._patientArrivedAppointmentListHospital.add( PatientAppointmentList( - filterName: element.clinicName, + filterName: element.projectName, patientDoctorAppointment: element)); } + openAppointmentsTab(); }); } @@ -247,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; } @@ -267,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(), )), ) ], @@ -322,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(), )), ) ], @@ -375,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(), ), ), ) @@ -419,4 +586,10 @@ class _MyAppointmentsState extends State ), ); } + + setFilterType(FilterType filterType) { + setState(() { + this.filterType = filterType; + }); + } } diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index a30349ba..136bd30f 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -2,13 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class ArrivedButtons { - static var buttons = [ - { - "title": TranslationBase.of(AppGlobal.context).arrived, - "subtitle": TranslationBase.of(AppGlobal.context).status, - "icon": "assets/images/new-design/waiting-room.png", - "caller": "openReschedule" - }, + var buttons = [ { "title": TranslationBase.of(AppGlobal.context).medicines, "subtitle": TranslationBase.of(AppGlobal.context).medicinesSubtitle, @@ -40,13 +34,13 @@ class ArrivedButtons { "caller": "insertComplaint" }, { - "title": TranslationBase.of(AppGlobal.context).insurance, + "title": TranslationBase.of(AppGlobal.context).insuranceApproval, "subtitle": TranslationBase.of(AppGlobal.context).insuranceSubtitle, "icon": "assets/images/new-design/insurance_approvals_icon.png", "caller": "Insurance" }, { - "title": TranslationBase.of(AppGlobal.context).askYour, + "title": TranslationBase.of(AppGlobal.context).askDoctor, "subtitle": TranslationBase.of(AppGlobal.context).askYourSubtitle, "icon": "assets/images/new-design/ask_doctor_icon.png", "caller": "askDoc" @@ -58,4 +52,4 @@ class ArrivedButtons { "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 c0399b8a..60035ee1 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -1,3 +1,4 @@ +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'; @@ -16,6 +17,7 @@ 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'; @@ -62,8 +64,8 @@ class _AppointmentActionsState extends State { toDoProvider = Provider.of(context); var size = MediaQuery.of(context).size; final double itemHeight = projectViewModel.isArabic - ? ((size.height - kToolbarHeight - 24) * 0.47) / 2 - : ((size.height - kToolbarHeight - 24) * 0.4) / 2; + ? ((size.height - kToolbarHeight - 24) * 0.5) / 2 + : ((size.height - kToolbarHeight - 24) * 0.45) / 2; final double itemWidth = size.width / 2; return Container( @@ -83,12 +85,12 @@ class _AppointmentActionsState extends State { _handleButtonClicks(e); }, child: Column( - mainAxisSize: MainAxisSize.min, + mainAxisSize: MainAxisSize.max, children: [ Container( // height: 100.0, margin: EdgeInsets.all(7.0), - padding: EdgeInsets.only(bottom: 15.0), + padding: EdgeInsets.only(bottom: 4.0), decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -100,7 +102,7 @@ class _AppointmentActionsState extends State { color: Colors.white), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, + mainAxisSize: MainAxisSize.max, children: [ Container( margin: @@ -196,6 +198,10 @@ class _AppointmentActionsState extends State { openAppointmentRadiology(); break; + case "labResult": + openAppointmentLabResults(); + break; + case "prescriptions": openPrescriptionReport(); break; @@ -270,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(() { @@ -287,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(() { @@ -304,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(() { @@ -321,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(() { @@ -338,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(() { @@ -355,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(() { @@ -391,18 +404,48 @@ class _AppointmentActionsState extends State { } getToDoCount() { - toDoProvider.setState(0); + toDoProvider.setState(0, true); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber']); + 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(); @@ -411,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); @@ -429,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); }); } @@ -458,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, @@ -612,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 1bbe471a..c4299e33 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -1,10 +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'; @@ -21,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); @@ -40,92 +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, + 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)), - ), - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDate(widget.appo.appointmentDate).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: Image.asset( - "assets/images/new-design/arrow.png", - width: 25.0, - height: 25.0), - ), - ], - ), - widget.appo.patientStatusType == AppointmentType.BOOKED ? - Container( - child: CountdownTimer( - endTime: DateTime.now().millisecondsSinceEpoch + - (widget.appo.remaniningHoursTocanPay * 1000) * - 60, - widgetBuilder: (_, CurrentRemainingTime time) { - return Text( - '${time.days}:${time.hours}:${time.min}:${time.sec} ' + - TranslationBase.of(context) - .upcomingTimeLeft, - style: TextStyle( - fontSize: 12.0, - color: Color(0xff40ACC9))); - }, + 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), ), - ) : Container(), - ], + ], + ), + (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/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 fb8990b2..1066ca15 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,15 +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'; @@ -19,9 +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 { @@ -30,6 +36,10 @@ class ToDo extends StatefulWidget { var languageID; MyInAppBrowser browser; + bool isShowAppBar = true; + + ToDo({@required this.isShowAppBar}); + @override _ToDoState createState() => _ToDoState(); } @@ -43,6 +53,9 @@ class _ToDoState extends State { List imagesInfo = List(); + ToDoCountProviderModel toDoProvider; + CountdownTimerController controller; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); @@ -55,14 +68,19 @@ class _ToDoState extends State { '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: true, + isShowAppBar: widget.isShowAppBar, + isShowDecPage: true, description: TranslationBase.of(context).infoTodo, body: SingleChildScrollView( child: Column( @@ -98,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( @@ -130,7 +156,7 @@ class _ToDoState extends State { : "-", overflow: TextOverflow.clip, maxLines: 2, - style: TextStyle(fontSize: 11.0)), + style: TextStyle(fontSize: 10.0)), ), ], ), @@ -212,17 +238,26 @@ class _ToDoState extends State { ), Container( child: CountdownTimer( - endTime: DateTime.now().millisecondsSinceEpoch + - (widget.appoList[index] - .remaniningHoursTocanPay * - 1000) * - 60, - widgetBuilder: (_, CurrentRemainingTime time) { - return Text( - '${time.days}:${time.hours}:${time.min}:${time.sec} ' + TranslationBase.of(context).upcomingTimeLeft, - style: TextStyle( - fontSize: 12.0, - color: Color(0xff40ACC9))); + 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(); }, ), ), @@ -507,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(() { @@ -516,12 +552,9 @@ class _ToDoState extends State { widget.appoList .add(new AppoitmentAllHistoryResultList.fromJson(v)); }); - } else {} - }); - widget.appoList.forEach((element) { - print(element.isLiveCareAppointment); - print(element.nextAction); - print(element.remaniningHoursTocanPay); + } else { + Navigator.of(context).popAndPushNamed(HOME); + } }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -529,7 +562,7 @@ class _ToDoState extends State { }).catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); + err != null ?? AppToast.showErrorToast(message: err); }); } diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index fe2a217b..3a0734dc 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -163,45 +163,45 @@ class _PaymentMethodState extends State { ], ), ), - // Container( - // margin: EdgeInsets.only(top: 25.0), - // child: Flex( - // direction: Axis.horizontal, - // children: [ - // Expanded( - // child: Container( - // child: InkWell( - // onTap: () { - // updateSelectedPaymentMethod("ApplePay"); - // }, - // child: Card( - // elevation: 3.0, - // margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - // color: Colors.white, - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // side: selectedPaymentMethod == "ApplePay" - // ? BorderSide( - // color: Colors.green, width: 5.0) - // : BorderSide( - // color: Colors.transparent, width: 0.0), - // ), - // child: Container( - // height: 120.0, - // padding: EdgeInsets.all(20.0), - // child: SvgPicture.asset( - // "assets/images/new-design/applepay.svg"), - // ), - // ), - // ), - // ), - // ), - // Expanded( - // child: Container(), - // ), - // ], - // ), - // ), + Container( + margin: EdgeInsets.only(top: 25.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: Container( + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("ApplePay"); + }, + child: Card( + elevation: 3.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: selectedPaymentMethod == "ApplePay" + ? BorderSide( + color: Colors.green, width: 5.0) + : BorderSide( + color: Colors.transparent, width: 0.0), + ), + child: Container( + height: 120.0, + padding: EdgeInsets.all(20.0), + child: SvgPicture.asset( + "assets/images/new-design/applepay.svg"), + ), + ), + ), + ), + ), + Expanded( + child: Container(), + ), + ], + ), + ), SizedBox( height: 150.0, ), @@ -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 38b70e23..5977e97e 100644 --- a/lib/pages/base/base_view.dart +++ b/lib/pages/base/base_view.dart @@ -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..f7f998bf 100644 --- a/lib/pages/feedback/feedback_home_page.dart +++ b/lib/pages/feedback/feedback_home_page.dart @@ -73,8 +73,7 @@ class _FeedbackHomePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Theme.of(context).primaryColor, + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 14463825..aded1a3b 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -3,10 +3,12 @@ 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'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; @@ -14,7 +16,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 +34,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 +93,6 @@ class _SendFeedbackPageState extends State { child: Texts( TranslationBase.of(context).likeToHear, textAlign: TextAlign.center, - variant: 'body2Link', ), ), InkWell( @@ -75,9 +112,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 +127,7 @@ class _SendFeedbackPageState extends State { ), ), ), - if (appointHistory != null && model.messageType == + if (appointHistory != null && messageType == MessageType.ComplaintOnAnAppointment) InkWell( onTap: () { @@ -167,12 +203,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 +319,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 +337,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 +345,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 +410,7 @@ class _SendFeedbackPageState extends State { ), )), SizedBox( - height: 30, + height: 45, ), ], ), @@ -384,27 +418,26 @@ class _SendFeedbackPageState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.13, + height: MediaQuery.of(context).size.height * 0.09, width: double.infinity, - padding: EdgeInsets.all(8.0), + padding: EdgeInsets.all(15.0), child: Center( child: Container( - height: MediaQuery.of(context).size.height * 0.1, - width: MediaQuery.of(context).size.width * 0.8, - child: Button( + height: MediaQuery.of(context).size.height * 0.8, + child: SecondaryButton( label: TranslationBase.of(context).send, - loading: model.state == ViewState.BusyLocal, + disabled: (titleController.text.toString().isEmpty || messageController.text.toString().isEmpty|| messageType == MessageType.NON), onTap: () { final form = formKey.currentState; - if (form.validate()) if (model.messageType != MessageType.NON) - model - .sendCOCItem( + if (form.validate()) + if (messageType != MessageType.NON){ + GifLoaderDialogUtils.showMyDialog(context); + model.sendCOCItem( title: titleController.text, attachment: images.length > 0 ? images[0] : "", details: messageController.text, - cOCTypeName: getCOCName(model), - appointHistory: model.messageType == - MessageType.ComplaintOnAnAppointment + cOCTypeName: getCOCName(), + appointHistory:messageType == MessageType.ComplaintOnAnAppointment ? appointHistory : null) .then((value) { @@ -414,13 +447,15 @@ class _SendFeedbackPageState extends State { messageController.text = ""; images = []; }); - model.setMessageType(MessageType.NON); + setMessageType(MessageType.NON); + GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast( message: TranslationBase.of(context).yourFeedback); } else { AppToast.showErrorToast(message: model.error); + GifLoaderDialogUtils.hideDialog(context); } - }); + });} else { AppToast.showErrorToast(message: TranslationBase.of(context).selectPart); } @@ -433,8 +468,8 @@ class _SendFeedbackPageState extends State { ); } - String getCOCName(FeedbackViewModel model) { - switch (model.messageType) { + String getCOCName() { + switch (messageType) { case MessageType.ComplaintOnAnAppointment: return "1"; break; @@ -462,15 +497,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 +516,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 +561,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 +585,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 +610,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 +634,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 +658,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 +713,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/final_products_page.dart b/lib/pages/final_products_page.dart new file mode 100644 index 00000000..03adee97 --- /dev/null +++ b/lib/pages/final_products_page.dart @@ -0,0 +1,480 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.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'; + +import 'base/base_view.dart'; + +class FinalProductsPage extends StatefulWidget { + String id; + FinalProductsPage({this.id}); + @override + _FinalProductsPageState createState() => _FinalProductsPageState(id: id); +} + +class _FinalProductsPageState extends State { + String id; + _FinalProductsPageState({this.id}); + String categoriseName = "Personal Care"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getFinalProducts(i: id), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: 'Products', + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: Container( + height: MediaQuery.of(context).size.height * 5.87, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ +//Expanded widget heree if nassery + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts( + 'Products', + fontWeight: FontWeight.w600, + ), + ), + 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 + ? Expanded( + child: Container( + height: MediaQuery.of(context).size.height * 3.90, + child: GridView.builder( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.finalProducts.length, + itemBuilder: (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.finalProducts[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: [ + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.finalProducts[index] + .images.isNotEmpty + ? model + .finalProducts[ + 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 + .finalProducts[ + index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 2.8 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(6)), + ), + child: Texts( + model.finalProducts[index] + .rxMessage != + null + ? model + .finalProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w600, + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + if (model + .finalProducts[ + index] + .discountName != + null) + Container( + width: double.infinity, + height: 13.0, + decoration: + BoxDecoration( + color: + Color(0xff5AB145), + ), + child: Center( + child: Texts( + model + .finalProducts[ + index] + .discountName, + regular: true, + color: Colors.white, + fontSize: 10.4, + ), + ), + ), + Texts( + model.finalProducts[index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w400, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .finalProducts[ + index] + .approvedRatingSum > + 0 + ? (model.finalProducts[index].approvedRatingSum + .toDouble() / + model + .finalProducts[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + )); + }, + ), + ), + ) + : Expanded( + child: Container( + height: MediaQuery.of(context).size.height * 5.0, + child: ListView.builder( + itemCount: model.finalProducts.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.finalProducts[index] + .images.isNotEmpty + ? model + .finalProducts[ + 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 + .finalProducts[ + index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 3.5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(6)), + ), + child: Texts( + model.finalProducts[index] + .rxMessage != + null + ? model + .finalProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w600, + ), + ), + ], + ), + ], + ), + Container( + height: 100.0, + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + height: 35.0, + width: 250.0, + child: Texts( + model.finalProducts[index] + .name, + regular: true, + fontSize: 13.2, + fontWeight: FontWeight.w500, + maxLines: 2, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .finalProducts[ + index] + .approvedRatingSum > + 0 + ? (model + .finalProducts[ + index] + .approvedRatingSum + .toDouble() / + model + .finalProducts[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ); + }), + ), + ) + ], + ), + ), + )); + } +} 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 d21e06a5..d81e704e 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -63,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: 60, - height: 35, + height: 40, decoration: BoxDecoration( 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, ), )) ], @@ -138,22 +135,18 @@ class _InsuranceApprovalState extends State { 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, ), ], ), @@ -166,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, + ), + Texts( + model.insuranceApproval[index].unUsedCount.toString(), fontSize: 17.5, - fontWeight: FontWeight.w600), + fontWeight: FontWeight.w600, + ), + ], ), Divider( color: Colors.black, @@ -223,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( @@ -237,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 5f8c6777..42efc179 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -20,18 +20,23 @@ import '../base/base_view.dart'; class InsuranceCard extends StatefulWidget { int appointmentNo; - InsuranceCard({this.appointmentNo}); @override _InsuranceCardState createState() => _InsuranceCardState(); } + 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')); + 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(), @@ -39,7 +44,6 @@ class _InsuranceCardState extends State { 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, @@ -79,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: [ @@ -96,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, @@ -103,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( @@ -151,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, @@ -160,8 +182,6 @@ class _InsuranceCardState extends State { ], ), ), - - ], ), ], @@ -191,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 1a8b8637..87afb17f 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -1,11 +1,8 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_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/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_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'; @@ -25,6 +22,8 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import 'landing_page_pharmcy.dart'; + class HomePage extends StatefulWidget { final Function goToMyProfile; @@ -35,18 +34,6 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - ToDoCountProviderModel toDoProvider; - - @override - // void initState() { - // WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - // getToDoCount(); - // }); - // super.initState(); - // } - AuthenticatedUserObject authenticatedUserObject = - locator(); - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -54,7 +41,6 @@ class _HomePageState extends State { onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( isShowDecPage: false, - isHelp: true, body: Container( width: double.infinity, child: SingleChildScrollView( @@ -82,12 +68,12 @@ 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( child: Container( - height: 120, + height: 125, padding: EdgeInsets.all(5), margin: EdgeInsets.all(5), decoration: BoxDecoration( @@ -97,78 +83,54 @@ 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( - margin: EdgeInsets.only(top: 10.0), + child: Column( children: [ - Text("COVID-19 TEST", - style: TextStyle( - color: Colors.white, - fontWeight: - FontWeight.bold, - fontSize: 18.0)), + Texts(TranslationBase.of(context).covidTest, + color: Colors.white, + fontWeight: FontWeight.w700, + ), Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Container( margin: EdgeInsets.only( - top: 15.0, - left: 3.5, - right: 3.5), + top: 15.0,), child: SvgPicture.asset( 'assets/images/new-design/covid-19-car.svg', width: 45.0, height: 45.0), ), Container( - margin: EdgeInsets.only( - left: 10.0, - top: 10.0), + margin: EdgeInsets.only(top: 5.0), child: Column( children: [ - Text("Drive-Thru", - style: TextStyle( - color: Colors - .white, - fontWeight: - FontWeight - .bold, - fontSize: - 16.0)), + Texts(TranslationBase.of(context).driveThru, + fontWeight: FontWeight.w700, + color: Colors.white,), ButtonTheme( - shape: - RoundedRectangleBorder( + shape: RoundedRectangleBorder( borderRadius: - BorderRadius - .circular( - 5.0), - ), - minWidth: MediaQuery.of( - context) - .size - .width * - 0.15, + BorderRadius.circular(5.0),), + minWidth: MediaQuery.of(context).size.width * 0.15, height: 25.0, child: RaisedButton( - color: Colors - .red[800], - textColor: - Colors.white, - disabledTextColor: - Colors.white, - disabledColor: - new Color( - 0xFFbcc2c4), + color: Colors.red[800], + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), onPressed: () { navigateToCovidDriveThru(); }, - child: Text( - "BOOK NOW", - style: TextStyle( - fontSize: - 12.0)), + child: Texts( + TranslationBase.of(context).bookNow, + fontWeight: FontWeight.w700, + color: Colors.white, + ), ), ), ], @@ -186,7 +148,7 @@ class _HomePageState extends State { onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())), child: Container( - height: 120, + height: 125, padding: EdgeInsets.all(15), margin: EdgeInsets.all(5), decoration: BoxDecoration( @@ -209,367 +171,360 @@ class _HomePageState extends State { ], ), ), - Container(width: double.infinity, height: 80) + Container(width: double.infinity, height:projectViewModel.isArabic ?110: 80) ], ), Positioned( 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) + child: (!model.isLogin) ? 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: 2, + ), + Texts( + TranslationBase.of(context).myMedicalFile, + color: Colors.black87, + fontWeight: FontWeight.w700, + fontSize: 23, + ), + + Texts( + TranslationBase.of(context) + .myMedicalFileSubTitle, + color: Colors.black, + fontSize: 16, + ), + Align( + alignment: projectViewModel.isArabic + ? Alignment.bottomLeft + : Alignment.bottomRight, + child: InkWell( + onTap: () { + widget.goToMyProfile(); + }, + child: Container( + margin: EdgeInsets.only(left: 15,right: 15), + 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(0)), ), - Texts( - TranslationBase.of(context) - .myMedicalFileSubTitle, - color: Colors.black, - fontSize: 16, + child: Center( + child: Texts( + TranslationBase.of(context).viewMore, + color: Colors.white, + fontWeight: FontWeight.w700, + 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: projectViewModel.isArabic ? 160: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 (projectViewModel.user != null && model.isLogin) + 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( + children: [ + Expanded( + child: Row( 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, + fontSize: 17, ) ], ), - Row( - //crossAxisAlignment: CrossAxisAlignment.center, - //mainAxisAlignment: MainAxisAlignment.spaceAround, + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( 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, + fontSize: 17 + ) + ], + ), + ), + 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, + ) ], - ) - ], - ), - ), - ), + ), + ), + ], + ) + ], + ), + ), + ), ), ], ), 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: 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, + 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, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, + ) + ], ), - 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, - ), - if(projectViewModel.havePrivilege(65)) - DashboardItem( - //onTap: () => Navigator.push(context, FadePage(page: PharmacyPage())), + 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, + 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, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, + ) + ], ), - 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', - ), - if(projectViewModel.havePrivilege(67)) - 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: CMCPage(), ), - 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, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, + ) + ], ), - 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, ), @@ -646,47 +601,47 @@ class _HomePageState extends State { color: Colors.white, )), 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, - ) - ], + 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 +727,7 @@ class _HomePageState extends State { ], ), ), - height: 106, + height: 100, imageName: 'contact_us_bg.png', opacity: 0.5, color: Colors.grey[700], @@ -801,15 +756,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; @@ -827,16 +782,14 @@ class DashboardItem extends StatelessWidget { onTap: onTap, child: Container( width: width != null ? width : MediaQuery.of(context).size.width * 0.29, - height: height != null - ? height - : MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.19 - : MediaQuery.of(context).size.height * 0.35, + height: height != null ? height : MediaQuery.of(context).orientation == Orientation.portrait + ? MediaQuery.of(context).size.height * 0.17 + : MediaQuery.of(context).size.height * 0.35, decoration: BoxDecoration( color: !hasBorder ? color != null - ? color - : HexColor('#050705').withOpacity(opacity) + ? color + : HexColor('#050705').withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), border: hasBorder @@ -844,13 +797,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_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart new file mode 100644 index 00000000..fda83fc2 --- /dev/null +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -0,0 +1,175 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/parent_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy_categorise.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: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'; + +class LandingPagePharmacy extends StatefulWidget { + @override + _LandingPagePharmacyState createState() => _LandingPagePharmacyState(); +} + +class _LandingPagePharmacyState extends State { + int currentTab = 0; + PageController pageController; + ProjectViewModel projectProvider; + + _changeCurrentTab(int tab) { + setState(() { + currentTab = tab; + pageController.jumpToPage(tab); + }); + } + + void initState() { + super.initState(); + pageController = PageController(keepPage: true); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: currentTab == 0 || currentTab == 1 + ? AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + title: Container( + height: MediaQuery.of(context).size.height * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, + ), + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchProductsPage()), + ); + }, + ), + ), + leading: Builder( + builder: (BuildContext context) { + return InkWell( + onTap: (){ + setState(() { + currentTab = 0; + pageController.jumpToPage(0); + }); + }, + child: Container( + height: 2.0, + width: 10.0, + child: Image.asset( + 'assets/images/pharmacy_logo.png', + ), + ), + ); + }, + ), + actions: [ + // IconButton( + // iconSize: 70, + // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // height: 100, width: 100, fit: BoxFit.cover), + // onPressed: () { + // triggerRobot(); + // } //do something, + // ) + ], + centerTitle: true, + ) + : currentTab == 4 + ? null + : AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + textTheme: TextTheme( + headline6: TextStyle( + color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text(getText(currentTab).toUpperCase()), + leading: Builder( + builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back), + color: Colors.white, + onPressed: () => Scaffold.of(context).openDrawer(), + ); + }, + ), + actions: [ + // IconButton( + // iconSize: 70, + // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // height: 100, width: 100, fit: BoxFit.cover), + // onPressed: () { + // triggerRobot(); + // } //do something, + // ) + ], + centerTitle: true, + ), + extendBody: false, + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + // TODO mosa_comeback + PharmacyPage(), + PharmacyCategorisePage(), +// OffersCategorisePage(), + WishlistPage(), + PharmacyProfilePage(), +// Container( +// child: Text('text'), +// ), + CartOrderPage(), + ], // Please do not remove the BookingOptions from this array + ), + bottomNavigationBar: BottomNavPharmacyBar( + changeIndex: _changeCurrentTab, + index: currentTab, + ), + ); + } + + getText(currentTab) { + switch (currentTab) { + case 2: + return 'Wishlist'; + case 3: + return 'My Account'; + case 4: + return 'Shopping Cart'; + } + } +} diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index 3243b269..fc5c4eab 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -3,11 +3,12 @@ import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePendingReque import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/livecare_logs.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.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:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +import 'livecare_type_select.dart'; class LiveCareHome extends StatefulWidget { static bool showFooterButton = true; @@ -92,37 +93,40 @@ class _LiveCareHomeState extends State hasLiveCareRequest = false; }); LiveCareService service = new LiveCareService(); - GifLoaderDialogUtils.showMyDialog(context); PatientERVirtualHistoryResponse patientERVirtualHistoryResponse = new PatientERVirtualHistoryResponse(); - service.getLivecareHistory(context).then((res) { - GifLoaderDialogUtils.hideDialog(context); - setState(() { - print(res['ErRequestHistoryList'].length); - if (res['ErRequestHistoryList'].length != 0) { - patientERVirtualHistoryResponse = - PatientERVirtualHistoryResponse.fromJson(res); - erRequestHistoryList = - patientERVirtualHistoryResponse.erRequestHistoryList; + service + .getLivecareHistory(context) + .then((res) { + setState(() { + print(res['ErRequestHistoryList'].length); + if (res['ErRequestHistoryList'].length != 0) { + patientERVirtualHistoryResponse = + PatientERVirtualHistoryResponse.fromJson(res); + erRequestHistoryList = + patientERVirtualHistoryResponse.erRequestHistoryList; - if (patientERVirtualHistoryResponse - .erRequestHistoryList[0].callStatus < - 4) { - pendingERRequestHistoryList = - patientERVirtualHistoryResponse.erRequestHistoryList[0]; - hasLiveCareRequest = true; - } else { - hasLiveCareRequest = false; - } - } - }); - setState(() { - isDataLoaded = true; - }); - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); - print(err); - }); + if (patientERVirtualHistoryResponse + .erRequestHistoryList[0].callStatus < + 4) { + pendingERRequestHistoryList = + patientERVirtualHistoryResponse.erRequestHistoryList[0]; + hasLiveCareRequest = true; + } else { + hasLiveCareRequest = false; + } + } + }); + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + setState(() { + isDataLoaded = true; + }); + }); } } diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index e80f79ee..25ec8514 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -5,11 +5,11 @@ import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.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/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class LiveCareHistoryCard extends StatefulWidget { ErRequestHistoryList erRequestHistoryList; @@ -177,7 +177,6 @@ class _LiveCareHistoryCardState extends State { sendInvoiceEmail(context) { ConfirmDialog.closeAlertDialog(context); LiveCareService service = new LiveCareService(); - GifLoaderDialogUtils.showMyDialog(context); service .sendLiveCareInvoiceEmail( widget.erRequestHistoryList.appointmentNo.toString(), @@ -185,13 +184,12 @@ class _LiveCareHistoryCardState extends State { authUser.emailAddress, context) .then((res) { - GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: "LiveCare invoice sent successfully"); }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); print(err); - }); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getAuthenticatedUser() async { diff --git a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart index 7ce39804..bfd42e62 100644 --- a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart +++ b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart @@ -3,9 +3,9 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryR import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.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:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class LiveCarePendingRequest extends StatefulWidget { ErRequestHistoryList pendingERRequestHistoryList; @@ -149,19 +149,19 @@ class _LiveCarePendingRequestState extends State { cancelLiveCareRequest() { LiveCareService service = new LiveCareService(); - GifLoaderDialogUtils.showMyDialog(context); service .cancelLiveCareRequest(widget.pendingERRequestHistoryList.vCID, context) .then((res) { - GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast( message: "LiveCare request cancelled successfully"); - widget.getLiveCareHistory(); }) .catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + widget.getLiveCareHistory(); }); } } diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index 410b7170..56613034 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -2,8 +2,8 @@ import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsRespon import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'ClinicTimingsDialog.dart'; @@ -90,11 +90,9 @@ class _State extends State { getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) { LiveCareService service = new LiveCareService(); - GifLoaderDialogUtils.showMyDialog(context); service .getLivecareClinicTiming(patientERGetClinicsList.serviceID, context) .then((res) { - GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { clinicsServiceTimingsResponse = @@ -131,9 +129,8 @@ class _State 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)); } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 2b02540b..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,6 +24,7 @@ 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'; @@ -74,6 +79,8 @@ class _ConfirmLogin extends State { locator(); ProjectViewModel projectViewModel; + ToDoCountProviderModel toDoProvider; + @override void initState() { _getAvailableBiometrics(); @@ -84,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, @@ -95,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( @@ -352,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); @@ -379,55 +395,34 @@ class _ConfirmLogin extends State { } getMobileInfo(request) { - 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; - }), - - //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); }); } - setUser() async {} - setDefault() async { if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson( @@ -515,8 +510,8 @@ class _ConfirmLogin extends State { .then((result) => { if (result is Map) { - projectViewModel.setPrivilege(privilegeList: result), - result = CheckActivationCode.fromJson(result), + projectViewModel.setPrivilege(privilegeList: result), + result = CheckActivationCode.fromJson(result), if (this.registerd_data != null && this.registerd_data.isRegister == true) { @@ -529,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, @@ -549,6 +546,9 @@ class _ConfirmLogin extends State { .catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: err); + }); }); } @@ -569,11 +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) { @@ -588,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( @@ -614,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: [ @@ -626,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, ) ], ), @@ -641,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( @@ -670,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: [ @@ -705,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( @@ -719,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, diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index dcd58b9d..69a66d9e 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/logo.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 cc1a0350..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,14 +92,12 @@ class _Login extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - MobileNo( - onNumberChange: (value) => - {mobileNo = value, validateForm()}, - onCountryChange: (value) => countryCode = value), + 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()}, @@ -153,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; }); } } @@ -240,23 +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), - projectViewModel.setPrivilege(privilegeList: result), - 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) { @@ -280,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 9245d6c3..131db748 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -72,113 +72,113 @@ class _Register extends State { onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - Directionality( - textDirection:TextDirection.ltr,child: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 { @@ -216,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, @@ -224,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); - }); } @@ -257,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'], @@ -308,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/login/welcome.dart b/lib/pages/login/welcome.dart index 419df302..4b8e90ae 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -36,7 +37,7 @@ class _WelcomeLogin extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset('assets/images/DQ/dq_logo_icon.png', + Image.asset('assets/images/DQ/logo.png', height: 90, width: 90), Text( TranslationBase.of(context).welcome, @@ -75,7 +76,7 @@ class _WelcomeLogin extends State { LOGIN_TYPE, ), }, - color: Color(0xFF40ACC9), + color: Color(0xFFc5272c), textColor: Colors.white, )) ], 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/ask_doctor/ask_doctor_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_page.dart index e6172b7a..6beed0dc 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_page.dart @@ -1,5 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/ask_doctor/request_type.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -10,6 +12,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class AskDoctorPage extends StatelessWidget { @override diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 85a0cc8f..fce664f7 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -20,6 +20,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:smart_progress_bar/smart_progress_bar.dart'; import '../../../core/model/my_balance/AdvanceModel.dart'; import 'confirm_payment_page.dart'; @@ -214,6 +215,7 @@ class _AdvancePaymentPageState extends State { SizedBox( height: 12, ), + if(model.user!=null) NewTextFields( hintText: TranslationBase.of(context).depositorEmail, initialValue: model.user.emailAddress, @@ -236,15 +238,13 @@ class _AdvancePaymentPageState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, - padding: EdgeInsets.all(12), + padding: EdgeInsets.all(18), child: SecondaryButton( textColor: Colors.white, label: TranslationBase.of(context).submit, - disabled: amount.isEmpty || - _fileTextController.text.isEmpty || - _selectedHospital == null, + disabled: amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null, onTap: () { var mobileNum; var patientName; diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 679a16db..8a69bf5d 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -156,11 +156,12 @@ 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: () { 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/SelectBeneficiaryDialog.dart b/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart index b004bc38..d7ce3fac 100644 --- a/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../Constants.dart'; import '../advance_payment_page.dart'; class SelectBeneficiaryDialog extends StatefulWidget { @@ -45,7 +46,7 @@ class _SelectBeneficiaryDialogState extends State { leading: Radio( value: BeneficiaryType.MyAccount, groupValue: beneficiaryType, - activeColor: Color(0xFF40ACC9), + activeColor: secondaryColor, onChanged: (BeneficiaryType value) { setState(() { beneficiaryType = value; diff --git a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart b/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart index 42bd66b7..a9a4fea2 100644 --- a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart @@ -4,6 +4,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../Constants.dart'; + class SelectHospitalDialog extends StatefulWidget { final List hospitals; final Function(HospitalsModel) onValueSelected; @@ -54,7 +56,7 @@ class _SelectHospitalDialogState extends State { leading: Radio( value: widget.hospitals[index], groupValue: widget.selectedHospital, - activeColor: Color(0xFF40ACC9), + activeColor: secondaryColor, onChanged: (value) { setState(() { widget.selectedHospital = value; diff --git a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart index 7d69f084..ab2b48d5 100644 --- a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart @@ -4,6 +4,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../Constants.dart'; + class SelectPatientFamilyDialog extends StatefulWidget { final List getAllSharedRecordsByStatusList; final Function(GetAllSharedRecordsByStatusList) onValueSelected; @@ -35,11 +37,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( @@ -55,7 +55,7 @@ class _SelectPatientFamilyDialogState extends State { leading: Radio( value: widget.getAllSharedRecordsByStatusList[index], groupValue: widget.selectedPatientFamily, - activeColor: Colors.red[800], + activeColor: secondaryColor, onChanged: (value) { setState(() { widget.selectedPatientFamily = value; @@ -67,8 +67,6 @@ class _SelectPatientFamilyDialogState extends State { ) ], ), - if(widget.getAllSharedRecordsByStatusList[index].status==3) - SizedBox( height: 5.0, ), diff --git a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart index bea4f694..3cce8e61 100644 --- a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart @@ -6,6 +6,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../Constants.dart'; + class SelectPatientInfoDialog extends StatefulWidget { final List patientInfoList ; final Function(PatientInfo) onValueSelected; @@ -55,7 +57,7 @@ class _SelectPatientInfoDialogState extends State { leading: Radio( value: widget.patientInfoList[index], groupValue: widget.selectedPatientInfo, - activeColor: Colors.red[800], + activeColor: secondaryColor, onChanged: (value) { setState(() { widget.selectedPatientInfo = value; diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index 2fb8c51c..1edbcbf6 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -27,54 +27,26 @@ class MyBalancePage extends StatelessWidget { appBarTitle: TranslationBase.of(context).myBalances, imagesInfo: imagesInfo, description: TranslationBase.of(context).infoMyBalance, - 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), + 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} '+ TranslationBase.of(context).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), ), @@ -83,20 +55,53 @@ class MyBalancePage extends StatelessWidget { children: [ Texts( - '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} '+TranslationBase.of(context).sar, + '${model.totalAdvanceBalanceAmount ?? 0} '+ TranslationBase.of(context).sar, + color: Colors.white, bold: true, ), - Texts(model.patientAdvanceBalanceAmountList[index] - .projectDescription), + 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 6a03b58b..c8fad3ce 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -48,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); }, @@ -65,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/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 18cc9b77..bce778b8 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -74,8 +74,7 @@ class _EyeHomePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 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 9b1f5a26..a251a1ce 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -1,37 +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/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/laboratory_result_widget.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: 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 4b412f5b..ce78a7dc 100644 --- a/lib/pages/medical/labs/labs_home_page.dart +++ b/lib/pages/medical/labs/labs_home_page.dart @@ -1,6 +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'; @@ -10,6 +11,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'; import 'laboratory_result_page.dart'; @@ -18,6 +20,7 @@ class LabsHomePage extends StatelessWidget { @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(), @@ -45,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); }, @@ -62,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), ), @@ -91,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 73e60ce6..f56fce76 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'; @@ -21,6 +24,8 @@ 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'; @@ -29,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'; diff --git a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart index 8e6f808c..9bd89a2c 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart @@ -70,7 +70,7 @@ class _WeightHomePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, + indicatorSize: TabBarIndicatorSize.tab, indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index d2bcde47..de8bb509 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -73,8 +73,7 @@ class _BloodPressureHomePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 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..71df9a3a 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 @@ -74,8 +74,7 @@ class _BloodSugarHomePageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.only(top: 4.0, left: 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 4d561d60..196b5d79 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -1,11 +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 @@ -14,9 +19,18 @@ 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) { - 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')); + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getSickLeave(), builder: (_, model, w) => AppScaffold( @@ -31,23 +45,15 @@ class _PatientSickLeavePageState extends State { 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); }, ), ), @@ -55,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 f70810dd..6fb07f68 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -13,6 +13,7 @@ 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; @@ -33,120 +34,154 @@ 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: [ @@ -156,25 +191,41 @@ class PrescriptionItemsPage extends StatelessWidget { 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 94484340..380d6284 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -11,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(); @@ -69,12 +71,12 @@ class _HomePrescriptionsPageState extends State child: Container( height: 60.0, margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.of(context).size.width * 0.92, decoration: BoxDecoration( border: Border( bottom: BorderSide( color: Theme.of(context).dividerColor, - width: 0.7), + width: 0.9), //width: 0.7 ), color: Colors.white), child: Center( @@ -82,11 +84,10 @@ class _HomePrescriptionsPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Colors.red[800], + indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( 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 f7648aad..742e3ddf 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -1,3 +1,4 @@ +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'; @@ -5,6 +6,8 @@ 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'; @@ -30,50 +33,81 @@ class RadiologyDetailsPage extends StatelessWidget { baseViewModel: model, body: SingleChildScrollView( child: Column( + mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( + 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: (projectViewModel.havePrivilege(9) || - projectViewModel.havePrivilege(8)) + projectViewModel.havePrivilege(8)) ? Container( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.2, - color: Colors.grey[100], - child: Column( - children: [ - Divider(), - if (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: () => model.sendRadReportEmail( - finalRadiology: finalRadiology), - label: TranslationBase.of(context).sendCopyRad, - loading: model.state == ViewState.BusyLocal, - backgroundColor: Theme.of(context).primaryColor, - ), - ) - ], + width: double.infinity, + 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: () { + showConfirmMessage( + finalRadiology: finalRadiology, model: model); + }, + label: TranslationBase.of(context).sendCopyRad, + loading: model.state == ViewState.BusyLocal, + backgroundColor: Theme.of(context).primaryColor, ), ) - : Container()), + ], + ), + ):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 ebc3527d..2123172a 100644 --- a/lib/pages/medical/radiology/radiology_home_page.dart +++ b/lib/pages/medical/radiology/radiology_home_page.dart @@ -1,6 +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'; @@ -11,11 +12,13 @@ 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( @@ -43,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); }, @@ -61,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); }, @@ -91,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/monthly_reports.dart b/lib/pages/medical/reports/monthly_reports.dart index ae9cc295..4484bd5f 100644 --- a/lib/pages/medical/reports/monthly_reports.dart +++ b/lib/pages/medical/reports/monthly_reports.dart @@ -2,10 +2,12 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/user_agreement_page.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/custom_switch.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -19,6 +21,8 @@ class MonthlyReportsPage extends StatefulWidget { class _MonthlyReportsPageState extends State { bool isAgree = false; bool isSummary = false; + String email = ""; + final formKey = GlobalKey(); @override Widget build(BuildContext context) { @@ -29,135 +33,161 @@ class _MonthlyReportsPageState extends State { body: SingleChildScrollView( child: Container( padding: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(9), - height: 55, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(8)), - shape: BoxShape.rectangle, - border: Border.all(color: Colors.grey)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).patientHealthSummaryReport, - bold: true, - ), - CustomSwitch( - value: isSummary, - activeColor: Colors.red, - inactiveColor: Colors.grey, - onChanged: () async { - setState(() { - isSummary = !isSummary; - }); - }, - ) - ], + child: Form( + key: formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(9), + height: 55, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(8)), + shape: BoxShape.rectangle, + border: Border.all(color: Colors.grey)), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + Texts( + TranslationBase.of(context).patientHealthSummaryReport, + bold: true, + ), + CustomSwitch( + value: isSummary, + activeColor: Colors.red, + inactiveColor: Colors.grey, + onChanged: () async { + setState(() { + isSummary = !isSummary; + }); + if(!isSummary) { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePatientHealthSummaryReport( + message: TranslationBase + .of(context) + .updateSuccessfully, isSummary: isSummary); + GifLoaderDialogUtils.hideDialog(context); + } + }, + ) + ], + ), ), - ), - SizedBox( - height: 15, - ), - Container( - margin: EdgeInsets.all(8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - model.user.emailAddress, - bold: true, - ), - ], + SizedBox( + height: 15, ), - ), - Divider( - height: 10.4, - thickness: 1.0, - ), - SizedBox( - height: 15, - ), - Container( - margin: EdgeInsets.all(8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + Container( + margin: EdgeInsets.all(8), + child: TextFields( + fillColor: Colors.red, + hintText: 'email@email.com', + fontSize: 20, + initialValue: model.user.emailAddress, + fontWeight: FontWeight.w600, + onChanged: (text) { + email = text; + }, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context).enterEmail; + else + return null; + }, + ), + ), + Divider( + height: 10.4, + thickness: 1.0, + ), + SizedBox( + height: 15, + ), + Container( + margin: EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Texts(TranslationBase.of(context) + .toViewTheTermsAndConditions), + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: UserAgreementContent(), + ), + ); + }, + child: Texts( + TranslationBase.of(context).clickHere, + color: Colors.blue, + ), + ) + ], + ), + ), + SizedBox( + height: 5, + ), + Row( crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: Texts(TranslationBase.of(context) - .toViewTheTermsAndConditions), - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: UserAgreementContent(), - ), - ); + Checkbox( + value: isAgree, + onChanged: (value) { + setState(() { + isAgree = !isAgree; + }); }, - child: Texts( - TranslationBase.of(context).clickHere, - color: Colors.blue, - ), - ) + activeColor: Colors.red, + ), + Texts(TranslationBase.of(context).iAgreeToTheTermsAndConditions), ], ), - ), - SizedBox( - height: 5, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Checkbox( - value: isAgree, - onChanged: (value) { - setState(() { - isAgree = !isAgree; - }); + Container( + margin: EdgeInsets.all(8), + width: double.infinity, + child: SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).save, + disabled: (!isAgree || !isSummary ), + onTap: () async { + final form = formKey.currentState; + if (form.validate()) { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePatientHealthSummaryReport( + message: TranslationBase + .of(context) + .updateSuccessfully, + isSummary: isSummary, + isUpdateEmail: true, + email: email.isNotEmpty ? email : model.user + .emailAddress); + GifLoaderDialogUtils.hideDialog(context); + } }, - activeColor: Colors.red, ), - Texts(TranslationBase.of(context) - .iAgreeToTheTermsAndConditions), - ], - ), - Container( - margin: EdgeInsets.all(8), - width: double.infinity, - child: SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).save, - disabled: !isAgree, - loading: model.state == ViewState.BusyLocal, - onTap: () { - model.updatePatientHealthSummaryReport( - message: TranslationBase.of(context) - .updateSuccessfully, - isSummary: isSummary); - }, ), - ), - Padding( - padding: const EdgeInsets.all(5.0), - child: Texts( - TranslationBase.of(context) - .iAgreeToTheTermsAndConditionsSubtitle, - fontWeight: FontWeight.normal, + Padding( + padding: const EdgeInsets.all(5.0), + child: Texts( + TranslationBase.of(context) + .instructionAgree, + fontWeight: FontWeight.normal, + ), + ), + SizedBox( + height: 12, ), - ), - SizedBox( - height: 12, - ), - Center(child: Image.asset('assets/images/report.jpg')) - ], + Center(child: Image.asset('assets/images/report.jpg')) + ], + ), ), ), ), diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 42f207da..42dcf40a 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -40,14 +40,27 @@ 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')); + 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, imagesInfo: imagesInfo, @@ -88,33 +101,34 @@ class _HomeReportPageState extends State isScrollable: true, controller: _tabController, indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Theme.of(context).primaryColor, + indicatorSize: TabBarIndicatorSize.tab, 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(TranslationBase.of(context).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(TranslationBase.of(context).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(TranslationBase.of(context).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(TranslationBase.of(context).cancelled), + child: + Texts(TranslationBase.of(context).cancelled,fontSize: 11,), ), ), ], @@ -127,6 +141,7 @@ class _HomeReportPageState extends State ), body: Column( children: [ + if(model.user!=null) Expanded( child: TabBarView( physics: BouncingScrollPhysics(), @@ -134,20 +149,26 @@ 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: projectViewModel.havePrivilege(21) ?Container( 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 1a5270f8..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 @@ -3,9 +3,9 @@ import 'dart:io'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/health_data_list.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:url_launcher/url_launcher.dart'; class SmartWatchInstructions extends StatefulWidget { @@ -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: @@ -811,9 +796,7 @@ class _SmartWatchInstructionsState extends State { getLastPatientRecord(BuildContext context) { SmartWatchIntegrationService service = new SmartWatchIntegrationService(); - GifLoaderDialogUtils.showMyDialog(context); service.getLastPatientRecord(context).then((res) { - GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { print(res['Med_GetPatientLastRecordList']); setState(() { @@ -824,9 +807,9 @@ class _SmartWatchInstructionsState extends State { }); } else {} }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); print(err); - }); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } _openHealthDataList() { 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 c4273a09..4d141b5f 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart @@ -17,7 +17,8 @@ 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(); @@ -27,9 +28,9 @@ class VitalSignDetailsScreen extends StatelessWidget { 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, @@ -43,7 +44,7 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () => Navigator.push( + onTap: () =>isNotOneAppointment? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -52,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( @@ -76,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, ), ), ], @@ -93,7 +86,7 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () => Navigator.push( + onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -103,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( @@ -124,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, ), ), @@ -141,7 +130,7 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () => Navigator.push( + onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( page: VitalSignItemDetailsScreen( @@ -150,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( @@ -173,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, ), ), @@ -191,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 5304bb9b..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,9 +76,9 @@ class VitalSignItem extends StatelessWidget { text: TextSpan( style: TextStyle(color: Colors.black), children: [ - TextSpan(text: lastVal + " "), + TextSpan(text: lastVal), TextSpan( - text: " " + unit, + text: unit, style: TextStyle( 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/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart new file mode 100644 index 00000000..782ea018 --- /dev/null +++ b/lib/pages/offers_categorise_page.dart @@ -0,0 +1,620 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/offers_Categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import 'base/base_view.dart'; + +class OffersCategorisePage extends StatefulWidget { + @override + _OffersCategorisePageState createState() => _OffersCategorisePageState(); +} + +class _OffersCategorisePageState extends State { + String categoriseName = "Personal Care"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getOffersCategorise(), + builder: (BuildContext context, OffersCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: 'Offers', + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: Container( + //height: MediaQuery.of(context).size.height * 0.57, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts( + 'Categories', + fontWeight: FontWeight.w800, + ), + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + //Expanded widget heree if nassery + Container( + height: MediaQuery.of(context).size.height * 0.20, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.categorise.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + InkWell( + child: Column( + children: [ + Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.orange.shade200 + .withOpacity(0.45), + ), + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.2, + height: MediaQuery.of(context) + .size + .height * + 0.09, + child: Center( + child: Texts( + model.categorise[index].name, + fontWeight: FontWeight.w600, + fontSize: 13.8, + ), + ), + ), + ], + ), + onTap: () { + model.getOffersProducts( + i: model.categorise[index].id); + String ids = model.categorise[index].id; + + categoriseName = + model.categorise[index].name; + }), + ], + ), + ); + }), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts( + categoriseName, + fontWeight: FontWeight.w800, + ), + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 0.7, + //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 + ? Expanded( + child: Container( + height: MediaQuery.of(context).size.height * 0.50, + child: GridView.builder( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.85, + ), + itemCount: model.products.length, + itemBuilder: (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.products[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( + height: 250.0, + 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.products[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, + ), + ), + transform: new Matrix4 + .rotationZ( + 5.837200), + ), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.products[index] + .images.isNotEmpty + ? model + .products[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.products[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.products[index] + .rxMessage != + null + ? model + .products[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.products[index] + .discountName != + null) + Container( + width: double.infinity, + height: 22.0, + decoration: + BoxDecoration( + color: + Color(0xff5AB145), + ), + child: Center( + child: Texts( + model + .products[index] + .discountName, + regular: true, + color: Colors.white, + fontSize: 12.0, + fontWeight: + FontWeight.w700, + ), + ), + ), + Texts( + model + .products[index].name, + regular: true, + fontSize: 12.58, + fontWeight: + FontWeight.w600, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.products[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .products[ + index] + .approvedRatingSum > + 0 + ? (model.products[index].approvedRatingSum + .toDouble() / + model + .products[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.products[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + )); + }, + ), + ), + ) + : Expanded( + child: Container( + child: ListView.builder( + itemCount: model.products.length, + itemBuilder: + (BuildContext context, int index) { + return Card( + // color: + // model.products[index].discountName != + // null + // ? Color(0xffFFFF00) + // : Colors.white, + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + if (model.products[index] + .discountName != + null) + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + child: Container( + color: Colors.yellow, + height: 25.0, + width: 70.0, + child: Center( + child: Texts( + 'offer' + .toUpperCase(), + color: Colors.red, + fontSize: 13.0, + fontWeight: + FontWeight + .w900, + ), + ), + ), + ), + transform: + new Matrix4.rotationZ( + 6.15099), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.products[index] + .images.isNotEmpty + ? model + .products[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, + ), + ), + ], + ), + Column( + children: [ + Container( + width: model.products[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.products[index] + .rxMessage != + null + ? model + .products[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.products[index] + .discountName != + null) + Container( + width: 250.0, + height: 22.5, + decoration: BoxDecoration( + color: Color(0xff5AB145), + ), + child: Padding( + padding: + EdgeInsets.symmetric( + horizontal: 5.5, + ), + child: Texts( + model.products[index] + .discountName, + regular: true, + color: Colors.white, + fontSize: 12.0, + fontWeight: + FontWeight.w700, + ), + ), + ), + SizedBox( + height: 4.0, + ), + Texts( + model.products[index].name, + regular: true, + fontSize: 14.0, + fontWeight: FontWeight.w600, + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.products[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .products[ + index] + .approvedRatingSum > + 0 + ? (model + .products[ + index] + .approvedRatingSum + .toDouble() / + model + .products[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.products[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w500, + ) + ], + ), + ], + ), + ), + ], + ), + ); + }), + ), + ) + ], + ), + ), + )); + } +} diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart new file mode 100644 index 00000000..414106b1 --- /dev/null +++ b/lib/pages/parent_categorise_page.dart @@ -0,0 +1,1074 @@ +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'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:giffy_dialog/giffy_dialog.dart'; + +import 'base/base_view.dart'; +import 'final_products_page.dart'; + +class ParentCategorisePage extends StatefulWidget { + String id; + String titleName; + ParentCategorisePage({this.id, this.titleName}); + @override + _ParentCategorisePageState createState() => + _ParentCategorisePageState(id: id, titleName: titleName); +} + +class _ParentCategorisePageState extends State { + String id; + String titleName; + _ParentCategorisePageState({this.id, this.titleName}); + Map values = {'huusam': false, 'ali': false, 'noor': false}; + bool checkedBrands = false; + bool checkedCategorise = false; + String categoriseName = "Personal Care"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getCategoriseParent(i: id), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: titleName, + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + 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: [ + 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, + )), + ); + }, + ), + ), + ); + }), + ), + ); + }, + ); + }, + ), + ), + 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, + ), + ), + ), + ), + 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); + }, + ), + ); + }), + ), + ), + ), + + 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( + 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; + }); + }, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + ExpansionTile( + title: + Texts('Brands'), + children: [ + Container( + height: 350, + child: ListView + .builder( + scrollDirection: + Axis + .vertical, + shrinkWrap: + true, + 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 + .spaceAround, + children: [ + 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(), + ), + ), + ), + ], + ), + ], + ), + ) + ], + ), + 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, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ); + }); + }, + ); + }, + ), + 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, + ), + ), + 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), + ), + 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, + ) + ], + ), + ], + ), + ), + ], + ), + ), + )); + }, + ), + ) + : 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 fb356dca..cca506ec 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, @@ -26,7 +33,6 @@ class PaymentService extends StatelessWidget { children: [ Row( children: [ - if(projectViewModel.havePrivilege(33)) Expanded( child: InkWell( onTap: () => Navigator.push( @@ -51,93 +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: InkWell( - onTap: () => Navigator.push( - context, FadePage(page: MyBalancePage())), - 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( - 'My Balances', - color: HexColor('#B61422'), - bold: true, - ), - Texts( - TranslationBase.of(context).payment, - 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, - ), - ), - ], - ), - ), - ), - ), + //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)) + // if(!projectViewModel.havePrivilege(33)) Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -165,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, ), ), @@ -190,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 new file mode 100644 index 00000000..878544e1 --- /dev/null +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -0,0 +1,70 @@ +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 + ? ListView.builder( + itemCount: wishlist.length, + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + Container( + child: isTrue + ? productTile( + 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: 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, + ), + ), + Divider(height: 1, color: Colors.grey) + ], + ); + }) + : GridView.count( + crossAxisCount: 2, + children: List.generate( + wishlist.length, + (index) => productTile( + productName: wishlist[index].product.name, + productPrice: wishlist[index].subtotal, + productRate: + double.parse(wishlist[index].subtotalVatRate), + productImage: wishlist[index].product.images[0].src, + showLine: isTrue, + )), + ); + } +} + +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 new file mode 100644 index 00000000..d1872187 --- /dev/null +++ b/lib/pages/pharmacies/compare.dart @@ -0,0 +1,328 @@ +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'; + +int counter = 0; + +class ComparePage extends StatefulWidget { + @override + _ComparePageState createState() => _ComparePageState(); +} + +//CompareList compareItems = CompareList(); +class _ComparePageState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: 'Reviews page', + isShowAppBar: true, + isPharmacy: true, + body: Container( + child: compareList(), + ), + ); + } +} + +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: [ + 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), + ), + ) + ], + ), + ), + ) + : 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( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.symmetric(horizontal: 10.0), + child: productItem.length != 0 + ? slideDetail(productItem) + : Container(), + ), + ); + }, + ); + }).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); + }); + }, + ), + ), + ), + SizedBox( + height: 20, + ), + Image.network( + widget.data[index].images[0].src.trim(), + 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: 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: 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: widget.data[index].specifications[0].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: widget.data[index].specifications[1].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: 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: 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: widget.data[index].specifications[4].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: widget.data[index].specifications[5].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, + ), + ), + ], + ), + ), + ), + ], + ); + }, + ); + } +} + +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 62cacb7f..7a61dabe 100644 --- a/lib/pages/pharmacies/medicine_search_screen.dart +++ b/lib/pages/pharmacies/medicine_search_screen.dart @@ -1,26 +1,28 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/pharmacies_list_screen.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart'; +import '../base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/drug_item.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../base/base_view.dart'; +import 'package:diplomaticquarterapp/core/service/pharmacies_service.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/pharmacies_list_screen.dart'; class MedicineSearch extends StatelessWidget { final textController = TextEditingController(); final _formKey = GlobalKey(); - @override Widget build(BuildContext context) { return BaseView( + allowAny: true, + onModelReady: (model) => model.clearMedicineSearch(), builder: (BuildContext context, PharmacyViewModel model, Widget child) => AppScaffold( baseViewModel: model, @@ -51,13 +53,11 @@ class MedicineSearch extends StatelessWidget { controller: textController, validator: (value) { if (value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterMedicineName; - } else if (value.length < 4) { - return TranslationBase.of(context) - .searchItemError; - } else - return null; + return TranslationBase.of(context).pleaseEnterMedicineName; + }else if( value.length <4){ + return TranslationBase.of(context).searchItemError; + }else + return null; }, ), ), @@ -83,24 +83,21 @@ class MedicineSearch extends StatelessWidget { ], ), ), - if (model.pharmacy.isNotEmpty) - Container( - margin: EdgeInsets.only( - left: SizeConfig.heightMultiplier * 2), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: Texts( - TranslationBase.of(context).youCanFind + - '${model.pharmacy == null ? '0' : model.pharmacy.length.toString()}' + - TranslationBase.of(context).itemInSearch, - ), - ), - ], - ), + if(model.pharmacy.isNotEmpty) + Container( + margin: EdgeInsets.only( + left: SizeConfig.heightMultiplier * 2), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).youCanFind+ + '${model.pharmacy == null ? '0' : model.pharmacy.length.toString()}'+ + TranslationBase.of(context).itemInSearch, + ), + ], ), + ), if (model.state == ViewState.ErrorLocal) Container( child: Texts(model.error), diff --git a/lib/pages/pharmacies/my_reviews.dart b/lib/pages/pharmacies/my_reviews.dart new file mode 100644 index 00000000..7b17a359 --- /dev/null +++ b/lib/pages/pharmacies/my_reviews.dart @@ -0,0 +1,248 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/review_view_model.dart'; +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'; +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: 'My Reviews', + isShowAppBar: true, + isPharmacy: true, + 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, + ), + ), + 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) + ], + ); + }), + ), + ), + ); + } +} + +reviewDetails(data, rate, myRate) { + return Container( + child: Padding( + padding: EdgeInsets.only(bottom: 10.0), + child: Container( + height: 200, + width: double.infinity, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + children: [ + Container( + 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, + width: 80, + height: 80, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + child: RichText( + text: TextSpan( + text: languageID == 'ar' + ? data.product.namen + : data.product.name, + style: TextStyle( + color: Colors.black54, + fontSize: languageID == 'ar' ? 7 : 13, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Column( + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + child: RichText( + text: TextSpan( + text: data.product.price.toString() + + " " + + data.product.currency, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: rate, + 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: 20, + ), + Container( + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10) + : EdgeInsets.only(left: 10), + child: Text(data.createdOnUtc.toString())), + ], + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: languageID == 'ar' + ? EdgeInsets.only(right: 60) + : EdgeInsets.only(left: 60), + child: RatingBar.readOnly( + initialRating: myRate, + 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: 15, + ), + Expanded( + child: Container( + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10) + : EdgeInsets.only(left: 10), + child: Text(fixingString(data.reviewText.toString())), + ), + ), + ], + ), + ), + ), + ); +} + +fixingString(txt) { + String stringTxt; + String newTxt; + stringTxt = txt.toString(); + newTxt = stringTxt.split('.')[1]; + + 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 dc69a3e2..a35a77c9 100644 --- a/lib/pages/pharmacies/pharmacies_list_screen.dart +++ b/lib/pages/pharmacies/pharmacies_list_screen.dart @@ -24,12 +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 new file mode 100644 index 00000000..b9e6db95 --- /dev/null +++ b/lib/pages/pharmacies/product-brands.dart @@ -0,0 +1,254 @@ +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'; +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.getBrandsData(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: 'Brands page', + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + body: Container( + child: Column( + children: [ + Container( + color: Colors.white, + 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( + TranslationBase.of(context).topBrands, + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + height: 220, + width: double.infinity, + color: Colors.white, + child: topBrand(), + ), + SizedBox( + height: 10, + ), + Container( + height: MediaQuery.of(context).size.height * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, + ), + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchBrandsPage()), + ); + }, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: 230, + width: double.infinity, + color: Colors.white, + child: ListView.builder( + itemCount: model.brandsListList.length, + 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"); + }, + ); + }), + ), + ], + ), + ), + ), + ); + } +} + + +topBrand() { + return BaseView( + onModelReady: (model) => model.getTopBrandsData(), + builder: (_, model, wi) => GridView.count( + crossAxisCount: 4, + children: List.generate( + model.topBrandsListList.length, + (index) => Column( + children: [ + InkWell( + child: Container( + margin: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 0.0), + child: Container( + 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), + ), + color: Colors.white, + ), + 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"); + }, + ), + ], + ), + ), + ), + ); +} + +brandSearch() { + return Text('ENAD'); +} + +class SearchBar extends SearchDelegate { + @override + List buildActions(BuildContext context) { + return [ + IconButton( + icon: Icon(Icons.clear), + onPressed: () { + query = ""; + }, + ) + ]; + } + + @override + Widget buildLeading(BuildContext context) { + return IconButton( + icon: AnimatedIcon( + icon: AnimatedIcons.menu_arrow, + progress: transitionAnimation, + ), + onPressed: () { + close(context, null); + }, + ); + } + + @override + Widget buildResults(BuildContext context) { + return Container( + height: 100, + width: 100, + child: Card( + color: Colors.red, + child: Center( + child: Text(query), + ), + ), + ); + } + + @override + Widget buildSuggestions(BuildContext context) { + return ListView.builder( + itemCount: 5, + itemBuilder: (context, index) => ListTile( + leading: Icon(Icons.location_city), + title: Text("Enad"), + onTap: () { + showResults(context); + }, + ), + ); + } +} + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart new file mode 100644 index 00000000..2040db11 --- /dev/null +++ b/lib/pages/pharmacies/product_detail.dart @@ -0,0 +1,1862 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/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: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; +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(); +} + +class __ProductDetailPageState extends State { + bool isTrue = true; + 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 customerId != null + ? DetailPageScafold( + appBarTitle: 'product detail page', + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + body: SingleChildScrollView( + child: Column( + children: [ + 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( + TranslationBase.of(context).specification, + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ), + Divider(color: Colors.grey), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + "there is no data", + ), + ), + ), + ], + ), + ), + 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(), + ], + ), + ), +// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), + ], + ), + ), + 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( + children: [ + 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( + TranslationBase.of(context).specification, + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ), + Divider(color: Colors.grey) + ], + ), + ), + 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) => + 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(), + ], + ), + ), +// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), + ], + ), + ), + 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(); +} + +class _footerWidgetState extends State { + double quantityUI = 70; + bool showUI = false; + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: quantityUI, + color: Colors.white, + child: Column( + children: [ + showUI + ? Container( + width: double.infinity, + height: 90, + color: Colors.white, + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).quantity, + style: TextStyle( + fontSize: 15, fontWeight: FontWeight.bold), + ), + ), +// ListView( +// scrollDirection: Axis.horizontal, +// children: [ +// itemQuantity(), +// ], +// ), + Container( +// margin: EdgeInsets.symmetric(vertical: 20.0), + height: 50.0, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '1', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 1; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '2', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 2; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '3', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 3; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '4', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 4; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '5', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 5; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '6', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 6; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '7', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 7; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '8', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 8; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '9', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 9; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '10', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 10; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + Container( + width: 50.0, + child: TextField( + 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; + } + }); + } + }, + ), + ), + ], + ), + ) + ], + ), + ), + ) + : Container( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 70, + height: 50, + child: FlatButton( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Text( + price.toString(), + style: TextStyle(fontSize: 20), + ), + ), + Expanded( + flex: 5, + child: Text( + TranslationBase.of(context).quantityShortcut, + style: TextStyle(fontSize: 16), + ), + ), + ], + ), + onPressed: () { + setState(() { + if (showUI) { + quantityUI = 70; + showUI = false; + } else { + quantityUI = 150; + showUI = true; + } + }); + }, + ), + ), + !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, + ), + !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), + ), + ), + ), + ], + ), + ], + ), + ); + } +} + +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), + ), + 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(); + }, + )), + ], + ), + ), + 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), + ), + ), + ), + ), + 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: 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, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 14.0, vertical: 15.0), + decoration: const BoxDecoration( + 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: const Text('1', + textAlign: TextAlign.center, + style: TextStyle(color: Color(0xFF000000))), + ), + ) + ], + ); +} + +fixingString(txt) { + String stringTxt; + String newTxt; + stringTxt = txt.toString(); + newTxt = stringTxt.split('.')[1]; + + 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/address-select-page.dart b/lib/pages/pharmacies/screens/address-select-page.dart new file mode 100644 index 00000000..6c39ba3f --- /dev/null +++ b/lib/pages/pharmacies/screens/address-select-page.dart @@ -0,0 +1,34 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class AddressSelectPageTest extends StatelessWidget { + final List addresses; + + AddressSelectPageTest(this.addresses); + + @override + Widget build(BuildContext context) { + return AppScaffold( + title: "test", + isShowAppBar: true, + isShowDecPage: false, + body: Column( + children: [ + Container( + child: RaisedButton( + onPressed: () => {Navigator.pop(context, addresses[0])}, + child: new Text( + "Set address", + style: new TextStyle(color: Colors.white, fontSize: 14), + ), + color: Colors.blueAccent, + disabledColor: Colors.blueAccent, + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart new file mode 100644 index 00000000..cca6c1df --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -0,0 +1,382 @@ +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'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.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/material.dart'; +import 'package:provider/provider.dart'; + +class CartOrderPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; + + return BaseView( + onModelReady: (model) => model.getOrderPreviewData(), + builder: (_, model, wi) => ChangeNotifierProvider.value( + value: model.cartResponse, + child: AppScaffold( + appBarTitle: TranslationBase.of(context).shoppingCart, + isShowAppBar: true, + isPharmacy: true, + baseViewModel: model, + backgroundColor: Colors.white, + body: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? Container( + height: height * 0.85, + width: double.infinity, + child: Consumer( + builder: (ctx, cart, _) => Container( + 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.shade700, + ), + onTap: () => {model.deleteShoppingCart()}, + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + child: Column( + children: [ + ...List.generate( + cart.shoppingCarts != null + ? cart.shoppingCarts.length + : 0, + (index) => ProductOrderItem( + cart.shoppingCarts[index], () { + print(cart.shoppingCarts[index] + .quantity); + model.changeProductQuantity( + cart.shoppingCarts[index]); + }, + () => model.deleteProduct( + cart.shoppingCarts[index]))) + ], + ), + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 2, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).subtotal, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).vat}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(cart.subtotalVatAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Image.asset( + "assets/images/pharmacy_module/payment_image.png", + width: mediaQuery.size.width - 20, + height: 30.0, + fit: BoxFit.scaleDown, + ) + ], + ), + ), + ), + ), + ), + ) + : 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), + ), + ) + ], + ), + ), + bottomSheet: Container( + height: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? height * 0.15 + : 0, + color: Colors.white, + child: OrderBottomWidget(model.addresses, height), + ), + ), + ), + ); + } +} + +class OrderBottomWidget extends StatefulWidget { + final List addresses; + final double height; + + OrderBottomWidget(this.addresses, this.height); + + @override + _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); +} + +class _OrderBottomWidgetState extends State { + bool isAgree = false; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: Consumer( + builder: (ctx, cart, _) => !(cart.shoppingCarts == null || + cart.shoppingCarts.length == 0) + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + height: widget.height * 0.070, + color: Color(0xffe6ffe0), + padding: EdgeInsets.symmetric(horizontal: 4), + child: Expanded( + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + isAgree = !isAgree; + }); + }, + child: Container( + width: 25.0, + height: widget.height * 0.070, + decoration: new BoxDecoration( + color: !isAgree + ? Color(0xffeeeeee) + : Colors.green, + shape: BoxShape.circle, + ), + child: !isAgree + ? null + : Padding( + padding: const EdgeInsets.all(0.0), + child: Icon( + Icons.check, + color: Colors.white, + size: 25, + ), + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 4), + margin: const EdgeInsets.symmetric(vertical: 4), + child: Texts( + TranslationBase.of(context) + .pharmacyServiceTermsCondition, + fontSize: 13, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ), + InkWell( + onTap: () => { + Navigator.push(context, + FadePage(page: PharmacyTermsConditions())) + }, + child: Container( + child: Icon( + Icons.info, + size: 25, + color: Color(0xff005aff), + ), + ), + ), + ], + ), + ), + ), + Container( + height: widget.height * 0.065, + margin: EdgeInsets.symmetric(vertical: 2), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + 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} ${TranslationBase.of(context).items}", + fontSize: 10, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ], + ), + ), + RaisedButton( + onPressed: isAgree + ? () => { + Navigator.push( + context, + FadePage( + page: OrderPreviewPage( + widget.addresses))) + } + : null, + child: new Text( + "${TranslationBase.of(context).checkOut}", + style: new TextStyle( + color: isAgree + ? Colors.white + : Colors.grey.shade300, + fontSize: 14), + ), + color: Color(0xff005aff), + disabledColor: Color(0xff005aff), + ), + ], + ), + ), + ], + ) + : Container(), + )); + } +} diff --git a/lib/pages/pharmacies/screens/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-order-preview.dart new file mode 100644 index 00000000..9d819c1c --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-order-preview.dart @@ -0,0 +1,832 @@ +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'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:flutter/scheduler.dart'; + +class OrderPreviewPage extends StatelessWidget { + final List addresses; + + OrderPreviewPage(this.addresses); + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - + 60 - + mediaQuery.padding.top; + + return BaseView( + onModelReady: (model) => model.getShoppingCart(), + builder: (_, model, wi) => ChangeNotifierProvider.value( + value: model.paymentCheckoutData, + child: AppScaffold( + appBarTitle: "${TranslationBase.of(context).checkOut}", + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + height: height * 0.90, + child: SingleChildScrollView( + child: Container( + color: Color(0xFFF1F1F1), + child: Column( + children: [ + SelectAddressWidget(model, addresses), + SizedBox( + height: 10, + ), + SelectPaymentOptionWidget(model), + SizedBox( + height: 10, + ), + Consumer( + builder: (ctx, paymentData, _) => + paymentData.lacumInformation != null + ? Container( + child: Column( + children: [ + LakumWidget(model), + SizedBox( + height: 10, + ), + ], + ), + ) + : Container()), + Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).reviewOrder, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ...List.generate( + model.cartResponse.shoppingCarts != null + ? model.cartResponse.shoppingCarts.length + : 0, + (index) => ProductOrderPreviewItem( + model.cartResponse.shoppingCarts[index]), + ), + ], + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(8), + child: model.cartResponse.subtotal != null + ? Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .orderSummary, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).subtotal}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).shipping}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).vat}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), + SizedBox( + height: 10, + ), + ], + ) + : Container(), + ) + ], + ), + ), + ), + ), + bottomSheet: Container( + height: model.cartResponse.shoppingCarts != null + ? height * 0.10 + : 0, + color: Colors.white, + child: PaymentBottomWidget(model), + ), + ), + )); + } +} + +class SelectAddressWidget extends StatefulWidget { + final OrderPreviewViewModel model; + final List addresses; + + SelectAddressWidget(this.model, this.addresses); + + @override + _SelectAddressWidgetState createState() => _SelectAddressWidgetState(); +} + +class _SelectAddressWidgetState extends State { + Addresses address; + + _navigateToAddressPage() { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())) + .then((result) { + if (result != null) { + address = result; + widget.model.paymentCheckoutData.address = address; + widget.model.getInformationsByAddress(); + } + + /* setState(() { + if (result != null) { + address = result; + widget.model.paymentCheckoutData.address = address; + widget.model.getInformationsByAddress(); + } + })*/ + }); + } + + @override + void initState() { + if (widget.model.paymentCheckoutData.address != null) { + address = widget.model.paymentCheckoutData.address; + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (ctx, paymentData, _) => Container( + color: Colors.white, + child: address == null + ? InkWell( + onTap: () => {_navigateToAddressPage()}, + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_address.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: + EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).selectAddress, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff0000ff), + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 20, + color: Colors.grey.shade400, + ), + ], + ), + ), + ) + : Container( + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_mark.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric( + vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).shippingAddress, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + ), + InkWell( + onTap: () => {_navigateToAddressPage()}, + child: Texts( + TranslationBase.of(context).changeAddress, + fontSize: 12, + fontWeight: FontWeight.normal, + color: Color(0xff0000ff), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Texts( + "${address.firstName} ${address.lastName}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + 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, + ), + ], + ), + Container( + margin: EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + ), + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_truck.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + padding: EdgeInsets.symmetric( + vertical: 0, horizontal: 6), + child: Texts( + "${TranslationBase.of(context).shipBy}", + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Container( + child: Image.asset( + paymentData.shippingOption + .shippingRateComputationMethodSystemName == + "Shipping.FixedOrByWeight" + ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" + : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", + fit: BoxFit.contain, + ), + margin: EdgeInsets.symmetric(horizontal: 8), + ), + ], + ), + ], + ), + ), + ), // ic_shipping_mark.png + ), + ); + } +} + +class SelectPaymentOptionWidget extends StatefulWidget { + final OrderPreviewViewModel model; + + SelectPaymentOptionWidget(this.model); + + @override + _SelectPaymentOptionWidgetState createState() => + _SelectPaymentOptionWidgetState(); +} + +class _SelectPaymentOptionWidgetState extends State { + PaymentOption paymentOption; + + _navigateToPaymentOption() { + Navigator.push(context, FadePage(page: PaymentMethodSelectPage())) + .then((result) => { + setState(() { + if (result != null) { + paymentOption = result; + widget.model.paymentCheckoutData.paymentOption = + paymentOption; + widget.model.paymentCheckoutData.updateData(); + } + }) + }); + } + + @override + void initState() { + if (widget.model.paymentCheckoutData.paymentOption != null) { + paymentOption = widget.model.paymentCheckoutData.paymentOption; + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: paymentOption == null + ? InkWell( + onTap: () => {_navigateToPaymentOption()}, + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_payment_option.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: + EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).selectPaymentOption, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff0000ff), + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 20, + color: Colors.grey.shade400, + ), + ], + ), + ), + ) + : Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_payment_option.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0), + decoration: new BoxDecoration( + color: Colors.grey.shade100, + shape: BoxShape.rectangle, + ), + child: Image.asset( + widget.model.getPaymentOptionImage(paymentOption), + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + widget.model.getPaymentOptionName(paymentOption), + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + ), + InkWell( + onTap: () => {_navigateToPaymentOption()}, + child: Texts( + TranslationBase.of(context).changeMethod, + fontSize: 12, + fontWeight: FontWeight.normal, + color: Color(0xff0000ff), + ), + ), + ], + ), + ), + ); + } +} + +class LakumWidget extends StatefulWidget { + final OrderPreviewViewModel model; + + LakumWidget(this.model); + + @override + _LakumWidgetState createState() => _LakumWidgetState(); +} + +class _LakumWidgetState extends State { + TextEditingController _pointsController = new TextEditingController(); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_checkout.png", + width: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).lakumPoints}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Texts( + "${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}", + fontSize: 12, + fontWeight: FontWeight.normal, + ), + ], + ), + ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Texts( + "${TranslationBase.of(context).riyal}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Container( + margin: projectProvider.isArabic + ? EdgeInsets.only(right: 4) + : EdgeInsets.only(left: 4), + width: 60, + height: 50, + child: TextField( + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.black, width: 0.2), + gapPadding: 0, + 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: + BorderSide(color: Colors.black, width: 0.4), + gapPadding: 0, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8)), + ), + ), + controller: _pointsController, + keyboardType: TextInputType.number, + style: TextStyle( + fontSize: 14, + color: widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount > + 0 + ? Colors.black + : Colors.grey, + ), + enabled: widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount == + 0 + ? false + : true, + onChanged: (val) { + var value = int.tryParse(val); + if (value != null && + value <= + widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount) { + widget.model.paymentCheckoutData.usedLakumPoints = + value; + } else { + widget.model.paymentCheckoutData.usedLakumPoints = 0; + } + _pointsController.text = + "${widget.model.paymentCheckoutData.usedLakumPoints}"; + }, + ), + ), + Container( + height: 50, + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), + decoration: new BoxDecoration( + color: Color(0xff3666E0), + shape: BoxShape.rectangle, + 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( + "${TranslationBase.of(context).use}", + fontSize: 12, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} + +class PaymentBottomWidget extends StatelessWidget { + final OrderPreviewViewModel model; + + PaymentBottomWidget(this.model); + + @override + Widget build(BuildContext context) { + final scaffold = Scaffold.of(context); + + return Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: Consumer( + builder: (ctx, paymentData, _) => paymentData.cartDataVisible + ? Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + margin: + EdgeInsets.symmetric(horizontal: 0, vertical: 4), + child: Row( + children: [ + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff929295), + ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 4), + child: Texts( + "${TranslationBase.of(context).inclusiveVat}", + fontSize: 8, + color: Color(0xff929295), + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + Texts( + "${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}", + fontSize: 10, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ], + ), + Container( + child: RaisedButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + side: BorderSide( + color: Color(0xff929295), + width: 1, + ), + ), + onPressed: (paymentData.address != null && + paymentData.paymentOption != null) + ? () => { + model.makeOrder().then((_) { + if (model.state != ViewState.Idle) { + SnackBar snackBar = SnackBar( + content: Text( + 'Order has been placed successfully!!')); + scaffold.showSnackBar(snackBar); + } + + // Navigator.pushAndRemoveUntil( + // context, + // MaterialPageRoute( + // builder: (context) => + // PharmacyPage()), + // (Route r) => false); + }) + } + : null, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 16), + child: new Text( + "${TranslationBase.of(context).proceedPay}", + style: new TextStyle( + color: (paymentData.address != null && + paymentData.paymentOption != null) + ? Colors.white + : Colors.grey.shade400, + fontWeight: FontWeight.bold, + fontSize: 12), + ), + ), + color: (paymentData.address != null && + paymentData.paymentOption != null) + ? Colors.green + : Color(0xff929295), + disabledColor: (paymentData.address != null && + paymentData.paymentOption != null) + ? Colors.green + : Color(0xff929295), + ), + ), + ], + ), + ) + : Container(), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart b/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart new file mode 100644 index 00000000..fc1270c0 --- /dev/null +++ b/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart @@ -0,0 +1,101 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import 'lacum-registration-page.dart'; + +class LakumActivationVidaPage extends StatelessWidget { + TextEditingController _identificationNumberController = + new TextEditingController(); + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Acount Activation", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 12), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts( + " This service allows you to activate your LAKUM account after registering through the Vida system. ", + fontSize: 14, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + controller: _identificationNumberController, + decoration: new InputDecoration( + hintText: 'Enter Identification Number', + ), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 4), + child: BorderedButton( + TranslationBase.of(context).accountActivation, + backgroundColor: + _identificationNumberController.text != null && + _identificationNumberController.text != "" + ? Color(0xff60686b) + : Color(0xffb0b4b5), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: _identificationNumberController.text != null && + _identificationNumberController.text != "" + ? () { + model + .checkLacumAccountActivation( + _identificationNumberController.text) + .then((_) => { + if (model.state == ViewState.Idle) + { + Navigator.push( + context, + FadePage( + page: LakumRegistrationPage( + _identificationNumberController + .text))) + .then((status) => { + if (status == 200) + {Navigator.pop(context, "")} + // back to previous page + }) + } + }); + } + : null, + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lacum-registration-page.dart b/lib/pages/pharmacies/screens/lacum-registration-page.dart new file mode 100644 index 00000000..c40771b8 --- /dev/null +++ b/lib/pages/pharmacies/screens/lacum-registration-page.dart @@ -0,0 +1,234 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; +import 'package:diplomaticquarterapp/models/id-name-pair.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.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:diplomaticquarterapp/widgets/dialogs/radio-group-dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import 'lakum-terms-conditions-page.dart'; + +class LakumRegistrationPage extends StatefulWidget { + final String patientIdentificationNo; + + LakumRegistrationPage(this.patientIdentificationNo); + + @override + _LakumRegistrationPageState createState() => _LakumRegistrationPageState(); +} + +class _LakumRegistrationPageState extends State { + final TextEditingController _firstNameController = TextEditingController(); + + final TextEditingController _lastNameController = TextEditingController(); + + final TextEditingController _mobileNumberController = TextEditingController(); + + List languages = List(); + + IdNamePair selectedLanguage; + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + languages.clear(); + languages.add(IdNamePair(1, TranslationBase.of(context).arabic)); + languages.add(IdNamePair(2, TranslationBase.of(context).english)); + + bool canSubmit = _firstNameController.text != null && + _firstNameController.text != "" && + _lastNameController.text != null && + _lastNameController.text != "" && + _mobileNumberController.text != null && + _mobileNumberController.text != "" && + selectedLanguage != null; + + return BaseView( + builder: (_, model, wi) => AppScaffold( + appBarTitle: + "${TranslationBase.of(context).register} ${TranslationBase.of(context).lakum}", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: SizedBox( + height: + mediaQuery.size.height - 60 - mediaQuery.padding.top, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + Column( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + height: 150, + width: mediaQuery.size.width, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).firstName, + fontSize: 13, + fontWeight: FontWeight.normal, + color: Color(0xff8a8a8a), + ), + TextField( + controller: _firstNameController, + style: TextStyle( + fontSize: 16, + color: Colors.black, + ), + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).lastName, + fontSize: 13, + fontWeight: FontWeight.normal, + color: Color(0xff8a8a8a), + ), + TextField( + controller: _lastNameController, + style: TextStyle( + fontSize: 16, + color: Colors.black, + ), + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).mobileNumber, + fontSize: 13, + fontWeight: FontWeight.normal, + color: Color(0xff8a8a8a), + ), + TextField( + controller: _mobileNumberController, + style: TextStyle( + fontSize: 16, + color: Colors.black, + ), + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context) + .prefferedLanguage, + fontSize: 13, + fontWeight: FontWeight.normal, + color: Color(0xff8a8a8a), + ), + InkWell( + onTap: () { + RadioGroupDialog dialog = + new RadioGroupDialog( + context: context, + title: TranslationBase.of(context) + .prefferedLanguage, + okText: + TranslationBase.of(context) + .confirm, + cancelText: + TranslationBase.of(context) + .cancel_nocaps, + list: languages, + okFunction: (selectedValue) { + setState(() { + selectedLanguage = + selectedValue; + }); + print( + "selectedLanguage = ${selectedValue.name}"); + }, + cancelFunction: () => {}); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + }, + child: TextField( + enabled: false, + decoration: InputDecoration( + suffixIcon: + Icon(Icons.arrow_drop_down), + hintText: selectedLanguage == null + ? "${TranslationBase.of(context).prefferedLanguage}" + : "${selectedLanguage.name}", + hintStyle: TextStyle( + fontSize: 16, + color: Colors.black, + )), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + ], + ), + ), + ], + ), + Container( + color: Colors.green, + margin: EdgeInsets.all(8), + child: BorderedButton( + TranslationBase.of(context).register, + backgroundColor: canSubmit + ? Color(0xff339933) + : Color(0xff99cc99), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: canSubmit + ? () { + Navigator.push( + context, + FadePage( + page: LakumTermsConditions( + widget + .patientIdentificationNo, + _firstNameController.text, + _lastNameController.text, + _mobileNumberController + .text, + selectedLanguage.id))) + .then((status) => { + if (status == 200) + {Navigator.pop(context, "")} + // back to previous page + }); + } + : null, + ), + ), + ], + ), + ), + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/lacum-setting-page.dart b/lib/pages/pharmacies/screens/lacum-setting-page.dart new file mode 100644 index 00000000..861279f3 --- /dev/null +++ b/lib/pages/pharmacies/screens/lacum-setting-page.dart @@ -0,0 +1,238 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class LakumSettingPage extends StatefulWidget { + final LacumAccountInformation lacumInformation; + final LacumAccountInformation lacumGroupInformation; + + LakumSettingPage(this.lacumInformation, this.lacumGroupInformation); + + @override + _LakumSettingPageState createState() => _LakumSettingPageState(); +} + +class _LakumSettingPageState extends State { + bool _lakumAccountActivated = false; + TextEditingController _nameController = new TextEditingController(); + TextEditingController _phoneController = new TextEditingController(); + + @override + void initState() { + _lakumAccountActivated = widget.lacumGroupInformation + .lakumInquiryInformationObjVersion.accountStatus == + "Active"; + super.initState(); + _nameController.text = widget.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName; + _phoneController.text = widget.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber; + } + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + onModelReady: (model) => model.setLakumData( + widget.lacumInformation, widget.lacumGroupInformation), + builder: (_, model, wi) => AppScaffold( + appBarTitle: "${TranslationBase.of(context).lakum}", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: SizedBox( + height: mediaQuery.size.height - + 60 - + mediaQuery.padding.top, + child: _buildSettingScreen(mediaQuery, model), + ), + ), + ), + ), + ); + } + + _buildSettingScreen(MediaQueryData mediaQuery, LacumViewModel model) { + bool canUpdate = (_nameController.text != "" && + _phoneController.text != "" && + (_nameController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName || + _phoneController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber)); + + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Container( + height: mediaQuery.size.height * 0.15, + color: Colors.green, + ), + Column( + children: [ + SizedBox( + height: mediaQuery.size.height * 0.05, + ), + Container( + width: mediaQuery.size.width * 1, + child: LakumBannerWidget(model, mediaQuery, false)), + ], + ) + ], + ), + SizedBox( + height: 20, + ), + SizedBox( + height: 1, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "Activate LAKUM Account", + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + Switch.adaptive( + activeColor: Color.fromRGBO(51, 153, 51, 1), + inactiveThumbColor: Colors.red, + activeTrackColor: Colors.grey, + inactiveTrackColor: Colors.grey, + value: _lakumAccountActivated, + onChanged: (val) { + if (_lakumAccountActivated) { + model.makeAccountDeactivate(); + } else { + model.makeAccountActivate(); + } + setState(() { + _lakumAccountActivated = val; + }); + }, + ), + ], + ), + ), + SizedBox( + height: 30, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).name, + fontSize: 13, + fontWeight: _lakumAccountActivated + ? FontWeight.bold + : FontWeight.normal, + color: Colors.grey.shade400, + ), + _lakumAccountActivated + ? TextField( + controller: _nameController, + enabled: _lakumAccountActivated ? true : false, + style: TextStyle( + fontSize: 16, + color: _lakumAccountActivated + ? Colors.black + : Colors.white38, + ), + ) + : Texts( + _nameController.text, + fontSize: 16, + color: Colors.grey.shade600, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).mobileNumber, + fontSize: 13, + fontWeight: _lakumAccountActivated + ? FontWeight.bold + : FontWeight.normal, + color: Colors.grey.shade400, + ), + _lakumAccountActivated + ? TextField( + controller: _phoneController, + enabled: _lakumAccountActivated ? true : false, + keyboardType: TextInputType.phone, + style: TextStyle( + fontSize: 16, + color: _lakumAccountActivated + ? Colors.black + : Colors.white38, + ), + ) + : Texts( + _phoneController.text, + fontSize: 16, + color: Colors.grey.shade600, + ), + ], + ), + ), + ], + ), + Container( + child: Column( + children: [ + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.all(8), + child: BorderedButton( + TranslationBase.of(context).save, + backgroundColor: + canUpdate ? Color(0xff60686b) : Color(0xffb0b4b5), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: canUpdate + ? () { + model.createLakumAccount(_nameController.text, _phoneController.text).then((status) => { + if (status == 200) {Navigator.pop(context, "")} + // back to previous page + }); + } + : null, + ), + ) + ], + ), + ), + ], + ); + } +} diff --git a/lib/pages/pharmacies/screens/lacum-transfer-page.dart b/lib/pages/pharmacies/screens/lacum-transfer-page.dart new file mode 100644 index 00000000..9103b646 --- /dev/null +++ b/lib/pages/pharmacies/screens/lacum-transfer-page.dart @@ -0,0 +1,315 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class LacumTransferPage extends StatefulWidget { + final LacumAccountInformation lacumInformation; + final LacumAccountInformation lacumGroupInformation; + + LacumTransferPage(this.lacumInformation, this.lacumGroupInformation); + + @override + _LacumTransferPageState createState() => _LacumTransferPageState(); +} + +class _LacumTransferPageState extends State { + TextEditingController _beneficieryAccountController = + new TextEditingController(); + TextEditingController _transferPointsController = new TextEditingController(); + + @override + void initState() { + super.initState(); + _beneficieryAccountController.text = ""; + _transferPointsController.text = "0"; + } + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + onModelReady: (model) => model.setLakumData( + widget.lacumInformation, widget.lacumGroupInformation), + builder: (_, model, wi) => AppScaffold( + appBarTitle: "${TranslationBase.of(context).lakum}", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: SizedBox( + height: + mediaQuery.size.height - 58 - mediaQuery.padding.top, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + Row( + children: [ + Container( + height: 100, + width: mediaQuery.size.width / 2 - 26, + padding: EdgeInsets.only( + top: 12, left: 8, right: 8, bottom: 4), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: Color(0xff6294ed), + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Container( + child: Texts( + "Point Balance", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric( + vertical: 8), + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Texts( + "0", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ], + ), + ), + ) + ], + ), + ), + SizedBox( + width: 20, + ), + Container( + height: 100, + width: mediaQuery.size.width / 2 - 26, + padding: EdgeInsets.only( + top: 12, left: 8, right: 8, bottom: 4), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: Color(0xff339933), + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Container( + child: Texts( + "Riyal Balance", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric( + vertical: 8), + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Texts( + "0", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ], + ), + ), + ) + ], + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 16), + child: TextField( + controller: _beneficieryAccountController, + decoration: new InputDecoration( + hintText: 'Enter Beneficiary Account No.', + ), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 4), + child: BorderedButton( + TranslationBase.of(context).checkBeneficiary, + backgroundColor: + _beneficieryAccountController.text != "" + ? Color(0xff60686b) + : Color(0xffb0b4b5), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: + _beneficieryAccountController.text != "" + ? () { + model.getLacumGroupDataBuAccountId( + _beneficieryAccountController + .text); + } + : null, + ), + ), + (model.lacumReceiverInformation != null && + model.lacumReceiverInformation + .lakumInquiryInformationObjVersion != + null) + ? Container( + margin: EdgeInsets.only(top: 8), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .beneficiaryName, + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8), + child: TextField( + enabled: false, + decoration: new InputDecoration( + hintText: + "${model.lacumReceiverInformation.lakumInquiryInformationObjVersion.memberName}", + hintStyle: TextStyle( + fontSize: 16, + color: Colors.grey.shade600, + )), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + SizedBox( + height: 10, + width: double.infinity, + ), + Texts( + "Point's to Transfer :", + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8), + child: TextField( + controller: + _transferPointsController, + decoration: new InputDecoration( + focusColor: Colors.green, + hintStyle: TextStyle( + fontSize: 16, + color: Colors.grey.shade600, + )), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + ], + ), + ) + : Container() + ], + ), + if (model.lacumReceiverInformation != null && + model.lacumReceiverInformation + .lakumInquiryInformationObjVersion != + null) + Container( + margin: EdgeInsets.all(8), + child: BorderedButton( + "LACUM TRANSFER", + backgroundColor: Color(0xff339933), + textColor: Colors.white, + fontSize: 18, + hPadding: 8, + radius: 12, + vPadding: 16, + fontWeight: FontWeight.w600, + handler: () { + model + .transferYaHalaLoyaltyPoints( + _transferPointsController.text) + .then((status) => { + if (status == 200) + {Navigator.pop(context, "")} + // back to previous page + }); + }, + ), + ) + ], + ), + ), + ), + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart new file mode 100644 index 00000000..adbb07c2 --- /dev/null +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -0,0 +1,555 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-setting-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-transfer-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-points-year-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import 'lacum-activitaion-vida-page.dart'; + +class LakumMainPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + onModelReady: (model) => model.getLacumData(), + builder: (_, model, wi) => AppScaffold( + title: "Lakum", + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + appBarIcons: _buildAppBarICons(context, model), + // preferredSize: mediaQuery.size.height * 0.20, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: (model.lacumGroupInformation != null && + model.lacumGroupInformation + .lakumInquiryInformationObjVersion != + null) + ? Column( + children: [ + Stack( + children: [ + Container( + height: mediaQuery.size.height * 0.15, + color: Colors.green, + ), + Column( + children: [ + SizedBox( + height: mediaQuery.size.height * 0.05, + ), + Container( + width: mediaQuery.size.width * 1, + child: LakumBannerWidget( + model, mediaQuery, true)), + ], + ) + ], + ), + SizedBox( + height: 20, + ), + LakumHomeButtons(mediaQuery, model), + SizedBox( + height: 20, + ), + Container( + height: 100, + margin: EdgeInsets.symmetric(horizontal: 16), + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + LacumPointsWidget( + mediaQuery, + 1, + TranslationBase.of(context).balance, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalance, + null), + SizedBox( + width: 8, + ), + LacumPointsWidget( + mediaQuery, + 2, + TranslationBase.of(context).gained, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPointsAmountPerYear), + SizedBox( + width: 8, + ), + LacumPointsWidget( + mediaQuery, + 3, + TranslationBase.of(context).consumed, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount != + null + ? int.parse(model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount) + : 0, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmountPerYear), + SizedBox( + width: 8, + ), + LacumPointsWidget( + mediaQuery, + 4, + TranslationBase.of(context).transferred, + 0, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPointsAmountPerYear), + ], + ), + ), + SizedBox( + height: 20, + ), + SizedBox( + height: 8, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/expired_icon.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 8), + child: Texts( + "Expired", + fontSize: 14, + ), + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} Points", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ], + ), + ), + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/waiting_gained_icon.png", + fit: BoxFit.fill, + width: 20, + height: 25, + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 8), + child: Texts( + "Waiting gained", + fontSize: 14, + ), + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ], + ), + ), + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/will_be_expired_icon.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 8), + child: Texts( + "Will Be Expired", + fontSize: 14, + ), + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} Points", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ], + ), + ), + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + ], + ) + : Container(), + ), + ), + )); + } +} + +List _buildAppBarICons(BuildContext context, LacumViewModel model) { + return [ + IconButton( + icon: Icon(Icons.settings), + color: Colors.white, + onPressed: () { + Navigator.push( + context, + FadePage( + page: LakumSettingPage( + model.lacumInformation, model.lacumGroupInformation))) + .then((result) => {model.getLacumGroupData()}); + }, + ), + ]; +} + +class LakumHomeButtons extends StatelessWidget { + final MediaQueryData mediaQuery; + final LacumViewModel model; + + LakumHomeButtons(this.mediaQuery, this.model); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + print("Account activate click"); + Navigator.push( + context, FadePage(page: LakumActivationVidaPage())) + .then((result) => {model.getLacumGroupData()}); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: Color(0xffe1e1e1)), + height: mediaQuery.size.height * 0.08, + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/Account_activation_icon.png", + fit: BoxFit.fill, + width: 30, + height: 30, + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 16), + child: Texts( + "Account Activation", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ) + ], + ), + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: InkWell( + onTap: () { + print("Lacum transfer click"); + Navigator.push( + context, + FadePage( + page: LacumTransferPage(model.lacumInformation, + model.lacumGroupInformation))) + .then((result) => {model.getLacumGroupData()}); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: Color(0xffe1e1e1)), + height: mediaQuery.size.height * 0.08, + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png", + fit: BoxFit.fill, + width: 35, + height: 30, + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 16), + child: Texts( + "Lakum Transfer", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ) + ], + ), + ), + ), + ), + ], + ), + ); + } +} + +class LacumPointsWidget extends StatelessWidget { + final MediaQueryData mediaQuery; + final int pointType; // 1. balance, 2. gained, 3. consume, 4. transfer + final String title; + final int riyal; + final int point; + Color titleColor; + final List pointsAmountPerYear; + + LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, + this.point, this.pointsAmountPerYear) { + if (pointType == 1) { + titleColor = Color(0xffefefef); + } else if (pointType == 2) { + titleColor = Color(0xff004bcc); + } else if (pointType == 3) { + titleColor = Color(0xff339933); + } else { + titleColor = Color(0xffffa500); + } + } + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + if (pointType != 1) { + if (pointsAmountPerYear != null && pointsAmountPerYear.length > 0) { + Navigator.push(context, + FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); + } else { + // show snackBar No Details Points are there + } + } + }, + child: Container( + width: mediaQuery.size.width / 2 - 16, + padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 4), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: pointType == 1 ? Color(0xff004bcc) : Color(0xffefefef), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Texts( + title, + fontSize: 14, + fontWeight: FontWeight.bold, + color: titleColor, + ), + ), + if (pointType != 1) + Icon( + Icons.arrow_forward, + color: titleColor, + ) + ], + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + if (pointType != 4) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "RIYAL", + fontSize: 13, + fontWeight: FontWeight.bold, + color: pointType == 1 ? Colors.white : Colors.black, + ), + SizedBox( + height: 4, + ), + Texts( + "$riyal", + fontSize: 13, + fontWeight: FontWeight.bold, + color: pointType == 1 ? Colors.white : Colors.black, + ), + ], + ), + ), + if (pointType != 4) + SizedBox( + child: Container( + color: pointType == 1 ? Colors.white : Colors.grey, + ), + width: 1, + ), + Expanded( + child: Container( + margin: EdgeInsets.only(left: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "POINT", + fontSize: 12, + fontWeight: FontWeight.bold, + color: pointType == 1 ? Colors.white : Colors.black, + ), + SizedBox( + height: 4, + ), + Texts( + "$point", + fontSize: 12, + fontWeight: FontWeight.bold, + color: pointType == 1 ? Colors.white : Colors.black, + ), + ], + ), + ), + ), + ], + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lakum-points-month-page.dart b/lib/pages/pharmacies/screens/lakum-points-month-page.dart new file mode 100644 index 00000000..47270eee --- /dev/null +++ b/lib/pages/pharmacies/screens/lakum-points-month-page.dart @@ -0,0 +1,271 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerMonth.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lakum-point-table-row-widget.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class LakumPointMonthPage extends StatefulWidget { + final PointsAmountPerMonth pointsAmountPerMonth; + final int year; + int expandedItemIndex = -1; + + LakumPointMonthPage(this.pointsAmountPerMonth, this.year); + + @override + _LakumPointsMonthPageState createState() => _LakumPointsMonthPageState(); +} + +class _LakumPointsMonthPageState extends State { + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Lakum points", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + height: mediaQuery.size.height * 0.25, + child: Stack( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + width: mediaQuery.size.width * 1.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + height: mediaQuery.size.height * 0.06, + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 24), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).month, + color: Colors.grey.shade600, + fontSize: 16, + ), + Texts( + "${widget.pointsAmountPerMonth.month}, ${widget.year}", + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + ), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Texts( + TranslationBase.of(context).point, + color: Colors.grey.shade600, + fontSize: 16, + ), + Texts( + "${widget.pointsAmountPerMonth.pointsPerMonth}", + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + ), + SizedBox( + child: Container( + color: Colors.grey, + ), + width: 1, + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Texts( + TranslationBase.of(context).riyal, + color: Colors.grey.shade600, + fontSize: 16, + ), + Texts( + "${widget.pointsAmountPerMonth.amountPerMonth}", + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + SizedBox( + height: 10, + ), + LakumPointTableRowWidget(true, "DAY", 0, 0, null, 0), + ...List.generate( + widget.pointsAmountPerMonth.pointsAmountPerday.length, + (index) => LakumPointTableRowWidget( + false, + widget.pointsAmountPerMonth.pointsAmountPerday[index].day, + widget.pointsAmountPerMonth.pointsAmountPerday[index] + .pointsPerDay, + widget.pointsAmountPerMonth.pointsAmountPerday[index] + .amountPerDay, + () { + setState(() { + if (widget.expandedItemIndex == index) { + widget.expandedItemIndex = -1; + } else { + widget.expandedItemIndex = index; + } + }); + }, + index, + expandFlag: widget.expandedItemIndex == index, + collapsed: Column( + children: [ + ...List.generate( + widget.pointsAmountPerMonth.pointsAmountPerday[index] + .pointsDetails.length, + (index) => DayPointsDetailWidget( + widget + .pointsAmountPerMonth + .pointsAmountPerday[index] + .pointsDetails[index] + .subTransactionTypeDescription, + widget + .pointsAmountPerMonth + .pointsAmountPerday[index] + .pointsDetails[index].purchasePoints, + widget + .pointsAmountPerMonth + .pointsAmountPerday[index] + .pointsDetails[index].amount), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} + +class DayPointsDetailWidget extends StatelessWidget { + final String rowTitle; + final double points; + final double riyal; + + DayPointsDetailWidget(this.rowTitle, this.points, this.riyal); + + @override + Widget build(BuildContext context) { + return Container( + color: Color(0xffe4e4e4), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 12), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + children: [ + Expanded( + child: Container( + child: Column( + children: [ + Texts( + "TYPE", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 4, + ), + Texts( + rowTitle, + fontSize: 14, + fontWeight: FontWeight.normal, + ), + ], + crossAxisAlignment: CrossAxisAlignment.start, + ), + )), + Expanded( + + child: Container( + child: Texts( + "$points", + fontSize: 14, + fontWeight: FontWeight.normal, + ), + )), + Expanded( + child: Container( + child: Texts( + "$riyal", + fontSize: 14, + fontWeight: FontWeight.normal, + ), + )), + Expanded(child: Container()), + ], + ), + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lakum-points-year-page.dart b/lib/pages/pharmacies/screens/lakum-points-year-page.dart new file mode 100644 index 00000000..f7b6d9e6 --- /dev/null +++ b/lib/pages/pharmacies/screens/lakum-points-year-page.dart @@ -0,0 +1,201 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lakum-point-table-row-widget.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/material.dart'; + +import 'lakum-points-month-page.dart'; + +class LakumPointsYearPage extends StatefulWidget { + final List pointsAmountPerYear; + int selectedIndexYear = 0; + + LakumPointsYearPage(this.pointsAmountPerYear); + + @override + _LakumPointsYearPageState createState() => _LakumPointsYearPageState(); +} + +class _LakumPointsYearPageState extends State { + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Lakum points", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + height: 100, + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + ...List.generate( + widget.pointsAmountPerYear.length, + (index) => LacumPointsYearWidget( + mediaQuery, + widget.selectedIndexYear == index, + widget.pointsAmountPerYear[index], () { + setState(() { + widget.selectedIndexYear = index; + }); + })), + ], + ), + ), + SizedBox( + height: 0, + ), + LakumPointTableRowWidget(true, "MONTH", 0, 0, null, 0), + ...List.generate( + widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth.length, + (index) => LakumPointTableRowWidget( + false, + widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth[index].month, + widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth[index].pointsPerMonth, + widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth[index].amountPerMonth, + (){ + Navigator.push(context, + FadePage(page: LakumPointMonthPage(widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth[index], widget.pointsAmountPerYear[widget.selectedIndexYear].year))); + }, + index), + ), + ], + ), + ), + ), + ), + ); + } +} + +class LacumPointsYearWidget extends StatelessWidget { + final MediaQueryData mediaQuery; + final bool isSelected; + final PointsAmountPerYear yearPoints; + final Function yearOnTap; + + LacumPointsYearWidget( + this.mediaQuery, this.isSelected, this.yearPoints, this.yearOnTap); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: yearOnTap, + child: Container( + width: mediaQuery.size.width / 2 - 16, + padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 4), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: isSelected ? Color(0xff004bcc) : Color(0xffefefef), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Texts( + "YEAR: ${yearPoints.year}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + ), + ], + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(left: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "POINT", + fontSize: 12, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + SizedBox( + height: 4, + ), + Texts( + "${yearPoints.pointsPerYear}", + fontSize: 12, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + ], + ), + ), + ), + SizedBox( + child: Container( + color: isSelected ? Colors.white : Colors.grey, + ), + width: 1, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts( + "RIYAL", + fontSize: 13, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + SizedBox( + height: 4, + ), + Texts( + "${yearPoints.amountPerYear}", + fontSize: 13, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lakum-terms-conditions-page.dart b/lib/pages/pharmacies/screens/lakum-terms-conditions-page.dart new file mode 100644 index 00000000..228b0874 --- /dev/null +++ b/lib/pages/pharmacies/screens/lakum-terms-conditions-page.dart @@ -0,0 +1,77 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.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/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:provider/provider.dart'; + +class LakumTermsConditions extends StatelessWidget { + final String firstName, lastName, mobileNo, identificationNo; + final int languageId; + + LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, + this.mobileNo, this.languageId); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getUserTermsAndConditionsForEPharmcy(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: "${TranslationBase.of(context).register} ${TranslationBase.of(context).lakum}", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + margin: EdgeInsets.all(8), + width: double.infinity, + child: Stack( + children: [ + SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (model.listUserAgreement != null && + model.listUserAgreement.userAgreementLAKUM != + null) + Html( + data: projectProvider.isArabic + ? model.listUserAgreement.userAgreementLAKUMn + : model.listUserAgreement.userAgreementLAKUM, + ), + ], + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Container( + height: 50, + margin: EdgeInsets.all(8), + child: BorderedButton( + TranslationBase.of(context).acceptLbl, + backgroundColor: Color(0xff60686b), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: () { + model.createNewLakumAccount("$firstName $lastName", mobileNo, identificationNo, languageId).then((status) => { + if (status == 200) {Navigator.pop(context, "")} + // back to previous page + }); + }, + ), + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart new file mode 100644 index 00000000..8cdbaf3c --- /dev/null +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -0,0 +1,202 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class PaymentMethodSelectPage extends StatefulWidget { + @override + _PaymentMethodSelectPageState createState() => + _PaymentMethodSelectPageState(); +} + +class _PaymentMethodSelectPageState extends State { + PaymentOption selectedPaymentOption; + + @override + Widget build(BuildContext context) { + Size screenSize = MediaQuery.of(context).size; + double cardWidth = screenSize.width / 2 - 32; + + return AppScaffold( + title: "Payment method", + isShowAppBar: true, + isShowDecPage: false, + body: Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Texts( + TranslationBase.of(context).selectPaymentOption, + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16), + child: Column( + children: [ + Row( + children: [ + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.meda, + () => { + setState(() { + selectedPaymentOption = PaymentOption.meda; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.sadad, + () => { + setState(() { + selectedPaymentOption = PaymentOption.sadad; + }) + }), + ], + ), + Row( + children: [ + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.visa, + () => { + setState(() { + selectedPaymentOption = PaymentOption.visa; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.mastercard, + () => { + setState(() { + selectedPaymentOption = + PaymentOption.mastercard; + }) + }), + ], + ), + PaymentMethodCard( + (cardWidth * 2 + 32), + selectedPaymentOption, + PaymentOption.installments, + () => { + setState(() { + selectedPaymentOption = + PaymentOption.installments; + }) + }), + ], + ), + ), + ], + ), + ), + bottomSheet: Container( + height: screenSize.height * 0.08, + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: BorderedButton( + TranslationBase.of(context).next, + backgroundColor: Color(0xff5AB154), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: selectedPaymentOption != null + ? () => {Navigator.pop(context, selectedPaymentOption)} + : null, + ), + ), + ); + } +} + +class PaymentMethodCard extends StatelessWidget { + final double cardWidth; + final PaymentOption selectedPaymentOption; + final PaymentOption paymentOption; + final Function selectMethod; + + PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, + this.paymentOption, this.selectMethod); + + @override + Widget build(BuildContext context) { + bool isSelected = false; + if (selectedPaymentOption != null && + selectedPaymentOption == paymentOption) { + isSelected = true; + } + + return InkWell( + onTap: selectMethod, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0), + child: Stack( + children: [ + Container( + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8), + margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8), + decoration: new BoxDecoration( + color: Colors.grey.shade100, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300, + width: 0.8, + )), + ), + width: cardWidth, + child: Image.asset( + getPaymentOptionImage(paymentOption), + fit: BoxFit.cover, + ), + ), + if (isSelected) + Positioned( + right: 1, + child: Icon( + Icons.check_circle, + color: Color(0xff20BC11), + size: 30, + ), + ), + ], + ), + ), + ); + } + + String getPaymentOptionImage(PaymentOption paymentOption) { + String assetFile = "assets/images/pharmacy_module/payment/"; + switch (paymentOption.index) { + case 0: + return "${assetFile}mada.png"; + break; + case 1: + return "${assetFile}sadad.png"; + break; + case 2: + return "${assetFile}visa.png"; + break; + case 3: + return "${assetFile}mastercard.png"; + break; + case 4: + return "${assetFile}installment.png"; + break; + default: + return ""; + } + } +} diff --git a/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart b/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart new file mode 100644 index 00000000..87c1b97c --- /dev/null +++ b/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart @@ -0,0 +1,51 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/tems-condition-viewmodel.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/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:provider/provider.dart'; + +class PharmacyTermsConditions extends StatelessWidget { + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getUserTermsAndConditionsForEPharmcy(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).termOfService, + isShowAppBar: true, + isShowDecPage: false, + isPharmacy: true, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + margin: EdgeInsets.all(8), + width: double.infinity, + child: Stack( + children: [ + SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (model.listUserAgreement != null && + model.listUserAgreement.userAgreementLAKUM != + null) + Html( + data: projectProvider.isArabic + ? model.listUserAgreement.userAgreementTxtn + : model.listUserAgreement.userAgreementTxt, + ), + ], + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 2ae2be65..fd51d6ef 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -2,27 +2,32 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/order-preview-page.dart'; +import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; 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'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; -class PharmacyPage extends StatelessWidget { +import 'lacum-activitaion-vida-page.dart'; +class PharmacyPage extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( - // onModelReady: (model) => model.getPharmacyHomeData(), onModelReady: (model) => model.getPharmacyHomeData(), + allowAny: true, builder: (_, model, wi) => AppScaffold( title: "", - isShowAppBar: true, + isShowAppBar: false, isShowDecPage: false, baseViewModel: model, backgroundColor: Colors.white, @@ -33,8 +38,7 @@ class PharmacyPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ BannerPager(model), - GridViewButtons(), - /*BannerPager(model.getBannerImagesUrl()),*/ + GridViewButtons(model), Container( margin: EdgeInsets.fromLTRB(10, 0, 10, 0), child: Row( @@ -48,9 +52,12 @@ class PharmacyPage extends StatelessWidget { TranslationBase.of(context).viewAll, hasBorder: true, vPadding: 6, + hPadding: 4, borderColor: Colors.green, - color: Colors.green, - handler: () {}, + textColor: Colors.green, + handler: () =>{ + Navigator.push(context,FadePage(page: ProductBrandsPage())), + }, ), ], ), @@ -77,15 +84,18 @@ class PharmacyPage extends StatelessWidget { TranslationBase.of(context).viewAll, hasBorder: true, vPadding: 6, + hPadding: 4, borderColor: Colors.green, - color: Colors.green, + textColor: Colors.green, handler: () {}, ), ], ), ), Container( - height: model.lastVisitedProducts.length > 0 ? MediaQuery.of(context).size.height / 4 : 0, + height: model.lastVisitedProducts.length > 0 + ? MediaQuery.of(context).size.height / 4 + 20 + : 0, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem(model.lastVisitedProducts[i]), @@ -106,15 +116,18 @@ class PharmacyPage extends StatelessWidget { TranslationBase.of(context).viewAll, hasBorder: true, borderColor: Colors.green, - color: Colors.green, + textColor: Colors.green, vPadding: 6, - handler: () {}, + hPadding: 4, + handler: () =>{ + Navigator.push(context,FadePage(page: ProductBrandsPage())), + }, ), ], ), ), Container( - height: MediaQuery.of(context).size.height / 4, + height: MediaQuery.of(context).size.height / 4 + 20, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem(model.bestSellerProduct[i]), @@ -132,6 +145,10 @@ class PharmacyPage extends StatelessWidget { } class GridViewButtons extends StatelessWidget { + final PharmacyModuleViewModel model; + + GridViewButtons(this.model); + @override Widget build(BuildContext context) { final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; @@ -153,24 +170,34 @@ class GridViewButtons extends StatelessWidget { opacity: 0.8, child: GridViewCard( TranslationBase.of(context).offersAndPromotions, - 'assets/images/pharmacy_module/offer_icon.png', - () { - Navigator.push(context, FadePage(page: OrderPreviewPage())); - }), + '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', () {}), + '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', () {}), + 'assets/images/pharmacy_module/prescription_icon.png', () { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())); + }), ), DashboardItem( imageName: 'pharmacy_module/bg_4.png', @@ -179,7 +206,7 @@ class GridViewButtons extends StatelessWidget { child: GridViewCard( TranslationBase.of(context).searchAndScanMedication, 'assets/images/pharmacy_module/search_scan_icon.png', - () {}), + () {}), ), ], ), @@ -219,11 +246,16 @@ class GridViewCard extends StatelessWidget { ), ), ), - Expanded( - child: BorderedButton( - TranslationBase.of(context).viewAll, - handler: handler, - ), + Row( + children: [ + BorderedButton( + TranslationBase.of(context).viewAll, + handler: handler, + tPadding: 0, + bPadding: 0, + ), + Expanded(child: Container()), + ], ), ], ), 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/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart index 81b6068a..92e2c39d 100644 --- a/lib/pages/pharmacies/widgets/ProductOrderItem.dart +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -1,13 +1,239 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class ProductOrderItem extends StatefulWidget { + final ShoppingCart item; + final VoidCallback changeCartItems; + final VoidCallback deleteCartItems; + + ProductOrderItem(this.item, this.changeCartItems, this.deleteCartItems); + + @override + _ProductOrderItemState createState() => _ProductOrderItemState(); +} + +class _ProductOrderItemState extends State { + TextEditingController _quantityController = new TextEditingController(); + String _totalPrice = "0"; + + @override + void initState() { + _quantityController.text = "${widget.item.quantity}"; + _totalPrice = + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; + super.initState(); + } -class ProductOrderItem extends StatelessWidget { @override Widget build(BuildContext context) { - return ListTile( - leading: Icon( - Icons.delete_outline_sharp, - color: Colors.grey.shade800, - ), + ProjectViewModel projectProvider = Provider.of(context); + + return Column( + children: [ + ListTile( + leading: InkWell( + onTap: () => {widget.deleteCartItems()}, + child: Icon( + Icons.delete_outline_sharp, + color: Colors.grey.shade700, + ), + ), + title: Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + (widget.item.product.images != null && widget.item.product.images.length > 0) + ? Image.network( + widget.item.product.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), + Expanded( + child: Container( + margin: + const EdgeInsets.symmetric(vertical: 8, horizontal: 8), + child: Container( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Texts( + projectProvider.isArabic + ? widget.item.product.namen + : widget.item.product.name, + regular: true, + textAlign: TextAlign.justify, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + margin: const EdgeInsets.only(bottom: 4), + ), + Container( + child: Texts( + "${(widget.item.product.price).toStringAsFixed(2)} ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + margin: const EdgeInsets.only(bottom: 4), + ), + Row( + children: [ + InkWell( + onTap: () => + {_quantityOnChangeClick(Operation.dec)}, + child: Container( + width: 25, + height: 25, + child: Center( + child: Texts( + "-", + color: Colors.grey.shade400, + )), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + ), + ), + Container( + margin: + const EdgeInsets.symmetric(horizontal: 4), + width: 25, + height: 25, + color: Colors.grey.shade300, + child: Center( + child: TextField( + cursorColor: Colors.black, + keyboardType: TextInputType.number, + controller: _quantityController, + textAlign: TextAlign.center, + onChanged: (text) { + setState(() { + var value = int.tryParse(text); + if (value == null) { + widget.item.quantity = 0; + } else { + widget.item.quantity = int.parse(text); + } + _totalPrice = + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; + }); + }, + )), + ), + InkWell( + onTap: () => + {_quantityOnChangeClick(Operation.inc)}, + child: Container( + width: 25, + height: 25, + child: Center( + child: Texts( + "+", + color: Colors.grey.shade400, + )), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + TranslationBase.of(context).total, + color: Colors.grey.shade500, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + Texts( + "$_totalPrice ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}", + fontSize: 12, + fontWeight: FontWeight.bold, + ) + ], + ), + ) + ], + ) + ], + ), + ), + ), + ) + ], + ), + ), + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 15, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], ); } + + _quantityOnChangeClick(Operation operation) { + int newValue = 0; + setState(() { + switch (operation) { + case Operation.inc: + { + newValue = widget.item.quantity + 1; + } + break; + + case Operation.dec: + { + newValue = widget.item.quantity - 1; + } + break; + default: + { + //statements; + } + break; + } + if (newValue > 0) { + widget.item.quantity = newValue; + _quantityController.text = "${widget.item.quantity}"; + _totalPrice = + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; + } + }); + if (newValue > 0) { + widget.changeCartItems(); + } + } + + @override + void dispose() { + // Clean up the controller when the widget is removed from the + // widget tree. + _quantityController.dispose(); + super.dispose(); + } } + +enum Operation { inc, dec } diff --git a/lib/pages/pharmacies/widgets/ProductOrderPreviewItem.dart b/lib/pages/pharmacies/widgets/ProductOrderPreviewItem.dart new file mode 100644 index 00000000..d38f437c --- /dev/null +++ b/lib/pages/pharmacies/widgets/ProductOrderPreviewItem.dart @@ -0,0 +1,111 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class ProductOrderPreviewItem extends StatelessWidget { + final ShoppingCart item; + + ProductOrderPreviewItem(this.item); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return Container( + margin: EdgeInsets.only(top: 16), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + (item.product.images != null && item.product.images.length > 0) + ? Image.network( + item.product.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), + Expanded( + child: Container( + margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 8), + child: Container( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Texts( + projectProvider.isArabic + ? item.product.namen + : item.product.name, + regular: true, + textAlign: TextAlign.justify, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + margin: const EdgeInsets.only(bottom: 4), + ), + Container( + child: Texts( + "${(item.product.price).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + margin: const EdgeInsets.only(bottom: 4), + ), + Container( + width: double.infinity, + alignment: Alignment.centerRight, + child: Texts( + TranslationBase.of(context).total, + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + fontSize: 13, + ), + ), + Row( + children: [ + Texts( + "QTY: ${item.quantity}", + color: Colors.grey.shade500, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + Expanded( + child: Container( + alignment: Alignment.centerRight, + child: Texts( + "${(item.product.price * item.quantity).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ) + ], + ), + ], + ), + ), + )), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 0, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 62493387..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,7 +18,7 @@ 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 { @@ -69,11 +70,17 @@ class ProductTileItem extends StatelessWidget { Container( margin: EdgeInsets.fromLTRB(0, 16, 0, 0), alignment: Alignment.center, - child: Image.network( - item.images[0].src, - fit: BoxFit.cover, - height: 80, - ), + child: (item.images != null && item.images.length > 0) + ? Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), ), Container( width: item.rxMessage != null @@ -104,7 +111,7 @@ class ProductTileItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - projectProvider.isArabic ? item.name : item.namen, + projectProvider.isArabic ? item.namen : item.name, regular: true, fontSize: 12, fontWeight: FontWeight.w400, @@ -119,19 +126,21 @@ class ProductTileItem extends StatelessWidget { ), Row( children: [ - StarRating( - totalAverage: item.approvedTotalReviews > 0 - ? (item.approvedRatingSum.toDouble() / - item.approvedTotalReviews.toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( + Expanded( + child: StarRating( + totalAverage: item.approvedTotalReviews > 0 + ? (item.approvedRatingSum.toDouble() / + item.approvedTotalReviews.toDouble()) + .toDouble() + : 0, + forceStars: true), + ), + /*Texts( "(${item.approvedTotalReviews})", regular: true, fontSize: 10, fontWeight: FontWeight.w400, - ) + ),*/ ], ), ], diff --git a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart new file mode 100644 index 00000000..14a53e72 --- /dev/null +++ b/lib/pages/pharmacies/widgets/lacum-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-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..6e4e2309 --- /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/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 new file mode 100644 index 00000000..822dfe89 --- /dev/null +++ b/lib/pages/pharmacies/wishlist.dart @@ -0,0 +1,69 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; + +class WishlistPage extends StatefulWidget { + @override + _WishlistPageState createState() => _WishlistPageState(); +} + +class _WishlistPageState extends State { + bool isTrue = true; + + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getWishlistData(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: 'Wishlist page', + 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/order/Order.dart b/lib/pages/pharmacy/order/Order.dart new file mode 100644 index 00000000..576bf2a0 --- /dev/null +++ b/lib/pages/pharmacy/order/Order.dart @@ -0,0 +1,1148 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; + +dynamic languageID; +class OrderPage extends StatefulWidget { + +// orderList({this.customerId, this.pageId}); + + String customerID; + + OrderPage({@required this.customerID}); + + @override + _OrderPageState createState() => _OrderPageState(); +} + +class _OrderPageState extends State with SingleTickerProviderStateMixin{ + + String pageID= "1"; + String customerId = ""; + String order =""; + + List orderList = [] ; + List deliveredOrderList = [] ; + List processingOrderList = []; + List cancelledOrderList = []; + List pendingOrderList = []; + + TabController _tabController; +// AppSharedPreferences sharedPref = AppSharedPreferences(); + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + + @override + void initState() { + getLanguageID(); + super.initState(); + + + _tabController = new TabController(length: 4, vsync: this,); + } + + @override + Widget build(BuildContext context) { + print( "customerID" + widget.customerID); + return BaseView( + onModelReady: (model) => model.getOrder(widget.customerID, pageID), + builder: (_,model, wi )=> AppScaffold( + appBarTitle:TranslationBase.of(context).order, + baseViewModel: model, + isShowAppBar: true, + isPharmacy:true , + body: Container( + child: Column( + children: [ + TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).delivered), + Tab(text: TranslationBase.of(context).processing), + Tab(text: TranslationBase.of(context).pending), + Tab(text: TranslationBase.of(context).cancelled), + ], + controller: _tabController, + ), + Divider( + color: Colors.grey[350], + height: 10, + thickness: 6, + indent: 0, + endIndent: 0, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + getDeliveredOrder(model), + getProcessingOrder(model), + getPendingOrder(model), + getCancelledOrder(model), + ], + controller: _tabController, + ), + ), + ], + ), + ), + ), + ); + } + + + + Widget getDeliveredOrder(OrderModelViewModel model){ + for(int i=0 ; i< model.order.length; i++){ + if( model.order[i].orderStatusId == 30 || model.order[i].orderStatusId == 997 + || model.order[i].orderStatusId == 994 + ){ + deliveredOrderList.add(model.order[i]); + } + } + return Container( + width: MediaQuery.of(context).size.width, + child: model.order.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: deliveredOrderList.length, + itemBuilder: (context, index){ + return Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderNumber, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text(deliveredOrderList[index].id.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderDate, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,11), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:deliveredOrderList[index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + :'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.blue[700], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.blue[700], + borderRadius: BorderRadius.circular(30.0) + ), + child: deliveredOrderList[index].orderStatusId == 30 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).deliveredOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? deliveredOrderList[index].orderStatusn.toString(): + deliveredOrderList[index].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(deliveredOrderList[index].orderTotal.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text(deliveredOrderList[index].orderItems.length.toString(), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).itemsNo, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), + ); + } + + Widget getProcessingOrder(OrderModelViewModel model){ + for(int i=0 ; i< model.order.length; i++){ + if( model.order[i].orderStatusId == 20 || model.order[i].orderStatusId == 995 || + model.order[i].orderStatusId == 998 || model.order[i].orderStatusId == 999){ + processingOrderList.add(model.order[i]); + } + } + return Container( + width: MediaQuery.of(context).size.width, + child: model.order.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: processingOrderList.length, + itemBuilder: (context, index){ + return Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderNumber, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text(processingOrderList[index].id.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderDate, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text(processingOrderList[index].createdOnUtc.toString().substring(0,11), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + :'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.green, + borderRadius: BorderRadius.circular(30.0) + ), + child: processingOrderList[index].orderStatusId == 20 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).processingOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? processingOrderList[index].orderStatusn.toString(): + processingOrderList[index].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(processingOrderList[index].orderTotal.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text(processingOrderList[index].orderItems.length.toString(), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).itemsNo, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), + ); +// return Container( +// child: model.order.length != 0 +// ? SingleChildScrollView( +// child: Column( +// children: [ +// ListView.builder( +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Container( +// margin: EdgeInsets.all(8), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Row( +// children: [ +// Container( +// margin: EdgeInsets.only(right: 5), +// child: Text(TranslationBase.of(context).orderNumber, +// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, +// ), +// ), +// ), +// Container( +// child: Text(processingOrderList[0].id.toString(), +// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, +// ), +// ), +// ), +// ], +// ), +// SizedBox( +// height: 5,), +// Row( +// children: [ +// Container( +// margin: EdgeInsets.only(right: 5), +// child: Text(TranslationBase.of(context).orderDate, +// style: TextStyle(fontSize: 14.0, +// ), +// ), +// ), +// Container( +// child: Text(processingOrderList[0].createdOnUtc.toString().substring(0,11), +// style: TextStyle(fontSize: 14.0, +// ), +// ), +// ), +// ], +// ), +// ], +// ), +// ), +// Container( +// margin: EdgeInsets.all(8), +// child: InkWell( +// onTap: () { +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[0]))); +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/arrow_right.svg', +// height: 20, +// width: 20,), +// ), +// ), +// ], +// ), +// ), +// Divider( +// color: Colors.grey[350], +// height: 20, +// thickness: 1, +// indent: 0, +// endIndent: 0, +// ), +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Container( +// margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), +// padding: EdgeInsets.only(left: 13.0, right: 13.0), +// decoration: BoxDecoration( +// border: Border.all( +// color: Colors.green, +// style: BorderStyle.solid, +// width: 5.0, +// ), +// color: Colors.green, +// borderRadius: BorderRadius.circular(30.0) +// ), +// child: Text( widget.languageID == "ar" +// ? processingOrderList[0].orderStatusn.toString() +// : processingOrderList[0].orderStatus.toString().substring(12), +//// TranslationBase.of(context).processing, +// style: TextStyle( +// color: Colors.white, +// fontSize: 15.0, +// fontWeight: FontWeight.bold, +// ), +// ), +// ), +// Container( +// margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), +// child: Column( +//// crossAxisAlignment: CrossAxisAlignment.end, +// children: [ +// Row( +// children: [ +// Container( +// margin: EdgeInsets.only(left: 5), +// child: Text(processingOrderList[0].orderTotal.toString(), +// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, +// ), +// ), +// ), +// Container( +// margin: EdgeInsets.only(left: 5), +// child: Text(TranslationBase.of(context).sar, +// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, +// ), +// ), +// ), +// ], +// ), +// SizedBox( +// height: 5,), +// Row( +// children: [ +// Container( +// child: Text(processingOrderList[0].orderItems[0].quantity.toString(), +// style: TextStyle(fontSize: 14.0, +// ), +// ), +// ), +// Container( +// margin: EdgeInsets.only(left: 5), +// child: Text(TranslationBase.of(context).itemsNo, +// style: TextStyle(fontSize: 14.0, +// ), +// ), +// ), +// ], +// ), +// ], +// ), +// ), +// ], +// ), +// Divider( +// color: Colors.grey[350], +// height: 20, +// thickness: 8, +// indent: 0, +// endIndent: 0, +// ), +// ], +// ), +// ) +// : Container( +// child: Center( +// child: Column( +// mainAxisAlignment: MainAxisAlignment.center, +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// SvgPicture.asset( +// 'assets/images/pharmacy/empty_box.svg'), +// Container( +// margin: EdgeInsets.only(top: 10.0), +// child: Text(TranslationBase.of(context).noOrder, +// style: TextStyle( +// fontSize: 16.0, +// )), +// ), +// ], +// ), +// ), +// ), +// ); + } + + Widget getPendingOrder(OrderModelViewModel model){ + for(int i=0 ; i< model.order.length; i++){ + if( model.order[i].orderStatusId == 10){ + pendingOrderList.add(model.order[i]); + } + } + return Container( + child: model.order.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: pendingOrderList.length , + itemBuilder: (context, index){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderNumber, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text(pendingOrderList[index].id.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderDate, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,11), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all( 8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + :'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange[300], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.orange[300], + borderRadius: BorderRadius.circular(30.0) + ), + child: pendingOrderList[index].orderStatusId == 10 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).pendingOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? pendingOrderList[index].orderStatusn.toString(): + pendingOrderList[index].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + ), + Container( + margin: EdgeInsets.all(8.0), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(pendingOrderList[index].orderTotal.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text(pendingOrderList[index].orderItems.length.toString(), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).itemsNo, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + + ); + } + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), + + ); + } + + Widget getCancelledOrder(OrderModelViewModel model){ + for(int i=0 ; i< model.order.length; i++){ + if( model.order[i].orderStatusId == 40 || model.order[i].orderStatusId == 996 + || model.order[i].orderStatusId == 200){ + cancelledOrderList.add(model.order[i]); + } + } + return Container( + child: model.order.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: cancelledOrderList.length, + itemBuilder: (context, index){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all( 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderNumber, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text(cancelledOrderList[index].id.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderDate, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,11), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:cancelledOrderList[index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + :'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 10.0, right: 10.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.red[900], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.red[900], + borderRadius: BorderRadius.circular(30.0) + ), + child: cancelledOrderList[index].orderStatusId == 40 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).cancelledOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? cancelledOrderList[index].orderStatusn.toString(): + cancelledOrderList[index].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(cancelledOrderList[index].orderTotal.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text(cancelledOrderList[index].orderItems.length.toString(), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).itemsNo, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + + ); + } + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), + ); + } + + +} + + + + + + diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart new file mode 100644 index 00000000..5438663d --- /dev/null +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -0,0 +1,650 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; +import 'package:diplomaticquarterapp/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/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:flutter/src/widgets/image.dart' as flutterImage; + +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:provider/provider.dart'; + + + + +dynamic languageID; +class OrderDetailsPage extends StatefulWidget { + OrderModel orderModel; + + OrderDetailsPage({@required this.orderModel}); + + @override + _OrderDetailsPageState createState() => _OrderDetailsPageState(); +} + +class _OrderDetailsPageState extends State { + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + +// AppSharedPreferences sharedPref = AppSharedPreferences(); + String orderId = ""; + String customerId; + List orderList = []; + + List cancelledOrderList = []; + +// String orderId="3516"; + var model; + var isCancel = false; + var isRefund = false; + var dataIsCancel; + var dataIsRefund; + + @override + void initState() { + getLanguageID(); + super.initState(); + print(widget.orderModel.orderItems.length); + getCancelOrder(widget.orderModel.id); +// cancelOrderDetail(order) + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getOrderDetails(widget.orderModel.id), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).orderDetail, + isShowAppBar: true, + isPharmacy: true, + body: Container( + color: Colors.white, + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0), + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/shipping_mark_icon.svg', + width: 28, + height: 28, + ), + Text( + TranslationBase.of(context).shippingAddress, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 15.0, right: 10.0), + padding: EdgeInsets.only(left: 11.0, right: 11.0), + decoration: BoxDecoration( + border: Border.all( + color: getStatusBackgroundColor(), + style: BorderStyle.solid, + width: 5.0, + ), + color: getStatusBackgroundColor(), + borderRadius: BorderRadius.circular(30.0)), + child: Text( + languageID == "ar" + ? widget.orderModel.orderStatusn.toString(): + widget.orderModel.orderStatus.toString().substring(12) , +// TranslationBase.of(context).delivered, + style: TextStyle( + color: Colors.white, + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(left: 10.0, top: 13.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.orderModel.shippingAddress.firstName + .toString() + .substring(10) + + ' ' + + widget.orderModel.shippingAddress.lastName + .toString() + .substring(9), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.orderModel.shippingAddress.address1 + .toString() + .substring(9), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ),] + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.orderModel.shippingAddress.address2 + .toString() + .substring(9) + + ' ' + + widget.orderModel.shippingAddress.country + .toString() + + ' ' + + widget.orderModel.shippingAddress.zipPostalCode + .toString(), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ]), + ), + Container( + child: Row( + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/mobile_number_icon.svg', + height: 13, + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + child: Text( + widget.orderModel.shippingAddress.phoneNumber + .toString(), + style: TextStyle( + fontSize: 15.0, + ), + ), + ), + ], + ), + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 10.0, 5.0, 10.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/shipping_truck_icon.svg', + height: 20, + width: 20, + ), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + TranslationBase.of(context).shippedMethod, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: flutterImage.Image.asset( + widget.orderModel.shippingRateComputationMethodSystemName != + "Shipping.Aramex" + ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" + : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", + fit: BoxFit.contain, +// height: 100, + width: 100, + ), + ), +// Container( +// child: widget.orderModel +// .shippingRateComputationMethodSystemName == +// "Shipping.FixedOrByWeight" +// ? Container( +// margin: EdgeInsets.only(bottom: 10.0, top: 10.0), +// child: SvgPicture.asset( +// 'assets/images/pharmacy_module/payment/hmg_shipping_logo.png', +// height: 25, +// width: 25, +// ), +// ) +// : Container( +// margin: EdgeInsets.only(bottom: 10.0, top: 10.0), +// child: SvgPicture.asset( +// 'assets/images/pharmacy_module/payment/aramex_shipping_logo.png', +// height: 25, +// width: 25, +// ), +// ), +// ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + Row( + children: [ + Container( + margin: EdgeInsets.all(10.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/credit_card_icon.svg', + height: 20, + width: 20, + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Text( + widget.orderModel.paymentName.toString().substring(12), + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + Container( + padding: EdgeInsets.only(bottom: 15.0), + margin: EdgeInsets.only(left: 10.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderDetail, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount:widget.orderModel.orderItems.length, + itemBuilder: (context, index){ + return Container( + child: productTile(productName: widget.orderModel.orderItems[index].product.name.toString(), + productPrice: widget.orderModel.orderItems[index].product.price.toString(), + productRate: widget.orderModel.orderItems[index].product.approvedRatingSum.toDouble(), + productReviews:widget.orderModel.orderItems[index].product.approvedTotalReviews, + totalPrice: "${(widget.orderModel.orderItems[index].product.price + * widget.orderModel.orderItems[index].quantity).toStringAsFixed(2)}", + qyt: widget.orderModel.orderItems[index].quantity.toString(), + isOrderDetails:true, + imgs: widget.orderModel.orderItems[index].product.images != null && + widget.orderModel.orderItems[index].product.images.length != 0 + ? widget.orderModel.orderItems[index].product.images [0].src.toString() + : null, + status: widget.orderModel.orderStatusId, + product: widget.orderModel.orderItems[index].product, + ), + ); + }), + + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(left: 10.0, top: 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderSummary, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), + child: Text( + TranslationBase.of(context).subtotal, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + widget.orderModel.orderSubtotalExclTax.toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), + child: Text( + TranslationBase.of(context).shipping, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + widget.orderModel.orderShippingExclTax.toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), + child: Text( + TranslationBase.of(context).vat, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + widget.orderModel.orderTax.toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(top: 5.0, left: 10.0), + child: Text( + TranslationBase.of(context).total, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Text( + widget.orderModel.orderTotal.toString(), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ], + ), + widget.orderModel.orderStatusId == 10 + ? InkWell( + onTap: () { + model.makeOrder(); + }, + child: Container( +// margin: EdgeInsets.only(top: 20.0), + height: 50.0, + color: Colors.transparent, + child: Container( + padding: EdgeInsets.only(left: 130.0, right: 130.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 4.0), + color: Colors.green, + borderRadius: BorderRadius.circular(5.0)), + child: Center( + child: Text( + TranslationBase.of(context).payOnline, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ) + : Container(), +// getCancelOrder(canCancel, canRefund), + isCancel + ? InkWell( + onTap: () { + presentConfirmDialog(model, + widget.orderModel.id); //(widget.orderModel.id)); +// + }, + child: Container( +// padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), + height: 50.0, + color: Colors.transparent, + child: Center( + child: Text( + TranslationBase.of(context).cancelOrder, + style: TextStyle( + color: Colors.red[900], + fontWeight: FontWeight.bold, + decoration: TextDecoration.underline), + ), + ), + ), + ) + : Container(), + ], + ), + ), + ), + ), + ); + } + + Color getStatusBackgroundColor() { + print(widget.orderModel.orderStatusId); +// if(orderStatus == 'delivered') + if (widget.orderModel.orderStatusId == 30 || + widget.orderModel.orderStatusId == 997 || + widget.orderModel.orderStatusId == 994) + return Colors.blue[700]; + else if (widget.orderModel.orderStatusId == 20 || + widget.orderModel.orderStatusId == 995 || + widget.orderModel.orderStatusId == 998 || + widget.orderModel.orderStatusId == 999) + return Colors.green; + else if (widget.orderModel.orderStatusId == 10) + return Colors.orange[300]; + else if (widget.orderModel.orderStatusId == 40 || + widget.orderModel.orderStatusId == 996 || + widget.orderModel.orderStatusId == 200) return Colors.red[900]; + } + + getCancelOrder(dataIsCancel) { + if (widget.orderModel.canCancel && widget.orderModel.canRefund) { + setState(() { + isCancel = true; + isRefund = false; + }); + } else if (widget.orderModel.canCancel) { + setState(() { + isCancel = true; + isRefund = false; + }); + } else if (widget.orderModel.canRefund) { + setState(() { + isCancel = false; + isRefund = true; + }); + } else { + setState(() { + isCancel = false; + isRefund = false; + }); + } + } + +// .getCanceledOrder + presentConfirmDialog(cancelFunction, id) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).confirmCancellation, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => + cancelFunction.getCanceledOrder(id, context).then((value) { + print(":D"); + print(value); +// Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrderPage( + customerID: widget.orderModel.customerId.toString())), + ); + }), + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + + getCanceledOrder(order) { + Navigator.pop(context); + if (widget.orderModel.canCancel && widget.orderModel.canRefund == false) { +// getCanceledOrder(order); +// AppToast.showSuccessToast(message: "Request Sent Successfully"); +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => OrderPage())); + + } + } +} diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart new file mode 100644 index 00000000..4d09191c --- /dev/null +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -0,0 +1,367 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.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/core/model/pharmacies/order_model.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:intl/intl.dart'; +import 'package:rating_bar/rating_bar.dart'; +import 'package:flutter/src/widgets/image.dart' as flutterImage; + +class ProductReviewPage extends StatefulWidget { + final Product product; + + ProductReviewPage(this.product); + + @override + _ProductReviewPageState createState() => _ProductReviewPageState(); +} + +class _ProductReviewPageState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + double currentRating = 0; + String reviewText = ""; + TextEditingController _reviewController = new TextEditingController(); + bool finishReview = false; + + @override + Widget build(BuildContext context) { + double ratingValue = double.parse("${widget.product.approvedRatingSum}"); + return BaseView( + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).writeReview, + isShowAppBar: true, + isPharmacy: true, + body: Container( + color: Colors.white, + child: !finishReview ? SingleChildScrollView( + child: Column( + children: [ + Container( + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + widget.product.images != null + ? flutterImage.Image.network( + widget.product.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : flutterImage.Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), + Expanded( + child: Container( + child: Column( + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.product.name, + style: TextStyle( + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.normal), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: + '${widget.product.price} ${TranslationBase.of(context).sar}', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: ratingValue, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + SizedBox( + width: 20, + ), + Container( + child: Align( + child: RichText( + text: TextSpan( + text: + '(${widget.product.approvedTotalReviews} reviews)', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), + ), + ), + ), + ), + ], + ), + ], + ), + ), + ), + ]), + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + Container( + margin: EdgeInsets.only(top: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar( + size: 40.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + onRatingChanged: (rating) { + currentRating = rating; + }, + ), + ], + ), + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Column( + children: [ + TextFormField( + controller: _reviewController, + maxLines: 6, + minLines: 4, + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Tell us more about product!', + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.0), + borderSide: + BorderSide(width: 1, color: Colors.grey[400]), + ), + enabledBorder: OutlineInputBorder( + borderRadius: + BorderRadius.all(Radius.circular(5.0)), + borderSide: + BorderSide(color: Colors.grey[400], width: 1), + ), + ), + onChanged: (value) { + setState(() { + reviewText = value; + }); + }, + textAlign: TextAlign.start, + textAlignVertical: TextAlignVertical.top, + ), + ], + ), + ), + InkWell( + onTap: reviewText != null && reviewText != "" + ? () { + model + .makeReview( + widget.product, ratingValue, reviewText) + .then((value) { + setState(() { + finishReview = true; + }); + }); + } + : null, + child: Container( + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + height: 50.0, + width: 400.0, + color: Colors.transparent, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: _reviewController.value.text != null && + _reviewController.value.text != "" + ? Colors.yellow[700] + : Color(0xFFf5d69c), + style: BorderStyle.solid, + width: 1.0), + color: _reviewController.value.text != null && + _reviewController.value.text != "" + ? Colors.yellow[700] + : Color(0xFFf5d69c), + borderRadius: BorderRadius.circular(5.0)), + child: Center( + child: Text( + TranslationBase.of(context).shareReview, + style: TextStyle( + color: Colors.white, + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), + ], + ), + ) : getReviewedProduct(), + ), + ), + ); + } + + //new screen is showing after submitting the review + Widget getReviewedProduct() { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/check_icon.svg', + width: 28, + height: 28, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + child: Text( + TranslationBase.of(context).reviewSuccessful, + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8, vertical: 8), + child: Text( + TranslationBase.of(context).reviewShared, + style: TextStyle( + fontSize: 15.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(bottom: 30.0, top: 30.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/success_review_icon.svg', + width: 100, + height: 100, + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/quote_start.svg', + width: 15, + height: 15, + ), + ], + ), + Text( + TranslationBase.of(context).reviewComment, + style: TextStyle( + fontSize: 15.0, + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/quote_end.svg', + width: 15, + height: 15, + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 20.0), + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return PharmacyProfilePage(); + }), + ); + }, + child: Container( + height: 50.0, + color: Colors.transparent, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange, + style: BorderStyle.solid, + width: 1.0), + color: Colors.transparent, + borderRadius: BorderRadius.circular(5.0)), + child: Center( + child: Text( + TranslationBase.of(context).backMyAccount, + style: TextStyle( + color: Colors.orange, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), + ), + ], + ); + } + +} diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart new file mode 100644 index 00000000..7569ed43 --- /dev/null +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -0,0 +1,79 @@ +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:diplomaticquarterapp/uitl/translations_delegate_base.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 + _AddAddressPageState createState() => _AddAddressPageState(); +} + +class _AddAddressPageState extends State { + double _latitude; + double _longitude; + + @override + void initState() { + 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(); + } + } + + _getCurrentLocation() async { + await Geolocator.getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); + } + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - + 60 - + mediaQuery.padding.top; + + return BaseView( + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).changeAddress, + isShowAppBar: true, + isPharmacy: true, + backgroundColor: Colors.white, + 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); + }, + ), + ), + ), + ); + } +} diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart new file mode 100644 index 00000000..340e2bd8 --- /dev/null +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -0,0 +1,313 @@ +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:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; + +class PharmacyAddressesPage extends StatefulWidget { + @override + _PharmacyAddressesState createState() => _PharmacyAddressesState(); +} + +class _PharmacyAddressesState extends State { + void navigateToAddressPage( + BuildContext ctx, PharmacyAddressesViewModel model, Addresses address) { + Navigator.push( + ctx, + FadePage( + page: AddAddressPage(address, (pickResult) { + model.addEditAddress(pickResult, address); + }))); + } + + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; + + return BaseView( + onModelReady: (model) => model.getAddressesList(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).changeAddress, + isShowAppBar: true, + isPharmacy: true, + baseViewModel: model, + backgroundColor: Colors.white, + body: Container( + height: height * 0.90, + child: SingleChildScrollView( + child: Column( + 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); + }), + ), + 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: Container( + height: height * 0.10, + color: Colors.white, + child: Column( + children: [ + Divider( + color: Colors.grey.shade300, + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + 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]); + }, + ), + ), + ], + ), + ), + ), + ); + } +} + +class AddressItemWidget extends StatelessWidget { + final PharmacyAddressesViewModel model; + final Addresses address; + final Function selectAddress; + final bool isSelected; + final Function(Addresses) onTabEditAddress; + + 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 new file mode 100644 index 00000000..ba742179 --- /dev/null +++ b/lib/pages/pharmacy/profile/profile.dart @@ -0,0 +1,626 @@ +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'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; +import 'package:diplomaticquarterapp/pages/login/welcome.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-terms-conditions-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; +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 ; +class PharmacyProfilePage extends StatefulWidget { + @override + _ProfilePageState createState() => _ProfilePageState(); +} + +class _ProfilePageState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + String page_id = ""; + + AuthenticatedUser user; + bool isLogin = false; + String firstName; + String customerId; + String lastName, mobileNo, identificationNo; + int languageId; + + _ProfilePageState({this.customerId }); + + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + getCustomer() async { + String custID; + custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + setState(() { + customerId = custID; + }); + print("customer Id is"+ customerId); + 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()), + ); + } + } + +// this.isLogin = user != null; + } + void initState() { + getCustomer(); + getLanguageID(); + super.initState(); + getUser(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getOrder(customerId, page_id), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).myAccount, + isShowAppBar:false, + isShowDecPage: false, + isPharmacy: true, + body: user != null ? Container( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + child: Row( + children: [ + Container( + padding: EdgeInsets.only( + top: 20.0, + left: 10.0, + right: 10.0, + bottom: 10.0, + ), + child: LargeAvatar( + name: "profile", + url: '', + ), + ), + Container( + 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), + ), + ], + ), + ), + ), + 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, + ), + ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyReviewsPage())); + },child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/review_icon.svg', + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + )), + SizedBox( + height: 15, + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 10, + ), + Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).myAccount, + style: TextStyle( + fontSize: 16.0, fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_prescription_icon.svg', + width: 28, + height: 28, + ), + SizedBox( + width: 15, + ), + Text( + TranslationBase.of(context).myPrescription, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ComparePage())); + }, + child: Row( + children: [ + Image.asset('assets/images/pharmacy/compare.png', + width: 35, height: 35), + SizedBox( + width: 15, + ), + Text( + TranslationBase.of(context).compare, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/medication_refill_icon.svg', + width: 30, + height: 30, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).medicationsRefill, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + 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( + 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: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FindUsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/our_locations_icon.svg', + width: 30, + height: 30, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).ourLocations, + style: TextStyle(fontSize: 13.0), + ), + ], + ), + ) + ], + ), + ) + ], + ), + ), + ) : Container(), + )); + }} + + + + diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart new file mode 100644 index 00000000..06bba8c3 --- /dev/null +++ b/lib/pages/pharmacy_categorise.dart @@ -0,0 +1,239 @@ +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'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; +import 'package:diplomaticquarterapp/pages/parent_categorise_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +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:provider/provider.dart'; +import 'base/base_view.dart'; +import 'final_products_page.dart'; + +class PharmacyCategorisePage extends StatefulWidget { + @override + _PharmacyCategorisePageState createState() => _PharmacyCategorisePageState(); +} + +class _PharmacyCategorisePageState extends State { + String idCategorise; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getCategorise(), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( + isShowDecPage: false, + baseViewModel: model, + body: Column( + children: [ + Container( + height: 400, + margin: EdgeInsets.only(bottom: 22), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 1.0, + childAspectRatio: 3.2, + ), + itemCount: model.categorise.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(4.0), + child: InkWell( + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Colors.grey.withOpacity(0.24), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? model.categorise[index].namen + : model.categorise[index].name, + fontWeight: FontWeight.w600, + ), + ), + ), + onTap: () => { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + model.categorise[index].id != '12' + ? ParentCategorisePage( + id: model.categorise[index].id, + titleName: model.categorise[index].name, + ) + : FinalProductsPage( + id: model.categorise[index].id, + ), + ), + ), + }, + ), + ); + }, + ), + ), + Container( + height: 140, + child: Column( + children: [ + Divider( + height: 2.0, + thickness: 1.0, + color: Colors.black12.withOpacity(0.14)), + SizedBox( + height: 10.0, + ), + Row( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.green.shade300.withOpacity(0.34), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? 'الاكثر مبيعا' + : 'Best Sellers', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: Colors.orangeAccent.shade200 + .withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? 'الاكثر مشاهدة' + : 'Most Viewed', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ], + ), + Row( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: Colors.blue.shade200.withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? 'منتجات جديدة' + : 'New Products', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: InkWell( + onTap: () { + _scanQrAndGetPatient(context, model); + }, + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: + Colors.purple.shade200.withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? 'شوهد مؤخرا' + : 'Recently Viewed', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ), + ], + ), + ], + )), + ], + ), + ), + ); + } + + _scanQrAndGetPatient( + 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 + 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); + } else { + AppToast.showSuccessToast(message: model.scanList[0].id); + { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => LandingPagePharmacy()), + ); + } + } + } + } +} diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index 38fdd008..bf0f4b4e 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,9 +207,9 @@ class _RateAppointmentClinicState extends State { message: 'please rate the clinic'); } }, - label: "Rate", - disabled: model.state == ViewState.BusyLocal, - loading: model.state == ViewState.BusyLocal, + label: TranslationBase.of(context).submit, + disabled: (model.state == ViewState.Busy || rating==0), + // loading: model.state == ViewState.BusyLocal, textColor: Theme.of(context).backgroundColor), ), SizedBox( @@ -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..71aacae2 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/search_products_page.dart b/lib/pages/search_products_page.dart new file mode 100644 index 00000000..45cafd35 --- /dev/null +++ b/lib/pages/search_products_page.dart @@ -0,0 +1,287 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.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'; + +import 'base/base_view.dart'; + +class SearchProductsPage extends StatefulWidget { + @override + _SearchProductsPageState createState() => _SearchProductsPageState(); +} + +class _SearchProductsPageState extends State { + final textController = TextEditingController(); + final _formKey = GlobalKey(); + String msg = ''; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.clearSearchList(), + builder: (BuildContext context, PharmacyCategoriseViewModel 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, + // ), + ], + ), + ), + Center( + child: NetworkBaseView( + baseViewModel: model, + child: model.searchList.isNotEmpty + ? Container( + height: MediaQuery.of(context).size.height * 0.80, + child: GridView.builder( + //physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.searchList.length, + itemBuilder: (BuildContext context, int index) { + return Card( + color: model.searchList[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: [ + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.searchList[index].images + .isNotEmpty + ? model.searchList[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.searchList[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.searchList[index] + .rxMessage != + null + ? model.searchList[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: [ + Texts( + model.searchList[index].name, + regular: true, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + Padding( + padding: const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.searchList[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .searchList[ + index] + .approvedRatingSum > + 0 + ? (model + .searchList[ + index] + .approvedRatingSum + .toDouble() / + model + .searchList[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.searchList[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + ); + }, + ), + ) + : Texts(msg), + ), + ) + ], + ), + ), + ), + ), + ); + } + + searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) { + Utils.hideKeyboard(context); + if (_formKey.currentState.validate()) + model.searchProducts(productName: textController.text); + } +} 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/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart new file mode 100644 index 00000000..45c9fd6c --- /dev/null +++ b/lib/pages/sub_categorise_page.dart @@ -0,0 +1,944 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.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'; +import 'package:provider/provider.dart'; + +import 'base/base_view.dart'; +import 'final_products_page.dart'; + +class SubCategorisePage extends StatefulWidget { + String id; + String title; + String parentId; + + SubCategorisePage({this.id, this.parentId, this.title}); + @override + _SubCategorisePageState createState() => + _SubCategorisePageState(id: id, title: title, parentId: parentId); +} + +class _SubCategorisePageState extends State { + bool checkedBrands = false; + bool checkedCategorise = false; + String id; + String title; + String parentId; + _SubCategorisePageState({this.title, this.parentId, this.id}); + String categoriseName = "Personal Care"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getSubCategorise(i: id), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: title, + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 5.97, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + parentId == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : parentId == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : parentId == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : parentId == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : parentId == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : parentId == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : parentId == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : parentId == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : parentId == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : parentId == + '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.subCategorise.length > 8) + Column( + children: [ + InkWell( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts('View All Categories'), + ), + ), + Icon(Icons.arrow_forward) + ], + ), + 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.subCategorise.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 + .subCategorise[ + index] + .name), + Divider( + thickness: 0.6, + color: Colors.black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + FinalProductsPage( + id: model + .subCategorise[ + index] + .id, + ), + ), + ); + }, + ), + ), + ); + }), + ), + ); + }, + ); + }, + ), + 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.subCategorise.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.17, + height: MediaQuery.of(context) + .size + .height * + 0.10, + child: Center( + child: Texts( + model.subCategorise[index].name, + fontSize: 14, + fontWeight: FontWeight.w600, + maxLines: 2, + ), + ), + ), + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + FinalProductsPage( + id: model.subCategorise[index].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, + ), + ], + ), + 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( + 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; + }); + }, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + ExpansionTile( + title: Texts('Brands'), + children: [ + Container( + height: 350, + child: ListView + .builder( + scrollDirection: + Axis + .vertical, + shrinkWrap: + true, + 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 + .spaceAround, + children: [ + 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(), + ), + ), + ), + ], + ), + ], + ), + ) + ], + ), + 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, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ); + }); + }, + ); + }, + ), + 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 * 3.85, + child: GridView.builder( + physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.subProducts.length, + itemBuilder: (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.subProducts[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: [ + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.subProducts[index] + .images.isNotEmpty + ? model + .subProducts[ + 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 + .subProducts[ + 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.subProducts[index] + .rxMessage != + null + ? model + .subProducts[ + 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: [ + Texts( + model.subProducts[index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w400, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model.subProducts[index].approvedRatingSum + .toDouble() / + model + .subProducts[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.subProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + )); + }, + ), + ) + : Container( + height: MediaQuery.of(context).size.height * 5.0, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.subProducts.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.subProducts[index] + .images.isNotEmpty + ? model + .subProducts[ + 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 + .subProducts[ + 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.subProducts[index] + .rxMessage != + null + ? model + .subProducts[ + 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, + ), + Container( + height: 35.0, + width: 250.0, + child: Texts( + model.subProducts[index] + .name, + regular: true, + fontSize: 13.2, + fontWeight: FontWeight.w500, + maxLines: 2, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model + .subProducts[ + index] + .approvedRatingSum + .toDouble() / + model + .parentProducts[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.subProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ); + }), + ) + ], + ), + ), + ), + )); + } +} diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index 3e81c41c..169e5cd5 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -16,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(); diff --git a/lib/routes.dart b/lib/routes.dart index 24069e15..97d506c5 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -38,7 +38,7 @@ const String SYMPTOM_CHECKER_INFO = 'symptom-checker-info'; const String SELECT_GENDER = 'select-gender'; const String SETTINGS = 'settings'; const String HEALTH_WEATHER = 'health-weather'; -const String APP_UPDATE = 'app_update'; +const APP_UPDATE = 'app-update'; var routes = { SPLASH: (_) => SplashScreen(), HOME: (_) => LandingPage(), @@ -60,5 +60,4 @@ var routes = { HEALTH_WEATHER: (_) => HealthWeatherIndicator(), APP_UPDATE: (_) => AppUpdatePage(), SETTINGS: (_) => Settings(), - HEALTH_WEATHER: (_) => HealthWeatherIndicator() }; diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index a320cf6b..d26c74ad 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1087,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 59f51bfc..8f0ea470 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -160,8 +160,7 @@ class AuthProvider with ChangeNotifier { }, body: request); return Future.value(localRes); } catch (error) { - print(error); - //throw error; + return Future.value(null); } } @@ -173,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 { @@ -252,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); } } diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 0b0c1ef5..7a2dec81 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -299,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); 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 new file mode 100644 index 00000000..32024f2f --- /dev/null +++ b/lib/services/pharmacy_services/brands_service.dart @@ -0,0 +1,73 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/brandModel.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/topBrandsModel.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; + +class BrandsService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + bool isLogin = false; + + List _brandsList = List(); + List get brandsList => _brandsList; + + 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, + onSuccess: (dynamic response, int statusCode) { + _brandsList.clear(); + response['manufacturer'].forEach((item) { + _brandsList.add(Brand.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future getTopBrands() async { + hasError = false; + await baseAppClient.getPharmacy(GET_TOP_BRANDS, + onSuccess: (dynamic response, int statusCode) { + _topBrandsList.clear(); + response['manufacturer'].forEach((item) { + _topBrandsList.add(TopBrand.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + 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/cancelOrder_service.dart b/lib/services/pharmacy_services/cancelOrder_service.dart new file mode 100644 index 00000000..f848c2ff --- /dev/null +++ b/lib/services/pharmacy_services/cancelOrder_service.dart @@ -0,0 +1,44 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.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'; + + +class CancelOrderService extends BaseService{ + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List _cancelOrderList = List(); + List get cancelOrderList => _cancelOrderList; + String url =""; + + + Future getCanceledOrder(order) async { + print("step 1"); + hasError = false; + + dynamic res; + + await baseAppClient.getPharmacy(GET_Cancel_ORDER+order, + onSuccess: (dynamic response, int statusCode) { + res = response; + print(res); +// _cancelOrderList.clear(); +// response['success'].forEach((item) { +// _cancelOrderList.add(OrderModel.fromJson(item)); +// }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + return res; + } +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart new file mode 100644 index 00000000..a3bb9976 --- /dev/null +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -0,0 +1,75 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.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'; + + +class OrderDetailsService extends BaseService{ + + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List get orderDetails => orderDetails; + List _orderList = List(); + List get orderList => _orderList; + + + Future getOrderDetails(orderId) async { + print("step 2" + orderId); + hasError = false; + await baseAppClient.getPharmacy(GET_ORDER_DETAILS+orderId, + onSuccess: (dynamic response, int statusCode) { + _orderList.clear(); + response['orders'].forEach((item) { + _orderList.add(OrderModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future makeReview(Product product, double rating, String reviewText) async { + hasError = false; + super.error = ""; + + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + + Map body = Map(); + Map reviewBody = Map(); + reviewBody["created_on_utc"] = DateTime.now().toString(); + reviewBody["customer_id"] = customerId; + reviewBody["helpful_no_total"] = 0; + reviewBody["helpful_yes_total"] = 0; + reviewBody["id"] = 0; + reviewBody["is_approved"] = false; + reviewBody["position"] = 0; + reviewBody["product_id"] = product.id; + reviewBody["rating"] = rating; + reviewBody["reply_text"] = reviewText; + reviewBody["store_id"] = 2; + reviewBody["title"] = ""; + body['review'] = reviewBody; + await baseAppClient.post("$PHARMACY_MAKE_REVIEW", + onSuccess: (response, statusCode) async { + /* + "success": { + "SuccessEndUserMsg": "Your request has been completed successfuly.", + "SuccessEndUserMsgN": "تمت العملية بنجاح" + } + */ + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart new file mode 100644 index 00000000..e426b801 --- /dev/null +++ b/lib/services/pharmacy_services/order_service.dart @@ -0,0 +1,81 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/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/order_model.dart'; + + +class OrderService extends BaseService{ + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List _orderList = List(); + List get orderList => _orderList; + String url =""; + + Future getOrder(customerId, pageId) async { + hasError = false; + // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; + url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; + print(url); + + await baseAppClient.getPharmacy(url, + onSuccess: (dynamic response, int statusCode) { + _orderList.clear(); + response['orders'].forEach((item) { + _orderList.add(OrderModel.fromJson(item)); + }); + print(_orderList.length); + print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + + Future getProductReview(orderId) async { + print("step 1"); + hasError = false; + url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; +// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$page_id&limit=200&customer_id=$custmerId"; + print(url); + await baseAppClient.getPharmacy(url, + onSuccess: (dynamic response, int statusCode) { + _orderList.clear(); + response['orders'].forEach((item) { + _orderList.add(OrderModel.fromJson(item)); + }); + print(_orderList.length); + print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } +// Future getOrder(BuildContext context ) async { +// +// if (await this.sharedPref.getObject(USER_PROFILE) != null) { +// var data = AuthenticatedUser.fromJson( +// await this.sharedPref.getObject(USER_PROFILE)); +// authUser = data; +// } +// +// dynamic localRes; +// String URL; +// URL = GET_ORDER; +// +// await baseAppClient.get(URL, +// onSuccess: (response, statusCode) async { +// localRes = response; +// }, onFailure: (String error, int statusCode) { +// throw error; +// }); +// return Future.value(localRes); +// } +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart new file mode 100644 index 00000000..1bb6571c --- /dev/null +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -0,0 +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/services/authentication/auth_provider.dart'; + +class PharmacyAddressService extends BaseService { + List addresses = List(); + CountryData country; + int selectedAddressIndex = 0; + + 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; + } + } + + Future addCustomerAddress(Addresses address) async { + makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS); + } + + Future editCustomerAddress(Addresses address) async { + makeCustomerAddress(address, EDIT_CUSTOMER_ADDRESS); + } + + 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; + 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 new file mode 100644 index 00000000..7a2947b0 --- /dev/null +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -0,0 +1,178 @@ +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/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; + +class ProductDetailService extends BaseService { + bool isLogin = false; + + List _productDetailList = List(); + List get productDetailList => _productDetailList; + + List _productLocationList = List(); + List get productLocationList => _productLocationList; + + List _addToCartModel = List(); + List get addToCartModel => _addToCartModel; + + 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+productID+"?fields=reviews", + onSuccess: (dynamic response, int statusCode) { + _productDetailList.clear(); + response['products'].forEach((item) { + _productDetailList.add(ProductDetail.fromJson(item)); + print(response); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future getProductAvailabiltyDetail() async { + hasError = false; + Map request; + + request = { + "Channel": 3, + "DeviceTypeID": 2, + "IPAdress": "10.20.10.20", + "LanguageID": 2, + "PatientOutSA": 0, + "SKU": "6720020025", + "SessionID": null, + "VersionID": 5.6, + "generalid": "Cs2020@2016\$2958", + "isDentalAllowedBackend": false + }; + await baseAppClient.post(GET_LOCATION, + onSuccess: (dynamic response, int statusCode) { + _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 new file mode 100644 index 00000000..44839955 --- /dev/null +++ b/lib/services/pharmacy_services/review_service.dart @@ -0,0 +1,38 @@ +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+customerId, + onSuccess: (dynamic response, int statusCode) { + _reviewList.clear(); + response['reviews'].forEach((item) { + _reviewList.add(Review.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + +} diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart new file mode 100644 index 00000000..5404a2bd --- /dev/null +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -0,0 +1,72 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/products.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + + +class WishListService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + bool isLogin = false; + List _wishListProducts = List(); + List get wishListProducts => _wishListProducts; + +// Future getWishlist() async { +// var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID); +// this.isLogin = isLogin != null; +//// if (!isLogin) { +//// // if not login +//// } else { +//// try { +//// await baseAppClient.get( +//// GET_WISHLIST +'/productsbyids/5308,3608,2316,963,5045,2714,1480,',//+ "272843" + "?shopping_cart_type=2", +//// onSuccess: (dynamic response, int statusCode) { +//// wishListProducts.clear(); +//// response['shopping_carts'].forEach((item) { +//// wishListProducts.add(Product.fromJson(item)); +//// }); +//// }, onFailure: (String error, int statusCode) { +//// hasError = true; +//// super.error = error; +//// }); +//// } catch (error) { +//// throw error; +//// } +//// } +// hasError = false; +// try { +// await baseAppClient.getPharmacy(GET_WISHLIST+"1367368?shopping_cart_type=2", +// onSuccess: (dynamic response, int statusCode) { +// wishListProducts.clear(); +// response.forEach((item) { +// wishListProducts.add(Wishlist.fromJson(response)); +// }); +// }, onFailure: (String error, int statusCode) { +// hasError = true; +// super.error = error; +// }); +// } catch (error) { +// throw error; +// } +// } + + Future getWishlist() 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; + }); + } + +} diff --git a/lib/services/pharmacy_services/writeReview_service.dart b/lib/services/pharmacy_services/writeReview_service.dart new file mode 100644 index 00000000..573095eb --- /dev/null +++ b/lib/services/pharmacy_services/writeReview_service.dart @@ -0,0 +1,40 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.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'; + + +class writeReviewService extends BaseService{ + + + + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List get writeReview => writeReview; + List _writeReviewList = List(); + List get orderList => _writeReviewList; + + + Future getProductReview() async { + hasError = false; + await baseAppClient.getPharmacy(WRITE_REVIEW, + onSuccess: (dynamic response, int statusCode) { + _writeReviewList.clear(); + response[''].forEach((item) { + _writeReviewList.add(OrderModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } +} \ No newline at end of file diff --git a/lib/splashPage.dart b/lib/splashPage.dart index aaffcbbd..20da2ba6 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -1,15 +1,19 @@ import 'dart:async'; -import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; 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 = @@ -22,26 +26,24 @@ class SplashScreen extends StatefulWidget { class _SplashScreenState extends State { PrivilegeService _privilegeService = locator(); - - //Provider.of(context, listen: false).isLogin @override void initState() { super.initState(); Timer( Duration(seconds: 1, milliseconds: 500), - () { - loadPrivilege().then((value) { - Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (BuildContext context) => LandingPage(), - ), - ); - }); + () { + loadPrivilege().then((value) { + Navigator.of(context).pushReplacement( + MaterialPageRoute( + builder: (BuildContext context) => LandingPage(), + ), + ); + }); + }, ); } - /// load the Privilege from service Future loadPrivilege() async { await _privilegeService.getPrivilege(); @@ -52,12 +54,7 @@ class _SplashScreenState extends State { 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 0b2b45d9..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) { @@ -325,6 +357,11 @@ class DateUtil { return ""; } + static String getFormattedDate(DateTime dateTime, String formattedString){ + 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 5c2d3a3c..c3799425 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -20,7 +20,8 @@ class LocationUtils { Geolocator.checkPermission().then((permission) { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - Geolocator.getLastKnownPosition().then((value) => setLocation(value)); + Geolocator.getLastKnownPosition() + .then((value) => setLocation(value)); } if (permission == LocationPermission.denied || @@ -57,9 +58,12 @@ class LocationUtils { } void setLocation(Position position) { - print(position); - this.sharedPref.setDouble(USER_LAT, position.latitude ?? 0.0); - this.sharedPref.setDouble(USER_LONG, position.longitude ?? 0.0); + 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 674dca5b..06c6628c 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,6 +14,10 @@ class TranslationBase { return Localizations.of(context, TranslationBase); } + String by(String key) { + return localizedValues[key][locale.languageCode]; + } + String get dashboardScreenToolbarTitle => localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; @@ -221,6 +226,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]; @@ -455,6 +462,7 @@ 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]; @@ -692,6 +700,72 @@ class TranslationBase { localizedValues['ServiceInformationButton'][locale.languageCode]; String get serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode]; + String get infoLab => localizedValues['info-lab'][locale.languageCode]; + String get infoRadiology => + localizedValues['info-radiology'][locale.languageCode]; + String get orders => localizedValues['orders'][locale.languageCode]; + String get lakum => localizedValues['lakum'][locale.languageCode]; + String get wishlist => localizedValues['wishlist'][locale.languageCode]; + String get reviews => localizedValues['reviews'][locale.languageCode]; + String get myPrescriptions => + localizedValues['myPrescriptions'][locale.languageCode]; + String get medicationRefill => + localizedValues['medicationRefill'][locale.languageCode]; + String get pillReminder => + localizedValues['pillReminder'][locale.languageCode]; + String get shippingAddresses => + localizedValues['shippingAddresses'][locale.languageCode]; + String get reachUs => localizedValues['reachUs'][locale.languageCode]; + String get ourLocations => + localizedValues['ourLocations'][locale.languageCode]; + String get edit => localizedValues['edit'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; + String get addAddress => localizedValues['addAddress'][locale.languageCode]; + String get addNewAddress => + localizedValues['addNewAddress'][locale.languageCode]; + String get order => localizedValues['order'][locale.languageCode]; + String get delivered => localizedValues['delivered'][locale.languageCode]; + String get processing => localizedValues['processing'][locale.languageCode]; + String get pending => localizedValues['pending'][locale.languageCode]; + String get cancelled => localizedValues['cancelled'][locale.languageCode]; + String get writeReview => localizedValues['writeReview'][locale.languageCode]; + String get shareReview => localizedValues['shareReview'][locale.languageCode]; + String get backMyAccount => + localizedValues['backMyAccount'][locale.languageCode]; + String get reviewSuccessful => + localizedValues['reviewSuccessful'][locale.languageCode]; + String get reviewShared => + localizedValues['reviewShared'][locale.languageCode]; + String get reviewComment => + localizedValues['reviewComment'][locale.languageCode]; + String get shippedMethod => + localizedValues['shippedMethod'][locale.languageCode]; + String get 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]; + String get cancelOrder => localizedValues['cancelOrder'][locale.languageCode]; + String get confirmAddress => + localizedValues['confirmAddress'][locale.languageCode]; + String get confirmLocation => + localizedValues['confirmLocation'][locale.languageCode]; + String get confirmDeleteMsg => + localizedValues['confirmDeleteMsg'][locale.languageCode]; + String get confirmDelete => + localizedValues['confirmDelete'][locale.languageCode]; + String get confirmCancellation => + localizedValues['confirmCancellation'][locale.languageCode]; String get serviceInformation => localizedValues['ServiceInformation'][locale.languageCode]; String get homeHealthCare => @@ -711,17 +785,30 @@ class TranslationBase { String get orderDate => localizedValues['orderDate'][locale.languageCode]; String get itemsNo => localizedValues['itemsNo'][locale.languageCode]; String get noOrder => localizedValues['noOrder'][locale.languageCode]; - String get infoLab => localizedValues['info-lab'][locale.languageCode]; - String get infoRadiology => - localizedValues['info-radiology'][locale.languageCode]; - // pharmacy module - String get medicationRefill => - localizedValues['medicationRefill'][locale.languageCode]; String get offersAndPromotions => localizedValues['offersAndPromotions'][locale.languageCode]; - String get myPrescriptions => - localizedValues['myPrescriptions'][locale.languageCode]; + String get review => localizedValues['review'][locale.languageCode]; + String get deliveredOrder => + localizedValues['deliveredOrder'][locale.languageCode]; + String get pendingOrder => + localizedValues['pendingOrder'][locale.languageCode]; + String get processingOrder => + localizedValues['processingOrder'][locale.languageCode]; + String get cancelledOrder => + localizedValues['cancelledOrder'][locale.languageCode]; + String get compare => localizedValues['compare'][locale.languageCode]; + String get medicationsRefill => + localizedValues['medicationsRefill'][locale.languageCode]; + String get myPrescription => + localizedValues['myPrescription'][locale.languageCode]; + String get quantity => localizedValues['quantity'][locale.languageCode]; + String get conditionsHMG => + localizedValues['conditionsHMG'][locale.languageCode]; + String get conditions => localizedValues['conditions'][locale.languageCode]; + + // pharmacy module + String get searchAndScanMedication => localizedValues['searchAndScanMedication'][locale.languageCode]; String get shopByBrands => @@ -731,6 +818,32 @@ class TranslationBase { String get bestSellers => localizedValues['bestSellers'][locale.languageCode]; String get deleteAllItems => localizedValues['deleteAllItems'][locale.languageCode]; + String get selectAddress => + localizedValues['selectAddress'][locale.languageCode]; + String get shippingAddress => + localizedValues['shippingAddress'][locale.languageCode]; + String get changeAddress => + localizedValues['changeAddress'][locale.languageCode]; + String get selectPaymentOption => + localizedValues['selectPaymentOption'][locale.languageCode]; + String get changeMethod => + localizedValues['changeMethod'][locale.languageCode]; + String get reviewOrder => localizedValues['reviewOrder'][locale.languageCode]; + String get orderSummary => + localizedValues['orderSummary'][locale.languageCode]; + String get active => localizedValues['active'][locale.languageCode]; + String get inactive => localizedValues['inactive'][locale.languageCode]; + String get balance => localizedValues['balance'][locale.languageCode]; + String get gained => localizedValues['gained'][locale.languageCode]; + String get consumed => localizedValues['consumed'][locale.languageCode]; + String get transferred => localizedValues['transferred'][locale.languageCode]; + String get checkBeneficiary => + localizedValues['checkBeneficiary'][locale.languageCode]; + String get beneficiaryName => + localizedValues['beneficiaryName'][locale.languageCode]; + String get accountActivation => + localizedValues['accountActivation'][locale.languageCode]; + String get acceptLbl => localizedValues['acceptLbl'][locale.languageCode]; String get termsService => localizedValues['TermsService'][locale.languageCode]; @@ -756,6 +869,11 @@ class TranslationBase { String get selectAge => localizedValues['select-age'][locale.languageCode]; String get iAm => localizedValues['i-am'][locale.languageCode]; String get yearOld => localizedValues['years-old'][locale.languageCode]; + String get categorise => localizedValues['categorise'][locale.languageCode]; + String get cart => localizedValues['cart'][locale.languageCode]; + String get wishList => localizedValues['wishList'][locale.languageCode]; + String get searchProductHere => + localizedValues['searchProductHere'][locale.languageCode]; String get email => localizedValues['email'][locale.languageCode]; String get book => localizedValues['Book'][locale.languageCode]; String get appointmentLabel => @@ -832,10 +950,8 @@ class TranslationBase { localizedValues['accessibility'][locale.languageCode]; String get selectClinic => localizedValues['selectClinic'][locale.languageCode]; - String get reviews => localizedValues['reviews'][locale.languageCode]; String get orderStatus => localizedValues['orderStatus'][locale.languageCode]; - String get cancelOrder => localizedValues['CancelOrder'][locale.languageCode]; String get findUs => localizedValues['FindUs'][locale.languageCode]; String get feedback => localizedValues['Feedback'][locale.languageCode]; String get liveChat => localizedValues['LiveChat'][locale.languageCode]; @@ -901,6 +1017,14 @@ class TranslationBase { localizedValues['blood-instruction'][locale.languageCode]; String get bloodTermsNcondition => localizedValues['view-terms'][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]; @@ -912,6 +1036,7 @@ 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]; @@ -930,7 +1055,6 @@ class TranslationBase { String get addChild => localizedValues['add-child'][locale.languageCode]; String get childName => localizedValues['child-name'][locale.languageCode]; String get childDob => localizedValues['childDob'][locale.languageCode]; - String get delete => localizedValues['delete'][locale.languageCode]; String get deletedChildMes => localizedValues['deleted-child-mes'][locale.languageCode]; String get visit => localizedValues['visit'][locale.languageCode]; @@ -971,7 +1095,6 @@ class TranslationBase { localizedValues['info-ambulance'][locale.languageCode]; String get transportHeading => localizedValues['RRT-transport-heading'][locale.languageCode]; - String get sar => localizedValues['sar'][locale.languageCode]; String get directionHeading => localizedValues['RRT-direction-heading'][locale.languageCode]; String get toHospital => localizedValues['to-hospital'][locale.languageCode]; @@ -999,7 +1122,7 @@ class TranslationBase { String get selectAmbulate => localizedValues['select-ambulate'][locale.languageCode]; String get wheelchair => localizedValues['wheelchair'][locale.languageCode]; - String get walker => localizedValues['walker"'][locale.languageCode]; + String get walker => localizedValues['walker'][locale.languageCode]; String get stretcher => localizedValues['stretcher'][locale.languageCode]; String get none => localizedValues['none'][locale.languageCode]; String get RRTSummary => localizedValues['RRT-Summary'][locale.languageCode]; @@ -1012,6 +1135,8 @@ class TranslationBase { 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 => @@ -1052,9 +1177,89 @@ class TranslationBase { String get requested => localizedValues['requested'][locale.languageCode]; String get ready => localizedValues['ready'][locale.languageCode]; String get completed => localizedValues['completed'][locale.languageCode]; - String get cancelled => localizedValues['cancelled'][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 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 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]; @@ -1085,10 +1290,37 @@ class TranslationBase { String get help => localizedValues['help'][locale.languageCode]; String get habibRobotText => localizedValues['habibRobotText'][locale.languageCode]; - String get selectAddress => - localizedValues['selectAddress'][locale.languageCode]; - String get addNewAddress => - localizedValues['addNewAddress'][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 year => localizedValues['Year'][locale.languageCode]; + String get month => localizedValues['Month'][locale.languageCode]; + String get point => localizedValues['point'][locale.languageCode]; + String get riyal => localizedValues['riyal'][locale.languageCode]; + String get termOfService => + localizedValues['termOfService'][locale.languageCode]; + String get shoppingCart => + localizedValues['shoppingCart'][locale.languageCode]; + String get covidTest => localizedValues['covidTest'][locale.languageCode]; + String get driveThru => localizedValues['driveThru'][locale.languageCode]; + String get NearestErDesc => + localizedValues['NearestErDesc'][locale.languageCode]; + String get NearestEr => localizedValues['NearestEr'][locale.languageCode]; + String get infoCMC => localizedValues['infoCMC'][locale.languageCode]; + String get instructionAgree => + localizedValues['instructionAgree'][locale.languageCode]; + String get reqId => localizedValues['reqId'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 34c0e58d..58ef9421 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -32,6 +32,7 @@ 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'; @@ -214,7 +215,7 @@ class Utils { toAnimate: false, position: BadgePosition.topEnd(), shape: BadgeShape.circle, - badgeColor: Color(0xFF40ACC9).withOpacity(1.0), + badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), 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 a6b61717..53822f1d 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_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/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'; @@ -25,6 +28,7 @@ class BottomNavBar extends StatefulWidget { class _BottomNavBarState extends State { int _index = 0; + ToDoCountProviderModel model; var event = RobotProvider(); _changeIndex(int index) async { widget.changeIndex(index); @@ -35,6 +39,7 @@ class _BottomNavBarState extends State { @override Widget build(BuildContext context) { + model = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context); return BottomAppBar( elevation: 4, @@ -116,6 +121,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/borderedButton.dart b/lib/widgets/buttons/borderedButton.dart index 5e05448e..b0bbdaf0 100644 --- a/lib/widgets/buttons/borderedButton.dart +++ b/lib/widgets/buttons/borderedButton.dart @@ -4,55 +4,91 @@ import 'package:flutter/material.dart'; class BorderedButton extends StatelessWidget { final String text; final Function handler; - final Color color; + final Color textColor; final bool hasBorder; final Color borderColor; final Color backgroundColor; final double vPadding; final double hPadding; + final double radius; + final double lPadding; + final double tPadding; + final double rPadding; + final double bPadding; + final double fontSize; + final Widget icon; + final FontWeight fontWeight; + final bool hasShadow; BorderedButton( this.text, { this.handler, - this.color, + this.textColor, this.hasBorder = false, this.borderColor, this.backgroundColor, this.vPadding = 0, this.hPadding = 0, + this.radius = 4.0, + this.lPadding = 4.0, + this.tPadding = 0.0, + this.rPadding = 4.0, + this.bPadding = 0.0, + this.fontSize = 0, + this.icon, + this.fontWeight, + this.hasShadow = false, }); @override Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.symmetric(horizontal: 4, vertical: 4), - child: ButtonTheme( - //adds padding inside the button - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - //limits the touch area to the button area - minWidth: 0, - //wraps child's width - height: 0, - //wraps child's height - child: RaisedButton( - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - padding: EdgeInsets.symmetric(horizontal: 12, vertical: vPadding), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(4.0), - side: BorderSide(color: hasBorder ? borderColor : Colors.white, width: 0.8),), - color: backgroundColor ?? Colors.white, - textColor: color ?? Color(0xffc4aa54), - disabledTextColor: color ?? Colors.black, - disabledColor: backgroundColor ?? Colors.white, - onPressed: handler, - child: Text( - text, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.normal), + return GestureDetector( + onTap: () { + handler(); + }, + 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, + )), + 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, + children: [ + icon != null ? icon : Container(), + Container( + padding: (hPadding > 0 || vPadding > 0) + ? EdgeInsets.symmetric( + vertical: vPadding, horizontal: hPadding) + : EdgeInsets.fromLTRB( + lPadding, tPadding, rPadding, bPadding), + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: fontSize == 0 + ? SizeConfig.textMultiplier * 1.6 + : fontSize, + fontWeight: + fontWeight != null ? fontWeight : FontWeight.normal, + color: textColor ?? Color(0xffc4aa54)), + ), + ), + ], ), - ), //your original button + ), ), ); } 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