diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index cf5f4faa1..0840f8a1f 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -148,7 +148,6 @@ :timeSlotsForSelectedDate="timeSlotsForSelectedDate" :estimatedServiceMinutesMinimum="estimatedServiceMinutesMinimum" :estimatedServiceMinutesMaximum="estimatedServiceMinutesMaximum" - @appointmentTypeUpdated="updateAppointmentType" @waitListRequested="handleWaitListRequested" @time-slot-modal-closed="timeSlotModalClosed" /> @@ -167,7 +166,10 @@ import { MONTHS_OF_YEAR, DAYS_OF_WEEK, } from "@/digital-components/date-picker/mixins/constants"; -import { PREMIUM_FEE_PART_TYPE } from "@/constants/schedule-constants"; +import { + AppointmentTypeStrings, + PREMIUM_FEE_PART_TYPE, +} from "@/constants/schedule-constants"; import { selectableDaysOptions, requiredParameter, @@ -877,9 +879,6 @@ export default { handleWaitListRequested(value) { this.$emit("waitListRequested", value); }, - updateAppointmentType(type) { - this.$emit("appointmentTypeUpdated", type); - }, }, watch: { modelValue(newValue) { diff --git a/src/layouts/schedule/helpers/schedule-helper.js b/src/layouts/schedule/helpers/schedule-helper.js index 633d862d2..e8b1ec55a 100644 --- a/src/layouts/schedule/helpers/schedule-helper.js +++ b/src/layouts/schedule/helpers/schedule-helper.js @@ -1,5 +1,8 @@ import { storeActions } from "@/constants/store-actions"; import baseMixin from "@/mixins/base-mixin.js"; +import { + RouteCodeFlags, +} from "@/constants/schedule-constants"; export async function getAlertReasons(ctu) { const alertReasons = await baseMixin.methods.dispatchStoreActionWithLogging( @@ -60,3 +63,13 @@ export function militaryToTwelveHourTime(timeString) { return `${hours}:${minutes} ${meridianNotation}`; } + +export function isDropOffRouteCode(routeCode) { + if (!routeCode) { + return false; + } + return ( + routeCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF) || + routeCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF) + ); +} diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 8758a9f96..6dfb4decb 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -150,7 +150,6 @@ :estimatedServiceMinutesMinimum="getServiceMinutesMin" :estimatedServiceMinutesMaximum="getServiceMinutesMax" @timeSlotSelected="updateTimeSlot" - @appointmentTypeUpdated="updateAppointmentType" :displayWaitList="displayWaitList" @waitListRequested="handleWaitListRequested" /> { - return this.isDropOffRouteCode(timeSlot.id); + return isDropOffRouteCode(timeSlot.id); }) .map((timeSlot) => { let buttonLabelValue; @@ -405,7 +405,7 @@ export default { return this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF; }, shouldDisplayDropOffAlert() { - return this.isDropOffRouteCode(this.selectedAnswerForDropOffOrInshop); + return isDropOffRouteCode(this.selectedAnswerForDropOffOrInshop); }, dropOffTimeSlotAlertCMSWidgetName() { if (this.selectedAnswerForDropOffOrInshop.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) { @@ -455,7 +455,7 @@ export default { getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) { return timeSlotsForSelectedDate .filter((timeSlot) => { - return !this.isDropOffRouteCode(timeSlot.id); + return !isDropOffRouteCode(timeSlot.id); }) .map((timeSlot) => { const readableTime = militaryToTwelveHourTime(timeSlot.startTime); @@ -509,7 +509,7 @@ export default { // Mobile Only this.selectedAnswerForTimeSlots = this.addPremiumFlagToInput(routeCodeFromParent); } else { - if (this.isDropOffRouteCode(routeCodeFromParent)) { + if (isDropOffRouteCode(routeCodeFromParent)) { this.selectedAnswerForDropOffOrInshop = routeCodeFromParent; } else { this.selectedAnswerForDropOffOrInshop = PICK_A_TIME_BUTTON_VALUE; @@ -580,15 +580,6 @@ export default { successMessageElement.scrollIntoView({ behavior: "smooth" }); } }, - isDropOffRouteCode(routeCode) { - if (!routeCode) { - return false; - } - return ( - routeCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF) || - routeCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF) - ); - }, }, watch: { waitListRequested(newVal) { @@ -617,17 +608,10 @@ export default { }, selectedAnswerForDropOffOrInshop(newValue) { if (newValue == PICK_A_TIME_BUTTON_VALUE) { - // Inshop selected this.selectedRouteCode = null; - this.$emit("appointmentTypeUpdated", AppointmentTypeStrings.IN_SHOP); - } else if (newValue) { - // Dropoff selected - this.$emit("appointmentTypeUpdated", AppointmentTypeStrings.DROP_OFF); - this.selectedRouteCode = newValue; } else { - // none selected this.selectedAnswerForTimeSlots = null; - this.$emit("appointmentTypeUpdated", null); + this.selectedRouteCode = newValue; } }, selectedAnswerForTimeSlots(newValue) {