Ensured that both VIN Lookup and Zip Servicability alerts can be displayed at the same time
This commit is contained in:
parent
cf29476668
commit
5e58722d45
1 changed files with 18 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue