Merge remote-tracking branch 'origin/feature/CSR-1088' into feature/CSR-1012

This commit is contained in:
Matt Caimi 2023-02-06 10:58:07 -05:00
commit 0fea157c9e
7 changed files with 33 additions and 46 deletions

View file

@ -51,23 +51,17 @@ export default {
type: Function, type: Function,
}, },
}, },
data() {
return {
modal: null,
};
},
mounted() {
this.modal = new Modal(document.getElementById(this.modalId));
},
methods: { methods: {
resetButtonStyle() { resetButtonStyle() {
this.$refs.buttonMain.resetButtonStyle(); this.$refs.buttonMain.resetButtonStyle();
}, },
openModal() { openModal() {
this.modal.show(); const modal = Modal.getOrCreateInstance(document.getElementById(this.modalId));
modal.show();
}, },
closeModal() { closeModal() {
this.modal.hide(); const modal = Modal.getInstance(document.getElementById(this.modalId));
modal.hide();
}, },
}, },
components: { components: {

View file

@ -1,6 +1,7 @@
<template> <template>
<div class="textbox-question" :class="(errors && errors.length) || hasError ? 'has-error' : ''"> <div class="textbox-question" :class="(errors && errors.length) || hasError ? 'has-error' : ''">
<label v-if="displayQuestionText" <label
v-if="displayQuestionText"
:for="inputId" :for="inputId"
:aria-label="questionText" :aria-label="questionText"
class="form-label" class="form-label"
@ -55,7 +56,7 @@ export default {
}, },
displayQuestionText: { displayQuestionText: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
modelValue: String, modelValue: String,
inputId: String, inputId: String,

View file

@ -83,7 +83,6 @@
alertClass="alert-warning" alertClass="alert-warning"
v-bind:isDismissible="false" /> v-bind:isDismissible="false" />
</div> </div>
</template> </template>
<script> <script>
@ -432,7 +431,6 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.address-questions { .address-questions {
margin-top: 0.5rem; margin-top: 0.5rem;
} }
@ -445,5 +443,4 @@ export default {
left: 0 !important; left: 0 !important;
} }
} }
</style> </style>

View file

@ -32,7 +32,7 @@
<vehicleProtectedQuestion <vehicleProtectedQuestion
ref="vehicleProtectedQuestion" ref="vehicleProtectedQuestion"
v-model="mobileLocationQuestionModel.isVehicleProtected" v-model="mobileLocationQuestionModel.isVehicleProtected"
cmsWidgetName="VehicleProtectedQuestionWidget" /> cmsWidgetName="VehicleProtectedQuestionWidget" />
<textBlock cmsWidgetName="WorkspaceRequirementsWidget" typeStyle="caption" /> <textBlock cmsWidgetName="WorkspaceRequirementsWidget" typeStyle="caption" />
</modal> </modal>
</template> </template>
@ -55,7 +55,6 @@ import baseMixin from "@/mixins/base-mixin.js";
// Define Validation Rules // Define Validation Rules
export default { export default {
name: "mobile-location-modal-questions", name: "mobile-location-modal-questions",
emits: ["update:modelValue"], // The component emits an event emits: ["update:modelValue"], // The component emits an event
@ -69,7 +68,7 @@ export default {
return { return {
modalForm, modalForm,
} };
}, },
props: { props: {
modelValue: { modelValue: {
@ -139,7 +138,6 @@ export default {
} else { } else {
this.$refs.mobileLocationModal.resetButtonStyle(); this.$refs.mobileLocationModal.resetButtonStyle();
} }
}, },
}, },
@ -169,5 +167,4 @@ export default {
.address-questions { .address-questions {
margin-top: 0em; margin-top: 0em;
} }
</style> </style>

View file

@ -10,8 +10,6 @@
isRequired /> isRequired />
</template> </template>
<script> <script>
import buttonQuestion from "@/digital-components/button-question/button-question"; import buttonQuestion from "@/digital-components/button-question/button-question";
// Supporting files // Supporting files

View file

@ -36,8 +36,6 @@ import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-heade
import { Form } from "vee-validate"; import { Form } from "vee-validate";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
import { validator } from "vee-validate"
import { provide } from 'vue';
export default { export default {
name: "service-location", name: "service-location",

View file

@ -85,6 +85,13 @@ export default {
alertNonServiceableZipWidgetName: String, alertNonServiceableZipWidgetName: String,
alertInvalidZipWidgetName: String, alertInvalidZipWidgetName: String,
}, },
setup() {
const modalForm = useForm();
return {
modalForm,
};
},
methods: { methods: {
openZipCodeModal() { openZipCodeModal() {
this.$refs[this.modalName].openModal(); this.$refs[this.modalName].openModal();
@ -122,25 +129,21 @@ export default {
async setZip() { async setZip() {
this.resetAlerts(); this.resetAlerts();
const componentValidation = await this.modalForm.validate();
if (componentValidation.valid) {
const zipCodeData = await this.getZipCodeData(this.serviceZipCodeInput);
if (!zipCodeData.isValid) {
this.displayInvalidZipAlert = true;
} else if (!zipCodeData.isServiceable) {
this.displayNonServiceableZipAlert = true;
} else {
this.serviceZip = this.serviceZipCodeInput;
this.serviceZipState = zipCodeData.state;
const zipLength = 5; this.$refs[this.modalName].closeModal();
if (!this.serviceZipCodeInput || this.serviceZipCodeInput.length < zipLength) { }
// prevent reading 1111 as 01111
return;
} }
const zipCodeData = await this.getZipCodeData(this.serviceZipCodeInput);
if (!zipCodeData.isValid) {
this.displayInvalidZipAlert = true;
} else if (!zipCodeData.isServiceable) {
this.displayNonServiceableZipAlert = true;
} else {
this.serviceZip = this.serviceZipCodeInput;
this.serviceZipState = zipCodeData.state;
this.$refs[this.modalName].closeModal();
}
}, },
}, },
computed: { computed: {
@ -203,5 +206,4 @@ export default {
vertical-align: middle; vertical-align: middle;
margin-right: 0.5em; margin-right: 0.5em;
} }
</style> </style>