From 84f7911c1a140a78f238afbb48210c9c54e2f594 Mon Sep 17 00:00:00 2001 From: Chris Redelinghuys Date: Wed, 23 Jul 2025 14:04:30 -0400 Subject: [PATCH] CASH-1214: Reset selected timeslot on date change --- .../time-slot-question/time-slot-question.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/layouts/schedule/time-slot-question/time-slot-question.vue b/src/layouts/schedule/time-slot-question/time-slot-question.vue index cb0120539..b1c6846d7 100644 --- a/src/layouts/schedule/time-slot-question/time-slot-question.vue +++ b/src/layouts/schedule/time-slot-question/time-slot-question.vue @@ -183,6 +183,7 @@ export default { let appointmentTypeCmsWidgetName; if ( + this.selectedDate == null || this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF || this.appointmentType === AppointmentTypeStrings.IN_SHOP || this.appointmentType === AppointmentTypeStrings.DROP_OFF @@ -440,6 +441,8 @@ export default { ); } + this.resetSelectedTimeSlotIfDateChange(timeSlotsForSelectedDate); + return availableTimeSlots; }, getPremiumAppointmentTimeSlot(timeSlotData) { @@ -535,6 +538,20 @@ export default { successMessageElement.scrollIntoView({ behavior: "smooth" }); } }, + resetSelectedTimeSlotIfDateChange(timeSlotsForSelectedDate) { + if (this.selectedRouteCode) { + const selectedRouteCodeString = this.selectedRouteCode.replace( + PREMIUM_TIME_SLOT_ID_FLAG, + "" + ); + const matchingTimeSlot = timeSlotsForSelectedDate.find((slot) => { + return slot.id === selectedRouteCodeString; + }); + if (!matchingTimeSlot) { + this.selectedRouteCode = null; + } + } + }, }, watch: { waitListRequested(newVal) {