Merge branch 'master' of http://34.17.182.140/Haroon6138/HMG_Patient_App_New into dev_sultan
# Conflicts: # lib/presentation/emergency_services/call_ambulance/tracking_screen.dart # lib/presentation/profile_settings/profile_settings.dart # lib/presentation/radiology/radiology_orders_page.dart # lib/widgets/chip/app_custom_chip_widget.dartpull/98/head
@ -1,74 +0,0 @@
|
||||
{
|
||||
"agcgw":{
|
||||
"backurl":"connect-drcn.hispace.hicloud.com",
|
||||
"url":"connect-drcn.dbankcloud.cn",
|
||||
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
|
||||
},
|
||||
"agcgw_all":{
|
||||
"CN":"connect-drcn.dbankcloud.cn",
|
||||
"CN_back":"connect-drcn.hispace.hicloud.com",
|
||||
"DE":"connect-dre.dbankcloud.cn",
|
||||
"DE_back":"connect-dre.hispace.hicloud.com",
|
||||
"RU":"connect-drru.dbankcloud.cn",
|
||||
"RU_back":"connect-drru.hispace.hicloud.com",
|
||||
"SG":"connect-dra.dbankcloud.cn",
|
||||
"SG_back":"connect-dra.hispace.hicloud.com"
|
||||
},
|
||||
"client":{
|
||||
"cp_id":"2640966000002322881",
|
||||
"product_id":"736430079244816567",
|
||||
"client_id":"563735388191982656",
|
||||
"client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF",
|
||||
"project_id":"736430079244816567",
|
||||
"app_id":"102857389",
|
||||
"api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI",
|
||||
"package_name":"com.ejada.hmg"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_id":"102857389",
|
||||
"client_type":1
|
||||
},
|
||||
"app_info":{
|
||||
"app_id":"102857389",
|
||||
"package_name":"com.ejada.hmg"
|
||||
},
|
||||
"service":{
|
||||
"analytics":{
|
||||
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||
"collector_url_ru":"datacollector-drru.dt.hicloud.com,datacollector-drru.dt.dbankcloud.cn",
|
||||
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
|
||||
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
|
||||
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||
"resource_id":"p1",
|
||||
"channel_id":""
|
||||
},
|
||||
"search":{
|
||||
"url":"https://search-drcn.cloud.huawei.com"
|
||||
},
|
||||
"cloudstorage":{
|
||||
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn"
|
||||
},
|
||||
"ml":{
|
||||
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
|
||||
}
|
||||
},
|
||||
"region":"CN",
|
||||
"configuration_version":"3.0",
|
||||
"appInfos":[
|
||||
{
|
||||
"package_name":"com.ejada.hmg",
|
||||
"client":{
|
||||
"app_id":"102857389"
|
||||
},
|
||||
"app_info":{
|
||||
"package_name":"com.ejada.hmg",
|
||||
"app_id":"102857389"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_type":1,
|
||||
"client_id":"102857389"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
//package com.cloud.diplomaticquarterapp
|
||||
package com.ejada.hmg
|
||||
|
||||
|
||||
import io.flutter.app.FlutterApplication
|
||||
|
||||
class Application : FlutterApplication() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
}
|
||||
}
|
||||
|
||||
//import io.flutter.app.FlutterApplication
|
||||
//import io.flutter.plugin.common.PluginRegistry
|
||||
//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
|
||||
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
|
||||
//
|
||||
//class Application : FlutterApplication(), PluginRegistrantCallback {
|
||||
// override fun onCreate() {
|
||||
// super.onCreate()
|
||||
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
|
||||
// }
|
||||
//
|
||||
// override fun registerWith(registry: PluginRegistry?) {
|
||||
// FirebaseCloudMessagingPluginRegistrant.registerWith(registry)
|
||||
// }
|
||||
//}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.ejada.hmg
|
||||
|
||||
import io.flutter.embedding.android.FlutterFragmentActivity
|
||||
|
||||
|
||||
class MainActivity : FlutterFragmentActivity()
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1021 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.cloud.diplomaticquarterapp.whatsapp.WhatsAppCodeActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<FrameLayout
|
||||
android:id="@+id/publisher_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FF9800" />
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<FrameLayout
|
||||
android:id="@+id/subscriber_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#3F51B5" />
|
||||
|
||||
<TextView
|
||||
android:text="Remote"
|
||||
android:textColor="#FFFFFF"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:keep="@drawable/*,@raw/slow_spring_board" />
|
||||
@ -0,0 +1,23 @@
|
||||
<resources>
|
||||
<string name="app_name">HMG Patient App</string>
|
||||
|
||||
<string name="geofence_unknown_error">
|
||||
Unknown error: the Geofence service is not available now.
|
||||
</string>
|
||||
<string name="geofence_not_available">
|
||||
Geofence service is not available now. Go to Settings>Location>Mode and choose High accuracy.
|
||||
</string>
|
||||
<string name="geofence_too_many_geofences">
|
||||
Your app has registered too many geofences.
|
||||
</string>
|
||||
<string name="geofence_too_many_pending_intents">
|
||||
You have provided too many PendingIntents to the addGeofences() call.
|
||||
</string>
|
||||
<string name="GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION">
|
||||
App do not have permission to access location service.
|
||||
</string>
|
||||
<string name="GEOFENCE_REQUEST_TOO_FREQUENT">
|
||||
Geofence requests happened too frequently.
|
||||
</string>
|
||||
<string name="mapbox_access_token" translatable="false">sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg</string>
|
||||
</resources>
|
||||
@ -0,0 +1,5 @@
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.88966 2.26044H6.1556C6.54339 2.26042 6.87763 2.2604 7.1452 2.29638C7.43199 2.33494 7.7069 2.42189 7.92987 2.64486C8.15285 2.86784 8.2398 3.14275 8.27836 3.42953C8.30096 3.59766 8.30936 3.79206 8.31247 4.00954C8.31248 4.01004 8.31288 4.01044 8.31338 4.01044C8.31369 4.01044 8.31396 4.0106 8.31413 4.01083C8.31413 4.01063 8.31423 4.01098 8.31413 4.01083L8.31429 6.19794C8.31429 6.43957 8.51017 6.63544 8.75179 6.63544C8.99342 6.63544 9.18929 6.43957 9.18929 6.19794V4.20362C9.18929 4.10493 9.2722 4.02578 9.37041 4.03551C9.63863 4.06206 9.88036 4.11895 10.1131 4.2507C10.3443 4.38162 10.5211 4.56074 10.6893 4.77855C10.8614 5.00128 11.0127 5.23986 11.1635 5.47761L11.164 5.4784C11.1889 5.51758 11.2137 5.55673 11.2386 5.59579C11.5034 6.01096 11.8302 6.35342 12.2362 6.63158C12.6288 6.90049 12.9411 7.11434 13.1141 7.46714C13.2034 7.64923 13.24 7.83466 13.2568 8.03171C13.2597 8.06529 13.2329 8.09377 13.1992 8.09377H12.6893C12.4477 8.09377 12.2518 8.28965 12.2518 8.53127C12.2518 8.7729 12.4477 8.96877 12.6893 8.96877H12.9207C13.0883 8.96877 13.1722 8.96877 13.2238 9.02251C13.2755 9.07625 13.2722 9.15762 13.2658 9.32036C13.2616 9.42578 13.2549 9.52356 13.244 9.61307C13.2135 9.86447 13.1447 10.1138 12.9593 10.3235C12.7687 10.5391 12.5059 10.6479 12.2248 10.6872C12.1439 10.6985 12.0789 10.625 12.0886 10.5439C12.0989 10.4578 12.1042 10.3701 12.1042 10.2813C12.1042 9.07315 11.1249 8.09377 9.91675 8.09377C8.71731 8.09377 7.72602 9.09672 7.72928 10.2935C7.73046 10.5082 7.73105 10.6156 7.67973 10.6672C7.62842 10.7188 7.53389 10.7188 7.34482 10.7188H6.65534C6.46628 10.7188 6.37175 10.7188 6.32043 10.6672C6.26912 10.6156 6.26971 10.5082 6.27088 10.2935C6.27415 9.09672 5.28286 8.09377 4.08342 8.09377C2.87529 8.09377 1.89592 9.07315 1.89592 10.2813C1.89592 10.4083 1.90675 10.5328 1.92753 10.6539C1.93036 10.6704 1.9166 10.6851 1.90005 10.6828C1.61327 10.6443 1.33836 10.5573 1.11539 10.3344C0.892408 10.1114 0.805457 9.83647 0.766899 9.54969C0.730924 9.28211 0.73094 8.94798 0.730958 8.56018V4.41914C0.73094 4.03135 0.730924 3.69711 0.766899 3.42953C0.805457 3.14275 0.892408 2.86784 1.11539 2.64486C1.33836 2.42189 1.61327 2.33494 1.90005 2.29638C2.16763 2.2604 2.50187 2.26042 2.88966 2.26044ZM5.10596 4.44794C5.10596 4.20631 4.91008 4.01044 4.66846 4.01044C4.42683 4.01044 4.23096 4.20631 4.23096 4.44794V5.17711H3.50179C3.26017 5.17711 3.06429 5.37298 3.06429 5.61461C3.06429 5.85623 3.26017 6.05211 3.50179 6.05211H4.23096V6.78127C4.23096 7.0229 4.42683 7.21877 4.66846 7.21877C4.91008 7.21877 5.10596 7.0229 5.10596 6.78127V6.05211H5.83513C6.07675 6.05211 6.27263 5.85623 6.27263 5.61461C6.27263 5.37298 6.07675 5.17711 5.83513 5.17711H5.10596V4.44794Z" fill="#2E3039"/>
|
||||
<path d="M11.3757 10.2813C11.3757 11.0867 10.7227 11.7396 9.91732 11.7396C9.1119 11.7396 8.45898 11.0867 8.45898 10.2813C8.45898 9.47586 9.1119 8.82294 9.91732 8.82294C10.7227 8.82294 11.3757 9.47586 11.3757 10.2813Z" fill="#2E3039"/>
|
||||
<path d="M4.08399 11.7396C4.8894 11.7396 5.54232 11.0867 5.54232 10.2813C5.54232 9.47586 4.8894 8.82294 4.08399 8.82294C3.27857 8.82294 2.62565 9.47586 2.62565 10.2813C2.62565 11.0867 3.27857 11.7396 4.08399 11.7396Z" fill="#2E3039"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
@ -0,0 +1,4 @@
|
||||
<svg width="10" height="13" viewBox="0 0 10 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 2.85449C3.79188 2.85449 2.8125 3.83387 2.8125 5.04199C2.8125 6.25011 3.79188 7.22949 5 7.22949C6.20812 7.22949 7.1875 6.25011 7.1875 5.04199C7.1875 3.83387 6.20812 2.85449 5 2.85449ZM3.6875 5.04199C3.6875 4.31712 4.27513 3.72949 5 3.72949C5.72487 3.72949 6.3125 4.31712 6.3125 5.04199C6.3125 5.76687 5.72487 6.35449 5 6.35449C4.27513 6.35449 3.6875 5.76687 3.6875 5.04199Z" fill="#ED1C2B"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 0.229492C2.38798 0.229492 0.1875 2.42783 0.1875 5.09268C0.1875 7.8228 2.43772 9.64709 4.31579 10.8329L4.32334 10.8377L4.33107 10.8422C4.5346 10.9593 4.76514 11.0212 5 11.0212C5.23486 11.0212 5.4654 10.9593 5.66893 10.8422L5.67567 10.8383L5.68227 10.8342C7.56769 9.65737 9.8125 7.81358 9.8125 5.09268C9.8125 2.42783 7.61202 0.229492 5 0.229492ZM1.0625 5.09268C1.0625 2.90553 2.87676 1.10449 5 1.10449C7.12324 1.10449 8.9375 2.90553 8.9375 5.09268C8.9375 7.29808 7.10717 8.91207 5.22662 10.0871C5.15694 10.1259 5.079 10.1462 5 10.1462C4.92132 10.1462 4.84369 10.1261 4.77422 10.0876C2.89372 8.89884 1.0625 7.30546 1.0625 5.09268Z" fill="#ED1C2B"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,95 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
||||
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_hmg_locations.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_patient_ic_projects.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class ContactUsRepo {
|
||||
Future<Either<Failure, GenericApiModel<List<GetHMGLocationsModel>>>> getHMGLocations();
|
||||
|
||||
Future<Either<Failure, GenericApiModel<List<GetPatientICProjectsModel>>>> getLiveChatProjectsList();
|
||||
}
|
||||
|
||||
class ContactUsRepoImp implements ContactUsRepo {
|
||||
final ApiClient apiClient;
|
||||
final LoggerService loggerService;
|
||||
|
||||
ContactUsRepoImp({required this.apiClient, required this.loggerService});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List<GetHMGLocationsModel>>>> getHMGLocations() async {
|
||||
Map<String, dynamic> mapDevice = {};
|
||||
|
||||
try {
|
||||
GenericApiModel<List<GetHMGLocationsModel>>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
GET_FINDUS_REQUEST,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final list = response['ListHMGLocation'];
|
||||
final hmgLocations = list.map((item) => GetHMGLocationsModel.fromJson(item as Map<String, dynamic>)).toList().cast<GetHMGLocationsModel>();
|
||||
|
||||
apiResponse = GenericApiModel<List<GetHMGLocationsModel>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: hmgLocations,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List<GetPatientICProjectsModel>>>> getLiveChatProjectsList() async {
|
||||
Map<String, dynamic> mapDevice = {};
|
||||
|
||||
try {
|
||||
GenericApiModel<List<GetPatientICProjectsModel>>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
GET_LIVECHAT_REQUEST,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final list = response['List_PatientICProjects'];
|
||||
final hmgLocations = list.map((item) => GetPatientICProjectsModel.fromJson(item as Map<String, dynamic>)).toList().cast<GetPatientICProjectsModel>();
|
||||
|
||||
apiResponse = GenericApiModel<List<GetPatientICProjectsModel>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: hmgLocations,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/contact_us_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_hmg_locations.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
|
||||
class ContactUsViewModel extends ChangeNotifier {
|
||||
ContactUsRepo contactUsRepo;
|
||||
ErrorHandlerService errorHandlerService;
|
||||
AppState appState;
|
||||
|
||||
bool isHMGLocationsListLoading = false;
|
||||
bool isHMGHospitalsListSelected = true;
|
||||
|
||||
List<GetHMGLocationsModel> hmgHospitalsLocationsList = [];
|
||||
List<GetHMGLocationsModel> hmgPharmacyLocationsList = [];
|
||||
|
||||
ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState});
|
||||
|
||||
initContactUsViewModel() {
|
||||
isHMGLocationsListLoading = true;
|
||||
isHMGHospitalsListSelected = true;
|
||||
hmgHospitalsLocationsList.clear();
|
||||
hmgPharmacyLocationsList.clear();
|
||||
getHMGLocations();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setHMGHospitalsListSelected(bool isSelected) {
|
||||
isHMGHospitalsListSelected = isSelected;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> getHMGLocations({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
isHMGLocationsListLoading = true;
|
||||
hmgHospitalsLocationsList.clear();
|
||||
hmgPharmacyLocationsList.clear();
|
||||
notifyListeners();
|
||||
|
||||
final result = await contactUsRepo.getHMGLocations();
|
||||
|
||||
result.fold(
|
||||
(failure) async => await errorHandlerService.handleError(failure: failure),
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
// hmgLocationsList = apiResponse.data!;
|
||||
for (var location in apiResponse.data!) {
|
||||
if (location.locationType == 1) {
|
||||
hmgHospitalsLocationsList.add(location);
|
||||
} else if (location.locationType == 2) {
|
||||
hmgPharmacyLocationsList.add(location);
|
||||
}
|
||||
}
|
||||
isHMGLocationsListLoading = false;
|
||||
notifyListeners();
|
||||
if (onSuccess != null) {
|
||||
onSuccess(apiResponse);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
class GetHMGLocationsModel {
|
||||
dynamic cityID;
|
||||
String? cityName;
|
||||
dynamic cityNameN;
|
||||
dynamic distanceInKilometers;
|
||||
bool? isActive;
|
||||
String? latitude;
|
||||
int? locationID;
|
||||
String? locationName;
|
||||
dynamic locationNameN;
|
||||
dynamic locationType;
|
||||
String? longitude;
|
||||
int? pharmacyLocationID;
|
||||
String? phoneNumber;
|
||||
int? projectID;
|
||||
String? projectImageURL;
|
||||
int? setupID;
|
||||
dynamic sortOrder;
|
||||
|
||||
GetHMGLocationsModel(
|
||||
{this.cityID,
|
||||
this.cityName,
|
||||
this.cityNameN,
|
||||
this.distanceInKilometers,
|
||||
this.isActive,
|
||||
this.latitude,
|
||||
this.locationID,
|
||||
this.locationName,
|
||||
this.locationNameN,
|
||||
this.locationType,
|
||||
this.longitude,
|
||||
this.pharmacyLocationID,
|
||||
this.phoneNumber,
|
||||
this.projectID,
|
||||
this.projectImageURL,
|
||||
this.setupID,
|
||||
this.sortOrder});
|
||||
|
||||
GetHMGLocationsModel.fromJson(Map<String, dynamic> json) {
|
||||
cityID = json['CityID'];
|
||||
cityName = json['CityName'];
|
||||
cityNameN = json['CityNameN'];
|
||||
distanceInKilometers = json['DistanceInKilometers'];
|
||||
isActive = json['IsActive'];
|
||||
latitude = json['Latitude'];
|
||||
locationID = json['LocationID'];
|
||||
locationName = json['LocationName'];
|
||||
locationNameN = json['LocationNameN'];
|
||||
locationType = json['LocationType'];
|
||||
longitude = json['Longitude'];
|
||||
pharmacyLocationID = json['PharmacyLocationID'];
|
||||
phoneNumber = json['PhoneNumber'];
|
||||
projectID = json['ProjectID'];
|
||||
projectImageURL = json['ProjectImageURL'];
|
||||
setupID = json['SetupID'];
|
||||
sortOrder = json['SortOrder'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['CityID'] = this.cityID;
|
||||
data['CityName'] = this.cityName;
|
||||
data['CityNameN'] = this.cityNameN;
|
||||
data['DistanceInKilometers'] = this.distanceInKilometers;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['Latitude'] = this.latitude;
|
||||
data['LocationID'] = this.locationID;
|
||||
data['LocationName'] = this.locationName;
|
||||
data['LocationNameN'] = this.locationNameN;
|
||||
data['LocationType'] = this.locationType;
|
||||
data['Longitude'] = this.longitude;
|
||||
data['PharmacyLocationID'] = this.pharmacyLocationID;
|
||||
data['PhoneNumber'] = this.phoneNumber;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ProjectImageURL'] = this.projectImageURL;
|
||||
data['SetupID'] = this.setupID;
|
||||
data['SortOrder'] = this.sortOrder;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
||||
|
||||
class GetPatientICProjectsModel {
|
||||
int? id;
|
||||
String? projectName;
|
||||
String? projectNameN;
|
||||
String? value;
|
||||
dynamic languageId;
|
||||
DateTime? createdOn;
|
||||
String? createdBy;
|
||||
dynamic editedOn;
|
||||
dynamic editedBy;
|
||||
bool? isActive;
|
||||
dynamic distanceInKilometers;
|
||||
|
||||
GetPatientICProjectsModel(
|
||||
{this.id, this.projectName, this.projectNameN, this.value, this.languageId, this.createdOn, this.createdBy, this.editedOn, this.editedBy, this.distanceInKilometers, this.isActive});
|
||||
|
||||
GetPatientICProjectsModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
projectName = json['ProjectName'];
|
||||
projectNameN = json['ProjectNameN'];
|
||||
value = json['Value'];
|
||||
languageId = json['LanguageId'];
|
||||
createdOn = DateUtil.convertStringToDate(json['CreatedOn']);
|
||||
createdBy = json['CreatedBy'];
|
||||
editedOn = json['EditedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
isActive = json['IsActive'];
|
||||
distanceInKilometers = json['DistanceInKilometers'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['ProjectName'] = this.projectName;
|
||||
data['ProjectNameN'] = this.projectNameN;
|
||||
data['Value'] = this.value;
|
||||
data['LanguageId'] = this.languageId;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['DistanceInKilometers'] = this.distanceInKilometers;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
enum AmbulanceCallingPlace{
|
||||
FROM_HOSPITAL,
|
||||
TO_HOSPITAL
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
enum AmbulanceDirection{
|
||||
ONE_WAY, TWO_WAY
|
||||
}
|
||||
@ -0,0 +1,205 @@
|
||||
|
||||
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/PatientERTransportationMethod.dart' show PatientERTransportationMethod;
|
||||
|
||||
class PatientER_RC {
|
||||
double? versionID;
|
||||
int? channel;
|
||||
int? languageID;
|
||||
String? iPAdress;
|
||||
String? generalid;
|
||||
bool? patientOutSA;
|
||||
String? sessionID;
|
||||
bool? isDentalAllowedBackend;
|
||||
int? deviceTypeID;
|
||||
int? patientID;
|
||||
String? tokenID;
|
||||
int? patientTypeID;
|
||||
int? patientType;
|
||||
int? orderServiceID;
|
||||
String? patientIdentificationID;
|
||||
dynamic patientOutSa;
|
||||
int? projectID;
|
||||
int? lineItemNo;
|
||||
TransportationDetails? transportationDetails;
|
||||
PatientERTransportationMethod? patientERTransportationMethod;
|
||||
|
||||
PatientER_RC(
|
||||
{this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.patientID,
|
||||
this.tokenID,
|
||||
this.patientTypeID,
|
||||
this.patientType,
|
||||
this.orderServiceID,
|
||||
this.patientIdentificationID,
|
||||
this.patientOutSa,
|
||||
this.projectID,
|
||||
this.lineItemNo,
|
||||
this.transportationDetails });
|
||||
|
||||
PatientER_RC.fromJson(Map<String, dynamic> json) {
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
patientID = json['PatientID'];
|
||||
tokenID = json['TokenID'];
|
||||
patientTypeID = json['PatientTypeID'];
|
||||
patientType = json['PatientType'];
|
||||
orderServiceID = json['OrderServiceID'];
|
||||
patientIdentificationID = json['PatientIdentificationID'];
|
||||
patientOutSa = json['patientOutSa'];
|
||||
projectID = json['projectID'];
|
||||
lineItemNo = json['lineItemNo'];
|
||||
transportationDetails = json['transportationDetails'] != null
|
||||
? new TransportationDetails.fromJson(json['transportationDetails'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['generalid'] = this.generalid;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = this.deviceTypeID;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['PatientTypeID'] = this.patientTypeID;
|
||||
data['PatientType'] = this.patientType;
|
||||
data['OrderServiceID'] = this.orderServiceID;
|
||||
data['PatientIdentificationID'] = this.patientIdentificationID;
|
||||
data['patientOutSa'] = this.patientOutSa;
|
||||
data['projectID'] = this.projectID;
|
||||
data['lineItemNo'] = this.lineItemNo;
|
||||
if (this.transportationDetails != null) {
|
||||
data['transportationDetails'] = this.transportationDetails!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class TransportationDetails {
|
||||
int? direction;
|
||||
int? haveAppointment;
|
||||
int? tripType;
|
||||
int? pickupUrgency;
|
||||
int? pickupSpot;
|
||||
String? pickupDateTime;
|
||||
String? transportationType;
|
||||
int? ambulate;
|
||||
String? ambulateTitle;
|
||||
String? notes;
|
||||
int? requesterFileNo;
|
||||
String? requesterMobileNo;
|
||||
bool? requesterIsOutSA;
|
||||
String? pickupLocationName;
|
||||
String? dropoffLocationName;
|
||||
String? pickupLatitude;
|
||||
String? pickupLongitude;
|
||||
String? dropoffLatitude;
|
||||
String? dropoffLongitude;
|
||||
String? appointmentNo;
|
||||
String? appointmentClinicName;
|
||||
String? appointmentDoctorName;
|
||||
String? appointmentBranch;
|
||||
String? appointmentTime;
|
||||
|
||||
TransportationDetails(
|
||||
{this.direction,
|
||||
this.haveAppointment = 0,
|
||||
this.tripType,
|
||||
this.pickupUrgency,
|
||||
this.pickupSpot,
|
||||
this.pickupDateTime,
|
||||
this.transportationType,
|
||||
this.ambulate,
|
||||
this.ambulateTitle,
|
||||
this.notes,
|
||||
this.requesterFileNo,
|
||||
this.requesterMobileNo,
|
||||
this.requesterIsOutSA,
|
||||
this.pickupLocationName,
|
||||
this.dropoffLocationName,
|
||||
this.pickupLatitude,
|
||||
this.pickupLongitude,
|
||||
this.dropoffLatitude,
|
||||
this.dropoffLongitude,
|
||||
this.appointmentNo = "0",
|
||||
this.appointmentClinicName = "",
|
||||
this.appointmentDoctorName = "",
|
||||
this.appointmentBranch = "",
|
||||
this.appointmentTime = ""});
|
||||
|
||||
TransportationDetails.fromJson(Map<String, dynamic> json) {
|
||||
direction = json['direction'];
|
||||
haveAppointment = json['haveAppointment'];
|
||||
tripType = json['tripType'];
|
||||
pickupUrgency = json['pickupUrgency'];
|
||||
pickupSpot = json['pickupSpot'];
|
||||
pickupDateTime = json['pickupDateTime'];
|
||||
transportationType = json['transportationType'];
|
||||
ambulate = json['ambulate'];
|
||||
ambulateTitle = "";
|
||||
notes = json['notes'];
|
||||
requesterFileNo = json['requesterFileNo'];
|
||||
requesterMobileNo = json['requesterMobileNo'];
|
||||
requesterIsOutSA = json['requesterIsOutSA'];
|
||||
pickupLocationName = json['pickupLocationName'];
|
||||
dropoffLocationName = json['dropoffLocationName'];
|
||||
pickupLatitude = json['pickup_Latitude'];
|
||||
pickupLongitude = json['pickup_Longitude'];
|
||||
dropoffLatitude = json['dropoff_Latitude'];
|
||||
dropoffLongitude = json['dropoff_Longitude'];
|
||||
appointmentNo = json['appointmentNo'];
|
||||
appointmentClinicName = json['appointmentClinicName'];
|
||||
appointmentDoctorName = json['appointmentDoctorName'];
|
||||
appointmentBranch = json['appointmentBranch'];
|
||||
appointmentTime = json['appointmentTime'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['direction'] = this.direction;
|
||||
data['haveAppointment'] = this.haveAppointment;
|
||||
data['tripType'] = this.tripType;
|
||||
data['pickupUrgency'] = this.pickupUrgency;
|
||||
data['pickupSpot'] = this.pickupSpot;
|
||||
data['pickupDateTime'] = this.pickupDateTime;
|
||||
data['transportationType'] = this.transportationType;
|
||||
data['ambulate'] = this.ambulate;
|
||||
data['ambulateTitle'] = this.ambulateTitle;
|
||||
data['notes'] = this.notes;
|
||||
data['requesterFileNo'] = this.requesterFileNo;
|
||||
data['requesterMobileNo'] = this.requesterMobileNo;
|
||||
data['requesterIsOutSA'] = this.requesterIsOutSA;
|
||||
data['pickupLocationName'] = this.pickupLocationName;
|
||||
data['dropoffLocationName'] = this.dropoffLocationName;
|
||||
data['pickup_Latitude'] = this.pickupLatitude;
|
||||
data['pickup_Longitude'] = this.pickupLongitude;
|
||||
data['dropoff_Latitude'] = this.dropoffLatitude;
|
||||
data['dropoff_Longitude'] = this.dropoffLongitude;
|
||||
data['appointmentNo'] = this.appointmentNo;
|
||||
data['appointmentClinicName'] = this.appointmentClinicName;
|
||||
data['appointmentDoctorName'] = this.appointmentDoctorName;
|
||||
data['appointmentBranch'] = this.appointmentBranch;
|
||||
data['appointmentTime'] = this.appointmentTime;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,346 @@
|
||||
class AmbulanceRequestOrdersModel {
|
||||
String? statusText;
|
||||
num? paymentStatus;
|
||||
dynamic clientRequestid;
|
||||
dynamic paymentStatusText;
|
||||
dynamic projectName;
|
||||
String? nearestProjectName;
|
||||
num? paymentAmount;
|
||||
WFOrder? wFOrder;
|
||||
String? serviceText;
|
||||
bool? isSentForApproval;
|
||||
num? exaCartOrderId;
|
||||
String? exaCartGUID;
|
||||
bool? isTimer;
|
||||
num? timeSeconds;
|
||||
num? totalPendingSeconds;
|
||||
num? timeMinute;
|
||||
num? timeHour;
|
||||
num? timeTotalSeconds;
|
||||
num? timeTotalMinute;
|
||||
num? timeTotalHour;
|
||||
dynamic approvalStatus;
|
||||
bool? isActive;
|
||||
num? clickButton;
|
||||
dynamic orderHistory;
|
||||
String? pickupLocation;
|
||||
String? dropOffLocation;
|
||||
String? clinicName;
|
||||
String? doctorName;
|
||||
String? branch;
|
||||
String? time;
|
||||
String? notes;
|
||||
int? iD;
|
||||
num? patientId;
|
||||
num? patientOutSa;
|
||||
bool? isOutPatient;
|
||||
num? projectId;
|
||||
num? nearestProjectId;
|
||||
dynamic longitude;
|
||||
dynamic latitude;
|
||||
dynamic appointmentNo;
|
||||
dynamic dischargeId;
|
||||
int? statusId;
|
||||
num? serviceId;
|
||||
num? channel;
|
||||
Orderpayment? orderpayment;
|
||||
dynamic wforder;
|
||||
dynamic orderapprovalobj;
|
||||
String? created;
|
||||
dynamic createdBy;
|
||||
dynamic modified;
|
||||
dynamic modifiedBy;
|
||||
bool? isDeleted;
|
||||
|
||||
AmbulanceRequestOrdersModel(
|
||||
{this.statusText,
|
||||
this.paymentStatus,
|
||||
this.clientRequestid,
|
||||
this.paymentStatusText,
|
||||
this.projectName,
|
||||
this.nearestProjectName,
|
||||
this.paymentAmount,
|
||||
this.wFOrder,
|
||||
this.serviceText,
|
||||
this.isSentForApproval,
|
||||
this.exaCartOrderId,
|
||||
this.exaCartGUID,
|
||||
this.isTimer,
|
||||
this.timeSeconds,
|
||||
this.totalPendingSeconds,
|
||||
this.timeMinute,
|
||||
this.timeHour,
|
||||
this.timeTotalSeconds,
|
||||
this.timeTotalMinute,
|
||||
this.timeTotalHour,
|
||||
this.approvalStatus,
|
||||
this.isActive,
|
||||
this.clickButton,
|
||||
this.orderHistory,
|
||||
this.pickupLocation,
|
||||
this.dropOffLocation,
|
||||
this.clinicName,
|
||||
this.doctorName,
|
||||
this.branch,
|
||||
this.time,
|
||||
this.notes,
|
||||
this.iD,
|
||||
this.patientId,
|
||||
this.patientOutSa,
|
||||
this.isOutPatient,
|
||||
this.projectId,
|
||||
this.nearestProjectId,
|
||||
this.longitude,
|
||||
this.latitude,
|
||||
this.appointmentNo,
|
||||
this.dischargeId,
|
||||
this.statusId,
|
||||
this.serviceId,
|
||||
this.channel,
|
||||
this.orderpayment,
|
||||
this.wforder,
|
||||
this.orderapprovalobj,
|
||||
this.created,
|
||||
this.createdBy,
|
||||
this.modified,
|
||||
this.modifiedBy,
|
||||
this.isDeleted});
|
||||
|
||||
AmbulanceRequestOrdersModel.fromJson(Map<String, dynamic> json) {
|
||||
statusText = json['StatusText'];
|
||||
paymentStatus = json['PaymentStatus'];
|
||||
clientRequestid = json['ClientRequestid'];
|
||||
paymentStatusText = json['PaymentStatusText'];
|
||||
projectName = json['ProjectName'];
|
||||
nearestProjectName = json['NearestProjectName'];
|
||||
paymentAmount = json['PaymentAmount'];
|
||||
wFOrder = json['WF_order'] != null
|
||||
? new WFOrder.fromJson(json['WF_order'])
|
||||
: null;
|
||||
serviceText = json['ServiceText'];
|
||||
isSentForApproval = json['isSentForApproval'];
|
||||
exaCartOrderId = json['ExaCart_OrderId'];
|
||||
exaCartGUID = json['ExaCart_GUID'];
|
||||
isTimer = json['isTimer'];
|
||||
timeSeconds = json['TimeSeconds'];
|
||||
totalPendingSeconds = json['TotalPendingSeconds'];
|
||||
timeMinute = json['TimeMinute'];
|
||||
timeHour = json['TimeHour'];
|
||||
timeTotalSeconds = json['TimeTotalSeconds'];
|
||||
timeTotalMinute = json['TimeTotalMinute'];
|
||||
timeTotalHour = json['TimeTotalHour'];
|
||||
approvalStatus = json['ApprovalStatus'];
|
||||
isActive = json['isActive'];
|
||||
clickButton = json['ClickButton'];
|
||||
orderHistory = json['OrderHistory'];
|
||||
pickupLocation = json['PickupLocation'];
|
||||
dropOffLocation = json['DropOffLocation'];
|
||||
clinicName = json['clinicName'];
|
||||
doctorName = json['DoctorName'];
|
||||
branch = json['Branch'];
|
||||
time = json['Time'];
|
||||
notes = json['Notes'];
|
||||
iD = json['ID'];
|
||||
patientId = json['PatientId'];
|
||||
patientOutSa = json['PatientOutSa'];
|
||||
isOutPatient = json['IsOutPatient'];
|
||||
projectId = json['ProjectId'];
|
||||
nearestProjectId = json['NearestProjectId'];
|
||||
longitude = json['Longitude'];
|
||||
latitude = json['Latitude'];
|
||||
appointmentNo = json['AppointmentNo'];
|
||||
dischargeId = json['DischargeId'];
|
||||
statusId = json['StatusId'];
|
||||
serviceId = json['ServiceId'];
|
||||
channel = json['Channel'];
|
||||
orderpayment = json['orderpayment'] != null
|
||||
? new Orderpayment.fromJson(json['orderpayment'])
|
||||
: null;
|
||||
wforder = json['wforder'];
|
||||
orderapprovalobj = json['orderapprovalobj'];
|
||||
created = json['Created'];
|
||||
createdBy = json['CreatedBy'];
|
||||
modified = json['Modified'];
|
||||
modifiedBy = json['ModifiedBy'];
|
||||
isDeleted = json['IsDeleted'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['StatusText'] = this.statusText;
|
||||
data['PaymentStatus'] = this.paymentStatus;
|
||||
data['ClientRequestid'] = this.clientRequestid;
|
||||
data['PaymentStatusText'] = this.paymentStatusText;
|
||||
data['ProjectName'] = this.projectName;
|
||||
data['NearestProjectName'] = this.nearestProjectName;
|
||||
data['PaymentAmount'] = this.paymentAmount;
|
||||
if (this.wFOrder != null) {
|
||||
data['WF_order'] = this.wFOrder!.toJson();
|
||||
}
|
||||
data['ServiceText'] = this.serviceText;
|
||||
data['isSentForApproval'] = this.isSentForApproval;
|
||||
data['ExaCart_OrderId'] = this.exaCartOrderId;
|
||||
data['ExaCart_GUID'] = this.exaCartGUID;
|
||||
data['isTimer'] = this.isTimer;
|
||||
data['TimeSeconds'] = this.timeSeconds;
|
||||
data['TotalPendingSeconds'] = this.totalPendingSeconds;
|
||||
data['TimeMinute'] = this.timeMinute;
|
||||
data['TimeHour'] = this.timeHour;
|
||||
data['TimeTotalSeconds'] = this.timeTotalSeconds;
|
||||
data['TimeTotalMinute'] = this.timeTotalMinute;
|
||||
data['TimeTotalHour'] = this.timeTotalHour;
|
||||
data['ApprovalStatus'] = this.approvalStatus;
|
||||
data['isActive'] = this.isActive;
|
||||
data['ClickButton'] = this.clickButton;
|
||||
data['OrderHistory'] = this.orderHistory;
|
||||
data['PickupLocation'] = this.pickupLocation;
|
||||
data['DropOffLocation'] = this.dropOffLocation;
|
||||
data['clinicName'] = this.clinicName;
|
||||
data['DoctorName'] = this.doctorName;
|
||||
data['Branch'] = this.branch;
|
||||
data['Time'] = this.time;
|
||||
data['Notes'] = this.notes;
|
||||
data['ID'] = this.iD;
|
||||
data['PatientId'] = this.patientId;
|
||||
data['PatientOutSa'] = this.patientOutSa;
|
||||
data['IsOutPatient'] = this.isOutPatient;
|
||||
data['ProjectId'] = this.projectId;
|
||||
data['NearestProjectId'] = this.nearestProjectId;
|
||||
data['Longitude'] = this.longitude;
|
||||
data['Latitude'] = this.latitude;
|
||||
data['AppointmentNo'] = this.appointmentNo;
|
||||
data['DischargeId'] = this.dischargeId;
|
||||
data['StatusId'] = this.statusId;
|
||||
data['ServiceId'] = this.serviceId;
|
||||
data['Channel'] = this.channel;
|
||||
if (this.orderpayment != null) {
|
||||
data['orderpayment'] = this.orderpayment!.toJson();
|
||||
}
|
||||
data['wforder'] = this.wforder;
|
||||
data['orderapprovalobj'] = this.orderapprovalobj;
|
||||
data['Created'] = this.created;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['Modified'] = this.modified;
|
||||
data['ModifiedBy'] = this.modifiedBy;
|
||||
data['IsDeleted'] = this.isDeleted;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class WFOrder {
|
||||
dynamic wfButtonsDTO;
|
||||
num? iD;
|
||||
num? orderId;
|
||||
num? previousStep;
|
||||
num? nextStep;
|
||||
num? serviceId;
|
||||
dynamic order;
|
||||
String? created;
|
||||
dynamic createdBy;
|
||||
dynamic modified;
|
||||
dynamic modifiedBy;
|
||||
bool? isDeleted;
|
||||
|
||||
WFOrder(
|
||||
{this.wfButtonsDTO,
|
||||
this.iD,
|
||||
this.orderId,
|
||||
this.previousStep,
|
||||
this.nextStep,
|
||||
this.serviceId,
|
||||
this.order,
|
||||
this.created,
|
||||
this.createdBy,
|
||||
this.modified,
|
||||
this.modifiedBy,
|
||||
this.isDeleted});
|
||||
|
||||
WFOrder.fromJson(Map<String, dynamic> json) {
|
||||
wfButtonsDTO = json['wf_ButtonsDTO'];
|
||||
iD = json['ID'];
|
||||
orderId = json['OrderId'];
|
||||
previousStep = json['PreviousStep'];
|
||||
nextStep = json['NextStep'];
|
||||
serviceId = json['ServiceId'];
|
||||
order = json['Order'];
|
||||
created = json['Created'];
|
||||
createdBy = json['CreatedBy'];
|
||||
modified = json['Modified'];
|
||||
modifiedBy = json['ModifiedBy'];
|
||||
isDeleted = json['IsDeleted'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['wf_ButtonsDTO'] = this.wfButtonsDTO;
|
||||
data['ID'] = this.iD;
|
||||
data['OrderId'] = this.orderId;
|
||||
data['PreviousStep'] = this.previousStep;
|
||||
data['NextStep'] = this.nextStep;
|
||||
data['ServiceId'] = this.serviceId;
|
||||
data['Order'] = this.order;
|
||||
data['Created'] = this.created;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['Modified'] = this.modified;
|
||||
data['ModifiedBy'] = this.modifiedBy;
|
||||
data['IsDeleted'] = this.isDeleted;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Orderpayment {
|
||||
num? iD;
|
||||
num? orderId;
|
||||
dynamic clientRequestId;
|
||||
num? totalAmount;
|
||||
num? paymentStatus;
|
||||
dynamic order;
|
||||
String? created;
|
||||
dynamic createdBy;
|
||||
dynamic modified;
|
||||
dynamic modifiedBy;
|
||||
bool? isDeleted;
|
||||
|
||||
Orderpayment(
|
||||
{this.iD,
|
||||
this.orderId,
|
||||
this.clientRequestId,
|
||||
this.totalAmount,
|
||||
this.paymentStatus,
|
||||
this.order,
|
||||
this.created,
|
||||
this.createdBy,
|
||||
this.modified,
|
||||
this.modifiedBy,
|
||||
this.isDeleted});
|
||||
|
||||
Orderpayment.fromJson(Map<String, dynamic> json) {
|
||||
iD = json['ID'];
|
||||
orderId = json['OrderId'];
|
||||
clientRequestId = json['ClientRequestId'];
|
||||
totalAmount = json['TotalAmount'];
|
||||
paymentStatus = json['PaymentStatus'];
|
||||
order = json['Order'];
|
||||
created = json['Created'];
|
||||
createdBy = json['CreatedBy'];
|
||||
modified = json['Modified'];
|
||||
modifiedBy = json['ModifiedBy'];
|
||||
isDeleted = json['IsDeleted'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ID'] = this.iD;
|
||||
data['OrderId'] = this.orderId;
|
||||
data['ClientRequestId'] = this.clientRequestId;
|
||||
data['TotalAmount'] = this.totalAmount;
|
||||
data['PaymentStatus'] = this.paymentStatus;
|
||||
data['Order'] = this.order;
|
||||
data['Created'] = this.created;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['Modified'] = this.modified;
|
||||
data['ModifiedBy'] = this.modifiedBy;
|
||||
data['IsDeleted'] = this.isDeleted;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
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;
|
||||
bool? isCash;
|
||||
bool? isEligible;
|
||||
bool? isInsured;
|
||||
|
||||
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,
|
||||
this.isCash,
|
||||
this.isEligible,
|
||||
this.isInsured});
|
||||
|
||||
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'];
|
||||
isCash = json['IsCash'];
|
||||
isEligible = json['IsEligible'];
|
||||
isInsured = json['IsInsured'];
|
||||
}
|
||||
|
||||
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;
|
||||
data['IsCash'] = this.isCash;
|
||||
data['IsEligible'] = this.isEligible;
|
||||
data['IsInsured'] = this.isInsured;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
class PatientERTransportationMethod {
|
||||
int? iD;
|
||||
String? serviceID;
|
||||
int? orderServiceID;
|
||||
String? text;
|
||||
String? textN;
|
||||
dynamic price;
|
||||
dynamic priceVAT;
|
||||
dynamic priceTotal;
|
||||
bool? isEnabled;
|
||||
int? orderId;
|
||||
int? quantity;
|
||||
|
||||
PatientERTransportationMethod(
|
||||
{this.iD,
|
||||
this.serviceID,
|
||||
this.orderServiceID,
|
||||
this.text,
|
||||
this.textN,
|
||||
this.price,
|
||||
this.priceVAT,
|
||||
this.priceTotal,
|
||||
this.isEnabled,
|
||||
this.orderId,
|
||||
this.quantity});
|
||||
|
||||
PatientERTransportationMethod.fromJson(Map<String, dynamic> json) {
|
||||
iD = json['ID'];
|
||||
serviceID = json['ServiceID'];
|
||||
orderServiceID = json['OrderServiceID'];
|
||||
text = json['Text'];
|
||||
textN = json['TextN'];
|
||||
price = json['Price'];
|
||||
priceVAT = json['PriceVAT'];
|
||||
priceTotal = json['PriceTotal'];
|
||||
isEnabled = json['IsEnabled'];
|
||||
orderId = json['OrderId'];
|
||||
quantity = json['Quantity'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ID'] = this.iD;
|
||||
data['ServiceID'] = this.serviceID;
|
||||
data['OrderServiceID'] = this.orderServiceID;
|
||||
data['Text'] = this.text;
|
||||
data['TextN'] = this.textN;
|
||||
data['Price'] = this.price;
|
||||
data['PriceVAT'] = this.priceVAT;
|
||||
data['PriceTotal'] = this.priceTotal;
|
||||
data['IsEnabled'] = this.isEnabled;
|
||||
data['OrderId'] = this.orderId;
|
||||
data['Quantity'] = this.quantity;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
class GeocodeResponse {
|
||||
final List<GeocodeResult> results;
|
||||
final String status;
|
||||
|
||||
GeocodeResponse({
|
||||
required this.results,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
factory GeocodeResponse.fromJson(Map<String, dynamic> json) {
|
||||
final resultsList = (json['results'] as List<dynamic>? ?? [])
|
||||
.map((e) => GeocodeResult.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
return GeocodeResponse(
|
||||
results: resultsList,
|
||||
status: json['status'] ?? '',
|
||||
);
|
||||
}
|
||||
@override
|
||||
String toString() {
|
||||
return 'GeocodeResponse(status: $status, results: [${results.map((r) => r.toString()).join(', ')}])';
|
||||
}
|
||||
}
|
||||
|
||||
class GeocodeResult {
|
||||
final String formattedAddress;
|
||||
final Geometry geometry;
|
||||
final String placeId;
|
||||
|
||||
GeocodeResult({
|
||||
required this.formattedAddress,
|
||||
required this.geometry,
|
||||
required this.placeId,
|
||||
});
|
||||
|
||||
factory GeocodeResult.fromJson(Map<String, dynamic> json) {
|
||||
return GeocodeResult(
|
||||
formattedAddress: json['formatted_address'] ?? '',
|
||||
geometry: Geometry.fromJson(json['geometry']),
|
||||
placeId: json['place_id'] ?? '',
|
||||
);
|
||||
}
|
||||
@override
|
||||
String toString() {
|
||||
return 'GeocodeResult(formattedAddress: $formattedAddress, placeId: $placeId, geometry: ${geometry.toString()})';
|
||||
}
|
||||
}
|
||||
|
||||
class Geometry {
|
||||
final Location location;
|
||||
|
||||
Geometry({required this.location});
|
||||
|
||||
factory Geometry.fromJson(Map<String, dynamic> json) {
|
||||
return Geometry(
|
||||
location: Location.fromJson(json['location']),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'Geometry(location: ${location.toString()})';
|
||||
}
|
||||
|
||||
class Location {
|
||||
final double lat;
|
||||
final double lng;
|
||||
|
||||
Location({required this.lat, required this.lng});
|
||||
|
||||
factory Location.fromJson(Map<String, dynamic> json) {
|
||||
return Location(
|
||||
lat: (json['lat'] as num).toDouble(),
|
||||
lng: (json['lng'] as num).toDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'Location(lat: $lat, lng: $lng)';
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
class PlaceDetails {
|
||||
final double lat;
|
||||
final double lng;
|
||||
|
||||
PlaceDetails({required this.lat, required this.lng});
|
||||
|
||||
factory PlaceDetails.fromJson(Map<String, dynamic> json) {
|
||||
final loc = json['result']['geometry']['location'];
|
||||
return PlaceDetails(
|
||||
lat: (loc['lat'] as num).toDouble(),
|
||||
lng: (loc['lng'] as num).toDouble(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
class PlacePrediction {
|
||||
final String description;
|
||||
final String placeID;
|
||||
PlacePrediction({required this.description, required this.placeID});
|
||||
factory PlacePrediction.fromJson(Map<String, dynamic> json) {
|
||||
return PlacePrediction(
|
||||
description: json['description'] ?? '',
|
||||
placeID: json['place_id'] ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,153 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart';
|
||||
import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart';
|
||||
|
||||
import '../../core/api_consts.dart';
|
||||
import 'PlacePrediction.dart';
|
||||
|
||||
abstract class LocationRepo {
|
||||
Future<Either<Failure, GenericApiModel<List<PlacePrediction>>>>
|
||||
getPlacePredictionsAsInput(String input);
|
||||
|
||||
Future<Either<Failure, GenericApiModel<PlaceDetails>>>
|
||||
getPlaceDetailsOfSelectedPrediction(String placeId);
|
||||
|
||||
Future<Either<Failure, GenericApiModel<GeocodeResponse>>>
|
||||
getGeoCodeFromLatLng(double lat, double lng);
|
||||
}
|
||||
|
||||
class LocationRepoImpl implements LocationRepo {
|
||||
final ApiClient apiClient;
|
||||
|
||||
LocationRepoImpl({required this.apiClient});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List<PlacePrediction>>>> getPlacePredictionsAsInput(
|
||||
String input) async {
|
||||
final url = Uri.parse(
|
||||
'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$input®ion=SA&key=$GOOGLE_API_KEY',
|
||||
);
|
||||
|
||||
GenericApiModel<List<PlacePrediction>>? apiResponse;
|
||||
Failure? failure;
|
||||
|
||||
try {
|
||||
await apiClient.get(
|
||||
url.toString(),
|
||||
isExternal: true,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final list = response['predictions'];
|
||||
final predictionsList = list
|
||||
.map((item) =>
|
||||
PlacePrediction.fromJson(item as Map<String, dynamic>))
|
||||
.toList()
|
||||
.cast<PlacePrediction>();
|
||||
apiResponse = GenericApiModel<List<PlacePrediction>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: predictionsList,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<GeocodeResponse>>> getGeoCodeFromLatLng(double lat, double lng) async {
|
||||
final url = Uri.parse(
|
||||
'https://maps.googleapis.com/maps/api/geocode/json?latlng=$lat,$lng&key=$GOOGLE_API_KEY',
|
||||
);
|
||||
|
||||
|
||||
GenericApiModel<GeocodeResponse>? apiResponse;
|
||||
Failure? failure;
|
||||
|
||||
try {
|
||||
await apiClient.get(
|
||||
url.toString(),
|
||||
isExternal: true,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final predictionsList = GeocodeResponse.fromJson(response);
|
||||
apiResponse = GenericApiModel<GeocodeResponse>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: predictionsList,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<PlaceDetails>>> getPlaceDetailsOfSelectedPrediction(String placeId) async {
|
||||
|
||||
|
||||
final url = Uri.parse(
|
||||
'https://maps.googleapis.com/maps/api/place/details/json'
|
||||
'?place_id=$placeId&fields=geometry&key=$GOOGLE_API_KEY',
|
||||
);
|
||||
|
||||
GenericApiModel<PlaceDetails>? apiResponse;
|
||||
Failure? failure;
|
||||
|
||||
try {
|
||||
await apiClient.get(
|
||||
url.toString(),
|
||||
isExternal: true,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final predictionsList = PlaceDetails.fromJson(response);
|
||||
apiResponse = GenericApiModel<PlaceDetails>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: predictionsList,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart' show ChangeNotifier;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_maps_flutter_platform_interface/src/types/camera.dart';
|
||||
import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart';
|
||||
import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart';
|
||||
import 'package:hmg_patient_app_new/features/location/location_repo.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
import 'package:huawei_map/huawei_map.dart' as HMSCameraServices;
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices;
|
||||
|
||||
|
||||
|
||||
import 'PlacePrediction.dart';
|
||||
|
||||
class LocationViewModel extends ChangeNotifier {
|
||||
final LocationRepo locationRepo;
|
||||
final ErrorHandlerService errorHandlerService;
|
||||
|
||||
LocationViewModel({required this.locationRepo, required this.errorHandlerService});
|
||||
|
||||
List<PlacePrediction> predictions = [];
|
||||
PlacePrediction? selectedPrediction;
|
||||
bool isPredictionLoading = false;
|
||||
GeocodeResponse? geocodeResponse;
|
||||
PlaceDetails? placeDetails;
|
||||
|
||||
Location? mapCapturedLocation;
|
||||
|
||||
FutureOr<void> getPlacesPrediction(String input) async {
|
||||
predictions = [];
|
||||
isPredictionLoading= true;
|
||||
final result = await locationRepo.getPlacePredictionsAsInput(input);
|
||||
result.fold(
|
||||
(failure) {
|
||||
errorHandlerService.handleError(failure: failure);
|
||||
},
|
||||
(apiModel) {
|
||||
predictions = apiModel.data??[];
|
||||
},
|
||||
);
|
||||
isPredictionLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
FutureOr<void> getPlaceEncodedData(double? lat, double? lng) async {
|
||||
geocodeResponse = null;
|
||||
final result = await locationRepo.getGeoCodeFromLatLng(lat!, lng!);
|
||||
result.fold(
|
||||
(failure) {
|
||||
errorHandlerService.handleError(failure: failure);
|
||||
},
|
||||
(apiModel) {
|
||||
print("Geocode Response: ${apiModel.data}");
|
||||
geocodeResponse = apiModel.data;
|
||||
},
|
||||
);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
FutureOr<void> getPlaceDetails(String placeID) async {
|
||||
placeDetails = null;
|
||||
final result = await locationRepo.getPlaceDetailsOfSelectedPrediction(placeID);
|
||||
result.fold(
|
||||
(failure) {
|
||||
errorHandlerService.handleError(failure: failure);
|
||||
},
|
||||
(apiModel) {
|
||||
placeDetails = apiModel.data;
|
||||
},
|
||||
);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
handleGMSMapCameraMoved(GMSMapServices.CameraPosition value) {
|
||||
mapCapturedLocation = Location(lat: value.target.latitude, lng: value.target.longitude);
|
||||
|
||||
}
|
||||
|
||||
handleHMSMapCameraMoved(HMSCameraServices.CameraPosition value) {
|
||||
mapCapturedLocation = Location(lat: value.target.lat, lng: value.target.lng);
|
||||
}
|
||||
|
||||
handleOnCameraIdle(){
|
||||
if(mapCapturedLocation != null) {
|
||||
getPlaceEncodedData(mapCapturedLocation!.lat, mapCapturedLocation!.lng);
|
||||
}
|
||||
}
|
||||
|
||||
void updateSearchQuery(String? value) {
|
||||
if(value == null || value.isEmpty){
|
||||
predictions = [];
|
||||
return;
|
||||
}
|
||||
|
||||
getPlacesPrediction(value);
|
||||
}
|
||||
|
||||
void flushSearchPredictions() {
|
||||
predictions = [];
|
||||
mapCapturedLocation= null;
|
||||
placeDetails= null;
|
||||
geocodeResponse= null;
|
||||
selectedPrediction= null;
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
FutureOr<void> selectPlacePrediction(PlacePrediction placePrediction) async{
|
||||
selectedPrediction= placePrediction;
|
||||
await getPlaceDetails(placePrediction.placeID);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
class AskDocRequestType {
|
||||
String? setupID;
|
||||
int? parameterGroup;
|
||||
int? parameterType;
|
||||
int? parameterCode;
|
||||
String? description;
|
||||
String? descriptionN;
|
||||
String? alias;
|
||||
String? aliasN;
|
||||
String? prefix;
|
||||
String? suffix;
|
||||
String? isColorCodingRequired;
|
||||
String? backColor;
|
||||
String? foreColor;
|
||||
bool? isBuiltIn;
|
||||
bool? isActive;
|
||||
int? createdBy;
|
||||
String? createdOn;
|
||||
String? editedBy;
|
||||
String? editedOn;
|
||||
String? rowVer;
|
||||
|
||||
AskDocRequestType(
|
||||
{this.setupID,
|
||||
this.parameterGroup,
|
||||
this.parameterType,
|
||||
this.parameterCode,
|
||||
this.description,
|
||||
this.descriptionN,
|
||||
this.alias,
|
||||
this.aliasN,
|
||||
this.prefix,
|
||||
this.suffix,
|
||||
this.isColorCodingRequired,
|
||||
this.backColor,
|
||||
this.foreColor,
|
||||
this.isBuiltIn,
|
||||
this.isActive,
|
||||
this.createdBy,
|
||||
this.createdOn,
|
||||
this.editedBy,
|
||||
this.editedOn,
|
||||
this.rowVer});
|
||||
|
||||
AskDocRequestType.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
parameterGroup = json['ParameterGroup'];
|
||||
parameterType = json['ParameterType'];
|
||||
parameterCode = json['ParameterCode'];
|
||||
description = json['Description'];
|
||||
descriptionN = json['DescriptionN'];
|
||||
alias = json['Alias'];
|
||||
aliasN = json['AliasN'];
|
||||
prefix = json['Prefix'];
|
||||
suffix = json['Suffix'];
|
||||
isColorCodingRequired = json['IsColorCodingRequired'];
|
||||
backColor = json['BackColor'];
|
||||
foreColor = json['ForeColor'];
|
||||
isBuiltIn = json['IsBuiltIn'];
|
||||
isActive = json['IsActive'];
|
||||
createdBy = json['CreatedBy'];
|
||||
createdOn = json['CreatedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
editedOn = json['EditedOn'];
|
||||
rowVer = json['RowVer'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ParameterGroup'] = this.parameterGroup;
|
||||
data['ParameterType'] = this.parameterType;
|
||||
data['ParameterCode'] = this.parameterCode;
|
||||
data['Description'] = this.description;
|
||||
data['DescriptionN'] = this.descriptionN;
|
||||
data['Alias'] = this.alias;
|
||||
data['AliasN'] = this.aliasN;
|
||||
data['Prefix'] = this.prefix;
|
||||
data['Suffix'] = this.suffix;
|
||||
data['IsColorCodingRequired'] = this.isColorCodingRequired;
|
||||
data['BackColor'] = this.backColor;
|
||||
data['ForeColor'] = this.foreColor;
|
||||
data['IsBuiltIn'] = this.isBuiltIn;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
data['RowVer'] = this.rowVer;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
// Dart model for the "AncillaryOrderList" structure
|
||||
// Uses DateUtil.convertStringToDate and DateUtil.dateToDotNetString from your project to parse/serialize .NET-style dates.
|
||||
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
||||
|
||||
class AncillaryOrderListModel {
|
||||
List<AncillaryOrderGroup>? ancillaryOrderList;
|
||||
|
||||
AncillaryOrderListModel({this.ancillaryOrderList});
|
||||
|
||||
factory AncillaryOrderListModel.fromJson(Map<String, dynamic> json) => AncillaryOrderListModel(
|
||||
ancillaryOrderList: json['AncillaryOrderList'] != null
|
||||
? List<AncillaryOrderGroup>.from(
|
||||
(json['AncillaryOrderList'] as List).map(
|
||||
(x) => AncillaryOrderGroup.fromJson(x as Map<String, dynamic>),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
class AncillaryOrderGroup {
|
||||
List<AncillaryOrderItem>? ancillaryOrderList;
|
||||
dynamic errCode;
|
||||
String? message;
|
||||
int? patientID;
|
||||
String? patientName;
|
||||
int? patientType;
|
||||
int? projectID;
|
||||
String? projectName;
|
||||
String? setupID;
|
||||
int? statusCode;
|
||||
|
||||
AncillaryOrderGroup({
|
||||
this.ancillaryOrderList,
|
||||
this.errCode,
|
||||
this.message,
|
||||
this.patientID,
|
||||
this.patientName,
|
||||
this.patientType,
|
||||
this.projectID,
|
||||
this.projectName,
|
||||
this.setupID,
|
||||
this.statusCode,
|
||||
});
|
||||
|
||||
factory AncillaryOrderGroup.fromJson(Map<String, dynamic> json) => AncillaryOrderGroup(
|
||||
ancillaryOrderList: json['AncillaryOrderList'] != null
|
||||
? List<AncillaryOrderItem>.from(
|
||||
(json['AncillaryOrderList'] as List).map(
|
||||
(x) => AncillaryOrderItem.fromJson(x as Map<String, dynamic>),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
errCode: json['ErrCode'],
|
||||
message: json['Message'] as String?,
|
||||
patientID: json['PatientID'] as int?,
|
||||
patientName: json['PatientName'] as String?,
|
||||
patientType: json['PatientType'] as int?,
|
||||
projectID: json['ProjectID'] as int?,
|
||||
projectName: json['ProjectName'] as String?,
|
||||
setupID: json['SetupID'] as String?,
|
||||
statusCode: json['StatusCode'] as int?,
|
||||
);
|
||||
}
|
||||
|
||||
class AncillaryOrderItem {
|
||||
dynamic ancillaryProcedureListModels;
|
||||
DateTime? appointmentDate;
|
||||
int? appointmentNo;
|
||||
int? clinicID;
|
||||
String? clinicName;
|
||||
int? doctorID;
|
||||
String? doctorName;
|
||||
int? invoiceNo;
|
||||
bool? isCheckInAllow;
|
||||
bool? isQueued;
|
||||
DateTime? orderDate;
|
||||
int? orderNo;
|
||||
String? projectName; // Added from parent AncillaryOrderGroup
|
||||
int? projectID; // Added from parent AncillaryOrderGroup
|
||||
|
||||
AncillaryOrderItem({
|
||||
this.ancillaryProcedureListModels,
|
||||
this.appointmentDate,
|
||||
this.appointmentNo,
|
||||
this.clinicID,
|
||||
this.clinicName,
|
||||
this.doctorID,
|
||||
this.doctorName,
|
||||
this.invoiceNo,
|
||||
this.isCheckInAllow,
|
||||
this.isQueued,
|
||||
this.orderDate,
|
||||
this.orderNo,
|
||||
this.projectName,
|
||||
this.projectID,
|
||||
});
|
||||
|
||||
factory AncillaryOrderItem.fromJson(Map<String, dynamic> json, {String? projectName, int? projectID}) => AncillaryOrderItem(
|
||||
ancillaryProcedureListModels: json['AncillaryProcedureListModels'],
|
||||
appointmentDate: DateUtil.convertStringToDate(json['AppointmentDate']),
|
||||
appointmentNo: json['AppointmentNo'] as int?,
|
||||
clinicID: json['ClinicID'] as int?,
|
||||
clinicName: json['ClinicName'] as String?,
|
||||
doctorID: json['DoctorID'] as int?,
|
||||
doctorName: json['DoctorName'] as String?,
|
||||
invoiceNo: json['Invoiceno'] as int?,
|
||||
isCheckInAllow: json['IsCheckInAllow'] as bool?,
|
||||
isQueued: json['IsQueued'] as bool?,
|
||||
orderDate: DateUtil.convertStringToDate(json['OrderDate']),
|
||||
orderNo: json['OrderNo'] as int?,
|
||||
projectName: projectName,
|
||||
projectID: projectID,
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,221 @@
|
||||
// Dart model classes for "AncillaryOrderProcList"
|
||||
// Generated for user: faizatflutter
|
||||
// Uses DateUtil.convertStringToDate for parsing .NET-style dates (same approach as your PatientRadiologyResponseModel)
|
||||
|
||||
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
||||
|
||||
class AncillaryOrderProcListModel {
|
||||
List<AncillaryOrderProcedureItem>? ancillaryOrderProcList;
|
||||
|
||||
AncillaryOrderProcListModel({this.ancillaryOrderProcList});
|
||||
|
||||
factory AncillaryOrderProcListModel.fromJson(Map<String, dynamic> json) => AncillaryOrderProcListModel(
|
||||
ancillaryOrderProcList: json['AncillaryOrderProcList'] != null
|
||||
? List<AncillaryOrderProcedureItem>.from(
|
||||
(json['AncillaryOrderProcList'] as List).map(
|
||||
(x) => AncillaryOrderProcedureItem.fromJson(x as Map<String, dynamic>),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
class AncillaryOrderProcedureItem {
|
||||
List<AncillaryOrderProcDetail>? ancillaryOrderProcDetailsList;
|
||||
DateTime? appointmentDate;
|
||||
int? appointmentNo;
|
||||
int? clinicID;
|
||||
String? clinicName;
|
||||
int? companyID;
|
||||
String? companyName;
|
||||
int? doctorID;
|
||||
String? doctorName;
|
||||
dynamic errCode;
|
||||
int? groupID;
|
||||
String? insurancePolicyNo;
|
||||
String? message;
|
||||
String? patientCardID;
|
||||
int? patientID;
|
||||
String? patientName;
|
||||
int? patientType;
|
||||
int? policyID;
|
||||
String? policyName;
|
||||
int? projectID;
|
||||
String? setupID;
|
||||
int? statusCode;
|
||||
int? subCategoryID;
|
||||
String? subPolicyNo;
|
||||
|
||||
AncillaryOrderProcedureItem({
|
||||
this.ancillaryOrderProcDetailsList,
|
||||
this.appointmentDate,
|
||||
this.appointmentNo,
|
||||
this.clinicID,
|
||||
this.clinicName,
|
||||
this.companyID,
|
||||
this.companyName,
|
||||
this.doctorID,
|
||||
this.doctorName,
|
||||
this.errCode,
|
||||
this.groupID,
|
||||
this.insurancePolicyNo,
|
||||
this.message,
|
||||
this.patientCardID,
|
||||
this.patientID,
|
||||
this.patientName,
|
||||
this.patientType,
|
||||
this.policyID,
|
||||
this.policyName,
|
||||
this.projectID,
|
||||
this.setupID,
|
||||
this.statusCode,
|
||||
this.subCategoryID,
|
||||
this.subPolicyNo,
|
||||
});
|
||||
|
||||
factory AncillaryOrderProcedureItem.fromJson(Map<String, dynamic> json) => AncillaryOrderProcedureItem(
|
||||
ancillaryOrderProcDetailsList: json['AncillaryOrderProcDetailsList'] != null
|
||||
? List<AncillaryOrderProcDetail>.from(
|
||||
(json['AncillaryOrderProcDetailsList'] as List).map(
|
||||
(x) => AncillaryOrderProcDetail.fromJson(x as Map<String, dynamic>),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
appointmentDate: DateUtil.convertStringToDate(json['AppointmentDate']),
|
||||
appointmentNo: json['AppointmentNo'] as int?,
|
||||
clinicID: json['ClinicID'] as int?,
|
||||
clinicName: json['ClinicName'] as String?,
|
||||
companyID: json['CompanyID'] as int?,
|
||||
companyName: json['CompanyName'] as String?,
|
||||
doctorID: json['DoctorID'] as int?,
|
||||
doctorName: json['DoctorName'] as String?,
|
||||
errCode: json['ErrCode'],
|
||||
groupID: json['GroupID'] as int?,
|
||||
insurancePolicyNo: json['InsurancePolicyNo'] as String?,
|
||||
message: json['Message'] as String?,
|
||||
patientCardID: json['PatientCardID'] as String?,
|
||||
patientID: json['PatientID'] as int?,
|
||||
patientName: json['PatientName'] as String?,
|
||||
patientType: json['PatientType'] as int?,
|
||||
policyID: json['PolicyID'] as int?,
|
||||
policyName: json['PolicyName'] as String?,
|
||||
projectID: json['ProjectID'] as int?,
|
||||
setupID: json['SetupID'] as String?,
|
||||
statusCode: json['StatusCode'] as int?,
|
||||
subCategoryID: json['SubCategoryID'] as int?,
|
||||
subPolicyNo: json['SubPolicyNo'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
class AncillaryOrderProcDetail {
|
||||
int? approvalLineItemNo;
|
||||
int? approvalNo;
|
||||
String? approvalStatus;
|
||||
int? approvalStatusID;
|
||||
num? companyShare;
|
||||
num? companyShareWithTax;
|
||||
num? companyTaxAmount;
|
||||
num? discountAmount;
|
||||
int? discountCategory;
|
||||
String? discountType;
|
||||
num? discountTypeValue;
|
||||
bool? isApprovalCreated;
|
||||
bool? isApprovalRequired;
|
||||
dynamic isCheckInAllow;
|
||||
bool? isCovered;
|
||||
bool? isLab;
|
||||
DateTime? orderDate;
|
||||
int? orderLineItemNo;
|
||||
int? orderNo;
|
||||
int? partnerID;
|
||||
num? partnerShare;
|
||||
String? partnerShareType;
|
||||
num? patientShare;
|
||||
num? patientShareWithTax;
|
||||
num? patientTaxAmount;
|
||||
num? procPrice;
|
||||
int? procedureCategoryID;
|
||||
String? procedureCategoryName;
|
||||
String? procedureID;
|
||||
String? procedureName;
|
||||
num? taxAmount;
|
||||
num? taxPct;
|
||||
|
||||
AncillaryOrderProcDetail({
|
||||
this.approvalLineItemNo,
|
||||
this.approvalNo,
|
||||
this.approvalStatus,
|
||||
this.approvalStatusID,
|
||||
this.companyShare,
|
||||
this.companyShareWithTax,
|
||||
this.companyTaxAmount,
|
||||
this.discountAmount,
|
||||
this.discountCategory,
|
||||
this.discountType,
|
||||
this.discountTypeValue,
|
||||
this.isApprovalCreated,
|
||||
this.isApprovalRequired,
|
||||
this.isCheckInAllow,
|
||||
this.isCovered,
|
||||
this.isLab,
|
||||
this.orderDate,
|
||||
this.orderLineItemNo,
|
||||
this.orderNo,
|
||||
this.partnerID,
|
||||
this.partnerShare,
|
||||
this.partnerShareType,
|
||||
this.patientShare,
|
||||
this.patientShareWithTax,
|
||||
this.patientTaxAmount,
|
||||
this.procPrice,
|
||||
this.procedureCategoryID,
|
||||
this.procedureCategoryName,
|
||||
this.procedureID,
|
||||
this.procedureName,
|
||||
this.taxAmount,
|
||||
this.taxPct,
|
||||
});
|
||||
|
||||
factory AncillaryOrderProcDetail.fromJson(Map<String, dynamic> json) => AncillaryOrderProcDetail(
|
||||
approvalLineItemNo: json['ApprovalLineItemNo'] as int?,
|
||||
approvalNo: json['ApprovalNo'] as int?,
|
||||
approvalStatus: json['ApprovalStatus'] as String?,
|
||||
approvalStatusID: json['ApprovalStatusID'] as int?,
|
||||
companyShare: _toNum(json['CompanyShare']),
|
||||
companyShareWithTax: _toNum(json['CompanyShareWithTax']),
|
||||
companyTaxAmount: _toNum(json['CompanyTaxAmount']),
|
||||
discountAmount: _toNum(json['DiscountAmount']),
|
||||
discountCategory: json['DiscountCategory'] as int?,
|
||||
discountType: json['DiscountType'] as String?,
|
||||
discountTypeValue: _toNum(json['DiscountTypeValue']),
|
||||
isApprovalCreated: json['IsApprovalCreated'] as bool?,
|
||||
isApprovalRequired: json['IsApprovalRequired'] as bool?,
|
||||
isCheckInAllow: json['IsCheckInAllow'],
|
||||
isCovered: json['IsCovered'] as bool?,
|
||||
isLab: json['IsLab'] as bool?,
|
||||
orderDate: DateUtil.convertStringToDate(json['OrderDate']),
|
||||
orderLineItemNo: json['OrderLineItemNo'] as int?,
|
||||
orderNo: json['OrderNo'] as int?,
|
||||
partnerID: json['PartnerID'] as int?,
|
||||
partnerShare: _toNum(json['PartnerShare']),
|
||||
partnerShareType: json['PartnerShareType'] as String?,
|
||||
patientShare: _toNum(json['PatientShare']),
|
||||
patientShareWithTax: _toNum(json['PatientShareWithTax']),
|
||||
patientTaxAmount: _toNum(json['PatientTaxAmount']),
|
||||
procPrice: _toNum(json['ProcPrice']),
|
||||
procedureCategoryID: json['ProcedureCategoryID'] as int?,
|
||||
procedureCategoryName: json['ProcedureCategoryName'] as String?,
|
||||
procedureID: json['ProcedureID'] as String?,
|
||||
procedureName: json['ProcedureName'] as String?,
|
||||
taxAmount: _toNum(json['TaxAmount']),
|
||||
taxPct: _toNum(json['TaxPct']),
|
||||
);
|
||||
}
|
||||
|
||||
// Helper to safely parse numeric fields that may be int/double/string/null
|
||||
num? _toNum(dynamic v) {
|
||||
if (v == null) return null;
|
||||
if (v is num) return v;
|
||||
if (v is String) return num.tryParse(v);
|
||||
return null;
|
||||
}
|
||||
@ -0,0 +1,379 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
||||
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_list_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_procedures_detail_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class TodoSectionRepo {
|
||||
Future<Either<Failure, GenericApiModel<List<AncillaryOrderItem>>>> getOnlineAncillaryOrderList();
|
||||
|
||||
Future<Either<Failure, GenericApiModel<List<AncillaryOrderProcedureItem>>>> getOnlineAncillaryOrderDetailsProceduresList({
|
||||
required int appointmentNoVida,
|
||||
required int orderNo,
|
||||
required int projectID,
|
||||
});
|
||||
|
||||
Future<Either<Failure, dynamic>> checkPaymentStatus({required String transID});
|
||||
|
||||
Future<Either<Failure, dynamic>> createAdvancePayment({
|
||||
required int projectID,
|
||||
required double paymentAmount,
|
||||
required String paymentReference,
|
||||
required String paymentMethodName,
|
||||
required int patientTypeID,
|
||||
required String patientName,
|
||||
required int patientID,
|
||||
required String setupID,
|
||||
required bool isAncillaryOrder,
|
||||
});
|
||||
|
||||
Future<Either<Failure, dynamic>> addAdvancedNumberRequest({
|
||||
required String advanceNumber,
|
||||
required String paymentReference,
|
||||
required int appointmentID,
|
||||
required int patientID,
|
||||
required int patientTypeID,
|
||||
required int patientOutSA,
|
||||
});
|
||||
|
||||
Future<Either<Failure, dynamic>> autoGenerateAncillaryOrdersInvoice({
|
||||
required int orderNo,
|
||||
required int projectID,
|
||||
required int appointmentNo,
|
||||
required List<dynamic> selectedProcedures,
|
||||
required int languageID,
|
||||
});
|
||||
|
||||
Future<Either<Failure, dynamic>> applePayInsertRequest({required dynamic applePayInsertRequest});
|
||||
}
|
||||
|
||||
class TodoSectionRepoImp implements TodoSectionRepo {
|
||||
final ApiClient apiClient;
|
||||
final LoggerService loggerService;
|
||||
|
||||
TodoSectionRepoImp({required this.loggerService, required this.apiClient});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List<AncillaryOrderItem>>>> getOnlineAncillaryOrderList() async {
|
||||
Map<String, dynamic> mapDevice = {};
|
||||
|
||||
try {
|
||||
GenericApiModel<List<AncillaryOrderItem>>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.getOnlineAncillaryOrderList,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
List<AncillaryOrderItem> ancillaryOrders = [];
|
||||
|
||||
// Parse the nested structure
|
||||
if (response['AncillaryOrderList'] != null && response['AncillaryOrderList'] is List) {
|
||||
final groupsList = response['AncillaryOrderList'] as List;
|
||||
|
||||
// Iterate through each group
|
||||
for (var group in groupsList) {
|
||||
if (group is Map<String, dynamic> && group['AncillaryOrderList'] != null) {
|
||||
final ordersList = group['AncillaryOrderList'] as List;
|
||||
final projectName = group['ProjectName'] as String?;
|
||||
final projectID = group['ProjectID'] as int?;
|
||||
|
||||
// Parse each order item in the group
|
||||
for (var orderJson in ordersList) {
|
||||
if (orderJson is Map<String, dynamic>) {
|
||||
ancillaryOrders.add(AncillaryOrderItem.fromJson(orderJson, projectName: projectName, projectID: projectID));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apiResponse = GenericApiModel<List<AncillaryOrderItem>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: errorMessage,
|
||||
data: ancillaryOrders,
|
||||
);
|
||||
} catch (e) {
|
||||
loggerService.logInfo("Error parsing ancillary orders: ${e.toString()}");
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
loggerService.logError("Unknown error in getOnlineAncillaryOrderList: ${e.toString()}");
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List<AncillaryOrderProcedureItem>>>> getOnlineAncillaryOrderDetailsProceduresList({
|
||||
required int appointmentNoVida,
|
||||
required int orderNo,
|
||||
required int projectID,
|
||||
}) async {
|
||||
Map<String, dynamic> mapDevice = {
|
||||
'AppointmentNo_Vida': appointmentNoVida,
|
||||
'OrderNo': orderNo,
|
||||
'ProjectID': projectID,
|
||||
};
|
||||
|
||||
try {
|
||||
GenericApiModel<List<AncillaryOrderProcedureItem>>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.getOnlineAncillaryOrderProcList,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
List<AncillaryOrderProcedureItem> ancillaryOrdersProcedures = [];
|
||||
|
||||
// Parse the flat array structure (NOT nested like AncillaryOrderList)
|
||||
if (response['AncillaryOrderProcList'] != null && response['AncillaryOrderProcList'] is List) {
|
||||
final procList = response['AncillaryOrderProcList'] as List;
|
||||
|
||||
// Parse each procedure item directly
|
||||
for (var procJson in procList) {
|
||||
if (procJson is Map<String, dynamic>) {
|
||||
ancillaryOrdersProcedures.add(AncillaryOrderProcedureItem.fromJson(procJson));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apiResponse = GenericApiModel<List<AncillaryOrderProcedureItem>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: errorMessage,
|
||||
data: ancillaryOrdersProcedures,
|
||||
);
|
||||
} catch (e) {
|
||||
loggerService.logError("Error parsing ancillary Procedures: ${e.toString()}");
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
loggerService.logError("Unknown error in getOnlineAncillaryOrderDetailsProceduresList: ${e.toString()}");
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, dynamic>> checkPaymentStatus({required String transID}) async {
|
||||
Map<String, dynamic> mapDevice = {'ClientRequestID': transID};
|
||||
|
||||
try {
|
||||
dynamic apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.getRequestStatusByRequestID,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
apiResponse = response;
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
return Right(apiResponse);
|
||||
} catch (e) {
|
||||
loggerService.logError("Unknown error in checkPaymentStatus: ${e.toString()}");
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, dynamic>> createAdvancePayment({
|
||||
required int projectID,
|
||||
required double paymentAmount,
|
||||
required String paymentReference,
|
||||
required String paymentMethodName,
|
||||
required int patientTypeID,
|
||||
required String patientName,
|
||||
required int patientID,
|
||||
required String setupID,
|
||||
required bool isAncillaryOrder,
|
||||
}) async {
|
||||
// //VersionID (number)
|
||||
// // Channel (number)
|
||||
// // IPAdress (string)
|
||||
// // generalid (string)
|
||||
// // LanguageID (number)
|
||||
// // Latitude (number)
|
||||
// // Longitude (number)
|
||||
// // DeviceTypeID (number)
|
||||
// // PatientType (number)
|
||||
// // PatientTypeID (number)
|
||||
// // PatientID (number)
|
||||
// // PatientOutSA (number)
|
||||
// // TokenID (string)
|
||||
// // SessionID (string)
|
||||
|
||||
Map<String, dynamic> mapDevice = {
|
||||
'CustName': patientName,
|
||||
'CustID': patientID,
|
||||
'SetupID': setupID,
|
||||
'ProjectID': projectID,
|
||||
'AccountID': patientID,
|
||||
'PaymentAmount': paymentAmount,
|
||||
'NationalityID': null,
|
||||
'DepositorName': patientName,
|
||||
'CreatedBy': 3,
|
||||
'PaymentMethodName': paymentMethodName,
|
||||
'PaymentReference': paymentReference,
|
||||
'PaymentMethod': paymentMethodName,
|
||||
'IsAncillaryOrder': isAncillaryOrder,
|
||||
};
|
||||
|
||||
try {
|
||||
dynamic apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.createAdvancePayments,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
apiResponse = response;
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
return Right(apiResponse);
|
||||
} catch (e) {
|
||||
loggerService.logError("Unknown error in createAdvancePayment: ${e.toString()}");
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, dynamic>> addAdvancedNumberRequest({
|
||||
required String advanceNumber,
|
||||
required String paymentReference,
|
||||
required int appointmentID,
|
||||
required int patientID,
|
||||
required int patientTypeID,
|
||||
required int patientOutSA,
|
||||
}) async {
|
||||
Map<String, dynamic> mapDevice = {
|
||||
'AdvanceNumber': advanceNumber,
|
||||
'PaymentReference': paymentReference,
|
||||
'AppointmentID': appointmentID,
|
||||
'PatientID': patientID,
|
||||
'PatientTypeID': patientTypeID,
|
||||
'PatientOutSA': patientOutSA,
|
||||
};
|
||||
|
||||
try {
|
||||
dynamic apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.addAdvanceNumberRequest,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
apiResponse = response;
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
return Right(apiResponse);
|
||||
} catch (e) {
|
||||
loggerService.logError("Unknown error in addAdvancedNumberRequest: ${e.toString()}");
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, dynamic>> autoGenerateAncillaryOrdersInvoice({
|
||||
required int orderNo,
|
||||
required int projectID,
|
||||
required int appointmentNo,
|
||||
required List<dynamic> selectedProcedures,
|
||||
required int languageID,
|
||||
}) async {
|
||||
// Extract procedure IDs from selectedProcedures
|
||||
List<String> procedureOrderIDs = [];
|
||||
selectedProcedures.forEach((element) {
|
||||
procedureOrderIDs.add(element["ProcedureID"].toString());
|
||||
});
|
||||
|
||||
Map<String, dynamic> mapDevice = {
|
||||
'LanguageID': languageID,
|
||||
'RequestAncillaryOrderInvoice': [
|
||||
{
|
||||
'MemberID': 102,
|
||||
'ProjectID': projectID,
|
||||
'AppointmentNo': appointmentNo,
|
||||
'OrderNo': orderNo,
|
||||
'AncillaryOrderInvoiceProcList': selectedProcedures,
|
||||
}
|
||||
],
|
||||
'ProcedureOrderIds': procedureOrderIDs,
|
||||
};
|
||||
|
||||
try {
|
||||
dynamic apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.autoGenerateAncillaryOrdersInvoice,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
apiResponse = response;
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
return Right(apiResponse);
|
||||
} catch (e) {
|
||||
loggerService.logError("Unknown error in autoGenerateAncillaryOrdersInvoice: ${e.toString()}");
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, dynamic>> applePayInsertRequest({required dynamic applePayInsertRequest}) async {
|
||||
Map<String, dynamic> mapDevice = {
|
||||
'ApplePayInsertRequest': applePayInsertRequest,
|
||||
};
|
||||
|
||||
try {
|
||||
dynamic apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
ApiConsts.applePayInsertRequest,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
apiResponse = response;
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
return Right(apiResponse);
|
||||
} catch (e) {
|
||||
loggerService.logError("Unknown error in applePayInsertRequest: ${e.toString()}");
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,242 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_list_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_procedures_detail_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/todo_section/todo_section_repo.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
|
||||
class TodoSectionViewModel extends ChangeNotifier {
|
||||
TodoSectionRepo todoSectionRepo;
|
||||
ErrorHandlerService errorHandlerService;
|
||||
|
||||
TodoSectionViewModel({required this.todoSectionRepo, required this.errorHandlerService});
|
||||
|
||||
initializeTodoSectionViewModel() async {
|
||||
patientAncillaryOrdersList.clear();
|
||||
isAncillaryOrdersLoading = true;
|
||||
isAncillaryDetailsProceduresLoading = true;
|
||||
await getPatientOnlineAncillaryOrderList();
|
||||
}
|
||||
|
||||
bool isAncillaryOrdersLoading = false;
|
||||
bool isAncillaryDetailsProceduresLoading = false;
|
||||
bool isProcessingPayment = false;
|
||||
List<AncillaryOrderItem> patientAncillaryOrdersList = [];
|
||||
List<AncillaryOrderProcedureItem> patientAncillaryOrderProceduresList = [];
|
||||
|
||||
void setProcessingPayment(bool value) {
|
||||
isProcessingPayment = value;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> getPatientOnlineAncillaryOrderList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
patientAncillaryOrdersList.clear();
|
||||
isAncillaryOrdersLoading = true;
|
||||
notifyListeners();
|
||||
final result = await todoSectionRepo.getOnlineAncillaryOrderList();
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
isAncillaryOrdersLoading = false;
|
||||
await errorHandlerService.handleError(failure: failure);
|
||||
},
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
patientAncillaryOrdersList = apiResponse.data!;
|
||||
isAncillaryOrdersLoading = false;
|
||||
notifyListeners();
|
||||
if (onSuccess != null) {
|
||||
onSuccess(apiResponse);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> getPatientOnlineAncillaryOrderDetailsProceduresList({
|
||||
Function(dynamic)? onSuccess,
|
||||
Function(String)? onError,
|
||||
required int appointmentNoVida,
|
||||
required int orderNo,
|
||||
required int projectID,
|
||||
}) async {
|
||||
isAncillaryDetailsProceduresLoading = true;
|
||||
notifyListeners();
|
||||
|
||||
final result = await todoSectionRepo.getOnlineAncillaryOrderDetailsProceduresList(
|
||||
appointmentNoVida: appointmentNoVida,
|
||||
orderNo: orderNo,
|
||||
projectID: projectID,
|
||||
);
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
isAncillaryDetailsProceduresLoading = false;
|
||||
await errorHandlerService.handleError(failure: failure);
|
||||
},
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
patientAncillaryOrderProceduresList = apiResponse.data!;
|
||||
isAncillaryDetailsProceduresLoading = false;
|
||||
notifyListeners();
|
||||
if (onSuccess != null) {
|
||||
onSuccess(apiResponse);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> checkPaymentStatus({
|
||||
required String transID,
|
||||
Function(dynamic)? onSuccess,
|
||||
Function(String)? onError,
|
||||
}) async {
|
||||
final result = await todoSectionRepo.checkPaymentStatus(transID: transID);
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
await errorHandlerService.handleError(failure: failure);
|
||||
if (onError != null) {
|
||||
onError(failure.toString());
|
||||
}
|
||||
},
|
||||
(response) {
|
||||
if (onSuccess != null) {
|
||||
onSuccess(response);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> createAdvancePayment({
|
||||
required int projectID,
|
||||
required double paymentAmount,
|
||||
required String paymentReference,
|
||||
required String paymentMethodName,
|
||||
required int patientTypeID,
|
||||
required String patientName,
|
||||
required int patientID,
|
||||
required String setupID,
|
||||
required bool isAncillaryOrder,
|
||||
Function(dynamic)? onSuccess,
|
||||
Function(String)? onError,
|
||||
}) async {
|
||||
final result = await todoSectionRepo.createAdvancePayment(
|
||||
projectID: projectID,
|
||||
paymentAmount: paymentAmount,
|
||||
paymentReference: paymentReference,
|
||||
paymentMethodName: paymentMethodName,
|
||||
patientTypeID: patientTypeID,
|
||||
patientName: patientName,
|
||||
patientID: patientID,
|
||||
setupID: setupID,
|
||||
isAncillaryOrder: isAncillaryOrder,
|
||||
);
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
await errorHandlerService.handleError(failure: failure);
|
||||
if (onError != null) {
|
||||
onError(failure.toString());
|
||||
}
|
||||
},
|
||||
(response) {
|
||||
if (onSuccess != null) {
|
||||
onSuccess(response);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> addAdvancedNumberRequest({
|
||||
required String advanceNumber,
|
||||
required String paymentReference,
|
||||
required int appointmentID,
|
||||
required int patientID,
|
||||
required int patientTypeID,
|
||||
required int patientOutSA,
|
||||
Function(dynamic)? onSuccess,
|
||||
Function(String)? onError,
|
||||
}) async {
|
||||
final result = await todoSectionRepo.addAdvancedNumberRequest(
|
||||
advanceNumber: advanceNumber,
|
||||
paymentReference: paymentReference,
|
||||
appointmentID: appointmentID,
|
||||
patientID: patientID,
|
||||
patientTypeID: patientTypeID,
|
||||
patientOutSA: patientOutSA,
|
||||
);
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
await errorHandlerService.handleError(failure: failure);
|
||||
if (onError != null) {
|
||||
onError(failure.toString());
|
||||
}
|
||||
},
|
||||
(response) {
|
||||
if (onSuccess != null) {
|
||||
onSuccess(response);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> autoGenerateAncillaryOrdersInvoice({
|
||||
required int orderNo,
|
||||
required int projectID,
|
||||
required int appointmentNo,
|
||||
required List<dynamic> selectedProcedures,
|
||||
required int languageID,
|
||||
Function(dynamic)? onSuccess,
|
||||
Function(String)? onError,
|
||||
}) async {
|
||||
final result = await todoSectionRepo.autoGenerateAncillaryOrdersInvoice(
|
||||
orderNo: orderNo,
|
||||
projectID: projectID,
|
||||
appointmentNo: appointmentNo,
|
||||
selectedProcedures: selectedProcedures,
|
||||
languageID: languageID,
|
||||
);
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
await errorHandlerService.handleError(failure: failure);
|
||||
if (onError != null) {
|
||||
onError(failure.toString());
|
||||
}
|
||||
},
|
||||
(response) {
|
||||
if (onSuccess != null) {
|
||||
onSuccess(response);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> applePayInsertRequest({
|
||||
required dynamic applePayInsertRequest,
|
||||
Function(dynamic)? onSuccess,
|
||||
Function(String)? onError,
|
||||
}) async {
|
||||
final result = await todoSectionRepo.applePayInsertRequest(applePayInsertRequest: applePayInsertRequest);
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
await errorHandlerService.handleError(failure: failure);
|
||||
if (onError != null) {
|
||||
onError(failure.toString());
|
||||
}
|
||||
},
|
||||
(response) {
|
||||
if (onSuccess != null) {
|
||||
onSuccess(response);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ask_doctor_request_type_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
||||
|
||||
class AskDoctorRequestTypeSelect extends StatelessWidget {
|
||||
AskDoctorRequestTypeSelect({super.key, required this.askDoctorRequestTypeList, required this.myAppointmentsViewModel, required this.patientAppointmentHistoryResponseModel});
|
||||
|
||||
final MyAppointmentsViewModel myAppointmentsViewModel;
|
||||
final PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel;
|
||||
List<AskDocRequestType> askDoctorRequestTypeList = [];
|
||||
int selectedParameterCodeValue = 2;
|
||||
int selectedParameterCode = 0;
|
||||
|
||||
final ValueNotifier<int> requestTypeSelectNotifier = ValueNotifier<int>(0);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
|
||||
child: ListView.builder(
|
||||
itemCount: askDoctorRequestTypeList.length,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.only(top: 8, bottom: 8),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return ValueListenableBuilder<int>(
|
||||
valueListenable: requestTypeSelectNotifier,
|
||||
builder: (context, duration, child) {
|
||||
return Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
listTileTheme: ListTileThemeData(horizontalTitleGap: 4),
|
||||
),
|
||||
child: RadioListTile<int>(
|
||||
title: (askDoctorRequestTypeList[index].description ?? '').toText14(weight: FontWeight.w500),
|
||||
value: index,
|
||||
fillColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return AppColors.primaryRedColor;
|
||||
}
|
||||
return Color(0xffEEEEEE);
|
||||
}),
|
||||
contentPadding: EdgeInsets.only(left: 12.h, right: 12.h),
|
||||
groupValue: selectedParameterCode,
|
||||
onChanged: (int? newValue) {
|
||||
selectedParameterCode = newValue!;
|
||||
selectedParameterCodeValue = askDoctorRequestTypeList[index].parameterCode!;
|
||||
requestTypeSelectNotifier.value = selectedParameterCode;
|
||||
debugPrint(selectedParameterCodeValue.toString());
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomButton(
|
||||
text: LocaleKeys.cancel.tr(),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
backgroundColor: AppColors.primaryRedColor,
|
||||
borderColor: AppColors.primaryRedColor,
|
||||
textColor: AppColors.whiteColor,
|
||||
icon: AppAssets.cancel,
|
||||
iconColor: AppColors.whiteColor,
|
||||
borderRadius: 12.r,
|
||||
iconSize: 14.h,
|
||||
fontSize: 14.f,
|
||||
height: 40.h,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.h),
|
||||
Expanded(
|
||||
child: CustomButton(
|
||||
text: LocaleKeys.confirm.tr(),
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
LoaderBottomSheet.showLoader(loadingText: "Sending Request...");
|
||||
await myAppointmentsViewModel.sendAskDocCallRequest(
|
||||
patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel,
|
||||
requestType: selectedParameterCodeValue.toString(),
|
||||
remarks: "",
|
||||
userMobileNumber: myAppointmentsViewModel.appState.getAuthenticatedUser()!.mobileNumber!,
|
||||
onSuccess: (val) {
|
||||
LoaderBottomSheet.hideLoader();
|
||||
showCommonBottomSheetWithoutHeight(
|
||||
context,
|
||||
child: Utils.getSuccessWidget(loadingText: "Request has been sent successfully, you will be contacted soon.".needTranslation),
|
||||
callBackFunc: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
title: "",
|
||||
isCloseButtonVisible: true,
|
||||
isDismissible: false,
|
||||
isFullScreen: false,
|
||||
);
|
||||
},
|
||||
onError: (errMessage) {
|
||||
LoaderBottomSheet.hideLoader();
|
||||
});
|
||||
},
|
||||
backgroundColor: AppColors.bgGreenColor,
|
||||
borderColor: AppColors.bgGreenColor,
|
||||
textColor: Colors.white,
|
||||
icon: AppAssets.confirm,
|
||||
iconSize: 14.h,
|
||||
borderRadius: 12.r,
|
||||
fontSize: 14.f,
|
||||
height: 40.h,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||||
import 'package:hmg_patient_app_new/core/location_util.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/contact_us/find_us_page.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/contact_us/live_chat_page.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ContactUs extends StatelessWidget {
|
||||
ContactUs({super.key});
|
||||
|
||||
late AppState appState;
|
||||
late ContactUsViewModel contactUsViewModel;
|
||||
late LocationUtils locationUtils;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
appState = getIt.get<AppState>();
|
||||
locationUtils = getIt.get<LocationUtils>();
|
||||
locationUtils.isShowConfirmDialog = true;
|
||||
contactUsViewModel = Provider.of<ContactUsViewModel>(context);
|
||||
return Column(
|
||||
children: [
|
||||
checkInOptionCard(
|
||||
AppAssets.checkin_location_icon,
|
||||
LocaleKeys.findUs.tr(),
|
||||
"View your nearest HMG locations".needTranslation,
|
||||
).onPress(() {
|
||||
locationUtils.getCurrentLocation(onSuccess: (value) {
|
||||
contactUsViewModel.initContactUsViewModel();
|
||||
Navigator.pop(context);
|
||||
Navigator.of(context).push(
|
||||
CustomPageRoute(
|
||||
page: FindUsPage(),
|
||||
),
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 16.h),
|
||||
checkInOptionCard(
|
||||
AppAssets.checkin_location_icon,
|
||||
LocaleKeys.feedback.tr(),
|
||||
"Provide your feedback on our services".needTranslation,
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
checkInOptionCard(
|
||||
AppAssets.checkin_location_icon,
|
||||
LocaleKeys.liveChat.tr(),
|
||||
"Live chat option with HMG".needTranslation,
|
||||
).onPress(() {
|
||||
locationUtils.getCurrentLocation(onSuccess: (value) {
|
||||
Navigator.pop(context);
|
||||
Navigator.of(context).push(
|
||||
CustomPageRoute(
|
||||
page: LiveChatPage(),
|
||||
),
|
||||
);
|
||||
});
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget checkInOptionCard(String icon, String title, String subTitle) {
|
||||
return Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.r,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(icon: icon, width: 40.h, height: 40.h, fit: BoxFit.fill),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
title.toText16(isBold: true, color: AppColors.textColor),
|
||||
subTitle.toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
Transform.flip(
|
||||
flipX: appState.isArabic(),
|
||||
child: Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.forward_arrow_icon_small,
|
||||
iconColor: AppColors.blackColor,
|
||||
width: 18.h,
|
||||
height: 13.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingAll(16.h),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,165 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/medical_file/models/patient_sickleave_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/contact_us/widgets/find_us_item_card.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/medical_file/widgets/patient_sick_leave_card.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class FindUsPage extends StatelessWidget {
|
||||
FindUsPage({super.key});
|
||||
|
||||
late AppState appState;
|
||||
late ContactUsViewModel contactUsViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
contactUsViewModel = Provider.of<ContactUsViewModel>(context);
|
||||
appState = getIt.get<AppState>();
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: CollapsingListView(
|
||||
title: LocaleKeys.location.tr(),
|
||||
child: Consumer<ContactUsViewModel>(builder: (context, contactUsVM, child) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 16.h),
|
||||
contactUsVM.isHMGLocationsListLoading
|
||||
? SizedBox.shrink()
|
||||
: CustomTabBar(
|
||||
activeTextColor: AppColors.primaryRedColor,
|
||||
activeBackgroundColor: AppColors.primaryRedColor.withValues(alpha: .1),
|
||||
tabs: [
|
||||
CustomTabBarModel(null, LocaleKeys.hmgHospitals.tr()),
|
||||
CustomTabBarModel(null, LocaleKeys.pharmaciesList.tr()),
|
||||
],
|
||||
onTabChange: (index) {
|
||||
contactUsVM.setHMGHospitalsListSelected(index == 0);
|
||||
},
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
ListView.separated(
|
||||
padding: EdgeInsets.only(top: 16.h),
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: contactUsVM.isHMGLocationsListLoading
|
||||
? 5
|
||||
: contactUsVM.isHMGHospitalsListSelected
|
||||
? contactUsVM.hmgHospitalsLocationsList.length
|
||||
: contactUsVM.hmgPharmacyLocationsList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return contactUsVM.isHMGLocationsListLoading
|
||||
? Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.h,
|
||||
hasShadow: true,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(14.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.network(
|
||||
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
|
||||
width: 63.h,
|
||||
height: 63.h,
|
||||
fit: BoxFit.cover,
|
||||
).circle(100).toShimmer2(isShow: true),
|
||||
SizedBox(width: 16.h),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
"Dr John Smith".toText16(isBold: true).toShimmer2(isShow: true),
|
||||
SizedBox(height: 8.h),
|
||||
Wrap(
|
||||
direction: Axis.horizontal,
|
||||
spacing: 3.h,
|
||||
runSpacing: 4.h,
|
||||
children: [
|
||||
AppCustomChipWidget(labelText: "").toShimmer2(isShow: true, width: 16.h),
|
||||
AppCustomChipWidget(labelText: "").toShimmer2(isShow: true, width: 16.h),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
).paddingSymmetrical(24.h, 0.h)
|
||||
: contactUsVM.isHMGHospitalsListSelected
|
||||
// ? contactUsVM.hmgHospitalsLocationsList.isNotEmpty
|
||||
? AnimationConfiguration.staggeredList(
|
||||
position: index,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: SlideAnimation(
|
||||
verticalOffset: 100.0,
|
||||
child: FadeInAnimation(
|
||||
child: AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: FindUsItemCard(
|
||||
getHMGLocationsModel: contactUsVM.hmgHospitalsLocationsList[index],
|
||||
),
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
),
|
||||
),
|
||||
)
|
||||
: AnimationConfiguration.staggeredList(
|
||||
position: index,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: SlideAnimation(
|
||||
verticalOffset: 100.0,
|
||||
child: FadeInAnimation(
|
||||
child: AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: FindUsItemCard(
|
||||
getHMGLocationsModel: contactUsVM.hmgPharmacyLocationsList[index],
|
||||
),
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
),
|
||||
),
|
||||
);
|
||||
// : Utils.getNoDataWidget(
|
||||
// context,
|
||||
// noDataText: "No any locations yet.".needTranslation,
|
||||
// );
|
||||
},
|
||||
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
|
||||
),
|
||||
SizedBox(height: 24.h),
|
||||
// FindUsItemCard(),
|
||||
// FindUsItemCard(),
|
||||
// FindUsItemCard(),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||
|
||||
class LiveChatPage extends StatelessWidget {
|
||||
const LiveChatPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CollapsingListView(
|
||||
title: LocaleKeys.liveChat.tr(),
|
||||
child: SingleChildScrollView(),
|
||||
),
|
||||
),
|
||||
Container()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_hmg_locations.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
||||
import 'package:maps_launcher/maps_launcher.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class FindUsItemCard extends StatelessWidget {
|
||||
FindUsItemCard({super.key, required this.getHMGLocationsModel});
|
||||
|
||||
late AppState appState;
|
||||
GetHMGLocationsModel getHMGLocationsModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
appState = getIt.get<AppState>();
|
||||
return DecoratedBox(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.r,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 8.h,
|
||||
children: [hospitalName, distanceInfo],
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingSymmetrical(16.h, 16.h),
|
||||
);
|
||||
}
|
||||
|
||||
Widget get hospitalName => Row(
|
||||
children: [
|
||||
Image.network(
|
||||
getHMGLocationsModel.projectImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
|
||||
width: 40.h,
|
||||
height: 40.h,
|
||||
fit: BoxFit.cover,
|
||||
).circle(100).toShimmer2(isShow: false).paddingOnly(right: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
getHMGLocationsModel.locationName!,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
color: AppColors.blackColor,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
Widget get distanceInfo => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
AppCustomChipWidget(
|
||||
labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km".needTranslation,
|
||||
icon: AppAssets.location_red,
|
||||
iconColor: AppColors.primaryRedColor,
|
||||
backgroundColor: AppColors.secondaryLightRedColor,
|
||||
textColor: AppColors.errorColor,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
AppCustomChipWidget(
|
||||
labelText: "Get Directions".needTranslation,
|
||||
icon: AppAssets.directions_icon,
|
||||
iconColor: AppColors.whiteColor,
|
||||
backgroundColor: AppColors.textColor.withValues(alpha: 0.8),
|
||||
textColor: AppColors.whiteColor,
|
||||
onChipTap: () {
|
||||
MapsLauncher.launchCoordinates(double.parse(getHMGLocationsModel.latitude ?? "0.0"), double.parse(getHMGLocationsModel.longitude ?? "0.0"), getHMGLocationsModel.locationName!);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 4.w),
|
||||
AppCustomChipWidget(
|
||||
labelText: LocaleKeys.callNow.tr(),
|
||||
icon: AppAssets.call_fill,
|
||||
iconColor: AppColors.whiteColor,
|
||||
backgroundColor: AppColors.primaryRedColor.withValues(alpha: 1.0),
|
||||
textColor: AppColors.whiteColor,
|
||||
onChipTap: () {
|
||||
launchUrl(Uri.parse("tel://" + "${getHMGLocationsModel.phoneNumber}"));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||