commit
a2139c3588
1 changed files with 19 additions and 31 deletions
|
|
@ -37,7 +37,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
// eslint-disable-next-line vue/no-reserved-component-names
|
// eslint-disable-next-line vue/no-reserved-component-names
|
||||||
Form,
|
Form,
|
||||||
questionsPageLayout,
|
questionsPageLayout
|
||||||
},
|
},
|
||||||
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
mixins: [baseFormMixin, vehicleQuestionsMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
|
@ -47,8 +47,8 @@ export default {
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
resultKey: 'cmsContent',
|
resultKey: 'cmsContent',
|
||||||
promise: cmsContentPromise,
|
promise: cmsContentPromise
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
@ -63,8 +63,8 @@ export default {
|
||||||
selectedAnswers: {},
|
selectedAnswers: {},
|
||||||
currentGlassIndex: 0,
|
currentGlassIndex: 0,
|
||||||
rules: {
|
rules: {
|
||||||
optionRequired: globalRules.OPTION_REQUIRED,
|
optionRequired: globalRules.OPTION_REQUIRED
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -83,23 +83,17 @@ export default {
|
||||||
partsOrQuestionsData() {
|
partsOrQuestionsData() {
|
||||||
return useMainStore().pageData(issPageValues.CAPABILITY_QUESTIONS)
|
return useMainStore().pageData(issPageValues.CAPABILITY_QUESTIONS)
|
||||||
.partsOrQuestions;
|
.partsOrQuestions;
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getInitialQuestionData();
|
this.getInitialQuestionData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
const capabilityQuestionsFromPageData = useMainStore().pageData(
|
const capabilityQuestionsFromPageData = useMainStore().pageData(issPageValues.CAPABILITY_QUESTIONS);
|
||||||
issPageValues.CAPABILITY_QUESTIONS
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
capabilityQuestionsFromPageData?.partsOrQuestions?.some(
|
capabilityQuestionsFromPageData?.partsOrQuestions?.some((part) => part?.glassName)
|
||||||
(part) => part?.glassName
|
&& capabilityQuestionsFromPageData?.partsOrQuestions?.some((part) => part?.capabilityQuestions?.length > 0)
|
||||||
) &&
|
|
||||||
capabilityQuestionsFromPageData?.partsOrQuestions?.some(
|
|
||||||
(part) => part?.capabilityQuestions?.length > 0
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getInitialQuestionData() {
|
getInitialQuestionData() {
|
||||||
|
|
@ -140,9 +134,7 @@ export default {
|
||||||
// get answerResult2 of returned answer
|
// get answerResult2 of returned answer
|
||||||
let selectedAnswerResult2;
|
let selectedAnswerResult2;
|
||||||
glass.questions.forEach((q) => {
|
glass.questions.forEach((q) => {
|
||||||
const idx = q.answers.findIndex(
|
const idx = q.answers.findIndex((a) => a.answerResult === glass.answerData.answerResult);
|
||||||
(a) => a.answerResult === glass.answerData.answerResult
|
|
||||||
);
|
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
selectedAnswerResult2 = q.answers[idx].answerResult2;
|
selectedAnswerResult2 = q.answers[idx].answerResult2;
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +146,7 @@ export default {
|
||||||
result1: glass.answerData.answerResult,
|
result1: glass.answerData.answerResult,
|
||||||
result2: selectedAnswerResult2,
|
result2: selectedAnswerResult2,
|
||||||
answeredQuestions: glass.answerData.answeredQuestions,
|
answeredQuestions: glass.answerData.answeredQuestions,
|
||||||
isSuppressedPart: glass.isSuppressedPart,
|
isSuppressedPart: glass.isSuppressedPart
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// clear out answerData for future page loads; must occur prior to store save
|
// clear out answerData for future page loads; must occur prior to store save
|
||||||
|
|
@ -162,25 +154,21 @@ export default {
|
||||||
glass.answerData = {};
|
glass.answerData = {};
|
||||||
});
|
});
|
||||||
// save to store as order.damage.moldingQuestionArrays (array)
|
// save to store as order.damage.moldingQuestionArrays (array)
|
||||||
await this.mainStore.saveCapabilityQuestionAnswers(
|
await this.mainStore.saveCapabilityQuestionAnswers(questionAnswersArray);
|
||||||
questionAnswersArray
|
|
||||||
);
|
|
||||||
// get parts from the capabilityQuestionAnswers
|
// get parts from the capabilityQuestionAnswers
|
||||||
const partsOrQuestions = this.partsOrQuestionsData;
|
const partsOrQuestions = this.partsOrQuestionsData;
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const answer of questionAnswersArray) {
|
for (const answer of questionAnswersArray) {
|
||||||
partsOrQuestions.find(
|
partsOrQuestions.find((partOrQuestion) =>
|
||||||
(partOrQuestion) =>
|
partOrQuestion.glassLocation === answer.glassLocation
|
||||||
partOrQuestion.glassLocation === answer.glassLocation &&
|
&& partOrQuestion.glassName === answer.glassName).parts[0].childParts = [
|
||||||
partOrQuestion.glassName === answer.glassName
|
|
||||||
).parts[0].childParts = [
|
|
||||||
{
|
{
|
||||||
partNumber: answer.partNum,
|
partNumber: answer.partNum
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
this.navigateForward(partsOrQuestions, null);
|
this.navigateForward(partsOrQuestions, null);
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue