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

View file

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

View file

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