diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index b3634769b..729faa973 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -105,7 +105,18 @@ components: { }, computed: { isForwardActionDisabled() { - return !this.glassParts || Object.values(this.glassParts).filter(value => value).length === 0; + const matchedParts = []; + + // Match them to the parts from the API. + this.PartsFromApi.partsOrQuestions.forEach(part => { + const selectedPartForGlassLocationAndName = this.glassParts[`${part.glassLocation}-${part.glassName}`]; + const selectedPartData = part.parts.filter(part => selectedPartForGlassLocationAndName && part.partNumber == selectedPartForGlassLocationAndName?.partNumber)[0]; + + if (selectedPartData) + matchedParts.push(selectedPartData); + }) + + return Object.keys(matchedParts).length !== this.PartsFromApi.partsOrQuestions.length; }, PartsOrQuestions() { const partsData = this.PartsFromApi; @@ -159,19 +170,8 @@ methods: { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, forwardButtonAction() { - const matchedParts = []; - - // Match them to the parts from the API. - this.PartsFromApi.partsOrQuestions.forEach(part => { - const selectedPartForGlassLocationAndName = this.glassParts[`${part.glassLocation}-${part.glassName}`]; - const selectedPartData = part.parts.filter(part => selectedPartForGlassLocationAndName && part.partNumber == selectedPartForGlassLocationAndName?.partNumber)[0]; - - if (selectedPartData) - matchedParts.push(selectedPartData); - }) - // If no parts could be matched, throw an error. - if (Object.keys(matchedParts).length !== this.PartsFromApi.partsOrQuestions.length) { + if (this.isForwardActionDisabled) { this.$refs.funnelFooter.removeLoader(); throw new Error("Could not match any parts to the selected parts"); }