|
|
|
|
@ -8,20 +8,32 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/route_extensions.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/book_appointments/models/resp_models/get_clinic_list_response_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/symptoms_checker/models/resp_models/triage_response_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/condition_card.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.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 'package:shimmer/shimmer.dart';
|
|
|
|
|
|
|
|
|
|
import '../appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart';
|
|
|
|
|
|
|
|
|
|
class PossibleConditionsPage extends StatelessWidget {
|
|
|
|
|
const PossibleConditionsPage({super.key});
|
|
|
|
|
PossibleConditionsPage({super.key});
|
|
|
|
|
|
|
|
|
|
late SymptomsCheckerViewModel symptomsCheckerViewModel;
|
|
|
|
|
late BookAppointmentsViewModel bookAppointmentsViewModel;
|
|
|
|
|
late AppointmentViaRegionViewmodel regionalViewModel;
|
|
|
|
|
|
|
|
|
|
Widget _buildLoadingShimmer() {
|
|
|
|
|
return ListView.separated(
|
|
|
|
|
@ -80,8 +92,20 @@ class PossibleConditionsPage extends StatelessWidget {
|
|
|
|
|
condition: condition,
|
|
|
|
|
symptoms: symptoms,
|
|
|
|
|
onActionPressed: () {
|
|
|
|
|
dialogService.showErrorBottomSheet(
|
|
|
|
|
message: 'icd10 Code is ${condition.conditionDetails?.icd10Code}. We need to get the clinics mapped against this code.',
|
|
|
|
|
LoaderBottomSheet.showLoader();
|
|
|
|
|
symptomsCheckerViewModel.getClinicConditionsFromCategory(
|
|
|
|
|
categoryName: (condition.conditionDetails!.category!.name) ?? "Other",
|
|
|
|
|
onSuccess: (value) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
print(symptomsCheckerViewModel.clinicDetailsList.first.clinicID);
|
|
|
|
|
initiateBookAppointmentFlow(context);
|
|
|
|
|
},
|
|
|
|
|
onError: (err) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
dialogService.showErrorBottomSheet(
|
|
|
|
|
message: err.toString(),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@ -194,6 +218,9 @@ class PossibleConditionsPage extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
symptomsCheckerViewModel = context.read<SymptomsCheckerViewModel>();
|
|
|
|
|
bookAppointmentsViewModel = context.read<BookAppointmentsViewModel>();
|
|
|
|
|
regionalViewModel = context.read<AppointmentViaRegionViewmodel>();
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
|
|
|
body: CollapsingListView(
|
|
|
|
|
@ -202,7 +229,6 @@ class PossibleConditionsPage extends StatelessWidget {
|
|
|
|
|
context: context,
|
|
|
|
|
onConfirm: () {
|
|
|
|
|
context.pop();
|
|
|
|
|
final SymptomsCheckerViewModel symptomsCheckerViewModel = context.read<SymptomsCheckerViewModel>();
|
|
|
|
|
symptomsCheckerViewModel.reset(); // Clear all symptoms checker data
|
|
|
|
|
final navigationService = getIt.get<NavigationService>();
|
|
|
|
|
// navigationService.replaceAllRoutesAndNavigateToLanding();
|
|
|
|
|
@ -230,4 +256,102 @@ class PossibleConditionsPage extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initiateBookAppointmentFlow(BuildContext context) {
|
|
|
|
|
bookAppointmentsViewModel.getLocation();
|
|
|
|
|
bookAppointmentsViewModel.setSelectedClinic(GetClinicsListResponseModel(
|
|
|
|
|
clinicID: symptomsCheckerViewModel.clinicDetailsList.first.clinicID,
|
|
|
|
|
clinicDescription: symptomsCheckerViewModel.clinicDetailsList.first.category,
|
|
|
|
|
clinicDescriptionN: symptomsCheckerViewModel.clinicDetailsList.first.categoryAR,
|
|
|
|
|
));
|
|
|
|
|
bookAppointmentsViewModel.setIsDoctorsListLoading(true);
|
|
|
|
|
|
|
|
|
|
var bottomSheetType = RegionBottomSheetType.FOR_CLINIIC;
|
|
|
|
|
openRegionListBottomSheet(context, bottomSheetType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getTitle(AppointmentViaRegionViewmodel data, BuildContext context) {
|
|
|
|
|
if (data.selectedRegionId == null) {
|
|
|
|
|
return LocaleKeys.selectRegion.tr(context: context).toText20(weight: FontWeight.w600);
|
|
|
|
|
} else {
|
|
|
|
|
return Transform.flip(
|
|
|
|
|
flipX: data.isArabic ? true : false,
|
|
|
|
|
child: Utils.buildSvgWithAssets(
|
|
|
|
|
icon: AppAssets.arrow_back,
|
|
|
|
|
iconColor: Color(0xff2B353E),
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
data.handleBackPress();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void openRegionListBottomSheet(BuildContext context, RegionBottomSheetType type) {
|
|
|
|
|
bookAppointmentsViewModel.setProjectID(null);
|
|
|
|
|
|
|
|
|
|
regionalViewModel.flush();
|
|
|
|
|
regionalViewModel.setBottomSheetType(type);
|
|
|
|
|
// AppointmentViaRegionViewmodel? viewmodel = null;
|
|
|
|
|
showCommonBottomSheetWithoutHeight(context, title: "", titleWidget: Consumer<AppointmentViaRegionViewmodel>(builder: (_, data, __) => getTitle(data, context)), isDismissible: false,
|
|
|
|
|
child: Consumer<AppointmentViaRegionViewmodel>(builder: (context, data, __) {
|
|
|
|
|
return getRegionalSelectionWidget(data, context);
|
|
|
|
|
}), callBackFunc: () {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getRegionalSelectionWidget(AppointmentViaRegionViewmodel data, BuildContext context) {
|
|
|
|
|
if (data.bottomSheetState == AppointmentViaRegionState.REGION_SELECTION) {
|
|
|
|
|
return RegionBottomSheetBody();
|
|
|
|
|
}
|
|
|
|
|
if (data.bottomSheetState == AppointmentViaRegionState.TYPE_SELECTION) {
|
|
|
|
|
bookAppointmentsViewModel.resetFilterList();
|
|
|
|
|
return FacilityTypeSelectionWidget(
|
|
|
|
|
selectedRegion: data.selectedRegionId ?? "",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (data.bottomSheetState == AppointmentViaRegionState.HOSPITAL_SELECTION) {
|
|
|
|
|
return HospitalBottomSheetBody(
|
|
|
|
|
searchText: data.searchController,
|
|
|
|
|
displayList: data.displayList,
|
|
|
|
|
onFacilityClicked: (value) {
|
|
|
|
|
data.setSelectedFacility(value);
|
|
|
|
|
data.getDisplayList();
|
|
|
|
|
},
|
|
|
|
|
onHospitalClicked: (hospital) {
|
|
|
|
|
regionalViewModel.setHospitalModel(hospital);
|
|
|
|
|
if (regionalViewModel.regionBottomSheetType == RegionBottomSheetType.FOR_REGION) {
|
|
|
|
|
regionalViewModel.setBottomSheetState(AppointmentViaRegionState.CLINIC_SELECTION);
|
|
|
|
|
regionalViewModel.handleLastStepForRegion();
|
|
|
|
|
} else if (regionalViewModel.regionBottomSheetType == RegionBottomSheetType.FOR_CLINIIC) {
|
|
|
|
|
regionalViewModel.setBottomSheetState(AppointmentViaRegionState.DOCTOR_SELECTION);
|
|
|
|
|
regionalViewModel.handleLastStepForClinic();
|
|
|
|
|
} else if (regionalViewModel.regionBottomSheetType == RegionBottomSheetType.REGION_FOR_DENTAL_AND_LASER) {
|
|
|
|
|
var appointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
|
|
|
|
|
regionalViewModel.setBottomSheetState(AppointmentViaRegionState.DOCTOR_SELECTION);
|
|
|
|
|
regionalViewModel.handleLastStepForClinicForDentalAndLaser(appointmentsViewModel.selectedClinic.clinicID ?? -1);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onHospitalSearch: (value) {
|
|
|
|
|
data.searchHospitals(value ?? "");
|
|
|
|
|
},
|
|
|
|
|
selectedFacility: data.selectedFacility,
|
|
|
|
|
hmcCount: data.hmcCount,
|
|
|
|
|
hmgCount: data.hmgCount,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (data.bottomSheetState == AppointmentViaRegionState.DOCTOR_SELECTION) {
|
|
|
|
|
//if the region screen is opened for the dental clinic then the project id will be in the hospital list as the list is formed form the get project api
|
|
|
|
|
var id = "";
|
|
|
|
|
if (data.regionBottomSheetType == RegionBottomSheetType.REGION_FOR_DENTAL_AND_LASER) {
|
|
|
|
|
id = regionalViewModel.selectedHospital?.hospitalList.first.iD?.toString() ?? "";
|
|
|
|
|
} else {
|
|
|
|
|
id = regionalViewModel.selectedHospital?.patientDoctorAppointmentList?.first.projectID?.toString() ?? "";
|
|
|
|
|
}
|
|
|
|
|
bookAppointmentsViewModel.setProjectID(id);
|
|
|
|
|
return SizedBox.shrink();
|
|
|
|
|
} else {
|
|
|
|
|
return SizedBox.shrink();
|
|
|
|
|
}
|
|
|
|
|
return SizedBox.shrink();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|