Move method to computed, remove resetbuttonstyle calls

This commit is contained in:
Scott Kiener 2025-07-17 10:08:28 -04:00
parent 46c2119426
commit 6c1b90225e

View file

@ -157,6 +157,13 @@ export default {
if (!this.shopProviders.length) return false; if (!this.shopProviders.length) return false;
return this.numberOfShopsToDisplay < this.shopProviders.length; return this.numberOfShopsToDisplay < this.shopProviders.length;
}, },
isModalFooterButtonDisabled() {
return (
this.displayInvalidZipAlert ||
this.displayNoShopsAlert ||
!this.localSelectedProviderNumber
);
},
}, },
methods: { methods: {
openModal() { openModal() {
@ -189,13 +196,6 @@ export default {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}); });
}, },
isModalFooterButtonDisabled() {
return (
this.displayInvalidZipAlert ||
this.displayNoShopsAlert ||
!this.localSelectedProviderNumber
);
},
updateShopListWithNextShops(numberToGet = 3) { updateShopListWithNextShops(numberToGet = 3) {
//gaAction = this.GaActions.SHOPS_FIRST_DISPLAYED; --This needs to actually fire on initial display, can never happen here //gaAction = this.GaActions.SHOPS_FIRST_DISPLAYED; --This needs to actually fire on initial display, can never happen here
@ -260,8 +260,6 @@ export default {
const zipCodeData = await this.getZipCodeData(this.localZipCode, "service-location"); const zipCodeData = await this.getZipCodeData(this.localZipCode, "service-location");
if (!zipCodeData.isValid) { if (!zipCodeData.isValid) {
this.displayInvalidZipAlert = true; this.displayInvalidZipAlert = true;
this.resetModalButtonStyle();
} else { } else {
if (this.isVehicleHeavyTruck) { if (this.isVehicleHeavyTruck) {
// check the location endpoint to verify this zip can service a heavy truck // check the location endpoint to verify this zip can service a heavy truck
@ -273,7 +271,6 @@ export default {
if (!closestShops || closestShops.providers?.length === 0) { if (!closestShops || closestShops.providers?.length === 0) {
this.displayNoServiceAlert = true; this.displayNoServiceAlert = true;
this.resetModalButtonStyle();
return null; return null;
} }
} else { } else {
@ -303,9 +300,6 @@ export default {
// I think we should call our new pushGA Event here with new mapped data // I think we should call our new pushGA Event here with new mapped data
this.displayNoShopsAlert = this.answers.length === 0; this.displayNoShopsAlert = this.answers.length === 0;
}, },
resetModalButtonStyle() {
this.modal.resetButtonStyle();
},
resetAlerts() { resetAlerts() {
this.displayInvalidZipAlert = false; this.displayInvalidZipAlert = false;
this.displayNoServiceAlert = false; this.displayNoServiceAlert = false;
@ -321,7 +315,6 @@ export default {
if (!zipCodeData.isValid) { if (!zipCodeData.isValid) {
this.displayInvalidZipAlert = true; this.displayInvalidZipAlert = true;
this.resetModalButtonStyle();
} else { } else {
if (this.isVehicleHeavyTruck) { if (this.isVehicleHeavyTruck) {
// check the location endpoint to verify this zip can service a heavy truck // check the location endpoint to verify this zip can service a heavy truck
@ -333,7 +326,6 @@ export default {
if (!closestShops || closestShops.providers?.length === 0) { if (!closestShops || closestShops.providers?.length === 0) {
this.displayNoServiceAlert = true; this.displayNoServiceAlert = true;
this.resetModalButtonStyle();
return null; return null;
} }
} }