format only
This commit is contained in:
parent
138efb9ccd
commit
ccb1356029
1 changed files with 27 additions and 35 deletions
|
|
@ -89,7 +89,7 @@ import settleAllPromises from '@/helpers/layout-helper';
|
||||||
import routerParams from '@/router/router-constants/router-params';
|
import routerParams from '@/router/router-constants/router-params';
|
||||||
import {
|
import {
|
||||||
getDamageString,
|
getDamageString,
|
||||||
isGlassAvailableForCarId,
|
isGlassAvailableForCarId
|
||||||
} from '@/helpers/damage-helper';
|
} from '@/helpers/damage-helper';
|
||||||
|
|
||||||
import vinPagesMixin from '@/mixins/vin-pages-mixin';
|
import vinPagesMixin from '@/mixins/vin-pages-mixin';
|
||||||
|
|
@ -105,7 +105,7 @@ export default {
|
||||||
customerQuestions,
|
customerQuestions,
|
||||||
alert,
|
alert,
|
||||||
// eslint-disable-next-line vue/no-reserved-component-names
|
// eslint-disable-next-line vue/no-reserved-component-names
|
||||||
Form,
|
Form
|
||||||
},
|
},
|
||||||
mixins: [baseFormMixin, vinPagesMixin],
|
mixins: [baseFormMixin, vinPagesMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
|
@ -116,8 +116,8 @@ export default {
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
resultKey: 'cmsContent',
|
resultKey: 'cmsContent',
|
||||||
promise: cmsContentPromise,
|
promise: cmsContentPromise
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
@ -138,7 +138,7 @@ export default {
|
||||||
isCarIdDifferent: false,
|
isCarIdDifferent: false,
|
||||||
isSelectedGlassAvailableForVehicle: true,
|
isSelectedGlassAvailableForVehicle: true,
|
||||||
customAlertData: {},
|
customAlertData: {},
|
||||||
forwardButtonCarStyle: '',
|
forwardButtonCarStyle: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -198,20 +198,18 @@ export default {
|
||||||
useMainStore().order.vehicle.make
|
useMainStore().order.vehicle.make
|
||||||
} ${useMainStore().order.vehicle.model}`;
|
} ${useMainStore().order.vehicle.model}`;
|
||||||
return vinYmmFound.toLowerCase() === vinYmmExpected.toLowerCase();
|
return vinYmmFound.toLowerCase() === vinYmmExpected.toLowerCase();
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
customerQuestions: {
|
customerQuestions: {
|
||||||
handler() {
|
handler() {
|
||||||
// if they modify one of the lookup fields (address, city, state, zipCode, or lastName),
|
// if they modify one of the lookup fields (address, city, state, zipCode, or lastName),
|
||||||
// then modify the button text back to "Get my personalized quote"
|
// then modify the button text back to "Get my personalized quote"
|
||||||
this.$refs.siteFooter.updateButtonText(
|
this.$refs.siteFooter.updateButtonText(this.getCmsContent('siteFooterWidget', 'ForwardButtonText'));
|
||||||
this.getCmsContent('siteFooterWidget', 'ForwardButtonText')
|
|
||||||
);
|
|
||||||
this.resetWarningsAndErrors();
|
this.resetWarningsAndErrors();
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.attachCustomEvents();
|
this.attachCustomEvents();
|
||||||
|
|
@ -242,15 +240,15 @@ export default {
|
||||||
licenseStreetAddress:
|
licenseStreetAddress:
|
||||||
this.customerQuestions.addressQuestions.streetAddress,
|
this.customerQuestions.addressQuestions.streetAddress,
|
||||||
licenseZip: this.customerQuestions.addressQuestions.zipCode,
|
licenseZip: this.customerQuestions.addressQuestions.zipCode,
|
||||||
licenseState: this.customerQuestions.addressQuestions.state,
|
licenseState: this.customerQuestions.addressQuestions.state
|
||||||
});
|
});
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
resultKey: 'vinLookupResponse',
|
resultKey: 'vinLookupResponse',
|
||||||
promise: vinLookupResponse,
|
promise: vinLookupResponse
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
@ -272,8 +270,8 @@ export default {
|
||||||
this.isCarIdDifferent =
|
this.isCarIdDifferent =
|
||||||
carFound.carId !== useMainStore().order.vehicle.carId;
|
carFound.carId !== useMainStore().order.vehicle.carId;
|
||||||
if (
|
if (
|
||||||
this.isCarIdDifferent &&
|
this.isCarIdDifferent
|
||||||
carFound.carId !== this.previouslyEnteredCarId
|
&& carFound.carId !== this.previouslyEnteredCarId
|
||||||
) {
|
) {
|
||||||
// Display Alert
|
// Display Alert
|
||||||
this.previouslyEnteredCarId = carFound.carId;
|
this.previouslyEnteredCarId = carFound.carId;
|
||||||
|
|
@ -291,28 +289,24 @@ export default {
|
||||||
// Update button "Continue with..."
|
// Update button "Continue with..."
|
||||||
this.$refs.siteFooter
|
this.$refs.siteFooter
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
.updateButtonText(
|
.updateButtonText(`Continue with ${carFound.year} ${carFound.make} ${carFound.model} ${this.forwardButtonCarStyle}`);
|
||||||
`Continue with ${carFound.year} ${carFound.make} ${carFound.model} ${this.forwardButtonCarStyle}`
|
|
||||||
);
|
|
||||||
return this.$refs.siteFooter.removeLoader();
|
return this.$refs.siteFooter.removeLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
// update data
|
// update data
|
||||||
vehicleInfoToCommit = Object.assign(carFound, {
|
vehicleInfoToCommit = Object.assign(carFound, {
|
||||||
vin: carsFound[0].vin,
|
vin: carsFound[0].vin
|
||||||
});
|
});
|
||||||
} else if (carsFound.length > 1) {
|
} else if (carsFound.length > 1) {
|
||||||
// If multiple cars were found and one and only one of them matches the carId entered, save the vehicle info
|
// If multiple cars were found and one and only one of them matches the carId entered, save the vehicle info
|
||||||
const matchingCars = carsFound.filter(
|
const matchingCars = carsFound.filter((vin) =>
|
||||||
(vin) =>
|
vin.vehicle.carId === useMainStore().order.vehicle.carId);
|
||||||
vin.vehicle.carId === useMainStore().order.vehicle.carId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (matchingCars.length === 1) {
|
if (matchingCars.length === 1) {
|
||||||
vehicleInfoToCommit = Object.assign(
|
vehicleInfoToCommit = Object.assign(
|
||||||
matchingCars[0].vehicle,
|
matchingCars[0].vehicle,
|
||||||
{
|
{
|
||||||
vin: matchingCars[0].vin,
|
vin: matchingCars[0].vin
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -341,8 +335,8 @@ export default {
|
||||||
city: this.customerQuestions.addressQuestions.city,
|
city: this.customerQuestions.addressQuestions.city,
|
||||||
state: this.customerQuestions.addressQuestions.state,
|
state: this.customerQuestions.addressQuestions.state,
|
||||||
zipCode:
|
zipCode:
|
||||||
this.customerQuestions.addressQuestions.zipCode,
|
this.customerQuestions.addressQuestions.zipCode
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
@ -351,17 +345,15 @@ export default {
|
||||||
},
|
},
|
||||||
async navigateForward(carsFound) {
|
async navigateForward(carsFound) {
|
||||||
// Match vehicles found to vehicles in state.
|
// Match vehicles found to vehicles in state.
|
||||||
const matchingCars = carsFound.filter(
|
const matchingCars = carsFound.filter((car) =>
|
||||||
(car) =>
|
car.vehicle.carId === useMainStore().order.vehicle.carId);
|
||||||
car.vehicle.carId === useMainStore().order.vehicle.carId
|
|
||||||
);
|
|
||||||
|
|
||||||
// If a different vehicle is found than the one entered and the selected glass
|
// If a different vehicle is found than the one entered and the selected glass
|
||||||
// is not available for that vehicle then navigate back to "vehicle-damage"
|
// is not available for that vehicle then navigate back to "vehicle-damage"
|
||||||
// display vehicle changed alert on that page.
|
// display vehicle changed alert on that page.
|
||||||
if (
|
if (
|
||||||
this.isCarIdDifferent &&
|
this.isCarIdDifferent
|
||||||
!this.isSelectedGlassAvailableForVehicle
|
&& !this.isSelectedGlassAvailableForVehicle
|
||||||
) {
|
) {
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
||||||
|
|
@ -387,7 +379,7 @@ export default {
|
||||||
this.displayMatchedDifferentVehicleAlert = false;
|
this.displayMatchedDifferentVehicleAlert = false;
|
||||||
this.displayVinLookupByHomeAddressNotAllowedAlert = false;
|
this.displayVinLookupByHomeAddressNotAllowedAlert = false;
|
||||||
this.$refs.siteFooter.enableForwardAction();
|
this.$refs.siteFooter.enableForwardAction();
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue