Model reset stuff
This commit is contained in:
parent
6b24f56a2b
commit
d7fa90ee58
4 changed files with 36 additions and 7 deletions
|
|
@ -207,6 +207,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
setupAddressLookup() {
|
||||
this.showAddressFields = false;
|
||||
if (
|
||||
this.addressModel.streetAddress &&
|
||||
this.addressModel.city &&
|
||||
|
|
|
|||
|
|
@ -146,18 +146,24 @@ export default {
|
|||
onModalClosed() {
|
||||
this.mobileLocationQuestionsInput = this.mobileLocationQuestionsModel;
|
||||
},
|
||||
resetModel() {
|
||||
resetComponent() {
|
||||
// Address
|
||||
this.addressModel.streetAddress = "";
|
||||
this.addressModel.apartmentNumberOrBusinessName = "";
|
||||
this.addressModel.city = "";
|
||||
this.addressModel.state = "";
|
||||
this.addressModel.zipCode = "";
|
||||
this.addressModelInput.streetAddress = "";
|
||||
this.addressModelInput.apartmentNumberOrBusinessName = "";
|
||||
this.addressModelInput.city = "";
|
||||
this.addressModelInput.state = "";
|
||||
this.addressModelInput.zipCode = "";
|
||||
|
||||
// Is Vehicle Protected
|
||||
this.mobileLocationQuestionsInput.isVehicleProtected = null;
|
||||
this.mobileLocationQuestionsInput.isVehicleProtected = null;
|
||||
|
||||
this.$refs[this.modalName].form.resetForm();
|
||||
|
||||
this.$refs.addressQuestions.setupAddressLookup();
|
||||
},
|
||||
async setMobileLocation() {
|
||||
// TODO: Any lookups or actions to be taken before assigning the Mobile Location
|
||||
|
||||
this.mobileLocationQuestionsModel = {
|
||||
addressQuestions: {
|
||||
streetAddress: this.addressModelInput.streetAddress,
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@
|
|||
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
||||
<serviceZipModalQuestion
|
||||
v-model="serviceZipQuestionModel"
|
||||
@service-zip-updated="resetMobileLocation"
|
||||
linkWidgetName="ServiceZipLinkWidget"
|
||||
modalWidgetName="ServiceZipModalWidget"
|
||||
textboxQuestionWidgetName="ServiceZipQuestionWidget"
|
||||
alertInvalidZipWidgetName="AlertInvalidZipWidget" />
|
||||
<mobileLocationModalQuestions
|
||||
ref="mobileLocationModalQuestions"
|
||||
v-model="mobileLocationQuestionsModel"
|
||||
linkWidgetName="MobileLocationLinkWidget"
|
||||
modalWidgetName="MobileLocationModalWidget"
|
||||
|
|
@ -121,7 +123,22 @@ export default {
|
|||
arePagePrerequisitesValid() {
|
||||
return true;
|
||||
},
|
||||
resetMobileLocation() {
|
||||
this.mobileLocationQuestionsModel = {
|
||||
addressQuestions: {
|
||||
streetAddress: "",
|
||||
apartmentNumberOrBusinessName: "",
|
||||
city: "",
|
||||
state: "",
|
||||
zipCode: "",
|
||||
},
|
||||
isVehicleProtected: null,
|
||||
isZipServiceableMobile: null,
|
||||
isZipServiceableInShop: null,
|
||||
};
|
||||
|
||||
this.$refs.mobileLocationModalQuestions.resetComponent();
|
||||
},
|
||||
backButtonAction() {
|
||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -138,6 +138,11 @@ export default {
|
|||
this.displayInvalidZipAlert = true;
|
||||
this.focusOnZipInput();
|
||||
} else {
|
||||
// if the service zip code changes we need to clear the Mobile Location Model
|
||||
if (this.serviceZipModel.zipCode !== "" && this.serviceZipCodeInput !== this.serviceZipModel.zipCode ) {
|
||||
this.$emit("service-zip-updated");
|
||||
}
|
||||
|
||||
this.serviceZipModel = {
|
||||
state: zipCodeData.state,
|
||||
zipCode: this.serviceZipCodeInput,
|
||||
|
|
|
|||
Loading…
Reference in a new issue