122 lines
4.5 KiB
Vue
122 lines
4.5 KiB
Vue
<template>
|
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
|
<div class="page-container-grouped-styles">
|
|
<loadingModal ref="loadingModal" />
|
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
|
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
|
<serviceZipModalQuestion
|
|
v-model="serviceZipCodeQuestion"
|
|
@service-zip-updated="resetMobileLocation"
|
|
linkWidgetName="ServiceZipLinkWidget"
|
|
modalWidgetName="ServiceZipModalWidget"
|
|
textboxQuestionWidgetName="ServiceZipQuestionWidget"
|
|
alertInvalidZipWidgetName="AlertInvalidZipWidget" />
|
|
<mobileLocationModalQuestions
|
|
v-model="mobileLocationQuestions"
|
|
ref="mobileLocationModalQuestions"
|
|
linkWidgetName="MobileLocationLinkWidget"
|
|
modalWidgetName="MobileLocationModalWidget"
|
|
mobileFeeDisclaimerWidgetName="MobileFeeDisclaimerWidget"
|
|
workspaceRequirementsWidgetName="WorkspaceRequirementsWidget" />
|
|
<funnel-footer
|
|
cmsWidgetName="FunnelFooterWidget"
|
|
ref="funnelFooter"
|
|
:isForwardActionDisabled="!meta.valid"
|
|
@back-clicked="backButtonAction"
|
|
@ForwardClicked="forwardButtonAction" />
|
|
</div>
|
|
</Form>
|
|
</template>
|
|
|
|
<script>
|
|
// Components
|
|
import serviceZipModalQuestion from "@/layouts/service-location/service-zip-modal-question/service-zip-modal-question";
|
|
import mobileLocationModalQuestions from "@/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions";
|
|
import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
|
import funnelFooter from "@/fmg-components/funnel-footer/funnel-footer";
|
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
|
import { Form } from "vee-validate";
|
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
|
|
|
export default {
|
|
name: "service-location",
|
|
data() {
|
|
return {
|
|
isZipServiceableMobile: null,
|
|
isZipServiceableInShop: null,
|
|
serviceZipCodeQuestion: {
|
|
state: "",
|
|
zipCode: "",
|
|
isServiceable: null,
|
|
},
|
|
mobileLocationQuestions: {
|
|
addressQuestions: {
|
|
streetAddress: "",
|
|
apartmentNumberOrBusinessName: "",
|
|
city: "",
|
|
state: "",
|
|
zipCode: "",
|
|
},
|
|
isVehicleProtected: null,
|
|
},
|
|
};
|
|
},
|
|
|
|
async beforeRouteEnter(to, from, next) {
|
|
// Call APIs
|
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
|
|
|
// Settle promises and get results
|
|
const promiseResultMap = [
|
|
{
|
|
resultKey: "cmsContent",
|
|
promise: cmsContentPromise,
|
|
},
|
|
];
|
|
|
|
const resultMap = await settleAllPromises(promiseResultMap);
|
|
|
|
// Call the "next" function to complete the transition to this page.
|
|
next((vm) => {
|
|
vm.setCmsContent(resultMap.cmsContent);
|
|
});
|
|
},
|
|
methods: {
|
|
arePagePrerequisitesValid() {
|
|
return true;
|
|
},
|
|
resetMobileLocation() {
|
|
this.mobileLocationQuestions = {
|
|
addressQuestions: {
|
|
streetAddress: "",
|
|
apartmentNumberOrBusinessName: "",
|
|
city: "",
|
|
state: "",
|
|
zipCode: "",
|
|
},
|
|
isVehicleProtected: null,
|
|
};
|
|
|
|
this.$refs.mobileLocationModalQuestions.resetComponent();
|
|
},
|
|
backButtonAction() {
|
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
|
},
|
|
forwardButtonAction() {
|
|
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
|
},
|
|
},
|
|
components: {
|
|
serviceZipModalQuestion,
|
|
mobileLocationModalQuestions,
|
|
funnelHeader,
|
|
funnelFooter,
|
|
funnelSubHeader,
|
|
Form,
|
|
loadingModal,
|
|
},
|
|
};
|
|
</script>
|