navigation for molding-questions
This commit is contained in:
parent
13d76dae62
commit
ec8731f9a3
3 changed files with 13 additions and 13 deletions
|
|
@ -86,7 +86,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
arePagePrerequisiteValid() {
|
||||
const moldingQuestionsFromPageData = useMainStore().getters.pageData(
|
||||
const moldingQuestionsFromPageData = useMainStore().pageData(
|
||||
issPageValues.MOLDING_QUESTIONS
|
||||
);
|
||||
return (
|
||||
|
|
@ -102,7 +102,7 @@ export default {
|
|||
getInitialQuestionData() {
|
||||
// get any questions that were already answered
|
||||
const alreadyAnsweredQuestions =
|
||||
useMainStore().order.damage.moldingQuestionAnswers;
|
||||
useMainStore().damage.moldingQuestionAnswers;
|
||||
this.questionsData = this.partsOrQuestionsData
|
||||
.filter((x) => x.parts[0].childPartQuestions.length)
|
||||
.map((glass, index) => {
|
||||
|
|
@ -121,7 +121,7 @@ export default {
|
|||
"selectedAnswers." + glass.answerKey,
|
||||
(newValue) => {
|
||||
if (newValue && Object.keys(newValue).length > 0) {
|
||||
this.handleCompletedQuestionChainAnswers(
|
||||
this.handleAnswerUpdates(
|
||||
newValue,
|
||||
glass.answerKey
|
||||
);
|
||||
|
|
@ -147,7 +147,7 @@ export default {
|
|||
glass.answerData = {};
|
||||
});
|
||||
// save to store as order.damage.moldingQuestionArrays (array)
|
||||
await useMainStore().saveMoldingQuestionAnswers(questionAnswersArray);
|
||||
await this.mainStore.saveMoldingQuestionAnswers(questionAnswersArray);
|
||||
|
||||
// get parts from the questionAnswers
|
||||
let partsOrQuestions = this.partsOrQuestionsData;
|
||||
|
|
@ -163,7 +163,7 @@ export default {
|
|||
},
|
||||
];
|
||||
}
|
||||
this.navigateForward(partsOrQuestions);
|
||||
this.navigateForward(partsOrQuestions, null);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ const routingTable = function(store) {
|
|||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||
destinationIssPageValue: issPageValues.ESTIMATE,
|
||||
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP,
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||
|
|
|
|||
|
|
@ -701,19 +701,19 @@ export const useMainStore = defineStore({
|
|||
//Save new values
|
||||
this.updatePartQuestionAnswers(partQuestionAnswersArray);
|
||||
},
|
||||
saveMoldingQuestionAnswers(moldingQuestionAnswers) {
|
||||
saveMoldingQuestionAnswers(moldingQuestionAnswersArray) {
|
||||
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(
|
||||
this.getters.damage.moldingQuestionAnswers,
|
||||
"partNum"
|
||||
this.order.damage.moldingQuestionAnswers,
|
||||
"result"
|
||||
);
|
||||
const sortedMoldingQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(
|
||||
moldingQuestionAnswers,
|
||||
"partNum"
|
||||
moldingQuestionAnswersArray,
|
||||
"result"
|
||||
);
|
||||
const haveMoldingQuestionAnswersChanged =
|
||||
sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length ||
|
||||
!sortedPreviousResultsArray?.every(
|
||||
(x, i) => x.partNum === sortedMoldingQuestionAnswersArray[i].partNum
|
||||
(x, i) => x.result === sortedMoldingQuestionAnswersArray[i].result
|
||||
);
|
||||
|
||||
if (haveMoldingQuestionAnswersChanged) {
|
||||
|
|
@ -727,7 +727,7 @@ export const useMainStore = defineStore({
|
|||
}
|
||||
|
||||
// Save new values
|
||||
this.updateMoldingQuestionAnswers(moldingQuestionAnswers);
|
||||
this.updateMoldingQuestionAnswers(moldingQuestionAnswersArray);
|
||||
},
|
||||
|
||||
addEventToBus (event) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue