navigation for molding-questions

This commit is contained in:
Kroell 2023-02-08 15:40:46 -05:00
parent 13d76dae62
commit ec8731f9a3
3 changed files with 13 additions and 13 deletions

View file

@ -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: {

View file

@ -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,

View file

@ -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) {