You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
361 lines
15 KiB
Dart
361 lines
15 KiB
Dart
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/pages/pharmacies/screens/pharmacy_module_page.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 SearchResultsByRegion extends StatelessWidget {
|
|
List<DoctorList> doctorsList = [];
|
|
RegionList patientDoctorAppointmentListHospital;
|
|
bool isLiveCareAppointment;
|
|
bool isObGyneAppointment;
|
|
bool isDoctorNameSearch;
|
|
OBGyneProcedureListResponse? obGyneProcedureListResponse;
|
|
bool isDoctorSearchResult;
|
|
|
|
SearchResultsByRegion(
|
|
{required this.doctorsList,
|
|
required this.patientDoctorAppointmentListHospital,
|
|
this.isObGyneAppointment = false,
|
|
this.isDoctorNameSearch = false,
|
|
required this.isLiveCareAppointment,
|
|
required this.isDoctorSearchResult,
|
|
this.obGyneProcedureListResponse});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
appBarTitle: TranslationBase.of(context).bookAppo,
|
|
isShowDecPage: false,
|
|
isShowAppBar: true,
|
|
showNewAppBarTitle: true,
|
|
showNewAppBar: true,
|
|
backgroundColor: CustomColors.appBackgroudGrey2Color,
|
|
body: patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?.isNotEmpty ==
|
|
true
|
|
? ListView.separated(
|
|
addAutomaticKeepAlives: true,
|
|
physics: BouncingScrollPhysics(),
|
|
separatorBuilder: (context, index) {
|
|
return Container(
|
|
height: 12,
|
|
margin: EdgeInsets.only(left: 21, right: 21),
|
|
);
|
|
},
|
|
itemBuilder: (context, index) {
|
|
String key = patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?.keys
|
|
.toList()[index] ??
|
|
'';
|
|
|
|
print(' the key is $key');
|
|
return AppExpandableNotifier(
|
|
headerWidget: RegionTitle(
|
|
title: key,
|
|
hmcCount:
|
|
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}",
|
|
hmgCount:
|
|
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}",
|
|
),
|
|
showDropDownIconWithCustomHeader: true,
|
|
isTitleSingleLine: false,
|
|
isDoctorSearchResult: isDoctorSearchResult,
|
|
bodyWidget: Column(
|
|
children: [
|
|
AppExpandableNotifier(
|
|
headerWidget: HospitalTitle(
|
|
iconUrl: 'assets/images/svg/HMG.svg',
|
|
title: TranslationBase.of(context).hmgHospital,
|
|
isHMC: false,
|
|
itemCount:
|
|
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmgSize ?? 0}",
|
|
),
|
|
showDropDownIconWithCustomHeader: true,
|
|
bodyWidget: HospitalBodyWidget(
|
|
patientDoctorAppointmentListHospital:
|
|
patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[key]?.hmgDoctorList,
|
|
isLiveCareAppointment: isLiveCareAppointment,
|
|
isObGyneAppointment: isObGyneAppointment,
|
|
isDoctorNameSearch: isDoctorNameSearch,
|
|
isDoctorSearchResult: isDoctorSearchResult,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
AppExpandableNotifier(
|
|
headerWidget: HospitalTitle(
|
|
iconUrl: 'assets/images/svg/HMC.svg',
|
|
title: TranslationBase.of(context).hmcHospital,
|
|
isHMC: true,
|
|
itemCount:
|
|
"${patientDoctorAppointmentListHospital.registeredDoctorMap?[key]?.hmcSize ?? 0}",
|
|
),
|
|
showDropDownIconWithCustomHeader: true,
|
|
bodyWidget: HospitalBodyWidget(
|
|
patientDoctorAppointmentListHospital:
|
|
patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?[key]?.hmcDoctorList,
|
|
isLiveCareAppointment: isLiveCareAppointment,
|
|
isObGyneAppointment: isObGyneAppointment,
|
|
isDoctorNameSearch: isDoctorNameSearch,
|
|
isDoctorSearchResult: isDoctorSearchResult,
|
|
),
|
|
)
|
|
],
|
|
));
|
|
// return AppExpandableNotifier(
|
|
// 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) {
|
|
// final doctor = patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList![_index];
|
|
// return DoctorView(
|
|
// doctor: doctor,
|
|
// isLiveCareAppointment: isLiveCareAppointment,
|
|
// isObGyneAppointment: isObGyneAppointment,
|
|
// isDoctorNameSearch: isDoctorNameSearch,
|
|
// obGyneProcedureListResponse: obGyneProcedureListResponse,
|
|
// isShowDate: false,
|
|
// onTap: () {
|
|
// context.read<ProjectViewModel>().analytics.appointment.book_appointment_select_doctor(appointment_type: 'regular', doctor: doctor);
|
|
// });
|
|
// },
|
|
// separatorBuilder: (context, index) => SizedBox(height: 14),
|
|
// itemCount: patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList!.length),
|
|
// );
|
|
},
|
|
itemCount: patientDoctorAppointmentListHospital
|
|
.registeredDoctorMap?.length ??
|
|
0,
|
|
)
|
|
: getNoDataWidget(context),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HospitalBodyWidget extends StatelessWidget {
|
|
final List<PatientDoctorAppointmentList>?
|
|
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(
|
|
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<ProjectViewModel>()
|
|
.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),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|