Merge branch 'dev_v3.13.6' into dev_3.13.6_CR5047_LiveCare_Enhancements
# Conflicts: # lib/config/config.dart # lib/config/localized_values.dart # lib/core/service/client/base_app_client.dart # lib/pages/conference/zoom/call_screen.dart # lib/uitl/translations_delegate_base.dartmerge-update-with-lab-changes
@ -0,0 +1,52 @@
|
|||||||
|
package com.cloud.diplomaticquarterapp
|
||||||
|
import com.ejada.hmg.MainActivity
|
||||||
|
import android.os.Build
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
|
import com.cloud.diplomaticquarterapp.penguin.PenguinView
|
||||||
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
|
import io.flutter.plugin.common.MethodCall
|
||||||
|
import io.flutter.plugin.common.MethodChannel
|
||||||
|
|
||||||
|
class PenguinInPlatformBridge(
|
||||||
|
private var flutterEngine: FlutterEngine,
|
||||||
|
private var mainActivity: MainActivity
|
||||||
|
) {
|
||||||
|
|
||||||
|
private lateinit var channel: MethodChannel
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val CHANNEL = "launch_penguin_ui"
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
fun create() {
|
||||||
|
// openTok = OpenTok(mainActivity, flutterEngine)
|
||||||
|
channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
|
||||||
|
channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
|
||||||
|
when (call.method) {
|
||||||
|
"launchPenguin" -> {
|
||||||
|
print("the platform channel is being called")
|
||||||
|
val args = call.arguments as Map<String, Any>?
|
||||||
|
Log.d("TAG", "configureFlutterEngine: $args")
|
||||||
|
println("args")
|
||||||
|
args?.let {
|
||||||
|
PenguinView(
|
||||||
|
mainActivity,
|
||||||
|
100,
|
||||||
|
args,
|
||||||
|
flutterEngine.dartExecutor.binaryMessenger,
|
||||||
|
activity = mainActivity,
|
||||||
|
channel
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
result.notImplemented()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.cloud.diplomaticquarterapp.PermissionManager
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.os.Build
|
||||||
|
|
||||||
|
object PermissionHelper {
|
||||||
|
|
||||||
|
fun getRequiredPermissions(): Array<String> {
|
||||||
|
val permissions = mutableListOf(
|
||||||
|
Manifest.permission.INTERNET,
|
||||||
|
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||||
|
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||||
|
Manifest.permission.ACCESS_NETWORK_STATE,
|
||||||
|
Manifest.permission.BLUETOOTH,
|
||||||
|
Manifest.permission.BLUETOOTH_ADMIN,
|
||||||
|
// Manifest.permission.ACTIVITY_RECOGNITION
|
||||||
|
)
|
||||||
|
|
||||||
|
// For Android 12 (API level 31) and above, add specific permissions
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { // Android 12 (API 31) and above
|
||||||
|
permissions.add(Manifest.permission.BLUETOOTH_SCAN)
|
||||||
|
permissions.add(Manifest.permission.BLUETOOTH_CONNECT)
|
||||||
|
permissions.add(Manifest.permission.HIGH_SAMPLING_RATE_SENSORS)
|
||||||
|
}
|
||||||
|
|
||||||
|
return permissions.toTypedArray()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.cloud.diplomaticquarterapp.PermissionManager
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
|
||||||
|
class PermissionManager(
|
||||||
|
private val context: Context,
|
||||||
|
val listener: PermissionListener,
|
||||||
|
private val requestCode: Int,
|
||||||
|
vararg permissions: String
|
||||||
|
) {
|
||||||
|
|
||||||
|
private val permissionsArray = permissions
|
||||||
|
|
||||||
|
interface PermissionListener {
|
||||||
|
fun onPermissionGranted()
|
||||||
|
fun onPermissionDenied()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun arePermissionsGranted(): Boolean {
|
||||||
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
permissionsArray.all {
|
||||||
|
ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun requestPermissions(activity: Activity) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
ActivityCompat.requestPermissions(activity, permissionsArray, requestCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun handlePermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||||
|
if (this.requestCode == requestCode) {
|
||||||
|
val allGranted = grantResults.all { it == PackageManager.PERMISSION_GRANTED }
|
||||||
|
if (allGranted) {
|
||||||
|
listener.onPermissionGranted()
|
||||||
|
} else {
|
||||||
|
listener.onPermissionDenied()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.cloud.diplomaticquarterapp.PermissionManager
|
||||||
|
|
||||||
|
// PermissionResultReceiver.kt
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
|
||||||
|
class PermissionResultReceiver(
|
||||||
|
private val callback: (Boolean) -> Unit
|
||||||
|
) : BroadcastReceiver() {
|
||||||
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
|
val granted = intent?.getBooleanExtra("PERMISSION_GRANTED", false) ?: false
|
||||||
|
callback(granted)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.cloud.diplomaticquarterapp.penguin
|
||||||
|
|
||||||
|
enum class PenguinMethod {
|
||||||
|
// initializePenguin("initializePenguin"),
|
||||||
|
// configurePenguin("configurePenguin"),
|
||||||
|
// showPenguinUI("showPenguinUI"),
|
||||||
|
// onPenNavUIDismiss("onPenNavUIDismiss"),
|
||||||
|
// onReportIssue("onReportIssue"),
|
||||||
|
// onPenNavSuccess("onPenNavSuccess"),
|
||||||
|
onPenNavInitializationError // onLocationOffCampus("onLocationOffCampus"),
|
||||||
|
// navigateToPOI("navigateToPOI"),
|
||||||
|
// openSharedLocation("openSharedLocation");
|
||||||
|
}
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
package com.cloud.diplomaticquarterapp.penguin
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.peng.pennavmap.PlugAndPlaySDK
|
||||||
|
import com.peng.pennavmap.connections.ApiController
|
||||||
|
import com.peng.pennavmap.interfaces.RefIdDelegate
|
||||||
|
import com.peng.pennavmap.models.TokenModel
|
||||||
|
import com.peng.pennavmap.models.postmodels.PostToken
|
||||||
|
import com.peng.pennavmap.utils.AppSharedData
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.Callback
|
||||||
|
import retrofit2.Response
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
|
|
||||||
|
class PenguinNavigator() {
|
||||||
|
|
||||||
|
fun navigateTo(mContext: Context, refID: String, delegate: RefIdDelegate,clientID : String,clientKey : String ) {
|
||||||
|
val postToken = PostToken(clientID, clientKey)
|
||||||
|
getToken(mContext, postToken, object : RefIdDelegate {
|
||||||
|
override fun onRefByIDSuccess(PoiId: String?) {
|
||||||
|
Log.e("navigateTo", "PoiId is+++++++ $PoiId")
|
||||||
|
|
||||||
|
PlugAndPlaySDK.navigateTo(mContext, refID, object : RefIdDelegate {
|
||||||
|
override fun onRefByIDSuccess(PoiId: String?) {
|
||||||
|
Log.e("navigateTo", "PoiId 2is+++++++ $PoiId")
|
||||||
|
|
||||||
|
delegate.onRefByIDSuccess(refID)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onGetByRefIDError(error: String?) {
|
||||||
|
delegate.onRefByIDSuccess(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onGetByRefIDError(error: String?) {
|
||||||
|
delegate.onRefByIDSuccess(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getToken(mContext: Context, postToken: PostToken?, apiTokenCallBack: RefIdDelegate) {
|
||||||
|
try {
|
||||||
|
// Create the API call
|
||||||
|
val purposesCall: Call<ResponseBody> = ApiController.getInstance(mContext)
|
||||||
|
.apiMethods
|
||||||
|
.getToken(postToken)
|
||||||
|
|
||||||
|
// Enqueue the call for asynchronous execution
|
||||||
|
purposesCall.enqueue(object : Callback<ResponseBody?> {
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<ResponseBody?>,
|
||||||
|
response: Response<ResponseBody?>
|
||||||
|
) {
|
||||||
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
try {
|
||||||
|
response.body()?.use { responseBody ->
|
||||||
|
val responseBodyString: String = responseBody.string() // Use `string()` to get the actual response content
|
||||||
|
if (responseBodyString.isNotEmpty()) {
|
||||||
|
val tokenModel = Gson().fromJson(responseBodyString, TokenModel::class.java)
|
||||||
|
if (tokenModel != null && tokenModel.token != null) {
|
||||||
|
AppSharedData.apiToken = tokenModel.token
|
||||||
|
apiTokenCallBack.onRefByIDSuccess(tokenModel.token)
|
||||||
|
} else {
|
||||||
|
apiTokenCallBack.onGetByRefIDError("Failed to parse token model")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
apiTokenCallBack.onGetByRefIDError("Response body is empty")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
apiTokenCallBack.onGetByRefIDError("An error occurred: ${e.message}")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
apiTokenCallBack.onGetByRefIDError("Unsuccessful response: " + response.code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(call: Call<ResponseBody?>, t: Throwable) {
|
||||||
|
apiTokenCallBack.onGetByRefIDError(t.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (error: Exception) {
|
||||||
|
apiTokenCallBack.onGetByRefIDError("Exception during API call: $error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,310 @@
|
|||||||
|
package com.cloud.diplomaticquarterapp.penguin
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Context.RECEIVER_EXPORTED
|
||||||
|
import android.content.IntentFilter
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Build
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
|
import com.cloud.diplomaticquarterapp.PermissionManager.PermissionHelper
|
||||||
|
import com.cloud.diplomaticquarterapp.PermissionManager.PermissionManager
|
||||||
|
import com.cloud.diplomaticquarterapp.PermissionManager.PermissionResultReceiver
|
||||||
|
import com.ejada.hmg.MainActivity
|
||||||
|
import com.peng.pennavmap.PlugAndPlayConfiguration
|
||||||
|
import com.peng.pennavmap.PlugAndPlaySDK
|
||||||
|
import com.peng.pennavmap.enums.InitializationErrorType
|
||||||
|
import com.peng.pennavmap.interfaces.PenNavUIDelegate
|
||||||
|
import com.peng.pennavmap.utils.Languages
|
||||||
|
import io.flutter.plugin.common.BinaryMessenger
|
||||||
|
import io.flutter.plugin.common.MethodCall
|
||||||
|
import io.flutter.plugin.common.MethodChannel
|
||||||
|
import io.flutter.plugin.platform.PlatformView
|
||||||
|
import com.cloud.diplomaticquarterapp.penguin.PenguinNavigator
|
||||||
|
import com.peng.pennavmap.interfaces.PIEventsDelegate
|
||||||
|
import com.peng.pennavmap.interfaces.PILocationDelegate
|
||||||
|
import com.peng.pennavmap.interfaces.RefIdDelegate
|
||||||
|
import com.peng.pennavmap.models.PIReportIssue
|
||||||
|
/**
|
||||||
|
* Custom PlatformView for displaying Penguin UI components within a Flutter app.
|
||||||
|
* Implements `PlatformView` for rendering the view, `MethodChannel.MethodCallHandler` for handling method calls,
|
||||||
|
* and `PenNavUIDelegate` for handling SDK events.
|
||||||
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
internal class PenguinView(
|
||||||
|
context: Context,
|
||||||
|
id: Int,
|
||||||
|
val creationParams: Map<String, Any>,
|
||||||
|
messenger: BinaryMessenger,
|
||||||
|
activity: MainActivity,
|
||||||
|
val channel: MethodChannel
|
||||||
|
) : PlatformView, MethodChannel.MethodCallHandler, PenNavUIDelegate {
|
||||||
|
// The layout for displaying the Penguin UI
|
||||||
|
private val mapLayout: RelativeLayout = RelativeLayout(context)
|
||||||
|
private val _context: Context = context
|
||||||
|
|
||||||
|
private val permissionResultReceiver: PermissionResultReceiver
|
||||||
|
private val permissionIntentFilter = IntentFilter("PERMISSION_RESULT_ACTION")
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val PERMISSIONS_REQUEST_CODE = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var permissionManager: PermissionManager
|
||||||
|
|
||||||
|
// Reference to the main activity
|
||||||
|
private var _activity: Activity = activity
|
||||||
|
|
||||||
|
private lateinit var mContext: Context
|
||||||
|
|
||||||
|
lateinit var navigator: PenguinNavigator
|
||||||
|
|
||||||
|
init {
|
||||||
|
// Set layout parameters for the mapLayout
|
||||||
|
mapLayout.layoutParams = ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
|
||||||
|
mContext = context
|
||||||
|
|
||||||
|
|
||||||
|
permissionResultReceiver = PermissionResultReceiver { granted ->
|
||||||
|
if (granted) {
|
||||||
|
onPermissionsGranted()
|
||||||
|
} else {
|
||||||
|
onPermissionsDenied()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
mContext.registerReceiver(
|
||||||
|
permissionResultReceiver,
|
||||||
|
permissionIntentFilter,
|
||||||
|
RECEIVER_EXPORTED
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
mContext.registerReceiver(
|
||||||
|
permissionResultReceiver,
|
||||||
|
permissionIntentFilter,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the background color of the layout
|
||||||
|
mapLayout.setBackgroundColor(Color.RED)
|
||||||
|
|
||||||
|
permissionManager = PermissionManager(
|
||||||
|
context = mContext,
|
||||||
|
listener = object : PermissionManager.PermissionListener {
|
||||||
|
override fun onPermissionGranted() {
|
||||||
|
// Handle permissions granted
|
||||||
|
onPermissionsGranted()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPermissionDenied() {
|
||||||
|
// Handle permissions denied
|
||||||
|
onPermissionsDenied()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
requestCode = PERMISSIONS_REQUEST_CODE,
|
||||||
|
*PermissionHelper.getRequiredPermissions()
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!permissionManager.arePermissionsGranted()) {
|
||||||
|
permissionManager.requestPermissions(_activity)
|
||||||
|
} else {
|
||||||
|
// Permissions already granted
|
||||||
|
permissionManager.listener.onPermissionGranted()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun onPermissionsGranted() {
|
||||||
|
// Handle the actions when permissions are granted
|
||||||
|
Log.d("PermissionsResult", "onPermissionsGranted")
|
||||||
|
// Register the platform view factory for creating custom views
|
||||||
|
|
||||||
|
// Initialize the Penguin SDK
|
||||||
|
initPenguin()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun onPermissionsDenied() {
|
||||||
|
// Handle the actions when permissions are denied
|
||||||
|
Log.d("PermissionsResult", "onPermissionsDenied")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the view associated with this PlatformView.
|
||||||
|
*
|
||||||
|
* @return The main view for this PlatformView.
|
||||||
|
*/
|
||||||
|
override fun getView(): View {
|
||||||
|
return mapLayout
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleans up resources associated with this PlatformView.
|
||||||
|
*/
|
||||||
|
override fun dispose() {
|
||||||
|
// Cleanup code if needed
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles method calls from Dart code.
|
||||||
|
*
|
||||||
|
* @param call The method call from Dart.
|
||||||
|
* @param result The result callback to send responses back to Dart.
|
||||||
|
*/
|
||||||
|
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
|
||||||
|
// Handle method calls from Dart code here
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the Penguin SDK with custom configuration and delegates.
|
||||||
|
*/
|
||||||
|
private fun initPenguin() {
|
||||||
|
navigator = PenguinNavigator()
|
||||||
|
// Configure the PlugAndPlaySDK
|
||||||
|
val language = when (creationParams["languageCode"] as String) {
|
||||||
|
"ar" -> Languages.ar
|
||||||
|
"en" -> Languages.en
|
||||||
|
else -> {
|
||||||
|
Languages.en
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.d(
|
||||||
|
"TAG",
|
||||||
|
"initPenguin: ${Languages.getLanguageEnum(creationParams["languageCode"] as String)}"
|
||||||
|
)
|
||||||
|
PlugAndPlaySDK.configuration = PlugAndPlayConfiguration.Builder()
|
||||||
|
.setBaseUrl(
|
||||||
|
creationParams["dataURL"] as String,
|
||||||
|
creationParams["positionURL"] as String
|
||||||
|
)
|
||||||
|
.setServiceName(
|
||||||
|
creationParams["dataServiceName"] as String,
|
||||||
|
creationParams["positionServiceName"] as String
|
||||||
|
)
|
||||||
|
.setClientData(
|
||||||
|
creationParams["clientID"] as String,
|
||||||
|
creationParams["clientKey"] as String
|
||||||
|
)
|
||||||
|
.setUserName(creationParams["username"] as String)
|
||||||
|
// .setLanguageID(Languages.en)
|
||||||
|
.setLanguageID(language)
|
||||||
|
.setSimulationModeEnabled(creationParams["isSimulationModeEnabled"] as Boolean)
|
||||||
|
.setEnableBackButton(true)
|
||||||
|
// .setDeepLinkData("deeplink")
|
||||||
|
.setCustomizeColor("#2CA0AF")
|
||||||
|
.setDeepLinkSchema("")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// Set location delegate to handle location updates
|
||||||
|
// PlugAndPlaySDK.setPiLocationDelegate {
|
||||||
|
// Example code to handle location updates
|
||||||
|
// Uncomment and modify as needed
|
||||||
|
// if (location.size() > 0)
|
||||||
|
// Toast.makeText(_context, "Location Info Latitude: ${location[0]}, Longitude: ${location[1]}", Toast.LENGTH_SHORT).show()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Set events delegate for reporting issues
|
||||||
|
PlugAndPlaySDK.setPiEventsDelegate { }
|
||||||
|
|
||||||
|
// Start the Penguin SDK
|
||||||
|
PlugAndPlaySDK.start(mContext, this)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigates to the specified reference ID.
|
||||||
|
*
|
||||||
|
* @param refID The reference ID to navigate to.
|
||||||
|
*/
|
||||||
|
fun navigateTo(refID: String) {
|
||||||
|
try {
|
||||||
|
if (refID.isBlank()) {
|
||||||
|
Log.e("navigateTo", "Invalid refID: The reference ID is blank.")
|
||||||
|
}
|
||||||
|
// referenceId = refID
|
||||||
|
navigator.navigateTo(mContext, refID,object : RefIdDelegate {
|
||||||
|
override fun onRefByIDSuccess(PoiId: String?) {
|
||||||
|
Log.e("navigateTo", "PoiId is penguin view+++++++ $PoiId")
|
||||||
|
|
||||||
|
// channelFlutter.invokeMethod(
|
||||||
|
// PenguinMethod.navigateToPOI.name,
|
||||||
|
// "navigateTo Success"
|
||||||
|
// )
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onGetByRefIDError(error: String?) {
|
||||||
|
Log.e("navigateTo", "error is penguin view+++++++ $error")
|
||||||
|
|
||||||
|
// channelFlutter.invokeMethod(
|
||||||
|
// PenguinMethod.navigateToPOI.name,
|
||||||
|
// "navigateTo Failed: Invalid refID"
|
||||||
|
// )
|
||||||
|
}
|
||||||
|
} , creationParams["clientID"] as String, creationParams["clientKey"] as String )
|
||||||
|
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("navigateTo", "Exception occurred during navigation: ${e.message}", e)
|
||||||
|
// channelFlutter.invokeMethod(
|
||||||
|
// PenguinMethod.navigateToPOI.name,
|
||||||
|
// "Failed: Exception - ${e.message}"
|
||||||
|
// )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when Penguin UI setup is successful.
|
||||||
|
*
|
||||||
|
* @param warningCode Optional warning code received from the SDK.
|
||||||
|
*/
|
||||||
|
override fun onPenNavSuccess(warningCode: String?) {
|
||||||
|
val clinicId = creationParams["clinicID"] as String
|
||||||
|
|
||||||
|
if(clinicId.isEmpty()) return
|
||||||
|
|
||||||
|
navigateTo(clinicId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when there is an initialization error with Penguin UI.
|
||||||
|
*
|
||||||
|
* @param description Description of the error.
|
||||||
|
* @param errorType Type of initialization error.
|
||||||
|
*/
|
||||||
|
override fun onPenNavInitializationError(
|
||||||
|
description: String?,
|
||||||
|
errorType: InitializationErrorType?
|
||||||
|
) {
|
||||||
|
val arguments: Map<String, Any?> = mapOf(
|
||||||
|
"description" to description,
|
||||||
|
"type" to errorType?.name
|
||||||
|
)
|
||||||
|
|
||||||
|
channel.invokeMethod(PenguinMethod.onPenNavInitializationError.name, arguments)
|
||||||
|
Toast.makeText(mContext, "Navigation Error: $description", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when Penguin UI is dismissed.
|
||||||
|
*/
|
||||||
|
override fun onPenNavUIDismiss() {
|
||||||
|
// Handle UI dismissal if needed
|
||||||
|
try {
|
||||||
|
mContext.unregisterReceiver(permissionResultReceiver)
|
||||||
|
dispose();
|
||||||
|
} catch (e: IllegalArgumentException) {
|
||||||
|
Log.e("PenguinView", "Receiver not registered: $e")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 432 KiB |
|
After Width: | Height: | Size: 119 KiB |
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"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:815750722565:android:62281cd3e5df4063",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.ejada.hmg"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDUfg6AKM1-00WyzpvLImUBC46wFrq9-qw"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"analytics_service": {
|
||||||
|
"status": 1
|
||||||
|
},
|
||||||
|
"appinvite_service": {
|
||||||
|
"status": 1,
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
},
|
||||||
|
"ads_service": {
|
||||||
|
"status": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"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:815750722565:android:62281cd3e5df4063",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.ejada.hmg"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDUfg6AKM1-00WyzpvLImUBC46wFrq9-qw"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "815750722565-0cq9366orvsk5ipivq6lijcj56u03fr7.apps.googleusercontent.com",
|
||||||
|
"client_type": 2,
|
||||||
|
"ios_info": {
|
||||||
|
"bundle_id": "com.void.demo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
import Foundation
|
||||||
|
import FLAnimatedImage
|
||||||
|
|
||||||
|
|
||||||
|
var flutterMethodChannelPenguinIn:FlutterMethodChannel? = nil
|
||||||
|
fileprivate var mainViewController:MainFlutterVC!
|
||||||
|
|
||||||
|
class HMGPenguinInPlatformBridge{
|
||||||
|
|
||||||
|
private let channelName = "launch_penguin_ui"
|
||||||
|
private static var shared_:HMGPenguinInPlatformBridge?
|
||||||
|
|
||||||
|
class func initialize(flutterViewController:MainFlutterVC){
|
||||||
|
shared_ = HMGPenguinInPlatformBridge()
|
||||||
|
mainViewController = flutterViewController
|
||||||
|
shared_?.openChannel()
|
||||||
|
}
|
||||||
|
|
||||||
|
func shared() -> HMGPenguinInPlatformBridge{
|
||||||
|
assert((HMGPenguinInPlatformBridge.shared_ != nil), "HMGPenguinInPlatformBridge is not initialized, call initialize(mainViewController:MainFlutterVC) function first.")
|
||||||
|
return HMGPenguinInPlatformBridge.shared_!
|
||||||
|
}
|
||||||
|
|
||||||
|
private func openChannel(){
|
||||||
|
flutterMethodChannelPenguinIn = FlutterMethodChannel(name: channelName, binaryMessenger: mainViewController.binaryMessenger)
|
||||||
|
|
||||||
|
flutterMethodChannelPenguinIn?.setMethodCallHandler { (methodCall, result) in
|
||||||
|
print("Called function \(methodCall.method)")
|
||||||
|
|
||||||
|
if let arguments = methodCall.arguments as Any? {
|
||||||
|
if methodCall.method == "launchPenguin"{
|
||||||
|
print("====== launchPenguinView Launched =========")
|
||||||
|
self.launchPenguinView(arguments: arguments, result: result)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result(FlutterError(code: "INVALID_ARGUMENT", message: "Storyboard name is required", details: nil))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func launchPenguinView(arguments: Any, result: @escaping FlutterResult) {
|
||||||
|
|
||||||
|
let penguinView = PenguinView(
|
||||||
|
frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height),
|
||||||
|
viewIdentifier: 0,
|
||||||
|
arguments: arguments,
|
||||||
|
binaryMessenger: mainViewController.binaryMessenger
|
||||||
|
)
|
||||||
|
|
||||||
|
let penguinUIView = penguinView.view()
|
||||||
|
penguinUIView.frame = mainViewController.view.bounds
|
||||||
|
penguinUIView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||||
|
|
||||||
|
mainViewController.view.addSubview(penguinUIView)
|
||||||
|
|
||||||
|
guard let args = arguments as? [String: Any],
|
||||||
|
let loaderImageData = args["loaderImage"] as? FlutterStandardTypedData else {
|
||||||
|
print("loaderImage data not found in arguments")
|
||||||
|
result(FlutterError(code: "ARGUMENT_ERROR", message: "Missing loaderImage data", details: nil))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let loadingOverlay = UIView(frame: UIScreen.main.bounds)
|
||||||
|
loadingOverlay.backgroundColor = UIColor.black.withAlphaComponent(0.5) // Semi-transparent overlay
|
||||||
|
loadingOverlay.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||||
|
|
||||||
|
// Display the GIF using FLAnimatedImage
|
||||||
|
let animatedImage = FLAnimatedImage(animatedGIFData: loaderImageData.data)
|
||||||
|
let gifImageView = FLAnimatedImageView()
|
||||||
|
gifImageView.animatedImage = animatedImage
|
||||||
|
gifImageView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
|
||||||
|
gifImageView.center = loadingOverlay.center
|
||||||
|
gifImageView.contentMode = .scaleAspectFit
|
||||||
|
loadingOverlay.addSubview(gifImageView)
|
||||||
|
|
||||||
|
|
||||||
|
if let window = UIApplication.shared.windows.first {
|
||||||
|
window.addSubview(loadingOverlay)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print("Error: Main window not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
penguinView.onSuccess = {
|
||||||
|
// Hide and remove the loader
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
loadingOverlay.removeFromSuperview()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
//
|
||||||
|
// PenguinModel.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by Amir on 06/08/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
// Define the model class
|
||||||
|
struct PenguinModel {
|
||||||
|
let baseURL: String
|
||||||
|
let dataURL: String
|
||||||
|
let dataServiceName: String
|
||||||
|
let positionURL: String
|
||||||
|
let clientKey: String
|
||||||
|
let storyboardName: String
|
||||||
|
let mapBoxKey: String
|
||||||
|
let clientID: String
|
||||||
|
let positionServiceName: String
|
||||||
|
let username: String
|
||||||
|
let isSimulationModeEnabled: Bool
|
||||||
|
let isShowUserName: Bool
|
||||||
|
let isUpdateUserLocationSmoothly: Bool
|
||||||
|
let isEnableReportIssue: Bool
|
||||||
|
let languageCode: String
|
||||||
|
let clinicID: String
|
||||||
|
let patientID: String
|
||||||
|
let projectID: String
|
||||||
|
|
||||||
|
// Initialize the model from a dictionary
|
||||||
|
init?(from dictionary: [String: Any]) {
|
||||||
|
guard
|
||||||
|
let baseURL = dictionary["baseURL"] as? String,
|
||||||
|
let dataURL = dictionary["dataURL"] as? String,
|
||||||
|
let dataServiceName = dictionary["dataServiceName"] as? String,
|
||||||
|
let positionURL = dictionary["positionURL"] as? String,
|
||||||
|
let clientKey = dictionary["clientKey"] as? String,
|
||||||
|
let storyboardName = dictionary["storyboardName"] as? String,
|
||||||
|
let mapBoxKey = dictionary["mapBoxKey"] as? String,
|
||||||
|
let clientID = dictionary["clientID"] as? String,
|
||||||
|
let positionServiceName = dictionary["positionServiceName"] as? String,
|
||||||
|
let username = dictionary["username"] as? String,
|
||||||
|
let isSimulationModeEnabled = dictionary["isSimulationModeEnabled"] as? Bool,
|
||||||
|
let isShowUserName = dictionary["isShowUserName"] as? Bool,
|
||||||
|
let isUpdateUserLocationSmoothly = dictionary["isUpdateUserLocationSmoothly"] as? Bool,
|
||||||
|
let isEnableReportIssue = dictionary["isEnableReportIssue"] as? Bool,
|
||||||
|
let languageCode = dictionary["languageCode"] as? String,
|
||||||
|
let clinicID = dictionary["clinicID"] as? String,
|
||||||
|
let patientID = dictionary["patientID"] as? String,
|
||||||
|
let projectID = dictionary["projectID"] as? String
|
||||||
|
else {
|
||||||
|
print("Initialization failed due to missing or invalid keys.")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
self.baseURL = baseURL
|
||||||
|
self.dataURL = dataURL
|
||||||
|
self.dataServiceName = dataServiceName
|
||||||
|
self.positionURL = positionURL
|
||||||
|
self.clientKey = clientKey
|
||||||
|
self.storyboardName = storyboardName
|
||||||
|
self.mapBoxKey = mapBoxKey
|
||||||
|
self.clientID = clientID
|
||||||
|
self.positionServiceName = positionServiceName
|
||||||
|
self.username = username
|
||||||
|
self.isSimulationModeEnabled = isSimulationModeEnabled
|
||||||
|
self.isShowUserName = isShowUserName
|
||||||
|
self.isUpdateUserLocationSmoothly = isUpdateUserLocationSmoothly
|
||||||
|
self.isEnableReportIssue = isEnableReportIssue
|
||||||
|
self.languageCode = languageCode
|
||||||
|
self.clinicID = clinicID
|
||||||
|
self.patientID = patientID
|
||||||
|
self.projectID = projectID
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
import PenNavUI
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class PenguinNavigator {
|
||||||
|
private var config: PenguinModel
|
||||||
|
|
||||||
|
init(config: PenguinModel) {
|
||||||
|
self.config = config
|
||||||
|
}
|
||||||
|
|
||||||
|
private func logError(_ message: String) {
|
||||||
|
// Centralized logging function
|
||||||
|
print("PenguinSDKNavigator Error: \(message)")
|
||||||
|
}
|
||||||
|
|
||||||
|
func navigateToPOI( referenceId:String,completion: @escaping (Bool, String?) -> Void) {
|
||||||
|
PenNavUIManager.shared.getToken(clientID: config.clientID, clientKey: config.clientKey) { [weak self] token, error in
|
||||||
|
|
||||||
|
if let error = error {
|
||||||
|
let errorMessage = "Token error while getting the for Navigate to method"
|
||||||
|
completion(false, "Failed to get token: \(errorMessage)")
|
||||||
|
|
||||||
|
print("Failed to get token: \(errorMessage)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let token = token else {
|
||||||
|
completion(false, "Token is nil")
|
||||||
|
print("Token is nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
print("Token Generated")
|
||||||
|
print(token);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleNavigation(referenceId: String, token: String, completion: @escaping (Bool, String?) -> Void) {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
PenNavUIManager.shared.setToken(token: token)
|
||||||
|
|
||||||
|
PenNavUIManager.shared.navigate(to: referenceId) { [weak self] _, navError in
|
||||||
|
guard let self = self else { return }
|
||||||
|
|
||||||
|
if let navError = navError {
|
||||||
|
self.logError("Navigation error: Reference ID invalid")
|
||||||
|
completion(false, "Navigation error: \(navError.localizedDescription)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Navigation successful
|
||||||
|
completion(true, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// BlueGpsPlugin.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by Penguin .
|
||||||
|
//
|
||||||
|
|
||||||
|
//import Foundation
|
||||||
|
//import Flutter
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * A Flutter plugin for integrating Penguin SDK functionality.
|
||||||
|
// * This class registers a view factory with the Flutter engine to create native views.
|
||||||
|
// */
|
||||||
|
//class PenguinPlugin: NSObject, FlutterPlugin {
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Registers the plugin with the Flutter engine.
|
||||||
|
// *
|
||||||
|
// * @param registrar The [FlutterPluginRegistrar] used to register the plugin.
|
||||||
|
// * This method is called when the plugin is initialized, and it sets up the communication
|
||||||
|
// * between Flutter and native code.
|
||||||
|
// */
|
||||||
|
// public static func register(with registrar: FlutterPluginRegistrar) {
|
||||||
|
// // Create an instance of PenguinViewFactory with the binary messenger from the registrar
|
||||||
|
// let factory = PenguinViewFactory(messenger: registrar.messenger())
|
||||||
|
//
|
||||||
|
// // Register the view factory with a unique ID for use in Flutter code
|
||||||
|
// registrar.register(factory, withId: "penguin_native")
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,445 @@
|
|||||||
|
//
|
||||||
|
|
||||||
|
// BlueGpsView.swift
|
||||||
|
|
||||||
|
// Runner
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
// Created by Penguin.
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
import Flutter
|
||||||
|
import PenNavUI
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Flutter
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* A custom Flutter platform view for displaying Penguin UI components.
|
||||||
|
|
||||||
|
* This class integrates with the Penguin navigation SDK and handles UI events.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
class PenguinView: NSObject, FlutterPlatformView, PIEventsDelegate, PenNavInitializationDelegate
|
||||||
|
|
||||||
|
{
|
||||||
|
// The main view displayed within the platform view
|
||||||
|
|
||||||
|
private var _view: UIView
|
||||||
|
|
||||||
|
private var model: PenguinModel?
|
||||||
|
|
||||||
|
private var methodChannel: FlutterMethodChannel
|
||||||
|
|
||||||
|
var onSuccess: (() -> Void)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* Initializes the PenguinView with the provided parameters.
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
* @param frame The frame of the view, specifying its size and position.
|
||||||
|
|
||||||
|
* @param viewId A unique identifier for this view instance.
|
||||||
|
|
||||||
|
* @param args Optional arguments provided for creating the view.
|
||||||
|
|
||||||
|
* @param messenger The [FlutterBinaryMessenger] used for communication with Dart.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
init(
|
||||||
|
|
||||||
|
frame: CGRect,
|
||||||
|
|
||||||
|
viewIdentifier viewId: Int64,
|
||||||
|
|
||||||
|
arguments args: Any?,
|
||||||
|
|
||||||
|
binaryMessenger messenger: FlutterBinaryMessenger?
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
_view = UIView()
|
||||||
|
|
||||||
|
methodChannel = FlutterMethodChannel(name: "launch_penguin_ui", binaryMessenger: messenger!)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
super.init()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Get the screen's width and height to set the view's frame
|
||||||
|
|
||||||
|
let screenWidth = UIScreen.main.bounds.width
|
||||||
|
|
||||||
|
let screenHeight = UIScreen.main.bounds.height
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Uncomment to set the background color of the view
|
||||||
|
|
||||||
|
// _view.backgroundColor = UIColor.red
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Set the frame of the view to cover the entire screen
|
||||||
|
|
||||||
|
_view.frame = CGRect(x: 0, y: 0, width: screenWidth, height: screenHeight)
|
||||||
|
|
||||||
|
print("========Inside Penguin View ========")
|
||||||
|
|
||||||
|
print(args)
|
||||||
|
|
||||||
|
guard let arguments = args as? [String: Any] else {
|
||||||
|
|
||||||
|
print("Error: Arguments are not in the expected format.")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print("===== i got tha Args=======")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize the model from the arguments
|
||||||
|
|
||||||
|
if let penguinModel = PenguinModel(from: arguments) {
|
||||||
|
|
||||||
|
self.model = penguinModel
|
||||||
|
|
||||||
|
initPenguin(args: penguinModel)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
print("Error: Failed to initialize PenguinModel from arguments ")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the Penguin SDK with required configurations
|
||||||
|
|
||||||
|
// initPenguin( arguments: args)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* Initializes the Penguin SDK with custom configuration settings.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
func initPenguin(args: PenguinModel) {
|
||||||
|
|
||||||
|
// Set the initialization delegate to handle SDK initialization events
|
||||||
|
|
||||||
|
PenNavUIManager.shared.initializationDelegate = self
|
||||||
|
|
||||||
|
// Configure the Penguin SDK with necessary parameters
|
||||||
|
|
||||||
|
PenNavUIManager.shared
|
||||||
|
|
||||||
|
.setClientKey(args.clientKey)
|
||||||
|
|
||||||
|
.setClientID(args.clientID)
|
||||||
|
|
||||||
|
.setUsername(args.username)
|
||||||
|
|
||||||
|
.setSimulationModeEnabled(isEnable: args.isSimulationModeEnabled)
|
||||||
|
|
||||||
|
.setBaseURL(dataURL: args.dataURL, positionURL: args.positionURL)
|
||||||
|
|
||||||
|
.setServiceName(dataServiceName: args.dataServiceName, positionServiceName: args.positionServiceName)
|
||||||
|
|
||||||
|
.setIsShowUserName(args.isShowUserName)
|
||||||
|
|
||||||
|
.setIsUpdateUserLocationSmoothly(args.isUpdateUserLocationSmoothly)
|
||||||
|
|
||||||
|
.setEnableReportIssue(enable: args.isEnableReportIssue)
|
||||||
|
|
||||||
|
.setLanguage(args.languageCode)
|
||||||
|
|
||||||
|
.setBackButtonVisibility(true)
|
||||||
|
|
||||||
|
.build()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* Returns the main view associated with this platform view.
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
* @return The UIView instance that represents this platform view.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
func view() -> UIView {
|
||||||
|
|
||||||
|
return _view
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: - PIEventsDelegate Methods
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* Called when the Penguin UI is dismissed.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
func onPenNavUIDismiss() {
|
||||||
|
|
||||||
|
// Handle UI dismissal if needed
|
||||||
|
|
||||||
|
print("====== onPenNavUIDismiss =========")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
self.view().removeFromSuperview()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* Called when a report issue is generated.
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
* @param issue The type of issue reported.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
func onReportIssue(_ issue: PenNavUI.IssueType) {
|
||||||
|
|
||||||
|
// Handle report issue events if needed
|
||||||
|
|
||||||
|
print("====== onReportIssueError =========")
|
||||||
|
|
||||||
|
methodChannel.invokeMethod("onReportIssue", arguments: ["issueType": issue])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* Called when the Penguin UI setup is successful.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
func onPenNavSuccess() {
|
||||||
|
|
||||||
|
print("====== onPenNavSuccess =========")
|
||||||
|
|
||||||
|
onSuccess?()
|
||||||
|
|
||||||
|
methodChannel.invokeMethod("onPenNavSuccess", arguments: nil)
|
||||||
|
|
||||||
|
// Obtain the FlutterViewController instance
|
||||||
|
|
||||||
|
let controller: FlutterViewController = UIApplication.shared.windows.first?.rootViewController as! FlutterViewController
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("====== after controller onPenNavSuccess =========")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Set the events delegate to handle SDK events
|
||||||
|
|
||||||
|
PenNavUIManager.shared.eventsDelegate = self
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("====== after eventsDelegate onPenNavSuccess =========")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Present the Penguin UI on top of the Flutter view controller
|
||||||
|
|
||||||
|
PenNavUIManager.shared.present(root: controller, view: _view)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("====== after present onPenNavSuccess =========")
|
||||||
|
|
||||||
|
print(model?.clinicID)
|
||||||
|
|
||||||
|
print("====== after present onPenNavSuccess =========")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
guard let config = self.model else {
|
||||||
|
|
||||||
|
print("Error: Config Model is nil")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
guard let clinicID = self.model?.clinicID,
|
||||||
|
|
||||||
|
let clientID = self.model?.clientID, !clientID.isEmpty else {
|
||||||
|
|
||||||
|
print("Error: Config Client ID is nil or empty")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let navigator = PenguinNavigator(config: config)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PenNavUIManager.shared.getToken(clientID: config.clientID, clientKey: config.clientKey) { [weak self] token, error in
|
||||||
|
|
||||||
|
if let error = error {
|
||||||
|
|
||||||
|
let errorMessage = "Token error while getting the for Navigate to method"
|
||||||
|
|
||||||
|
print("Failed to get token: \(errorMessage)")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
guard let token = token else {
|
||||||
|
|
||||||
|
print("Token is nil")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print("Token Generated")
|
||||||
|
|
||||||
|
print(token);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
self?.handleNavigation(clinicID: clinicID, token: token) { success, errorMessage in
|
||||||
|
|
||||||
|
if success {
|
||||||
|
|
||||||
|
print("Navigation successful")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
print("Navigation failed: \(errorMessage ?? "Unknown error")")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("====== after Token onPenNavSuccess =========")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private func handleNavigation(clinicID: String, token: String, completion: @escaping (Bool, String?) -> Void) {
|
||||||
|
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
|
||||||
|
PenNavUIManager.shared.setToken(token: token)
|
||||||
|
|
||||||
|
PenNavUIManager.shared.navigate(to: clinicID)
|
||||||
|
|
||||||
|
completion(true,nil)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* Called when there is an initialization error with the Penguin UI.
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
* @param errorType The type of initialization error.
|
||||||
|
|
||||||
|
* @param errorDescription A description of the error.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
func onPenNavInitializationError(errorType: PenNavUI.PenNavUIError, errorDescription: String) {
|
||||||
|
|
||||||
|
// Handle initialization errors if needed
|
||||||
|
|
||||||
|
print("onPenNavInitializationErrorType: \(errorType.rawValue)")
|
||||||
|
|
||||||
|
print("onPenNavInitializationError: \(errorDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
//
|
||||||
|
// BlueGpsViewFactory.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by Penguin .
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Flutter
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A factory class for creating instances of [PenguinView].
|
||||||
|
* This class implements `FlutterPlatformViewFactory` to create and manage native views.
|
||||||
|
*/
|
||||||
|
class PenguinViewFactory: NSObject, FlutterPlatformViewFactory {
|
||||||
|
|
||||||
|
// The binary messenger used for communication with the Flutter engine
|
||||||
|
private var messenger: FlutterBinaryMessenger
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the PenguinViewFactory with the given messenger.
|
||||||
|
*
|
||||||
|
* @param messenger The [FlutterBinaryMessenger] used to communicate with Dart code.
|
||||||
|
*/
|
||||||
|
init(messenger: FlutterBinaryMessenger) {
|
||||||
|
self.messenger = messenger
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of [PenguinView].
|
||||||
|
*
|
||||||
|
* @param frame The frame of the view, specifying its size and position.
|
||||||
|
* @param viewId A unique identifier for this view instance.
|
||||||
|
* @param args Optional arguments provided for creating the view.
|
||||||
|
* @return An instance of [PenguinView] configured with the provided parameters.
|
||||||
|
*/
|
||||||
|
func create(
|
||||||
|
withFrame frame: CGRect,
|
||||||
|
viewIdentifier viewId: Int64,
|
||||||
|
arguments args: Any?
|
||||||
|
) -> FlutterPlatformView {
|
||||||
|
return PenguinView(
|
||||||
|
frame: frame,
|
||||||
|
viewIdentifier: viewId,
|
||||||
|
arguments: args,
|
||||||
|
binaryMessenger: messenger)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the codec used for encoding and decoding method channel arguments.
|
||||||
|
* This method is required when `arguments` in `create` is not `nil`.
|
||||||
|
*
|
||||||
|
* @return A [FlutterMessageCodec] instance used for serialization.
|
||||||
|
*/
|
||||||
|
public func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol {
|
||||||
|
return FlutterStandardMessageCodec.sharedInstance()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
class PatientPackageComponent {
|
||||||
|
List<PatientPackageComponents>? patientPackageComponents;
|
||||||
|
|
||||||
|
PatientPackageComponent({this.patientPackageComponents});
|
||||||
|
|
||||||
|
PatientPackageComponent.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['PatientPackageComponents'] != null) {
|
||||||
|
patientPackageComponents = <PatientPackageComponents>[];
|
||||||
|
json['PatientPackageComponents'].forEach((v) {
|
||||||
|
patientPackageComponents!.add(new PatientPackageComponents.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
if (this.patientPackageComponents != null) {
|
||||||
|
data['PatientPackageComponents'] = this.patientPackageComponents!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PatientPackageComponents {
|
||||||
|
int? invoiceNo;
|
||||||
|
int? lineItemNo;
|
||||||
|
String? procedureID;
|
||||||
|
String? procedureName;
|
||||||
|
int? projectID;
|
||||||
|
int? sequence;
|
||||||
|
String? setupID;
|
||||||
|
num? invoiceNo_VP;
|
||||||
|
|
||||||
|
PatientPackageComponents({this.invoiceNo, this.lineItemNo, this.procedureID, this.procedureName, this.projectID, this.sequence, this.setupID, this.invoiceNo_VP});
|
||||||
|
|
||||||
|
PatientPackageComponents.fromJson(Map<String, dynamic> json) {
|
||||||
|
invoiceNo = json['InvoiceNo'];
|
||||||
|
lineItemNo = json['LineItemNo'];
|
||||||
|
procedureID = json['ProcedureID'];
|
||||||
|
procedureName = json['ProcedureName'];
|
||||||
|
projectID = json['ProjectID'];
|
||||||
|
sequence = json['Sequence'];
|
||||||
|
setupID = json['SetupID'];
|
||||||
|
invoiceNo_VP = json['InvoiceNo_VP'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['InvoiceNo'] = this.invoiceNo;
|
||||||
|
data['LineItemNo'] = this.lineItemNo;
|
||||||
|
data['ProcedureID'] = this.procedureID;
|
||||||
|
data['ProcedureName'] = this.procedureName;
|
||||||
|
data['ProjectID'] = this.projectID;
|
||||||
|
data['Sequence'] = this.sequence;
|
||||||
|
data['SetupID'] = this.setupID;
|
||||||
|
data['InvoiceNo_VP'] = this.invoiceNo_VP;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
class EROnlineCheckInPaymentDetailsResponse {
|
||||||
|
num? cashPrice;
|
||||||
|
num? cashPriceTax;
|
||||||
|
num? cashPriceWithTax;
|
||||||
|
int? companyId;
|
||||||
|
String? companyName;
|
||||||
|
num? companyShareWithTax;
|
||||||
|
dynamic errCode;
|
||||||
|
int? groupID;
|
||||||
|
String? insurancePolicyNo;
|
||||||
|
String? message;
|
||||||
|
String? patientCardID;
|
||||||
|
num? patientShare;
|
||||||
|
num? patientShareWithTax;
|
||||||
|
num? patientTaxAmount;
|
||||||
|
int? policyId;
|
||||||
|
String? policyName;
|
||||||
|
String? procedureId;
|
||||||
|
String? procedureName;
|
||||||
|
dynamic setupID;
|
||||||
|
int? statusCode;
|
||||||
|
String? subPolicyNo;
|
||||||
|
|
||||||
|
EROnlineCheckInPaymentDetailsResponse(
|
||||||
|
{this.cashPrice,
|
||||||
|
this.cashPriceTax,
|
||||||
|
this.cashPriceWithTax,
|
||||||
|
this.companyId,
|
||||||
|
this.companyName,
|
||||||
|
this.companyShareWithTax,
|
||||||
|
this.errCode,
|
||||||
|
this.groupID,
|
||||||
|
this.insurancePolicyNo,
|
||||||
|
this.message,
|
||||||
|
this.patientCardID,
|
||||||
|
this.patientShare,
|
||||||
|
this.patientShareWithTax,
|
||||||
|
this.patientTaxAmount,
|
||||||
|
this.policyId,
|
||||||
|
this.policyName,
|
||||||
|
this.procedureId,
|
||||||
|
this.procedureName,
|
||||||
|
this.setupID,
|
||||||
|
this.statusCode,
|
||||||
|
this.subPolicyNo});
|
||||||
|
|
||||||
|
EROnlineCheckInPaymentDetailsResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
cashPrice = json['CashPrice'];
|
||||||
|
cashPriceTax = json['CashPriceTax'];
|
||||||
|
cashPriceWithTax = json['CashPriceWithTax'];
|
||||||
|
companyId = json['CompanyId'];
|
||||||
|
companyName = json['CompanyName'];
|
||||||
|
companyShareWithTax = json['CompanyShareWithTax'];
|
||||||
|
errCode = json['ErrCode'];
|
||||||
|
groupID = json['GroupID'];
|
||||||
|
insurancePolicyNo = json['InsurancePolicyNo'];
|
||||||
|
message = json['Message'];
|
||||||
|
patientCardID = json['PatientCardID'];
|
||||||
|
patientShare = json['PatientShare'];
|
||||||
|
patientShareWithTax = json['PatientShareWithTax'];
|
||||||
|
patientTaxAmount = json['PatientTaxAmount'];
|
||||||
|
policyId = json['PolicyId'];
|
||||||
|
policyName = json['PolicyName'];
|
||||||
|
procedureId = json['ProcedureId'];
|
||||||
|
procedureName = json['ProcedureName'];
|
||||||
|
setupID = json['SetupID'];
|
||||||
|
statusCode = json['StatusCode'];
|
||||||
|
subPolicyNo = json['SubPolicyNo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['CashPrice'] = this.cashPrice;
|
||||||
|
data['CashPriceTax'] = this.cashPriceTax;
|
||||||
|
data['CashPriceWithTax'] = this.cashPriceWithTax;
|
||||||
|
data['CompanyId'] = this.companyId;
|
||||||
|
data['CompanyName'] = this.companyName;
|
||||||
|
data['CompanyShareWithTax'] = this.companyShareWithTax;
|
||||||
|
data['ErrCode'] = this.errCode;
|
||||||
|
data['GroupID'] = this.groupID;
|
||||||
|
data['InsurancePolicyNo'] = this.insurancePolicyNo;
|
||||||
|
data['Message'] = this.message;
|
||||||
|
data['PatientCardID'] = this.patientCardID;
|
||||||
|
data['PatientShare'] = this.patientShare;
|
||||||
|
data['PatientShareWithTax'] = this.patientShareWithTax;
|
||||||
|
data['PatientTaxAmount'] = this.patientTaxAmount;
|
||||||
|
data['PolicyId'] = this.policyId;
|
||||||
|
data['PolicyName'] = this.policyName;
|
||||||
|
data['ProcedureId'] = this.procedureId;
|
||||||
|
data['ProcedureName'] = this.procedureName;
|
||||||
|
data['SetupID'] = this.setupID;
|
||||||
|
data['StatusCode'] = this.statusCode;
|
||||||
|
data['SubPolicyNo'] = this.subPolicyNo;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,559 @@
|
|||||||
|
import 'dart:collection';
|
||||||
|
|
||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../../config/shared_pref_kay.dart';
|
||||||
|
import '../../../config/size_config.dart';
|
||||||
|
import '../../../core/model/hospitals/hospitals_model.dart';
|
||||||
|
import '../../../core/viewModels/project_view_model.dart';
|
||||||
|
import '../../../models/Appointments/DoctorListResponse.dart';
|
||||||
|
import '../../../models/Appointments/SearchInfoModel.dart';
|
||||||
|
import '../../../models/Clinics/ClinicListResponse.dart';
|
||||||
|
import '../../../services/appointment_services/GetDoctorsList.dart';
|
||||||
|
import '../../../services/authentication/auth_provider.dart';
|
||||||
|
import '../../../services/clinic_services/get_clinic_service.dart';
|
||||||
|
import '../../../uitl/app_toast.dart';
|
||||||
|
import '../../../uitl/gif_loader_dialog_utils.dart';
|
||||||
|
import '../../../uitl/translations_delegate_base.dart';
|
||||||
|
import '../../../widgets/transitions/fade_page.dart';
|
||||||
|
import '../../livecare/livecare_home.dart';
|
||||||
|
import '../DentalComplaints.dart';
|
||||||
|
import '../LaserBooking.dart';
|
||||||
|
import '../SearchResults.dart';
|
||||||
|
import '../dialog/clinic_list_dialog.dart';
|
||||||
|
import 'LiveCareBookAppointment.dart';
|
||||||
|
|
||||||
|
class SearchByHospital extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
State<SearchByHospital> createState() => _SearchByHospitalState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SearchByHospitalState extends State<SearchByHospital> {
|
||||||
|
HospitalsModel? selectedHospital;
|
||||||
|
bool nearestAppo = false;
|
||||||
|
|
||||||
|
String? selectedClinicName;
|
||||||
|
List<HospitalsModel> projectsList = [];
|
||||||
|
List<ListClinicCentralized>? clinicIds = List.empty();
|
||||||
|
|
||||||
|
final GlobalKey projectDropdownKey = GlobalKey();
|
||||||
|
|
||||||
|
List<ListClinicCentralized> clinicsList = [];
|
||||||
|
bool isMobileAppDentalAllow = false;
|
||||||
|
ListClinicCentralized? selectedClinic;
|
||||||
|
|
||||||
|
String? dropdownValue;
|
||||||
|
String dropdownTitle = "";
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) => getProjectsList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
AppGlobal.context = context;
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 6, right: 6, top: 16),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Checkbox(
|
||||||
|
activeColor: CustomColors.accentColor,
|
||||||
|
value: nearestAppo,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
nearestAppo = value ?? false;
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
AutoSizeText(
|
||||||
|
TranslationBase.of(context).nearestAppo.trim(),
|
||||||
|
maxLines: 1,
|
||||||
|
minFontSize: 10,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier! * 1.4,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
letterSpacing: -0.39,
|
||||||
|
height: 0.8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Text(TranslationBase.of(context).nearestAppo, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(8),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
openDropdown(projectDropdownKey);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: containerRadius(Colors.white, 12),
|
||||||
|
margin: EdgeInsets.only(left: 20, right: 20),
|
||||||
|
padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).selectHospital,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11,
|
||||||
|
letterSpacing: -0.44,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 18,
|
||||||
|
width: double.infinity,
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton<HospitalsModel>(
|
||||||
|
key: projectDropdownKey,
|
||||||
|
hint: Text(
|
||||||
|
TranslationBase.of(context).selectHospital),
|
||||||
|
value: selectedHospital,
|
||||||
|
iconSize: 0,
|
||||||
|
isExpanded: true,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: -0.56,
|
||||||
|
color: Colors.black),
|
||||||
|
items: projectsList.map((HospitalsModel item) {
|
||||||
|
return DropdownMenuItem<HospitalsModel>(
|
||||||
|
value: item,
|
||||||
|
child: AutoSizeText(
|
||||||
|
item.name!,
|
||||||
|
maxLines: 1,
|
||||||
|
minFontSize: 10,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier! * 1.6,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
letterSpacing: -0.39,
|
||||||
|
height: 0.8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Text('${item.name!}'),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (HospitalsModel? newValue) {
|
||||||
|
getClinicWrtHospital(newValue);
|
||||||
|
setState(() {
|
||||||
|
selectedHospital = newValue;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(Icons.keyboard_arrow_down),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
if (clinicIds?.isNotEmpty == true) ...[
|
||||||
|
mHeight(8),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
showClickListDialog(context, clinicIds ?? List.empty(),
|
||||||
|
onSelection: (ListClinicCentralized clincs) {
|
||||||
|
selectedClinic = clincs;
|
||||||
|
Navigator.pop(context);
|
||||||
|
setState(() {
|
||||||
|
dropdownTitle = clincs.clinicDescription!;
|
||||||
|
dropdownValue = clincs.clinicID.toString() +
|
||||||
|
"-" +
|
||||||
|
clincs.isLiveCareClinicAndOnline.toString() +
|
||||||
|
"-" +
|
||||||
|
clincs.liveCareClinicID.toString() +
|
||||||
|
"-" +
|
||||||
|
clincs.liveCareServiceID.toString();
|
||||||
|
});
|
||||||
|
getDoctorsList(context);
|
||||||
|
|
||||||
|
context
|
||||||
|
.read<ProjectViewModel>()
|
||||||
|
.analytics
|
||||||
|
.appointment
|
||||||
|
.book_appointment_select_clinic(
|
||||||
|
appointment_type: 'regular',
|
||||||
|
clinic: clincs.clinicDescription);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: containerRadius(Colors.white, 12),
|
||||||
|
margin: EdgeInsets.only(left: 20, right: 20),
|
||||||
|
padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 8),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).selectClinic,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11,
|
||||||
|
letterSpacing: -0.44,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 4, bottom: 2),
|
||||||
|
child: Text(
|
||||||
|
dropdownTitle,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
letterSpacing: -0.44,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(Icons.keyboard_arrow_down),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void openDropdown(GlobalKey key) {
|
||||||
|
GestureDetector? detector;
|
||||||
|
|
||||||
|
void searchForGestureDetector(BuildContext element) {
|
||||||
|
element.visitChildElements((element) {
|
||||||
|
if (element.widget != null && element.widget is GestureDetector) {
|
||||||
|
detector = element.widget as GestureDetector?;
|
||||||
|
//return false;
|
||||||
|
} else {
|
||||||
|
searchForGestureDetector(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
//return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
searchForGestureDetector(key.currentContext!);
|
||||||
|
assert(detector != null);
|
||||||
|
|
||||||
|
detector!.onTap!();
|
||||||
|
}
|
||||||
|
|
||||||
|
GestureDetector? searchForGestureDetector(BuildContext element) {
|
||||||
|
GestureDetector? detector;
|
||||||
|
element.visitChildElements((element) {
|
||||||
|
if (element.widget != null && element.widget is GestureDetector) {
|
||||||
|
detector = element.widget as GestureDetector?;
|
||||||
|
//return false;
|
||||||
|
} else {
|
||||||
|
searchForGestureDetector(element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return detector;
|
||||||
|
}
|
||||||
|
|
||||||
|
getProjectsList() {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
|
||||||
|
int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2;
|
||||||
|
ClinicListService service = new ClinicListService();
|
||||||
|
List<HospitalsModel> projectsListLocal = [];
|
||||||
|
service.getProjectsList(languageID, context).then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
|
||||||
|
if (res['MessageStatus'] == 1) {
|
||||||
|
setState(() {
|
||||||
|
res['ListProject'].forEach((v) {
|
||||||
|
projectsListLocal.add(new HospitalsModel.fromJson(v));
|
||||||
|
});
|
||||||
|
projectsList = projectsListLocal;
|
||||||
|
});
|
||||||
|
} else {}
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void getClinicWrtHospital(HospitalsModel? newValue) async {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
ClinicListService service = new ClinicListService();
|
||||||
|
List<HospitalsModel> projectsListLocal = [];
|
||||||
|
setState(() {
|
||||||
|
clinicIds = List.empty();
|
||||||
|
});
|
||||||
|
List<ListClinicCentralized> clinicId = [];
|
||||||
|
try {
|
||||||
|
Map res = await service.getClinicByHospital(
|
||||||
|
projectID: newValue?.mainProjectID.toString() ?? "");
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
if (res['MessageStatus'] == 1) {
|
||||||
|
List list = res['ListClinic'];
|
||||||
|
|
||||||
|
if (list.isEmpty) {
|
||||||
|
AppToast.showErrorToast(
|
||||||
|
message: TranslationBase.of(context).NoClinicFound,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
res['ListClinic'].forEach((v) {
|
||||||
|
clinicId.add(ListClinicCentralized.fromJson(v));
|
||||||
|
});
|
||||||
|
clinicIds = clinicId;
|
||||||
|
setState(() {});
|
||||||
|
} else {
|
||||||
|
AppToast.showErrorToast(
|
||||||
|
message: TranslationBase.of(context).NoClinicFound,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("the error is $e");
|
||||||
|
AppToast.showErrorToast(
|
||||||
|
message: TranslationBase.of(context).NoClinicFound,
|
||||||
|
);
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .then((res) {
|
||||||
|
// print("the result is obtained");
|
||||||
|
// GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
// if (res['MessageStatus'] == 1) {
|
||||||
|
// List list = res['ListClinic'];
|
||||||
|
//
|
||||||
|
// if(list.isEmpty){
|
||||||
|
// AppToast.showErrorToast(message:
|
||||||
|
// TranslationBase.of(context).NoClinicFound,
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// res['ListClinic'].forEach((v) {
|
||||||
|
// clinicId?.add(ListClinicCentralized.fromJson(v));
|
||||||
|
// });
|
||||||
|
// clinicIds = clinicId;
|
||||||
|
// setState(() {
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// AppToast.showErrorToast(message:
|
||||||
|
// TranslationBase.of(context).NoClinicFound,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }).catchError((err) {
|
||||||
|
// print('the error is $err');
|
||||||
|
// AppToast.showErrorToast(message:
|
||||||
|
// TranslationBase.of(context).NoClinicFound,
|
||||||
|
// );
|
||||||
|
// GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
// }).catchError((err) {
|
||||||
|
// AppToast.showErrorToast(message:
|
||||||
|
// TranslationBase.of(context).NoClinicFound,
|
||||||
|
// );
|
||||||
|
// GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
//
|
||||||
|
// print(err);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future navigateToDentalComplaints(
|
||||||
|
BuildContext context, SearchInfo searchInfo) async {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: DentalComplaints(searchInfo: searchInfo),
|
||||||
|
),
|
||||||
|
).then((value) {
|
||||||
|
setState(() {
|
||||||
|
dropdownValue = null;
|
||||||
|
selectedHospital = null;
|
||||||
|
dropdownTitle = "";
|
||||||
|
clinicIds = List.empty();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
callDoctorsSearchAPI(int clinicID) {
|
||||||
|
int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2;
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
List<DoctorList> doctorsList = [];
|
||||||
|
List<String> arr = [];
|
||||||
|
List<String> arrDistance = [];
|
||||||
|
List<String> result;
|
||||||
|
int numAll;
|
||||||
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
|
||||||
|
[];
|
||||||
|
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
service
|
||||||
|
.getDoctorsList(
|
||||||
|
clinicID,
|
||||||
|
selectedHospital?.mainProjectID.toString() != ""
|
||||||
|
? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1")
|
||||||
|
: 0,
|
||||||
|
nearestAppo,
|
||||||
|
languageID,
|
||||||
|
null)
|
||||||
|
.then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
if (res['MessageStatus'] == 1) {
|
||||||
|
setState(() {
|
||||||
|
if (res['DoctorList'].length != 0) {
|
||||||
|
doctorsList.clear();
|
||||||
|
res['DoctorList'].forEach((v) {
|
||||||
|
doctorsList.add(DoctorList.fromJson(v));
|
||||||
|
});
|
||||||
|
doctorsList.forEach((element) {
|
||||||
|
List<PatientDoctorAppointmentList> doctorByHospital =
|
||||||
|
_patientDoctorAppointmentListHospital
|
||||||
|
.where(
|
||||||
|
(elementClinic) =>
|
||||||
|
elementClinic.filterName == element.getProjectCompleteName(),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (doctorByHospital.length != 0) {
|
||||||
|
_patientDoctorAppointmentListHospital[
|
||||||
|
_patientDoctorAppointmentListHospital
|
||||||
|
.indexOf(doctorByHospital[0])]
|
||||||
|
.patientDoctorAppointmentList!
|
||||||
|
.add(element);
|
||||||
|
} else {
|
||||||
|
_patientDoctorAppointmentListHospital.add(
|
||||||
|
PatientDoctorAppointmentList(
|
||||||
|
filterName: element.getProjectCompleteName(),
|
||||||
|
distanceInKMs:
|
||||||
|
element.projectDistanceInKiloMeters.toString(),
|
||||||
|
patientDoctorAppointment: element));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {}
|
||||||
|
});
|
||||||
|
|
||||||
|
result = LinkedHashSet<String>.from(arr).toList();
|
||||||
|
numAll = result.length;
|
||||||
|
navigateToSearchResults(
|
||||||
|
context, doctorsList, _patientDoctorAppointmentListHospital);
|
||||||
|
} else {
|
||||||
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
print(err);
|
||||||
|
AppToast.showErrorToast(message: err, localContext: context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future navigateToSearchResults(
|
||||||
|
context,
|
||||||
|
List<DoctorList> docList,
|
||||||
|
List<PatientDoctorAppointmentList>
|
||||||
|
patientDoctorAppointmentListHospital) async {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: SearchResults(
|
||||||
|
isLiveCareAppointment: false,
|
||||||
|
doctorsList: docList,
|
||||||
|
patientDoctorAppointmentListHospital:
|
||||||
|
patientDoctorAppointmentListHospital)))
|
||||||
|
.then((value) {
|
||||||
|
print("navigation return ");
|
||||||
|
dropdownValue = null;
|
||||||
|
dropdownTitle = "";
|
||||||
|
selectedHospital = null;
|
||||||
|
clinicIds = List.empty();
|
||||||
|
setState(() {});
|
||||||
|
// getProjectsList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future navigateToLaserClinic(BuildContext context) async {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: LaserBooking(),
|
||||||
|
),
|
||||||
|
).then((value) {
|
||||||
|
print("LaserBooking navigation return ");
|
||||||
|
setState(() {
|
||||||
|
dropdownValue = null;
|
||||||
|
selectedHospital = null;
|
||||||
|
dropdownTitle = "";
|
||||||
|
clinicIds = List.empty();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getDoctorsList(BuildContext context) {
|
||||||
|
SearchInfo searchInfo = new SearchInfo();
|
||||||
|
if (dropdownValue != null) if (dropdownValue!.split("-")[0] == "17") {
|
||||||
|
searchInfo.ProjectID = int.parse(selectedHospital?.mainProjectID.toString() ?? "");
|
||||||
|
searchInfo.ClinicID = int.parse(dropdownValue!.split("-")[0]);
|
||||||
|
searchInfo.hospital = selectedHospital;
|
||||||
|
searchInfo.clinic = selectedClinic;
|
||||||
|
searchInfo.date = DateTime.now();
|
||||||
|
|
||||||
|
if (context.read<ProjectViewModel>().isLogin) {
|
||||||
|
if (context.read<ProjectViewModel>().user.age! > 12) {
|
||||||
|
navigateToDentalComplaints(context, searchInfo);
|
||||||
|
} else {
|
||||||
|
callDoctorsSearchAPI(17);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
navigateToDentalComplaints(context, searchInfo);
|
||||||
|
}
|
||||||
|
} else if (dropdownValue!.split("-")[0] == "253") {
|
||||||
|
navigateToLaserClinic(context);
|
||||||
|
// callDoctorsSearchAPI();
|
||||||
|
} else if (dropdownValue!.split("-")[1] == "true"
|
||||||
|
// && authProvider.isLogin &&
|
||||||
|
// authUser.patientType == 1
|
||||||
|
) {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: LiveCareBookAppointment(
|
||||||
|
clinicName: dropdownTitle,
|
||||||
|
liveCareClinicID: dropdownValue!.split("-")[2],
|
||||||
|
liveCareServiceID: dropdownValue!.split("-")[3]),
|
||||||
|
),
|
||||||
|
).then((value) {
|
||||||
|
print("navigation return ");
|
||||||
|
if (value == "false") dropdownValue = null;
|
||||||
|
|
||||||
|
// setState(() {
|
||||||
|
// });
|
||||||
|
if (value == "livecare") {
|
||||||
|
Navigator.push(context, FadePage(page: LiveCareHome()));
|
||||||
|
}
|
||||||
|
if (value == "schedule") {
|
||||||
|
callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0]));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setState(() {});
|
||||||
|
} else {
|
||||||
|
callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,113 @@
|
|||||||
|
import 'package:diplomaticquarterapp/pages/BookAppointment/waiting_appointment/waiting_appointment_verification.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
|
class WaitingAppointmentInfo extends StatelessWidget {
|
||||||
|
const WaitingAppointmentInfo({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: TranslationBase.of(context).waitingAppointment,
|
||||||
|
isShowAppBar: true,
|
||||||
|
isShowDecPage: false,
|
||||||
|
showNewAppBar: true,
|
||||||
|
showNewAppBarTitle: true,
|
||||||
|
backgroundColor: CustomColors.appBackgroudGreyColor,
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
decoration: containerRadius(Colors.white, 10),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
"assets/images/new/waitingAppo.svg",
|
||||||
|
width: 52.0,
|
||||||
|
height: 52.0,
|
||||||
|
),
|
||||||
|
mHeight(11),
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).whatWaitingAppointment,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
mHeight(11),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).waitingAppointmentText1,
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, letterSpacing: -1.04, height: 35 / 24, overflow: TextOverflow.clip),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(18),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).waitingAppointmentText2,
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, letterSpacing: -1.04, height: 35 / 24, overflow: TextOverflow.clip),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.warning,
|
||||||
|
size: 20,
|
||||||
|
color: Color(0xffA78618),
|
||||||
|
),
|
||||||
|
mWidth(10),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.7,
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).waitingAppointmentText3,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14, fontStyle: FontStyle.italic, fontWeight: FontWeight.w600, color: Color(0xffA78618), letterSpacing: -1.04, height: 35 / 24, overflow: TextOverflow.clip),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
height: 80,
|
||||||
|
color: CustomColors.white,
|
||||||
|
padding: EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 25.0),
|
||||||
|
child: Container(
|
||||||
|
child: DefaultButton(
|
||||||
|
TranslationBase.of(context).continues,
|
||||||
|
() {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: WaitingAppointmentVerification(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
color: CustomColors.accentColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,292 @@
|
|||||||
|
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/privilege/ProjectDetailListModel.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/BookAppointment/BookConfirm.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/location_util.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/nfc/nfc_reader_sheet.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../../uitl/utils.dart';
|
||||||
|
|
||||||
|
class WaitingAppointmentVerification extends StatefulWidget {
|
||||||
|
const WaitingAppointmentVerification({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<WaitingAppointmentVerification> createState() => _WaitingAppointmentVerificationState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _WaitingAppointmentVerificationState extends State<WaitingAppointmentVerification> {
|
||||||
|
String selectedVerificationMethod = "QR";
|
||||||
|
|
||||||
|
late ProjectViewModel projectViewModel;
|
||||||
|
late LocationUtils locationUtils;
|
||||||
|
ProjectDetailListModel projectDetailListModel = ProjectDetailListModel();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
projectViewModel = Provider.of(context);
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: TranslationBase.of(context).waitingAppointment,
|
||||||
|
isShowAppBar: true,
|
||||||
|
isShowDecPage: false,
|
||||||
|
showNewAppBar: true,
|
||||||
|
showNewAppBarTitle: true,
|
||||||
|
backgroundColor: CustomColors.appBackgroudGreyColor,
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
mHeight(11),
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).waitingAppointmentVerificationMethod,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.04, height: 35 / 24),
|
||||||
|
),
|
||||||
|
mHeight(12),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
decoration: containerRadius(Colors.white, 10),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
selectedVerificationMethod = "QR";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
decoration: containerColorRadiusBorderWidth(selectedVerificationMethod == "QR" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
|
||||||
|
),
|
||||||
|
mWidth(6),
|
||||||
|
Container(
|
||||||
|
height: 40.0,
|
||||||
|
width: 40.0,
|
||||||
|
padding: EdgeInsets.all(7.0),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
"assets/images/new/services/qr_code.svg",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).pharmaLiveCareScanQR,
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, fontWeight: FontWeight.w600, letterSpacing: -1.04, height: 35 / 24, overflow: TextOverflow.clip),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
selectedVerificationMethod = "NFC";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
decoration: containerColorRadiusBorderWidth(selectedVerificationMethod == "NFC" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
|
||||||
|
),
|
||||||
|
mWidth(6),
|
||||||
|
Container(
|
||||||
|
height: 40.0,
|
||||||
|
width: 40.0,
|
||||||
|
padding: EdgeInsets.all(7.0),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
"assets/images/new/services/contactless.svg",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).scanNFC,
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, fontWeight: FontWeight.w600, letterSpacing: -1.04, height: 35 / 24, overflow: TextOverflow.clip),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
selectedVerificationMethod = "Location";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
decoration: containerColorRadiusBorderWidth(selectedVerificationMethod == "Location" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
|
||||||
|
),
|
||||||
|
mWidth(6),
|
||||||
|
Container(
|
||||||
|
height: 40.0,
|
||||||
|
width: 40.0,
|
||||||
|
padding: EdgeInsets.all(7.0),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
"assets/images/new/services/location.svg",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).checkInViaLocation,
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, fontWeight: FontWeight.w600, letterSpacing: -1.04, height: 35 / 24, overflow: TextOverflow.clip),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(6),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
decoration: containerRadius(Colors.white, 10),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
mHeight(12),
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).howToUseVerificationMethod,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -1.04, height: 35 / 24),
|
||||||
|
),
|
||||||
|
mHeight(12),
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/new/NFCCheckIn_QR_gps_HMG.png',
|
||||||
|
fit: BoxFit.fitWidth,
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
),
|
||||||
|
mHeight(12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
height: 80,
|
||||||
|
color: CustomColors.white,
|
||||||
|
padding: EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 25.0),
|
||||||
|
child: Container(
|
||||||
|
child: DefaultButton(
|
||||||
|
TranslationBase.of(context).continues,
|
||||||
|
() {
|
||||||
|
startVerification();
|
||||||
|
},
|
||||||
|
color: CustomColors.accentColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
startVerification() {
|
||||||
|
switch (selectedVerificationMethod) {
|
||||||
|
case "QR":
|
||||||
|
startQRCodeScan();
|
||||||
|
break;
|
||||||
|
case "NFC":
|
||||||
|
startNFCScan();
|
||||||
|
break;
|
||||||
|
case "Location":
|
||||||
|
startLocationCheckIn();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkScannedNFCAndQRCode(String nfcId) {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
service.checkScannedNFCAndQRCode(nfcId, projectViewModel.waitingAppointmentDoctor!.projectID!).then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
projectViewModel.setWaitingAppointmentNFCCode(nfcId);
|
||||||
|
if (res["returnValue"] == 1) {
|
||||||
|
navigateToBookConfirm(context);
|
||||||
|
} else {
|
||||||
|
AppToast.showErrorToast(message: "Invalid verification point scanned.");
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future navigateToBookConfirm(context) async {
|
||||||
|
final DateFormat formatter = DateFormat('yyyy-MM-dd');
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: BookConfirm(
|
||||||
|
doctor: projectViewModel.waitingAppointmentDoctor!,
|
||||||
|
isLiveCareAppointment: false,
|
||||||
|
selectedDate: formatter.format(DateTime.now()),
|
||||||
|
selectedTime: TranslationBase.of(context).waitingAppointment,
|
||||||
|
initialSlotDuration: 15,
|
||||||
|
isWalkinAppointment: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
startLocationCheckIn() async {
|
||||||
|
locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context);
|
||||||
|
locationUtils.getCurrentLocation(callBack: (value) {
|
||||||
|
projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, projectViewModel.waitingAppointmentProjectID);
|
||||||
|
double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000;
|
||||||
|
projectViewModel.setWaitingAppointmentNFCCode(projectDetailListModel.checkInQrCode!);
|
||||||
|
print(dist);
|
||||||
|
if (dist <= projectDetailListModel.geofenceRadius!) {
|
||||||
|
navigateToBookConfirm(context);
|
||||||
|
} else {
|
||||||
|
AppToast.showErrorToast(message: TranslationBase.of(context).locationCheckInError);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
startNFCScan() {
|
||||||
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
|
showNfcReader(context, onNcfScan: (String nfcId) {
|
||||||
|
Future.delayed(const Duration(milliseconds: 100), () {
|
||||||
|
checkScannedNFCAndQRCode(nfcId);
|
||||||
|
});
|
||||||
|
}, onCancel: () {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// locator<GAnalytics>().todoList.to_do_list_nfc_cancel(widget.appointment!);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
startQRCodeScan() async {
|
||||||
|
String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent));
|
||||||
|
if (onlineCheckInQRCode != "") {
|
||||||
|
checkScannedNFCAndQRCode(onlineCheckInQRCode);
|
||||||
|
} else {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,203 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/ErService/EROnlineCheckIn/EROnlineCheckInPaymentDetails.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.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_new.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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 EROnlineCheckInBookAppointment extends StatefulWidget {
|
||||||
|
const EROnlineCheckInBookAppointment();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<EROnlineCheckInBookAppointment> createState() => _EROnlineCheckInBookAppointmentState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EROnlineCheckInBookAppointmentState extends State<EROnlineCheckInBookAppointment> with SingleTickerProviderStateMixin {
|
||||||
|
late ProjectViewModel projectViewModel;
|
||||||
|
List<HospitalsModel> projectsList = [];
|
||||||
|
final GlobalKey projectDropdownKey = GlobalKey();
|
||||||
|
HospitalsModel? selectedHospital;
|
||||||
|
String projectDropdownValue = "";
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
getProjectsList();
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
projectViewModel = Provider.of(context);
|
||||||
|
return AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: TranslationBase.of(context).emergency + " ${TranslationBase.of(context).checkinOptions}",
|
||||||
|
isShowDecPage: false,
|
||||||
|
showNewAppBar: true,
|
||||||
|
showNewAppBarTitle: true,
|
||||||
|
backgroundColor: Color(0xffF8F8F8),
|
||||||
|
body: Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
openDropdown(projectDropdownKey);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: containerRadius(Colors.white, 12),
|
||||||
|
padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).selectHospital,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11,
|
||||||
|
letterSpacing: -0.44,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 18,
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton<HospitalsModel>(
|
||||||
|
key: projectDropdownKey,
|
||||||
|
hint: new Text(TranslationBase.of(context).selectHospital),
|
||||||
|
value: selectedHospital,
|
||||||
|
iconSize: 0,
|
||||||
|
isExpanded: true,
|
||||||
|
style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black),
|
||||||
|
items: projectsList.map((item) {
|
||||||
|
return new DropdownMenuItem<HospitalsModel>(
|
||||||
|
value: item,
|
||||||
|
child: new Text(item.name!),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (newValue) async {
|
||||||
|
setState(() {
|
||||||
|
selectedHospital = newValue;
|
||||||
|
projectDropdownValue = newValue!.mainProjectID.toString();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(Icons.keyboard_arrow_down),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(16),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: containerRadius(Colors.white, 12),
|
||||||
|
padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).clinicName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11,
|
||||||
|
letterSpacing: -0.44,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"ER Clinic",
|
||||||
|
style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
height: 80,
|
||||||
|
color: CustomColors.white,
|
||||||
|
padding: EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 25.0),
|
||||||
|
child: DefaultButton(
|
||||||
|
TranslationBase.of(context).bookAppo,
|
||||||
|
() {
|
||||||
|
if (projectDropdownValue == "" || selectedHospital == null) {
|
||||||
|
AppToast.showErrorToast(message: TranslationBase.of(context).selectHospital);
|
||||||
|
} else {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: EROnlineCheckInPaymentDetails(
|
||||||
|
projectID: selectedHospital!.iD,
|
||||||
|
isERBookAppointment: true,
|
||||||
|
projectName: selectedHospital!.name ?? "",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
color: CustomColors.accentColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getProjectsList() {
|
||||||
|
int languageID = projectViewModel.isArabic ? 1 : 2;
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
ClinicListService service = new ClinicListService();
|
||||||
|
List<HospitalsModel> projectsListLocal = [];
|
||||||
|
service.getProjectsList(languageID, context).then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
if (res['MessageStatus'] == 1) {
|
||||||
|
setState(() {
|
||||||
|
res['ListProject'].forEach((v) {
|
||||||
|
projectsListLocal.add(new HospitalsModel.fromJson(v));
|
||||||
|
});
|
||||||
|
projectsList = projectsListLocal;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void openDropdown(GlobalKey key) {
|
||||||
|
GestureDetector? detector;
|
||||||
|
void searchForGestureDetector(BuildContext element) {
|
||||||
|
element.visitChildElements((element) {
|
||||||
|
if (element.widget != null && element.widget is GestureDetector) {
|
||||||
|
detector = element.widget as GestureDetector?;
|
||||||
|
// return false;
|
||||||
|
} else {
|
||||||
|
searchForGestureDetector(element);
|
||||||
|
}
|
||||||
|
// return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
searchForGestureDetector(key.currentContext!);
|
||||||
|
assert(detector != null);
|
||||||
|
detector!.onTap!();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,451 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/ErService/EROnlineCheckIn/EROnlineCheckInBookAppointment.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/ErService/EROnlineCheckIn/EROnlineCheckInPaymentDetails.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.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_new.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/nfc/nfc_reader_sheet.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_nfc_kit/flutter_nfc_kit.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class EROnlineCheckInHomePage extends StatefulWidget {
|
||||||
|
const EROnlineCheckInHomePage();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<EROnlineCheckInHomePage> createState() => _EROnlineCheckInHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with SingleTickerProviderStateMixin {
|
||||||
|
late ProjectViewModel projectViewModel;
|
||||||
|
bool _supportsNFC = false;
|
||||||
|
bool isPatientArrived = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
// checkIfPatientHasArrived();
|
||||||
|
if (projectViewModel.isLogin) checkPatientERAdvanceBalance();
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
projectViewModel = Provider.of(context);
|
||||||
|
FlutterNfcKit.nfcAvailability.then((value) {
|
||||||
|
_supportsNFC = (value == NFCAvailability.available);
|
||||||
|
});
|
||||||
|
return AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: TranslationBase.of(context).emergency + " ${TranslationBase.of(context).checkinOptions}",
|
||||||
|
isShowDecPage: true,
|
||||||
|
showNewAppBar: true,
|
||||||
|
showNewAppBarTitle: true,
|
||||||
|
description: TranslationBase.of(context).HHCNotAuthMsg,
|
||||||
|
imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png')],
|
||||||
|
backgroundColor: Color(0xffF8F8F8),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.1),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.check_circle,
|
||||||
|
size: 50,
|
||||||
|
color: CustomColors.green,
|
||||||
|
),
|
||||||
|
mHeight(6),
|
||||||
|
Text(
|
||||||
|
"What is Online Check-In?",
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"online check-in lets patients fill out forms, share insurance details, and book appointments online, making their visit smoother and quicker.",
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
mHeight(16),
|
||||||
|
Text(
|
||||||
|
"How can i use Online Check-In?",
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"online check-in lets patients fill out forms, share insurance details, and book appointments online, making their visit smoother and quicker.",
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.1),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 35,
|
||||||
|
height: 35,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CustomColors.green,
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"1",
|
||||||
|
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700, color: CustomColors.white, letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(12),
|
||||||
|
SvgPicture.asset(
|
||||||
|
"assets/images/new/tap.svg",
|
||||||
|
width: 35,
|
||||||
|
height: 35,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 50, right: 50),
|
||||||
|
child: Text(
|
||||||
|
"Tap On",
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -1.44,
|
||||||
|
height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 50, right: 50),
|
||||||
|
child: Text(
|
||||||
|
"Tap on the check-in button within the app",
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(16),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 35,
|
||||||
|
height: 35,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CustomColors.green,
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"2",
|
||||||
|
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700, color: CustomColors.white, letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(12),
|
||||||
|
SvgPicture.asset(
|
||||||
|
"assets/images/new/NFC_Hold.svg",
|
||||||
|
width: 35,
|
||||||
|
height: 35,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 50, right: 50),
|
||||||
|
child: Text(
|
||||||
|
"Hold your phone",
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -1.44,
|
||||||
|
height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 50, right: 50),
|
||||||
|
child: Text(
|
||||||
|
"Hold the phone 1 to 2 cm from the NFC sign displayed on the board",
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(16),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 35,
|
||||||
|
height: 35,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CustomColors.green,
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"3",
|
||||||
|
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700, color: CustomColors.white, letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(12),
|
||||||
|
SvgPicture.asset(
|
||||||
|
"assets/images/new/hourglass.svg",
|
||||||
|
width: 35,
|
||||||
|
height: 35,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 50, right: 50),
|
||||||
|
child: Text(
|
||||||
|
"Wait your turn",
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -1.44,
|
||||||
|
height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 50, right: 50),
|
||||||
|
child: Text(
|
||||||
|
"Please wait in the waiting area until called by the nurse",
|
||||||
|
style: TextStyle(fontSize: 14, color: CustomColors.textDarkColor, letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
height: projectViewModel.isLogin ? 80 : 1,
|
||||||
|
color: CustomColors.white,
|
||||||
|
padding: EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 25.0),
|
||||||
|
child: isPatientArrived
|
||||||
|
? Container(
|
||||||
|
child: DefaultButton(
|
||||||
|
TranslationBase.of(context).arrived,
|
||||||
|
() {
|
||||||
|
if (_supportsNFC) {
|
||||||
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
|
showNfcReader(context, onNcfScan: (String nfcId) {
|
||||||
|
Future.delayed(const Duration(milliseconds: 100), () {
|
||||||
|
print(nfcId);
|
||||||
|
getProjectIDFromNFC(nfcId, true);
|
||||||
|
// Navigator.push(context, FadePage(page: EROnlineCheckInPaymentDetails()));
|
||||||
|
});
|
||||||
|
}, onCancel: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//NFCNotSupported
|
||||||
|
AppToast.showErrorToast(message: TranslationBase.of(context).NFCNotSupported);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
color: CustomColors.accentColor,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: DefaultButton(
|
||||||
|
TranslationBase.of(context).checkinOptions,
|
||||||
|
() {
|
||||||
|
if (_supportsNFC) {
|
||||||
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
|
showNfcReader(context, onNcfScan: (String nfcId) {
|
||||||
|
Future.delayed(const Duration(milliseconds: 100), () {
|
||||||
|
print(nfcId);
|
||||||
|
getProjectIDFromNFC(nfcId, false);
|
||||||
|
});
|
||||||
|
}, onCancel: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//NFCNotSupported
|
||||||
|
AppToast.showErrorToast(message: TranslationBase.of(context).NFCNotSupported);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
color: CustomColors.green,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(12),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: DefaultButton(
|
||||||
|
TranslationBase.of(context).bookAppo,
|
||||||
|
() {
|
||||||
|
Navigator.push(context, FadePage(page: EROnlineCheckInBookAppointment()));
|
||||||
|
},
|
||||||
|
color: CustomColors.accentColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void getProjectIDFromNFC(String nfcID, bool isArrived) {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
ClinicListService ancillaryOrdersService = new ClinicListService();
|
||||||
|
ancillaryOrdersService.getProjectIDFromNFC(nfcID).then((response) {
|
||||||
|
if (response["GetProjectByNFC"].length != 0) {
|
||||||
|
print(response["GetProjectByNFC"]);
|
||||||
|
int projectID = response['GetProjectByNFC'][0]["ProjectID"];
|
||||||
|
String projectName = response['GetProjectByNFC'][0]["ProjectName"];
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
if (isArrived) {
|
||||||
|
autoGenerateInvoiceER(projectID);
|
||||||
|
} else {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: EROnlineCheckInPaymentDetails(
|
||||||
|
projectID: projectID,
|
||||||
|
isERBookAppointment: false,
|
||||||
|
projectName: projectName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AppToast.showErrorToast(message: "Invalid NFC Card Scanned.");
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
AppToast.showErrorToast(message: err.toString());
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
autoGenerateInvoiceER(int projectID) {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
service.autoGenerateInvoiceERClinic(projectID, 4, null, null, null, null, null, null, true).then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
_showMyDialog(TranslationBase.of(context).ERCheckInSuccess, context);
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: err);
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showMyDialog(String message, BuildContext context) async {
|
||||||
|
return showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true, // user must tap button!
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('Alert'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(message),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkIfPatientHasArrived() {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
ClinicListService ancillaryOrdersService = new ClinicListService();
|
||||||
|
ancillaryOrdersService.checkIfPatientHasArrived(15, 10).then((response) {
|
||||||
|
print(response["IsPatientArrivedResponse"]);
|
||||||
|
isPatientArrived = response['IsPatientArrivedResponse']["IsPatientArrived"];
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
// erOnlineCheckInPaymentDetailsResponse = EROnlineCheckInPaymentDetailsResponse.fromJson(response["ResponsePatientShare"]);
|
||||||
|
setState(() {});
|
||||||
|
}).catchError((err) {
|
||||||
|
AppToast.showErrorToast(message: err.toString());
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkPatientERAdvanceBalance() {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
ClinicListService ancillaryOrdersService = new ClinicListService();
|
||||||
|
ancillaryOrdersService.checkPatientERAdvanceBalance(10).then((response) {
|
||||||
|
print(response["BalanceAmount"]);
|
||||||
|
isPatientArrived = response['BalanceAmount'] > 0;
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
setState(() {});
|
||||||
|
}).catchError((err) {
|
||||||
|
AppToast.showErrorToast(message: err.toString());
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,620 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/enum/PayfortEnums.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Clinics/EROnlineCheckInPaymentDetailsResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.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';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/dragable_sheet.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:provider/provider.dart';
|
||||||
|
|
||||||
|
class EROnlineCheckInPaymentDetails extends StatefulWidget {
|
||||||
|
int projectID = 0;
|
||||||
|
bool isERBookAppointment = false;
|
||||||
|
String projectName = "";
|
||||||
|
|
||||||
|
EROnlineCheckInPaymentDetails({required this.projectID, required this.isERBookAppointment, required this.projectName});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<EROnlineCheckInPaymentDetails> createState() => _EROnlineCheckInPaymentDetailsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDetails> with SingleTickerProviderStateMixin {
|
||||||
|
late ProjectViewModel projectViewModel;
|
||||||
|
EROnlineCheckInPaymentDetailsResponse? erOnlineCheckInPaymentDetailsResponse;
|
||||||
|
String? selectedPaymentMethod;
|
||||||
|
String? selectedInstallmentPlan;
|
||||||
|
String transID = "";
|
||||||
|
late MyInAppBrowser browser;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
getEROnlineCheckInPaymentDetails();
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
projectViewModel = Provider.of(context);
|
||||||
|
return AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: TranslationBase.of(context).emergency + " ${TranslationBase.of(context).checkinOptions}",
|
||||||
|
isShowDecPage: false,
|
||||||
|
showNewAppBar: true,
|
||||||
|
showNewAppBarTitle: true,
|
||||||
|
backgroundColor: Color(0xffF8F8F8),
|
||||||
|
body: Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.1),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).patientInfo,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
mHeight(12),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).patientName + ":",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 12,
|
||||||
|
letterSpacing: -0.6,
|
||||||
|
color: CustomColors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(3),
|
||||||
|
Text(
|
||||||
|
projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: -0.48,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).mrn + ":",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 12,
|
||||||
|
letterSpacing: -0.6,
|
||||||
|
color: CustomColors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(3),
|
||||||
|
Text(
|
||||||
|
projectViewModel.user.patientID.toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: -0.48,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.1),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"ER Visit Details",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
|
||||||
|
),
|
||||||
|
mHeight(12),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).hospital + ":",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 12,
|
||||||
|
letterSpacing: -0.6,
|
||||||
|
color: CustomColors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(3),
|
||||||
|
Text(
|
||||||
|
widget.projectName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: -0.48,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).clinicName + ":",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 12,
|
||||||
|
letterSpacing: -0.6,
|
||||||
|
color: CustomColors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(3),
|
||||||
|
Text(
|
||||||
|
"ER Clinic",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: -0.48,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Time Check-In" + ":",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 12,
|
||||||
|
letterSpacing: -0.6,
|
||||||
|
color: CustomColors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(3),
|
||||||
|
Text(
|
||||||
|
DateUtil.getMonthDayYearDateFormatted(DateTime.now()),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: -0.48,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: erOnlineCheckInPaymentDetailsResponse != null
|
||||||
|
? Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15),
|
||||||
|
width: double.infinity,
|
||||||
|
// color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 12),
|
||||||
|
Text(
|
||||||
|
TranslationBase.of(context).YouCanPayByTheFollowingOptions,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.75,
|
||||||
|
child: getPaymentMethods(),
|
||||||
|
),
|
||||||
|
_amountView(TranslationBase.of(context).patientShareTotalToDo, erOnlineCheckInPaymentDetailsResponse!.patientShareWithTax.toString() + " " + TranslationBase.of(context).sar,
|
||||||
|
isBold: true, isTotal: true),
|
||||||
|
SizedBox(height: 12),
|
||||||
|
DefaultButton(
|
||||||
|
TranslationBase.of(context).payNow.toUpperCase(),
|
||||||
|
() {
|
||||||
|
makePayment();
|
||||||
|
},
|
||||||
|
color: CustomColors.green,
|
||||||
|
disabledColor: CustomColors.grey2,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
makePayment() {
|
||||||
|
showDraggableDialog(
|
||||||
|
context,
|
||||||
|
PaymentMethod(
|
||||||
|
onSelectedMethod: (String method, [String? selectedInstallmentPlan]) {
|
||||||
|
selectedPaymentMethod = method;
|
||||||
|
this.selectedInstallmentPlan = selectedInstallmentPlan;
|
||||||
|
if (selectedPaymentMethod == "ApplePay") {
|
||||||
|
if (projectViewModel.havePrivilege(103)) {
|
||||||
|
startApplePay();
|
||||||
|
} else {
|
||||||
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
||||||
|
appo.projectID = widget.projectID;
|
||||||
|
openPayment(selectedPaymentMethod!, projectViewModel.user, erOnlineCheckInPaymentDetailsResponse!.patientShareWithTax!, AppoitmentAllHistoryResultList());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
openPayment(selectedPaymentMethod!, projectViewModel.user, erOnlineCheckInPaymentDetailsResponse!.patientShareWithTax!, AppoitmentAllHistoryResultList());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
patientShare: erOnlineCheckInPaymentDetailsResponse!.patientShareWithTax,
|
||||||
|
isFromAdvancePayment: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) {
|
||||||
|
transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user.patientID!);
|
||||||
|
|
||||||
|
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart);
|
||||||
|
|
||||||
|
browser.openPaymentBrowser(amount, "ER Online Check-In Payment", transID, widget.projectID.toString(), authenticatedUser.emailAddress!, paymentMethod, authenticatedUser.patientType,
|
||||||
|
authenticatedUser.firstName!, authenticatedUser.patientID, authenticatedUser, browser, false, "3", "", context);
|
||||||
|
}
|
||||||
|
|
||||||
|
onBrowserLoadStart(String url) {
|
||||||
|
print("onBrowserLoadStart");
|
||||||
|
print(url);
|
||||||
|
|
||||||
|
MyInAppBrowser.successURLS.forEach((element) {
|
||||||
|
if (url.contains(element)) {
|
||||||
|
if (browser.isOpened()) browser.close();
|
||||||
|
MyInAppBrowser.isPaymentDone = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
MyInAppBrowser.errorURLS.forEach((element) {
|
||||||
|
if (url.contains(element)) {
|
||||||
|
if (browser.isOpened()) browser.close();
|
||||||
|
MyInAppBrowser.isPaymentDone = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
|
||||||
|
print("onBrowserExit Called!!!!");
|
||||||
|
checkPaymentStatus(appo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void startApplePay() async {
|
||||||
|
transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user.patientID!);
|
||||||
|
|
||||||
|
print("TransactionID: $transID");
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
|
||||||
|
LiveCareService service = new LiveCareService();
|
||||||
|
ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest();
|
||||||
|
|
||||||
|
PayfortProjectDetailsRespModel? payfortProjectDetailsRespModel;
|
||||||
|
await context.read<PayfortViewModel>().getProjectDetailsForPayfort(projectId: widget.projectID, serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum()).then((value) {
|
||||||
|
payfortProjectDetailsRespModel = value!;
|
||||||
|
});
|
||||||
|
|
||||||
|
applePayInsertRequest.clientRequestID = transID;
|
||||||
|
applePayInsertRequest.clinicID = 0;
|
||||||
|
applePayInsertRequest.currency = projectViewModel.user.outSA == 1 ? "AED" : "SAR";
|
||||||
|
// applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress;
|
||||||
|
applePayInsertRequest.customerEmail = "CustID_${projectViewModel.user.patientID}@HMG.com";
|
||||||
|
applePayInsertRequest.customerID = projectViewModel.user.patientID;
|
||||||
|
applePayInsertRequest.customerName = projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!;
|
||||||
|
applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN);
|
||||||
|
applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN);
|
||||||
|
applePayInsertRequest.doctorID = 0;
|
||||||
|
applePayInsertRequest.projectID = widget.projectID.toString();
|
||||||
|
applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString();
|
||||||
|
applePayInsertRequest.channelID = 3;
|
||||||
|
applePayInsertRequest.patientID = projectViewModel.user.patientID;
|
||||||
|
applePayInsertRequest.patientTypeID = projectViewModel.user.patientType;
|
||||||
|
applePayInsertRequest.patientOutSA = projectViewModel.user.outSA;
|
||||||
|
applePayInsertRequest.appointmentDate = null;
|
||||||
|
applePayInsertRequest.appointmentNo = 0;
|
||||||
|
applePayInsertRequest.orderDescription = "ER Online Check-In Payment";
|
||||||
|
applePayInsertRequest.liveServiceID = "0";
|
||||||
|
applePayInsertRequest.latitude = "0.0";
|
||||||
|
applePayInsertRequest.longitude = "0.0";
|
||||||
|
applePayInsertRequest.amount = erOnlineCheckInPaymentDetailsResponse!.patientShareWithTax.toString();
|
||||||
|
applePayInsertRequest.isSchedule = "0";
|
||||||
|
applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en';
|
||||||
|
applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2;
|
||||||
|
applePayInsertRequest.userName = projectViewModel.user.patientID;
|
||||||
|
applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html";
|
||||||
|
applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html";
|
||||||
|
applePayInsertRequest.paymentOption = "ApplePay";
|
||||||
|
|
||||||
|
applePayInsertRequest.isMobSDK = true;
|
||||||
|
applePayInsertRequest.merchantReference = transID;
|
||||||
|
applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel!.merchantIdentifier;
|
||||||
|
applePayInsertRequest.commandType = "PURCHASE";
|
||||||
|
applePayInsertRequest.signature = payfortProjectDetailsRespModel!.signature;
|
||||||
|
applePayInsertRequest.accessCode = payfortProjectDetailsRespModel!.accessCode;
|
||||||
|
applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel!.shaRequest;
|
||||||
|
applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel!.shaResponse;
|
||||||
|
applePayInsertRequest.returnURL = "";
|
||||||
|
|
||||||
|
service.applePayInsertRequest(applePayInsertRequest, context).then((res) async {
|
||||||
|
if (res["MessageStatus"] == 1) {
|
||||||
|
await context.read<PayfortViewModel>().initiateApplePayWithPayfort(
|
||||||
|
customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!,
|
||||||
|
// customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
|
||||||
|
customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com",
|
||||||
|
orderDescription: "ER Online Check-In Payment",
|
||||||
|
orderAmount: erOnlineCheckInPaymentDetailsResponse!.patientShareWithTax,
|
||||||
|
merchantReference: transID,
|
||||||
|
payfortProjectDetailsRespModel: payfortProjectDetailsRespModel,
|
||||||
|
currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR",
|
||||||
|
onFailed: (failureResult) async {
|
||||||
|
log("failureResult: ${failureResult.toString()}");
|
||||||
|
AppToast.showErrorToast(message: failureResult.toString());
|
||||||
|
},
|
||||||
|
onSuccess: (successResult) async {
|
||||||
|
log("Payfort: ${successResult.responseMessage}");
|
||||||
|
await context.read<PayfortViewModel>().addPayfortApplePayResponse(projectViewModel.user.patientID!, result: successResult);
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
checkPaymentStatus(AppoitmentAllHistoryResultList());
|
||||||
|
},
|
||||||
|
projectId: widget.projectID,
|
||||||
|
serviceTypeEnum: ServiceTypeEnum.appointmentPayment,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: "An error occurred while processing your request");
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
print(err);
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
service.checkPaymentStatus(transID, false, context).then((res) {
|
||||||
|
String paymentInfo = res['Response_Message'];
|
||||||
|
if (paymentInfo == 'Success') {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
if (widget.isERBookAppointment) {
|
||||||
|
// createAdvancePayment(res, appo);
|
||||||
|
ER_createAdvancePayment(res, appo);
|
||||||
|
} else {
|
||||||
|
autoGenerateInvoiceER(res);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: res['Response_Message']);
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: err);
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ER_createAdvancePayment(payment_res, AppoitmentAllHistoryResultList appo) {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
String paymentReference = payment_res['Fort_id'].toString();
|
||||||
|
service.ER_createAdvancePayment(appo, widget.projectID.toString(), payment_res['Amount'], payment_res['Fort_id'], payment_res['PaymentMethod'], context).then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
addAdvancedNumberRequest(
|
||||||
|
// Utils.isVidaPlusProject(projectViewModel, widget.projectID)
|
||||||
|
// ? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
||||||
|
// : res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
||||||
|
res['ER_AdvancePaymentResponse']['AdvanceNumber'].toString(),
|
||||||
|
paymentReference,
|
||||||
|
0,
|
||||||
|
appo,
|
||||||
|
payment_res);
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: err);
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
createAdvancePayment(paymentRes, AppoitmentAllHistoryResultList appo) {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
String paymentReference = paymentRes['Fort_id'].toString();
|
||||||
|
service.HIS_createAdvancePayment(appo, widget.projectID.toString(), paymentRes['Amount'], paymentRes['Fort_id'], paymentRes['PaymentMethod'], projectViewModel.user.patientType,
|
||||||
|
projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!, projectViewModel.user.patientID, context)
|
||||||
|
.then((res) {
|
||||||
|
addAdvancedNumberRequest(
|
||||||
|
Utils.isVidaPlusProject(projectViewModel, widget.projectID)
|
||||||
|
? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
||||||
|
: res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
||||||
|
paymentReference,
|
||||||
|
0,
|
||||||
|
appo,
|
||||||
|
paymentRes);
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: err);
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo, paymentRes) {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
if (widget.isERBookAppointment) {
|
||||||
|
AppToast.showSuccessToast(message: "Your appointment has been booked successfully. Please perform Check-In once you arrive at the hospital.");
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
} else {
|
||||||
|
autoGenerateInvoiceER(paymentRes);
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: err.toString());
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
autoGenerateInvoiceER(res) {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
service.autoGenerateInvoiceERClinic(widget.projectID, 4, res['Fort_id'], res['Amount'], res['PaymentMethod'], res['CardNumber'], res['Merchant_Reference'], res['RRN'], false).then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
_showMyDialog(TranslationBase.of(context).ERCheckInSuccess, context);
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
AppToast.showErrorToast(message: err);
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showMyDialog(String message, BuildContext context) async {
|
||||||
|
return showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true, // user must tap button!
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('Alert'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(message),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getEROnlineCheckInPaymentDetails() {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
ClinicListService ancillaryOrdersService = new ClinicListService();
|
||||||
|
ancillaryOrdersService.getEROnlineCheckInPaymentDetails(widget.projectID, 10).then((response) {
|
||||||
|
erOnlineCheckInPaymentDetailsResponse = EROnlineCheckInPaymentDetailsResponse.fromJson(response["ResponsePatientShare"]);
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
setState(() {});
|
||||||
|
}).catchError((err) {
|
||||||
|
AppToast.showErrorToast(message: err.toString());
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_amountView(String title, String value, {bool isBold = false, bool isTotal = false}) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10, bottom: 10),
|
||||||
|
child: Row(children: [
|
||||||
|
Expanded(
|
||||||
|
child: _getNormalText(title),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: _getNormalText(value, isBold: isBold, isTotal: isTotal),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_getNormalText(text, {bool isBold = false, bool isTotal = false}) {
|
||||||
|
return Text(
|
||||||
|
text,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isBold
|
||||||
|
? isTotal
|
||||||
|
? 16
|
||||||
|
: 12
|
||||||
|
: 11,
|
||||||
|
letterSpacing: -0.5,
|
||||||
|
color: isBold ? Color(0xff2E303A) : Color(0xff575757),
|
||||||
|
fontWeight: isTotal ? FontWeight.bold : FontWeight.w600,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,218 @@
|
|||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class AdmissionNotice extends StatefulWidget {
|
||||||
|
const AdmissionNotice();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AdmissionNotice> createState() => _AdmissionNoticeState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AdmissionNoticeState extends State<AdmissionNotice> {
|
||||||
|
late ProjectViewModel projectViewModel;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
projectViewModel = Provider.of(context);
|
||||||
|
List<Widget> inPatientServiceList = getAdmissionNoticeServicesList(context);
|
||||||
|
return AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
isShowDecPage: false,
|
||||||
|
showNewAppBarTitle: true,
|
||||||
|
showNewAppBar: true,
|
||||||
|
appBarTitle: TranslationBase.of(context).admissionNoticeTitle,
|
||||||
|
body: Container(
|
||||||
|
margin: EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 12, right: 12),
|
||||||
|
child: GridView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
primary: false,
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12),
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
itemCount: inPatientServiceList.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return inPatientServiceList[index];
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> getAdmissionNoticeServicesList(BuildContext context) {
|
||||||
|
List<Widget> serviceList = [];
|
||||||
|
|
||||||
|
serviceList.add(
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
// openBirthNotificationsPage(context);
|
||||||
|
viewModalBottomSheet();
|
||||||
|
},
|
||||||
|
child: MedicalProfileItem(
|
||||||
|
title: TranslationBase.of(context).admissionNoticeTitle,
|
||||||
|
imagePath: 'admission.svg',
|
||||||
|
subTitle: TranslationBase.of(context).insuranceSubtitle,
|
||||||
|
width: 50.0,
|
||||||
|
height: 40.0,
|
||||||
|
isInPatient: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return serviceList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void viewModalBottomSheet() {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 20, top: 20),
|
||||||
|
child: Text(
|
||||||
|
"Admission Card",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 21,
|
||||||
|
letterSpacing: -0.25,
|
||||||
|
height: 25 / 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
height: 250,
|
||||||
|
child: Container(
|
||||||
|
decoration: cardRadius(20, color: Color(0xFFF2B353E)),
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: double.infinity,
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
decoration: projectViewModel.isArabic
|
||||||
|
? containerBottomRightRadiusWithGradientForAr(MediaQuery.of(context).size.width / 4)
|
||||||
|
: containerBottomRightRadiusWithGradient(MediaQuery.of(context).size.width / 4),
|
||||||
|
child: Card(
|
||||||
|
color: Colors.transparent,
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
mFlex(2),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||||
|
child: Text(
|
||||||
|
projectViewModel.authenticatedUserObject.user.firstName! + " " + projectViewModel.authenticatedUserObject.user.lastName!,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 17,
|
||||||
|
letterSpacing: -0.25,
|
||||||
|
height: 25 / 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).roomNo + " " + (projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.roomID! : "Not assigned yet"),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
letterSpacing: -0.25,
|
||||||
|
height: 25 / 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mFlex(2),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||||
|
child: Text(
|
||||||
|
projectViewModel.isPatientAdmitted
|
||||||
|
? projectViewModel.getAdmissionInfoResponseModel.doctorName ?? ""
|
||||||
|
: projectViewModel.getAdmissionRequestInfoResponseModel.doctorName ?? "",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 17,
|
||||||
|
letterSpacing: -0.25,
|
||||||
|
height: 25 / 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// mFlex(2),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).clinic +
|
||||||
|
": " +
|
||||||
|
(projectViewModel.isPatientAdmitted
|
||||||
|
? projectViewModel.getAdmissionInfoResponseModel.clinicName!.toString()
|
||||||
|
: projectViewModel.getAdmissionRequestInfoResponseModel.clinicName!),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
letterSpacing: -0.25,
|
||||||
|
height: 25 / 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).hospital +
|
||||||
|
": " +
|
||||||
|
(projectViewModel.isPatientAdmitted
|
||||||
|
? projectViewModel.getAdmissionInfoResponseModel.projectName!.toString()
|
||||||
|
: projectViewModel.getAdmissionRequestInfoResponseModel.projectName!),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
letterSpacing: -0.25,
|
||||||
|
height: 25 / 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mFlex(1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 30),
|
||||||
|
child: DefaultButton(
|
||||||
|
TranslationBase.of(context).close.toUpperCase(),
|
||||||
|
() {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
color: CustomColors.accentColor,
|
||||||
|
disabledColor: CustomColors.grey2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,527 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.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_new.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class InPatientGeneralConsent extends StatelessWidget {
|
||||||
|
late ProjectViewModel projectViewModel;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
projectViewModel = Provider.of(context);
|
||||||
|
return AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
isShowDecPage: false,
|
||||||
|
showNewAppBarTitle: true,
|
||||||
|
showNewAppBar: true,
|
||||||
|
appBarTitle: TranslationBase.of(context).InPatientServicesHeader,
|
||||||
|
body: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(21.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: Card(
|
||||||
|
elevation: 0.0,
|
||||||
|
margin: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 16.0),
|
||||||
|
color: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
side: BorderSide(color: Colors.transparent, width: 0.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent1,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).hospitalRules,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent2,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).communicationConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent3,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).releaseConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent4,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent5,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).valuables,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent6,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).financialConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent7,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).dataSharingConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent8,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).permissionLeaveConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent9,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).observeConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent10,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).noGuaranteeConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent11,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).disputeConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent12,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).patientsRightsConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent13,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(24.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).acknowledgementConsent,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 21.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mHeight(12.0),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.85,
|
||||||
|
margin: EdgeInsets.only(left: 5.0, right: 5.0),
|
||||||
|
child: Text(
|
||||||
|
TranslationBase.of(context).generalConsent14,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Color(0xff2B353E),
|
||||||
|
letterSpacing: -0.64,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 21.0, right: 21.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: ButtonTheme(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
height: 45.0,
|
||||||
|
child: CustomTextButton(
|
||||||
|
backgroundColor: Color(0xffc5272d),
|
||||||
|
elevation: 0,
|
||||||
|
onPressed: () {
|
||||||
|
acceptRejectConsent(context, 0);
|
||||||
|
},
|
||||||
|
child: Text(TranslationBase.of(context).reject, style: TextStyle(fontSize: 16.0, color: Colors.white)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
mWidth(7),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: ButtonTheme(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
height: 45.0,
|
||||||
|
child: CustomTextButton(
|
||||||
|
backgroundColor: CustomColors.green,
|
||||||
|
elevation: 0,
|
||||||
|
onPressed: () {
|
||||||
|
acceptRejectConsent(context, 1);
|
||||||
|
},
|
||||||
|
child: Text(TranslationBase.of(context).acceptLbl, style: TextStyle(fontSize: 16.0, color: Colors.white)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void acceptRejectConsent(BuildContext context, int status) {
|
||||||
|
ClinicListService service = new ClinicListService();
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
service
|
||||||
|
.insertForGeneralAdmissionConsent(
|
||||||
|
projectViewModel.user.patientID!,
|
||||||
|
projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionRequestNo! : projectViewModel.getAdmissionRequestInfoResponseModel.admissionRequestNo!,
|
||||||
|
projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.clinicID! : projectViewModel.getAdmissionRequestInfoResponseModel.clinicId!,
|
||||||
|
projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.projectID! : projectViewModel.getAdmissionRequestInfoResponseModel.projectId!,
|
||||||
|
status,
|
||||||
|
context)
|
||||||
|
.then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
if (res["MessageStatus"] == 1) {
|
||||||
|
AppToast.showErrorToast(message: res["SuccessMsg"]);
|
||||||
|
} else {
|
||||||
|
AppToast.showErrorToast(message: res["endUserMessage"]);
|
||||||
|
}
|
||||||
|
Navigator.pop(context);
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
print(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||