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:
brich1212safe 2026-02-25 13:11:52 -05:00 committed by GitHub
commit 464a1a7fba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 85 additions and 42 deletions

View file

@ -89,9 +89,8 @@ import {
import settleAllPromises from '@/helpers/layout-helper'; import settleAllPromises from '@/helpers/layout-helper';
import showIssLoadingModal from '@/helpers/loading-modal-helper.js'; import showIssLoadingModal from '@/helpers/loading-modal-helper.js';
import { import {
getProviderData, getPricedMobileFeePart,
getZipCodeData, getZipCodeData
onProviderChanged
} from '@/helpers/service-location-helper'; } from '@/helpers/service-location-helper';
import { Form } from 'vee-validate'; import { Form } from 'vee-validate';
import BaseFormMixin from '@/mixins/base-form-mixin.js'; import BaseFormMixin from '@/mixins/base-form-mixin.js';
@ -225,9 +224,16 @@ export default {
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); 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 zipCodeData = getZipCodeData(serviceZipCode);
const mobileFeePartPromise = getPricedMobileFeePart(serviceZipCode);
const serviceabilityDetailsPromise = useMainStore().getServiceabilityDetails(serviceZipCode); const serviceabilityDetailsPromise = useMainStore().getServiceabilityDetails(serviceZipCode);
const getGlassFeesPromise = useMainStore().getGlassFees();
const providersPromise = useMainStore().getSafeliteProviders(serviceZipCode, 150); const providersPromise = useMainStore().getSafeliteProviders(serviceZipCode, 150);
const premiumFeePromise = useMainStore().getMobilePremiumFee(); const premiumFeePromise = useMainStore().getMobilePremiumFee();
@ -244,6 +250,14 @@ export default {
resultKey: 'cmsContent', resultKey: 'cmsContent',
promise: cmsContentPromise promise: cmsContentPromise
}, },
{
resultKey: 'mobileFeePart',
promise: mobileFeePartPromise
},
{
resultKey: 'glassFees',
promise: getGlassFeesPromise
},
{ {
resultKey: 'serviceabilityDetails', resultKey: 'serviceabilityDetails',
promise: serviceabilityDetailsPromise promise: serviceabilityDetailsPromise
@ -256,10 +270,6 @@ export default {
resultKey: 'providers', resultKey: 'providers',
promise: providersPromise promise: providersPromise
}, },
{
resultKey: 'providerChanged',
promise: onProviderChanged()
},
{ {
resultKey: 'premiumFeeWithPrice', resultKey: 'premiumFeeWithPrice',
promise: premiumFeeWithPricePromise promise: premiumFeeWithPricePromise
@ -321,6 +331,7 @@ export default {
inShopDatesData: [], inShopDatesData: [],
isMobileView: false, isMobileView: false,
mobileDatesData: [], mobileDatesData: [],
mobileFeePart: null,
mobilePremiumAppointmentFee: null, mobilePremiumAppointmentFee: null,
mobileProviderNumber: null, mobileProviderNumber: null,
selectableDatesData: [], selectableDatesData: [],
@ -647,9 +658,7 @@ export default {
} }
}, },
mobileZipUpdatedFromServiceLocation(mobileZipServiceLocation) { mobileZipUpdatedFromServiceLocation(mobileZipServiceLocation) {
if (mobileZipServiceLocation if (mobileZipServiceLocation) {
&& (this.mobileProviderNumber !== mobileZipServiceLocation.mobileProviderNumber
|| !this.hasNeededServiceLocationData)) {
this.mobileProviderNumber = mobileZipServiceLocation.mobileProviderNumber; this.mobileProviderNumber = mobileZipServiceLocation.mobileProviderNumber;
this.selectedMobileZipCode = mobileZipServiceLocation.zipCode; this.selectedMobileZipCode = mobileZipServiceLocation.zipCode;
this.selectedServiceLocation = mobileZipServiceLocation; this.selectedServiceLocation = mobileZipServiceLocation;
@ -661,18 +670,22 @@ export default {
}, },
async providerChangedFromServiceLocation(newProvider) { async providerChangedFromServiceLocation(newProvider) {
this.selectedProvider = newProvider?.provider; this.selectedProvider = newProvider?.provider;
if (newProvider?.provider) { if (newProvider?.refreshDatePicker && newProvider.provider) {
this.mainStore.updateServiceLocation(newProvider); this.mainStore.updateServiceLocationProvider(newProvider.provider);
showIssLoadingModal(true); showIssLoadingModal(true);
await onProviderChanged(); await this.mainStore.getBillToInfo(newProvider.provider?.providerNumber)
if (newProvider.refreshDatePicker) { .then(() => {
await this.refreshDatePicker(); this.refreshDatePicker();
} else { })
showIssLoadingModal(false); .catch(() => {
} console.warn('Error fetching bill to info...');
showIssLoadingModal(false);
});
} }
}, },
async refreshDatePicker() { async refreshDatePicker() {
console.log('refresh date picker...');
this.resetLocalFlags(); this.resetLocalFlags();
await this.getDatePickerInitialData().then((data) => { await this.getDatePickerInitialData().then((data) => {
this.selectableDatesData = data.initialShopTimeSlotsResponse; this.selectableDatesData = data.initialShopTimeSlotsResponse;
@ -700,7 +713,7 @@ export default {
appointmentTypeToUse = AppointmentTypeStrings.DROP_OFF; appointmentTypeToUse = AppointmentTypeStrings.DROP_OFF;
} }
this.mainStore.updateAppointmentType(appointmentTypeToUse); await this.$refs.serviceLocation.forwardButtonAction(appointmentTypeToUse);
this.mainStore.saveSchedule(this.selectedTimeSlotInfo.timeSlot); this.mainStore.saveSchedule(this.selectedTimeSlotInfo.timeSlot);
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD, this.navigationScenarios.CLICKED_FORWARD,

View file

@ -182,6 +182,7 @@ export default {
isRecalibrationServiceableMobile: null, isRecalibrationServiceableMobile: null,
selectedAppointmentType: this.getSelectedAppointmentType(), selectedAppointmentType: this.getSelectedAppointmentType(),
selectedProvider: this.getSelectedProvider(), selectedProvider: this.getSelectedProvider(),
mobileFeePart: null,
mobileProviderNumber: null, mobileProviderNumber: null,
zipContainsMilitaryBase: false, zipContainsMilitaryBase: false,
zipCodeCtu: null, zipCodeCtu: null,
@ -236,7 +237,8 @@ export default {
); );
}, },
isMobile() { isMobile() {
return this.selectedAppointmentType === AppointmentTypeStrings.MOBILE; return this.selectedAppointmentType === AppointmentTypeStrings.MOBILE
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
}, },
isServiceableInshop() { isServiceableInshop() {
if (this.isRecalibrationServiceableInshop !== null) { if (this.isRecalibrationServiceableInshop !== null) {
@ -339,27 +341,16 @@ export default {
} }
}, },
selectedProvider(newProvider, oldProvider) { selectedProvider(newProvider, oldProvider) {
if (newProvider?.providerNumber !== oldProvider?.providerNumber) { if (newProvider?.providerNumber !== oldProvider?.providerNumber || this.availabilityRating === null) {
const appointmentIsInshop = this.isInshop; const appointmentIsInshop = this.isInshop;
const returnedProvider = { const returnedProvider = {
refreshDatePicker: appointmentIsInshop && oldProvider?.providerNumber !== null, provider: newProvider,
state: this.state, refreshDatePicker: appointmentIsInshop && oldProvider?.providerNumber !== null
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
}
}
}; };
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); await this.setData(initialData);
this.initializingData = false; 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) { openModalAction(modalName) {
this.$refs[modalName].openModal(); this.$refs[modalName].openModal();
}, },
@ -446,6 +465,10 @@ export default {
this.setServiceabilityDetails(initialData.serviceabilityDetails); this.setServiceabilityDetails(initialData.serviceabilityDetails);
} }
if (initialData.mobileFeePart) {
this.mobileFeePart = initialData.mobileFeePart;
}
if (initialData.providers) { if (initialData.providers) {
this.setMobileProviderNumber(initialData.providers.mobileProviderNumber); this.setMobileProviderNumber(initialData.providers.mobileProviderNumber);
let foundMatch = false; let foundMatch = false;
@ -462,12 +485,22 @@ export default {
this.selectedProvider = null; this.selectedProvider = null;
} }
} }
if (initialData.glassFees) {
useMainStore().getCombinedQuote(initialData.glassFees)
.then((combinedQuote) => {
this.setGlassFeeItems(combinedQuote);
});
}
}, },
setContainsMilitaryBase(val) { setContainsMilitaryBase(val) {
if (this.zipContainsMilitaryBase !== val) { if (this.zipContainsMilitaryBase !== val) {
this.zipContainsMilitaryBase = val; this.zipContainsMilitaryBase = val;
} }
}, },
setGlassFeeItems(newGlassFeeItems) {
this.mainStore.updateGlassFees(newGlassFeeItems);
},
setMobileProviderNumber(providerNumber) { setMobileProviderNumber(providerNumber) {
this.mobileProviderNumber = providerNumber; this.mobileProviderNumber = providerNumber;
}, },

View file

@ -426,7 +426,7 @@ export default {
`+${formatAmountInDollars(getPriceOfLineItem(this.premiumAppointmentFee))}`; `+${formatAmountInDollars(getPriceOfLineItem(this.premiumAppointmentFee))}`;
return { 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), value: this.addPremiumFlagToInput(timeSlotData.id),
buttonLabel: this.premiumAppointmentButtonText, buttonLabel: this.premiumAppointmentButtonText,
buttonLabelSubCopy: formattedPrice, buttonLabelSubCopy: formattedPrice,

View file

@ -1865,7 +1865,6 @@ export const useMainStore = defineStore({
resetState() { resetState() {
Object.assign(this, getDefaultState()); Object.assign(this, getDefaultState());
}, },
resetRegistrationState() { resetRegistrationState() {
this.order.vehicle.registration.licensePlate = null; this.order.vehicle.registration.licensePlate = null;
this.order.vehicle.registration.address = null; this.order.vehicle.registration.address = null;
@ -1904,14 +1903,12 @@ export const useMainStore = defineStore({
this.order.serviceLocation.state = null; this.order.serviceLocation.state = null;
this.order.serviceLocation.isVehicleProtected = null; this.order.serviceLocation.isVehicleProtected = null;
}, },
resetBailout() { resetBailout() {
this.updatePageData({ this.updatePageData({
page: issPageValues.BAILOUT_PAGE, page: issPageValues.BAILOUT_PAGE,
data: null data: null
}); });
}, },
resetInsurance() { resetInsurance() {
this.order.insuranceCoverage.coverageStatus = coverageStatuses.PENDING; this.order.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
this.order.insuranceCoverage.coverageType = coverageType.NONE; this.order.insuranceCoverage.coverageType = coverageType.NONE;