From df2665a2ce0a9a1a8dbf34b902daa69e1d48bbc5 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 24 Mar 2023 13:44:31 -0400 Subject: [PATCH] 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 {