@burh/nuxt-core 1.0.80 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,162 +1,230 @@
1
1
  <template>
2
- <div class="col-5 bg-light--darken py-5 px-5">
3
- <div class="d-flex justify-content-center">
4
- <a href="#!" class="avatar avatar-pdf">
5
- <img alt="Image placeholder" :src="avatar" v-show="avatar">
6
- <p class="h5 font-weight-bold text-muted" v-show="!avatar">{{handleGetPrefixes(name)}}</p>
7
- </a>
8
- </div>
9
- <p class="text-center text-muted font-weight-bold mb-4">{{yearsOld ? `${yearsOld} anos` : 'idade não informada'}}</p>
10
-
11
- <h2 class="display-4">Contato e Endereço</h2>
12
- <p>{{street}}, {{number}}<br v-show="number"> {{neighborhood}}<br v-show="neighborhood"> {{city}} - {{regionCode}}</p>
13
- <p><strong>Telefone:</strong> {{treatPhone(phone)}}<br> <strong>Celular:</strong> {{treatCellphone(cellphone)}}<br></p>
14
-
15
- <h2 class="display-4 mt-4" v-show="education.length">Educação</h2>
16
- <div class="mb-4" v-for="(edu,index) in education" :key="`education-${index}`">
17
- <h3 class="h6">{{edu.institution}}</h3>
18
- <h4 class="h6 text-muted">{{edu.formation}}</h4>
19
- <p>{{edu.start_month}}/{{edu.start_year}} - {{treatEndDate(edu.end_month,edu.end_year)}} {{getTime(edu)}}</p>
20
- </div>
21
-
22
- <h2 class="display-4 mt-4" v-show="courses.length">Cursos Profissionalizantes</h2>
23
- <div class="mb-4" v-for="(course, index) in courses" :key="`course-${index}`">
24
- <h4 class="h6">{{course.name}}</h4>
25
- <p>{{course.institution}} {{getTime(course)}}</p>
26
- </div>
27
-
28
- <h2 class="display-4 mt-4" v-show="languages.length">Idiomas</h2>
29
- <div class="mb-4" v-for="(lang, index) in languages" :key="`lang-${index}`">
30
- <h4 class="h6 d-inline-block mr-3">{{lang.language[0].name}}</h4>
31
- <el-tooltip placement="top" :content="languageLevel(lang.level)">
32
- <div class="d-inline-block">
33
- <font-awesome-icon :icon="['fas', 'star']" class="mr-2"
34
- v-for="(j, posStar) in Array(7)" :key="`level-${lang.language[0].name}-${posStar}`"
35
- :class="posStar < lang.level && 'text-warning'"/>
2
+ <div class="col-5 bg-light--darken py-5 px-5">
3
+ <div class="d-flex justify-content-center">
4
+ <a href="#!" class="avatar avatar-pdf">
5
+ <img alt="Image placeholder" :src="avatar" v-show="avatar" />
6
+ <p class="h5 font-weight-bold text-muted" v-show="!avatar">
7
+ {{ handleGetPrefixes(name) }}
8
+ </p>
9
+ </a>
10
+ </div>
11
+ <p class="text-center text-muted font-weight-bold mb-4">
12
+ {{ yearsOld ? `${yearsOld} anos` : "idade não informada" }}
13
+ </p>
14
+
15
+ <h2 class="display-4">Contato e Endereço</h2>
16
+ <p>
17
+ {{ street }}, {{ number }}<br v-show="number" />
18
+ {{ neighborhood }}<br v-show="neighborhood" />
19
+ {{ city }} - {{ regionCode }}
20
+ </p>
21
+ <p>
22
+ <strong>Telefone:</strong> {{ treatPhone(phone) }}<br />
23
+ <strong>Celular:</strong> {{ treatCellphone(cellphone) }}<br />
24
+ </p>
25
+
26
+ <h2 class="display-4 mt-4" v-show="education.length">Educação</h2>
27
+ <div
28
+ class="mb-4"
29
+ v-for="(edu, index) in education"
30
+ :key="`education-${index}`"
31
+ >
32
+ <h3 class="h6">{{ edu.institution }}</h3>
33
+ <h4 class="h6 text-muted">{{ edu.formation }}</h4>
34
+ <p>
35
+ {{ edu.start_month }}/{{ edu.start_year }} -
36
+ {{ treatEndDate(edu.end_month, edu.end_year) }}
37
+ {{ getTime(edu) }}
38
+ {{
39
+ edu.user_education_period
40
+ ? "-" + edu.user_education_period.name
41
+ : ""
42
+ }}
43
+ </p>
44
+ </div>
45
+
46
+ <h2 class="display-4 mt-4" v-show="courses.length">
47
+ Cursos Profissionalizantes
48
+ </h2>
49
+ <div
50
+ class="mb-4"
51
+ v-for="(course, index) in courses"
52
+ :key="`course-${index}`"
53
+ >
54
+ <h4 class="h6">{{ course.name }}</h4>
55
+ <p>{{ course.institution }} {{ getTime(course) }}</p>
36
56
  </div>
