Updates for Military zip front end.

This commit is contained in:
Bill Richardson 2023-03-09 09:57:05 -05:00
parent 5d47859618
commit 532a017064

View file

@ -10,10 +10,6 @@
cmsWidgetName="AlertMilitaryBaseZipWidget" cmsWidgetName="AlertMilitaryBaseZipWidget"
v-if="zipContainsMilitaryBase" v-if="zipContainsMilitaryBase"
alertClass="alert-warning" /> alertClass="alert-warning" />
<div>shouldDisableForwardAction: {{ shouldDisableForwardAction }}</div>
<div>
<button @click="toggleZip">Toggle Zip</button>
</div>
</div> </div>
<serviceZipModalQuestion <serviceZipModalQuestion
v-model="serviceZipCodeQuestion" v-model="serviceZipCodeQuestion"
@ -68,17 +64,12 @@ export default {
isZipServiceableMobile: null, isZipServiceableMobile: null,
isZipServiceableInShop: null, isZipServiceableInShop: null,
mobileFeePart: null, mobileFeePart: null,
};
return {
serviceLocationZip: 0,
zipContainsMilitaryBase: false, zipContainsMilitaryBase: false,
}; };
}, },
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const zip = store.getters.order.serviceLocation.zipCode;
const serviceZipCode = store.getters.order.serviceLocation.zipCode; const serviceZipCode = store.getters.order.serviceLocation.zipCode;
const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace";
const parentAccountNumber = store.getters.payment.parentAccountNumber; const parentAccountNumber = store.getters.payment.parentAccountNumber;
@ -103,7 +94,7 @@ export default {
}, },
{ {
resultKey: "zipCodeData", resultKey: "zipCodeData",
promise: baseMixin.methods.getZipCodeData(zip), promise: baseMixin.methods.getZipCodeData(serviceZipCode),
}, },
]; ];
@ -114,7 +105,7 @@ export default {
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
vm.setData(resultMap.mobileFeePart); vm.setData(resultMap.mobileFeePart);
vm.zipContainsMilitaryBase = resultMap.zipCodeData.containsMilitaryBase; vm.zipContainsMilitaryBase = resultMap.zipCodeData.containsMilitaryBase;
vm.serviceLocationZip = zip; vm.zipCode = serviceZipCode;
}); });
}, },
computed: { computed: {
@ -157,8 +148,6 @@ export default {
this.isVehicleProtected = newValue.isVehicleProtected; this.isVehicleProtected = newValue.isVehicleProtected;
}, },
}, },
},
computed: {
shouldDisableForwardAction() { shouldDisableForwardAction() {
return this.zipContainsMilitaryBase; return this.zipContainsMilitaryBase;
}, },
@ -217,16 +206,9 @@ export default {
forwardButtonAction() { forwardButtonAction() {
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal }); navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
}, },
toggleZip() {
if (this.serviceLocationZip == 43228) {
this.serviceLocationZip = 45433;
} else {
this.serviceLocationZip = 43228;
}
},
}, },
watch: { watch: {
serviceLocationZip(current, previous) { zipCode(current, previous) {
if (current !== previous) { if (current !== previous) {
baseMixin.methods.getZipCodeData(current).then((r) => { baseMixin.methods.getZipCodeData(current).then((r) => {
this.zipContainsMilitaryBase = r.containsMilitaryBase; this.zipContainsMilitaryBase = r.containsMilitaryBase;