From 5e58722d459926b00f80541504ff04e7fb348c16 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Thu, 16 Jun 2022 13:16:15 -0400 Subject: [PATCH] Ensured that both VIN Lookup and Zip Servicability alerts can be displayed at the same time --- src/layouts/vin-lookup/vin-lookup.vue | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index f7e7ab56e..23cce0f67 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -203,6 +203,9 @@ export default { this.getCmsContent("FunnelFooterWidget", "ForwardButtonText") ); }, + zip() { + this.noServiceZip = false; + }, }, computed: { perfectMatchNewVinAlert() { @@ -309,33 +312,39 @@ export default { const zipValidation = this.validateZip(this.zip); const zipValidationResponse = await zipValidation; + // Check if Service Zip entered is servicable, if not display an alert if (!zipValidationResponse.data.isServiceable) { - this.customAlertData.zip = this.zip; - this.$refs.funnelFooter.removeLoader(); + this.customAlertData.zip = this.zip; this.noServiceZip = true; this.invalidZip = this.zip; - return; } - // If the user has clicked on the VIN field, either they are doing a new VIN lookup or changing the VIN previously matched. - // Therefore we need to do a VIN Lookup let vehicleLookupResponse; if (this.vinTouched && this.vin != this.initialVin) { + // If the user has clicked on the VIN field, either they are doing a new VIN lookup or changing the VIN previously matched. + // Therefore we need to do a VIN Lookup const vinToLookup = this.vinTouched ? this.vin : this.initialVin; const vehicleLookup = this.lookupVehicle(vinToLookup); vehicleLookupResponse = await vehicleLookup.catch((response) => { if (response.status == StatusCodes.NOT_FOUND) { this.vinNotFound = true; this.$refs.funnelFooter.removeLoader(); - this.noServiceZip = false; return false; } }); - if (!vehicleLookupResponse) { - return; - } + // if the ZIP is not serviceable or the Vin Lookup didn't return anything then don't complete the process and navigate forward. + if (!zipValidationResponse.data.isServiceable || !vehicleLookupResponse) { + this.$refs.funnelFooter.removeLoader(); + return; + } } else { + // if the ZIP is not serviceable then don't navigate forward. + if (!zipValidationResponse.data.isServiceable) { + this.$refs.funnelFooter.removeLoader(); + return; + } + this.navigateForward(); return; }