153 lines
5.2 KiB
Vue
153 lines
5.2 KiB
Vue
<template>
|
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
|
<funnelHeader
|
|
cmsWidgetName="FunnelHeaderWidget"
|
|
ref="funnelHeader"
|
|
:overrideImageSrc="clientLogoImageSrc" />
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-12 col-md-10 col-lg-8 col-xl-7">
|
|
<funnelSubHeader
|
|
cmsWidgetName="FunnelSubHeaderWidget"
|
|
class="siteSubHeader mb-4"
|
|
:alignLeft="true" />
|
|
|
|
<img
|
|
:src="recalibrationInfoDesktopImage"
|
|
alt=""
|
|
class="recal-image recal-image--desktop mb-4" />
|
|
<img
|
|
:src="recalibrationInfoMobileImage"
|
|
alt=""
|
|
class="recal-image recal-image--mobile mb-4" />
|
|
|
|
<div class="adas-body-text mb-7" v-html="adasBodyText"></div>
|
|
|
|
<hr class="mb-5" />
|
|
|
|
<saveProgressModalQuestion
|
|
modalWidgetName="SaveProgressModalWidget"
|
|
modalName="SaveProgressModal"
|
|
v-if="showSaveProgressModal"
|
|
pageName="recalibration-info" />
|
|
|
|
<navbar
|
|
cmsWidgetName="FunnelFooterWidget"
|
|
ref="navbar"
|
|
:isForwardActionDisabled="!meta.valid"
|
|
@back-clicked="backButtonAction"
|
|
@ForwardClicked="forwardButtonAction" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Form>
|
|
</template>
|
|
|
|
<script>
|
|
import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
|
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
|
import saveProgressModalQuestion from "@/fmg-components/save-progress-modal-question/save-progress-modal-question";
|
|
import { Form } from "vee-validate";
|
|
|
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
|
import store from "@/store";
|
|
import { debugLog } from "@/helpers/debug-log-helper";
|
|
|
|
export default {
|
|
name: "recalibration-info",
|
|
mixins: [],
|
|
data() {
|
|
return {
|
|
clientConfig: {},
|
|
recalibrationInfoDesktopImage: "",
|
|
recalibrationInfoMobileImage: "",
|
|
adasBodyText: "",
|
|
showSaveProgressModal: null,
|
|
};
|
|
},
|
|
components: {
|
|
Form,
|
|
funnelHeader,
|
|
navbar,
|
|
funnelSubHeader,
|
|
saveProgressModalQuestion,
|
|
},
|
|
// Ensure CMS content is fetched during route navigation without depending on `to`/`from`
|
|
async beforeRouteEnter(to, from, next) {
|
|
const pageName = to.name;
|
|
const cmsContentPromise = fetchCmsContentForPage(pageName);
|
|
const clientConfigPageName = `client_${store.getters.order.payment.parentAccountNumber}`;
|
|
const clientConfigPromise = fetchCmsContentForPage(clientConfigPageName);
|
|
const promiseResultMap = [
|
|
{
|
|
resultKey: "cmsContent",
|
|
promise: cmsContentPromise,
|
|
},
|
|
{
|
|
resultKey: "clientConfig",
|
|
promise: clientConfigPromise,
|
|
},
|
|
];
|
|
const resultMap = await settleAllPromises(promiseResultMap);
|
|
const emailFromStore = store.getters.order.customer.emailAddress;
|
|
const showSaveProgressModal = !(emailFromStore?.length > 0);
|
|
next((vm) => {
|
|
vm.setCmsContent(resultMap.cmsContent);
|
|
vm.clientConfig = resultMap.clientConfig ?? {};
|
|
vm.showSaveProgressModal = showSaveProgressModal;
|
|
vm.recalibrationInfoDesktopImage = vm.getCmsContent("AdasInfoDesktopWidget", "Image");
|
|
vm.recalibrationInfoMobileImage = vm.getCmsContent("AdasInfoMobileWidget", "Image");
|
|
vm.adasBodyText = vm.getCmsContent("AdasInfoDesktopWidget", "BodyText");
|
|
debugLog(
|
|
`recalibration-info clientConfig::${clientConfigPageName}`,
|
|
JSON.stringify(vm.clientConfig)
|
|
);
|
|
});
|
|
},
|
|
|
|
computed: {
|
|
clientLogoImageSrc() {
|
|
return this.clientConfig?.ClientLogoWidget?.Image || "";
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
backButtonAction() {
|
|
this.$router.navigateWithoutSaving(
|
|
this.navigationScenarios.CLICKED_BACK,
|
|
this.pageName
|
|
);
|
|
},
|
|
async forwardButtonAction() {
|
|
this.$router.navigateWithSaving(
|
|
this.navigationScenarios.CLICKED_FORWARD,
|
|
this.pageName
|
|
);
|
|
},
|
|
arePagePrerequisitesValid() {
|
|
return true;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
// Both images are rendered; CSS swaps them at the md breakpoint so no JS
|
|
// resize listeners are needed.
|
|
.recal-image--desktop {
|
|
display: none;
|
|
}
|
|
.recal-image--mobile {
|
|
display: block;
|
|
}
|
|
@include media-breakpoint-up(md) {
|
|
.recal-image--desktop {
|
|
display: block;
|
|
}
|
|
.recal-image--mobile {
|
|
display: none;
|
|
}
|
|
}
|
|
</style>
|