No changes just hit save for formatting
This commit is contained in:
parent
f62c873f62
commit
04160506bb
1 changed files with 19 additions and 30 deletions
|
|
@ -38,7 +38,7 @@ export default {
|
|||
components: {
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
Form,
|
||||
questionsPageLayout,
|
||||
questionsPageLayout
|
||||
},
|
||||
mixins: [BaseFormMixin, vehicleQuestionsMixin],
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
|
|
@ -48,8 +48,8 @@ export default {
|
|||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: 'cmsContent',
|
||||
promise: cmsContentPromise,
|
||||
},
|
||||
promise: cmsContentPromise
|
||||
}
|
||||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
|
@ -64,8 +64,8 @@ export default {
|
|||
selectedAnswers: {},
|
||||
currentGlassIndex: 0,
|
||||
rules: {
|
||||
optionRequired: globalRules.OPTION_REQUIRED,
|
||||
},
|
||||
optionRequired: globalRules.OPTION_REQUIRED
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -84,26 +84,19 @@ export default {
|
|||
partsOrQuestionsData() {
|
||||
return useMainStore().pageData(issPageValues.MOLDING_QUESTIONS)
|
||||
.partsOrQuestions;
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getInitialQuestionData();
|
||||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
const moldingQuestionsFromPageData = useMainStore().pageData(
|
||||
issPageValues.MOLDING_QUESTIONS
|
||||
);
|
||||
const moldingQuestionsFromPageData = useMainStore().pageData(issPageValues.MOLDING_QUESTIONS);
|
||||
return (
|
||||
// has childPartQuestions array and has glassName not null
|
||||
moldingQuestionsFromPageData?.partsOrQuestions?.some(
|
||||
(part) => part?.glassName
|
||||
) &&
|
||||
moldingQuestionsFromPageData.partsOrQuestions.some((glass) =>
|
||||
glass.parts?.some(
|
||||
(part) => part?.childPartQuestions?.length > 0
|
||||
)
|
||||
)
|
||||
moldingQuestionsFromPageData?.partsOrQuestions?.some((part) => part?.glassName)
|
||||
&& moldingQuestionsFromPageData.partsOrQuestions.some((glass) =>
|
||||
glass.parts?.some((part) => part?.childPartQuestions?.length > 0))
|
||||
);
|
||||
},
|
||||
getInitialQuestionData() {
|
||||
|
|
@ -145,35 +138,31 @@ export default {
|
|||
glassName: glass.glassName,
|
||||
partNum: glass.answerData.answerResult,
|
||||
answeredQuestions: glass.answerData.answeredQuestions,
|
||||
isSuppressedPart: glass.isSuppressedPart,
|
||||
isSuppressedPart: glass.isSuppressedPart
|
||||
}));
|
||||
// clear out answerData for future page loads; must occur prior to store save
|
||||
this.questionsData.forEach((glass) => {
|
||||
glass.answerData = {};
|
||||
});
|
||||
// save to store as order.damage.moldingQuestionArrays (array)
|
||||
await this.mainStore.saveMoldingQuestionAnswers(
|
||||
questionAnswersArray
|
||||
);
|
||||
await this.mainStore.saveMoldingQuestionAnswers(questionAnswersArray);
|
||||
|
||||
// get parts from the questionAnswers
|
||||
const partsOrQuestions = this.partsOrQuestionsData;
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const answer of questionAnswersArray) {
|
||||
partsOrQuestions.find(
|
||||
(partOrQuestion) =>
|
||||
partOrQuestion.glassLocation === answer.glassLocation &&
|
||||
partOrQuestion.glassName === answer.glassName
|
||||
).parts[0].childParts = [
|
||||
partsOrQuestions.find((partOrQuestion) =>
|
||||
partOrQuestion.glassLocation === answer.glassLocation
|
||||
&& partOrQuestion.glassName === answer.glassName).parts[0].childParts = [
|
||||
{
|
||||
partNumber: answer.partNum,
|
||||
},
|
||||
partNumber: answer.partNum
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
this.navigateForward(partsOrQuestions, null);
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue