Merge pull request #3029 from Safelite/feature/CASH-1790-for-20260129
CASH-2096 redo previously lost changes from 1790
This commit is contained in:
commit
758ea3b4aa
4 changed files with 54 additions and 71 deletions
|
|
@ -281,7 +281,7 @@ export default {
|
||||||
if (event.screenX === 0 && event.screenY === 0) {
|
if (event.screenX === 0 && event.screenY === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$emit("date-clicked", date);
|
this.$emit("date-selected", date);
|
||||||
},
|
},
|
||||||
getWeekStartDate(dateString) {
|
getWeekStartDate(dateString) {
|
||||||
const date = convertDateStringToDate(dateString);
|
const date = convertDateStringToDate(dateString);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
cmsWidgetName="ScheduleYourServiceWidget"
|
cmsWidgetName="ScheduleYourServiceWidget"
|
||||||
id="schedule-your-service" />
|
id="schedule-your-service" />
|
||||||
<appointmentTypeQuestion
|
<appointmentTypeQuestion
|
||||||
|
v-if="hasSelectableDatesLoaded"
|
||||||
v-model="appointmentTypeFromAppointmentTypeQuestion"
|
v-model="appointmentTypeFromAppointmentTypeQuestion"
|
||||||
v-show="isAppointmentTypeDisplayed"
|
v-show="isAppointmentTypeDisplayed"
|
||||||
:isServiceableMobile="isServiceableMobile"
|
:isServiceableMobile="isServiceableMobile"
|
||||||
|
|
@ -139,8 +140,6 @@
|
||||||
:isOvernightDropoff="isOvernightDropoff" />
|
:isOvernightDropoff="isOvernightDropoff" />
|
||||||
</div>
|
</div>
|
||||||
<datePicker
|
<datePicker
|
||||||
:currentZip="zipCode"
|
|
||||||
:currentProviderNumber="selectedProvider?.providerNumber"
|
|
||||||
v-show="appointmentType"
|
v-show="appointmentType"
|
||||||
customComponentId="dateQuestion"
|
customComponentId="dateQuestion"
|
||||||
selectableDatesSetting="custom"
|
selectableDatesSetting="custom"
|
||||||
|
|
@ -150,7 +149,7 @@
|
||||||
class="text-link-small"
|
class="text-link-small"
|
||||||
:getMoreDatesCallback="getMoreScheduleData"
|
:getMoreDatesCallback="getMoreScheduleData"
|
||||||
validationRules="date-required"
|
validationRules="date-required"
|
||||||
@date-clicked="handleDateClicked"
|
@date-selected="handleDateSelected"
|
||||||
:pricingByDayBasePrice="pricingByDayBasePrice"
|
:pricingByDayBasePrice="pricingByDayBasePrice"
|
||||||
:pricingByDayUpcharge="pricingByDayUpcharge"
|
:pricingByDayUpcharge="pricingByDayUpcharge"
|
||||||
:showPricingByDay="showPricingByDay"
|
:showPricingByDay="showPricingByDay"
|
||||||
|
|
@ -653,12 +652,12 @@ export default {
|
||||||
showTimeSlotQuestion() {
|
showTimeSlotQuestion() {
|
||||||
if (
|
if (
|
||||||
this.selectedDate &&
|
this.selectedDate &&
|
||||||
this.selectedDate.includes("mobile") &&
|
this.appointmentTypeFromAppointmentTypeQuestion &&
|
||||||
!this.isMobileSelected
|
this.timeSlotsForSelectedDate
|
||||||
) {
|
) {
|
||||||
this.setSelectedDateToFirstAvailable();
|
return true;
|
||||||
}
|
}
|
||||||
return this.selectedDate && this.appointmentTypeFromAppointmentTypeQuestion;
|
return false;
|
||||||
},
|
},
|
||||||
isMobileStaticRecalibrationApplicable() {
|
isMobileStaticRecalibrationApplicable() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -886,6 +885,13 @@ export default {
|
||||||
? this.$refs.mobileFirstModal?.getIsModalOpen()
|
? this.$refs.mobileFirstModal?.getIsModalOpen()
|
||||||
: false;
|
: false;
|
||||||
},
|
},
|
||||||
|
hasSelectableDatesLoaded() {
|
||||||
|
if (this.isMobileSelected) {
|
||||||
|
return this.selectableDatesMobile?.days?.length > 0;
|
||||||
|
} else {
|
||||||
|
return this.selectableDatesInshop?.days?.length > 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
splitCopyOnCMSPlaceHolder,
|
splitCopyOnCMSPlaceHolder,
|
||||||
|
|
@ -1200,8 +1206,6 @@ export default {
|
||||||
async initializeDatePicker() {
|
async initializeDatePicker() {
|
||||||
this.isShowMobileFirstAppt && this.showLoadingModal();
|
this.isShowMobileFirstAppt && this.showLoadingModal();
|
||||||
|
|
||||||
this.selectedDate = null;
|
|
||||||
|
|
||||||
const includeMobileTimeSlots = this.isServiceableMobile;
|
const includeMobileTimeSlots = this.isServiceableMobile;
|
||||||
const includeInshopTimeSlots = this.isServiceableInshop || this.isServiceableDropoff;
|
const includeInshopTimeSlots = this.isServiceableInshop || this.isServiceableDropoff;
|
||||||
const datePickerInitialData = await this.$refs.datePicker.loadInitialData({
|
const datePickerInitialData = await this.$refs.datePicker.loadInitialData({
|
||||||
|
|
@ -1613,28 +1617,39 @@ export default {
|
||||||
handleWaitListRequested(value) {
|
handleWaitListRequested(value) {
|
||||||
this.waitListRequested = value;
|
this.waitListRequested = value;
|
||||||
},
|
},
|
||||||
handleDateClicked(date) {
|
handleDateSelected(date) {
|
||||||
// do something to mark this as upcharge day or not...
|
const previousDate = this.selectedDate;
|
||||||
if (date.isPricingByDayUpchargeDay) {
|
// check if date actually changed
|
||||||
this.includePricingByDayUpcharge = true;
|
if (previousDate !== date.dateString) {
|
||||||
} else {
|
this.selectedTimeSlotInfo = this.getEmptyTimeSlot();
|
||||||
this.includePricingByDayUpcharge = false;
|
this.updateFooterButtonText(this.selectedTimeSlotInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: REMOVE AS PART OF CASH-1634
|
||||||
|
// // do something to mark this as upcharge day or not...
|
||||||
|
// if (date.isPricingByDayUpchargeDay) {
|
||||||
|
// this.includePricingByDayUpcharge = true;
|
||||||
|
// } else {
|
||||||
|
// this.includePricingByDayUpcharge = false;
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
getEmptyTimeSlot() {
|
||||||
|
return {
|
||||||
|
timeSlot: {
|
||||||
|
date: null,
|
||||||
|
routeCode: null,
|
||||||
|
startTime: null,
|
||||||
|
endTime: null,
|
||||||
|
jobMaxMinutes: null,
|
||||||
|
jobMinMinutes: null,
|
||||||
|
},
|
||||||
|
isPremiumAppointment: null,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
updateTimeSlot(timeSlotObj) {
|
updateTimeSlot(timeSlotObj) {
|
||||||
if (!timeSlotObj?.routeCode) {
|
if (!timeSlotObj?.routeCode) {
|
||||||
this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
||||||
this.selectedTimeSlotInfo = {
|
this.selectedTimeSlotInfo = this.getEmptyTimeSlot();
|
||||||
timeSlot: {
|
|
||||||
date: null,
|
|
||||||
routeCode: null,
|
|
||||||
startTime: null,
|
|
||||||
endTime: null,
|
|
||||||
jobMaxMinutes: null,
|
|
||||||
jobMinMinutes: null,
|
|
||||||
},
|
|
||||||
isPremiumAppointment: null,
|
|
||||||
};
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const timeSlot = this.timeSlotsForSelectedDate?.timeSlots?.find(
|
const timeSlot = this.timeSlotsForSelectedDate?.timeSlots?.find(
|
||||||
|
|
@ -1752,6 +1767,9 @@ export default {
|
||||||
},
|
},
|
||||||
handleAppointmentTypeChange(newAppointmentType) {
|
handleAppointmentTypeChange(newAppointmentType) {
|
||||||
this.updateFooterButtonText();
|
this.updateFooterButtonText();
|
||||||
|
// if time appointment type changes, clear any selected time slot
|
||||||
|
this.selectedTimeSlotInfo = this.getEmptyTimeSlot();
|
||||||
|
|
||||||
if (newAppointmentType === AppointmentTypeStrings.MOBILE) {
|
if (newAppointmentType === AppointmentTypeStrings.MOBILE) {
|
||||||
// Remember last shop selected if previous selection was inshop/dropoff
|
// Remember last shop selected if previous selection was inshop/dropoff
|
||||||
if (
|
if (
|
||||||
|
|
@ -1760,17 +1778,6 @@ export default {
|
||||||
AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF) &&
|
AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF) &&
|
||||||
this.selectedProvider
|
this.selectedProvider
|
||||||
) {
|
) {
|
||||||
this.selectedTimeSlotInfo = {
|
|
||||||
timeSlot: {
|
|
||||||
date: null,
|
|
||||||
routeCode: null,
|
|
||||||
startTime: null,
|
|
||||||
endTime: null,
|
|
||||||
jobMaxMinutes: null,
|
|
||||||
jobMinMinutes: null,
|
|
||||||
},
|
|
||||||
isPremiumAppointment: null,
|
|
||||||
};
|
|
||||||
this.lastSelectedInshopOrDropoffProvider = this.selectedProvider;
|
this.lastSelectedInshopOrDropoffProvider = this.selectedProvider;
|
||||||
}
|
}
|
||||||
this.appointmentType = AppointmentTypeStrings.MOBILE;
|
this.appointmentType = AppointmentTypeStrings.MOBILE;
|
||||||
|
|
@ -1797,8 +1804,8 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.appointmentType = null;
|
this.appointmentType = null;
|
||||||
}
|
}
|
||||||
this.setSelectedDateToFirstAvailable();
|
this.setSelectedDateToFirstAvailable(); // v-if on appointmentTypeQuestion ensures dates have been loaded by now
|
||||||
this.setDisplayWaitList();
|
this.setDisplayWaitList(); // v-if on appointmentTypeQuestion ensures dates have been loaded by now
|
||||||
},
|
},
|
||||||
setSelectedDateToFirstAvailable() {
|
setSelectedDateToFirstAvailable() {
|
||||||
this.selectedDate = this.getFirstAvailableDate();
|
this.selectedDate = this.getFirstAvailableDate();
|
||||||
|
|
@ -1960,35 +1967,9 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
appointmentTypeFromAppointmentTypeQuestion: {
|
appointmentTypeFromAppointmentTypeQuestion: {
|
||||||
handler(newValue, oldValue) {
|
handler(newValue, oldValue) {
|
||||||
this.handleAppointmentTypeChange(newValue);
|
this.handleAppointmentTypeChange(newValue); // v-if on appointmentTypeQuestion ensures dates have been loaded by now
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
selectedDate(newValue, oldValue) {
|
|
||||||
// Clear time slot selection if date selected changes
|
|
||||||
const selectedDate = this.getSelectedDateFromStore();
|
|
||||||
if (oldValue && this.appointmentType === AppointmentTypeStrings.MOBILE) {
|
|
||||||
oldValue = `${oldValue}-mobile`;
|
|
||||||
}
|
|
||||||
const hasValueChanged = newValue !== oldValue;
|
|
||||||
const isDateDifferent = (newValue || oldValue) !== selectedDate;
|
|
||||||
|
|
||||||
if (hasValueChanged && isDateDifferent && !this.selectedMobileFirstAppointment) {
|
|
||||||
this.selectedTimeSlotInfo = {
|
|
||||||
timeSlot: {
|
|
||||||
date: null,
|
|
||||||
routeCode: null,
|
|
||||||
startTime: null,
|
|
||||||
endTime: null,
|
|
||||||
jobMaxMinutes: null,
|
|
||||||
jobMinMinutes: null,
|
|
||||||
},
|
|
||||||
isPremiumAppointment: null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectedTimeSlotInfo(newValue) {
|
|
||||||
this.updateFooterButtonText(newValue);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="time-slots-question">
|
<div class="time-slots-question">
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
|
ref="chooseDropOffOrInshop"
|
||||||
v-if="isDropOffAppointmentAvailable"
|
v-if="isDropOffAppointmentAvailable"
|
||||||
v-model="selectedAnswerForDropOffOrInshop"
|
v-model="selectedAnswerForDropOffOrInshop"
|
||||||
@update:modelValue="dropOffSelectionChanged"
|
@update:modelValue="dropOffSelectionChanged"
|
||||||
|
|
@ -23,8 +24,9 @@
|
||||||
</div>
|
</div>
|
||||||
</buttonQuestion>
|
</buttonQuestion>
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
ref="buttonQuestion"
|
ref="chooseTimeSlot"
|
||||||
v-if="shouldDisplayTimeSlotQuestion"
|
v-if="displayTimeSlotQuestion"
|
||||||
|
v-model="selectedAnswerForTimeSlots"
|
||||||
@update:modelValue="timeSlotSelectionChanged"
|
@update:modelValue="timeSlotSelectionChanged"
|
||||||
buttonTypeString="timeSlotModalListButton"
|
buttonTypeString="timeSlotModalListButton"
|
||||||
:buttonTypeObject="timeSlotModalListButton"
|
:buttonTypeObject="timeSlotModalListButton"
|
||||||
|
|
@ -37,7 +39,6 @@
|
||||||
:lazyLoad="{ isLazyLoad: !isMobileAppointment, amountToLoad: 10 }"
|
:lazyLoad="{ isLazyLoad: !isMobileAppointment, amountToLoad: 10 }"
|
||||||
groupName="chooseTimeSlot"
|
groupName="chooseTimeSlot"
|
||||||
textPosition="text-center"
|
textPosition="text-center"
|
||||||
v-model="selectedAnswerForTimeSlots"
|
|
||||||
questionText="Available times:"
|
questionText="Available times:"
|
||||||
isRequired
|
isRequired
|
||||||
validationRules="time-slot-required" />
|
validationRules="time-slot-required" />
|
||||||
|
|
@ -389,7 +390,7 @@ export default {
|
||||||
this.answersForDropOffQuestion[0].value !== PICK_A_TIME_BUTTON_VALUE
|
this.answersForDropOffQuestion[0].value !== PICK_A_TIME_BUTTON_VALUE
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
shouldDisplayTimeSlotQuestion() {
|
displayTimeSlotQuestion() {
|
||||||
return (
|
return (
|
||||||
this.selectedAnswerForDropOffOrInshop == PICK_A_TIME_BUTTON_VALUE ||
|
this.selectedAnswerForDropOffOrInshop == PICK_A_TIME_BUTTON_VALUE ||
|
||||||
!this.isDropOffAppointmentAvailable
|
!this.isDropOffAppointmentAvailable
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ export default {
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
this.$emit("update:modelValue", newValue);
|
this.$emit("update:modelValue", newValue);
|
||||||
|
this.$emit("handle-appointment-type-change", newValue);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isMobileOnly() {
|
isMobileOnly() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue