Przeglądaj źródła

:wrench: WIP entire onboarding flow. working step through, still missing input forms+correct step structure+styles

tags/0.0.1^2
juancarbajal98 3 lat temu
rodzic
commit
dc57ab5ca0

+ 4
- 4
frontend/src/router/index.js Wyświetl plik

@@ -6,7 +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 QuestionnaireView from '../views/QuestionnaireView.vue'
9
+import OnboardingView from '../views/OnboardingView.vue'
10 10
 
11 11
 const routes = [
12 12
     {
@@ -48,9 +48,9 @@ const routes = [
48 48
         meta: { requiresAuth: true, requiresCompleteProfile: false },
49 49
     },
50 50
     {
51
-        path: `/questionnaire`,
52
-        component: QuestionnaireView,
53
-        name: `QuestionnaireView`,
51
+        path: `/onboarding`,
52
+        component: OnboardingView,
53
+        name: `OnboardingView`,
54 54
         meta: { requiresAuth: true, requiresCompleteProfile: false },
55 55
     },
56 56
     {

+ 12
- 6
frontend/src/utils/aspects.js Wyświetl plik

@@ -1,26 +1,32 @@
1 1
 const Aspects = [
2 2
     {
3
-        question: 'While operating in your professional role, do you identify yourself to be a Visionary or Implementer?',
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?',
4 5
         answers: ['Visionary', 'Implementer']
5 6
     },
6 7
     {
7
-        question: 'As a professional, do you consider yourself to be Creative or Methodical in your execution of job duties?',
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?',
8 10
         answers: ['Creative', 'Methodical']
9 11
     },
10 12
     {
11
-        question: 'Do you prefer to work in a Collaborative or Independent environment?',
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?',
12 15
         answers: ['Collaborative', 'Independent']
13 16
     },
14 17
     {
15
-        question: 'Are you Innovative or Convetional?',
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?',
16 20
         answers: ['Innovative', 'Conventional']
17 21
     },
18 22
     {
19
-        question: 'As a professional, are you a Big Picture thinker or Focused thinker when it comes to how you operate in your job duties?',
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?',
20 25
         answers: ['Big Picture', 'Focused']
21 26
     },
22 27
     {
23
-        question: 'While working on job related tasks, do you prefer to be Guided or Self-managed in achieveing completion of your responsibilities?',
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?',
24 30
         answers: ['Guided', 'Self-managed']
25 31
     },
26 32
 ]

+ 133
- 0
frontend/src/views/OnboardingView.vue Wyświetl plik

@@ -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>

+ 0
- 73
frontend/src/views/QuestionnaireView.vue Wyświetl plik

@@ -1,73 +0,0 @@
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>

Ładowanie…
Anuluj
Zapisz