From ae4c287af2562a1d72f43af111de45e91db449ec Mon Sep 17 00:00:00 2001 From: Syed Taha Alam Date: Thu, 10 Apr 2025 14:09:20 +0300 Subject: [PATCH] new ui integrated. --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 4 + .../Appointments/DoctorListResponse.dart | 2 + .../components/search_by_hospital_name.dart | 3 +- .../search_result/ResultByDoctors.dart | 76 +++ .../search_result/ResultByFacility.dart | 124 ++++ .../search_result/ResultByHospital.dart | 225 +++++++ .../search_result/ResultByRegion.dart | 145 +++++ .../search_result/SearchResultWithTab.dart | 590 ++++++++++++++++++ lib/pages/conference/zoom/call_screen.dart | 2 +- lib/pages/login/register_new.dart | 7 - .../doctor_response_mapper.dart | 4 + lib/uitl/app_toast.dart | 2 +- lib/uitl/translations_delegate_base.dart | 4 + 14 files changed, 1180 insertions(+), 12 deletions(-) create mode 100644 lib/pages/BookAppointment/search_result/ResultByDoctors.dart create mode 100644 lib/pages/BookAppointment/search_result/ResultByFacility.dart create mode 100644 lib/pages/BookAppointment/search_result/ResultByHospital.dart create mode 100644 lib/pages/BookAppointment/search_result/ResultByRegion.dart create mode 100644 lib/pages/BookAppointment/search_result/SearchResultWithTab.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 25c4bf73..f687899b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -22,12 +22,12 @@ var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidamergeuat.cloudsolutions.com.sa/'; -// var BASE_URL = 'https://webservices.hmg.com/'; +var BASE_URL = 'https://webservices.hmg.com/'; // var BASE_URL = 'http://10.50.100.198:4422/'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 90747ef8..ceb94c73 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -2141,6 +2141,10 @@ const Map localizedValues = { "download": {"en": "Download", "ar": "تحميل"}, "share": {"en": "Share", "ar": "يشارك"}, + "nearest": {"en": "Nearest", "ar": "الأقرب"}, + "selectRegion": {"en": "Select Region", "ar": "اختر المنطقة"}, + "selectFacitlity": {"en": "Select Facility", "ar": "اختر المنشأة"}, + "selectDoctor": {"en": "Select Doctor", "ar": "اختر الطبيب"}, "hmgHospital": {"en": "HMG Hospital", "ar": "مستشفى HMG"}, "hmcHospital": {"en": "HMC", "ar": "HMC"}, "hmcHospitalCount": {"en": "@ HMC", "ar": "@ HMC"}, diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index cf9a5ea7..70576a40 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -255,6 +255,8 @@ class PatientDoctorAppointmentListByRegion { int hmcSize = 0; int hmgSize = 0; num distance = double.infinity; + num hmgDistance = double.infinity; + num hmcDistance = double.infinity; } class RegionList { diff --git a/lib/pages/BookAppointment/components/search_by_hospital_name.dart b/lib/pages/BookAppointment/components/search_by_hospital_name.dart index df220441..eb9bd9e5 100644 --- a/lib/pages/BookAppointment/components/search_by_hospital_name.dart +++ b/lib/pages/BookAppointment/components/search_by_hospital_name.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResultsByRegion.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/LaserClinic.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/SearchResultWithTab.dart'; import 'package:diplomaticquarterapp/services/appointment_services/doctor_response_mapper.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; @@ -450,7 +451,7 @@ class _SearchByHospitalState extends State { Navigator.push( context, FadePage( - page: SearchResultsByRegion( + page: SearchResultWithTab( doctorsList: [], patientDoctorAppointmentListHospital: regionHospitalList, isLiveCareAppointment: false, diff --git a/lib/pages/BookAppointment/search_result/ResultByDoctors.dart b/lib/pages/BookAppointment/search_result/ResultByDoctors.dart new file mode 100644 index 00000000..6ca315c5 --- /dev/null +++ b/lib/pages/BookAppointment/search_result/ResultByDoctors.dart @@ -0,0 +1,76 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +class ResultByDoctor extends StatelessWidget { + List doctorsList = []; + List? patientDoctorAppointmentListHospital; + Function(int) onDoctorSelected; + final bool isLiveCareAppointment; + final bool isObGyneAppointment; + final bool isDoctorNameSearch; + final bool isDoctorSearchResult; + final OBGyneProcedureListResponse? obGyneProcedureListResponse; + ResultByDoctor( + {required this.doctorsList, + required this.patientDoctorAppointmentListHospital, + required this.onDoctorSelected, + required this.isLiveCareAppointment, + required this.isObGyneAppointment, + required this.isDoctorNameSearch, + required this.isDoctorSearchResult, + this.obGyneProcedureListResponse, + }); + + @override + Widget build(BuildContext context) { + return SizedBox( + child: patientDoctorAppointmentListHospital?.isNotEmpty == + true + ? ListView.separated( + addAutomaticKeepAlives: true, + physics: BouncingScrollPhysics(), + separatorBuilder: (context, index) { + return Material( + color: Color(0xFFf5f5f5), + child: SizedBox( + height: 12, + ), + ); + }, + itemBuilder: (context, index) { + final doctor = patientDoctorAppointmentListHospital![index]; + + return DoctorView( + doctor: doctor, + isLiveCareAppointment: isLiveCareAppointment, + isObGyneAppointment: isObGyneAppointment, + isDoctorNameSearch: isDoctorNameSearch, + obGyneProcedureListResponse: obGyneProcedureListResponse, + isShowDate: false, + onTap: () { + context + .read() + .analytics + .appointment + .book_appointment_select_doctor( + appointment_type: 'regular', doctor: doctor); + }); + + }, + itemCount: patientDoctorAppointmentListHospital?.length ?? + 0, + ) + : getNoDataWidget(context), + ); + } +} diff --git a/lib/pages/BookAppointment/search_result/ResultByFacility.dart b/lib/pages/BookAppointment/search_result/ResultByFacility.dart new file mode 100644 index 00000000..8eb5f71d --- /dev/null +++ b/lib/pages/BookAppointment/search_result/ResultByFacility.dart @@ -0,0 +1,124 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +typedef OnFacilitySelected = Function(bool); + +class ResultByFacility extends StatelessWidget { + List doctorsList = []; + String selectedRegion = ''; + RegionList patientDoctorAppointmentListHospital; + OnFacilitySelected onFacilitySelected; + + ResultByFacility( + {required this.doctorsList, + required this.patientDoctorAppointmentListHospital, + required this.onFacilitySelected, + required this.selectedRegion}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + HospitalTitle( + iconUrl: 'assets/images/svg/HMG.svg', + title: TranslationBase.of(context).hmgHospital, + isHMC: false, + itemCount: + "${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}", + nearest: patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgDistance + + ), + SizedBox(height: 16,), + HospitalTitle( + iconUrl: 'assets/images/svg/HMC.svg', + title: TranslationBase.of(context).hmcHospital, + isHMC: true, + itemCount: + "${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}", + nearest: patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcDistance + ) + ]); + } +} + +class HospitalTitle extends StatelessWidget { + final String title; + final String iconUrl; + final bool isHMC; + final num? nearest; + final String itemCount; + + const HospitalTitle( + {super.key, + required this.title, + required this.iconUrl, + required this.isHMC, + required this.itemCount,this.nearest}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + SvgPicture.asset(iconUrl), + SizedBox( + width: 8, + ), + Text( + title, + style: TextStyle( + fontSize: 18, + color: isHMC ? Color(0xFF40ACC9) : Color(0xFFD02127), + fontWeight: FontWeight.w600), + ), + ], + ), + SizedBox( + height: 6, + ), + Row( + children: [ + Text( + isHMC + ? "${TranslationBase.of(context).hmcHospitalCount.replaceAll("@", itemCount)}" + : "${TranslationBase.of(context).hmgHospitalCount.replaceAll("@", itemCount)}", + style: TextStyle( + fontSize: 12, color: Colors.black, fontWeight: FontWeight.w600), + ), + + Visibility( + visible: nearest != double.infinity, + child: Row( + children: [ + SizedBox(width: 8,), + Icon(Icons.location_on, color: Colors.black,), + SizedBox(width: 8,), + Text( + "${TranslationBase.of(context).nearest}: $nearest", + style: TextStyle( + fontSize: 12, color: Colors.black, fontWeight: FontWeight.w600), + ), + ], + ), + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/pages/BookAppointment/search_result/ResultByHospital.dart b/lib/pages/BookAppointment/search_result/ResultByHospital.dart new file mode 100644 index 00000000..d60d3738 --- /dev/null +++ b/lib/pages/BookAppointment/search_result/ResultByHospital.dart @@ -0,0 +1,225 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +typedef OnHospitalSelected = Function(String, int); + +class ResultByHospital extends StatelessWidget { + List doctorsList = []; + List? paitientDoctorAppointmentList; + bool isHMCSelected; + + bool isLiveCareAppointment; + bool isObGyneAppointment; + bool isDoctorNameSearch; + OBGyneProcedureListResponse? obGyneProcedureListResponse; + bool isDoctorSearchResult; + OnHospitalSelected onHospitalSelected; + + ResultByHospital( + {required this.doctorsList, + required this.paitientDoctorAppointmentList, + required this.isHMCSelected, + this.isObGyneAppointment = false, + this.isDoctorNameSearch = false, + required this.isLiveCareAppointment, + required this.isDoctorSearchResult, + this.obGyneProcedureListResponse, + required this.onHospitalSelected}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Expanded( + child: HospitalBodyWidget( + patientDoctorAppointmentListHospital: paitientDoctorAppointmentList, + isLiveCareAppointment: isLiveCareAppointment, + isObGyneAppointment: isObGyneAppointment, + isDoctorNameSearch: isDoctorNameSearch, + isDoctorSearchResult: isDoctorSearchResult, + onHospitalSelected: onHospitalSelected, + ), + ), + ], + ); + } +} + +class HospitalBodyWidget extends StatelessWidget { + final List? + patientDoctorAppointmentListHospital; + final bool isLiveCareAppointment; + final bool isObGyneAppointment; + final bool isDoctorNameSearch; + final bool isDoctorSearchResult; + final OBGyneProcedureListResponse? obGyneProcedureListResponse; + final OnHospitalSelected onHospitalSelected; + + const HospitalBodyWidget( + {super.key, + this.patientDoctorAppointmentListHospital, + required this.isLiveCareAppointment, + required this.isObGyneAppointment, + required this.isDoctorNameSearch, + required this.isDoctorSearchResult, + this.obGyneProcedureListResponse, + required this.onHospitalSelected}); + + @override + Widget build(BuildContext context) { + return ListView.separated( + addAutomaticKeepAlives: true, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: patientDoctorAppointmentListHospital?.length ?? 0, + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + ); + }, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + onHospitalSelected( + patientDoctorAppointmentListHospital![index].filterName ?? '', + index); + }, + child: Material( + color: CustomColors.white, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + patientDoctorAppointmentListHospital![index] + .filterName ?? + '', + style: TextStyle( + fontSize: 22, + color: Colors.black, + fontWeight: FontWeight.w700), + ), + SizedBox( + height: 8, + ), + Visibility( + visible: + (patientDoctorAppointmentListHospital?[index] + .distanceInKMs != + "0"), + child: Row( + children: [ + Icon( + Icons.location_on, + color: Colors.black, + ), + SizedBox( + width: 8, + ), + Text( + "${TranslationBase.of(context).nearest}: ${patientDoctorAppointmentListHospital?[index].distanceInKMs}", + style: TextStyle( + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w600), + ), + ], + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(8), + child: Center( + child: Icon( + Icons.arrow_forward_ios, + color: CustomColors.black, + size: 16, + ), + ), + ), + ], + )), + ), + ); + // return AppExpandableNotifier( + // applyBackgroundColor: false, + // widgetColor: CustomColors.appBackgroudGrey2Color, + // title: (patientDoctorAppointmentListHospital?[index].distanceInKMs != + // "0") + // ? patientDoctorAppointmentListHospital![index].filterName! + + // " - " + + // patientDoctorAppointmentListHospital![index].distanceInKMs! + + // " " + + // TranslationBase.of(context).km + // : patientDoctorAppointmentListHospital![index].filterName, + // projectTitleTop: + // patientDoctorAppointmentListHospital![index].projectTopName, + // projectTitleBottom: (patientDoctorAppointmentListHospital![index] + // .distanceInKMs != + // "0") + // ? patientDoctorAppointmentListHospital![index] + // .projectBottomName + // .toString() + + // " - " + + // patientDoctorAppointmentListHospital![index].distanceInKMs! + + // " " + + // TranslationBase.of(context).km + // : patientDoctorAppointmentListHospital![index] + // .projectBottomName + // .toString(), + // isTitleSingleLine: false, + // isDoctorSearchResult: isDoctorSearchResult, + // isDisabled: true, + // isExpand: + // patientDoctorAppointmentListHospital?.length == 1 ? true : false, + // // bodyWidget: ListView.separated( + // // shrinkWrap: true, + // // physics: NeverScrollableScrollPhysics(), + // // padding: + // // EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21), + // // itemBuilder: (context, _index) { + // // // print("the index of patientDoctorAppointmentList is ${_index}"); + // // // print("the index of parent is ${index}"); + // // final doctor = patientDoctorAppointmentListHospital![index] + // // .patientDoctorAppointmentList![_index]; + // // // print('the doctor is ${doctor.toJson()}'); + // // return DoctorView( + // // doctor: doctor, + // // isLiveCareAppointment: isLiveCareAppointment, + // // isObGyneAppointment: isObGyneAppointment, + // // isDoctorNameSearch: isDoctorNameSearch, + // // obGyneProcedureListResponse: obGyneProcedureListResponse, + // // isShowDate: false, + // // onTap: () { + // // context + // // .read() + // // .analytics + // // .appointment + // // .book_appointment_select_doctor( + // // appointment_type: 'regular', doctor: doctor); + // // }); + // // }, + // // separatorBuilder: (context, index) => SizedBox(height: 14), + // // itemCount: patientDoctorAppointmentListHospital?[index].patientDoctorAppointmentList?.length ?? 0), + // ); + }, + ); + } +} diff --git a/lib/pages/BookAppointment/search_result/ResultByRegion.dart b/lib/pages/BookAppointment/search_result/ResultByRegion.dart new file mode 100644 index 00000000..86a973a8 --- /dev/null +++ b/lib/pages/BookAppointment/search_result/ResultByRegion.dart @@ -0,0 +1,145 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; +typedef OnRegionSelected = Function(String); +class ResultByRegion extends StatelessWidget { + List doctorsList = []; + RegionList patientDoctorAppointmentListHospital; + OnRegionSelected onRegionSelected; + ResultByRegion( + {required this.doctorsList, + required this.patientDoctorAppointmentListHospital, + required this.onRegionSelected + }); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Expanded( + child: patientDoctorAppointmentListHospital + .registeredDoctorMap?.isNotEmpty == + true + ? ListView.separated( + addAutomaticKeepAlives: true, + physics: BouncingScrollPhysics(), + separatorBuilder: (context, index) { + return Material( + color: Color(0xFFf5f5f5), + child: SizedBox( + height: 12, + ), + ); + }, + itemBuilder: (context, index) { + String key = patientDoctorAppointmentListHospital + .registeredDoctorMap?.keys + .toList()[index] ?? + ''; + + return InkWell( + onTap: (){ + onRegionSelected(key); + }, + child: RegionTitle( + title: key, + hmcCount: + "${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}", + hmgCount: + "${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}", + ), + ); + + }, + itemCount: patientDoctorAppointmentListHospital + .registeredDoctorMap?.length ?? + 0, + ) + : getNoDataWidget(context), + ), + ], + ); + } +} + + +class RegionTitle extends StatelessWidget { + final String title; + final String hmcCount; + final String hmgCount; + + const RegionTitle( + {super.key, + required this.title, + required this.hmcCount, + required this.hmgCount}); + + @override + Widget build(BuildContext context) { + return Material( + color: CustomColors.white, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 22, color: Colors.black, fontWeight: FontWeight.w700), + ), + SizedBox( + height: 8, + ), + Row( + children: [ + Text( + "${TranslationBase.of(context).hmgHospitalCount.replaceAll("@", hmgCount)} ,", + style: TextStyle( + fontSize: 14, + color: Color(0xFFD02127), + fontWeight: FontWeight.w600), + ), + SizedBox( + width: 8, + ), + Text( + "${TranslationBase.of(context).hmcHospitalCount.replaceAll("@", hmcCount)}", + style: TextStyle( + fontSize: 14, + color: Color(0xFF40ACC9), + fontWeight: FontWeight.w600), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(8), + child: Center( + child: Icon( + Icons.arrow_forward_ios, + color: CustomColors.black, + size: 16, + ), + ), + ), + ], + ) + ), + ); + } +} diff --git a/lib/pages/BookAppointment/search_result/SearchResultWithTab.dart b/lib/pages/BookAppointment/search_result/SearchResultWithTab.dart new file mode 100644 index 00000000..39e08949 --- /dev/null +++ b/lib/pages/BookAppointment/search_result/SearchResultWithTab.dart @@ -0,0 +1,590 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByFacility.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByHospital.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByRegion.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +class SearchResultWithTab extends StatefulWidget { + List doctorsList = []; + RegionList patientDoctorAppointmentListHospital; + bool isLiveCareAppointment; + bool isObGyneAppointment; + bool isDoctorNameSearch; + OBGyneProcedureListResponse? obGyneProcedureListResponse; + bool isDoctorSearchResult; + + SearchResultWithTab({required this.doctorsList, + required this.patientDoctorAppointmentListHospital, + this.isObGyneAppointment = false, + this.isDoctorNameSearch = false, + required this.isLiveCareAppointment, + required this.isDoctorSearchResult, + this.obGyneProcedureListResponse}); + + @override + State createState() => _SearchResultWithTabState(); +} + +class _SearchResultWithTabState extends State { + int _currentIndex = 0; + late PageController _controller; + String selectedRegion = ""; + bool isHMCSelected = false; + int selectedHospitalIndex = -1; + + @override + void initState() { + super.initState(); + _controller = new PageController(); + } + + changePageViewIndex(pageIndex) { + _controller.jumpToPage(pageIndex); + } + + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: getTitle(), + isShowDecPage: false, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: widget.patientDoctorAppointmentListHospital + .registeredDoctorMap?.isNotEmpty == + true + ? SingleChildScrollView( + child: Column(children: [ + Container( + width: double.infinity, + padding: EdgeInsets.only(left: 20, right: 20, top: 12), + child: Row( + children: [ + Expanded( + child: showProgress( + title: TranslationBase + .of(context) + .selectRegion, + status: _currentIndex == 0 + ? TranslationBase + .of(context) + .inPrgress + : _currentIndex > 0 + ? TranslationBase + .of(context) + .completed + : TranslationBase + .of(context) + .locked, + color: _currentIndex == 0 + ? CustomColors.orange + : CustomColors.green, + ), + ), + Expanded( + child: showProgress( + title: TranslationBase + .of(context) + .selectFacitlity, + status: _currentIndex == 1 + ? TranslationBase + .of(context) + .inPrgress + : _currentIndex > 1 + ? TranslationBase + .of(context) + .completed + : TranslationBase + .of(context) + .locked, + color: _currentIndex == 1 + ? CustomColors.orange + : _currentIndex > 1 + ? CustomColors.green + : CustomColors.grey2, + ), + ), + showProgress( + title: TranslationBase + .of(context) + .selectBranch, + status: _currentIndex == 2 ? TranslationBase + .of(context) + .inPrgress : TranslationBase + .of(context) + .locked, + color: _currentIndex == 2 + ? CustomColors.orange + : _currentIndex > 3 + ? CustomColors.green + : CustomColors.grey2, + isNeedBorder: false, + ), + showProgress( + title: TranslationBase + .of(context) + .selectDoctor, + status: _currentIndex == 3 ? TranslationBase + .of(context) + .inPrgress : TranslationBase + .of(context) + .locked, + color: _currentIndex == 3 + ? CustomColors.orange + : _currentIndex > 4 + ? CustomColors.green + : CustomColors.grey2, + isNeedBorder: false, + ), + ], + ), + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + ResultByRegion(doctorsList: widget.doctorsList, + patientDoctorAppointmentListHospital: widget + .patientDoctorAppointmentListHospital, + onRegionSelected: (key) { + setState(() { + selectedRegion = key; + }); + }), + (selectedRegion != "") + ? + ResultByFacility(doctorsList: widget.doctorsList, + patientDoctorAppointmentListHospital: widget + .patientDoctorAppointmentListHospital, + selectedRegion: selectedRegion, + onFacilitySelected: (isHMCSelected) { + setState(() { + isHMCSelected = isHMCSelected; + }); + }, + + ) : SizedBox.shrink(), + (selectedRegion != '') ? + ResultByHospital(doctorsList: widget.doctorsList, + paitientDoctorAppointmentList: (isHMCSelected)? + widget.patientDoctorAppointmentListHospital + .registeredDoctorMap![selectedRegion]!.hmgDoctorList ?? [] + : widget.patientDoctorAppointmentListHospital + .registeredDoctorMap?[selectedRegion]?.hmgDoctorList ?? [], + isHMCSelected: isHMCSelected, + isLiveCareAppointment: widget.isLiveCareAppointment, + isDoctorSearchResult: widget.isDoctorSearchResult, + onHospitalSelected: (hospital,index) { + setState(() { + selectedHospitalIndex = index; + }); + }): SizedBox.shrink(), + + ], + ), + ), + ])) + : getNoDataWidget(context),); + } + + String getTitle() { + switch (_currentIndex) { + case 0: + return TranslationBase + .of(context) + .selectRegion; + case 1: + return TranslationBase + .of(context) + .selectFacitlity; + case 2: + return TranslationBase + .of(context) + .selectBranch; + case 3: + return TranslationBase + .of(context) + .selectDoctor; + } + return ""; + } + + Widget showProgress( + {String? title, String? status, Color? color, bool isNeedBorder = true}) { + return InkWell( + onTap: () { + if (status == TranslationBase + .of(context) + .completed) { + changePageViewIndex(_currentIndex); + } + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 26, + height: 26, + decoration: containerRadius(color!, 200), + child: Icon( + Icons.done, + color: Colors.white, + size: 16, + ), + ), + if (isNeedBorder) + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: mDivider(Colors.grey), + )), + ], + ), + mHeight(8), + Text( + title!, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + letterSpacing: -0.44, + ), + ), + mHeight(2), + Container( + padding: EdgeInsets.all(5), + decoration: containerRadius(color!.withOpacity(0.2), 4), + child: Text( + status!, + style: TextStyle( + fontSize: 8, + fontWeight: FontWeight.w600, + letterSpacing: -0.32, + color: color, + ), + ), + ), + ], + ) + ], + ), + ); + } +} + +class HospitalBodyWidget extends StatelessWidget { + final List? + patientDoctorAppointmentListHospital; + final bool isLiveCareAppointment; + final bool isObGyneAppointment; + final bool isDoctorNameSearch; + final bool isDoctorSearchResult; + final OBGyneProcedureListResponse? obGyneProcedureListResponse; + + const HospitalBodyWidget({ + super.key, + this.patientDoctorAppointmentListHospital, + required this.isLiveCareAppointment, + required this.isObGyneAppointment, + required this.isDoctorNameSearch, + required this.isDoctorSearchResult, + this.obGyneProcedureListResponse, + }); + + @override + Widget build(BuildContext context) { + return ListView.separated( + addAutomaticKeepAlives: true, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: patientDoctorAppointmentListHospital?.length ?? 0, + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + ); + }, + itemBuilder: (context, index) { + return AppExpandableNotifier( + applyBackgroundColor: false, + widgetColor: CustomColors.appBackgroudGrey2Color, + title: (patientDoctorAppointmentListHospital?[index].distanceInKMs != + "0") + ? patientDoctorAppointmentListHospital![index].filterName! + + " - " + + patientDoctorAppointmentListHospital![index].distanceInKMs! + + " " + + TranslationBase + .of(context) + .km + : patientDoctorAppointmentListHospital![index].filterName, + projectTitleTop: + patientDoctorAppointmentListHospital![index].projectTopName, + projectTitleBottom: (patientDoctorAppointmentListHospital![index] + .distanceInKMs != + "0") + ? patientDoctorAppointmentListHospital![index] + .projectBottomName + .toString() + + " - " + + patientDoctorAppointmentListHospital![index].distanceInKMs! + + " " + + TranslationBase + .of(context) + .km + : patientDoctorAppointmentListHospital![index] + .projectBottomName + .toString(), + isTitleSingleLine: false, + isDoctorSearchResult: isDoctorSearchResult, + isExpand: + patientDoctorAppointmentListHospital?.length == 1 ? true : false, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: + EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21), + itemBuilder: (context, _index) { + // print("the index of patientDoctorAppointmentList is ${_index}"); + // print("the index of parent is ${index}"); + final doctor = patientDoctorAppointmentListHospital![index] + .patientDoctorAppointmentList![_index]; + // print('the doctor is ${doctor.toJson()}'); + return DoctorView( + doctor: doctor, + isLiveCareAppointment: isLiveCareAppointment, + isObGyneAppointment: isObGyneAppointment, + isDoctorNameSearch: isDoctorNameSearch, + obGyneProcedureListResponse: obGyneProcedureListResponse, + isShowDate: false, + onTap: () { + context + .read() + .analytics + .appointment + .book_appointment_select_doctor( + appointment_type: 'regular', doctor: doctor); + }); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: patientDoctorAppointmentListHospital?[index] + .patientDoctorAppointmentList?.length ?? 0), + ); + }, + ); + } +} + +class RegionTitle extends StatelessWidget { + final String title; + final String hmcCount; + final String hmgCount; + + const RegionTitle({super.key, + required this.title, + required this.hmcCount, + required this.hmgCount}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 22, color: Colors.black, fontWeight: FontWeight.w700), + ), + SizedBox( + height: 8, + ), + Row( + children: [ + Text( + "${TranslationBase + .of(context) + .hmgHospitalCount + .replaceAll("@", hmgCount)} ,", + style: TextStyle( + fontSize: 14, + color: Color(0xFFD02127), + fontWeight: FontWeight.w600), + ), + SizedBox( + width: 8, + ), + Text( + "${TranslationBase + .of(context) + .hmcHospitalCount + .replaceAll("@", hmcCount)}", + style: TextStyle( + fontSize: 14, + color: Color(0xFF40ACC9), + fontWeight: FontWeight.w600), + ), + ], + ), + ], + ), + ); + } +} + +class HospitalTitle extends StatelessWidget { + final String title; + final String iconUrl; + final bool isHMC; + final String itemCount; + + const HospitalTitle({super.key, + required this.title, + required this.iconUrl, + required this.isHMC, + required this.itemCount}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + SvgPicture.asset(iconUrl), + SizedBox( + width: 8, + ), + Text( + title, + style: TextStyle( + fontSize: 18, + color: isHMC ? Color(0xFF40ACC9) : Color(0xFFD02127), + fontWeight: FontWeight.w600), + ), + ], + ), + SizedBox( + height: 6, + ), + Text( + isHMC + ? "${TranslationBase + .of(context) + .hmcHospitalCount + .replaceAll("@", itemCount)}" + : "${TranslationBase + .of(context) + .hmgHospitalCount + .replaceAll("@", itemCount)}", + style: TextStyle( + fontSize: 12, color: Colors.black, fontWeight: FontWeight.w600), + ), + ], + ), + ); + } +} + + +///todo the current content of the application +/// return AppExpandableNotifier( +// paddingValue: 10, +// applyBackgroundToOnlyHeader: true, +// completeHeaderColor: CustomColors.appBackgroudGrey2Color, +// headerWidget: RegionTitle( +// title: key, +// hmcCount: +// "${widget.patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}", +// hmgCount: +// "${widget.patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}", +// ), +// showDropDownIconWithCustomHeader: true, +// isTitleSingleLine: false, +// isDoctorSearchResult: widget.isDoctorSearchResult, +// widgetColor: Color(0xFFF8F8F8), +// bodyWidget: Column( +// children: [ +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: AppExpandableNotifier( +// paddingValue: 8, +// applyBackgroundColor: false, +// applyBackgroundToOnlyHeader: true, +// completeHeaderColor: Colors.white, +// headerRadius: BorderRadius.circular(16), +// headerWidget: HospitalTitle( +// iconUrl: 'assets/images/svg/HMG.svg', +// title: TranslationBase.of(context).hmgHospital, +// isHMC: false, +// itemCount: +// "${widget.patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}", +// ), +// showDropDownIconWithCustomHeader: true, +// bodyWidget: HospitalBodyWidget( +// patientDoctorAppointmentListHospital: +// widget.patientDoctorAppointmentListHospital +// .registeredDoctorMap?[key]?.hmgDoctorList, +// isLiveCareAppointment: widget.isLiveCareAppointment, +// isObGyneAppointment: widget.isObGyneAppointment, +// isDoctorNameSearch: widget.isDoctorNameSearch, +// isDoctorSearchResult: widget.isDoctorSearchResult, +// ), +// ), +// ), +// Padding( +// padding: const EdgeInsets.only( +// bottom: 8.0, left: 8, right: 8), +// child: AppExpandableNotifier( +// paddingValue: 8, +// applyBackgroundColor: false, +// applyBackgroundToOnlyHeader: true, +// completeHeaderColor: Colors.white, +// headerRadius: BorderRadius.circular(16), +// headerWidget: HospitalTitle( +// iconUrl: 'assets/images/svg/HMC.svg', +// title: TranslationBase.of(context).hmcHospital, +// isHMC: true, +// itemCount: +// "${widget.patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}", +// ), +// showDropDownIconWithCustomHeader: true, +// bodyWidget: HospitalBodyWidget( +// patientDoctorAppointmentListHospital: +// widget.patientDoctorAppointmentListHospital +// .registeredDoctorMap?[key]?.hmcDoctorList, +// isLiveCareAppointment: widget.isLiveCareAppointment, +// isObGyneAppointment: widget.isObGyneAppointment, +// isDoctorNameSearch: widget.isDoctorNameSearch, +// isDoctorSearchResult: widget.isDoctorSearchResult, +// ), +// ), +// ), +// ], +// )); diff --git a/lib/pages/conference/zoom/call_screen.dart b/lib/pages/conference/zoom/call_screen.dart index 6de59807..2a5b4e40 100644 --- a/lib/pages/conference/zoom/call_screen.dart +++ b/lib/pages/conference/zoom/call_screen.dart @@ -472,7 +472,7 @@ class _CallScreenState extends State { ], ), ); - if (errorType == Errors.SessionJoinFailed || errorType == Errors.SessionDisconnecting) { + if (errorType == Errors.SessionJoinFailed || errorType == Errors.SessionDisconncting) { Timer( const Duration(milliseconds: 1000), () => Navigator.pop(context), diff --git a/lib/pages/login/register_new.dart b/lib/pages/login/register_new.dart index cac18634..dac74122 100644 --- a/lib/pages/login/register_new.dart +++ b/lib/pages/login/register_new.dart @@ -117,14 +117,7 @@ class _RegisterNew extends State { }, scrollDirection: Axis.horizontal, children: [ - Register( - changePageViewIndex: changePageViewIndex, - ), - RegisterInfo( - changePageViewIndex: changePageViewIndex, - ), - RegisterInfo(changePageViewIndex: changePageViewIndex, page: 2), // NewEReferralStepOnePage( // changePageViewIndex: changePageViewIndex, // createEReferralRequestModel: createEReferralRequestModel, diff --git a/lib/services/appointment_services/doctor_response_mapper.dart b/lib/services/appointment_services/doctor_response_mapper.dart index ea6c321b..16b7ac7c 100644 --- a/lib/services/appointment_services/doctor_response_mapper.dart +++ b/lib/services/appointment_services/doctor_response_mapper.dart @@ -51,6 +51,10 @@ class DoctorMapper{ } if(regionDoctorList!.distance>distance){ regionDoctorList!.distance = distance; + if(element.isHMC == true) + regionDoctorList.hmcDistance = distance; + else + regionDoctorList.hmgDistance = distance; } print("the distance is $distance"); } diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index bbeebe5d..3e1f08b5 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -70,7 +70,7 @@ class AppToast { child: toast, gravity: ToastGravity.TOP, toastDuration: Duration(seconds: timeInSeconds), - positionedToastBuilder: (context, child) { + positionedToastBuilder: (context, child,_) { return Positioned(top: 50, left: 10, right: 10, child: child); }); // Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.red, textColor: textColor, fontSize: fontSize); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index dad50e31..5e858cf0 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -3268,10 +3268,14 @@ class TranslationBase { String get download => localizedValues["download"][locale.languageCode]; String get share => localizedValues["share"][locale.languageCode]; + String get selectRegion => localizedValues["selectRegion"][locale.languageCode]; + String get selectFacitlity => localizedValues["selectFacitlity"][locale.languageCode]; + String get selectDoctor => localizedValues["selectDoctor"][locale.languageCode]; String get hmgHospital => localizedValues["hmgHospital"][locale.languageCode]; String get hmcHospital => localizedValues["hmcHospital"][locale.languageCode]; String get hmcHospitalCount => localizedValues["hmcHospitalCount"][locale.languageCode]; String get hmgHospitalCount => localizedValues["hmgHospitalCount"][locale.languageCode]; + String get nearest => localizedValues["nearest"][locale.languageCode]; }