ambulance_listing_and_request
#96
ambulance_listing_and_request into master 4 months ago
@ -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,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,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,54 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_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/presentation/appointments/widgets/appointment_card.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_doctor_card.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/doctor_card.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class AppointmentBottomSheet extends StatelessWidget{
|
||||
|
||||
|
||||
final Function(PatientAppointmentHistoryResponseModel) onAppointmentSelection;
|
||||
final List<PatientAppointmentHistoryResponseModel> list;
|
||||
|
||||
const AppointmentBottomSheet({super.key, required this.onAppointmentSelection, required this.list});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => getAppointList(list);
|
||||
|
||||
Widget getAppointList( List<PatientAppointmentHistoryResponseModel> list) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.only(top: 24.h),
|
||||
shrinkWrap: true,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
PatientAppointmentHistoryResponseModel item = list[index];
|
||||
return AppointmentDoctorCard(
|
||||
renderWidgetForERDisplay: true,
|
||||
patientAppointmentHistoryResponseModel: item,
|
||||
onAskDoctorTap: () {},
|
||||
onCancelTap: () async {},
|
||||
onRescheduleTap: () async {},
|
||||
).onPress((){
|
||||
onAppointmentSelection(item);
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24.h),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,172 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.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/emergency_services/emergency_services_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/emergency_services/models/AmbulanceCallingPlace.dart';
|
||||
import 'package:hmg_patient_app_new/features/emergency_services/models/ambulance_direction.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../../generated/locale_keys.g.dart' show LocaleKeys;
|
||||
|
||||
class PickupLocation extends StatelessWidget {
|
||||
final VoidCallback onTap;
|
||||
const PickupLocation({super.key, required this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
"Select Pickup Direction"
|
||||
.needTranslation
|
||||
.toText24(color: AppColors.textColor,isBold: true),
|
||||
SizedBox(
|
||||
height: 16.h,
|
||||
),
|
||||
"Select Direction"
|
||||
.needTranslation
|
||||
.toText14(color: AppColors.textColor, weight: FontWeight.w600),
|
||||
SizedBox(
|
||||
height: 12.h,
|
||||
),
|
||||
Selector<EmergencyServicesViewModel, AmbulanceCallingPlace>(
|
||||
selector: (context, viewModel) => viewModel.callingPlace,
|
||||
builder: (context, value, _) {
|
||||
return Column(
|
||||
spacing: 12.h,
|
||||
children: [
|
||||
RadioGroup<AmbulanceCallingPlace>(
|
||||
groupValue: value,
|
||||
onChanged: (value) {
|
||||
context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.updateCallingPlace(value);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
spacing: 24.h,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: AmbulanceCallingPlace.TO_HOSPITAL,
|
||||
groupValue: value,
|
||||
activeColor: AppColors.primaryRedColor,
|
||||
|
||||
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor),
|
||||
),
|
||||
"To Hospital"
|
||||
.needTranslation
|
||||
.toText12(color: AppColors.textColor)
|
||||
],
|
||||
).onPress((){
|
||||
context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.updateCallingPlace(AmbulanceCallingPlace.TO_HOSPITAL);
|
||||
}),
|
||||
Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: AmbulanceCallingPlace.FROM_HOSPITAL,
|
||||
activeColor: AppColors.primaryRedColor,
|
||||
|
||||
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor),
|
||||
),
|
||||
"From Hospital"
|
||||
.needTranslation
|
||||
.toText12(color: AppColors.textColor)
|
||||
],
|
||||
).onPress((){
|
||||
context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.updateCallingPlace(AmbulanceCallingPlace.FROM_HOSPITAL);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: value == AmbulanceCallingPlace.TO_HOSPITAL,
|
||||
child: Selector<EmergencyServicesViewModel, AmbulanceDirection>(
|
||||
selector: (context, viewModel) =>
|
||||
viewModel.ambulanceDirection,
|
||||
builder: (context, directionValue, _) {
|
||||
return Column(
|
||||
spacing: 12.h,
|
||||
children: [
|
||||
"Select Way"
|
||||
.needTranslation
|
||||
.toText14(color: AppColors.textColor, weight: FontWeight.w600),
|
||||
RadioGroup<AmbulanceDirection>(
|
||||
groupValue: directionValue,
|
||||
onChanged: (value) {
|
||||
context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.updateDirection(value);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
spacing: 24.h,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: AmbulanceDirection.ONE_WAY,
|
||||
activeColor: AppColors.primaryRedColor,
|
||||
|
||||
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor),
|
||||
),
|
||||
"One Way"
|
||||
.needTranslation
|
||||
.toText12(color: AppColors.textColor)
|
||||
],
|
||||
).onPress((){
|
||||
context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.updateDirection(AmbulanceDirection.ONE_WAY);
|
||||
}),
|
||||
Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: AmbulanceDirection.TWO_WAY,
|
||||
// activeColor: AppColors.primaryRedColor,
|
||||
|
||||
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor),
|
||||
),
|
||||
"Two Way"
|
||||
.needTranslation
|
||||
.toText12(color: AppColors.textColor)
|
||||
],
|
||||
).onPress((){
|
||||
context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.updateDirection(AmbulanceDirection.TWO_WAY);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
SizedBox(
|
||||
height: 16.h,
|
||||
),
|
||||
CustomButton(
|
||||
text: LocaleKeys.confirm.tr(context: context),
|
||||
onPressed: onTap,
|
||||
backgroundColor: AppColors.primaryRedColor,
|
||||
borderColor: AppColors.primaryRedColor,
|
||||
textColor: AppColors.whiteColor,
|
||||
iconColor: AppColors.whiteColor,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.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/emergency_services/emergency_services_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/ambulance_history_item.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ErHistoryListing extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CollapsingListView(
|
||||
title: "History Log".needTranslation,
|
||||
child: SingleChildScrollView(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
child: Column(
|
||||
children: [Visibility(
|
||||
visible: context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.orders
|
||||
?.isNotEmpty == true,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.orders
|
||||
?.length ?? 0,
|
||||
itemBuilder: (_, index) =>
|
||||
Consumer<EmergencyServicesViewModel>( builder: (_, vm, __)=>
|
||||
AmbulanceHistoryItem(order: vm.orders![index]),
|
||||
)
|
||||
),
|
||||
),]
|
||||
).paddingAll(16.h)
|
||||
|
||||
))
|
||||
|
||||
),
|
||||
|
||||
|
||||
Visibility(
|
||||
visible: context
|
||||
.read<EmergencyServicesViewModel>()
|
||||
.orders
|
||||
?.isEmpty == true,
|
||||
child: Utils.getNoDataWidget(context,
|
||||
noDataText: "You don't have any history"
|
||||
.needTranslation)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
||||
|
||||
class RequestStatus extends StatelessWidget {
|
||||
final int status;
|
||||
|
||||
const RequestStatus({super.key, required this.status});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppCustomChipWidget(
|
||||
labelText: getTitle(status),
|
||||
backgroundColor: getBackgroundColor(status),
|
||||
textColor: getTextColor(status),
|
||||
);
|
||||
}
|
||||
|
||||
String? getTitle(int status) {
|
||||
switch (status) {
|
||||
case 1: //pending
|
||||
case 2: //processing
|
||||
return "Under Processing".needTranslation;
|
||||
case 3: //completed
|
||||
return "Completed".needTranslation;
|
||||
break;
|
||||
case 4: //cancel
|
||||
case 6:
|
||||
case 7:
|
||||
return "Canceled by patient".needTranslation;
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Color? getBackgroundColor(int status) {
|
||||
switch (status) {
|
||||
case 1: //pending
|
||||
case 2: //processing
|
||||
case 3: //completed
|
||||
return AppColors.switchBackgroundColor;
|
||||
break;
|
||||
case 4: //cancel
|
||||
case 6:
|
||||
case 7:
|
||||
return AppColors.lightRedButtonColor;
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Color? getTextColor(int status) {
|
||||
switch (status) {
|
||||
case 1: //pending
|
||||
case 2:
|
||||
return AppColors.successColor;//processing
|
||||
case 3: //completed
|
||||
case 4: //cancel
|
||||
case 6:
|
||||
case 7:
|
||||
return AppColors.errorColor;
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/date_util.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/emergency_services/emergency_services_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/AmbulanceRequestOrdersModel.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/RequestStatus.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:provider/provider.dart';
|
||||
|
||||
import '../../../../core/utils/utils.dart';
|
||||
|
||||
|
||||
class AmbulanceHistoryItem extends StatelessWidget {
|
||||
final AmbulanceRequestOrdersModel order;
|
||||
|
||||
const AmbulanceHistoryItem({super.key, required this.order});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DecoratedBox(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: Colors.white,
|
||||
hasShadow: true,
|
||||
customBorder: BorderRadius.all(
|
||||
Radius.circular(20.h),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 8.h,
|
||||
children: [
|
||||
RequestStatus(status: order.statusId ?? 0),
|
||||
"Req ID: ${order.iD}".toText16(color: AppColors.textColor, weight: FontWeight.w600),
|
||||
Row(
|
||||
spacing: 4.w,
|
||||
children: [
|
||||
chip( Utils.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.time)), AppAssets.calendar, AppColors.blackBgColor),
|
||||
chip("Ambulance".needTranslation, AppAssets.ambulance, AppColors.blackBgColor),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(child: chip(order?.dropOffLocation ?? "", (order.dropOffLocation?.toLowerCase().contains("hospital") == true)?AppAssets.hospital:AppAssets.location_pickup, AppColors
|
||||
.blackBgColor),)
|
||||
],
|
||||
),
|
||||
if (order.statusId == 1 || order.statusId == 2)
|
||||
CustomButton(
|
||||
text: "Cancel Request".needTranslation,
|
||||
onPressed: () async {
|
||||
openCancelOrderBottomSheet(context);
|
||||
},
|
||||
backgroundColor: AppColors.primaryRedColor,
|
||||
borderColor: AppColors.primaryRedColor,
|
||||
textColor: Colors.white,
|
||||
icon: AppAssets.cancel,
|
||||
),
|
||||
],
|
||||
).paddingAll(16.h),
|
||||
).paddingOnly(bottom: 16.h);
|
||||
}
|
||||
|
||||
chip(String title, String iconString, Color iconColor) {
|
||||
return AppCustomChipWidget(
|
||||
labelText: title,
|
||||
icon: iconString,
|
||||
iconColor: iconColor,
|
||||
iconSize: 14.h,
|
||||
);
|
||||
}
|
||||
|
||||
openCancelOrderBottomSheet(BuildContext context) {
|
||||
context.read<EmergencyServicesViewModel>().cancelOrder(order);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'
|
||||
show AnimationConfiguration, SlideAnimation, FadeInAnimation;
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.dart';
|
||||
import 'package:hmg_patient_app_new/core/enums.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/debouncer.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/emergency_services/emergency_services_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart';
|
||||
import 'package:hmg_patient_app_new/features/location/PlacePrediction.dart';
|
||||
import 'package:hmg_patient_app_new/features/location/location_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../theme/colors.dart';
|
||||
import '../../appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart';
|
||||
|
||||
class LocationInputBottomSheet extends StatelessWidget {
|
||||
final Debouncer debouncer = Debouncer(milliseconds: 500);
|
||||
|
||||
LocationInputBottomSheet({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextInputWidget(
|
||||
labelText: LocaleKeys.search.tr(),
|
||||
hintText: "Search Location".needTranslation,
|
||||
controller: TextEditingController(),
|
||||
onChange: (value){
|
||||
debouncer.run(() {
|
||||
context.read<LocationViewModel>().updateSearchQuery(value);
|
||||
});
|
||||
},
|
||||
isEnable: true,
|
||||
prefix: null,
|
||||
autoFocus: false,
|
||||
isBorderAllowed: false,
|
||||
keyboardType: TextInputType.text,
|
||||
isAllowLeadingIcon: true,
|
||||
selectionType: SelectionTypeEnum.search,
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.h,
|
||||
horizontal: 15.h,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24.h),
|
||||
Selector<LocationViewModel, List<PlacePrediction>>(
|
||||
selector: (_, vm) => vm.predictions ?? <PlacePrediction>[],
|
||||
builder: (context, predictions, _) {
|
||||
if (predictions.isEmpty) return SizedBox.shrink();
|
||||
return Expanded(
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (_,__)=>SizedBox(height: 16.h,),
|
||||
itemCount: predictions.length,
|
||||
itemBuilder: (_, index) {
|
||||
final prediction = predictions[index];
|
||||
|
||||
return 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: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: prediction.description.toText14(
|
||||
color: AppColors.textColor,
|
||||
weight: FontWeight.w500),
|
||||
),
|
||||
|
||||
Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.forward_arrow_icon_small,
|
||||
iconColor: AppColors.blackColor,
|
||||
width: 20.h,
|
||||
height: 15.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
],
|
||||
).paddingAll(24.h),),
|
||||
),
|
||||
),
|
||||
).onPress(() async {
|
||||
await context.read<LocationViewModel>().selectPlacePrediction(prediction);
|
||||
Navigator.of(context).pop();
|
||||
var location = context.read<LocationViewModel>().placeDetails;
|
||||
if(location != null) {
|
||||
context.read<EmergencyServicesViewModel>().moveController(
|
||||
Location(lat: location.lat, lng: location.lng));
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,41 +1,63 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:huawei_map/huawei_map.dart' ;
|
||||
|
||||
class HMSMap extends StatefulWidget{
|
||||
final CameraPosition currentLocation;
|
||||
final Function(CameraPosition) onCameraMoved;
|
||||
final VoidCallback onCameraIdle;
|
||||
final MapType mapType;
|
||||
final bool compassEnabled;
|
||||
final bool myLocationEnabled;
|
||||
final bool showCenterMarker;
|
||||
final Completer<HuaweiMapController>? inputController;
|
||||
|
||||
HMSMap({super.key, required this.currentLocation ,required this.onCameraMoved, this.mapType = MapType.normal,this.compassEnabled = false, this.myLocationEnabled = true});
|
||||
HMSMap({super.key, required this.currentLocation ,required this.onCameraMoved,required this.onCameraIdle,
|
||||
this.mapType = MapType.normal,this.compassEnabled = false,this.showCenterMarker = false,
|
||||
this.myLocationEnabled = true, this.inputController});
|
||||
|
||||
@override
|
||||
State<HMSMap> createState() => _HMSMapState();
|
||||
}
|
||||
|
||||
class _HMSMapState extends State<HMSMap> {
|
||||
final Completer<HuaweiMapController> _controller = Completer<HuaweiMapController>();
|
||||
Completer<HuaweiMapController>? controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
HuaweiMapInitializer.initializeMap();
|
||||
controller = widget.inputController ?? Completer<HuaweiMapController>();
|
||||
super.initState();
|
||||
}
|
||||
// @override
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
HuaweiMap(
|
||||
mapType: widget.mapType,
|
||||
zoomControlsEnabled: false,
|
||||
myLocationEnabled: widget.myLocationEnabled,
|
||||
compassEnabled: widget.compassEnabled,
|
||||
initialCameraPosition: widget.currentLocation,
|
||||
onCameraMove: (value) => widget.onCameraMoved(value),
|
||||
onMapCreated: (HuaweiMapController controller) {
|
||||
_controller.complete(controller);
|
||||
},
|
||||
);
|
||||
Stack(
|
||||
children: [
|
||||
HuaweiMap(
|
||||
mapType: widget.mapType,
|
||||
zoomControlsEnabled: false,
|
||||
myLocationEnabled: widget.myLocationEnabled,
|
||||
myLocationButtonEnabled: false,
|
||||
compassEnabled: widget.compassEnabled,
|
||||
onCameraIdle:()=> widget.onCameraIdle(),
|
||||
initialCameraPosition: widget.currentLocation,
|
||||
onCameraMove: (value) => widget.onCameraMoved(value),
|
||||
onMapCreated: (HuaweiMapController controller) {
|
||||
this.controller?.complete(controller);
|
||||
},
|
||||
),
|
||||
Visibility(
|
||||
visible: widget.showCenterMarker,
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Utils.buildSvgWithAssets(icon: AppAssets.pin_location, width: 24.w, height: 36.h),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||