CASH-814 | Combine drop-off and in-shop time slots

Changed name of component because it was named based on functionality that no longer exists (no-modal is a confusing way to name everything that isn't a modal)
Cleaned up references to DROP_OFF that are obsolete
This commit is contained in:
Scott Kiener 2025-06-26 09:37:35 -04:00
parent f29d6082b3
commit aafc3d15df

View file

@ -14,7 +14,6 @@
class="mt-4" class="mt-4"
:class="[ :class="[
isMobileAppointment ? 'is-mobile-appointment' : '', isMobileAppointment ? 'is-mobile-appointment' : '',
isDropOffAppointment ? 'is-drop-off-appointment' : '',
]" ]"
:answers="availableTimeSlots" :answers="availableTimeSlots"
groupName="chooseTimeSlot" groupName="chooseTimeSlot"
@ -97,7 +96,7 @@ const cmsWidgetFieldMappings = {
defineRule("time-slot-required", required(errorMessages.OPTION_REQUIRED)); defineRule("time-slot-required", required(errorMessages.OPTION_REQUIRED));
export default { export default {
name: "time-slot-no-modal-question", name: "time-slot-question",
emits: ["update:modelValue", "TimeSlotSelected", "click-event"], emits: ["update:modelValue", "TimeSlotSelected", "click-event"],
props: { props: {
modelValue: { modelValue: {
@ -240,6 +239,9 @@ export default {
); );
}, },
disclaimerTextBlockCopy() { disclaimerTextBlockCopy() {
/* AppointmentTypeStrings.DROP_OFF should never be used per CASH-803 epic
but I'm leaving this in assuming that a future card in this epic
will handle disclaimers in a different way */
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) { if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
if (this.selectedRouteCode?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) { if (this.selectedRouteCode?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
if (this.isSameDay) { if (this.isSameDay) {
@ -329,11 +331,7 @@ export default {
return null; return null;
} }
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) { if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
return this.getAvailableTimeSlotsForDropOff(
this.timeSlotsForSelectedDate.timeSlots
);
} else if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
return this.getAvailableTimeSlotsForMobile(this.timeSlotsForSelectedDate.timeSlots); return this.getAvailableTimeSlotsForMobile(this.timeSlotsForSelectedDate.timeSlots);
} else { } else {
return this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots); return this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots);
@ -356,10 +354,7 @@ export default {
}, },
isMobileAppointment() { isMobileAppointment() {
return this.appointmentType === AppointmentTypeStrings.MOBILE; return this.appointmentType === AppointmentTypeStrings.MOBILE;
}, }
isDropOffAppointment() {
return this.appointmentType === AppointmentTypeStrings.DROP_OFF;
},
}, },
methods: { methods: {
async setSelectedTimeSlot() { async setSelectedTimeSlot() {
@ -382,23 +377,20 @@ export default {
} }
}, },
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) { getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
return timeSlotsForSelectedDate.map((timeSlot) => { let dropOffIndex = -1;
const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot, index) => {
const readableTime = militaryToTwelveHourTime(timeSlot.startTime); const readableTime = militaryToTwelveHourTime(timeSlot.startTime);
return { let buttonLabelValue = readableTime;
value: timeSlot.id, if (timeSlot.id.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
buttonLabel: readableTime, dropOffIndex = index;
}; if (this.isSameDay) {
}); buttonLabelValue = this.sameDayDropoffButtonText;
}, } else {
getAvailableTimeSlotsForDropOff(timeSlotsForSelectedDate) { buttonLabelValue = this.dropoffButtonText;
const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => { }
let buttonLabelValue; } else if (timeSlot.id.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
if (timeSlot.id.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) { dropOffIndex = index;
buttonLabelValue = this.overnightDropoffButtonText; buttonLabelValue = this.overnightDropoffButtonText;
} else if (this.isSameDay) {
buttonLabelValue = this.sameDayDropoffButtonText;
} else {
buttonLabelValue = this.dropoffButtonText;
} }
return { return {
value: timeSlot.id, value: timeSlot.id,
@ -406,6 +398,10 @@ export default {
}; };
}); });
if (dropOffIndex) {
const dropOffTimeSlot = availableTimeSlots.splice(dropOffIndex, 1)[0];
availableTimeSlots.unshift(dropOffTimeSlot);
}
return availableTimeSlots; return availableTimeSlots;
}, },
getAvailableTimeSlotsForMobile(timeSlotsForSelectedDate) { getAvailableTimeSlotsForMobile(timeSlotsForSelectedDate) {