37
- </el-tooltip>
38
- </div>
39
57
 
40
- <h2 class="display-4 mt-4" v-show="skills.length">Habilidades</h2>
41
- <badge rounded type="primary"
42
- v-for="(skill, index) in skills" :key="`skill-${index}`">{{skill.skill_word}}</badge>
58
+ <h2 class="display-4 mt-4" v-show="languages.length">Idiomas</h2>
59
+ <div
60
+ class="mb-4"
61
+ v-for="(lang, index) in languages"
62
+ :key="`lang-${index}`"
63
+ >
64
+ <h4 class="h6 d-inline-block mr-3">{{ lang.language[0].name }}</h4>
65
+ <el-tooltip placement="top" :content="languageLevel(lang.level)">
66
+ <div class="d-inline-block">
67
+ <font-awesome-icon
68
+ :icon="['fas', 'star']"
69
+ class="mr-2"
70
+ v-for="(j, posStar) in Array(7)"
71
+ :key="`level-${lang.language[0].name}-${posStar}`"
72
+ :class="posStar < lang.level && 'text-warning'"
73
+ />
74
+ </div>
75
+ </el-tooltip>
76
+ </div>
43
77
 
44
- </div>
78
+ <h2 class="display-4 mt-4" v-show="skills.length">Habilidades</h2>
79
+ <badge
80
+ rounded
81
+ type="primary"
82
+ v-for="(skill, index) in skills"
83
+ :key="`skill-${index}`"
84
+ >{{ skill.skill_word }}</badge
85
+ >
86
+ </div>
45
87
  </template>
46
88
 
47
89
  <script>
48
- import getPrefixes from '~/util/getPrefixes.js'
90
+ import getPrefixes from "~/util/getPrefixes.js";
49
91
 
