Fix early bird issues, auto-select, and general clean up
This commit is contained in:
parent
fd3a8e1aee
commit
c8db19a73b
1 changed files with 30 additions and 25 deletions
|
|
@ -115,7 +115,6 @@ export default {
|
||||||
name: "time-slot-question",
|
name: "time-slot-question",
|
||||||
emits: ["update:modelValue", "time-slot-selection-changed",],
|
emits: ["update:modelValue", "time-slot-selection-changed",],
|
||||||
props: {
|
props: {
|
||||||
cmsWidgetName: String,
|
|
||||||
mobileCmsWidgetName: String,
|
mobileCmsWidgetName: String,
|
||||||
mobilePremiumCmsWidgetName: String,
|
mobilePremiumCmsWidgetName: String,
|
||||||
dropoffCmsWidgetName: String,
|
dropoffCmsWidgetName: String,
|
||||||
|
|
@ -134,10 +133,14 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
timeSlotModalListButton: timeSlotModalListButton,
|
timeSlotModalListButton: timeSlotModalListButton,
|
||||||
|
selectedAnswerForTimeSlots: null,
|
||||||
selectedAnswerForDropOffOrInshop: null,
|
selectedAnswerForDropOffOrInshop: null,
|
||||||
selectedAnswerForTimeSlots: null
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.updateDropoffAndTimeSlotAnswersFromSelectedRouteCodeData(this.selectedRouteCodeData);
|
||||||
|
this.autoSelectTimeSlotIfOnlyOneIsAvailable();
|
||||||
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const uuid = uuidv4();
|
const uuid = uuidv4();
|
||||||
const componentId = !props.customComponentId
|
const componentId = !props.customComponentId
|
||||||
|
|
@ -181,10 +184,10 @@ export default {
|
||||||
timeSlotsForSelectedDate() {
|
timeSlotsForSelectedDate() {
|
||||||
this.selectedAnswerForDropOffOrInshop = null;
|
this.selectedAnswerForDropOffOrInshop = null;
|
||||||
this.selectedAnswerForTimeSlots = null;
|
this.selectedAnswerForTimeSlots = null;
|
||||||
|
this.autoSelectTimeSlotIfOnlyOneIsAvailable();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
supplementalInformationBlock() {
|
supplementalInformationBlock() {
|
||||||
let appointmentTypeCmsWidgetName;
|
let appointmentTypeCmsWidgetName;
|
||||||
|
|
||||||
|
|
@ -193,9 +196,6 @@ export default {
|
||||||
this.appointmentType === AppointmentTypeStrings.IN_SHOP ||
|
this.appointmentType === AppointmentTypeStrings.IN_SHOP ||
|
||||||
this.appointmentType === AppointmentTypeStrings.DROP_OFF
|
this.appointmentType === AppointmentTypeStrings.DROP_OFF
|
||||||
) {
|
) {
|
||||||
if (!this.selectedAnswerForTimeSlots && !this.selectedAnswerForDropOffOrInshop) {
|
|
||||||
this.autoSelectTimeSlotIfOnlyOneIsAvailable();
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
// This is planned to be used again for drop-off
|
// This is planned to be used again for drop-off
|
||||||
// Wrote this to be ready for that eventuality, is untested and no HTML work done yet
|
// Wrote this to be ready for that eventuality, is untested and no HTML work done yet
|
||||||
|
|
@ -390,11 +390,15 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
updateDropoffAndTimeSlotAnswersFromSelectedRouteCodeData(selectedRouteCodeData) {
|
updateDropoffAndTimeSlotAnswersFromSelectedRouteCodeData(selectedRouteCodeData) {
|
||||||
if (selectedRouteCodeData?.routeCode) {
|
if (selectedRouteCodeData?.routeCode) {
|
||||||
if (isDropOffRouteCode(selectedRouteCodeData.routeCode)) {
|
let routeCode = selectedRouteCodeData.routeCode;
|
||||||
this.selectedAnswerForDropOffOrInshop = selectedRouteCodeData.routeCode;
|
if (isDropOffRouteCode(routeCode)) {
|
||||||
|
this.selectedAnswerForDropOffOrInshop = routeCode;
|
||||||
} else {
|
} else {
|
||||||
this.selectedAnswerForDropOffOrInshop = PICK_A_TIME_BUTTON_VALUE;
|
this.selectedAnswerForDropOffOrInshop = PICK_A_TIME_BUTTON_VALUE;
|
||||||
this.selectedAnswerForTimeSlots = selectedRouteCodeData.routeCode;
|
if (this.selectedRouteCodeData.isPremiumAppointment) {
|
||||||
|
routeCode = this.addPremiumFlagToInput(routeCode);
|
||||||
|
}
|
||||||
|
this.selectedAnswerForTimeSlots = routeCode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.selectedAnswerForDropOffOrInshop = null;
|
this.selectedAnswerForDropOffOrInshop = null;
|
||||||
|
|
@ -413,7 +417,6 @@ export default {
|
||||||
this.$emit("time-slot-selection-changed", newSelectedRouteCodeData);
|
this.$emit("time-slot-selection-changed", newSelectedRouteCodeData);
|
||||||
},
|
},
|
||||||
timeSlotSelectionChanged(newValue) {
|
timeSlotSelectionChanged(newValue) {
|
||||||
console.log('heard time slot change', newValue);
|
|
||||||
if(newValue) {
|
if(newValue) {
|
||||||
let routeCode = newValue;
|
let routeCode = newValue;
|
||||||
let isPremiumAppointment = routeCode.includes(
|
let isPremiumAppointment = routeCode.includes(
|
||||||
|
|
@ -428,18 +431,19 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
// This is unused but planned to be used again
|
||||||
selectedRouteCode,
|
// getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||||
isSameDayRelevant = false
|
// selectedRouteCode,
|
||||||
) {
|
// isSameDayRelevant = false
|
||||||
if (selectedRouteCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
// ) {
|
||||||
return this.overnightDropOffCmsWidgetName;
|
// if (selectedRouteCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||||
} else if (selectedRouteCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
// return this.overnightDropOffCmsWidgetName;
|
||||||
return this.isSameDay && isSameDayRelevant
|
// } else if (selectedRouteCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||||
? this.sameDayDropOffCmsWidgetName
|
// return this.isSameDay && isSameDayRelevant
|
||||||
: this.dropoffCmsWidgetName;
|
// ? this.sameDayDropOffCmsWidgetName
|
||||||
}
|
// : this.dropoffCmsWidgetName;
|
||||||
},
|
// }
|
||||||
|
// },
|
||||||
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
||||||
return timeSlotsForSelectedDate
|
return timeSlotsForSelectedDate
|
||||||
.filter((timeSlot) => {
|
.filter((timeSlot) => {
|
||||||
|
|
@ -491,15 +495,16 @@ export default {
|
||||||
getWaitListRequestedFromStore() {
|
getWaitListRequestedFromStore() {
|
||||||
return store.getters.order.customer?.waitListRequested;
|
return store.getters.order.customer?.waitListRequested;
|
||||||
},
|
},
|
||||||
autoSelectTimeSlotIfOnlyOneIsAvailable() { // this needs to be fixed
|
autoSelectTimeSlotIfOnlyOneIsAvailable() {
|
||||||
const numberOfOptions = this.timeSlotsForSelectedDate?.timeSlots?.length;
|
const numberOfOptions = this.timeSlotsForSelectedDate?.timeSlots?.length;
|
||||||
if (this.appointmentType && numberOfOptions === 1) {
|
if (numberOfOptions === 1) {
|
||||||
if (this.availableTimeSlots.length > 0) {
|
if (this.availableTimeSlots.length > 0) {
|
||||||
|
// this.availableTimeSlots only returns mobile/inshop slots so we know
|
||||||
|
// the only available slot is not dropOFf
|
||||||
this.selectedAnswerForTimeSlots = this.availableTimeSlots[0].value;
|
this.selectedAnswerForTimeSlots = this.availableTimeSlots[0].value;
|
||||||
} else {
|
} else {
|
||||||
this.selectedAnswerForDropOffOrInshop = this.answersForDropOffQuestion[0].value;
|
this.selectedAnswerForDropOffOrInshop = this.answersForDropOffQuestion[0].value;
|
||||||
}
|
}
|
||||||
this.setSelectedTimeSlot();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addPremiumFlagToInput(routeCode) {
|
addPremiumFlagToInput(routeCode) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue