ER Online CheckIn implementation contd.

pull/92/head
haroon amjad 3 weeks ago
parent f280d4a28a
commit 60bd9ee55a

@ -18,6 +18,8 @@ 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/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/doctor_list_api_response.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
@ -804,6 +806,22 @@ class Utils {
return file.path;
}
///method to be used to get the text as per the langauge of the application
static String getTextWRTCurrentLanguage(String? englishText, String? arabicText) {
String? text = appState.isArabic() ? arabicText : englishText;
return text ?? '';
}
static String formatNumberToInternationalFormat(num number, {String? currencySymbol, int decimalDigit = 0}) {
return NumberFormat.currency(locale: 'en_US', symbol: currencySymbol ?? "", decimalDigits: decimalDigit).format(number);
}
static PatientDoctorAppointmentList? convertToPatientDoctorAppointmentList(HospitalsModel? hospital) {
if (hospital == null) return null;
return PatientDoctorAppointmentList(
filterName: hospital.name, distanceInKMs: hospital.distanceInKilometers?.toString(), projectTopName: hospital.name, projectBottomName: hospital.name, model: hospital, isHMC: hospital.isHMC);
}
static bool havePrivilege(int id) {
bool isHavePrivilege = false;
try {

@ -5,12 +5,17 @@ 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/emergency_services/model/resp_model/ProjectAvgERWaitingTime.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_models/rrt_procedures_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class EmergencyServicesRepo {
Future<Either<Failure, GenericApiModel<List<RRTProceduresResponseModel>>>> getRRTProcedures();
Future<Either<Failure, GenericApiModel<List<ProjectAvgERWaitingTime>>>> getNearestEr({int? id, int? projectID});
Future<Either<Failure, GenericApiModel<dynamic>>> checkPatientERAdvanceBalance();
Future<Either<Failure, GenericApiModel<List<HospitalsModel>>>> getProjectList();
}
class EmergencyServicesRepoImp implements EmergencyServicesRepo {
@ -91,4 +96,78 @@ class EmergencyServicesRepoImp implements EmergencyServicesRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> checkPatientERAdvanceBalance() async {
Map<String, dynamic> mapDevice = {"ClinicID": 10};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
CHECK_PATIENT_ER_ADVANCE_BALANCE,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final bool patientHasERBalance = response['BalanceAmount'] > 0;
print(patientHasERBalance);
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: patientHasERBalance,
);
} 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<HospitalsModel>>>> getProjectList() async {
Map<String, dynamic> request = {};
try {
GenericApiModel<List<HospitalsModel>>? apiResponse;
Failure? failure;
await apiClient.post(
GET_PROJECT_LIST,
body: request,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['ListProject'];
final appointmentsList = list.map((item) => HospitalsModel.fromJson(item as Map<String, dynamic>)).toList().cast<HospitalsModel>();
apiResponse = GenericApiModel<List<HospitalsModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: appointmentsList,
);
} 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()));
}
}
}

