diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index bdf3e956..23f1c519 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -2,66 +2,53 @@
-
- - - -
-

Placeholder for molding-questions page

- - -
-
+ + + \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index abb22d83..d664f46b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -701,6 +701,34 @@ export const useMainStore = defineStore({ //Save new values this.updatePartQuestionAnswers(partQuestionAnswersArray); }, + saveMoldingQuestionAnswers(moldingQuestionAnswers) { + const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue( + this.getters.damage.moldingQuestionAnswers, + "partNum" + ); + const sortedMoldingQuestionAnswersArray = sortArrayOfObjectsByPropertyValue( + moldingQuestionAnswers, + "partNum" + ); + const haveMoldingQuestionAnswersChanged = + sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length || + !sortedPreviousResultsArray?.every( + (x, i) => x.partNum === sortedMoldingQuestionAnswersArray[i].partNum + ); + + if (haveMoldingQuestionAnswersChanged) { + this.updateGlassParts(null); + this.updateSupportingItems(null); + this.updateCapabilityQuestionAnswers(null); + this.updatePageData({ + page: issPageValues.CAPABILITY_QUESTIONS, + data: null, + }); + } + + // Save new values + this.updateMoldingQuestionAnswers(moldingQuestionAnswers); + }, addEventToBus (event) { this.applicationUser.eventBus.push(event);