CSR-1088 - Additional model / prop related changes

This commit is contained in:
Leah Schumann 2023-02-09 10:45:29 -05:00
parent 0517b7072a
commit 1aa470bf18
4 changed files with 40 additions and 12 deletions

View file

@ -44,7 +44,6 @@
import buttonMain from "@/ux-components/button-main/button-main";
import { Modal } from "bootstrap";
import { useIsFormTouched, useIsFormDirty, useIsFormValid } from "vee-validate";
import { checkPropertyChange } from "json-schema";
export default {
name: "modal",

View file

@ -54,11 +54,6 @@ import textBlock from "@/digital-components/text-block/text-block";
export default {
name: "mobile-location-modal-questions",
emits: ["update:modelValue"], // The component emits an event
data() {
return {
answers: [],
};
},
props: {
modelValue: {
type: Object,
@ -70,11 +65,12 @@ export default {
state: "",
zipCode: "",
},
isZipServiceableMobile: Boolean,
isZipServiceableInShop: Boolean,
isVehicleProtected: Boolean,
isZipServiceableMobile: Boolean,
isZipServiceableInShop: Boolean,
}),
},
serviceZipCode: String,
cmsWidgetName: String,
modalWidgetName: String,
mobileFeeDisclaimerWidgetName: String,
@ -100,7 +96,6 @@ export default {
}
return this.getCmsContent(this.cmsWidgetName, "BodyText");
},
modalHeaderText() {
return this.getCmsContent(this.modalWidgetName, "HeaderText");
},
@ -120,6 +115,14 @@ export default {
return this.mobileLocationQuestionModel.addressQuestions;
},
},
_isVehicleProtected: {
get: function () {
return this.modelValue.isVehicleProtected;
},
set: function (newValue) {
this.$emit("update:modelValue.isVehicleProtected", newValue);
},
}
},
methods: {
openModal() {
@ -128,10 +131,29 @@ export default {
closeModal() {
this.$refs.mobileLocationModal.closeModal();
},
resetModel() {
// Address
this.addressModel.streetAddress = "";
this.addressModel.apartmentNumberOrBusinessName = "";
this.addressModel.city = "";
this.addressModel.state = "";
this.addressModel.zipCode = "";
// Is Vehicle Protected
this._isVehicleProtected = null;
},
async setMobileLocation() {
this.closeModal();
},
},
watch: {
serviceZipCode: {
handler() {
// if they modify the Service Zip Code, clear the model
this.resetModel();
}
},
},
components: {
textLink,
modal,

View file

@ -23,7 +23,9 @@ defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
export default {
name: "vehicle-protected-question",
props: {
modelValue: String,
modelValue: {
isVehicleProtected: Boolean,
},
cmsWidgetName: String,
},
components: {

View file

@ -1,4 +1,3 @@
fmg
<template>
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
<div class="page-container-grouped-styles">
@ -12,6 +11,7 @@ fmg
alertInvalidZipWidgetName="AlertInvalidZipWidget" />
<mobileLocationModalQuestions
v-model="mobileLocationQuestions"
:serviceZipCode="serviceZipQuestion.serviceZipCode"
cmsWidgetName="MobileLocationLinkWidget"
modalWidgetName="MobileLocationModalWidget"
mobileFeeDisclaimerWidgetName="MobileFeeDisclaimerWidget"
@ -54,6 +54,9 @@ export default {
state: "",
zipCode: "",
},
isVehicleProtected: null,
isZipServiceableMobile: null,
isZipServiceableInShop: null,
},
};
},
@ -80,7 +83,9 @@ export default {
arePagePrerequisitesValid() {
return true;
},
resetMobileLocationTest() {
this.serviceZipQuestion.serviceZipCode = "43054";
},
backButtonAction() {},
forwardButtonAction() {},
},