@burh/nuxt-core 1.0.368 → 1.0.370

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.
@@ -7,7 +7,7 @@
7
7
  >
8
8
  <template>
9
9
  <div class="role">
10
- <h3>Cadastrar Cliente</h3>
10
+ <h3>{{ isEditing ? 'Editando Cliente' : 'Cadastrar Cliente' }}</h3>
11
11
 
12
12
  <section>
13
13
  <validation-observer ref="sendRole">
@@ -58,6 +58,7 @@
58
58
  name="CNPJ"
59
59
  rules="required|min:14"
60
60
  v-slot="{ errors }"
61
+ v-if="!isEditing"
61
62
  >
62
63
  <label for="cnpj">CNPJ</label>
63
64
  <base-input
@@ -147,7 +148,7 @@
147
148
  @click="sendRequest"
148
149
  class="btn ml-auto d-block btn-primary btn-md"
149
150
  >
150
- Enviar
151
+ {{ isEditing ? 'Salvar' : 'Enviar' }}
151
152
  </button>
152
153
  </section>
153
154
  </div>
@@ -185,6 +186,10 @@ export default {
185
186
  default: false,
186
187
  description: 'Modal open verification'
187
188
  },
189
+ userData: {
190
+ type: Object,
191
+ default: null
192
+ }
188
193
  },
189
194
  watch: {
190
195
  name(to) {
@@ -196,6 +201,21 @@ export default {
196
201
  if (!to) {
197
202
  this.resetFields();
198
203
  }
204
+ },
205
+ userData(to) {
206
+ if (to !== null) {
207
+ this.id = to.id;
208
+ this.name = to.name;
209
+ this.social = to.razao_social;
210
+ this.description = to.description;
211
+ this.cnpj = to.cnpj;
212
+ this.cep = to.cep;
213
+ this.address = to.address;
214
+ this.city = to.city;
215
+ this.isEditing = true;
216
+ } else {
217
+ this.isEditing = false;
218
+ }
199
219
  }
200
220
  },
201
221
  data() {
@@ -208,6 +228,8 @@ export default {
208
228
  address: '',
209
229
  city: '',
210
230
 
231
+ isEditing: false,
232
+
211
233
  cityList: [],
212
234
  permissions: false,
213
235
  permessionsData: [
@@ -247,7 +269,7 @@ export default {
247
269
  toast: true,
248
270
  position: 'top-end',
249
271
  showConfirmButton: false,
250
- timer: 30000,
272
+ timer: 3000,
251
273
  });
252
274
 
253
275
  Toast.fire({
@@ -303,7 +325,9 @@ export default {
303
325
  city: this.city
304
326
  };
305
327
 
306
- this.$emit('add-customer', payload);
328
+ const mode = this.isEditing ? 'update' : 'create';
329
+
330
+ this.$emit('customer-submit', payload, mode, this.id);
307
331
  this.$emit('close');
308
332
  }
309
333
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.368",
3
+ "version": "1.0.370",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {