diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index d44eee92..6bef82b9 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -280,23 +280,27 @@ class _DocAvailableAppointmentsState extends State wit selectedDateJSON = freeSlotsResponse[0]; }); openTimeSlotsPickerForDate( - (isLiveCareSchedule != null && isLiveCareSchedule) + isWaitingAppointmentAvailable + ? DateTime.now() + : (isLiveCareSchedule != null && isLiveCareSchedule) + ? DateUtil.convertStringToDate(selectedDateJSON) + : DateUtil.convertStringToDateSaudiTimezone( + selectedDateJSON, + int.parse( + widget.doctor.projectID.toString(), + ), + ), + docFreeSlots); + _calendarController.selectedDate = isWaitingAppointmentAvailable + ? DateTime.now() + : (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(selectedDateJSON) : DateUtil.convertStringToDateSaudiTimezone( selectedDateJSON, int.parse( widget.doctor.projectID.toString(), ), - ), - docFreeSlots); - _calendarController.selectedDate = (isLiveCareSchedule != null && isLiveCareSchedule) - ? DateUtil.convertStringToDate(selectedDateJSON) - : DateUtil.convertStringToDateSaudiTimezone( - selectedDateJSON, - int.parse( - widget.doctor.projectID.toString(), - ), - ); + ); _calendarController.displayDate = _calendarController.selectedDate; return _eventsParsed; } @@ -360,16 +364,16 @@ class _DocAvailableAppointmentsState extends State wit freeSlotsResponse = res['FreeTimeSlots']; _getJSONSlots().then((value) { setState(() { - _events.clear(); - _events = value; - if (widget.doctorSchedule != null) - { - _onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date'])); - _calendarController.selectedDate = DateUtil.convertStringToDate( - widget.doctorSchedule['Date'], - ); - }; - }); + _events.clear(); + _events = value; + if (widget.doctorSchedule != null) { + _onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date'])); + _calendarController.selectedDate = DateUtil.convertStringToDate( + widget.doctorSchedule['Date'], + ); + } + ; + }); }); } else { DocAvailableAppointments.areAppointmentsAvailable = false;