50
92
  export default {
51
- name: 'user-cv-left-side',
52
- props: {
53
- name: String,
54
- avatar: String,
55
- yearsOld: String | Number,
56
- city: String,
57
- regionCode: String,
58
- neighborhood: String,
59
- street: String,
60
- number: String,
61
- cellphone: String,
62
- phone: String,
63
- education: {
64
- type: Array,
65
- default: () => ([])
66
- },
67
- courses: {
68
- type: Array,
69
- default: () => ([])
70
- },
71
- skills: {
72
- type: Array,
73
- default: () => ([])
74
- },
75
- languages: {
76
- type: Array,
77
- default: () => ([])
78
- },
79
- },
80
- methods: {
81
- getTime({start_year = null, end_year = null, start_month, end_month }, textHappening = 'Cursando') {
82
- const isHappening = !end_month && !end_year
83
-
84
- if(isHappening) {
85
- return textHappening
86
- }
87
-
88
- const dateInitial = this.$moment(['1', start_month.toString(), start_year.toString()], 'DD/MM/YYYY');
89
- const dateDone = this.$moment(['1', end_month.toString(), end_year.toString()], 'DD/MM/YYYY');
90
- const diffDuration = this.$moment.duration(dateDone.diff(dateInitial));
91
- const years = diffDuration.years()
92
- const months = diffDuration.months()
93
-
94
- if(years) {
95
- return years > 1 ? `(${years} anos)` : `(${years} ano)`
96
- }
97
-
98
- return months > 1 ? `(${months} meses)` :
99
- months == 1 ? `(${months} mês)` : ''
100
- },
101
- languageLevel(level) {
102
- switch (parseInt(level)) {
103
- case 1: return 'Iniciante';
104
- case 2: return 'Elementar';
105
- case 3: return 'Pré-intermediário';
106
- case 4: return 'Intermediário';
107
- case 5: return 'Intermediário Superior';
108
- case 6: return 'Avançado';
109
- case 7: return 'Fluente';
110
- default: return '';
111
- }
112
- },
113
- treatPhone(phone) {
114
- if(phone == '0' || phone.length < 9 || !phone) {
115
- return 'não cadastrado'
93
+ name: "user-cv-left-side",
94
+ props: {
95
+ name: String,
96
+ avatar: String,
97
+ yearsOld: String | Number,
98
+ city: String,
99
+ regionCode: String,
100
+ neighborhood: String,
101
+ street: String,
102
+ number: String,
103
+ cellphone: String,
104
+ phone: String,
105
+ education: {
106
+ type: Array,
107
+ default: () => []
108
+ },
109
+ courses: {
110
+ type: Array,
111
+ default: () => []
112
+ },
113
+ skills: {
114
+ type: Array,
115
+ default: () => []
116
+ },
117
+ languages: {
118
+ type: Array,
119
+ default: () => []
116
120
  }
117
-
118
- return phone
119
121
  },
120
- treatCellphone(cellphone) {
121
- if(cellphone == '0' || cellphone.length < 11 || !cellphone) {
122
- return 'não cadastrado'
123
- }
122
+ methods: {
123
+ getTime(
124
+ { start_year = null, end_year = null, start_month, end_month },
125
+ textHappening = "Cursando"
126
+ ) {
127
+ const isHappening = !end_month && !end_year;
124
128
 
125
- return cellphone
126
- },
127
- handleGetPrefixes(name = '') {
128
- return getPrefixes(name)
129
- },
130
- treatEndDate(end_month, end_year) {
131
- if ( end_month && end_year) {
132
- return `${end_month}/${end_year}`
133
- }
134
- return ''
135
- },
136
- }
137
- }
129
+ if (isHappening) {
130
+ return textHappening;
131
+ }
132
+
133
+ const dateInitial = this.$moment(
134
+ ["1", start_month.toString(), start_year.toString()],
135
+ "DD/MM/YYYY"
136
+ );
137
+ const dateDone = this.$moment(
138
+ ["1", end_month.toString(), end_year.toString()],
139
+ "DD/MM/YYYY"
140
+ );
141
+ const diffDuration = this.$moment.duration(
142
+ dateDone.diff(dateInitial)
143
+ );
144
+ const years = diffDuration.years();
145
+ const months = diffDuration.months();
146
+
147
+ if (years) {
148
+ return years > 1 ? `(${years} anos)` : `(${years} ano)`;
149
+ }
150
+
151
+ return months > 1
152
+ ? `(${months} meses)`
153
+ : months == 1
154
+ ? `(${months} mês)`
155
+ : "";
156
+ },
157
+ languageLevel(level) {
158
+ switch (parseInt(level)) {
159
+ case 1:
160
+ return "Iniciante";
161
+ case 2:
162
+ return "Elementar";
163
+ case 3:
164
+ return "Pré-intermediário";
165
+ case 4:
166
+ return "Intermediário";
167
+ case 5:
168
+ return "Intermediário Superior";
169
+ case 6:
170
+ return "Avançado";
171
+ case 7:
172
+ return "Fluente";
173
+ default:
174
+ return "";
175
+ }
176
+ },
177
+ treatPhone(phone) {
178
+ if (phone) {
179
+ if (phone == "0" || phone.length < 9 || !phone) {
180
+ return "não cadastrado";
181
+ }
182
+ }
183
+
184
+ return phone;
185
+ },
186
+ treatCellphone(cellphone) {
187
+ if (cellphone) {
188
+ if (cellphone == "0" || cellphone.length < 11 || !cellphone) {
189
+ return "não cadastrado";
190
+ }
191
+ }
192
+
193
+ return cellphone;
194
+ },
195
+ handleGetPrefixes(name = "") {
196
+ return getPrefixes(name);
197
+ },
198
+ treatEndDate(end_month, end_year) {
199
+ if (end_month && end_year) {
200
+ return `${end_month}/${end_year}`;
201
+ }
202
+ return "";
203
+ }
204
+ }
205
+ };
138
206
  </script>
139
207
 
140
208
  <style lang="scss" scoped>
141
209
  @import "@burh/nuxt-core/assets/sass/burh-ds/variables/_colors.scss";
142
210
 
143
211
  .bg-light--darken {
144
- background-color: $gray-100 !important;
212
+ background-color: $gray-100 !important;
145
213
  }
146
214
 
147
215
  .avatar {
148
- &.avatar-pdf {
149
- background-color: white;
150
- width: 104px;
151
- height: 104px;
152
- border-radius: 50%;
153
-
154
- img {
155
- width: 90px;
156
- height: 90px;
157
- z-index: 2;
158
- border-radius: 50%;
216
+ &.avatar-pdf {
217
+ background-color: white;
218
+ width: 104px;
219
+ height: 104px;
220
+ border-radius: 50%;
221
+
222
+ img {
223
+ width: 90px;
224
+ height: 90px;
225
+ z-index: 2;
226
+ border-radius: 50%;
227
+ }
159
228
  }
160
- }
161
229
  }
162
- </style>
230
+ </style>
@@ -247,6 +247,11 @@ export default {
247
247
  data => data.title == this.messageTitle
248
248
  );
249
249
 
250
+ if (!template) {
251
+ this.messageTitle = null;
252
+ return false;
253
+ }
254
+
250
255
  return (
251
256
  parseInt(this.$store.state.user.currentUser.id) ==
252
257
  template.user_id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {
@@ -0,0 +1,12 @@
1
+ const getPrefixes = (text, qtd = 2, splitBy = ' ') => {
2
+ const arrText = text.split(splitBy)
3
+
4
+ const cbPrefix = (acc, value, pos) => {
5
+ return (pos >= qtd && acc) || acc.concat(value.charAt(0))
6
+ }
7
+ const prefixes = arrText.reduce(cbPrefix, [, ''])
8
+
9
+ return prefixes.join('')
10
+ }
11
+
12
+ export default getPrefixes