@ -8,7 +8,10 @@ import 'package:hmg_patient_app_new/core/location_util.dart';
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_repo.dart';
import 'package:hmg_patient_app_new/features/emergency_services/model/resp_model/ProjectAvgERWaitingTime.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_models/rrt_procedures_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.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/nearest_er_page.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
@ -30,8 +33,20 @@ class EmergencyServicesViewModel extends ChangeNotifier {
List<RRTProceduresResponseModel> RRTProceduresList = [];
List<HospitalsModel>? hospitalList;
List<HospitalsModel>? hmgHospitalList;
List<HospitalsModel>? hmcHospitalList;
List<HospitalsModel>? displayList;
HospitalsModel? selectedHospital;
FacilitySelection selectedFacility = FacilitySelection.ALL;
int hmgCount = 0;
int hmcCount = 0;
bool pickupFromInsideTheLocation = true;
late RRTProceduresResponseModel selectedRRTProcedure;
bool patientHasAdvanceERBalance = false;
BottomSheetType bottomSheetType = BottomSheetType.FIXED;
setSelectedRRTProcedure(RRTProceduresResponseModel procedure) {
@ -47,10 +62,9 @@ class EmergencyServicesViewModel extends ChangeNotifier {
required this.appState,
});
get isGMSAvailable
{
return appState.isGMSAvailable;
}
bool get isArabic => appState.isArabic();
get isGMSAvailable => appState.isGMSAvailable;
Future<void> getRRTProcedures({Function(dynamic)? onSuccess, Function(String)? onError}) async {
@ -167,6 +181,75 @@ class EmergencyServicesViewModel extends ChangeNotifier {
//todo handle the camera moved position for HMS devices
}
FutureOr<void> getProjects() async {
// if (hospitalList.isNotEmpty) return;
var response = await emergencyServicesRepo.getProjectList();
response.fold(
(failure) async {},
(apiResponse) async {
List<HospitalsModel>? data = apiResponse.data;
if (data == null) return;
hospitalList = data;
hmgHospitalList = data.where((e) => e.isHMC == false).toList();
hmcHospitalList = data.where((e) => e.isHMC == true).toList();
hmgCount = hmgHospitalList?.length ?? 0;
hmcCount = hmcHospitalList?.length ?? 0;
notifyListeners();
},
);
}
setSelectedFacility(FacilitySelection selection) {
selectedFacility = selection;
notifyListeners();
}
searchHospitals(String query) {
if (query.isEmpty) {
getDisplayList();
return;
}
List<HospitalsModel>? sourceList;
switch (selectedFacility) {
case FacilitySelection.ALL:
sourceList = hospitalList;
break;
case FacilitySelection.HMG:
sourceList = hmgHospitalList;
break;
case FacilitySelection.HMC:
sourceList = hmcHospitalList;
break;
}
displayList = sourceList?.where((hospital) => hospital.name != null && hospital.name!.toLowerCase().contains(query.toLowerCase())).toList();
notifyListeners();
}
getDisplayList() {
switch (selectedFacility) {
case FacilitySelection.ALL:
displayList = hospitalList;
break;
case FacilitySelection.HMG:
displayList = hmgHospitalList;
break;
case FacilitySelection.HMC:
displayList = hmcHospitalList;
break;
}
notifyListeners();
}
void setSelectedHospital(HospitalsModel? hospital) {
selectedHospital = hospital;
notifyListeners();
}
String? getSelectedHospitalName() {
return selectedHospital?.getName(isArabic);
}
void navigateTOAmbulancePage() {
locationUtils!.getLocation(
isShowConfirmDialog: true,
@ -181,14 +264,44 @@ class EmergencyServicesViewModel extends ChangeNotifier {
});
}
void navigateToEROnlineCheckIn() {
navServices.push(
CustomPageRoute(page: ErOnlineCheckinHome()),
);
}
void updateBottomSheetState(BottomSheetType sheetType) {
bottomSheetType = sheetType;
notifyListeners();
}
void setIsGMSAvailable(bool value) {
notifyListeners();
}
Future<void> checkPatientERAdvanceBalance({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await emergencyServicesRepo.checkPatientERAdvanceBalance();
result.fold(
// (failure) async => await errorHandlerService.handleError(failure: failure),
(failure) {
patientHasAdvanceERBalance = false;
if (onSuccess != null) {
onSuccess(failure.message);
}
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
patientHasAdvanceERBalance = false;
} else if (apiResponse.messageStatus == 1) {
patientHasAdvanceERBalance = apiResponse.data;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
}

@ -441,7 +441,26 @@ class CallAmbulancePage extends StatelessWidget {
title:
LocaleKeys.selectHospital.tr(),
context,
child: HospitalBottomSheetBody(),
child: Consumer<EmergencyServicesViewModel>(
builder:(_,vm,__)=> HospitalBottomSheetBody(
displayList: vm.displayList,
onFacilityClicked: (value) {
vm.setSelectedFacility(value);
vm.getDisplayList();
},
onHospitalClicked: (hospital) {
Navigator.pop(context);
vm.setSelectedHospital(hospital);
},
onHospitalSearch: (value) {
vm.searchHospitals(value ?? "");
},
selectedFacility:
vm.selectedFacility,
hmcCount: vm.hmcCount,
hmgCount: vm.hmgCount,
),
),
isFullScreen: false,
isCloseButtonVisible: true,
hasBottomPadding: false,

@ -2,12 +2,17 @@ import 'package:easy_localization/easy_localization.dart'
show tr, StringTranslateExtension;
import 'package:flutter/material.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/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/book_appointments/book_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart' show HospitalsModel;
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/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart';
@ -20,8 +25,25 @@ import 'package:provider/provider.dart';
class HospitalBottomSheetBody extends StatelessWidget {
final TextEditingController searchText = TextEditingController();
final Debouncer debouncer = Debouncer(milliseconds: 500);
HospitalBottomSheetBody({super.key});
final int hmcCount;
final int hmgCount;
final List<HospitalsModel>? displayList;
final FacilitySelection selectedFacility;
final Function(FacilitySelection) onFacilityClicked;
final Function(HospitalsModel) onHospitalClicked;
final Function(String) onHospitalSearch;
HospitalBottomSheetBody(
{super.key,
required this.hmcCount,
required this.hmgCount,
this.displayList,
required this.selectedFacility,
required this.onFacilityClicked,
required this.onHospitalClicked,
required this.onHospitalSearch});
@override
Widget build(BuildContext context) {
@ -29,13 +51,14 @@ class HospitalBottomSheetBody extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextInputWidget(
labelText: LocaleKeys.search.tr(),
hintText: LocaleKeys.searchHospital.tr(),
controller: searchText,
onChange: (value) {
debouncer.run(() {
onHospitalSearch(value ?? "");
});
},
isEnable: true,
prefix: null,
@ -51,30 +74,31 @@ class HospitalBottomSheetBody extends StatelessWidget {
),
SizedBox(height: 24.h),
TypeSelectionWidget(
hmcCount: "0",
hmgCount: "0",
selectedFacility: selectedFacility,
hmcCount: hmcCount.toString(),
hmgCount: hmgCount.toString(),
onitemClicked: (selectedValue){
onFacilityClicked(selectedValue);
},
),
SizedBox(height: 21.h),
SizedBox(
height: MediaQuery.sizeOf(context).height * .4,
child: ListView.separated(
height: MediaQuery.sizeOf(context).height * .4,
child: ListView.separated(
itemBuilder: (_, index)
{
var hospital = null;
var hospital = displayList?[index];
return HospitalListItem(
hospitalData: hospital,
isLocationEnabled: false,
).onPress(() {
hospitalData: Utils.convertToPatientDoctorAppointmentList(hospital),
isLocationEnabled: true,
).onPress(() {
onHospitalClicked(hospital!);
});},
separatorBuilder: (_, __) => SizedBox(
height: 16.h,
),
itemCount: 0,
))
height: 16.h,
),
itemCount: displayList?.length ?? 0,
))
],
);
}

@ -12,10 +12,15 @@ import 'package:provider/provider.dart' show Consumer;
class TypeSelectionWidget extends StatelessWidget {
final String hmcCount;
final String hmgCount;
final Function(String) onitemClicked;
final FacilitySelection selectedFacility;
final Function(FacilitySelection) onitemClicked;
const TypeSelectionWidget(
{super.key, required this.hmcCount, required this.hmgCount, required this.onitemClicked});
{super.key,
required this.hmcCount,
required this.hmgCount,
required this.onitemClicked,
required this.selectedFacility});
@override
Widget build(BuildContext context) {
@ -28,51 +33,69 @@ class TypeSelectionWidget extends StatelessWidget {
labelText: "All Facilities".needTranslation,
shape: RoundedRectangleBorder(
side: BorderSide(
color: AppColors.errorColor
,
color: selectedFacility == FacilitySelection.ALL
? AppColors.errorColor
: AppColors.chipBorderColorOpacity20,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
backgroundColor:
AppColors.secondaryLightRedColor
,
textColor: AppColors.errorColor
,
selectedFacility == FacilitySelection.ALL
?AppColors.secondaryLightRedColor: AppColors.whiteColor,
textColor: selectedFacility == FacilitySelection.ALL
? AppColors.errorColor:AppColors.blackColor
,
).onPress((){
onitemClicked(FacilitySelection.ALL.name);
}),
AppCustomChipWidget(
icon: AppAssets.hmg,
iconHasColor: false,
labelText: "Hospitals".needTranslation,
shape: RoundedRectangleBorder(
side: BorderSide(
color: AppColors.chipBorderColorOpacity20,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
backgroundColor:
AppColors.whiteColor,
textColor: AppColors.blackColor,
).onPress((){
onitemClicked(FacilitySelection.HMG.name);
}),
AppCustomChipWidget(
icon: AppAssets.hmc,
iconHasColor: false,
labelText: "Medical Centers".needTranslation,
shape: RoundedRectangleBorder(
side: BorderSide(
color:AppColors.chipBorderColorOpacity20,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
backgroundColor:
AppColors.whiteColor,
textColor: AppColors.blackColor,
).onPress((){
onitemClicked(FacilitySelection.HMC.name);
onitemClicked(FacilitySelection.ALL);
}),
Visibility(
visible: hmgCount != "0",
child: AppCustomChipWidget(
icon: AppAssets.hmg,
iconHasColor: false,
labelText: "Hospitals".needTranslation,
shape: RoundedRectangleBorder(
side: BorderSide(
color: selectedFacility == FacilitySelection.HMG
? AppColors.errorColor
: AppColors.chipBorderColorOpacity20,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
backgroundColor:
selectedFacility == FacilitySelection.HMG
?AppColors.secondaryLightRedColor: AppColors.whiteColor,
textColor: selectedFacility == FacilitySelection.HMG
? AppColors.errorColor
: AppColors.blackColor,
).onPress((){
onitemClicked(FacilitySelection.HMG);
}),
),
Visibility(
visible: hmcCount != "0",
child: AppCustomChipWidget(
icon: AppAssets.hmc,
iconHasColor: false,
labelText: "Medical Centers".needTranslation,
shape: RoundedRectangleBorder(
side: BorderSide(
color: selectedFacility == FacilitySelection.HMC
? AppColors.errorColor
: AppColors.chipBorderColorOpacity20,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
backgroundColor:
selectedFacility == FacilitySelection.HMC
?AppColors.secondaryLightRedColor: AppColors.whiteColor,
textColor: selectedFacility == FacilitySelection.HMC
? AppColors.errorColor
: AppColors.blackColor,
).onPress((){
onitemClicked(FacilitySelection.HMC);
}),
),
],
);
}

@ -34,7 +34,7 @@ class EmergencyServicesPage extends StatelessWidget {
locationUtils = getIt.get<LocationUtils>();
locationUtils!.isShowConfirmDialog = true;
return CollapsingListView(
title: "Emergency Services".needTranslation,
title: LocaleKeys.emergencyServices.tr(),
requests: () {},
child: Padding(
padding: EdgeInsets.all(24.h),
@ -57,7 +57,7 @@ class EmergencyServicesPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Call Ambulance".needTranslation.toText16(isBold: true, color: AppColors.blackColor),
"Request and ambulance in emergency from home or hospital".needTranslation.toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500),
"Request an ambulance in emergency from home or hospital".needTranslation.toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500),
],
),
),
@ -101,8 +101,7 @@ class EmergencyServicesPage extends StatelessWidget {
height: 120.h,
fit: BoxFit.contain),
SizedBox(height: 8.h),
"Confirmation".needTranslation.toText28(
color: AppColors.whiteColor, isBold: true),
LocaleKeys.confirm.tr().toText28(color: AppColors.whiteColor, isBold: true),
SizedBox(height: 8.h),
"Are you sure you want to call an ambulance?"
.needTranslation
@ -234,7 +233,7 @@ class EmergencyServicesPage extends StatelessWidget {
),
Lottie.asset(AppAnimations.ambulance_alert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain),
SizedBox(height: 8.h),
"Confirmation".needTranslation.toText28(color: AppColors.whiteColor, isBold: true),
LocaleKeys.confirm.tr().toText28(color: AppColors.whiteColor, isBold: true),
SizedBox(height: 8.h),
"Are you sure you want to call Rapid Response Team (RRT)?".needTranslation.toText14(color: AppColors.whiteColor, weight: FontWeight.w500),
SizedBox(height: 24.h),
@ -257,7 +256,93 @@ class EmergencyServicesPage extends StatelessWidget {
callBackFunc: () {},
);
});
},
backgroundColor: AppColors.whiteColor,
borderColor: AppColors.whiteColor,
textColor: AppColors.primaryRedColor,
icon: AppAssets.checkmark_icon,
iconColor: AppColors.primaryRedColor,
),
SizedBox(height: 8.h),
],
),
),
),
isFullScreen: false,
isCloseButtonVisible: false,
hasBottomPadding: false,
backgroundColor: AppColors.primaryRedColor,
callBackFunc: () {},
);
}),
),
SizedBox(height: 16.h),
Container(
padding: EdgeInsets.all(16.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: false,
),
child: Row(
children: [
Utils.buildSvgWithAssets(icon: AppAssets.rrt_icon, width: 40.h, height: 40.h),
SizedBox(width: 12.h),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Emergency Check-In".needTranslation.toText16(isBold: true, color: AppColors.blackColor),
"Prior ER Check-In to skip the line & payment at the reception.".needTranslation.toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500),
],
),
),
SizedBox(width: 12.h),
Utils.buildSvgWithAssets(icon: AppAssets.forward_chevron_icon, width: 13.h, height: 13.h),
],
).onPress(() {
showCommonBottomSheetWithoutHeight(
context,
child: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.primaryRedColor,
borderRadius: 24.h,
),
child: Padding(
padding: EdgeInsets.all(24.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
"".toText14(),
Utils.buildSvgWithAssets(
icon: AppAssets.cancel_circle_icon,
iconColor: AppColors.whiteColor,
width: 24.h,
height: 24.h,
fit: BoxFit.contain,
).onPress(() {
Navigator.of(context).pop();
}),
],
),
Lottie.asset(AppAnimations.ambulance_alert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain),
SizedBox(height: 8.h),
LocaleKeys.confirm.tr().toText28(color: AppColors.whiteColor, isBold: true),
SizedBox(height: 8.h),
"Are you sure you want to make ER Check-In?".needTranslation.toText14(color: AppColors.whiteColor, weight: FontWeight.w500),
SizedBox(height: 24.h),
CustomButton(
text: LocaleKeys.confirm.tr(context: context),
onPressed: () async {
Navigator.of(context).pop();
LoaderBottomSheet.showLoader(loadingText: "Checking your ER Appointment status...".needTranslation);
await context.read<EmergencyServicesViewModel>().checkPatientERAdvanceBalance(onSuccess: (dynamic response) {
LoaderBottomSheet.hideLoader();
context.read<EmergencyServicesViewModel>().navigateToEROnlineCheckIn();
});
},
backgroundColor: AppColors.whiteColor,
borderColor: AppColors.whiteColor,

@ -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/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/emergency_services/emergency_services_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/appbar/collapsing_list_view.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';
import 'package:provider/provider.dart';
import '../call_ambulance/widgets/HospitalBottomSheetBody.dart';
class ErOnlineCheckinHome extends StatelessWidget {
const ErOnlineCheckinHome({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.bgScaffoldColor,
body: Column(
children: [
Expanded(
child: CollapsingListView(
title: "Emergency Check-In".needTranslation,
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(24.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Utils.buildSvgWithAssets(icon: AppAssets.immediate_service_icon, width: 58.h, height: 58.h),
SizedBox(width: 18.h),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Online Check-In".needTranslation.toText18(color: AppColors.textColor, isBold: true),
"This service lets patients to register their ER appointment prior to arrival.".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500),
],
),
),
],
),
],
),
),
),
),
),
CustomButton(
text: "Book Appointment".needTranslation,
onPressed: () async {
LoaderBottomSheet.showLoader(loadingText: "Fetching hospitals list...".needTranslation);
await context.read<EmergencyServicesViewModel>().getProjects();
LoaderBottomSheet.hideLoader();
//Project Selection Dropdown
showHospitalBottomSheet(context);
},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor,
fontSize: 16.f,
fontWeight: FontWeight.w500,
borderRadius: 10.r,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 50.h,
icon: AppAssets.bookAppoBottom,
iconColor: AppColors.whiteColor,
iconSize: 18.h,
).paddingSymmetrical(24.h, 24.h),
],
),
);
}
showHospitalBottomSheet(BuildContext context) {
showCommonBottomSheetWithoutHeight(
title: LocaleKeys.selectHospital.tr(),
context,
child: Consumer<EmergencyServicesViewModel>(
builder: (_, vm, __) => HospitalBottomSheetBody(
displayList: vm.displayList,
onFacilityClicked: (value) {
vm.setSelectedFacility(value);
vm.getDisplayList();
},
onHospitalClicked: (hospital) {
Navigator.pop(context);
vm.setSelectedHospital(hospital);
},
onHospitalSearch: (value) {
vm.searchHospitals(value ?? "");
},
selectedFacility: vm.selectedFacility,
hmcCount: vm.hmcCount,
hmgCount: vm.hmgCount,
),
),
isFullScreen: false,
isCloseButtonVisible: true,
hasBottomPadding: false,
backgroundColor: AppColors.bottomSheetBgColor,
callBackFunc: () {},
);
}
}
Loading…
Cancel
Save