CSR-343 Fix funnelFooter button disabling
This commit is contained in:
parent
a979bf2c85
commit
7796520147
1 changed files with 13 additions and 13 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue