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",
|
||||
emits: ["update:modelValue", "time-slot-selection-changed",],
|
||||
props: {
|
||||
cmsWidgetName: String,
|
||||
mobileCmsWidgetName: String,
|
||||
mobilePremiumCmsWidgetName: String,
|
||||
dropoffCmsWidgetName: String,
|
||||
|
|
@ -134,10 +133,14 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
timeSlotModalListButton: timeSlotModalListButton,
|
||||
selectedAnswerForTimeSlots: null,
|
||||
selectedAnswerForDropOffOrInshop: null,
|
||||
selectedAnswerForTimeSlots: null
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.updateDropoffAndTimeSlotAnswersFromSelectedRouteCodeData(this.selectedRouteCodeData);
|
||||
this.autoSelectTimeSlotIfOnlyOneIsAvailable();
|
||||
},
|
||||
setup(props) {
|
||||
const uuid = uuidv4();
|
||||
const componentId = !props.customComponentId
|
||||
|
|
@ -181,10 +184,10 @@ export default {
|
|||
timeSlotsForSelectedDate() {
|
||||
this.selectedAnswerForDropOffOrInshop = null;
|
||||
this.selectedAnswerForTimeSlots = null;
|
||||
this.autoSelectTimeSlotIfOnlyOneIsAvailable();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
supplementalInformationBlock() {
|
||||
let appointmentTypeCmsWidgetName;
|
||||
|
||||
|
|
@ -193,9 +196,6 @@ export default {
|
|||
this.appointmentType === AppointmentTypeStrings.IN_SHOP ||
|
||||
this.appointmentType === AppointmentTypeStrings.DROP_OFF
|
||||
) {
|
||||
if (!this.selectedAnswerForTimeSlots && !this.selectedAnswerForDropOffOrInshop) {
|
||||
this.autoSelectTimeSlotIfOnlyOneIsAvailable();
|
||||
}
|
||||
return null;
|
||||
// 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
|
||||
|
|
@ -390,11 +390,15 @@ export default {
|
|||
methods: {
|
||||
updateDropoffAndTimeSlotAnswersFromSelectedRouteCodeData(selectedRouteCodeData) {
|
||||
if (selectedRouteCodeData?.routeCode) {
|
||||
if (isDropOffRouteCode(selectedRouteCodeData.routeCode)) {
|
||||
this.selectedAnswerForDropOffOrInshop = selectedRouteCodeData.routeCode;
|
||||
let routeCode = selectedRouteCodeData.routeCode;
|
||||
if (isDropOffRouteCode(routeCode)) {
|
||||
this.selectedAnswerForDropOffOrInshop = routeCode;
|
||||
} else {
|
||||
this.selectedAnswerForDropOffOrInshop = PICK_A_TIME_BUTTON_VALUE;
|
||||
this.selectedAnswerForTimeSlots = selectedRouteCodeData.routeCode;
|
||||
if (this.selectedRouteCodeData.isPremiumAppointment) {
|
||||
routeCode = this.addPremiumFlagToInput(routeCode);
|
||||
}
|
||||
this.selectedAnswerForTimeSlots = routeCode;
|
||||
}
|
||||
} else {
|
||||
this.selectedAnswerForDropOffOrInshop = null;
|
||||
|
|
@ -413,7 +417,6 @@ export default {
|
|||
this.$emit("time-slot-selection-changed", newSelectedRouteCodeData);
|
||||
},
|
||||
timeSlotSelectionChanged(newValue) {
|
||||
console.log('heard time slot change', newValue);
|
||||
if(newValue) {
|
||||
let routeCode = newValue;
|
||||
let isPremiumAppointment = routeCode.includes(
|
||||
|
|
@ -428,18 +431,19 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||
selectedRouteCode,
|
||||
isSameDayRelevant = false
|
||||
) {
|
||||
if (selectedRouteCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||
return this.overnightDropOffCmsWidgetName;
|
||||
} else if (selectedRouteCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||
return this.isSameDay && isSameDayRelevant
|
||||
? this.sameDayDropOffCmsWidgetName
|
||||
: this.dropoffCmsWidgetName;
|
||||
}
|
||||
},
|
||||
// This is unused but planned to be used again
|
||||
// getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||
// selectedRouteCode,
|
||||
// isSameDayRelevant = false
|
||||
// ) {
|
||||
// if (selectedRouteCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||
// return this.overnightDropOffCmsWidgetName;
|
||||
// } else if (selectedRouteCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||
// return this.isSameDay && isSameDayRelevant
|
||||
// ? this.sameDayDropOffCmsWidgetName
|
||||
// : this.dropoffCmsWidgetName;
|
||||
// }
|
||||
// },
|
||||
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
||||
return timeSlotsForSelectedDate
|
||||
.filter((timeSlot) => {
|
||||
|
|
@ -491,15 +495,16 @@ export default {
|
|||
getWaitListRequestedFromStore() {
|
||||
return store.getters.order.customer?.waitListRequested;
|
||||
},
|
||||
autoSelectTimeSlotIfOnlyOneIsAvailable() { // this needs to be fixed
|
||||
autoSelectTimeSlotIfOnlyOneIsAvailable() {
|
||||
const numberOfOptions = this.timeSlotsForSelectedDate?.timeSlots?.length;
|
||||
if (this.appointmentType && numberOfOptions === 1) {
|
||||
if (numberOfOptions === 1) {
|
||||
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;
|
||||
} else {
|
||||
this.selectedAnswerForDropOffOrInshop = this.answersForDropOffQuestion[0].value;
|
||||
}
|
||||
this.setSelectedTimeSlot();
|
||||
}
|
||||
},
|
||||
addPremiumFlagToInput(routeCode) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue