Use 'next' function for skipping styles page
This commit is contained in:
parent
ae6c242f2d
commit
7d391266e7
1 changed files with 34 additions and 22 deletions
|
|
@ -1,9 +1,12 @@
|
|||
<template>
|
||||
<div class="page-container-grouped-styles" v-show="showStylePage">
|
||||
<div class="page-container-grouped-styles">
|
||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
||||
<div class="select-car">
|
||||
<div class="select-car-form rounded text-center">
|
||||
<vehicleBanner cmsWidgetName="VehicleBannerWidget" displayGenericVehicleImage />
|
||||
<vehicleBanner
|
||||
cmsWidgetName="VehicleBannerWidget"
|
||||
displayGenericVehicleImage
|
||||
/>
|
||||
<funnelSubHeader
|
||||
cmsWidgetName="FunnelSubHeaderWidget"
|
||||
:hasBackButton="true"
|
||||
|
|
@ -11,7 +14,11 @@
|
|||
@click-event="backButtonAction"
|
||||
/>
|
||||
<div class="fade-on-route-transition">
|
||||
<styleQuestion v-model="selectedStyle" ref="styleQuestion" cmsWidgetName="VehicleStyleQuestion" />
|
||||
<styleQuestion
|
||||
v-model="selectedStyle"
|
||||
ref="styleQuestion"
|
||||
cmsWidgetName="VehicleStyleQuestion"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -36,8 +43,7 @@ export default {
|
|||
name: "vehicle-style",
|
||||
data() {
|
||||
return {
|
||||
selectedStyle: null,
|
||||
showStylePage: false,
|
||||
selectedStyle: null
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -62,27 +68,33 @@ export default {
|
|||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
const visitedVehicleDamage = JSON.stringify(store.getters.applicationUser.pageData).indexOf(fmgPageValues.VEHICLE_DAMAGE) < 0 ? false : true;
|
||||
|
||||
|
||||
// Call the "next" function to complete the transition to this page.
|
||||
next((vm) => {
|
||||
//skip this style page if only 1 vehicle style returned and they have yet to visit vehicle damage
|
||||
var visitedVehicleDamage = JSON.stringify(store.getters.applicationUser.pageData).indexOf(fmgPageValues.VEHICLE_DAMAGE) < 0 ? false : true;
|
||||
|
||||
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;
|
||||
// If we have exactly one style
|
||||
if(resultMap.styleQuestionInitialData.length === 1 || !visitedVehicleDamage) {
|
||||
store.commit(storeMutations.UPDATE_STYLE, resultMap.styleQuestionInitialData[0]);
|
||||
|
||||
await store.dispatch(storeActions.SET_VEHICLE,
|
||||
{
|
||||
year: store.getters.vehicle.year,
|
||||
make: store.getters.vehicle.make,
|
||||
model: store.getters.vehicle.model,
|
||||
style: store.getters.vehicle.style,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// ...GetNavigationMap(navigationScenarios.SELECTED_STYLE, to);
|
||||
//...
|
||||
next({name: 'root', query: Object.assign(to.query, { fmgPage: '....destinationFmgPageValue' })});
|
||||
|
||||
} else{
|
||||
next( (vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.$refs.styleQuestion.initializeComponent(resultMap.styleQuestionInitialData)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue