|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+<template lang="pug">
|
|
|
2
|
+br
|
|
|
3
|
+br
|
|
|
4
|
+article
|
|
|
5
|
+ form(@submit.prevent="onSubmit")
|
|
|
6
|
+ .aspects
|
|
|
7
|
+ .aspect(
|
|
|
8
|
+ v-for="(aspect, i) in aspects"
|
|
|
9
|
+ )
|
|
|
10
|
+ label {{aspect.question}}
|
|
|
11
|
+ br
|
|
|
12
|
+ br
|
|
|
13
|
+ .aspect--response
|
|
|
14
|
+ .aspect--answers
|
|
|
15
|
+ h3 {{aspect.answers[0]}}
|
|
|
16
|
+ h3 {{aspect.answers[1]}}
|
|
|
17
|
+ .aspect--radio-buttons
|
|
|
18
|
+ input(type="radio" :id="'q'+(i+1)+'_a1'" :name="'q'+(i+1)" value="a1" v-model="questionnaireAnswers[i]")
|
|
|
19
|
+ input(type="radio" :id="'q'+(i+1)+'_a2'" :name="'q'+(i+1)" value="a2" v-model="questionnaireAnswers[i]")
|
|
|
20
|
+ input(type="radio" :id="'q'+(i+1)+'_a3'" :name="'q'+(i+1)" value="a3" v-model="questionnaireAnswers[i]")
|
|
|
21
|
+ input(type="radio" :id="'q'+(i+1)+'_a4'" :name="'q'+(i+1)" value="a4" v-model="questionnaireAnswers[i]")
|
|
|
22
|
+ input(type="radio" :id="'q'+(i+1)+'_a5'" :name="'q'+(i+1)" value="a5" v-model="questionnaireAnswers[i]")
|
|
|
23
|
+ br
|
|
|
24
|
+ br
|
|
|
25
|
+ br
|
|
|
26
|
+ w-flex
|
|
|
27
|
+ w-button.ma1.grow(type="submit" bg-color="primary") Submit Rating
|
|
|
28
|
+</template>
|
|
|
29
|
+<script>
|
|
|
30
|
+import aspects from '../utils/aspects'
|
|
|
31
|
+
|
|
|
32
|
+export default {
|
|
|
33
|
+ name:'QuestionnaireView',
|
|
|
34
|
+ data: () => {
|
|
|
35
|
+ let num_of_ans = aspects.length // need 1 answer for every aspect question
|
|
|
36
|
+ return {
|
|
|
37
|
+ questionnaireAnswers: Array(num_of_ans).join(".").split(".")
|
|
|
38
|
+ }
|
|
|
39
|
+ },
|
|
|
40
|
+ computed:{
|
|
|
41
|
+ aspects() { return aspects }
|
|
|
42
|
+ },
|
|
|
43
|
+ methods: {
|
|
|
44
|
+ onSubmit() {
|
|
|
45
|
+ this.questionnaireAnswers.forEach((ans,ind)=>{
|
|
|
46
|
+ console.log(`Question ${ind+1} was ${ans==''? 'left blank.' : `answered ${ans}`}`)
|
|
|
47
|
+ })
|
|
|
48
|
+ }
|
|
|
49
|
+ },
|
|
|
50
|
+}
|
|
|
51
|
+</script>
|
|
|
52
|
+<style>
|
|
|
53
|
+.aspects{
|
|
|
54
|
+ display: flex;
|
|
|
55
|
+ flex-direction:column;
|
|
|
56
|
+}
|
|
|
57
|
+.aspect--response{
|
|
|
58
|
+ display: flex;
|
|
|
59
|
+ flex-direction: column;
|
|
|
60
|
+}
|
|
|
61
|
+.aspect--answers{
|
|
|
62
|
+ display: flex;
|
|
|
63
|
+ flex-direction: row;
|
|
|
64
|
+ justify-content: space-between;
|
|
|
65
|
+}
|
|
|
66
|
+.aspect--radio-buttons{
|
|
|
67
|
+ width: 90%;
|
|
|
68
|
+ margin: auto;
|
|
|
69
|
+ display: flex;
|
|
|
70
|
+ flex-direction: row;
|
|
|
71
|
+ justify-content: space-between;
|
|
|
72
|
+}
|
|
|
73
|
+</style>
|