Kaynağa Gözat

:wrench: onboarding component subfolder | overriding guards temporarily

tags/0.0.2
juancarbajal98 3 yıl önce
ebeveyn
işleme
d7aa9169da

+ 1
- 1
backend/db/seeds/04-responses.js Dosyayı Görüntüle

23
     for (let i = 1; i <= len; i += 1) {
23
     for (let i = 1; i <= len; i += 1) {
24
         responsesToPush.push(responses.shift())
24
         responsesToPush.push(responses.shift())
25
         if (i % batchSize === 0 || i > responses.length) {
25
         if (i % batchSize === 0 || i > responses.length) {
26
-            await knex('responses').insert(responsesToPush)
26
+            // await knex('responses').insert(responsesToPush)
27
             responsesToPush = []
27
             responsesToPush = []
28
         }
28
         }
29
     }
29
     }

+ 2
- 5
frontend/src/App.vue Dosyayı Görüntüle

6
         SideBar(@updatePid="setPid" :pid="profile.id.value")
6
         SideBar(@updatePid="setPid" :pid="profile.id.value")
7
         
7
         
8
     RouterView(
8
     RouterView(
9
-        v-if="profile.isLoggedIn"
10
-        :pid="profile.id.value"
11
         @updatePid="setPid"
9
         @updatePid="setPid"
12
-        @show-sidebar="showSidebar = !showSidebar"
13
     )
10
     )
14
 </template>
11
 </template>
15
 
12
 
21
 import { currentProfile } from './services'
18
 import { currentProfile } from './services'
22
 import { surveyFactory } from './utils'
19
 import { surveyFactory } from './utils'
23
 
20
 
24
-const DEV_MODE = import.meta.env.VITE_DEV == 'true'
25
-// const DEV_MODE = false
21
+// const DEV_MODE = import.meta.env.VITE_DEV == 'true'
22
+const DEV_MODE = false
26
 const DEV_PID = 45
23
 const DEV_PID = 45
27
 
24
 
