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