Merge branch 'develop' into bugfix/CSR-818
This commit is contained in:
commit
af069eb3b6
18 changed files with 831 additions and 419 deletions
|
|
@ -17,16 +17,19 @@ module.exports = {
|
||||||
"!src/layouts/capability-questions/**/*.vue",
|
"!src/layouts/capability-questions/**/*.vue",
|
||||||
"!src/layouts/part-questions/**/*.vue",
|
"!src/layouts/part-questions/**/*.vue",
|
||||||
"!src/layouts/reveal/**/*.vue",
|
"!src/layouts/reveal/**/*.vue",
|
||||||
|
"!src/layouts/quote/**/*.vue",
|
||||||
"!src/ux-components/text-link/**/*.vue",
|
"!src/ux-components/text-link/**/*.vue",
|
||||||
"!src/common-components/question-chain/**/*.vue",
|
"!src/common-components/question-chain/**/*.vue",
|
||||||
"!src/layouts/quote/**/*.vue", // Temporary
|
"!src/layouts/quote/**/*.vue", // Temporary
|
||||||
"!src/layouts/vin-lookup/**/*.vue", //Temporary for Quote page testing
|
"!src/layouts/vin-lookup/**/*.vue", //Temporary for Quote page testing
|
||||||
|
"!src/common-components/funnel-header/menu-modal/**/*.vue",
|
||||||
// END
|
// END
|
||||||
], // ! means exclude from coverage.
|
], // ! means exclude from coverage.
|
||||||
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"],
|
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"],
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
statements: 84,
|
// TODO after release/2022.09.15, raise this back up!!
|
||||||
|
statements: 80,
|
||||||
// Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90
|
// Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
{{ questionText }}
|
{{ questionText }}
|
||||||
{{(isMultiSelect && answers && answers.length > 1) ? 'Select one or more options below.' : 'Select an option below.' }}
|
{{(isMultiSelect && answers && answers.length > 1) ? 'Select one or more options below.' : 'Select an option below.' }}
|
||||||
</legend>
|
</legend>
|
||||||
<div :class="getComponentLoopWrapperClasses" role="application">
|
<div :class="getComponentLoopWrapperClasses">
|
||||||
<div :class="getComponentWrapperClasses" v-for="answer in answers" :key="answer.Name ? answer.Name : answer">
|
<div :class="getComponentWrapperClasses" v-for="answer in answers" :key="answer.Name ? answer.Name : answer">
|
||||||
<component
|
<component
|
||||||
:is="buttonType"
|
:is="buttonType"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export default {
|
||||||
questionData: Object,
|
questionData: Object,
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
modelValue: Array,
|
modelValue: Array,
|
||||||
partIndex: Number,
|
glassIndex: Number,
|
||||||
keyString: String,
|
keyString: String,
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
|
|
@ -41,43 +41,43 @@ export default {
|
||||||
await useValidateForm(); // do a test validation check, without triggering full validation
|
await useValidateForm(); // do a test validation check, without triggering full validation
|
||||||
|
|
||||||
this.questionData.map((q, i) => {
|
this.questionData.map((q, i) => {
|
||||||
let answerPair = [];
|
let answerPair = [];
|
||||||
const question = {
|
const question = {
|
||||||
questionText: q.questionText,
|
questionText: q.questionText,
|
||||||
questionSequence: q.questionSequence,
|
questionSequence: q.questionSequence,
|
||||||
answers: q.answers.map((a) => {
|
answers: q.answers.map((a) => {
|
||||||
answerPair.push(a.nextQuestionSequence ? a.nextQuestionSequence : a.answerResult);
|
answerPair.push(a.nextQuestionSequence ? a.nextQuestionSequence : a.answerResult);
|
||||||
return {
|
return {
|
||||||
Text: a.answerText,
|
Text: a.answerText,
|
||||||
// Name will either be nextQuestionSequence or answerResult
|
// Name will either be nextQuestionSequence or answerResult
|
||||||
// Name will be used by list-button as the input value.
|
// Name will be used by list-button as the input value.
|
||||||
// It must be a single string or number, so concatenating together a string with
|
// It must be a single string or number, so concatenating together a string with
|
||||||
// 4 pieces of data separated by pipe characters:
|
// 4 pieces of data separated by pipe characters:
|
||||||
// question number|type of answer|answer value|answer text
|
// question number|type of answer|answer value|answer text
|
||||||
Name: a.nextQuestionSequence ?
|
Name: a.nextQuestionSequence ?
|
||||||
q.questionSequence + "|nextQuestion|" + a.nextQuestionSequence + "|" + a.answerText :
|
q.questionSequence + "|nextQuestion|" + a.nextQuestionSequence + "|" + a.answerText :
|
||||||
q.questionSequence + "|answer|" + a.answerResult + "|" + a.answerText,
|
q.questionSequence + "|answer|" + a.answerResult + "|" + a.answerText,
|
||||||
nextQuestionSequence: a.nextQuestionSequence,
|
nextQuestionSequence: a.nextQuestionSequence,
|
||||||
answerResult: a.answerResult,
|
answerResult: a.answerResult,
|
||||||
questionSequence: q.questionSequence,
|
questionSequence: q.questionSequence,
|
||||||
questionType: a.nextQuestionSequence ? "nextQuestion" : "answer",
|
questionType: a.nextQuestionSequence ? "nextQuestion" : "answer",
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
answerSelected: q.answerSelected || "",
|
answerSelected: q.answerSelected || "",
|
||||||
};
|
};
|
||||||
question.answerPair = answerPair;
|
question.answerPair = answerPair;
|
||||||
if (!q.suppressQuestion) {
|
if (!q.suppressQuestion) {
|
||||||
this.questions.push(question);
|
this.questions.push(question);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.modelValue?.length > 0) {
|
if (!this.modelValue?.length > 0 && this.questions.length > 0) {
|
||||||
// set this.currentQuestionNum to first valid question
|
// set this.currentQuestionNum to first valid question
|
||||||
this.currentQuestionNum = this.questions[0].questionSequence;
|
this.currentQuestionNum = this.questions[0].questionSequence;
|
||||||
// scroll the next question into view
|
// scroll the next question into view
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
document.querySelector('.current-question').scrollIntoView({behavior: "smooth"});
|
document.querySelector('.current-question').scrollIntoView({behavior: "smooth"});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -151,7 +151,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
answerResult: questionAnswer,
|
answerResult: questionAnswer,
|
||||||
answeredQuestions: answeredQuestions,
|
answeredQuestions: answeredQuestions,
|
||||||
partIndex: this.partIndex,
|
glassIndex: this.glassIndex,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,5 @@ export default {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ const storeActions = {
|
||||||
GET_PARTS: "getParts",
|
GET_PARTS: "getParts",
|
||||||
GET_CAPABILITY_QUESTIONS: "getCapabilityQuestions",
|
GET_CAPABILITY_QUESTIONS: "getCapabilityQuestions",
|
||||||
GET_PART_FROM_CAPABILITY_QUESTION_ANSWER: "getPartFromCapabilityQuestionAnswer",
|
GET_PART_FROM_CAPABILITY_QUESTION_ANSWER: "getPartFromCapabilityQuestionAnswer",
|
||||||
|
GET_MOLDING_QUESTIONS: "getMoldingQuestions",
|
||||||
SAVE_ORDER: "saveOrder",
|
SAVE_ORDER: "saveOrder",
|
||||||
LOAD_ORDER: "loadOrder",
|
LOAD_ORDER: "loadOrder",
|
||||||
UPDATE_STORE_WITH_SAVE_ORDER_RESPONSE: "updateStoreWithSaveOrderResponse",
|
UPDATE_STORE_WITH_SAVE_ORDER_RESPONSE: "updateStoreWithSaveOrderResponse",
|
||||||
|
|
@ -57,6 +58,8 @@ const storeActions = {
|
||||||
SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup",
|
SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup",
|
||||||
SAVE_GLASS_PARTS: "saveGlassParts",
|
SAVE_GLASS_PARTS: "saveGlassParts",
|
||||||
SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers",
|
SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers",
|
||||||
|
RESET_MOLDING_AND_CAPABILITY_QUESTIONS_IF_NEEDED: "resetMoldingAndCapabilityQuestionAnswersIfNeeded",
|
||||||
|
SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers",
|
||||||
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers"
|
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ const storeMutations = {
|
||||||
UPDATE_NUMBER_OF_CHIPS: "updateNumberOfChips",
|
UPDATE_NUMBER_OF_CHIPS: "updateNumberOfChips",
|
||||||
UPDATE_GLASS_TO_REPLACE: "updateGlassToReplace",
|
UPDATE_GLASS_TO_REPLACE: "updateGlassToReplace",
|
||||||
UPDATE_PART_QUESTION_ANSWERS: "updatePartQuestionAnswers",
|
UPDATE_PART_QUESTION_ANSWERS: "updatePartQuestionAnswers",
|
||||||
|
UPDATE_MOLDING_QUESTION_ANSWERS: "updateMoldingQuestionAnswers",
|
||||||
UPDATE_CAPABILITY_QUESTION_ANSWERS: "updateCapabilityQuestionAnswers",
|
UPDATE_CAPABILITY_QUESTION_ANSWERS: "updateCapabilityQuestionAnswers",
|
||||||
UPDATE_GLASS_PARTS: "updateGlassParts",
|
UPDATE_GLASS_PARTS: "updateGlassParts",
|
||||||
UPDATE_OTHER_PARTS: "updateOtherParts",
|
UPDATE_OTHER_PARTS: "updateOtherParts",
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@
|
||||||
<alert ref="alertFewMoreQuestions" class="my-5" alertClass="alert-warning"
|
<alert ref="alertFewMoreQuestions" class="my-5" alertClass="alert-warning"
|
||||||
:manualHeadline="AlertFewMoreQuestionsHeader" :manualCopy="AlertFewMoreQuestionsCopy"
|
:manualHeadline="AlertFewMoreQuestionsHeader" :manualCopy="AlertFewMoreQuestionsCopy"
|
||||||
v-bind:isDismissible="false" />
|
v-bind:isDismissible="false" />
|
||||||
<div v-for="(part, i) in capabilityQuestionsData" :key="part.key">
|
<div v-for="(glass, i) in capabilityQuestionsData" :key="glass.key">
|
||||||
<questionChain ref="questionChain" :keyString="part.key"
|
<questionChain ref="questionChain" :keyString="glass.key"
|
||||||
v-model="selectedAnswers[part.glassLocation + '-' + part.glassName]"
|
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
||||||
:questionData="part.capabilityQuestions" :partIndex="i"
|
:questionData="glass.capabilityQuestions" :glassIndex="i"
|
||||||
v-if="showThisPartQuestionChain(part, i)"
|
v-if="showThisQuestionChain(glass, i)"
|
||||||
validationRules="questions-required" />
|
validationRules="questions-required" />
|
||||||
</div>
|
</div>
|
||||||
<funnel-footer ref="funnelFooter" cmsWidgetName="FunnelFooterWidget"
|
<funnel-footer ref="funnelFooter" cmsWidgetName="FunnelFooterWidget"
|
||||||
|
|
@ -73,11 +73,9 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedAnswer: [],
|
|
||||||
capabilityQuestionsData: store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS).partsOrQuestions,
|
capabilityQuestionsData: store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS).partsOrQuestions,
|
||||||
selectedAnswers: {},
|
selectedAnswers: {},
|
||||||
currentQuestionChainIndex: 0,
|
currentQuestionChainIndex: 0,
|
||||||
newAnswersArray: [],
|
|
||||||
foundDuplicateQuestions: [],
|
foundDuplicateQuestions: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -102,33 +100,33 @@ export default {
|
||||||
this.loadInitialCapabilityQuestionsData();
|
this.loadInitialCapabilityQuestionsData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showThisPartQuestionChain(part, i) {
|
showThisQuestionChain(glass, i) {
|
||||||
if (part.capabilityQuestions?.length < 1 || part.isSuppressedPart) { return false; } // return false if no capabilityQuestions or if suppressed
|
if (!glass.capabilityQuestions || glass.capabilityQuestions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no capabilityQuestions or if suppressed
|
||||||
return this.currentQuestionChainIndex === i || part.answerData?.answerResult?.length > 0
|
return this.currentQuestionChainIndex === i || glass.answerData?.answerResult?.length > 0;
|
||||||
},
|
},
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
const capabilityQuestionsPageData = store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS);
|
const capabilityQuestionsPageData = store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS);
|
||||||
return capabilityQuestionsPageData && Object.keys(capabilityQuestionsPageData).length > 0;
|
return capabilityQuestionsPageData && Object.keys(capabilityQuestionsPageData).length > 0;
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
const capabilityQuestionsAnswersArray = this.capabilityQuestionsData.map((item) => {
|
const capabilityQuestionsAnswersArray = this.capabilityQuestionsData.map((glass) => {
|
||||||
const selectedAnswerResult1 = item.answerData.answerResult;
|
const selectedAnswerResult1 = glass.answerData.answerResult;
|
||||||
const selectedAnswerResult2 = item.answerData.answerResult2;
|
const selectedAnswerResult2 = glass.answerData.answerResult2;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
glassLocation: item.glassLocation,
|
glassLocation: glass.glassLocation,
|
||||||
glassName: item.glassName,
|
glassName: glass.glassName,
|
||||||
result: item.answerData.answerResult,
|
result: glass.answerData.answerResult,
|
||||||
result1: selectedAnswerResult1,
|
result1: selectedAnswerResult1,
|
||||||
result2: selectedAnswerResult2,
|
result2: selectedAnswerResult2,
|
||||||
answeredQuestions: item.answerData.answeredQuestions,
|
answeredQuestions: glass.answerData.answeredQuestions,
|
||||||
isSuppressedPart: item.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.capabilityQuestionsData.forEach((part) => {
|
this.capabilityQuestionsData.forEach((glass) => {
|
||||||
part.answerData = {};
|
glass.answerData = {};
|
||||||
});
|
});
|
||||||
|
|
||||||
// save to vuex store as order.damage.capabilityQuestionAnswers (array)
|
// save to vuex store as order.damage.capabilityQuestionAnswers (array)
|
||||||
|
|
@ -160,16 +158,9 @@ export default {
|
||||||
"questionText": "Is your Grand Cherokee the Laredo model?",
|
"questionText": "Is your Grand Cherokee the Laredo model?",
|
||||||
"selectedAnswerText": "Yes",
|
"selectedAnswerText": "Yes",
|
||||||
"questionNum": 1,
|
"questionNum": 1,
|
||||||
"extra": {
|
|
||||||
"Text": "Yes",
|
|
||||||
"nextQuestionSequence": null,
|
|
||||||
"answerResult": "DD11132",
|
|
||||||
"questionSequence": 1,
|
|
||||||
"questionType": "answer"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"partIndex": 0
|
"glassIndex": 0
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -192,18 +183,18 @@ export default {
|
||||||
// HANDLE DUPLICATE QUESTIONS
|
// HANDLE DUPLICATE QUESTIONS
|
||||||
|
|
||||||
// loop through all glass parts data
|
// loop through all glass parts data
|
||||||
this.capabilityQuestionsData.forEach((glassPart, gpIndex) => {
|
this.capabilityQuestionsData.forEach((glass, gpIndex) => {
|
||||||
|
|
||||||
// only look for duplicates forward... to parts that follow after the currently being answered part
|
// only look for duplicates forward... to parts that follow after the currently being answered part
|
||||||
if (gpIndex > answer.partIndex) {
|
if (gpIndex > answer.glass) {
|
||||||
|
|
||||||
let suppressUntil;
|
let suppressUntil;
|
||||||
// reset this glass part, in case user is changing their previous answers
|
// reset this glass part, in case user is changing their previous answers
|
||||||
glassPart.answerData = null;
|
glass.answerData = null;
|
||||||
glassPart.isSuppressedPart = null;
|
glass.isSuppressedPart = null;
|
||||||
|
|
||||||
// loop through this glass part's part questions, looking for a questionText match
|
// loop through this glass part's part questions, looking for a questionText match
|
||||||
glassPart.capabilityQuestions.forEach((pq, pqIndex) => {
|
glass.capabilityQuestions.forEach((pq, pqIndex) => {
|
||||||
|
|
||||||
// clear out any previously set answers
|
// clear out any previously set answers
|
||||||
pq.answerSelected = null;
|
pq.answerSelected = null;
|
||||||
|
|
@ -223,7 +214,7 @@ export default {
|
||||||
// if these match then we have a duplicate question
|
// if these match then we have a duplicate question
|
||||||
if (pq.questionText.toUpperCase() === answeredQuestionText) {
|
if (pq.questionText.toUpperCase() === answeredQuestionText) {
|
||||||
|
|
||||||
const thisAnsweredCapabilityQuestion = glassPart.capabilityQuestions[pqIndex];
|
const thisAnsweredCapabilityQuestion = glass.capabilityQuestions[pqIndex];
|
||||||
let matchedAnswer;
|
let matchedAnswer;
|
||||||
let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
|
let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
|
||||||
|
|
||||||
|
|
@ -245,7 +236,7 @@ export default {
|
||||||
|
|
||||||
if (matchedAnswer.nextQuestionSequence) {
|
if (matchedAnswer.nextQuestionSequence) {
|
||||||
// ensure that the question that the accepted answer has set to be next is NOT suppressed
|
// ensure that the question that the accepted answer has set to be next is NOT suppressed
|
||||||
glassPart.capabilityQuestions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
|
glass.capabilityQuestions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
|
||||||
// if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
|
// if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
|
||||||
if (pqIndex === 0) {
|
if (pqIndex === 0) {
|
||||||
if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
|
if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
|
||||||
|
|
@ -254,7 +245,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle suppressing upstream in this question chain
|
// handle suppressing upstream in this question chain
|
||||||
glassPart.capabilityQuestions.forEach((q) => {
|
glass.capabilityQuestions.forEach((q) => {
|
||||||
q.answers.forEach((thisAns) => {
|
q.answers.forEach((thisAns) => {
|
||||||
// restore any of the answers that formerly led to the duplicated question
|
// restore any of the answers that formerly led to the duplicated question
|
||||||
if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
|
if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
|
||||||
|
|
@ -288,7 +279,7 @@ export default {
|
||||||
// suppress current question
|
// suppress current question
|
||||||
thisAnsweredCapabilityQuestion.suppressQuestion = true;
|
thisAnsweredCapabilityQuestion.suppressQuestion = true;
|
||||||
|
|
||||||
const thisGlassPart = "glassPart" + gpIndex;
|
const thisGlassPart = "glass" + gpIndex;
|
||||||
if (this.foundDuplicateQuestions[thisGlassPart]) {
|
if (this.foundDuplicateQuestions[thisGlassPart]) {
|
||||||
if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredCapabilityQuestion.questionSequence)) {
|
if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredCapabilityQuestion.questionSequence)) {
|
||||||
this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredCapabilityQuestion.questionSequence);
|
this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredCapabilityQuestion.questionSequence);
|
||||||
|
|
@ -298,7 +289,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// are there any questions left that are not suppressed?
|
// are there any questions left that are not suppressed?
|
||||||
const remainingQuestions = glassPart.capabilityQuestions.filter((q) => {
|
const remainingQuestions = glass.capabilityQuestions.filter((q) => {
|
||||||
return !q.suppressQuestion;
|
return !q.suppressQuestion;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -313,14 +304,14 @@ export default {
|
||||||
suppressQuestion: pq.suppressQuestion,
|
suppressQuestion: pq.suppressQuestion,
|
||||||
};
|
};
|
||||||
// set the answerData as 'already answered'
|
// set the answerData as 'already answered'
|
||||||
glassPart.answerData = {
|
glass.answerData = {
|
||||||
answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
|
answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
|
||||||
answerResult1: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
|
answerResult1: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
|
||||||
answeredQuestions: [answeredQuestionObj],
|
answeredQuestions: [answeredQuestionObj],
|
||||||
};
|
};
|
||||||
|
|
||||||
// suppress this glassPart because it has an answer
|
// suppress this glass because it has an answer
|
||||||
glassPart.isSuppressedPart = true;
|
glass.isSuppressedPart = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -346,9 +337,9 @@ export default {
|
||||||
// "glassPart2": [7, 10]
|
// "glassPart2": [7, 10]
|
||||||
// };
|
// };
|
||||||
|
|
||||||
const thisPartsDupes = this.foundDuplicateQuestions["glassPart" + answer.partIndex];
|
const thisPartsDupes = this.foundDuplicateQuestions["glass" + answer.glassIndex];
|
||||||
const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
|
const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
|
||||||
const glassPartAnswered = this.capabilityQuestionsData[answer.partIndex];
|
const glassPartAnswered = this.capabilityQuestionsData[answer.glassIndex];
|
||||||
|
|
||||||
thisPartsDupes?.forEach((dupe) => {
|
thisPartsDupes?.forEach((dupe) => {
|
||||||
// dupe is a single integer
|
// dupe is a single integer
|
||||||
|
|
@ -404,7 +395,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this part has been fully answered, so advance to next part's question chain
|
// this part has been fully answered, so advance to next part's question chain
|
||||||
for (let i = answer.partIndex + 1; i < this.capabilityQuestionsData.length; i++) {
|
for (let i = answer.glassIndex + 1; i < this.capabilityQuestionsData.length; i++) {
|
||||||
// if this part has not yet been fully answered, then make it the current part
|
// if this part has not yet been fully answered, then make it the current part
|
||||||
if (!this.capabilityQuestionsData[i].answerData?.answerResult) {
|
if (!this.capabilityQuestionsData[i].answerData?.answerResult) {
|
||||||
this.currentQuestionChainIndex = i;
|
this.currentQuestionChainIndex = i;
|
||||||
|
|
@ -425,11 +416,11 @@ export default {
|
||||||
// are there alreadyAnsweredQuestions?
|
// are there alreadyAnsweredQuestions?
|
||||||
const alreadyAnsweredQuestions = store.getters.damage.capabilityQuestionAnswers;
|
const alreadyAnsweredQuestions = store.getters.damage.capabilityQuestionAnswers;
|
||||||
|
|
||||||
this.capabilityQuestionsData = this.pageData.partsOrQuestions.filter(x => x.capabilityQuestions).map((part, i) => {
|
this.capabilityQuestionsData = this.pageData.partsOrQuestions.filter(x => x.capabilityQuestions).map((glass, i) => {
|
||||||
part.key = part.glassLocation + "-" + part.glassName;
|
glass.key = glass.glassLocation + "-" + glass.glassName;
|
||||||
this.selectedAnswers[part.key] = [];
|
this.selectedAnswers[glass.key] = [];
|
||||||
if (!alreadyAnsweredQuestions) {
|
if (!alreadyAnsweredQuestions) {
|
||||||
part.answerData = null;
|
glass.answerData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
alreadyAnsweredQuestions?.forEach((savedPart) => {
|
alreadyAnsweredQuestions?.forEach((savedPart) => {
|
||||||
|
|
@ -437,7 +428,7 @@ export default {
|
||||||
if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.result) {
|
if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (part.glassLocation === savedPart.glassLocation && part.glassName === savedPart.glassName) {
|
if (glass.glassLocation === savedPart.glassLocation && glass.glassName === savedPart.glassName) {
|
||||||
let answerString = "";
|
let answerString = "";
|
||||||
|
|
||||||
// matches; loop through answeredQuestions for matches
|
// matches; loop through answeredQuestions for matches
|
||||||
|
|
@ -446,7 +437,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// determine which answer was previously chosen
|
// determine which answer was previously chosen
|
||||||
const theAns = part.capabilityQuestions[aq.questionNum - 1].answers.find((a) => {
|
const theAns = glass.capabilityQuestions[aq.questionNum - 1].answers.find((a) => {
|
||||||
return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
|
return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
|
||||||
});
|
});
|
||||||
if (theAns.nextQuestionSequence) {
|
if (theAns.nextQuestionSequence) {
|
||||||
|
|
@ -456,18 +447,18 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark this partQuestion as answered (question-chain will read this)
|
// mark this partQuestion as answered (question-chain will read this)
|
||||||
part.capabilityQuestions[aq.questionNum - 1].answerSelected = answerString;
|
glass.capabilityQuestions[aq.questionNum - 1].answerSelected = answerString;
|
||||||
// mark this partQuestion as duplicate if it is (question-chain will read this)
|
// mark this partQuestion as duplicate if it is (question-chain will read this)
|
||||||
if (aq.suppressQuestion) {
|
if (aq.suppressQuestion) {
|
||||||
part.capabilityQuestions[aq.questionNum - 1].suppressQuestion = true;
|
glass.capabilityQuestions[aq.questionNum - 1].suppressQuestion = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// advance the currentQuestionChainIndex
|
// advance the currentQuestionChainIndex
|
||||||
this.currentQuestionChainIndex = i;
|
this.currentQuestionChainIndex = i;
|
||||||
|
|
||||||
// add answerData to current part
|
// add answerData to current glass
|
||||||
part.answerData = {
|
glass.answerData = {
|
||||||
answerResult: savedPart.result,
|
answerResult: savedPart.result,
|
||||||
answerResult1: savedPart.result,
|
answerResult1: savedPart.result,
|
||||||
answerResult2: this.getCorrespondingAnswerResult2(savedPart.result),
|
answerResult2: this.getCorrespondingAnswerResult2(savedPart.result),
|
||||||
|
|
@ -477,14 +468,14 @@ export default {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set up watch for each set of part questions, which gets updated when all questions for a part have been answered
|
// Set up watch for each set of glass questions, which gets updated when all questions for a glass have been answered
|
||||||
this.$watch("selectedAnswers." + part.key, (newValue) => {
|
this.$watch("selectedAnswers." + glass.key, (newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
this.handleAnswerUpdates(newValue);
|
this.handleAnswerUpdates(newValue);
|
||||||
}
|
}
|
||||||
}, { deep: true })
|
}, { deep: true })
|
||||||
|
|
||||||
return part;
|
return glass;
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -49,19 +49,22 @@ describe("estimate.vue", () => {
|
||||||
//Assert
|
//Assert
|
||||||
expect(arePagePrerequisitesValid).toBe(true);
|
expect(arePagePrerequisitesValid).toBe(true);
|
||||||
});
|
});
|
||||||
test("isRepair is set to false, arePagePrerequisitesValid should return true", async () => {
|
test("isRepair is set to true, arePagePrerequisitesValid should return true", async () => {
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
store.commit( storeMutations.UPDATE_IS_REPAIR, false );
|
store.commit( storeMutations.UPDATE_IS_REPAIR, true );
|
||||||
|
|
||||||
let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
|
let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(arePagePrerequisitesValid).toBe(true);
|
expect(arePagePrerequisitesValid).toBe(true);
|
||||||
});
|
});
|
||||||
|
test.todo("isRepair is false and there are no lineItems => should return false")
|
||||||
|
test.todo("isRepair is false and lineItems is null => should return false")
|
||||||
|
test.todo("isRepair is false are there are lineItems => should return true")
|
||||||
test("isRepair is set to null, arePagePrerequisitesValid should return false", async () => {
|
test("isRepair is set to null, arePagePrerequisitesValid should return false", async () => {
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|
|
||||||
|
|
@ -80,10 +80,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
if(store.getters.damage.isRepair != null){
|
return store.getters.damage.isRepair || store.getters.damage.glassToReplace?.length > 0;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
// route to move backwards
|
// route to move backwards
|
||||||
|
|
|
||||||
|
|
@ -11,22 +11,23 @@
|
||||||
<vehicleBanner cmsWidgetName="VehicleBannerWidget" :displayGenericVehicleImage=false />
|
<vehicleBanner cmsWidgetName="VehicleBannerWidget" :displayGenericVehicleImage=false />
|
||||||
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
||||||
<div class="fade-on-route-transition sub-container make-tall">
|
<div class="fade-on-route-transition sub-container make-tall">
|
||||||
<h1>MOLDING QUESTIONS TEMPORARY PLACEHOLDER</h1>
|
|
||||||
<alert
|
<alert
|
||||||
ref="alertFewMoreQuestions"
|
ref="alertFewMoreQuestions"
|
||||||
|
cmsWidgetName="AlertFewMoreQuestionsWidget"
|
||||||
class="my-5"
|
class="my-5"
|
||||||
alertClass="alert-warning"
|
alertClass="alert-warning"
|
||||||
:manualHeadline="AlertFewMoreQuestionsHeader"
|
:manualHeadline="AlertFewMoreQuestionsHeader"
|
||||||
:manualCopy="AlertFewMoreQuestionsCopy"
|
:manualCopy="AlertFewMoreQuestionsCopy"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
/>
|
/>
|
||||||
<div v-for="(part, i) in moldingQuestionsData" :key="i">
|
<div v-for="(glass, i) in moldingQuestionsData" :key="glass.key">
|
||||||
<questionChain
|
<questionChain
|
||||||
ref="questionChain"
|
ref="questionChain"
|
||||||
v-model="selectedModel"
|
:keyString="glass.key"
|
||||||
:questionData="part"
|
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
||||||
:partIndex="i"
|
:questionData="glass.questions"
|
||||||
v-if="showThisPartQuestionChain(part, i)"
|
:glassIndex="i"
|
||||||
|
v-if="showThisQuestionChain(glass, i)"
|
||||||
validationRules="questions-required"
|
validationRules="questions-required"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -63,7 +64,6 @@ import { Form, defineRule } from "vee-validate";
|
||||||
import { required } from "@/helpers/validation-rules";
|
import { required } from "@/helpers/validation-rules";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("questions-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("questions-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
@ -92,89 +92,391 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedModel: [],
|
moldingQuestionsData: store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS).partsOrQuestions,
|
||||||
partsQuestionsData: this.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS).partsOrQuestions.filter((p) => {
|
selectedAnswers: {},
|
||||||
if (Array.isArray(p.partQuestions) && p.partQuestions.length > 0) {
|
currentGlassIndex: 0,
|
||||||
return {
|
foundDuplicateQuestions: [],
|
||||||
glassName: p.glassName,
|
|
||||||
glassLocation: p.glassLocation,
|
|
||||||
partQuestions: p.partQuestions,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
currentPartNum: 0,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
AlertFewMoreQuestionsHeader() {
|
AlertFewMoreQuestionsHeader() {
|
||||||
return this.getCmsContent("AlertPartsQuestions", "HeadlineText");
|
return this.getCmsContent("AdditionalPartsQuestionsAlert", "HeadlineText");
|
||||||
},
|
},
|
||||||
AlertFewMoreQuestionsCopy() {
|
AlertFewMoreQuestionsCopy() {
|
||||||
return this.getCmsContent("AlertPartsQuestions", "BodyText");
|
return this.getCmsContent("AdditionalPartsQuestionsAlert", "BodyText");
|
||||||
},
|
},
|
||||||
|
pageData() {
|
||||||
|
return this.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.LoadInitialData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return false; // TODO - DO TRUE TEST OF PAGEDATA
|
const moldingQuestionsFromPageData = store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS);
|
||||||
// return Object.keys(store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS)).length > 0;
|
return moldingQuestionsFromPageData && Object.keys(moldingQuestionsFromPageData).length > 0;
|
||||||
},
|
},
|
||||||
showThisPartQuestionChain(part, i) {
|
showThisQuestionChain(glass, i) {
|
||||||
if (part.partQuestions?.length < 1) { return false; } // return false if only one partQuestion
|
if (!glass.questions || glass.questions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no questions or if suppressed
|
||||||
if (this.currentPartNum === i || part.answerData?.answerResult.length > 0) { return true; }
|
return this.currentGlassIndex === i || glass.answerData?.answerResult?.length > 0;
|
||||||
return false;
|
|
||||||
},
|
|
||||||
backButtonAction() {
|
|
||||||
// route to move backwards
|
|
||||||
this.$router.navigateWithoutSaving(
|
|
||||||
this.navigationScenarios.CLICKED_BACK,
|
|
||||||
this.$route
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
const partQuestionAnswersArray = this.partsQuestionsData.map((item) => {
|
const questionAnswersArray = this.moldingQuestionsData.map((glass) => {
|
||||||
return {
|
return {
|
||||||
glassLocation: item.glassLocation,
|
glassLocation: glass.glassLocation,
|
||||||
glassName: item.glassName,
|
glassName: glass.glassName,
|
||||||
result: item.answerData.answerResult,
|
partNum: glass.answerData.answerResult,
|
||||||
answeredQuestions: item.answerData.answeredQuestions,
|
answeredQuestions: glass.answerData.answeredQuestions,
|
||||||
|
isSuppressedPart: glass.isSuppressedPart,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// save to vuex store as order.damage.partQuestionAnswers (array)
|
// clear out answerData for future page loads; must occur prior to store save
|
||||||
await this.dispatchStoreAction(this.storeActions.SAVE_PART_QUESTION_ANSWERS, partQuestionAnswersArray, false);
|
this.moldingQuestionsData.forEach((glass) => {
|
||||||
|
glass.answerData = {};
|
||||||
|
});
|
||||||
|
|
||||||
|
// save to vuex store as order.damage.moldingQuestionArrays (array)
|
||||||
|
await this.dispatchStoreAction(this.storeActions.SAVE_MOLDING_QUESTION_ANSWERS, questionAnswersArray, false);
|
||||||
|
|
||||||
|
// get parts from the questionAnswers
|
||||||
|
let partsOrQuestions = this.pageData.partsOrQuestions;
|
||||||
|
for (let answer of questionAnswersArray) {
|
||||||
|
partsOrQuestions.find(partOrQuestion => {
|
||||||
|
return partOrQuestion.glassLocation === answer.glassLocation && partOrQuestion.glassName === answer.glassName;
|
||||||
|
}).parts[0].childParts = [
|
||||||
|
{
|
||||||
|
partNumber: answer.partNum
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.navigateForward(partsOrQuestions);
|
||||||
|
},
|
||||||
|
handleAnswerUpdates(key, answer) {
|
||||||
|
// only runs when all questions in a question-chain have been answered
|
||||||
|
// when selectedAnswers updates, user has completed this part's question chain and has a final answer
|
||||||
|
// (does not get run for each invididual question's answer, only when
|
||||||
|
// all relevent questions for the current part have been answered)
|
||||||
|
|
||||||
|
/*
|
||||||
|
answer example format:
|
||||||
|
{
|
||||||
|
"answerResult": "DD11132",
|
||||||
|
"answeredQuestions": [
|
||||||
|
{
|
||||||
|
"questionText": "Is your Grand Cherokee the Laredo model?",
|
||||||
|
"selectedAnswerText": "Yes",
|
||||||
|
"questionNum": 1,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"glassIndex": 0
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// collect a list of the answered questions' numbers, needed later below
|
||||||
|
const answeredQuestionIndexes = [];
|
||||||
|
|
||||||
|
// if user has answered a question differently than anything that was preloaded,
|
||||||
|
// we need to clear out any preloaded answers
|
||||||
|
this.selectedAnswers = {};
|
||||||
|
|
||||||
|
// loop through every answered question on the currently answered glass part
|
||||||
|
answer.answeredQuestions?.forEach((aq) => {
|
||||||
|
|
||||||
|
// keep track of this question number
|
||||||
|
answeredQuestionIndexes.push(aq.questionNum);
|
||||||
|
|
||||||
|
const answeredQuestionText = aq.questionText.toUpperCase();
|
||||||
|
const answeredQuestionAnswer = aq.selectedAnswerText.toUpperCase();
|
||||||
|
|
||||||
|
// HANDLE DUPLICATE QUESTIONS
|
||||||
|
|
||||||
|
// loop through all glass parts data
|
||||||
|
this.moldingQuestionsData.forEach((glass, gpIndex) => {
|
||||||
|
|
||||||
|
// only look for duplicates forward... to parts that follow after the currently being answered part
|
||||||
|
if (gpIndex > answer.glassIndex) {
|
||||||
|
|
||||||
|
let suppressUntil;
|
||||||
|
// reset this glass part, in case user is changing their previous answers
|
||||||
|
glass.answerData = null;
|
||||||
|
glass.isSuppressedPart = null;
|
||||||
|
|
||||||
|
// loop through this glass part's part questions, looking for a questionText match
|
||||||
|
glass.questions.forEach((pq, pqIndex) => {
|
||||||
|
|
||||||
|
// clear out any previously set answers
|
||||||
|
pq.answerSelected = null;
|
||||||
|
|
||||||
|
// clear or set suppressQuestion property for each question
|
||||||
|
if (suppressUntil) {
|
||||||
|
// if suppressUntil has been set, then suppress this question if before it
|
||||||
|
if (pqIndex + 1 < suppressUntil) {
|
||||||
|
pq.suppressQuestion = true;
|
||||||
|
} else {
|
||||||
|
pq.suppressQuestion = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pq.suppressQuestion = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if these match then we have a duplicate question
|
||||||
|
if (pq.questionText.toUpperCase() === answeredQuestionText) {
|
||||||
|
|
||||||
|
const thisAnsweredPartQuestion = glass.questions[pqIndex];
|
||||||
|
let matchedAnswer;
|
||||||
|
let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
|
||||||
|
|
||||||
|
// which one of this questions' answers matches our answer?
|
||||||
|
pq.answers.forEach((ans) => {
|
||||||
|
if (ans.answerText.toUpperCase() === answeredQuestionAnswer) {
|
||||||
|
matchedAnswer = ans;
|
||||||
|
ans.selected = true;
|
||||||
|
} else {
|
||||||
|
rejectedAnswers.push(ans);
|
||||||
|
ans.selected = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the key to re-render this part's question-chain component
|
||||||
|
this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].glassLocation + this.moldingQuestionsData[gpIndex].glassName + Date.now().toString();
|
||||||
|
|
||||||
|
// handle suppressing downstream in this question chain
|
||||||
|
|
||||||
|
if (matchedAnswer.nextQuestionSequence) {
|
||||||
|
// ensure that the question that the accepted answer has set to be next is NOT suppressed
|
||||||
|
glass.questions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
|
||||||
|
// if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
|
||||||
|
if (pqIndex === 0) {
|
||||||
|
if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
|
||||||
|
if (matchedAnswer.nextQuestionSequence < suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle suppressing upstream in this question chain
|
||||||
|
glass.questions.forEach((q) => {
|
||||||
|
q.answers.forEach((thisAns) => {
|
||||||
|
// restore any of the answers that formerly led to the duplicated question
|
||||||
|
if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
|
||||||
|
// restore original nextQuestionSequence
|
||||||
|
thisAns.nextQuestionSequence = thisAns.originalNextQuestionSequence;
|
||||||
|
this.originalNextQuestionSequence = null;
|
||||||
|
// restore original answerResult
|
||||||
|
if (thisAns.originalAnswerResult) {
|
||||||
|
thisAns.answerResult = thisAns.originalAnswerResult;
|
||||||
|
thisAns.originalAnswerResult = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// search for any answers that lead to the duplicated question
|
||||||
|
if (thisAns.nextQuestionSequence === pq.questionSequence) {
|
||||||
|
// update either the nextQuestionSequence or the answerResult
|
||||||
|
if (matchedAnswer.nextQuestionSequence) {
|
||||||
|
thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence;
|
||||||
|
thisAns.nextQuestionSequence = matchedAnswer.nextQuestionSequence;
|
||||||
|
} else {
|
||||||
|
thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence;
|
||||||
|
thisAns.nextQuestionSequence = null;
|
||||||
|
thisAns.originalAnswerResult = thisAns.originalAnswerResult || thisAns.answerResult;
|
||||||
|
thisAns.answerResult = matchedAnswer.answerResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// suppress current question
|
||||||
|
thisAnsweredPartQuestion.suppressQuestion = true;
|
||||||
|
|
||||||
|
const thisGlassPart = "glass" + gpIndex;
|
||||||
|
if (this.foundDuplicateQuestions[thisGlassPart]) {
|
||||||
|
if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredPartQuestion.questionSequence)) {
|
||||||
|
this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredPartQuestion.questionSequence);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.foundDuplicateQuestions[thisGlassPart] = [thisAnsweredPartQuestion.questionSequence];
|
||||||
|
}
|
||||||
|
|
||||||
|
// are there any questions left that are not suppressed?
|
||||||
|
const remainingQuestions = glass.questions.filter((q) => {
|
||||||
|
return !q.suppressQuestion;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (remainingQuestions.length < 1) {
|
||||||
|
// this is the final answer for this glass part
|
||||||
|
|
||||||
|
// mark this part as completely answered by adding answerData
|
||||||
|
const answeredQuestionObj = {
|
||||||
|
questionText: pq.questionText,
|
||||||
|
selectedAnswerText: matchedAnswer.answerText,
|
||||||
|
questionNum: pq.questionSequence,
|
||||||
|
suppressQuestion: pq.suppressQuestion,
|
||||||
|
};
|
||||||
|
// set the answerData as 'already answered'
|
||||||
|
glass.answerData = {
|
||||||
|
answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
|
||||||
|
answeredQuestions: [answeredQuestionObj],
|
||||||
|
};
|
||||||
|
|
||||||
|
// suppress this glass because it has an answer
|
||||||
|
glass.isSuppressedPart = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the key to re-render this part's question-chain component
|
||||||
|
this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].glassLocation + this.moldingQuestionsData[gpIndex].glassName + Date.now().toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// call API parts method
|
|
||||||
const partsLookup = await this.dispatchStoreAction(storeActions.GET_PARTS)
|
|
||||||
.catch(() => {
|
|
||||||
return this.$refs.funnelFooter.removeLoader();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const glassNameAndPartsForStore = partsLookup.data.glassNameAndPartsForStore;
|
});
|
||||||
|
|
||||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(glassNameAndPartsForStore);
|
// DETERMINE ANSWERED QUESTIONS LIST FOR THIS GLASS PART
|
||||||
|
|
||||||
if (hasCapabilityQuestions) {
|
// look through all (this part's) part questions for any duplicates that were suppressed;
|
||||||
// if has capability questions
|
// add them to the list of answered questions if found
|
||||||
// go to capability-questions page
|
|
||||||
this.$router.navigateWithSaving(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore});
|
// EX answeredQuestionIndexes: [1,5,11,13]
|
||||||
} else {
|
|
||||||
// if single parts only
|
// EX this.foundDuplicateQuestions = {
|
||||||
const collectedGlassParts = this.reducedGlassPartsArray(glassNameAndPartsForStore);
|
// "glassPart1": [1],
|
||||||
// save to store lineItems.glassParts
|
// "glassPart2": [7, 10]
|
||||||
this.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
// };
|
||||||
// go to heritage quote page
|
|
||||||
this.$refs.loadingModal.showModal();
|
const thisPartsDupes = this.foundDuplicateQuestions["glass" + answer.glassIndex];
|
||||||
navigateToHeritageFunnel();
|
const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
|
||||||
|
const glassPartAnswered = this.moldingQuestionsData[answer.glassIndex];
|
||||||
|
|
||||||
|
thisPartsDupes?.forEach((dupe) => {
|
||||||
|
// dupe is a single integer
|
||||||
|
const dupeQuestion = glassPartAnswered.questions[dupe - 1];
|
||||||
|
const dupeQuestionAnswer = dupeQuestion.answers.find((q) => q.selected === true);
|
||||||
|
|
||||||
|
glassPartAnswered.questions.forEach((q) => {
|
||||||
|
let includeThisDupeInAnsweredQuestions = false;
|
||||||
|
|
||||||
|
// did one of the answers of this question point to the duplicated question?
|
||||||
|
q.answers.forEach((a) => {
|
||||||
|
if ((dupe === a.originalNextQuestionSequence) &&
|
||||||
|
(answeredQuestionIndexes.includes(q.questionSequence)) &&
|
||||||
|
(a.answerText.toUpperCase() === dupeQuestionAnswer.answerText.toUpperCase())) {
|
||||||
|
includeThisDupeInAnsweredQuestions = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// is this q.questionSequence listed as the duplicated question's nextQuestionSequence?
|
||||||
|
if ((q.questionSequence === dupeQuestionAnswer.nextQuestionSequence) && (answeredQuestionIndexes.includes(q.questionSequence))) {
|
||||||
|
includeThisDupeInAnsweredQuestions = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (includeThisDupeInAnsweredQuestions) {
|
||||||
|
completeAnsweredQuestions.push({
|
||||||
|
questionNum: dupeQuestion.questionSequence,
|
||||||
|
questionText: dupeQuestion.questionText,
|
||||||
|
selectedAnswerText: dupeQuestionAnswer.answerText,
|
||||||
|
suppressQuestion: dupeQuestion.suppressQuestion,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// make sure there are no duplicated dupes in the list...
|
||||||
|
const foundInCompleteAnsweredQuestions = new Set();
|
||||||
|
let filteredCompleteAnsweredQuestions = completeAnsweredQuestions.filter(el => {
|
||||||
|
const duplicate = foundInCompleteAnsweredQuestions.has(el.questionText);
|
||||||
|
foundInCompleteAnsweredQuestions.add(el.questionText);
|
||||||
|
return !duplicate;
|
||||||
|
});
|
||||||
|
filteredCompleteAnsweredQuestions = filteredCompleteAnsweredQuestions.sort((a,b) => a.questionNum - b.questionNum);
|
||||||
|
|
||||||
|
// set final answer data for the current answered glass part
|
||||||
|
glassPartAnswered.answerData = {
|
||||||
|
answerResult: answer.answerResult,
|
||||||
|
answeredQuestions: filteredCompleteAnsweredQuestions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this part has been fully answered, so advance to next molding question chain
|
||||||
|
for (let i = answer.glassIndex + 1; i < this.moldingQuestionsData.length; i++) {
|
||||||
|
// if this part has not yet been fully answered, then make it the current part
|
||||||
|
if (!this.moldingQuestionsData[i].answerData?.answerResult) {
|
||||||
|
this.currentGlassIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
LoadInitialData() {
|
||||||
watch: {
|
|
||||||
selectedModel(model) {
|
// are there alreadyAnsweredQuestions?
|
||||||
this.moldingQuestionsData[model.partIndex].answerData = {
|
const alreadyAnsweredQuestions = store.getters.damage.moldingQuestionAnswers;
|
||||||
answerResult: model.answerResult,
|
|
||||||
answeredQuestions: model.answeredQuestions,
|
this.moldingQuestionsData = this.pageData.partsOrQuestions.filter(x => x.parts[0].childPartQuestions.length).map((glass, i) => {
|
||||||
}
|
glass.key = glass.glassLocation + "-" + glass.glassName;
|
||||||
this.currentPartNum = model.partIndex + 1;
|
// NOTE: property "questions" can differ between layouts
|
||||||
|
glass.questions = glass.parts[0].childPartQuestions;
|
||||||
|
|
||||||
|
this.selectedAnswers[glass.key] = [];
|
||||||
|
if (!alreadyAnsweredQuestions) {
|
||||||
|
glass.answerData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
alreadyAnsweredQuestions?.forEach((savedPart) => {
|
||||||
|
|
||||||
|
if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.partNum) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (glass.glassLocation === savedPart.glassLocation && glass.glassName === savedPart.glassName) {
|
||||||
|
let answerString = "";
|
||||||
|
|
||||||
|
// matches; loop through answeredQuestions for matches
|
||||||
|
savedPart.answeredQuestions.forEach((aq) => {
|
||||||
|
if (!aq.questionNum || !aq.selectedAnswerText) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// determine which answer was previously chosen
|
||||||
|
const theAns = glass.questions[aq.questionNum-1].answers.find((a) => {
|
||||||
|
return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
|
||||||
|
});
|
||||||
|
if (theAns.nextQuestionSequence) {
|
||||||
|
answerString = `${aq.questionNum}|nextQuestion|${theAns.nextQuestionSequence}|${theAns.answerText}`
|
||||||
|
} else {
|
||||||
|
answerString = `${aq.questionNum}|answer|${theAns.answerResult}|${theAns.answerText}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// mark this partQuestion as answered (question-chain will read this)
|
||||||
|
glass.questions[aq.questionNum-1].answerSelected = answerString;
|
||||||
|
// mark this partQuestion as duplicate if it is (question-chain will read this)
|
||||||
|
if (aq.suppressQuestion) {
|
||||||
|
glass.questions[aq.questionNum-1].suppressQuestion = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// advance the currentGlassIndex
|
||||||
|
this.currentGlassIndex = i;
|
||||||
|
|
||||||
|
// add answerData to current glass
|
||||||
|
glass.answerData = {
|
||||||
|
answerResult: savedPart.partNum,
|
||||||
|
answeredQuestions: savedPart.answeredQuestions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set up watch for each set of glass questions, which gets updated when all questions for a glass have been answered
|
||||||
|
this.$watch("selectedAnswers." + glass.key, (newValue) => {
|
||||||
|
if (newValue) {
|
||||||
|
this.handleAnswerUpdates(glass.key, newValue);
|
||||||
|
}
|
||||||
|
}, {deep: true})
|
||||||
|
|
||||||
|
return glass;
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@
|
||||||
:manualCopy="AlertFewMoreQuestionsCopy"
|
:manualCopy="AlertFewMoreQuestionsCopy"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
/>
|
/>
|
||||||
<div v-for="(part, i) in partsQuestionsData" :key="part.key">
|
<div v-for="(glass, i) in partsQuestionsData" :key="glass.key">
|
||||||
<questionChain
|
<questionChain
|
||||||
ref="questionChain"
|
ref="questionChain"
|
||||||
:keyString="part.key"
|
:keyString="glass.key"
|
||||||
v-model="selectedAnswers[part.glassLocation + '-' + part.glassName]"
|
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
||||||
:questionData="part.partQuestions"
|
:questionData="glass.questions"
|
||||||
:partIndex="i"
|
:glassIndex="i"
|
||||||
v-if="showThisPartQuestionChain(part, i)"
|
v-if="showThisQuestionChain(glass, i)"
|
||||||
validationRules="questions-required"
|
validationRules="questions-required"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -91,13 +91,9 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
partsQuestionsFromApi: this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)?.partsOrQuestions.filter((p) => {
|
partsQuestionsData: store.getters.pageData(fmgPageValues.PART_QUESTIONS).partsOrQuestions,
|
||||||
return Array.isArray(p.partQuestions) && p.partQuestions.length > 0;
|
|
||||||
}),
|
|
||||||
selectedAnswers: {},
|
selectedAnswers: {},
|
||||||
currentPartNum: 0,
|
currentGlassIndex: 0,
|
||||||
newAnswersArray: [],
|
|
||||||
partsQuestionsData: [],
|
|
||||||
foundDuplicateQuestions: [],
|
foundDuplicateQuestions: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -108,35 +104,41 @@ export default {
|
||||||
AlertFewMoreQuestionsCopy() {
|
AlertFewMoreQuestionsCopy() {
|
||||||
return this.getCmsContent("AlertPartsQuestions", "BodyText");
|
return this.getCmsContent("AlertPartsQuestions", "BodyText");
|
||||||
},
|
},
|
||||||
|
pageData() {
|
||||||
|
return this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mixins: [vehicleQuestionsMixin],
|
mixins: [vehicleQuestionsMixin],
|
||||||
mounted() {
|
mounted() {
|
||||||
this.LoadInitialPartsData();
|
this.LoadInitialData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showThisPartQuestionChain(part, i) {
|
arePagePrerequisitesValid() {
|
||||||
if (part.partQuestions?.length < 1 || part.isSuppressedPart) { return false; } // return false if no partQuestions or if suppressed
|
const partQuestionsFromPageData = store.getters.pageData(fmgPageValues.PART_QUESTIONS);
|
||||||
if (this.currentPartNum === i || part.answerData?.answerResult?.length > 0) { return true; }
|
return partQuestionsFromPageData && Object.keys(partQuestionsFromPageData).length > 0;
|
||||||
return false;
|
},
|
||||||
|
showThisQuestionChain(glass, i) {
|
||||||
|
if (!glass.questions || glass.questions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no questions or if suppressed
|
||||||
|
return this.currentGlassIndex === i || glass.answerData?.answerResult?.length > 0;
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
const partQuestionAnswersArray = this.partsQuestionsData.map((item) => {
|
const questionAnswersArray = this.partsQuestionsData.map((glass) => {
|
||||||
return {
|
return {
|
||||||
glassLocation: item.glassLocation,
|
glassLocation: glass.glassLocation,
|
||||||
glassName: item.glassName,
|
glassName: glass.glassName,
|
||||||
result: item.answerData.answerResult,
|
result: glass.answerData.answerResult,
|
||||||
answeredQuestions: item.answerData.answeredQuestions,
|
answeredQuestions: glass.answerData.answeredQuestions,
|
||||||
isSuppressedPart: item.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.partsQuestionsData.forEach((part) => {
|
this.partsQuestionsData.forEach((glass) => {
|
||||||
part.answerData = {};
|
glass.answerData = {};
|
||||||
});
|
});
|
||||||
|
|
||||||
// save to vuex store as order.damage.partQuestionAnswers (array)
|
// save to vuex store as order.damage.partQuestionAnswers (array)
|
||||||
await this.dispatchStoreAction(this.storeActions.SAVE_PART_QUESTION_ANSWERS, partQuestionAnswersArray, false);
|
await this.dispatchStoreAction(this.storeActions.SAVE_PART_QUESTION_ANSWERS, questionAnswersArray, false);
|
||||||
|
|
||||||
// call API parts method
|
// call API parts method
|
||||||
const partsLookup = await this.dispatchStoreAction(storeActions.GET_PARTS)
|
const partsLookup = await this.dispatchStoreAction(storeActions.GET_PARTS)
|
||||||
|
|
@ -145,12 +147,9 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
const glassNameAndPartsForStore = partsLookup.data.glassNameAndParts;
|
const glassNameAndPartsForStore = partsLookup.data.glassNameAndParts;
|
||||||
|
|
||||||
this.navigateForward(glassNameAndPartsForStore);
|
this.navigateForward(glassNameAndPartsForStore);
|
||||||
},
|
},
|
||||||
arePagePrerequisitesValid() {
|
|
||||||
const partQuestionsFromPageData = store.getters.pageData(fmgPageValues.PART_QUESTIONS);
|
|
||||||
return partQuestionsFromPageData && Object.keys(partQuestionsFromPageData).length > 0;
|
|
||||||
},
|
|
||||||
handleAnswerUpdates(key, answer) {
|
handleAnswerUpdates(key, answer) {
|
||||||
// only runs when all questions in a question-chain have been answered
|
// only runs when all questions in a question-chain have been answered
|
||||||
// when selectedAnswers updates, user has completed this part's question chain and has a final answer
|
// when selectedAnswers updates, user has completed this part's question chain and has a final answer
|
||||||
|
|
@ -166,16 +165,9 @@ export default {
|
||||||
"questionText": "Is your Grand Cherokee the Laredo model?",
|
"questionText": "Is your Grand Cherokee the Laredo model?",
|
||||||
"selectedAnswerText": "Yes",
|
"selectedAnswerText": "Yes",
|
||||||
"questionNum": 1,
|
"questionNum": 1,
|
||||||
"extra": {
|
|
||||||
"Text": "Yes",
|
|
||||||
"nextQuestionSequence": null,
|
|
||||||
"answerResult": "DD11132",
|
|
||||||
"questionSequence": 1,
|
|
||||||
"questionType": "answer"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"partIndex": 0
|
"glassIndex": 0
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -198,18 +190,18 @@ export default {
|
||||||
// HANDLE DUPLICATE QUESTIONS
|
// HANDLE DUPLICATE QUESTIONS
|
||||||
|
|
||||||
// loop through all glass parts data
|
// loop through all glass parts data
|
||||||
this.partsQuestionsData.forEach((glassPart, gpIndex) => {
|
this.partsQuestionsData.forEach((glass, gpIndex) => {
|
||||||
|
|
||||||
// only look for duplicates forward... to parts that follow after the currently being answered part
|
// only look for duplicates forward... to parts that follow after the currently being answered part
|
||||||
if (gpIndex > answer.partIndex) {
|
if (gpIndex > answer.glassIndex) {
|
||||||
|
|
||||||
let suppressUntil;
|
let suppressUntil;
|
||||||
// reset this glass part, in case user is changing their previous answers
|
// reset this glass part, in case user is changing their previous answers
|
||||||
glassPart.answerData = null;
|
glass.answerData = null;
|
||||||
glassPart.isSuppressedPart = null;
|
glass.isSuppressedPart = null;
|
||||||
|
|
||||||
// loop through this glass part's part questions, looking for a questionText match
|
// loop through this glass part's questions, looking for a questionText match
|
||||||
glassPart.partQuestions.forEach((pq, pqIndex) => {
|
glass.questions.forEach((pq, pqIndex) => {
|
||||||
|
|
||||||
// clear out any previously set answers
|
// clear out any previously set answers
|
||||||
pq.answerSelected = null;
|
pq.answerSelected = null;
|
||||||
|
|
@ -229,11 +221,11 @@ export default {
|
||||||
// if these match then we have a duplicate question
|
// if these match then we have a duplicate question
|
||||||
if (pq.questionText.toUpperCase() === answeredQuestionText) {
|
if (pq.questionText.toUpperCase() === answeredQuestionText) {
|
||||||
|
|
||||||
const thisAnsweredPartQuestion = glassPart.partQuestions[pqIndex];
|
const thisAnsweredQuestion = glass.questions[pqIndex];
|
||||||
let matchedAnswer;
|
let matchedAnswer;
|
||||||
let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
|
let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
|
||||||
|
|
||||||
// which one of this partQuestions' answers matches our answer?
|
// which one of this questions' answers matches our answer?
|
||||||
pq.answers.forEach((ans) => {
|
pq.answers.forEach((ans) => {
|
||||||
if (ans.answerText.toUpperCase() === answeredQuestionAnswer) {
|
if (ans.answerText.toUpperCase() === answeredQuestionAnswer) {
|
||||||
matchedAnswer = ans;
|
matchedAnswer = ans;
|
||||||
|
|
@ -251,7 +243,7 @@ export default {
|
||||||
|
|
||||||
if (matchedAnswer.nextQuestionSequence) {
|
if (matchedAnswer.nextQuestionSequence) {
|
||||||
// ensure that the question that the accepted answer has set to be next is NOT suppressed
|
// ensure that the question that the accepted answer has set to be next is NOT suppressed
|
||||||
glassPart.partQuestions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
|
glass.questions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
|
||||||
// if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
|
// if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
|
||||||
if (pqIndex === 0) {
|
if (pqIndex === 0) {
|
||||||
if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
|
if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
|
||||||
|
|
@ -260,7 +252,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle suppressing upstream in this question chain
|
// handle suppressing upstream in this question chain
|
||||||
glassPart.partQuestions.forEach((q) => {
|
glass.questions.forEach((q) => {
|
||||||
q.answers.forEach((thisAns) => {
|
q.answers.forEach((thisAns) => {
|
||||||
// restore any of the answers that formerly led to the duplicated question
|
// restore any of the answers that formerly led to the duplicated question
|
||||||
if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
|
if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
|
||||||
|
|
@ -290,19 +282,19 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
// suppress current question
|
// suppress current question
|
||||||
thisAnsweredPartQuestion.suppressQuestion = true;
|
thisAnsweredQuestion.suppressQuestion = true;
|
||||||
|
|
||||||
const thisGlassPart = "glassPart" + gpIndex;
|
const thisGlassPart = "glass" + gpIndex;
|
||||||
if (this.foundDuplicateQuestions[thisGlassPart]) {
|
if (this.foundDuplicateQuestions[thisGlassPart]) {
|
||||||
if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredPartQuestion.questionSequence)) {
|
if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredQuestion.questionSequence)) {
|
||||||
this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredPartQuestion.questionSequence);
|
this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredQuestion.questionSequence);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.foundDuplicateQuestions[thisGlassPart] = [thisAnsweredPartQuestion.questionSequence];
|
this.foundDuplicateQuestions[thisGlassPart] = [thisAnsweredQuestion.questionSequence];
|
||||||
}
|
}
|
||||||
|
|
||||||
// are there any questions left that are not suppressed?
|
// are there any questions left that are not suppressed?
|
||||||
const remainingQuestions = glassPart.partQuestions.filter((q) => {
|
const remainingQuestions = glass.questions.filter((q) => {
|
||||||
return !q.suppressQuestion;
|
return !q.suppressQuestion;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -317,13 +309,13 @@ export default {
|
||||||
suppressQuestion: pq.suppressQuestion,
|
suppressQuestion: pq.suppressQuestion,
|
||||||
};
|
};
|
||||||
// set the answerData as 'already answered'
|
// set the answerData as 'already answered'
|
||||||
glassPart.answerData = {
|
glass.answerData = {
|
||||||
answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
|
answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
|
||||||
answeredQuestions: [answeredQuestionObj],
|
answeredQuestions: [answeredQuestionObj],
|
||||||
};
|
};
|
||||||
|
|
||||||
// suppress this glassPart because it has an answer
|
// suppress this glass because it has an answer
|
||||||
glassPart.isSuppressedPart = true;
|
glass.isSuppressedPart = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -351,16 +343,16 @@ export default {
|
||||||
// "glassPart2": [7, 10]
|
// "glassPart2": [7, 10]
|
||||||
// };
|
// };
|
||||||
|
|
||||||
const thisPartsDupes = this.foundDuplicateQuestions["glassPart" + answer.partIndex];
|
const thisPartsDupes = this.foundDuplicateQuestions["glass" + answer.glassIndex];
|
||||||
const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
|
const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
|
||||||
const glassPartAnswered = this.partsQuestionsData[answer.partIndex];
|
const glassPartAnswered = this.partsQuestionsData[answer.glassIndex];
|
||||||
|
|
||||||
thisPartsDupes?.forEach((dupe) => {
|
thisPartsDupes?.forEach((dupe) => {
|
||||||
// dupe is a single integer
|
// dupe is a single integer
|
||||||
const dupeQuestion = glassPartAnswered.partQuestions[dupe - 1];
|
const dupeQuestion = glassPartAnswered.questions[dupe - 1];
|
||||||
const dupeQuestionAnswer = dupeQuestion.answers.find((q) => q.selected === true);
|
const dupeQuestionAnswer = dupeQuestion.answers.find((q) => q.selected === true);
|
||||||
|
|
||||||
glassPartAnswered.partQuestions.forEach((q) => {
|
glassPartAnswered.questions.forEach((q) => {
|
||||||
let includeThisDupeInAnsweredQuestions = false;
|
let includeThisDupeInAnsweredQuestions = false;
|
||||||
|
|
||||||
// did one of the answers of this question point to the duplicated question?
|
// did one of the answers of this question point to the duplicated question?
|
||||||
|
|
@ -404,25 +396,28 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this part has been fully answered, so advance to next part's question chain
|
// this part has been fully answered, so advance to next part's question chain
|
||||||
for (let i = answer.partIndex + 1; i < this.partsQuestionsData.length; i++) {
|
for (let i = answer.glassIndex + 1; i < this.partsQuestionsData.length; i++) {
|
||||||
// if this part has not yet been fully answered, then make it the current part
|
// if this part has not yet been fully answered, then make it the current part
|
||||||
if (!this.partsQuestionsData[i].answerData?.answerResult) {
|
if (!this.partsQuestionsData[i].answerData?.answerResult) {
|
||||||
this.currentPartNum = i;
|
this.currentGlassIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
LoadInitialPartsData() {
|
LoadInitialData() {
|
||||||
|
|
||||||
// are there alreadyAnsweredQuestions?
|
// are there alreadyAnsweredQuestions?
|
||||||
const alreadyAnsweredQuestions = store.getters.damage.partQuestionAnswers;
|
const alreadyAnsweredQuestions = store.getters.damage.partQuestionAnswers;
|
||||||
|
|
||||||
this.partsQuestionsData = this.partsQuestionsFromApi.map((part, i) => {
|
this.partsQuestionsData = this.pageData.partsOrQuestions.filter(x => x.partQuestions).map((glass, i) => {
|
||||||
part.key = part.glassLocation + "-" + part.glassName;
|
glass.key = glass.glassLocation + "-" + glass.glassName;
|
||||||
this.selectedAnswers[part.key] = [];
|
// NOTE: property "questions" can differ between layouts
|
||||||
|
glass.questions = glass.partQuestions;
|
||||||
|
|
||||||
|
this.selectedAnswers[glass.key] = [];
|
||||||
if (!alreadyAnsweredQuestions) {
|
if (!alreadyAnsweredQuestions) {
|
||||||
part.answerData = null;
|
glass.answerData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
alreadyAnsweredQuestions?.forEach((savedPart) => {
|
alreadyAnsweredQuestions?.forEach((savedPart) => {
|
||||||
|
|
@ -430,7 +425,7 @@ export default {
|
||||||
if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.result) {
|
if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (part.glassLocation === savedPart.glassLocation && part.glassName === savedPart.glassName) {
|
if (glass.glassLocation === savedPart.glassLocation && glass.glassName === savedPart.glassName) {
|
||||||
let answerString = "";
|
let answerString = "";
|
||||||
|
|
||||||
// matches; loop through answeredQuestions for matches
|
// matches; loop through answeredQuestions for matches
|
||||||
|
|
@ -439,7 +434,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// determine which answer was previously chosen
|
// determine which answer was previously chosen
|
||||||
const theAns = part.partQuestions[aq.questionNum-1].answers.find((a) => {
|
const theAns = glass.questions[aq.questionNum-1].answers.find((a) => {
|
||||||
return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
|
return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
|
||||||
});
|
});
|
||||||
if (theAns.nextQuestionSequence) {
|
if (theAns.nextQuestionSequence) {
|
||||||
|
|
@ -448,19 +443,19 @@ export default {
|
||||||
answerString = `${aq.questionNum}|answer|${theAns.answerResult}|${theAns.answerText}`
|
answerString = `${aq.questionNum}|answer|${theAns.answerResult}|${theAns.answerText}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark this partQuestion as answered (question-chain will read this)
|
// mark this question as answered (question-chain will read this)
|
||||||
part.partQuestions[aq.questionNum-1].answerSelected = answerString;
|
glass.questions[aq.questionNum-1].answerSelected = answerString;
|
||||||
// mark this partQuestion as duplicate if it is (question-chain will read this)
|
// mark this question as duplicate if it is (question-chain will read this)
|
||||||
if (aq.suppressQuestion) {
|
if (aq.suppressQuestion) {
|
||||||
part.partQuestions[aq.questionNum-1].suppressQuestion = true;
|
glass.questions[aq.questionNum-1].suppressQuestion = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// advance the currentPartNum
|
// advance the currentGlassIndex
|
||||||
this.currentPartNum = i;
|
this.currentGlassIndex = i;
|
||||||
|
|
||||||
// add answerData to current part
|
// add answerData to current glass
|
||||||
part.answerData = {
|
glass.answerData = {
|
||||||
answerResult: savedPart.result,
|
answerResult: savedPart.result,
|
||||||
answeredQuestions: savedPart.answeredQuestions
|
answeredQuestions: savedPart.answeredQuestions
|
||||||
}
|
}
|
||||||
|
|
@ -468,14 +463,14 @@ export default {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set up watch for each set of part questions, which gets updated when all questions for a part have been answered
|
// Set up watch for each set of glass questions, which gets updated when all questions for a glass have been answered
|
||||||
this.$watch("selectedAnswers." + part.key, (newValue) => {
|
this.$watch("selectedAnswers." + glass.key, (newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
this.handleAnswerUpdates(part.key, newValue);
|
this.handleAnswerUpdates(glass.key, newValue);
|
||||||
}
|
}
|
||||||
}, {deep: true})
|
}, {deep: true})
|
||||||
|
|
||||||
return part;
|
return glass;
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ export default {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
// route to move backwards
|
// route to move backwards
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,8 @@ export default {
|
||||||
throw new Error("Could not match any parts to the selected parts");
|
throw new Error("Could not match any parts to the selected parts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.dispatchStoreAction(this.storeActions.RESET_MOLDING_AND_CAPABILITY_QUESTIONS_IF_NEEDED, matchedParts, false);
|
||||||
|
|
||||||
// Navigate to the next page
|
// Navigate to the next page
|
||||||
this.navigateForward(matchedParts);
|
this.navigateForward(matchedParts);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ import store from "@/store";
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
hasSettingEqualTo(settingName, settingValue) {
|
hasSettingEqualTo(settingName, settingValue) {
|
||||||
return store.getters.experimentSettings[settingName] === settingValue;
|
return store.getters.experimentSettings[settingName] == settingValue;
|
||||||
},
|
},
|
||||||
hasSetting(settingName) {
|
hasSetting(settingName) {
|
||||||
return store.getters.experimentSettings.hasOwnProperty(settingName);
|
return Object.hasOwn(store.getters.experimentSettings, settingName);
|
||||||
},
|
},
|
||||||
getSettingValue(settingName) {
|
getSettingValue(settingName) {
|
||||||
return this.hasSetting(settingName) ? store.getters.experimentSettings[settingName] : null;
|
return this.hasSetting(settingName) ? store.getters.experimentSettings[settingName] : null;
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
const partsOrQuestions = this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)?.partsOrQuestions;
|
const partsOrQuestions = (this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS) ?? this.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS))?.partsOrQuestions;
|
||||||
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
||||||
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ const getDefaultState = () => {
|
||||||
numberOfChips: null,
|
numberOfChips: null,
|
||||||
glassToReplace: null,
|
glassToReplace: null,
|
||||||
partQuestionAnswers: null,
|
partQuestionAnswers: null,
|
||||||
|
moldingQuestionAnswers: null,
|
||||||
capabilityQuestionAnswers: null
|
capabilityQuestionAnswers: null
|
||||||
},
|
},
|
||||||
lineItems: {
|
lineItems: {
|
||||||
|
|
@ -127,6 +128,9 @@ export const mutations = {
|
||||||
updatePartQuestionAnswers(state, answersArray) {
|
updatePartQuestionAnswers(state, answersArray) {
|
||||||
state.order.damage.partQuestionAnswers = answersArray;
|
state.order.damage.partQuestionAnswers = answersArray;
|
||||||
},
|
},
|
||||||
|
updateMoldingQuestionAnswers(state, answersArray) {
|
||||||
|
state.order.damage.moldingQuestionAnswers = answersArray;
|
||||||
|
},
|
||||||
updateCapabilityQuestionAnswers(state, answersArray) {
|
updateCapabilityQuestionAnswers(state, answersArray) {
|
||||||
state.order.damage.capabilityQuestionAnswers = answersArray;
|
state.order.damage.capabilityQuestionAnswers = answersArray;
|
||||||
},
|
},
|
||||||
|
|
@ -221,7 +225,7 @@ export const mutations = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// applicationUser MUTATIONS
|
// applicationUser MUTATIONS
|
||||||
updateSaveOrderPromise(state, saveOrderPromise){
|
updateSaveOrderPromise(state, saveOrderPromise) {
|
||||||
state.applicationUser.saveOrderPromise = saveOrderPromise;
|
state.applicationUser.saveOrderPromise = saveOrderPromise;
|
||||||
},
|
},
|
||||||
updateSavedSessionId(state, savedSessionId) {
|
updateSavedSessionId(state, savedSessionId) {
|
||||||
|
|
@ -281,6 +285,7 @@ export const mutations = {
|
||||||
resetGlassPartsState(state) {
|
resetGlassPartsState(state) {
|
||||||
state.order.lineItems.glassParts = null;
|
state.order.lineItems.glassParts = null;
|
||||||
state.order.damage.partQuestionAnswers = null;
|
state.order.damage.partQuestionAnswers = null;
|
||||||
|
state.order.damage.moldingQuestionAnswers = null;
|
||||||
state.order.damage.capabilityQuestionAnswers = null;
|
state.order.damage.capabilityQuestionAnswers = null;
|
||||||
state.applicationUser.pageData[fmgPageValues.PART_QUESTIONS] = null;
|
state.applicationUser.pageData[fmgPageValues.PART_QUESTIONS] = null;
|
||||||
state.applicationUser.pageData[fmgPageValues.VEHICLE_PARTS] = null;
|
state.applicationUser.pageData[fmgPageValues.VEHICLE_PARTS] = null;
|
||||||
|
|
@ -374,29 +379,31 @@ export const getters = {
|
||||||
payment: (state) => state.order.payment,
|
payment: (state) => state.order.payment,
|
||||||
experimentOrder: (state) => {
|
experimentOrder: (state) => {
|
||||||
return {
|
return {
|
||||||
vehicleYear: state.order.vehicle.year,
|
funnelVehicleYear: state.order.vehicle.year,
|
||||||
vehicleMake: state.order.vehicle.make,
|
funnelVehicleMake: state.order.vehicle.make,
|
||||||
vehicleModel: state.order.vehicle.model,
|
funnelVehicleModel: state.order.vehicle.model,
|
||||||
vehicleStyle: state.order.vehicle.style,
|
funnelVehicleStyle: state.order.vehicle.style,
|
||||||
isRepair: state.order.damage.isRepair,
|
funnelIsRepair: state.order.damage.isRepair,
|
||||||
numberOfChips: state.order.damage.numberOfChips,
|
funnelNumberOfChips: state.order.damage.numberOfChips,
|
||||||
carId: state.order.vehicle.carId,
|
funnelCarId: state.order.vehicle.carId,
|
||||||
serviceCity: state.order.serviceLocation.city,
|
funnelServiceCity: state.order.serviceLocation.city,
|
||||||
serviceState: state.order.serviceLocation.state,
|
funnelServiceState: state.order.serviceLocation.state,
|
||||||
serviceZipCode: state.order.serviceLocation.zipCode,
|
funnelServiceZipCode: state.order.serviceLocation.zipCode,
|
||||||
parentAccountNumber: state.order.accountNumber,
|
funnelParentAccountNumber: state.order.accountNumber,
|
||||||
isCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
funnelIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
||||||
orderPartNumbers: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "partNumber"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "partNumber")],
|
funnelHasRecalibrationPart: getHasRecalibrationPart(state),
|
||||||
orderPartTypes: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "recalibrationType")],
|
funnelSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
||||||
hasRecalibrationPart: getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "requiresRecalibration")?.length > 0,
|
funnelSelectedWindshieldGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.WINDSHIELD),
|
||||||
selectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
funnelSelectedBackGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.REAR),
|
||||||
selectedWindshieldGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.WINDSHIELD),
|
funnelSelectedDriverSideGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.DRIVER),
|
||||||
selectedBackGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.REAR),
|
funnelSelectedPassengerSideGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.PASSENGER),
|
||||||
selectedDriverSideGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.DRIVER),
|
|
||||||
selectedPassengerSideGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.PASSENGER)
|
funnelOrderPartNumbers: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "partNumber"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "partNumber")],
|
||||||
|
|
||||||
|
funnelOrderPartTypes: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "recalibrationType")],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
experimentSettings: (state) => state.applicationUser.experiments.map(x => x.settings).reduce((r, c) => Object.assign(r, c), {})
|
experimentSettings: (state) => state.applicationUser.experiments.map(x => x.settings).reduce((r, c) => Object.assign(r, c), {}) ?? {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
function getAllValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
||||||
|
|
@ -755,7 +762,7 @@ export const actions = {
|
||||||
const part = pageData.partsOrQuestions.find(x => x.glassLocation === glassLocation).parts[0];
|
const part = pageData.partsOrQuestions.find(x => x.glassLocation === glassLocation).parts[0];
|
||||||
const capabilityQuestionAnswers = context.getters.damage.capabilityQuestionAnswers;
|
const capabilityQuestionAnswers = context.getters.damage.capabilityQuestionAnswers;
|
||||||
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find(x => x.glassLocation === glassLocation);
|
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find(x => x.glassLocation === glassLocation);
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetPartFromCapabilityAnswer.method,
|
method: endpoints.GetPartFromCapabilityAnswer.method,
|
||||||
endpoint: endpoints.GetPartFromCapabilityAnswer.url,
|
endpoint: endpoints.GetPartFromCapabilityAnswer.url,
|
||||||
|
|
@ -1002,13 +1009,63 @@ export const actions = {
|
||||||
!previousResultsArray.every((x, i) => x.result === partQuestionAnswersArray[i].result);
|
!previousResultsArray.every((x, i) => x.result === partQuestionAnswersArray[i].result);
|
||||||
|
|
||||||
if (havePartQuestionAnswersChanged) {
|
if (havePartQuestionAnswersChanged) {
|
||||||
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.VEHICLE_PARTS, data: null });
|
||||||
|
context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.MOLDING_QUESTIONS, data: null });
|
||||||
|
context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
context.commit(storeMutations.UPDATE_PART_QUESTION_ANSWERS, partQuestionAnswersArray);
|
context.commit(storeMutations.UPDATE_PART_QUESTION_ANSWERS, partQuestionAnswersArray);
|
||||||
},
|
},
|
||||||
|
resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, matchedParts) {
|
||||||
|
const previousResultsArray = [{ parts: context.getters.lineItems.glassParts }];
|
||||||
|
const partsOrQuestionsDataToCompareWith = context.getters.pageData(fmgPageValues.MOLDING_QUESTIONS)?.partsOrQuestions ?? context.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS)?.partsOrQuestions ?? [];
|
||||||
|
|
||||||
|
function getAllPartNumbers(partsOrQuestions) {
|
||||||
|
return partsOrQuestions[0]?.parts
|
||||||
|
? [...partsOrQuestions].map(glass => glass.parts).flat().map(part => part.partNumber).filter(partNumber => !partNumber.toUpperCase().includes("FEE")).sort().join(",")
|
||||||
|
: []
|
||||||
|
}
|
||||||
|
|
||||||
|
const previouslySelectedPartNumbers = getAllPartNumbers(partsOrQuestionsDataToCompareWith);
|
||||||
|
const currentlySelectedPartNumbers = getAllPartNumbers(matchedParts);
|
||||||
|
|
||||||
|
const haveSelectedVehiclePartsChanged = previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
|
||||||
|
|
||||||
|
if (haveSelectedVehiclePartsChanged) {
|
||||||
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.MOLDING_QUESTIONS, data: null });
|
||||||
|
context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
saveMoldingQuestionAnswers(context, moldingQuestionAnswers) {
|
||||||
|
const previousResultsArray = context.getters.damage.moldingQuestionAnswers;
|
||||||
|
const haveMoldingQuestionAnswersChanged = previousResultsArray?.length !== moldingQuestionAnswers.length ||
|
||||||
|
!previousResultsArray.every((x, i) => x.partNum === moldingQuestionAnswers[i].partNum);
|
||||||
|
|
||||||
|
if (haveMoldingQuestionAnswersChanged) {
|
||||||
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
|
}
|
||||||
|
|
||||||
|
//Save new values
|
||||||
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, moldingQuestionAnswers);
|
||||||
|
},
|
||||||
saveCapabilityQuestionAnswers(context, capabilityQuestionAnswers) {
|
saveCapabilityQuestionAnswers(context, capabilityQuestionAnswers) {
|
||||||
|
const previousResultsArray = context.getters.damage.capabilityQuestionAnswers;
|
||||||
|
const haveCapabilityQuestionAnswersChanged = previousResultsArray?.length !== capabilityQuestionAnswers.length ||
|
||||||
|
!previousResultsArray.every((x, i) => x.result === capabilityQuestionAnswers[i].result);
|
||||||
|
|
||||||
|
if (haveCapabilityQuestionAnswersChanged) {
|
||||||
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, capabilityQuestionAnswers);
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, capabilityQuestionAnswers);
|
||||||
},
|
},
|
||||||
|
|
@ -1055,3 +1112,18 @@ export default createStore({
|
||||||
|
|
||||||
// Private Functions
|
// Private Functions
|
||||||
|
|
||||||
|
function getHasRecalibrationPart(state) {
|
||||||
|
var hasRequiresRecalibration = getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "requiresRecalibration")?.length > 0;
|
||||||
|
var hasRecalibrationType = getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType")?.length > 0;
|
||||||
|
|
||||||
|
if (hasRequiresRecalibration) {
|
||||||
|
if (hasRecalibrationType) { // Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType'
|
||||||
|
return getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType")[0].toLowerCase() != "unknown";
|
||||||
|
} else { // Has 'requiresRecalibration' but no 'recalibrationType' at all
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else { // Does not have 'requiresRecalibration'
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1154,6 +1154,49 @@ describe("Actions", () => {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("savePartQuestionAnswers", () => {
|
||||||
|
test.todo("saves partQuestionAnswers")
|
||||||
|
|
||||||
|
test.todo("there are no previous answers => resets necessary fields")
|
||||||
|
|
||||||
|
// mix up the order to make sure sort is working
|
||||||
|
test.todo("previous answers match current answers => does not reset fields")
|
||||||
|
|
||||||
|
test.todo("previous answers does not match current answers => resets necessary fields")
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("resetMoldingAndCapabilityQuestionAnswersIfNeeded", () => {
|
||||||
|
test.todo("there are no saved parts => resets necessary fields")
|
||||||
|
|
||||||
|
// make sure you check the different variations where molding-questions and capability-questions do or don't have pageData
|
||||||
|
// mix up the order to make sure sort is working
|
||||||
|
test.todo("previously saved parts match selected parts => does not reset fields")
|
||||||
|
|
||||||
|
test.todo("previously saved parts do not match selected parts => resets necessary fields")
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("saveMoldingQuestionAnswers", () => {
|
||||||
|
test.todo("saves moldingQuestionAnswers")
|
||||||
|
|
||||||
|
test.todo("there are no previous answers => resets necessary fields")
|
||||||
|
|
||||||
|
// mix up the order to make sure sort is working
|
||||||
|
test.todo("previous answers match current answers => does not reset fields")
|
||||||
|
|
||||||
|
test.todo("previous answers does not match current answers => resets necessary fields")
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("saveCapabilityQuestionAnswers", () => {
|
||||||
|
test.todo("saves capabilityQuestionAnswers")
|
||||||
|
|
||||||
|
test.todo("there are no previous answers => resets necessary fields")
|
||||||
|
|
||||||
|
// mix up the order to make sure sort is working
|
||||||
|
test.todo("previous answers match current answers => does not reset fields")
|
||||||
|
|
||||||
|
test.todo("previous answers does not match current answers => resets necessary fields")
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1256,64 +1299,64 @@ describe("Getters", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeState = state;
|
const storeState = state;
|
||||||
const mockStateValues = {
|
const mockStateValues = {
|
||||||
vehicleYear: 1000,
|
funnelVehicleYear: 1000,
|
||||||
vehicleMake: "CarMake",
|
funnelVehicleMake: "CarMake",
|
||||||
vehicleModel: "CarModel",
|
funnelVehicleModel: "CarModel",
|
||||||
vehicleStyle: "SuperCoolStyle",
|
funnelVehicleStyle: "SuperCoolStyle",
|
||||||
isRepair: true,
|
funnelIsRepair: true,
|
||||||
numberOfChips: 9999999,
|
funnelNumberOfChips: 9999999,
|
||||||
carId: "Gibberish",
|
funnelCarId: "Gibberish",
|
||||||
serviceCity: "Columbus",
|
funnelServiceCity: "Columbus",
|
||||||
serviceState: "OH-IO",
|
funnelServiceState: "OH-IO",
|
||||||
serviceZipCode: 43215,
|
funnelServiceZipCode: 43215,
|
||||||
parentAccountNumber: "999999",
|
funnelParentAccountNumber: "999999",
|
||||||
isCoverageVerified: true,
|
funnelIsCoverageVerified: true,
|
||||||
glassParts: null,
|
funnelGlassParts: null,
|
||||||
otherParts: null,
|
funnelOtherParts: null,
|
||||||
glassToReplace: null
|
funnelGlassToReplace: null
|
||||||
}
|
}
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
mutations.updateYear(storeState, mockStateValues.vehicleYear);
|
mutations.updateYear(storeState, mockStateValues.funnelVehicleYear);
|
||||||
mutations.updateMake(storeState, mockStateValues.vehicleMake);
|
mutations.updateMake(storeState, mockStateValues.funnelVehicleMake);
|
||||||
mutations.updateModel(storeState, mockStateValues.vehicleModel);
|
mutations.updateModel(storeState, mockStateValues.funnelVehicleModel);
|
||||||
mutations.updateStyle(storeState, mockStateValues.vehicleStyle);
|
mutations.updateStyle(storeState, mockStateValues.funnelVehicleStyle);
|
||||||
mutations.updateIsRepair(storeState, mockStateValues.isRepair);
|
mutations.updateIsRepair(storeState, mockStateValues.funnelIsRepair);
|
||||||
mutations.updateNumberOfChips(storeState, mockStateValues.numberOfChips);
|
mutations.updateNumberOfChips(storeState, mockStateValues.funnelNumberOfChips);
|
||||||
mutations.updateCarId(storeState, mockStateValues.carId);
|
mutations.updateCarId(storeState, mockStateValues.funnelCarId);
|
||||||
mutations.updateServiceLocation(storeState, {
|
mutations.updateServiceLocation(storeState, {
|
||||||
city: mockStateValues.serviceCity,
|
city: mockStateValues.funnelServiceCity,
|
||||||
state: mockStateValues.serviceState,
|
state: mockStateValues.funnelServiceState,
|
||||||
zipCode: mockStateValues.serviceZipCode
|
zipCode: mockStateValues.funnelServiceZipCode
|
||||||
});
|
});
|
||||||
mutations.updateParentAcctNumber(storeState, mockStateValues.parentAccountNumber);
|
mutations.updateParentAcctNumber(storeState, mockStateValues.funnelParentAccountNumber);
|
||||||
mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.isCoverageVerified);
|
mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.funnelIsCoverageVerified);
|
||||||
mutations.updateGlassParts(storeState, mockStateValues.glassParts);
|
mutations.updateGlassParts(storeState, mockStateValues.funnelGlassParts);
|
||||||
mutations.updateOtherParts(storeState, mockStateValues.otherParts);
|
mutations.updateOtherParts(storeState, mockStateValues.funnelOtherParts);
|
||||||
mutations.updateGlassToReplace(storeState, mockStateValues.glassToReplace);
|
mutations.updateGlassToReplace(storeState, mockStateValues.funnelGlassToReplace);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(getters.experimentOrder(storeState)).toEqual({
|
expect(getters.experimentOrder(storeState)).toEqual({
|
||||||
vehicleYear: mockStateValues.vehicleYear,
|
funnelVehicleYear: mockStateValues.funnelVehicleYear,
|
||||||
vehicleMake: mockStateValues.vehicleMake,
|
funnelVehicleMake: mockStateValues.funnelVehicleMake,
|
||||||
vehicleModel: mockStateValues.vehicleModel,
|
funnelVehicleModel: mockStateValues.funnelVehicleModel,
|
||||||
vehicleStyle: mockStateValues.vehicleStyle,
|
funnelVehicleStyle: mockStateValues.funnelVehicleStyle,
|
||||||
isRepair: mockStateValues.isRepair,
|
funnelIsRepair: mockStateValues.funnelIsRepair,
|
||||||
numberOfChips: mockStateValues.numberOfChips,
|
funnelNumberOfChips: mockStateValues.funnelNumberOfChips,
|
||||||
carId: mockStateValues.carId,
|
funnelCarId: mockStateValues.funnelCarId,
|
||||||
serviceCity: mockStateValues.serviceCity,
|
funnelServiceCity: mockStateValues.funnelServiceCity,
|
||||||
serviceState: mockStateValues.serviceState,
|
funnelServiceState: mockStateValues.funnelServiceState,
|
||||||
serviceZipCode: mockStateValues.serviceZipCode,
|
funnelServiceZipCode: mockStateValues.funnelServiceZipCode,
|
||||||
parentAccountNumber: mockStateValues.parentAccountNumber,
|
funnelParentAccountNumber: mockStateValues.funnelParentAccountNumber,
|
||||||
isCoverageVerified: mockStateValues.isCoverageVerified,
|
funnelIsCoverageVerified: mockStateValues.funnelIsCoverageVerified,
|
||||||
orderPartNumbers: [],
|
funnelOrderPartNumbers: [],
|
||||||
orderPartTypes: [],
|
funnelOrderPartTypes: [],
|
||||||
hasRecalibrationPart: false,
|
funnelHasRecalibrationPart: false,
|
||||||
selectedMultiGlass: false,
|
funnelSelectedMultiGlass: false,
|
||||||
selectedWindshieldGlass: false,
|
funnelSelectedWindshieldGlass: false,
|
||||||
selectedBackGlass: false,
|
funnelSelectedBackGlass: false,
|
||||||
selectedDriverSideGlass: false,
|
funnelSelectedDriverSideGlass: false,
|
||||||
selectedPassengerSideGlass: false
|
funnelSelectedPassengerSideGlass: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1321,64 +1364,64 @@ describe("Getters", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeState = state;
|
const storeState = state;
|
||||||
const mockStateValues = {
|
const mockStateValues = {
|
||||||
vehicleYear: 1000,
|
funnelVehicleYear: 1000,
|
||||||
vehicleMake: "CarMake",
|
funnelVehicleMake: "CarMake",
|
||||||
vehicleModel: "CarModel",
|
funnelVehicleModel: "CarModel",
|
||||||
vehicleStyle: "SuperCoolStyle",
|
funnelVehicleStyle: "SuperCoolStyle",
|
||||||
isRepair: true,
|
funnelIsRepair: true,
|
||||||
numberOfChips: 9999999,
|
funnelNumberOfChips: 9999999,
|
||||||
carId: "Gibberish",
|
funnelCarId: "Gibberish",
|
||||||
serviceCity: "Columbus",
|
funnelServiceCity: "Columbus",
|
||||||
serviceState: "OH-IO",
|
funnelServiceState: "OH-IO",
|
||||||
serviceZipCode: 43215,
|
funnelServiceZipCode: 43215,
|
||||||
parentAccountNumber: "999999",
|
funnelParentAccountNumber: "999999",
|
||||||
isCoverageVerified: true,
|
funnelIsCoverageVerified: true,
|
||||||
glassParts: [],
|
funnelGlassParts: [],
|
||||||
otherParts: [],
|
funnelOtherParts: [],
|
||||||
glassToReplace: []
|
funnelGlassToReplace: []
|
||||||
}
|
}
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
mutations.updateYear(storeState, mockStateValues.vehicleYear);
|
mutations.updateYear(storeState, mockStateValues.funnelVehicleYear);
|
||||||
mutations.updateMake(storeState, mockStateValues.vehicleMake);
|
mutations.updateMake(storeState, mockStateValues.funnelVehicleMake);
|
||||||
mutations.updateModel(storeState, mockStateValues.vehicleModel);
|
mutations.updateModel(storeState, mockStateValues.funnelVehicleModel);
|
||||||
mutations.updateStyle(storeState, mockStateValues.vehicleStyle);
|
mutations.updateStyle(storeState, mockStateValues.funnelVehicleStyle);
|
||||||
mutations.updateIsRepair(storeState, mockStateValues.isRepair);
|
mutations.updateIsRepair(storeState, mockStateValues.funnelIsRepair);
|
||||||
mutations.updateNumberOfChips(storeState, mockStateValues.numberOfChips);
|
mutations.updateNumberOfChips(storeState, mockStateValues.funnelNumberOfChips);
|
||||||
mutations.updateCarId(storeState, mockStateValues.carId);
|
mutations.updateCarId(storeState, mockStateValues.funnelCarId);
|
||||||
mutations.updateServiceLocation(storeState, {
|
mutations.updateServiceLocation(storeState, {
|
||||||
city: mockStateValues.serviceCity,
|
city: mockStateValues.funnelServiceCity,
|
||||||
state: mockStateValues.serviceState,
|
state: mockStateValues.funnelServiceState,
|
||||||
zipCode: mockStateValues.serviceZipCode
|
zipCode: mockStateValues.funnelServiceZipCode
|
||||||
});
|
});
|
||||||
mutations.updateParentAcctNumber(storeState, mockStateValues.parentAccountNumber);
|
mutations.updateParentAcctNumber(storeState, mockStateValues.funnelParentAccountNumber);
|
||||||
mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.isCoverageVerified);
|
mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.funnelIsCoverageVerified);
|
||||||
mutations.updateGlassParts(storeState, mockStateValues.glassParts);
|
mutations.updateGlassParts(storeState, mockStateValues.funnelGlassParts);
|
||||||
mutations.updateOtherParts(storeState, mockStateValues.otherParts);
|
mutations.updateOtherParts(storeState, mockStateValues.funnelOtherParts);
|
||||||
mutations.updateGlassToReplace(storeState, mockStateValues.glassToReplace);
|
mutations.updateGlassToReplace(storeState, mockStateValues.funnelGlassToReplace);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(getters.experimentOrder(storeState)).toEqual({
|
expect(getters.experimentOrder(storeState)).toEqual({
|
||||||
vehicleYear: mockStateValues.vehicleYear,
|
funnelVehicleYear: mockStateValues.funnelVehicleYear,
|
||||||
vehicleMake: mockStateValues.vehicleMake,
|
funnelVehicleMake: mockStateValues.funnelVehicleMake,
|
||||||
vehicleModel: mockStateValues.vehicleModel,
|
funnelVehicleModel: mockStateValues.funnelVehicleModel,
|
||||||
vehicleStyle: mockStateValues.vehicleStyle,
|
funnelVehicleStyle: mockStateValues.funnelVehicleStyle,
|
||||||
isRepair: mockStateValues.isRepair,
|
funnelIsRepair: mockStateValues.funnelIsRepair,
|
||||||
numberOfChips: mockStateValues.numberOfChips,
|
funnelNumberOfChips: mockStateValues.funnelNumberOfChips,
|
||||||
carId: mockStateValues.carId,
|
funnelCarId: mockStateValues.funnelCarId,
|
||||||
serviceCity: mockStateValues.serviceCity,
|
funnelServiceCity: mockStateValues.funnelServiceCity,
|
||||||
serviceState: mockStateValues.serviceState,
|
funnelServiceState: mockStateValues.funnelServiceState,
|
||||||
serviceZipCode: mockStateValues.serviceZipCode,
|
funnelServiceZipCode: mockStateValues.funnelServiceZipCode,
|
||||||
parentAccountNumber: mockStateValues.parentAccountNumber,
|
funnelParentAccountNumber: mockStateValues.funnelParentAccountNumber,
|
||||||
isCoverageVerified: mockStateValues.isCoverageVerified,
|
funnelIsCoverageVerified: mockStateValues.funnelIsCoverageVerified,
|
||||||
orderPartNumbers: [],
|
funnelOrderPartNumbers: [],
|
||||||
orderPartTypes: [],
|
funnelOrderPartTypes: [],
|
||||||
hasRecalibrationPart: false,
|
funnelHasRecalibrationPart: false,
|
||||||
selectedMultiGlass: false,
|
funnelSelectedMultiGlass: false,
|
||||||
selectedWindshieldGlass: false,
|
funnelSelectedWindshieldGlass: false,
|
||||||
selectedBackGlass: false,
|
funnelSelectedBackGlass: false,
|
||||||
selectedDriverSideGlass: false,
|
funnelSelectedDriverSideGlass: false,
|
||||||
selectedPassengerSideGlass: false
|
funnelSelectedPassengerSideGlass: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1439,26 +1482,26 @@ describe("Getters", () => {
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(getters.experimentOrder(storeState)).toEqual({
|
expect(getters.experimentOrder(storeState)).toEqual({
|
||||||
vehicleYear: mockStateValues.vehicleYear,
|
funnelVehicleYear: mockStateValues.vehicleYear,
|
||||||
vehicleMake: mockStateValues.vehicleMake,
|
funnelVehicleMake: mockStateValues.vehicleMake,
|
||||||
vehicleModel: mockStateValues.vehicleModel,
|
funnelVehicleModel: mockStateValues.vehicleModel,
|
||||||
vehicleStyle: mockStateValues.vehicleStyle,
|
funnelVehicleStyle: mockStateValues.vehicleStyle,
|
||||||
isRepair: mockStateValues.isRepair,
|
funnelIsRepair: mockStateValues.isRepair,
|
||||||
numberOfChips: mockStateValues.numberOfChips,
|
funnelNumberOfChips: mockStateValues.numberOfChips,
|
||||||
carId: mockStateValues.carId,
|
funnelCarId: mockStateValues.carId,
|
||||||
serviceCity: mockStateValues.serviceCity,
|
funnelServiceCity: mockStateValues.serviceCity,
|
||||||
serviceState: mockStateValues.serviceState,
|
funnelServiceState: mockStateValues.serviceState,
|
||||||
serviceZipCode: mockStateValues.serviceZipCode,
|
funnelServiceZipCode: mockStateValues.serviceZipCode,
|
||||||
parentAccountNumber: mockStateValues.parentAccountNumber,
|
funnelParentAccountNumber: mockStateValues.parentAccountNumber,
|
||||||
isCoverageVerified: mockStateValues.isCoverageVerified,
|
funnelIsCoverageVerified: mockStateValues.isCoverageVerified,
|
||||||
orderPartNumbers: ["WINDSHIELDPARTNUMBER"],
|
funnelOrderPartNumbers: ["WINDSHIELDPARTNUMBER"],
|
||||||
orderPartTypes: ["ADAS, maybe"],
|
funnelOrderPartTypes: ["ADAS, maybe"],
|
||||||
hasRecalibrationPart: true,
|
funnelHasRecalibrationPart: true,
|
||||||
selectedMultiGlass: false,
|
funnelSelectedMultiGlass: false,
|
||||||
selectedWindshieldGlass: true,
|
funnelSelectedWindshieldGlass: true,
|
||||||
selectedBackGlass: false,
|
funnelSelectedBackGlass: false,
|
||||||
selectedDriverSideGlass: false,
|
funnelSelectedDriverSideGlass: false,
|
||||||
selectedPassengerSideGlass: false
|
funnelSelectedPassengerSideGlass: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1545,26 +1588,26 @@ describe("Getters", () => {
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(getters.experimentOrder(storeState)).toEqual({
|
expect(getters.experimentOrder(storeState)).toEqual({
|
||||||
vehicleYear: mockStateValues.vehicleYear,
|
funnelVehicleYear: mockStateValues.vehicleYear,
|
||||||
vehicleMake: mockStateValues.vehicleMake,
|
funnelVehicleMake: mockStateValues.vehicleMake,
|
||||||
vehicleModel: mockStateValues.vehicleModel,
|
funnelVehicleModel: mockStateValues.vehicleModel,
|
||||||
vehicleStyle: mockStateValues.vehicleStyle,
|
funnelVehicleStyle: mockStateValues.vehicleStyle,
|
||||||
isRepair: mockStateValues.isRepair,
|
funnelIsRepair: mockStateValues.isRepair,
|
||||||
numberOfChips: mockStateValues.numberOfChips,
|
funnelNumberOfChips: mockStateValues.numberOfChips,
|
||||||
carId: mockStateValues.carId,
|
funnelCarId: mockStateValues.carId,
|
||||||
serviceCity: mockStateValues.serviceCity,
|
funnelServiceCity: mockStateValues.serviceCity,
|
||||||
serviceState: mockStateValues.serviceState,
|
funnelServiceState: mockStateValues.serviceState,
|
||||||
serviceZipCode: mockStateValues.serviceZipCode,
|
funnelServiceZipCode: mockStateValues.serviceZipCode,
|
||||||
parentAccountNumber: mockStateValues.parentAccountNumber,
|
funnelParentAccountNumber: mockStateValues.parentAccountNumber,
|
||||||
isCoverageVerified: mockStateValues.isCoverageVerified,
|
funnelIsCoverageVerified: mockStateValues.isCoverageVerified,
|
||||||
orderPartNumbers: ["BACKGLASS_PN", "DRIVERGLASS_PN", "PASSENGERGLASS_PN"],
|
funnelOrderPartNumbers: ["BACKGLASS_PN", "DRIVERGLASS_PN", "PASSENGERGLASS_PN"],
|
||||||
orderPartTypes: [],
|
funnelOrderPartTypes: [],
|
||||||
hasRecalibrationPart: false,
|
funnelHasRecalibrationPart: false,
|
||||||
selectedMultiGlass: true,
|
funnelSelectedMultiGlass: true,
|
||||||
selectedWindshieldGlass: false,
|
funnelSelectedWindshieldGlass: false,
|
||||||
selectedBackGlass: true,
|
funnelSelectedBackGlass: true,
|
||||||
selectedDriverSideGlass: true,
|
funnelSelectedDriverSideGlass: true,
|
||||||
selectedPassengerSideGlass: true
|
funnelSelectedPassengerSideGlass: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -64,4 +64,4 @@ caption,
|
||||||
font-size: 1rem !important;
|
font-size: 1rem !important;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue