@stiunb/unb-lib-components 21.0.1 → 21.0.3
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.
|
@@ -17,16 +17,19 @@ import * as i2 from '@angular/material/menu';
|
|
|
17
17
|
import { MatMenuModule } from '@angular/material/menu';
|
|
18
18
|
import * as i4$1 from '@angular/material/list';
|
|
19
19
|
import { MatListModule } from '@angular/material/list';
|
|
20
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
21
20
|
import * as i9$1 from '@angular/material/card';
|
|
22
21
|
import { MatCardModule } from '@angular/material/card';
|
|
23
22
|
import { MatDividerModule } from '@angular/material/divider';
|
|
24
23
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
24
|
+
import * as i6$1 from '@angular/cdk/drag-drop';
|
|
25
|
+
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
25
26
|
import * as i6 from '@angular/forms';
|
|
26
27
|
import { FormsModule } from '@angular/forms';
|
|
27
28
|
import { NativeDateAdapter, MatNativeDateModule, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
|
28
29
|
import * as i14 from '@angular/material/datepicker';
|
|
29
30
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
31
|
+
import * as i4$2 from '@angular/material/dialog';
|
|
32
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
30
33
|
import { MatExpansionModule } from '@angular/material/expansion';
|
|
31
34
|
import * as i9 from '@angular/material/form-field';
|
|
32
35
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
@@ -43,12 +46,8 @@ import * as i11 from '@angular/material/select';
|
|
|
43
46
|
import { MatSelectModule } from '@angular/material/select';
|
|
44
47
|
import * as i1$1 from '@angular/material/snack-bar';
|
|
45
48
|
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
46
|
-
import * as i4$2 from '@angular/material/dialog';
|
|
47
|
-
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
48
49
|
import * as i1 from '@angular/common/http';
|
|
49
50
|
import { HttpHeaders, HttpParams } from '@angular/common/http';
|
|
50
|
-
import * as i6$1 from '@angular/cdk/drag-drop';
|
|
51
|
-
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
52
51
|
|
|
53
52
|
class UnbMensagemModel {
|
|
54
53
|
}
|
|
@@ -356,7 +355,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
356
355
|
|
|
357
356
|
class UnbUsuarioModule {
|
|
358
357
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbUsuarioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
359
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: UnbUsuarioModule, declarations: [UnbUsuarioComponent], imports: [
|
|
358
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: UnbUsuarioModule, declarations: [UnbUsuarioComponent], imports: [CommonModule,
|
|
360
359
|
MatToolbarModule,
|
|
361
360
|
MatSidenavModule,
|
|
362
361
|
LayoutModule,
|
|
@@ -368,7 +367,7 @@ class UnbUsuarioModule {
|
|
|
368
367
|
MatTooltipModule,
|
|
369
368
|
MatMenuModule,
|
|
370
369
|
MatDividerModule], exports: [UnbUsuarioComponent] }); }
|
|
371
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbUsuarioModule, providers: [UnbAuthService], imports: [
|
|
370
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbUsuarioModule, providers: [UnbAuthService], imports: [CommonModule,
|
|
372
371
|
MatToolbarModule,
|
|
373
372
|
MatSidenavModule,
|
|
374
373
|
LayoutModule,
|
|
@@ -386,7 +385,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
386
385
|
args: [{
|
|
387
386
|
declarations: [UnbUsuarioComponent],
|
|
388
387
|
imports: [
|
|
389
|
-
|
|
388
|
+
CommonModule,
|
|
390
389
|
MatToolbarModule,
|
|
391
390
|
MatSidenavModule,
|
|
392
391
|
LayoutModule,
|
|
@@ -406,7 +405,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
406
405
|
|
|
407
406
|
class UnbNavBarModule {
|
|
408
407
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbNavBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
409
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: UnbNavBarModule, declarations: [UnbNavBarComponent], imports: [
|
|
408
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: UnbNavBarModule, declarations: [UnbNavBarComponent], imports: [CommonModule,
|
|
410
409
|
MatToolbarModule,
|
|
411
410
|
MatSidenavModule,
|
|
412
411
|
LayoutModule,
|
|
@@ -415,7 +414,7 @@ class UnbNavBarModule {
|
|
|
415
414
|
MatButtonModule,
|
|
416
415
|
UnbUsuarioModule,
|
|
417
416
|
MatCardModule], exports: [UnbNavBarComponent] }); }
|
|
418
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbNavBarModule, imports: [
|
|
417
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbNavBarModule, imports: [CommonModule,
|
|
419
418
|
MatToolbarModule,
|
|
420
419
|
MatSidenavModule,
|
|
421
420
|
LayoutModule,
|
|
@@ -430,7 +429,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
430
429
|
args: [{
|
|
431
430
|
declarations: [UnbNavBarComponent],
|
|
432
431
|
imports: [
|
|
433
|
-
|
|
432
|
+
CommonModule,
|
|
434
433
|
MatToolbarModule,
|
|
435
434
|
MatSidenavModule,
|
|
436
435
|
LayoutModule,
|
|
@@ -444,11 +443,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
444
443
|
}]
|
|
445
444
|
}] });
|
|
446
445
|
|
|
447
|
-
class UnbPessoaEmail {
|
|
448
|
-
}
|
|
449
|
-
class UnbPessoaEmailTipo {
|
|
450
|
-
}
|
|
451
|
-
|
|
452
446
|
/**
|
|
453
447
|
* Essa eh uma classe base, com propriedades comum a todas as outras pessoas.
|
|
454
448
|
* */
|
|
@@ -463,6 +457,79 @@ var UnbTipoPessoaEnum;
|
|
|
463
457
|
UnbTipoPessoaEnum["ESTRANGEIRA"] = "ESTRANGEIRA";
|
|
464
458
|
})(UnbTipoPessoaEnum || (UnbTipoPessoaEnum = {}));
|
|
465
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Essa eh uma classe base, com propriedades comum ao componente de pesquisa de pesssoa. Porque tem vários campos que são usados para configurar o comportamento do componente.
|
|
462
|
+
* */
|
|
463
|
+
class UnbPessoaPesquisaConfig {
|
|
464
|
+
// Construtor opcional para facilitar a criação (atalho)
|
|
465
|
+
constructor(init) {
|
|
466
|
+
this.backendURL = "";
|
|
467
|
+
this.token = ""; // usado para testar autenticação no backend se necessário.
|
|
468
|
+
// Flags com valores padrão (já resolve o booleano)
|
|
469
|
+
this.defaultTipoPessoa = UnbTipoPessoaEnum.FISICA;
|
|
470
|
+
this.pesquisarPorCPF = true;
|
|
471
|
+
this.pesquisarPorCNPJ = true;
|
|
472
|
+
this.pesquisarPorEstrangeiro = false;
|
|
473
|
+
// UI
|
|
474
|
+
this.mostrarPesquisa = true;
|
|
475
|
+
this.limparAposPesquisa = false;
|
|
476
|
+
// Textos
|
|
477
|
+
this.label = "Digite o CPF/CNPJ ou Passaporte";
|
|
478
|
+
this.placeholder = "";
|
|
479
|
+
this.hint = "";
|
|
480
|
+
Object.assign(this, init);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
class UnbPessoaFormConfig {
|
|
484
|
+
constructor(init) {
|
|
485
|
+
this.backendURL = "";
|
|
486
|
+
this.token = "";
|
|
487
|
+
this.isReadyOnly = false;
|
|
488
|
+
this.pessoa = new UnbPessoaModel();
|
|
489
|
+
Object.assign(this, init);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const listaEstados = [
|
|
494
|
+
{ codigo: 1, identificador: 'AC', descricao: "Acre" },
|
|
495
|
+
{ codigo: 2, identificador: 'AL', descricao: "Alagoas" },
|
|
496
|
+
{ codigo: 3, identificador: 'AM', descricao: "Amazonas" },
|
|
497
|
+
{ codigo: 4, identificador: 'AP', descricao: "Amapá" },
|
|
498
|
+
{ codigo: 5, identificador: 'BA', descricao: "Bahia" },
|
|
499
|
+
{ codigo: 6, identificador: 'CE', descricao: "Ceará" },
|
|
500
|
+
{ codigo: 7, identificador: 'DF', descricao: "Distrito Federal" },
|
|
501
|
+
{ codigo: 8, identificador: 'ES', descricao: "Espírito Santo" },
|
|
502
|
+
{ codigo: 9, identificador: 'GO', descricao: "Goiás" },
|
|
503
|
+
{ codigo: 10, identificador: 'MA', descricao: "Maranhão" },
|
|
504
|
+
{ codigo: 11, identificador: 'MG', descricao: "Minas Gerais" },
|
|
505
|
+
{ codigo: 12, identificador: 'MS', descricao: "Mato Grosso do Sul" },
|
|
506
|
+
{ codigo: 13, identificador: 'MT', descricao: "Mato Grosso" },
|
|
507
|
+
{ codigo: 14, identificador: 'PA', descricao: "Pará" },
|
|
508
|
+
{ codigo: 15, identificador: 'PB', descricao: "Paraíba" },
|
|
509
|
+
{ codigo: 16, identificador: 'PE', descricao: "Pernambuco" },
|
|
510
|
+
{ codigo: 17, identificador: 'PI', descricao: "Piauí" },
|
|
511
|
+
{ codigo: 18, identificador: 'PR', descricao: "Paraná" },
|
|
512
|
+
{ codigo: 19, identificador: 'RJ', descricao: "Rio de Janeiro" },
|
|
513
|
+
{ codigo: 20, identificador: 'RN', descricao: "Rio Grande do Norte" },
|
|
514
|
+
{ codigo: 21, identificador: 'RO', descricao: "Rondônia" },
|
|
515
|
+
{ codigo: 22, identificador: 'RR', descricao: "Roraima" },
|
|
516
|
+
{ codigo: 23, identificador: 'RS', descricao: "Rio Grande do Sul" },
|
|
517
|
+
{ codigo: 24, identificador: 'SC', descricao: "Santa Catarina" },
|
|
518
|
+
{ codigo: 25, identificador: 'SE', descricao: "Sergipe" },
|
|
519
|
+
{ codigo: 26, identificador: 'SP', descricao: "São Paulo" },
|
|
520
|
+
{ codigo: 27, identificador: 'TO', descricao: "Tocantins" }
|
|
521
|
+
];
|
|
522
|
+
|
|
523
|
+
class UnbPessoaEmail {
|
|
524
|
+
}
|
|
525
|
+
class UnbPessoaEmailTipo {
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
class UnbPessoaEndereco {
|
|
529
|
+
}
|
|
530
|
+
class UnbPessoaEnderecoTipo {
|
|
531
|
+
}
|
|
532
|
+
|
|
466
533
|
class UnbUtils {
|
|
467
534
|
removeNull(key, value) {
|
|
468
535
|
// Filtering out properties
|
|
@@ -1098,49 +1165,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
1098
1165
|
}]
|
|
1099
1166
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
1100
1167
|
|
|
1101
|
-
class
|
|
1168
|
+
class UnbPessoaTelefone {
|
|
1169
|
+
constructor() {
|
|
1170
|
+
// usado pelo componente unb-pesoa-form, pra indicar que o usuario estah editando
|
|
1171
|
+
this.modoEdicao = false;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
class UnbPessoaTelefoneTipo {
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
class UnbPessoaTelefoneFormComponent {
|
|
1102
1178
|
constructor(snackBar, service, alertService, dialogRef, data) {
|
|
1103
1179
|
this.snackBar = snackBar;
|
|
1104
1180
|
this.service = service;
|
|
1105
1181
|
this.alertService = alertService;
|
|
1106
1182
|
this.dialogRef = dialogRef;
|
|
1107
1183
|
this.data = data;
|
|
1108
|
-
this.
|
|
1109
|
-
this.
|
|
1110
|
-
this.idMensagemService = "
|
|
1111
|
-
this.
|
|
1184
|
+
this.telefone = new UnbPessoaTelefone();
|
|
1185
|
+
this.listaTipoTelefone = [];
|
|
1186
|
+
this.idMensagemService = "UnbPessoaTelefoneForm";
|
|
1187
|
+
this.telefone = JSON.parse(JSON.stringify(data.telefone)); // O e-mail específico para edição
|
|
1112
1188
|
// Verifique se a lista de e-mails foi passada e atribua-a
|
|
1113
|
-
if (data.
|
|
1114
|
-
this.
|
|
1189
|
+
if (data.telefonesList) {
|
|
1190
|
+
this.telefonesList = JSON.parse(JSON.stringify(data.telefonesList)); // Faça uma cópia profunda se for manipular
|
|
1115
1191
|
}
|
|
1116
1192
|
else {
|
|
1117
|
-
this.
|
|
1193
|
+
this.telefonesList = []; // Inicialize como vazio se não for passada
|
|
1118
1194
|
}
|
|
1119
|
-
if (!this.
|
|
1120
|
-
this.
|
|
1195
|
+
if (!this.telefone) {
|
|
1196
|
+
this.telefone = new UnbPessoaTelefone();
|
|
1121
1197
|
}
|
|
1122
1198
|
}
|
|
1123
1199
|
ngOnInit() {
|
|
1124
|
-
|
|
1125
|
-
this.service.getTipoEmail().subscribe({
|
|
1200
|
+
this.service.getTipoTelefone().subscribe({
|
|
1126
1201
|
next: (lista) => {
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
const tipoEncontrado = lista.find(t => t.codigo === this.email.tipoEmailCodigo);
|
|
1202
|
+
this.listaTipoTelefone = lista;
|
|
1203
|
+
// Se já tiver tipoTelefoneCodigo, preenche o nome correspondente
|
|
1204
|
+
if (this.telefone.tipoTelefoneCodigo != null) {
|
|
1205
|
+
const tipoEncontrado = lista.find(t => t.codigo === this.telefone.tipoTelefoneCodigo);
|
|
1132
1206
|
if (tipoEncontrado) {
|
|
1133
|
-
this.
|
|
1207
|
+
this.telefone.tipo = tipoEncontrado.denominacao;
|
|
1134
1208
|
}
|
|
1135
1209
|
}
|
|
1136
|
-
else if (this.
|
|
1137
|
-
const tipoEncontrado = lista.find(t => t.denominacao?.toLowerCase() === this.
|
|
1210
|
+
else if (this.telefone.tipo) {
|
|
1211
|
+
const tipoEncontrado = lista.find(t => t.denominacao?.toLowerCase() === this.telefone.tipo?.toLowerCase());
|
|
1138
1212
|
if (tipoEncontrado) {
|
|
1139
|
-
this.
|
|
1213
|
+
this.telefone.tipoTelefoneCodigo = tipoEncontrado.codigo;
|
|
1140
1214
|
}
|
|
1141
1215
|
}
|
|
1142
1216
|
},
|
|
1143
|
-
// 3. Usa seu tratamento de erro novo
|
|
1144
1217
|
error: (err) => this.handleError(err)
|
|
1145
1218
|
});
|
|
1146
1219
|
}
|
|
@@ -1149,75 +1222,86 @@ class UnbPessoaEmailFormComponent {
|
|
|
1149
1222
|
this.openSnackBar('Existem erros no formulário, por favor, verificar.');
|
|
1150
1223
|
return;
|
|
1151
1224
|
}
|
|
1152
|
-
// 1. Define o 'tipo' padrão (
|
|
1153
|
-
if (!this.
|
|
1154
|
-
this.
|
|
1225
|
+
// 1. Define o 'tipo' padrão (1) se não for preenchido (Conforme sua solicitação)
|
|
1226
|
+
if (!this.telefone.tipoTelefoneCodigo) {
|
|
1227
|
+
this.telefone.tipoTelefoneCodigo = 1; // 1 é geralmente 'Residencial' ou 'Principal'
|
|
1155
1228
|
}
|
|
1156
|
-
// 2. Define a 'ordem' (que o back-end chama de '
|
|
1157
|
-
if (!this.
|
|
1229
|
+
// 2. Define a 'ordem' (que o back-end chama de 'ordemTelefone')
|
|
1230
|
+
if (!this.telefone.ordem || this.telefone.ordem === 0) {
|
|
1158
1231
|
let maxOrdem = 0;
|
|
1159
|
-
// Verifica se a lista de
|
|
1160
|
-
if (this.
|
|
1161
|
-
maxOrdem = Math.max(...this.
|
|
1232
|
+
// Verifica se a lista de telefones já existe e tem itens
|
|
1233
|
+
if (this.telefonesList && this.telefonesList.length > 0) {
|
|
1234
|
+
maxOrdem = Math.max(...this.telefonesList.map(t => t.ordem || 0));
|
|
1162
1235
|
}
|
|
1163
|
-
// Define a ordem do novo
|
|
1164
|
-
this.
|
|
1236
|
+
// Define a ordem do novo telefone como a maior ordem + 1
|
|
1237
|
+
this.telefone.ordem = maxOrdem + 1;
|
|
1165
1238
|
}
|
|
1166
|
-
|
|
1167
|
-
if (this.validar(this.email) == false)
|
|
1239
|
+
if (this.validar(this.telefone) == false)
|
|
1168
1240
|
return;
|
|
1169
|
-
this.
|
|
1241
|
+
this.telefoneSalvo = this.telefone;
|
|
1170
1242
|
this.salvarclose();
|
|
1171
1243
|
}
|
|
1172
1244
|
compararTipos(t1, t2) {
|
|
1173
1245
|
return t1 && t2 && t1 === t2;
|
|
1174
1246
|
}
|
|
1175
1247
|
onTipoSelecionado(codigoSelecionado) {
|
|
1176
|
-
const tipoSelecionado = this.
|
|
1248
|
+
const tipoSelecionado = this.listaTipoTelefone.find(t => t.codigo === codigoSelecionado); // <--- Renomeado de listaTipoEndereco
|
|
1177
1249
|
if (tipoSelecionado) {
|
|
1178
|
-
this.
|
|
1250
|
+
this.telefone.tipo = tipoSelecionado.denominacao;
|
|
1179
1251
|
}
|
|
1180
1252
|
}
|
|
1181
1253
|
/**
|
|
1182
|
-
* Valida o objeto de
|
|
1183
|
-
* Retorna true se o
|
|
1254
|
+
* Valida o objeto de telefone com base nas regras do backend.
|
|
1255
|
+
* Retorna true se o telefone for válido, false caso contrário.
|
|
1184
1256
|
*/
|
|
1185
|
-
validar(
|
|
1186
|
-
// 1. Validação de
|
|
1187
|
-
if (!
|
|
1188
|
-
this.openSnackBar("
|
|
1257
|
+
validar(telefoneToValidate) {
|
|
1258
|
+
// 1. Validação de Número (Obrigatório)
|
|
1259
|
+
if (!telefoneToValidate.numero || telefoneToValidate.numero.trim() === '') {
|
|
1260
|
+
this.openSnackBar("Número do telefone é um campo obrigatório.");
|
|
1189
1261
|
return false;
|
|
1190
1262
|
}
|
|
1191
|
-
// 2. Validação de
|
|
1192
|
-
|
|
1193
|
-
|
|
1263
|
+
// 2. Validação de Número (Formato)
|
|
1264
|
+
// que ele espera 8 ou 9 dígitos numéricos (padrão Brasil).
|
|
1265
|
+
const numeroLimpo = telefoneToValidate.numero.replace(/\D/g, ''); // Remove não-dígitos
|
|
1266
|
+
if (numeroLimpo.length !== 9) {
|
|
1267
|
+
this.openSnackBar("Número do telefone deve conter exatamente 9 dígitos.");
|
|
1194
1268
|
return false;
|
|
1195
1269
|
}
|
|
1196
|
-
// 3. Validação de
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
if (!emailRegex.test(emailToValidate.email)) {
|
|
1200
|
-
this.openSnackBar("Digite um E-mail válido.");
|
|
1270
|
+
// 3. Validação de DDD (Obrigatório - Boa prática, embora o Java não exija)
|
|
1271
|
+
if (!telefoneToValidate.ddd || telefoneToValidate.ddd.trim() === '') {
|
|
1272
|
+
this.openSnackBar("DDD é um campo obrigatório.");
|
|
1201
1273
|
return false;
|
|
1202
1274
|
}
|
|
1203
|
-
// 4. Validação de
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1275
|
+
// 4. Validação de DDD (Tamanho Máximo)
|
|
1276
|
+
if (telefoneToValidate.ddd.trim().length > 3) {
|
|
1277
|
+
this.openSnackBar("DDD deve ter no máximo 3 caracteres.");
|
|
1278
|
+
return false;
|
|
1279
|
+
}
|
|
1280
|
+
// 5. Validação de DDI (Tamanho Máximo)
|
|
1281
|
+
//
|
|
1282
|
+
if (telefoneToValidate.ddi && telefoneToValidate.ddi.trim().length > 5) {
|
|
1283
|
+
this.openSnackBar("DDI deve ter no máximo 5 caracteres.");
|
|
1284
|
+
return false;
|
|
1285
|
+
}
|
|
1286
|
+
// 6. Validação de Ramal (Tamanho Máximo)
|
|
1287
|
+
//
|
|
1288
|
+
if (telefoneToValidate.ramal && telefoneToValidate.ramal.trim().length > 6) {
|
|
1289
|
+
this.openSnackBar("Ramal deve ter no máximo 6 caracteres.");
|
|
1290
|
+
return false;
|
|
1291
|
+
}
|
|
1292
|
+
// 7. Validação de NomeResponsavel (Tamanho Máximo)
|
|
1293
|
+
//
|
|
1294
|
+
if (telefoneToValidate.nomeResponsavel && telefoneToValidate.nomeResponsavel.trim().length > 100) {
|
|
1295
|
+
this.openSnackBar("Nome do Responsável deve ter no máximo 100 caracteres.");
|
|
1209
1296
|
return false;
|
|
1210
1297
|
}
|
|
1211
|
-
// Nota: As validações de 'ordemEmail' e 'tipoEmailCodigo' do Java
|
|
1212
|
-
// já são tratadas na sua função 'salvar()',
|
|
1213
|
-
// que atribui valores padrão antes desta função 'validar()' ser chamada.
|
|
1214
1298
|
return true; // Passou em todas as validações!
|
|
1215
1299
|
}
|
|
1216
1300
|
close() {
|
|
1217
1301
|
this.dialogRef.close(null);
|
|
1218
1302
|
}
|
|
1219
1303
|
salvarclose() {
|
|
1220
|
-
this.dialogRef.close(this.
|
|
1304
|
+
this.dialogRef.close(this.telefoneSalvo);
|
|
1221
1305
|
}
|
|
1222
1306
|
handleError(erro) {
|
|
1223
1307
|
let erroTratado;
|
|
@@ -1246,38 +1330,192 @@ class UnbPessoaEmailFormComponent {
|
|
|
1246
1330
|
duration: 5000,
|
|
1247
1331
|
});
|
|
1248
1332
|
}
|
|
1249
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
1250
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type:
|
|
1333
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaTelefoneFormComponent, deps: [{ token: i1$1.MatSnackBar }, { token: UnBPessoaService }, { token: UnbMensagemService }, { token: i4$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1334
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaTelefoneFormComponent, isStandalone: false, selector: "lib-unb-pessoa-telefone-form", ngImport: i0, template: "<h1 mat-dialog-title>Cadastro de Telefone</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"telefone.tipoTelefoneCodigo\" [compareWith]=\"compararTipos\" name=\"tipoTelefoneCodigo\" (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoTelefone\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>DDD</mat-label>\r\n <input type=\"text\" maxlength=\"3\" required matInput [(ngModel)]=\"telefone.ddd\" name=\"dddValue\" #dddValue=\"ngModel\" />\r\n </mat-form-field> \r\n \r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>N\u00FAmero</mat-label>\r\n <input type=\"text\" required maxlength=\"9\" matInput [(ngModel)]=\"telefone.numero\" name=\"telefoneValue\" #telefoneValue=\"ngModel\" />\r\n </mat-form-field>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i6.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UnbMensagemComponent, selector: "unb-mensagem", inputs: ["mensagem", "tipo", "identificador"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i4$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i11.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] }); }
|
|
1251
1335
|
}
|
|
1252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
1336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaTelefoneFormComponent, decorators: [{
|
|
1253
1337
|
type: Component,
|
|
1254
|
-
args: [{ standalone: false, selector: 'lib-unb-pessoa-
|
|
1338
|
+
args: [{ standalone: false, selector: 'lib-unb-pessoa-telefone-form', template: "<h1 mat-dialog-title>Cadastro de Telefone</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"telefone.tipoTelefoneCodigo\" [compareWith]=\"compararTipos\" name=\"tipoTelefoneCodigo\" (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoTelefone\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>DDD</mat-label>\r\n <input type=\"text\" maxlength=\"3\" required matInput [(ngModel)]=\"telefone.ddd\" name=\"dddValue\" #dddValue=\"ngModel\" />\r\n </mat-form-field> \r\n \r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>N\u00FAmero</mat-label>\r\n <input type=\"text\" required maxlength=\"9\" matInput [(ngModel)]=\"telefone.numero\" name=\"telefoneValue\" #telefoneValue=\"ngModel\" />\r\n </mat-form-field>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"] }]
|
|
1255
1339
|
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: UnbMensagemService }, { type: i4$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
1256
1340
|
type: Inject,
|
|
1257
1341
|
args: [MAT_DIALOG_DATA]
|
|
1258
1342
|
}] }] });
|
|
1259
1343
|
|
|
1260
|
-
class
|
|
1261
|
-
|
|
1262
|
-
class UnbPessoaEnderecoTipo {
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
class UnbPessoaEnderecoFormComponent {
|
|
1266
|
-
constructor(snackBar, service, alertService, dialogRef, data) {
|
|
1344
|
+
class UnbPessoaTelefoneListComponent {
|
|
1345
|
+
constructor(snackBar, service, dialog) {
|
|
1267
1346
|
this.snackBar = snackBar;
|
|
1268
1347
|
this.service = service;
|
|
1269
|
-
this.
|
|
1270
|
-
this.
|
|
1271
|
-
this.
|
|
1272
|
-
this.
|
|
1273
|
-
this.
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
this.
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1348
|
+
this.dialog = dialog;
|
|
1349
|
+
this.podeEditar = true;
|
|
1350
|
+
this.telefones = [];
|
|
1351
|
+
this.backendURL = '';
|
|
1352
|
+
this.telefonesEmitted = new EventEmitter();
|
|
1353
|
+
}
|
|
1354
|
+
ngOnInit() {
|
|
1355
|
+
this.tipoTelefone = this.service.getTipoTelefone();
|
|
1356
|
+
}
|
|
1357
|
+
// tem que fazer isso pq no on init eu ainda nao tenho a lista de telefones
|
|
1358
|
+
ngOnChanges(changes) {
|
|
1359
|
+
// Verifica se a propriedade 'telefones' mudou
|
|
1360
|
+
if (changes['telefones'] && this.telefones) {
|
|
1361
|
+
// chamada quando os dados realmente chegarem
|
|
1362
|
+
this.sortAndAssignOrder();
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
excluir(telefoneParaExcluir) {
|
|
1366
|
+
if (telefoneParaExcluir.codigo) {
|
|
1367
|
+
// Se tem código, remove por ele (mais seguro)
|
|
1368
|
+
this.telefones = this.telefones.filter(t => t.codigo !== telefoneParaExcluir.codigo);
|
|
1369
|
+
}
|
|
1370
|
+
else {
|
|
1371
|
+
// Se não tem código (novo item), remove pela ordem
|
|
1372
|
+
this.telefones = this.telefones.filter(t => t.ordem !== telefoneParaExcluir.ordem);
|
|
1373
|
+
}
|
|
1374
|
+
// Chama função existente que re-calcula as ordens e emite a lista atualizada
|
|
1375
|
+
this.atualizarOrdem();
|
|
1376
|
+
this.telefonesEmitted.emit(this.telefones);
|
|
1377
|
+
}
|
|
1378
|
+
editar(telefone) {
|
|
1379
|
+
this.openFormDialog(telefone);
|
|
1380
|
+
}
|
|
1381
|
+
atualizarOrdem() {
|
|
1382
|
+
this.telefones.forEach((telefone, idx) => {
|
|
1383
|
+
telefone.ordem = idx + 1;
|
|
1384
|
+
});
|
|
1385
|
+
// reemite a lista atualizada, igual antes
|
|
1386
|
+
this.telefonesEmitted.emit(this.telefones);
|
|
1387
|
+
}
|
|
1388
|
+
openFormDialog(toEdit) {
|
|
1389
|
+
const dialogRef = this.dialog.open(UnbPessoaTelefoneFormComponent, {
|
|
1390
|
+
width: '900px',
|
|
1391
|
+
data: {
|
|
1392
|
+
telefone: toEdit, // E-mail a ser editado ou vazio para novo
|
|
1393
|
+
telefonesList: this.telefones // A sua lista COMPLETA de e-mails
|
|
1394
|
+
},
|
|
1395
|
+
});
|
|
1396
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
1397
|
+
if (!result) {
|
|
1398
|
+
return; // Usuário clicou em 'Fechar' ou 'Cancelar'
|
|
1399
|
+
}
|
|
1400
|
+
// 'result' é o objeto retornado pelo dialog (editado ou novo)
|
|
1401
|
+
let index = -1;
|
|
1402
|
+
// 1. Tenta encontrar pelo 'codigo' (para itens que já vieram do banco)
|
|
1403
|
+
if (result.codigo) {
|
|
1404
|
+
index = this.telefones.findIndex(t => t.codigo === result.codigo);
|
|
1405
|
+
}
|
|
1406
|
+
// 2. Se não achou pelo 'codigo', tenta pela 'ordem'.
|
|
1407
|
+
// A 'ordem' é o nosso identificador único para itens que
|
|
1408
|
+
// ainda não foram salvos no banco (criados/editados localmente).
|
|
1409
|
+
if (index === -1 && result.ordem) {
|
|
1410
|
+
index = this.telefones.findIndex(t => t.ordem === result.ordem);
|
|
1411
|
+
}
|
|
1412
|
+
if (index > -1) {
|
|
1413
|
+
// ENCONTROU (pelo 'codigo' ou pela 'ordem'): Atualiza o item existente
|
|
1414
|
+
this.telefones[index] = result;
|
|
1415
|
+
}
|
|
1416
|
+
else {
|
|
1417
|
+
// NÃO ENCONTROU: É um item 100% novo (não uma edição)
|
|
1418
|
+
// O form (unb-pessoa-telefone-form) já cuidou de
|
|
1419
|
+
// atribuir a 'ordem' correta (maxOrdem + 1)
|
|
1420
|
+
this.telefones.push(result);
|
|
1421
|
+
}
|
|
1422
|
+
// vamos apenas re-ordenar a lista pela 'ordem' que já temos
|
|
1423
|
+
// e depois emitir.
|
|
1424
|
+
this.telefones.sort((a, b) => (a.ordem ?? 0) - (b.ordem ?? 0));
|
|
1425
|
+
this.telefonesEmitted.emit(this.telefones);
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
moverTelefone(event) {
|
|
1429
|
+
// troca a posição dentro do array
|
|
1430
|
+
moveItemInArray(this.telefones, event.previousIndex, event.currentIndex);
|
|
1431
|
+
// atualiza o campo 'ordem' em cada item
|
|
1432
|
+
this.atualizarOrdem();
|
|
1433
|
+
}
|
|
1434
|
+
sortAndAssignOrder() {
|
|
1435
|
+
// 1. Crie uma cópia da lista para não modificar a original durante a iteração inicial
|
|
1436
|
+
const tempEmails = [...this.telefones];
|
|
1437
|
+
// 2. Mapeie as ordens existentes para identificar duplicatas e ausentes
|
|
1438
|
+
const orderMap = new Map();
|
|
1439
|
+
const emailsWithoutOrder = [];
|
|
1440
|
+
tempEmails.forEach(telefone => {
|
|
1441
|
+
if (telefone.ordem !== undefined && telefone.ordem !== null) {
|
|
1442
|
+
if (!orderMap.has(telefone.ordem)) {
|
|
1443
|
+
orderMap.set(telefone.ordem, []);
|
|
1444
|
+
}
|
|
1445
|
+
orderMap.get(telefone.ordem)?.push(telefone);
|
|
1446
|
+
}
|
|
1447
|
+
else {
|
|
1448
|
+
emailsWithoutOrder.push(telefone);
|
|
1449
|
+
}
|
|
1450
|
+
});
|
|
1451
|
+
// 3. Inicialize um Set para rastrear todas as ordens que serão usadas no final
|
|
1452
|
+
const finalUsedOrders = new Set();
|
|
1453
|
+
// Inicialize o próximo valor de ordem disponível
|
|
1454
|
+
let nextAvailableOrder = 0;
|
|
1455
|
+
// Função auxiliar para encontrar a próxima ordem disponível
|
|
1456
|
+
const getNextAvailableOrder = () => {
|
|
1457
|
+
while (finalUsedOrders.has(nextAvailableOrder)) {
|
|
1458
|
+
nextAvailableOrder++;
|
|
1459
|
+
}
|
|
1460
|
+
return nextAvailableOrder++;
|
|
1461
|
+
};
|
|
1462
|
+
// 4. Processe telefones com ordem definida:
|
|
1463
|
+
// - A primeira ocorrência de uma ordem a mantém.
|
|
1464
|
+
// - Duplicatas recebem uma nova ordem.
|
|
1465
|
+
// - Adicione as ordens válidas ao finalUsedOrders.
|
|
1466
|
+
this.telefones.forEach(telefone => {
|
|
1467
|
+
if (telefone.ordem !== undefined && telefone.ordem !== null) {
|
|
1468
|
+
if (!finalUsedOrders.has(telefone.ordem)) {
|
|
1469
|
+
// Se a ordem ainda não foi usada, use-a e adicione ao set
|
|
1470
|
+
finalUsedOrders.add(telefone.ordem);
|
|
1471
|
+
}
|
|
1472
|
+
else {
|
|
1473
|
+
// Se a ordem já foi usada (é uma duplicata), atribua uma nova
|
|
1474
|
+
telefone.ordem = getNextAvailableOrder();
|
|
1475
|
+
finalUsedOrders.add(telefone.ordem); // Adiciona a nova ordem ao set
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
// 5. Atribua ordens para telefones que não tinham ordem definida
|
|
1480
|
+
emailsWithoutOrder.forEach(telefone => {
|
|
1481
|
+
telefone.ordem = getNextAvailableOrder();
|
|
1482
|
+
finalUsedOrders.add(telefone.ordem); // Adiciona a nova ordem ao set
|
|
1483
|
+
});
|
|
1484
|
+
// 6. Finalmente, ordene a lista completa com as ordens agora únicas
|
|
1485
|
+
this.telefones.sort((a, b) => (a.ordem ?? 0) - (b.ordem ?? 0));
|
|
1486
|
+
}
|
|
1487
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaTelefoneListComponent, deps: [{ token: i1$1.MatSnackBar }, { token: UnBPessoaService }, { token: i4$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1488
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaTelefoneListComponent, isStandalone: false, selector: "lib-unb-pessoa-telefone-list", inputs: { podeEditar: "podeEditar", telefones: "telefones", backendURL: "backendURL" }, outputs: { telefonesEmitted: "telefonesEmitted" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"mes-container\">\r\n <div class=\"header-container\">\r\n <div class=\"mes-header\">\r\n <span class=\"titulo\">\r\n {{ telefones?.length === 1 ? 'Telefone Cadastrado' : 'Telefones Cadastrados' }}\r\n </span>\r\n <span class=\"titulo\">({{ telefones?.length || 0 }})</span>\r\n </div>\r\n\r\n <button type=\"button\" matTooltip=\"Novo Telefone\" mat-flat-button color=\"primary\" (click)=\"openFormDialog(null)\">\r\n Cadastrar Novo Telefone\r\n </button>\r\n </div>\r\n\r\n\r\n <!-- Exibe a tabela de despesas somente se houver despesas -->\r\n <table class=\"my-table\" *ngIf=\"telefones && telefones.length > 0\" cdkDropList (cdkDropListDropped)=\"moverTelefone($event)\">\r\n <tr style=\"background-color: #e4e3e3cc;\">\r\n <th style=\"width: 5%; text-align: center;\">Ordem</th>\r\n <th style=\"width: 20%;\">DDD</th>\r\n <th>N\u00FAmero</th> \r\n <th>Tipo</th>\r\n <th style=\"width: 1%; text-align: center;\">A\u00E7\u00F5es</th>\r\n </tr>\r\n\r\n <tr *ngFor=\"let valor of telefones; let i = index\" class=\"my-tr\" cdkDrag>\r\n <td style=\"text-align: center;\"> \r\n <div class=\"drag-cell\" cdkDragHandle>\r\n <mat-icon>drag_indicator</mat-icon>\r\n <span>{{ i + 1 }}</span>\r\n </div>\r\n </td>\r\n <td>{{ valor.ddd }}</td> \r\n <td>{{ valor.numero }}</td> \r\n <td>{{ valor.tipo?.toUpperCase() }}</td>\r\n <td>\r\n <div class=\"actions-container\">\r\n <button type=\"button\" mat-icon-button color=\"primary\" (click)=\"editar(valor)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button type=\"button\" mat-icon-button color=\"warn\" (click)=\"excluir(valor)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n </div>\r\n </td>\r\n </tr>\r\n</table>\r\n</div>", styles: [".mes-container{padding:12px;margin-bottom:2px;border-radius:8px;box-shadow:0 2px 6px #0000001a;transition:background-color .3s ease,box-shadow .3s ease}.mes-container:nth-child(2n){background-color:#f9f9fc}.mes-container:nth-child(odd){background-color:#fff}.mes-container:hover{background-color:#f0f0f5;box-shadow:0 4px 8px #00000026}.header-container{display:flex;align-items:center;margin-bottom:2px}.header-container button{margin-left:auto}.mes-header{display:flex;align-items:center;gap:6px;font-size:1.2rem;font-weight:700;color:#333}.my-table{width:100%;border-collapse:collapse;border-radius:8px;overflow:hidden;box-shadow:0 4px 8px #0000001a;font-family:Arial,sans-serif}.my-table th,.my-table td{padding:5px;text-align:left;border-bottom:1px solid #ddd}.my-table th{background-color:#005dbb7b;color:#fff;font-weight:700}.my-table tr{transition:background-color .3s ease}.my-table tr:hover{background-color:#f1f1f1}.my-table td{background-color:#fff}.my-table td button{transition:transform .2s ease}.my-table td button:hover{transform:scale(1.1)}.my-table td:last-child{text-align:center}.order-input{width:40px;text-align:center;border:1px solid #ccc;border-radius:4px;padding:2px}.order-input:focus{border-color:#1976d2;outline:none}.drag-cell{display:inline-flex;align-items:center;justify-content:center;gap:4px;cursor:grab;-webkit-user-select:none;user-select:none}.drag-cell mat-icon{font-size:18px;line-height:1;vertical-align:middle}.cdk-drag-preview{background:#fff;border-radius:6px;box-shadow:0 4px 12px #0003;display:table;border-collapse:collapse}.cdk-drag-placeholder{opacity:0;display:table-row}.cdk-drag-animating{transition:transform .2s cubic-bezier(0,0,.2,1)}table[cdkDropList] tr{border-bottom:1px solid #e0e0e0}table[cdkDropList] td{padding:8px}.actions-container{display:flex;justify-content:flex-end;gap:4px}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i6$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i6$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i7.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }] }); }
|
|
1489
|
+
}
|
|
1490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaTelefoneListComponent, decorators: [{
|
|
1491
|
+
type: Component,
|
|
1492
|
+
args: [{ standalone: false, selector: 'lib-unb-pessoa-telefone-list', template: "<div class=\"mes-container\">\r\n <div class=\"header-container\">\r\n <div class=\"mes-header\">\r\n <span class=\"titulo\">\r\n {{ telefones?.length === 1 ? 'Telefone Cadastrado' : 'Telefones Cadastrados' }}\r\n </span>\r\n <span class=\"titulo\">({{ telefones?.length || 0 }})</span>\r\n </div>\r\n\r\n <button type=\"button\" matTooltip=\"Novo Telefone\" mat-flat-button color=\"primary\" (click)=\"openFormDialog(null)\">\r\n Cadastrar Novo Telefone\r\n </button>\r\n </div>\r\n\r\n\r\n <!-- Exibe a tabela de despesas somente se houver despesas -->\r\n <table class=\"my-table\" *ngIf=\"telefones && telefones.length > 0\" cdkDropList (cdkDropListDropped)=\"moverTelefone($event)\">\r\n <tr style=\"background-color: #e4e3e3cc;\">\r\n <th style=\"width: 5%; text-align: center;\">Ordem</th>\r\n <th style=\"width: 20%;\">DDD</th>\r\n <th>N\u00FAmero</th> \r\n <th>Tipo</th>\r\n <th style=\"width: 1%; text-align: center;\">A\u00E7\u00F5es</th>\r\n </tr>\r\n\r\n <tr *ngFor=\"let valor of telefones; let i = index\" class=\"my-tr\" cdkDrag>\r\n <td style=\"text-align: center;\"> \r\n <div class=\"drag-cell\" cdkDragHandle>\r\n <mat-icon>drag_indicator</mat-icon>\r\n <span>{{ i + 1 }}</span>\r\n </div>\r\n </td>\r\n <td>{{ valor.ddd }}</td> \r\n <td>{{ valor.numero }}</td> \r\n <td>{{ valor.tipo?.toUpperCase() }}</td>\r\n <td>\r\n <div class=\"actions-container\">\r\n <button type=\"button\" mat-icon-button color=\"primary\" (click)=\"editar(valor)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button type=\"button\" mat-icon-button color=\"warn\" (click)=\"excluir(valor)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n </div>\r\n </td>\r\n </tr>\r\n</table>\r\n</div>", styles: [".mes-container{padding:12px;margin-bottom:2px;border-radius:8px;box-shadow:0 2px 6px #0000001a;transition:background-color .3s ease,box-shadow .3s ease}.mes-container:nth-child(2n){background-color:#f9f9fc}.mes-container:nth-child(odd){background-color:#fff}.mes-container:hover{background-color:#f0f0f5;box-shadow:0 4px 8px #00000026}.header-container{display:flex;align-items:center;margin-bottom:2px}.header-container button{margin-left:auto}.mes-header{display:flex;align-items:center;gap:6px;font-size:1.2rem;font-weight:700;color:#333}.my-table{width:100%;border-collapse:collapse;border-radius:8px;overflow:hidden;box-shadow:0 4px 8px #0000001a;font-family:Arial,sans-serif}.my-table th,.my-table td{padding:5px;text-align:left;border-bottom:1px solid #ddd}.my-table th{background-color:#005dbb7b;color:#fff;font-weight:700}.my-table tr{transition:background-color .3s ease}.my-table tr:hover{background-color:#f1f1f1}.my-table td{background-color:#fff}.my-table td button{transition:transform .2s ease}.my-table td button:hover{transform:scale(1.1)}.my-table td:last-child{text-align:center}.order-input{width:40px;text-align:center;border:1px solid #ccc;border-radius:4px;padding:2px}.order-input:focus{border-color:#1976d2;outline:none}.drag-cell{display:inline-flex;align-items:center;justify-content:center;gap:4px;cursor:grab;-webkit-user-select:none;user-select:none}.drag-cell mat-icon{font-size:18px;line-height:1;vertical-align:middle}.cdk-drag-preview{background:#fff;border-radius:6px;box-shadow:0 4px 12px #0003;display:table;border-collapse:collapse}.cdk-drag-placeholder{opacity:0;display:table-row}.cdk-drag-animating{transition:transform .2s cubic-bezier(0,0,.2,1)}table[cdkDropList] tr{border-bottom:1px solid #e0e0e0}table[cdkDropList] td{padding:8px}.actions-container{display:flex;justify-content:flex-end;gap:4px}\n"] }]
|
|
1493
|
+
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: i4$2.MatDialog }], propDecorators: { podeEditar: [{
|
|
1494
|
+
type: Input
|
|
1495
|
+
}], telefones: [{
|
|
1496
|
+
type: Input
|
|
1497
|
+
}], backendURL: [{
|
|
1498
|
+
type: Input
|
|
1499
|
+
}], telefonesEmitted: [{
|
|
1500
|
+
type: Output
|
|
1501
|
+
}] } });
|
|
1502
|
+
|
|
1503
|
+
class UnbPessoaEnderecoFormComponent {
|
|
1504
|
+
constructor(snackBar, service, alertService, dialogRef, data) {
|
|
1505
|
+
this.snackBar = snackBar;
|
|
1506
|
+
this.service = service;
|
|
1507
|
+
this.alertService = alertService;
|
|
1508
|
+
this.dialogRef = dialogRef;
|
|
1509
|
+
this.data = data;
|
|
1510
|
+
this.endereco = new UnbPessoaEndereco();
|
|
1511
|
+
this.listaTipoEndereco = [];
|
|
1512
|
+
this.listaPaises = [];
|
|
1513
|
+
this.loading = false;
|
|
1514
|
+
this.idMensagemService = "UnbPessoaEnderecoForm";
|
|
1515
|
+
this.endereco = JSON.parse(JSON.stringify(data.endereco)); // O e-mail específico para edição
|
|
1516
|
+
// Verifique se a lista de e-mails foi passada e atribua-a
|
|
1517
|
+
if (data.enderecosList) {
|
|
1518
|
+
this.enderecosList = JSON.parse(JSON.stringify(data.enderecosList)); // Faça uma cópia profunda se for manipular
|
|
1281
1519
|
}
|
|
1282
1520
|
else {
|
|
1283
1521
|
this.enderecosList = []; // Inicialize como vazio se não for passada
|
|
@@ -1491,440 +1729,42 @@ class UnbPessoaEnderecoFormComponent {
|
|
|
1491
1729
|
this.dialogRef.close(this.enderecoSalvo);
|
|
1492
1730
|
}
|
|
1493
1731
|
handleError(erro) {
|
|
1494
|
-
let erroTratado;
|
|
1495
|
-
// Converte string local em Objeto Padrão
|
|
1496
|
-
if (typeof erro === 'string') {
|
|
1497
|
-
erroTratado = {
|
|
1498
|
-
status: 400,
|
|
1499
|
-
mensagemSimples: erro,
|
|
1500
|
-
mensagemHtml: `<strong>${erro}</strong>`
|
|
1501
|
-
};
|
|
1502
|
-
}
|
|
1503
|
-
else {
|
|
1504
|
-
erroTratado = erro;
|
|
1505
|
-
}
|
|
1506
|
-
// 1. SnackBar
|
|
1507
|
-
if (erroTratado.mensagemSimples) {
|
|
1508
|
-
this.openSnackBar(erroTratado.mensagemSimples);
|
|
1509
|
-
}
|
|
1510
|
-
// 2. AlertService (Se houver tag <unb-mensagem> no HTML do dialog)
|
|
1511
|
-
if (this.alertService && erroTratado.mensagemHtml) {
|
|
1512
|
-
this.alertService.showMessage(erroTratado.mensagemHtml, UnbTipoMensagemEnum.DANGER, this.idMensagemService);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
openSnackBar(message) {
|
|
1516
|
-
this.snackBar.open(message, 'x', {
|
|
1517
|
-
duration: 5000,
|
|
1518
|
-
});
|
|
1519
|
-
}
|
|
1520
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaEnderecoFormComponent, deps: [{ token: i1$1.MatSnackBar }, { token: UnBPessoaService }, { token: UnbMensagemService }, { token: i4$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1521
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaEnderecoFormComponent, isStandalone: false, selector: "lib-unb-pessoa-endereco-form", ngImport: i0, template: "<h1 mat-dialog-title>Cadastro de Endere\u00E7o</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"endereco.tipoEnderecoCodigo\" name=\"tipo\" #tipo=\"ngModel\"\r\n (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoEndereco\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs</mat-label>\r\n\r\n <mat-select [(ngModel)]=\"endereco.paisEnderecoCodigo\" name=\"paisEnderecoCodigo\" #paisEnderecoCodigo=\"ngModel\">\r\n\r\n <mat-option *ngFor=\"let paises of listaPaises\" [value]=\"paises.codigo\">\r\n <span *ngIf=\"paises.denominacao === 'BRASIL'\">\uD83C\uDDE7\uD83C\uDDF7 <b>{{ paises.denominacao }}</b></span>\r\n <span *ngIf=\"paises.denominacao !== 'BRASIL'\">{{ paises.denominacao }}</span>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>CEP</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.cep\" name=\"cep\" #cep=\"ngModel\" />\r\n\r\n <button matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" \r\n [disabled]=\"loading\" (click)=\"pesquisarCep()\">\r\n \r\n <ng-container *ngIf=\"!loading; else loadingIcon\">\r\n <mat-icon style=\"margin-right: 2px;\">search</mat-icon>\r\n </ng-container>\r\n\r\n <ng-template #loadingIcon>\r\n <mat-progress-spinner \r\n [diameter]=\"20\" \r\n mode=\"indeterminate\" \r\n color=\"primary\" \r\n class=\"spinner-button\">\r\n </mat-progress-spinner>\r\n </ng-template>\r\n\r\n </button>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Endere\u00E7o</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.logradouro\" name=\"logradouro\" #logradouro=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Bairro</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.bairro\" name=\"bairro\" #bairro=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Complemento</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.complemento\" name=\"complemento\" #complemento=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>UF</mat-label>\r\n <mat-select [(ngModel)]=\"endereco.uf\" name=\"uf\" #uf=\"ngModel\">\r\n <mat-option *ngFor=\"let uf of getListaEstados()\" [value]=\"uf\">\r\n {{ uf }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i7.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UnbMensagemComponent, selector: "unb-mensagem", inputs: ["mensagem", "tipo", "identificador"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i4$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i11.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i13.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] }); }
|
|
1522
|
-
}
|
|
1523
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaEnderecoFormComponent, decorators: [{
|
|
1524
|
-
type: Component,
|
|
1525
|
-
args: [{ standalone: false, selector: 'lib-unb-pessoa-endereco-form', template: "<h1 mat-dialog-title>Cadastro de Endere\u00E7o</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"endereco.tipoEnderecoCodigo\" name=\"tipo\" #tipo=\"ngModel\"\r\n (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoEndereco\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs</mat-label>\r\n\r\n <mat-select [(ngModel)]=\"endereco.paisEnderecoCodigo\" name=\"paisEnderecoCodigo\" #paisEnderecoCodigo=\"ngModel\">\r\n\r\n <mat-option *ngFor=\"let paises of listaPaises\" [value]=\"paises.codigo\">\r\n <span *ngIf=\"paises.denominacao === 'BRASIL'\">\uD83C\uDDE7\uD83C\uDDF7 <b>{{ paises.denominacao }}</b></span>\r\n <span *ngIf=\"paises.denominacao !== 'BRASIL'\">{{ paises.denominacao }}</span>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>CEP</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.cep\" name=\"cep\" #cep=\"ngModel\" />\r\n\r\n <button matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" \r\n [disabled]=\"loading\" (click)=\"pesquisarCep()\">\r\n \r\n <ng-container *ngIf=\"!loading; else loadingIcon\">\r\n <mat-icon style=\"margin-right: 2px;\">search</mat-icon>\r\n </ng-container>\r\n\r\n <ng-template #loadingIcon>\r\n <mat-progress-spinner \r\n [diameter]=\"20\" \r\n mode=\"indeterminate\" \r\n color=\"primary\" \r\n class=\"spinner-button\">\r\n </mat-progress-spinner>\r\n </ng-template>\r\n\r\n </button>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Endere\u00E7o</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.logradouro\" name=\"logradouro\" #logradouro=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Bairro</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.bairro\" name=\"bairro\" #bairro=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Complemento</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.complemento\" name=\"complemento\" #complemento=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>UF</mat-label>\r\n <mat-select [(ngModel)]=\"endereco.uf\" name=\"uf\" #uf=\"ngModel\">\r\n <mat-option *ngFor=\"let uf of getListaEstados()\" [value]=\"uf\">\r\n {{ uf }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"] }]
|
|
1526
|
-
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: UnbMensagemService }, { type: i4$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
1527
|
-
type: Inject,
|
|
1528
|
-
args: [MAT_DIALOG_DATA]
|
|
1529
|
-
}] }] });
|
|
1530
|
-
|
|
1531
|
-
const listaEstados = [
|
|
1532
|
-
{ codigo: 1, identificador: 'AC', descricao: "Acre" },
|
|
1533
|
-
{ codigo: 2, identificador: 'AL', descricao: "Alagoas" },
|
|
1534
|
-
{ codigo: 3, identificador: 'AM', descricao: "Amazonas" },
|
|
1535
|
-
{ codigo: 4, identificador: 'AP', descricao: "Amapá" },
|
|
1536
|
-
{ codigo: 5, identificador: 'BA', descricao: "Bahia" },
|
|
1537
|
-
{ codigo: 6, identificador: 'CE', descricao: "Ceará" },
|
|
1538
|
-
{ codigo: 7, identificador: 'DF', descricao: "Distrito Federal" },
|
|
1539
|
-
{ codigo: 8, identificador: 'ES', descricao: "Espírito Santo" },
|
|
1540
|
-
{ codigo: 9, identificador: 'GO', descricao: "Goiás" },
|
|
1541
|
-
{ codigo: 10, identificador: 'MA', descricao: "Maranhão" },
|
|
1542
|
-
{ codigo: 11, identificador: 'MG', descricao: "Minas Gerais" },
|
|
1543
|
-
{ codigo: 12, identificador: 'MS', descricao: "Mato Grosso do Sul" },
|
|
1544
|
-
{ codigo: 13, identificador: 'MT', descricao: "Mato Grosso" },
|
|
1545
|
-
{ codigo: 14, identificador: 'PA', descricao: "Pará" },
|
|
1546
|
-
{ codigo: 15, identificador: 'PB', descricao: "Paraíba" },
|
|
1547
|
-
{ codigo: 16, identificador: 'PE', descricao: "Pernambuco" },
|
|
1548
|
-
{ codigo: 17, identificador: 'PI', descricao: "Piauí" },
|
|
1549
|
-
{ codigo: 18, identificador: 'PR', descricao: "Paraná" },
|
|
1550
|
-
{ codigo: 19, identificador: 'RJ', descricao: "Rio de Janeiro" },
|
|
1551
|
-
{ codigo: 20, identificador: 'RN', descricao: "Rio Grande do Norte" },
|
|
1552
|
-
{ codigo: 21, identificador: 'RO', descricao: "Rondônia" },
|
|
1553
|
-
{ codigo: 22, identificador: 'RR', descricao: "Roraima" },
|
|
1554
|
-
{ codigo: 23, identificador: 'RS', descricao: "Rio Grande do Sul" },
|
|
1555
|
-
{ codigo: 24, identificador: 'SC', descricao: "Santa Catarina" },
|
|
1556
|
-
{ codigo: 25, identificador: 'SE', descricao: "Sergipe" },
|
|
1557
|
-
{ codigo: 26, identificador: 'SP', descricao: "São Paulo" },
|
|
1558
|
-
{ codigo: 27, identificador: 'TO', descricao: "Tocantins" }
|
|
1559
|
-
];
|
|
1560
|
-
|
|
1561
|
-
/**
|
|
1562
|
-
* Essa eh uma classe base, com propriedades comum ao componente de pesquisa de pesssoa. Porque tem vários campos que são usados para configurar o comportamento do componente.
|
|
1563
|
-
* */
|
|
1564
|
-
class UnbPessoaPesquisaConfig {
|
|
1565
|
-
// Construtor opcional para facilitar a criação (atalho)
|
|
1566
|
-
constructor(init) {
|
|
1567
|
-
this.backendURL = "";
|
|
1568
|
-
this.token = ""; // usado para testar autenticação no backend se necessário.
|
|
1569
|
-
// Flags com valores padrão (já resolve o booleano)
|
|
1570
|
-
this.defaultTipoPessoa = UnbTipoPessoaEnum.FISICA;
|
|
1571
|
-
this.pesquisarPorCPF = true;
|
|
1572
|
-
this.pesquisarPorCNPJ = true;
|
|
1573
|
-
this.pesquisarPorEstrangeiro = false;
|
|
1574
|
-
// UI
|
|
1575
|
-
this.mostrarPesquisa = true;
|
|
1576
|
-
this.limparAposPesquisa = false;
|
|
1577
|
-
// Textos
|
|
1578
|
-
this.label = "Digite o CPF/CNPJ ou Passaporte";
|
|
1579
|
-
this.placeholder = "";
|
|
1580
|
-
this.hint = "";
|
|
1581
|
-
Object.assign(this, init);
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
class UnbPessoaFormConfig {
|
|
1585
|
-
constructor(init) {
|
|
1586
|
-
this.backendURL = "";
|
|
1587
|
-
this.token = "";
|
|
1588
|
-
this.isReadyOnly = false;
|
|
1589
|
-
this.pessoa = new UnbPessoaModel();
|
|
1590
|
-
Object.assign(this, init);
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
class UnbPessoaTelefone {
|
|
1595
|
-
constructor() {
|
|
1596
|
-
// usado pelo componente unb-pesoa-form, pra indicar que o usuario estah editando
|
|
1597
|
-
this.modoEdicao = false;
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
class UnbPessoaTelefoneTipo {
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
class UnbPessoaTelefoneFormComponent {
|
|
1604
|
-
constructor(snackBar, service, alertService, dialogRef, data) {
|
|
1605
|
-
this.snackBar = snackBar;
|
|
1606
|
-
this.service = service;
|
|
1607
|
-
this.alertService = alertService;
|
|
1608
|
-
this.dialogRef = dialogRef;
|
|
1609
|
-
this.data = data;
|
|
1610
|
-
this.telefone = new UnbPessoaTelefone();
|
|
1611
|
-
this.listaTipoTelefone = [];
|
|
1612
|
-
this.idMensagemService = "UnbPessoaTelefoneForm";
|
|
1613
|
-
this.telefone = JSON.parse(JSON.stringify(data.telefone)); // O e-mail específico para edição
|
|
1614
|
-
// Verifique se a lista de e-mails foi passada e atribua-a
|
|
1615
|
-
if (data.telefonesList) {
|
|
1616
|
-
this.telefonesList = JSON.parse(JSON.stringify(data.telefonesList)); // Faça uma cópia profunda se for manipular
|
|
1617
|
-
}
|
|
1618
|
-
else {
|
|
1619
|
-
this.telefonesList = []; // Inicialize como vazio se não for passada
|
|
1620
|
-
}
|
|
1621
|
-
if (!this.telefone) {
|
|
1622
|
-
this.telefone = new UnbPessoaTelefone();
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
ngOnInit() {
|
|
1626
|
-
this.service.getTipoTelefone().subscribe({
|
|
1627
|
-
next: (lista) => {
|
|
1628
|
-
this.listaTipoTelefone = lista;
|
|
1629
|
-
// Se já tiver tipoTelefoneCodigo, preenche o nome correspondente
|
|
1630
|
-
if (this.telefone.tipoTelefoneCodigo != null) {
|
|
1631
|
-
const tipoEncontrado = lista.find(t => t.codigo === this.telefone.tipoTelefoneCodigo);
|
|
1632
|
-
if (tipoEncontrado) {
|
|
1633
|
-
this.telefone.tipo = tipoEncontrado.denominacao;
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
else if (this.telefone.tipo) {
|
|
1637
|
-
const tipoEncontrado = lista.find(t => t.denominacao?.toLowerCase() === this.telefone.tipo?.toLowerCase());
|
|
1638
|
-
if (tipoEncontrado) {
|
|
1639
|
-
this.telefone.tipoTelefoneCodigo = tipoEncontrado.codigo;
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
},
|
|
1643
|
-
error: (err) => this.handleError(err)
|
|
1644
|
-
});
|
|
1645
|
-
}
|
|
1646
|
-
salvar(form) {
|
|
1647
|
-
if (form.invalid) {
|
|
1648
|
-
this.openSnackBar('Existem erros no formulário, por favor, verificar.');
|
|
1649
|
-
return;
|
|
1650
|
-
}
|
|
1651
|
-
// 1. Define o 'tipo' padrão (1) se não for preenchido (Conforme sua solicitação)
|
|
1652
|
-
if (!this.telefone.tipoTelefoneCodigo) {
|
|
1653
|
-
this.telefone.tipoTelefoneCodigo = 1; // 1 é geralmente 'Residencial' ou 'Principal'
|
|
1654
|
-
}
|
|
1655
|
-
// 2. Define a 'ordem' (que o back-end chama de 'ordemTelefone')
|
|
1656
|
-
if (!this.telefone.ordem || this.telefone.ordem === 0) {
|
|
1657
|
-
let maxOrdem = 0;
|
|
1658
|
-
// Verifica se a lista de telefones já existe e tem itens
|
|
1659
|
-
if (this.telefonesList && this.telefonesList.length > 0) {
|
|
1660
|
-
maxOrdem = Math.max(...this.telefonesList.map(t => t.ordem || 0));
|
|
1661
|
-
}
|
|
1662
|
-
// Define a ordem do novo telefone como a maior ordem + 1
|
|
1663
|
-
this.telefone.ordem = maxOrdem + 1;
|
|
1664
|
-
}
|
|
1665
|
-
if (this.validar(this.telefone) == false)
|
|
1666
|
-
return;
|
|
1667
|
-
this.telefoneSalvo = this.telefone;
|
|
1668
|
-
this.salvarclose();
|
|
1669
|
-
}
|
|
1670
|
-
compararTipos(t1, t2) {
|
|
1671
|
-
return t1 && t2 && t1 === t2;
|
|
1672
|
-
}
|
|
1673
|
-
onTipoSelecionado(codigoSelecionado) {
|
|
1674
|
-
const tipoSelecionado = this.listaTipoTelefone.find(t => t.codigo === codigoSelecionado); // <--- Renomeado de listaTipoEndereco
|
|
1675
|
-
if (tipoSelecionado) {
|
|
1676
|
-
this.telefone.tipo = tipoSelecionado.denominacao;
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
/**
|
|
1680
|
-
* Valida o objeto de telefone com base nas regras do backend.
|
|
1681
|
-
* Retorna true se o telefone for válido, false caso contrário.
|
|
1682
|
-
*/
|
|
1683
|
-
validar(telefoneToValidate) {
|
|
1684
|
-
// 1. Validação de Número (Obrigatório)
|
|
1685
|
-
if (!telefoneToValidate.numero || telefoneToValidate.numero.trim() === '') {
|
|
1686
|
-
this.openSnackBar("Número do telefone é um campo obrigatório.");
|
|
1687
|
-
return false;
|
|
1688
|
-
}
|
|
1689
|
-
// 2. Validação de Número (Formato)
|
|
1690
|
-
// que ele espera 8 ou 9 dígitos numéricos (padrão Brasil).
|
|
1691
|
-
const numeroLimpo = telefoneToValidate.numero.replace(/\D/g, ''); // Remove não-dígitos
|
|
1692
|
-
if (numeroLimpo.length !== 9) {
|
|
1693
|
-
this.openSnackBar("Número do telefone deve conter exatamente 9 dígitos.");
|
|
1694
|
-
return false;
|
|
1695
|
-
}
|
|
1696
|
-
// 3. Validação de DDD (Obrigatório - Boa prática, embora o Java não exija)
|
|
1697
|
-
if (!telefoneToValidate.ddd || telefoneToValidate.ddd.trim() === '') {
|
|
1698
|
-
this.openSnackBar("DDD é um campo obrigatório.");
|
|
1699
|
-
return false;
|
|
1700
|
-
}
|
|
1701
|
-
// 4. Validação de DDD (Tamanho Máximo)
|
|
1702
|
-
if (telefoneToValidate.ddd.trim().length > 3) {
|
|
1703
|
-
this.openSnackBar("DDD deve ter no máximo 3 caracteres.");
|
|
1704
|
-
return false;
|
|
1705
|
-
}
|
|
1706
|
-
// 5. Validação de DDI (Tamanho Máximo)
|
|
1707
|
-
//
|
|
1708
|
-
if (telefoneToValidate.ddi && telefoneToValidate.ddi.trim().length > 5) {
|
|
1709
|
-
this.openSnackBar("DDI deve ter no máximo 5 caracteres.");
|
|
1710
|
-
return false;
|
|
1711
|
-
}
|
|
1712
|
-
// 6. Validação de Ramal (Tamanho Máximo)
|
|
1713
|
-
//
|
|
1714
|
-
if (telefoneToValidate.ramal && telefoneToValidate.ramal.trim().length > 6) {
|
|
1715
|
-
this.openSnackBar("Ramal deve ter no máximo 6 caracteres.");
|
|
1716
|
-
return false;
|
|
1717
|
-
}
|
|
1718
|
-
// 7. Validação de NomeResponsavel (Tamanho Máximo)
|
|
1719
|
-
//
|
|
1720
|
-
if (telefoneToValidate.nomeResponsavel && telefoneToValidate.nomeResponsavel.trim().length > 100) {
|
|
1721
|
-
this.openSnackBar("Nome do Responsável deve ter no máximo 100 caracteres.");
|
|
1722
|
-
return false;
|
|
1723
|
-
}
|
|
1724
|
-
return true; // Passou em todas as validações!
|
|
1725
|
-
}
|
|
1726
|
-
close() {
|
|
1727
|
-
this.dialogRef.close(null);
|
|
1728
|
-
}
|
|
1729
|
-
salvarclose() {
|
|
1730
|
-
this.dialogRef.close(this.telefoneSalvo);
|
|
1731
|
-
}
|
|
1732
|
-
handleError(erro) {
|
|
1733
|
-
let erroTratado;
|
|
1734
|
-
// Converte string local em Objeto Padrão
|
|
1735
|
-
if (typeof erro === 'string') {
|
|
1736
|
-
erroTratado = {
|
|
1737
|
-
status: 400,
|
|
1738
|
-
mensagemSimples: erro,
|
|
1739
|
-
mensagemHtml: `<strong>${erro}</strong>`
|
|
1740
|
-
};
|
|
1741
|
-
}
|
|
1742
|
-
else {
|
|
1743
|
-
erroTratado = erro;
|
|
1744
|
-
}
|
|
1745
|
-
// 1. SnackBar
|
|
1746
|
-
if (erroTratado.mensagemSimples) {
|
|
1747
|
-
this.openSnackBar(erroTratado.mensagemSimples);
|
|
1748
|
-
}
|
|
1749
|
-
// 2. AlertService (Se houver tag <unb-mensagem> no HTML do dialog)
|
|
1750
|
-
if (this.alertService && erroTratado.mensagemHtml) {
|
|
1751
|
-
this.alertService.showMessage(erroTratado.mensagemHtml, UnbTipoMensagemEnum.DANGER, this.idMensagemService);
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
openSnackBar(message) {
|
|
1755
|
-
this.snackBar.open(message, 'x', {
|
|
1756
|
-
duration: 5000,
|
|
1757
|
-
});
|
|
1758
|
-
}
|
|
1759
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaTelefoneFormComponent, deps: [{ token: i1$1.MatSnackBar }, { token: UnBPessoaService }, { token: UnbMensagemService }, { token: i4$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1760
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaTelefoneFormComponent, isStandalone: false, selector: "lib-unb-pessoa-telefone-form", ngImport: i0, template: "<h1 mat-dialog-title>Cadastro de Telefone</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"telefone.tipoTelefoneCodigo\" [compareWith]=\"compararTipos\" name=\"tipoTelefoneCodigo\" (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoTelefone\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>DDD</mat-label>\r\n <input type=\"text\" maxlength=\"3\" required matInput [(ngModel)]=\"telefone.ddd\" name=\"dddValue\" #dddValue=\"ngModel\" />\r\n </mat-form-field> \r\n \r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>N\u00FAmero</mat-label>\r\n <input type=\"text\" required maxlength=\"9\" matInput [(ngModel)]=\"telefone.numero\" name=\"telefoneValue\" #telefoneValue=\"ngModel\" />\r\n </mat-form-field>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i6.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UnbMensagemComponent, selector: "unb-mensagem", inputs: ["mensagem", "tipo", "identificador"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i4$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i11.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] }); }
|
|
1761
|
-
}
|
|
1762
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaTelefoneFormComponent, decorators: [{
|
|
1763
|
-
type: Component,
|
|
1764
|
-
args: [{ standalone: false, selector: 'lib-unb-pessoa-telefone-form', template: "<h1 mat-dialog-title>Cadastro de Telefone</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"telefone.tipoTelefoneCodigo\" [compareWith]=\"compararTipos\" name=\"tipoTelefoneCodigo\" (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoTelefone\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>DDD</mat-label>\r\n <input type=\"text\" maxlength=\"3\" required matInput [(ngModel)]=\"telefone.ddd\" name=\"dddValue\" #dddValue=\"ngModel\" />\r\n </mat-form-field> \r\n \r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>N\u00FAmero</mat-label>\r\n <input type=\"text\" required maxlength=\"9\" matInput [(ngModel)]=\"telefone.numero\" name=\"telefoneValue\" #telefoneValue=\"ngModel\" />\r\n </mat-form-field>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"] }]
|
|
1765
|
-
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: UnbMensagemService }, { type: i4$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
1766
|
-
type: Inject,
|
|
1767
|
-
args: [MAT_DIALOG_DATA]
|
|
1768
|
-
}] }] });
|
|
1769
|
-
|
|
1770
|
-
class UnbPessoaTelefoneListComponent {
|
|
1771
|
-
constructor(snackBar, service, dialog) {
|
|
1772
|
-
this.snackBar = snackBar;
|
|
1773
|
-
this.service = service;
|
|
1774
|
-
this.dialog = dialog;
|
|
1775
|
-
this.podeEditar = true;
|
|
1776
|
-
this.telefones = [];
|
|
1777
|
-
this.backendURL = '';
|
|
1778
|
-
this.telefonesEmitted = new EventEmitter();
|
|
1779
|
-
}
|
|
1780
|
-
ngOnInit() {
|
|
1781
|
-
this.tipoTelefone = this.service.getTipoTelefone();
|
|
1782
|
-
}
|
|
1783
|
-
// tem que fazer isso pq no on init eu ainda nao tenho a lista de telefones
|
|
1784
|
-
ngOnChanges(changes) {
|
|
1785
|
-
// Verifica se a propriedade 'telefones' mudou
|
|
1786
|
-
if (changes['telefones'] && this.telefones) {
|
|
1787
|
-
// chamada quando os dados realmente chegarem
|
|
1788
|
-
this.sortAndAssignOrder();
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
excluir(telefoneParaExcluir) {
|
|
1792
|
-
if (telefoneParaExcluir.codigo) {
|
|
1793
|
-
// Se tem código, remove por ele (mais seguro)
|
|
1794
|
-
this.telefones = this.telefones.filter(t => t.codigo !== telefoneParaExcluir.codigo);
|
|
1795
|
-
}
|
|
1796
|
-
else {
|
|
1797
|
-
// Se não tem código (novo item), remove pela ordem
|
|
1798
|
-
this.telefones = this.telefones.filter(t => t.ordem !== telefoneParaExcluir.ordem);
|
|
1799
|
-
}
|
|
1800
|
-
// Chama função existente que re-calcula as ordens e emite a lista atualizada
|
|
1801
|
-
this.atualizarOrdem();
|
|
1802
|
-
this.telefonesEmitted.emit(this.telefones);
|
|
1803
|
-
}
|
|
1804
|
-
editar(telefone) {
|
|
1805
|
-
this.openFormDialog(telefone);
|
|
1806
|
-
}
|
|
1807
|
-
atualizarOrdem() {
|
|
1808
|
-
this.telefones.forEach((telefone, idx) => {
|
|
1809
|
-
telefone.ordem = idx + 1;
|
|
1810
|
-
});
|
|
1811
|
-
// reemite a lista atualizada, igual antes
|
|
1812
|
-
this.telefonesEmitted.emit(this.telefones);
|
|
1813
|
-
}
|
|
1814
|
-
openFormDialog(toEdit) {
|
|
1815
|
-
const dialogRef = this.dialog.open(UnbPessoaTelefoneFormComponent, {
|
|
1816
|
-
width: '900px',
|
|
1817
|
-
data: {
|
|
1818
|
-
telefone: toEdit, // E-mail a ser editado ou vazio para novo
|
|
1819
|
-
telefonesList: this.telefones // A sua lista COMPLETA de e-mails
|
|
1820
|
-
},
|
|
1821
|
-
});
|
|
1822
|
-
dialogRef.afterClosed().subscribe(result => {
|
|
1823
|
-
if (!result) {
|
|
1824
|
-
return; // Usuário clicou em 'Fechar' ou 'Cancelar'
|
|
1825
|
-
}
|
|
1826
|
-
// 'result' é o objeto retornado pelo dialog (editado ou novo)
|
|
1827
|
-
let index = -1;
|
|
1828
|
-
// 1. Tenta encontrar pelo 'codigo' (para itens que já vieram do banco)
|
|
1829
|
-
if (result.codigo) {
|
|
1830
|
-
index = this.telefones.findIndex(t => t.codigo === result.codigo);
|
|
1831
|
-
}
|
|
1832
|
-
// 2. Se não achou pelo 'codigo', tenta pela 'ordem'.
|
|
1833
|
-
// A 'ordem' é o nosso identificador único para itens que
|
|
1834
|
-
// ainda não foram salvos no banco (criados/editados localmente).
|
|
1835
|
-
if (index === -1 && result.ordem) {
|
|
1836
|
-
index = this.telefones.findIndex(t => t.ordem === result.ordem);
|
|
1837
|
-
}
|
|
1838
|
-
if (index > -1) {
|
|
1839
|
-
// ENCONTROU (pelo 'codigo' ou pela 'ordem'): Atualiza o item existente
|
|
1840
|
-
this.telefones[index] = result;
|
|
1841
|
-
}
|
|
1842
|
-
else {
|
|
1843
|
-
// NÃO ENCONTROU: É um item 100% novo (não uma edição)
|
|
1844
|
-
// O form (unb-pessoa-telefone-form) já cuidou de
|
|
1845
|
-
// atribuir a 'ordem' correta (maxOrdem + 1)
|
|
1846
|
-
this.telefones.push(result);
|
|
1847
|
-
}
|
|
1848
|
-
// vamos apenas re-ordenar a lista pela 'ordem' que já temos
|
|
1849
|
-
// e depois emitir.
|
|
1850
|
-
this.telefones.sort((a, b) => (a.ordem ?? 0) - (b.ordem ?? 0));
|
|
1851
|
-
this.telefonesEmitted.emit(this.telefones);
|
|
1852
|
-
});
|
|
1853
|
-
}
|
|
1854
|
-
moverTelefone(event) {
|
|
1855
|
-
// troca a posição dentro do array
|
|
1856
|
-
moveItemInArray(this.telefones, event.previousIndex, event.currentIndex);
|
|
1857
|
-
// atualiza o campo 'ordem' em cada item
|
|
1858
|
-
this.atualizarOrdem();
|
|
1859
|
-
}
|
|
1860
|
-
sortAndAssignOrder() {
|
|
1861
|
-
// 1. Crie uma cópia da lista para não modificar a original durante a iteração inicial
|
|
1862
|
-
const tempEmails = [...this.telefones];
|
|
1863
|
-
// 2. Mapeie as ordens existentes para identificar duplicatas e ausentes
|
|
1864
|
-
const orderMap = new Map();
|
|
1865
|
-
const emailsWithoutOrder = [];
|
|
1866
|
-
tempEmails.forEach(telefone => {
|
|
1867
|
-
if (telefone.ordem !== undefined && telefone.ordem !== null) {
|
|
1868
|
-
if (!orderMap.has(telefone.ordem)) {
|
|
1869
|
-
orderMap.set(telefone.ordem, []);
|
|
1870
|
-
}
|
|
1871
|
-
orderMap.get(telefone.ordem)?.push(telefone);
|
|
1872
|
-
}
|
|
1873
|
-
else {
|
|
1874
|
-
emailsWithoutOrder.push(telefone);
|
|
1875
|
-
}
|
|
1876
|
-
});
|
|
1877
|
-
// 3. Inicialize um Set para rastrear todas as ordens que serão usadas no final
|
|
1878
|
-
const finalUsedOrders = new Set();
|
|
1879
|
-
// Inicialize o próximo valor de ordem disponível
|
|
1880
|
-
let nextAvailableOrder = 0;
|
|
1881
|
-
// Função auxiliar para encontrar a próxima ordem disponível
|
|
1882
|
-
const getNextAvailableOrder = () => {
|
|
1883
|
-
while (finalUsedOrders.has(nextAvailableOrder)) {
|
|
1884
|
-
nextAvailableOrder++;
|
|
1885
|
-
}
|
|
1886
|
-
return nextAvailableOrder++;
|
|
1887
|
-
};
|
|
1888
|
-
// 4. Processe telefones com ordem definida:
|
|
1889
|
-
// - A primeira ocorrência de uma ordem a mantém.
|
|
1890
|
-
// - Duplicatas recebem uma nova ordem.
|
|
1891
|
-
// - Adicione as ordens válidas ao finalUsedOrders.
|
|
1892
|
-
this.telefones.forEach(telefone => {
|
|
1893
|
-
if (telefone.ordem !== undefined && telefone.ordem !== null) {
|
|
1894
|
-
if (!finalUsedOrders.has(telefone.ordem)) {
|
|
1895
|
-
// Se a ordem ainda não foi usada, use-a e adicione ao set
|
|
1896
|
-
finalUsedOrders.add(telefone.ordem);
|
|
1897
|
-
}
|
|
1898
|
-
else {
|
|
1899
|
-
// Se a ordem já foi usada (é uma duplicata), atribua uma nova
|
|
1900
|
-
telefone.ordem = getNextAvailableOrder();
|
|
1901
|
-
finalUsedOrders.add(telefone.ordem); // Adiciona a nova ordem ao set
|
|
1902
|
-
}
|
|
1903
|
-
}
|
|
1904
|
-
});
|
|
1905
|
-
// 5. Atribua ordens para telefones que não tinham ordem definida
|
|
1906
|
-
emailsWithoutOrder.forEach(telefone => {
|
|
1907
|
-
telefone.ordem = getNextAvailableOrder();
|
|
1908
|
-
finalUsedOrders.add(telefone.ordem); // Adiciona a nova ordem ao set
|
|
1732
|
+
let erroTratado;
|
|
1733
|
+
// Converte string local em Objeto Padrão
|
|
1734
|
+
if (typeof erro === 'string') {
|
|
1735
|
+
erroTratado = {
|
|
1736
|
+
status: 400,
|
|
1737
|
+
mensagemSimples: erro,
|
|
1738
|
+
mensagemHtml: `<strong>${erro}</strong>`
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
else {
|
|
1742
|
+
erroTratado = erro;
|
|
1743
|
+
}
|
|
1744
|
+
// 1. SnackBar
|
|
1745
|
+
if (erroTratado.mensagemSimples) {
|
|
1746
|
+
this.openSnackBar(erroTratado.mensagemSimples);
|
|
1747
|
+
}
|
|
1748
|
+
// 2. AlertService (Se houver tag <unb-mensagem> no HTML do dialog)
|
|
1749
|
+
if (this.alertService && erroTratado.mensagemHtml) {
|
|
1750
|
+
this.alertService.showMessage(erroTratado.mensagemHtml, UnbTipoMensagemEnum.DANGER, this.idMensagemService);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
openSnackBar(message) {
|
|
1754
|
+
this.snackBar.open(message, 'x', {
|
|
1755
|
+
duration: 5000,
|
|
1909
1756
|
});
|
|
1910
|
-
// 6. Finalmente, ordene a lista completa com as ordens agora únicas
|
|
1911
|
-
this.telefones.sort((a, b) => (a.ordem ?? 0) - (b.ordem ?? 0));
|
|
1912
1757
|
}
|
|
1913
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
1914
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type:
|
|
1758
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaEnderecoFormComponent, deps: [{ token: i1$1.MatSnackBar }, { token: UnBPessoaService }, { token: UnbMensagemService }, { token: i4$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1759
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaEnderecoFormComponent, isStandalone: false, selector: "lib-unb-pessoa-endereco-form", ngImport: i0, template: "<h1 mat-dialog-title>Cadastro de Endere\u00E7o</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"endereco.tipoEnderecoCodigo\" name=\"tipo\" #tipo=\"ngModel\"\r\n (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoEndereco\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs</mat-label>\r\n\r\n <mat-select [(ngModel)]=\"endereco.paisEnderecoCodigo\" name=\"paisEnderecoCodigo\" #paisEnderecoCodigo=\"ngModel\">\r\n\r\n <mat-option *ngFor=\"let paises of listaPaises\" [value]=\"paises.codigo\">\r\n <span *ngIf=\"paises.denominacao === 'BRASIL'\">\uD83C\uDDE7\uD83C\uDDF7 <b>{{ paises.denominacao }}</b></span>\r\n <span *ngIf=\"paises.denominacao !== 'BRASIL'\">{{ paises.denominacao }}</span>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>CEP</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.cep\" name=\"cep\" #cep=\"ngModel\" />\r\n\r\n <button matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" \r\n [disabled]=\"loading\" (click)=\"pesquisarCep()\">\r\n \r\n <ng-container *ngIf=\"!loading; else loadingIcon\">\r\n <mat-icon style=\"margin-right: 2px;\">search</mat-icon>\r\n </ng-container>\r\n\r\n <ng-template #loadingIcon>\r\n <mat-progress-spinner \r\n [diameter]=\"20\" \r\n mode=\"indeterminate\" \r\n color=\"primary\" \r\n class=\"spinner-button\">\r\n </mat-progress-spinner>\r\n </ng-template>\r\n\r\n </button>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Endere\u00E7o</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.logradouro\" name=\"logradouro\" #logradouro=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Bairro</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.bairro\" name=\"bairro\" #bairro=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Complemento</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.complemento\" name=\"complemento\" #complemento=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>UF</mat-label>\r\n <mat-select [(ngModel)]=\"endereco.uf\" name=\"uf\" #uf=\"ngModel\">\r\n <mat-option *ngFor=\"let uf of getListaEstados()\" [value]=\"uf\">\r\n {{ uf }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i7.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UnbMensagemComponent, selector: "unb-mensagem", inputs: ["mensagem", "tipo", "identificador"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i4$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i11.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i13.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] }); }
|
|
1915
1760
|
}
|
|
1916
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
1761
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaEnderecoFormComponent, decorators: [{
|
|
1917
1762
|
type: Component,
|
|
1918
|
-
args: [{ standalone: false, selector: 'lib-unb-pessoa-
|
|
1919
|
-
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: i4$2.
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
}], backendURL: [{
|
|
1924
|
-
type: Input
|
|
1925
|
-
}], telefonesEmitted: [{
|
|
1926
|
-
type: Output
|
|
1927
|
-
}] } });
|
|
1763
|
+
args: [{ standalone: false, selector: 'lib-unb-pessoa-endereco-form', template: "<h1 mat-dialog-title>Cadastro de Endere\u00E7o</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"endereco.tipoEnderecoCodigo\" name=\"tipo\" #tipo=\"ngModel\"\r\n (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoEndereco\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs</mat-label>\r\n\r\n <mat-select [(ngModel)]=\"endereco.paisEnderecoCodigo\" name=\"paisEnderecoCodigo\" #paisEnderecoCodigo=\"ngModel\">\r\n\r\n <mat-option *ngFor=\"let paises of listaPaises\" [value]=\"paises.codigo\">\r\n <span *ngIf=\"paises.denominacao === 'BRASIL'\">\uD83C\uDDE7\uD83C\uDDF7 <b>{{ paises.denominacao }}</b></span>\r\n <span *ngIf=\"paises.denominacao !== 'BRASIL'\">{{ paises.denominacao }}</span>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>CEP</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.cep\" name=\"cep\" #cep=\"ngModel\" />\r\n\r\n <button matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" \r\n [disabled]=\"loading\" (click)=\"pesquisarCep()\">\r\n \r\n <ng-container *ngIf=\"!loading; else loadingIcon\">\r\n <mat-icon style=\"margin-right: 2px;\">search</mat-icon>\r\n </ng-container>\r\n\r\n <ng-template #loadingIcon>\r\n <mat-progress-spinner \r\n [diameter]=\"20\" \r\n mode=\"indeterminate\" \r\n color=\"primary\" \r\n class=\"spinner-button\">\r\n </mat-progress-spinner>\r\n </ng-template>\r\n\r\n </button>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Endere\u00E7o</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.logradouro\" name=\"logradouro\" #logradouro=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Bairro</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.bairro\" name=\"bairro\" #bairro=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Complemento</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.complemento\" name=\"complemento\" #complemento=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>UF</mat-label>\r\n <mat-select [(ngModel)]=\"endereco.uf\" name=\"uf\" #uf=\"ngModel\">\r\n <mat-option *ngFor=\"let uf of getListaEstados()\" [value]=\"uf\">\r\n {{ uf }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"] }]
|
|
1764
|
+
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: UnbMensagemService }, { type: i4$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
1765
|
+
type: Inject,
|
|
1766
|
+
args: [MAT_DIALOG_DATA]
|
|
1767
|
+
}] }] });
|
|
1928
1768
|
|
|
1929
1769
|
class UnbPessoaenderecoListComponent {
|
|
1930
1770
|
constructor(snackBar, service, dialog) {
|
|
@@ -2070,6 +1910,165 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
2070
1910
|
type: Output
|
|
2071
1911
|
}] } });
|
|
2072
1912
|
|
|
1913
|
+
class UnbPessoaEmailFormComponent {
|
|
1914
|
+
constructor(snackBar, service, alertService, dialogRef, data) {
|
|
1915
|
+
this.snackBar = snackBar;
|
|
1916
|
+
this.service = service;
|
|
1917
|
+
this.alertService = alertService;
|
|
1918
|
+
this.dialogRef = dialogRef;
|
|
1919
|
+
this.data = data;
|
|
1920
|
+
this.email = new UnbPessoaEmail();
|
|
1921
|
+
this.listaTipoEmail = [];
|
|
1922
|
+
this.idMensagemService = "UnbPessoaEmailForm";
|
|
1923
|
+
this.email = JSON.parse(JSON.stringify(data.email)); // O e-mail específico para edição
|
|
1924
|
+
// Verifique se a lista de e-mails foi passada e atribua-a
|
|
1925
|
+
if (data.emailsList) {
|
|
1926
|
+
this.emailsList = JSON.parse(JSON.stringify(data.emailsList)); // Faça uma cópia profunda se for manipular
|
|
1927
|
+
}
|
|
1928
|
+
else {
|
|
1929
|
+
this.emailsList = []; // Inicialize como vazio se não for passada
|
|
1930
|
+
}
|
|
1931
|
+
if (!this.email) {
|
|
1932
|
+
this.email = new UnbPessoaEmail();
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
ngOnInit() {
|
|
1936
|
+
// Chamamos o serviço direto. Não guardamos o observable, apenas o resultado.
|
|
1937
|
+
this.service.getTipoEmail().subscribe({
|
|
1938
|
+
next: (lista) => {
|
|
1939
|
+
// 1. Guarda a lista para o HTML usar
|
|
1940
|
+
this.listaTipoEmail = lista;
|
|
1941
|
+
// 2. Lógica de Seleção Automática (Match)
|
|
1942
|
+
if (this.email.tipoEmailCodigo != null) {
|
|
1943
|
+
const tipoEncontrado = lista.find(t => t.codigo === this.email.tipoEmailCodigo);
|
|
1944
|
+
if (tipoEncontrado) {
|
|
1945
|
+
this.email.tipo = tipoEncontrado.denominacao;
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
else if (this.email.tipo) {
|
|
1949
|
+
const tipoEncontrado = lista.find(t => t.denominacao?.toLowerCase() === this.email.tipo?.toLowerCase());
|
|
1950
|
+
if (tipoEncontrado) {
|
|
1951
|
+
this.email.tipoEmailCodigo = tipoEncontrado.codigo;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
},
|
|
1955
|
+
// 3. Usa seu tratamento de erro novo
|
|
1956
|
+
error: (err) => this.handleError(err)
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
salvar(form) {
|
|
1960
|
+
if (form.invalid) {
|
|
1961
|
+
this.openSnackBar('Existem erros no formulário, por favor, verificar.');
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
// 1. Define o 'tipo' padrão (ex: 1 para 'Pessoal') se não for preenchido
|
|
1965
|
+
if (!this.email.tipoEmailCodigo) {
|
|
1966
|
+
this.email.tipoEmailCodigo = 1; // 1 é geralmente 'Pessoal'
|
|
1967
|
+
}
|
|
1968
|
+
// 2. Define a 'ordem' (que o back-end chama de 'ordemEmail')
|
|
1969
|
+
if (!this.email.ordem || this.email.ordem === 0) {
|
|
1970
|
+
let maxOrdem = 0;
|
|
1971
|
+
// Verifica se a lista de emails já existe e tem itens
|
|
1972
|
+
if (this.emailsList && this.emailsList.length > 0) {
|
|
1973
|
+
maxOrdem = Math.max(...this.emailsList.map(e => e.ordem || 0));
|
|
1974
|
+
}
|
|
1975
|
+
// Define a ordem do novo email como a maior ordem + 1
|
|
1976
|
+
this.email.ordem = maxOrdem + 1;
|
|
1977
|
+
}
|
|
1978
|
+
// --- Fim da Modificação ---
|
|
1979
|
+
if (this.validar(this.email) == false)
|
|
1980
|
+
return;
|
|
1981
|
+
this.emailSalvo = this.email;
|
|
1982
|
+
this.salvarclose();
|
|
1983
|
+
}
|
|
1984
|
+
compararTipos(t1, t2) {
|
|
1985
|
+
return t1 && t2 && t1 === t2;
|
|
1986
|
+
}
|
|
1987
|
+
onTipoSelecionado(codigoSelecionado) {
|
|
1988
|
+
const tipoSelecionado = this.listaTipoEmail.find(t => t.codigo === codigoSelecionado);
|
|
1989
|
+
if (tipoSelecionado) {
|
|
1990
|
+
this.email.tipo = tipoSelecionado.denominacao;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
/**
|
|
1994
|
+
* Valida o objeto de e-mail, replicando as regras do validador do backend.
|
|
1995
|
+
* Retorna true se o e-mail for válido, false caso contrário.
|
|
1996
|
+
*/
|
|
1997
|
+
validar(emailToValidate) {
|
|
1998
|
+
// 1. Validação de campo obrigatório (do Java)
|
|
1999
|
+
if (!emailToValidate.email || emailToValidate.email.trim() === '') {
|
|
2000
|
+
this.openSnackBar("E-mail é um campo obrigatório.");
|
|
2001
|
+
return false;
|
|
2002
|
+
}
|
|
2003
|
+
// 2. Validação de Tamanho Máximo (do Java)
|
|
2004
|
+
if (emailToValidate.email.trim().length > 60) {
|
|
2005
|
+
this.openSnackBar("E-mail deve ter no máximo 60 caracteres.");
|
|
2006
|
+
return false;
|
|
2007
|
+
}
|
|
2008
|
+
// 3. Validação de formato de e-mail (do Java e do Angular)
|
|
2009
|
+
// [Java: !Validadores.validarEmail(request.getEmail())]
|
|
2010
|
+
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
2011
|
+
if (!emailRegex.test(emailToValidate.email)) {
|
|
2012
|
+
this.openSnackBar("Digite um E-mail válido.");
|
|
2013
|
+
return false;
|
|
2014
|
+
}
|
|
2015
|
+
// 4. Validação de e-mail duplicado (do seu Angular)
|
|
2016
|
+
const isDuplicate = this.emailsList.some(existingEmail => existingEmail.email?.toLowerCase() === emailToValidate.email?.toLowerCase() &&
|
|
2017
|
+
existingEmail.codigo !== emailToValidate.codigo // Ignora o próprio e-mail se estiver sendo editado
|
|
2018
|
+
);
|
|
2019
|
+
if (isDuplicate) {
|
|
2020
|
+
this.openSnackBar("Este e-mail já existe na lista.");
|
|
2021
|
+
return false;
|
|
2022
|
+
}
|
|
2023
|
+
// Nota: As validações de 'ordemEmail' e 'tipoEmailCodigo' do Java
|
|
2024
|
+
// já são tratadas na sua função 'salvar()',
|
|
2025
|
+
// que atribui valores padrão antes desta função 'validar()' ser chamada.
|
|
2026
|
+
return true; // Passou em todas as validações!
|
|
2027
|
+
}
|
|
2028
|
+
close() {
|
|
2029
|
+
this.dialogRef.close(null);
|
|
2030
|
+
}
|
|
2031
|
+
salvarclose() {
|
|
2032
|
+
this.dialogRef.close(this.emailSalvo);
|
|
2033
|
+
}
|
|
2034
|
+
handleError(erro) {
|
|
2035
|
+
let erroTratado;
|
|
2036
|
+
// Converte string local em Objeto Padrão
|
|
2037
|
+
if (typeof erro === 'string') {
|
|
2038
|
+
erroTratado = {
|
|
2039
|
+
status: 400,
|
|
2040
|
+
mensagemSimples: erro,
|
|
2041
|
+
mensagemHtml: `<strong>${erro}</strong>`
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
else {
|
|
2045
|
+
erroTratado = erro;
|
|
2046
|
+
}
|
|
2047
|
+
// 1. SnackBar
|
|
2048
|
+
if (erroTratado.mensagemSimples) {
|
|
2049
|
+
this.openSnackBar(erroTratado.mensagemSimples);
|
|
2050
|
+
}
|
|
2051
|
+
// 2. AlertService (Se houver tag <unb-mensagem> no HTML do dialog)
|
|
2052
|
+
if (this.alertService && erroTratado.mensagemHtml) {
|
|
2053
|
+
this.alertService.showMessage(erroTratado.mensagemHtml, UnbTipoMensagemEnum.DANGER, this.idMensagemService);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
openSnackBar(message) {
|
|
2057
|
+
this.snackBar.open(message, 'x', {
|
|
2058
|
+
duration: 5000,
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaEmailFormComponent, deps: [{ token: i1$1.MatSnackBar }, { token: UnBPessoaService }, { token: UnbMensagemService }, { token: i4$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2062
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaEmailFormComponent, isStandalone: false, selector: "lib-unb-pessoa-email-form", ngImport: i0, template: "<h1 mat-dialog-title>Cadastro de E-mail</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"email.tipoEmailCodigo\" [compareWith]=\"compararTipos\" name=\"tipoEmailCodigo\" (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoEmail\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>E-mail</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"email.email\" name=\"emailValue\" #emailValue=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-60{flex:1 1 60%}.form-70{flex:1 1 70%}.form-80{flex:1 1 80%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UnbMensagemComponent, selector: "unb-mensagem", inputs: ["mensagem", "tipo", "identificador"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i4$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i11.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }] }); }
|
|
2063
|
+
}
|
|
2064
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaEmailFormComponent, decorators: [{
|
|
2065
|
+
type: Component,
|
|
2066
|
+
args: [{ standalone: false, selector: 'lib-unb-pessoa-email-form', template: "<h1 mat-dialog-title>Cadastro de E-mail</h1>\r\n<form (ngSubmit)=\"salvar(form)\" #form=\"ngForm\">\r\n <mat-dialog-content>\r\n <unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>Tipo</mat-label>\r\n <mat-select [(ngModel)]=\"email.tipoEmailCodigo\" [compareWith]=\"compararTipos\" name=\"tipoEmailCodigo\" (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of listaTipoEmail\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>E-mail</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"email.email\" name=\"emailValue\" #emailValue=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n </div>\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button type=\"button\" color=\"warn\" (click)=\"close()\">Fechar</button>\r\n <button mat-flat-button type=\"submit\" color=\"primary\">Salvar</button>\r\n </mat-dialog-actions>\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin:10px}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-60{flex:1 1 60%}.form-70{flex:1 1 70%}.form-80{flex:1 1 80%}.form-100{flex:1 1 100%;min-width:250px}.botoes-container{display:flex;gap:5px}@media(max-width:600px){.botoes-container{margin-bottom:10px}.botoes-container button{flex:1;max-width:50%}}\n"] }]
|
|
2067
|
+
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: UnbMensagemService }, { type: i4$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
2068
|
+
type: Inject,
|
|
2069
|
+
args: [MAT_DIALOG_DATA]
|
|
2070
|
+
}] }] });
|
|
2071
|
+
|
|
2073
2072
|
class UnbPessoaEmailListComponent {
|
|
2074
2073
|
constructor(snackBar, service, dialog) {
|
|
2075
2074
|
this.snackBar = snackBar;
|
|
@@ -2411,31 +2410,83 @@ class UnbPessoaFormComponent {
|
|
|
2411
2410
|
this.alertService.showMessage(erro.mensagemHtml, UnbTipoMensagemEnum.DANGER, this.idMensagemService);
|
|
2412
2411
|
}
|
|
2413
2412
|
}
|
|
2414
|
-
getLabelDocumento() {
|
|
2415
|
-
switch (this.config.pessoa.tipoPessoa) {
|
|
2416
|
-
case this.tipoPessoaEnum().FISICA: return 'CPF';
|
|
2417
|
-
case this.tipoPessoaEnum().JURIDICA: return 'CNPJ';
|
|
2418
|
-
case this.tipoPessoaEnum().ESTRANGEIRA: return 'Passaporte';
|
|
2419
|
-
default: return 'Documento';
|
|
2413
|
+
getLabelDocumento() {
|
|
2414
|
+
switch (this.config.pessoa.tipoPessoa) {
|
|
2415
|
+
case this.tipoPessoaEnum().FISICA: return 'CPF';
|
|
2416
|
+
case this.tipoPessoaEnum().JURIDICA: return 'CNPJ';
|
|
2417
|
+
case this.tipoPessoaEnum().ESTRANGEIRA: return 'Passaporte';
|
|
2418
|
+
default: return 'Documento';
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaFormComponent, deps: [{ token: UnBPessoaService }, { token: i1$1.MatSnackBar }, { token: UnbMensagemService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2422
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaFormComponent, isStandalone: false, selector: "lib-unb-pessoa-form", inputs: { config: "config", hideSalvarButton: "hideSalvarButton" }, outputs: { pessoaEmitted: "pessoaEmitted", isLoadingChange: "isLoadingChange" }, viewQueries: [{ propertyName: "pessoaForm", first: true, predicate: ["pessoaForm"], descendants: true }], ngImport: i0, template: "<mat-progress-bar *ngIf=\"isLoading\" mode=\"indeterminate\"></mat-progress-bar>\r\n\r\n<unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n\r\n<!-- Label indicando que est\u00E1 incluindo nova pessoa -->\r\n<div *ngIf=\"documentoPesquisado\"\r\n class=\"status-banner\" \r\n [ngClass]=\"{\r\n 'status-inclusao': !pessoa.codigoPessoa,\r\n 'status-edicao': pessoa.codigoPessoa && !isReadyOnly,\r\n 'status-bloqueado': config.isReadyOnly\r\n }\">\r\n\r\n <mat-icon>\r\n {{ !pessoa.codigoPessoa ? 'person_add' : (isReadyOnly ? 'lock' : 'edit') }}\r\n </mat-icon>\r\n\r\n <span>\r\n <ng-container *ngIf=\"!pessoa.codigoPessoa\">Incluindo nova pessoa</ng-container>\r\n <ng-container *ngIf=\"pessoa.codigoPessoa && !isReadyOnly\">Editando pessoa</ng-container>\r\n <ng-container *ngIf=\"isReadyOnly\">Registro SIAPE (Visualiza\u00E7\u00E3o)</ng-container> com <strong>{{ getLabelDocumento() }} {{ documentoPesquisado }}</strong>\r\n </span>\r\n</div>\r\n\r\n<form #pessoaForm=\"ngForm\" [class.readonly]=\"isReadyOnly || isLoading\" class=\"form-container\" (ngSubmit)=\"salvar(pessoaForm)\">\r\n <!-- Campos Pessoa F\u00EDsica e Estrangeira -->\r\n <ng-container\r\n *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA || pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA\">\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nome\" name=\"nome\" #nome=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Sexo</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoSexo\" name=\"codigoSexo\" #codigoSexo=\"ngModel\" required>\r\n <mat-option [value]=\"1\">Masculino</mat-option>\r\n <mat-option [value]=\"2\">Feminino</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Data Nascimento</mat-label>\r\n <input matInput [matDatepicker]=\"dataNascimentoPicker\" [(ngModel)]=\"pessoa.dataNascimento\" name=\"dataNascimento\"\r\n #dataNascimento=\"ngModel\" required>\r\n <mat-datepicker-toggle matSuffix [for]=\"dataNascimentoPicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #dataNascimentoPicker></mat-datepicker>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Estado Civil</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoEstadoCivil\" name=\"codigoEstadoCivil\" #codigoEstadoCivil=\"ngModel\">\r\n <mat-option *ngFor=\"let estado of estadosCivil | async\" [value]=\"estado.codigo\">\r\n {{ estado.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <!--\r\n <mat-form-field class=\"form-15\" appearance=\"outline\">\r\n <mat-label>Naturalidade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.naturalidade\" name=\"naturalidade\" #naturalidade=\"ngModel\" required>\r\n <mat-option *ngFor=\"let cidade of getListaEstados()\" [value]=\"cidade.codigo\">\r\n {{ cidade.descricao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n -->\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisNascimento\" name=\"codigoPaisNascimento\" #codigoPaisNascimento=\"ngModel\"\r\n required>\r\n <mat-option *ngFor=\"let paisNascimento of paises | async\" [value]=\"paisNascimento.codigo\">\r\n <span *ngIf=\"paisNascimento.denominacao === 'BRASIL'\">\uD83C\uDDE7\uD83C\uDDF7 <b>{{ paisNascimento.denominacao }}</b></span>\r\n <span *ngIf=\"paisNascimento.denominacao !== 'BRASIL'\">{{ paisNascimento.denominacao }}</span>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\" *ngIf=\"pessoa.codigoPaisNascimento == 22\"> <!-- 22 eh Brasil-->\r\n <mat-label>UF Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.ufNascimento\" name=\"ufNascimento\" #ufNascimento=\"ngModel\" required>\r\n <mat-option *ngFor=\"let estado of getListaEstados()\" [value]=\"estado.identificador\">\r\n {{ estado.identificador }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\" *ngIf=\"pessoa.codigoPaisNascimento == 22\">\r\n <mat-label>Naturalidade</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.naturalidade\" name=\"naturalidade\" #naturalidade=\"ngModel\"\r\n required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Escolaridade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.escolaridade\" name=\"codigoEscolaridade\" #codigoEscolaridade=\"ngModel\" required>\r\n <mat-option *ngFor=\"let escolaridade of escolaridade | async\" [value]=\"escolaridade.codigo\">\r\n {{ escolaridade.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome Social</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeSocial\" name=\"nomeSocial\" #nomeSocial=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome da M\u00E3e</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeMae\" name=\"nomeMae\" #nomeMae=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome do Pai</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomePai\" name=\"nomePai\" #nomePai=\"ngModel\" required />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- Campos Pessoa Jur\u00EDdica -->\r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().JURIDICA\">\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Raz\u00E3o Social</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.razaoSocial\" name=\"razaoSocial\" />\r\n </mat-form-field>\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome Fantasia</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeFantasia\" name=\"nomeFantasia\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA\">\r\n <b style=\"flex: 1 1 100%; margin-bottom: 10px;\">Documenta\u00E7\u00E3o</b>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Identidade</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rg\" name=\"rg\" #rg=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>\u00D3rg\u00E3o Emissor</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rgOrgao\" name=\"rgOrgao\" #rgOrgao=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Unidade Federativa</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.rgUf\" name=\"rgUf\" #rgUf=\"ngModel\" required>\r\n <mat-option *ngFor=\"let estado of getListaEstados()\" [value]=\"estado.identificador\">\r\n {{ estado.identificador }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Data de Emiss\u00E3o</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rgDataEmissao\" name=\"rgDataEmissao\" #rgDataEmissao=\"ngModel\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa != tipoPessoaEnum().JURIDICA && (pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA || pessoa.codigoPaisNascimento != 22)\">\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>Data Chegada Brasil</mat-label>\r\n <input matInput [matDatepicker]=\"dataChegadaBrasilPicker\" [(ngModel)]=\"pessoa.dataChegadaBrasil\"\r\n name=\"dataChegadaBrasil\" #dataChegadaBrasil=\"ngModel\" required>\r\n <mat-datepicker-toggle matSuffix [for]=\"dataChegadaBrasilPicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #dataChegadaBrasilPicker></mat-datepicker>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Passaporte</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisPassaporte\" name=\"codigoPaisPassaporte\" #codigoPaisPassaporte=\"ngModel\"\r\n required>\r\n <mat-option *ngFor=\"let paisNascimento of paises | async\" [value]=\"paisNascimento.codigo\">\r\n {{ paisNascimento.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>N\u00FAmero Passaporte</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.passaporte\" name=\"passaporte\" #passaporte=\"ngModel\" required />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <lib-unb-pessoa-telefone-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [telefones]=\"pessoa.telefones\"\r\n (telefonesEmitted)=\"telefonesEmitted($event)\"></lib-unb-pessoa-telefone-list>\r\n\r\n <lib-unb-pessoa-endereco-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [enderecos]=\"pessoa.enderecos\"\r\n (enderecosEmitted)=\"enderecosEmitted($event)\"></lib-unb-pessoa-endereco-list>\r\n\r\n <lib-unb-pessoa-email-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [emails]=\"pessoa.emails\"\r\n (emailsEmitted)=\"emailsEmitted($event)\"></lib-unb-pessoa-email-list>\r\n\r\n <div *ngIf=\"isReadyOnly\" style=\"flex:1 1 100%; margin-bottom:10px;\">\r\n <mat-card>\r\n <mat-card-content>\r\n <strong>Servidor com matr\u00EDcula SIAPE deve ter seus dados autalizados pelo aplicativo do sougov</strong>\r\n </mat-card-content>\r\n </mat-card>\r\n </div>\r\n\r\n <mat-card-actions class=\"card-actions-buttons\" *ngIf=\"!hideSalvarButton\">\r\n <button mat-flat-button [disabled]=\"isLoading || isReadyOnly\" type=\"submit\" color=\"primary\">\r\n Salvar\r\n </button>\r\n </mat-card-actions>\r\n\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin-top:5px}:host{display:block}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.readonly{pointer-events:none;opacity:.6}.disabled-wrapper{pointer-events:none;opacity:.6;filter:grayscale(1)}.status-banner{display:flex;align-items:center;gap:8px;padding:10px 16px;margin:2px 0 20px;border-radius:6px;font-size:14px;font-weight:500}.status-banner.status-inclusao{background-color:#e3f2fd;color:#1565c0;border:1px solid #bbdefb}.status-banner.status-edicao{background-color:#fff3e0;color:#ef6c00;border:1px solid #ffe0b2}.status-banner.status-bloqueado{background-color:#fce4ec;color:#c2185b;border:1px solid #f8bbd0}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UnbMensagemComponent, selector: "unb-mensagem", inputs: ["mensagem", "tipo", "identificador"] }, { kind: "component", type: i9$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i9$1.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i9$1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i11.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i13$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i14.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i14.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i14.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: UnbPessoaTelefoneListComponent, selector: "lib-unb-pessoa-telefone-list", inputs: ["podeEditar", "telefones", "backendURL"], outputs: ["telefonesEmitted"] }, { kind: "component", type: UnbPessoaenderecoListComponent, selector: "lib-unb-pessoa-endereco-list", inputs: ["podeEditar", "enderecos", "backendURL"], outputs: ["enderecosEmitted"] }, { kind: "component", type: UnbPessoaEmailListComponent, selector: "lib-unb-pessoa-email-list", inputs: ["podeEditar", "emails", "backendURL"], outputs: ["emailsEmitted"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] }); }
|
|
2423
|
+
}
|
|
2424
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaFormComponent, decorators: [{
|
|
2425
|
+
type: Component,
|
|
2426
|
+
args: [{ selector: 'lib-unb-pessoa-form', standalone: false, template: "<mat-progress-bar *ngIf=\"isLoading\" mode=\"indeterminate\"></mat-progress-bar>\r\n\r\n<unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n\r\n<!-- Label indicando que est\u00E1 incluindo nova pessoa -->\r\n<div *ngIf=\"documentoPesquisado\"\r\n class=\"status-banner\" \r\n [ngClass]=\"{\r\n 'status-inclusao': !pessoa.codigoPessoa,\r\n 'status-edicao': pessoa.codigoPessoa && !isReadyOnly,\r\n 'status-bloqueado': config.isReadyOnly\r\n }\">\r\n\r\n <mat-icon>\r\n {{ !pessoa.codigoPessoa ? 'person_add' : (isReadyOnly ? 'lock' : 'edit') }}\r\n </mat-icon>\r\n\r\n <span>\r\n <ng-container *ngIf=\"!pessoa.codigoPessoa\">Incluindo nova pessoa</ng-container>\r\n <ng-container *ngIf=\"pessoa.codigoPessoa && !isReadyOnly\">Editando pessoa</ng-container>\r\n <ng-container *ngIf=\"isReadyOnly\">Registro SIAPE (Visualiza\u00E7\u00E3o)</ng-container> com <strong>{{ getLabelDocumento() }} {{ documentoPesquisado }}</strong>\r\n </span>\r\n</div>\r\n\r\n<form #pessoaForm=\"ngForm\" [class.readonly]=\"isReadyOnly || isLoading\" class=\"form-container\" (ngSubmit)=\"salvar(pessoaForm)\">\r\n <!-- Campos Pessoa F\u00EDsica e Estrangeira -->\r\n <ng-container\r\n *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA || pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA\">\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nome\" name=\"nome\" #nome=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Sexo</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoSexo\" name=\"codigoSexo\" #codigoSexo=\"ngModel\" required>\r\n <mat-option [value]=\"1\">Masculino</mat-option>\r\n <mat-option [value]=\"2\">Feminino</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Data Nascimento</mat-label>\r\n <input matInput [matDatepicker]=\"dataNascimentoPicker\" [(ngModel)]=\"pessoa.dataNascimento\" name=\"dataNascimento\"\r\n #dataNascimento=\"ngModel\" required>\r\n <mat-datepicker-toggle matSuffix [for]=\"dataNascimentoPicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #dataNascimentoPicker></mat-datepicker>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Estado Civil</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoEstadoCivil\" name=\"codigoEstadoCivil\" #codigoEstadoCivil=\"ngModel\">\r\n <mat-option *ngFor=\"let estado of estadosCivil | async\" [value]=\"estado.codigo\">\r\n {{ estado.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <!--\r\n <mat-form-field class=\"form-15\" appearance=\"outline\">\r\n <mat-label>Naturalidade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.naturalidade\" name=\"naturalidade\" #naturalidade=\"ngModel\" required>\r\n <mat-option *ngFor=\"let cidade of getListaEstados()\" [value]=\"cidade.codigo\">\r\n {{ cidade.descricao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n -->\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisNascimento\" name=\"codigoPaisNascimento\" #codigoPaisNascimento=\"ngModel\"\r\n required>\r\n <mat-option *ngFor=\"let paisNascimento of paises | async\" [value]=\"paisNascimento.codigo\">\r\n <span *ngIf=\"paisNascimento.denominacao === 'BRASIL'\">\uD83C\uDDE7\uD83C\uDDF7 <b>{{ paisNascimento.denominacao }}</b></span>\r\n <span *ngIf=\"paisNascimento.denominacao !== 'BRASIL'\">{{ paisNascimento.denominacao }}</span>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\" *ngIf=\"pessoa.codigoPaisNascimento == 22\"> <!-- 22 eh Brasil-->\r\n <mat-label>UF Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.ufNascimento\" name=\"ufNascimento\" #ufNascimento=\"ngModel\" required>\r\n <mat-option *ngFor=\"let estado of getListaEstados()\" [value]=\"estado.identificador\">\r\n {{ estado.identificador }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\" *ngIf=\"pessoa.codigoPaisNascimento == 22\">\r\n <mat-label>Naturalidade</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.naturalidade\" name=\"naturalidade\" #naturalidade=\"ngModel\"\r\n required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Escolaridade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.escolaridade\" name=\"codigoEscolaridade\" #codigoEscolaridade=\"ngModel\" required>\r\n <mat-option *ngFor=\"let escolaridade of escolaridade | async\" [value]=\"escolaridade.codigo\">\r\n {{ escolaridade.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome Social</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeSocial\" name=\"nomeSocial\" #nomeSocial=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome da M\u00E3e</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeMae\" name=\"nomeMae\" #nomeMae=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome do Pai</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomePai\" name=\"nomePai\" #nomePai=\"ngModel\" required />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- Campos Pessoa Jur\u00EDdica -->\r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().JURIDICA\">\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Raz\u00E3o Social</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.razaoSocial\" name=\"razaoSocial\" />\r\n </mat-form-field>\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome Fantasia</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeFantasia\" name=\"nomeFantasia\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA\">\r\n <b style=\"flex: 1 1 100%; margin-bottom: 10px;\">Documenta\u00E7\u00E3o</b>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Identidade</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rg\" name=\"rg\" #rg=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>\u00D3rg\u00E3o Emissor</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rgOrgao\" name=\"rgOrgao\" #rgOrgao=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Unidade Federativa</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.rgUf\" name=\"rgUf\" #rgUf=\"ngModel\" required>\r\n <mat-option *ngFor=\"let estado of getListaEstados()\" [value]=\"estado.identificador\">\r\n {{ estado.identificador }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Data de Emiss\u00E3o</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rgDataEmissao\" name=\"rgDataEmissao\" #rgDataEmissao=\"ngModel\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa != tipoPessoaEnum().JURIDICA && (pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA || pessoa.codigoPaisNascimento != 22)\">\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>Data Chegada Brasil</mat-label>\r\n <input matInput [matDatepicker]=\"dataChegadaBrasilPicker\" [(ngModel)]=\"pessoa.dataChegadaBrasil\"\r\n name=\"dataChegadaBrasil\" #dataChegadaBrasil=\"ngModel\" required>\r\n <mat-datepicker-toggle matSuffix [for]=\"dataChegadaBrasilPicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #dataChegadaBrasilPicker></mat-datepicker>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Passaporte</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisPassaporte\" name=\"codigoPaisPassaporte\" #codigoPaisPassaporte=\"ngModel\"\r\n required>\r\n <mat-option *ngFor=\"let paisNascimento of paises | async\" [value]=\"paisNascimento.codigo\">\r\n {{ paisNascimento.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>N\u00FAmero Passaporte</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.passaporte\" name=\"passaporte\" #passaporte=\"ngModel\" required />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <lib-unb-pessoa-telefone-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [telefones]=\"pessoa.telefones\"\r\n (telefonesEmitted)=\"telefonesEmitted($event)\"></lib-unb-pessoa-telefone-list>\r\n\r\n <lib-unb-pessoa-endereco-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [enderecos]=\"pessoa.enderecos\"\r\n (enderecosEmitted)=\"enderecosEmitted($event)\"></lib-unb-pessoa-endereco-list>\r\n\r\n <lib-unb-pessoa-email-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [emails]=\"pessoa.emails\"\r\n (emailsEmitted)=\"emailsEmitted($event)\"></lib-unb-pessoa-email-list>\r\n\r\n <div *ngIf=\"isReadyOnly\" style=\"flex:1 1 100%; margin-bottom:10px;\">\r\n <mat-card>\r\n <mat-card-content>\r\n <strong>Servidor com matr\u00EDcula SIAPE deve ter seus dados autalizados pelo aplicativo do sougov</strong>\r\n </mat-card-content>\r\n </mat-card>\r\n </div>\r\n\r\n <mat-card-actions class=\"card-actions-buttons\" *ngIf=\"!hideSalvarButton\">\r\n <button mat-flat-button [disabled]=\"isLoading || isReadyOnly\" type=\"submit\" color=\"primary\">\r\n Salvar\r\n </button>\r\n </mat-card-actions>\r\n\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin-top:5px}:host{display:block}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.readonly{pointer-events:none;opacity:.6}.disabled-wrapper{pointer-events:none;opacity:.6;filter:grayscale(1)}.status-banner{display:flex;align-items:center;gap:8px;padding:10px 16px;margin:2px 0 20px;border-radius:6px;font-size:14px;font-weight:500}.status-banner.status-inclusao{background-color:#e3f2fd;color:#1565c0;border:1px solid #bbdefb}.status-banner.status-edicao{background-color:#fff3e0;color:#ef6c00;border:1px solid #ffe0b2}.status-banner.status-bloqueado{background-color:#fce4ec;color:#c2185b;border:1px solid #f8bbd0}\n"] }]
|
|
2427
|
+
}], ctorParameters: () => [{ type: UnBPessoaService }, { type: i1$1.MatSnackBar }, { type: UnbMensagemService }], propDecorators: { pessoaForm: [{
|
|
2428
|
+
type: ViewChild,
|
|
2429
|
+
args: ['pessoaForm']
|
|
2430
|
+
}], config: [{
|
|
2431
|
+
type: Input
|
|
2432
|
+
}], hideSalvarButton: [{
|
|
2433
|
+
type: Input
|
|
2434
|
+
}], pessoaEmitted: [{
|
|
2435
|
+
type: Output
|
|
2436
|
+
}], isLoadingChange: [{
|
|
2437
|
+
type: Output
|
|
2438
|
+
}] } });
|
|
2439
|
+
|
|
2440
|
+
class UnbPessoaFormDialogComponent {
|
|
2441
|
+
constructor(dialogRef, data) {
|
|
2442
|
+
this.dialogRef = dialogRef;
|
|
2443
|
+
this.config = new UnbPessoaFormConfig();
|
|
2444
|
+
this.pessoaEmitted = new EventEmitter();
|
|
2445
|
+
this.isLoading = false;
|
|
2446
|
+
this.titulo = 'Cadastro de Pessoa';
|
|
2447
|
+
if (data && data.config) {
|
|
2448
|
+
this.config = data.config;
|
|
2449
|
+
// Ajusta o título dependendo se é edição ou inclusão
|
|
2450
|
+
if (this.config.pessoa && this.config.pessoa.codigoPessoa) {
|
|
2451
|
+
this.titulo = 'Editando Pessoa';
|
|
2452
|
+
}
|
|
2453
|
+
else {
|
|
2454
|
+
this.titulo = 'Nova Pessoa';
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
onLoadingChange($event) {
|
|
2459
|
+
this.isLoading = $event;
|
|
2460
|
+
}
|
|
2461
|
+
fechar() {
|
|
2462
|
+
this.dialogRef.close();
|
|
2463
|
+
}
|
|
2464
|
+
// se salvar, jah fecha emite o valor salvo. Nao posso deixar aberto, senao vai emitir o close vazio. E o dono nao vai receber a pessoa
|
|
2465
|
+
onSalvarSucesso($event) {
|
|
2466
|
+
this.dialogRef.close($event);
|
|
2467
|
+
}
|
|
2468
|
+
submitForm() {
|
|
2469
|
+
// chama o salvar lah do form.
|
|
2470
|
+
if (this.pessoaFormComponent && this.pessoaFormComponent.pessoaForm) {
|
|
2471
|
+
this.pessoaFormComponent.salvar(this.pessoaFormComponent.pessoaForm);
|
|
2420
2472
|
}
|
|
2421
2473
|
}
|
|
2422
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
2423
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaFormComponent, isStandalone: false, selector: "lib-unb-pessoa-form", inputs: { config: "config", hideSalvarButton: "hideSalvarButton" }, outputs: { pessoaEmitted: "pessoaEmitted", isLoadingChange: "isLoadingChange" }, viewQueries: [{ propertyName: "pessoaForm", first: true, predicate: ["pessoaForm"], descendants: true }], ngImport: i0, template: "<mat-progress-bar *ngIf=\"isLoading\" mode=\"indeterminate\"></mat-progress-bar>\r\n\r\n<unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n\r\n<!-- Label indicando que est\u00E1 incluindo nova pessoa -->\r\n<div *ngIf=\"documentoPesquisado\"\r\n class=\"status-banner\" \r\n [ngClass]=\"{\r\n 'status-inclusao': !pessoa.codigoPessoa,\r\n 'status-edicao': pessoa.codigoPessoa && !isReadyOnly,\r\n 'status-bloqueado': config.isReadyOnly\r\n }\">\r\n\r\n <mat-icon>\r\n {{ !pessoa.codigoPessoa ? 'person_add' : (isReadyOnly ? 'lock' : 'edit') }}\r\n </mat-icon>\r\n\r\n <span>\r\n <ng-container *ngIf=\"!pessoa.codigoPessoa\">Incluindo nova pessoa</ng-container>\r\n <ng-container *ngIf=\"pessoa.codigoPessoa && !isReadyOnly\">Editando pessoa</ng-container>\r\n <ng-container *ngIf=\"isReadyOnly\">Registro SIAPE (Visualiza\u00E7\u00E3o)</ng-container> com <strong>{{ getLabelDocumento() }} {{ documentoPesquisado }}</strong>\r\n </span>\r\n</div>\r\n\r\n<form #pessoaForm=\"ngForm\" [class.readonly]=\"isReadyOnly || isLoading\" class=\"form-container\" (ngSubmit)=\"salvar(pessoaForm)\">\r\n <!-- Campos Pessoa F\u00EDsica e Estrangeira -->\r\n <ng-container\r\n *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA || pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA\">\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nome\" name=\"nome\" #nome=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Sexo</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoSexo\" name=\"codigoSexo\" #codigoSexo=\"ngModel\" required>\r\n <mat-option [value]=\"1\">Masculino</mat-option>\r\n <mat-option [value]=\"2\">Feminino</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Data Nascimento</mat-label>\r\n <input matInput [matDatepicker]=\"dataNascimentoPicker\" [(ngModel)]=\"pessoa.dataNascimento\" name=\"dataNascimento\"\r\n #dataNascimento=\"ngModel\" required>\r\n <mat-datepicker-toggle matSuffix [for]=\"dataNascimentoPicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #dataNascimentoPicker></mat-datepicker>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Estado Civil</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoEstadoCivil\" name=\"codigoEstadoCivil\" #codigoEstadoCivil=\"ngModel\">\r\n <mat-option *ngFor=\"let estado of estadosCivil | async\" [value]=\"estado.codigo\">\r\n {{ estado.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <!--\r\n <mat-form-field class=\"form-15\" appearance=\"outline\">\r\n <mat-label>Naturalidade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.naturalidade\" name=\"naturalidade\" #naturalidade=\"ngModel\" required>\r\n <mat-option *ngFor=\"let cidade of getListaEstados()\" [value]=\"cidade.codigo\">\r\n {{ cidade.descricao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n -->\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisNascimento\" name=\"codigoPaisNascimento\" #codigoPaisNascimento=\"ngModel\"\r\n required>\r\n <mat-option *ngFor=\"let paisNascimento of paises | async\" [value]=\"paisNascimento.codigo\">\r\n <span *ngIf=\"paisNascimento.denominacao === 'BRASIL'\">\uD83C\uDDE7\uD83C\uDDF7 <b>{{ paisNascimento.denominacao }}</b></span>\r\n <span *ngIf=\"paisNascimento.denominacao !== 'BRASIL'\">{{ paisNascimento.denominacao }}</span>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\" *ngIf=\"pessoa.codigoPaisNascimento == 22\"> <!-- 22 eh Brasil-->\r\n <mat-label>UF Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.ufNascimento\" name=\"ufNascimento\" #ufNascimento=\"ngModel\" required>\r\n <mat-option *ngFor=\"let estado of getListaEstados()\" [value]=\"estado.identificador\">\r\n {{ estado.identificador }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\" *ngIf=\"pessoa.codigoPaisNascimento == 22\">\r\n <mat-label>Naturalidade</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.naturalidade\" name=\"naturalidade\" #naturalidade=\"ngModel\"\r\n required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Escolaridade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.escolaridade\" name=\"codigoEscolaridade\" #codigoEscolaridade=\"ngModel\" required>\r\n <mat-option *ngFor=\"let escolaridade of escolaridade | async\" [value]=\"escolaridade.codigo\">\r\n {{ escolaridade.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome Social</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeSocial\" name=\"nomeSocial\" #nomeSocial=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome da M\u00E3e</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeMae\" name=\"nomeMae\" #nomeMae=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome do Pai</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomePai\" name=\"nomePai\" #nomePai=\"ngModel\" required />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- Campos Pessoa Jur\u00EDdica -->\r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().JURIDICA\">\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Raz\u00E3o Social</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.razaoSocial\" name=\"razaoSocial\" />\r\n </mat-form-field>\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome Fantasia</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeFantasia\" name=\"nomeFantasia\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA\">\r\n <b style=\"flex: 1 1 100%; margin-bottom: 10px;\">Documenta\u00E7\u00E3o</b>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Identidade</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rg\" name=\"rg\" #rg=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>\u00D3rg\u00E3o Emissor</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rgOrgao\" name=\"rgOrgao\" #rgOrgao=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Unidade Federativa</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.rgUf\" name=\"rgUf\" #rgUf=\"ngModel\" required>\r\n <mat-option *ngFor=\"let estado of getListaEstados()\" [value]=\"estado.identificador\">\r\n {{ estado.identificador }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Data de Emiss\u00E3o</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rgDataEmissao\" name=\"rgDataEmissao\" #rgDataEmissao=\"ngModel\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa != tipoPessoaEnum().JURIDICA && (pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA || pessoa.codigoPaisNascimento != 22)\">\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>Data Chegada Brasil</mat-label>\r\n <input matInput [matDatepicker]=\"dataChegadaBrasilPicker\" [(ngModel)]=\"pessoa.dataChegadaBrasil\"\r\n name=\"dataChegadaBrasil\" #dataChegadaBrasil=\"ngModel\" required>\r\n <mat-datepicker-toggle matSuffix [for]=\"dataChegadaBrasilPicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #dataChegadaBrasilPicker></mat-datepicker>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Passaporte</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisPassaporte\" name=\"codigoPaisPassaporte\" #codigoPaisPassaporte=\"ngModel\"\r\n required>\r\n <mat-option *ngFor=\"let paisNascimento of paises | async\" [value]=\"paisNascimento.codigo\">\r\n {{ paisNascimento.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>N\u00FAmero Passaporte</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.passaporte\" name=\"passaporte\" #passaporte=\"ngModel\" required />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <lib-unb-pessoa-telefone-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [telefones]=\"pessoa.telefones\"\r\n (telefonesEmitted)=\"telefonesEmitted($event)\"></lib-unb-pessoa-telefone-list>\r\n\r\n <lib-unb-pessoa-endereco-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [enderecos]=\"pessoa.enderecos\"\r\n (enderecosEmitted)=\"enderecosEmitted($event)\"></lib-unb-pessoa-endereco-list>\r\n\r\n <lib-unb-pessoa-email-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [emails]=\"pessoa.emails\"\r\n (emailsEmitted)=\"emailsEmitted($event)\"></lib-unb-pessoa-email-list>\r\n\r\n <div *ngIf=\"isReadyOnly\" style=\"flex:1 1 100%; margin-bottom:10px;\">\r\n <mat-card>\r\n <mat-card-content>\r\n <strong>Servidor com matr\u00EDcula SIAPE deve ter seus dados autalizados pelo aplicativo do sougov</strong>\r\n </mat-card-content>\r\n </mat-card>\r\n </div>\r\n\r\n <mat-card-actions class=\"card-actions-buttons\" *ngIf=\"!hideSalvarButton\">\r\n <button mat-flat-button [disabled]=\"isLoading || isReadyOnly\" type=\"submit\" color=\"primary\">\r\n Salvar\r\n </button>\r\n </mat-card-actions>\r\n\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin-top:5px}:host{display:block}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.readonly{pointer-events:none;opacity:.6}.disabled-wrapper{pointer-events:none;opacity:.6;filter:grayscale(1)}.status-banner{display:flex;align-items:center;gap:8px;padding:10px 16px;margin:2px 0 20px;border-radius:6px;font-size:14px;font-weight:500}.status-banner.status-inclusao{background-color:#e3f2fd;color:#1565c0;border:1px solid #bbdefb}.status-banner.status-edicao{background-color:#fff3e0;color:#ef6c00;border:1px solid #ffe0b2}.status-banner.status-bloqueado{background-color:#fce4ec;color:#c2185b;border:1px solid #f8bbd0}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UnbMensagemComponent, selector: "unb-mensagem", inputs: ["mensagem", "tipo", "identificador"] }, { kind: "component", type: i9$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i9$1.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i9$1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i11.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i13$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i14.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i14.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i14.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: UnbPessoaTelefoneListComponent, selector: "lib-unb-pessoa-telefone-list", inputs: ["podeEditar", "telefones", "backendURL"], outputs: ["telefonesEmitted"] }, { kind: "component", type: UnbPessoaenderecoListComponent, selector: "lib-unb-pessoa-endereco-list", inputs: ["podeEditar", "enderecos", "backendURL"], outputs: ["enderecosEmitted"] }, { kind: "component", type: UnbPessoaEmailListComponent, selector: "lib-unb-pessoa-email-list", inputs: ["podeEditar", "emails", "backendURL"], outputs: ["emailsEmitted"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] }); }
|
|
2474
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaFormDialogComponent, deps: [{ token: i4$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2475
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaFormDialogComponent, isStandalone: false, selector: "lib-unb-pessoa-form-dialog", inputs: { config: "config" }, outputs: { pessoaEmitted: "pessoaEmitted" }, viewQueries: [{ propertyName: "pessoaFormComponent", first: true, predicate: UnbPessoaFormComponent, descendants: true }], ngImport: i0, template: "<h2 mat-dialog-title>{{ titulo }}</h2>\r\n\r\n<mat-dialog-content class=\"mat-typography\">\r\n <lib-unb-pessoa-form\r\n [config]=\"config\"\r\n [hideSalvarButton]=true\r\n (pessoaEmitted)=\"onSalvarSucesso($event)\"\r\n (isLoadingChange)=\"onLoadingChange($event)\">\r\n </lib-unb-pessoa-form>\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button color=\"warn\" [disabled]=\"isLoading\" (click)=\"fechar()\">\r\n Fechar\r\n </button>\r\n\r\n <button [disabled]=\"isLoading\" mat-flat-button color=\"primary\" (click)=\"submitForm()\">\r\n Salvar\r\n </button>\r\n</mat-dialog-actions>\r\n", styles: [":host{display:flex;flex-direction:column;height:100%;max-height:100%}h2[mat-dialog-title]{flex:0 0 auto;margin:0;padding:16px 24px}mat-dialog-content{flex-grow:1;overflow-y:auto;max-height:unset!important;display:flex;flex-direction:column}mat-dialog-actions{flex:0 0 auto;border-top:1px solid #ddd;padding:8px 16px!important;margin-bottom:0!important;min-height:52px}\n"], dependencies: [{ kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i4$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: UnbPessoaFormComponent, selector: "lib-unb-pessoa-form", inputs: ["config", "hideSalvarButton"], outputs: ["pessoaEmitted", "isLoadingChange"] }] }); }
|
|
2424
2476
|
}
|
|
2425
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
2477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaFormDialogComponent, decorators: [{
|
|
2426
2478
|
type: Component,
|
|
2427
|
-
args: [{ selector: 'lib-unb-pessoa-form', standalone: false, template: "<mat-progress-bar *ngIf=\"isLoading\" mode=\"indeterminate\"></mat-progress-bar>\r\n\r\n<unb-mensagem [identificador]=\"idMensagemService\"></unb-mensagem>\r\n\r\n<!-- Label indicando que est\u00E1 incluindo nova pessoa -->\r\n<div *ngIf=\"documentoPesquisado\"\r\n class=\"status-banner\" \r\n [ngClass]=\"{\r\n 'status-inclusao': !pessoa.codigoPessoa,\r\n 'status-edicao': pessoa.codigoPessoa && !isReadyOnly,\r\n 'status-bloqueado': config.isReadyOnly\r\n }\">\r\n\r\n <mat-icon>\r\n {{ !pessoa.codigoPessoa ? 'person_add' : (isReadyOnly ? 'lock' : 'edit') }}\r\n </mat-icon>\r\n\r\n <span>\r\n <ng-container *ngIf=\"!pessoa.codigoPessoa\">Incluindo nova pessoa</ng-container>\r\n <ng-container *ngIf=\"pessoa.codigoPessoa && !isReadyOnly\">Editando pessoa</ng-container>\r\n <ng-container *ngIf=\"isReadyOnly\">Registro SIAPE (Visualiza\u00E7\u00E3o)</ng-container> com <strong>{{ getLabelDocumento() }} {{ documentoPesquisado }}</strong>\r\n </span>\r\n</div>\r\n\r\n<form #pessoaForm=\"ngForm\" [class.readonly]=\"isReadyOnly || isLoading\" class=\"form-container\" (ngSubmit)=\"salvar(pessoaForm)\">\r\n <!-- Campos Pessoa F\u00EDsica e Estrangeira -->\r\n <ng-container\r\n *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA || pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA\">\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nome\" name=\"nome\" #nome=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Sexo</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoSexo\" name=\"codigoSexo\" #codigoSexo=\"ngModel\" required>\r\n <mat-option [value]=\"1\">Masculino</mat-option>\r\n <mat-option [value]=\"2\">Feminino</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Data Nascimento</mat-label>\r\n <input matInput [matDatepicker]=\"dataNascimentoPicker\" [(ngModel)]=\"pessoa.dataNascimento\" name=\"dataNascimento\"\r\n #dataNascimento=\"ngModel\" required>\r\n <mat-datepicker-toggle matSuffix [for]=\"dataNascimentoPicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #dataNascimentoPicker></mat-datepicker>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Estado Civil</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoEstadoCivil\" name=\"codigoEstadoCivil\" #codigoEstadoCivil=\"ngModel\">\r\n <mat-option *ngFor=\"let estado of estadosCivil | async\" [value]=\"estado.codigo\">\r\n {{ estado.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <!--\r\n <mat-form-field class=\"form-15\" appearance=\"outline\">\r\n <mat-label>Naturalidade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.naturalidade\" name=\"naturalidade\" #naturalidade=\"ngModel\" required>\r\n <mat-option *ngFor=\"let cidade of getListaEstados()\" [value]=\"cidade.codigo\">\r\n {{ cidade.descricao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n -->\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisNascimento\" name=\"codigoPaisNascimento\" #codigoPaisNascimento=\"ngModel\"\r\n required>\r\n <mat-option *ngFor=\"let paisNascimento of paises | async\" [value]=\"paisNascimento.codigo\">\r\n <span *ngIf=\"paisNascimento.denominacao === 'BRASIL'\">\uD83C\uDDE7\uD83C\uDDF7 <b>{{ paisNascimento.denominacao }}</b></span>\r\n <span *ngIf=\"paisNascimento.denominacao !== 'BRASIL'\">{{ paisNascimento.denominacao }}</span>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\" *ngIf=\"pessoa.codigoPaisNascimento == 22\"> <!-- 22 eh Brasil-->\r\n <mat-label>UF Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.ufNascimento\" name=\"ufNascimento\" #ufNascimento=\"ngModel\" required>\r\n <mat-option *ngFor=\"let estado of getListaEstados()\" [value]=\"estado.identificador\">\r\n {{ estado.identificador }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\" *ngIf=\"pessoa.codigoPaisNascimento == 22\">\r\n <mat-label>Naturalidade</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.naturalidade\" name=\"naturalidade\" #naturalidade=\"ngModel\"\r\n required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Escolaridade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.escolaridade\" name=\"codigoEscolaridade\" #codigoEscolaridade=\"ngModel\" required>\r\n <mat-option *ngFor=\"let escolaridade of escolaridade | async\" [value]=\"escolaridade.codigo\">\r\n {{ escolaridade.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome Social</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeSocial\" name=\"nomeSocial\" #nomeSocial=\"ngModel\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome da M\u00E3e</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeMae\" name=\"nomeMae\" #nomeMae=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome do Pai</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomePai\" name=\"nomePai\" #nomePai=\"ngModel\" required />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- Campos Pessoa Jur\u00EDdica -->\r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().JURIDICA\">\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Raz\u00E3o Social</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.razaoSocial\" name=\"razaoSocial\" />\r\n </mat-form-field>\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Nome Fantasia</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.nomeFantasia\" name=\"nomeFantasia\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA\">\r\n <b style=\"flex: 1 1 100%; margin-bottom: 10px;\">Documenta\u00E7\u00E3o</b>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Identidade</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rg\" name=\"rg\" #rg=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>\u00D3rg\u00E3o Emissor</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rgOrgao\" name=\"rgOrgao\" #rgOrgao=\"ngModel\" required />\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>Unidade Federativa</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.rgUf\" name=\"rgUf\" #rgUf=\"ngModel\" required>\r\n <mat-option *ngFor=\"let estado of getListaEstados()\" [value]=\"estado.identificador\">\r\n {{ estado.identificador }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-20\" appearance=\"outline\">\r\n <mat-label>Data de Emiss\u00E3o</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.rgDataEmissao\" name=\"rgDataEmissao\" #rgDataEmissao=\"ngModel\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa != tipoPessoaEnum().JURIDICA && (pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA || pessoa.codigoPaisNascimento != 22)\">\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>Data Chegada Brasil</mat-label>\r\n <input matInput [matDatepicker]=\"dataChegadaBrasilPicker\" [(ngModel)]=\"pessoa.dataChegadaBrasil\"\r\n name=\"dataChegadaBrasil\" #dataChegadaBrasil=\"ngModel\" required>\r\n <mat-datepicker-toggle matSuffix [for]=\"dataChegadaBrasilPicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #dataChegadaBrasilPicker></mat-datepicker>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Passaporte</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisPassaporte\" name=\"codigoPaisPassaporte\" #codigoPaisPassaporte=\"ngModel\"\r\n required>\r\n <mat-option *ngFor=\"let paisNascimento of paises | async\" [value]=\"paisNascimento.codigo\">\r\n {{ paisNascimento.denominacao }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>N\u00FAmero Passaporte</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.passaporte\" name=\"passaporte\" #passaporte=\"ngModel\" required />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <lib-unb-pessoa-telefone-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [telefones]=\"pessoa.telefones\"\r\n (telefonesEmitted)=\"telefonesEmitted($event)\"></lib-unb-pessoa-telefone-list>\r\n\r\n <lib-unb-pessoa-endereco-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [enderecos]=\"pessoa.enderecos\"\r\n (enderecosEmitted)=\"enderecosEmitted($event)\"></lib-unb-pessoa-endereco-list>\r\n\r\n <lib-unb-pessoa-email-list style=\"flex: 1 1 100%;\" [backendURL]=\"config.backendURL\" [emails]=\"pessoa.emails\"\r\n (emailsEmitted)=\"emailsEmitted($event)\"></lib-unb-pessoa-email-list>\r\n\r\n <div *ngIf=\"isReadyOnly\" style=\"flex:1 1 100%; margin-bottom:10px;\">\r\n <mat-card>\r\n <mat-card-content>\r\n <strong>Servidor com matr\u00EDcula SIAPE deve ter seus dados autalizados pelo aplicativo do sougov</strong>\r\n </mat-card-content>\r\n </mat-card>\r\n </div>\r\n\r\n <mat-card-actions class=\"card-actions-buttons\" *ngIf=\"!hideSalvarButton\">\r\n <button mat-flat-button [disabled]=\"isLoading || isReadyOnly\" type=\"submit\" color=\"primary\">\r\n Salvar\r\n </button>\r\n </mat-card-actions>\r\n\r\n</form>", styles: [".card-actions-buttons{display:flex;gap:5px;flex-wrap:wrap}.form-container{display:flex;flex-wrap:wrap;column-gap:10px;margin-top:5px}:host{display:block}@media(max-width:1000px){.form-container{flex-direction:column;gap:5px}}.break{flex-basis:100%;height:0}.form-5{flex:1 1 5%}.inline-table-container{display:flex;align-items:center;justify-content:space-between;padding:5px}@media(max-width:600px){.form-5,.form-10,.form-15{flex:1 1 100%}}.form-10{flex:1 1 10%}.form-15{flex:1 1 15%}.form-20{flex:1 1 20%}.form-25{flex:1 1 25%}.form-30{flex:1 1 30%}.form-35{flex:1 1 35%}.form-40{flex:1 1 40%}.form-45{flex:1 1 45%}.form-50{flex:1 1 50%}.form-100{flex:1 1 100%;min-width:250px}.readonly{pointer-events:none;opacity:.6}.disabled-wrapper{pointer-events:none;opacity:.6;filter:grayscale(1)}.status-banner{display:flex;align-items:center;gap:8px;padding:10px 16px;margin:2px 0 20px;border-radius:6px;font-size:14px;font-weight:500}.status-banner.status-inclusao{background-color:#e3f2fd;color:#1565c0;border:1px solid #bbdefb}.status-banner.status-edicao{background-color:#fff3e0;color:#ef6c00;border:1px solid #ffe0b2}.status-banner.status-bloqueado{background-color:#fce4ec;color:#c2185b;border:1px solid #f8bbd0}\n"] }]
|
|
2428
|
-
}], ctorParameters: () => [{ type:
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
type: Input
|
|
2433
|
-
}], hideSalvarButton: [{
|
|
2479
|
+
args: [{ selector: 'lib-unb-pessoa-form-dialog', standalone: false, template: "<h2 mat-dialog-title>{{ titulo }}</h2>\r\n\r\n<mat-dialog-content class=\"mat-typography\">\r\n <lib-unb-pessoa-form\r\n [config]=\"config\"\r\n [hideSalvarButton]=true\r\n (pessoaEmitted)=\"onSalvarSucesso($event)\"\r\n (isLoadingChange)=\"onLoadingChange($event)\">\r\n </lib-unb-pessoa-form>\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button color=\"warn\" [disabled]=\"isLoading\" (click)=\"fechar()\">\r\n Fechar\r\n </button>\r\n\r\n <button [disabled]=\"isLoading\" mat-flat-button color=\"primary\" (click)=\"submitForm()\">\r\n Salvar\r\n </button>\r\n</mat-dialog-actions>\r\n", styles: [":host{display:flex;flex-direction:column;height:100%;max-height:100%}h2[mat-dialog-title]{flex:0 0 auto;margin:0;padding:16px 24px}mat-dialog-content{flex-grow:1;overflow-y:auto;max-height:unset!important;display:flex;flex-direction:column}mat-dialog-actions{flex:0 0 auto;border-top:1px solid #ddd;padding:8px 16px!important;margin-bottom:0!important;min-height:52px}\n"] }]
|
|
2480
|
+
}], ctorParameters: () => [{ type: i4$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
2481
|
+
type: Inject,
|
|
2482
|
+
args: [MAT_DIALOG_DATA]
|
|
2483
|
+
}] }], propDecorators: { config: [{
|
|
2434
2484
|
type: Input
|
|
2435
2485
|
}], pessoaEmitted: [{
|
|
2436
2486
|
type: Output
|
|
2437
|
-
}],
|
|
2438
|
-
type:
|
|
2487
|
+
}], pessoaFormComponent: [{
|
|
2488
|
+
type: ViewChild,
|
|
2489
|
+
args: [UnbPessoaFormComponent]
|
|
2439
2490
|
}] } });
|
|
2440
2491
|
|
|
2441
2492
|
class UnbPessoaPesquisarComponent {
|
|
@@ -2702,10 +2753,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
2702
2753
|
}] } });
|
|
2703
2754
|
|
|
2704
2755
|
/**
|
|
2705
|
-
* Esse é um
|
|
2706
|
-
*
|
|
2707
|
-
|
|
2708
|
-
|
|
2756
|
+
* Esse é um componetne Wrapper utilitário. Ele encapsula a logica de procurar e se nao achar iniciar o formulario de cadastro em um modal.
|
|
2757
|
+
* Também, se achar, ele permite alterar a pessoa encontrada.
|
|
2758
|
+
* O SGI usa para cadastro de Inquilino no formulario. La tem a pesquisa de Pessoa, se nao achar, abre o formulario de cadastro em modal. Assim, nao precisa ir em outra tela pra cadastrar
|
|
2759
|
+
* Eh possivel configurar se quer mostrar o botao de Novo (se nao achar) e Alterar (se achar). No SGI, por exemplo eu soh deixo incluir novo, pq nao faz sentido alterar a pessoa no meio do cadastro do inquilino.
|
|
2760
|
+
*/
|
|
2761
|
+
class UnbPessoaCrudModalComponent {
|
|
2709
2762
|
constructor(snackBar, pessoaService, alertService, dialog) {
|
|
2710
2763
|
this.snackBar = snackBar;
|
|
2711
2764
|
this.pessoaService = pessoaService;
|
|
@@ -2714,11 +2767,11 @@ class UnbPessoaCrudComponent {
|
|
|
2714
2767
|
this.isLoading = false;
|
|
2715
2768
|
// Configuração do componente
|
|
2716
2769
|
this.pesquisaConfig = new UnbPessoaPesquisaConfig();
|
|
2717
|
-
this.
|
|
2718
|
-
this.
|
|
2770
|
+
this.incluirBotaoNovo = true; // se pesquisou e nao achou, mostra botao novo
|
|
2771
|
+
this.incluirBotaoAlterar = true; // se pesquisou e achou, mostra botao alterar
|
|
2719
2772
|
this.pessoaEmitted = new EventEmitter();
|
|
2720
2773
|
this.pessoaSelecionada = new UnbPessoaModel();
|
|
2721
|
-
this.
|
|
2774
|
+
this.mostrarBotaoNovo = false;
|
|
2722
2775
|
this.formConfig = new UnbPessoaFormConfig(); // o formCOnfig a gente monta conforme o pesquisaConfig
|
|
2723
2776
|
}
|
|
2724
2777
|
ngOnInit() {
|
|
@@ -2736,9 +2789,6 @@ class UnbPessoaCrudComponent {
|
|
|
2736
2789
|
this.formConfig.backendURL = this.pesquisaConfig.backendURL;
|
|
2737
2790
|
this.formConfig.token = this.pesquisaConfig.token;
|
|
2738
2791
|
}
|
|
2739
|
-
loadingPesquisa($event) {
|
|
2740
|
-
this.isLoading = $event;
|
|
2741
|
-
}
|
|
2742
2792
|
pessoaPesquisaRecebida(pessoa) {
|
|
2743
2793
|
// 1. Verifica se a pessoa é nula ou se é um objeto "vazio" (sem ID e sem documentos)
|
|
2744
2794
|
const isVazio = !pessoa || (!pessoa.codigoPessoa && // Não tem ID
|
|
@@ -2750,12 +2800,19 @@ class UnbPessoaCrudComponent {
|
|
|
2750
2800
|
// Se for vazio, limpamos a seleção para esconder o formulário
|
|
2751
2801
|
// (O *ngIf="pessoaSelecionada" no HTML vai remover o componente da tela)
|
|
2752
2802
|
this.pessoaSelecionada = new UnbPessoaModel(); // ou undefined, dependendo da tipagem
|
|
2753
|
-
this.
|
|
2803
|
+
this.mostrarBotaoNovo = false;
|
|
2754
2804
|
}
|
|
2755
2805
|
else {
|
|
2756
2806
|
// Se tiver algum dado (CPF digitado ou pessoa encontrada), atualiza
|
|
2757
2807
|
this.pessoaSelecionada = pessoa;
|
|
2758
|
-
this.
|
|
2808
|
+
if (this.pessoaSelecionada.codigoPessoa) {
|
|
2809
|
+
// joga pra cima pra falar que uma pessoa foi encontrada
|
|
2810
|
+
this.pessoaEmitted.emit(pessoa);
|
|
2811
|
+
}
|
|
2812
|
+
else if (this.incluirBotaoNovo) {
|
|
2813
|
+
this.openSnackBar('Pessoa não encontrada. Clique em “Incluir Nova Pessoa” para realizar o cadastro.');
|
|
2814
|
+
this.mostrarBotaoNovo = true;
|
|
2815
|
+
}
|
|
2759
2816
|
}
|
|
2760
2817
|
// 2. Atualiza a configuração do formulário
|
|
2761
2818
|
// Importante: Só tenta acessar 'pessoa' se formConfig existir
|
|
@@ -2768,87 +2825,70 @@ class UnbPessoaCrudComponent {
|
|
|
2768
2825
|
};
|
|
2769
2826
|
}
|
|
2770
2827
|
}
|
|
2828
|
+
limparSelecao() {
|
|
2829
|
+
this.pessoaSelecionada = new UnbPessoaModel(); // ou new UnbPessoaModel()
|
|
2830
|
+
// Talvez precise avisar o componente filho para limpar o input também
|
|
2831
|
+
}
|
|
2832
|
+
getDocumentoFormatado(pessoa) {
|
|
2833
|
+
if (pessoa.cpf && pessoa.cpf.trim() !== '') {
|
|
2834
|
+
return pessoa.cpf;
|
|
2835
|
+
}
|
|
2836
|
+
else if (pessoa.cnpj && pessoa.cnpj.trim() !== '') {
|
|
2837
|
+
return pessoa.cnpj;
|
|
2838
|
+
}
|
|
2839
|
+
else if (pessoa.passaporte && pessoa.passaporte.trim() !== '') {
|
|
2840
|
+
return pessoa.passaporte;
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
openModal() {
|
|
2844
|
+
const dialogRef = this.dialog.open(UnbPessoaFormDialogComponent, {
|
|
2845
|
+
// 1. Defina um painel de classe para controlar tudo no CSS
|
|
2846
|
+
panelClass: 'dialog-pessoa-fullscreen',
|
|
2847
|
+
// 2. Largura padrão para Desktop (o CSS vai sobrescrever no mobile)
|
|
2848
|
+
width: '90vw',
|
|
2849
|
+
maxWidth: '1200px', // Trava para não ficar gigante em monitores ultrawide
|
|
2850
|
+
// 3. Altura automática ou máxima (CSS controla o esticar)
|
|
2851
|
+
maxHeight: '95vh',
|
|
2852
|
+
data: {
|
|
2853
|
+
config: this.formConfig
|
|
2854
|
+
},
|
|
2855
|
+
autoFocus: 'first-tabbable'
|
|
2856
|
+
});
|
|
2857
|
+
dialogRef.afterClosed().subscribe((pessoaSalva) => {
|
|
2858
|
+
if (pessoaSalva?.codigoPessoa) {
|
|
2859
|
+
this.pessoaEmitted.emit(pessoaSalva);
|
|
2860
|
+
}
|
|
2861
|
+
});
|
|
2862
|
+
}
|
|
2771
2863
|
openSnackBar(message) {
|
|
2772
2864
|
this.snackBar.open(message, 'x', {
|
|
2773
2865
|
duration: 5000,
|
|
2774
2866
|
});
|
|
2775
2867
|
}
|
|
2776
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
2777
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
2868
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaCrudModalComponent, deps: [{ token: i1$1.MatSnackBar }, { token: UnBPessoaService }, { token: UnbMensagemService }, { token: i4$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2869
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "21.1.3", type: UnbPessoaCrudModalComponent, isStandalone: false, selector: "lib-unb-pessoa-crud-modal", inputs: { pesquisaConfig: "pesquisaConfig", incluirBotaoNovo: ["incluirBotaoNovo", "incluirBotaoNovo", booleanAttribute], incluirBotaoAlterar: ["incluirBotaoAlterar", "incluirBotaoAlterar", booleanAttribute] }, outputs: { pessoaEmitted: "pessoaEmitted" }, ngImport: i0, template: "<div class=\"search-wrapper\" [class.disabled-wrapper]=\"isLoading\">\r\n\r\n <div class=\"search-input-area\">\r\n <lib-unb-pessoa-pesquisar \r\n [config]=\"pesquisaConfig\" \r\n (pessoaEmitted)=\"pessoaPesquisaRecebida($event)\">\r\n </lib-unb-pessoa-pesquisar>\r\n </div>\r\n\r\n <div class=\"search-button-area\">\r\n\r\n <button *ngIf=\"incluirBotaoNovo && mostrarBotaoNovo && !pessoaSelecionada.codigoPessoa\" \r\n mat-stroked-button \r\n color=\"accent\"\r\n (click)=\"openModal()\" \r\n type=\"button\" \r\n style=\"white-space: nowrap;\">\r\n <mat-icon>add</mat-icon> Incluir Nova Pessoa\r\n </button>\r\n\r\n <div *ngIf=\"incluirBotaoAlterar && pessoaSelecionada.codigoPessoa\" class=\"mini-card-selected\">\r\n <div class=\"card-avatar\"><mat-icon>person</mat-icon></div>\r\n <div class=\"card-info\">\r\n <div class=\"card-name\">{{ pessoaSelecionada.nome }}</div>\r\n <div class=\"card-doc\">{{ getDocumentoFormatado(pessoaSelecionada) }}</div>\r\n </div>\r\n <div class=\"card-actions\">\r\n <button mat-stroked-button color=\"primary\" (click)=\"openModal()\" type=\"button\">\r\n <mat-icon>edit</mat-icon> Editar\r\n </button>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n</div>", styles: ["::ng-deep .dialog-pessoa-fullscreen .mat-mdc-dialog-container{min-width:600px}@media(max-width:768px){::ng-deep .dialog-pessoa-fullscreen{max-width:100vw!important;width:100vw!important;height:100vh!important}::ng-deep .dialog-pessoa-fullscreen .mat-mdc-dialog-container{max-width:100vw!important;height:100%!important;max-height:100vh!important}::ng-deep .dialog-pessoa-fullscreen .mat-mdc-dialog-surface{border-radius:0!important;height:100%!important;display:flex;flex-direction:column}}.form-container{display:flex;flex-wrap:wrap;align-items:baseline;gap:16px;width:100%}.mini-card-selected{display:flex;align-items:center;gap:12px;background-color:#fff;border:1px solid #e0e0e0;border-radius:8px;padding:8px 16px;box-shadow:0 1px 3px #00000014;white-space:nowrap;margin-bottom:22px}.card-avatar{display:flex;align-items:center;justify-content:center;width:40px;height:40px;background-color:#f5f5f5;border-radius:50%;color:#757575}.card-info{display:flex;flex-direction:column;line-height:1.3;margin-right:8px}.card-name{font-weight:600;font-size:14px;color:#333;max-width:200px;overflow:hidden;text-overflow:ellipsis}.card-doc{font-size:12px;color:#666}.card-actions{flex-shrink:0}@media(max-width:600px){.mini-card-selected{width:100%;justify-content:space-between}.card-name{max-width:140px}}.search-wrapper{display:flex;flex-wrap:wrap;align-items:flex-end;gap:16px;width:100%}.search-input-area{flex:1;min-width:250px;max-width:400px}.search-button-area{flex-shrink:0;margin-bottom:22px}@media(max-width:600px){.search-input-area{max-width:100%}.search-button-area{width:100%;margin-bottom:0}.search-button-area button{width:100%}}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: UnbPessoaPesquisarComponent, selector: "lib-unb-pessoa-pesquisar", inputs: ["config"], outputs: ["pessoaEmitted", "isLoadingChange"] }] }); }
|
|
2778
2870
|
}
|
|
2779
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
2871
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaCrudModalComponent, decorators: [{
|
|
2780
2872
|
type: Component,
|
|
2781
|
-
args: [{ selector: 'lib-unb-pessoa-crud', standalone: false, template: "<div class=\"
|
|
2873
|
+
args: [{ selector: 'lib-unb-pessoa-crud-modal', standalone: false, template: "<div class=\"search-wrapper\" [class.disabled-wrapper]=\"isLoading\">\r\n\r\n <div class=\"search-input-area\">\r\n <lib-unb-pessoa-pesquisar \r\n [config]=\"pesquisaConfig\" \r\n (pessoaEmitted)=\"pessoaPesquisaRecebida($event)\">\r\n </lib-unb-pessoa-pesquisar>\r\n </div>\r\n\r\n <div class=\"search-button-area\">\r\n\r\n <button *ngIf=\"incluirBotaoNovo && mostrarBotaoNovo && !pessoaSelecionada.codigoPessoa\" \r\n mat-stroked-button \r\n color=\"accent\"\r\n (click)=\"openModal()\" \r\n type=\"button\" \r\n style=\"white-space: nowrap;\">\r\n <mat-icon>add</mat-icon> Incluir Nova Pessoa\r\n </button>\r\n\r\n <div *ngIf=\"incluirBotaoAlterar && pessoaSelecionada.codigoPessoa\" class=\"mini-card-selected\">\r\n <div class=\"card-avatar\"><mat-icon>person</mat-icon></div>\r\n <div class=\"card-info\">\r\n <div class=\"card-name\">{{ pessoaSelecionada.nome }}</div>\r\n <div class=\"card-doc\">{{ getDocumentoFormatado(pessoaSelecionada) }}</div>\r\n </div>\r\n <div class=\"card-actions\">\r\n <button mat-stroked-button color=\"primary\" (click)=\"openModal()\" type=\"button\">\r\n <mat-icon>edit</mat-icon> Editar\r\n </button>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n</div>", styles: ["::ng-deep .dialog-pessoa-fullscreen .mat-mdc-dialog-container{min-width:600px}@media(max-width:768px){::ng-deep .dialog-pessoa-fullscreen{max-width:100vw!important;width:100vw!important;height:100vh!important}::ng-deep .dialog-pessoa-fullscreen .mat-mdc-dialog-container{max-width:100vw!important;height:100%!important;max-height:100vh!important}::ng-deep .dialog-pessoa-fullscreen .mat-mdc-dialog-surface{border-radius:0!important;height:100%!important;display:flex;flex-direction:column}}.form-container{display:flex;flex-wrap:wrap;align-items:baseline;gap:16px;width:100%}.mini-card-selected{display:flex;align-items:center;gap:12px;background-color:#fff;border:1px solid #e0e0e0;border-radius:8px;padding:8px 16px;box-shadow:0 1px 3px #00000014;white-space:nowrap;margin-bottom:22px}.card-avatar{display:flex;align-items:center;justify-content:center;width:40px;height:40px;background-color:#f5f5f5;border-radius:50%;color:#757575}.card-info{display:flex;flex-direction:column;line-height:1.3;margin-right:8px}.card-name{font-weight:600;font-size:14px;color:#333;max-width:200px;overflow:hidden;text-overflow:ellipsis}.card-doc{font-size:12px;color:#666}.card-actions{flex-shrink:0}@media(max-width:600px){.mini-card-selected{width:100%;justify-content:space-between}.card-name{max-width:140px}}.search-wrapper{display:flex;flex-wrap:wrap;align-items:flex-end;gap:16px;width:100%}.search-input-area{flex:1;min-width:250px;max-width:400px}.search-button-area{flex-shrink:0;margin-bottom:22px}@media(max-width:600px){.search-input-area{max-width:100%}.search-button-area{width:100%;margin-bottom:0}.search-button-area button{width:100%}}\n"] }]
|
|
2782
2874
|
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: UnbMensagemService }, { type: i4$2.MatDialog }], propDecorators: { pesquisaConfig: [{
|
|
2783
2875
|
type: Input,
|
|
2784
2876
|
args: [{ required: true }]
|
|
2785
|
-
}],
|
|
2786
|
-
type: Input
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
}] } });
|
|
2792
|
-
|
|
2793
|
-
class UnbPessoaFormDialogComponent {
|
|
2794
|
-
constructor(dialogRef, data) {
|
|
2795
|
-
this.dialogRef = dialogRef;
|
|
2796
|
-
this.config = new UnbPessoaFormConfig();
|
|
2797
|
-
this.pessoaEmitted = new EventEmitter();
|
|
2798
|
-
this.isLoading = false;
|
|
2799
|
-
this.titulo = 'Cadastro de Pessoa';
|
|
2800
|
-
if (data && data.config) {
|
|
2801
|
-
this.config = data.config;
|
|
2802
|
-
// Ajusta o título dependendo se é edição ou inclusão
|
|
2803
|
-
if (this.config.pessoa && this.config.pessoa.codigoPessoa) {
|
|
2804
|
-
this.titulo = 'Editando Pessoa';
|
|
2805
|
-
}
|
|
2806
|
-
else {
|
|
2807
|
-
this.titulo = 'Nova Pessoa';
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2810
|
-
}
|
|
2811
|
-
onLoadingChange($event) {
|
|
2812
|
-
this.isLoading = $event;
|
|
2813
|
-
}
|
|
2814
|
-
fechar() {
|
|
2815
|
-
this.dialogRef.close();
|
|
2816
|
-
}
|
|
2817
|
-
// se salvar, jah fecha emite o valor salvo. Nao posso deixar aberto, senao vai emitir o close vazio. E o dono nao vai receber a pessoa
|
|
2818
|
-
onSalvarSucesso($event) {
|
|
2819
|
-
this.dialogRef.close($event);
|
|
2820
|
-
}
|
|
2821
|
-
submitForm() {
|
|
2822
|
-
// chama o salvar lah do form.
|
|
2823
|
-
if (this.pessoaFormComponent && this.pessoaFormComponent.pessoaForm) {
|
|
2824
|
-
this.pessoaFormComponent.salvar(this.pessoaFormComponent.pessoaForm);
|
|
2825
|
-
}
|
|
2826
|
-
}
|
|
2827
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaFormDialogComponent, deps: [{ token: i4$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2828
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaFormDialogComponent, isStandalone: false, selector: "lib-unb-pessoa-form-dialog", inputs: { config: "config" }, outputs: { pessoaEmitted: "pessoaEmitted" }, viewQueries: [{ propertyName: "pessoaFormComponent", first: true, predicate: UnbPessoaFormComponent, descendants: true }], ngImport: i0, template: "<h2 mat-dialog-title>{{ titulo }}</h2>\r\n\r\n<mat-dialog-content class=\"mat-typography\">\r\n <lib-unb-pessoa-form\r\n [config]=\"config\"\r\n [hideSalvarButton]=true\r\n (pessoaEmitted)=\"onSalvarSucesso($event)\"\r\n (isLoadingChange)=\"onLoadingChange($event)\">\r\n </lib-unb-pessoa-form>\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button color=\"warn\" [disabled]=\"isLoading\" (click)=\"fechar()\">\r\n Fechar\r\n </button>\r\n\r\n <button [disabled]=\"isLoading\" mat-flat-button color=\"primary\" (click)=\"submitForm()\">\r\n Salvar\r\n </button>\r\n</mat-dialog-actions>\r\n", styles: [":host{display:flex;flex-direction:column;height:100%;max-height:100%}h2[mat-dialog-title]{flex:0 0 auto;margin:0;padding:16px 24px}mat-dialog-content{flex-grow:1;overflow-y:auto;max-height:unset!important;display:flex;flex-direction:column}mat-dialog-actions{flex:0 0 auto;border-top:1px solid #ddd;padding:8px 16px!important;margin-bottom:0!important;min-height:52px}\n"], dependencies: [{ kind: "component", type: i7.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i4$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: UnbPessoaFormComponent, selector: "lib-unb-pessoa-form", inputs: ["config", "hideSalvarButton"], outputs: ["pessoaEmitted", "isLoadingChange"] }] }); }
|
|
2829
|
-
}
|
|
2830
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaFormDialogComponent, decorators: [{
|
|
2831
|
-
type: Component,
|
|
2832
|
-
args: [{ selector: 'lib-unb-pessoa-form-dialog', standalone: false, template: "<h2 mat-dialog-title>{{ titulo }}</h2>\r\n\r\n<mat-dialog-content class=\"mat-typography\">\r\n <lib-unb-pessoa-form\r\n [config]=\"config\"\r\n [hideSalvarButton]=true\r\n (pessoaEmitted)=\"onSalvarSucesso($event)\"\r\n (isLoadingChange)=\"onLoadingChange($event)\">\r\n </lib-unb-pessoa-form>\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions align=\"end\">\r\n <button mat-stroked-button color=\"warn\" [disabled]=\"isLoading\" (click)=\"fechar()\">\r\n Fechar\r\n </button>\r\n\r\n <button [disabled]=\"isLoading\" mat-flat-button color=\"primary\" (click)=\"submitForm()\">\r\n Salvar\r\n </button>\r\n</mat-dialog-actions>\r\n", styles: [":host{display:flex;flex-direction:column;height:100%;max-height:100%}h2[mat-dialog-title]{flex:0 0 auto;margin:0;padding:16px 24px}mat-dialog-content{flex-grow:1;overflow-y:auto;max-height:unset!important;display:flex;flex-direction:column}mat-dialog-actions{flex:0 0 auto;border-top:1px solid #ddd;padding:8px 16px!important;margin-bottom:0!important;min-height:52px}\n"] }]
|
|
2833
|
-
}], ctorParameters: () => [{ type: i4$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
2834
|
-
type: Inject,
|
|
2835
|
-
args: [MAT_DIALOG_DATA]
|
|
2836
|
-
}] }], propDecorators: { config: [{
|
|
2837
|
-
type: Input
|
|
2877
|
+
}], incluirBotaoNovo: [{
|
|
2878
|
+
type: Input,
|
|
2879
|
+
args: [{ transform: booleanAttribute }]
|
|
2880
|
+
}], incluirBotaoAlterar: [{
|
|
2881
|
+
type: Input,
|
|
2882
|
+
args: [{ transform: booleanAttribute }]
|
|
2838
2883
|
}], pessoaEmitted: [{
|
|
2839
2884
|
type: Output
|
|
2840
|
-
}], pessoaFormComponent: [{
|
|
2841
|
-
type: ViewChild,
|
|
2842
|
-
args: [UnbPessoaFormComponent]
|
|
2843
2885
|
}] } });
|
|
2844
2886
|
|
|
2845
2887
|
/**
|
|
2846
|
-
* Esse é um
|
|
2847
|
-
*
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
*/
|
|
2851
|
-
class UnbPessoaCrudModalComponent {
|
|
2888
|
+
* Esse é um componente Wrapper utilitário. Ele encapsula a logica de procurar e exibir o formulario de cadastro/alteração inline.
|
|
2889
|
+
* Isso economiza o ciclo de mostrar a pesquisa do pessoa, e depois mostrar o formulário.
|
|
2890
|
+
*/
|
|
2891
|
+
class UnbPessoaCrudComponent {
|
|
2852
2892
|
constructor(snackBar, pessoaService, alertService, dialog) {
|
|
2853
2893
|
this.snackBar = snackBar;
|
|
2854
2894
|
this.pessoaService = pessoaService;
|
|
@@ -2857,11 +2897,11 @@ class UnbPessoaCrudModalComponent {
|
|
|
2857
2897
|
this.isLoading = false;
|
|
2858
2898
|
// Configuração do componente
|
|
2859
2899
|
this.pesquisaConfig = new UnbPessoaPesquisaConfig();
|
|
2860
|
-
this.
|
|
2861
|
-
this.
|
|
2900
|
+
this.showFormOnModal = false;
|
|
2901
|
+
this.maxWidthPesquisa = '450px'; // Input para controlar a largura da área de pesquisa
|
|
2862
2902
|
this.pessoaEmitted = new EventEmitter();
|
|
2863
2903
|
this.pessoaSelecionada = new UnbPessoaModel();
|
|
2864
|
-
this.
|
|
2904
|
+
this.pessoaEncontrada = false;
|
|
2865
2905
|
this.formConfig = new UnbPessoaFormConfig(); // o formCOnfig a gente monta conforme o pesquisaConfig
|
|
2866
2906
|
}
|
|
2867
2907
|
ngOnInit() {
|
|
@@ -2879,6 +2919,9 @@ class UnbPessoaCrudModalComponent {
|
|
|
2879
2919
|
this.formConfig.backendURL = this.pesquisaConfig.backendURL;
|
|
2880
2920
|
this.formConfig.token = this.pesquisaConfig.token;
|
|
2881
2921
|
}
|
|
2922
|
+
loadingPesquisa($event) {
|
|
2923
|
+
this.isLoading = $event;
|
|
2924
|
+
}
|
|
2882
2925
|
pessoaPesquisaRecebida(pessoa) {
|
|
2883
2926
|
// 1. Verifica se a pessoa é nula ou se é um objeto "vazio" (sem ID e sem documentos)
|
|
2884
2927
|
const isVazio = !pessoa || (!pessoa.codigoPessoa && // Não tem ID
|
|
@@ -2890,19 +2933,12 @@ class UnbPessoaCrudModalComponent {
|
|
|
2890
2933
|
// Se for vazio, limpamos a seleção para esconder o formulário
|
|
2891
2934
|
// (O *ngIf="pessoaSelecionada" no HTML vai remover o componente da tela)
|
|
2892
2935
|
this.pessoaSelecionada = new UnbPessoaModel(); // ou undefined, dependendo da tipagem
|
|
2893
|
-
this.
|
|
2936
|
+
this.pessoaEncontrada = false;
|
|
2894
2937
|
}
|
|
2895
2938
|
else {
|
|
2896
2939
|
// Se tiver algum dado (CPF digitado ou pessoa encontrada), atualiza
|
|
2897
2940
|
this.pessoaSelecionada = pessoa;
|
|
2898
|
-
|
|
2899
|
-
// joga pra cima pra falar que uma pessoa foi encontrada
|
|
2900
|
-
this.pessoaEmitted.emit(pessoa);
|
|
2901
|
-
}
|
|
2902
|
-
else if (this.incluirBotaoNovo) {
|
|
2903
|
-
this.openSnackBar('Pessoa não encontrada. Clique em “Incluir Nova Pessoa” para realizar o cadastro.');
|
|
2904
|
-
this.mostrarBotaoNovo = true;
|
|
2905
|
-
}
|
|
2941
|
+
this.pessoaEncontrada = true;
|
|
2906
2942
|
}
|
|
2907
2943
|
// 2. Atualiza a configuração do formulário
|
|
2908
2944
|
// Importante: Só tenta acessar 'pessoa' se formConfig existir
|
|
@@ -2915,61 +2951,24 @@ class UnbPessoaCrudModalComponent {
|
|
|
2915
2951
|
};
|
|
2916
2952
|
}
|
|
2917
2953
|
}
|
|
2918
|
-
limparSelecao() {
|
|
2919
|
-
this.pessoaSelecionada = new UnbPessoaModel(); // ou new UnbPessoaModel()
|
|
2920
|
-
// Talvez precise avisar o componente filho para limpar o input também
|
|
2921
|
-
}
|
|
2922
|
-
getDocumentoFormatado(pessoa) {
|
|
2923
|
-
if (pessoa.cpf && pessoa.cpf.trim() !== '') {
|
|
2924
|
-
return pessoa.cpf;
|
|
2925
|
-
}
|
|
2926
|
-
else if (pessoa.cnpj && pessoa.cnpj.trim() !== '') {
|
|
2927
|
-
return pessoa.cnpj;
|
|
2928
|
-
}
|
|
2929
|
-
else if (pessoa.passaporte && pessoa.passaporte.trim() !== '') {
|
|
2930
|
-
return pessoa.passaporte;
|
|
2931
|
-
}
|
|
2932
|
-
}
|
|
2933
|
-
openModal() {
|
|
2934
|
-
const dialogRef = this.dialog.open(UnbPessoaFormDialogComponent, {
|
|
2935
|
-
// 1. Defina um painel de classe para controlar tudo no CSS
|
|
2936
|
-
panelClass: 'dialog-pessoa-fullscreen',
|
|
2937
|
-
// 2. Largura padrão para Desktop (o CSS vai sobrescrever no mobile)
|
|
2938
|
-
width: '90vw',
|
|
2939
|
-
maxWidth: '1200px', // Trava para não ficar gigante em monitores ultrawide
|
|
2940
|
-
// 3. Altura automática ou máxima (CSS controla o esticar)
|
|
2941
|
-
maxHeight: '95vh',
|
|
2942
|
-
data: {
|
|
2943
|
-
config: this.formConfig
|
|
2944
|
-
},
|
|
2945
|
-
autoFocus: 'first-tabbable'
|
|
2946
|
-
});
|
|
2947
|
-
dialogRef.afterClosed().subscribe((pessoaSalva) => {
|
|
2948
|
-
if (pessoaSalva?.codigoPessoa) {
|
|
2949
|
-
this.pessoaEmitted.emit(pessoaSalva);
|
|
2950
|
-
}
|
|
2951
|
-
});
|
|
2952
|
-
}
|
|
2953
2954
|
openSnackBar(message) {
|
|
2954
2955
|
this.snackBar.open(message, 'x', {
|
|
2955
2956
|
duration: 5000,
|
|
2956
2957
|
});
|
|
2957
2958
|
}
|
|
2958
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
2959
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
2959
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaCrudComponent, deps: [{ token: i1$1.MatSnackBar }, { token: UnBPessoaService }, { token: UnbMensagemService }, { token: i4$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2960
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: UnbPessoaCrudComponent, isStandalone: false, selector: "lib-unb-pessoa-crud", inputs: { pesquisaConfig: "pesquisaConfig", showFormOnModal: "showFormOnModal", maxWidthPesquisa: "maxWidthPesquisa" }, outputs: { pessoaEmitted: "pessoaEmitted" }, ngImport: i0, template: "<div class=\"area-pesquisa\" [style.max-width]=\"maxWidthPesquisa\" [class.disabled-wrapper]=\"isLoading\">\r\n <lib-unb-pessoa-pesquisar \r\n [config]=\"pesquisaConfig\"\r\n (isLoadingChange)=\"loadingPesquisa($event)\"\r\n (pessoaEmitted)=\"pessoaPesquisaRecebida($event)\">\r\n </lib-unb-pessoa-pesquisar>\r\n</div>\r\n\r\n<div *ngIf=\"pessoaEncontrada && !isLoading\" class=\"area-formulario\">\r\n <lib-unb-pessoa-form \r\n [config]=\"formConfig\">\r\n </lib-unb-pessoa-form>\r\n</div>", styles: [".area-pesquisa{width:100%;margin-bottom:10px}.area-formulario{width:100%}@media(max-width:600px){.area-pesquisa{max-width:100%}}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: UnbPessoaFormComponent, selector: "lib-unb-pessoa-form", inputs: ["config", "hideSalvarButton"], outputs: ["pessoaEmitted", "isLoadingChange"] }, { kind: "component", type: UnbPessoaPesquisarComponent, selector: "lib-unb-pessoa-pesquisar", inputs: ["config"], outputs: ["pessoaEmitted", "isLoadingChange"] }] }); }
|
|
2960
2961
|
}
|
|
2961
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type:
|
|
2962
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaCrudComponent, decorators: [{
|
|
2962
2963
|
type: Component,
|
|
2963
|
-
args: [{ selector: 'lib-unb-pessoa-crud
|
|
2964
|
+
args: [{ selector: 'lib-unb-pessoa-crud', standalone: false, template: "<div class=\"area-pesquisa\" [style.max-width]=\"maxWidthPesquisa\" [class.disabled-wrapper]=\"isLoading\">\r\n <lib-unb-pessoa-pesquisar \r\n [config]=\"pesquisaConfig\"\r\n (isLoadingChange)=\"loadingPesquisa($event)\"\r\n (pessoaEmitted)=\"pessoaPesquisaRecebida($event)\">\r\n </lib-unb-pessoa-pesquisar>\r\n</div>\r\n\r\n<div *ngIf=\"pessoaEncontrada && !isLoading\" class=\"area-formulario\">\r\n <lib-unb-pessoa-form \r\n [config]=\"formConfig\">\r\n </lib-unb-pessoa-form>\r\n</div>", styles: [".area-pesquisa{width:100%;margin-bottom:10px}.area-formulario{width:100%}@media(max-width:600px){.area-pesquisa{max-width:100%}}\n"] }]
|
|
2964
2965
|
}], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: UnBPessoaService }, { type: UnbMensagemService }, { type: i4$2.MatDialog }], propDecorators: { pesquisaConfig: [{
|
|
2965
2966
|
type: Input,
|
|
2966
2967
|
args: [{ required: true }]
|
|
2967
|
-
}],
|
|
2968
|
-
type: Input
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
type: Input,
|
|
2972
|
-
args: [{ transform: booleanAttribute }]
|
|
2968
|
+
}], showFormOnModal: [{
|
|
2969
|
+
type: Input
|
|
2970
|
+
}], maxWidthPesquisa: [{
|
|
2971
|
+
type: Input
|
|
2973
2972
|
}], pessoaEmitted: [{
|
|
2974
2973
|
type: Output
|
|
2975
2974
|
}] } });
|
|
@@ -3016,7 +3015,6 @@ class UnbPessoaModule {
|
|
|
3016
3015
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
3017
3016
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: UnbPessoaModule, declarations: [UnbPessoaFormDialogComponent, UnbPessoaCrudComponent, UnbPessoaCrudModalComponent, UnbPessoaFormComponent, UnbPessoaPesquisarComponent, UnbPessoaEnderecoFormComponent, UnbPessoaTelefoneListComponent, UnbPessoaenderecoListComponent, UnbPessoaTelefoneFormComponent, UnbPessoaEmailFormComponent, UnbPessoaEmailListComponent], imports: [CommonModule,
|
|
3018
3017
|
FormsModule,
|
|
3019
|
-
BrowserModule,
|
|
3020
3018
|
MatIconModule,
|
|
3021
3019
|
DragDropModule,
|
|
3022
3020
|
MatListModule,
|
|
@@ -3051,7 +3049,6 @@ class UnbPessoaModule {
|
|
|
3051
3049
|
{ provide: MAT_DATE_FORMATS, useValue: PT_BR_DATE_FORMATS }
|
|
3052
3050
|
], imports: [CommonModule,
|
|
3053
3051
|
FormsModule,
|
|
3054
|
-
BrowserModule,
|
|
3055
3052
|
MatIconModule,
|
|
3056
3053
|
DragDropModule,
|
|
3057
3054
|
MatListModule,
|
|
@@ -3085,7 +3082,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
3085
3082
|
imports: [
|
|
3086
3083
|
CommonModule,
|
|
3087
3084
|
FormsModule,
|
|
3088
|
-
BrowserModule,
|
|
3089
3085
|
MatIconModule,
|
|
3090
3086
|
DragDropModule,
|
|
3091
3087
|
MatListModule,
|