Merge pull request #740 from Safelite/feature/CSR-803-refactoring-2
Feature/CSR-803 refactoring 2
This commit is contained in:
commit
275fa72735
5 changed files with 5 additions and 11 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
:class="(q.questionSequence === currentQuestionNum) && 'current-question'"
|
:class="(q.questionSequence === currentQuestionNum) && 'current-question'"
|
||||||
:questionText="q.questionText"
|
:questionText="q.questionText"
|
||||||
:answers="q.answers"
|
:answers="q.answers"
|
||||||
:groupName="`${keyString}-${q.questionSequence}`"
|
:groupName="`question-${glassIndex}-${q.questionSequence}`"
|
||||||
v-model="q.answerSelected"
|
v-model="q.answerSelected"
|
||||||
@isCheckedChanged="handleAnswer"
|
@isCheckedChanged="handleAnswer"
|
||||||
isRequired
|
isRequired
|
||||||
|
|
@ -34,19 +34,16 @@ export default {
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
modelValue: Array,
|
modelValue: Array,
|
||||||
glassIndex: Number,
|
glassIndex: Number,
|
||||||
keyString: String,
|
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
// validate form upon create to prevent out of sync / persistent valid states
|
// do a test validation check upon create to prevent out of sync / incorrect valid states
|
||||||
await useValidateForm(); // do a test validation check, without triggering full validation
|
await useValidateForm(); // NOTE: needs to have async/await here; tested and won't work without it
|
||||||
|
|
||||||
this.questionData.map((q, i) => {
|
this.questionData.map((q, i) => {
|
||||||
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);
|
|
||||||
return {
|
return {
|
||||||
Text: a.answerText,
|
Text: a.answerText,
|
||||||
// Name will either be nextQuestionSequence or answerResult
|
// Name will either be nextQuestionSequence or answerResult
|
||||||
|
|
@ -65,7 +62,6 @@ export default {
|
||||||
}),
|
}),
|
||||||
answerSelected: q.answerSelected || "",
|
answerSelected: q.answerSelected || "",
|
||||||
};
|
};
|
||||||
question.answerPair = answerPair;
|
|
||||||
if (!q.suppressQuestion) {
|
if (!q.suppressQuestion) {
|
||||||
this.questions.push(question);
|
this.questions.push(question);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
:manualHeadline="AlertFewMoreQuestionsHeader" :manualCopy="AlertFewMoreQuestionsCopy"
|
:manualHeadline="AlertFewMoreQuestionsHeader" :manualCopy="AlertFewMoreQuestionsCopy"
|
||||||
v-bind:isDismissible="false" />
|
v-bind:isDismissible="false" />
|
||||||
<div v-for="(glass, i) in capabilityQuestionsData" :key="glass.key">
|
<div v-for="(glass, i) in capabilityQuestionsData" :key="glass.key">
|
||||||
<questionChain ref="questionChain" :keyString="glass.key"
|
<questionChain ref="questionChain"
|
||||||
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
||||||
:questionData="glass.capabilityQuestions" :glassIndex="i"
|
:questionData="glass.capabilityQuestions" :glassIndex="i"
|
||||||
v-if="showThisQuestionChain(glass, i)"
|
v-if="showThisQuestionChain(glass, i)"
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
<div v-for="(glass, i) in moldingQuestionsData" :key="glass.key">
|
<div v-for="(glass, i) in moldingQuestionsData" :key="glass.key">
|
||||||
<questionChain
|
<questionChain
|
||||||
ref="questionChain"
|
ref="questionChain"
|
||||||
:keyString="glass.key"
|
|
||||||
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
||||||
:questionData="glass.questions"
|
:questionData="glass.questions"
|
||||||
:glassIndex="i"
|
:glassIndex="i"
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
<div v-for="(glass, i) in partsQuestionsData" :key="glass.key">
|
<div v-for="(glass, i) in partsQuestionsData" :key="glass.key">
|
||||||
<questionChain
|
<questionChain
|
||||||
ref="questionChain"
|
ref="questionChain"
|
||||||
:keyString="glass.key"
|
|
||||||
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
|
||||||
:questionData="glass.questions"
|
:questionData="glass.questions"
|
||||||
:glassIndex="i"
|
:glassIndex="i"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export default {
|
||||||
if (!store.getters.applicationUser.savedSessionId) {
|
if (!store.getters.applicationUser.savedSessionId) {
|
||||||
saveOrder();
|
saveOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS);
|
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS);
|
||||||
const partsOrQuestions = result.data.partsOrQuestions;
|
const partsOrQuestions = result.data.partsOrQuestions;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue