|
|
|
|
@ -2,13 +2,17 @@ import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices;
|
|
|
|
|
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/date_util.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/doctor_response_mapper.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/authentication/authentication_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_repo.dart';
|
|
|
|
|
@ -34,6 +38,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/
|
|
|
|
|
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_map_screen.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_request_type_select.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/call_ambulance_page.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart';
|
|
|
|
|
@ -44,6 +49,8 @@ import 'package:hmg_patient_app_new/routes/app_routes.dart' show AppRoutes;
|
|
|
|
|
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/expandable_bottom_sheet/model/BottomSheetType.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/order_tracking/order_tracking_state.dart';
|
|
|
|
|
@ -490,8 +497,6 @@ class EmergencyServicesViewModel extends ChangeNotifier {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (transportationOptions.isNotEmpty) return;
|
|
|
|
|
|
|
|
|
|
int? id = appState.getAuthenticatedUser()?.patientId;
|
|
|
|
|
LoaderBottomSheet.showLoader(
|
|
|
|
|
loadingText: "Getting Ambulance Transport Option".needTranslation);
|
|
|
|
|
@ -864,10 +869,10 @@ class EmergencyServicesViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
Future<void> cancelOrder(AmbulanceRequestOrdersModel? order, {bool shouldPop = false}) async {
|
|
|
|
|
dialogService.showCommonBottomSheetWithoutH(
|
|
|
|
|
message: "Do you want to cancel the order".needTranslation,
|
|
|
|
|
message: "Do you want to cancel the request".needTranslation,
|
|
|
|
|
onOkPressed: () async {
|
|
|
|
|
navServices.pop();
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Cancelling Order".needTranslation);
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Cancelling request".needTranslation);
|
|
|
|
|
var response = await emergencyServicesRepo.cancelOrder(order?.iD, appState.getAuthenticatedUser()?.patientId ?? 0);
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
response.fold((failure) => errorHandlerService.handleError(failure: failure), (success) {
|
|
|
|
|
@ -973,10 +978,10 @@ class EmergencyServicesViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
FutureOr<void> cancelRRTOrder(int? orderID, {bool shouldPop = false}) async {
|
|
|
|
|
dialogService.showCommonBottomSheetWithoutH(
|
|
|
|
|
message: "Do you want to cancel the order".needTranslation,
|
|
|
|
|
message: "Do you want to cancel the request".needTranslation,
|
|
|
|
|
onOkPressed: () async {
|
|
|
|
|
navServices.pop();
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Cancelling Order".needTranslation);
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Cancelling request".needTranslation);
|
|
|
|
|
var response = await emergencyServicesRepo.cancelRRTOrder(orderID);
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
response.fold((failure) => errorHandlerService.handleError(failure: failure), (success) {
|
|
|
|
|
@ -1009,9 +1014,35 @@ class EmergencyServicesViewModel extends ChangeNotifier {
|
|
|
|
|
print("the app state is ${appState.isAuthenticated}");
|
|
|
|
|
if (appState.isAuthenticated) {
|
|
|
|
|
if(agreedToTermsAndCondition == false){
|
|
|
|
|
dialogService.showErrorBottomSheet(message: "You Need To Agree To Terms And Conditions".needTranslation);
|
|
|
|
|
dialogService.showErrorBottomSheet(message: "You Need To Agree To Terms And Conditions".needTranslation, onOkPressed: (){
|
|
|
|
|
if(navServices.context == null ) return;
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
navServices.context!,
|
|
|
|
|
padding: EdgeInsets.only(top: 24.h),
|
|
|
|
|
titleWidget: Transform.flip(
|
|
|
|
|
flipX: isArabic,
|
|
|
|
|
child: Utils.buildSvgWithAssets(
|
|
|
|
|
icon: AppAssets.arrow_back,
|
|
|
|
|
iconColor: Color(0xff2B353E),
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
navServices.pop();
|
|
|
|
|
}),
|
|
|
|
|
// title: "Rapid Response Team (RRT)".needTranslation,
|
|
|
|
|
child: RrtRequestTypeSelect(),
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
hasBottomPadding: false,
|
|
|
|
|
backgroundColor: AppColors.bottomSheetBgColor,
|
|
|
|
|
callBackFunc: () {
|
|
|
|
|
navServices.pop();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
placeValueInController();
|
|
|
|
|
locationUtils!.getLocation(
|
|
|
|
|
isShowConfirmDialog: true,
|
|
|
|
|
onSuccess: (position) {
|
|
|
|
|
|