This commit is contained in:
Kulbhushan Kaushik 2022-11-14 08:35:35 -05:00
parent 2c215e23a9
commit acee099333
3 changed files with 22 additions and 18 deletions

View file

@ -85,7 +85,7 @@ export default {
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
const damageOptionsPromise = useMainStore().getDamageOptions(useMainStore().getters.vehicle.carId);
const damageOptionsPromise = useMainStore().getDamageOptions(useMainStore().order.vehicle.carId);
// Settle promises and get results
const promiseResultMap = [
@ -146,15 +146,15 @@ export default {
var glassSelections = [];
if (
this.mainStore.getters.damage.glassToReplace?.some((glass) => {
useMainStore().order.damage.glassToReplace?.some((glass) => {
return glass.glassLocation === damageLocationsSelected.WINDSHIELD;
}) ||
this.mainStore.getters.damage.isRepair
useMainStore().order.damage.isRepair
) {
glassSelections.push(damageLocationsSelected.WINDSHIELD);
}
if (
this.mainStore.getters.damage.glassToReplace?.some((glass) => {
useMainStore().order.damage.glassToReplace?.some((glass) => {
return (
glass.glassLocation === damageLocationsSelected.DRIVER ||
glass.glassLocation === damageLocationsSelected.PASSENGER
@ -165,7 +165,7 @@ export default {
}
if (
this.mainStore.getters.damage.glassToReplace?.some((glass) => {
useMainStore().order.damage.glassToReplace?.some((glass) => {
return glass.glassLocation === damageLocationsSelected.REAR;
})
) {
@ -182,14 +182,14 @@ export default {
selectedWindshieldReplaceOptions: [],
};
if (this.mainStore.getters.damage.isRepair === undefined) return windshieldOptions;
if (useMainStore().order.damage.isRepair === undefined) return windshieldOptions;
if (this.mainStore.getters.damage.isRepair) {
if (useMainStore().order.damage.isRepair) {
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPAIR;
windShieldOptions.selectedWindshieldChipCount = this.mainStore.getters.damage.numberOfChips;
windShieldOptions.selectedWindshieldChipCount = useMainStore().order.damage.numberOfChips;
} else {
if (
this.mainStore.getters.damage.glassToReplace?.some((glass) => {
useMainStore().order.damage.glassToReplace?.some((glass) => {
return (
glass.glassLocation === damageLocationsSelected.WINDSHIELD &&
glass.glassName === damageLocationsSelected.SINGLE
@ -204,7 +204,7 @@ export default {
}
if (
this.mainStore.getters.damage.glassToReplace?.some((glass) => {
useMainStore().order.damage.glassToReplace?.some((glass) => {
return (
glass.glassLocation === damageLocationsSelected.WINDSHIELD &&
glass.glassName === damageLocationsSelected.DRIVER
@ -219,7 +219,7 @@ export default {
}
if (
this.mainStore.getters.damage.glassToReplace?.some((glass) => {
useMainStore().order.damage.glassToReplace?.some((glass) => {
return (
glass.glassLocation === damageLocationsSelected.WINDSHIELD &&
glass.glassName === damageLocationsSelected.PASSENGER
@ -240,7 +240,7 @@ export default {
getDoorSidesFromStore() {
var doorSides = [];
if (
this.mainStore.getters.damage.glassToReplace?.some((glass) => {
useMainStore().order.damage.glassToReplace?.some((glass) => {
return glass.glassLocation === damageLocationsSelected.DRIVER;
})
) {
@ -248,7 +248,7 @@ export default {
}
if (
this.mainStore.getters.damage.glassToReplace?.some((glass) => {
useMainStore().order.damage.glassToReplace?.some((glass) => {
return glass.glassLocation === damageLocationsSelected.PASSENGER;
})
) {
@ -261,7 +261,7 @@ export default {
getDriverSideReplaceOptionsFromStore() {
var driverSideReplaceOptions = [];
this.mainStore.getters.damage.glassToReplace?.forEach((glass) => {
useMainStore().order.damage.glassToReplace?.forEach((glass) => {
if (glass.glassLocation === damageLocationsSelected.DRIVER) {
driverSideReplaceOptions.push(glass.glassName);
}
@ -273,7 +273,7 @@ export default {
getPassengerSideReplaceOptionsFromStore() {
var passengerSideReplaceOptions = [];
this.mainStore.getters.damage.glassToReplace?.forEach((glass) => {
useMainStore().order.damage.glassToReplace?.forEach((glass) => {
if (glass.glassLocation === damageLocationsSelected.PASSENGER) {
passengerSideReplaceOptions.push(glass.glassName);
}
@ -283,7 +283,7 @@ export default {
},
getRearReplaceOptionsFromStore() {
var rearReplaceOptions = this.mainStore.getters.damage.glassToReplace?.filter(
var rearReplaceOptions = useMainStore().order.damage.glassToReplace?.filter(
(glass) => glass.glassLocation === damageLocationsSelected.REAR
)[0]?.glassName;
@ -307,7 +307,7 @@ export default {
navigateForward() {
// If vin already exists, navigate directly to vin-lookup
if (this.mainStore.getters.vehicle.vin) {
if (useMainStore().order.vehicle.vin) {
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
this.$route

View file

@ -6,6 +6,7 @@ import { navigationScenarios } from "@/router/router-constants/navigation-scenar
import { vehicleCategories } from "@/constants/vehicle-categories.js";
import { queryStrings } from "@/constants/query-strings";
import { dynamicStrings } from "@/constants/dynamic-strings";
import { routerParams } from "@/router/router-constants/router-params";
export default {
data() {
@ -44,5 +45,8 @@ export default {
cssClassNameForCmsWidget(){
return "widget-name-" + this.cmsWidgetName;
},
routerParams() {
return routerParams;
},
},
};

View file

@ -2,4 +2,4 @@ const routerParams = {
DISPLAY_VEHICLE_CHANGE_ALERT: "displayVehicleChangeAlert",
};
export { routerParams };
export { routerParams };