diff --git a/src/layouts/service-location/shop-question/shop-question-popup.vue b/src/layouts/service-location/shop-question/shop-question-popup.vue index 1e7d7ec59..b345d370d 100644 --- a/src/layouts/service-location/shop-question/shop-question-popup.vue +++ b/src/layouts/service-location/shop-question/shop-question-popup.vue @@ -520,75 +520,75 @@ export default { const selectedProvider = this.shopProviders.find( (provider) => provider.providerNumber == this.selectedProviderNumber ); - this.resetAlerts(); + this.resetAlerts(); - const zipCodeData = await this.getZipCodeData( - selectedProvider.address.zipCode, + const zipCodeData = await this.getZipCodeData( + selectedProvider.address.zipCode, + "service-location" + ); + + if (!zipCodeData.isValid) { + this.displayInvalidZipAlert = true; + this.focusOnZipInput(); + this.resetModalButtonStyle(); + } else { + if (this.isVehicleHeavyTruck) { + // check the location endpoint to verify this zip can service a heavy truck + const closestShops = await getClosestApplicableShops( + selectedProvider.address.zipCode, + this.carId, + "service-location" + ); + + if (!closestShops || closestShops.providers?.length === 0) { + this.displayNoServiceAlert = true; + this.focusOnZipInput(); + this.resetModalButtonStyle(); + return null; + } + } + + selectedProvider.address.state = zipCodeData.state; + selectedProvider.address.zipCodeCtu = zipCodeData.zipCodeCtu; + + // retrieve mobile fee part + const serviceZipCode = selectedProvider.address.zipCode; + const mobileFeePart = await getPricedMobileFeePart( + serviceZipCode, "service-location" ); - if (!zipCodeData.isValid) { - this.displayInvalidZipAlert = true; - this.focusOnZipInput(); - this.resetModalButtonStyle(); - } else { - if (this.isVehicleHeavyTruck) { - // check the location endpoint to verify this zip can service a heavy truck - const closestShops = await getClosestApplicableShops( - selectedProvider.address.zipCode, - this.carId, - "service-location" - ); + // retrieve recycle fee part + const recycleFeePart = await getPricedRecycleFeePart( + serviceZipCode, + "service-location" + ); - if (!closestShops || closestShops.providers?.length === 0) { - this.displayNoServiceAlert = true; - this.focusOnZipInput(); - this.resetModalButtonStyle(); - return null; - } - } + // retrieve serviceability details + const serviceabilityDetails = await getServiceabilityDetails( + serviceZipCode, + null, + "service-location" + ); - selectedProvider.address.state = zipCodeData.state; - selectedProvider.address.zipCodeCtu = zipCodeData.zipCodeCtu; + const billToAccountNumber = await getBillToAccountNumber( + selectedProvider.address.zipCodeCtu + ); - // retrieve mobile fee part - const serviceZipCode = selectedProvider.address.zipCode; - const mobileFeePart = await getPricedMobileFeePart( - serviceZipCode, - "service-location" - ); + // update content related to service zip code + this.$emit("updated-mobile-fee-part", mobileFeePart); + this.$emit("updated-recycle-fee-part", recycleFeePart); + this.$emit("updated-serviceability", serviceabilityDetails.data); + this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase); + this.$emit("updated-bill-to-account-number", billToAccountNumber); + this.$emit("updated-zipcode-ctu", selectedProvider.address.zipCodeCtu); - // retrieve recycle fee part - const recycleFeePart = await getPricedRecycleFeePart( - serviceZipCode, - "service-location" - ); + this.$emit("update:modelValue", this.selectedValue); + this.$emit("update-shop-provider-data", this.localShopProviderData); + this.$emit("shop-selected", selectedProvider); - // retrieve serviceability details - const serviceabilityDetails = await getServiceabilityDetails( - serviceZipCode, - null, - "service-location" - ); - - const billToAccountNumber = await getBillToAccountNumber( - selectedProvider.address.zipCodeCtu - ); - - // update content related to service zip code - this.$emit("updated-mobile-fee-part", mobileFeePart); - this.$emit("updated-recycle-fee-part", recycleFeePart); - this.$emit("updated-serviceability", serviceabilityDetails.data); - this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase); - this.$emit("updated-bill-to-account-number", billToAccountNumber); - this.$emit("updated-zipcode-ctu", selectedProvider.address.zipCodeCtu); - - this.$emit("update:modelValue", this.selectedValue); - this.$emit("update-shop-provider-data", this.localShopProviderData); - this.$emit("shop-selected", selectedProvider); - - this.closeModal(); - } + this.closeModal(); + } }, }, watch: {