Merge pull request #2717 from Safelite/feature/CASH-1235
CASH-1235: Auto select if only one timeslot available
This commit is contained in:
commit
ce053864e2
1 changed files with 7 additions and 1 deletions
|
|
@ -192,6 +192,9 @@ 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
|
||||||
|
|
@ -399,6 +402,8 @@ export default {
|
||||||
this.setSelectedRouteCodeFromParent();
|
this.setSelectedRouteCodeFromParent();
|
||||||
},
|
},
|
||||||
async setSelectedTimeSlot() {
|
async setSelectedTimeSlot() {
|
||||||
|
this.selectedRouteCode =
|
||||||
|
this.selectedAnswerForTimeSlots || this.selectedAnswerForDropOffOrInshop;
|
||||||
this.$emit(
|
this.$emit(
|
||||||
"update:modelValue",
|
"update:modelValue",
|
||||||
this.getSelectedTimeSlotInfoObject(this.selectedRouteCode)
|
this.getSelectedTimeSlotInfoObject(this.selectedRouteCode)
|
||||||
|
|
@ -488,12 +493,13 @@ export default {
|
||||||
},
|
},
|
||||||
autoSelectTimeSlotIfOnlyOneIsAvailable() {
|
autoSelectTimeSlotIfOnlyOneIsAvailable() {
|
||||||
const numberOfOptions = this.timeSlotsForSelectedDate?.timeSlots?.length;
|
const numberOfOptions = this.timeSlotsForSelectedDate?.timeSlots?.length;
|
||||||
if (numberOfOptions === 1) {
|
if (this.appointmentType && numberOfOptions === 1) {
|
||||||
if (this.availableTimeSlots.length > 0) {
|
if (this.availableTimeSlots.length > 0) {
|
||||||
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