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: {
|
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) {
|
||||||
|
|
@ -48,8 +48,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);
|
||||||
|
|
@ -64,8 +64,8 @@ export default {
|
||||||
selectedAnswers: {},
|
selectedAnswers: {},
|
||||||
currentGlassIndex: 0,
|
currentGlassIndex: 0,
|
||||||
rules: {
|
rules: {
|
||||||
optionRequired: globalRules.OPTION_REQUIRED,
|
optionRequired: globalRules.OPTION_REQUIRED
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -84,26 +84,19 @@ export default {
|
||||||
partsOrQuestionsData() {
|
partsOrQuestionsData() {
|
||||||
return useMainStore().pageData(issPageValues.MOLDING_QUESTIONS)
|
return useMainStore().pageData(issPageValues.MOLDING_QUESTIONS)
|
||||||
.partsOrQuestions;
|
.partsOrQuestions;
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getInitialQuestionData();
|
this.getInitialQuestionData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
const moldingQuestionsFromPageData = useMainStore().pageData(
|
const moldingQuestionsFromPageData = useMainStore().pageData(issPageValues.MOLDING_QUESTIONS);
|
||||||
issPageValues.MOLDING_QUESTIONS
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
// has childPartQuestions array and has glassName not null
|
// has childPartQuestions array and has glassName not null
|
||||||
moldingQuestionsFromPageData?.partsOrQuestions?.some(
|
moldingQuestionsFromPageData?.partsOrQuestions?.some((part) => part?.glassName)
|
||||||
(part) => part?.glassName
|
&& moldingQuestionsFromPageData.partsOrQuestions.some((glass) =>
|
||||||
) &&
|
glass.parts?.some((part) => part?.childPartQuestions?.length > 0))
|
||||||
moldingQuestionsFromPageData.partsOrQuestions.some((glass) =>
|
|
||||||
glass.parts?.some(
|
|
||||||
(part) => part?.childPartQuestions?.length > 0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getInitialQuestionData() {
|
getInitialQuestionData() {
|
||||||
|
|
@ -145,35 +138,31 @@ export default {
|
||||||
glassName: glass.glassName,
|
glassName: glass.glassName,
|
||||||
partNum: glass.answerData.answerResult,
|
partNum: glass.answerData.answerResult,
|
||||||
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
|
||||||
this.questionsData.forEach((glass) => {
|
this.questionsData.forEach((glass) => {
|
||||||
glass.answerData = {};
|
glass.answerData = {};
|
||||||
});
|
});
|
||||||
// save to store as order.damage.moldingQuestionArrays (array)
|
// save to store as order.damage.moldingQuestionArrays (array)
|
||||||
await this.mainStore.saveMoldingQuestionAnswers(
|
await this.mainStore.saveMoldingQuestionAnswers(questionAnswersArray);
|
||||||
questionAnswersArray
|
|
||||||
);
|
|
||||||
|
|
||||||
// get parts from the questionAnswers
|
// get parts from the questionAnswers
|
||||||
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