diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index 15cae75a..25bb200b 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -22,8 +22,10 @@ import 'package:flutter/material.dart'; class DentalComplaints extends StatefulWidget { SearchInfo searchInfo; + Function onSelectedMethod; + bool isDoctorNameSearch; - DentalComplaints({@required this.searchInfo}); + DentalComplaints({@required this.searchInfo, this.onSelectedMethod, this.isDoctorNameSearch = false}); @override _DentalComplaintsState createState() => _DentalComplaintsState(); @@ -66,6 +68,8 @@ class _DentalComplaintsState extends State { child: DentalComplaintCard( listDentalChiefComplain: complaintsList[index], languageID: languageID, + isDoctorNameSearch: widget.isDoctorNameSearch, + onSelectedMethod: widget.onSelectedMethod, )..logAnalytics = (){ final info = widget.searchInfo; locator().appointment.book_appointment_chief_complaints(appointment_type: 'regular', hospital: info.hospital, clinic: info.clinic, treatment: complaintsList[index]); diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 503fa3e2..17f394a0 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -1,10 +1,14 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; +import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/doctor_post_pre_images_page.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; import 'package:diplomaticquarterapp/routes.dart'; @@ -34,8 +38,9 @@ class DoctorProfile extends StatefulWidget { DoctorProfileList docProfileList; final bool isOpenAppt; bool isLiveCareAppointment; + bool isDoctorNameSearch; - DoctorProfile({@required this.doctor, @required this.docProfileList, @required this.isLiveCareAppointment, this.isOpenAppt = false}); + DoctorProfile({@required this.doctor, @required this.docProfileList, @required this.isLiveCareAppointment, this.isOpenAppt = false, this.isDoctorNameSearch = false}); AuthenticatedUser authUser; @@ -89,11 +94,10 @@ class _DoctorProfileState extends State with TickerProviderStateM minWidth: MediaQuery.of(context).size.width * 0.7, height: 40.0, child: CustomTextButton( - backgroundColor: CustomColors.accentColor, - elevation: 0, + backgroundColor: CustomColors.accentColor, + elevation: 0, onPressed: goToBookConfirm, - child: Text(TranslationBase.of(context).reviewAppointment, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, - color: Colors.white, fontWeight: FontWeight.w600)), + child: Text(TranslationBase.of(context).reviewAppointment, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, color: Colors.white, fontWeight: FontWeight.w600)), ), ), ), @@ -445,10 +449,9 @@ class _DoctorProfileState extends State with TickerProviderStateM ), minWidth: MediaQuery.of(context).size.width, height: 40.0, - child:CustomTextButton( - elevation: 0.0, - backgroundColor: Colors.white, - + child: CustomTextButton( + elevation: 0.0, + backgroundColor: Colors.white, onPressed: () { Navigator.of(context).pop(); }, @@ -489,23 +492,52 @@ class _DoctorProfileState extends State with TickerProviderStateM } void goToBookConfirm() async { - if (DocAvailableAppointments.areSlotsAvailable) { - if (projectViewModel.isLogin) { - final timeSlot = DocAvailableAppointments.selectedAppoDateTime; - navigateToBookConfirm(context); - projectViewModel.analytics.appointment.book_appointment_review(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); - } else { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: TranslationBase.of(context).loginToUseService, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {navigateToLogin()}, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - } - } else - AppToast.showErrorToast(message: TranslationBase.of(context).selectSlot); + if (widget.isDoctorNameSearch) { + navigateToDentalComplaints(context); + } else { + if (DocAvailableAppointments.areSlotsAvailable) { + if (projectViewModel.isLogin) { + final timeSlot = DocAvailableAppointments.selectedAppoDateTime; + navigateToBookConfirm(context); + projectViewModel.analytics.appointment.book_appointment_review(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); + } else { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).loginToUseService, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {navigateToLogin()}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + } else + AppToast.showErrorToast(message: TranslationBase.of(context).selectSlot); + } + } + + Future navigateToDentalComplaints(BuildContext context) async { + HospitalsModel selectedHospital = new HospitalsModel(); + selectedHospital.name = widget.doctor.projectName; + ListClinicCentralized selectedClinic = new ListClinicCentralized(); + selectedClinic.clinicDescription = widget.doctor.clinicName; + + SearchInfo searchInfo = new SearchInfo(); + searchInfo.ProjectID = widget.doctor.projectID; + searchInfo.ClinicID = widget.doctor.clinicID; + searchInfo.date = DateTime.now(); + searchInfo.hospital = selectedHospital; + searchInfo.clinic = selectedClinic; + + Navigator.push( + context, + FadePage( + page: DentalComplaints(searchInfo: searchInfo), + ), + ).then((value) { + // setState(() { + // dropdownValue = null; + // }); + }); } navigateToLogin() { diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index e577af7f..0f80abac 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -15,9 +15,10 @@ class SearchResults extends StatefulWidget { List patientDoctorAppointmentListHospital; bool isLiveCareAppointment; bool isObGyneAppointment; + bool isDoctorNameSearch; OBGyneProcedureListResponse obGyneProcedureListResponse; - SearchResults({@required this.doctorsList, this.patientDoctorAppointmentListHospital, this.isObGyneAppointment = false, @required this.isLiveCareAppointment, this.obGyneProcedureListResponse}); + SearchResults({@required this.doctorsList, this.patientDoctorAppointmentListHospital, this.isObGyneAppointment = false, this.isDoctorNameSearch = false, @required this.isLiveCareAppointment, this.obGyneProcedureListResponse}); @override _SearchResultsState createState() => _SearchResultsState(); @@ -61,6 +62,7 @@ class _SearchResultsState extends State { doctor: doctor, isLiveCareAppointment: widget.isLiveCareAppointment, isObGyneAppointment: widget.isObGyneAppointment, + isDoctorNameSearch: widget.isDoctorNameSearch, obGyneProcedureListResponse: widget.obGyneProcedureListResponse, onTap: () { projectViewModel.analytics.appointment.book_appointment_select_doctor(appointment_type: 'regular', doctor: doctor); diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 64723226..4425d926 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -153,7 +153,7 @@ class _SearchByDoctorState extends State { } navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) { - Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, isDoctorNameSearch: true, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart index e65d25ca..83b298f2 100644 --- a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -1,5 +1,3 @@ -import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; @@ -14,8 +12,10 @@ class DentalComplaintCard extends StatefulWidget { final ListDentalChiefComplain listDentalChiefComplain; VoidCallback logAnalytics; var languageID; + Function onSelectedMethod; + bool isDoctorNameSearch; - DentalComplaintCard({@required this.listDentalChiefComplain, this.languageID}); + DentalComplaintCard({@required this.listDentalChiefComplain, this.languageID, this.onSelectedMethod, this.isDoctorNameSearch = false}); @override _DentalComplaintCardState createState() => _DentalComplaintCardState(); @@ -27,9 +27,12 @@ class _DentalComplaintCardState extends State { return Container( child: InkWell( onTap: () { - if(widget.logAnalytics != null) - widget.logAnalytics(); + if (widget.logAnalytics != null) widget.logAnalytics(); + // if(widget.isDoctorNameSearch) { + // widget.onSelectedMethod(); + // } else { getChiefComplaintsList(); + // } }, child: Container( width: double.infinity, diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index ae781cb3..32aff5ac 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -1,7 +1,11 @@ +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; +import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -9,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/dragable_sheet.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -22,10 +27,18 @@ class DoctorView extends StatelessWidget { bool isLiveCareAppointment; bool isObGyneAppointment; bool isShowFlag; + bool isDoctorNameSearch; OBGyneProcedureListResponse obGyneProcedureListResponse; final VoidCallback onTap; - DoctorView({@required this.doctor, @required this.isLiveCareAppointment, this.isObGyneAppointment = false, this.isShowFlag = true, this.onTap, this.obGyneProcedureListResponse}); + DoctorView( + {@required this.doctor, + @required this.isLiveCareAppointment, + this.isObGyneAppointment = false, + this.isDoctorNameSearch = false, + this.isShowFlag = true, + this.onTap, + this.obGyneProcedureListResponse}); ProjectViewModel projectViewModel; @@ -37,7 +50,12 @@ class DoctorView extends StatelessWidget { if (isObGyneAppointment) { next(context); } else { - if (isShowFlag) getDoctorsProfile(context, doctor, isAppo: true); + // if (doctor.clinicID == 17 && isDoctorNameSearch) { + // showDentalChiefComplaintsList(context); + // } else + if (isShowFlag) { + getDoctorsProfile(context, doctor, isAppo: true); + } (onTap ?? () {})(); // For log analytics of doctor click from book appointment } }, @@ -138,6 +156,24 @@ class DoctorView extends StatelessWidget { ); } + showDentalChiefComplaintsList(BuildContext context) { + HospitalsModel selectedHospital = new HospitalsModel(); + selectedHospital.name = doctor.projectName; + ListClinicCentralized selectedClinic = new ListClinicCentralized(); + selectedClinic.clinicDescription = doctor.clinicName; + + SearchInfo searchInfo = new SearchInfo(); + searchInfo.ProjectID = doctor.projectID; + searchInfo.ClinicID = doctor.clinicID; + searchInfo.date = DateTime.now(); + searchInfo.hospital = selectedHospital; + searchInfo.clinic = selectedClinic; + + showDraggableDialog(context, DentalComplaints(isDoctorNameSearch: true, onSelectedMethod: () { + Navigator.pop(context); + }, searchInfo: searchInfo)); + } + String getDoctorSpeciality(List docSpecial) { String docSpeciality = ""; docSpecial.forEach((v) { @@ -193,7 +229,8 @@ class DoctorView extends StatelessWidget { } void next(BuildContext context) { - Navigator.push(context, FadePage(page: ObGyneTimeSlots(projectID: doctor.projectID, selectedClinicID: doctor.clinicID, selectedDoctorID: doctor.doctorID, obGyneProcedureListResponse: obGyneProcedureListResponse))); + Navigator.push(context, + FadePage(page: ObGyneTimeSlots(projectID: doctor.projectID, selectedClinicID: doctor.clinicID, selectedDoctorID: doctor.doctorID, obGyneProcedureListResponse: obGyneProcedureListResponse))); } Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async { @@ -205,6 +242,7 @@ class DoctorView extends StatelessWidget { isLiveCareAppointment: isLiveCareAppointment, docProfileList: docProfile, isOpenAppt: isAppo, + isDoctorNameSearch: isDoctorNameSearch, ), ), );