diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index 08a803b89..d04d10872 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -142,7 +142,7 @@ overnightDropOffCmsWidgetName="OvernightDropOffTimeSlotModal" dropOffOrPickATimeQuestionCmsWidgetName="DropOffOrPickATimeQuestionWidget" :selectedDate="selectedDate" - :appointmentType="appointmentType" + :appointmentType="appointmentTypeForTimeSlotQuestion" :premiumAppointmentFee="premiumAppointmentFee" :displayWaitList="displayWaitList" :timeSlotsForSelectedDate="timeSlotsForSelectedDate" @@ -166,7 +166,7 @@ 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, @@ -224,7 +224,7 @@ export default { pricingByDayUpcharge: Number, isPricingByDayExperiment: Boolean, timeSlotsForSelectedDate: Object, - appointmentType: String, + appointmentTypeForTimeSlotQuestion: String, premiumAppointmentFee: Object, estimatedServiceMinutesMinimum: Number, estimatedServiceMinutesMaximum: Number, diff --git a/src/layouts/schedule/helpers/schedule-helper.js b/src/layouts/schedule/helpers/schedule-helper.js index 633d862d2..41a1cd66a 100644 --- a/src/layouts/schedule/helpers/schedule-helper.js +++ b/src/layouts/schedule/helpers/schedule-helper.js @@ -1,5 +1,6 @@ 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 +61,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 edd305f92..a4d3250d0 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -66,7 +66,7 @@
0) { preSelectedDate = preSelectedSlot.date; - if (selectedAppointmentType === AppointmentTypeStrings.MOBILE) { + if (appointmentType === AppointmentTypeStrings.MOBILE) { preSelectedDate += "-mobile"; } @@ -607,7 +609,7 @@ export default { vm.pricingByDayUpcharge = pricingByDayUpcharge; vm.showPricingByDay = showPricingByDay; - vm.selectedAppointmentType = selectedAppointmentType; + vm.appointmentType = appointmentType; vm.setData( resultMap.zipCodeData, resultMap.serviceabilityDetails, @@ -661,7 +663,7 @@ export default { set: function (newValue) { if (newValue.zipCode !== this.zipCode) { this.resetMobileLocation(); - this.selectedAppointmentType = null; + this.appointmentType = null; this.selectedProvider = new Provider(); } @@ -673,7 +675,7 @@ export default { }, }, isMobileSelected() { - return this.selectedAppointmentType == AppointmentTypeStrings.MOBILE; + return this.appointmentType == AppointmentTypeStrings.MOBILE; }, isServiceableMobile() { if (this.isRecalibrationServiceableMobile !== null) { @@ -751,10 +753,7 @@ export default { } }, isShopQuestionDisplayed() { - return ( - this.selectedAppointmentType === "Inshop" || - this.selectedAppointmentType === "Dropoff" - ); + return this.appointmentType === "Inshop" || this.appointmentType === "Dropoff"; }, isAppointmentTypeDisplayed() { // temporary adjustment @@ -816,7 +815,7 @@ export default { availabilityRatingCallback: getAvailabilityRating, startDate: formattedStartDate, endDate: formattedEndDate, - shopAppointmentType: this.selectedAppointmentType, + shopAppointmentType: this.appointmentType, }; }, selectedShopAnswer() { @@ -1035,7 +1034,7 @@ export default { getIsVehicleProtectedFromStore() { return store.getters.order.serviceLocation.isVehicleProtected; }, - getSelectedAppointmentType() { + getAppointmentType() { return store.getters.order.serviceLocation.appointmentType; }, getSelectedProvider() { @@ -1067,8 +1066,7 @@ export default { }, updateAndSaveIsMSRFeeApplicable() { const isMSRFeeApplicable = - this.isMobileStaticRecalibrationApplicable && - this.selectedAppointmentType == "Mobile"; + this.isMobileStaticRecalibrationApplicable && this.appointmentType == "Mobile"; this.dispatchStoreAction( this.storeActions.SAVE_IS_MSR_FEE_APPLICABLE, isMSRFeeApplicable @@ -1104,7 +1102,7 @@ export default { } // if we have a mobile fee, then save/update supporting items - if (this.selectedAppointmentType == "Mobile") { + if (this.appointmentType == "Mobile") { const mobileFeeIndex = supportingItems.findIndex( (item) => item.partType == MOBILE_FEE_PART_TYPE ); @@ -1241,7 +1239,7 @@ export default { getSelectedDate() { let isMobileSelected = this.isMobileSelected; if (isMobileSelected === undefined) { - isMobileSelected = this.selectedAppointmentType === AppointmentTypeStrings.MOBILE; + isMobileSelected = this.appointmentType === AppointmentTypeStrings.MOBILE; } let storedDate = store.getters.order.schedule.date; if (isMobileSelected) storedDate += "-mobile"; @@ -1277,7 +1275,10 @@ export default { timeSlotInfo.timeSlot.date )}`; - if (this.selectedAppointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF) { + if ( + this.appointmentType === AppointmentTypeStrings.IN_SHOP || + this.appointmentType === AppointmentTypeStrings.DROP_OFF + ) { if ( !timeSlotInfo.timeSlot.routeCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF) ) { @@ -1286,7 +1287,7 @@ export default { )}`; } } else if ( - this.selectedAppointmentType === AppointmentTypeStrings.MOBILE && + this.appointmentType === AppointmentTypeStrings.MOBILE && !timeSlotInfo.isPremiumAppointment ) { navbarButtonText += ` at ${this.getDisplayTextForMilitaryTime( @@ -1341,7 +1342,7 @@ export default { this.navigatingForward = true; var ctu = this.zipCodeCtu; if ( - this.selectedAppointmentType == AppointmentTypeStrings.MOBILE && + this.appointmentType == AppointmentTypeStrings.MOBILE && this.selectedProvider && this.selectedProvider.address ) { @@ -1366,7 +1367,7 @@ export default { state: this.state, zipCode: this.zipCode, zipCodeCtu: ctu, - appointmentType: this.selectedAppointmentType, + appointmentType: this.appointmentType, isVehicleProtected: this.isVehicleProtected, provider: { providerNumber: this.selectedProvider?.providerNumber, @@ -1451,7 +1452,7 @@ export default { ); } - if (this.selectedAppointmentType == AppointmentTypeStrings.MOBILE) { + if (this.appointmentType == AppointmentTypeStrings.MOBILE) { //navigate to mobile details page this.$router.navigateWithSaving( this.navigationScenarios.CLICKED_FORWARD_WITH_MOBILE_SERVICE, @@ -1526,7 +1527,7 @@ export default { // if we have a premium fee(early bird), then save/update supporting items if ( - this.selectedAppointmentType === AppointmentTypeStrings.MOBILE && + this.appointmentType === AppointmentTypeStrings.MOBILE && this.selectedTimeSlotInfo?.isPremiumAppointment ) { const premiumFeeIndex = supportingItems.findIndex( @@ -1575,8 +1576,19 @@ export default { this.includePricingByDayUpcharge = false; } }, - updateTimeSlot(timeSlot) { - this.selectedTimeSlotInfo = timeSlot; + updateTimeSlot(timeSlotObj) { + this.selectedTimeSlotInfo = timeSlotObj; + if (this.appointmentType !== AppointmentTypeStrings.MOBILE) { + // update apptType based on routeCode to determine if it should be dropoff or inshop + this.appointmentType = this.getInShopOrDropOffApptType( + timeSlotObj.timeSlot.routeCode + ); + } + }, + getInShopOrDropOffApptType(routeCode) { + return isDropOffRouteCode(routeCode) + ? AppointmentTypeStrings.DROP_OFF + : AppointmentTypeStrings.IN_SHOP; }, }, watch: { @@ -1585,7 +1597,7 @@ export default { if (!this.navigatingForward) { getShopProviderData(this.zipCode).then(async (result) => { this.shopProviderData = result.data; - if (this.selectedAppointmentType === "Mobile") { + if (this.appointmentType === "Mobile") { this.selectedProvider = new Provider( this.shopProviderData.mobileProviderNumber ); @@ -1596,9 +1608,9 @@ export default { } }, }, - selectedAppointmentType: { + appointmentType: { handler(newValue, oldValue) { - if (newValue === "Mobile") { + if (newValue === AppointmentTypeStrings.MOBILE) { this.selectedProvider = new Provider( this.shopProviderData.mobileProviderNumber ); @@ -1609,6 +1621,23 @@ export default { }, }, + appointmentTypeFromAppointmentTypeQuestion: { + handler(newValue, oldValue) { + if (newValue === AppointmentTypeStrings.MOBILE) { + this.appointmentType = AppointmentTypeStrings.MOBILE; + } else { + if (this.selectedTimeSlotInfo?.timeSlot?.routeCode) { + // update appointmentType based on routeCode to determine if it should be dropoff or inshop + this.appointmentType = this.getInShopOrDropOffApptType( + this.selectedTimeSlotInfo.timeSlot.routeCode + ); + } else { + this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF; + } + } + }, + }, + selectedDate(newValue, oldValue) { // Clear time slot selection if date selected changes if (newValue !== oldValue) { 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 f35300f1a..6bd93f843 100644 --- a/src/layouts/schedule/time-slot-question/time-slot-question.vue +++ b/src/layouts/schedule/time-slot-question/time-slot-question.vue @@ -1,6 +1,5 @@