@burh/nuxt-core 1.0.396 → 1.0.399

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,429 +1,564 @@
1
- <template>
2
- <el-dialog
3
- :visible.sync="isActive"
4
- width="55%"
5
- custom-class="position-relative"
6
- @close="$emit('close')"
7
- >
8
- <template>
9
- <div class="role">
10
- <h3>{{ isEditing ? 'Editando Cliente' : 'Cadastrar Cliente' }}</h3>
11
-
12
- <section>
13
- <validation-observer ref="sendRole">
14
- <validation-provider
15
- tag="div"
16
- name="Nome"
17
- rules="required"
18
- v-slot="{ errors }"
19
- >
20
- <label for="name">Nome da Empresa</label>
21
- <base-input
22
- type="text"
23
- id="name"
24
- v-model="name"
25
- placeholder="Nome da Empresa"
26
- :error="errors[0]"
27
- :valid="errors.length ? true : false"
28
- />
29
- </validation-provider>
30
-
31
- <validation-provider
32
- tag="div"
33
- name="Razão Social"
34
- rules="required"
35
- v-slot="{ errors }"
36
- >
37
- <label for="social">Razão Social</label>
38
- <base-input
39
- type="text"
40
- id="social"
41
- v-model="social"
42
- placeholder="Razão Social"
43
- :error="errors[0]"
44
- :valid="errors.length ? true : false"
45
- />
46
- </validation-provider>
47
-
48
- <validation-provider
49
- tag="div"
50
- name="Descrição"
51
- rules="required"
52
- v-slot="{ errors }"
53
- >
54
- <label for="description">Descrição</label>
55
- <base-input
56
- type="text"
57
- id="description"
58
- v-model="description"
59
- placeholder="Descrição"
60
- :error="errors[0]"
61
- :valid="errors.length ? true : false"
62
- />
63
- </validation-provider>
64
-
65
- <validation-provider
66
- tag="div"
67
- name="CNPJ"
68
- rules="required|min:14"
69
- v-slot="{ errors }"
70
- v-if="!isEditing"
71
- >
72
- <label for="cnpj">CNPJ</label>
73
- <base-input
74
- type="text"
75
- id="cnpj"
76
- v-model="cnpj"
77
- placeholder="CNPJ"
78
- :mask="['##.###.###/####-##']"
79
- :error="errors[0]"
80
- :valid="errors.length ? true : false"
81
- />
82
- </validation-provider>
83
-
84
- <validation-provider
85
- tag="div"
86
- name="CEP"
87
- rules="required|min:9"
88
- v-slot="{ errors }"
89
- >
90
- <label for="cep">CEP</label>
91
- <base-input
92
- type="text"
93
- id="cep"
94
- v-model="cep"
95
- placeholder="CEP"
96
- v-mask="['#####-###']"
97
- :error="errors[0]"
98
- :valid="errors.length ? true : false"
99
- />
100
- </validation-provider>
101
-
102
- <validation-provider
103
- tag="div"
104
- name="Cidade"
105
- rules="required"
106
- v-slot="{ errors }"
107
- >
108
- <label for="city" class="form-control-label">Cidade</label>
109
- <div class="form-group">
110
- <el-select
111
- id="city"
112
- v-model="city"
113
- placeholder="Cidade"
114
- filterable
115
- remote
116
- required
117
- auto-complete="off"
118
- :class="{'is-invalid': errors[0]}"
119
- :remote-method="getCityListFiltered"
120
- :loading="isSelectLoading"
121
-
122
- >
123
- <div class="text-center" slot="empty">
124
- <p class="small mb-2 mt-3">Nenhuma cidade encontrada</p>
125
- </div>
126
-
127
- <el-option
128
- v-for="city in cityListFiltered"
129
- :key="city.value"
130
- :value="city.value"
131
- :label="city.value"
132
- />
133
- </el-select>
134
- <div
135
- class="invalid-feedback"
136
- style="display: block;">
137
- {{ errors[0] }}
138
- </div>
139
- </div>
140
- </validation-provider>
141
-
142
- <validation-provider
143
- tag="div"
144
- name="Endereço"
145
- rules="required"
146
- v-slot="{ errors }"
147
- >
148
- <label for="address">Endereço</label>
149
- <base-input
150
- type="text"
151
- id="address"
152
- v-model="address"
153
- placeholder="Endereço"
154
- :error="errors[0]"
155
- :valid="errors.length ? true : false"
156
- />
157
- </validation-provider>
158
- </validation-observer>
159
- <button
160
- type="button"
161
- :class="{'invalid-form': !permissions}"
162
- :disabled="!permissions"
163
- @click="sendRequest"
164
- class="btn ml-auto d-block btn-primary btn-md"
165
- >
166
- {{ isEditing ? 'Salvar' : 'Enviar' }}
167
- </button>
168
- </section>
169
- </div>
170
-
171
- <span class="tool tool-close" @click="$emit('close')">
172
- Fechar
173
- <font-awesome-icon
174
- :icon="['fas', 'times']"
175
- class="text-white ml-1"
176
- />
177
- </span>
178
- </template>
179
- </el-dialog>
180
- </template>
181
-
182
- <script>
183
- import { Dialog, Select, Option } from 'element-ui';
184
- import { mask } from 'vue-the-mask';
185
- import swal from 'sweetalert2';
186
- import removeAccents from 'remove-accents';
187
-
188
- export default {
189
- name: 'add-customer-modal',
190
- directives:{
191
- mask
192
- },
193
- components: {
194
- [Dialog.name]: Dialog,
195
- [Select.name]: Select,
196
- [Option.name]: Option,
197
-
198
- },
199
- props: {
200
- isActive: {
201
- type: Boolean,
202
- default: false,
203
- description: 'Modal open verification'
204
- },
205
- userData: {
206
- type: Object,
207
- default: null
208
- }
209
- },
210
- watch: {
211
- name(to) {
212
- if (to.length > 3) {
213
- this.permissions = true;
214
- }
215
- },
216
- isActive(to) {
217
- if (!to) {
218
- this.resetFields();
219
- this.cityList = [];
220
- }
221
- },
222
- userData(to) {
223
- if (to !== null) {
224
- this.id = to.id;
225
- this.name = to.name;
226
- this.social = to.razao_social;
227
- this.description = to.description;
228
- this.cnpj = to.cnpj;
229
- this.cep = to.cep;
230
- this.address = to.address;
231
- this.city = to.city;
232
- this.isEditing = true;
233
- } else {
234
- this.isEditing = false;
235
- }
236
- }
237
- },
238
- data() {
239
- return {
240
- name: '',
241
- social: '',
242
- description: '',
243
- cnpj: '',
244
- cep: '',
245
- address: '',
246
- city: '',
247
- isEditing: false,
248
- isSelectLoading: false,
249
- cityList: [],
250
- cityListFiltered: [],
251
- permissions: false,
252
- permessionsData: [
253
- {
254
- id: 22845207,
255
- name: 'Administrador'
256
- },
257
- {
258
- id: 22890835,
259
- name: 'Usuário Empresas'
260
- },
261
- {
262
- id: 22913699,
263
- name: 'Portal do RH'
264
- },
265
- {
266
- id: 22959227,
267
- name: 'Universidade Corporativa'
268
- },
269
- ]
270
- };
271
- },
272
- methods: {
273
- resetFields() {
274
- this.name = '';
275
- this.social = '';
276
- this.description = '';
277
- this.cnpj = '';
278
- this.cep = '';
279
- this.address = '';
280
- this.city = '';
281
-
282
- this.$refs.sendRole.reset();
283
- },
284
- async showMessage(message, type = 'success') {
285
- const Toast = swal.mixin({
286
- toast: true,
287
- position: 'top-end',
288
- showConfirmButton: false,
289
- timer: 3000,
290
- });
291
-
292
- Toast.fire({
293
- type: type,
294
- title: message,
295
- });
296
- },
297
- async getCityList() {
298
- this.cityList = await fetch('https://raw.githubusercontent.com/Skuth/cidades-com-estados-brasil/main/cidades.json')
299
- .then(res => res.json())
300
- .catch(() => {});
301
- },
302
- getCityListFiltered(query) {
303
- if (query && query.length >= 2) {
304
- this.cityListFiltered = this.cityList.filter(city => removeAccents(String(city.city)).toLowerCase().startsWith(removeAccents(query.toLowerCase())));
305
- this.cityListFiltered = this.cityListFiltered.map(city => {
306
- return {
307
- value: `${city.city} / ${city.uf}`
308
- };
309
- });
310
- } else {
311
- this.cityListFiltered = [];
312
- }
313
- },
314
- async checkZipcode() {
315
- await this.$services.company
316
- .checkZipCode(this.cep)
317
- .then((response) => {
318
- if (response.error || response.data.length == 0) {
319
- response.error = true;
320
- } else {
321
- if (response.data) {
322
- if (response.data.city_name && response.data.region_code) {
323
- this.city = `${response.data.city_name} / ${response.data.region_code}`;
324
- }
325
- }
326
- }
327
- })
328
- .catch(() => {});
329
- },
330
- async sendRequest() {
331
- this.permissions = true;
332
-
333
- const pass = await this.$refs.sendRole.validate();
334
-
335
- if (!pass) {
336
- return this.showMessage('Preencha todos os campos obrigatórios!', 'error');
337
- }
338
-
339
- await this.checkZipcode();
340
-
341
- let payload = {
342
- name: this.name,
343
- razao_social: this.social,
344
- description: this.description,
345
- cnpj: this.cnpj,
346
- cep: this.cep,
347
- address: this.address,
348
- city: this.city
349
- };
350
-
351
- const mode = this.isEditing ? 'update' : 'create';
352
-
353
- this.$emit('customer-submit', payload, mode, this.id);
354
- this.$emit('close');
355
- }
356
- },
357
- mounted() {
358
- this.getCityList();
359
- }
360
- };
361
- </script>
362
-
363
- <style lang="scss">
364
- body.swal2-toast-shown .swal2-container.swal2-top-end, body.swal2-toast-shown .swal2-container.swal2-top-right {
365
- z-index: 10000!important;
366
- }
367
- </style>
368
-
369
- <style lang="scss" scoped>
370
- @import '@burh/nuxt-core/assets/sass/burh-ds/variables/_colors.scss';
371
-
372
- /deep/ .el-dialog__body {
373
- padding: 0;
374
- }
375
-
376
- /deep/ .el-dialog__header {
377
- display: none;
378
- }
379
-
380
- /deep/ .el-dialog {
381
- overflow: hidden;
382
- border-radius: 10px;
383
- max-width: 47.5rem;
384
- }
385
-
386
- .role {
387
- padding: 2rem 3rem;
388
-
389
- section {
390
- margin-top: 2rem;
391
-
392
- .invalid-form {
393
- opacity: 0.3;
394
- }
395
- }
396
- }
397
-
398
- .is-invalid {
399
- /deep/ input {
400
- border-color: #de214b!important;
401
- }
402
- }
403
-
404
- .tool {
405
- position: absolute;
406
- top: 1rem;
407
- z-index: 10;
408
- color: $primary;
409
- cursor: pointer;
410
-
411
- &-close {
412
- position: absolute;
413
- width: 88px;
414
- height: 27px;
415
- right: 7px;
416
- top: 7px;
417
- display: flex;
418
- justify-content: center;
419
- align-items: center;
420
-
421
- font-size: 11px;
422
-
423
- font-weight: 500;
424
- background: rgba(0, 0, 0, 0.2);
425
- border-radius: 17.5px;
426
- color: #fff;
427
- }
428
- }
429
- </style>
1
+ <template>
2
+ <el-dialog
3
+ :visible.sync="isActive"
4
+ width="55%"
5
+ custom-class="position-relative"
6
+ @close="$emit('close')"
7
+ >
8
+ <template>
9
+ <div class="role">
10
+ <h3>{{ isEditing ? 'Editando Cliente' : 'Cadastrar Cliente' }}</h3>
11
+
12
+ <section>
13
+ <validation-observer ref="sendRole">
14
+ <validation-provider
15
+ tag="div"
16
+ name="Nome"
17
+ rules="required"
18
+ v-slot="{ errors }"
19
+ >
20
+ <label for="name">Nome da Empresa</label>
21
+ <base-input
22
+ type="text"
23
+ id="name"
24
+ v-model="name"
25
+ placeholder="Nome da Empresa"
26
+ :error="errors[0]"
27
+ :valid="errors.length ? true : false"
28
+ />
29
+ </validation-provider>
30
+ <validation-provider
31
+ tag="div"
32
+ name="Descrição"
33
+ rules="required"
34
+ v-slot="{ errors }"
35
+ >
36
+ <label for="description">Descrição</label>
37
+ <base-input
38
+ type="text"
39
+ id="description"
40
+ v-model="description"
41
+ placeholder="Descrição"
42
+ :error="errors[0]"
43
+ :valid="errors.length ? true : false"
44
+ />
45
+ </validation-provider>
46
+ <validation-provider
47
+ tag="div"
48
+ name="Razão Social"
49
+ rules="required"
50
+ v-slot="{ errors }"
51
+ >
52
+ <label for="social">Razão Social</label>
53
+ <base-input
54
+ type="text"
55
+ id="social"
56
+ v-model="social"
57
+ placeholder="Razão Social"
58
+ :error="errors[0]"
59
+ :valid="errors.length ? true : false"
60
+ />
61
+ </validation-provider>
62
+ <validation-provider
63
+ tag="div"
64
+ name="CNPJ"
65
+ rules="required|min:14"
66
+ v-slot="{ errors }"
67
+ v-if="!isEditing"
68
+ >
69
+ <label for="cnpj">CNPJ</label>
70
+ <base-input
71
+ type="text"
72
+ id="cnpj"
73
+ v-model="cnpj"
74
+ placeholder="CNPJ"
75
+ :mask="['##.###.###/####-##']"
76
+ :error="errors[0]"
77
+ :valid="errors.length ? true : false"
78
+ />
79
+ </validation-provider>
80
+
81
+ <validation-provider
82
+ tag="div"
83
+ name="CEP"
84
+ rules="required|min:9"
85
+ v-slot="{ errors }"
86
+ >
87
+ <label for="cep">CEP</label>
88
+ <base-input
89
+ type="text"
90
+ id="cep"
91
+ v-model="cep"
92
+ placeholder="CEP"
93
+ v-mask="['#####-###']"
94
+ :error="errors[0]"
95
+ :valid="errors.length ? true : false"
96
+ />
97
+ </validation-provider>
98
+
99
+ <validation-provider
100
+ tag="div"
101
+ name="Cidade"
102
+ rules="required"
103
+ v-slot="{ errors }"
104
+ >
105
+ <label for="city" class="form-control-label">Cidade</label>
106
+ <div class="form-group">
107
+ <el-select
108
+ id="city"
109
+ v-model="city"
110
+ placeholder="Cidade"
111
+ filterable
112
+ remote
113
+ required
114
+ auto-complete="off"
115
+ :class="{'is-invalid': errors[0]}"
116
+ :remote-method="getCityListFiltered"
117
+ :loading="isSelectLoading"
118
+
119
+ >
120
+ <div class="text-center" slot="empty">
121
+ <p class="small mb-2 mt-3">Nenhuma cidade encontrada</p>
122
+ </div>
123
+
124
+ <el-option
125
+ v-for="city in cityListFiltered"
126
+ :key="city.value"
127
+ :value="city.value"
128
+ :label="city.value"
129
+ />
130
+ </el-select>
131
+ <div
132
+ class="invalid-feedback"
133
+ style="display: block;">
134
+ {{ errors[0] }}
135
+ </div>
136
+ </div>
137
+ </validation-provider>
138
+
139
+ <validation-provider
140
+ tag="div"
141
+ name="Endereço"
142
+ rules="required"
143
+ v-slot="{ errors }"
144
+ >
145
+ <label for="address">Endereço</label>
146
+ <base-input
147
+ type="text"
148
+ id="address"
149
+ v-model="address"
150
+ placeholder="Endereço"
151
+ :error="errors[0]"
152
+ :valid="errors.length ? true : false"
153
+ />
154
+ </validation-provider>
155
+ <h2>Contato</h2>
156
+ <div v-for="(contact, idx) in contacts" :key="idx">
157
+ <div class="border p-3 rounded">
158
+ <validation-provider
159
+ tag="div"
160
+ name="Responsável"
161
+ :vid="`send-responsible-${idx}`"
162
+ rules="required"
163
+ v-slot="{ errors }"
164
+ >
165
+ <label for="name">Responsável</label>
166
+ <base-input
167
+ type="text"
168
+ v-model="contact.name"
169
+ placeholder="Responsável"
170
+ :error="errors[0]"
171
+ :valid="errors.length ? true : false"
172
+ />
173
+ </validation-provider>
174
+
175
+ <validation-provider
176
+ tag="div"
177
+ name="E-mail"
178
+ :vid="`send-email-${idx}`"
179
+ rules="required"
180
+ v-slot="{ errors }"
181
+ >
182
+ <label for="email">Email</label>
183
+ <base-input
184
+ type="email"
185
+ v-model="contact.email"
186
+ placeholder="Email"
187
+ :error="errors[0]"
188
+ :valid="errors.length ? true : false"
189
+ />
190
+ </validation-provider>
191
+
192
+ <validation-provider
193
+ tag="div"
194
+ name="Telefone"
195
+ :vid="`send-phone-${idx}`"
196
+ rules="required"
197
+ v-slot="{ errors }"
198
+ >
199
+ <label for="phone">Telefone</label>
200
+ <base-input
201
+ type="text"
202
+ v-model="contact.phone"
203
+ :mask="['(##) ####-####']"
204
+ placeholder="Telefone com DDD"
205
+ :error="errors[0]"
206
+ :valid="errors.length ? true : false"
207
+ />
208
+ </validation-provider>
209
+
210
+ <validation-provider
211
+ tag="div"
212
+ name="Celular"
213
+ :vid="`send-cellphone-${idx}`"
214
+ rules="required"
215
+ v-slot="{ errors }"
216
+ >
217
+ <label for="cellphone">Celular</label>
218
+ <base-input
219
+ type="text"
220
+ v-model="contact.cellphone"
221
+ :mask="['(##) #####-####']"
222
+ placeholder="Celular com DDD"
223
+ :error="errors[0]"
224
+ :valid="errors.length ? true : false"
225
+ />
226
+ </validation-provider>
227
+
228
+ <validation-provider
229
+ tag="div"
230
+ name="Observações"
231
+ :vid="`send-note-${idx}`"
232
+ rules="required"
233
+ v-slot="{ errors }"
234
+ >
235
+ <label for="note">Observações</label>
236
+ <base-input
237
+ type="text"
238
+ v-model="contact.note"
239
+ placeholder="Observações"
240
+ :error="errors[0]"
241
+ :valid="errors.length ? true : false"
242
+ />
243
+ </validation-provider>
244
+ <div class="col-1 pt-2">
245
+ <i
246
+ v-if="idx !== contacts.length - 1"
247
+ class="fa fa-trash pointer"
248
+ @click="removeSlot(idx)"
249
+ ></i>
250
+ </div>
251
+ </div>
252
+ <div class="col-1 pt-2">
253
+ <i v-if="idx === contacts.length - 1" class="fa fa-plus pointer" @click="addSlot"></i>
254
+ </div>
255
+ </div>
256
+ </validation-observer>
257
+ <button
258
+ type="button"
259
+ :class="{'invalid-form': !permissions}"
260
+ :disabled="!permissions"
261
+ @click="sendRequest"
262
+ class="btn ml-auto d-block btn-primary btn-md"
263
+ >
264
+ {{ isEditing ? 'Salvar' : 'Enviar' }}
265
+ </button>
266
+ </section>
267
+ </div>
268
+
269
+ <span class="tool tool-close" @click="$emit('close')">
270
+ Fechar
271
+ <font-awesome-icon
272
+ :icon="['fas', 'times']"
273
+ class="text-white ml-1"
274
+ />
275
+ </span>
276
+ </template>
277
+ </el-dialog>
278
+ </template>
279
+
280
+ <script>
281
+ import { Dialog, Select, Option } from 'element-ui';
282
+ import { mask } from 'vue-the-mask';
283
+ import swal from 'sweetalert2';
284
+ import removeAccents from 'remove-accents';
285
+
286
+ export default {
287
+ name: 'add-customer-modal',
288
+ directives:{
289
+ mask
290
+ },
291
+ components: {
292
+ [Dialog.name]: Dialog,
293
+ [Select.name]: Select,
294
+ [Option.name]: Option,
295
+
296
+ },
297
+ props: {
298
+ isActive: {
299
+ type: Boolean,
300
+ default: false,
301
+ description: 'Modal open verification'
302
+ },
303
+ userData: {
304
+ type: Object,
305
+ default: null
306
+ }
307
+ },
308
+ watch: {
309
+ name(to) {
310
+ if (to.length > 3) {
311
+ this.permissions = true;
312
+ }
313
+ },
314
+ isActive(to) {
315
+ if (!to) {
316
+ this.resetFields();
317
+ this.cityList = [];
318
+ }
319
+ if(!this.cityList.length && to){
320
+ this.getCityList();
321
+ }
322
+ },
323
+ userData(to) {
324
+ if (to !== null) {
325
+ this.id = to.id;
326
+ this.name = to.name;
327
+ this.social = to.razao_social;
328
+ this.description = to.description;
329
+ this.contacts = to.contact,
330
+ this.cnpj = to.cnpj;
331
+ this.cep = to.cep;
332
+ this.address = to.address;
333
+ this.city = to.city;
334
+ this.isEditing = true;
335
+ } else {
336
+ this.isEditing = false;
337
+ }
338
+ }
339
+ },
340
+ data() {
341
+ return {
342
+ name: '',
343
+ social: '',
344
+ description: '',
345
+ cnpj: '',
346
+ contacts: [
347
+ {
348
+ name:'',
349
+ email:'',
350
+ phone:'',
351
+ cellphone:'',
352
+ note:'',
353
+ }
354
+ ],
355
+ cep: '',
356
+ address: '',
357
+ city: '',
358
+ isEditing: false,
359
+ isSelectLoading: false,
360
+ cityList: [],
361
+ cityListFiltered: [],
362
+ permissions: false,
363
+ permessionsData: [
364
+ {
365
+ id: 22845207,
366
+ name: 'Administrador'
367
+ },
368
+ {
369
+ id: 22890835,
370
+ name: 'Usuário Empresas'
371
+ },
372
+ {
373
+ id: 22913699,
374
+ name: 'Portal do RH'
375
+ },
376
+ {
377
+ id: 22959227,
378
+ name: 'Universidade Corporativa'
379
+ },
380
+ ]
381
+ };
382
+ },
383
+ methods: {
384
+ resetFields() {
385
+ this.name = '';
386
+ this.social = '';
387
+ this.description = '';
388
+ this.cnpj = '';
389
+ this.contacts = [
390
+ {
391
+ name:'',
392
+ email:'',
393
+ phone:'',
394
+ cellphone:'',
395
+ note:'',
396
+ }
397
+ ],
398
+ this.cep = '';
399
+ this.address = '';
400
+ this.city = '';
401
+
402
+ this.$refs.sendRole.reset();
403
+ },
404
+ addSlot(){
405
+ const newContacts = {
406
+ name:'',
407
+ email:'',
408
+ phone:'',
409
+ cellphone:'',
410
+ note:'',
411
+ };
412
+
413
+ this.contacts = [...this.contacts, newContacts];
414
+ },
415
+ removeSlot(idx){
416
+ this.contacts.splice(idx, 1);
417
+ },
418
+ async showMessage(message, type = 'success') {
419
+ const Toast = swal.mixin({
420
+ toast: true,
421
+ position: 'top-end',
422
+ showConfirmButton: false,
423
+ timer: 3000,
424
+ });
425
+
426
+ Toast.fire({
427
+ type: type,
428
+ title: message,
429
+ });
430
+ },
431
+ async getCityList() {
432
+ this.cityList = await fetch('https://raw.githubusercontent.com/Skuth/cidades-com-estados-brasil/main/cidades.json')
433
+ .then(res => res.json())
434
+ .catch(() => {});
435
+ },
436
+ getCityListFiltered(query) {
437
+ if (query && query.length >= 2) {
438
+ this.cityListFiltered = this.cityList.filter(city => removeAccents(String(city.city)).toLowerCase().startsWith(removeAccents(query.toLowerCase())));
439
+ this.cityListFiltered = this.cityListFiltered.map(city => {
440
+ return {
441
+ value: `${city.city} / ${city.uf}`
442
+ };
443
+ });
444
+ } else {
445
+ this.cityListFiltered = [];
446
+ }
447
+ },
448
+ async checkZipcode() {
449
+ await this.$services.company
450
+ .checkZipCode(this.cep)
451
+ .then((response) => {
452
+ if (response.error || response.data.length == 0) {
453
+ response.error = true;
454
+ } else {
455
+ if (response.data) {
456
+ if (response.data.city_name && response.data.region_code) {
457
+ this.city = `${response.data.city_name} / ${response.data.region_code}`;
458
+ }
459
+ }
460
+ }
461
+ })
462
+ .catch(() => {});
463
+ },
464
+ async sendRequest() {
465
+ this.permissions = true;
466
+
467
+ const pass = await this.$refs.sendRole.validate();
468
+
469
+ if (!pass) {
470
+ return this.showMessage('Preencha todos os campos obrigatórios!', 'error');
471
+ }
472
+
473
+ await this.checkZipcode();
474
+
475
+ let payload = {
476
+ name: this.name,
477
+ razao_social: this.social,
478
+ description: this.description,
479
+ contact: this.contacts,
480
+ cnpj: this.cnpj,
481
+ cep: this.cep,
482
+ address: this.address,
483
+ city: this.city
484
+ };
485
+
486
+ const mode = this.isEditing ? 'update' : 'create';
487
+
488
+ this.$emit('customer-submit', payload, mode, this.id);
489
+ this.$emit('close');
490
+ }
491
+ },
492
+ mounted() {
493
+ this.getCityList();
494
+ }
495
+ };
496
+ </script>
497
+
498
+ <style lang="scss">
499
+ body.swal2-toast-shown .swal2-container.swal2-top-end, body.swal2-toast-shown .swal2-container.swal2-top-right {
500
+ z-index: 10000!important;
501
+ }
502
+ </style>
503
+
504
+ <style lang="scss" scoped>
505
+ @import '@burh/nuxt-core/assets/sass/burh-ds/variables/_colors.scss';
506
+
507
+ /deep/ .el-dialog__body {
508
+ padding: 0;
509
+ }
510
+
511
+ /deep/ .el-dialog__header {
512
+ display: none;
513
+ }
514
+
515
+ /deep/ .el-dialog {
516
+ overflow: hidden;
517
+ border-radius: 10px;
518
+ max-width: 47.5rem;
519
+ }
520
+
521
+ .role {
522
+ padding: 2rem 3rem;
523
+
524
+ section {
525
+ margin-top: 2rem;
526
+
527
+ .invalid-form {
528
+ opacity: 0.3;
529
+ }
530
+ }
531
+ }
532
+
533
+ .is-invalid {
534
+ /deep/ input {
535
+ border-color: #de214b!important;
536
+ }
537
+ }
538
+
539
+ .tool {
540
+ position: absolute;
541
+ top: 1rem;
542
+ z-index: 10;
543
+ color: $primary;
544
+ cursor: pointer;
545
+
546
+ &-close {
547
+ position: absolute;
548
+ width: 88px;
549
+ height: 27px;
550
+ right: 7px;
551
+ top: 7px;
552
+ display: flex;
553
+ justify-content: center;
554
+ align-items: center;
555
+
556
+ font-size: 11px;
557
+
558
+ font-weight: 500;
559
+ background: rgba(0, 0, 0, 0.2);
560
+ border-radius: 17.5px;
561
+ color: #fff;
562
+ }
563
+ }
564
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.396",
3
+ "version": "1.0.399",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {