@stiunb/unb-lib-components 18.0.22
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.
- package/README.md +18 -0
- package/esm2022/lib/services/unb-auth.service.mjs +57 -0
- package/esm2022/lib/unb-mensagem/unb-mensagem.component.mjs +82 -0
- package/esm2022/lib/unb-mensagem/unb-mensagem.module.mjs +26 -0
- package/esm2022/lib/unb-mensagem/unb-mensagem.service.mjs +61 -0
- package/esm2022/lib/unb-mensagem/unb-message.model.mjs +3 -0
- package/esm2022/lib/unb-nav-bar/unb-nav-bar.component.mjs +53 -0
- package/esm2022/lib/unb-nav-bar/unb-nav-bar.module.mjs +52 -0
- package/esm2022/lib/unb-pessoa/pessoa-tabelas-apoio.mjs +30 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-email-form/unb-pessoa-email-form.mjs +122 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-email-form/unb-pessoa-email-list.mjs +140 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-endereco-form/unb-pessoa-endereco-form.mjs +144 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-endereco-form/unb-pessoa-endereco-list.mjs +139 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-form/unb-pessoa-form.component.mjs +166 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-email.model.mjs +5 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-endereco.model.mjs +5 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-escolaridade.model.mjs +6 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-estado-civil.model.mjs +6 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-municipio.mjs +3 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-pais.mjs +3 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-raca-cor.mjs +3 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-telefone.model.mjs +9 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-models/unb-pessoa.model.mjs +6 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-pesquisar/unb-pessoa-pesquisar.component.mjs +229 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-telefone-form/unb-pessoa-telefone-form.mjs +102 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa-telefone-form/unb-pessoa-telefone-list.mjs +140 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa.module.mjs +128 -0
- package/esm2022/lib/unb-pessoa/unb-pessoa.service.mjs +157 -0
- package/esm2022/lib/unb-pessoa/unb-tipo-pessoa.enum.mjs +7 -0
- package/esm2022/lib/unb-usuario/oidc-decoded-token.mjs +2 -0
- package/esm2022/lib/unb-usuario/oidc-user-data.mjs +2 -0
- package/esm2022/lib/unb-usuario/unb-usuario.component.mjs +38 -0
- package/esm2022/lib/unb-usuario/unb-usuario.model.mjs +9 -0
- package/esm2022/lib/unb-usuario/unb-usuario.module.mjs +65 -0
- package/esm2022/lib/utils/unb-utils.mjs +76 -0
- package/esm2022/public-api.mjs +34 -0
- package/esm2022/unb-lib-components.mjs +5 -0
- package/fesm2022/unb-lib-components.mjs +1923 -0
- package/fesm2022/unb-lib-components.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/services/unb-auth.service.d.ts +17 -0
- package/lib/unb-mensagem/unb-mensagem.component.d.ts +35 -0
- package/lib/unb-mensagem/unb-mensagem.module.d.ts +10 -0
- package/lib/unb-mensagem/unb-mensagem.service.d.ts +36 -0
- package/lib/unb-mensagem/unb-message.model.d.ts +6 -0
- package/lib/unb-nav-bar/unb-nav-bar.component.d.ts +19 -0
- package/lib/unb-nav-bar/unb-nav-bar.module.d.ts +16 -0
- package/lib/unb-pessoa/pessoa-tabelas-apoio.d.ts +5 -0
- package/lib/unb-pessoa/unb-pessoa-email-form/unb-pessoa-email-form.d.ts +34 -0
- package/lib/unb-pessoa/unb-pessoa-email-form/unb-pessoa-email-list.d.ts +31 -0
- package/lib/unb-pessoa/unb-pessoa-endereco-form/unb-pessoa-endereco-form.d.ts +36 -0
- package/lib/unb-pessoa/unb-pessoa-endereco-form/unb-pessoa-endereco-list.d.ts +29 -0
- package/lib/unb-pessoa/unb-pessoa-form/unb-pessoa-form.component.d.ts +56 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-email.model.d.ts +13 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-endereco.model.d.ts +22 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-escolaridade.model.d.ts +6 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-estado-civil.model.d.ts +6 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-municipio.d.ts +8 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-pais.d.ts +7 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-raca-cor.d.ts +4 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa-telefone.model.d.ts +17 -0
- package/lib/unb-pessoa/unb-pessoa-models/unb-pessoa.model.d.ts +69 -0
- package/lib/unb-pessoa/unb-pessoa-pesquisar/unb-pessoa-pesquisar.component.d.ts +39 -0
- package/lib/unb-pessoa/unb-pessoa-telefone-form/unb-pessoa-telefone-form.d.ts +34 -0
- package/lib/unb-pessoa/unb-pessoa-telefone-form/unb-pessoa-telefone-list.d.ts +31 -0
- package/lib/unb-pessoa/unb-pessoa.module.d.ts +35 -0
- package/lib/unb-pessoa/unb-pessoa.service.d.ts +59 -0
- package/lib/unb-pessoa/unb-tipo-pessoa.enum.d.ts +5 -0
- package/lib/unb-usuario/oidc-decoded-token.d.ts +29 -0
- package/lib/unb-usuario/oidc-user-data.d.ts +9 -0
- package/lib/unb-usuario/unb-usuario.component.d.ts +17 -0
- package/lib/unb-usuario/unb-usuario.model.d.ts +6 -0
- package/lib/unb-usuario/unb-usuario.module.d.ts +18 -0
- package/lib/utils/unb-utils.d.ts +7 -0
- package/package.json +28 -0
- package/public-api.d.ts +28 -0
|
@@ -0,0 +1,1923 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, Input, NgModule, ViewChild, Inject, EventEmitter, Output } from '@angular/core';
|
|
3
|
+
import { Subject, BehaviorSubject, catchError, throwError, of, map } from 'rxjs';
|
|
4
|
+
import * as i4 from '@angular/common';
|
|
5
|
+
import { CommonModule, DatePipe, CurrencyPipe } from '@angular/common';
|
|
6
|
+
import * as i5 from '@angular/material/icon';
|
|
7
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
8
|
+
import * as i6 from '@angular/material/button';
|
|
9
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
10
|
+
import * as i4$1 from '@angular/material/sidenav';
|
|
11
|
+
import { MatSidenav, MatSidenavModule } from '@angular/material/sidenav';
|
|
12
|
+
import * as i1 from '@angular/cdk/layout';
|
|
13
|
+
import { LayoutModule } from '@angular/cdk/layout';
|
|
14
|
+
import * as i3$1 from '@angular/material/toolbar';
|
|
15
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
16
|
+
import * as i3 from '@angular/material/menu';
|
|
17
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
18
|
+
import * as i5$1 from '@angular/material/divider';
|
|
19
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
20
|
+
import * as i7 from '@angular/material/card';
|
|
21
|
+
import { MatCardModule } from '@angular/material/card';
|
|
22
|
+
import * as i8 from '@angular/material/tooltip';
|
|
23
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
24
|
+
import { MatListModule } from '@angular/material/list';
|
|
25
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
26
|
+
import * as i5$2 from '@angular/forms';
|
|
27
|
+
import { FormsModule } from '@angular/forms';
|
|
28
|
+
import * as i10 from '@angular/material/core';
|
|
29
|
+
import { MatNativeDateModule } from '@angular/material/core';
|
|
30
|
+
import * as i11 from '@angular/material/datepicker';
|
|
31
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
32
|
+
import { MatExpansionModule } from '@angular/material/expansion';
|
|
33
|
+
import * as i7$1 from '@angular/material/form-field';
|
|
34
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
35
|
+
import * as i8$1 from '@angular/material/input';
|
|
36
|
+
import { MatInputModule } from '@angular/material/input';
|
|
37
|
+
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
38
|
+
import * as i9$1 from '@angular/material/progress-bar';
|
|
39
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
40
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
41
|
+
import * as i10$1 from '@angular/material/radio';
|
|
42
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
43
|
+
import * as i9 from '@angular/material/select';
|
|
44
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
45
|
+
import * as i1$2 from '@angular/material/snack-bar';
|
|
46
|
+
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
47
|
+
import * as i3$2 from '@angular/material/dialog';
|
|
48
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
49
|
+
import * as i1$1 from '@angular/common/http';
|
|
50
|
+
import { HttpHeaders } from '@angular/common/http';
|
|
51
|
+
|
|
52
|
+
class UnbMensagemModel {
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// faz com que a enum seja uma contagem de 0 a 3
|
|
56
|
+
var UnbTipoMensagemEnum;
|
|
57
|
+
(function (UnbTipoMensagemEnum) {
|
|
58
|
+
UnbTipoMensagemEnum[UnbTipoMensagemEnum["SUCCESS"] = 0] = "SUCCESS";
|
|
59
|
+
UnbTipoMensagemEnum[UnbTipoMensagemEnum["INFO"] = 1] = "INFO";
|
|
60
|
+
UnbTipoMensagemEnum[UnbTipoMensagemEnum["WARNING"] = 2] = "WARNING";
|
|
61
|
+
UnbTipoMensagemEnum[UnbTipoMensagemEnum["DANGER"] = 3] = "DANGER";
|
|
62
|
+
})(UnbTipoMensagemEnum || (UnbTipoMensagemEnum = {}));
|
|
63
|
+
class UnbMensagemService {
|
|
64
|
+
constructor() {
|
|
65
|
+
this.messageSubject = new Subject();
|
|
66
|
+
// [background_color, font_color, border_color]
|
|
67
|
+
this.cores = [
|
|
68
|
+
['#dff0d8', '#3c763d', '#d6e9c6'], // SUCCESS
|
|
69
|
+
['#d9edf7', '#31708f', '#bce8f1'], // INFO
|
|
70
|
+
['#fcf8e3', '#8a6d3b', '#faebcc'], // WARNING
|
|
71
|
+
['#f2dede', '#a94442', '#ebccd1'] // DANGER
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @param message mensagem que vai aparecer na tela
|
|
77
|
+
* @param tipo tipo da mensagem: success, info, warning, danger.
|
|
78
|
+
*/
|
|
79
|
+
showMessage(message, type) {
|
|
80
|
+
this.messageSubject.next(this.createAlertMessage(message, ...this.cores[type]));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Esconde o componente de mensagem passando um valor vazio
|
|
84
|
+
*/
|
|
85
|
+
hideMessage() {
|
|
86
|
+
this.messageSubject.next(new UnbMensagemModel());
|
|
87
|
+
}
|
|
88
|
+
getMessageSubject() {
|
|
89
|
+
return this.messageSubject.asObservable();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param message Cria a mensagem passando os parametros com base nas cores criadas no construturo
|
|
94
|
+
* @param background_color cor de fundo
|
|
95
|
+
* @param font_color cor da fonte
|
|
96
|
+
* @param border_color cor da borda
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
createAlertMessage(message, background_color, font_color, border_color) {
|
|
100
|
+
return { message, background_color, font_color, border_color };
|
|
101
|
+
}
|
|
102
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
103
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemService, providedIn: 'root' }); }
|
|
104
|
+
}
|
|
105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemService, decorators: [{
|
|
106
|
+
type: Injectable,
|
|
107
|
+
args: [{
|
|
108
|
+
providedIn: 'root'
|
|
109
|
+
}]
|
|
110
|
+
}], ctorParameters: () => [] });
|
|
111
|
+
|
|
112
|
+
class UnbMensagemComponent {
|
|
113
|
+
constructor(mensagemService) {
|
|
114
|
+
this.mensagemService = mensagemService;
|
|
115
|
+
}
|
|
116
|
+
ngOnInit() {
|
|
117
|
+
this.subscription = this.mensagemService.getMessageSubject().subscribe(message => {
|
|
118
|
+
if (message) {
|
|
119
|
+
this.alertMessage = message;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
//this.alertMessage = undefined;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
ngAfterContentInit() {
|
|
127
|
+
if (this.mensagem != null && this.mensagem != undefined) {
|
|
128
|
+
this.showMessage(this.mensagem, this.getTipo());
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Esconde o componente de mensagem
|
|
133
|
+
*/
|
|
134
|
+
hide() {
|
|
135
|
+
this.mensagemService.hideMessage();
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @param message mensagem que vai aparecer na tela
|
|
140
|
+
* @param tipo tipo da mensagem: success, info, warning, danger.
|
|
141
|
+
*/
|
|
142
|
+
showMessage(message, tipo) {
|
|
143
|
+
this.mensagemService.showMessage(message, tipo);
|
|
144
|
+
}
|
|
145
|
+
ngOnDestroy() {
|
|
146
|
+
// unsubscribe to ensure no memory leaks
|
|
147
|
+
if (this.subscription) {
|
|
148
|
+
this.subscription.unsubscribe();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Recupera qual o tipo da mensagem.
|
|
153
|
+
* O método tenta achar o tipo conforme o valor informado, incluido erros de digitação
|
|
154
|
+
*
|
|
155
|
+
* @returns o valor correspondente do informa. Caso não encontra, emite um erro e coloca retorna o padrão info como default
|
|
156
|
+
*/
|
|
157
|
+
getTipo() {
|
|
158
|
+
if (this.tipo != null && this.tipo != undefined) {
|
|
159
|
+
let valor = this.tipo.toLowerCase();
|
|
160
|
+
if (valor == 'warning' || valor == 'warn' || valor == 'aviso') {
|
|
161
|
+
return UnbTipoMensagemEnum.WARNING;
|
|
162
|
+
}
|
|
163
|
+
else if (valor == 'sucesso' || valor == 'success' || valor == 'sucess') {
|
|
164
|
+
return UnbTipoMensagemEnum.SUCCESS;
|
|
165
|
+
}
|
|
166
|
+
else if (valor == 'danger' || valor == 'erro' || valor == 'error') {
|
|
167
|
+
return UnbTipoMensagemEnum.DANGER;
|
|
168
|
+
}
|
|
169
|
+
else if (valor == 'info') {
|
|
170
|
+
return UnbTipoMensagemEnum.INFO;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// o padrao eh o info
|
|
174
|
+
console.log("Erro: Input [tipo] do componente unb-mensagem tem um valor inválido. Utilize: " + UnbTipoMensagemEnum.SUCCESS + " | " + UnbTipoMensagemEnum.INFO + " | " + UnbTipoMensagemEnum.WARNING + " | " + UnbTipoMensagemEnum.DANGER);
|
|
175
|
+
return UnbTipoMensagemEnum.INFO;
|
|
176
|
+
}
|
|
177
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemComponent, deps: [{ token: UnbMensagemService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
178
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbMensagemComponent, selector: "unb-mensagem", inputs: { mensagem: "mensagem", tipo: "tipo" }, ngImport: i0, template: "\r\n<div class=\"alert\" *ngIf=\"alertMessage && alertMessage.message && alertMessage.message.length > 1\" [ngStyle]=\"{background: alertMessage.background_color, 'border-color': alertMessage.border_color}\"> \r\n <div class=\"mensagem\" [ngStyle]=\"{color: alertMessage.font_color}\" [innerHtml]= \"alertMessage.message\"></div>\r\n <a class=\"close\" (click)=\"hide()\" aria-label=\"fechar\" [ngStyle]=\"{color: alertMessage.font_color}\">x</a>\r\n</div> \r\n\r\n", styles: [".alert{display:flex;text-align:center;justify-content:space-between;border-top-color:darken(1px,5%);padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:15px;line-height:1.42857143;font-weight:400;border-color:#fff}.mensagem{margin:0 auto}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;cursor:pointer;justify-content:flex-end}.close:hover{opacity:.7}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
|
|
179
|
+
}
|
|
180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemComponent, decorators: [{
|
|
181
|
+
type: Component,
|
|
182
|
+
args: [{ selector: 'unb-mensagem', template: "\r\n<div class=\"alert\" *ngIf=\"alertMessage && alertMessage.message && alertMessage.message.length > 1\" [ngStyle]=\"{background: alertMessage.background_color, 'border-color': alertMessage.border_color}\"> \r\n <div class=\"mensagem\" [ngStyle]=\"{color: alertMessage.font_color}\" [innerHtml]= \"alertMessage.message\"></div>\r\n <a class=\"close\" (click)=\"hide()\" aria-label=\"fechar\" [ngStyle]=\"{color: alertMessage.font_color}\">x</a>\r\n</div> \r\n\r\n", styles: [".alert{display:flex;text-align:center;justify-content:space-between;border-top-color:darken(1px,5%);padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:15px;line-height:1.42857143;font-weight:400;border-color:#fff}.mensagem{margin:0 auto}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;cursor:pointer;justify-content:flex-end}.close:hover{opacity:.7}\n"] }]
|
|
183
|
+
}], ctorParameters: () => [{ type: UnbMensagemService }], propDecorators: { mensagem: [{
|
|
184
|
+
type: Input
|
|
185
|
+
}], tipo: [{
|
|
186
|
+
type: Input
|
|
187
|
+
}] } });
|
|
188
|
+
|
|
189
|
+
class UnbMensagemModule {
|
|
190
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
191
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemModule, declarations: [UnbMensagemComponent], imports: [CommonModule,
|
|
192
|
+
MatIconModule,
|
|
193
|
+
MatButtonModule], exports: [UnbMensagemComponent] }); }
|
|
194
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemModule, imports: [CommonModule,
|
|
195
|
+
MatIconModule,
|
|
196
|
+
MatButtonModule] }); }
|
|
197
|
+
}
|
|
198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbMensagemModule, decorators: [{
|
|
199
|
+
type: NgModule,
|
|
200
|
+
args: [{
|
|
201
|
+
declarations: [UnbMensagemComponent],
|
|
202
|
+
imports: [CommonModule,
|
|
203
|
+
MatIconModule,
|
|
204
|
+
MatButtonModule],
|
|
205
|
+
exports: [UnbMensagemComponent]
|
|
206
|
+
}]
|
|
207
|
+
}] });
|
|
208
|
+
|
|
209
|
+
class UnbUsuarioModel {
|
|
210
|
+
constructor() {
|
|
211
|
+
this.autenticado = false;
|
|
212
|
+
this.usuarioNome = "";
|
|
213
|
+
this.perfis = [];
|
|
214
|
+
this.expiration = 0;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
class UnbAuthService {
|
|
219
|
+
constructor() {
|
|
220
|
+
// Inicializamos o BehaviorSubject com uma lista vazia de perfis
|
|
221
|
+
this.usuarioSubject = new BehaviorSubject(new UnbUsuarioModel);
|
|
222
|
+
this.usuario$ = this.usuarioSubject.asObservable();
|
|
223
|
+
this.usuarioModel = new UnbUsuarioModel();
|
|
224
|
+
}
|
|
225
|
+
initiate(oidcSecurityService) {
|
|
226
|
+
this.oidcSecurityService = oidcSecurityService;
|
|
227
|
+
this.logAuthenticatedState();
|
|
228
|
+
}
|
|
229
|
+
logAuthenticatedState() {
|
|
230
|
+
this.oidcSecurityService.checkAuth().subscribe((loginResponse) => {
|
|
231
|
+
if (!loginResponse.isAuthenticated) {
|
|
232
|
+
this.usuarioModel.autenticado = false;
|
|
233
|
+
this.usuarioSubject.next(this.usuarioModel);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
this.usuarioModel.autenticado = true;
|
|
237
|
+
this.setUserData(loginResponse.userData);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
setUserData(userData) {
|
|
242
|
+
const nomeCompleto = userData.given_name.trim();
|
|
243
|
+
const nomes = nomeCompleto.split(' ');
|
|
244
|
+
this.usuarioModel.usuarioNome = nomes.length > 1
|
|
245
|
+
? `${nomes[0]} ${nomes[nomes.length - 1]}`
|
|
246
|
+
: nomes[0];
|
|
247
|
+
this.oidcSecurityService.getPayloadFromAccessToken().subscribe((authResult) => {
|
|
248
|
+
this.usuarioModel.perfis = authResult.realm_access.roles || [];
|
|
249
|
+
// Atualiza o BehaviorSubject com o modelo atualizado
|
|
250
|
+
this.usuarioSubject.next(this.usuarioModel);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
login() {
|
|
254
|
+
this.oidcSecurityService.authorize();
|
|
255
|
+
}
|
|
256
|
+
logout() {
|
|
257
|
+
this.oidcSecurityService
|
|
258
|
+
.logoff()
|
|
259
|
+
.subscribe(() => this.usuarioSubject.next(new UnbUsuarioModel()));
|
|
260
|
+
}
|
|
261
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbAuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
262
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbAuthService, providedIn: 'root' }); }
|
|
263
|
+
}
|
|
264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbAuthService, decorators: [{
|
|
265
|
+
type: Injectable,
|
|
266
|
+
args: [{
|
|
267
|
+
providedIn: 'root'
|
|
268
|
+
}]
|
|
269
|
+
}], ctorParameters: () => [] });
|
|
270
|
+
|
|
271
|
+
class UnbUsuarioComponent {
|
|
272
|
+
constructor(authService) {
|
|
273
|
+
this.authService = authService;
|
|
274
|
+
}
|
|
275
|
+
ngOnInit() {
|
|
276
|
+
if (this.oidcSecurityService == null) {
|
|
277
|
+
console.log("Erro: oidcService está null!");
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
this.authService.initiate(this.oidcSecurityService);
|
|
281
|
+
this.usuario$ = this.authService.usuario$;
|
|
282
|
+
}
|
|
283
|
+
login() {
|
|
284
|
+
this.authService.login();
|
|
285
|
+
}
|
|
286
|
+
logout() {
|
|
287
|
+
this.authService.logout();
|
|
288
|
+
}
|
|
289
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbUsuarioComponent, deps: [{ token: UnbAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
290
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbUsuarioComponent, selector: "unb-usuario", inputs: { oidcSecurityService: "oidcSecurityService" }, ngImport: i0, template: "<button mat-mini-fab color=\"primary\" aria-label=\"Login Button\" [matMenuTriggerFor]=\"menu\">\r\n <mat-icon>person</mat-icon>\r\n</button>\r\n<mat-menu #menu=\"matMenu\">\r\n <div *ngIf=\"usuario$ | async as usuario\"> \r\n <mat-card-header class=\"menuHeader\" *ngIf=\"usuario && usuario.autenticado; else notAuthenticated\">\r\n <mat-card-title>\r\n <div class=\"user-info-container\">\r\n <span>{{ usuario.usuarioNome }}</span>\r\n <mat-icon matTooltip=\"{{ usuario.perfis.join(', ') }}\" aria-label=\"Perfis de usu\u00E1rio\" *ngIf=\"usuario.perfis\">\r\n account_circle\r\n </mat-icon>\r\n </div>\r\n </mat-card-title>\r\n </mat-card-header>\r\n\r\n <ng-template #notAuthenticated>\r\n <mat-card-header class=\"menuHeader\">\r\n <button mat-menu-item (click)=\"login()\">\r\n <mat-icon>login</mat-icon>\r\n <span>Login</span>\r\n </button>\r\n </mat-card-header>\r\n </ng-template>\r\n\r\n <mat-divider *ngIf=\"usuario.autenticado\"></mat-divider>\r\n\r\n <mat-card-actions *ngIf=\"usuario.autenticado\">\r\n <button mat-menu-item (click)=\"logout()\">\r\n <mat-icon>exit_to_app</mat-icon>\r\n <span>Sair</span>\r\n </button>\r\n </mat-card-actions>\r\n </div>\r\n</mat-menu>", styles: [".sidenav-container{height:100%}.sidenav{width:200px}.sidenav .mat-toolbar{background:inherit}.mat-toolbar.mat-primary{position:sticky;top:0;z-index:1}button.login_button{outline:none;padding:0;border:none;background:none;cursor:pointer}.mat-card{background:#036;padding:5px 20px 0 0}.menu{min-width:500px;max-width:400px}.menuHeader{padding:10px}.user-info-container{display:flex;align-items:center;justify-content:center;gap:8px}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i6.MatMiniFabButton, selector: "button[mat-mini-fab]", exportAs: ["matButton"] }, { kind: "directive", type: i7.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "component", type: i7.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i7.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] }); }
|
|
291
|
+
}
|
|
292
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbUsuarioComponent, decorators: [{
|
|
293
|
+
type: Component,
|
|
294
|
+
args: [{ selector: 'unb-usuario', template: "<button mat-mini-fab color=\"primary\" aria-label=\"Login Button\" [matMenuTriggerFor]=\"menu\">\r\n <mat-icon>person</mat-icon>\r\n</button>\r\n<mat-menu #menu=\"matMenu\">\r\n <div *ngIf=\"usuario$ | async as usuario\"> \r\n <mat-card-header class=\"menuHeader\" *ngIf=\"usuario && usuario.autenticado; else notAuthenticated\">\r\n <mat-card-title>\r\n <div class=\"user-info-container\">\r\n <span>{{ usuario.usuarioNome }}</span>\r\n <mat-icon matTooltip=\"{{ usuario.perfis.join(', ') }}\" aria-label=\"Perfis de usu\u00E1rio\" *ngIf=\"usuario.perfis\">\r\n account_circle\r\n </mat-icon>\r\n </div>\r\n </mat-card-title>\r\n </mat-card-header>\r\n\r\n <ng-template #notAuthenticated>\r\n <mat-card-header class=\"menuHeader\">\r\n <button mat-menu-item (click)=\"login()\">\r\n <mat-icon>login</mat-icon>\r\n <span>Login</span>\r\n </button>\r\n </mat-card-header>\r\n </ng-template>\r\n\r\n <mat-divider *ngIf=\"usuario.autenticado\"></mat-divider>\r\n\r\n <mat-card-actions *ngIf=\"usuario.autenticado\">\r\n <button mat-menu-item (click)=\"logout()\">\r\n <mat-icon>exit_to_app</mat-icon>\r\n <span>Sair</span>\r\n </button>\r\n </mat-card-actions>\r\n </div>\r\n</mat-menu>", styles: [".sidenav-container{height:100%}.sidenav{width:200px}.sidenav .mat-toolbar{background:inherit}.mat-toolbar.mat-primary{position:sticky;top:0;z-index:1}button.login_button{outline:none;padding:0;border:none;background:none;cursor:pointer}.mat-card{background:#036;padding:5px 20px 0 0}.menu{min-width:500px;max-width:400px}.menuHeader{padding:10px}.user-info-container{display:flex;align-items:center;justify-content:center;gap:8px}\n"] }]
|
|
295
|
+
}], ctorParameters: () => [{ type: UnbAuthService }], propDecorators: { oidcSecurityService: [{
|
|
296
|
+
type: Input
|
|
297
|
+
}] } });
|
|
298
|
+
|
|
299
|
+
class UnbNavBarComponent {
|
|
300
|
+
constructor(observer) {
|
|
301
|
+
this.observer = observer;
|
|
302
|
+
this.nomeSistema = "Nome do Sistema"; /* O nome do sistema */
|
|
303
|
+
this.menuSize = 300; /** O tamanho do menu em px */
|
|
304
|
+
this.widthToHideMenu = 800; /* O tamanho da tela ateh esconder o menu */
|
|
305
|
+
this.contentBackgroundColor = '#f0f3f7'; /* A cor do Content */
|
|
306
|
+
this.containerPadding = 10; /* O tamanho do padding to container que fica o content */
|
|
307
|
+
this.isMobile = true;
|
|
308
|
+
}
|
|
309
|
+
ngOnInit() {
|
|
310
|
+
this.observer.observe(['(max-width: ' + this.widthToHideMenu + 'px)']).subscribe((screenSize) => {
|
|
311
|
+
if (screenSize.matches) {
|
|
312
|
+
this.isMobile = true;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
this.isMobile = false;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbNavBarComponent, deps: [{ token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
320
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbNavBarComponent, selector: "unb-nav-bar", inputs: { nomeSistema: "nomeSistema", menuSize: "menuSize", widthToHideMenu: "widthToHideMenu", contentBackgroundColor: "contentBackgroundColor", containerPadding: "containerPadding", oidcSecurityService: "oidcSecurityService" }, viewQueries: [{ propertyName: "sidenav", first: true, predicate: MatSidenav, descendants: true }], ngImport: i0, template: "<div class=\"example-container\" >\r\n <mat-toolbar class=\"example-toolbar\">\r\n <button mat-icon-button class=\"minifab\" type=\"button\" aria-label=\"Toggle sidenav\" color=\"accent\" (click)=\"snav.toggle()\"><mat-icon>menu</mat-icon></button> \r\n <img src=\"assets/img/unb_icon_branco.svg\" alt=\"\" style=\"width: 40px\"> \r\n <span style=\"color: white;\">{{nomeSistema}}</span>\r\n <span class=\"spacer\"></span> \r\n <unb-usuario [oidcSecurityService]=\"oidcSecurityService\"></unb-usuario>\r\n </mat-toolbar>\r\n\r\n <mat-sidenav-container class=\"example-sidenav-container\" [ngStyle]=\"{'background-color': contentBackgroundColor}\" > \r\n <mat-sidenav #snav [mode]=\"isMobile ? 'over' : 'side'\" [opened]=\"isMobile ? 'false' : 'true'\" [style.max-width.px]=\"menuSize\" > \r\n <ng-content select=\"[menu]\"></ng-content> \r\n </mat-sidenav>\r\n\r\n <mat-sidenav-content [ngStyle]=\"{'padding.px': containerPadding}\">\r\n <ng-content select=\"[body]\"></ng-content> \r\n </mat-sidenav-content>\r\n\r\n </mat-sidenav-container>\r\n</div>", styles: [".example-container{display:flex;flex-direction:column;position:absolute;inset:0}.example-is-mobile .example-toolbar{position:fixed;z-index:2}.spacer{flex:1 1 auto}.example-sidenav-container{flex:1}.example-is-mobile .example-sidenav-container{flex:1 0 auto}.minifab{margin:5px;color:#fff;fill:#fff}\n"], dependencies: [{ kind: "directive", type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i4$1.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i4$1.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i4$1.MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i6.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: UnbUsuarioComponent, selector: "unb-usuario", inputs: ["oidcSecurityService"] }] }); }
|
|
321
|
+
}
|
|
322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbNavBarComponent, decorators: [{
|
|
323
|
+
type: Component,
|
|
324
|
+
args: [{ selector: 'unb-nav-bar', template: "<div class=\"example-container\" >\r\n <mat-toolbar class=\"example-toolbar\">\r\n <button mat-icon-button class=\"minifab\" type=\"button\" aria-label=\"Toggle sidenav\" color=\"accent\" (click)=\"snav.toggle()\"><mat-icon>menu</mat-icon></button> \r\n <img src=\"assets/img/unb_icon_branco.svg\" alt=\"\" style=\"width: 40px\"> \r\n <span style=\"color: white;\">{{nomeSistema}}</span>\r\n <span class=\"spacer\"></span> \r\n <unb-usuario [oidcSecurityService]=\"oidcSecurityService\"></unb-usuario>\r\n </mat-toolbar>\r\n\r\n <mat-sidenav-container class=\"example-sidenav-container\" [ngStyle]=\"{'background-color': contentBackgroundColor}\" > \r\n <mat-sidenav #snav [mode]=\"isMobile ? 'over' : 'side'\" [opened]=\"isMobile ? 'false' : 'true'\" [style.max-width.px]=\"menuSize\" > \r\n <ng-content select=\"[menu]\"></ng-content> \r\n </mat-sidenav>\r\n\r\n <mat-sidenav-content [ngStyle]=\"{'padding.px': containerPadding}\">\r\n <ng-content select=\"[body]\"></ng-content> \r\n </mat-sidenav-content>\r\n\r\n </mat-sidenav-container>\r\n</div>", styles: [".example-container{display:flex;flex-direction:column;position:absolute;inset:0}.example-is-mobile .example-toolbar{position:fixed;z-index:2}.spacer{flex:1 1 auto}.example-sidenav-container{flex:1}.example-is-mobile .example-sidenav-container{flex:1 0 auto}.minifab{margin:5px;color:#fff;fill:#fff}\n"] }]
|
|
325
|
+
}], ctorParameters: () => [{ type: i1.BreakpointObserver }], propDecorators: { nomeSistema: [{
|
|
326
|
+
type: Input
|
|
327
|
+
}], menuSize: [{
|
|
328
|
+
type: Input
|
|
329
|
+
}], widthToHideMenu: [{
|
|
330
|
+
type: Input
|
|
331
|
+
}], contentBackgroundColor: [{
|
|
332
|
+
type: Input
|
|
333
|
+
}], containerPadding: [{
|
|
334
|
+
type: Input
|
|
335
|
+
}], oidcSecurityService: [{
|
|
336
|
+
type: Input
|
|
337
|
+
}], sidenav: [{
|
|
338
|
+
type: ViewChild,
|
|
339
|
+
args: [MatSidenav]
|
|
340
|
+
}] } });
|
|
341
|
+
|
|
342
|
+
class UnbUsuarioModule {
|
|
343
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbUsuarioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
344
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.2", ngImport: i0, type: UnbUsuarioModule, declarations: [UnbUsuarioComponent], imports: [BrowserModule,
|
|
345
|
+
MatToolbarModule,
|
|
346
|
+
MatSidenavModule,
|
|
347
|
+
LayoutModule,
|
|
348
|
+
MatMenuModule,
|
|
349
|
+
MatIconModule,
|
|
350
|
+
MatListModule,
|
|
351
|
+
MatButtonModule,
|
|
352
|
+
MatCardModule,
|
|
353
|
+
MatTooltipModule,
|
|
354
|
+
MatMenuModule,
|
|
355
|
+
MatDividerModule], exports: [UnbUsuarioComponent] }); }
|
|
356
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbUsuarioModule, providers: [UnbAuthService], imports: [BrowserModule,
|
|
357
|
+
MatToolbarModule,
|
|
358
|
+
MatSidenavModule,
|
|
359
|
+
LayoutModule,
|
|
360
|
+
MatMenuModule,
|
|
361
|
+
MatIconModule,
|
|
362
|
+
MatListModule,
|
|
363
|
+
MatButtonModule,
|
|
364
|
+
MatCardModule,
|
|
365
|
+
MatTooltipModule,
|
|
366
|
+
MatMenuModule,
|
|
367
|
+
MatDividerModule] }); }
|
|
368
|
+
}
|
|
369
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbUsuarioModule, decorators: [{
|
|
370
|
+
type: NgModule,
|
|
371
|
+
args: [{
|
|
372
|
+
declarations: [UnbUsuarioComponent],
|
|
373
|
+
imports: [
|
|
374
|
+
BrowserModule,
|
|
375
|
+
MatToolbarModule,
|
|
376
|
+
MatSidenavModule,
|
|
377
|
+
LayoutModule,
|
|
378
|
+
MatMenuModule,
|
|
379
|
+
MatIconModule,
|
|
380
|
+
MatListModule,
|
|
381
|
+
MatButtonModule,
|
|
382
|
+
MatCardModule,
|
|
383
|
+
MatTooltipModule,
|
|
384
|
+
MatMenuModule,
|
|
385
|
+
MatDividerModule
|
|
386
|
+
],
|
|
387
|
+
exports: [UnbUsuarioComponent],
|
|
388
|
+
providers: [UnbAuthService]
|
|
389
|
+
}]
|
|
390
|
+
}] });
|
|
391
|
+
|
|
392
|
+
class UnbNavBarModule {
|
|
393
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbNavBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
394
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.2", ngImport: i0, type: UnbNavBarModule, declarations: [UnbNavBarComponent], imports: [BrowserModule,
|
|
395
|
+
MatToolbarModule,
|
|
396
|
+
MatSidenavModule,
|
|
397
|
+
LayoutModule,
|
|
398
|
+
MatIconModule,
|
|
399
|
+
MatListModule,
|
|
400
|
+
MatButtonModule,
|
|
401
|
+
UnbUsuarioModule,
|
|
402
|
+
MatCardModule], exports: [UnbNavBarComponent] }); }
|
|
403
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbNavBarModule, imports: [BrowserModule,
|
|
404
|
+
MatToolbarModule,
|
|
405
|
+
MatSidenavModule,
|
|
406
|
+
LayoutModule,
|
|
407
|
+
MatIconModule,
|
|
408
|
+
MatListModule,
|
|
409
|
+
MatButtonModule,
|
|
410
|
+
UnbUsuarioModule,
|
|
411
|
+
MatCardModule] }); }
|
|
412
|
+
}
|
|
413
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbNavBarModule, decorators: [{
|
|
414
|
+
type: NgModule,
|
|
415
|
+
args: [{
|
|
416
|
+
declarations: [UnbNavBarComponent],
|
|
417
|
+
imports: [
|
|
418
|
+
BrowserModule,
|
|
419
|
+
MatToolbarModule,
|
|
420
|
+
MatSidenavModule,
|
|
421
|
+
LayoutModule,
|
|
422
|
+
MatIconModule,
|
|
423
|
+
MatListModule,
|
|
424
|
+
MatButtonModule,
|
|
425
|
+
UnbUsuarioModule,
|
|
426
|
+
MatCardModule
|
|
427
|
+
],
|
|
428
|
+
exports: [UnbNavBarComponent]
|
|
429
|
+
}]
|
|
430
|
+
}] });
|
|
431
|
+
|
|
432
|
+
const listaEstados = [
|
|
433
|
+
{ codigo: 1, identificador: 'AC', descricao: "Acre" },
|
|
434
|
+
{ codigo: 2, identificador: 'AL', descricao: "Alagoas" },
|
|
435
|
+
{ codigo: 3, identificador: 'AM', descricao: "Amazonas" },
|
|
436
|
+
{ codigo: 4, identificador: 'AP', descricao: "Amapá" },
|
|
437
|
+
{ codigo: 5, identificador: 'BA', descricao: "Bahia" },
|
|
438
|
+
{ codigo: 6, identificador: 'CE', descricao: "Ceará" },
|
|
439
|
+
{ codigo: 7, identificador: 'DF', descricao: "Distrito Federal" },
|
|
440
|
+
{ codigo: 8, identificador: 'ES', descricao: "Espírito Santo" },
|
|
441
|
+
{ codigo: 9, identificador: 'GO', descricao: "Goiás" },
|
|
442
|
+
{ codigo: 10, identificador: 'MA', descricao: "Maranhão" },
|
|
443
|
+
{ codigo: 11, identificador: 'MG', descricao: "Minas Gerais" },
|
|
444
|
+
{ codigo: 12, identificador: 'MS', descricao: "Mato Grosso do Sul" },
|
|
445
|
+
{ codigo: 13, identificador: 'MT', descricao: "Mato Grosso" },
|
|
446
|
+
{ codigo: 14, identificador: 'PA', descricao: "Pará" },
|
|
447
|
+
{ codigo: 15, identificador: 'PB', descricao: "Paraíba" },
|
|
448
|
+
{ codigo: 16, identificador: 'PE', descricao: "Pernambuco" },
|
|
449
|
+
{ codigo: 17, identificador: 'PI', descricao: "Piauí" },
|
|
450
|
+
{ codigo: 18, identificador: 'PR', descricao: "Paraná" },
|
|
451
|
+
{ codigo: 19, identificador: 'RJ', descricao: "Rio de Janeiro" },
|
|
452
|
+
{ codigo: 20, identificador: 'RN', descricao: "Rio Grande do Norte" },
|
|
453
|
+
{ codigo: 21, identificador: 'RO', descricao: "Rondônia" },
|
|
454
|
+
{ codigo: 22, identificador: 'RR', descricao: "Roraima" },
|
|
455
|
+
{ codigo: 23, identificador: 'RS', descricao: "Rio Grande do Sul" },
|
|
456
|
+
{ codigo: 24, identificador: 'SC', descricao: "Santa Catarina" },
|
|
457
|
+
{ codigo: 25, identificador: 'SE', descricao: "Sergipe" },
|
|
458
|
+
{ codigo: 26, identificador: 'SP', descricao: "São Paulo" },
|
|
459
|
+
{ codigo: 27, identificador: 'TO', descricao: "Tocantins" }
|
|
460
|
+
];
|
|
461
|
+
|
|
462
|
+
class UnbPessoaEmail {
|
|
463
|
+
}
|
|
464
|
+
class UnbPessoaEmailTipo {
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
var TipoPessoaEnum;
|
|
468
|
+
(function (TipoPessoaEnum) {
|
|
469
|
+
TipoPessoaEnum["FISICA"] = "F\u00EDsica";
|
|
470
|
+
TipoPessoaEnum["JURIDICA"] = "Jur\u00EDdica";
|
|
471
|
+
TipoPessoaEnum["ESTRANGEIRA"] = "Estrangeira";
|
|
472
|
+
})(TipoPessoaEnum || (TipoPessoaEnum = {}));
|
|
473
|
+
|
|
474
|
+
class UnBPessoaService {
|
|
475
|
+
constructor(http) {
|
|
476
|
+
this.http = http;
|
|
477
|
+
this.apiConfigSubject = new BehaviorSubject({ url: '', token: '' });
|
|
478
|
+
this.apiConfig$ = this.apiConfigSubject.asObservable();
|
|
479
|
+
}
|
|
480
|
+
// Atualiza a configuração global
|
|
481
|
+
setApiConfig(config) {
|
|
482
|
+
this.apiConfigSubject.next(config);
|
|
483
|
+
}
|
|
484
|
+
// Retorna a configuração atual
|
|
485
|
+
getApiConfig() {
|
|
486
|
+
return this.apiConfigSubject.getValue();
|
|
487
|
+
}
|
|
488
|
+
// Headers padrão
|
|
489
|
+
getHeaders() {
|
|
490
|
+
const { token } = this.getApiConfig();
|
|
491
|
+
return {
|
|
492
|
+
headers: new HttpHeaders({
|
|
493
|
+
'Content-Type': 'application/json',
|
|
494
|
+
Authorization: `Bearer ${token}`
|
|
495
|
+
})
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
// Métodos de busca
|
|
499
|
+
findByCpf(cpf) {
|
|
500
|
+
const url = `${this.getApiConfig().url}/pessoa-api/pessoas/fisicas?cpf=${cpf}`;
|
|
501
|
+
return this.http.get(url, this.getHeaders()).pipe(catchError(this.handleError));
|
|
502
|
+
}
|
|
503
|
+
findByCnpj(cnpj) {
|
|
504
|
+
const url = `${this.getApiConfig().url}/pessoa-api/pessoas/juridicas?cnpj=${cnpj}`;
|
|
505
|
+
return this.http.get(url, this.getHeaders()).pipe(catchError(this.handleError));
|
|
506
|
+
}
|
|
507
|
+
findByPassaporte(passaporte) {
|
|
508
|
+
const url = `${this.getApiConfig().url}/pessoa-api/pessoas/fisicas?passaporte=${passaporte}`;
|
|
509
|
+
return this.http.get(url, this.getHeaders()).pipe(catchError(this.handleError));
|
|
510
|
+
}
|
|
511
|
+
findPessoaFisicaById(id) {
|
|
512
|
+
const url = `${this.getApiConfig().url}/pessoa-api/pessoas/fisicas/${id}`;
|
|
513
|
+
return this.http.get(url, this.getHeaders()).pipe(catchError(this.handleError));
|
|
514
|
+
}
|
|
515
|
+
pesquisarCep(cep) {
|
|
516
|
+
const url = `${this.getApiConfig().url}/pessoa-api/public/busca-cep/servico-1/${cep}`;
|
|
517
|
+
return this.http.get(url, this.getHeaders()).pipe(catchError(this.handleError));
|
|
518
|
+
}
|
|
519
|
+
// Salvar (decide fisica ou juridica)
|
|
520
|
+
salvar(pessoa) {
|
|
521
|
+
if (!pessoa)
|
|
522
|
+
return throwError(() => new Error('Erro Local: Object não pode ser null'));
|
|
523
|
+
if (!pessoa.tipoPessoa)
|
|
524
|
+
return throwError(() => new Error('Erro Local: Tipo pessoa não pode ser null'));
|
|
525
|
+
if (pessoa.tipoPessoa == TipoPessoaEnum.FISICA || pessoa.tipoPessoa == TipoPessoaEnum.ESTRANGEIRA) {
|
|
526
|
+
return this.savePessoaFisica(pessoa);
|
|
527
|
+
}
|
|
528
|
+
else if (pessoa.tipoPessoa == TipoPessoaEnum.JURIDICA) {
|
|
529
|
+
return this.savePessoaJuridica(pessoa);
|
|
530
|
+
}
|
|
531
|
+
return of(null);
|
|
532
|
+
}
|
|
533
|
+
// Salvar Pessoa Física
|
|
534
|
+
savePessoaFisica(pessoa) {
|
|
535
|
+
const url = this.getApiConfig().url;
|
|
536
|
+
const httpOptions = this.getHeaders();
|
|
537
|
+
const body = JSON.stringify(pessoa);
|
|
538
|
+
if (pessoa.codigoPessoa == null) {
|
|
539
|
+
return this.http.post(`${url}/pessoa-api/pessoas/fisicas`, body, httpOptions);
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
return this.http.put(`${url}/pessoa-api/pessoas/fisicas/${pessoa.codigoPessoa}`, body, httpOptions);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
// Salvar Pessoa Jurídica
|
|
546
|
+
savePessoaJuridica(pessoa) {
|
|
547
|
+
const url = this.getApiConfig().url;
|
|
548
|
+
const httpOptions = this.getHeaders();
|
|
549
|
+
const body = JSON.stringify(pessoa);
|
|
550
|
+
if (pessoa.codigoPessoa == null) {
|
|
551
|
+
return this.http.post(`${url}/pessoa-api/pessoas/juridicas`, body, httpOptions);
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
return this.http.put(`${url}/pessoa-api/pessoas/juridicas/${pessoa.codigoPessoa}`, body, httpOptions);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
// Dados auxiliares públicos
|
|
558
|
+
getEscolaridade() {
|
|
559
|
+
return this.http.get(`${this.getApiConfig().url}/pessoa-api/public/escolaridades/listagem`);
|
|
560
|
+
}
|
|
561
|
+
getEstadoCivil() {
|
|
562
|
+
return this.http.get(`${this.getApiConfig().url}/pessoa-api/public/estados-civis/listagem`);
|
|
563
|
+
}
|
|
564
|
+
getMunicipios() {
|
|
565
|
+
return this.http.get(`${this.getApiConfig().url}/pessoa-api/public/municipios/listagem`);
|
|
566
|
+
}
|
|
567
|
+
getPaises() {
|
|
568
|
+
return this.http.get(`${this.getApiConfig().url}/pessoa-api/public/paises/listagem?&page=0&size=200&sort=denominacao,asc`).pipe(map(response => {
|
|
569
|
+
return response.content.sort((a, b) => {
|
|
570
|
+
const nomeA = a?.denominacao?.toUpperCase() || '';
|
|
571
|
+
const nomeB = b?.denominacao?.toUpperCase() || '';
|
|
572
|
+
if (nomeA === 'BRASIL')
|
|
573
|
+
return -1;
|
|
574
|
+
if (nomeB === 'BRASIL')
|
|
575
|
+
return 1;
|
|
576
|
+
return nomeA.localeCompare(nomeB);
|
|
577
|
+
});
|
|
578
|
+
}));
|
|
579
|
+
}
|
|
580
|
+
getRacaCor() {
|
|
581
|
+
return this.http.get(`${this.getApiConfig().url}/pessoa-api/public/etnias/listagem`).pipe(map(lista => lista.map((item, index) => ({
|
|
582
|
+
codigo: index, // gera um código numérico sequencial
|
|
583
|
+
denominacao: this.formatarLabel(item) // formata se quiser
|
|
584
|
+
}))));
|
|
585
|
+
}
|
|
586
|
+
getTipoEmail() {
|
|
587
|
+
return this.http.get(`${this.getApiConfig().url}/pessoa-api/tipos-email/public/listagem`).pipe(map(lista => lista.map((item, index) => ({
|
|
588
|
+
codigo: index, // gera um código numérico sequencial
|
|
589
|
+
denominacao: this.formatarLabel(item) // formata se quiser
|
|
590
|
+
}))));
|
|
591
|
+
}
|
|
592
|
+
getTipoEndereco() {
|
|
593
|
+
return this.http.get(`${this.getApiConfig().url}/pessoa-api/tipos-endereco/public/listagem`).pipe(map(lista => lista.map((item, index) => ({
|
|
594
|
+
codigo: index, // gera um código numérico sequencial
|
|
595
|
+
denominacao: this.formatarLabel(item) // formata se quiser
|
|
596
|
+
}))));
|
|
597
|
+
}
|
|
598
|
+
getTipoTelefone() {
|
|
599
|
+
return this.http.get(`${this.getApiConfig().url}/pessoa-api/tipos-telefone/public/listagem`).pipe(map(lista => lista.map((item, index) => ({
|
|
600
|
+
codigo: index, // gera um código numérico sequencial
|
|
601
|
+
denominacao: this.formatarLabel(item) // formata se quiser
|
|
602
|
+
}))));
|
|
603
|
+
}
|
|
604
|
+
formatarLabel(text) {
|
|
605
|
+
return text
|
|
606
|
+
.toLowerCase()
|
|
607
|
+
.replace(/_/g, ' ')
|
|
608
|
+
.replace(/\b\w/g, l => l.toUpperCase());
|
|
609
|
+
}
|
|
610
|
+
// Handler de erro padrão
|
|
611
|
+
handleError(error) {
|
|
612
|
+
console.error('[UnBPessoaService] Erro na chamada HTTP:', error);
|
|
613
|
+
return throwError(() => error);
|
|
614
|
+
}
|
|
615
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnBPessoaService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
616
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnBPessoaService, providedIn: 'root' }); }
|
|
617
|
+
}
|
|
618
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnBPessoaService, decorators: [{
|
|
619
|
+
type: Injectable,
|
|
620
|
+
args: [{
|
|
621
|
+
providedIn: 'root'
|
|
622
|
+
}]
|
|
623
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }] });
|
|
624
|
+
|
|
625
|
+
class UnbPessoaEmailFormComponent {
|
|
626
|
+
constructor(snackBar, service, dialogRef, data) {
|
|
627
|
+
this.snackBar = snackBar;
|
|
628
|
+
this.service = service;
|
|
629
|
+
this.dialogRef = dialogRef;
|
|
630
|
+
this.data = data;
|
|
631
|
+
this.email = new UnbPessoaEmail();
|
|
632
|
+
this.listaTipoEmail = [];
|
|
633
|
+
this.email = JSON.parse(JSON.stringify(data.email)); // O e-mail específico para edição
|
|
634
|
+
// Verifique se a lista de e-mails foi passada e atribua-a
|
|
635
|
+
if (data.emailsList) {
|
|
636
|
+
this.emailsList = JSON.parse(JSON.stringify(data.emailsList)); // Faça uma cópia profunda se for manipular
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
this.emailsList = []; // Inicialize como vazio se não for passada
|
|
640
|
+
}
|
|
641
|
+
if (!this.email) {
|
|
642
|
+
this.email = new UnbPessoaEmail();
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
ngOnInit() {
|
|
646
|
+
this.tipoEmail = this.service.getTipoEmail();
|
|
647
|
+
// Inscreve para guardar a lista em uma variável comum
|
|
648
|
+
this.tipoEmail.subscribe(lista => {
|
|
649
|
+
this.listaTipoEmail = lista;
|
|
650
|
+
// Se já tiver tipoEmailCodigo, preenche o nome correspondente
|
|
651
|
+
if (this.email.tipoEmailCodigo != null) {
|
|
652
|
+
const tipoEncontrado = lista.find(t => t.codigo === this.email.tipoEmailCodigo);
|
|
653
|
+
if (tipoEncontrado) {
|
|
654
|
+
this.email.tipo = tipoEncontrado.denominacao;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
else if (this.email.tipo) {
|
|
658
|
+
const tipoEncontrado = lista.find(t => t.denominacao?.toLowerCase() === this.email.tipo?.toLowerCase());
|
|
659
|
+
if (tipoEncontrado) {
|
|
660
|
+
this.email.tipoEmailCodigo = tipoEncontrado.codigo;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
salvar(form) {
|
|
666
|
+
if (form.invalid) {
|
|
667
|
+
this.openSnackBar('Existem erros no formulário, por favor, verificar.');
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
if (this.validar(this.email) == false)
|
|
671
|
+
return;
|
|
672
|
+
this.emailSalvo = this.email;
|
|
673
|
+
this.salvarclose();
|
|
674
|
+
}
|
|
675
|
+
compararTipos(t1, t2) {
|
|
676
|
+
return t1 && t2 && t1 === t2;
|
|
677
|
+
}
|
|
678
|
+
onTipoSelecionado(codigoSelecionado) {
|
|
679
|
+
const tipoSelecionado = this.listaTipoEmail.find(t => t.codigo === codigoSelecionado);
|
|
680
|
+
if (tipoSelecionado) {
|
|
681
|
+
this.email.tipo = tipoSelecionado.denominacao;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Valida o objeto de e-mail.
|
|
686
|
+
* Retorna true se o e-mail for válido, false caso contrário.
|
|
687
|
+
*/
|
|
688
|
+
validar(emailToValidate) {
|
|
689
|
+
// 1. Validação de campo obrigatório
|
|
690
|
+
if (!emailToValidate.email || emailToValidate.email.trim() === '') {
|
|
691
|
+
this.openSnackBar("E-mail é um campo obrigatório.");
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
694
|
+
// 2. Validação de formato de e-mail
|
|
695
|
+
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
696
|
+
if (!emailRegex.test(emailToValidate.email)) {
|
|
697
|
+
this.openSnackBar("Digite um E-mail válido.");
|
|
698
|
+
return false;
|
|
699
|
+
}
|
|
700
|
+
// 3. Validação de e-mail duplicado na lista existente
|
|
701
|
+
// Filtra a lista para excluir o próprio e-mail que está sendo editado (se ele tiver um 'codigo')
|
|
702
|
+
const isDuplicate = this.emailsList.some(existingEmail => existingEmail.email?.toLowerCase() === emailToValidate.email?.toLowerCase() &&
|
|
703
|
+
existingEmail.codigo !== emailToValidate.codigo // Ignora o próprio e-mail se estiver sendo editado
|
|
704
|
+
);
|
|
705
|
+
if (isDuplicate) {
|
|
706
|
+
this.openSnackBar("Este e-mail já existe na lista.");
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
return true;
|
|
710
|
+
}
|
|
711
|
+
close() {
|
|
712
|
+
this.dialogRef.close(null);
|
|
713
|
+
}
|
|
714
|
+
salvarclose() {
|
|
715
|
+
this.dialogRef.close(this.emailSalvo);
|
|
716
|
+
}
|
|
717
|
+
openSnackBar(message) {
|
|
718
|
+
this.snackBar.open(message, 'x', {
|
|
719
|
+
duration: 5000,
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaEmailFormComponent, deps: [{ token: i1$2.MatSnackBar }, { token: UnBPessoaService }, { token: i3$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
723
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbPessoaEmailFormComponent, 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 <div class=\"form-container\">\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 <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 tipoEmail | async\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\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: i5$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$2.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: i5$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i5$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i6.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i7$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i8$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i3$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i3$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i9.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"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] }); }
|
|
724
|
+
}
|
|
725
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaEmailFormComponent, decorators: [{
|
|
726
|
+
type: Component,
|
|
727
|
+
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 <div class=\"form-container\">\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 <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 tipoEmail | async\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\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"] }]
|
|
728
|
+
}], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: UnBPessoaService }, { type: i3$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
729
|
+
type: Inject,
|
|
730
|
+
args: [MAT_DIALOG_DATA]
|
|
731
|
+
}] }] });
|
|
732
|
+
|
|
733
|
+
class UnbPessoaEndereco {
|
|
734
|
+
}
|
|
735
|
+
class UnbPessoaEnderecoTipo {
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
class UnbPessoaEnderecoFormComponent {
|
|
739
|
+
constructor(snackBar, service, dialogRef, data) {
|
|
740
|
+
this.snackBar = snackBar;
|
|
741
|
+
this.service = service;
|
|
742
|
+
this.dialogRef = dialogRef;
|
|
743
|
+
this.data = data;
|
|
744
|
+
this.endereco = new UnbPessoaEndereco();
|
|
745
|
+
this.listaTipoEndereco = [];
|
|
746
|
+
this.endereco = JSON.parse(JSON.stringify(data.endereco)); // O e-mail específico para edição
|
|
747
|
+
// Verifique se a lista de e-mails foi passada e atribua-a
|
|
748
|
+
if (data.enderecosList) {
|
|
749
|
+
this.enderecosList = JSON.parse(JSON.stringify(data.enderecosList)); // Faça uma cópia profunda se for manipular
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
this.enderecosList = []; // Inicialize como vazio se não for passada
|
|
753
|
+
}
|
|
754
|
+
if (!this.endereco) {
|
|
755
|
+
this.endereco = new UnbPessoaEndereco();
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
ngOnInit() {
|
|
759
|
+
this.tipoEndereco = this.service.getTipoEndereco();
|
|
760
|
+
// Inscreve para guardar a lista em uma variável comum
|
|
761
|
+
this.tipoEndereco.subscribe(lista => {
|
|
762
|
+
this.listaTipoEndereco = lista;
|
|
763
|
+
// Se já tiver tipoEmailCodigo, preenche o nome correspondente
|
|
764
|
+
if (this.endereco.tipoEnderecoCodigo != null) {
|
|
765
|
+
const tipoEncontrado = lista.find(t => t.codigo === this.endereco.tipoEnderecoCodigo);
|
|
766
|
+
if (tipoEncontrado) {
|
|
767
|
+
this.endereco.tipo = tipoEncontrado.denominacao;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
else if (this.endereco.tipo) {
|
|
771
|
+
const tipoEncontrado = lista.find(t => t.denominacao?.toLowerCase() === this.endereco.tipo?.toLowerCase());
|
|
772
|
+
if (tipoEncontrado) {
|
|
773
|
+
this.endereco.tipoEnderecoCodigo = tipoEncontrado.codigo;
|
|
774
|
+
}
|
|
775
|
+
// O metodo get retorna uf, mas o put espera ufEndereco
|
|
776
|
+
if (this.endereco.uf) {
|
|
777
|
+
this.endereco.ufEndereco = this.endereco.uf; // Converte ufEndereco para uf
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
salvar(form) {
|
|
783
|
+
if (form.invalid) {
|
|
784
|
+
this.openSnackBar('Existem erros no formulário, por favor, verificar.');
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
if (this.validar(this.endereco) == false)
|
|
788
|
+
return;
|
|
789
|
+
this.enderecoSalvo = this.endereco;
|
|
790
|
+
this.salvarclose();
|
|
791
|
+
}
|
|
792
|
+
compararTipos(t1, t2) {
|
|
793
|
+
return t1 && t2 && t1.codigo === t2.codigo;
|
|
794
|
+
}
|
|
795
|
+
onTipoSelecionado(codigoSelecionado) {
|
|
796
|
+
const tipoSelecionado = this.listaTipoEndereco.find(t => t.codigo === codigoSelecionado);
|
|
797
|
+
if (tipoSelecionado) {
|
|
798
|
+
this.endereco.tipo = tipoSelecionado.denominacao;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
pesquisarCep() {
|
|
802
|
+
if (this.endereco.cep && this.endereco.cep.trim() !== '') {
|
|
803
|
+
let cepFormatado = this.endereco.cep.replace(/\D/g, ''); // Remove caracteres não numéricos
|
|
804
|
+
this.service.pesquisarCep(cepFormatado).subscribe({
|
|
805
|
+
next: (data) => {
|
|
806
|
+
this.endereco.logradouro = data.logradouro;
|
|
807
|
+
this.endereco.bairro = data.bairro;
|
|
808
|
+
this.endereco.ufEndereco = data.uf;
|
|
809
|
+
this.endereco.uf = data.uf;
|
|
810
|
+
this.endereco.complemento = data.complemento;
|
|
811
|
+
},
|
|
812
|
+
error: (error) => {
|
|
813
|
+
this.openSnackBar('Falha ao encontrar o CEP');
|
|
814
|
+
console.error('Erro ao pesquisar CEP:', error);
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
this.openSnackBar('Por favor, insira um CEP válido.');
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
getListaEstados() {
|
|
823
|
+
return [
|
|
824
|
+
'AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA',
|
|
825
|
+
'MT', 'MS', 'MG', 'PA', 'PB', 'PR', 'PE', 'PI', 'RJ', 'RN',
|
|
826
|
+
'RS', 'RO', 'RR', 'SC', 'SP', 'SE', 'TO'
|
|
827
|
+
];
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Valida o objeto de e-mail.
|
|
831
|
+
* Retorna true se o e-mail for válido, false caso contrário.
|
|
832
|
+
*/
|
|
833
|
+
validar(enderecoToValidate) {
|
|
834
|
+
// 3. Validação de e-mail duplicado na lista existente
|
|
835
|
+
// Filtra a lista para excluir o próprio endereço que está sendo editado (se ele tiver um 'codigo')
|
|
836
|
+
const isDuplicate = this.enderecosList.some(existingEndereco => existingEndereco.logradouro?.toLowerCase() === enderecoToValidate.logradouro?.toLowerCase() &&
|
|
837
|
+
existingEndereco.codigo !== enderecoToValidate.codigo // Ignora o próprio endereço se estiver sendo editado
|
|
838
|
+
);
|
|
839
|
+
if (isDuplicate) {
|
|
840
|
+
this.openSnackBar("Este endereço já existe na lista.");
|
|
841
|
+
return false;
|
|
842
|
+
}
|
|
843
|
+
return true;
|
|
844
|
+
}
|
|
845
|
+
close() {
|
|
846
|
+
this.dialogRef.close(null);
|
|
847
|
+
}
|
|
848
|
+
salvarclose() {
|
|
849
|
+
this.dialogRef.close(this.enderecoSalvo);
|
|
850
|
+
}
|
|
851
|
+
openSnackBar(message) {
|
|
852
|
+
this.snackBar.open(message, 'x', {
|
|
853
|
+
duration: 5000,
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaEnderecoFormComponent, deps: [{ token: i1$2.MatSnackBar }, { token: UnBPessoaService }, { token: i3$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
857
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbPessoaEnderecoFormComponent, selector: "lib-unb-pessoa-endereco-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 <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\" (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of tipoEndereco | async\" [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>CEP</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.cep\" name=\"cep\" #cep=\"ngModel\" />\r\n <button matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" (click)=\"pesquisarCep()\">\r\n <mat-icon style=\"margin-right: 2px;\">search</mat-icon> \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: i5$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$2.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: i5$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i5$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),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: i6.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i6.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i7$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i7$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i8$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i3$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i3$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i9.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"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] }); }
|
|
858
|
+
}
|
|
859
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaEnderecoFormComponent, decorators: [{
|
|
860
|
+
type: Component,
|
|
861
|
+
args: [{ standalone: false, selector: 'lib-unb-pessoa-endereco-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 <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\" (selectionChange)=\"onTipoSelecionado($event.value)\" required>\r\n <mat-option *ngFor=\"let tipo of tipoEndereco | async\" [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>CEP</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"endereco.cep\" name=\"cep\" #cep=\"ngModel\" />\r\n <button matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" (click)=\"pesquisarCep()\">\r\n <mat-icon style=\"margin-right: 2px;\">search</mat-icon> \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"] }]
|
|
862
|
+
}], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: UnBPessoaService }, { type: i3$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
863
|
+
type: Inject,
|
|
864
|
+
args: [MAT_DIALOG_DATA]
|
|
865
|
+
}] }] });
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Essa eh uma classe base, com propriedades comum a todas as outras pessoas.
|
|
869
|
+
* */
|
|
870
|
+
class UnbPessoaModel {
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
class UnbUtils {
|
|
874
|
+
removeNull(key, value) {
|
|
875
|
+
// Filtering out properties
|
|
876
|
+
if (value === null) {
|
|
877
|
+
return undefined;
|
|
878
|
+
}
|
|
879
|
+
return value;
|
|
880
|
+
}
|
|
881
|
+
// forma cpf
|
|
882
|
+
static formataCpf(valor) {
|
|
883
|
+
return valor.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/g, "\$1.\$2.\$3\-\$4");
|
|
884
|
+
}
|
|
885
|
+
// forma cpf ou cnpj
|
|
886
|
+
static formataCnpj(valor) {
|
|
887
|
+
return valor.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5");
|
|
888
|
+
}
|
|
889
|
+
static validarCPF(cpf) {
|
|
890
|
+
if (!cpf)
|
|
891
|
+
return false; // Se CPF for null, undefined ou vazio, retorna falso
|
|
892
|
+
cpf = cpf.replace(/\D/g, ''); // Remove todos os caracteres não numéricos
|
|
893
|
+
if (cpf == '')
|
|
894
|
+
return false;
|
|
895
|
+
if (cpf.length !== 11 || /^(\d)\1+$/.test(cpf)) {
|
|
896
|
+
return false; // Verifica se tem 11 dígitos e não é uma sequência repetida (ex: 11111111111)
|
|
897
|
+
}
|
|
898
|
+
let soma = 0, resto;
|
|
899
|
+
// Validação do primeiro dígito verificador
|
|
900
|
+
for (let i = 0; i < 9; i++) {
|
|
901
|
+
soma += Number(cpf[i]) * (10 - i);
|
|
902
|
+
}
|
|
903
|
+
resto = (soma * 10) % 11;
|
|
904
|
+
if (resto === 10 || resto === 11)
|
|
905
|
+
resto = 0;
|
|
906
|
+
if (resto !== Number(cpf[9]))
|
|
907
|
+
return false;
|
|
908
|
+
soma = 0;
|
|
909
|
+
// Validação do segundo dígito verificador
|
|
910
|
+
for (let i = 0; i < 10; i++) {
|
|
911
|
+
soma += Number(cpf[i]) * (11 - i);
|
|
912
|
+
}
|
|
913
|
+
resto = (soma * 10) % 11;
|
|
914
|
+
if (resto === 10 || resto === 11)
|
|
915
|
+
resto = 0;
|
|
916
|
+
return resto === Number(cpf[10]);
|
|
917
|
+
}
|
|
918
|
+
static validarCNPJ(cnpj) {
|
|
919
|
+
cnpj = cnpj.replace(/[^\d]+/g, ''); // Remove caracteres não numéricos
|
|
920
|
+
if (cnpj.length !== 14 || /^(\d)\1+$/.test(cnpj)) {
|
|
921
|
+
return false; // Verifica se tem 14 dígitos e não é uma sequência repetida
|
|
922
|
+
}
|
|
923
|
+
let tamanho = cnpj.length - 2;
|
|
924
|
+
let numeros = cnpj.substring(0, tamanho);
|
|
925
|
+
let digitos = cnpj.substring(tamanho);
|
|
926
|
+
let soma = 0, pos = tamanho - 7;
|
|
927
|
+
for (let i = tamanho; i >= 1; i--) {
|
|
928
|
+
soma += parseInt(numeros.charAt(tamanho - i)) * pos--;
|
|
929
|
+
if (pos < 2)
|
|
930
|
+
pos = 9;
|
|
931
|
+
}
|
|
932
|
+
let resultado = soma % 11 < 2 ? 0 : 11 - (soma % 11);
|
|
933
|
+
if (resultado !== parseInt(digitos.charAt(0)))
|
|
934
|
+
return false;
|
|
935
|
+
tamanho = tamanho + 1;
|
|
936
|
+
numeros = cnpj.substring(0, tamanho);
|
|
937
|
+
soma = 0;
|
|
938
|
+
pos = tamanho - 7;
|
|
939
|
+
for (let i = tamanho; i >= 1; i--) {
|
|
940
|
+
soma += parseInt(numeros.charAt(tamanho - i)) * pos--;
|
|
941
|
+
if (pos < 2)
|
|
942
|
+
pos = 9;
|
|
943
|
+
}
|
|
944
|
+
resultado = soma % 11 < 2 ? 0 : 11 - (soma % 11);
|
|
945
|
+
return resultado === parseInt(digitos.charAt(1));
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
class UnbPessoaPesquisarComponent {
|
|
950
|
+
constructor(pessoaService, snackBar) {
|
|
951
|
+
this.pessoaService = pessoaService;
|
|
952
|
+
this.snackBar = snackBar;
|
|
953
|
+
this.isLoading = false;
|
|
954
|
+
this.apiPessoaConfig = { url: '', token: '' };
|
|
955
|
+
this.pesquisarPorCPF = true;
|
|
956
|
+
this.pesquisarPorCNPJ = true;
|
|
957
|
+
this.pesquisarPorEstrangeiro = true;
|
|
958
|
+
this.pessoaEmitted = new EventEmitter();
|
|
959
|
+
this.pessoa = new UnbPessoaModel();
|
|
960
|
+
this.mostrarPesquisa = true;
|
|
961
|
+
this.limparAposPesquisa = false; // indica se deve limpar o cpf apos pesquisar
|
|
962
|
+
this.label = "Digite o CPF/CNPJ ou Passaporte"; // eh o que mostra no topo do componente
|
|
963
|
+
this.placeholder = ""; // eh o que mostra como placeholder topo do componente
|
|
964
|
+
this.hint = ""; // dica que aparece debaixo do campo
|
|
965
|
+
// usado pra saber se mostra ou nao o botao de incluir pessoa
|
|
966
|
+
this.pessoaEncontrado = false;
|
|
967
|
+
}
|
|
968
|
+
ngOnInit() {
|
|
969
|
+
if (this.apiPessoaConfig.url.endsWith('/')) {
|
|
970
|
+
this.apiPessoaConfig.url = this.apiPessoaConfig.url.slice(0, -1);
|
|
971
|
+
}
|
|
972
|
+
if (this.apiPessoaConfig.url == "") {
|
|
973
|
+
this.handleErrorPrintConsole("[UnbPessoaPesquisarComponent] ERROR: apiPessoaConfig.url está null. Insira o parâmetro (apiPessoaConfig) com o valor válido!");
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
if (this.apiPessoaConfig.token == "") {
|
|
977
|
+
this.handleErrorPrintConsole("[UnbPessoaPesquisarComponent] ERROR: apiPessoaConfig.token está null. Insira o parâmetro (apiPessoaConfig) com o valor do token da sua aplicação");
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
// se chegar com barra no final, eu retiro. Pra ficar no padrao
|
|
981
|
+
if (this.apiPessoaConfig.url.endsWith('/')) {
|
|
982
|
+
this.apiPessoaConfig.url = this.apiPessoaConfig.url.slice(0, -1);
|
|
983
|
+
}
|
|
984
|
+
// inicializa o serviço com a configuração da API
|
|
985
|
+
this.pessoaService.setApiConfig(this.apiPessoaConfig);
|
|
986
|
+
// Conta quantos dos inputs estão como true
|
|
987
|
+
const opcoesAtivas = [this.pesquisarPorCPF, this.pesquisarPorCNPJ, this.pesquisarPorEstrangeiro].filter(op => op).length;
|
|
988
|
+
// Exibe a opcao do tipo de pessoa, somente se mais de um estiver selecionado
|
|
989
|
+
if (opcoesAtivas > 1) {
|
|
990
|
+
this.mostrarTipoPessoa = opcoesAtivas > 1;
|
|
991
|
+
}
|
|
992
|
+
else {
|
|
993
|
+
// entao tenho que marcar qual foi selecionada
|
|
994
|
+
if (this.pesquisarPorCPF) {
|
|
995
|
+
this.pessoa.tipoPessoa = TipoPessoaEnum.FISICA;
|
|
996
|
+
}
|
|
997
|
+
else if (this.pesquisarPorCNPJ) {
|
|
998
|
+
this.pessoa.tipoPessoa = TipoPessoaEnum.JURIDICA;
|
|
999
|
+
}
|
|
1000
|
+
else if (this.pesquisarPorEstrangeiro) {
|
|
1001
|
+
this.pessoa.tipoPessoa = TipoPessoaEnum.ESTRANGEIRA;
|
|
1002
|
+
}
|
|
1003
|
+
else {
|
|
1004
|
+
this.handleErrorPrintConsole("[UnbPessoaPesquisarComponent] ERROR: pesquisarPorCPF, pesquisarPorCNPJ e pesquisarPorEstrangeiro está falso. Marque pelo menos um como true");
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
// seleciona o radio button padrao
|
|
1009
|
+
if (this.defaultTipoPessoa == TipoPessoaEnum.FISICA && this.pesquisarPorCPF) {
|
|
1010
|
+
this.pessoa.tipoPessoa = this.defaultTipoPessoa;
|
|
1011
|
+
}
|
|
1012
|
+
else if (this.defaultTipoPessoa == TipoPessoaEnum.JURIDICA && this.pesquisarPorCNPJ) {
|
|
1013
|
+
this.pessoa.tipoPessoa = this.defaultTipoPessoa;
|
|
1014
|
+
}
|
|
1015
|
+
else if (this.defaultTipoPessoa == TipoPessoaEnum.ESTRANGEIRA && this.pesquisarPorEstrangeiro) {
|
|
1016
|
+
this.pessoa.tipoPessoa = this.defaultTipoPessoa;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
pesquisar() {
|
|
1020
|
+
if (this.validar() == false)
|
|
1021
|
+
return;
|
|
1022
|
+
this.isLoading = true;
|
|
1023
|
+
let result;
|
|
1024
|
+
if (this.pessoa.tipoPessoa == TipoPessoaEnum.FISICA) {
|
|
1025
|
+
let cpf = this.pessoa.cpf.match(/\d/g)?.join(""); // remove caracteres
|
|
1026
|
+
result = this.pessoaService.findByCpf(cpf);
|
|
1027
|
+
}
|
|
1028
|
+
else if (this.pessoa.tipoPessoa == TipoPessoaEnum.JURIDICA) {
|
|
1029
|
+
let cnpj = this.pessoa.cnpj.match(/\d/g)?.join(""); // remove caracteres
|
|
1030
|
+
result = this.pessoaService.findByCnpj(cnpj);
|
|
1031
|
+
}
|
|
1032
|
+
else if (this.pessoa.tipoPessoa == TipoPessoaEnum.ESTRANGEIRA) {
|
|
1033
|
+
result = this.pessoaService.findByPassaporte(this.pessoa.passaporte);
|
|
1034
|
+
}
|
|
1035
|
+
if (result) {
|
|
1036
|
+
result.subscribe({
|
|
1037
|
+
next: this.hadleResult.bind(this),
|
|
1038
|
+
error: this.handleError.bind(this)
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
validar() {
|
|
1043
|
+
if (this.apiPessoaConfig.url == "") {
|
|
1044
|
+
this.handleErrorPrintConsole("[UnbPessoaPesquisarComponent] ERROR: apiPessoaConfig.url está null. Insira o parâmetro (apiPessoaConfig) com o valor válido!");
|
|
1045
|
+
return false;
|
|
1046
|
+
}
|
|
1047
|
+
if (this.apiPessoaConfig.token == "") {
|
|
1048
|
+
this.handleErrorPrintConsole("[UnbPessoaPesquisarComponent] ERROR: apiPessoaConfig.token está null. Insira o parâmetro (apiPessoaConfig) com o valor do token da sua aplicação");
|
|
1049
|
+
return false;
|
|
1050
|
+
}
|
|
1051
|
+
if (this.pessoa.tipoPessoa == TipoPessoaEnum.FISICA) {
|
|
1052
|
+
if (this.pessoa.cpf == null || (this.pessoa.cpf != null && this.pessoa.cpf == "")) {
|
|
1053
|
+
this.handleError("CPF é um campo obrigatório.");
|
|
1054
|
+
return false;
|
|
1055
|
+
}
|
|
1056
|
+
else if (!UnbUtils.validarCPF(this.pessoa.cpf)) {
|
|
1057
|
+
this.handleError("Digite um valor válido para o CPF");
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
else if (this.pessoa.tipoPessoa == TipoPessoaEnum.JURIDICA) {
|
|
1062
|
+
if (this.pessoa.cnpj == null || (this.pessoa.cnpj != null && this.pessoa.cnpj == "")) {
|
|
1063
|
+
this.handleError("CNPJ é um campo obrigatório");
|
|
1064
|
+
return false;
|
|
1065
|
+
}
|
|
1066
|
+
else if (!UnbUtils.validarCNPJ(this.pessoa.cnpj)) {
|
|
1067
|
+
this.handleError("Digite um valor válido para o CNPJ!");
|
|
1068
|
+
return false;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
else if (this.pessoa.tipoPessoa == TipoPessoaEnum.ESTRANGEIRA) {
|
|
1072
|
+
if (this.pessoa.passaporte == null || (this.pessoa.passaporte != null && this.pessoa.passaporte == "")) {
|
|
1073
|
+
this.handleError("Passaporte é um campo obrigatório");
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
else {
|
|
1078
|
+
this.handleError("Selecione um tipo de pessoa!");
|
|
1079
|
+
return false;
|
|
1080
|
+
}
|
|
1081
|
+
return true;
|
|
1082
|
+
}
|
|
1083
|
+
hadleResult(resultado) {
|
|
1084
|
+
this.isLoading = false;
|
|
1085
|
+
if (resultado) {
|
|
1086
|
+
resultado.tipoPessoa = this.pessoa.tipoPessoa; // o backend nao retorna o tipo pessoa. entao tenho que atribuir antes
|
|
1087
|
+
this.pessoa = resultado;
|
|
1088
|
+
if (this.pessoa.tipoPessoa == TipoPessoaEnum.FISICA) {
|
|
1089
|
+
this.pessoa.cpf = UnbUtils.formataCpf(resultado.cpf); // voltou pro formato original (isso evita formartar novamente)
|
|
1090
|
+
}
|
|
1091
|
+
else if (this.pessoa.tipoPessoa == TipoPessoaEnum.JURIDICA) {
|
|
1092
|
+
this.pessoa.cnpj = UnbUtils.formataCnpj(resultado.cnpj); // voltou pro formato original (isso evita formartar novamente)
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
else {
|
|
1096
|
+
// se chegar aki eh pq nao encontrou, entao temos que emitir um resultado com codigoPessoa vazio mas com os criterios usado na pesquisa
|
|
1097
|
+
let novaPessoa = new UnbPessoaModel();
|
|
1098
|
+
novaPessoa.tipoPessoa = this.pessoa.tipoPessoa;
|
|
1099
|
+
if (this.pessoa.tipoPessoa == TipoPessoaEnum.FISICA) {
|
|
1100
|
+
novaPessoa.cpf = this.pessoa.cpf;
|
|
1101
|
+
}
|
|
1102
|
+
else if (this.pessoa.tipoPessoa == TipoPessoaEnum.JURIDICA) {
|
|
1103
|
+
novaPessoa.cnpj = this.pessoa.cnpj;
|
|
1104
|
+
}
|
|
1105
|
+
else {
|
|
1106
|
+
novaPessoa.passaporte = this.pessoa.passaporte;
|
|
1107
|
+
}
|
|
1108
|
+
// agora sobreescrevemos, pq se tiver uma pessoa pesquisada com resultado correto, e pesquisar novamente, precisamos apagar a primeira pessoa.
|
|
1109
|
+
this.pessoa = novaPessoa;
|
|
1110
|
+
}
|
|
1111
|
+
this.pessoaEmitted.emit(this.pessoa);
|
|
1112
|
+
}
|
|
1113
|
+
handleError(erro) {
|
|
1114
|
+
this.openSnackBar(erro);
|
|
1115
|
+
this.isLoading = false;
|
|
1116
|
+
// se chegar aki, entao nao encontrou a pessoa. Mas damos a chance de incluir pessoa
|
|
1117
|
+
this.pessoaEncontrado = false;
|
|
1118
|
+
}
|
|
1119
|
+
handleErrorPrintConsole(erro) {
|
|
1120
|
+
console.log(erro);
|
|
1121
|
+
this.handleError(erro);
|
|
1122
|
+
}
|
|
1123
|
+
openSnackBar(message) {
|
|
1124
|
+
this.snackBar.open(message, 'x', {
|
|
1125
|
+
duration: 5000,
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
tipoPessoaEnum() {
|
|
1129
|
+
return TipoPessoaEnum;
|
|
1130
|
+
}
|
|
1131
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaPesquisarComponent, deps: [{ token: UnBPessoaService }, { token: i1$2.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1132
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbPessoaPesquisarComponent, selector: "lib-unb-pessoa-pesquisar", inputs: { apiPessoaConfig: "apiPessoaConfig", pesquisarPorCPF: "pesquisarPorCPF", pesquisarPorCNPJ: "pesquisarPorCNPJ", pesquisarPorEstrangeiro: "pesquisarPorEstrangeiro", defaultTipoPessoa: "defaultTipoPessoa", pessoa: "pessoa", mostrarPesquisa: "mostrarPesquisa", limparAposPesquisa: "limparAposPesquisa", label: "label", placeholder: "placeholder", hint: "hint" }, outputs: { pessoaEmitted: "pessoaEmitted" }, ngImport: i0, template: "<form #pessoaForm=\"ngForm\" class=\"form-container\" (ngSubmit)=\"pesquisar()\">\r\n <!-- Tipo da Pessoa. Controlado pelo OnInit -->\r\n <mat-progress-bar *ngIf=\"isLoading\" mode=\"indeterminate\"></mat-progress-bar> \r\n <div *ngIf=\"mostrarTipoPessoa\">\r\n <mat-radio-group aria-label=\"Tipo de Pessoa\" [(ngModel)]=\"pessoa.tipoPessoa\" #tipoPessoa=\"ngModel\" name=\"tipoPessoa\">\r\n <mat-radio-button *ngIf=\"pesquisarPorCPF\" value=\"{{ tipoPessoaEnum().FISICA}}\">Pessoa F\u00EDsica</mat-radio-button>\r\n <mat-radio-button *ngIf=\"pesquisarPorCNPJ\" value=\"{{tipoPessoaEnum().JURIDICA}}\"> Pessoa Jur\u00EDdica</mat-radio-button>\r\n <mat-radio-button *ngIf=\"pesquisarPorEstrangeiro\" value=\"{{tipoPessoaEnum().ESTRANGEIRA}}\">Estrangeiro</mat-radio-button>\r\n </mat-radio-group>\r\n </div>\r\n\r\n <div class=\"break\"></div>\r\n \r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().FISICA\">\r\n \r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>CPF</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.cpf\" name=\"cpf\" #cpf=\"ngModel\" required={{true}}/> \r\n <button *ngIf=\"!isLoading\" disabled=\"{{isLoading}}\" matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" (click)=\"pesquisar()\">\r\n <mat-icon style=\"margin-right: 2px;\">search</mat-icon> \r\n </button>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().ESTRANGEIRA\">\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>Passaporte</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.passaporte\" name=\"passaporte\" required=\"true\" />\r\n <button *ngIf=\"!isLoading\" matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" (click)=\"pesquisar()\">\r\n <mat-icon>search</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().JURIDICA\">\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>CNPJ</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.cnpj\" name=\"cnpj\" required=\"true\" />\r\n <button *ngIf=\"!isLoading\" matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" (click)=\"pesquisar()\">\r\n <mat-icon>search</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n </ng-container>\r\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$2.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: i5$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i5$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),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: i6.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i7$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i7$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i8$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i9$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i10$1.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i10$1.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color"], outputs: ["change"], exportAs: ["matRadioButton"] }] }); }
|
|
1133
|
+
}
|
|
1134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaPesquisarComponent, decorators: [{
|
|
1135
|
+
type: Component,
|
|
1136
|
+
args: [{ selector: 'lib-unb-pessoa-pesquisar', standalone: false, template: "<form #pessoaForm=\"ngForm\" class=\"form-container\" (ngSubmit)=\"pesquisar()\">\r\n <!-- Tipo da Pessoa. Controlado pelo OnInit -->\r\n <mat-progress-bar *ngIf=\"isLoading\" mode=\"indeterminate\"></mat-progress-bar> \r\n <div *ngIf=\"mostrarTipoPessoa\">\r\n <mat-radio-group aria-label=\"Tipo de Pessoa\" [(ngModel)]=\"pessoa.tipoPessoa\" #tipoPessoa=\"ngModel\" name=\"tipoPessoa\">\r\n <mat-radio-button *ngIf=\"pesquisarPorCPF\" value=\"{{ tipoPessoaEnum().FISICA}}\">Pessoa F\u00EDsica</mat-radio-button>\r\n <mat-radio-button *ngIf=\"pesquisarPorCNPJ\" value=\"{{tipoPessoaEnum().JURIDICA}}\"> Pessoa Jur\u00EDdica</mat-radio-button>\r\n <mat-radio-button *ngIf=\"pesquisarPorEstrangeiro\" value=\"{{tipoPessoaEnum().ESTRANGEIRA}}\">Estrangeiro</mat-radio-button>\r\n </mat-radio-group>\r\n </div>\r\n\r\n <div class=\"break\"></div>\r\n \r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().FISICA\">\r\n \r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>CPF</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.cpf\" name=\"cpf\" #cpf=\"ngModel\" required={{true}}/> \r\n <button *ngIf=\"!isLoading\" disabled=\"{{isLoading}}\" matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" (click)=\"pesquisar()\">\r\n <mat-icon style=\"margin-right: 2px;\">search</mat-icon> \r\n </button>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().ESTRANGEIRA\">\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>Passaporte</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.passaporte\" name=\"passaporte\" required=\"true\" />\r\n <button *ngIf=\"!isLoading\" matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" (click)=\"pesquisar()\">\r\n <mat-icon>search</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa === tipoPessoaEnum().JURIDICA\">\r\n <mat-form-field appearance=\"outline\">\r\n <mat-label>CNPJ</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.cnpj\" name=\"cnpj\" required=\"true\" />\r\n <button *ngIf=\"!isLoading\" matSuffix mat-icon-button type=\"button\" aria-label=\"Pesquisar\" (click)=\"pesquisar()\">\r\n <mat-icon>search</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n </ng-container>\r\n</form>" }]
|
|
1137
|
+
}], ctorParameters: () => [{ type: UnBPessoaService }, { type: i1$2.MatSnackBar }], propDecorators: { apiPessoaConfig: [{
|
|
1138
|
+
type: Input
|
|
1139
|
+
}], pesquisarPorCPF: [{
|
|
1140
|
+
type: Input
|
|
1141
|
+
}], pesquisarPorCNPJ: [{
|
|
1142
|
+
type: Input
|
|
1143
|
+
}], pesquisarPorEstrangeiro: [{
|
|
1144
|
+
type: Input
|
|
1145
|
+
}], defaultTipoPessoa: [{
|
|
1146
|
+
type: Input
|
|
1147
|
+
}], pessoaEmitted: [{
|
|
1148
|
+
type: Output
|
|
1149
|
+
}], pessoa: [{
|
|
1150
|
+
type: Input
|
|
1151
|
+
}], mostrarPesquisa: [{
|
|
1152
|
+
type: Input
|
|
1153
|
+
}], limparAposPesquisa: [{
|
|
1154
|
+
type: Input
|
|
1155
|
+
}], label: [{
|
|
1156
|
+
type: Input
|
|
1157
|
+
}], placeholder: [{
|
|
1158
|
+
type: Input
|
|
1159
|
+
}], hint: [{
|
|
1160
|
+
type: Input
|
|
1161
|
+
}] } });
|
|
1162
|
+
|
|
1163
|
+
class UnbPessoaTelefone {
|
|
1164
|
+
constructor() {
|
|
1165
|
+
// usado pelo componente unb-pesoa-form, pra indicar que o usuario estah editando
|
|
1166
|
+
this.modoEdicao = false;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
class UnbPessoaTelefoneTipo {
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
class UnbPessoaTelefoneFormComponent {
|
|
1173
|
+
constructor(snackBar, service, dialogRef, data) {
|
|
1174
|
+
this.snackBar = snackBar;
|
|
1175
|
+
this.service = service;
|
|
1176
|
+
this.dialogRef = dialogRef;
|
|
1177
|
+
this.data = data;
|
|
1178
|
+
this.telefone = new UnbPessoaTelefone();
|
|
1179
|
+
this.listaTipoEndereco = [];
|
|
1180
|
+
this.telefone = JSON.parse(JSON.stringify(data.telefone)); // O e-mail específico para edição
|
|
1181
|
+
// Verifique se a lista de e-mails foi passada e atribua-a
|
|
1182
|
+
if (data.telefonesList) {
|
|
1183
|
+
this.telefonesList = JSON.parse(JSON.stringify(data.telefonesList)); // Faça uma cópia profunda se for manipular
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
this.telefonesList = []; // Inicialize como vazio se não for passada
|
|
1187
|
+
}
|
|
1188
|
+
if (!this.telefone) {
|
|
1189
|
+
this.telefone = new UnbPessoaTelefone();
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
ngOnInit() {
|
|
1193
|
+
this.tipoTelefone = this.service.getTipoTelefone();
|
|
1194
|
+
// Inscreve para guardar a lista em uma variável comum
|
|
1195
|
+
this.tipoTelefone.subscribe(lista => {
|
|
1196
|
+
this.listaTipoEndereco = lista;
|
|
1197
|
+
// Se já tiver tipoTelefoneCodigo, preenche o nome correspondente
|
|
1198
|
+
if (this.telefone.tipoTelefoneCodigo != null) {
|
|
1199
|
+
const tipoEncontrado = lista.find(t => t.codigo === this.telefone.tipoTelefoneCodigo);
|
|
1200
|
+
if (tipoEncontrado) {
|
|
1201
|
+
this.telefone.tipo = tipoEncontrado.denominacao;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
else if (this.telefone.tipo) {
|
|
1205
|
+
const tipoEncontrado = lista.find(t => t.denominacao?.toLowerCase() === this.telefone.tipo?.toLowerCase());
|
|
1206
|
+
if (tipoEncontrado) {
|
|
1207
|
+
this.telefone.tipoTelefoneCodigo = tipoEncontrado.codigo;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
salvar(form) {
|
|
1213
|
+
if (form.invalid) {
|
|
1214
|
+
this.openSnackBar('Existem erros no formulário, por favor, verificar.');
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
if (this.validar(this.telefone) == false)
|
|
1218
|
+
return;
|
|
1219
|
+
this.telefoneSalvo = this.telefone;
|
|
1220
|
+
this.salvarclose();
|
|
1221
|
+
}
|
|
1222
|
+
compararTipos(t1, t2) {
|
|
1223
|
+
return t1 && t2 && t1 === t2;
|
|
1224
|
+
}
|
|
1225
|
+
onTipoSelecionado(codigoSelecionado) {
|
|
1226
|
+
const tipoSelecionado = this.listaTipoEndereco.find(t => t.codigo === codigoSelecionado);
|
|
1227
|
+
if (tipoSelecionado) {
|
|
1228
|
+
this.telefone.tipo = tipoSelecionado.denominacao;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* Valida o objeto de telefone.
|
|
1233
|
+
* Retorna true se o telefone for válido, false caso contrário.
|
|
1234
|
+
*/
|
|
1235
|
+
validar(telefoneToValidate) {
|
|
1236
|
+
return true; // Implementar a lógica de validação conforme necessário
|
|
1237
|
+
}
|
|
1238
|
+
close() {
|
|
1239
|
+
this.dialogRef.close(null);
|
|
1240
|
+
}
|
|
1241
|
+
salvarclose() {
|
|
1242
|
+
this.dialogRef.close(this.telefoneSalvo);
|
|
1243
|
+
}
|
|
1244
|
+
openSnackBar(message) {
|
|
1245
|
+
this.snackBar.open(message, 'x', {
|
|
1246
|
+
duration: 5000,
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaTelefoneFormComponent, deps: [{ token: i1$2.MatSnackBar }, { token: UnBPessoaService }, { token: i3$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1250
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbPessoaTelefoneFormComponent, 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 <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>DDD</mat-label>\r\n <input type=\"text\" 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\" matInput [(ngModel)]=\"telefone.numero\" name=\"telefoneValue\" #telefoneValue=\"ngModel\" />\r\n </mat-form-field>\r\n\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 tipoTelefone | async\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\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-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: i5$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$2.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: i5$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i5$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i6.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i7$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i8$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i3$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i3$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i9.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"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] }); }
|
|
1251
|
+
}
|
|
1252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaTelefoneFormComponent, decorators: [{
|
|
1253
|
+
type: Component,
|
|
1254
|
+
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 <div class=\"form-container\">\r\n <mat-form-field class=\"form-100\" appearance=\"outline\">\r\n <mat-label>DDD</mat-label>\r\n <input type=\"text\" 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\" matInput [(ngModel)]=\"telefone.numero\" name=\"telefoneValue\" #telefoneValue=\"ngModel\" />\r\n </mat-form-field>\r\n\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 tipoTelefone | async\" [value]=\"tipo.codigo\">\r\n {{tipo.denominacao}}\r\n </mat-option>\r\n </mat-select>\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-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
|
+
}], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: UnBPessoaService }, { type: i3$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
1256
|
+
type: Inject,
|
|
1257
|
+
args: [MAT_DIALOG_DATA]
|
|
1258
|
+
}] }] });
|
|
1259
|
+
|
|
1260
|
+
class UnbPessoaTelefoneListComponent {
|
|
1261
|
+
constructor(snackBar, service, dialog) {
|
|
1262
|
+
this.snackBar = snackBar;
|
|
1263
|
+
this.service = service;
|
|
1264
|
+
this.dialog = dialog;
|
|
1265
|
+
this.podeEditar = true;
|
|
1266
|
+
this.telefones = [];
|
|
1267
|
+
this.apiPessoaConfig = { url: '', token: '' };
|
|
1268
|
+
this.telefonesEmitted = new EventEmitter();
|
|
1269
|
+
}
|
|
1270
|
+
ngOnInit() {
|
|
1271
|
+
this.tipoTelefone = this.service.getTipoTelefone();
|
|
1272
|
+
this.sortAndAssignOrder(); // organiza a lista de telefones. As vezes tem ordem duplicada ou faltando.
|
|
1273
|
+
}
|
|
1274
|
+
excluir(telefone) {
|
|
1275
|
+
}
|
|
1276
|
+
editar(telefone) {
|
|
1277
|
+
this.openFormDialog(telefone);
|
|
1278
|
+
}
|
|
1279
|
+
moverParaCima(index) {
|
|
1280
|
+
if (index <= 0)
|
|
1281
|
+
return;
|
|
1282
|
+
[this.telefones[index - 1], this.telefones[index]] = [this.telefones[index], this.telefones[index - 1]];
|
|
1283
|
+
this.atualizarOrdem();
|
|
1284
|
+
}
|
|
1285
|
+
moverParaBaixo(index) {
|
|
1286
|
+
if (index >= this.telefones.length - 1)
|
|
1287
|
+
return;
|
|
1288
|
+
[this.telefones[index], this.telefones[index + 1]] = [this.telefones[index + 1], this.telefones[index]];
|
|
1289
|
+
this.atualizarOrdem();
|
|
1290
|
+
}
|
|
1291
|
+
atualizarOrdem() {
|
|
1292
|
+
this.telefones.forEach((telefone, idx) => {
|
|
1293
|
+
telefone.ordem = idx + 1;
|
|
1294
|
+
});
|
|
1295
|
+
this.telefonesEmitted.emit(this.telefones);
|
|
1296
|
+
}
|
|
1297
|
+
openFormDialog(toEdit) {
|
|
1298
|
+
const dialogRef = this.dialog.open(UnbPessoaTelefoneFormComponent, {
|
|
1299
|
+
width: '900px',
|
|
1300
|
+
data: {
|
|
1301
|
+
telefone: toEdit, // E-mail a ser editado ou vazio para novo
|
|
1302
|
+
emailsList: this.telefones // A sua lista COMPLETA de e-mails
|
|
1303
|
+
},
|
|
1304
|
+
});
|
|
1305
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
1306
|
+
if (result) {
|
|
1307
|
+
const index = this.telefones.findIndex(e => e.codigo === result.codigo);
|
|
1308
|
+
if (result.codigo && index > -1) {
|
|
1309
|
+
// Atualiza e-mail existente
|
|
1310
|
+
this.telefones[index] = result;
|
|
1311
|
+
}
|
|
1312
|
+
else {
|
|
1313
|
+
// Adiciona novo e-mail (gera ordem automaticamente se quiser)
|
|
1314
|
+
result.ordem = this.telefones.length + 1;
|
|
1315
|
+
this.telefones.push(result);
|
|
1316
|
+
}
|
|
1317
|
+
// Emite lista atualizada
|
|
1318
|
+
this.telefonesEmitted.emit(this.telefones);
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
sortAndAssignOrder() {
|
|
1323
|
+
// 1. Crie uma cópia da lista para não modificar a original durante a iteração inicial
|
|
1324
|
+
const tempEmails = [...this.telefones];
|
|
1325
|
+
// 2. Mapeie as ordens existentes para identificar duplicatas e ausentes
|
|
1326
|
+
const orderMap = new Map();
|
|
1327
|
+
const emailsWithoutOrder = [];
|
|
1328
|
+
tempEmails.forEach(telefone => {
|
|
1329
|
+
if (telefone.ordem !== undefined && telefone.ordem !== null) {
|
|
1330
|
+
if (!orderMap.has(telefone.ordem)) {
|
|
1331
|
+
orderMap.set(telefone.ordem, []);
|
|
1332
|
+
}
|
|
1333
|
+
orderMap.get(telefone.ordem)?.push(telefone);
|
|
1334
|
+
}
|
|
1335
|
+
else {
|
|
1336
|
+
emailsWithoutOrder.push(telefone);
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
// 3. Inicialize um Set para rastrear todas as ordens que serão usadas no final
|
|
1340
|
+
const finalUsedOrders = new Set();
|
|
1341
|
+
// Inicialize o próximo valor de ordem disponível
|
|
1342
|
+
let nextAvailableOrder = 0;
|
|
1343
|
+
// Função auxiliar para encontrar a próxima ordem disponível
|
|
1344
|
+
const getNextAvailableOrder = () => {
|
|
1345
|
+
while (finalUsedOrders.has(nextAvailableOrder)) {
|
|
1346
|
+
nextAvailableOrder++;
|
|
1347
|
+
}
|
|
1348
|
+
return nextAvailableOrder++;
|
|
1349
|
+
};
|
|
1350
|
+
// 4. Processe telefones com ordem definida:
|
|
1351
|
+
// - A primeira ocorrência de uma ordem a mantém.
|
|
1352
|
+
// - Duplicatas recebem uma nova ordem.
|
|
1353
|
+
// - Adicione as ordens válidas ao finalUsedOrders.
|
|
1354
|
+
this.telefones.forEach(telefone => {
|
|
1355
|
+
if (telefone.ordem !== undefined && telefone.ordem !== null) {
|
|
1356
|
+
if (!finalUsedOrders.has(telefone.ordem)) {
|
|
1357
|
+
// Se a ordem ainda não foi usada, use-a e adicione ao set
|
|
1358
|
+
finalUsedOrders.add(telefone.ordem);
|
|
1359
|
+
}
|
|
1360
|
+
else {
|
|
1361
|
+
// Se a ordem já foi usada (é uma duplicata), atribua uma nova
|
|
1362
|
+
telefone.ordem = getNextAvailableOrder();
|
|
1363
|
+
finalUsedOrders.add(telefone.ordem); // Adiciona a nova ordem ao set
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
// 5. Atribua ordens para telefones que não tinham ordem definida
|
|
1368
|
+
emailsWithoutOrder.forEach(telefone => {
|
|
1369
|
+
telefone.ordem = getNextAvailableOrder();
|
|
1370
|
+
finalUsedOrders.add(telefone.ordem); // Adiciona a nova ordem ao set
|
|
1371
|
+
});
|
|
1372
|
+
// 6. Finalmente, ordene a lista completa com as ordens agora únicas
|
|
1373
|
+
this.telefones.sort((a, b) => (a.ordem ?? 0) - (b.ordem ?? 0));
|
|
1374
|
+
}
|
|
1375
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaTelefoneListComponent, deps: [{ token: i1$2.MatSnackBar }, { token: UnBPessoaService }, { token: i3$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1376
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbPessoaTelefoneListComponent, selector: "lib-unb-pessoa-telefone-list", inputs: { podeEditar: "podeEditar", telefones: "telefones", apiPessoaConfig: "apiPessoaConfig" }, outputs: { telefonesEmitted: "telefonesEmitted" }, 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 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 <!-- Exibe a tabela de despesas somente se houver despesas -->\r\n <table class=\"my-table\" *ngIf=\"telefones && telefones.length > 0\">\r\n <tr style=\"background-color: #e4e3e3cc;\">\r\n <th style=\"text-align: center;\" >Ordem</th>\r\n <th>DDD</th>\r\n <th>N\u00FAmero</th>\r\n <th style=\"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\">\r\n <td style=\"width: 5%; text-align: center;\"> \r\n <button *ngIf=\"telefones.length > 1 && i > 0\" mat-icon-button aria-label=\"Mover para cima\"\r\n (click)=\"moverParaCima(i)\">\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button *ngIf=\"telefones.length > 1 && i < telefones.length - 1\" mat-icon-button aria-label=\"Mover para baixo\"\r\n (click)=\"moverParaBaixo(i)\">\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n </td>\r\n <td style=\"width: 20%;\">{{ valor.ddd }}</td>\r\n <td style=\"width: 60%;\">{{ valor.numero}}</td>\r\n <td style=\"width: 20%; text-align: center;\">\r\n <button mat-icon-button aria-label=\"Salvar\" color=\"primary\" (click)=\"editar(valor)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button mat-icon-button aria-label=\"Deletar\" color=\"warn\" (click)=\"excluir(valor)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\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}\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: "component", type: i6.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i6.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] }); }
|
|
1377
|
+
}
|
|
1378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaTelefoneListComponent, decorators: [{
|
|
1379
|
+
type: Component,
|
|
1380
|
+
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 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 <!-- Exibe a tabela de despesas somente se houver despesas -->\r\n <table class=\"my-table\" *ngIf=\"telefones && telefones.length > 0\">\r\n <tr style=\"background-color: #e4e3e3cc;\">\r\n <th style=\"text-align: center;\" >Ordem</th>\r\n <th>DDD</th>\r\n <th>N\u00FAmero</th>\r\n <th style=\"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\">\r\n <td style=\"width: 5%; text-align: center;\"> \r\n <button *ngIf=\"telefones.length > 1 && i > 0\" mat-icon-button aria-label=\"Mover para cima\"\r\n (click)=\"moverParaCima(i)\">\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button *ngIf=\"telefones.length > 1 && i < telefones.length - 1\" mat-icon-button aria-label=\"Mover para baixo\"\r\n (click)=\"moverParaBaixo(i)\">\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n </td>\r\n <td style=\"width: 20%;\">{{ valor.ddd }}</td>\r\n <td style=\"width: 60%;\">{{ valor.numero}}</td>\r\n <td style=\"width: 20%; text-align: center;\">\r\n <button mat-icon-button aria-label=\"Salvar\" color=\"primary\" (click)=\"editar(valor)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button mat-icon-button aria-label=\"Deletar\" color=\"warn\" (click)=\"excluir(valor)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\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}\n"] }]
|
|
1381
|
+
}], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: UnBPessoaService }, { type: i3$2.MatDialog }], propDecorators: { podeEditar: [{
|
|
1382
|
+
type: Input
|
|
1383
|
+
}], telefones: [{
|
|
1384
|
+
type: Input
|
|
1385
|
+
}], apiPessoaConfig: [{
|
|
1386
|
+
type: Input
|
|
1387
|
+
}], telefonesEmitted: [{
|
|
1388
|
+
type: Output
|
|
1389
|
+
}] } });
|
|
1390
|
+
|
|
1391
|
+
class UnbPessoaenderecoListComponent {
|
|
1392
|
+
constructor(snackBar, service, dialog) {
|
|
1393
|
+
this.snackBar = snackBar;
|
|
1394
|
+
this.service = service;
|
|
1395
|
+
this.dialog = dialog;
|
|
1396
|
+
this.podeEditar = true;
|
|
1397
|
+
this.enderecos = [];
|
|
1398
|
+
this.apiPessoaConfig = { url: '', token: '' };
|
|
1399
|
+
this.enderecosEmitted = new EventEmitter();
|
|
1400
|
+
}
|
|
1401
|
+
ngOnInit() {
|
|
1402
|
+
this.sortAndAssignOrder(); // organiza a lista de enderecos. As vezes tem ordem duplicada ou faltando.
|
|
1403
|
+
}
|
|
1404
|
+
excluir(endereco) {
|
|
1405
|
+
}
|
|
1406
|
+
editar(endereco) {
|
|
1407
|
+
this.openFormDialog(endereco);
|
|
1408
|
+
}
|
|
1409
|
+
moverParaCima(index) {
|
|
1410
|
+
if (index <= 0)
|
|
1411
|
+
return;
|
|
1412
|
+
[this.enderecos[index - 1], this.enderecos[index]] = [this.enderecos[index], this.enderecos[index - 1]];
|
|
1413
|
+
this.atualizarOrdem();
|
|
1414
|
+
}
|
|
1415
|
+
moverParaBaixo(index) {
|
|
1416
|
+
if (index >= this.enderecos.length - 1)
|
|
1417
|
+
return;
|
|
1418
|
+
[this.enderecos[index], this.enderecos[index + 1]] = [this.enderecos[index + 1], this.enderecos[index]];
|
|
1419
|
+
this.atualizarOrdem();
|
|
1420
|
+
}
|
|
1421
|
+
atualizarOrdem() {
|
|
1422
|
+
this.enderecos.forEach((endereco, idx) => {
|
|
1423
|
+
endereco.ordem = idx + 1;
|
|
1424
|
+
});
|
|
1425
|
+
this.enderecosEmitted.emit(this.enderecos);
|
|
1426
|
+
}
|
|
1427
|
+
openFormDialog(enderecoToEdit) {
|
|
1428
|
+
const dialogRef = this.dialog.open(UnbPessoaEnderecoFormComponent, {
|
|
1429
|
+
width: '900px',
|
|
1430
|
+
data: {
|
|
1431
|
+
endereco: enderecoToEdit, // E-mail a ser editado ou vazio para novo
|
|
1432
|
+
enderecosList: this.enderecos // A sua lista COMPLETA de e-mails
|
|
1433
|
+
},
|
|
1434
|
+
});
|
|
1435
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
1436
|
+
if (result) {
|
|
1437
|
+
const index = this.enderecos.findIndex(e => e.codigo === result.codigo);
|
|
1438
|
+
if (result.codigo && index > -1) {
|
|
1439
|
+
// Atualiza e-mail existente
|
|
1440
|
+
this.enderecos[index] = result;
|
|
1441
|
+
}
|
|
1442
|
+
else {
|
|
1443
|
+
// Adiciona novo e-mail (gera ordem automaticamente se quiser)
|
|
1444
|
+
result.ordem = this.enderecos.length + 1;
|
|
1445
|
+
this.enderecos.push(result);
|
|
1446
|
+
}
|
|
1447
|
+
// Emite lista atualizada
|
|
1448
|
+
this.enderecosEmitted.emit(this.enderecos);
|
|
1449
|
+
}
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
sortAndAssignOrder() {
|
|
1453
|
+
// 1. Crie uma cópia da lista para não modificar a original durante a iteração inicial
|
|
1454
|
+
const tempenderecos = [...this.enderecos];
|
|
1455
|
+
// 2. Mapeie as ordens existentes para identificar duplicatas e ausentes
|
|
1456
|
+
const orderMap = new Map();
|
|
1457
|
+
const enderecosWithoutOrder = [];
|
|
1458
|
+
tempenderecos.forEach(endereco => {
|
|
1459
|
+
if (endereco.ordem !== undefined && endereco.ordem !== null) {
|
|
1460
|
+
if (!orderMap.has(endereco.ordem)) {
|
|
1461
|
+
orderMap.set(endereco.ordem, []);
|
|
1462
|
+
}
|
|
1463
|
+
orderMap.get(endereco.ordem)?.push(endereco);
|
|
1464
|
+
}
|
|
1465
|
+
else {
|
|
1466
|
+
enderecosWithoutOrder.push(endereco);
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
// 3. Inicialize um Set para rastrear todas as ordens que serão usadas no final
|
|
1470
|
+
const finalUsedOrders = new Set();
|
|
1471
|
+
// Inicialize o próximo valor de ordem disponível
|
|
1472
|
+
let nextAvailableOrder = 0;
|
|
1473
|
+
// Função auxiliar para encontrar a próxima ordem disponível
|
|
1474
|
+
const getNextAvailableOrder = () => {
|
|
1475
|
+
while (finalUsedOrders.has(nextAvailableOrder)) {
|
|
1476
|
+
nextAvailableOrder++;
|
|
1477
|
+
}
|
|
1478
|
+
return nextAvailableOrder++;
|
|
1479
|
+
};
|
|
1480
|
+
// 4. Processe enderecos com ordem definida:
|
|
1481
|
+
// - A primeira ocorrência de uma ordem a mantém.
|
|
1482
|
+
// - Duplicatas recebem uma nova ordem.
|
|
1483
|
+
// - Adicione as ordens válidas ao finalUsedOrders.
|
|
1484
|
+
this.enderecos.forEach(endereco => {
|
|
1485
|
+
if (endereco.ordem !== undefined && endereco.ordem !== null) {
|
|
1486
|
+
if (!finalUsedOrders.has(endereco.ordem)) {
|
|
1487
|
+
// Se a ordem ainda não foi usada, use-a e adicione ao set
|
|
1488
|
+
finalUsedOrders.add(endereco.ordem);
|
|
1489
|
+
}
|
|
1490
|
+
else {
|
|
1491
|
+
// Se a ordem já foi usada (é uma duplicata), atribua uma nova
|
|
1492
|
+
endereco.ordem = getNextAvailableOrder();
|
|
1493
|
+
finalUsedOrders.add(endereco.ordem); // Adiciona a nova ordem ao set
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
// 5. Atribua ordens para enderecos que não tinham ordem definida
|
|
1498
|
+
enderecosWithoutOrder.forEach(endereco => {
|
|
1499
|
+
endereco.ordemEndereco = getNextAvailableOrder();
|
|
1500
|
+
finalUsedOrders.add(endereco.ordemEndereco); // Adiciona a nova ordem ao set
|
|
1501
|
+
});
|
|
1502
|
+
// 6. Finalmente, ordene a lista completa com as ordens agora únicas
|
|
1503
|
+
this.enderecos.sort((a, b) => (a.ordemEndereco ?? 0) - (b.ordemEndereco ?? 0));
|
|
1504
|
+
}
|
|
1505
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaenderecoListComponent, deps: [{ token: i1$2.MatSnackBar }, { token: UnBPessoaService }, { token: i3$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1506
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbPessoaenderecoListComponent, selector: "lib-unb-pessoa-endereco-list", inputs: { podeEditar: "podeEditar", enderecos: "enderecos", apiPessoaConfig: "apiPessoaConfig" }, outputs: { enderecosEmitted: "enderecosEmitted" }, 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 {{ enderecos?.length === 1 ? 'Endere\u00E7o Cadastrado' : 'Endere\u00E7os Cadastrados' }}\r\n </span>\r\n <span class=\"titulo\">({{ enderecos?.length || 0 }})</span>\r\n </div>\r\n\r\n <button matTooltip=\"Novo Endere\u00E7o\" mat-flat-button color=\"primary\" (click)=\"openFormDialog(null)\">\r\n Cadastrar Novo Endere\u00E7o\r\n </button>\r\n </div>\r\n\r\n <!-- Exibe a tabela de despesas somente se houver despesas -->\r\n <table class=\"my-table\" *ngIf=\"enderecos && enderecos.length > 0\">\r\n <tr style=\"background-color: #e4e3e3cc;\">\r\n <th style=\"text-align: center;\" >Ordem</th>\r\n <th>Logradouro</th>\r\n <th>Bairro</th>\r\n <th>CEP</th>\r\n <th>Tipo</th>\r\n <th style=\"text-align: center;\">A\u00E7\u00F5es</th>\r\n </tr>\r\n\r\n <tr *ngFor=\"let valor of enderecos; let i = index\" class=\"my-tr\">\r\n <td style=\"width: 5%; text-align: center;\"> \r\n <button *ngIf=\"enderecos.length > 1 && i > 0\" mat-icon-button aria-label=\"Mover para cima\"\r\n (click)=\"moverParaCima(i)\">\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button *ngIf=\"enderecos.length > 1 && i < enderecos.length - 1\" mat-icon-button aria-label=\"Mover para baixo\"\r\n (click)=\"moverParaBaixo(i)\">\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n </td>\r\n <td style=\"width: 20%;\">{{ valor.logradouro }}</td>\r\n <td style=\"width: 20%;\">{{ valor.bairro }}</td>\r\n <td style=\"width: 10%;\">{{ valor.cep }}</td>\r\n <td style=\"width: 10%;\">{{ valor.tipo?.toUpperCase() }}</td>\r\n <td style=\"width: 20%; text-align: center;\">\r\n <button mat-icon-button aria-label=\"Salvar\" color=\"primary\" (click)=\"editar(valor)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button mat-icon-button aria-label=\"Deletar\" color=\"warn\" (click)=\"excluir(valor)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\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}\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: "component", type: i6.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i6.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] }); }
|
|
1507
|
+
}
|
|
1508
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaenderecoListComponent, decorators: [{
|
|
1509
|
+
type: Component,
|
|
1510
|
+
args: [{ standalone: false, selector: 'lib-unb-pessoa-endereco-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 {{ enderecos?.length === 1 ? 'Endere\u00E7o Cadastrado' : 'Endere\u00E7os Cadastrados' }}\r\n </span>\r\n <span class=\"titulo\">({{ enderecos?.length || 0 }})</span>\r\n </div>\r\n\r\n <button matTooltip=\"Novo Endere\u00E7o\" mat-flat-button color=\"primary\" (click)=\"openFormDialog(null)\">\r\n Cadastrar Novo Endere\u00E7o\r\n </button>\r\n </div>\r\n\r\n <!-- Exibe a tabela de despesas somente se houver despesas -->\r\n <table class=\"my-table\" *ngIf=\"enderecos && enderecos.length > 0\">\r\n <tr style=\"background-color: #e4e3e3cc;\">\r\n <th style=\"text-align: center;\" >Ordem</th>\r\n <th>Logradouro</th>\r\n <th>Bairro</th>\r\n <th>CEP</th>\r\n <th>Tipo</th>\r\n <th style=\"text-align: center;\">A\u00E7\u00F5es</th>\r\n </tr>\r\n\r\n <tr *ngFor=\"let valor of enderecos; let i = index\" class=\"my-tr\">\r\n <td style=\"width: 5%; text-align: center;\"> \r\n <button *ngIf=\"enderecos.length > 1 && i > 0\" mat-icon-button aria-label=\"Mover para cima\"\r\n (click)=\"moverParaCima(i)\">\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button *ngIf=\"enderecos.length > 1 && i < enderecos.length - 1\" mat-icon-button aria-label=\"Mover para baixo\"\r\n (click)=\"moverParaBaixo(i)\">\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n </td>\r\n <td style=\"width: 20%;\">{{ valor.logradouro }}</td>\r\n <td style=\"width: 20%;\">{{ valor.bairro }}</td>\r\n <td style=\"width: 10%;\">{{ valor.cep }}</td>\r\n <td style=\"width: 10%;\">{{ valor.tipo?.toUpperCase() }}</td>\r\n <td style=\"width: 20%; text-align: center;\">\r\n <button mat-icon-button aria-label=\"Salvar\" color=\"primary\" (click)=\"editar(valor)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button mat-icon-button aria-label=\"Deletar\" color=\"warn\" (click)=\"excluir(valor)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\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}\n"] }]
|
|
1511
|
+
}], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: UnBPessoaService }, { type: i3$2.MatDialog }], propDecorators: { podeEditar: [{
|
|
1512
|
+
type: Input
|
|
1513
|
+
}], enderecos: [{
|
|
1514
|
+
type: Input
|
|
1515
|
+
}], apiPessoaConfig: [{
|
|
1516
|
+
type: Input
|
|
1517
|
+
}], enderecosEmitted: [{
|
|
1518
|
+
type: Output
|
|
1519
|
+
}] } });
|
|
1520
|
+
|
|
1521
|
+
class UnbPessoaEmailListComponent {
|
|
1522
|
+
constructor(snackBar, service, dialog) {
|
|
1523
|
+
this.snackBar = snackBar;
|
|
1524
|
+
this.service = service;
|
|
1525
|
+
this.dialog = dialog;
|
|
1526
|
+
this.podeEditar = true;
|
|
1527
|
+
this.emails = [];
|
|
1528
|
+
this.apiPessoaConfig = { url: '', token: '' };
|
|
1529
|
+
this.emailsEmitted = new EventEmitter();
|
|
1530
|
+
}
|
|
1531
|
+
ngOnInit() {
|
|
1532
|
+
this.tipoEmail = this.service.getTipoEmail();
|
|
1533
|
+
this.sortAndAssignOrder(); // organiza a lista de emails. As vezes tem ordem duplicada ou faltando.
|
|
1534
|
+
}
|
|
1535
|
+
excluir(email) {
|
|
1536
|
+
}
|
|
1537
|
+
editar(email) {
|
|
1538
|
+
this.openFormDialog(email);
|
|
1539
|
+
}
|
|
1540
|
+
moverParaCima(index) {
|
|
1541
|
+
if (index <= 0)
|
|
1542
|
+
return;
|
|
1543
|
+
[this.emails[index - 1], this.emails[index]] = [this.emails[index], this.emails[index - 1]];
|
|
1544
|
+
this.atualizarOrdem();
|
|
1545
|
+
}
|
|
1546
|
+
moverParaBaixo(index) {
|
|
1547
|
+
if (index >= this.emails.length - 1)
|
|
1548
|
+
return;
|
|
1549
|
+
[this.emails[index], this.emails[index + 1]] = [this.emails[index + 1], this.emails[index]];
|
|
1550
|
+
this.atualizarOrdem();
|
|
1551
|
+
}
|
|
1552
|
+
atualizarOrdem() {
|
|
1553
|
+
this.emails.forEach((email, idx) => {
|
|
1554
|
+
email.ordem = idx + 1;
|
|
1555
|
+
});
|
|
1556
|
+
this.emailsEmitted.emit(this.emails);
|
|
1557
|
+
}
|
|
1558
|
+
openFormDialog(emailToEdit) {
|
|
1559
|
+
const dialogRef = this.dialog.open(UnbPessoaEmailFormComponent, {
|
|
1560
|
+
width: '900px',
|
|
1561
|
+
data: {
|
|
1562
|
+
email: emailToEdit, // E-mail a ser editado ou vazio para novo
|
|
1563
|
+
emailsList: this.emails // A sua lista COMPLETA de e-mails
|
|
1564
|
+
},
|
|
1565
|
+
});
|
|
1566
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
1567
|
+
if (result) {
|
|
1568
|
+
const index = this.emails.findIndex(e => e.codigo === result.codigo);
|
|
1569
|
+
if (result.codigo && index > -1) {
|
|
1570
|
+
// Atualiza e-mail existente
|
|
1571
|
+
this.emails[index] = result;
|
|
1572
|
+
}
|
|
1573
|
+
else {
|
|
1574
|
+
// Adiciona novo e-mail (gera ordem automaticamente se quiser)
|
|
1575
|
+
result.ordem = this.emails.length + 1;
|
|
1576
|
+
this.emails.push(result);
|
|
1577
|
+
}
|
|
1578
|
+
// Emite lista atualizada
|
|
1579
|
+
this.emailsEmitted.emit(this.emails);
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
sortAndAssignOrder() {
|
|
1584
|
+
// 1. Crie uma cópia da lista para não modificar a original durante a iteração inicial
|
|
1585
|
+
const tempEmails = [...this.emails];
|
|
1586
|
+
// 2. Mapeie as ordens existentes para identificar duplicatas e ausentes
|
|
1587
|
+
const orderMap = new Map();
|
|
1588
|
+
const emailsWithoutOrder = [];
|
|
1589
|
+
tempEmails.forEach(email => {
|
|
1590
|
+
if (email.ordem !== undefined && email.ordem !== null) {
|
|
1591
|
+
if (!orderMap.has(email.ordem)) {
|
|
1592
|
+
orderMap.set(email.ordem, []);
|
|
1593
|
+
}
|
|
1594
|
+
orderMap.get(email.ordem)?.push(email);
|
|
1595
|
+
}
|
|
1596
|
+
else {
|
|
1597
|
+
emailsWithoutOrder.push(email);
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
// 3. Inicialize um Set para rastrear todas as ordens que serão usadas no final
|
|
1601
|
+
const finalUsedOrders = new Set();
|
|
1602
|
+
// Inicialize o próximo valor de ordem disponível
|
|
1603
|
+
let nextAvailableOrder = 0;
|
|
1604
|
+
// Função auxiliar para encontrar a próxima ordem disponível
|
|
1605
|
+
const getNextAvailableOrder = () => {
|
|
1606
|
+
while (finalUsedOrders.has(nextAvailableOrder)) {
|
|
1607
|
+
nextAvailableOrder++;
|
|
1608
|
+
}
|
|
1609
|
+
return nextAvailableOrder++;
|
|
1610
|
+
};
|
|
1611
|
+
// 4. Processe emails com ordem definida:
|
|
1612
|
+
// - A primeira ocorrência de uma ordem a mantém.
|
|
1613
|
+
// - Duplicatas recebem uma nova ordem.
|
|
1614
|
+
// - Adicione as ordens válidas ao finalUsedOrders.
|
|
1615
|
+
this.emails.forEach(email => {
|
|
1616
|
+
if (email.ordem !== undefined && email.ordem !== null) {
|
|
1617
|
+
if (!finalUsedOrders.has(email.ordem)) {
|
|
1618
|
+
// Se a ordem ainda não foi usada, use-a e adicione ao set
|
|
1619
|
+
finalUsedOrders.add(email.ordem);
|
|
1620
|
+
}
|
|
1621
|
+
else {
|
|
1622
|
+
// Se a ordem já foi usada (é uma duplicata), atribua uma nova
|
|
1623
|
+
email.ordem = getNextAvailableOrder();
|
|
1624
|
+
finalUsedOrders.add(email.ordem); // Adiciona a nova ordem ao set
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
// 5. Atribua ordens para emails que não tinham ordem definida
|
|
1629
|
+
emailsWithoutOrder.forEach(email => {
|
|
1630
|
+
email.ordem = getNextAvailableOrder();
|
|
1631
|
+
finalUsedOrders.add(email.ordem); // Adiciona a nova ordem ao set
|
|
1632
|
+
});
|
|
1633
|
+
// 6. Finalmente, ordene a lista completa com as ordens agora únicas
|
|
1634
|
+
this.emails.sort((a, b) => (a.ordem ?? 0) - (b.ordem ?? 0));
|
|
1635
|
+
}
|
|
1636
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaEmailListComponent, deps: [{ token: i1$2.MatSnackBar }, { token: UnBPessoaService }, { token: i3$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1637
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbPessoaEmailListComponent, selector: "lib-unb-pessoa-email-list", inputs: { podeEditar: "podeEditar", emails: "emails", apiPessoaConfig: "apiPessoaConfig" }, outputs: { emailsEmitted: "emailsEmitted" }, 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 {{ emails?.length === 1 ? 'Email Cadastrado' : 'E-mails Cadastrados' }}\r\n </span>\r\n <span class=\"titulo\">({{ emails?.length || 0 }})</span>\r\n </div>\r\n\r\n <button matTooltip=\"Novo Email\" mat-flat-button color=\"primary\" (click)=\"openFormDialog(null)\">\r\n Cadastrar Novo Email\r\n </button>\r\n </div>\r\n\r\n <!-- Exibe a tabela de despesas somente se houver despesas -->\r\n <table class=\"my-table\" *ngIf=\"emails && emails.length > 0\">\r\n <tr style=\"background-color: #e4e3e3cc;\">\r\n <th style=\"text-align: center;\" >Ordem</th>\r\n <th>E-mail</th>\r\n <th>Tipo</th>\r\n <th style=\"text-align: center;\">A\u00E7\u00F5es</th>\r\n </tr>\r\n\r\n <tr *ngFor=\"let valor of emails; let i = index\" class=\"my-tr\">\r\n <td style=\"width: 5%; text-align: center;\"> \r\n <button *ngIf=\"emails.length > 1 && i > 0\" mat-icon-button aria-label=\"Mover para cima\"\r\n (click)=\"moverParaCima(i)\">\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button *ngIf=\"emails.length > 1 && i < emails.length - 1\" mat-icon-button aria-label=\"Mover para baixo\"\r\n (click)=\"moverParaBaixo(i)\">\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n </td>\r\n <td style=\"width: 50%;\">{{ valor.email }}</td>\r\n <td style=\"width: 20%;\">{{ valor.tipo?.toUpperCase() }}</td>\r\n <td style=\"width: 20%; text-align: center;\">\r\n <button mat-icon-button aria-label=\"Salvar\" color=\"primary\" (click)=\"editar(valor)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button mat-icon-button aria-label=\"Deletar\" color=\"warn\" (click)=\"excluir(valor)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\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}\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: "component", type: i6.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i6.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] }); }
|
|
1638
|
+
}
|
|
1639
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaEmailListComponent, decorators: [{
|
|
1640
|
+
type: Component,
|
|
1641
|
+
args: [{ standalone: false, selector: 'lib-unb-pessoa-email-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 {{ emails?.length === 1 ? 'Email Cadastrado' : 'E-mails Cadastrados' }}\r\n </span>\r\n <span class=\"titulo\">({{ emails?.length || 0 }})</span>\r\n </div>\r\n\r\n <button matTooltip=\"Novo Email\" mat-flat-button color=\"primary\" (click)=\"openFormDialog(null)\">\r\n Cadastrar Novo Email\r\n </button>\r\n </div>\r\n\r\n <!-- Exibe a tabela de despesas somente se houver despesas -->\r\n <table class=\"my-table\" *ngIf=\"emails && emails.length > 0\">\r\n <tr style=\"background-color: #e4e3e3cc;\">\r\n <th style=\"text-align: center;\" >Ordem</th>\r\n <th>E-mail</th>\r\n <th>Tipo</th>\r\n <th style=\"text-align: center;\">A\u00E7\u00F5es</th>\r\n </tr>\r\n\r\n <tr *ngFor=\"let valor of emails; let i = index\" class=\"my-tr\">\r\n <td style=\"width: 5%; text-align: center;\"> \r\n <button *ngIf=\"emails.length > 1 && i > 0\" mat-icon-button aria-label=\"Mover para cima\"\r\n (click)=\"moverParaCima(i)\">\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button *ngIf=\"emails.length > 1 && i < emails.length - 1\" mat-icon-button aria-label=\"Mover para baixo\"\r\n (click)=\"moverParaBaixo(i)\">\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n </td>\r\n <td style=\"width: 50%;\">{{ valor.email }}</td>\r\n <td style=\"width: 20%;\">{{ valor.tipo?.toUpperCase() }}</td>\r\n <td style=\"width: 20%; text-align: center;\">\r\n <button mat-icon-button aria-label=\"Salvar\" color=\"primary\" (click)=\"editar(valor)\">\r\n <mat-icon>edit</mat-icon>\r\n </button>\r\n <button mat-icon-button aria-label=\"Deletar\" color=\"warn\" (click)=\"excluir(valor)\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\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}\n"] }]
|
|
1642
|
+
}], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: UnBPessoaService }, { type: i3$2.MatDialog }], propDecorators: { podeEditar: [{
|
|
1643
|
+
type: Input
|
|
1644
|
+
}], emails: [{
|
|
1645
|
+
type: Input
|
|
1646
|
+
}], apiPessoaConfig: [{
|
|
1647
|
+
type: Input
|
|
1648
|
+
}], emailsEmitted: [{
|
|
1649
|
+
type: Output
|
|
1650
|
+
}] } });
|
|
1651
|
+
|
|
1652
|
+
class UnbPessoaFormComponent {
|
|
1653
|
+
constructor(service, snackBar) {
|
|
1654
|
+
this.service = service;
|
|
1655
|
+
this.snackBar = snackBar;
|
|
1656
|
+
this.isLoading = false;
|
|
1657
|
+
this.buscaRealizada = false;
|
|
1658
|
+
this.endereco = new UnbPessoaEndereco();
|
|
1659
|
+
this.email = new UnbPessoaEmail();
|
|
1660
|
+
this.tiposPessoa = TipoPessoaEnum;
|
|
1661
|
+
this.pessoa = new UnbPessoaModel(); // inicializa com pessoa
|
|
1662
|
+
this.dadosSalvos = {}; // Armazena os dados ao trocar de tipo
|
|
1663
|
+
this.apiPessoaConfig = { url: '', token: '' };
|
|
1664
|
+
this.pesquisarPorCPF = true;
|
|
1665
|
+
this.pesquisarPorCNPJ = true;
|
|
1666
|
+
this.pesquisarPorEstrangeiro = true;
|
|
1667
|
+
}
|
|
1668
|
+
ngOnInit() {
|
|
1669
|
+
if (this.apiPessoaConfig.url.endsWith('/')) {
|
|
1670
|
+
this.apiPessoaConfig.url = this.apiPessoaConfig.url.slice(0, -1);
|
|
1671
|
+
}
|
|
1672
|
+
this.service.setApiConfig(this.apiPessoaConfig);
|
|
1673
|
+
// atencao, o pessoaRecebida que inicializa esse componente
|
|
1674
|
+
this.escolaridade = this.service.getEscolaridade();
|
|
1675
|
+
this.paises = this.service.getPaises();
|
|
1676
|
+
this.estadosCivil = this.service.getEstadoCivil();
|
|
1677
|
+
}
|
|
1678
|
+
pessoaRecebida(pessoaRecebida) {
|
|
1679
|
+
this.buscaRealizada = true;
|
|
1680
|
+
this.pessoa = pessoaRecebida;
|
|
1681
|
+
if (this.pessoa && this.pessoa.escolaridade) {
|
|
1682
|
+
this.pessoa.escolaridade = this.normalizaEscolaridade(this.pessoa.escolaridade);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
salvar() {
|
|
1686
|
+
if (!this.validar() && !this.pessoa)
|
|
1687
|
+
return;
|
|
1688
|
+
if (!this.service)
|
|
1689
|
+
return;
|
|
1690
|
+
this.isLoading = true;
|
|
1691
|
+
let result = this.service.salvar(this.pessoa);
|
|
1692
|
+
if (result && typeof result.subscribe === 'function') {
|
|
1693
|
+
result.subscribe((resposta) => {
|
|
1694
|
+
this.isLoading = false;
|
|
1695
|
+
this.pessoa = resposta;
|
|
1696
|
+
}, (err) => { this.erro(err); });
|
|
1697
|
+
}
|
|
1698
|
+
else {
|
|
1699
|
+
console.error("Erro: O método salvar() não retornou um Observable.");
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
validar() {
|
|
1703
|
+
if (!this.pessoa) {
|
|
1704
|
+
this.openSnackBar("Erro ao carregar objeto pessoa");
|
|
1705
|
+
return false;
|
|
1706
|
+
}
|
|
1707
|
+
if (this.pessoa.telefones == null || (this.pessoa.telefones != null && this.pessoa.telefones.length == 0)) {
|
|
1708
|
+
this.openSnackBar("Digite um Contato e clique em Adicionar");
|
|
1709
|
+
return false;
|
|
1710
|
+
}
|
|
1711
|
+
if (this.pessoa.enderecos == null || (this.pessoa.enderecos != null && this.pessoa.enderecos.length == 0)) {
|
|
1712
|
+
this.openSnackBar("Digite um Endereço(Localicade) e clique em Adicionar");
|
|
1713
|
+
return false;
|
|
1714
|
+
}
|
|
1715
|
+
if (this.pessoa.emails == null || (this.pessoa.emails != null && this.pessoa.emails.length == 0)) {
|
|
1716
|
+
this.openSnackBar("Digite um E-mail e clique em Adicionar");
|
|
1717
|
+
return false;
|
|
1718
|
+
}
|
|
1719
|
+
if (this.pessoa.tipoPessoa == TipoPessoaEnum.FISICA) {
|
|
1720
|
+
if (!this.pessoa.nome || (this.pessoa && this.pessoa.nome == "")) {
|
|
1721
|
+
this.openSnackBar("Nome é um campo obrigatório");
|
|
1722
|
+
return false;
|
|
1723
|
+
}
|
|
1724
|
+
if (!this.pessoa.dataNascimento) {
|
|
1725
|
+
this.openSnackBar("Data de Nascimento é um campo obrigatório");
|
|
1726
|
+
return false;
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
if (this.pessoa.tipoPessoa == TipoPessoaEnum.ESTRANGEIRA) {
|
|
1730
|
+
if (!this.pessoa.nome || (this.pessoa && this.pessoa.nome == "")) {
|
|
1731
|
+
this.openSnackBar("Nome é um campo obrigatório");
|
|
1732
|
+
return false;
|
|
1733
|
+
}
|
|
1734
|
+
if (this.pessoa.passaporte == null || (this.pessoa.passaporte != null && this.pessoa.passaporte == "")) {
|
|
1735
|
+
this.openSnackBar("Passaporte é um campo obrigatório");
|
|
1736
|
+
return false;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
if (this.pessoa.tipoPessoa == TipoPessoaEnum.JURIDICA) {
|
|
1740
|
+
if (this.pessoa.passaporte == null || (this.pessoa.passaporte != null && this.pessoa.passaporte == "")) {
|
|
1741
|
+
this.openSnackBar("Passaporte é um campo obrigatório");
|
|
1742
|
+
return false;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
return true;
|
|
1746
|
+
}
|
|
1747
|
+
telefonesEmitted(telefones) {
|
|
1748
|
+
this.pessoa.telefones = telefones;
|
|
1749
|
+
}
|
|
1750
|
+
enderecosEmitted(enderecos) {
|
|
1751
|
+
this.pessoa.enderecos = enderecos;
|
|
1752
|
+
}
|
|
1753
|
+
emailsEmitted(emails) {
|
|
1754
|
+
this.pessoa.emails = emails;
|
|
1755
|
+
}
|
|
1756
|
+
normalizaEscolaridade(escolaridade) {
|
|
1757
|
+
if (!escolaridade)
|
|
1758
|
+
return '0'; // Retorna "Não Informado" se estiver vazio
|
|
1759
|
+
const partes = escolaridade.split(" - ");
|
|
1760
|
+
return partes.length > 1 ? partes[0].trim() : '0';
|
|
1761
|
+
}
|
|
1762
|
+
erro(erro) {
|
|
1763
|
+
// coloco o erro em negrito
|
|
1764
|
+
this.openSnackBar(erro);
|
|
1765
|
+
this.isLoading = false;
|
|
1766
|
+
}
|
|
1767
|
+
openSnackBar(message) {
|
|
1768
|
+
this.snackBar.open(message, 'x', {
|
|
1769
|
+
duration: 5000,
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
tipoPessoaEnum() {
|
|
1773
|
+
return TipoPessoaEnum;
|
|
1774
|
+
}
|
|
1775
|
+
getListaEstados() {
|
|
1776
|
+
return listaEstados;
|
|
1777
|
+
}
|
|
1778
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaFormComponent, deps: [{ token: UnBPessoaService }, { token: i1$2.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1779
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.2", type: UnbPessoaFormComponent, selector: "lib-unb-pessoa-form", inputs: { apiPessoaConfig: "apiPessoaConfig", defaultTipoPessoa: "defaultTipoPessoa", pesquisarPorCPF: "pesquisarPorCPF", pesquisarPorCNPJ: "pesquisarPorCNPJ", pesquisarPorEstrangeiro: "pesquisarPorEstrangeiro" }, ngImport: i0, template: " <div class=\"form-container\">\r\n <lib-unb-pessoa-pesquisar\r\n [apiPessoaConfig]=\"apiPessoaConfig\" \r\n [defaultTipoPessoa]=\"defaultTipoPessoa\" \r\n (pessoaEmitted)=\"pessoaRecebida($event)\"></lib-unb-pessoa-pesquisar>\r\n</div>\r\n \r\n <form #pessoaForm=\"ngForm\" class=\"form-container mt-2\" *ngIf=\"buscaRealizada && apiPessoaConfig.url\" (ngSubmit)=\"salvar()\">\r\n \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-10\" 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-15\" appearance=\"outline\">\r\n <mat-label>Data Nascimento</mat-label>\r\n <input matInput [matDatepicker]=\"dataNascimentoPicker\" [(ngModel)]=\"pessoa.dataNascimento\" name=\"dataNascimento\" #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-10\" 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-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisNascimento\" name=\"codigoPaisNascimento\" #codigoPaisNascimento=\"ngModel\">\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\r\n <mat-form-field class=\"form-10\" 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 ufNascimento of getListaEstados()\" [value]=\"ufNascimento\">\r\n {{ ufNascimento }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-15\" 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\" required/>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Escolaridade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.escolaridade\" name=\"codigoEscolaridade\" #codigoEscolaridade=\"ngModel\">\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 \r\n <ng-container *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA || pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA \">\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 cidade of getListaEstados()\" [value]=\"cidade.identificador\">\r\n {{ cidade.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\"\r\n #rgDataEmissao=\"ngModel\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA \">\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 <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 <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>N\u00FAmero Passaporte</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.passaporte\" name=\"passaporte\" #passaporte=\"ngModel\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <b style=\"flex: 1 1 100%; margin-bottom: 10px;\"> Contato</b>\r\n\r\n <lib-unb-pessoa-telefone-list style=\"flex: 1 1 100%;\" [apiPessoaConfig]=\"apiPessoaConfig\" [telefones]=\"pessoa.telefones\" (telefonesEmitted)=\"telefonesEmitted($event)\" ></lib-unb-pessoa-telefone-list>\r\n\r\n <lib-unb-pessoa-endereco-list style=\"flex: 1 1 100%;\" [apiPessoaConfig]=\"apiPessoaConfig\" [enderecos]=\"pessoa.enderecos\" (enderecosEmitted)=\"enderecosEmitted($event)\" ></lib-unb-pessoa-endereco-list>\r\n\r\n <lib-unb-pessoa-email-list style=\"flex: 1 1 100%;\" [apiPessoaConfig]=\"apiPessoaConfig\" [emails]=\"pessoa.emails\" (emailsEmitted)=\"emailsEmitted($event)\" ></lib-unb-pessoa-email-list>\r\n \r\n <mat-card-actions class=\"card-actions-buttons\" *ngIf=\"buscaRealizada\">\r\n <button mat-flat-button disabled=\"{{isLoading}}\" type=\"submit\" color=\"primary\">\r\n Salvar\r\n </button>\r\n </mat-card-actions>\r\n \r\n </form>\r\n\r\n", 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}\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: i5$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$2.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: i5$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i5$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i6.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i7.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "component", type: i7$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i7$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i8$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i9.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"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i11.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i11.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i11.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: UnbPessoaPesquisarComponent, selector: "lib-unb-pessoa-pesquisar", inputs: ["apiPessoaConfig", "pesquisarPorCPF", "pesquisarPorCNPJ", "pesquisarPorEstrangeiro", "defaultTipoPessoa", "pessoa", "mostrarPesquisa", "limparAposPesquisa", "label", "placeholder", "hint"], outputs: ["pessoaEmitted"] }, { kind: "component", type: UnbPessoaTelefoneListComponent, selector: "lib-unb-pessoa-telefone-list", inputs: ["podeEditar", "telefones", "apiPessoaConfig"], outputs: ["telefonesEmitted"] }, { kind: "component", type: UnbPessoaenderecoListComponent, selector: "lib-unb-pessoa-endereco-list", inputs: ["podeEditar", "enderecos", "apiPessoaConfig"], outputs: ["enderecosEmitted"] }, { kind: "component", type: UnbPessoaEmailListComponent, selector: "lib-unb-pessoa-email-list", inputs: ["podeEditar", "emails", "apiPessoaConfig"], outputs: ["emailsEmitted"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] }); }
|
|
1780
|
+
}
|
|
1781
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaFormComponent, decorators: [{
|
|
1782
|
+
type: Component,
|
|
1783
|
+
args: [{ selector: 'lib-unb-pessoa-form', standalone: false, template: " <div class=\"form-container\">\r\n <lib-unb-pessoa-pesquisar\r\n [apiPessoaConfig]=\"apiPessoaConfig\" \r\n [defaultTipoPessoa]=\"defaultTipoPessoa\" \r\n (pessoaEmitted)=\"pessoaRecebida($event)\"></lib-unb-pessoa-pesquisar>\r\n</div>\r\n \r\n <form #pessoaForm=\"ngForm\" class=\"form-container mt-2\" *ngIf=\"buscaRealizada && apiPessoaConfig.url\" (ngSubmit)=\"salvar()\">\r\n \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-10\" 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-15\" appearance=\"outline\">\r\n <mat-label>Data Nascimento</mat-label>\r\n <input matInput [matDatepicker]=\"dataNascimentoPicker\" [(ngModel)]=\"pessoa.dataNascimento\" name=\"dataNascimento\" #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-10\" 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-10\" appearance=\"outline\">\r\n <mat-label>Pa\u00EDs Nascimento</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.codigoPaisNascimento\" name=\"codigoPaisNascimento\" #codigoPaisNascimento=\"ngModel\">\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\r\n <mat-form-field class=\"form-10\" 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 ufNascimento of getListaEstados()\" [value]=\"ufNascimento\">\r\n {{ ufNascimento }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-15\" 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\" required/>\r\n </mat-form-field>\r\n\r\n <mat-form-field class=\"form-10\" appearance=\"outline\">\r\n <mat-label>Escolaridade</mat-label>\r\n <mat-select [(ngModel)]=\"pessoa.escolaridade\" name=\"codigoEscolaridade\" #codigoEscolaridade=\"ngModel\">\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 \r\n <ng-container *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().FISICA || pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA \">\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 cidade of getListaEstados()\" [value]=\"cidade.identificador\">\r\n {{ cidade.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\"\r\n #rgDataEmissao=\"ngModel\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"pessoa.tipoPessoa == tipoPessoaEnum().ESTRANGEIRA \">\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 <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 <mat-form-field class=\"form-25\" appearance=\"outline\">\r\n <mat-label>N\u00FAmero Passaporte</mat-label>\r\n <input type=\"text\" matInput [(ngModel)]=\"pessoa.passaporte\" name=\"passaporte\" #passaporte=\"ngModel\" />\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <b style=\"flex: 1 1 100%; margin-bottom: 10px;\"> Contato</b>\r\n\r\n <lib-unb-pessoa-telefone-list style=\"flex: 1 1 100%;\" [apiPessoaConfig]=\"apiPessoaConfig\" [telefones]=\"pessoa.telefones\" (telefonesEmitted)=\"telefonesEmitted($event)\" ></lib-unb-pessoa-telefone-list>\r\n\r\n <lib-unb-pessoa-endereco-list style=\"flex: 1 1 100%;\" [apiPessoaConfig]=\"apiPessoaConfig\" [enderecos]=\"pessoa.enderecos\" (enderecosEmitted)=\"enderecosEmitted($event)\" ></lib-unb-pessoa-endereco-list>\r\n\r\n <lib-unb-pessoa-email-list style=\"flex: 1 1 100%;\" [apiPessoaConfig]=\"apiPessoaConfig\" [emails]=\"pessoa.emails\" (emailsEmitted)=\"emailsEmitted($event)\" ></lib-unb-pessoa-email-list>\r\n \r\n <mat-card-actions class=\"card-actions-buttons\" *ngIf=\"buscaRealizada\">\r\n <button mat-flat-button disabled=\"{{isLoading}}\" type=\"submit\" color=\"primary\">\r\n Salvar\r\n </button>\r\n </mat-card-actions>\r\n \r\n </form>\r\n\r\n", 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}\n"] }]
|
|
1784
|
+
}], ctorParameters: () => [{ type: UnBPessoaService }, { type: i1$2.MatSnackBar }], propDecorators: { apiPessoaConfig: [{
|
|
1785
|
+
type: Input
|
|
1786
|
+
}], defaultTipoPessoa: [{
|
|
1787
|
+
type: Input
|
|
1788
|
+
}], pesquisarPorCPF: [{
|
|
1789
|
+
type: Input
|
|
1790
|
+
}], pesquisarPorCNPJ: [{
|
|
1791
|
+
type: Input
|
|
1792
|
+
}], pesquisarPorEstrangeiro: [{
|
|
1793
|
+
type: Input
|
|
1794
|
+
}] } });
|
|
1795
|
+
|
|
1796
|
+
class UnbPessoaModule {
|
|
1797
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1798
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaModule, declarations: [UnbPessoaFormComponent, UnbPessoaPesquisarComponent, UnbPessoaEnderecoFormComponent, UnbPessoaTelefoneListComponent, UnbPessoaenderecoListComponent, UnbPessoaTelefoneFormComponent, UnbPessoaEmailFormComponent, UnbPessoaEmailListComponent], imports: [CommonModule,
|
|
1799
|
+
FormsModule,
|
|
1800
|
+
BrowserModule,
|
|
1801
|
+
MatIconModule,
|
|
1802
|
+
MatListModule,
|
|
1803
|
+
MatButtonModule,
|
|
1804
|
+
UnbUsuarioModule,
|
|
1805
|
+
MatCardModule,
|
|
1806
|
+
MatFormFieldModule,
|
|
1807
|
+
MatIconModule,
|
|
1808
|
+
MatInputModule,
|
|
1809
|
+
MatDialogModule,
|
|
1810
|
+
MatSelectModule,
|
|
1811
|
+
MatProgressSpinnerModule,
|
|
1812
|
+
MatButtonModule,
|
|
1813
|
+
MatProgressBarModule,
|
|
1814
|
+
MatNativeDateModule,
|
|
1815
|
+
MatListModule,
|
|
1816
|
+
MatPaginatorModule,
|
|
1817
|
+
MatExpansionModule,
|
|
1818
|
+
MatSnackBarModule,
|
|
1819
|
+
MatDatepickerModule,
|
|
1820
|
+
MatRadioModule,
|
|
1821
|
+
MatCardModule,
|
|
1822
|
+
MatDividerModule], exports: [UnbPessoaFormComponent, UnbPessoaPesquisarComponent, UnbPessoaEnderecoFormComponent, UnbPessoaTelefoneListComponent, UnbPessoaenderecoListComponent, UnbPessoaTelefoneFormComponent, UnbPessoaEmailFormComponent] }); }
|
|
1823
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaModule, providers: [
|
|
1824
|
+
MatDatepickerModule,
|
|
1825
|
+
DatePipe,
|
|
1826
|
+
CurrencyPipe
|
|
1827
|
+
], imports: [CommonModule,
|
|
1828
|
+
FormsModule,
|
|
1829
|
+
BrowserModule,
|
|
1830
|
+
MatIconModule,
|
|
1831
|
+
MatListModule,
|
|
1832
|
+
MatButtonModule,
|
|
1833
|
+
UnbUsuarioModule,
|
|
1834
|
+
MatCardModule,
|
|
1835
|
+
MatFormFieldModule,
|
|
1836
|
+
MatIconModule,
|
|
1837
|
+
MatInputModule,
|
|
1838
|
+
MatDialogModule,
|
|
1839
|
+
MatSelectModule,
|
|
1840
|
+
MatProgressSpinnerModule,
|
|
1841
|
+
MatButtonModule,
|
|
1842
|
+
MatProgressBarModule,
|
|
1843
|
+
MatNativeDateModule,
|
|
1844
|
+
MatListModule,
|
|
1845
|
+
MatPaginatorModule,
|
|
1846
|
+
MatExpansionModule,
|
|
1847
|
+
MatSnackBarModule,
|
|
1848
|
+
MatDatepickerModule,
|
|
1849
|
+
MatRadioModule,
|
|
1850
|
+
MatCardModule,
|
|
1851
|
+
MatDividerModule] }); }
|
|
1852
|
+
}
|
|
1853
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: UnbPessoaModule, decorators: [{
|
|
1854
|
+
type: NgModule,
|
|
1855
|
+
args: [{
|
|
1856
|
+
declarations: [UnbPessoaFormComponent, UnbPessoaPesquisarComponent, UnbPessoaEnderecoFormComponent, UnbPessoaTelefoneListComponent, UnbPessoaenderecoListComponent, UnbPessoaTelefoneFormComponent, UnbPessoaEmailFormComponent, UnbPessoaEmailListComponent],
|
|
1857
|
+
imports: [
|
|
1858
|
+
CommonModule,
|
|
1859
|
+
FormsModule,
|
|
1860
|
+
BrowserModule,
|
|
1861
|
+
MatIconModule,
|
|
1862
|
+
MatListModule,
|
|
1863
|
+
MatButtonModule,
|
|
1864
|
+
UnbUsuarioModule,
|
|
1865
|
+
MatCardModule,
|
|
1866
|
+
MatFormFieldModule,
|
|
1867
|
+
MatIconModule,
|
|
1868
|
+
MatInputModule,
|
|
1869
|
+
MatDialogModule,
|
|
1870
|
+
MatSelectModule,
|
|
1871
|
+
MatProgressSpinnerModule,
|
|
1872
|
+
MatButtonModule,
|
|
1873
|
+
MatProgressBarModule,
|
|
1874
|
+
MatNativeDateModule,
|
|
1875
|
+
MatListModule,
|
|
1876
|
+
MatPaginatorModule,
|
|
1877
|
+
MatExpansionModule,
|
|
1878
|
+
MatSnackBarModule,
|
|
1879
|
+
MatDatepickerModule,
|
|
1880
|
+
MatRadioModule,
|
|
1881
|
+
MatCardModule,
|
|
1882
|
+
MatDividerModule
|
|
1883
|
+
],
|
|
1884
|
+
exports: [UnbPessoaFormComponent, UnbPessoaPesquisarComponent, UnbPessoaEnderecoFormComponent, UnbPessoaTelefoneListComponent, UnbPessoaenderecoListComponent, UnbPessoaTelefoneFormComponent, UnbPessoaEmailFormComponent],
|
|
1885
|
+
providers: [
|
|
1886
|
+
MatDatepickerModule,
|
|
1887
|
+
DatePipe,
|
|
1888
|
+
CurrencyPipe
|
|
1889
|
+
]
|
|
1890
|
+
}]
|
|
1891
|
+
}] });
|
|
1892
|
+
|
|
1893
|
+
class UnbPessoaEscolaridade {
|
|
1894
|
+
constructor() {
|
|
1895
|
+
this.extinto = false;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
class UnbPessoaEstadoCivil {
|
|
1900
|
+
constructor() {
|
|
1901
|
+
this.extinto = false;
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
class UnbPessoaMunincipio {
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
class UnbPessoaPais {
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
class UnbPessoaRacaCor {
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
/*
|
|
1915
|
+
* Public API Surface of unb-lib-components
|
|
1916
|
+
*/
|
|
1917
|
+
|
|
1918
|
+
/**
|
|
1919
|
+
* Generated bundle index. Do not edit.
|
|
1920
|
+
*/
|
|
1921
|
+
|
|
1922
|
+
export { TipoPessoaEnum, UnBPessoaService, UnbAuthService, UnbMensagemComponent, UnbMensagemModule, UnbMensagemService, UnbNavBarComponent, UnbNavBarModule, UnbPessoaEmail, UnbPessoaEmailFormComponent, UnbPessoaEmailListComponent, UnbPessoaEmailTipo, UnbPessoaEndereco, UnbPessoaEnderecoFormComponent, UnbPessoaEnderecoTipo, UnbPessoaEscolaridade, UnbPessoaEstadoCivil, UnbPessoaFormComponent, UnbPessoaModel, UnbPessoaModule, UnbPessoaMunincipio, UnbPessoaPais, UnbPessoaPesquisarComponent, UnbPessoaRacaCor, UnbPessoaTelefone, UnbPessoaTelefoneFormComponent, UnbPessoaTelefoneListComponent, UnbPessoaTelefoneTipo, UnbPessoaenderecoListComponent, UnbTipoMensagemEnum, UnbUsuarioModel, listaEstados };
|
|
1923
|
+
//# sourceMappingURL=unb-lib-components.mjs.map
|