Merge pull request #1114 from Safelite/feature/richardson/INSR-schedule.revertage
Some updates to revert some updates from previous PR
This commit is contained in:
commit
464a1a7fba
4 changed files with 85 additions and 42 deletions
|
|
@ -89,9 +89,8 @@ import {
|
|||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import showIssLoadingModal from '@/helpers/loading-modal-helper.js';
|
||||
import {
|
||||
getProviderData,
|
||||
getZipCodeData,
|
||||
onProviderChanged
|
||||
getPricedMobileFeePart,
|
||||
getZipCodeData
|
||||
} from '@/helpers/service-location-helper';
|
||||
import { Form } from 'vee-validate';
|
||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
|
|
@ -225,9 +224,16 @@ export default {
|
|||
async beforeRouteEnter(to, from, next) {
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
const { isMobileAppointment, storeServiceLocation, storeSelectedProvider, serviceZipCode } = getProviderData();
|
||||
const storeServiceLocation = useMainStore().order.serviceLocation;
|
||||
const storeSelectedAppointmentType = storeServiceLocation?.appointmentType;
|
||||
const isMobileAppointment = storeSelectedAppointmentType === AppointmentTypeStrings.MOBILE
|
||||
|| storeSelectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
|
||||
const storeSelectedProvider = storeServiceLocation?.provider;
|
||||
const serviceZipCode = storeServiceLocation?.zipCode || useMainStore().order.customer.address.zipCode;
|
||||
const zipCodeData = getZipCodeData(serviceZipCode);
|
||||
const mobileFeePartPromise = getPricedMobileFeePart(serviceZipCode);
|
||||
const serviceabilityDetailsPromise = useMainStore().getServiceabilityDetails(serviceZipCode);
|
||||
const getGlassFeesPromise = useMainStore().getGlassFees();
|
||||
const providersPromise = useMainStore().getSafeliteProviders(serviceZipCode, 150);
|
||||
|
||||
const premiumFeePromise = useMainStore().getMobilePremiumFee();
|
||||
|
|
@ -244,6 +250,14 @@ export default {
|
|||
resultKey: 'cmsContent',
|
||||
promise: cmsContentPromise
|
||||
},
|
||||
{
|
||||
resultKey: 'mobileFeePart',
|
||||
promise: mobileFeePartPromise
|
||||
},
|
||||
{
|
||||
resultKey: 'glassFees',
|
||||
promise: getGlassFeesPromise
|
||||
},
|
||||
{
|
||||
resultKey: 'serviceabilityDetails',
|
||||
promise: serviceabilityDetailsPromise
|
||||
|
|
@ -256,10 +270,6 @@ export default {
|
|||
resultKey: 'providers',
|
||||
promise: providersPromise
|
||||
},
|
||||
{
|
||||
resultKey: 'providerChanged',
|
||||
promise: onProviderChanged()
|
||||
},
|
||||
{
|
||||
resultKey: 'premiumFeeWithPrice',
|
||||
promise: premiumFeeWithPricePromise
|
||||
|
|
@ -321,6 +331,7 @@ export default {
|
|||
inShopDatesData: [],
|
||||
isMobileView: false,
|
||||
mobileDatesData: [],
|
||||
mobileFeePart: null,
|
||||
mobilePremiumAppointmentFee: null,
|
||||
mobileProviderNumber: null,
|
||||
selectableDatesData: [],
|
||||
|
|
@ -647,9 +658,7 @@ export default {
|
|||
}
|
||||
},
|
||||
mobileZipUpdatedFromServiceLocation(mobileZipServiceLocation) {
|
||||
if (mobileZipServiceLocation
|
||||
&& (this.mobileProviderNumber !== mobileZipServiceLocation.mobileProviderNumber
|
||||
|| !this.hasNeededServiceLocationData)) {
|
||||
if (mobileZipServiceLocation) {
|
||||
this.mobileProviderNumber = mobileZipServiceLocation.mobileProviderNumber;
|
||||
this.selectedMobileZipCode = mobileZipServiceLocation.zipCode;
|
||||
this.selectedServiceLocation = mobileZipServiceLocation;
|
||||
|
|
@ -661,18 +670,22 @@ export default {
|
|||
},
|
||||
async providerChangedFromServiceLocation(newProvider) {
|
||||
this.selectedProvider = newProvider?.provider;
|
||||
if (newProvider?.provider) {
|
||||
this.mainStore.updateServiceLocation(newProvider);
|
||||
if (newProvider?.refreshDatePicker && newProvider.provider) {
|
||||
this.mainStore.updateServiceLocationProvider(newProvider.provider);
|
||||
|
||||
showIssLoadingModal(true);
|
||||
await onProviderChanged();
|
||||
if (newProvider.refreshDatePicker) {
|
||||
await this.refreshDatePicker();
|
||||
} else {
|
||||
showIssLoadingModal(false);
|
||||
}
|
||||
await this.mainStore.getBillToInfo(newProvider.provider?.providerNumber)
|
||||
.then(() => {
|
||||
this.refreshDatePicker();
|
||||
})
|
||||
.catch(() => {
|
||||
console.warn('Error fetching bill to info...');
|
||||
showIssLoadingModal(false);
|
||||
});
|
||||
}
|
||||
},
|
||||
async refreshDatePicker() {
|
||||
console.log('refresh date picker...');
|
||||
this.resetLocalFlags();
|
||||
await this.getDatePickerInitialData().then((data) => {
|
||||
this.selectableDatesData = data.initialShopTimeSlotsResponse;
|
||||
|
|
@ -700,7 +713,7 @@ export default {
|
|||
appointmentTypeToUse = AppointmentTypeStrings.DROP_OFF;
|
||||
}
|
||||
|
||||
this.mainStore.updateAppointmentType(appointmentTypeToUse);
|
||||
await this.$refs.serviceLocation.forwardButtonAction(appointmentTypeToUse);
|
||||
this.mainStore.saveSchedule(this.selectedTimeSlotInfo.timeSlot);
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD,
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ export default {
|
|||
isRecalibrationServiceableMobile: null,
|
||||
selectedAppointmentType: this.getSelectedAppointmentType(),
|
||||
selectedProvider: this.getSelectedProvider(),
|
||||
mobileFeePart: null,
|
||||
mobileProviderNumber: null,
|
||||
zipContainsMilitaryBase: false,
|
||||
zipCodeCtu: null,
|
||||
|
|
@ -236,7 +237,8 @@ export default {
|
|||
);
|
||||
},
|
||||
isMobile() {
|
||||
return this.selectedAppointmentType === AppointmentTypeStrings.MOBILE;
|
||||
return this.selectedAppointmentType === AppointmentTypeStrings.MOBILE
|
||||
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
|
||||
},
|
||||
isServiceableInshop() {
|
||||
if (this.isRecalibrationServiceableInshop !== null) {
|
||||
|
|
@ -339,27 +341,16 @@ export default {
|
|||
}
|
||||
},
|
||||
selectedProvider(newProvider, oldProvider) {
|
||||
if (newProvider?.providerNumber !== oldProvider?.providerNumber) {
|
||||
if (newProvider?.providerNumber !== oldProvider?.providerNumber || this.availabilityRating === null) {
|
||||
const appointmentIsInshop = this.isInshop;
|
||||
const returnedProvider = {
|
||||
refreshDatePicker: appointmentIsInshop && oldProvider?.providerNumber !== null,
|
||||
state: this.state,
|
||||
zipCode: this.zipCode,
|
||||
zipCodeCtu: this.zipCodeCtu,
|
||||
appointmentType: this.selectedAppointmentType,
|
||||
provider: !this.isMobile ? newProvider : {
|
||||
providerNumber: this.mobileProviderNumber,
|
||||
address: {
|
||||
streetAddress: null,
|
||||
city: null,
|
||||
state: null,
|
||||
zipCode: null,
|
||||
zipCodeCtu: null
|
||||
}
|
||||
}
|
||||
provider: newProvider,
|
||||
refreshDatePicker: appointmentIsInshop && oldProvider?.providerNumber !== null
|
||||
};
|
||||
|
||||
this.$emit('provider-changed', returnedProvider);
|
||||
if (newProvider?.providerNumber !== oldProvider?.providerNumber) {
|
||||
this.$emit('provider-changed', returnedProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -369,6 +360,34 @@ export default {
|
|||
await this.setData(initialData);
|
||||
this.initializingData = false;
|
||||
},
|
||||
async forwardButtonAction(appointmentType) {
|
||||
let provider = this.selectedProvider;
|
||||
this.mainStore.updateMobileFee(null);
|
||||
if (this.isMobile) {
|
||||
if (this.mainStore.isNoComp || this.mainStore.isITAC) {
|
||||
this.mainStore.updateMobileFee(this.mobileFeePart);
|
||||
}
|
||||
|
||||
provider = {
|
||||
providerNumber: this.mobileProviderNumber,
|
||||
address: {
|
||||
streetAddress: null,
|
||||
city: null,
|
||||
state: null,
|
||||
zipCode: null,
|
||||
zipCodeCtu: null
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.mainStore.saveServiceLocation({
|
||||
state: this.state,
|
||||
zipCode: this.zipCode,
|
||||
zipCodeCtu: this.zipCodeCtu,
|
||||
appointmentType: appointmentType || this.selectedAppointmentType,
|
||||
provider
|
||||
});
|
||||
},
|
||||
openModalAction(modalName) {
|
||||
this.$refs[modalName].openModal();
|
||||
},
|
||||
|
|
@ -446,6 +465,10 @@ export default {
|
|||
this.setServiceabilityDetails(initialData.serviceabilityDetails);
|
||||
}
|
||||
|
||||
if (initialData.mobileFeePart) {
|
||||
this.mobileFeePart = initialData.mobileFeePart;
|
||||
}
|
||||
|
||||
if (initialData.providers) {
|
||||
this.setMobileProviderNumber(initialData.providers.mobileProviderNumber);
|
||||
let foundMatch = false;
|
||||
|
|
@ -462,12 +485,22 @@ export default {
|
|||
this.selectedProvider = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (initialData.glassFees) {
|
||||
useMainStore().getCombinedQuote(initialData.glassFees)
|
||||
.then((combinedQuote) => {
|
||||
this.setGlassFeeItems(combinedQuote);
|
||||
});
|
||||
}
|
||||
},
|
||||
setContainsMilitaryBase(val) {
|
||||
if (this.zipContainsMilitaryBase !== val) {
|
||||
this.zipContainsMilitaryBase = val;
|
||||
}
|
||||
},
|
||||
setGlassFeeItems(newGlassFeeItems) {
|
||||
this.mainStore.updateGlassFees(newGlassFeeItems);
|
||||
},
|
||||
setMobileProviderNumber(providerNumber) {
|
||||
this.mobileProviderNumber = providerNumber;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ export default {
|
|||
`+${formatAmountInDollars(getPriceOfLineItem(this.premiumAppointmentFee))}`;
|
||||
|
||||
return {
|
||||
// Unique value is required for each <input> and the premium appoinment shares an id
|
||||
// Unique value is required for each <input> and the premium appointment shares an id
|
||||
value: this.addPremiumFlagToInput(timeSlotData.id),
|
||||
buttonLabel: this.premiumAppointmentButtonText,
|
||||
buttonLabelSubCopy: formattedPrice,
|
||||
|
|
|
|||
|
|
@ -1865,7 +1865,6 @@ export const useMainStore = defineStore({
|
|||
resetState() {
|
||||
Object.assign(this, getDefaultState());
|
||||
},
|
||||
|
||||
resetRegistrationState() {
|
||||
this.order.vehicle.registration.licensePlate = null;
|
||||
this.order.vehicle.registration.address = null;
|
||||
|
|
@ -1904,14 +1903,12 @@ export const useMainStore = defineStore({
|
|||
this.order.serviceLocation.state = null;
|
||||
this.order.serviceLocation.isVehicleProtected = null;
|
||||
},
|
||||
|
||||
resetBailout() {
|
||||
this.updatePageData({
|
||||
page: issPageValues.BAILOUT_PAGE,
|
||||
data: null
|
||||
});
|
||||
},
|
||||
|
||||
resetInsurance() {
|
||||
this.order.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||
this.order.insuranceCoverage.coverageType = coverageType.NONE;
|
||||
|
|
|
|||
Loading…
Reference in a new issue