CSR-658 skip style page when only 1 style
This commit is contained in:
parent
de7c80aae1
commit
ae6c242f2d
1 changed files with 22 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="page-container-grouped-styles">
|
<div class="page-container-grouped-styles" v-show="showStylePage">
|
||||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
||||||
<div class="select-car">
|
<div class="select-car">
|
||||||
<div class="select-car-form rounded text-center">
|
<div class="select-car-form rounded text-center">
|
||||||
|
|
@ -30,14 +30,17 @@ import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { storeMutations } from "@/constants/store-mutations";
|
import { storeMutations } from "@/constants/store-mutations";
|
||||||
|
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "vehicle-style",
|
name: "vehicle-style",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedStyle: null,
|
selectedStyle: null,
|
||||||
|
showStylePage: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {},
|
computed: {},
|
||||||
|
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
|
@ -61,11 +64,24 @@ export default {
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
//skip this style page if only 1 vehicle style returned and they have yet to visit vehicle damage
|
||||||
vm.$refs.styleQuestion.initializeComponent(
|
var visitedVehicleDamage = JSON.stringify(store.getters.applicationUser.pageData).indexOf(fmgPageValues.VEHICLE_DAMAGE) < 0 ? false : true;
|
||||||
resultMap.styleQuestionInitialData
|
|
||||||
);
|
if (resultMap.styleQuestionInitialData.lenghth > 1 || visitedVehicleDamage) {
|
||||||
|
vm.showStylePage = true;
|
||||||
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
vm.$refs.styleQuestion.initializeComponent(
|
||||||
|
resultMap.styleQuestionInitialData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
store.commit(storeMutations.UPDATE_STYLE, resultMap.styleQuestionInitialData[0]);
|
||||||
|
vm.setVehicle().then(() => {
|
||||||
|
vm.$router.navigateAfterSave(vm.navigationScenarios.SELECTED_STYLE,vm.$route);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue