Przeglądaj źródła

Merge branch 'more-skeleton' of ssh://gitea.yvvas.com:4022/fyindr/siimee into more-skeleton

tags/0.0.1^2
J 3 lat temu
rodzic
commit
24a3a22de2

+ 12
- 12
backend/db/data-generator/mock.js Wyświetl plik

@@ -93,43 +93,43 @@ module.exports = {
93 93
     response_keys: [
94 94
         {
95 95
             response_key_id: 1,
96
-            response_key_category: 'grit',
97
-            response_key_prompt: 'can you power through adversity',
96
+            response_key_category: 'visionary_vs_implementer',
97
+            response_key_prompt: 'While managing your team, do you find success in your employees being more Visionary or Implementer?',
98 98
             response_key_description: 'first round draft scoring question',
99 99
         },
100 100
         {
101 101
             response_key_id: 2,
102
-            response_key_category: 'openness',
102
+            response_key_category: 'creative_vs_methodical',
103 103
             response_key_prompt:
104
-                'are you open with your emotions with everyone',
104
+                'In your department, do you find more success in your employees being Creative or Methodical in their job duties?',
105 105
             response_key_description: 'first round draft scoring question',
106 106
         },
107 107
         {
108 108
             response_key_id: 3,
109
-            response_key_category: 'bravery',
109
+            response_key_category: 'collaborative_vs_independent',
110 110
             response_key_prompt:
111
-                'do you speak-up when you feel something is wrong',
111
+                'Do you structure and encourage your team to be a Collaborative or Independent environment?',
112 112
             response_key_description: 'first round draft scoring question',
113 113
         },
114 114
         {
115 115
             response_key_id: 4,
116
-            response_key_category: 'empathy',
116
+            response_key_category: 'innovative_vs_conventional',
117 117
             response_key_prompt:
118
-                'do you stop to help others when they are struggling',
118
+                'Do you find higher success in employees on your team that are Innovative or Conventional?',
119 119
             response_key_description: 'first round draft scoring question',
120 120
         },
121 121
         {
122 122
             response_key_id: 5,
123
-            response_key_category: 'honesty',
123
+            response_key_category: 'big_Picture_vs_focused',
124 124
             response_key_prompt:
125
-                'when telling a story do you exaggerate for dramatic effect',
125
+                'As a hiring leader, are you a Big Picture or Focused thinker when it comes to how you operate in your job duties?',
126 126
             response_key_description: 'first round draft scoring question',
127 127
         },
128 128
         {
129 129
             response_key_id: 6,
130
-            response_key_category: 'respect',
130
+            response_key_category: 'guided_vs_self-managed',
131 131
             response_key_prompt:
132
-                'do you treat difficult people as well as you treat your close friends',
132
+                'Do you prefer your employees to be Guided or Self-managed in achieving completion of their responsibilities?',
133 133
             response_key_description: 'first round draft scoring question',
134 134
         },
135 135
         {

+ 1466
- 208
frontend/package-lock.json
Plik diff jest za duży
Wyświetl plik


+ 1
- 0
frontend/src/utils/aspects.js Wyświetl plik

@@ -1,3 +1,4 @@
1
+/* Only keeping until fully migrated to backend table. Will be deleted soon. */
1 2
 const Aspects = [
2 3
     {
3 4
         employer_question: 'While managing your team, do you find success in your employees being more Visionary or Implementer?',

+ 109
- 85
frontend/src/views/OnboardingView.vue Wyświetl plik

@@ -1,94 +1,101 @@
1 1
 <template lang="pug">
2
+article
3
+    form(@submit.prevent="onSubmit")
4
+        .questionnaire
5
+            .question(
6
+                v-for="q in questionnaireQuestions"
7
+            )
8
+                label {{q.question}}
9
+                .question--response
10
+                    .question--answers 
11
+                        h3 {{q.answers[0].charAt(0).toUpperCase() + q.answers[0].slice(1)}}
12
+                        h3 {{q.answers[1].charAt(0).toUpperCase() + q.answers[1].slice(1)}}
13
+                    .question--radio-buttons
14
+                        input(type='radio' :id="'q'+(q.id)+'_a1'" :name="'q'+(q.id)" value="a1" v-model="questionnaireAnswers[q.id-1]") 
15
+                        input(type='radio' :id="'q'+(q.id)+'_a2'" :name="'q'+(q.id)" value="a2" v-model="questionnaireAnswers[q.id-1]") 
16
+                        input(type='radio' :id="'q'+(q.id)+'_a3'" :name="'q'+(q.id)" value="a3" v-model="questionnaireAnswers[q.id-1]") 
17
+                        input(type='radio' :id="'q'+(q.id)+'_a4'" :name="'q'+(q.id)" value="a4" v-model="questionnaireAnswers[q.id-1]") 
18
+                        input(type='radio' :id="'q'+(q.id)+'_a5'" :name="'q'+(q.id)" value="a5" v-model="questionnaireAnswers[q.id-1]") 
19
+        br
20
+        w-flex
21
+            w-button.ma1.grow(type="submit" bg-color="success")
22
+                w-icon.mr1 wi-check
23
+                | SUBMIT ANSWERS
24
+//- br
25
+//- h3 Current Step: {{currentStep}}
26
+//- br
27
+//- ul
28
+//-     li(v-for="question in onboardingStep")
29
+//-         p {{question}}
30
+//- br
31
+//- button(@click="goToStep(currentStep - 1)") previous
32
+//- br
33
+//- button(@click="goToStep(currentStep + 1)") next
2 34
 //- br
3 35
 //- br
4
-//- article
5
-//-     form(@submit.prevent="onSubmit")
6
-//-         .aspects
7
-//-             .aspect(
8
-//-                 v-for="(aspect, i) in aspects"
9
-//-             )
10
-//-                 label {{aspect.seeker_question}}
11
-//-                 //- label {{aspect.employer_question}}
12
-//-                 br
13
-//-                 br
14
-//-                 .aspect--response
15
-//-                     .aspect--answers
16
-//-                         h3 {{aspect.answers[0]}}
17
-//-                         h3 {{aspect.answers[1]}}
18
-//-                     .aspect--radio-buttons
19
-//-                         input(type="radio" :id="'q'+(i+1)+'_a1'"  :name="'q'+(i+1)" value="a1" v-model="questionnaireAnswers[i]")
20
-//-                         input(type="radio" :id="'q'+(i+1)+'_a2'"  :name="'q'+(i+1)" value="a2" v-model="questionnaireAnswers[i]")
21
-//-                         input(type="radio" :id="'q'+(i+1)+'_a3'"  :name="'q'+(i+1)" value="a3" v-model="questionnaireAnswers[i]")
22
-//-                         input(type="radio" :id="'q'+(i+1)+'_a4'"  :name="'q'+(i+1)" value="a4" v-model="questionnaireAnswers[i]")
23
-//-                         input(type="radio" :id="'q'+(i+1)+'_a5'"  :name="'q'+(i+1)" value="a5" v-model="questionnaireAnswers[i]")
24
-//-                 br
25
-//-                 br
26
-//-         br
27
-//-         w-flex
28
-//-             w-button.ma1.grow(type="submit" bg-color="success")
29
-//-                 w-icon.mr1 wi-check
30
-//-                 | SUBMIT ANSWERS
31
-br
32
-h3 Current Step: {{currentStep}}
33
-br
34
-ul
35
-    li(v-for="question in onboardingStep")
36
-        p {{question}}
37
-br
38
-button(@click="goToStep(currentStep - 1)") previous
39
-br
40
-button(@click="goToStep(currentStep + 1)") next
41 36
 </template>
42 37
 <script>    
43
-import aspects from '../utils/aspects'
44 38
 import { surveyFactory } from '@/utils'
45 39
 import { allSteps, possible } from '@/utils/lang'
46 40
 
47 41
 
48 42
 export default {
49 43
     name:'OnboardingView',
50
-    props: {
51
-        pid: {
52
-            type: Number,
53
-            default: () => 45,
54
-        },
55
-    },
56 44
     data: () => {
57
-        let num_of_ans = aspects.length // need 1 answer for every aspect question
58 45
         return {
59
-            onboardingQuestions: [],
60
-            currentStep: 0,
61
-            onboardingAnswers: [],
46
+            // onboardingQuestions: [],
47
+            // currentStep: 0,
48
+            // onboardingAnswers: [],
62 49
             validSurvey: null,
63
-            questionnaireAnswers: Array(num_of_ans).join(".").split(".") 
50
+            questionnaireQuestions:[],
51
+            questionnaireAnswers: Array(6).join(".").split(".") 
64 52
         }
65 53
     },
66 54
     computed:{
67
-        aspects() { 
68
-            return aspects
69
-        },
70
-        onboardingStep(){
71
-            if(!this.onboardingQuestions.length) return []
72
-            return this.onboardingQuestions[this.currentStep]
73
-        }
55
+        // onboardingStep(){
56
+        //     if(!this.onboardingQuestions.length) return []
57
+        //     return this.onboardingQuestions[this.currentStep]
58
+        // },
59
+        // questionnaireAnswers(){
60
+        //     let num_of_ans = 6 // TODO make dynamic once we know which questions we will be asking
61
+        //     return Array(num_of_ans).join(".").split(".") 
62
+        // }
74 63
     },
75 64
     async created(){
76 65
         this.validSurvey = await surveyFactory.createSurvey(
77 66
             allSteps['usa'],
78 67
             possible['usa']['roles'],
79 68
         )
80
-        var step = []
81
-        var fooSteps = [...this.validSurvey.steps]
82
-        while(fooSteps.length > (this.validSurvey.steps.length % 3)){
83
-            var q = fooSteps.shift()
84
-            step.push(q)
85
-            if(step.length == 3){
86
-                this.onboardingQuestions.push(step)
87
-                step = []
69
+        // gather questionnaire questions
70
+        this.validSurvey.steps.forEach(q => {
71
+            if(q.response_key_id  && q.response_key_id  < 7) {
72
+                let id = q.response_key_id
73
+                let question = q.response_key_prompt
74
+                let answers = q.response_key_category.split('_vs_')
75
+                answers.forEach((a,i) => {
76
+                    if(a.indexOf('_') !== -1){
77
+                        answers[i] = a.split('_').join(' ')
78
+                    }
79
+                })
80
+                this.questionnaireQuestions.push({
81
+                    id,
82
+                    question,
83
+                    answers
84
+                })
88 85
             }
89
-        }
90
-        var last_step = [...fooSteps]
91
-        this.onboardingQuestions.push(last_step)
86
+        })
87
+        // var step = []
88
+        // var fooSteps = [...this.validSurvey.steps]
89
+        // while(fooSteps.length > (this.validSurvey.steps.length % 3)){
90
+        //     var q = fooSteps.shift()
91
+        //     step.push(q)
92
+        //     if(step.length == 3){
93
+        //         this.onboardingQuestions.push(step)
94
+        //         step = []
95
+        //     }
96
+        // }
97
+        // var last_step = [...fooSteps]
98
+        // this.onboardingQuestions.push(last_step)
92 99
     },
93 100
     methods: {
94 101
         onSubmit() {
@@ -96,38 +103,55 @@ export default {
96 103
                 console.log(`Question ${ind+1} was ${ans==''? 'left blank.' : `answered ${ans}`}`)
97 104
             })
98 105
         },
99
-        goToStep(num){
100
-            if(num < 0){
101
-                this.currentStep = this.onboardingQuestions.length-1
102
-            }
103
-            else if(num >= this.onboardingQuestions.length) {
104
-                this.currentStep = 0
105
-            }
106
-            else 
107
-                this.currentStep = num
108
-        },
106
+        // goToStep(num){
107
+        //     if(num < 0){
108
+        //         this.currentStep = this.onboardingQuestions.length-1
109
+        //     }
110
+        //     else if(num >= this.onboardingQuestions.length) {
111
+        //         this.currentStep = 0
112
+        //     }
113
+        //     else 
114
+        //         this.currentStep = num
115
+        // },
109 116
     },
110 117
 }
111 118
 </script>
112 119
 <style>
113
-.aspects{
120
+body{
121
+    background-color: #1F2024;
122
+}
123
+article{
124
+    color: #FFFFFF;
125
+}
126
+.questionnaire{
114 127
     display: flex;
115 128
     flex-direction:column;
116 129
 }
117
-.aspect--response{
118
-    display: flex;
119
-    flex-direction: column;
130
+.question{
131
+    margin-top: 44px;
132
+}
133
+.question > label{
134
+    font-size: 18px; 
135
+    line-height: 23px;
120 136
 }
121
-.aspect--answers{
137
+.question--response{
138
+    margin-top: 22px;
139
+    margin-inline: 19px;
140
+}
141
+.question--answers{
122 142
     display: flex;
123 143
     flex-direction: row;
124 144
     justify-content: space-between;
125 145
 }
126
-.aspect--radio-buttons{
127
-    width: 90%;
128
-    margin: auto;
146
+.question--radio-buttons{
147
+    padding: 0 25px;
148
+    margin: 16px auto auto auto;
129 149
     display: flex;
130 150
     flex-direction: row;
131 151
     justify-content: space-between;
132 152
 }
153
+.question--radio-buttons > input {
154
+    width: 24px;
155
+    height: 24px;
156
+}
133 157
 </style>

Ładowanie…
Anuluj
Zapisz