Merge pull request #1052 from Safelite/feature/richardson/INSR-8114.3
Mobile appt updates
This commit is contained in:
commit
a4673a8e2b
4 changed files with 50 additions and 11 deletions
|
|
@ -559,6 +559,7 @@ export default {
|
||||||
this.selectTimeSlotForDay(timeSlot);
|
this.selectTimeSlotForDay(timeSlot);
|
||||||
},
|
},
|
||||||
async setCalendarData(config = {}) {
|
async setCalendarData(config = {}) {
|
||||||
|
// set selectable dates data
|
||||||
config.initialShopTimeSlotsResponse.days.forEach((selectableDate) => {
|
config.initialShopTimeSlotsResponse.days.forEach((selectableDate) => {
|
||||||
const dateObjectToPush = {
|
const dateObjectToPush = {
|
||||||
date: selectableDate.date,
|
date: selectableDate.date,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
ref="serviceLocation"
|
ref="serviceLocation"
|
||||||
@appointmentTypeChanged="appointmentTypeChangedFromServiceLocation"
|
@appointmentTypeChanged="appointmentTypeChangedFromServiceLocation"
|
||||||
@cityUpdated="cityUpdatedFromServiceLocation"
|
@cityUpdated="cityUpdatedFromServiceLocation"
|
||||||
|
@inShopZipUpdated="inShopZipUpdatedFromServiceLocation"
|
||||||
@mobileZipUpdated="mobileZipUpdatedFromServiceLocation"
|
@mobileZipUpdated="mobileZipUpdatedFromServiceLocation"
|
||||||
@providerChanged="providerChangedFromServiceLocation" />
|
@providerChanged="providerChangedFromServiceLocation" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -182,7 +183,8 @@ const getAvailableDates = async (
|
||||||
storeAction.payload.endDate,
|
storeAction.payload.endDate,
|
||||||
storeAction.payload.zipCodeOverride
|
storeAction.payload.zipCodeOverride
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
console.log('Error fetching mobile time slots:', error);
|
// eslint-disable-next-line no-console
|
||||||
|
console.warn('Error fetching mobile time slots:', error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -224,6 +226,8 @@ export default {
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||||
const storeServiceLocation = useMainStore().order.serviceLocation;
|
const storeServiceLocation = useMainStore().order.serviceLocation;
|
||||||
const storeSelectedAppointmentType = storeServiceLocation?.appointmentType;
|
const storeSelectedAppointmentType = storeServiceLocation?.appointmentType;
|
||||||
|
const isMobileAppointment = storeSelectedAppointmentType === AppointmentTypeStrings.MOBILE
|
||||||
|
|| storeSelectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
|
||||||
const storeSelectedProvider = storeServiceLocation?.provider;
|
const storeSelectedProvider = storeServiceLocation?.provider;
|
||||||
const serviceZipCode = storeServiceLocation?.zipCode || useMainStore().order.customer.address.zipCode;
|
const serviceZipCode = storeServiceLocation?.zipCode || useMainStore().order.customer.address.zipCode;
|
||||||
const zipCodeData = getZipCodeData(serviceZipCode);
|
const zipCodeData = getZipCodeData(serviceZipCode);
|
||||||
|
|
@ -275,6 +279,9 @@ export default {
|
||||||
// use resultMap to populate layout content.
|
// use resultMap to populate layout content.
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
const serviceLocationData = {
|
const serviceLocationData = {
|
||||||
|
defaultMobileZipCode: isMobileAppointment
|
||||||
|
? storeServiceLocation?.zipCode
|
||||||
|
: '',
|
||||||
glassFees: resultMap.glassFees,
|
glassFees: resultMap.glassFees,
|
||||||
mobileFeePart: resultMap.mobileFeePart,
|
mobileFeePart: resultMap.mobileFeePart,
|
||||||
providers: resultMap.providers,
|
providers: resultMap.providers,
|
||||||
|
|
@ -285,8 +292,6 @@ export default {
|
||||||
next(async (vm) => {
|
next(async (vm) => {
|
||||||
const providerToUse = resultMap.providers?.shopProviders
|
const providerToUse = resultMap.providers?.shopProviders
|
||||||
.find((provider) => provider.providerNumber === storeSelectedProvider?.providerNumber) || resultMap.providers?.shopProviders[0];
|
.find((provider) => provider.providerNumber === storeSelectedProvider?.providerNumber) || resultMap.providers?.shopProviders[0];
|
||||||
const isMobileAppointment = storeSelectedAppointmentType === AppointmentTypeStrings.MOBILE
|
|
||||||
|| storeSelectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
|
|
||||||
const initialServiceLocationObj = {
|
const initialServiceLocationObj = {
|
||||||
mobileProviderNumber: isMobileAppointment
|
mobileProviderNumber: isMobileAppointment
|
||||||
? storeSelectedProvider?.providerNumber
|
? storeSelectedProvider?.providerNumber
|
||||||
|
|
@ -314,10 +319,10 @@ export default {
|
||||||
mobileFeePart: null,
|
mobileFeePart: null,
|
||||||
mobilePremiumAppointmentFee: null,
|
mobilePremiumAppointmentFee: null,
|
||||||
mobileProviderNumber: null,
|
mobileProviderNumber: null,
|
||||||
mobileZipCodeOverride: null,
|
|
||||||
selectableDatesData: [],
|
selectableDatesData: [],
|
||||||
selectedAppointmentType: this.getAppointmentType(),
|
selectedAppointmentType: this.getAppointmentType(),
|
||||||
selectedDate: this.getSelectedDate(),
|
selectedDate: this.getSelectedDate(),
|
||||||
|
selectedMobileZipCode: null,
|
||||||
selectedProvider: this.getSelectedProvider(),
|
selectedProvider: this.getSelectedProvider(),
|
||||||
selectedServiceLocation: this.getServiceLocation(),
|
selectedServiceLocation: this.getServiceLocation(),
|
||||||
selectedServiceLocationCity: this.getServiceLocationCity(),
|
selectedServiceLocationCity: this.getServiceLocationCity(),
|
||||||
|
|
@ -401,6 +406,7 @@ export default {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.mobileProviderNumber = initialServiceLocationObj.mobileProviderNumber;
|
this.mobileProviderNumber = initialServiceLocationObj.mobileProviderNumber;
|
||||||
|
this.selectedMobileZipCode = initialServiceLocationObj.zipCode;
|
||||||
await this.getDatePickerInitialData().then((initialData) => {
|
await this.getDatePickerInitialData().then((initialData) => {
|
||||||
this.selectableDatesData = initialData.initialShopTimeSlotsResponse;
|
this.selectableDatesData = initialData.initialShopTimeSlotsResponse;
|
||||||
this.$refs.datePicker.setCalendarData(initialData);
|
this.$refs.datePicker.setCalendarData(initialData);
|
||||||
|
|
@ -430,11 +436,18 @@ export default {
|
||||||
return this.mainStore.order?.serviceLocation?.appointmentType;
|
return this.mainStore.order?.serviceLocation?.appointmentType;
|
||||||
},
|
},
|
||||||
async getAvailableDatesMethod(startDate, endDate) {
|
async getAvailableDatesMethod(startDate, endDate) {
|
||||||
|
let mobileProviderNumberToUse = this.mobileProviderNumber;
|
||||||
|
if (this.selectedAppointmentType === AppointmentTypeStrings.MOBILE
|
||||||
|
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) {
|
||||||
|
mobileProviderNumberToUse = this.selectedServiceLocation.mobileProviderNumber;
|
||||||
|
}
|
||||||
|
|
||||||
const newShopTimeSlots = await getAvailableDates(
|
const newShopTimeSlots = await getAvailableDates(
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
this.selectedAppointmentType,
|
this.selectedAppointmentType,
|
||||||
this.selectedProvider.providerNumber
|
this.selectedProvider.providerNumber || mobileProviderNumberToUse,
|
||||||
|
this.selectedMobileZipCode
|
||||||
);
|
);
|
||||||
// ADD API CALL RESULTS TO EXISTING DATE DATA
|
// ADD API CALL RESULTS TO EXISTING DATE DATA
|
||||||
this.selectableDatesData.days =
|
this.selectableDatesData.days =
|
||||||
|
|
@ -590,9 +603,17 @@ export default {
|
||||||
handleMqlChange(e) {
|
handleMqlChange(e) {
|
||||||
this.isMobileView = !e.matches;
|
this.isMobileView = !e.matches;
|
||||||
},
|
},
|
||||||
|
inShopZipUpdatedFromServiceLocation(inShopZipServiceLocation) {
|
||||||
|
if (inShopZipServiceLocation) {
|
||||||
|
this.mobileProviderNumber = null;
|
||||||
|
this.selectedMobileZipCode = null;
|
||||||
|
this.selectedServiceLocation = inShopZipServiceLocation;
|
||||||
|
}
|
||||||
|
},
|
||||||
mobileZipUpdatedFromServiceLocation(mobileZipServiceLocation) {
|
mobileZipUpdatedFromServiceLocation(mobileZipServiceLocation) {
|
||||||
if (mobileZipServiceLocation) {
|
if (mobileZipServiceLocation) {
|
||||||
this.mobileProviderNumber = mobileZipServiceLocation.mobileProviderNumber;
|
this.mobileProviderNumber = mobileZipServiceLocation.mobileProviderNumber;
|
||||||
|
this.selectedMobileZipCode = mobileZipServiceLocation.zipCode;
|
||||||
this.selectedServiceLocation = mobileZipServiceLocation;
|
this.selectedServiceLocation = mobileZipServiceLocation;
|
||||||
|
|
||||||
if (mobileZipServiceLocation.refreshDatePicker) {
|
if (mobileZipServiceLocation.refreshDatePicker) {
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ export default {
|
||||||
serviceZipQuestion
|
serviceZipQuestion
|
||||||
},
|
},
|
||||||
mixins: [baseFormMixin],
|
mixins: [baseFormMixin],
|
||||||
emits: ['appointment-type-changed', 'city-updated', 'mobile-zip-updated', 'provider-changed'],
|
emits: ['appointment-type-changed', 'city-updated', 'in-shop-zip-updated', 'mobile-zip-updated', 'provider-changed'],
|
||||||
setup() {
|
setup() {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
return { mainStore };
|
return { mainStore };
|
||||||
|
|
@ -171,6 +171,7 @@ export default {
|
||||||
city: this.getServiceCityFromStore(),
|
city: this.getServiceCityFromStore(),
|
||||||
state: this.getServiceStateFromStore(),
|
state: this.getServiceStateFromStore(),
|
||||||
zipCode: this.getServiceZipCodeFromStore(),
|
zipCode: this.getServiceZipCodeFromStore(),
|
||||||
|
initializingData: false,
|
||||||
isGlassServiceableInshop: null,
|
isGlassServiceableInshop: null,
|
||||||
isRecalibrationServiceableInshop: null,
|
isRecalibrationServiceableInshop: null,
|
||||||
isGlassServiceableMobile: null,
|
isGlassServiceableMobile: null,
|
||||||
|
|
@ -289,7 +290,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mobileZipCode(newZip, oldZip) {
|
async mobileZipCode(newZip, oldZip) {
|
||||||
if (newZip !== '' && newZip !== oldZip) {
|
if (newZip !== '' && newZip !== oldZip && !this.initializingData) {
|
||||||
showIssLoadingModal(true);
|
showIssLoadingModal(true);
|
||||||
await this.updateMobileZip();
|
await this.updateMobileZip();
|
||||||
const updateMobileZipServiceLocationObj = {
|
const updateMobileZipServiceLocationObj = {
|
||||||
|
|
@ -348,8 +349,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initializeComponent(initialData) {
|
async initializeComponent(initialData) {
|
||||||
this.setData(initialData);
|
this.initializingData = true;
|
||||||
|
await this.setData(initialData);
|
||||||
|
this.initializingData = false;
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
let provider = this.selectedProvider;
|
let provider = this.selectedProvider;
|
||||||
|
|
@ -424,6 +427,17 @@ export default {
|
||||||
if (details) {
|
if (details) {
|
||||||
this.setServiceabilityDetails(details);
|
this.setServiceabilityDetails(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const inShopZipServiceLocationObj = {
|
||||||
|
appointmentType: AppointmentTypeStrings.IN_SHOP,
|
||||||
|
mobileProviderNumber: null,
|
||||||
|
provider: this.selectedProvider,
|
||||||
|
refreshDatePicker: false,
|
||||||
|
resetDatePicker: false,
|
||||||
|
zipCode: newZip,
|
||||||
|
zipCodeCtu: zipCodeData.zipCodeCtu
|
||||||
|
};
|
||||||
|
this.$emit('in-shop-zip-updated', inShopZipServiceLocationObj);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
refreshAvailabilityRating() {
|
refreshAvailabilityRating() {
|
||||||
|
|
@ -447,7 +461,11 @@ export default {
|
||||||
setCtuForMobile(val) {
|
setCtuForMobile(val) {
|
||||||
this.zipCodeCtu = val;
|
this.zipCodeCtu = val;
|
||||||
},
|
},
|
||||||
setData(initialData) {
|
async setData(initialData) {
|
||||||
|
if (initialData.defaultMobileZipCode) {
|
||||||
|
this.mobileZipCode = initialData.defaultMobileZipCode;
|
||||||
|
}
|
||||||
|
|
||||||
if (initialData.zipCodeData) {
|
if (initialData.zipCodeData) {
|
||||||
this.zipContainsMilitaryBase = initialData.zipCodeData.containsMilitaryBase;
|
this.zipContainsMilitaryBase = initialData.zipCodeData.containsMilitaryBase;
|
||||||
this.zipCodeCtu = initialData.zipCodeData.zipCodeCtu;
|
this.zipCodeCtu = initialData.zipCodeData.zipCodeCtu;
|
||||||
|
|
|
||||||
|
|
@ -509,7 +509,6 @@ form {
|
||||||
:deep(.input-wrapper) {
|
:deep(.input-wrapper) {
|
||||||
input[type="date"]::-webkit-calendar-picker-indicator {
|
input[type="date"]::-webkit-calendar-picker-indicator {
|
||||||
background-color: $svg-calendar-error-fill-color;
|
background-color: $svg-calendar-error-fill-color;
|
||||||
// eslint-disable-next-line max-len
|
|
||||||
background-image: url($svg-error-calendar-graphic);
|
background-image: url($svg-error-calendar-graphic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue