@burh/nuxt-core 1.1.18 → 1.1.19

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.
@@ -128,6 +128,18 @@
128
128
  />
129
129
  </div>
130
130
  </div>
131
+
132
+ <!-- DADOS PESSOAIS -->
133
+ <div v-if="userData && userData.user_complementary_information">
134
+ <h5 class="font-weight-bold mt-4 ml-3">Dados Pessoais</h5>
135
+ <div class="ml-3 info-text">
136
+ <span v-if="userData.user_complementary_information.rg != null">RG: {{getFormattedValue('rg', userData.user_complementary_information.rg)}}<br></span>
137
+ <span v-if="userData.user_complementary_information.cpf != null">CPF: {{getFormattedValue('cpf', userData.user_complementary_information.cpf)}}<br></span>
138
+ <span v-if="userData.user_complementary_information.birth != null">Data de Nascimento: {{getFormattedValue('birthDate', userData.user_complementary_information.birth)}}<br></span>
139
+ <span v-if="userData.user_complementary_information.mother_name != null">Nome da mãe: {{userData.user_complementary_information.mother_name}}<br></span>
140
+ </div>
141
+ </div>
142
+
131
143
  <!-- CONTATO -->
132
144
  <h5 class="font-weight-bold mt-4 ml-3">Contatos</h5>
133
145
  <div class="ml-3 info-text">
@@ -359,6 +371,33 @@ export default {
359
371
  }
360
372
  },
361
373
  methods: {
374
+ getFormattedValue(type, value) {
375
+ if (!value || typeof value !== 'string') return '';
376
+
377
+ const onlyDigits = value.replace(/\D/g, '');
378
+
379
+ if (type === 'cpf') {
380
+ if (onlyDigits.length !== 11) return value;
381
+ return onlyDigits.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4');
382
+ }
383
+
384
+ if (type === 'rg') {
385
+ if (onlyDigits.length < 7 || onlyDigits.length > 9) return value;
386
+ return onlyDigits.replace(/^(\d{1,2})(\d{3})(\d{3})(\d?)$/, (match, p1, p2, p3, p4) => {
387
+ let formatted = `${p1}.${p2}.${p3}`;
388
+ if (p4) formatted += `-${p4}`;
389
+ return formatted;
390
+ });
391
+ }
392
+
393
+ if (type === 'birthDate') {
394
+ const parts = onlyDigits.match(/^(\d{2})(\d{2})(\d{4})$/);
395
+ if (!parts) return value;
396
+ return `${parts[1]}/${parts[2]}/${parts[3]}`;
397
+ }
398
+
399
+ return value;
400
+ },
362
401
  showMessage(message, type = 'success') {
363
402
  const Toast = swal.mixin({
364
403
  toast: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "private": false,