From d4a938f3c3f540c3ef6b81671d0ca799bdb42fd3 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 17 Mar 2023 14:42:28 -0400 Subject: [PATCH 01/17] WIP --- src/constants/error-messages.js | 1 + .../mobile-location-modal-questions.vue | 40 +++++++++++++++++ .../service-location/service-location.vue | 45 ++++++++++++++++--- 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 5631b44c7..739698861 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -18,6 +18,7 @@ const errorMessages = { LAST_NAME_REQUIRED: "Please enter your last name", EMAIL_ADDRESS_REQUIRED: "Please enter your email address", EMAIL_ADDRESS_FORMAT: "Please enter a valid email address", + SERVICE_ADDRESS_REQUIRED: "Please enter your service address", SERVICE_ZIP_REQUIRED: "Please enter your service ZIP", SERVICE_ZIP_FORMAT: "Please enter a valid service ZIP", VIN_REQUIRED: "Please enter your VIN", 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 { }, }; + + From 6039bacf0da8765f0223d20b8f078bf42262397c Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 09:34:31 -0400 Subject: [PATCH 02/17] Added SERVCE_ADDRESS_REQUIRED Error Msg --- src/constants/error-messages.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 739698861..5631b44c7 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -18,7 +18,6 @@ const errorMessages = { LAST_NAME_REQUIRED: "Please enter your last name", EMAIL_ADDRESS_REQUIRED: "Please enter your email address", EMAIL_ADDRESS_FORMAT: "Please enter a valid email address", - SERVICE_ADDRESS_REQUIRED: "Please enter your service address", SERVICE_ZIP_REQUIRED: "Please enter your service ZIP", SERVICE_ZIP_FORMAT: "Please enter a valid service ZIP", VIN_REQUIRED: "Please enter your VIN", From 0a78965a3772642813a105f543d16ec54f4e0c9f Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 09:34:31 -0400 Subject: [PATCH 03/17] Revert "Added SERVCE_ADDRESS_REQUIRED Error Msg" This reverts commit 6039bacf0da8765f0223d20b8f078bf42262397c. --- src/constants/error-messages.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 5631b44c7..739698861 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -18,6 +18,7 @@ const errorMessages = { LAST_NAME_REQUIRED: "Please enter your last name", EMAIL_ADDRESS_REQUIRED: "Please enter your email address", EMAIL_ADDRESS_FORMAT: "Please enter a valid email address", + SERVICE_ADDRESS_REQUIRED: "Please enter your service address", SERVICE_ZIP_REQUIRED: "Please enter your service ZIP", SERVICE_ZIP_FORMAT: "Please enter a valid service ZIP", VIN_REQUIRED: "Please enter your VIN", From 80d5f9597077f64afba637883283b1fcf37e1092 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 09:50:05 -0400 Subject: [PATCH 04/17] Clean up --- .../mobile-location-modal-questions.vue | 40 ----------------- .../service-location/service-location.vue | 45 +++---------------- 2 files changed, 6 insertions(+), 79 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 46cb51d13..586e1c6de 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,9 +22,6 @@ cmsWidgetName="MobileFeeDisclaimerWidget" typeStyle="caption" /> -
- {{ errorMessage }} -
+ modalWidgetName="MobileLocationModalWidget" /> @@ -43,7 +42,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, defineRule } from "vee-validate"; +import { Form } from "vee-validate"; // Supporting files import baseMixin from "@/mixins/base-mixin.js"; @@ -51,24 +50,8 @@ 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() { @@ -156,12 +139,6 @@ export default { this.state = newValue.addressQuestions.state; this.zipCode = newValue.addressQuestions.zipCode; this.isVehicleProtected = newValue.isVehicleProtected; - - // setErrors({ - // mobileLocationQuestions: "" - // }); - - //this.$refs.theForm.setTouched({}); }, }, shouldDisableForwardAction() { @@ -170,7 +147,6 @@ export default { }, methods: { arePagePrerequisitesValid() { - return ( store.getters.lineItems.supportingItems !== null && store.getters.order.serviceLocation.zipCode !== null && @@ -212,9 +188,9 @@ export default { }, }, watch: { - zipCode(newValue, oldValue) { - if (newValue !== oldValue) { - baseMixin.methods.getZipCodeData(newValue).then((r) => { + zipCode(current, previous) { + if (current !== previous) { + baseMixin.methods.getZipCodeData(current).then((r) => { this.zipContainsMilitaryBase = r.containsMilitaryBase; }); } @@ -232,12 +208,3 @@ export default { }, }; - - From 1bc00e31e713cfef5f0e928c269713237aeacab1 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 09:50:05 -0400 Subject: [PATCH 05/17] 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 { }, }; + + From be31530bfa9990cae45781afa51714f775742936 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 09:50:05 -0400 Subject: [PATCH 06/17] Revert "Revert "Clean up"" This reverts commit 1bc00e31e713cfef5f0e928c269713237aeacab1. --- .../mobile-location-modal-questions.vue | 40 ----------------- .../service-location/service-location.vue | 45 +++---------------- 2 files changed, 6 insertions(+), 79 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 46cb51d13..586e1c6de 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,9 +22,6 @@ cmsWidgetName="MobileFeeDisclaimerWidget" typeStyle="caption" /> -
- {{ errorMessage }} -
+ modalWidgetName="MobileLocationModalWidget" /> @@ -43,7 +42,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, defineRule } from "vee-validate"; +import { Form } from "vee-validate"; // Supporting files import baseMixin from "@/mixins/base-mixin.js"; @@ -51,24 +50,8 @@ 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() { @@ -156,12 +139,6 @@ export default { this.state = newValue.addressQuestions.state; this.zipCode = newValue.addressQuestions.zipCode; this.isVehicleProtected = newValue.isVehicleProtected; - - // setErrors({ - // mobileLocationQuestions: "" - // }); - - //this.$refs.theForm.setTouched({}); }, }, shouldDisableForwardAction() { @@ -170,7 +147,6 @@ export default { }, methods: { arePagePrerequisitesValid() { - return ( store.getters.lineItems.supportingItems !== null && store.getters.order.serviceLocation.zipCode !== null && @@ -212,9 +188,9 @@ export default { }, }, watch: { - zipCode(newValue, oldValue) { - if (newValue !== oldValue) { - baseMixin.methods.getZipCodeData(newValue).then((r) => { + zipCode(current, previous) { + if (current !== previous) { + baseMixin.methods.getZipCodeData(current).then((r) => { this.zipContainsMilitaryBase = r.containsMilitaryBase; }); } @@ -232,12 +208,3 @@ export default { }, }; - - From 521937c388c2805f05a1539a4c45a89f03c9da5e Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 09:34:31 -0400 Subject: [PATCH 07/17] Revert "Revert "Added SERVCE_ADDRESS_REQUIRED Error Msg"" This reverts commit 0a78965a3772642813a105f543d16ec54f4e0c9f. --- src/constants/error-messages.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 739698861..5631b44c7 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -18,7 +18,6 @@ const errorMessages = { LAST_NAME_REQUIRED: "Please enter your last name", EMAIL_ADDRESS_REQUIRED: "Please enter your email address", EMAIL_ADDRESS_FORMAT: "Please enter a valid email address", - SERVICE_ADDRESS_REQUIRED: "Please enter your service address", SERVICE_ZIP_REQUIRED: "Please enter your service ZIP", SERVICE_ZIP_FORMAT: "Please enter a valid service ZIP", VIN_REQUIRED: "Please enter your VIN", From 2e7de50c967ca5c457ddac2081fa5417f2e1b8c5 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 09:34:31 -0400 Subject: [PATCH 08/17] Revert "Added SERVCE_ADDRESS_REQUIRED Error Msg" This reverts commit 6039bacf0da8765f0223d20b8f078bf42262397c. --- src/constants/error-messages.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 5631b44c7..739698861 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -18,6 +18,7 @@ const errorMessages = { LAST_NAME_REQUIRED: "Please enter your last name", EMAIL_ADDRESS_REQUIRED: "Please enter your email address", EMAIL_ADDRESS_FORMAT: "Please enter a valid email address", + SERVICE_ADDRESS_REQUIRED: "Please enter your service address", SERVICE_ZIP_REQUIRED: "Please enter your service ZIP", SERVICE_ZIP_FORMAT: "Please enter a valid service ZIP", VIN_REQUIRED: "Please enter your VIN", From a0ab81acaad470453cd77a618029a22123c16a09 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 17 Mar 2023 14:42:28 -0400 Subject: [PATCH 09/17] Revert "WIP" This reverts commit d4a938f3c3f540c3ef6b81671d0ca799bdb42fd3. --- src/constants/error-messages.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 739698861..5631b44c7 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -18,7 +18,6 @@ const errorMessages = { LAST_NAME_REQUIRED: "Please enter your last name", EMAIL_ADDRESS_REQUIRED: "Please enter your email address", EMAIL_ADDRESS_FORMAT: "Please enter a valid email address", - SERVICE_ADDRESS_REQUIRED: "Please enter your service address", SERVICE_ZIP_REQUIRED: "Please enter your service ZIP", SERVICE_ZIP_FORMAT: "Please enter a valid service ZIP", VIN_REQUIRED: "Please enter your VIN", From 4c60dc054f40b8e241a16ac26762460a34d25df4 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 10:30:36 -0400 Subject: [PATCH 10/17] Added autocomplete and city reset for validation --- .../mobile-location-modal-questions.vue | 4 ++++ 1 file changed, 4 insertions(+) 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..9ba81f14a 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 @@ -158,6 +158,8 @@ export default { // on the service-zip-modal-question component this.$refs[this.modalName].form.resetForm({ values: { + autocomplete: updatedServiceZipCodeInfo.streetAddress, + city: updatedServiceZipCodeInfo.city, state: updatedServiceZipCodeInfo.state, zipCode: updatedServiceZipCodeInfo.zipCode, isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected, @@ -197,6 +199,8 @@ export default { this.internalModel = deepClone(newValue); this.resetComponent({ + autocomplete: updatedServiceZipCodeInfo.streetAddress, + city: updatedServiceZipCodeInfo.city, state: newValue.addressQuestions.state, zipCode: newValue.addressQuestions.zipCode, isVehicleProtected: newValue.isVehicleProtected, From 12c5d684d800df90f87a9e4aabb6c64160413573 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 10:46:02 -0400 Subject: [PATCH 11/17] Minor correction to previous commit --- .../mobile-location-modal-questions.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9ba81f14a..2974254b3 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 @@ -199,7 +199,7 @@ export default { this.internalModel = deepClone(newValue); this.resetComponent({ - autocomplete: updatedServiceZipCodeInfo.streetAddress, + streetAddress: updatedServiceZipCodeInfo.streetAddress, city: updatedServiceZipCodeInfo.city, state: newValue.addressQuestions.state, zipCode: newValue.addressQuestions.zipCode, From e0a57916750417890b95240d22e107b8fff7f156 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 20 Mar 2023 14:15:51 -0400 Subject: [PATCH 12/17] Another correction for previous commit --- .../mobile-location-modal-questions.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 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 2974254b3..5261d81e0 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 @@ -199,8 +199,8 @@ export default { this.internalModel = deepClone(newValue); this.resetComponent({ - streetAddress: updatedServiceZipCodeInfo.streetAddress, - city: updatedServiceZipCodeInfo.city, + streetAddress: newValue.addressQuestions.streetAddress, + city: newValue.addressQuestions.city, state: newValue.addressQuestions.state, zipCode: newValue.addressQuestions.zipCode, isVehicleProtected: newValue.isVehicleProtected, From df2665a2ce0a9a1a8dbf34b902daa69e1d48bbc5 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 24 Mar 2023 13:44:31 -0400 Subject: [PATCH 13/17] Technical review changes --- src/constants/error-messages.js | 1 + src/digital-components/modal/modal.vue | 15 +++++---- .../textbox-question/textbox-question.vue | 28 +++++++++++++++-- .../mobile-location-modal-questions.vue | 13 +++++++- .../service-location/service-location.vue | 31 ++++++++++++++++--- .../service-zip-modal-question.vue | 2 +- 6 files changed, 74 insertions(+), 16 deletions(-) diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 5631b44c7..3c3f776c1 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -25,6 +25,7 @@ const errorMessages = { "Invalid VIN. Please make sure that you entered the correct 17-digit, alpha-numeric number. VINs do not contain the letters I, O, or Q", OPTION_REQUIRED: "Please select an option", VEHICLE_REQUIRED: "Please select a vehicle", + MOBILE_LOCATION_REQUIRED: "Please enter your service address", }; export { errorMessages }; diff --git a/src/digital-components/modal/modal.vue b/src/digital-components/modal/modal.vue index a18881796..e10f437d3 100644 --- a/src/digital-components/modal/modal.vue +++ b/src/digital-components/modal/modal.vue @@ -60,14 +60,17 @@ export default { setup() { const modalId = `modal-${crypto.randomUUID()}`; - const form = useForm(); + const { meta, validate, resetForm } = useForm(); + const isFormTouched = useIsFormTouched(); const isFormDirty = useIsFormDirty(); const isFormValid = useIsFormValid(); return { modalId, - form, + meta, + validate, + resetForm, isFormTouched, isFormDirty, isFormValid, @@ -75,7 +78,7 @@ export default { }, methods: { async validateAndEmit() { - const validationResult = await this.form.validate(); + const validationResult = await this.validate(); if (validationResult.valid) { this.$emit("footer-button-event"); } else { @@ -103,10 +106,10 @@ export default { }, computed: { isFooterButtonDisabled() { - if (!this.isFormTouched) { - return !this.isFormValid; + if (!this.meta.touched) { + return !this.meta.valid; } - return !this.isFormDirty || !this.isFormValid; + return !this.meta.dirty || !this.meta.valid; }, }, components: { diff --git a/src/digital-components/textbox-question/textbox-question.vue b/src/digital-components/textbox-question/textbox-question.vue index 2766e2cd9..335c47a60 100644 --- a/src/digital-components/textbox-question/textbox-question.vue +++ b/src/digital-components/textbox-question/textbox-question.vue @@ -1,11 +1,19 @@ @@ -74,6 +88,8 @@ export default { questionAlignment: String, // Left or center. Left is default. cornerStyle: String, // Rounded or square. Square is default. includeSearchIcon: Boolean, + hideInput: Boolean, + centerErrorMessage: Boolean, }, setup(props) { const inputId = !props.customInputId ? `input-${crypto.randomUUID()}` : props.customInputId; @@ -142,6 +158,12 @@ export default {