get/set zip code
This commit is contained in:
parent
05eff89aea
commit
d425b88f38
2 changed files with 38 additions and 31 deletions
|
|
@ -38,10 +38,7 @@ import serviceZipQuestion from "@/layouts/service-location/service-zip-modal-que
|
||||||
import modal from "@/digital-components/modal/modal.vue"
|
import modal from "@/digital-components/modal/modal.vue"
|
||||||
import alert from "@/ux-components/alert/alert";
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
|
||||||
// import {
|
import { getServiceabilityDetails } from "@/helpers/service-location-helper";
|
||||||
// getPricedMobileFeePart,
|
|
||||||
// getServiceabilityDetails,
|
|
||||||
// } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-zip-modal-question",
|
name: "service-zip-modal-question",
|
||||||
|
|
@ -128,33 +125,30 @@ export default {
|
||||||
this.internalModel.serviceZip = this.modelValue.serviceZip;
|
this.internalModel.serviceZip = this.modelValue.serviceZip;
|
||||||
this.resetsOnZipInput();
|
this.resetsOnZipInput();
|
||||||
},
|
},
|
||||||
// async setZipCode() {
|
async setZipCode() {
|
||||||
// if (this.internalModel.serviceZip !== this.modelValue.serviceZip) {
|
if (this.internalModel.serviceZip !== this.modelValue.serviceZip) {
|
||||||
// this.resetAlerts();
|
this.resetAlerts();
|
||||||
// const zipCodeData = await this.getZipCodeData(this.internalModel.serviceZip);
|
const zipCodeData = await this.getZipCodeData(this.internalModel.serviceZip);
|
||||||
// if (!zipCodeData.isValid) {
|
if (!zipCodeData.isValid) {
|
||||||
// this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
// this.focusOnZipInput();
|
this.focusOnZipInput();
|
||||||
// this.resetModalButtonStyle();
|
this.resetModalButtonStyle();
|
||||||
// } else {
|
} else {
|
||||||
// this.internalModel.serviceZipState = zipCodeData.serviceZipState;
|
this.internalModel.serviceZipState = zipCodeData.serviceZipState;
|
||||||
// // retrieve mobile fee part
|
const serviceZipCode = this.internalModel.serviceZip;
|
||||||
// const serviceZipCode = this.internalModel.serviceZip;
|
// retrieve serviceability details
|
||||||
// const mobileFeePart = await getPricedMobileFeePart(serviceZipCode);
|
const serviceabilityDetails = await getServiceabilityDetails(serviceZipCode);
|
||||||
// // retrieve serviceability details
|
// update content related to service zip code
|
||||||
// const serviceabilityDetails = await getServiceabilityDetails(serviceZipCode);
|
this.$emit("updated-serviceability", serviceabilityDetails.data);
|
||||||
// // update content related to service zip code
|
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
||||||
// this.$emit("updated-mobile-fee-part", mobileFeePart);
|
// Update the page level model
|
||||||
// this.$emit("updated-serviceability", serviceabilityDetails.data);
|
this.$emit("update:modelValue", this.internalModel);
|
||||||
// this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
this.closeModal();
|
||||||
// // Update the page level model
|
}
|
||||||
// this.$emit("update:modelValue", this.internalModel);
|
} else {
|
||||||
// this.closeModal();
|
this.closeModal();
|
||||||
// }
|
}
|
||||||
// } else {
|
},
|
||||||
// this.closeModal();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
modelValue(newValue) {
|
modelValue(newValue) {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,19 @@ export default {
|
||||||
savePageDataToStore(page, data) {
|
savePageDataToStore(page, data) {
|
||||||
useMainStore().updatePageData({ page: page, data: data});
|
useMainStore().updatePageData({ page: page, data: data});
|
||||||
},
|
},
|
||||||
|
async getZipCodeData(zipCode) {
|
||||||
|
const serviceZipValidationResponse = await useMainStore().validateZip(
|
||||||
|
{ zip: zipCode }
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
containsMilitaryBase: serviceZipValidationResponse.data.containsMilitaryBase,
|
||||||
|
isValid: serviceZipValidationResponse.data.isValid,
|
||||||
|
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
||||||
|
state: serviceZipValidationResponse.data.state,
|
||||||
|
zipCodeCtu: serviceZipValidationResponse.data.zipCodeCtu,
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// store will be accessible globally as its id + 'Store'
|
// store will be accessible globally as its id + 'Store'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue