59 lines
2.1 KiB
Vue
59 lines
2.1 KiB
Vue
<template>
|
|
<div class="container-fluid shadow rounded-3 p-0">
|
|
<funnelHeader ref="funnelHeader" />
|
|
<vehicleBanner ref="vehicleBanner" />
|
|
<funnelSubHeader
|
|
ref="funnelSubHeader"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
// Components
|
|
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
|
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
|
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
|
// Supporting files
|
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
|
import store from "@/store";
|
|
import baseMixin from "@/mixins/base-mixin";
|
|
import { storeActions } from "@/constants/store-actions";
|
|
|
|
export default ({
|
|
name: "vehicle-damage",
|
|
beforeRouteEnter(to, from, next) {
|
|
// Call APIs
|
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
|
const damageOptionsPromise = baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.GET_DAMAGE_OPTIONS, {carId: store.getters.vehicle.carId});
|
|
|
|
// Settle promises and get results
|
|
const promiseResultMap = [
|
|
{
|
|
resultKey: "cmsContent",
|
|
promise: cmsContentPromise,
|
|
},
|
|
{
|
|
resultKey: "damageOptions",
|
|
promise: damageOptionsPromise
|
|
},
|
|
];
|
|
|
|
settleAllPromises(promiseResultMap).then((resultMap) => {
|
|
// Call the "next" function to complete the transition to this page.
|
|
next((vm) => {
|
|
vm.$refs.funnelHeader.initializeComponent(resultMap.cmsContent.FunnelHeaderWidget);
|
|
vm.$refs.vehicleBanner.initializeComponent(resultMap.cmsContent.VehicleBannerWidget);
|
|
vm.$refs.funnelSubHeader.initializeComponent(resultMap.cmsContent.FunnelSubHeaderWidget);
|
|
// use resultMap.damageOptions for damage options
|
|
});
|
|
});
|
|
|
|
},
|
|
components: {
|
|
funnelHeader,
|
|
vehicleBanner,
|
|
funnelSubHeader,
|
|
},
|
|
})
|
|
</script>
|