28
 export default {
25
 export default {

+ 2
- 2
frontend/src/components/PairingButton.vue Dosyayı Görüntüle

1
 <template lang="pug">
1
 <template lang="pug">
2
 .pairing-button.w-flex.row
2
 .pairing-button.w-flex.row
3
     template(v-if='status == "pristine"')
3
     template(v-if='status == "pristine"')
4
-        w-button(:class='status')(@click='pass')
4
+        w-button(:class='status' @click='pass')
5
             p.pa4.text-upper pass
5
             p.pa4.text-upper pass
6
-        w-button(:class='status')(@click='pair')
6
+        w-button(:class='status' @click='pair')
7
             p.pa4.text-upper pair
7
             p.pa4.text-upper pair
8
     template(v-else-if='status == "pending"')
8
     template(v-else-if='status == "pending"')
9
         w-button(:class='status')
9
         w-button(:class='status')

+ 17
- 0
frontend/src/components/onboarding/AccountType.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+h3 {Name}, let's get started on your profile while we verify your account
3
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") CANDIDATES
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") JOBS
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'AccountType',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 28
- 0
frontend/src/components/onboarding/Aspects.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+form(@submit.prevent="this.$emit('handle-submit')").questionnaire
3
+    QuestionResponse(v-for="question in aspectQuestions" :question="question")
4
+    w-button.ma1.grow(type="submit" bg-color="success")
5
+        w-icon.mr1 wi-check
6
+        | SUBMIT ANSWERS
7
+</template>
8
+<script>
9
+import QuestionResponse from '../QuestionResponse.vue'
10
+
11
+export default {
12
+    name: 'Aspects',
13
+    components: {
14
+        QuestionResponse
15
+    },
16
+    props: {
17
+        aspectQuestions:{
18
+            required: true,
19
+            type: Array
20
+        },
21
+        currentStep:{
22
+            required: true,
23
+            type: Number,
24
+            default: 0
25
+        }
26
+    },
27
+}
28
+</script>

+ 19
- 0
frontend/src/components/onboarding/CompanyID.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+h3 Company ID
3
+p PLEASE ENTER YOUR COMPANY ID#:
4
+input(type="text" placeholder="Get this from your admin.")
5
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
6
+</template>
7
+<script>
8
+// todo add v-model to input, pass down answers array from parent
9
+export default {
10
+    name: 'CompanyID',
11
+    props: {
12
+        currentStep:{
13
+            required: true,
14
+            type: Number,
15
+            default: 0
16
+        }
17
+    },
18
+}
19
+</script>

+ 17
- 0
frontend/src/components/onboarding/Interests.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+h3 Interests
3
+p What are some interests you would like in your next candidates?
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'Interests',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 17
- 0
frontend/src/components/onboarding/LicensesAndCertifications.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+h3 Licenses & Certifications
3
+p Are there any licenses and certification requirements?
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'LicensesAndCertifications',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 17
- 0
frontend/src/components/onboarding/Location.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+h3 Location
3
+p Where would you like to select your candidates from?
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'Location',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 20
- 0
frontend/src/components/onboarding/Role.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+h3 ACTIVELY SEARCHING
3
+p What is your role at your company?
4
+w-select.mt4(
5
+    :items="[{label: 'RECRUITER'},{label: 'HIRING MANAGER'}]"
6
+    placeholder="i am")
7
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
8
+</template>
9
+<script>
10
+export default {
11
+    name: 'Role',
12
+    props: {
13
+        currentStep:{
14
+            required: true,
15
+            type: Number,
16
+            default: 0
17
+        }
18
+    },
19
+}
20
+</script>

+ 17
- 0
frontend/src/components/onboarding/Skills.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+h3 RECRUITER
3
+p What are some skills you are looking for at your company?
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'Skills',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 17
- 0
frontend/src/components/onboarding/Splash.vue Dosyayı Görüntüle

1
+<template lang="pug">
2
+.splash-icon(style="width:347px; height:347px; background-color: red;")
3
+div(style="text-align:center;")
4
+    w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") GET STARTED
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'Splash',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 21
- 0
frontend/src/components/onboarding/index.js Dosyayı Görüntüle

1
+import Splash from './Splash.vue'
2
+import AccountType from './AccountType.vue'
3
+import CompanyID from './CompanyID.vue'
4
+import Role from './Role.vue'
5
+import Skills from './Skills.vue'
6
+import Location from './Location.vue'
7
+import Interests from './Interests.vue'
8
+import LicensesAndCertifications from './LicensesAndCertifications.vue'
9
+import Aspects from './Aspects.vue'
10
+
11
+export default {
12
+    Splash,
13
+    AccountType,
14
+    CompanyID,
15
+    Role,
16
+    Skills,
17
+    Location,
18
+    Interests,
19
+    LicensesAndCertifications,
20
+    Aspects,
21
+}

+ 2
- 1
frontend/src/main.js Dosyayı Görüntüle

8
 import App from './App.vue'
8
 import App from './App.vue'
9
 import MainNav from './components/MainNav.vue'
9
 import MainNav from './components/MainNav.vue'
10
 
10
 
11
-const DEV = import.meta.env.VITE_DEV == 'true'
11
+// const DEV = import.meta.env.VITE_DEV == 'true'
12
+const DEV = false
12
 
13
 
13
 /**
14
 /**
14
  * Check between route changes for login/timeout
15
  * Check between route changes for login/timeout

+ 1
- 1
frontend/src/router/guards.js Dosyayı Görüntüle

10
         !currentProfile.isLoggedIn &&
10
         !currentProfile.isLoggedIn &&
11
         !currentProfile.isComplete 
11
         !currentProfile.isComplete 
12
     ) {
12
     ) {
13
-        nextCb('survey')
13
+        nextCb('onboarding')
14
     } else if(
14
     } else if(
15
         destination.meta.requiresCompleteProfile &&
15
         destination.meta.requiresCompleteProfile &&
16
         destination.meta.requiresAuth &&
16
         destination.meta.requiresAuth &&

+ 16
- 0
frontend/src/services/survey.service.js Dosyayı Görüntüle

32
     })
32
     })
33
 }
33
 }
34
 
34
 
35
+// const updateSurveyByProfileId = async (surveyResponses, profileId) => {
36
+//     surveyResponses.forEach(responseKeyIdwithVal => {
37
+//         const keyId = responseKeyIdwithVal.response_key_id
38
+//         const val = responseKeyIdwithVal.val
39
+//         // PATCH
40
+//         db.patch(`/profile/${profileId}/update/${keyId}`, [
41
+//             {
42
+//                 response_id: 2,
43
+//                 profile_id: profileId,
44
+//                 response_key_id: keyId,
45
+//                 val: val,
46
+//             },
47
+//         ])
48
+//     })
49
+// }
50
+
35
 const scoreSurveyByProfileId = async (profileId, maxDistance = 99) => {
51
 const scoreSurveyByProfileId = async (profileId, maxDistance = 99) => {
36
     const scoreSurvey = await db.get(
52
     const scoreSurvey = await db.get(
37
         `/profile/${profileId}/score?max_distance=${maxDistance}`,
53
         `/profile/${profileId}/score?max_distance=${maxDistance}`,

+ 39
- 0
frontend/src/utils/onboardingStepComponents.js Dosyayı Görüntüle

1
+const OnboardingStepComponents = [
2
+    {
3
+        id: 0,
4
+        component:'Splash',
5
+    },
6
+    {
7
+        id: 1,
8
+        component:'AccountType',
9
+    },
10
+    {
11
+        id: 2,
12
+        component:'CompanyID',
13
+    },
14
+    {
15
+        id: 3,
16
+        component:'Role',
17
+    },
18
+    {
19
+        id: 4,
20
+        component:'Skills',
21
+    },
22
+    {
23
+        id: 5,
24
+        component:'Location',
25
+    },
26
+    {
27
+        id: 6,
28
+        component:'Interests',
29
+    },
30
+    {
31
+        id: 7,
32
+        component:'LicensesAndCertifications',
33
+    },
34
+    {
35
+        id: 8,
36
+        component:'Aspects',
37
+    }
38
+]
39
+export default OnboardingStepComponents

+ 42
- 15
frontend/src/views/OnboardingView.vue Dosyayı Görüntüle

1
 <template lang="pug">
1
 <template lang="pug">
2
 main.view--onboarding
2
 main.view--onboarding
3
-    article
4
-        form(@submit.prevent="onSubmit").questionnaire
5
-            QuestionResponse(v-for="question in questions" :question="question" @updated="onUpdate")
6
-            w-button.ma1.grow(type="submit" bg-color="success")
7
-                w-icon.mr1 wi-check
8
-                | SUBMIT ANSWERS
9
-    MainNav
3
+    article(style="display: flex;flex-direction: column;align-items: center;")
4
+        component(
5
+            :is="onboardingStep.component"
6
+            :currentStep="currentStep"
7
+            :aspectQuestions="onboardingStep.component == 'Aspects'? aspectQuestions : null"
8
+            @go-to-step="goToStep"
9
+            @handle-submit="onboardingStep.component == 'Aspects'? onSubmit : null"
10
+        )
11
+        //- form(@submit.prevent="onSubmit").questionnaire
12
+        //-     QuestionResponse(v-for="question in questions" :question="question" @updated="onUpdate")
13
+        //-     w-button.ma1.grow(type="submit" bg-color="success")
14
+        //-         w-icon.mr1 wi-check
15
+        //-         | SUBMIT ANSWERS
16
+    //- MainNav
10
 </template>
17
 </template>
11
 
18
 
12
 <script>
19
 <script>
13
 import { surveyFactory } from '@/utils'
20
 import { surveyFactory } from '@/utils'
14
 import { allSteps, possible } from '@/utils/lang'
21
 import { allSteps, possible } from '@/utils/lang'
22
+import stepViews from '@/components/onboarding'
23
+import OnboardingStepComponents from '../utils/onboardingStepComponents'
15
 
24
 
16
-import QuestionResponse from '../components/QuestionResponse.vue'
17
-const SCORED = [1, 2, 3, 4, 5, 6]
25
+// import QuestionResponse from '../components/QuestionResponse.vue'
26
+const SCORED = [1, 2, 3, 4, 5, 6] // consider expanding + modifying DB table
18
 const _isScored = id => SCORED.includes(id)
27
 const _isScored = id => SCORED.includes(id)
19
 
28
 
20
 const _makeCategoryFriendly = responseCategory => {
29
 const _makeCategoryFriendly = responseCategory => {
26
     return labels
35
     return labels
27
 }
36
 }
28
 
37
 
29
-const _formatSteps = steps => {
38
+const _formatAspectQuestions = steps => {
30
     return steps
39
     return steps
31
         .map(q => {
40
         .map(q => {
32
             if (!_isScored(q.response_key_id)) return null
41
             if (!_isScored(q.response_key_id)) return null
39
         .filter(step => step != null)
48
         .filter(step => step != null)
40
 }
49
 }
41
 
50
 
51
+// import savesurveybyprfileid - call it on submit
52
+// paginate to save every steps answers
42
 export default {
53
 export default {
43
     name: 'OnboardingView',
54
     name: 'OnboardingView',
44
-    components: { QuestionResponse },
55
+    components: { 
56
+        ...stepViews,
57
+        // QuestionResponse 
58
+        },
45
     data: () => {
59
     data: () => {
46
         return {
60
         return {
47
-            validSurvey: null,
48
-            questions: [],
49
             answered: {},
61
             answered: {},
62
+            aspectQuestions: [],
63
+            currentStep: 0,
64
+            onboardingStepComponents: [],
65
+            validSurvey: null,
66
+        }
67
+    },
68
+    computed : {
69
+        onboardingStep(){
70
+            if(!this.onboardingStepComponents.length) return []
71
+            return this.onboardingStepComponents[this.currentStep]
50
         }
72
         }
51
     },
73
     },
52
     async created() {
74
     async created() {
54
             allSteps['usa'],
76
             allSteps['usa'],
55
             possible['usa']['roles'],
77
             possible['usa']['roles'],
56
         )
78
         )
57
-        this.questions = _formatSteps(survey.steps)
79
+        this.aspectQuestions = _formatAspectQuestions(survey.steps)
80
+        this.onboardingStepComponents = OnboardingStepComponents
58
     },
81
     },
59
     methods: {
82
     methods: {
60
         onUpdate(payload) {
83
         onUpdate(payload) {
61
-            this.answered[payload.id] = payload
84
+            console.log('payload: ', payload)
85
+            // this.answered[payload.id] = payload
62
         },
86
         },
63
         onSubmit() {
87
         onSubmit() {
64
             Object.values(this.answered).forEach(ans =>
88
             Object.values(this.answered).forEach(ans =>
65
                 console.log(ans.question, ans.answer),
89
                 console.log(ans.question, ans.answer),
66
             )
90
             )
67
         },
91
         },
92
+        goToStep(num){
93
+            this.currentStep = num
94
+        },
68
     },
95
     },
69
 }
96
 }
70
 </script>
97
 </script>

Loading…
İptal
Kaydet