diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 45db7f8b..15eedec1 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -55,7 +55,7 @@ class _DocAvailableAppointmentsState extends State wit int selectedButtonIndex = 0; int selectedNextDayButtonIndex = -1; dynamic freeSlotsResponse; - String nextDayAppointmentDate =""; + // String nextDayAppointmentDate =""; late ScrollController _scrollController; var language; @@ -120,7 +120,7 @@ class _DocAvailableAppointmentsState extends State wit _calendarController.selectedDate = day; openTimeSlotsPickerForDate(day, docFreeSlots); DocAvailableAppointments.selectedDate = formatter.format(day); - nextDayAppointmentDate = formatter.format(day.add(Duration(days: 1))); + selectedNextDayButtonIndex =-1; print(_calendarController.selectedDate); }); } @@ -268,7 +268,7 @@ class _DocAvailableAppointmentsState extends State wit DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); nextDayEvents = []; - DateTime? previousDate = _calendarController.selectedDate != null ? _calendarController.selectedDate : _calendarController.displayDate; + // DateTime? previousDate = _calendarController.selectedDate != null ? _calendarController.selectedDate : _calendarController.displayDate; // if(DateUtils.isSameDay(dateStart, previousDate!.add(Duration(days:1)) )) { freeSlots.forEach((v) { @@ -301,16 +301,7 @@ class _DocAvailableAppointmentsState extends State wit ), ), ); - nextDayAppointmentDate = dateFormatter.format( - (isLiveCareSchedule != null && isLiveCareSchedule) - ? DateUtil.convertStringToDate(freeSlotsResponse[0]).add(Duration(days:1)) - : DateUtil.convertStringToDateSaudiTimezone( - freeSlotsResponse[0], - int.parse( - widget.doctor.projectID.toString(), - ), - ).add(Duration(days:1)), - ); + DocAvailableAppointments.selectedAppoDateTime = (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(freeSlotsResponse[0]) : DateUtil.convertStringToDateSaudiTimezone( @@ -386,16 +377,8 @@ class _DocAvailableAppointmentsState extends State wit selectedNextDayButtonIndex =-1; DocAvailableAppointments.selectedTime = dayEvents[index].isoTime; print(DocAvailableAppointments.selectedTime); - DocAvailableAppointments.selectedDate = dateFormatter.format( - (isLiveCareSchedule != null && isLiveCareSchedule) - ? DateUtil.convertStringToDate(freeSlotsResponse[0]) - : DateUtil.convertStringToDateSaudiTimezone( - freeSlotsResponse[0], - int.parse( - widget.doctor.projectID.toString(), - ), - ), - ); + DocAvailableAppointments.selectedDate = dateFormatter.format(_calendarController.selectedDate!); + }); projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor); }, @@ -416,16 +399,7 @@ class _DocAvailableAppointmentsState extends State wit setState(() { selectedButtonIndex = index; DocAvailableAppointments.selectedTime = dayEvents[index].isoTime; - DocAvailableAppointments.selectedDate = dateFormatter.format( - (isLiveCareSchedule != null && isLiveCareSchedule) - ? DateUtil.convertStringToDate(freeSlotsResponse[0]) - : DateUtil.convertStringToDateSaudiTimezone( - freeSlotsResponse[0], - int.parse( - widget.doctor.projectID.toString(), - ), - ), - ); + DocAvailableAppointments.selectedDate = dateFormatter.format(_calendarController.selectedDate!); print(DocAvailableAppointments.selectedTime); }); }, @@ -449,7 +423,7 @@ class _DocAvailableAppointmentsState extends State wit selectedButtonIndex = -1; selectedNextDayButtonIndex =index; DocAvailableAppointments.selectedTime = nextDayEvents[index].isoTime; - DocAvailableAppointments.selectedDate = nextDayAppointmentDate; + DocAvailableAppointments.selectedDate = dateFormatter.format(_calendarController.selectedDate!.add(Duration(days:1))); print(DocAvailableAppointments.selectedTime); }); projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor); @@ -472,7 +446,7 @@ class _DocAvailableAppointmentsState extends State wit selectedButtonIndex =-1; selectedNextDayButtonIndex = index; DocAvailableAppointments.selectedTime = nextDayEvents[index].isoTime; - DocAvailableAppointments.selectedDate = nextDayAppointmentDate; + DocAvailableAppointments.selectedDate =dateFormatter.format(_calendarController.selectedDate!.add(Duration(days:1))); print(DocAvailableAppointments.selectedTime); }); },