|
|
@@ -1,14 +1,12 @@
|
|
1
|
1
|
<template lang="pug">
|
|
2
|
|
-w-card.aspects.w-flex.column
|
|
3
|
|
- form.questionnaire(@submit.prevent='this.$emit("handle-submit")')
|
|
4
|
|
- QuestionResponse(
|
|
5
|
|
- :question='question'
|
|
6
|
|
- @updated='updateRadio'
|
|
7
|
|
- v-for='question in aspectQuestions'
|
|
8
|
|
- )
|
|
9
|
|
- w-button.ma1.grow(bg-color='success' type='submit')
|
|
10
|
|
- w-icon.mr1 wi-check
|
|
11
|
|
- | SUBMIT ANSWERS
|
|
|
2
|
+form.questionnaire(@submit.prevent='this.$emit("handle-submit")')
|
|
|
3
|
+p(v-for='question in aspectQuestions')
|
|
|
4
|
+ QuestionResponse(
|
|
|
5
|
+ :question='question'
|
|
|
6
|
+ @updated='updateRadio'
|
|
|
7
|
+ @updateIsAnswered='updateIsAnswered'
|
|
|
8
|
+ v-if='question.isBeingAnswered' @update-all='updateAll'
|
|
|
9
|
+ )
|
|
12
|
10
|
</template>
|
|
13
|
11
|
|
|
14
|
12
|
<script>
|
|
|
@@ -30,19 +28,32 @@ export default {
|
|
30
|
28
|
async created() {
|
|
31
|
29
|
this.aspectQuestions.forEach((q, i) => {
|
|
32
|
30
|
console.log(`Aspect #${i}: ${JSON.stringify(q)}`)
|
|
|
31
|
+ q.isBeingAnswered = i === 0 ? true : false
|
|
33
|
32
|
})
|
|
34
|
33
|
},
|
|
35
|
34
|
methods: {
|
|
|
35
|
+ updateAll() {
|
|
|
36
|
+ this.$emit('handle-submit')
|
|
|
37
|
+ },
|
|
36
|
38
|
updateRadio(onRadioSelect) {
|
|
37
|
39
|
answered[onRadioSelect.id - 1] = onRadioSelect.answer
|
|
38
|
40
|
this.$emit('update-answers', {
|
|
39
|
41
|
key: 'Aspects',
|
|
40
|
42
|
question: {
|
|
41
|
|
- survey_stage: 'aspects'
|
|
|
43
|
+ survey_stage: 'aspects',
|
|
42
|
44
|
},
|
|
43
|
45
|
input: answered,
|
|
44
|
46
|
})
|
|
45
|
47
|
},
|
|
|
48
|
+ updateIsAnswered(id) {
|
|
|
49
|
+ this.aspectQuestions.forEach((q, i) => {
|
|
|
50
|
+ if (i === id - 1) {
|
|
|
51
|
+ const nextQ = this.aspectQuestions[id]
|
|
|
52
|
+ q.isBeingAnswered = false
|
|
|
53
|
+ nextQ.isBeingAnswered = true
|
|
|
54
|
+ }
|
|
|
55
|
+ })
|
|
|
56
|
+ },
|
|
46
|
57
|
},
|
|
47
|
58
|
}
|
|
48
|
59
|
</script>
|