Просмотр исходного кода

Merge branch 'questionnaire-endpoint' of fyindr/siimee into dev

tags/0.0.1^2
maeda 3 лет назад
Родитель
Сommit
dc3c325303
3 измененных файлов: 174 добавлений и 0 удалений
  1. 7
    0
      frontend/src/router/index.js
  2. 34
    0
      frontend/src/utils/aspects.js
  3. 133
    0
      frontend/src/views/OnboardingView.vue

+ 7
- 0
frontend/src/router/index.js Просмотреть файл

@@ -6,6 +6,7 @@ import ChatView from '../views/ChatView.vue'
6 6
 import MatchesView from '../views/MatchesView.vue'
7 7
 import LoginView from '../views/LoginView.vue'
8 8
 import SurveyView from '../views/SurveyView.vue'
9
+import OnboardingView from '../views/OnboardingView.vue'
9 10
 
10 11
 const routes = [
11 12
     {
@@ -46,6 +47,12 @@ const routes = [
46 47
         name: `SurveyView`,
47 48
         meta: { requiresAuth: true, requiresCompleteProfile: false },
48 49
     },
50
+    {
51
+        path: `/onboarding`,
52
+        component: OnboardingView,
53
+        name: `OnboardingView`,
54
+        meta: { requiresAuth: true, requiresCompleteProfile: false },
55
+    },
49 56
     {
50 57
         path: `/login`,
51 58
         component: LoginView,

+ 34
- 0
frontend/src/utils/aspects.js Просмотреть файл

@@ -0,0 +1,34 @@
1
+const Aspects = [
2
+    {
3
+        employer_question: 'While managing your team, do you find success in your employees being more Visionary or Implementer?',
4
+        seeker_question: 'While operating in your professional role, do you identify yourself to be a Visionary or Implementer?',
5
+        answers: ['Visionary', 'Implementer']
6
+    },
7
+    {
8
+        employer_question: 'In your department, do you find more success in your employees being Creative or Methodical in their job duties?',
9
+        seeker_question: 'As a professional, do you consider yourself to be Creative or Methodical in your execution of job duties?',
10
+        answers: ['Creative', 'Methodical']
11
+    },
12
+    {
13
+        employer_question: 'Do you structure and encourage your team to be a Collaborative or Independent environment?',
14
+        seeker_question: 'Do you prefer to work in a Collaborative or Independent environment?',
15
+        answers: ['Collaborative', 'Independent']
16
+    },
17
+    {
18
+        employer_question: 'Do you find higher success in employees on your team that are Innovative or Conventional?',
19
+        seeker_question: 'Are you Innovative or Convetional?',
20
+        answers: ['Innovative', 'Conventional']
21
+    },
22
+    {
23
+        employer_question: 'As a hiring leader, are you a Big Picture or Focused thinker when it comes to how you operate in your job duties?',
24
+        seeker_question: 'As a professional, are you a Big Picture thinker or Focused thinker when it comes to how you operate in your job duties?',
25
+        answers: ['Big Picture', 'Focused']
26
+    },
27
+    {
28
+        employer_question: 'Do you prefer your employees to be Guided or Self-managed in achieving completion of their responsibilities?',
29
+        seeker_question: 'While working on job related tasks, do you prefer to be Guided or Self-managed in achieveing completion of your responsibilities?',
30
+        answers: ['Guided', 'Self-managed']
31
+    },
32
+]
33
+
34
+export default Aspects

+ 133
- 0
frontend/src/views/OnboardingView.vue Просмотреть файл

@@ -0,0 +1,133 @@
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.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
+</template>
42
+<script>    
43
+import aspects from '../utils/aspects'
44
+import { surveyFactory } from '@/utils'
45
+import { allSteps, possible } from '@/utils/lang'
46
+
47
+
48
+export default {
49
+    name:'OnboardingView',
50
+    props: {
51
+        pid: {
52
+            type: Number,
53
+            default: () => 45,
54
+        },
55
+    },
56
+    data: () => {
57
+        let num_of_ans = aspects.length // need 1 answer for every aspect question
58
+        return {
59
+            onboardingQuestions: [],
60
+            currentStep: 0,
61
+            onboardingAnswers: [],
62
+            validSurvey: null,
63
+            questionnaireAnswers: Array(num_of_ans).join(".").split(".") 
64
+        }
65
+    },
66
+    computed:{
67
+        aspects() { 
68
+            return aspects
69
+        },
70
+        onboardingStep(){
71
+            if(!this.onboardingQuestions.length) return []
72
+            return this.onboardingQuestions[this.currentStep]
73
+        }
74
+    },
75
+    async created(){
76
+        this.validSurvey = await surveyFactory.createSurvey(
77
+            allSteps['usa'],
78
+            possible['usa']['roles'],
79
+        )
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 = []
88
+            }
89
+        }
90
+        var last_step = [...fooSteps]
91
+        this.onboardingQuestions.push(last_step)
92
+    },
93
+    methods: {
94
+        onSubmit() {
95
+            this.questionnaireAnswers.forEach((ans,ind)=>{
96
+                console.log(`Question ${ind+1} was ${ans==''? 'left blank.' : `answered ${ans}`}`)
97
+            })
98
+        },
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
+        },
109
+    },
110
+}
111
+</script>
112
+<style>
113
+.aspects{
114
+    display: flex;
115
+    flex-direction:column;
116
+}
117
+.aspect--response{
118
+    display: flex;
119
+    flex-direction: column;
120
+}
121
+.aspect--answers{
122
+    display: flex;
123
+    flex-direction: row;
124
+    justify-content: space-between;
125
+}
126
+.aspect--radio-buttons{
127
+    width: 90%;
128
+    margin: auto;
129
+    display: flex;
130
+    flex-direction: row;
131
+    justify-content: space-between;
132
+}
133
+</style>

Загрузка…
Отмена
Сохранить