From 1bc00e31e713cfef5f0e928c269713237aeacab1 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 09:50:05 -0400 Subject: [PATCH] Revert "Clean up" This reverts commit 80d5f9597077f64afba637883283b1fcf37e1092. --- .../mobile-location-modal-questions.vue | 40 +++++++++++++++++ .../service-location/service-location.vue | 45 ++++++++++++++++--- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index 586e1c6de..46cb51d13 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -22,6 +22,9 @@ cmsWidgetName="MobileFeeDisclaimerWidget" typeStyle="caption" /> +
+ {{ errorMessage }} +
+ modalWidgetName="MobileLocationModalWidget" + validationRules="service-address-required"/> @@ -42,7 +43,7 @@ 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 { Form, defineRule } from "vee-validate"; // Supporting files import baseMixin from "@/mixins/base-mixin.js"; @@ -50,8 +51,24 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; +import { errorMessages } from "@/constants/error-messages"; import store from "@/store"; +defineRule("service-address-required", (value) => { + const isValid = + value.addressQuestions.streetAddress !== "" && + value.addressQuestions.city !== "" && + value.addressQuestions.state !== "" && + value.addressQuestions.zipCode !== "" && + value.isVehicleProtected !== null; + + if (!isValid) { + return errorMessages.SERVICE_ADDRESS_REQUIRED; + } + + return isValid; +}); + export default { name: "service-location", data() { @@ -139,6 +156,12 @@ export default { this.state = newValue.addressQuestions.state; this.zipCode = newValue.addressQuestions.zipCode; this.isVehicleProtected = newValue.isVehicleProtected; + + // setErrors({ + // mobileLocationQuestions: "" + // }); + + //this.$refs.theForm.setTouched({}); }, }, shouldDisableForwardAction() { @@ -147,6 +170,7 @@ export default { }, methods: { arePagePrerequisitesValid() { + return ( store.getters.lineItems.supportingItems !== null && store.getters.order.serviceLocation.zipCode !== null && @@ -188,9 +212,9 @@ export default { }, }, watch: { - zipCode(current, previous) { - if (current !== previous) { - baseMixin.methods.getZipCodeData(current).then((r) => { + zipCode(newValue, oldValue) { + if (newValue !== oldValue) { + baseMixin.methods.getZipCodeData(newValue).then((r) => { this.zipContainsMilitaryBase = r.containsMilitaryBase; }); } @@ -208,3 +232,12 @@ export default { }, }; + +