From d693850ef403cf0595091a554e7a4711becf34d6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Oct 2025 14:13:31 +0300 Subject: [PATCH] ER services implementation contd. --- assets/images/svg/call_ambulance_icon.svg | 6 + assets/images/svg/nearest_er_icon.svg | 4 + assets/images/svg/rrt_icon.svg | 6 + lib/core/app_assets.dart | 3 + .../medical_file/medical_file_view_model.dart | 5 +- .../book_appointment/select_clinic_page.dart | 13 ++- .../emergency_services_page.dart | 106 ++++++++++++++++++ .../hmg_services/services_page.dart | 25 +++++ lib/presentation/home/landing_page.dart | 1 + lib/presentation/home/navigation_screen.dart | 3 +- .../home/widgets/small_service_card.dart | 8 ++ lib/widgets/appbar/collapsing_list_view.dart | 4 +- 12 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 assets/images/svg/call_ambulance_icon.svg create mode 100644 assets/images/svg/nearest_er_icon.svg create mode 100644 assets/images/svg/rrt_icon.svg create mode 100644 lib/presentation/emergency_services/emergency_services_page.dart create mode 100644 lib/presentation/hmg_services/services_page.dart diff --git a/assets/images/svg/call_ambulance_icon.svg b/assets/images/svg/call_ambulance_icon.svg new file mode 100644 index 0000000..de3bbc2 --- /dev/null +++ b/assets/images/svg/call_ambulance_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/svg/nearest_er_icon.svg b/assets/images/svg/nearest_er_icon.svg new file mode 100644 index 0000000..73637da --- /dev/null +++ b/assets/images/svg/nearest_er_icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/rrt_icon.svg b/assets/images/svg/rrt_icon.svg new file mode 100644 index 0000000..0530487 --- /dev/null +++ b/assets/images/svg/rrt_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart index 1e9eaa4..b675e60 100644 --- a/lib/core/app_assets.dart +++ b/lib/core/app_assets.dart @@ -155,6 +155,9 @@ class AppAssets { static const String switch_user = '$svgBasePath/switch_user.svg'; static const String activeCheck = '$svgBasePath/active-check.svg'; static const String deleteIcon = '$svgBasePath/delete_icon.svg'; + static const String call_ambulance_icon = '$svgBasePath/call_ambulance_icon.svg'; + static const String nearest_er_icon = '$svgBasePath/nearest_er_icon.svg'; + static const String rrt_icon = '$svgBasePath/rrt_icon.svg'; //bottom navigation// static const String homeBottom = '$svgBasePath/home_bottom.svg'; diff --git a/lib/features/medical_file/medical_file_view_model.dart b/lib/features/medical_file/medical_file_view_model.dart index db2d7fe..4b5a14c 100644 --- a/lib/features/medical_file/medical_file_view_model.dart +++ b/lib/features/medical_file/medical_file_view_model.dart @@ -382,7 +382,10 @@ class MedicalFileViewModel extends ChangeNotifier { final result = await medicalFileRepo.getAllPendingRecordsByResponseId(request: {'ResponseID': appState.getAuthenticatedUser()!.patientId ?? "0", "Status": 2}); result.fold( - (failure) async => await errorHandlerService.handleError(failure: failure), + // (failure) async => await errorHandlerService.handleError(failure: failure), + (failure) async { + log("Error in fetching pending family files: ${failure.message}"); + }, (apiResponse) { if (apiResponse.messageStatus == 2) { // _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {}); diff --git a/lib/presentation/book_appointment/select_clinic_page.dart b/lib/presentation/book_appointment/select_clinic_page.dart index f5e534e..5e5c79b 100644 --- a/lib/presentation/book_appointment/select_clinic_page.dart +++ b/lib/presentation/book_appointment/select_clinic_page.dart @@ -303,7 +303,12 @@ class _SelectClinicPageState extends State { id = regionalViewModel.selectedHospital?.patientDoctorAppointmentList?.first.projectID?.toString() ?? ""; } if (bookAppointmentsViewModel.selectedClinic.clinicID == 17) { - if (!appState.isAuthenticated) { + + if (appState.isAuthenticated) { + initDentalAppointmentBookingFlow(int.parse(bookAppointmentsViewModel + .currentlySelectedHospitalFromRegionFlow ?? + "0")); + }else { bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true); } } @@ -459,7 +464,11 @@ class _SelectClinicPageState extends State { isCloseButtonVisible: true, ); } else { - // Navigate to Chief Complaint Screen + Navigator.of(context).push( + CustomPageRoute( + page: DentalChiefComplaintsPage(), + ), + ); } }); } diff --git a/lib/presentation/emergency_services/emergency_services_page.dart b/lib/presentation/emergency_services/emergency_services_page.dart new file mode 100644 index 0000000..bae1e6c --- /dev/null +++ b/lib/presentation/emergency_services/emergency_services_page.dart @@ -0,0 +1,106 @@ +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/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; + +class EmergencyServicesPage extends StatelessWidget { + const EmergencyServicesPage({super.key}); + + @override + Widget build(BuildContext context) { + return CollapsingListView( + title: "Emergency Services", + requests: () {}, + child: Padding( + padding: EdgeInsets.all(24.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(16.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: false, + ), + child: Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.call_ambulance_icon, width: 40.h, height: 40.h), + SizedBox(width: 12.h), + Expanded( + child: Column( + 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), + ], + ), + ), + SizedBox(width: 12.h), + Utils.buildSvgWithAssets(icon: AppAssets.forward_chevron_icon, width: 13.h, height: 13.h), + ], + ), + ), + 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.nearest_er_icon, width: 40.h, height: 40.h), + SizedBox(width: 12.h), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Nearest ER Location".needTranslation.toText16(isBold: true, color: AppColors.blackColor), + "Get the details of nearest branch including directions".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), + ], + ), + ), + 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: [ + "Rapid Response Team (RRT)".toText16(isBold: true, color: AppColors.blackColor), + "Comprehensive medical service for all sorts of urgent and stable cases".toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), + ], + ), + ), + SizedBox(width: 12.h), + Utils.buildSvgWithAssets(icon: AppAssets.forward_chevron_icon, width: 13.h, height: 13.h), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/presentation/hmg_services/services_page.dart b/lib/presentation/hmg_services/services_page.dart new file mode 100644 index 0000000..f79aae0 --- /dev/null +++ b/lib/presentation/hmg_services/services_page.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.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/widgets/appbar/collapsing_list_view.dart'; + +class ServicesPage extends StatelessWidget { + const ServicesPage({super.key}); + + @override + Widget build(BuildContext context) { + return CollapsingListView( + title: "Explore Services".needTranslation, + isLeading: false, + child: Padding( + padding: EdgeInsets.all(24.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Medical & Care Services".needTranslation.toText18(isBold: true) + ], + ), + ), + ); + } +} diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 7de153f..f9665b9 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -436,6 +436,7 @@ class _LandingPageState extends State { horizontalOffset: 100.0, child: FadeInAnimation( child: SmallServiceCard( + serviceName: LandingPageData.getNotLoggedInServiceCardsList[index].serviceName, icon: LandingPageData.getNotLoggedInServiceCardsList[index].icon, title: LandingPageData.getNotLoggedInServiceCardsList[index].title, subtitle: LandingPageData.getNotLoggedInServiceCardsList[index].subtitle, diff --git a/lib/presentation/home/navigation_screen.dart b/lib/presentation/home/navigation_screen.dart index 6b33b2f..c2bfae7 100644 --- a/lib/presentation/home/navigation_screen.dart +++ b/lib/presentation/home/navigation_screen.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.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/presentation/book_appointment/book_appointment_page.dart'; +import 'package:hmg_patient_app_new/presentation/hmg_services/services_page.dart'; import 'package:hmg_patient_app_new/presentation/home/landing_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; import 'package:hmg_patient_app_new/widgets/bottom_navigation/bottom_navigation.dart'; @@ -30,7 +31,7 @@ class _LandingNavigationState extends State { appState.isAuthenticated ? MedicalFilePage() : /* need add feedback page */ const LandingPage(), BookAppointmentPage(), const LandingPage(), - appState.isAuthenticated ? /* need add news page */ LandingPage() : const LandingPage(), + appState.isAuthenticated ? /* need add news page */ ServicesPage() : const LandingPage(), ], ), bottomNavigationBar: BottomNavigation( diff --git a/lib/presentation/home/widgets/small_service_card.dart b/lib/presentation/home/widgets/small_service_card.dart index 416ed9a..ee5fcca 100644 --- a/lib/presentation/home/widgets/small_service_card.dart +++ b/lib/presentation/home/widgets/small_service_card.dart @@ -3,6 +3,7 @@ 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/presentation/appointments/my_doctors_page.dart'; +import 'package:hmg_patient_app_new/presentation/emergency_services/emergency_services_page.dart'; import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_orders_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/patient_sickleaves_list_page.dart'; @@ -104,6 +105,13 @@ class SmallServiceCard extends StatelessWidget { ), ); break; + case "emergency": + Navigator.of(context).push( + CustomPageRoute( + page: EmergencyServicesPage(), + ), + ); + break; default: // Handle unknown service break; diff --git a/lib/widgets/appbar/collapsing_list_view.dart b/lib/widgets/appbar/collapsing_list_view.dart index e889346..d4f89cc 100644 --- a/lib/widgets/appbar/collapsing_list_view.dart +++ b/lib/widgets/appbar/collapsing_list_view.dart @@ -22,13 +22,14 @@ class CollapsingListView extends StatelessWidget { VoidCallback? logout; VoidCallback? history; VoidCallback? instructions; + VoidCallback? requests; Widget? bottomChild; Widget? trailing; bool isClose; bool isLeading; CollapsingListView( - {required this.title, this.child, this.search, this.isClose = false, this.bottomChild, this.report, this.logout, this.history, this.instructions, this.isLeading = true, this.trailing}); + {required this.title, this.child, this.search, this.isClose = false, this.bottomChild, this.report, this.logout, this.history, this.instructions, this.requests, this.isLeading = true, this.trailing}); @override Widget build(BuildContext context) { @@ -101,6 +102,7 @@ class CollapsingListView extends StatelessWidget { if (report != null) actionButton(context, t, title: "Report".needTranslation, icon: AppAssets.report_icon).onPress(report!), if (history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(history!), if (instructions != null) actionButton(context, t, title: "Instructions".needTranslation, icon: AppAssets.requests).onPress(instructions!), + if (requests != null) actionButton(context, t, title: "Requests".needTranslation, icon: AppAssets.insurance_history_icon).onPress(requests!), if (search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(search!).paddingOnly(right: 24), if (trailing != null) trailing!, ],