diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index 23f1c519..44b4cd38 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -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: { diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 95179d81..78dbb55a 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -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, diff --git a/src/store/index.js b/src/store/index.js index d664f46b..db172dde 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -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) {