ngx-sp-auth 0.0.0-watch
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/esm2022/lib/auth.module.mjs +87 -0
- package/esm2022/lib/auth.service.mjs +306 -0
- package/esm2022/lib/components/login/login.component.mjs +326 -0
- package/esm2022/lib/components/menu-lateral/dropdown/primary-dropdown/primary-dropdown.component.mjs +68 -0
- package/esm2022/lib/components/menu-lateral/dropdown/secondary-dropdown/secondary-dropdown.component.mjs +32 -0
- package/esm2022/lib/components/menu-lateral/menu/list-estab.service.mjs +55 -0
- package/esm2022/lib/components/menu-lateral/menu/menu-lateral.component.mjs +235 -0
- package/esm2022/lib/components/menu-lateral/menu/selecao-estabelecimentos-modal/selecao-estabelecimentos-modal.component.mjs +200 -0
- package/esm2022/lib/components/menu-lateral/menu-services.service.mjs +151 -0
- package/esm2022/lib/components/menu-lateral/model/iestabelecimento.model.mjs +2 -0
- package/esm2022/lib/components/menu-lateral/model/imenu-item-structure.model.mjs +2 -0
- package/esm2022/lib/components/menu-lateral/model/imenu.model.mjs +12 -0
- package/esm2022/lib/components/menu-lateral/model/infrausuarioimg.mjs +12 -0
- package/esm2022/lib/components/menu-lateral/model/isubmenu-item-structure.model.mjs +2 -0
- package/esm2022/lib/components/menu-lateral/model/ret-estabelecimento-session.mjs +10 -0
- package/esm2022/lib/components/menu-lateral/model/ret-infrausuarioemail.mjs +8 -0
- package/esm2022/lib/components/menu-lateral/model/ret-infrausuarioimg.mjs +11 -0
- package/esm2022/lib/components/menu-lateral/model/usuario-img.mjs +8 -0
- package/esm2022/lib/components/menu-lateral/submenus/dynamic-menu/dynamic-menu.component.mjs +54 -0
- package/esm2022/lib/components/menu-lateral/submenus/notif-submenu/notif-submenu.component.mjs +14 -0
- package/esm2022/lib/components/nova-senha/nova-senhacomponent.mjs +191 -0
- package/esm2022/lib/custom/custom-login.service.mjs +52 -0
- package/esm2022/lib/custom/custom-menu.service.mjs +88 -0
- package/esm2022/lib/custom/menu-config.service.mjs +70 -0
- package/esm2022/lib/custom/models/icustom-login-service.mjs +2 -0
- package/esm2022/lib/custom/models/icustom-menu-service.mjs +2 -0
- package/esm2022/lib/custom/models/imenu-config.mjs +2 -0
- package/esm2022/lib/environments/environments.service.mjs +21 -0
- package/esm2022/lib/environments/models/ienvironments.mjs +2 -0
- package/esm2022/lib/guards/auth-guard.mjs +34 -0
- package/esm2022/lib/guards/external-login-guard.mjs +88 -0
- package/esm2022/lib/guards/login-guard.mjs +35 -0
- package/esm2022/lib/interceptors/auth-aplic.interceptor.mjs +41 -0
- package/esm2022/lib/interceptors/auth-infra.interceptor.mjs +30 -0
- package/esm2022/lib/models/code-2fa.mjs +2 -0
- package/esm2022/lib/models/custom-propriedades-login.mjs +3 -0
- package/esm2022/lib/models/forgotten-password-form.mjs +2 -0
- package/esm2022/lib/models/login-form.mjs +2 -0
- package/esm2022/lib/models/login.mjs +2 -0
- package/esm2022/lib/models/nova-senha-form.mjs +2 -0
- package/esm2022/lib/models/password-recup.mjs +2 -0
- package/esm2022/lib/models/payload.mjs +2 -0
- package/esm2022/lib/models/ret-login.mjs +21 -0
- package/esm2022/lib/models/ret-token.mjs +8 -0
- package/esm2022/lib/models/token.mjs +2 -0
- package/esm2022/lib/server/ret-server-config.mjs +9 -0
- package/esm2022/lib/server/server.service.mjs +38 -0
- package/esm2022/lib/storage/auth-storage.service.mjs +409 -0
- package/esm2022/ngx-sp-auth.mjs +5 -0
- package/esm2022/public-api.mjs +37 -0
- package/fesm2022/ngx-sp-auth.mjs +2520 -0
- package/fesm2022/ngx-sp-auth.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/auth.module.d.ts +21 -0
- package/lib/auth.service.d.ts +42 -0
- package/lib/components/login/login.component.d.ts +67 -0
- package/lib/components/menu-lateral/dropdown/primary-dropdown/primary-dropdown.component.d.ts +20 -0
- package/lib/components/menu-lateral/dropdown/secondary-dropdown/secondary-dropdown.component.d.ts +12 -0
- package/lib/components/menu-lateral/menu/list-estab.service.d.ts +19 -0
- package/lib/components/menu-lateral/menu/menu-lateral.component.d.ts +74 -0
- package/lib/components/menu-lateral/menu/selecao-estabelecimentos-modal/selecao-estabelecimentos-modal.component.d.ts +71 -0
- package/lib/components/menu-lateral/menu-services.service.d.ts +31 -0
- package/lib/components/menu-lateral/model/iestabelecimento.model.d.ts +4 -0
- package/lib/components/menu-lateral/model/imenu-item-structure.model.d.ts +12 -0
- package/lib/components/menu-lateral/model/imenu.model.d.ts +40 -0
- package/lib/components/menu-lateral/model/infrausuarioimg.d.ts +9 -0
- package/lib/components/menu-lateral/model/isubmenu-item-structure.model.d.ts +9 -0
- package/lib/components/menu-lateral/model/ret-estabelecimento-session.d.ts +8 -0
- package/lib/components/menu-lateral/model/ret-infrausuarioemail.d.ts +6 -0
- package/lib/components/menu-lateral/model/ret-infrausuarioimg.d.ts +9 -0
- package/lib/components/menu-lateral/model/usuario-img.d.ts +5 -0
- package/lib/components/menu-lateral/submenus/dynamic-menu/dynamic-menu.component.d.ts +25 -0
- package/lib/components/menu-lateral/submenus/notif-submenu/notif-submenu.component.d.ts +8 -0
- package/lib/components/nova-senha/nova-senhacomponent.d.ts +48 -0
- package/lib/custom/custom-login.service.d.ts +38 -0
- package/lib/custom/custom-menu.service.d.ts +48 -0
- package/lib/custom/menu-config.service.d.ts +32 -0
- package/lib/custom/models/icustom-login-service.d.ts +13 -0
- package/lib/custom/models/icustom-menu-service.d.ts +10 -0
- package/lib/custom/models/imenu-config.d.ts +7 -0
- package/lib/environments/environments.service.d.ts +11 -0
- package/lib/environments/models/ienvironments.d.ts +4 -0
- package/lib/guards/auth-guard.d.ts +14 -0
- package/lib/guards/external-login-guard.d.ts +21 -0
- package/lib/guards/login-guard.d.ts +24 -0
- package/lib/interceptors/auth-aplic.interceptor.d.ts +22 -0
- package/lib/interceptors/auth-infra.interceptor.d.ts +16 -0
- package/lib/models/code-2fa.d.ts +4 -0
- package/lib/models/custom-propriedades-login.d.ts +11 -0
- package/lib/models/forgotten-password-form.d.ts +5 -0
- package/lib/models/login-form.d.ts +5 -0
- package/lib/models/login.d.ts +4 -0
- package/lib/models/nova-senha-form.d.ts +5 -0
- package/lib/models/password-recup.d.ts +5 -0
- package/lib/models/payload.d.ts +9 -0
- package/lib/models/ret-login.d.ts +20 -0
- package/lib/models/ret-token.d.ts +6 -0
- package/lib/models/token.d.ts +8 -0
- package/lib/server/ret-server-config.d.ts +7 -0
- package/lib/server/server.service.d.ts +14 -0
- package/lib/storage/auth-storage.service.d.ts +90 -0
- package/package.json +25 -0
- package/public-api.d.ts +36 -0
- package/src/assets/imgs/Property1-cadeado.png +0 -0
- package/src/assets/imgs/Property1-calendariofino.png +0 -0
- package/src/assets/imgs/Property1-mao.png +0 -0
- package/src/assets/styles/styles.novo.scss +0 -0
|
@@ -0,0 +1,2520 @@
|
|
|
1
|
+
import * as i2 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable, Component, EventEmitter, Input, Output, TemplateRef, ContentChild, ViewChild, NgModule } from '@angular/core';
|
|
5
|
+
import * as i3 from '@angular/forms';
|
|
6
|
+
import { FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
+
import * as i1$1 from '@angular/router';
|
|
8
|
+
import { NavigationEnd, RouterLink, RouterOutlet } from '@angular/router';
|
|
9
|
+
import * as i9$2 from 'ngx-bootstrap/popover';
|
|
10
|
+
import { PopoverModule } from 'ngx-bootstrap/popover';
|
|
11
|
+
import * as i9$1 from 'ngx-bootstrap/tooltip';
|
|
12
|
+
import { TooltipModule } from 'ngx-bootstrap/tooltip';
|
|
13
|
+
import * as i8 from 'ngx-pagination';
|
|
14
|
+
import { NgxPaginationModule } from 'ngx-pagination';
|
|
15
|
+
import * as i5 from 'ngx-sp-infra';
|
|
16
|
+
import { Utils, FormUtils, InfraModule } from 'ngx-sp-infra';
|
|
17
|
+
import { BehaviorSubject, take, tap, Subscription, timer, map as map$1, Observable, Subject, filter, of, merge, lastValueFrom, from } from 'rxjs';
|
|
18
|
+
import * as i1$2 from 'ngx-bootstrap/modal';
|
|
19
|
+
import * as i1 from '@angular/common/http';
|
|
20
|
+
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
21
|
+
import { take as take$1, tap as tap$1, map, switchMap } from 'rxjs/operators';
|
|
22
|
+
import * as i9 from '@angular/platform-browser';
|
|
23
|
+
import * as i11 from 'ngx-toastr';
|
|
24
|
+
|
|
25
|
+
class AuthStorageService {
|
|
26
|
+
constructor(_httpBackend) {
|
|
27
|
+
this._httpBackend = _httpBackend;
|
|
28
|
+
this._HOSTNAME = window.location.hostname.includes("localhost")
|
|
29
|
+
? `http://${window.location.hostname}`
|
|
30
|
+
: `https://${window.location.hostname}`;
|
|
31
|
+
this._BASE_URL = `${this._HOSTNAME}/SisproErpCloud/Service_Private/Infra/SpInfra2LoginWS/api/LoginSisproERP`; // SpInfra2WS
|
|
32
|
+
this.__local_key = 'user_auth_v6';
|
|
33
|
+
// indica se objeto já está marcado para salvar os dados no local storage.
|
|
34
|
+
this.__isSaving = false;
|
|
35
|
+
/** Se ainda estamos com uma função rodando para verificar o login do usuário */
|
|
36
|
+
this.__isCheckingAuth = false;
|
|
37
|
+
// #region GETTERS/SETTERS
|
|
38
|
+
this.isLoggedInSub = new BehaviorSubject(false);
|
|
39
|
+
//ip
|
|
40
|
+
this.__ip = "";
|
|
41
|
+
//tenantId
|
|
42
|
+
this.__tenantId = 0;
|
|
43
|
+
//infraUsuarioId
|
|
44
|
+
this.__infraUsuarioId = "";
|
|
45
|
+
// EstabelecimentoID
|
|
46
|
+
this.__infraEstabId = "";
|
|
47
|
+
// NomeEstabelecimento
|
|
48
|
+
this.__infraEstabNome = "";
|
|
49
|
+
// EmpresaID
|
|
50
|
+
this.__infraEmpresaId = "";
|
|
51
|
+
// NomeEmpresa
|
|
52
|
+
this.__infraEmpresaNome = "";
|
|
53
|
+
//user
|
|
54
|
+
this.__user = "";
|
|
55
|
+
//username
|
|
56
|
+
this.__userName = "";
|
|
57
|
+
//authToken
|
|
58
|
+
this.__authToken = "";
|
|
59
|
+
/** Domínio */
|
|
60
|
+
this.__dominio = "";
|
|
61
|
+
//url para redirecionamento
|
|
62
|
+
this.__UrlRedirect = "/";
|
|
63
|
+
//indica Login Externo
|
|
64
|
+
this.__isExternalLogin = false;
|
|
65
|
+
/** Se é para ignorar o método reCheckLogin */
|
|
66
|
+
this.__ignoreCheckLogin = false;
|
|
67
|
+
this._httpClient = new HttpClient(_httpBackend);
|
|
68
|
+
//this._BASE_URL = !environment.production ? this._BASE_URL : `${environment.SpInfra2LoginWS}/LoginSisproERP`;
|
|
69
|
+
// Método com customizações para inicializações da storage
|
|
70
|
+
this.storageConstructor();
|
|
71
|
+
const expectedLocalAuthStorage = localStorage.getItem(this.__local_key);
|
|
72
|
+
if (expectedLocalAuthStorage) {
|
|
73
|
+
const localAuthStorage = JSON.parse(expectedLocalAuthStorage);
|
|
74
|
+
this.__ip = localAuthStorage.__ip;
|
|
75
|
+
this.__tenantId = localAuthStorage.__tenantId;
|
|
76
|
+
this.__infraUsuarioId = localAuthStorage.__infraUsuarioId;
|
|
77
|
+
this.__infraEstabId = localAuthStorage.__infraEstabId;
|
|
78
|
+
this.__infraEstabNome = localAuthStorage.__infraEstabNome;
|
|
79
|
+
this.__infraEmpresaId = localAuthStorage.__infraEmpresaId;
|
|
80
|
+
this.__infraEmpresaNome = localAuthStorage.__infraEmpresaNome;
|
|
81
|
+
this.__user = localAuthStorage.__user;
|
|
82
|
+
this.__userName = localAuthStorage.__userName;
|
|
83
|
+
this.__tokenPayload = localAuthStorage.__tokenPayload;
|
|
84
|
+
this.__authToken = localAuthStorage.__authToken;
|
|
85
|
+
this.__dominio = localAuthStorage.__dominio;
|
|
86
|
+
this.__isExternalLogin = localAuthStorage.__isExternalLogin;
|
|
87
|
+
this.startLoginCheck();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
get ip() {
|
|
91
|
+
return this.__ip;
|
|
92
|
+
}
|
|
93
|
+
set ip(value) {
|
|
94
|
+
this.__ip = value;
|
|
95
|
+
if (this.isLoggedInSub.value) {
|
|
96
|
+
this.__saveLocalInstance();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
get tenantId() {
|
|
100
|
+
return this.__tenantId;
|
|
101
|
+
}
|
|
102
|
+
set tenantId(value) {
|
|
103
|
+
this.__tenantId = value;
|
|
104
|
+
this.__saveLocalInstance();
|
|
105
|
+
}
|
|
106
|
+
get infraUsuarioId() {
|
|
107
|
+
return this.__infraUsuarioId;
|
|
108
|
+
}
|
|
109
|
+
set infraUsuarioId(value) {
|
|
110
|
+
this.__infraUsuarioId = value;
|
|
111
|
+
this.__saveLocalInstance();
|
|
112
|
+
}
|
|
113
|
+
get infraEstabId() {
|
|
114
|
+
return this.__infraEstabId;
|
|
115
|
+
}
|
|
116
|
+
set infraEstabId(value) {
|
|
117
|
+
this.__infraEstabId = value;
|
|
118
|
+
this.__saveLocalInstance();
|
|
119
|
+
}
|
|
120
|
+
get infraEstabNome() {
|
|
121
|
+
return this.__infraEstabNome;
|
|
122
|
+
}
|
|
123
|
+
set infraEstabNome(value) {
|
|
124
|
+
this.__infraEstabNome = value;
|
|
125
|
+
this.__saveLocalInstance();
|
|
126
|
+
}
|
|
127
|
+
get infraEmpresaId() {
|
|
128
|
+
return this.__infraEmpresaId;
|
|
129
|
+
}
|
|
130
|
+
set infraEmpresaId(value) {
|
|
131
|
+
this.__infraEmpresaId = value;
|
|
132
|
+
this.__saveLocalInstance();
|
|
133
|
+
}
|
|
134
|
+
get infraEmpresaNome() {
|
|
135
|
+
return this.__infraEmpresaNome;
|
|
136
|
+
}
|
|
137
|
+
set infraEmpresaNome(value) {
|
|
138
|
+
this.__infraEmpresaNome = value;
|
|
139
|
+
this.__saveLocalInstance();
|
|
140
|
+
}
|
|
141
|
+
get user() {
|
|
142
|
+
return this.__user;
|
|
143
|
+
}
|
|
144
|
+
set user(value) {
|
|
145
|
+
this.__user = value;
|
|
146
|
+
this.__saveLocalInstance();
|
|
147
|
+
}
|
|
148
|
+
get userName() {
|
|
149
|
+
return this.__userName;
|
|
150
|
+
}
|
|
151
|
+
set userName(value) {
|
|
152
|
+
this.__userName = value;
|
|
153
|
+
this.__saveLocalInstance();
|
|
154
|
+
}
|
|
155
|
+
get tokenPayload() {
|
|
156
|
+
return this.__tokenPayload;
|
|
157
|
+
}
|
|
158
|
+
get authToken() {
|
|
159
|
+
return this.__authToken;
|
|
160
|
+
}
|
|
161
|
+
set authToken(value) {
|
|
162
|
+
this.__authToken = value;
|
|
163
|
+
if (this.__authToken != '') {
|
|
164
|
+
// Utiliza-se a função dos Utils para pegar o segundo valor do Token, separados por um '.'
|
|
165
|
+
// e define o __tokenPayload como o objeto resultante do JSON.parse(payloadJson)
|
|
166
|
+
const payloadJson = Utils.b64DecodeUnicode(this.__authToken.split('.')[1]);
|
|
167
|
+
this.__tokenPayload = JSON.parse(payloadJson);
|
|
168
|
+
this.startLoginCheck();
|
|
169
|
+
}
|
|
170
|
+
this.__saveLocalInstance();
|
|
171
|
+
}
|
|
172
|
+
get dominio() {
|
|
173
|
+
return this.__dominio;
|
|
174
|
+
}
|
|
175
|
+
set dominio(value) {
|
|
176
|
+
this.__dominio = value;
|
|
177
|
+
this.__saveLocalInstance();
|
|
178
|
+
}
|
|
179
|
+
get urlRedirect() {
|
|
180
|
+
return this.__UrlRedirect;
|
|
181
|
+
}
|
|
182
|
+
set urlRedirect(value) {
|
|
183
|
+
this.__UrlRedirect = value;
|
|
184
|
+
}
|
|
185
|
+
get isExternalLogin() {
|
|
186
|
+
return this.__isExternalLogin;
|
|
187
|
+
}
|
|
188
|
+
set isExternalLogin(value) {
|
|
189
|
+
this.__isExternalLogin = value;
|
|
190
|
+
this.__saveLocalInstance();
|
|
191
|
+
}
|
|
192
|
+
get ignoreCheckLogin() {
|
|
193
|
+
return this.__ignoreCheckLogin;
|
|
194
|
+
}
|
|
195
|
+
set ignoreCheckLogin(value) {
|
|
196
|
+
this.__ignoreCheckLogin = value;
|
|
197
|
+
this.__saveLocalInstance();
|
|
198
|
+
}
|
|
199
|
+
// #endregion GETTERS/SETTERS
|
|
200
|
+
async __saveLocalInstance() {
|
|
201
|
+
if (this.__isSaving) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.__isSaving = true;
|
|
205
|
+
localStorage.setItem(this.__local_key, this.toJson());
|
|
206
|
+
// Método com customizações para salvar informações na storage
|
|
207
|
+
this.storageSaveLocalInstance();
|
|
208
|
+
this.__notSaving();
|
|
209
|
+
}
|
|
210
|
+
async __notSaving() {
|
|
211
|
+
this.__isSaving = false;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Salva a instância como JSON seguro, ignorando objetos que não podem se tornar um JSON.
|
|
215
|
+
*/
|
|
216
|
+
toJson() {
|
|
217
|
+
const json = `
|
|
218
|
+
{
|
|
219
|
+
"__ip": "${this.ip}",
|
|
220
|
+
"__tenantId": ${this.tenantId},
|
|
221
|
+
"__infraUsuarioId": "${this.infraUsuarioId}",
|
|
222
|
+
"__infraEstabId": "${this.infraEstabId}",
|
|
223
|
+
"__infraEstabNome": "${this.infraEstabNome}",
|
|
224
|
+
"__infraEmpresaId": "${this.infraEmpresaId}",
|
|
225
|
+
"__infraEmpresaNome": "${this.infraEmpresaNome}",
|
|
226
|
+
"__user": "${this.user}",
|
|
227
|
+
"__userName": "${this.userName}",
|
|
228
|
+
"__authToken": "${this.authToken}",
|
|
229
|
+
"__tokenPayload": ${JSON.stringify(this.tokenPayload)},
|
|
230
|
+
"__dominio": "${this.dominio}",
|
|
231
|
+
"__isExternalLogin": ${this.isExternalLogin}
|
|
232
|
+
}
|
|
233
|
+
`;
|
|
234
|
+
return json;
|
|
235
|
+
}
|
|
236
|
+
/** Inicia a verificação do login. */
|
|
237
|
+
startLoginCheck() {
|
|
238
|
+
if (!this.__isCheckingAuth) {
|
|
239
|
+
this.reCheckLogin();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Verifica a cada diferença de tempo entre a data atual e a data do token.
|
|
244
|
+
*/
|
|
245
|
+
async reCheckLogin() {
|
|
246
|
+
if (this.__authToken === undefined || this.__authToken === '' || this.authToken === null || this.authToken === '') {
|
|
247
|
+
this.__isCheckingAuth = false;
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
this.__isCheckingAuth = true;
|
|
251
|
+
let isRenewToken = false;
|
|
252
|
+
let nowDate = Math.round(Date.now() / 1000);
|
|
253
|
+
if (this.tokenPayload.exp <= nowDate) {
|
|
254
|
+
isRenewToken = true;
|
|
255
|
+
}
|
|
256
|
+
let leftTime = this.tokenPayload.exp - nowDate;
|
|
257
|
+
if (leftTime <= 0) {
|
|
258
|
+
isRenewToken = true;
|
|
259
|
+
}
|
|
260
|
+
// TODO: Alterar aqui para não deslogar e avisar o usuário para logar denovo.
|
|
261
|
+
if (isRenewToken) {
|
|
262
|
+
const response = await this.getNewToken();
|
|
263
|
+
if (response !== undefined && response !== null && response != '') {
|
|
264
|
+
this.authToken = response;
|
|
265
|
+
nowDate = Math.round(Date.now() / 1000);
|
|
266
|
+
leftTime = this.tokenPayload.exp - nowDate;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
this.logout();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (this.ignoreCheckLogin) {
|
|
274
|
+
this.ignoreCheckLogin = false;
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
// Método com customizações para inicializações da AutoStorage
|
|
278
|
+
this.storageInitializeAutoStorage();
|
|
279
|
+
}
|
|
280
|
+
this.isLoggedInSub.next(true);
|
|
281
|
+
setTimeout(this.reCheckLogin.bind(this), leftTime * 1000);
|
|
282
|
+
}
|
|
283
|
+
logout() {
|
|
284
|
+
this.__isCheckingAuth = false;
|
|
285
|
+
this.isLoggedInSub.next(false);
|
|
286
|
+
this.__UrlRedirect = "/";
|
|
287
|
+
this.__ip = "";
|
|
288
|
+
this.__tenantId = 0;
|
|
289
|
+
this.__infraUsuarioId = "";
|
|
290
|
+
this.__infraEstabId = "";
|
|
291
|
+
this.__infraEstabNome = "";
|
|
292
|
+
this.__infraEmpresaId = "";
|
|
293
|
+
this.__infraEmpresaNome = "";
|
|
294
|
+
this.__user = "";
|
|
295
|
+
this.__userName = "";
|
|
296
|
+
this.__authToken = "";
|
|
297
|
+
this.__dominio = "";
|
|
298
|
+
this.__tokenPayload = {};
|
|
299
|
+
this.__isExternalLogin = false;
|
|
300
|
+
localStorage.removeItem(this.__local_key);
|
|
301
|
+
// Método com customizações para finalizações da storage
|
|
302
|
+
this.storageLogout();
|
|
303
|
+
}
|
|
304
|
+
getNewTokenBack() {
|
|
305
|
+
let token = {
|
|
306
|
+
domain: this.__dominio,
|
|
307
|
+
user: this.__user,
|
|
308
|
+
tenantId: this.tenantId,
|
|
309
|
+
token: this.authToken,
|
|
310
|
+
infraUsuarioId: this.__infraUsuarioId,
|
|
311
|
+
userName: this.__userName
|
|
312
|
+
};
|
|
313
|
+
const url = `${this._BASE_URL}/GetNewToken`;
|
|
314
|
+
const headers = new HttpHeaders()
|
|
315
|
+
.set('Content-Type', 'application/json')
|
|
316
|
+
.set('Authorization', `Basic ${btoa(`${localStorage.getItem('configServerUser')}:${localStorage.getItem('configServerPassword')}`)}`);
|
|
317
|
+
return this._httpClient
|
|
318
|
+
.post(url, token, { 'headers': headers })
|
|
319
|
+
.pipe(take(1), tap((response) => {
|
|
320
|
+
if (response.Error) {
|
|
321
|
+
throw Error(response.ErrorMessage);
|
|
322
|
+
}
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
getNewToken() {
|
|
326
|
+
return new Promise((resolve, reject) => {
|
|
327
|
+
this.getNewTokenBack().subscribe({
|
|
328
|
+
next: response => {
|
|
329
|
+
resolve(response.Token);
|
|
330
|
+
},
|
|
331
|
+
error: error => {
|
|
332
|
+
reject(error);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Renova o Token quando este estiver vencido.
|
|
339
|
+
*/
|
|
340
|
+
async renewToken() {
|
|
341
|
+
if (!this.isLoggedInSub || this.__authToken === undefined || this.__authToken === '' || this.authToken === null || this.authToken === '') {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
let isRenewToken = false;
|
|
345
|
+
let nowDate = Math.round(Date.now() / 1000);
|
|
346
|
+
if (this.tokenPayload.exp <= nowDate) {
|
|
347
|
+
isRenewToken = true;
|
|
348
|
+
}
|
|
349
|
+
let leftTime = this.tokenPayload.exp - nowDate;
|
|
350
|
+
if (leftTime <= 0) {
|
|
351
|
+
isRenewToken = true;
|
|
352
|
+
}
|
|
353
|
+
if (isRenewToken) {
|
|
354
|
+
const response = await this.getNewToken();
|
|
355
|
+
if (response !== undefined && response !== null && response != '') {
|
|
356
|
+
this.authToken = response;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
isPrePortal() {
|
|
361
|
+
// Identifica se a origem é PrePortal
|
|
362
|
+
var url = new URL(window.location.href);
|
|
363
|
+
var isPrePortal = url.searchParams.get("PrePortal");
|
|
364
|
+
if (isPrePortal != null) {
|
|
365
|
+
if (isPrePortal.toString() == "true") {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// #region ==========> UTILS <==========
|
|
377
|
+
// #endregion Propriedades Customizadas para o Componente auth-storage.service.ts
|
|
378
|
+
// #region Métodos Customizadas para o Componente auth-storage.service.ts
|
|
379
|
+
// Método executado no auth-storage.service.ts - método: constructor ()
|
|
380
|
+
// Utilizado para inicializações diversas
|
|
381
|
+
storageConstructor(callback) {
|
|
382
|
+
if (callback) {
|
|
383
|
+
callback();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// Método executado no auth-storage.service.ts - método: saveLocalInstance ()
|
|
387
|
+
// Utilizado para salvar informações no localStorage
|
|
388
|
+
storageSaveLocalInstance(callback) {
|
|
389
|
+
if (callback) {
|
|
390
|
+
callback();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
// Método executado no auth-storage.service.ts - método: logout ()
|
|
394
|
+
// Utilizado para inicializar informações no localStorage na logout da aplicação
|
|
395
|
+
storageLogout(callback) {
|
|
396
|
+
if (callback) {
|
|
397
|
+
callback();
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// Método executado no auth-storage.service.ts - método: reCheckLogin ()
|
|
401
|
+
// Utilizado para inicializações diversas quando o Login exeutado via Pré Portal
|
|
402
|
+
storageInitializeAutoStorage(callback) {
|
|
403
|
+
if (callback) {
|
|
404
|
+
callback();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
// Método executado para salvar as propriedades no LocalStorage (não deve ser modificado)
|
|
408
|
+
async __authStorageSaveLocalInstance() {
|
|
409
|
+
if (this.__isSaving) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
this.__isSaving = true;
|
|
413
|
+
this.storageSaveLocalInstance();
|
|
414
|
+
this.__authStorageNotSaving();
|
|
415
|
+
}
|
|
416
|
+
// Método executado para salvar as propriedades no LocalStorage (não deve ser modificado)
|
|
417
|
+
async __authStorageNotSaving() {
|
|
418
|
+
this.__isSaving = false;
|
|
419
|
+
}
|
|
420
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthStorageService, deps: [{ token: i1.HttpBackend }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
421
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthStorageService, providedIn: 'root' }); }
|
|
422
|
+
}
|
|
423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthStorageService, decorators: [{
|
|
424
|
+
type: Injectable,
|
|
425
|
+
args: [{ providedIn: 'root' }]
|
|
426
|
+
}], ctorParameters: () => [{ type: i1.HttpBackend }] });
|
|
427
|
+
|
|
428
|
+
class LibCustomLoginService {
|
|
429
|
+
constructor() { }
|
|
430
|
+
// #endregion Propriedade Customizadas para o Componente login.component.ts
|
|
431
|
+
// #region Métodos Customizadas para o Componente auth.service.ts
|
|
432
|
+
/**
|
|
433
|
+
* Método executado no auth.service.ts - método: login ()
|
|
434
|
+
* Utilizado para inicializações diversas
|
|
435
|
+
*/
|
|
436
|
+
authLogin() {
|
|
437
|
+
this.storedAuthLogin;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Método executado no auth.service.ts - método: logout ()
|
|
441
|
+
* Utilizado para inicializações diversas
|
|
442
|
+
*/
|
|
443
|
+
authLogout() {
|
|
444
|
+
this.storedAuthLogout;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Método executado no auth.service.ts - método: login ()
|
|
448
|
+
* Utilizado para informar o redirecionamento para a tela inicial após o login ok
|
|
449
|
+
*
|
|
450
|
+
* @param router Objeto de Router que será utilizado
|
|
451
|
+
*/
|
|
452
|
+
authNavigateToPage(router) {
|
|
453
|
+
router.navigate(["/home"]);
|
|
454
|
+
}
|
|
455
|
+
ConfigurarCustomLogin(customLoginService) {
|
|
456
|
+
//passando propriedades do produto para a lib
|
|
457
|
+
this.loginTitle = customLoginService.loginTitle;
|
|
458
|
+
this.loginSubtitle = customLoginService.loginSubtitle;
|
|
459
|
+
this.loginBackground = customLoginService.loginBackground;
|
|
460
|
+
this.loginLogotipo = customLoginService.loginLogotipo;
|
|
461
|
+
this.loginAltLogotipo = customLoginService.loginAltLogotipo;
|
|
462
|
+
this.loginPageTitle = customLoginService.loginPageTitle;
|
|
463
|
+
this.loginDesenvDomain = customLoginService.loginDesenvDomain;
|
|
464
|
+
this.loginDesenvUser = customLoginService.loginDesenvUser;
|
|
465
|
+
this.loginDesenvPassword = customLoginService.loginDesenvPassword;
|
|
466
|
+
//passando implementação dos métodos do produto para a lib
|
|
467
|
+
this.storedAuthLogin = customLoginService.authLogin;
|
|
468
|
+
this.storedAuthLogout = customLoginService.authLogout;
|
|
469
|
+
}
|
|
470
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LibCustomLoginService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
471
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LibCustomLoginService, providedIn: 'root' }); }
|
|
472
|
+
}
|
|
473
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LibCustomLoginService, decorators: [{
|
|
474
|
+
type: Injectable,
|
|
475
|
+
args: [{ providedIn: 'root' }]
|
|
476
|
+
}], ctorParameters: () => [] });
|
|
477
|
+
|
|
478
|
+
class AuthService {
|
|
479
|
+
// #endregion PRIVATE
|
|
480
|
+
// #endregion ==========> PROPERTIES <==========
|
|
481
|
+
constructor(_httpClient, _router, _authStorageService, _customLoginService, _ipServiceService) {
|
|
482
|
+
this._httpClient = _httpClient;
|
|
483
|
+
this._router = _router;
|
|
484
|
+
this._authStorageService = _authStorageService;
|
|
485
|
+
this._customLoginService = _customLoginService;
|
|
486
|
+
this._ipServiceService = _ipServiceService;
|
|
487
|
+
// #region ==========> PROPERTIES <==========
|
|
488
|
+
// #region PRIVATE
|
|
489
|
+
// private readonly _HOSTNAME: any = window.location.hostname.includes("localhost")
|
|
490
|
+
// ? `http://${window.location.hostname}`
|
|
491
|
+
// : `https://${window.location.hostname}`;
|
|
492
|
+
this._HOSTNAME = "https://siscandesv6.sispro.com.br";
|
|
493
|
+
this._BASE_URL = `${this._HOSTNAME}/SisproErpCloud/Service_Private/Infra/SpInfra2LoginWS/api/LoginSisproERP`; // SpInfra2WS
|
|
494
|
+
this._HTTP_HEADERS = new HttpHeaders().set('Content-Type', 'application/json');
|
|
495
|
+
this.ip = "undefined";
|
|
496
|
+
this.city = "undefined";
|
|
497
|
+
this.state = "undefined";
|
|
498
|
+
this.country = "undefined";
|
|
499
|
+
//this._BASE_URL = !environment.production ? this._BASE_URL : `${environment.SpInfra2LoginWS}/LoginSisproERP`;
|
|
500
|
+
this._BASE_URL.includes("localhost") || this._BASE_URL.includes('127.0.0.1')
|
|
501
|
+
? this._BASE_URL
|
|
502
|
+
: this._BASE_URL = "https://siscandesv6.sispro.com.br/SisproErpCloud/Service_Private/Infra/SpInfra2LoginWS/api/LoginSisproERP";
|
|
503
|
+
this.getParms();
|
|
504
|
+
}
|
|
505
|
+
// #region ==========> SERVICE METHODS <==========
|
|
506
|
+
// #region GET
|
|
507
|
+
getParms() {
|
|
508
|
+
this.ip = "undefined";
|
|
509
|
+
this._ipServiceService.getIPAddress().subscribe({
|
|
510
|
+
next: (res) => {
|
|
511
|
+
this.ip = res.ip;
|
|
512
|
+
},
|
|
513
|
+
error: (error) => {
|
|
514
|
+
},
|
|
515
|
+
});
|
|
516
|
+
this.city = "undefined";
|
|
517
|
+
this.state = "undefined";
|
|
518
|
+
this.country = "undefined";
|
|
519
|
+
this._ipServiceService.getDataUser().subscribe({
|
|
520
|
+
next: (res) => {
|
|
521
|
+
this.city = res.city;
|
|
522
|
+
this.state = res.region_code;
|
|
523
|
+
this.country = res.country_name;
|
|
524
|
+
},
|
|
525
|
+
error: (error) => {
|
|
526
|
+
},
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
geHostName() {
|
|
530
|
+
let product = window.location.pathname;
|
|
531
|
+
let index = product.indexOf("/auth/login");
|
|
532
|
+
if (index != -1) {
|
|
533
|
+
product = product.substring(0, index);
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
product = "";
|
|
537
|
+
}
|
|
538
|
+
return this._HOSTNAME + product;
|
|
539
|
+
}
|
|
540
|
+
// #endregion GET
|
|
541
|
+
// #region POST
|
|
542
|
+
/** Realiza o login no sistema
|
|
543
|
+
* @param login Informações do formulário de login
|
|
544
|
+
* @returns Observable com os dados do login realizado, seja erro ou sucesso
|
|
545
|
+
*/
|
|
546
|
+
login(parmsLogin) {
|
|
547
|
+
let login = {
|
|
548
|
+
usuario: parmsLogin.usuario,
|
|
549
|
+
senha: parmsLogin.senha
|
|
550
|
+
};
|
|
551
|
+
const params = new HttpParams()
|
|
552
|
+
.set('dominio', parmsLogin.dominio)
|
|
553
|
+
.set('urlServidor', this.geHostName())
|
|
554
|
+
.set('ip', this.ip)
|
|
555
|
+
.set('browse', `${this._ipServiceService.getDataBrowserUser().browser} - ${this._ipServiceService.getDataBrowserUser().so}`)
|
|
556
|
+
.set('localization', `${this.city}, ${this.state}, ${this.country}`);
|
|
557
|
+
const url = `${this._BASE_URL}/ValidateLogin`;
|
|
558
|
+
const headers = this._HTTP_HEADERS;
|
|
559
|
+
return this._httpClient
|
|
560
|
+
.post(url, login, { 'params': params, 'headers': headers })
|
|
561
|
+
.pipe(take$1(1), tap$1((response) => {
|
|
562
|
+
if (response.FeedbackMessage != "") {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (response.Error) {
|
|
566
|
+
throw Error(response.ErrorMessage);
|
|
567
|
+
}
|
|
568
|
+
if (response.InitializePassword) {
|
|
569
|
+
//Inicializar password
|
|
570
|
+
this._authStorageService.logout();
|
|
571
|
+
}
|
|
572
|
+
else if (response.InfraInAuthTypeId == 1 && response.InfraIn2FaTypeId != null && response.InfraIn2FaTypeId == 1 && response.Is2FaEnabled) {
|
|
573
|
+
//Inicializar Autenticação Local 2 Fatores via Email
|
|
574
|
+
this._authStorageService.logout();
|
|
575
|
+
this._authStorageService.ip = this.ip;
|
|
576
|
+
this._authStorageService.tenantId = response.TenantId;
|
|
577
|
+
this._authStorageService.infraUsuarioId = response.InfraUsuarioId;
|
|
578
|
+
this._authStorageService.user = login.usuario;
|
|
579
|
+
this._authStorageService.userName = response.UserName;
|
|
580
|
+
this._authStorageService.dominio = response.Dominio;
|
|
581
|
+
this._authStorageService.isExternalLogin = false;
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
this._authStorageService.ignoreCheckLogin = true;
|
|
585
|
+
this._authStorageService.isLoggedInSub.next(true);
|
|
586
|
+
this._authStorageService.ip = this.ip;
|
|
587
|
+
this._authStorageService.tenantId = response.TenantId;
|
|
588
|
+
this._authStorageService.infraUsuarioId = response.InfraUsuarioId;
|
|
589
|
+
this._authStorageService.infraEstabId = response.EstabelecimentoId;
|
|
590
|
+
this._authStorageService.infraEstabNome = response.NomeEstabelecimento;
|
|
591
|
+
this._authStorageService.infraEmpresaId = response.EmpresaId;
|
|
592
|
+
this._authStorageService.infraEmpresaNome = response.NomeEmpresa;
|
|
593
|
+
this._authStorageService.user = login.usuario;
|
|
594
|
+
this._authStorageService.userName = response.UserName;
|
|
595
|
+
this._authStorageService.authToken = response.Token;
|
|
596
|
+
this._authStorageService.dominio = response.Dominio;
|
|
597
|
+
this._authStorageService.isExternalLogin = false;
|
|
598
|
+
// Método com customizações para inicializações do Login
|
|
599
|
+
this._customLoginService.authLogin();
|
|
600
|
+
if (this._authStorageService.urlRedirect == '' || this._authStorageService.urlRedirect == '/' || this._authStorageService.urlRedirect == '/auth/login') {
|
|
601
|
+
// Método com customizações para redirecionamento da tela inicial após login ok
|
|
602
|
+
this._customLoginService.authNavigateToPage(this._router);
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
this._router.navigate([this._authStorageService.urlRedirect]);
|
|
606
|
+
}
|
|
607
|
+
this._authStorageService.urlRedirect = "/";
|
|
608
|
+
}
|
|
609
|
+
}));
|
|
610
|
+
}
|
|
611
|
+
loginExternal(dominio, user, password) {
|
|
612
|
+
let login = {
|
|
613
|
+
usuario: user,
|
|
614
|
+
senha: password
|
|
615
|
+
};
|
|
616
|
+
const params = new HttpParams()
|
|
617
|
+
.set('dominio', dominio);
|
|
618
|
+
const url = `${this._BASE_URL}/ValidateExternalLogin`;
|
|
619
|
+
const headers = this._HTTP_HEADERS;
|
|
620
|
+
return this._httpClient
|
|
621
|
+
.post(url, login, { 'params': params, 'headers': headers })
|
|
622
|
+
.pipe(take$1(1), tap$1((response) => {
|
|
623
|
+
if (!response.Error) {
|
|
624
|
+
this._authStorageService.isLoggedInSub.next(true);
|
|
625
|
+
this._authStorageService.ip = this.ip;
|
|
626
|
+
this._authStorageService.tenantId = response.TenantId;
|
|
627
|
+
this._authStorageService.infraUsuarioId = response.InfraUsuarioId;
|
|
628
|
+
this._authStorageService.infraEstabId = response.EstabelecimentoId;
|
|
629
|
+
this._authStorageService.infraEstabNome = response.NomeEstabelecimento;
|
|
630
|
+
this._authStorageService.infraEmpresaId = response.EmpresaId;
|
|
631
|
+
this._authStorageService.infraEmpresaNome = response.NomeEmpresa;
|
|
632
|
+
this._authStorageService.user = login.usuario;
|
|
633
|
+
this._authStorageService.userName = response.UserName;
|
|
634
|
+
this._authStorageService.authToken = response.Token;
|
|
635
|
+
this._authStorageService.dominio = response.Dominio;
|
|
636
|
+
this._authStorageService.isExternalLogin = true;
|
|
637
|
+
}
|
|
638
|
+
}), map((response) => {
|
|
639
|
+
return response.Error;
|
|
640
|
+
}));
|
|
641
|
+
}
|
|
642
|
+
logout() {
|
|
643
|
+
this._authStorageService.logout();
|
|
644
|
+
localStorage.removeItem('configsServerUser');
|
|
645
|
+
localStorage.removeItem('configsServerPassword');
|
|
646
|
+
// Método com customizações para inicializações do Logout
|
|
647
|
+
this._customLoginService.authLogout();
|
|
648
|
+
this._router.navigate(["/auth/login"]);
|
|
649
|
+
}
|
|
650
|
+
validateAuthentication2Fa(code) {
|
|
651
|
+
let Code2Fa = {
|
|
652
|
+
infraUsuarioId: this._authStorageService.infraUsuarioId,
|
|
653
|
+
code: code
|
|
654
|
+
};
|
|
655
|
+
const params = new HttpParams()
|
|
656
|
+
.set('domain', this._authStorageService.dominio)
|
|
657
|
+
.set('user', this._authStorageService.user)
|
|
658
|
+
.set('userName', this._authStorageService.userName);
|
|
659
|
+
const url = `${this._BASE_URL}/ValidadeLogin2FaWithEmail`;
|
|
660
|
+
const headers = this._HTTP_HEADERS;
|
|
661
|
+
return this._httpClient
|
|
662
|
+
.post(url, Code2Fa, { 'params': params, 'headers': headers })
|
|
663
|
+
.pipe(take$1(1), tap$1((response) => {
|
|
664
|
+
if (response.Error) {
|
|
665
|
+
throw Error(response.ErrorMessage);
|
|
666
|
+
}
|
|
667
|
+
this._authStorageService.ignoreCheckLogin = true;
|
|
668
|
+
this._authStorageService.isLoggedInSub.next(true);
|
|
669
|
+
this._authStorageService.ip = this.ip;
|
|
670
|
+
this._authStorageService.tenantId = response.TenantId;
|
|
671
|
+
this._authStorageService.infraUsuarioId = response.InfraUsuarioId;
|
|
672
|
+
this._authStorageService.infraEstabId = response.EstabelecimentoId;
|
|
673
|
+
this._authStorageService.infraEstabNome = response.NomeEstabelecimento;
|
|
674
|
+
this._authStorageService.infraEmpresaId = response.EmpresaId;
|
|
675
|
+
this._authStorageService.infraEmpresaNome = response.NomeEmpresa;
|
|
676
|
+
this._authStorageService.user = this._authStorageService.user;
|
|
677
|
+
this._authStorageService.userName = response.UserName;
|
|
678
|
+
this._authStorageService.authToken = response.Token;
|
|
679
|
+
this._authStorageService.dominio = response.Dominio;
|
|
680
|
+
this._authStorageService.isExternalLogin = false;
|
|
681
|
+
// Método com customizações para inicializações do Login
|
|
682
|
+
this._customLoginService.authLogin();
|
|
683
|
+
if (this._authStorageService.urlRedirect == '' || this._authStorageService.urlRedirect == '/' || this._authStorageService.urlRedirect == '/auth/login') {
|
|
684
|
+
// Método com customizações para redirecionamento da tela inicial após login ok
|
|
685
|
+
this._customLoginService.authNavigateToPage(this._router);
|
|
686
|
+
}
|
|
687
|
+
else {
|
|
688
|
+
this._router.navigate([this._authStorageService.urlRedirect]);
|
|
689
|
+
}
|
|
690
|
+
this._authStorageService.urlRedirect = "/";
|
|
691
|
+
}));
|
|
692
|
+
}
|
|
693
|
+
GetNewCode2Fa() {
|
|
694
|
+
const params = new HttpParams()
|
|
695
|
+
.set('domain', this._authStorageService.dominio)
|
|
696
|
+
.set('user', this._authStorageService.user)
|
|
697
|
+
.set('ip', this.ip)
|
|
698
|
+
.set('browse', `${this._ipServiceService.getDataBrowserUser().browser} - ${this._ipServiceService.getDataBrowserUser().so}`)
|
|
699
|
+
.set('localization', `${this.city}, ${this.state}, ${this.country}`);
|
|
700
|
+
const url = `${this._BASE_URL}/GetNewCode2FaWithEmail`;
|
|
701
|
+
const headers = this._HTTP_HEADERS;
|
|
702
|
+
return this._httpClient
|
|
703
|
+
.post(url, null, { 'params': params, 'headers': headers })
|
|
704
|
+
.pipe(take$1(1), tap$1((response) => {
|
|
705
|
+
if (response.Error) {
|
|
706
|
+
throw Error(response.ErrorMessage);
|
|
707
|
+
}
|
|
708
|
+
}));
|
|
709
|
+
}
|
|
710
|
+
forgottenPassword(parms) {
|
|
711
|
+
this._authStorageService.logout();
|
|
712
|
+
const params = new HttpParams()
|
|
713
|
+
.set('domain', parms.dominioFgtPsw)
|
|
714
|
+
.set('user', parms.usuarioFgtPsw)
|
|
715
|
+
.set('urlServidor', this.geHostName())
|
|
716
|
+
.set('ip', this.ip)
|
|
717
|
+
.set('browse', `${this._ipServiceService.getDataBrowserUser().browser} - ${this._ipServiceService.getDataBrowserUser().so}`)
|
|
718
|
+
.set('localization', `${this.city}, ${this.state}, ${this.country}`);
|
|
719
|
+
const headers = this._HTTP_HEADERS;
|
|
720
|
+
const url = `${this._BASE_URL}/ForgottenPassword`;
|
|
721
|
+
return this._httpClient
|
|
722
|
+
.post(url, null, { 'params': params, 'headers': headers })
|
|
723
|
+
.pipe(take$1(1), tap$1((response) => {
|
|
724
|
+
if (response.Error) {
|
|
725
|
+
throw Error(response.ErrorMessage);
|
|
726
|
+
}
|
|
727
|
+
}));
|
|
728
|
+
}
|
|
729
|
+
recoverPassword(dominio, usuario, parms) {
|
|
730
|
+
let recupPassword = {
|
|
731
|
+
password: parms.password,
|
|
732
|
+
confirmPassword: parms.confirmPassword,
|
|
733
|
+
code: parms.code
|
|
734
|
+
};
|
|
735
|
+
const params = new HttpParams()
|
|
736
|
+
.set('domain', dominio)
|
|
737
|
+
.set('user', usuario);
|
|
738
|
+
const headers = this._HTTP_HEADERS;
|
|
739
|
+
const url = `${this._BASE_URL}/RecoverPassword`;
|
|
740
|
+
return this._httpClient
|
|
741
|
+
.post(url, recupPassword, { 'params': params, 'headers': headers })
|
|
742
|
+
.pipe(take$1(1), tap$1((response) => {
|
|
743
|
+
if (response.Error) {
|
|
744
|
+
throw Error(response.ErrorMessage);
|
|
745
|
+
}
|
|
746
|
+
}));
|
|
747
|
+
}
|
|
748
|
+
createPassword(dominio, usuario, parms) {
|
|
749
|
+
let recupPassword = {
|
|
750
|
+
password: parms.password,
|
|
751
|
+
confirmPassword: parms.confirmPassword,
|
|
752
|
+
code: parms.code
|
|
753
|
+
};
|
|
754
|
+
const params = new HttpParams()
|
|
755
|
+
.set('domain', dominio)
|
|
756
|
+
.set('user', usuario);
|
|
757
|
+
const headers = this._HTTP_HEADERS;
|
|
758
|
+
const url = `${this._BASE_URL}/CreatePassword`;
|
|
759
|
+
return this._httpClient
|
|
760
|
+
.post(url, recupPassword, { 'params': params, 'headers': headers })
|
|
761
|
+
.pipe(take$1(1), tap$1((response) => {
|
|
762
|
+
if (response.Error) {
|
|
763
|
+
throw Error(response.ErrorMessage);
|
|
764
|
+
}
|
|
765
|
+
}));
|
|
766
|
+
}
|
|
767
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: i1$1.Router }, { token: AuthStorageService }, { token: LibCustomLoginService }, { token: i5.IpServiceService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
768
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, providedIn: 'root' }); }
|
|
769
|
+
}
|
|
770
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, decorators: [{
|
|
771
|
+
type: Injectable,
|
|
772
|
+
args: [{ providedIn: 'root' }]
|
|
773
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.Router }, { type: AuthStorageService }, { type: LibCustomLoginService }, { type: i5.IpServiceService }] });
|
|
774
|
+
|
|
775
|
+
class ServerService {
|
|
776
|
+
constructor(_httpClient) {
|
|
777
|
+
this._httpClient = _httpClient;
|
|
778
|
+
// private readonly _HOSTNAME: any = window.location.hostname.includes("localhost")
|
|
779
|
+
// ? `http://${window.location.hostname}`
|
|
780
|
+
// : `https://${window.location.hostname}`;
|
|
781
|
+
this._HOSTNAME = "https://siscandesv6.sispro.com.br";
|
|
782
|
+
this._BASE_URL = `${this._HOSTNAME}/SisproErpCloud/Service_Private/Infra/SpInfra2ConfigWS/api/Config`;
|
|
783
|
+
this._HTTP_HEADERS = new HttpHeaders().set('Content-Type', 'application/json');
|
|
784
|
+
this._BASE_URL.includes("localhost") || this._BASE_URL.includes('127.0.0.1')
|
|
785
|
+
? this._BASE_URL
|
|
786
|
+
: this._BASE_URL = "https://siscandesv6.sispro.com.br/SisproErpCloud/Service_Private/Infra/SpInfra2ConfigWS/api/Config";
|
|
787
|
+
}
|
|
788
|
+
// #region GET Server
|
|
789
|
+
getServer() {
|
|
790
|
+
const url = `${this._BASE_URL}/GetConfig`;
|
|
791
|
+
return this._httpClient
|
|
792
|
+
.post(url, null, { 'headers': this._HTTP_HEADERS })
|
|
793
|
+
.pipe(take(1), tap(response => {
|
|
794
|
+
localStorage.setItem('configServerUser', response.User);
|
|
795
|
+
localStorage.setItem('configServerPassword', response.Password);
|
|
796
|
+
}));
|
|
797
|
+
}
|
|
798
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ServerService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
799
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ServerService, providedIn: 'root' }); }
|
|
800
|
+
}
|
|
801
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ServerService, decorators: [{
|
|
802
|
+
type: Injectable,
|
|
803
|
+
args: [{
|
|
804
|
+
providedIn: 'root'
|
|
805
|
+
}]
|
|
806
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
807
|
+
|
|
808
|
+
/**Service responsável por pegar as opções do menu do projeto em que está sendo utilizada*/
|
|
809
|
+
class EnvironmentService {
|
|
810
|
+
constructor() {
|
|
811
|
+
this.production = false;
|
|
812
|
+
this.hostName = "https://siscandesv6.sispro.com.br";
|
|
813
|
+
}
|
|
814
|
+
ConfigurarEnvironments(propriedades) {
|
|
815
|
+
//passando propriedades do produto para a lib
|
|
816
|
+
this.needsAuthAplic = propriedades.needsAuthAplic;
|
|
817
|
+
this.needsAuthInfra = propriedades.needsAuthInfra;
|
|
818
|
+
}
|
|
819
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EnvironmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
820
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EnvironmentService, providedIn: 'root' }); }
|
|
821
|
+
}
|
|
822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EnvironmentService, decorators: [{
|
|
823
|
+
type: Injectable,
|
|
824
|
+
args: [{ providedIn: 'root' }]
|
|
825
|
+
}] });
|
|
826
|
+
|
|
827
|
+
class LoginComponent {
|
|
828
|
+
constructor(
|
|
829
|
+
//public _customLoginService: CustomLoginService,
|
|
830
|
+
_bsModalService, _messageService, _formBuilder, _authService, _serverService, _environmentService, _authStorageService, _customLoginService, _title, _router, _toastrService) {
|
|
831
|
+
this._bsModalService = _bsModalService;
|
|
832
|
+
this._messageService = _messageService;
|
|
833
|
+
this._formBuilder = _formBuilder;
|
|
834
|
+
this._authService = _authService;
|
|
835
|
+
this._serverService = _serverService;
|
|
836
|
+
this._environmentService = _environmentService;
|
|
837
|
+
this._authStorageService = _authStorageService;
|
|
838
|
+
this._customLoginService = _customLoginService;
|
|
839
|
+
this._title = _title;
|
|
840
|
+
this._router = _router;
|
|
841
|
+
this._toastrService = _toastrService;
|
|
842
|
+
// #region ==========> PROPERTIES <==========
|
|
843
|
+
// #region PRIVATE
|
|
844
|
+
this.idFgtPsw = 1;
|
|
845
|
+
// Variáveis específicas para funcionalidades padrões dos formulários
|
|
846
|
+
this.currentTime = new Date();
|
|
847
|
+
this.year = this.currentTime.getFullYear();
|
|
848
|
+
this.isLoading = false;
|
|
849
|
+
this.isLoadingSendAuthentication2Fa = false;
|
|
850
|
+
this.showParmsAuthentication2Fa = false;
|
|
851
|
+
this.isLoadingGetNewCode = false;
|
|
852
|
+
//propriedades que vão receber os valores do customLoginService ####VERIFICAR DEPOIS####
|
|
853
|
+
// @Input() customPropriedadesLogin?: CustomPropriedadesLogin;
|
|
854
|
+
// #endregion PUBLIC
|
|
855
|
+
// #region Timer
|
|
856
|
+
this._subscription = new Subscription();
|
|
857
|
+
this.timerDuration = 90;
|
|
858
|
+
this.secondsLeft = this.timerDuration;
|
|
859
|
+
this.countdown$ = timer(0, 1000).pipe(take(this.timerDuration + 1), map$1(secondsElapsed => this.timerDuration - secondsElapsed));
|
|
860
|
+
// #endregion Timer
|
|
861
|
+
// #region ==========> FORM BUILDER <==========
|
|
862
|
+
this.form = new FormGroup({});
|
|
863
|
+
this.formFgtPsw = new FormGroup({});
|
|
864
|
+
this.formAuthentication2Fa = new FormGroup({});
|
|
865
|
+
}
|
|
866
|
+
;
|
|
867
|
+
;
|
|
868
|
+
// Propriedade necessário para que a classe static FormUtils possa ser utilizada no Html
|
|
869
|
+
get FormUtils() {
|
|
870
|
+
return FormUtils;
|
|
871
|
+
}
|
|
872
|
+
// #region FORM DATA
|
|
873
|
+
// Variáveis específicas para funcionalidades padrões dos formulários (Login)
|
|
874
|
+
get dominio() {
|
|
875
|
+
return this.form.get('dominio')?.value;
|
|
876
|
+
}
|
|
877
|
+
get usuario() {
|
|
878
|
+
return this.form.get('usuario')?.value;
|
|
879
|
+
}
|
|
880
|
+
get senha() {
|
|
881
|
+
return this.form.get('senha')?.value;
|
|
882
|
+
}
|
|
883
|
+
// Variáveis específicas para funcionalidades padrões dos formulários (RequestRecoverPassword)
|
|
884
|
+
get dominioFgtPsw() {
|
|
885
|
+
return this.formFgtPsw.get('dominioFgtPsw')?.value;
|
|
886
|
+
}
|
|
887
|
+
get usuarioFgtPsw() {
|
|
888
|
+
return this.formFgtPsw.get('usuarioFgtPsw')?.value;
|
|
889
|
+
}
|
|
890
|
+
// Variáveis específicas para funcionalidades padrões dos formulários (Autenticação 2 Fatores)
|
|
891
|
+
get code() {
|
|
892
|
+
return this.formAuthentication2Fa.get('code')?.value;
|
|
893
|
+
}
|
|
894
|
+
// #endregion FORM DATA
|
|
895
|
+
// #endregion ==========> PROPERTIES <==========
|
|
896
|
+
ngOnInit() {
|
|
897
|
+
this._title.setTitle(this._customLoginService.loginPageTitle);
|
|
898
|
+
if (this._customLoginService.loginTitle != "") {
|
|
899
|
+
document.getElementById("title").innerHTML = this._customLoginService.loginTitle;
|
|
900
|
+
}
|
|
901
|
+
if (this._customLoginService.loginSubtitle != "") {
|
|
902
|
+
document.getElementById("subtitle").innerHTML = this._customLoginService.loginSubtitle;
|
|
903
|
+
}
|
|
904
|
+
this.createForm();
|
|
905
|
+
}
|
|
906
|
+
// #region FORM VALIDATORS
|
|
907
|
+
// Método para configuração dos campos de edição do formulário (Login)
|
|
908
|
+
createForm() {
|
|
909
|
+
// Dados originais de Login
|
|
910
|
+
if (this._environmentService.production) {
|
|
911
|
+
this.form = this._formBuilder.group({
|
|
912
|
+
dominio: ['', [Validators.required, Validators.maxLength(50)]],
|
|
913
|
+
usuario: ['', [Validators.required, Validators.maxLength(100)]],
|
|
914
|
+
senha: ['', [Validators.required, Validators.maxLength(100)]]
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
else {
|
|
918
|
+
this.form = this._formBuilder.group({
|
|
919
|
+
dominio: [this._customLoginService.loginDesenvDomain, [Validators.required, Validators.maxLength(50)]],
|
|
920
|
+
usuario: [this._customLoginService.loginDesenvUser, [Validators.required, Validators.maxLength(100)]],
|
|
921
|
+
senha: [this._customLoginService.loginDesenvPassword, [Validators.required, Validators.maxLength(100)]]
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
// Método para configuração dos campos de edição do formulário (RequestRecoverPassword)
|
|
926
|
+
createFormForgottenPassword() {
|
|
927
|
+
this.formFgtPsw = this._formBuilder.group({
|
|
928
|
+
dominioFgtPsw: ['', [Validators.required, Validators.maxLength(50)]],
|
|
929
|
+
usuarioFgtPsw: ['', [Validators.required, Validators.maxLength(100)]],
|
|
930
|
+
});
|
|
931
|
+
this.formFgtPsw.get('recoverCdominioFgtPswodeRecPsw')?.setValue('');
|
|
932
|
+
this.formFgtPsw.get('usuarioFgtPsw')?.setValue('');
|
|
933
|
+
}
|
|
934
|
+
// Método para configuração dos campos de edição do formulário (Autenticação 2 Fatores)
|
|
935
|
+
createFormAuthentication2Fa() {
|
|
936
|
+
this.formAuthentication2Fa = this._formBuilder.group({
|
|
937
|
+
code: ['', [Validators.required, Validators.maxLength(6)]],
|
|
938
|
+
});
|
|
939
|
+
this.form.get('code')?.setValue('');
|
|
940
|
+
}
|
|
941
|
+
// #endregion FORM VALIDATORS
|
|
942
|
+
// #endregion ==========> FORM BUILDER <==========
|
|
943
|
+
// #region ==========> SERVICE METHODS <==========
|
|
944
|
+
// #region GET
|
|
945
|
+
// Obtém a Url do Config Erp
|
|
946
|
+
geturlErpConfig() {
|
|
947
|
+
// verificar depois
|
|
948
|
+
return `${this._environmentService.hostName}/SisproErpCloud/ConfigErp`;
|
|
949
|
+
}
|
|
950
|
+
/*
|
|
951
|
+
* Obtém os parâmetros de configuração do servidor para Autenticação Básica de segurança
|
|
952
|
+
*/
|
|
953
|
+
getServer() {
|
|
954
|
+
if (this.form.valid) {
|
|
955
|
+
this.isLoading = true;
|
|
956
|
+
this._serverService.getServer().subscribe({
|
|
957
|
+
next: response => {
|
|
958
|
+
this.logOn();
|
|
959
|
+
},
|
|
960
|
+
error: (error) => {
|
|
961
|
+
this.isLoading = false;
|
|
962
|
+
//this._projectUtilservice.showHttpError(error);
|
|
963
|
+
this._messageService.showAlertDanger(error);
|
|
964
|
+
//pode ser substituido por console.error
|
|
965
|
+
throw new Error(error);
|
|
966
|
+
},
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
else {
|
|
970
|
+
FormUtils.validateFields(this.form);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
// #endregion GET
|
|
974
|
+
// #region POST
|
|
975
|
+
// Executa o Login
|
|
976
|
+
logOn() {
|
|
977
|
+
this._authService.login(this.form.value).subscribe({
|
|
978
|
+
next: (response) => {
|
|
979
|
+
this.isLoading = false;
|
|
980
|
+
if (response.FeedbackMessage != "") {
|
|
981
|
+
this._toastrService.warning(response.FeedbackMessage, '', {
|
|
982
|
+
timeOut: 3000,
|
|
983
|
+
extendedTimeOut: 2000
|
|
984
|
+
});
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
//Incialização de Senha
|
|
988
|
+
if (response.InitializePassword) {
|
|
989
|
+
let param = btoa(`true$${this.dominio}$${this.usuario}`);
|
|
990
|
+
this._router.navigate([`auth/login/novaSenha/${param}`]);
|
|
991
|
+
this._toastrService.success("Verifique no seu e-mail o código de validação.");
|
|
992
|
+
}
|
|
993
|
+
if (response.InfraInAuthTypeId == 1 && response.InfraIn2FaTypeId != null && response.InfraIn2FaTypeId == 1 && response.Is2FaEnabled) {
|
|
994
|
+
this.createFormAuthentication2Fa();
|
|
995
|
+
this._subscription = this.countdown$.subscribe(secondsLeft => {
|
|
996
|
+
this.secondsLeft = secondsLeft;
|
|
997
|
+
});
|
|
998
|
+
this.showParmsAuthentication2Fa = true;
|
|
999
|
+
this._toastrService.success("Verifique no seu e-mail o código de validação.");
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
error: (error) => {
|
|
1003
|
+
this.isLoading = false;
|
|
1004
|
+
//this._projectUtilservice.showHttpError(error);
|
|
1005
|
+
this._messageService.showAlertDanger(error);
|
|
1006
|
+
throw new Error(error);
|
|
1007
|
+
},
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
// Envia requisição para esquecer senha
|
|
1011
|
+
sendForgottenPassword() {
|
|
1012
|
+
if (this.formFgtPsw.valid) {
|
|
1013
|
+
this._serverService.getServer().subscribe({
|
|
1014
|
+
next: response => {
|
|
1015
|
+
this.forgottenPassword();
|
|
1016
|
+
},
|
|
1017
|
+
error: (error) => {
|
|
1018
|
+
//this._projectUtilservice.showHttpError(error);
|
|
1019
|
+
this._messageService.showAlertDanger(error);
|
|
1020
|
+
throw new Error(error);
|
|
1021
|
+
},
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
else {
|
|
1025
|
+
FormUtils.validateFields(this.formFgtPsw);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
// Requisição para esquecer senha
|
|
1029
|
+
forgottenPassword() {
|
|
1030
|
+
this._authService.forgottenPassword(this.formFgtPsw.value).subscribe({
|
|
1031
|
+
next: (response) => {
|
|
1032
|
+
this.closeForgottenPasswordModal();
|
|
1033
|
+
let param = btoa(`false$${this.dominio}$${this.usuario}$${3}`);
|
|
1034
|
+
this._router.navigate([`auth/login/novaSenha/${param}`]);
|
|
1035
|
+
this._toastrService.success("Verifique no seu e-mail o código de validação.");
|
|
1036
|
+
},
|
|
1037
|
+
error: (error) => {
|
|
1038
|
+
//this._projectUtilservice.showHttpError(error);
|
|
1039
|
+
this._messageService.showAlertDanger(error);
|
|
1040
|
+
throw new Error(error);
|
|
1041
|
+
},
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
// Envia requisição para validar código 2 fatores
|
|
1045
|
+
sendCode() {
|
|
1046
|
+
if (this.formAuthentication2Fa.valid) {
|
|
1047
|
+
this.isLoadingSendAuthentication2Fa = true;
|
|
1048
|
+
this.validateCode();
|
|
1049
|
+
}
|
|
1050
|
+
else {
|
|
1051
|
+
FormUtils.validateFields(this.formAuthentication2Fa);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
// Validação do código 2 fatores
|
|
1055
|
+
validateCode() {
|
|
1056
|
+
this._authService.validateAuthentication2Fa(this.code).subscribe({
|
|
1057
|
+
next: (response) => {
|
|
1058
|
+
this._subscription.unsubscribe();
|
|
1059
|
+
this.isLoadingSendAuthentication2Fa = false;
|
|
1060
|
+
},
|
|
1061
|
+
error: (error) => {
|
|
1062
|
+
this.isLoadingSendAuthentication2Fa = false;
|
|
1063
|
+
//this._projectUtilservice.showHttpError(error);
|
|
1064
|
+
this._messageService.showAlertDanger(error);
|
|
1065
|
+
throw new Error(error);
|
|
1066
|
+
},
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
// Envia requisição para validar código 2 fatores
|
|
1070
|
+
getNewCode() {
|
|
1071
|
+
this.isLoadingGetNewCode = true;
|
|
1072
|
+
this._serverService.getServer().subscribe({
|
|
1073
|
+
next: response => {
|
|
1074
|
+
this._subscription = this.countdown$.subscribe(secondsLeft => {
|
|
1075
|
+
this.secondsLeft = secondsLeft;
|
|
1076
|
+
});
|
|
1077
|
+
this.GetNewCode2Fa();
|
|
1078
|
+
},
|
|
1079
|
+
error: (error) => {
|
|
1080
|
+
//this._projectUtilservice.showHttpError(error);
|
|
1081
|
+
this._messageService.showAlertDanger(error);
|
|
1082
|
+
throw new Error(error);
|
|
1083
|
+
},
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
// Validação do código 2 fatores
|
|
1087
|
+
GetNewCode2Fa() {
|
|
1088
|
+
this._authService.GetNewCode2Fa().subscribe({
|
|
1089
|
+
next: (response) => {
|
|
1090
|
+
this.isLoadingGetNewCode = false;
|
|
1091
|
+
this._toastrService.success("Enviamos um novo código para o endereço de e-mail vinculado ao seu usuário. Verifique o lixo eletrônico (SPAM) da sua caixa de entrada, caso não tenha encontrado nossa mensagem.");
|
|
1092
|
+
},
|
|
1093
|
+
error: (error) => {
|
|
1094
|
+
this.isLoadingGetNewCode = false;
|
|
1095
|
+
//this._projectUtilservice.showHttpError(error);
|
|
1096
|
+
this._messageService.showAlertDanger(error);
|
|
1097
|
+
throw new Error(error);
|
|
1098
|
+
},
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
// #endregion POST
|
|
1102
|
+
// #region UTILIDADES
|
|
1103
|
+
// Retorno para a tela de login
|
|
1104
|
+
voltar() {
|
|
1105
|
+
this._subscription.unsubscribe();
|
|
1106
|
+
this.showParmsAuthentication2Fa = false;
|
|
1107
|
+
this._authStorageService.logout();
|
|
1108
|
+
this._router.navigate(["/auth/login"]);
|
|
1109
|
+
}
|
|
1110
|
+
// #endregion UTILIDADES
|
|
1111
|
+
// #endregion ==========> SERVICE METHODS <==========
|
|
1112
|
+
// #region ==========> MODALS <==========
|
|
1113
|
+
// Executa esquecer senha
|
|
1114
|
+
openForgottenPasswordModal(template) {
|
|
1115
|
+
this.createFormForgottenPassword();
|
|
1116
|
+
this.modalRef = this._bsModalService.show(template, {
|
|
1117
|
+
class: 'modal-dialog-centered',
|
|
1118
|
+
ignoreBackdropClick: false,
|
|
1119
|
+
keyboard: false,
|
|
1120
|
+
id: this.idFgtPsw
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
// Encerra esquecer senha
|
|
1124
|
+
closeForgottenPasswordModal() {
|
|
1125
|
+
this._bsModalService.hide(this.idFgtPsw);
|
|
1126
|
+
}
|
|
1127
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LoginComponent, deps: [{ token: i1$2.BsModalService }, { token: i5.MessageService }, { token: i3.FormBuilder }, { token: AuthService }, { token: ServerService }, { token: EnvironmentService }, { token: AuthStorageService }, { token: LibCustomLoginService }, { token: i9.Title }, { token: i1$1.Router }, { token: i11.ToastrService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1128
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: LoginComponent, selector: "lib-login", ngImport: i0, template: "<div class=\"container-fluid\">\r\n\t<div class=\"row\">\r\n\t\t<!-- Conte\u00FAdo da DIV do background -->\r\n\t\t<div class=\"col-md-7\">\r\n\t\t\t<div class=\"background\" style=\"background-image: linear-gradient(to bottom, rgba(10, 44, 81, 0.9), rgba(10, 44, 81, 0.9)), url({{_customLoginService.loginBackground}})\">\r\n\t\t\t\t<div class=\"text-position texto-apresentacao ps-5\">\r\n\t\t\t\t\t<h1 class=\"title\" id=\"title\"></h1>\r\n\t\t\t\t\t<p class=\"subtitle\" id=\"subtitle\"></p>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<!-- Conte\u00FAdo da DIV de Login -->\r\n\t\t<div class=\"col-md-5\">\r\n\r\n\t\t\t<div class=\"div-size\">\r\n\t\t\t\t<div class=\"logotipo\">\r\n\t\t\t\t\t<img style=\"height: 95px;\" src=\"{{ this._customLoginService.loginLogotipo }}\" alt=\"{{ this._customLoginService.loginAltLogotipo }}\" />\r\n\t\t\t\t</div>\r\n\t\t\t\t<form *ngIf=\"!showParmsAuthentication2Fa; else Authentication2Fa\" [formGroup]=\"form\" class=\"form-position\">\r\n\t\t\t\t\t<div class=\"input-group input-group-lg form-item\">\r\n\t\t\t\t\t\t<span class=\"input-group-text\" id=\"basic-addon1\"\r\n\t\t\t\t\t\t\tstyle=\"padding: 10px; border-radius: 4px 0px 0px 4px\">\r\n\t\t\t\t\t\t\t<img src=\"assets/icons/cloud.svg\" alt=\"cloud icon\" />\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" formControlName=\"dominio\" id=\"dominio\"\r\n\t\t\t\t\t\t\taria-label=\"Sizing example input\" placeholder=\"Dom\u00EDnio\" aria-label=\"Dom\u00EDnio\"\r\n\t\t\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('dominio'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('dominio')\" label=\"Dom\u00EDnio\"></app-field-error-message>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"input-group input-group-lg form-item\">\r\n\t\t\t\t\t\t<span class=\"input-group-text\" id=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\tstyle=\"padding: 10px; border-radius: 4px 0px 0px 4px\">\r\n\t\t\t\t\t\t\t<img src=\"assets/icons/at-sign.svg\" alt=\"at-sign icon\" />\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" formControlName=\"usuario\" id=\"usuario\"\r\n\t\t\t\t\t\t\taria-label=\"Sizing example input\" placeholder=\"Usu\u00E1rio\" aria-label=\"Usu\u00E1rio\"\r\n\t\t\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('usuario'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('usuario')\" label=\"Usu\u00E1rio\"></app-field-error-message>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"input-group input-group-lg form-item\" style=\"margin-bottom: 8px;\">\r\n\t\t\t\t\t\t<span class=\"input-group-text\" id=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\tstyle=\"padding: 10px; border-radius: 4px 0px 0px 4px;\">\r\n\t\t\t\t\t\t\t<img src=\"assets/icons/lock.svg\" alt=\"lock-icon\" />\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<input type=\"password\" class=\"form-control\" formControlName=\"senha\" id=\"senha\"\r\n\t\t\t\t\t\t\taria-label=\"Sizing example input\" placeholder=\"Senha\" aria-label=\"senha\"\r\n\t\t\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('senha'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('senha')\" label=\"Senha\"></app-field-error-message>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"remember-password\">\r\n\t\t\t\t\t<!-- Lembrar Senha\r\n\t\t\t\t\t\t<input id=\"checkboxLembrarSenha\" type=\"checkbox\" />\r\n\t\t\t\t\t\t<label for=\"checkboxLembrarSenha\"> Lembrar minha senha </label>\r\n \t\t\t\t\t-->\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<button [disabled]=\"isLoading\" (click)=\"getServer()\" type=\"submit\"\r\n\t\t\t\t\t\tclass=\"btn btn-primary btn-acessar btn-lg\">\r\n\t\t\t\t\t\t<app-loading-button [isLoading]=\"isLoading\"></app-loading-button>\r\n\t\t\t\t\t\t<span> Acessar </span>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t\t<button type=\"button\" (click)=\"openForgottenPasswordModal(forgottenPasswordModal)\" class=\"forgotten-password\">\r\n\t\t\t\t\t\t<span> Esqueceu sua senha? </span>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</form>\r\n\r\n\t\t\t\t<ng-template #Authentication2Fa>\r\n\t\t\t\t\t<form [formGroup]=\"formAuthentication2Fa\" class=\"form-position\">\r\n\t\t\t\t\t\t<div class=\"input-group input-group-lg form-item mb-3\">\r\n\t\t\t\t\t\t\t<span class=\"input-group-text\" id=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t\tstyle=\"padding: 10px; border-radius: 4px 0px 0px 4px;\">\r\n\t\t\t\t\t\t\t\t<img src=\"assets/icons/lock.svg\" alt=\"lock-icon\" />\r\n\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" formControlName=\"code\" id=\"code\"\r\n\t\t\t\t\t\t\t\taria-label=\"Sizing example input\" placeholder=\"C\u00F3digo de 2 fatores\" aria-label=\"C\u00F3digo de 2 fatores\"\r\n\t\t\t\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(formAuthentication2Fa.get('code'))\">\r\n\t\t\t\t\t\t\t<app-field-error-message [control]=\"formAuthentication2Fa.get('code')\" label=\"C\u00F3digo de 2 fatores\"></app-field-error-message>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"row mb-3\">\r\n\t\t\t\t\t\t\t<button (click)=\"voltar()\" type=\"button\" class=\"btn btn-acessar glb-btn-outline-dark-disabled col me-1\">\r\n\t\t\t\t\t\t\t\tVoltar\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t<button [disabled]=\"isLoadingSendAuthentication2Fa\" (click)=\"sendCode()\" type=\"button\" class=\"btn btn-acessar btn-primary col ms-1\">\r\n\t\t\t\t\t\t\t\t<app-loading-button [isLoading]=\"isLoadingSendAuthentication2Fa\"></app-loading-button>\r\n\t\t\t\t\t\t\t\tAcessar\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t\t<button *ngIf=\"secondsLeft == 0; else newCode\" \r\n\t\t\t\t\t\t\t\t[disabled]=\"isLoading\" (click)=\"getNewCode()\" type=\"button\" class=\"btn btn-acessar btn-outline-primary col\">\r\n\t\t\t\t\t\t\t\t<app-loading-button [isLoading]=\"isLoading\"></app-loading-button>\r\n\t\t\t\t\t\t\t\tEnviar novo c\u00F3digo\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t<ng-template #newCode>\r\n\t\t\t\t\t\t\t\t<p class=\"text-center\">{{ secondsLeft}} {{ secondsLeft == 1 ? 'segundo' : 'segundos' }} para obter novo c\u00F3digo</p>\r\n\t\t\t\t\t\t\t</ng-template>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</form>\t\r\n\t\t\t\t</ng-template>\r\n\t\t\t\t\r\n\t\t\t\t<div class=\"footer-position\">\r\n\t\t\t\t\t<footer>\r\n\t\t\t\t\t\t<span class=\"footer\"> \r\n\t\t\t\t\t\t\t<a href=\"https://dpo.privacytools.com.br/policy-view/JmGeNlJdw/1/poli%CC%81tica-de-privacidade/pt_BR?s=1685731510066\" target=\"_blank\" class=\"sispro text-primary\"> Pol\u00EDtica de Privacidade </a>\r\n\t\t\t\t\t\t\t<p class=\"separator\"> | </p>\r\n\t\t\t\t\t\t\t<a href=\"https://dpo.privacytools.com.br/policy-view/Rork35NN2/2/poli%CC%81tica-de-cookies/pt_BR?s=1685731551976\" target=\"_blank\" class=\"sispro text-primary\"> Pol\u00EDtica de Cookies </a>\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<span class=\"footer\"> Desenvolvido por \r\n\t\t\t\t\t\t\t<a href=\"https://www.sispro.com.br/\" target=\"_blank\" class=\"sispro text-primary\"> sispro s/a </a>\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<span class=\"footer\"> Servi\u00E7os e Tecnologia da informa\u00E7\u00E3o \u00A9 {{ year }} Todos os direitos reservados </span>\r\n\t\t\t\t\t\t\t<div class=\"icons\">\r\n\t\t\t\t\t\t\t\t<a href=\"https://pt-br.facebook.com/SisproERP/\" target=\"_blank\">\r\n\t\t\t\t\t\t\t\t\t<lib-icon class=\"text-primary\" iconName=\"facebook\" iconSize=\"medium-small\"/>\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t<a href=\"https://www.instagram.com/accounts/login/?next=/sispro_software/\" target=\"_blank\">\r\n\t\t\t\t\t\t\t\t\t<lib-icon class=\"text-primary\" iconName=\"instagram\" iconSize=\"medium-small\"/>\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t<a href=\"https://br.linkedin.com/company/sispro\" target=\"_blank\">\r\n\t\t\t\t\t\t\t\t\t<lib-icon class=\"text-primary\" iconName=\"linkedin\" iconSize=\"medium-small\"/>\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t<div class=\"d-flex justify-content-center\">\r\n\t\t\t\t\t\t\t\t<a [href]=\"geturlErpConfig()\" style=\"text-decoration: none; font-size: 12px;\">\r\n\t\t\t\t\t\t\t\t\tConfigurar ERP\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</footer>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n\r\n<!-- Template do modal de senha esquecida -->\r\n<ng-template #forgottenPasswordModal>\r\n\t<form [formGroup]=\"formFgtPsw\">\r\n\t\t<div class=\"modal-content\" style=\"box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.5);\">\r\n\t\t\t<div class=\"modal-header p-3\">\r\n\t\t\t\t<h4 class=\"modal-title\"> Recupera\u00E7\u00E3o de senha </h4>\r\n\t\t\t\t<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"\r\n\t\t\t\t\t(click)=\"closeForgottenPasswordModal()\">\r\n\t\t\t\t</button>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"modal-body\">\r\n\t\t\t\t<label for=\"inputDominioFgtPsw\" class=\"input-label\"> Dom\u00EDnio <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t<input type=\"text\" id=\"inputDominioFgtPsw\" formControlName=\"dominioFgtPsw\"\r\n\t\t\t\t\tclass=\"form-control input-text\" aria-label=\"Sizing example input\" aria-label=\"Dom\u00EDnio\"\r\n\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(formFgtPsw.get('dominioFgtPsw'))\">\r\n\t\t\t\t<app-field-error-message [control]=\"formFgtPsw.get('dominioFgtPsw')\" label=\"Dom\u00EDnio\"></app-field-error-message>\t\t\t\t\r\n\r\n\t\t\t\t<label for=\"inputUsuarioFgtPsw\" class=\"input-label\"> Usu\u00E1rio <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t<input type=\"text\" id=\"inputUsuarioFgtPsw\" formControlName=\"usuarioFgtPsw\"\r\n\t\t\t\t\tclass=\"form-control input-text\" aria-label=\"Sizing example input\" aria-label=\"Usu\u00E1rio\"\r\n\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(formFgtPsw.get('usuarioFgtPsw'))\">\r\n\t\t\t\t<app-field-error-message [control]=\"formFgtPsw.get('usuarioFgtPsw')\" label=\"Usu\u00E1rio\"></app-field-error-message>\t\t\t\t\r\n\t\t\r\n\t\t\t</div>\r\n\t\t\t<div class=\"modal-footer\">\r\n\t\t\t\t<button type=\"button\" class=\"btn glb-btn-dark-disabled modal-button\" (click)=\"closeForgottenPasswordModal()\">\r\n\t\t\t\t\t<span> Cancelar </span>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button type=\"button\" class=\"btn btn-primary modal-button\" (click)=\"sendForgottenPassword();\">\r\n\t\t\t\t\t<span> Continuar </span>\r\n\t\t\t\t</button>\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\t</form>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";*{padding:0;margin:0;font-family:Open Sans,sans-serif}.background{display:grid;height:100vh;align-content:center;background-size:cover;color:#f5f5f5;align-items:center;justify-content:center}.div-size{display:flex;flex-direction:column;justify-content:space-around;width:100%;height:100vh;align-items:center;background-color:#f5f5f5;box-shadow:0 0 15px #333}.title{font-size:3.5vw;text-transform:uppercase;font-weight:700}.subtitle{font-size:21px}.logotipo{display:flex;justify-content:center;margin-top:10%}.form-position{display:flex;flex-direction:column;align-content:center;width:378px}.form-item{margin-bottom:16px}.input-group-text{padding:10px 11px;border-radius:4px 0 0 4px}.remember-password{display:flex;align-items:center;margin-bottom:8px;justify-content:center}.remember-password label{margin-left:8px}.forgotten-password{background-color:#f5f5f5;border:none;text-decoration:underline;font-size:14px;box-shadow:none;margin-top:8px;cursor:pointer}.forgotten-password:focus{outline-style:none}.input-label{font-size:16px;padding:10px 0 8px 16px}.input-label:first-child{font-size:16px;padding-top:16px}.input-text{width:343px;height:38px;margin:0 0 10px 16px;padding:0 8px}.input-text:last-child{font-size:16px;margin-bottom:24px}.form-control{max-width:341px}.footer{display:flex;justify-content:center}.footer-position{font-size:14px;display:flex;justify-content:center;align-items:flex-end}.icons{display:flex;justify-content:center;align-items:center;margin-top:16px}.icons a{padding:4px}.icon-item{margin-left:24px;color:#007bff}.sispro{color:#2847a0;margin-left:5px;text-transform:uppercase;text-decoration:none;font-weight:700}.modal-footer{padding:0}.modal:before{content:\"\";display:inline-block;height:100%;vertical-align:middle}.modal-style{display:flex;align-items:center;justify-content:center}.modal-style h4{font-size:20px;font-weight:700;padding:10px}.modal-button{margin:16px 0;padding:7px 12px}.modal-button:last-child{margin-right:16px;margin-left:8px}.modal-close{display:flex;align-content:center;margin-right:10px;padding:6px}.col-md-7,.col-md-5{padding:0}.btn-acessar{height:48px;outline-style:none}.texto-apresentacao{align-items:start}.separator{margin-left:5px}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.FieldErrorMessageComponent, selector: "app-field-error-message, lib-error-message", inputs: ["customMessage", "control", "label"] }, { kind: "component", type: i5.LoadingButtonComponent, selector: "app-loading-button, lib-loading-button", inputs: ["isLoading"] }, { kind: "component", type: i5.LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }], preserveWhitespaces: true }); }
|
|
1129
|
+
}
|
|
1130
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LoginComponent, decorators: [{
|
|
1131
|
+
type: Component,
|
|
1132
|
+
args: [{ selector: 'lib-login', standalone: false, preserveWhitespaces: true, template: "<div class=\"container-fluid\">\r\n\t<div class=\"row\">\r\n\t\t<!-- Conte\u00FAdo da DIV do background -->\r\n\t\t<div class=\"col-md-7\">\r\n\t\t\t<div class=\"background\" style=\"background-image: linear-gradient(to bottom, rgba(10, 44, 81, 0.9), rgba(10, 44, 81, 0.9)), url({{_customLoginService.loginBackground}})\">\r\n\t\t\t\t<div class=\"text-position texto-apresentacao ps-5\">\r\n\t\t\t\t\t<h1 class=\"title\" id=\"title\"></h1>\r\n\t\t\t\t\t<p class=\"subtitle\" id=\"subtitle\"></p>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<!-- Conte\u00FAdo da DIV de Login -->\r\n\t\t<div class=\"col-md-5\">\r\n\r\n\t\t\t<div class=\"div-size\">\r\n\t\t\t\t<div class=\"logotipo\">\r\n\t\t\t\t\t<img style=\"height: 95px;\" src=\"{{ this._customLoginService.loginLogotipo }}\" alt=\"{{ this._customLoginService.loginAltLogotipo }}\" />\r\n\t\t\t\t</div>\r\n\t\t\t\t<form *ngIf=\"!showParmsAuthentication2Fa; else Authentication2Fa\" [formGroup]=\"form\" class=\"form-position\">\r\n\t\t\t\t\t<div class=\"input-group input-group-lg form-item\">\r\n\t\t\t\t\t\t<span class=\"input-group-text\" id=\"basic-addon1\"\r\n\t\t\t\t\t\t\tstyle=\"padding: 10px; border-radius: 4px 0px 0px 4px\">\r\n\t\t\t\t\t\t\t<img src=\"assets/icons/cloud.svg\" alt=\"cloud icon\" />\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" formControlName=\"dominio\" id=\"dominio\"\r\n\t\t\t\t\t\t\taria-label=\"Sizing example input\" placeholder=\"Dom\u00EDnio\" aria-label=\"Dom\u00EDnio\"\r\n\t\t\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('dominio'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('dominio')\" label=\"Dom\u00EDnio\"></app-field-error-message>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"input-group input-group-lg form-item\">\r\n\t\t\t\t\t\t<span class=\"input-group-text\" id=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\tstyle=\"padding: 10px; border-radius: 4px 0px 0px 4px\">\r\n\t\t\t\t\t\t\t<img src=\"assets/icons/at-sign.svg\" alt=\"at-sign icon\" />\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" formControlName=\"usuario\" id=\"usuario\"\r\n\t\t\t\t\t\t\taria-label=\"Sizing example input\" placeholder=\"Usu\u00E1rio\" aria-label=\"Usu\u00E1rio\"\r\n\t\t\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('usuario'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('usuario')\" label=\"Usu\u00E1rio\"></app-field-error-message>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"input-group input-group-lg form-item\" style=\"margin-bottom: 8px;\">\r\n\t\t\t\t\t\t<span class=\"input-group-text\" id=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\tstyle=\"padding: 10px; border-radius: 4px 0px 0px 4px;\">\r\n\t\t\t\t\t\t\t<img src=\"assets/icons/lock.svg\" alt=\"lock-icon\" />\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<input type=\"password\" class=\"form-control\" formControlName=\"senha\" id=\"senha\"\r\n\t\t\t\t\t\t\taria-label=\"Sizing example input\" placeholder=\"Senha\" aria-label=\"senha\"\r\n\t\t\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('senha'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('senha')\" label=\"Senha\"></app-field-error-message>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"remember-password\">\r\n\t\t\t\t\t<!-- Lembrar Senha\r\n\t\t\t\t\t\t<input id=\"checkboxLembrarSenha\" type=\"checkbox\" />\r\n\t\t\t\t\t\t<label for=\"checkboxLembrarSenha\"> Lembrar minha senha </label>\r\n \t\t\t\t\t-->\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<button [disabled]=\"isLoading\" (click)=\"getServer()\" type=\"submit\"\r\n\t\t\t\t\t\tclass=\"btn btn-primary btn-acessar btn-lg\">\r\n\t\t\t\t\t\t<app-loading-button [isLoading]=\"isLoading\"></app-loading-button>\r\n\t\t\t\t\t\t<span> Acessar </span>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t\t<button type=\"button\" (click)=\"openForgottenPasswordModal(forgottenPasswordModal)\" class=\"forgotten-password\">\r\n\t\t\t\t\t\t<span> Esqueceu sua senha? </span>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</form>\r\n\r\n\t\t\t\t<ng-template #Authentication2Fa>\r\n\t\t\t\t\t<form [formGroup]=\"formAuthentication2Fa\" class=\"form-position\">\r\n\t\t\t\t\t\t<div class=\"input-group input-group-lg form-item mb-3\">\r\n\t\t\t\t\t\t\t<span class=\"input-group-text\" id=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t\tstyle=\"padding: 10px; border-radius: 4px 0px 0px 4px;\">\r\n\t\t\t\t\t\t\t\t<img src=\"assets/icons/lock.svg\" alt=\"lock-icon\" />\r\n\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" formControlName=\"code\" id=\"code\"\r\n\t\t\t\t\t\t\t\taria-label=\"Sizing example input\" placeholder=\"C\u00F3digo de 2 fatores\" aria-label=\"C\u00F3digo de 2 fatores\"\r\n\t\t\t\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(formAuthentication2Fa.get('code'))\">\r\n\t\t\t\t\t\t\t<app-field-error-message [control]=\"formAuthentication2Fa.get('code')\" label=\"C\u00F3digo de 2 fatores\"></app-field-error-message>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"row mb-3\">\r\n\t\t\t\t\t\t\t<button (click)=\"voltar()\" type=\"button\" class=\"btn btn-acessar glb-btn-outline-dark-disabled col me-1\">\r\n\t\t\t\t\t\t\t\tVoltar\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t<button [disabled]=\"isLoadingSendAuthentication2Fa\" (click)=\"sendCode()\" type=\"button\" class=\"btn btn-acessar btn-primary col ms-1\">\r\n\t\t\t\t\t\t\t\t<app-loading-button [isLoading]=\"isLoadingSendAuthentication2Fa\"></app-loading-button>\r\n\t\t\t\t\t\t\t\tAcessar\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t\t<button *ngIf=\"secondsLeft == 0; else newCode\" \r\n\t\t\t\t\t\t\t\t[disabled]=\"isLoading\" (click)=\"getNewCode()\" type=\"button\" class=\"btn btn-acessar btn-outline-primary col\">\r\n\t\t\t\t\t\t\t\t<app-loading-button [isLoading]=\"isLoading\"></app-loading-button>\r\n\t\t\t\t\t\t\t\tEnviar novo c\u00F3digo\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t<ng-template #newCode>\r\n\t\t\t\t\t\t\t\t<p class=\"text-center\">{{ secondsLeft}} {{ secondsLeft == 1 ? 'segundo' : 'segundos' }} para obter novo c\u00F3digo</p>\r\n\t\t\t\t\t\t\t</ng-template>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</form>\t\r\n\t\t\t\t</ng-template>\r\n\t\t\t\t\r\n\t\t\t\t<div class=\"footer-position\">\r\n\t\t\t\t\t<footer>\r\n\t\t\t\t\t\t<span class=\"footer\"> \r\n\t\t\t\t\t\t\t<a href=\"https://dpo.privacytools.com.br/policy-view/JmGeNlJdw/1/poli%CC%81tica-de-privacidade/pt_BR?s=1685731510066\" target=\"_blank\" class=\"sispro text-primary\"> Pol\u00EDtica de Privacidade </a>\r\n\t\t\t\t\t\t\t<p class=\"separator\"> | </p>\r\n\t\t\t\t\t\t\t<a href=\"https://dpo.privacytools.com.br/policy-view/Rork35NN2/2/poli%CC%81tica-de-cookies/pt_BR?s=1685731551976\" target=\"_blank\" class=\"sispro text-primary\"> Pol\u00EDtica de Cookies </a>\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<span class=\"footer\"> Desenvolvido por \r\n\t\t\t\t\t\t\t<a href=\"https://www.sispro.com.br/\" target=\"_blank\" class=\"sispro text-primary\"> sispro s/a </a>\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t<span class=\"footer\"> Servi\u00E7os e Tecnologia da informa\u00E7\u00E3o \u00A9 {{ year }} Todos os direitos reservados </span>\r\n\t\t\t\t\t\t\t<div class=\"icons\">\r\n\t\t\t\t\t\t\t\t<a href=\"https://pt-br.facebook.com/SisproERP/\" target=\"_blank\">\r\n\t\t\t\t\t\t\t\t\t<lib-icon class=\"text-primary\" iconName=\"facebook\" iconSize=\"medium-small\"/>\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t<a href=\"https://www.instagram.com/accounts/login/?next=/sispro_software/\" target=\"_blank\">\r\n\t\t\t\t\t\t\t\t\t<lib-icon class=\"text-primary\" iconName=\"instagram\" iconSize=\"medium-small\"/>\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t<a href=\"https://br.linkedin.com/company/sispro\" target=\"_blank\">\r\n\t\t\t\t\t\t\t\t\t<lib-icon class=\"text-primary\" iconName=\"linkedin\" iconSize=\"medium-small\"/>\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t<div class=\"d-flex justify-content-center\">\r\n\t\t\t\t\t\t\t\t<a [href]=\"geturlErpConfig()\" style=\"text-decoration: none; font-size: 12px;\">\r\n\t\t\t\t\t\t\t\t\tConfigurar ERP\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</footer>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n\r\n<!-- Template do modal de senha esquecida -->\r\n<ng-template #forgottenPasswordModal>\r\n\t<form [formGroup]=\"formFgtPsw\">\r\n\t\t<div class=\"modal-content\" style=\"box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.5);\">\r\n\t\t\t<div class=\"modal-header p-3\">\r\n\t\t\t\t<h4 class=\"modal-title\"> Recupera\u00E7\u00E3o de senha </h4>\r\n\t\t\t\t<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"\r\n\t\t\t\t\t(click)=\"closeForgottenPasswordModal()\">\r\n\t\t\t\t</button>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"modal-body\">\r\n\t\t\t\t<label for=\"inputDominioFgtPsw\" class=\"input-label\"> Dom\u00EDnio <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t<input type=\"text\" id=\"inputDominioFgtPsw\" formControlName=\"dominioFgtPsw\"\r\n\t\t\t\t\tclass=\"form-control input-text\" aria-label=\"Sizing example input\" aria-label=\"Dom\u00EDnio\"\r\n\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(formFgtPsw.get('dominioFgtPsw'))\">\r\n\t\t\t\t<app-field-error-message [control]=\"formFgtPsw.get('dominioFgtPsw')\" label=\"Dom\u00EDnio\"></app-field-error-message>\t\t\t\t\r\n\r\n\t\t\t\t<label for=\"inputUsuarioFgtPsw\" class=\"input-label\"> Usu\u00E1rio <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t<input type=\"text\" id=\"inputUsuarioFgtPsw\" formControlName=\"usuarioFgtPsw\"\r\n\t\t\t\t\tclass=\"form-control input-text\" aria-label=\"Sizing example input\" aria-label=\"Usu\u00E1rio\"\r\n\t\t\t\t\taria-describedby=\"inputGroup-sizing-lg\"\r\n\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(formFgtPsw.get('usuarioFgtPsw'))\">\r\n\t\t\t\t<app-field-error-message [control]=\"formFgtPsw.get('usuarioFgtPsw')\" label=\"Usu\u00E1rio\"></app-field-error-message>\t\t\t\t\r\n\t\t\r\n\t\t\t</div>\r\n\t\t\t<div class=\"modal-footer\">\r\n\t\t\t\t<button type=\"button\" class=\"btn glb-btn-dark-disabled modal-button\" (click)=\"closeForgottenPasswordModal()\">\r\n\t\t\t\t\t<span> Cancelar </span>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button type=\"button\" class=\"btn btn-primary modal-button\" (click)=\"sendForgottenPassword();\">\r\n\t\t\t\t\t<span> Continuar </span>\r\n\t\t\t\t</button>\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\t</form>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";*{padding:0;margin:0;font-family:Open Sans,sans-serif}.background{display:grid;height:100vh;align-content:center;background-size:cover;color:#f5f5f5;align-items:center;justify-content:center}.div-size{display:flex;flex-direction:column;justify-content:space-around;width:100%;height:100vh;align-items:center;background-color:#f5f5f5;box-shadow:0 0 15px #333}.title{font-size:3.5vw;text-transform:uppercase;font-weight:700}.subtitle{font-size:21px}.logotipo{display:flex;justify-content:center;margin-top:10%}.form-position{display:flex;flex-direction:column;align-content:center;width:378px}.form-item{margin-bottom:16px}.input-group-text{padding:10px 11px;border-radius:4px 0 0 4px}.remember-password{display:flex;align-items:center;margin-bottom:8px;justify-content:center}.remember-password label{margin-left:8px}.forgotten-password{background-color:#f5f5f5;border:none;text-decoration:underline;font-size:14px;box-shadow:none;margin-top:8px;cursor:pointer}.forgotten-password:focus{outline-style:none}.input-label{font-size:16px;padding:10px 0 8px 16px}.input-label:first-child{font-size:16px;padding-top:16px}.input-text{width:343px;height:38px;margin:0 0 10px 16px;padding:0 8px}.input-text:last-child{font-size:16px;margin-bottom:24px}.form-control{max-width:341px}.footer{display:flex;justify-content:center}.footer-position{font-size:14px;display:flex;justify-content:center;align-items:flex-end}.icons{display:flex;justify-content:center;align-items:center;margin-top:16px}.icons a{padding:4px}.icon-item{margin-left:24px;color:#007bff}.sispro{color:#2847a0;margin-left:5px;text-transform:uppercase;text-decoration:none;font-weight:700}.modal-footer{padding:0}.modal:before{content:\"\";display:inline-block;height:100%;vertical-align:middle}.modal-style{display:flex;align-items:center;justify-content:center}.modal-style h4{font-size:20px;font-weight:700;padding:10px}.modal-button{margin:16px 0;padding:7px 12px}.modal-button:last-child{margin-right:16px;margin-left:8px}.modal-close{display:flex;align-content:center;margin-right:10px;padding:6px}.col-md-7,.col-md-5{padding:0}.btn-acessar{height:48px;outline-style:none}.texto-apresentacao{align-items:start}.separator{margin-left:5px}\n"] }]
|
|
1133
|
+
}], ctorParameters: () => [{ type: i1$2.BsModalService }, { type: i5.MessageService }, { type: i3.FormBuilder }, { type: AuthService }, { type: ServerService }, { type: EnvironmentService }, { type: AuthStorageService }, { type: LibCustomLoginService }, { type: i9.Title }, { type: i1$1.Router }, { type: i11.ToastrService }] });
|
|
1134
|
+
|
|
1135
|
+
/**Service responsável por pegar as opções do menu do projeto em que está sendo utilizada*/
|
|
1136
|
+
class MenuConfigService {
|
|
1137
|
+
constructor() {
|
|
1138
|
+
this._menuOptions = [];
|
|
1139
|
+
/** Indica se o menu é estático ou dinâmico. */
|
|
1140
|
+
this._isMenuStatic = false;
|
|
1141
|
+
this.menu = [];
|
|
1142
|
+
this.menuDropdown = [];
|
|
1143
|
+
}
|
|
1144
|
+
/** Obtém as opções do menu. */
|
|
1145
|
+
get menuOptions() { return this._menuOptions; }
|
|
1146
|
+
set menuOptions(value) { this._menuOptions = value; }
|
|
1147
|
+
/** Inicializa as opções do menu com base na rota atual e em uma lista personalizada (opcional).
|
|
1148
|
+
* @param currentRoute A rota atual da aplicação
|
|
1149
|
+
* @param customList Uma lista personalizada de opções de menu (opcional).
|
|
1150
|
+
* @returns As opções do menu inicializadas.
|
|
1151
|
+
*/
|
|
1152
|
+
setMenuStatic(isStaticMenu) {
|
|
1153
|
+
this._isMenuStatic = isStaticMenu;
|
|
1154
|
+
}
|
|
1155
|
+
initializeMenu(currentRoute, customList) {
|
|
1156
|
+
if (this.storedInitializeMenu) {
|
|
1157
|
+
this.menu = this.storedInitializeMenu(currentRoute, customList);
|
|
1158
|
+
}
|
|
1159
|
+
return this.menu;
|
|
1160
|
+
}
|
|
1161
|
+
updateRouteSelection(currentRoute, currentList) {
|
|
1162
|
+
currentList.forEach((item) => {
|
|
1163
|
+
if (item.children) {
|
|
1164
|
+
item.children.forEach(child => { child.isSelected = currentRoute.includes(child.route); });
|
|
1165
|
+
}
|
|
1166
|
+
const anyChildSelected = item.children ? item.children.some(child => child.isSelected === true) : false;
|
|
1167
|
+
item.isSelected = false;
|
|
1168
|
+
if (!item.children && currentRoute.includes(item.route)) {
|
|
1169
|
+
item.isSelected = true;
|
|
1170
|
+
}
|
|
1171
|
+
else if (item.children && anyChildSelected) {
|
|
1172
|
+
item.isSelected = true;
|
|
1173
|
+
}
|
|
1174
|
+
});
|
|
1175
|
+
return currentList;
|
|
1176
|
+
}
|
|
1177
|
+
/** Inicializa as opções do menu dropdown com base em uma lista personalizada (opcional).
|
|
1178
|
+
* @param primaryDropdownList Uma lista personalizada de opções do dropdown (opcional).
|
|
1179
|
+
* @returns As opções do dropdown inicializadas.
|
|
1180
|
+
*/
|
|
1181
|
+
initializeMenuDropdown(primaryDropdownList) {
|
|
1182
|
+
if (this.storedInitializeMenuDropdown) {
|
|
1183
|
+
this.menuDropdown = this.storedInitializeMenuDropdown(primaryDropdownList);
|
|
1184
|
+
}
|
|
1185
|
+
return this.menuDropdown;
|
|
1186
|
+
}
|
|
1187
|
+
ConfigurarMenuConfig(menuConfig) {
|
|
1188
|
+
//passando propriedades do produto para a lib
|
|
1189
|
+
this._menuOptions = menuConfig.menuOptions;
|
|
1190
|
+
this._isMenuStatic = menuConfig.isMenuStatic;
|
|
1191
|
+
//passando implementação dos métodos do produto para a lib
|
|
1192
|
+
this.storedInitializeMenu = menuConfig.initializeMenu;
|
|
1193
|
+
this.storedInitializeMenuDropdown = menuConfig.initializeMenuDropdown;
|
|
1194
|
+
}
|
|
1195
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MenuConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1196
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MenuConfigService, providedIn: 'root' }); }
|
|
1197
|
+
}
|
|
1198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MenuConfigService, decorators: [{
|
|
1199
|
+
type: Injectable,
|
|
1200
|
+
args: [{ providedIn: 'root' }]
|
|
1201
|
+
}] });
|
|
1202
|
+
|
|
1203
|
+
class LibCustomMenuService {
|
|
1204
|
+
/** Obtém as opções do menu. */
|
|
1205
|
+
get menuItems() {
|
|
1206
|
+
return this._menuItems;
|
|
1207
|
+
}
|
|
1208
|
+
set menuItems(value) {
|
|
1209
|
+
this._menuItems = value;
|
|
1210
|
+
}
|
|
1211
|
+
setEmpresa(value) { this.empresaId.next(value); }
|
|
1212
|
+
constructor(_menuConfig, _authStorageService, _router) {
|
|
1213
|
+
this._menuConfig = _menuConfig;
|
|
1214
|
+
this._authStorageService = _authStorageService;
|
|
1215
|
+
this._router = _router;
|
|
1216
|
+
// #region Propriedade Customizadas do Menu
|
|
1217
|
+
this.menuDynamic = false;
|
|
1218
|
+
this.moduleName = "";
|
|
1219
|
+
this.moduleImg = "";
|
|
1220
|
+
this.moduleSvg = "";
|
|
1221
|
+
this.themeColor = "";
|
|
1222
|
+
// #endregion Propriedade Customizadas do Menu
|
|
1223
|
+
// #region Propriedade do Menu
|
|
1224
|
+
this._MENU_BASE_URL = "https://siscandesv6.sispro.com.br/SisproErpCloud/Service_Private/Infra/SpInfra2ErpWS/api";
|
|
1225
|
+
this.currentURL = "";
|
|
1226
|
+
this._menuItems = [];
|
|
1227
|
+
this.menuList = [];
|
|
1228
|
+
this.menuLateralUpdated = [];
|
|
1229
|
+
// ! Definição do BehaviorSubject: responsável principal da emissão do evento
|
|
1230
|
+
this.empresaId = new BehaviorSubject({ estabelecimentoID: "", empresaID: "" });
|
|
1231
|
+
this.applyEmpresa$ = this.empresaId.asObservable();
|
|
1232
|
+
// inicializações do Menu Dinâmico
|
|
1233
|
+
this.currentURL = this._router.url;
|
|
1234
|
+
this.menuConfig = _menuConfig;
|
|
1235
|
+
}
|
|
1236
|
+
ConfigurarCustomMenuService(RealcustomMenuService) {
|
|
1237
|
+
//passando propriedades do produto para a lib
|
|
1238
|
+
this.menuDynamic = RealcustomMenuService.menuDynamic;
|
|
1239
|
+
this.moduleName = RealcustomMenuService.moduleName;
|
|
1240
|
+
this.moduleImg = RealcustomMenuService.moduleImg;
|
|
1241
|
+
this.moduleSvg = RealcustomMenuService.moduleSvg;
|
|
1242
|
+
this.themeColor = RealcustomMenuService.themeColor;
|
|
1243
|
+
//passando implementação dos métodos do produto para a lib
|
|
1244
|
+
this.storedMenuStaticOnInit = RealcustomMenuService.menuStaticOnInit;
|
|
1245
|
+
this.storedMenuopenExpansibleMenu = RealcustomMenuService.menuopenExpansibleMenu;
|
|
1246
|
+
this.storedMenuDynamicOnInit = RealcustomMenuService.menuDynamicOnInit;
|
|
1247
|
+
}
|
|
1248
|
+
// #region - Métodos Customizadas para o Menu dinâmico
|
|
1249
|
+
// Método executado no menu-lateral.component.ts - método: onInit ()
|
|
1250
|
+
// Utilizado para inicializações diversas
|
|
1251
|
+
menuDynamicOnInit() {
|
|
1252
|
+
if (this.storedMenuDynamicOnInit) {
|
|
1253
|
+
this.storedMenuDynamicOnInit();
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
// Método executado no menu-lateral.component.ts - método: onInit ()
|
|
1257
|
+
// Utilizado para inicializações diversas
|
|
1258
|
+
menuStaticOnInit() {
|
|
1259
|
+
if (this.storedMenuStaticOnInit) {
|
|
1260
|
+
this.storedMenuStaticOnInit();
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
// Método executado no menu-lateral.component.ts - método: openExpansibleMenu()
|
|
1264
|
+
// Utilizado para inicializações ao Exoandir a opção de Menu
|
|
1265
|
+
menuopenExpansibleMenu(ref) {
|
|
1266
|
+
if (this.storedMenuopenExpansibleMenu) {
|
|
1267
|
+
this.storedMenuopenExpansibleMenu(ref);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
/** Método que deve ser chamado na seleção de um novo estabelecimento, ele atualizará os valores do nosso BehaviorSubject para que possamos utilizá-lo em outras partes do sistema. */
|
|
1271
|
+
emitEstabelecimentoEvent() {
|
|
1272
|
+
this.setEmpresa({
|
|
1273
|
+
estabelecimentoID: this._authStorageService.infraEstabId,
|
|
1274
|
+
empresaID: this._authStorageService.infraEmpresaId
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LibCustomMenuService, deps: [{ token: MenuConfigService }, { token: AuthStorageService }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1278
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LibCustomMenuService, providedIn: 'root' }); }
|
|
1279
|
+
}
|
|
1280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LibCustomMenuService, decorators: [{
|
|
1281
|
+
type: Injectable,
|
|
1282
|
+
args: [{ providedIn: 'root' }]
|
|
1283
|
+
}], ctorParameters: () => [{ type: MenuConfigService }, { type: AuthStorageService }, { type: i1$1.Router }] });
|
|
1284
|
+
|
|
1285
|
+
//import { environment } from '../../../../environments/environments';
|
|
1286
|
+
// import { ProjectUtilservice } from 'src/app/project/utils/project-utils.service';
|
|
1287
|
+
class SecondaryDropdownComponent {
|
|
1288
|
+
constructor() {
|
|
1289
|
+
this.modulo = { id: null, icon: null, label: null, URL: null, secondary_level: null };
|
|
1290
|
+
this.backPrimaryDropdown = new EventEmitter();
|
|
1291
|
+
}
|
|
1292
|
+
ngOnInit() {
|
|
1293
|
+
}
|
|
1294
|
+
backToPrimary() {
|
|
1295
|
+
this.backPrimaryDropdown.emit(true);
|
|
1296
|
+
}
|
|
1297
|
+
redirectToModulo(modulo) {
|
|
1298
|
+
const url = `https://siscandesv6.sispro.com.br/SisproErpCloud/${modulo}`;
|
|
1299
|
+
window.open(url, '_blank');
|
|
1300
|
+
}
|
|
1301
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SecondaryDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1302
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SecondaryDropdownComponent, selector: "app-secondary-dropdown", inputs: { modulo: "modulo" }, outputs: { backPrimaryDropdown: "backPrimaryDropdown" }, ngImport: i0, template: "<div class=\"d-flex flex-row\">\r\n <button class=\"chevron d-flex m-0 p-0 align-items-start\" (click)=\"backToPrimary()\"> \r\n <lib-icon iconName=\"seta-esquerda\" iconSize=\"small\"/>\r\n </button>\r\n\r\n <div class=\"d-flex flex-column flex-row\">\r\n <li *ngIf=\"modulo != null\">\r\n <img class=\"ms-1 mb-2\" src=\"{{ modulo.icon }}\" alt=\"{{ modulo.label }}\">\r\n <span>{{ modulo.label }}</span>\r\n </li>\r\n <div *ngIf=\"modulo && modulo.secondary_level != null\">\r\n <li *ngFor=\"let moduloItem of modulo.secondary_level;\" (click)=\"redirectToModulo(moduloItem.URL)\">\r\n <a class=\"dropdown-item mb-2 ms-2\">\r\n <img src=\"{{ moduloItem.icon }}\" alt=\"{{ moduloItem.label }}\">\r\n {{ moduloItem.label }}\r\n </a>\r\n <li>\r\n </div>\r\n </div>\r\n</div>", styles: ["*{padding:0;margin:0}.chevron{margin-bottom:16px;margin-left:14px}li img{margin-left:8px;margin-right:4px}li span{font-weight:700}li a:hover{font-weight:700;background-color:transparent}.dropdown-item{margin-left:32px}button{background-color:transparent;border:none}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }] }); }
|
|
1303
|
+
}
|
|
1304
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SecondaryDropdownComponent, decorators: [{
|
|
1305
|
+
type: Component,
|
|
1306
|
+
args: [{ selector: 'app-secondary-dropdown', template: "<div class=\"d-flex flex-row\">\r\n <button class=\"chevron d-flex m-0 p-0 align-items-start\" (click)=\"backToPrimary()\"> \r\n <lib-icon iconName=\"seta-esquerda\" iconSize=\"small\"/>\r\n </button>\r\n\r\n <div class=\"d-flex flex-column flex-row\">\r\n <li *ngIf=\"modulo != null\">\r\n <img class=\"ms-1 mb-2\" src=\"{{ modulo.icon }}\" alt=\"{{ modulo.label }}\">\r\n <span>{{ modulo.label }}</span>\r\n </li>\r\n <div *ngIf=\"modulo && modulo.secondary_level != null\">\r\n <li *ngFor=\"let moduloItem of modulo.secondary_level;\" (click)=\"redirectToModulo(moduloItem.URL)\">\r\n <a class=\"dropdown-item mb-2 ms-2\">\r\n <img src=\"{{ moduloItem.icon }}\" alt=\"{{ moduloItem.label }}\">\r\n {{ moduloItem.label }}\r\n </a>\r\n <li>\r\n </div>\r\n </div>\r\n</div>", styles: ["*{padding:0;margin:0}.chevron{margin-bottom:16px;margin-left:14px}li img{margin-left:8px;margin-right:4px}li span{font-weight:700}li a:hover{font-weight:700;background-color:transparent}.dropdown-item{margin-left:32px}button{background-color:transparent;border:none}\n"] }]
|
|
1307
|
+
}], ctorParameters: () => [], propDecorators: { modulo: [{
|
|
1308
|
+
type: Input
|
|
1309
|
+
}], backPrimaryDropdown: [{
|
|
1310
|
+
type: Output
|
|
1311
|
+
}] } });
|
|
1312
|
+
|
|
1313
|
+
//import { ProjectUtilservice } from 'src/app/project/utils/project-utils.service';
|
|
1314
|
+
//import { environment } from '../../../../environments/environments';
|
|
1315
|
+
class PrimaryDropdownComponent {
|
|
1316
|
+
constructor(_customMenuService) {
|
|
1317
|
+
this._customMenuService = _customMenuService;
|
|
1318
|
+
this.buttonWasClicked = new Observable;
|
|
1319
|
+
this.primaryDropdown = [];
|
|
1320
|
+
}
|
|
1321
|
+
ngOnInit() {
|
|
1322
|
+
console.log('ngOnInit');
|
|
1323
|
+
this.buttonWasClicked.subscribe(() => { this.selectDataState = true; });
|
|
1324
|
+
// Resolver colisão de eventos
|
|
1325
|
+
if (this._customMenuService.menuDynamic) {
|
|
1326
|
+
if (!this._customMenuService.menuConfig) {
|
|
1327
|
+
setTimeout(() => {
|
|
1328
|
+
this.primaryDropdown = this._customMenuService.menuConfig.initializeMenuDropdown(this.primaryDropdown);
|
|
1329
|
+
}, 2000);
|
|
1330
|
+
}
|
|
1331
|
+
else {
|
|
1332
|
+
this.primaryDropdown = this._customMenuService.menuConfig.initializeMenuDropdown(this.primaryDropdown);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
else {
|
|
1336
|
+
this.primaryDropdown = this._customMenuService.menuConfig.initializeMenuDropdown(this.primaryDropdown);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
openDropdown(modulo, desiredDropdown) {
|
|
1340
|
+
this.modulo = modulo;
|
|
1341
|
+
if (desiredDropdown == null) {
|
|
1342
|
+
this.selectDataState = true;
|
|
1343
|
+
}
|
|
1344
|
+
else {
|
|
1345
|
+
this.selectDataState = false;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
onClickedOutside(e, ref) {
|
|
1349
|
+
if (this.selectDataState = false) {
|
|
1350
|
+
this.selectDataState = true;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
backToPrimary(data) {
|
|
1354
|
+
this.selectDataState = true;
|
|
1355
|
+
}
|
|
1356
|
+
redirectToPrePortal() {
|
|
1357
|
+
const url = `https://siscandesv6.sispro.com.br/SisproErpCloud/PrePortal`;
|
|
1358
|
+
window.open(url, '_blank');
|
|
1359
|
+
}
|
|
1360
|
+
redirectToModulo(modulo) {
|
|
1361
|
+
const url = `https://siscandesv6.sispro.com.br/SisproErpCloud/${modulo}`;
|
|
1362
|
+
window.open(url, '_blank');
|
|
1363
|
+
}
|
|
1364
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PrimaryDropdownComponent, deps: [{ token: LibCustomMenuService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1365
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PrimaryDropdownComponent, selector: "app-primary-dropdown", inputs: { buttonWasClicked: "buttonWasClicked" }, ngImport: i0, template: "<div class=\"p-2\">\r\n <div *ngIf=\"selectDataState; else secondary_dropdown\" class=\"mb-2 w-100\">\r\n <li *ngFor=\"let modulo of primaryDropdown\" (click)=\"(modulo.secondary_level != null ? openDropdown(modulo, secondary_dropdown) : redirectToModulo(modulo.URL))\">\r\n <a class=\"dropdown-item mb-2\">\r\n <img src=\"{{ modulo.icon }}\" alt=\"{{ modulo.label }}\">\r\n {{ modulo.label }}\r\n </a>\r\n </li>\r\n <hr class=\"dropdown-divider\">\r\n <li>\r\n <a class=\"dropdown-item link-portal mt-2\" (click)=\"redirectToPrePortal()\" target=\"_blank\">Portal Sispro</a>\r\n </li>\r\n </div>\r\n\r\n <ng-template #secondary_dropdown>\r\n <div #secondary_ref (clickOutside)=\"onClickedOutside($event, secondary_ref)\">\r\n <app-secondary-dropdown [modulo]=\"this.modulo\" (backPrimaryDropdown)=\"backToPrimary($event)\"></app-secondary-dropdown>\r\n </div>\r\n </ng-template>\r\n</div>", styles: ["*{padding:0;margin:0}li a{font-size:14px}li a img{margin-right:4px}li a:hover{font-weight:700;background-color:transparent}.dropdown-divider{height:0}.link-portal{color:#2847a0;text-decoration:underline;text-align:center;font-weight:700;font-size:14px}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.ClickOutsideDirective, selector: "[clickOutside]", inputs: ["clickOutsideEnabled", "attachOutsideOnClick", "delayClickOutsideInit", "emitOnBlur", "exclude", "excludeBeforeClick", "clickOutsideEvents"], outputs: ["clickOutside"] }, { kind: "component", type: SecondaryDropdownComponent, selector: "app-secondary-dropdown", inputs: ["modulo"], outputs: ["backPrimaryDropdown"] }] }); }
|
|
1366
|
+
}
|
|
1367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PrimaryDropdownComponent, decorators: [{
|
|
1368
|
+
type: Component,
|
|
1369
|
+
args: [{ selector: 'app-primary-dropdown', template: "<div class=\"p-2\">\r\n <div *ngIf=\"selectDataState; else secondary_dropdown\" class=\"mb-2 w-100\">\r\n <li *ngFor=\"let modulo of primaryDropdown\" (click)=\"(modulo.secondary_level != null ? openDropdown(modulo, secondary_dropdown) : redirectToModulo(modulo.URL))\">\r\n <a class=\"dropdown-item mb-2\">\r\n <img src=\"{{ modulo.icon }}\" alt=\"{{ modulo.label }}\">\r\n {{ modulo.label }}\r\n </a>\r\n </li>\r\n <hr class=\"dropdown-divider\">\r\n <li>\r\n <a class=\"dropdown-item link-portal mt-2\" (click)=\"redirectToPrePortal()\" target=\"_blank\">Portal Sispro</a>\r\n </li>\r\n </div>\r\n\r\n <ng-template #secondary_dropdown>\r\n <div #secondary_ref (clickOutside)=\"onClickedOutside($event, secondary_ref)\">\r\n <app-secondary-dropdown [modulo]=\"this.modulo\" (backPrimaryDropdown)=\"backToPrimary($event)\"></app-secondary-dropdown>\r\n </div>\r\n </ng-template>\r\n</div>", styles: ["*{padding:0;margin:0}li a{font-size:14px}li a img{margin-right:4px}li a:hover{font-weight:700;background-color:transparent}.dropdown-divider{height:0}.link-portal{color:#2847a0;text-decoration:underline;text-align:center;font-weight:700;font-size:14px}\n"] }]
|
|
1370
|
+
}], ctorParameters: () => [{ type: LibCustomMenuService }], propDecorators: { buttonWasClicked: [{
|
|
1371
|
+
type: Input
|
|
1372
|
+
}] } });
|
|
1373
|
+
|
|
1374
|
+
class MenuServicesService {
|
|
1375
|
+
constructor(_authStorageService, _httpClient) {
|
|
1376
|
+
this._authStorageService = _authStorageService;
|
|
1377
|
+
this._httpClient = _httpClient;
|
|
1378
|
+
this._BASE_URL = "https://siscandesv6.sispro.com.br/SisproErpCloud/Service_Private/Infra/SpInfra2ErpWS/api"; // SpInfra2AplicWS
|
|
1379
|
+
this._HTTP_HEADERS = new HttpHeaders().set('Content-Type', 'application/json');
|
|
1380
|
+
// #endregion Menu: Estabelecimentos
|
|
1381
|
+
// #endregion UPDATE
|
|
1382
|
+
// #region DELETE
|
|
1383
|
+
// [...]
|
|
1384
|
+
// #endregion DELETE
|
|
1385
|
+
// #endregion ==========> SERVICES <==========
|
|
1386
|
+
// #region ==========> UTILITIES <==========
|
|
1387
|
+
this._menuFooterImg = null;
|
|
1388
|
+
// #region NewImg Event
|
|
1389
|
+
// Implementação de lógica vista no link: https://hasangalakdinu.medium.com/how-to-call-a-function-in-another-component-angular-using-rxjs-3f2e85920705
|
|
1390
|
+
this._subject = new Subject();
|
|
1391
|
+
//verificar se é a melhor solucão
|
|
1392
|
+
//this._BASE_URL = !environment.production ? this._BASE_URL : `${environment.SpInfra2ErpWS}`;
|
|
1393
|
+
}
|
|
1394
|
+
// #region ==========> SERVICES <==========
|
|
1395
|
+
// #region PREPARATION
|
|
1396
|
+
// #region Menu: Usuário
|
|
1397
|
+
// [...]
|
|
1398
|
+
// #endregion Menu: Usuário
|
|
1399
|
+
// #region Menu: Estabelecimentos
|
|
1400
|
+
getEstabelecimentosModalList(usuarioID, pesquisa) {
|
|
1401
|
+
const params = new HttpParams()
|
|
1402
|
+
.set('pesquisa', pesquisa);
|
|
1403
|
+
const headers = new HttpHeaders()
|
|
1404
|
+
.set('Content-Type', 'application/json');
|
|
1405
|
+
const url = `${this._BASE_URL}/InfraEstabelecimento/GetEstabelecimentosModal`;
|
|
1406
|
+
return this._httpClient
|
|
1407
|
+
.get(url, { 'params': params, 'headers': headers })
|
|
1408
|
+
.pipe(take(1), tap(response => {
|
|
1409
|
+
if (response.Error) {
|
|
1410
|
+
throw Error(response.ErrorMessage);
|
|
1411
|
+
}
|
|
1412
|
+
}));
|
|
1413
|
+
}
|
|
1414
|
+
// #endregion Menu: Estabelecimentos
|
|
1415
|
+
// #endregion PREPARATION
|
|
1416
|
+
// #region GET
|
|
1417
|
+
// #region Menu: Usuário
|
|
1418
|
+
getImagemMenu() {
|
|
1419
|
+
const url = `${this._BASE_URL}/InfraUsuario/GetImagemMenu`;
|
|
1420
|
+
return this._httpClient
|
|
1421
|
+
.get(url, { 'headers': this._HTTP_HEADERS })
|
|
1422
|
+
.pipe(take(1), tap(response => {
|
|
1423
|
+
if (response.Error) {
|
|
1424
|
+
throw Error(response.ErrorMessage);
|
|
1425
|
+
}
|
|
1426
|
+
this.saveImageToStorage(response.InfraUsuarioImg.IMAGEM, response.InfraUsuarioImg.FILENAME);
|
|
1427
|
+
}));
|
|
1428
|
+
}
|
|
1429
|
+
// #endregion Menu: Usuário
|
|
1430
|
+
// #region Menu: Estabelecimentos
|
|
1431
|
+
getEstabelecimentoSession(estabID) {
|
|
1432
|
+
const params = new HttpParams()
|
|
1433
|
+
.set('id', estabID);
|
|
1434
|
+
const url = `${this._BASE_URL}/InfraEstabelecimento/GetEstabelecimentoSession`;
|
|
1435
|
+
return this._httpClient
|
|
1436
|
+
.get(url, { 'params': params, 'headers': this._HTTP_HEADERS })
|
|
1437
|
+
.pipe(take(1), tap(response => {
|
|
1438
|
+
if (response.Error) {
|
|
1439
|
+
throw Error(response.ErrorMessage);
|
|
1440
|
+
}
|
|
1441
|
+
}));
|
|
1442
|
+
}
|
|
1443
|
+
// #endregion Menu: Estabelecimentos
|
|
1444
|
+
// #region Get Usuario Email
|
|
1445
|
+
getUsuarioEmail() {
|
|
1446
|
+
const url = `${this._BASE_URL}/InfraUsuario/GetUsuarioEmail`;
|
|
1447
|
+
return this._httpClient
|
|
1448
|
+
.get(url, { 'headers': this._HTTP_HEADERS })
|
|
1449
|
+
.pipe(take(1), tap(response => {
|
|
1450
|
+
if (response.Error) {
|
|
1451
|
+
throw Error(response.ErrorMessage);
|
|
1452
|
+
}
|
|
1453
|
+
}));
|
|
1454
|
+
}
|
|
1455
|
+
// #endregion Get Usuario Email
|
|
1456
|
+
// #endregion GET
|
|
1457
|
+
// #region CREATE
|
|
1458
|
+
// [...]
|
|
1459
|
+
// #endregion CREATE
|
|
1460
|
+
// #region UPDATE
|
|
1461
|
+
// #region Menu: Usuário
|
|
1462
|
+
updateLastLogEstabID(estabID) {
|
|
1463
|
+
const params = new HttpParams()
|
|
1464
|
+
.set('estabID', estabID);
|
|
1465
|
+
const url = `${this._BASE_URL}/InfraUsuario/UpdateLastSelectedEstabelecimento`;
|
|
1466
|
+
return this._httpClient
|
|
1467
|
+
.post(url, null, { 'params': params, 'headers': this._HTTP_HEADERS })
|
|
1468
|
+
.pipe(take(1), tap(response => {
|
|
1469
|
+
if (response.Error) {
|
|
1470
|
+
throw Error(response.ErrorMessage);
|
|
1471
|
+
}
|
|
1472
|
+
}));
|
|
1473
|
+
}
|
|
1474
|
+
// #endregion Menu: Usuário
|
|
1475
|
+
// #region Menu: Estabelecimentos
|
|
1476
|
+
defineDefaultEstabelecimento(estabID, usuarioID, isDefault) {
|
|
1477
|
+
const params = new HttpParams()
|
|
1478
|
+
.set('estabID', estabID)
|
|
1479
|
+
.set('isDefault', isDefault);
|
|
1480
|
+
const url = `${this._BASE_URL}/InfraEstabelecimento/DefineDefaultEstab`;
|
|
1481
|
+
return this._httpClient
|
|
1482
|
+
.post(url, null, { 'params': params, 'headers': this._HTTP_HEADERS })
|
|
1483
|
+
.pipe(take(1), tap(response => {
|
|
1484
|
+
if (response.Error) {
|
|
1485
|
+
throw Error(response.ErrorMessage);
|
|
1486
|
+
}
|
|
1487
|
+
}));
|
|
1488
|
+
}
|
|
1489
|
+
getMenuFooterImg() {
|
|
1490
|
+
const cachedFooterImg = JSON.parse(localStorage.getItem('menuFooterImg'));
|
|
1491
|
+
if (cachedFooterImg) {
|
|
1492
|
+
return cachedFooterImg;
|
|
1493
|
+
}
|
|
1494
|
+
return this._menuFooterImg;
|
|
1495
|
+
}
|
|
1496
|
+
setMenuFooterImg(value) {
|
|
1497
|
+
this._menuFooterImg = value;
|
|
1498
|
+
localStorage.setItem('menuFooterImg', JSON.stringify(value));
|
|
1499
|
+
}
|
|
1500
|
+
saveImageToStorage(footerImgSrc, footerImgName) {
|
|
1501
|
+
this.setMenuFooterImg({ USUARIOID: this._authStorageService.infraUsuarioId, FILENAME: footerImgName, FILE: footerImgSrc });
|
|
1502
|
+
}
|
|
1503
|
+
newUserImageEvent(value) {
|
|
1504
|
+
this._subject.next(value);
|
|
1505
|
+
}
|
|
1506
|
+
getNewUserImageEvent() {
|
|
1507
|
+
return this._subject.asObservable();
|
|
1508
|
+
}
|
|
1509
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MenuServicesService, deps: [{ token: AuthStorageService }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1510
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MenuServicesService, providedIn: 'root' }); }
|
|
1511
|
+
}
|
|
1512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MenuServicesService, decorators: [{
|
|
1513
|
+
type: Injectable,
|
|
1514
|
+
args: [{
|
|
1515
|
+
providedIn: 'root'
|
|
1516
|
+
}]
|
|
1517
|
+
}], ctorParameters: () => [{ type: AuthStorageService }, { type: i1.HttpClient }] });
|
|
1518
|
+
|
|
1519
|
+
class SelecaoEstabelecimentosModalComponent {
|
|
1520
|
+
constructor(_authStorageService, _bsModalService, _customMenuService, _menuServicesService, _messageService) {
|
|
1521
|
+
this._authStorageService = _authStorageService;
|
|
1522
|
+
this._bsModalService = _bsModalService;
|
|
1523
|
+
this._customMenuService = _customMenuService;
|
|
1524
|
+
this._menuServicesService = _menuServicesService;
|
|
1525
|
+
this._messageService = _messageService;
|
|
1526
|
+
// #region ==========> PROPERTIES <==========
|
|
1527
|
+
// #region PRIVATE
|
|
1528
|
+
// [...]
|
|
1529
|
+
// #endregion PRIVATE
|
|
1530
|
+
// #region PUBLIC
|
|
1531
|
+
this.onClose = new EventEmitter();
|
|
1532
|
+
this.onSelected = new EventEmitter();
|
|
1533
|
+
this.$estabelecimentosList = [];
|
|
1534
|
+
this.page = 1;
|
|
1535
|
+
this.itemsPerPage = 10;
|
|
1536
|
+
this.response_messages = {
|
|
1537
|
+
'emptyMessage': 'Consulta não retornou registros...',
|
|
1538
|
+
'totalMessage': 'Linhas encontradas.'
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
ngOnInit() {
|
|
1542
|
+
this.getEstabelecimentos("");
|
|
1543
|
+
}
|
|
1544
|
+
// #endregion PUBLIC
|
|
1545
|
+
// #endregion ==========> PROPERTIES <==========
|
|
1546
|
+
// #region ==========> FORM BUILDER <==========
|
|
1547
|
+
// #region DATA
|
|
1548
|
+
// [...]
|
|
1549
|
+
// #endregion DATA
|
|
1550
|
+
// #region VALIDATORS
|
|
1551
|
+
// [...]
|
|
1552
|
+
// #endregion VALIDATORS
|
|
1553
|
+
// #endregion ==========> FORM BUILDER <==========
|
|
1554
|
+
// #region ==========> SERVICES <==========
|
|
1555
|
+
// #region PREPARATION
|
|
1556
|
+
refreshList(pesquisa) {
|
|
1557
|
+
this.getEstabelecimentos(pesquisa);
|
|
1558
|
+
}
|
|
1559
|
+
getEstabelecimentos(pesquisa = "") {
|
|
1560
|
+
this._menuServicesService.getEstabelecimentosModalList(this._authStorageService.infraUsuarioId, pesquisa).subscribe({
|
|
1561
|
+
next: response => {
|
|
1562
|
+
this.$estabelecimentosList = response.InfraEstabelecimentos;
|
|
1563
|
+
this.resetPagination(this.$estabelecimentosList);
|
|
1564
|
+
if (response.InfraEstabelecimentos.length == 0) {
|
|
1565
|
+
this._messageService.showAlertDanger(this.response_messages.emptyMessage);
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1568
|
+
error: error => {
|
|
1569
|
+
//this._projectUtilService.showHttpError(error);
|
|
1570
|
+
this._messageService.showAlertDanger(error);
|
|
1571
|
+
throw new Error(error);
|
|
1572
|
+
this.$estabelecimentosList = [];
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
// #endregion PREPARATION
|
|
1577
|
+
// #region GET
|
|
1578
|
+
// [...]
|
|
1579
|
+
// #endregion GET
|
|
1580
|
+
// #region CREATE OR UPDATE
|
|
1581
|
+
/**
|
|
1582
|
+
* Atualiza o estado do Estabelecimento, informando se ele é Padrão ou não.
|
|
1583
|
+
* @param estabID ID do Estabelecimento a ser alterado
|
|
1584
|
+
* @param isDefault Informa se ele é Padrão ou não
|
|
1585
|
+
*/
|
|
1586
|
+
defineDefaultEstabelecimento(estabID, isDefault) {
|
|
1587
|
+
this._menuServicesService.defineDefaultEstabelecimento(estabID, this._authStorageService.infraUsuarioId, isDefault).subscribe({
|
|
1588
|
+
next: () => {
|
|
1589
|
+
this.getEstabelecimentos("");
|
|
1590
|
+
isDefault
|
|
1591
|
+
? this._messageService.showAlertSuccess('Novo estabelecimento definido como padrão para o usuário')
|
|
1592
|
+
: this._messageService.showAlertSuccess('Estabelecimento padrão removido para o usuário');
|
|
1593
|
+
},
|
|
1594
|
+
error: error => {
|
|
1595
|
+
//this._projectUtilService.showHttpError(error);
|
|
1596
|
+
this._messageService.showAlertDanger(error);
|
|
1597
|
+
throw new Error(error);
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
// #endregion CREATE OR UPDATE
|
|
1602
|
+
// #region DELETE
|
|
1603
|
+
// [...]
|
|
1604
|
+
// #endregion DELETE
|
|
1605
|
+
// #endregion ==========> SERVICES <==========
|
|
1606
|
+
// #region ==========> UTILITIES <==========
|
|
1607
|
+
/**
|
|
1608
|
+
* Envia um sinal ao componente pai com o ID e Nome do Estabelecimento selecionado no Modal
|
|
1609
|
+
* @param estabID ID do Estabelecimento que será enviado
|
|
1610
|
+
* @param estabNome Nome do Estabelecimento que será enviado
|
|
1611
|
+
*/
|
|
1612
|
+
selectEstabelecimento(estabID, estabNome) {
|
|
1613
|
+
// * Método customizado para emissão de evento ao trocar de estabelecimento
|
|
1614
|
+
this._customMenuService.emitEstabelecimentoEvent();
|
|
1615
|
+
this.onSelected.emit(estabID + " - " + estabNome);
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Realiza uma nova pesquisa no banco para atualizar a lista a cada 3 caracteres digitados
|
|
1619
|
+
* @param pesquisa Texto do input de pesquisa
|
|
1620
|
+
*/
|
|
1621
|
+
updateSearch(pesquisa) {
|
|
1622
|
+
pesquisa.length % 3 == 0
|
|
1623
|
+
? this.getEstabelecimentos(pesquisa)
|
|
1624
|
+
: null;
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Verifica se a string passada é alfanumérica.
|
|
1628
|
+
* @param str String que será verificada
|
|
1629
|
+
* @returns TRUE se for alfanumérica, caso contrário FALSE.
|
|
1630
|
+
*/
|
|
1631
|
+
isAlphanumeric(str) {
|
|
1632
|
+
var code, i, len;
|
|
1633
|
+
for (i = 0, len = str.length; i < len; i++) {
|
|
1634
|
+
code = str.charCodeAt(i);
|
|
1635
|
+
if (!(code > 47 && code < 58) && // (0-9)
|
|
1636
|
+
!(code > 64 && code < 91) && // (A-Z)
|
|
1637
|
+
!(code > 96 && code < 123)) { // (a-z)
|
|
1638
|
+
return false;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
return true;
|
|
1642
|
+
}
|
|
1643
|
+
;
|
|
1644
|
+
/** Modifica a quantidade de itens a ser mostrada na lista.
|
|
1645
|
+
* @param event parâmetro de evento que irá selecionar a nova quantidade.
|
|
1646
|
+
*/
|
|
1647
|
+
onSelectChange(event) {
|
|
1648
|
+
this.itemsPerPage = parseInt(event.target.value, 10);
|
|
1649
|
+
this.page = 1;
|
|
1650
|
+
}
|
|
1651
|
+
/** Reseta a paginação da listagem.
|
|
1652
|
+
*/
|
|
1653
|
+
resetPagination(list) {
|
|
1654
|
+
// Cálculo para encontrar o valor inicial do index da página atual
|
|
1655
|
+
const startIndex = (this.page - 1) * this.itemsPerPage;
|
|
1656
|
+
// Condição para resetar o valor da paginação
|
|
1657
|
+
if (list.length <= startIndex) {
|
|
1658
|
+
this.page = 1;
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
// #endregion ==========> UTILITIES <==========
|
|
1662
|
+
// #region ==========> MODALS <==========
|
|
1663
|
+
/**
|
|
1664
|
+
* Função simples com o objetivo de abrir os modais no centro da tela.
|
|
1665
|
+
* @param template Template HTML do modal que será aberto.
|
|
1666
|
+
* @param modalID ID do modal que será aberto, para que possa ser referenciado depois.
|
|
1667
|
+
*/
|
|
1668
|
+
openModal(template, modalID) {
|
|
1669
|
+
if (modalID == 4) {
|
|
1670
|
+
this._bsModalService.show(template, {
|
|
1671
|
+
id: modalID,
|
|
1672
|
+
class: 'modal-dialog-centered modal-lg',
|
|
1673
|
+
ignoreBackdropClick: false,
|
|
1674
|
+
keyboard: false
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
else {
|
|
1678
|
+
this._bsModalService.show(template, {
|
|
1679
|
+
id: modalID,
|
|
1680
|
+
class: 'modal-dialog-centered',
|
|
1681
|
+
ignoreBackdropClick: false,
|
|
1682
|
+
keyboard: false
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Função simples com o objetivo de fechar os modais que estiverem abertos (baseados pelo ID).
|
|
1688
|
+
* @param modalID ID do modal que será fechado.
|
|
1689
|
+
*/
|
|
1690
|
+
closeModal(modalID) {
|
|
1691
|
+
this._bsModalService.hide(modalID);
|
|
1692
|
+
}
|
|
1693
|
+
closeSelf() {
|
|
1694
|
+
this.onClose.emit();
|
|
1695
|
+
}
|
|
1696
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelecaoEstabelecimentosModalComponent, deps: [{ token: AuthStorageService }, { token: i1$2.BsModalService }, { token: LibCustomMenuService }, { token: MenuServicesService }, { token: i5.MessageService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1697
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SelecaoEstabelecimentosModalComponent, selector: "selecao-estabelecimentos-modal", outputs: { onClose: "onClose", onSelected: "onSelected" }, ngImport: i0, template: "<div class=\"main-container\">\r\n <div class=\"modal-header modal-style modal-dialog-centered\">\r\n <h4 class=\"modal-title pull-left color-modal\" style=\"font-size: 20px; font-weight: bold;\"> Selecione um\r\n estabelecimento </h4>\r\n <button (click)=\"closeSelf()\" type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div class=\"modal-message\">\r\n <div class=\"search-and-filters d-flex flex-row align-items-center justify-content-between\">\r\n <div class=\"d-flex flex-row w-100\">\r\n <div class=\"input-group\">\r\n <span class=\"input-group-text px-2\" id=\"basic-addon1\"\r\n style=\"background-color: transparent; border-right: none;\">\r\n <lib-icon iconName=\"lupa\" iconColor=\"gray\"/>\r\n </span>\r\n <input type=\"text\" class=\"form-control border-start-0 ps-0\" id=\"pesquisaInput\" #pesquisa\r\n placeholder=\"Digite o C\u00F3digo\" (keyup.enter)=\"refreshList(pesquisa.value)\">\r\n </div>\r\n </div>\r\n\r\n <div class=\"filters d-flex align-items-center justify-content-between ms-3\">\r\n <div class=\"search-buttons d-flex flex-row align-items-center my-0 mx-0\">\r\n <button id=\"clearFilterBtn\" class=\"btn btn-outline-primary ms-0 no-hover-btn me-2\"\r\n (click)=\"pesquisa.value = ''; refreshList(pesquisa.value)\"> Limpar </button>\r\n <button id=\"searchFilterBtn\" class=\"btn btn-primary me-0\" (click)=\"refreshList(pesquisa.value)\"> Pesquisar\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"table-list w-100 mt-3\" *ngIf=\"$estabelecimentosList; else loading\">\r\n <table class=\"table table-bordered table-hover mb-0\">\r\n <thead class=\"fs-6\">\r\n <tr>\r\n <th scope=\"col\" class=\"col-11 align-middle th\">Estabelecimento <span\r\n class=\"text-primary fst-italic\">(duplo-clique para selecionar)</span></th>\r\n <th scope=\"col\" class=\"col-1 align-middle text-center th\">A\u00E7\u00F5es</th>\r\n </tr>\r\n </thead>\r\n\r\n <tbody *ngIf=\"$estabelecimentosList.length > 0; else emptyList\">\r\n <tr\r\n *ngFor=\"let estabelecimento of $estabelecimentosList | paginate: { itemsPerPage: itemsPerPage, currentPage: page }\"\r\n (dblclick)=\"selectEstabelecimento(estabelecimento.ID, estabelecimento.NOMEEXIBICAO)\" role=\"button\">\r\n <td><span class=\"row-name\"> {{ estabelecimento.CODIGO }} - {{ estabelecimento.NOMEEXIBICAO }} </span>\r\n <span class=\"subname\"> {{ estabelecimento.IS_MATRIZ ? \"Matriz \" : null }} CNPJ: {{ estabelecimento.CNPJ\r\n }} </span></td>\r\n <td class=\"text-center align-middle\">\r\n <div class=\"action-icons d-flex flex-row align-items-center justify-content-around\">\r\n <div class=\"form-check form-switch\">\r\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" id=\"flexSwitchCheckChecked\"\r\n tooltip=\"Estabelecimento padr\u00E3o\" [checked]=\"estabelecimento.IS_DEFAULT\"\r\n style=\"transform: translateY(3px); height: 1rem; width: 28px;\" #isDefaultRow\r\n (click)=\"estabelecimento.IS_DEFAULT = !estabelecimento.IS_DEFAULT; defineDefaultEstabelecimento(estabelecimento.ID, estabelecimento.IS_DEFAULT)\">\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n\r\n <!-- #region EMPTY LIST CELL -->\r\n <ng-template #emptyList>\r\n <tbody>\r\n <tr>\r\n <td colspan=\"2\" class=\"align-middle\"><span class=\"row-name fw-light fst-italic text-center\"> {{\r\n response_messages.emptyMessage }} </span></td>\r\n </tr>\r\n </tbody>\r\n </ng-template>\r\n <!-- #endregion EMPTY LIST CELL -->\r\n </table>\r\n\r\n <!-- #region PAGINATION -->\r\n <div class=\"d-flex justify-content-end mt-2\" *ngIf=\"$estabelecimentosList.length > 0\">\r\n <div class=\"d-flex align-items-center\">\r\n <label class=\"me-2\" style=\"white-space: nowrap;\">Itens por p\u00E1gina</label>\r\n <select class=\"form-select select-search\" (change)=\"onSelectChange($event)\">\r\n <option class=\"selected\" value=\"10\" selected>10</option>\r\n <option value=\"25\">25</option>\r\n <option value=\"50\">50</option>\r\n </select>\r\n </div>\r\n\r\n <pagination-controls class=\"sp-pagination mt-3\" (pageChange)=\"page = $event\"\r\n previousLabel=\"\u00AB \" nextLabel=\" \u00BB\" [maxSize]=\"5\">\r\n </pagination-controls>\r\n </div>\r\n <!-- #endregion PAGINATION -->\r\n \r\n </div>\r\n\r\n <!-- <div class=\"d-flex justify-content-between align-items-center mt-3\">\r\n <span style=\"color: #6C757D\"> Registros {{$estabelecimentosList.length}} de {{$estabelecimentosList.length}} </span>\r\n <nav aria-label=\"...\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item disabled\"> <a class=\"page-link\" href=\"#\" tabindex=\"-1\">Anterior</a> </li>\r\n <li class=\"page-item active\"> <a class=\"page-link\" href=\"#\">1</a> </li>\r\n <li class=\"page-item\"> <a class=\"page-link\" href=\"#\">2</a> </li>\r\n <li class=\"page-item\"> <a class=\"page-link\" href=\"#\">3</a> </li>\r\n <li class=\"page-item\"> <a class=\"page-link\" href=\"#\">Pr\u00F3ximo</a> </li>\r\n </ul>\r\n </nav>\r\n </div> -->\r\n\r\n\r\n <ng-template #loading>\r\n <lib-spinner></lib-spinner>\r\n </ng-template>\r\n </div>\r\n </div>\r\n</div>", styles: [".table-list table thead{height:50px;font-size:1rem;background-color:#e9ecef}.table-list table thead .status-header{width:5%}.table-list table thead th:first-child{width:50px;height:50px}.table-list table thead th{font-size:16px}.table-list table .center-content{text-align:center}.table-list table tbody{font-size:.875rem}.table-list table tbody>tr:hover{background-color:#cce5ff}.table-list table tbody span.row-name{display:block;width:100%;font-weight:700}.table-list table tbody span.subname{color:#0f0f0f80}.table-list table tbody .action-icons{color:#007bff}.table-list table tbody .action-icons a{margin:0 .75rem}.table-list table tbody .status{width:13px;height:13px;border-radius:50%}.table-list table tbody .active{background-color:#28a745}.table-list table tbody .inactive{background-color:#a72828}.name-estab{font-size:14px;font-weight:700;text-transform:uppercase;color:#212529}.subname-estab{font-size:12px;color:#212529}#clearFilterBtn,#searchFilterBtn{padding:6px 12px}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "component", type: i5.LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }, { kind: "component", type: i5.LibSpinnerComponent, selector: "lib-spinner", inputs: ["type", "theme", "size", "text"] }, { kind: "component", type: i8.PaginationControlsComponent, selector: "pagination-controls", inputs: ["id", "maxSize", "directionLinks", "autoHide", "responsive", "previousLabel", "nextLabel", "screenReaderPaginationLabel", "screenReaderPageLabel", "screenReaderCurrentLabel"], outputs: ["pageChange", "pageBoundsCorrection"] }, { kind: "directive", type: i9$1.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "pipe", type: i8.PaginatePipe, name: "paginate" }] }); }
|
|
1698
|
+
}
|
|
1699
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelecaoEstabelecimentosModalComponent, decorators: [{
|
|
1700
|
+
type: Component,
|
|
1701
|
+
args: [{ selector: 'selecao-estabelecimentos-modal', template: "<div class=\"main-container\">\r\n <div class=\"modal-header modal-style modal-dialog-centered\">\r\n <h4 class=\"modal-title pull-left color-modal\" style=\"font-size: 20px; font-weight: bold;\"> Selecione um\r\n estabelecimento </h4>\r\n <button (click)=\"closeSelf()\" type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div class=\"modal-message\">\r\n <div class=\"search-and-filters d-flex flex-row align-items-center justify-content-between\">\r\n <div class=\"d-flex flex-row w-100\">\r\n <div class=\"input-group\">\r\n <span class=\"input-group-text px-2\" id=\"basic-addon1\"\r\n style=\"background-color: transparent; border-right: none;\">\r\n <lib-icon iconName=\"lupa\" iconColor=\"gray\"/>\r\n </span>\r\n <input type=\"text\" class=\"form-control border-start-0 ps-0\" id=\"pesquisaInput\" #pesquisa\r\n placeholder=\"Digite o C\u00F3digo\" (keyup.enter)=\"refreshList(pesquisa.value)\">\r\n </div>\r\n </div>\r\n\r\n <div class=\"filters d-flex align-items-center justify-content-between ms-3\">\r\n <div class=\"search-buttons d-flex flex-row align-items-center my-0 mx-0\">\r\n <button id=\"clearFilterBtn\" class=\"btn btn-outline-primary ms-0 no-hover-btn me-2\"\r\n (click)=\"pesquisa.value = ''; refreshList(pesquisa.value)\"> Limpar </button>\r\n <button id=\"searchFilterBtn\" class=\"btn btn-primary me-0\" (click)=\"refreshList(pesquisa.value)\"> Pesquisar\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"table-list w-100 mt-3\" *ngIf=\"$estabelecimentosList; else loading\">\r\n <table class=\"table table-bordered table-hover mb-0\">\r\n <thead class=\"fs-6\">\r\n <tr>\r\n <th scope=\"col\" class=\"col-11 align-middle th\">Estabelecimento <span\r\n class=\"text-primary fst-italic\">(duplo-clique para selecionar)</span></th>\r\n <th scope=\"col\" class=\"col-1 align-middle text-center th\">A\u00E7\u00F5es</th>\r\n </tr>\r\n </thead>\r\n\r\n <tbody *ngIf=\"$estabelecimentosList.length > 0; else emptyList\">\r\n <tr\r\n *ngFor=\"let estabelecimento of $estabelecimentosList | paginate: { itemsPerPage: itemsPerPage, currentPage: page }\"\r\n (dblclick)=\"selectEstabelecimento(estabelecimento.ID, estabelecimento.NOMEEXIBICAO)\" role=\"button\">\r\n <td><span class=\"row-name\"> {{ estabelecimento.CODIGO }} - {{ estabelecimento.NOMEEXIBICAO }} </span>\r\n <span class=\"subname\"> {{ estabelecimento.IS_MATRIZ ? \"Matriz \" : null }} CNPJ: {{ estabelecimento.CNPJ\r\n }} </span></td>\r\n <td class=\"text-center align-middle\">\r\n <div class=\"action-icons d-flex flex-row align-items-center justify-content-around\">\r\n <div class=\"form-check form-switch\">\r\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" id=\"flexSwitchCheckChecked\"\r\n tooltip=\"Estabelecimento padr\u00E3o\" [checked]=\"estabelecimento.IS_DEFAULT\"\r\n style=\"transform: translateY(3px); height: 1rem; width: 28px;\" #isDefaultRow\r\n (click)=\"estabelecimento.IS_DEFAULT = !estabelecimento.IS_DEFAULT; defineDefaultEstabelecimento(estabelecimento.ID, estabelecimento.IS_DEFAULT)\">\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n\r\n <!-- #region EMPTY LIST CELL -->\r\n <ng-template #emptyList>\r\n <tbody>\r\n <tr>\r\n <td colspan=\"2\" class=\"align-middle\"><span class=\"row-name fw-light fst-italic text-center\"> {{\r\n response_messages.emptyMessage }} </span></td>\r\n </tr>\r\n </tbody>\r\n </ng-template>\r\n <!-- #endregion EMPTY LIST CELL -->\r\n </table>\r\n\r\n <!-- #region PAGINATION -->\r\n <div class=\"d-flex justify-content-end mt-2\" *ngIf=\"$estabelecimentosList.length > 0\">\r\n <div class=\"d-flex align-items-center\">\r\n <label class=\"me-2\" style=\"white-space: nowrap;\">Itens por p\u00E1gina</label>\r\n <select class=\"form-select select-search\" (change)=\"onSelectChange($event)\">\r\n <option class=\"selected\" value=\"10\" selected>10</option>\r\n <option value=\"25\">25</option>\r\n <option value=\"50\">50</option>\r\n </select>\r\n </div>\r\n\r\n <pagination-controls class=\"sp-pagination mt-3\" (pageChange)=\"page = $event\"\r\n previousLabel=\"\u00AB \" nextLabel=\" \u00BB\" [maxSize]=\"5\">\r\n </pagination-controls>\r\n </div>\r\n <!-- #endregion PAGINATION -->\r\n \r\n </div>\r\n\r\n <!-- <div class=\"d-flex justify-content-between align-items-center mt-3\">\r\n <span style=\"color: #6C757D\"> Registros {{$estabelecimentosList.length}} de {{$estabelecimentosList.length}} </span>\r\n <nav aria-label=\"...\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item disabled\"> <a class=\"page-link\" href=\"#\" tabindex=\"-1\">Anterior</a> </li>\r\n <li class=\"page-item active\"> <a class=\"page-link\" href=\"#\">1</a> </li>\r\n <li class=\"page-item\"> <a class=\"page-link\" href=\"#\">2</a> </li>\r\n <li class=\"page-item\"> <a class=\"page-link\" href=\"#\">3</a> </li>\r\n <li class=\"page-item\"> <a class=\"page-link\" href=\"#\">Pr\u00F3ximo</a> </li>\r\n </ul>\r\n </nav>\r\n </div> -->\r\n\r\n\r\n <ng-template #loading>\r\n <lib-spinner></lib-spinner>\r\n </ng-template>\r\n </div>\r\n </div>\r\n</div>", styles: [".table-list table thead{height:50px;font-size:1rem;background-color:#e9ecef}.table-list table thead .status-header{width:5%}.table-list table thead th:first-child{width:50px;height:50px}.table-list table thead th{font-size:16px}.table-list table .center-content{text-align:center}.table-list table tbody{font-size:.875rem}.table-list table tbody>tr:hover{background-color:#cce5ff}.table-list table tbody span.row-name{display:block;width:100%;font-weight:700}.table-list table tbody span.subname{color:#0f0f0f80}.table-list table tbody .action-icons{color:#007bff}.table-list table tbody .action-icons a{margin:0 .75rem}.table-list table tbody .status{width:13px;height:13px;border-radius:50%}.table-list table tbody .active{background-color:#28a745}.table-list table tbody .inactive{background-color:#a72828}.name-estab{font-size:14px;font-weight:700;text-transform:uppercase;color:#212529}.subname-estab{font-size:12px;color:#212529}#clearFilterBtn,#searchFilterBtn{padding:6px 12px}\n"] }]
|
|
1702
|
+
}], ctorParameters: () => [{ type: AuthStorageService }, { type: i1$2.BsModalService }, { type: LibCustomMenuService }, { type: MenuServicesService }, { type: i5.MessageService }], propDecorators: { onClose: [{
|
|
1703
|
+
type: Output
|
|
1704
|
+
}], onSelected: [{
|
|
1705
|
+
type: Output
|
|
1706
|
+
}] } });
|
|
1707
|
+
|
|
1708
|
+
class DynamicMenuComponent {
|
|
1709
|
+
constructor(router) {
|
|
1710
|
+
this.router = router;
|
|
1711
|
+
this.selectTemplate = new EventEmitter;
|
|
1712
|
+
this.titleSubmenu = "";
|
|
1713
|
+
this.submenuList = [];
|
|
1714
|
+
this.menuList = [];
|
|
1715
|
+
this.menuStatic = [];
|
|
1716
|
+
this.selectedMenuItem = [];
|
|
1717
|
+
this.selectedItem = -1;
|
|
1718
|
+
}
|
|
1719
|
+
ngOnInit() { }
|
|
1720
|
+
onClickedOutside(e, ref) {
|
|
1721
|
+
ref.classList.remove("opened-sub");
|
|
1722
|
+
this.submenuList = [];
|
|
1723
|
+
this.indicateSelectedMenuItem();
|
|
1724
|
+
}
|
|
1725
|
+
indicateSelectedMenuItem() {
|
|
1726
|
+
if (this.selectedMenuItem.length) {
|
|
1727
|
+
this.selectedItem = this.selectedMenuItem[0];
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
changeStar(ref, id) {
|
|
1731
|
+
ref.classList.toggle("star");
|
|
1732
|
+
ref.classList.toggle("yellow-star");
|
|
1733
|
+
}
|
|
1734
|
+
getExternalUrl(url) {
|
|
1735
|
+
return `https://siscandesv6.sispro.com.br/SisproErpCloud/${url}`;
|
|
1736
|
+
}
|
|
1737
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DynamicMenuComponent, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1738
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: DynamicMenuComponent, selector: "app-dynamic-menu", inputs: { submenuRef: "submenuRef", recebeParam: "recebeParam", titleSubmenu: "titleSubmenu", submenuList: "submenuList" }, outputs: { selectTemplate: "selectTemplate" }, queries: [{ propertyName: "desiredContent", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0, template: "<div #submenu class=\"header-submenu\">\r\n <h1 class=\"titulo pb-3 pt-4\">{{ titleSubmenu }}</h1>\r\n <div class=\"itens-list\">\r\n <ul style=\"width: 100%\">\r\n \r\n <li *ngFor=\"let itemList of submenuList; let i = index\" [id]=\"itemList!.id\" \r\n class=\"d-flex justify-content-between align-items-center\"\r\n [class]=\"i == 0 ? 'mt-1' : ''\">\r\n \r\n <a *ngIf=\"!itemList.isExternal; else externalMenu\"\r\n [routerLink]=\"itemList!.route != null ? ['/' + itemList!.route] : null\" \r\n (click)=\"recebeParam($event, submenuRef)\">\r\n <span>{{ itemList!.label }}</span>\r\n </a>\r\n \r\n <ng-template #externalMenu>\r\n <a [href]=\"getExternalUrl(itemList.route)\"\r\n target=\"_blank\" \r\n (click)=\"recebeParam($event, submenuRef)\">\r\n <span>{{ itemList!.label }}</span>\r\n </a>\r\n </ng-template>\r\n\r\n <!-- <button class=\"star favoritos\" #star (click)=\"changeStar(star, itemList)\"></button> -->\r\n </li>\r\n\r\n </ul>\r\n </div>\r\n</div>", styles: ["*{padding:0;margin:0;font-family:Open sans,Arial,Helvetica,sans-serif;color:#fff}ul{list-style:none;padding-left:0;display:inline;white-space:nowrap}.titulo{font-size:20px;font-weight:700;display:flex;justify-content:center;border-bottom:1px solid #2847a0}ul{display:flex;flex-direction:column;margin:25px 26px 0 24px}ul li{font-size:16px;padding-bottom:18px}ul li span:hover{font-weight:700}a{text-decoration:none}.itens-list{display:flex;align-items:center}.itens-list .favoritos,.itens-list span{cursor:pointer}.footer-menu{display:flex;flex-direction:column;justify-content:center;padding-bottom:16px}.footer-menu .footer-components{border-top:1px solid #3265ee;padding-top:16px;padding-left:17px;white-space:nowrap}.footer-menu button{position:relative;left:35%;border:none;background-color:transparent}.footer-menu .photo-profile{width:32px;height:32px;border-radius:50%;margin:0 15px 0 0}.footer-components{display:flex;justify-content:center;align-items:center}button{position:relative;border:none;background-color:transparent}.photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.submenu.opened-sub{z-index:1;display:flex;position:absolute;left:100%;height:100vh;justify-content:space-between}.submenu-footer{display:flex;flex-direction:row;justify-content:center;align-content:center;margin-bottom:14px;border-top:1px solid #2847a0}.submenu-footer .subfooter-components{padding-top:16px}.submenu-footer span{font-weight:700;padding-left:10px}.star{width:24px;height:24px;background-repeat:no-repeat}.yellow-star{width:26px;height:24px;background-repeat:no-repeat}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] }); }
|
|
1739
|
+
}
|
|
1740
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DynamicMenuComponent, decorators: [{
|
|
1741
|
+
type: Component,
|
|
1742
|
+
args: [{ selector: 'app-dynamic-menu', template: "<div #submenu class=\"header-submenu\">\r\n <h1 class=\"titulo pb-3 pt-4\">{{ titleSubmenu }}</h1>\r\n <div class=\"itens-list\">\r\n <ul style=\"width: 100%\">\r\n \r\n <li *ngFor=\"let itemList of submenuList; let i = index\" [id]=\"itemList!.id\" \r\n class=\"d-flex justify-content-between align-items-center\"\r\n [class]=\"i == 0 ? 'mt-1' : ''\">\r\n \r\n <a *ngIf=\"!itemList.isExternal; else externalMenu\"\r\n [routerLink]=\"itemList!.route != null ? ['/' + itemList!.route] : null\" \r\n (click)=\"recebeParam($event, submenuRef)\">\r\n <span>{{ itemList!.label }}</span>\r\n </a>\r\n \r\n <ng-template #externalMenu>\r\n <a [href]=\"getExternalUrl(itemList.route)\"\r\n target=\"_blank\" \r\n (click)=\"recebeParam($event, submenuRef)\">\r\n <span>{{ itemList!.label }}</span>\r\n </a>\r\n </ng-template>\r\n\r\n <!-- <button class=\"star favoritos\" #star (click)=\"changeStar(star, itemList)\"></button> -->\r\n </li>\r\n\r\n </ul>\r\n </div>\r\n</div>", styles: ["*{padding:0;margin:0;font-family:Open sans,Arial,Helvetica,sans-serif;color:#fff}ul{list-style:none;padding-left:0;display:inline;white-space:nowrap}.titulo{font-size:20px;font-weight:700;display:flex;justify-content:center;border-bottom:1px solid #2847a0}ul{display:flex;flex-direction:column;margin:25px 26px 0 24px}ul li{font-size:16px;padding-bottom:18px}ul li span:hover{font-weight:700}a{text-decoration:none}.itens-list{display:flex;align-items:center}.itens-list .favoritos,.itens-list span{cursor:pointer}.footer-menu{display:flex;flex-direction:column;justify-content:center;padding-bottom:16px}.footer-menu .footer-components{border-top:1px solid #3265ee;padding-top:16px;padding-left:17px;white-space:nowrap}.footer-menu button{position:relative;left:35%;border:none;background-color:transparent}.footer-menu .photo-profile{width:32px;height:32px;border-radius:50%;margin:0 15px 0 0}.footer-components{display:flex;justify-content:center;align-items:center}button{position:relative;border:none;background-color:transparent}.photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.submenu.opened-sub{z-index:1;display:flex;position:absolute;left:100%;height:100vh;justify-content:space-between}.submenu-footer{display:flex;flex-direction:row;justify-content:center;align-content:center;margin-bottom:14px;border-top:1px solid #2847a0}.submenu-footer .subfooter-components{padding-top:16px}.submenu-footer span{font-weight:700;padding-left:10px}.star{width:24px;height:24px;background-repeat:no-repeat}.yellow-star{width:26px;height:24px;background-repeat:no-repeat}\n"] }]
|
|
1743
|
+
}], ctorParameters: () => [{ type: i1$1.Router }], propDecorators: { selectTemplate: [{
|
|
1744
|
+
type: Output
|
|
1745
|
+
}], submenuRef: [{
|
|
1746
|
+
type: Input
|
|
1747
|
+
}], recebeParam: [{
|
|
1748
|
+
type: Input
|
|
1749
|
+
}], titleSubmenu: [{
|
|
1750
|
+
type: Input
|
|
1751
|
+
}], submenuList: [{
|
|
1752
|
+
type: Input
|
|
1753
|
+
}], desiredContent: [{
|
|
1754
|
+
type: ContentChild,
|
|
1755
|
+
args: [TemplateRef]
|
|
1756
|
+
}] } });
|
|
1757
|
+
|
|
1758
|
+
class NotifSubmenuComponent {
|
|
1759
|
+
constructor() { }
|
|
1760
|
+
ngOnInit() {
|
|
1761
|
+
}
|
|
1762
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NotifSubmenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1763
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: NotifSubmenuComponent, selector: "app-notif-submenu", ngImport: i0, template: "<div class=\"header-submenu\">\r\n <h1 class=\"titulo pb-3 pt-4\">Notifica\u00E7\u00F5es</h1>\r\n</div>\r\n<div class=\"body-notif\">\r\n <div class=\"new-notif\">\r\n <div class=\"session-header p-2\">\r\n <p class=\"session-h-item\">Novas (2)</p><p>Marcar todas como Lidas</p>\r\n </div>\r\n <div class=\"scroll\">\r\n <div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n \r\n <div class=\"read-notif\">\r\n <div class=\"session-header p-2\">\r\n <p class=\"session-h-item\">Lidas</p>\r\n </div>\r\n <div class=\"scroll-second\">\r\n <div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has\r\n Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["*{padding:0;margin:0;font-family:Open sans,Arial,Helvetica,sans-serif;color:#fff}ul{list-style:none;padding-left:0;display:inline;white-space:nowrap}::-webkit-scrollbar{width:4px;background:transparent}::-webkit-scrollbar-thumb{background:#fff;border-radius:16px}.titulo{font-size:20px;font-weight:700;display:flex;justify-content:center;border-bottom:1px solid #2847a0}ul{display:flex;flex-direction:column;margin:25px 26px 0 24px}ul li{font-size:20px;font-weight:600;line-height:22px;padding-bottom:18px}button{position:relative;border:none;background-color:transparent}.session-header{display:flex;justify-content:space-between;background-color:#2847a0}.session-header .session-h-item{font-weight:700}.session{border-bottom:1px solid #fff;overflow:auto;height:100%}.session:last-child{border-bottom:none}.session-start{display:flex}.item-end{display:flex;justify-content:space-between}.scroll{margin-right:2px;overflow:auto;max-height:300px}.scroll-second{margin-right:2px;overflow:auto;max-height:481px}\n"] }); }
|
|
1764
|
+
}
|
|
1765
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NotifSubmenuComponent, decorators: [{
|
|
1766
|
+
type: Component,
|
|
1767
|
+
args: [{ selector: 'app-notif-submenu', template: "<div class=\"header-submenu\">\r\n <h1 class=\"titulo pb-3 pt-4\">Notifica\u00E7\u00F5es</h1>\r\n</div>\r\n<div class=\"body-notif\">\r\n <div class=\"new-notif\">\r\n <div class=\"session-header p-2\">\r\n <p class=\"session-h-item\">Novas (2)</p><p>Marcar todas como Lidas</p>\r\n </div>\r\n <div class=\"scroll\">\r\n <div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n \r\n <div class=\"read-notif\">\r\n <div class=\"session-header p-2\">\r\n <p class=\"session-h-item\">Lidas</p>\r\n </div>\r\n <div class=\"scroll-second\">\r\n <div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has\r\n Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n <div class=\"session mb-3 pb-3\">\r\n <div class=\"session-start mt-3 ms-3\">\r\n <img src=\"assets/icons/file-text.svg\" alt=\"\"><p>Contratos</p>\r\n </div>\r\n <div class=\"m-4\">\r\n <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has </p>\r\n </div>\r\n <div class=\"item-end ms-4 mx-4\">\r\n <button>Marcar como lida</button>\r\n <p>2h atr\u00E1s</p>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["*{padding:0;margin:0;font-family:Open sans,Arial,Helvetica,sans-serif;color:#fff}ul{list-style:none;padding-left:0;display:inline;white-space:nowrap}::-webkit-scrollbar{width:4px;background:transparent}::-webkit-scrollbar-thumb{background:#fff;border-radius:16px}.titulo{font-size:20px;font-weight:700;display:flex;justify-content:center;border-bottom:1px solid #2847a0}ul{display:flex;flex-direction:column;margin:25px 26px 0 24px}ul li{font-size:20px;font-weight:600;line-height:22px;padding-bottom:18px}button{position:relative;border:none;background-color:transparent}.session-header{display:flex;justify-content:space-between;background-color:#2847a0}.session-header .session-h-item{font-weight:700}.session{border-bottom:1px solid #fff;overflow:auto;height:100%}.session:last-child{border-bottom:none}.session-start{display:flex}.item-end{display:flex;justify-content:space-between}.scroll{margin-right:2px;overflow:auto;max-height:300px}.scroll-second{margin-right:2px;overflow:auto;max-height:481px}\n"] }]
|
|
1768
|
+
}], ctorParameters: () => [] });
|
|
1769
|
+
|
|
1770
|
+
class MenuLateralComponent {
|
|
1771
|
+
constructor(_customMenuService, _authStorageService, _bsModalService, _menuServices, _messageService,
|
|
1772
|
+
//private _projectUtilService: ProjectUtilservice,
|
|
1773
|
+
_router, _authService) {
|
|
1774
|
+
this._customMenuService = _customMenuService;
|
|
1775
|
+
this._authStorageService = _authStorageService;
|
|
1776
|
+
this._bsModalService = _bsModalService;
|
|
1777
|
+
this._menuServices = _menuServices;
|
|
1778
|
+
this._messageService = _messageService;
|
|
1779
|
+
this._router = _router;
|
|
1780
|
+
this._authService = _authService;
|
|
1781
|
+
this.MODAL_ESTABELECIMENTO = 1;
|
|
1782
|
+
this.nomeEstabelecimento = 'Estabelecimento padrão';
|
|
1783
|
+
this.titleSubmenu = "";
|
|
1784
|
+
this.submenuList = [];
|
|
1785
|
+
this.messageIfClicked = new Subject();
|
|
1786
|
+
/** Esta variável é usada na abertura do submenu e do submenu secundário para
|
|
1787
|
+
* que a função onClickedOutside() que está na segunda div principal do HTML do
|
|
1788
|
+
* componente não seja ativada, pois se ela for ativada ela irá fechar o menu
|
|
1789
|
+
* lateral, e quando vamos do submenu para o submenu secundário não queremos
|
|
1790
|
+
* fechar o menu lateral, e quando vamos do submenu secundário para o submenu
|
|
1791
|
+
* também não queremos fechar o menu lateral;
|
|
1792
|
+
*/
|
|
1793
|
+
this.closeMenu = true;
|
|
1794
|
+
/** Utilizada como a fonte da imagem de perfil do usuário logado no sistema. */
|
|
1795
|
+
this.footerUserImgSrc = "";
|
|
1796
|
+
/** Emai do usuário logado para ser exibido no popover */
|
|
1797
|
+
this.footerUserEmail = "";
|
|
1798
|
+
/** Nome do usuário logado para ser exibido no rodapé do menu. */
|
|
1799
|
+
this.footerUserName = "Usuário";
|
|
1800
|
+
this.isPopoverVisible = false;
|
|
1801
|
+
this.showBalloon = false;
|
|
1802
|
+
// propriedades iniciadas quando passar o CustomMenuService
|
|
1803
|
+
this.menuDynamic = false;
|
|
1804
|
+
this.menuConfig = new MenuConfigService;
|
|
1805
|
+
// Implementação que verifica eventos acionados na classe de service.
|
|
1806
|
+
this._menuServices.getNewUserImageEvent().subscribe(() => { this.getMenuUserImg(); });
|
|
1807
|
+
}
|
|
1808
|
+
ngOnInit() {
|
|
1809
|
+
console.log(this.menuConfig);
|
|
1810
|
+
// Inscreva-se no evento NavigationEnd para receber notificações quando a rota mudar, serve para atualizar a seleção do menu corretamente
|
|
1811
|
+
this._router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event) => {
|
|
1812
|
+
this._customMenuService.menuItems = this._customMenuService.menuConfig.updateRouteSelection(this._router.url, this._customMenuService.menuItems);
|
|
1813
|
+
});
|
|
1814
|
+
if (!this._customMenuService.menuDynamic) {
|
|
1815
|
+
this._customMenuService.menuConfig.setMenuStatic(true);
|
|
1816
|
+
this._customMenuService.menuItems = this._customMenuService.menuConfig.initializeMenu(this._router.url);
|
|
1817
|
+
// Método com customizações para inicialização do Menu Estático
|
|
1818
|
+
this._customMenuService.menuStaticOnInit();
|
|
1819
|
+
}
|
|
1820
|
+
else {
|
|
1821
|
+
// Método com customizações para inicialização do Menu Dinâmico
|
|
1822
|
+
this._customMenuService.menuDynamicOnInit();
|
|
1823
|
+
}
|
|
1824
|
+
this.nomeEstabelecimento = this._authStorageService.infraEstabNome;
|
|
1825
|
+
this.footerUserName = this._authStorageService.userName;
|
|
1826
|
+
this.checkForCachedImage();
|
|
1827
|
+
this.getUserEmail();
|
|
1828
|
+
}
|
|
1829
|
+
// #endregion PUBLIC
|
|
1830
|
+
// #endregion ==========> PROPERTIES <==========
|
|
1831
|
+
// #region ==========> SERVICES <==========
|
|
1832
|
+
// #region GET
|
|
1833
|
+
getEstabelecimentoSession(estabID) {
|
|
1834
|
+
this._menuServices.getEstabelecimentoSession(estabID).subscribe({
|
|
1835
|
+
next: response => {
|
|
1836
|
+
this.nomeEstabelecimento = response.InfraEstabNome;
|
|
1837
|
+
this._authStorageService.infraEmpresaId = response.InfraEmpresaId;
|
|
1838
|
+
this._authStorageService.infraEmpresaNome = response.InfraEmpresaNome;
|
|
1839
|
+
},
|
|
1840
|
+
error: error => {
|
|
1841
|
+
//this._projectUtilService.showHttpError(error);
|
|
1842
|
+
this._messageService.showAlertDanger(error);
|
|
1843
|
+
throw new Error(error);
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
getMenuUserImg() {
|
|
1848
|
+
this._menuServices.getImagemMenu().subscribe({
|
|
1849
|
+
next: response => { this.footerUserImgSrc = response.InfraUsuarioImg.IMAGEM; },
|
|
1850
|
+
error: error => {
|
|
1851
|
+
//this._projectUtilService.showHttpError(error);
|
|
1852
|
+
this._messageService.showAlertDanger(error);
|
|
1853
|
+
throw new Error(error);
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
getUserEmail() {
|
|
1858
|
+
this._menuServices.getUsuarioEmail().subscribe({
|
|
1859
|
+
next: response => { this.footerUserEmail = response.Email; },
|
|
1860
|
+
error: error => {
|
|
1861
|
+
//this._projectUtilService.showHttpError(error);
|
|
1862
|
+
this._messageService.showAlertDanger(error);
|
|
1863
|
+
throw new Error(error);
|
|
1864
|
+
}
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
// #endregion GET
|
|
1868
|
+
// #region UPDATE
|
|
1869
|
+
updateLastLogEstabelecimento(estab) {
|
|
1870
|
+
this._menuServices.updateLastLogEstabID(estab.split(" - ")[0]).subscribe({
|
|
1871
|
+
next: () => {
|
|
1872
|
+
this._messageService.showAlertSuccess('Estabelecimento alterado com sucesso!');
|
|
1873
|
+
this.getEstabelecimentoSession(estab.split(" - ")[0]);
|
|
1874
|
+
}
|
|
1875
|
+
});
|
|
1876
|
+
this._authStorageService.infraEstabId = estab.split(" - ")[0];
|
|
1877
|
+
this._authStorageService.infraEstabNome = estab.split(" - ")[1];
|
|
1878
|
+
}
|
|
1879
|
+
// #endregion UPDATE
|
|
1880
|
+
// #endregion ==========> SERVICES <==========
|
|
1881
|
+
// #region ==========> UTILITIES <==========
|
|
1882
|
+
togglePopover() { this.showBalloon = !this.showBalloon; }
|
|
1883
|
+
dropdownWasOpened(value) { this.messageIfClicked.next(value); }
|
|
1884
|
+
openExpansibleMenu(ref) {
|
|
1885
|
+
ref.classList.toggle("closed");
|
|
1886
|
+
ref.classList.toggle("col");
|
|
1887
|
+
document.querySelector(".sidebar-control")?.classList.toggle("col");
|
|
1888
|
+
// Método com customizações para inicialização do Menu Estático
|
|
1889
|
+
this._customMenuService.menuopenExpansibleMenu(ref);
|
|
1890
|
+
}
|
|
1891
|
+
openSubmenu(menu, ref, desiredMenu) {
|
|
1892
|
+
if (menu.children && menu.children.length > 0) {
|
|
1893
|
+
this.titleSubmenu = menu.label;
|
|
1894
|
+
this.desiredContent = desiredMenu;
|
|
1895
|
+
ref.classList.remove("opened-notif-sub");
|
|
1896
|
+
if (this.submenuList === menu.children) {
|
|
1897
|
+
this.closeMenu = false;
|
|
1898
|
+
}
|
|
1899
|
+
else if (!ref.classList.contains("opened-sub")) {
|
|
1900
|
+
ref.classList.toggle("opened-sub");
|
|
1901
|
+
}
|
|
1902
|
+
this.submenuList = menu.children;
|
|
1903
|
+
}
|
|
1904
|
+
else if (!menu.children || (menu.children && menu.children.length == 0)) {
|
|
1905
|
+
this.submenuList = [];
|
|
1906
|
+
ref.classList.toggle("selectedItem");
|
|
1907
|
+
this.onClickedOutside(new Event(""), ref);
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
// public onClickedOutside(e: Event, ref: HTMLDivElement): void {
|
|
1911
|
+
// ref.classList.remove("opened-sub");
|
|
1912
|
+
// this.submenuList = [];
|
|
1913
|
+
// }
|
|
1914
|
+
onClickedOutside(e, ref) {
|
|
1915
|
+
if (ref) {
|
|
1916
|
+
ref.classList.remove("opened-sub");
|
|
1917
|
+
this.submenuList = [];
|
|
1918
|
+
}
|
|
1919
|
+
else {
|
|
1920
|
+
console.log(ref);
|
|
1921
|
+
console.warn('ref is undefined or null');
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
// #region MENU FOOTER USER IMAGE
|
|
1925
|
+
validateCachedImg(footerImg) {
|
|
1926
|
+
let usuarioId = this._authStorageService.infraUsuarioId;
|
|
1927
|
+
if (!footerImg || footerImg == null) {
|
|
1928
|
+
return true;
|
|
1929
|
+
}
|
|
1930
|
+
if (usuarioId != footerImg.USUARIOID) {
|
|
1931
|
+
return true;
|
|
1932
|
+
}
|
|
1933
|
+
this.footerUserImgSrc = footerImg.FILE;
|
|
1934
|
+
return false;
|
|
1935
|
+
}
|
|
1936
|
+
checkForCachedImage() {
|
|
1937
|
+
const isAPIRequestNeeded = this.validateCachedImg(this._menuServices.getMenuFooterImg());
|
|
1938
|
+
if (isAPIRequestNeeded) {
|
|
1939
|
+
this.getMenuUserImg();
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
// #endregion MENU FOOTER USER IMAGE
|
|
1943
|
+
logout() {
|
|
1944
|
+
this._authService.logout();
|
|
1945
|
+
}
|
|
1946
|
+
getExternalUrl(url) {
|
|
1947
|
+
return `https://siscandesv6.sispro.com.br/SisproErpCloud/${url}`;
|
|
1948
|
+
}
|
|
1949
|
+
// #endregion ==========> UTILITIES <==========
|
|
1950
|
+
// #region ==========> MODALS <==========
|
|
1951
|
+
/** Função simples com o objetivo de abrir os modais no centro da tela.
|
|
1952
|
+
* @param template Template HTML do modal que será aberto.
|
|
1953
|
+
* @param modalID ID do modal que será aberto, para que possa ser referenciado depois.
|
|
1954
|
+
*/
|
|
1955
|
+
openModal(template, modalID) {
|
|
1956
|
+
this._bsModalService.show(template, {
|
|
1957
|
+
class: 'modal-dialog-centered modal-lg',
|
|
1958
|
+
ignoreBackdropClick: false,
|
|
1959
|
+
keyboard: false,
|
|
1960
|
+
id: modalID
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
/** Função simples com o objetivo de fechar os modais que estiverem abertos (baseados pelo ID).
|
|
1964
|
+
* @param modalID ID do modal que será fechado.
|
|
1965
|
+
*/
|
|
1966
|
+
closeModal(modalID) {
|
|
1967
|
+
this._bsModalService.hide(modalID);
|
|
1968
|
+
}
|
|
1969
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MenuLateralComponent, deps: [{ token: LibCustomMenuService }, { token: AuthStorageService }, { token: i1$2.BsModalService }, { token: MenuServicesService }, { token: i5.MessageService }, { token: i1$1.Router }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1970
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: MenuLateralComponent, selector: "app-menu-lateral", queries: [{ propertyName: "desiredContent", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "notif_template", first: true, predicate: ["notif_menu"], descendants: true }, { propertyName: "menuLink", first: true, predicate: ["menuLink"], descendants: true }], ngImport: i0, template: "<!-- #region MAIN CONTENT -->\r\n<div class=\"main col-12\">\r\n\r\n <div style=\"height: 100vh; z-index: 3;\" class=\"sidebar-control position-relative d-flex flex-row\" \r\n (clickOutside)=\"closeMenu == true ? onClickedOutside($event, submenu_ref) : closeMenu = true\">\r\n <div class=\"sidebar {{_customMenuService.themeColor}} closed\" #sidebar>\r\n <div class=\"menu-header\">\r\n <ul>\r\n <li class=\"mb-3\">\r\n <div class=\"logo-hamburguer\">\r\n <img src=\"assets/icons/logotipo-sispro.svg\" alt=\"logo-sispro\" class=\"logo-sispro\" title=\"logo\" width=\"136px\" height=\"48px\">\r\n <button class=\"button-hamburguer\" (click)=\"openExpansibleMenu(sidebar)\">\r\n <img src=\"assets/icons/menu.svg\" alt=\"menu hamburguer\">\r\n </button>\r\n </div>\r\n </li>\r\n\r\n <!-- #region M\u00D3DULOS -->\r\n <li class=\"mb-3\" style=\"margin-left: 8px; margin-right: 8px\">\r\n <div class=\"btn-group\">\r\n <button (click)=\"dropdownWasOpened(true)\" type=\"button\" class=\"dropdown-button\" data-bs-toggle=\"dropdown\"\r\n aria-expanded=\"false\" data-bs-auto-close=\"outside\">\r\n\r\n <ng-container>\r\n <img *ngIf=\"_customMenuService.moduleImg != ''; else moduleSVG\" [src]=\"_customMenuService.moduleImg\" alt=\"\">\r\n <span class=\"ps-2\"> {{ this._customMenuService.moduleName }} <lib-icon iconName=\"seta-direita\" iconColor=\"white\" /> </span>\r\n\r\n <ng-template #moduleSVG>\r\n <lib-icon iconColor=\"white\" [iconName]=\"_customMenuService.moduleSvg\"/>\r\n </ng-template>\r\n </ng-container>\r\n\r\n </button>\r\n <ul class=\"dropdown-menu\" #dropdown_ref>\r\n <app-primary-dropdown [buttonWasClicked]=\"messageIfClicked\"></app-primary-dropdown>\r\n </ul>\r\n </div>\r\n </li>\r\n <!-- #endregion M\u00D3DULOS -->\r\n\r\n <!-- #region ESTABELECIMENTOS -->\r\n <li class=\"mx-3\" style=\"margin-bottom: 16px;\">\r\n <div class=\"icon-estabelecimento\">\r\n <button class=\"row justify-content-between bg-transparent border-0\"\r\n (click)=\"openModal(modalEstabelecimento, MODAL_ESTABELECIMENTO)\"\r\n [tooltip]=\"!sidebar.classList.contains('closed') ? '' : nomeEstabelecimento\" placement=\"right\">\r\n\r\n <lib-icon class=\"col-1\" iconName=\"predio\" iconColor=\"white\" />\r\n <span *ngIf=\"!sidebar.classList.contains('closed')\" class=\"col-9 ps-2 glb-text-width-160 text-start text-truncate\"> {{ nomeEstabelecimento }} </span>\r\n <lib-icon *ngIf=\"!sidebar.classList.contains('closed')\" class=\"col-1\" iconName=\"seta-direita\" iconColor=\"white\" />\r\n </button>\r\n </div>\r\n </li>\r\n <!-- #endregion ESTABELECIMENTOS -->\r\n\r\n </ul>\r\n\r\n </div>\r\n\r\n <!-- #region MENUS DE NAVEGA\u00C7\u00C3O -->\r\n <div class=\"main-menu\">\r\n <div class=\"scroll\">\r\n <div class=\"list-menu px-2 pb-1\">\r\n\r\n <!-- #region MENU DIN\u00C2MICO -->\r\n <div class=\"dynamic-menu\">\r\n <ul #dynamic_menu_items *ngIf=\"_customMenuService.menuItems; else isLoading\">\r\n\r\n <li *ngFor=\"let menuItem of _customMenuService.menuItems; let i = index\" \r\n class=\"p-1 rounded\" \r\n (click)=\"openSubmenu(menuItem, submenu_ref, dynamic_menu)\" \r\n [class.selectedItem]=\"menuItem.isSelected\">\r\n\r\n <a *ngIf=\"!menuItem.isExternal; else externalMenu\"\r\n [routerLink]=\"menuItem.route != '' ? menuItem.route : null\" \r\n [id]=\"'item' + menuItem.id\" \r\n [tooltip]=\"!sidebar.classList.contains('closed') ? '' : menuItem.label\" \r\n placement=\"left\" class=\"w-100 d-flex align-items-center button-icons text-decoration-none p-1 glb-cursor-pointer\" \r\n [class]=\"sidebar.classList.contains('closed') ? 'justify-content-center' : 'justify-content-between'\">\r\n\r\n <div class=\"container\">\r\n <lib-icon *ngIf=\"!menuItem.icon.includes('assets/icons'); else iconImg\" [iconName]=\"menuItem.icon\" iconColor=\"white\"/>\r\n <span class=\"span-main\">{{ menuItem.label }}</span>\r\n <ng-template #iconImg>\r\n <img [src]=\"menuItem.icon\" [alt]=\"'icone: ' + menuItem.label\">\r\n </ng-template>\r\n </div>\r\n <lib-icon *ngIf=\"(menuItem.children && menuItem.children.length > 0) && !sidebar.classList.contains('closed')\" \r\n iconName=\"seta-direita\" iconColor=\"white\"/>\r\n </a>\r\n \r\n <ng-template #externalMenu>\r\n <a [href]=\"getExternalUrl(menuItem.route)\"\r\n target=\"_blank\" \r\n [id]=\"'item' + menuItem.id\" \r\n [tooltip]=\"!sidebar.classList.contains('closed') ? '' : menuItem.label\" \r\n placement=\"left\" class=\"w-100 d-flex align-items-center button-icons text-decoration-none p-1 glb-cursor-pointer\" \r\n [class]=\"sidebar.classList.contains('closed') ? 'justify-content-center' : 'justify-content-between'\">\r\n\r\n <div class=\"container\">\r\n <lib-icon *ngIf=\"!menuItem.icon.includes('assets/icons'); else iconImgExternal\" [iconName]=\"menuItem.icon\" iconColor=\"white\"/>\r\n <span class=\"span-main\">{{ menuItem.label }}</span>\r\n <ng-template #iconImgExternal>\r\n <img [src]=\"menuItem.icon\" [alt]=\"'icone: ' + menuItem.label\">\r\n </ng-template>\r\n </div>\r\n <lib-icon *ngIf=\"(menuItem.children && menuItem.children.length > 0) && !sidebar.classList.contains('closed')\" \r\n iconName=\"seta-direita\" iconColor=\"white\"/>\r\n </a>\r\n </ng-template>\r\n </li>\r\n\r\n </ul>\r\n </div>\r\n\r\n <ng-template #isLoading>\r\n <li class=\"spinner-border spinner-border-sm mt-2\" role=\"status\" aria-hidden=\"true\"></li>\r\n </ng-template>\r\n <!-- #endregion MENU DIN\u00C2MICO -->\r\n\r\n </div>\r\n </div>\r\n </div>\r\n <!-- #endregion MENUS DE NAVEGA\u00C7\u00C3O -->\r\n\r\n <!-- #region FOOTER -->\r\n <div class=\"footer-menu\" (mouseenter)=\"showBalloon = true\" (mouseleave)=\"showBalloon = false\"\r\n [popover]=\"popoverContent\" placement=\"right bottom\" [outsideClick]=\"true\" containerClass=\"width: 200px\" >\r\n <div class=\"footer-components ps-1 pt-2\" [class.open]=\"showBalloon\">\r\n <button type=\"button\" class=\"btn btn-primary\">\r\n <img *ngIf=\"footerUserImgSrc; else noUserImg\" class=\"photo-profile ms-1\"\r\n [src]=\"['data:image/jpeg;base64,' + footerUserImgSrc]\" alt=\"foto-perfil\">\r\n <ng-template #noUserImg>\r\n <lib-icon iconName=\"contraparte\" iconColor=\"white\"/>\r\n </ng-template>\r\n <span class=\"glb-text-width-120 w-auto fw-bold text-start text-truncate ms-1 me-1\">\r\n {{ footerUserName }}\r\n </span>\r\n </button>\r\n </div>\r\n </div>\r\n \r\n <ng-template #popoverContent>\r\n <div class=\"footer-menu\" style=\"width: 1000px;\">\r\n <div class=\"d-flex align-items-center\"> \r\n <img *ngIf=\"footerUserImgSrc; else noUserImg\" class=\"photo-profile\"\r\n [src]=\"['data:image/jpeg;base64,' + footerUserImgSrc]\" alt=\"foto-perfil\"> \r\n <ng-template #noUserImg>\r\n <lib-icon iconName=\"contraparte\" iconColor=\"white\"/>\r\n </ng-template>\r\n <div class=\"d-flex flex-column ms-1\"> \r\n <div [tooltip]=\"footerUserName\" class=\"dynamic-container\" style=\"white-space: nowrap; flex-grow: 1;max-width: 200px; font-size: 16px;\">{{footerUserName}}</div>\r\n <div [tooltip]=\"footerUserEmail\" class=\"dynamic-container\" style=\"white-space: nowrap; font-size: 12px; flex-grow: 1;max-width: 200px;\">{{footerUserEmail}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n <hr class=\"mb-2 mt-2\">\r\n <div routerLink=\"meu-perfil\" style=\"cursor: pointer;\" (click)=\"togglePopover(); $event.stopPropagation()\">\r\n <lib-icon [iconSize]=\"'small'\" iconName=\"contraparte\"/> Meu Perfil\r\n </div>\r\n <div class=\"mt-2\" (click)=\"logout()\" style=\"cursor: pointer;\">\r\n <lib-icon [iconSize]=\"'small'\" iconName=\"logout\"/> Sair\r\n </div>\r\n </ng-template>\r\n <!-- #endregion FOOTER -->\r\n\r\n </div>\r\n\r\n <div class=\"submenu\" #submenu_ref>\r\n <ng-template [ngIf]=\"desiredContent !== null\">\r\n <ng-content *ngTemplateOutlet=\"desiredContent!; context: {$implicit: submenuList}\"></ng-content>\r\n </ng-template>\r\n </div>\r\n </div>\r\n \r\n <div class=\"main-content col d-flex flex-column align-content-between\" id=\"body-content\">\r\n <div class=\"content\" style=\"position: relative;\">\r\n <router-outlet></router-outlet>\r\n </div>\r\n <div app-footer></div>\r\n </div>\r\n\r\n</div>\r\n<!-- #endregion MAIN CONTENT -->\r\n\r\n<!-- #region TEMPLATES -->\r\n<!-- tem que perguntar pro Erick -->\r\n<!-- [submenuRef]=\"submenu_ref\" -->\r\n<ng-template #dynamic_menu let-data>\r\n <app-dynamic-menu \r\n [submenuList]=\"data\"\r\n [titleSubmenu]=\"titleSubmenu\"\r\n [submenuRef]=\"submenu_ref\"\r\n [recebeParam]=\"onClickedOutside.bind(this)\">\r\n </app-dynamic-menu>\r\n</ng-template>\r\n\r\n<ng-template #notif_menu>\r\n <app-notif-submenu></app-notif-submenu>\r\n</ng-template>\r\n\r\n<!-- #region MODAL SELECAO ESTABELECIMENTO -->\r\n<ng-template #modalEstabelecimento>\r\n <selecao-estabelecimentos-modal (onClose)=\"closeModal(MODAL_ESTABELECIMENTO)\"\r\n (onSelected)=\"closeModal(MODAL_ESTABELECIMENTO); updateLastLogEstabelecimento($event);\"></selecao-estabelecimentos-modal>\r\n</ng-template>\r\n<!-- #endregion MODAL SELECAO ESTABELECIMENTO -->\r\n\r\n<!-- #endregion TEMPLATES -->\r\n", styles: [".main{display:flex;width:100%;height:100%;background:#eee}::-webkit-scrollbar{width:8px;background:transparent}::-webkit-scrollbar-thumb{background:#bbb;border-radius:16px}.main-content{width:100%;z-index:0;overflow-y:auto;overflow:overlay;height:100vh}.main-content .content{padding:0 16px 16px;background-color:#eee!important}.disable-scroll{overflow-y:hidden}*{padding:0;margin:0;font-family:Open sans,Arial,Helvetica,sans-serif;font-size:14px}span{color:#fff}ul{list-style:none;padding-left:0;white-space:nowrap}.dropdown-button{padding:8px;border-radius:8px;background-color:#3265ee;border:none;font-size:14px;font-weight:700;width:100%;display:flex}.dropdown-button span{width:100%;display:flex;justify-content:space-between}.dropdown-menu{width:212px;border-radius:8px}.dropdown-menu li{margin:16px 8px}.dropdown-menu li a{font-size:14px}.dropdown-menu li a:hover{font-weight:700;background-color:transparent}.dropdown-menu .dropdown-divider{height:0}.link-portal{color:#213b70;text-decoration:underline;text-align:center;font-weight:700;font-size:14px}.container{display:flex;width:max-content}.sidebar{display:flex;flex-direction:column;height:100%;grid-template-rows:min-content;box-sizing:border-box;transition:width .5s;background-color:#213b70;max-width:inherit}.sidebar .footer-menu{justify-content:flex-end}.menu-header{display:flex;flex-direction:column;white-space:nowrap;padding:32px 0 0;background-color:#213b70}.menu-header ul li{margin-left:16px;margin-right:16px}.menu-header ul>li:last-child{border-bottom:1px solid #3265ee;padding-bottom:15px;height:auto}.dropdown{margin:0}.btn-group{width:100%}.sidebar.closed .menu-header ul li{margin-left:0;margin-right:0}.sidebar.closed .menu-header{display:flex;flex-direction:column;align-items:center}.icon-estabelecimento button{display:flex;flex-direction:row;width:100%;align-items:center;justify-content:center}.icon-estabelecimento button span:hover{font-weight:700}.header-content{display:flex;flex-direction:column;justify-content:space-evenly;height:100%;margin:0 20px}.logo-hamburguer{display:flex;justify-content:space-between;margin-right:8px}.logo-hamburguer .button-hamburguer{border:none;background-color:transparent}.sidebar.closed .logo-hamburguer{justify-content:center;margin-right:0}.scroll{overflow-y:auto;overflow-x:hidden;min-height:20%;margin-right:2px}.list-menu{padding-left:16px;padding-right:8px;display:flex;flex-direction:column;justify-content:center;white-space:nowrap}.list-menu .text-closed{padding-top:15px;display:none;color:#fff}.list-menu .text-opened{color:#fff;font-size:12px;padding-top:15px;visibility:visible;white-space:nowrap}.list-menu .li-main{padding:10px 7px;border-radius:8px}.list-menu .onSelect{background-color:#3265ee}.list-menu div.static-menu>ul>li:first-child{margin-top:16px}.list-menu .span-main{font-size:14px;margin-left:8px;opacity:1;pointer-events:auto;white-space:break-spaces}.list-menu .span-main:hover,.list-menu .list-options span:hover{font-weight:700}.list-menu p{font-size:10px;font-weight:700;text-transform:uppercase;border-bottom:1px solid #3265ee;visibility:hidden}.selectedItem{background-color:#3265ee}.selectedItem span{font-weight:700;background-color:transparent}.notif{padding:2px 13px;margin-bottom:none;background-color:#000;border-radius:8px;font-weight:700}.sidebar.closed .chevron{display:none}.sidebar.closed .icon-estabelecimento{margin:0}.sidebar.closed .icon-estabelecimento button{justify-content:center}.sidebar.closed .icon-estabelecimento button img{margin:0}.align-chevron{width:100%;text-align:justify;align-items:center;display:flex;justify-content:space-between}.selected-color{background-color:#3265ee}.main-menu{display:flex;flex-direction:column;justify-content:space-between;height:100%;min-height:20%}.button-icons{border:none;background-color:transparent}.footer-menu{display:flex;flex-direction:column;padding-bottom:8px}.footer-menu .footer-components{display:flex;justify-content:space-between;border-top:1px solid #3265ee;white-space:nowrap;align-items:center}.footer-menu .footer-components .button-closed{display:none}.footer-menu button{border:none;background-color:transparent;border-radius:8px}.footer-menu .points{padding:4px 0;margin:4px 0;border-radius:8px}.footer-menu .photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.footer-menu .open-user{background-color:#3265ee}.submenu{width:341px;display:none;background-color:#3265ee;box-sizing:border-box;flex-direction:column;overflow:hidden;box-shadow:0 4px 8px #0000004d}.submenu ul{display:flex;flex-direction:column;margin:25px 26px 0 24px}.submenu ul li{font-size:20px;font-weight:600;line-height:22px;padding-bottom:18px}.submenu .itens-list{display:flex;justify-content:space-between;align-items:center}.submenu .itens-list .favoritos,.submenu .itens-list span{cursor:pointer}.submenu .footer-menu{display:flex;flex-direction:row;justify-content:center;padding-bottom:16px;overflow:hidden}.submenu .footer-menu .footer-components{border-top:1px solid #3265ee;padding-top:16px;padding-left:17px;white-space:nowrap}.submenu .footer-menu button{position:relative;left:35%;border:none;background-color:transparent}.submenu .footer-menu .photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.submenu .footer-components{display:flex;justify-content:center;align-items:center}.submenu button{position:relative;left:10%;border:none;background-color:transparent}.submenu .photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.submenu.opened-sub{z-index:1;display:flex;position:absolute;left:100%;height:100vh;justify-content:space-between}.submenu-footer{display:flex;flex-direction:row;justify-content:center;align-content:center;margin-bottom:14px;border-top:1px solid #2847a0;box-shadow:0 4px 8px #0000004d}.submenu-footer .subfooter-components{padding-top:16px}.submenu-footer span{font-weight:700;padding-left:10px}.search-bar{max-width:368px;height:38px;margin-top:24px;border:1px solid #ced4da;box-sizing:border-box;border-radius:8px}.opened-notif-sub{min-width:452px;display:none;background-color:#3265ee;box-sizing:border-box;flex-direction:column;overflow:hidden}.sidebar.closed{max-width:73px}.sidebar.closed span{display:none}.sidebar.closed span{white-space:nowrap;overflow:hidden}.sidebar.closed .logo-sispro{display:none}.sidebar.closed .list-menu{padding:0;margin-left:0;margin-right:0;display:flex;flex-direction:column;align-items:center}.sidebar.closed .list-menu span{opacity:0;pointer-events:none}.sidebar.closed .list-menu .text-closed{padding-bottom:11px;visibility:visible;display:block}.sidebar.closed .list-menu .text-opened{display:none;font-size:8px}.sidebar.closed .list-menu .chevron,.sidebar.closed .favoritos,.sidebar.closed .footer-components .button-opened{display:none}.sidebar.closed .footer-components .button-closed{display:block}.sidebar.closed .button-icons{border:none;background-color:transparent}.sidebar.closed .footer-components{display:flex;align-items:center}.sidebar.closed button{border:none;background-color:transparent;display:block}.sidebar.closed .photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.sidebar-control{height:100vh;max-width:227.667px}.sidebar-control .main-content.closed{margin-left:0}.glb-text-width-120{max-width:120px}.profile-picture{display:inline-block;position:relative;width:100px;height:100px;border-radius:50%;overflow:hidden}.profile-picture img{width:100%;height:100%;object-fit:cover;border-radius:50%;clip-path:circle(50% at 50% 50%)}.image-div{width:50px;min-width:50px;height:50px;border-radius:100%;position:relative;overflow:hidden;z-index:1}.image-div #photoUser{width:146px;height:146px;top:-1px;left:-1px;object-fit:cover;position:relative;z-index:1;border:none;border-color:transparent}.dynamic-container{display:inline-block;white-space:nowrap;overflow:hidden}.custom-popover{width:1000px}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i5.ClickOutsideDirective, selector: "[clickOutside]", inputs: ["clickOutsideEnabled", "attachOutsideOnClick", "delayClickOutsideInit", "emitOnBlur", "exclude", "excludeBeforeClick", "clickOutsideEvents"], outputs: ["clickOutside"] }, { kind: "component", type: i5.LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }, { kind: "component", type: i5.FooterComponent, selector: "[app-footer], app-footer, lib-footer" }, { kind: "directive", type: i9$2.PopoverDirective, selector: "[popover]", inputs: ["adaptivePosition", "boundariesElement", "popover", "popoverContext", "popoverTitle", "placement", "outsideClick", "triggers", "container", "containerClass", "isOpen", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }, { kind: "directive", type: i9$1.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1$1.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: PrimaryDropdownComponent, selector: "app-primary-dropdown", inputs: ["buttonWasClicked"] }, { kind: "component", type: SelecaoEstabelecimentosModalComponent, selector: "selecao-estabelecimentos-modal", outputs: ["onClose", "onSelected"] }, { kind: "component", type: DynamicMenuComponent, selector: "app-dynamic-menu", inputs: ["submenuRef", "recebeParam", "titleSubmenu", "submenuList"], outputs: ["selectTemplate"] }, { kind: "component", type: NotifSubmenuComponent, selector: "app-notif-submenu" }] }); }
|
|
1971
|
+
}
|
|
1972
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MenuLateralComponent, decorators: [{
|
|
1973
|
+
type: Component,
|
|
1974
|
+
args: [{ selector: 'app-menu-lateral', template: "<!-- #region MAIN CONTENT -->\r\n<div class=\"main col-12\">\r\n\r\n <div style=\"height: 100vh; z-index: 3;\" class=\"sidebar-control position-relative d-flex flex-row\" \r\n (clickOutside)=\"closeMenu == true ? onClickedOutside($event, submenu_ref) : closeMenu = true\">\r\n <div class=\"sidebar {{_customMenuService.themeColor}} closed\" #sidebar>\r\n <div class=\"menu-header\">\r\n <ul>\r\n <li class=\"mb-3\">\r\n <div class=\"logo-hamburguer\">\r\n <img src=\"assets/icons/logotipo-sispro.svg\" alt=\"logo-sispro\" class=\"logo-sispro\" title=\"logo\" width=\"136px\" height=\"48px\">\r\n <button class=\"button-hamburguer\" (click)=\"openExpansibleMenu(sidebar)\">\r\n <img src=\"assets/icons/menu.svg\" alt=\"menu hamburguer\">\r\n </button>\r\n </div>\r\n </li>\r\n\r\n <!-- #region M\u00D3DULOS -->\r\n <li class=\"mb-3\" style=\"margin-left: 8px; margin-right: 8px\">\r\n <div class=\"btn-group\">\r\n <button (click)=\"dropdownWasOpened(true)\" type=\"button\" class=\"dropdown-button\" data-bs-toggle=\"dropdown\"\r\n aria-expanded=\"false\" data-bs-auto-close=\"outside\">\r\n\r\n <ng-container>\r\n <img *ngIf=\"_customMenuService.moduleImg != ''; else moduleSVG\" [src]=\"_customMenuService.moduleImg\" alt=\"\">\r\n <span class=\"ps-2\"> {{ this._customMenuService.moduleName }} <lib-icon iconName=\"seta-direita\" iconColor=\"white\" /> </span>\r\n\r\n <ng-template #moduleSVG>\r\n <lib-icon iconColor=\"white\" [iconName]=\"_customMenuService.moduleSvg\"/>\r\n </ng-template>\r\n </ng-container>\r\n\r\n </button>\r\n <ul class=\"dropdown-menu\" #dropdown_ref>\r\n <app-primary-dropdown [buttonWasClicked]=\"messageIfClicked\"></app-primary-dropdown>\r\n </ul>\r\n </div>\r\n </li>\r\n <!-- #endregion M\u00D3DULOS -->\r\n\r\n <!-- #region ESTABELECIMENTOS -->\r\n <li class=\"mx-3\" style=\"margin-bottom: 16px;\">\r\n <div class=\"icon-estabelecimento\">\r\n <button class=\"row justify-content-between bg-transparent border-0\"\r\n (click)=\"openModal(modalEstabelecimento, MODAL_ESTABELECIMENTO)\"\r\n [tooltip]=\"!sidebar.classList.contains('closed') ? '' : nomeEstabelecimento\" placement=\"right\">\r\n\r\n <lib-icon class=\"col-1\" iconName=\"predio\" iconColor=\"white\" />\r\n <span *ngIf=\"!sidebar.classList.contains('closed')\" class=\"col-9 ps-2 glb-text-width-160 text-start text-truncate\"> {{ nomeEstabelecimento }} </span>\r\n <lib-icon *ngIf=\"!sidebar.classList.contains('closed')\" class=\"col-1\" iconName=\"seta-direita\" iconColor=\"white\" />\r\n </button>\r\n </div>\r\n </li>\r\n <!-- #endregion ESTABELECIMENTOS -->\r\n\r\n </ul>\r\n\r\n </div>\r\n\r\n <!-- #region MENUS DE NAVEGA\u00C7\u00C3O -->\r\n <div class=\"main-menu\">\r\n <div class=\"scroll\">\r\n <div class=\"list-menu px-2 pb-1\">\r\n\r\n <!-- #region MENU DIN\u00C2MICO -->\r\n <div class=\"dynamic-menu\">\r\n <ul #dynamic_menu_items *ngIf=\"_customMenuService.menuItems; else isLoading\">\r\n\r\n <li *ngFor=\"let menuItem of _customMenuService.menuItems; let i = index\" \r\n class=\"p-1 rounded\" \r\n (click)=\"openSubmenu(menuItem, submenu_ref, dynamic_menu)\" \r\n [class.selectedItem]=\"menuItem.isSelected\">\r\n\r\n <a *ngIf=\"!menuItem.isExternal; else externalMenu\"\r\n [routerLink]=\"menuItem.route != '' ? menuItem.route : null\" \r\n [id]=\"'item' + menuItem.id\" \r\n [tooltip]=\"!sidebar.classList.contains('closed') ? '' : menuItem.label\" \r\n placement=\"left\" class=\"w-100 d-flex align-items-center button-icons text-decoration-none p-1 glb-cursor-pointer\" \r\n [class]=\"sidebar.classList.contains('closed') ? 'justify-content-center' : 'justify-content-between'\">\r\n\r\n <div class=\"container\">\r\n <lib-icon *ngIf=\"!menuItem.icon.includes('assets/icons'); else iconImg\" [iconName]=\"menuItem.icon\" iconColor=\"white\"/>\r\n <span class=\"span-main\">{{ menuItem.label }}</span>\r\n <ng-template #iconImg>\r\n <img [src]=\"menuItem.icon\" [alt]=\"'icone: ' + menuItem.label\">\r\n </ng-template>\r\n </div>\r\n <lib-icon *ngIf=\"(menuItem.children && menuItem.children.length > 0) && !sidebar.classList.contains('closed')\" \r\n iconName=\"seta-direita\" iconColor=\"white\"/>\r\n </a>\r\n \r\n <ng-template #externalMenu>\r\n <a [href]=\"getExternalUrl(menuItem.route)\"\r\n target=\"_blank\" \r\n [id]=\"'item' + menuItem.id\" \r\n [tooltip]=\"!sidebar.classList.contains('closed') ? '' : menuItem.label\" \r\n placement=\"left\" class=\"w-100 d-flex align-items-center button-icons text-decoration-none p-1 glb-cursor-pointer\" \r\n [class]=\"sidebar.classList.contains('closed') ? 'justify-content-center' : 'justify-content-between'\">\r\n\r\n <div class=\"container\">\r\n <lib-icon *ngIf=\"!menuItem.icon.includes('assets/icons'); else iconImgExternal\" [iconName]=\"menuItem.icon\" iconColor=\"white\"/>\r\n <span class=\"span-main\">{{ menuItem.label }}</span>\r\n <ng-template #iconImgExternal>\r\n <img [src]=\"menuItem.icon\" [alt]=\"'icone: ' + menuItem.label\">\r\n </ng-template>\r\n </div>\r\n <lib-icon *ngIf=\"(menuItem.children && menuItem.children.length > 0) && !sidebar.classList.contains('closed')\" \r\n iconName=\"seta-direita\" iconColor=\"white\"/>\r\n </a>\r\n </ng-template>\r\n </li>\r\n\r\n </ul>\r\n </div>\r\n\r\n <ng-template #isLoading>\r\n <li class=\"spinner-border spinner-border-sm mt-2\" role=\"status\" aria-hidden=\"true\"></li>\r\n </ng-template>\r\n <!-- #endregion MENU DIN\u00C2MICO -->\r\n\r\n </div>\r\n </div>\r\n </div>\r\n <!-- #endregion MENUS DE NAVEGA\u00C7\u00C3O -->\r\n\r\n <!-- #region FOOTER -->\r\n <div class=\"footer-menu\" (mouseenter)=\"showBalloon = true\" (mouseleave)=\"showBalloon = false\"\r\n [popover]=\"popoverContent\" placement=\"right bottom\" [outsideClick]=\"true\" containerClass=\"width: 200px\" >\r\n <div class=\"footer-components ps-1 pt-2\" [class.open]=\"showBalloon\">\r\n <button type=\"button\" class=\"btn btn-primary\">\r\n <img *ngIf=\"footerUserImgSrc; else noUserImg\" class=\"photo-profile ms-1\"\r\n [src]=\"['data:image/jpeg;base64,' + footerUserImgSrc]\" alt=\"foto-perfil\">\r\n <ng-template #noUserImg>\r\n <lib-icon iconName=\"contraparte\" iconColor=\"white\"/>\r\n </ng-template>\r\n <span class=\"glb-text-width-120 w-auto fw-bold text-start text-truncate ms-1 me-1\">\r\n {{ footerUserName }}\r\n </span>\r\n </button>\r\n </div>\r\n </div>\r\n \r\n <ng-template #popoverContent>\r\n <div class=\"footer-menu\" style=\"width: 1000px;\">\r\n <div class=\"d-flex align-items-center\"> \r\n <img *ngIf=\"footerUserImgSrc; else noUserImg\" class=\"photo-profile\"\r\n [src]=\"['data:image/jpeg;base64,' + footerUserImgSrc]\" alt=\"foto-perfil\"> \r\n <ng-template #noUserImg>\r\n <lib-icon iconName=\"contraparte\" iconColor=\"white\"/>\r\n </ng-template>\r\n <div class=\"d-flex flex-column ms-1\"> \r\n <div [tooltip]=\"footerUserName\" class=\"dynamic-container\" style=\"white-space: nowrap; flex-grow: 1;max-width: 200px; font-size: 16px;\">{{footerUserName}}</div>\r\n <div [tooltip]=\"footerUserEmail\" class=\"dynamic-container\" style=\"white-space: nowrap; font-size: 12px; flex-grow: 1;max-width: 200px;\">{{footerUserEmail}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n <hr class=\"mb-2 mt-2\">\r\n <div routerLink=\"meu-perfil\" style=\"cursor: pointer;\" (click)=\"togglePopover(); $event.stopPropagation()\">\r\n <lib-icon [iconSize]=\"'small'\" iconName=\"contraparte\"/> Meu Perfil\r\n </div>\r\n <div class=\"mt-2\" (click)=\"logout()\" style=\"cursor: pointer;\">\r\n <lib-icon [iconSize]=\"'small'\" iconName=\"logout\"/> Sair\r\n </div>\r\n </ng-template>\r\n <!-- #endregion FOOTER -->\r\n\r\n </div>\r\n\r\n <div class=\"submenu\" #submenu_ref>\r\n <ng-template [ngIf]=\"desiredContent !== null\">\r\n <ng-content *ngTemplateOutlet=\"desiredContent!; context: {$implicit: submenuList}\"></ng-content>\r\n </ng-template>\r\n </div>\r\n </div>\r\n \r\n <div class=\"main-content col d-flex flex-column align-content-between\" id=\"body-content\">\r\n <div class=\"content\" style=\"position: relative;\">\r\n <router-outlet></router-outlet>\r\n </div>\r\n <div app-footer></div>\r\n </div>\r\n\r\n</div>\r\n<!-- #endregion MAIN CONTENT -->\r\n\r\n<!-- #region TEMPLATES -->\r\n<!-- tem que perguntar pro Erick -->\r\n<!-- [submenuRef]=\"submenu_ref\" -->\r\n<ng-template #dynamic_menu let-data>\r\n <app-dynamic-menu \r\n [submenuList]=\"data\"\r\n [titleSubmenu]=\"titleSubmenu\"\r\n [submenuRef]=\"submenu_ref\"\r\n [recebeParam]=\"onClickedOutside.bind(this)\">\r\n </app-dynamic-menu>\r\n</ng-template>\r\n\r\n<ng-template #notif_menu>\r\n <app-notif-submenu></app-notif-submenu>\r\n</ng-template>\r\n\r\n<!-- #region MODAL SELECAO ESTABELECIMENTO -->\r\n<ng-template #modalEstabelecimento>\r\n <selecao-estabelecimentos-modal (onClose)=\"closeModal(MODAL_ESTABELECIMENTO)\"\r\n (onSelected)=\"closeModal(MODAL_ESTABELECIMENTO); updateLastLogEstabelecimento($event);\"></selecao-estabelecimentos-modal>\r\n</ng-template>\r\n<!-- #endregion MODAL SELECAO ESTABELECIMENTO -->\r\n\r\n<!-- #endregion TEMPLATES -->\r\n", styles: [".main{display:flex;width:100%;height:100%;background:#eee}::-webkit-scrollbar{width:8px;background:transparent}::-webkit-scrollbar-thumb{background:#bbb;border-radius:16px}.main-content{width:100%;z-index:0;overflow-y:auto;overflow:overlay;height:100vh}.main-content .content{padding:0 16px 16px;background-color:#eee!important}.disable-scroll{overflow-y:hidden}*{padding:0;margin:0;font-family:Open sans,Arial,Helvetica,sans-serif;font-size:14px}span{color:#fff}ul{list-style:none;padding-left:0;white-space:nowrap}.dropdown-button{padding:8px;border-radius:8px;background-color:#3265ee;border:none;font-size:14px;font-weight:700;width:100%;display:flex}.dropdown-button span{width:100%;display:flex;justify-content:space-between}.dropdown-menu{width:212px;border-radius:8px}.dropdown-menu li{margin:16px 8px}.dropdown-menu li a{font-size:14px}.dropdown-menu li a:hover{font-weight:700;background-color:transparent}.dropdown-menu .dropdown-divider{height:0}.link-portal{color:#213b70;text-decoration:underline;text-align:center;font-weight:700;font-size:14px}.container{display:flex;width:max-content}.sidebar{display:flex;flex-direction:column;height:100%;grid-template-rows:min-content;box-sizing:border-box;transition:width .5s;background-color:#213b70;max-width:inherit}.sidebar .footer-menu{justify-content:flex-end}.menu-header{display:flex;flex-direction:column;white-space:nowrap;padding:32px 0 0;background-color:#213b70}.menu-header ul li{margin-left:16px;margin-right:16px}.menu-header ul>li:last-child{border-bottom:1px solid #3265ee;padding-bottom:15px;height:auto}.dropdown{margin:0}.btn-group{width:100%}.sidebar.closed .menu-header ul li{margin-left:0;margin-right:0}.sidebar.closed .menu-header{display:flex;flex-direction:column;align-items:center}.icon-estabelecimento button{display:flex;flex-direction:row;width:100%;align-items:center;justify-content:center}.icon-estabelecimento button span:hover{font-weight:700}.header-content{display:flex;flex-direction:column;justify-content:space-evenly;height:100%;margin:0 20px}.logo-hamburguer{display:flex;justify-content:space-between;margin-right:8px}.logo-hamburguer .button-hamburguer{border:none;background-color:transparent}.sidebar.closed .logo-hamburguer{justify-content:center;margin-right:0}.scroll{overflow-y:auto;overflow-x:hidden;min-height:20%;margin-right:2px}.list-menu{padding-left:16px;padding-right:8px;display:flex;flex-direction:column;justify-content:center;white-space:nowrap}.list-menu .text-closed{padding-top:15px;display:none;color:#fff}.list-menu .text-opened{color:#fff;font-size:12px;padding-top:15px;visibility:visible;white-space:nowrap}.list-menu .li-main{padding:10px 7px;border-radius:8px}.list-menu .onSelect{background-color:#3265ee}.list-menu div.static-menu>ul>li:first-child{margin-top:16px}.list-menu .span-main{font-size:14px;margin-left:8px;opacity:1;pointer-events:auto;white-space:break-spaces}.list-menu .span-main:hover,.list-menu .list-options span:hover{font-weight:700}.list-menu p{font-size:10px;font-weight:700;text-transform:uppercase;border-bottom:1px solid #3265ee;visibility:hidden}.selectedItem{background-color:#3265ee}.selectedItem span{font-weight:700;background-color:transparent}.notif{padding:2px 13px;margin-bottom:none;background-color:#000;border-radius:8px;font-weight:700}.sidebar.closed .chevron{display:none}.sidebar.closed .icon-estabelecimento{margin:0}.sidebar.closed .icon-estabelecimento button{justify-content:center}.sidebar.closed .icon-estabelecimento button img{margin:0}.align-chevron{width:100%;text-align:justify;align-items:center;display:flex;justify-content:space-between}.selected-color{background-color:#3265ee}.main-menu{display:flex;flex-direction:column;justify-content:space-between;height:100%;min-height:20%}.button-icons{border:none;background-color:transparent}.footer-menu{display:flex;flex-direction:column;padding-bottom:8px}.footer-menu .footer-components{display:flex;justify-content:space-between;border-top:1px solid #3265ee;white-space:nowrap;align-items:center}.footer-menu .footer-components .button-closed{display:none}.footer-menu button{border:none;background-color:transparent;border-radius:8px}.footer-menu .points{padding:4px 0;margin:4px 0;border-radius:8px}.footer-menu .photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.footer-menu .open-user{background-color:#3265ee}.submenu{width:341px;display:none;background-color:#3265ee;box-sizing:border-box;flex-direction:column;overflow:hidden;box-shadow:0 4px 8px #0000004d}.submenu ul{display:flex;flex-direction:column;margin:25px 26px 0 24px}.submenu ul li{font-size:20px;font-weight:600;line-height:22px;padding-bottom:18px}.submenu .itens-list{display:flex;justify-content:space-between;align-items:center}.submenu .itens-list .favoritos,.submenu .itens-list span{cursor:pointer}.submenu .footer-menu{display:flex;flex-direction:row;justify-content:center;padding-bottom:16px;overflow:hidden}.submenu .footer-menu .footer-components{border-top:1px solid #3265ee;padding-top:16px;padding-left:17px;white-space:nowrap}.submenu .footer-menu button{position:relative;left:35%;border:none;background-color:transparent}.submenu .footer-menu .photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.submenu .footer-components{display:flex;justify-content:center;align-items:center}.submenu button{position:relative;left:10%;border:none;background-color:transparent}.submenu .photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.submenu.opened-sub{z-index:1;display:flex;position:absolute;left:100%;height:100vh;justify-content:space-between}.submenu-footer{display:flex;flex-direction:row;justify-content:center;align-content:center;margin-bottom:14px;border-top:1px solid #2847a0;box-shadow:0 4px 8px #0000004d}.submenu-footer .subfooter-components{padding-top:16px}.submenu-footer span{font-weight:700;padding-left:10px}.search-bar{max-width:368px;height:38px;margin-top:24px;border:1px solid #ced4da;box-sizing:border-box;border-radius:8px}.opened-notif-sub{min-width:452px;display:none;background-color:#3265ee;box-sizing:border-box;flex-direction:column;overflow:hidden}.sidebar.closed{max-width:73px}.sidebar.closed span{display:none}.sidebar.closed span{white-space:nowrap;overflow:hidden}.sidebar.closed .logo-sispro{display:none}.sidebar.closed .list-menu{padding:0;margin-left:0;margin-right:0;display:flex;flex-direction:column;align-items:center}.sidebar.closed .list-menu span{opacity:0;pointer-events:none}.sidebar.closed .list-menu .text-closed{padding-bottom:11px;visibility:visible;display:block}.sidebar.closed .list-menu .text-opened{display:none;font-size:8px}.sidebar.closed .list-menu .chevron,.sidebar.closed .favoritos,.sidebar.closed .footer-components .button-opened{display:none}.sidebar.closed .footer-components .button-closed{display:block}.sidebar.closed .button-icons{border:none;background-color:transparent}.sidebar.closed .footer-components{display:flex;align-items:center}.sidebar.closed button{border:none;background-color:transparent;display:block}.sidebar.closed .photo-profile{width:32px;height:32px;border-radius:50%;margin:0}.sidebar-control{height:100vh;max-width:227.667px}.sidebar-control .main-content.closed{margin-left:0}.glb-text-width-120{max-width:120px}.profile-picture{display:inline-block;position:relative;width:100px;height:100px;border-radius:50%;overflow:hidden}.profile-picture img{width:100%;height:100%;object-fit:cover;border-radius:50%;clip-path:circle(50% at 50% 50%)}.image-div{width:50px;min-width:50px;height:50px;border-radius:100%;position:relative;overflow:hidden;z-index:1}.image-div #photoUser{width:146px;height:146px;top:-1px;left:-1px;object-fit:cover;position:relative;z-index:1;border:none;border-color:transparent}.dynamic-container{display:inline-block;white-space:nowrap;overflow:hidden}.custom-popover{width:1000px}\n"] }]
|
|
1975
|
+
}], ctorParameters: () => [{ type: LibCustomMenuService }, { type: AuthStorageService }, { type: i1$2.BsModalService }, { type: MenuServicesService }, { type: i5.MessageService }, { type: i1$1.Router }, { type: AuthService }], propDecorators: { notif_template: [{
|
|
1976
|
+
type: ViewChild,
|
|
1977
|
+
args: ["notif_menu"]
|
|
1978
|
+
}], menuLink: [{
|
|
1979
|
+
type: ViewChild,
|
|
1980
|
+
args: ['menuLink']
|
|
1981
|
+
}], desiredContent: [{
|
|
1982
|
+
type: ContentChild,
|
|
1983
|
+
args: [TemplateRef]
|
|
1984
|
+
}] } });
|
|
1985
|
+
|
|
1986
|
+
class NovaSenhaComponent {
|
|
1987
|
+
constructor(_formBuilder, _messageService, _serverService, _authService, _authStorageService, _title, _router, _route) {
|
|
1988
|
+
this._formBuilder = _formBuilder;
|
|
1989
|
+
this._messageService = _messageService;
|
|
1990
|
+
this._serverService = _serverService;
|
|
1991
|
+
this._authService = _authService;
|
|
1992
|
+
this._authStorageService = _authStorageService;
|
|
1993
|
+
this._title = _title;
|
|
1994
|
+
this._router = _router;
|
|
1995
|
+
this._route = _route;
|
|
1996
|
+
// #region ==========> PROPERTIES <==========
|
|
1997
|
+
// #region PRIVATE
|
|
1998
|
+
this.domain = "";
|
|
1999
|
+
this.user = "";
|
|
2000
|
+
this.createPassword = false;
|
|
2001
|
+
this.esqueceuSenhaText = "Enviamos um código para o seu e-mail.<br>Insira-o abaixo para redefinir sua senha.";
|
|
2002
|
+
this.primeiroAcessoText = "Este é o seu primeiro acesso. Por favor,<br>Insira abaixo o código enviado pare seu<br>e-mail para definir sua senha.";
|
|
2003
|
+
this.senhaExpiradaText = "Sua senha expirou e precisa ser atualizada.<br>Enviamos um código para o seu e-mail.<br>Insira-o abaixo para definir sua senha.";
|
|
2004
|
+
this.cadeadoImg = 'assets/imgs/Property1-cadeado.png';
|
|
2005
|
+
this.maoImg = 'assets/imgs/Property1-mao.png';
|
|
2006
|
+
this.calendarioImg = 'assets/imgs/Property1-calendariofino.png';
|
|
2007
|
+
// #region PRIVATE
|
|
2008
|
+
// #region PUBLIC
|
|
2009
|
+
// #region ==========> FORM BUILDER <==========
|
|
2010
|
+
this.form = new FormGroup({});
|
|
2011
|
+
this.passwordLabel = "";
|
|
2012
|
+
this.statusSenha = 0;
|
|
2013
|
+
}
|
|
2014
|
+
ngOnInit() {
|
|
2015
|
+
this._title.setTitle("Nova Senha");
|
|
2016
|
+
this.createForm();
|
|
2017
|
+
this.getParmsFromRoute();
|
|
2018
|
+
this.form.get('password')?.disable();
|
|
2019
|
+
this.form.get('confirmPassword')?.disable();
|
|
2020
|
+
this.form.get('code')?.setValue('');
|
|
2021
|
+
this.form.get('code')?.valueChanges.subscribe(value => {
|
|
2022
|
+
if (value && value.length === 6) {
|
|
2023
|
+
this.form.get('password')?.enable();
|
|
2024
|
+
this.form.get('confirmPassword')?.enable();
|
|
2025
|
+
}
|
|
2026
|
+
else {
|
|
2027
|
+
this.form.get('password')?.disable();
|
|
2028
|
+
this.form.get('confirmPassword')?.disable();
|
|
2029
|
+
}
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
// Propriedade necessário para que a classe static FormUtils possa ser utilizada no Html
|
|
2033
|
+
get FormUtils() {
|
|
2034
|
+
return FormUtils;
|
|
2035
|
+
}
|
|
2036
|
+
// #region FORM DATA
|
|
2037
|
+
// Variáveis específicas para funcionalidades padrões dos formulários
|
|
2038
|
+
get code() {
|
|
2039
|
+
return this.form.get('code')?.value;
|
|
2040
|
+
}
|
|
2041
|
+
get password() {
|
|
2042
|
+
return this.form.get('password')?.value;
|
|
2043
|
+
}
|
|
2044
|
+
get confirmPassword() {
|
|
2045
|
+
return this.form.get('confirmPassword')?.value;
|
|
2046
|
+
}
|
|
2047
|
+
// #endregion FORM DATA
|
|
2048
|
+
// #region FORM VALIDATORS
|
|
2049
|
+
// #region PUBLIC
|
|
2050
|
+
// Método para configuração dos campos de edição do formulário
|
|
2051
|
+
createForm() {
|
|
2052
|
+
this.form = this._formBuilder.group({
|
|
2053
|
+
code: ['', [Validators.required, Validators.maxLength(6)]],
|
|
2054
|
+
password: ['', [Validators.required, Validators.maxLength(100)]],
|
|
2055
|
+
confirmPassword: ['', [Validators.required, Validators.maxLength(100)]]
|
|
2056
|
+
});
|
|
2057
|
+
this.form.get('code')?.setValue('');
|
|
2058
|
+
this.form.get('password')?.setValue('');
|
|
2059
|
+
this.form.get('confirmPassword')?.setValue('');
|
|
2060
|
+
}
|
|
2061
|
+
// #endregion FORM VALIDATORS
|
|
2062
|
+
// #endregion ==========> FORM BUILDER <==========
|
|
2063
|
+
// #region ==========> SERVICE METHODS <==========
|
|
2064
|
+
// #region GET
|
|
2065
|
+
/**
|
|
2066
|
+
* Puxa o nome do servidor salvo na configuração da máquina
|
|
2067
|
+
*/
|
|
2068
|
+
getServer() {
|
|
2069
|
+
if (this.form.valid) {
|
|
2070
|
+
this._serverService.getServer().subscribe({
|
|
2071
|
+
next: response => {
|
|
2072
|
+
},
|
|
2073
|
+
error: (error) => {
|
|
2074
|
+
//this._projectUtilservice.showHttpError(error);
|
|
2075
|
+
this._messageService.showAlertDanger(error);
|
|
2076
|
+
throw new Error(error);
|
|
2077
|
+
},
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
else {
|
|
2081
|
+
FormUtils.validateFields(this.form);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
// #endregion GET
|
|
2085
|
+
// #region POST
|
|
2086
|
+
// Envia requisição para recuperar de senha
|
|
2087
|
+
sendPassword() {
|
|
2088
|
+
if (this.form.valid) {
|
|
2089
|
+
this._serverService.getServer().subscribe({
|
|
2090
|
+
next: response => {
|
|
2091
|
+
this.updatePassword();
|
|
2092
|
+
},
|
|
2093
|
+
error: (error) => {
|
|
2094
|
+
//this._projectUtilservice.showHttpError(error);
|
|
2095
|
+
},
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
else {
|
|
2099
|
+
FormUtils.validateFields(this.form);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
// Recuperar senha
|
|
2103
|
+
updatePassword() {
|
|
2104
|
+
if (this.createPassword) {
|
|
2105
|
+
this._authService.createPassword(this.domain, this.user, this.form.value).subscribe({
|
|
2106
|
+
next: (response) => {
|
|
2107
|
+
this._messageService.showAlertSuccess('Você definiu sua senha com sucesso. Preencha suas novas credenciais para acessar o sistema.');
|
|
2108
|
+
this.cancelar();
|
|
2109
|
+
},
|
|
2110
|
+
error: (error) => {
|
|
2111
|
+
//this._projectUtilservice.showHttpError(error);
|
|
2112
|
+
this._messageService.showAlertDanger(error);
|
|
2113
|
+
throw new Error(error);
|
|
2114
|
+
},
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
else {
|
|
2118
|
+
this._authService.recoverPassword(this.domain, this.user, this.form.value).subscribe({
|
|
2119
|
+
next: (response) => {
|
|
2120
|
+
this._messageService.showAlertSuccess('Você redefiniu sua senha com sucesso. Preencha suas novas credenciais para acessar o sistema.');
|
|
2121
|
+
this.cancelar();
|
|
2122
|
+
},
|
|
2123
|
+
error: (error) => {
|
|
2124
|
+
//this._projectUtilservice.showHttpError(error);
|
|
2125
|
+
this._messageService.showAlertDanger(error);
|
|
2126
|
+
throw new Error(error);
|
|
2127
|
+
},
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
// #endregion POST
|
|
2132
|
+
// #region UTILIDADES
|
|
2133
|
+
getParmsFromRoute() {
|
|
2134
|
+
if (this._route.snapshot.paramMap.get('param') != null) {
|
|
2135
|
+
let param = atob(this._route.snapshot.paramMap.get('param'));
|
|
2136
|
+
var params = param.split('$');
|
|
2137
|
+
let numero = +params[params.length - 1].slice(-1);
|
|
2138
|
+
this.statusSenha = numero;
|
|
2139
|
+
this.createPassword = (params[0] == 'true' ? true : false);
|
|
2140
|
+
this.domain = params[1];
|
|
2141
|
+
this.user = params[2];
|
|
2142
|
+
this.passwordLabel = (this.createPassword ? "Escolha sua nova senha" : "Digite uma nova Senha");
|
|
2143
|
+
if (params[3] != null) {
|
|
2144
|
+
this.form.get('code')?.setValue(params[3]);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
else {
|
|
2148
|
+
this.createPassword = false;
|
|
2149
|
+
this.domain = "";
|
|
2150
|
+
this.user = "";
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
// Retorno para o login
|
|
2154
|
+
cancelar() {
|
|
2155
|
+
this._authStorageService.logout();
|
|
2156
|
+
this._router.navigate(["/auth/login"]);
|
|
2157
|
+
}
|
|
2158
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NovaSenhaComponent, deps: [{ token: i3.FormBuilder }, { token: i5.MessageService }, { token: ServerService }, { token: AuthService }, { token: AuthStorageService }, { token: i9.Title }, { token: i1$1.Router }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2159
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: NovaSenhaComponent, selector: "app-nova-senha", ngImport: i0, template: "<body>\r\n\t<div id=\"main-container\">\r\n\t\t<!-- #region MAIN CONTENT -->\r\n\t\t<div class=\"glb-main-container password-container\">\r\n\t\t\t<div class=\"password-info-container\">\r\n\t\t\t\t<div class=\"img mb-3\">\r\n\t\t\t\t\t<img [src]=\"statusSenha == 2 ? calendarioImg : statusSenha == 1 ? maoImg : statusSenha == 3 ? cadeadoImg : '' \" width=\"125.69\" height=\"122\">\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"text\">\r\n\t\t\t\t\t<h4>{{statusSenha == 2 ? 'Senha expirada' : statusSenha == 1 ? 'Primeiro acesso' : statusSenha == 3 ? 'Esqueceu sua senha?' : ''}}</h4>\r\n\t\t\t\t\t<p [innerHTML]=\"statusSenha == 2 ? senhaExpiradaText : statusSenha == 1 ? primeiroAcessoText : statusSenha == 3 ? esqueceuSenhaText : '' \"></p>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<form [formGroup]=\"form\">\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<div class=\"col-12 mb-3\">\r\n\t\t\t\t\t\t<label for=\"inputCode\" class=\"form-label\"> C\u00F3digo de valida\u00E7\u00E3o <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t\t\t<input type=\"text\" placeholder=\"Insira seu c\u00F3digo aqui...\" id=\"inputCode\" class=\"form-control\" formControlName=\"code\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('code'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('code')\" label=\"C\u00F3digo de valida\u00E7\u00E3o\"></app-field-error-message>\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<div class=\"col-12 mb-3\">\r\n\t\t\t\t\t\t<label for=\"inputPassword\" class=\"form-label\"> Digite uma nova Senha <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t\t\t<input type=\"password\" placeholder=\"Digite sua nova senha...\" id=\"inputPassword\" class=\"form-control\" formControlName=\"password\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('password'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('password')\" label=\"{{ passwordLabel }}\"></app-field-error-message>\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<div class=\"col-12 mb-3\">\r\n\t\t\t\t\t\t<label for=\"inputConfirmPassword\" class=\"form-label\"> Confirme sua nova Senha <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t\t\t<input type=\"password\" placeholder=\"Digite a senha novamente...\" id=\"inputConfirmPassword\" class=\"form-control\" formControlName=\"confirmPassword\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('confirmPassword'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('confirmPassword')\" label=\"Confirme sua Senha\"></app-field-error-message>\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\r\n\t\t\t\t\t<div class=\"btns\">\r\n\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary modal-button\" (click)=\"sendPassword()\">\r\n\t\t\t\t\t\t\t<span> Redefinir senha </span>\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t<button type=\"button\" class=\"btn modal-button cancelar-btn\" (click)=\"cancelar()\">\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<span><span class=\"icon\"><lib-icon iconName=\"p-seta-esquerda\" [iconSize]=\"20\"/></span>Voltar para a tela de login</span>\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t</form>\r\n\t\t</div>\r\n\t\t<!-- #endregion MAIN CONTENT -->\r\n\t</div>\r\n\t</body>\r\n\t", styles: ["body{background-color:#f5f5f5;height:100%!important;margin:0!important;padding:0!important}#main-container{display:flex;align-items:center;justify-content:center;height:100%}.password-container{padding:30px;width:37%;border:none;box-shadow:0 2px -1px #0000001a}.img{width:26%}.text{display:flex;flex-direction:column;align-items:flex-start;margin-left:auto}.text h4{font-weight:700}.text p{text-align:start}.password-info-container{display:flex;gap:15px}.btns{display:flex;flex-direction:column;gap:10px;align-items:center;width:100%}button{width:100%;padding:10px;border:none}button .cancelar-btn{background-color:none}.cancelar-btn span{color:#6c757d;font-weight:700}input{padding:10px}input::placeholder{color:#8d8d8d;font-size:15px}.icon{margin-right:5px;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.FieldErrorMessageComponent, selector: "app-field-error-message, lib-error-message", inputs: ["customMessage", "control", "label"] }, { kind: "component", type: i5.LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }], preserveWhitespaces: true }); }
|
|
2160
|
+
}
|
|
2161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NovaSenhaComponent, decorators: [{
|
|
2162
|
+
type: Component,
|
|
2163
|
+
args: [{ selector: 'app-nova-senha', preserveWhitespaces: true, template: "<body>\r\n\t<div id=\"main-container\">\r\n\t\t<!-- #region MAIN CONTENT -->\r\n\t\t<div class=\"glb-main-container password-container\">\r\n\t\t\t<div class=\"password-info-container\">\r\n\t\t\t\t<div class=\"img mb-3\">\r\n\t\t\t\t\t<img [src]=\"statusSenha == 2 ? calendarioImg : statusSenha == 1 ? maoImg : statusSenha == 3 ? cadeadoImg : '' \" width=\"125.69\" height=\"122\">\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"text\">\r\n\t\t\t\t\t<h4>{{statusSenha == 2 ? 'Senha expirada' : statusSenha == 1 ? 'Primeiro acesso' : statusSenha == 3 ? 'Esqueceu sua senha?' : ''}}</h4>\r\n\t\t\t\t\t<p [innerHTML]=\"statusSenha == 2 ? senhaExpiradaText : statusSenha == 1 ? primeiroAcessoText : statusSenha == 3 ? esqueceuSenhaText : '' \"></p>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<form [formGroup]=\"form\">\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<div class=\"col-12 mb-3\">\r\n\t\t\t\t\t\t<label for=\"inputCode\" class=\"form-label\"> C\u00F3digo de valida\u00E7\u00E3o <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t\t\t<input type=\"text\" placeholder=\"Insira seu c\u00F3digo aqui...\" id=\"inputCode\" class=\"form-control\" formControlName=\"code\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('code'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('code')\" label=\"C\u00F3digo de valida\u00E7\u00E3o\"></app-field-error-message>\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<div class=\"col-12 mb-3\">\r\n\t\t\t\t\t\t<label for=\"inputPassword\" class=\"form-label\"> Digite uma nova Senha <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t\t\t<input type=\"password\" placeholder=\"Digite sua nova senha...\" id=\"inputPassword\" class=\"form-control\" formControlName=\"password\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('password'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('password')\" label=\"{{ passwordLabel }}\"></app-field-error-message>\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<div class=\"col-12 mb-3\">\r\n\t\t\t\t\t\t<label for=\"inputConfirmPassword\" class=\"form-label\"> Confirme sua nova Senha <span class=\"text-danger\">*</span></label>\r\n\t\t\t\t\t\t<input type=\"password\" placeholder=\"Digite a senha novamente...\" id=\"inputConfirmPassword\" class=\"form-control\" formControlName=\"confirmPassword\"\r\n\t\t\t\t\t\t\t[class.is-invalid]=\"FormUtils.isInvalidField(form.get('confirmPassword'))\">\r\n\t\t\t\t\t\t<app-field-error-message [control]=\"form.get('confirmPassword')\" label=\"Confirme sua Senha\"></app-field-error-message>\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\r\n\t\t\t\t\t<div class=\"btns\">\r\n\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary modal-button\" (click)=\"sendPassword()\">\r\n\t\t\t\t\t\t\t<span> Redefinir senha </span>\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t<button type=\"button\" class=\"btn modal-button cancelar-btn\" (click)=\"cancelar()\">\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<span><span class=\"icon\"><lib-icon iconName=\"p-seta-esquerda\" [iconSize]=\"20\"/></span>Voltar para a tela de login</span>\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t</form>\r\n\t\t</div>\r\n\t\t<!-- #endregion MAIN CONTENT -->\r\n\t</div>\r\n\t</body>\r\n\t", styles: ["body{background-color:#f5f5f5;height:100%!important;margin:0!important;padding:0!important}#main-container{display:flex;align-items:center;justify-content:center;height:100%}.password-container{padding:30px;width:37%;border:none;box-shadow:0 2px -1px #0000001a}.img{width:26%}.text{display:flex;flex-direction:column;align-items:flex-start;margin-left:auto}.text h4{font-weight:700}.text p{text-align:start}.password-info-container{display:flex;gap:15px}.btns{display:flex;flex-direction:column;gap:10px;align-items:center;width:100%}button{width:100%;padding:10px;border:none}button .cancelar-btn{background-color:none}.cancelar-btn span{color:#6c757d;font-weight:700}input{padding:10px}input::placeholder{color:#8d8d8d;font-size:15px}.icon{margin-right:5px;font-weight:700}\n"] }]
|
|
2164
|
+
}], ctorParameters: () => [{ type: i3.FormBuilder }, { type: i5.MessageService }, { type: ServerService }, { type: AuthService }, { type: AuthStorageService }, { type: i9.Title }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }] });
|
|
2165
|
+
|
|
2166
|
+
class AuthModule {
|
|
2167
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2168
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: AuthModule, declarations: [LoginComponent,
|
|
2169
|
+
NovaSenhaComponent,
|
|
2170
|
+
PrimaryDropdownComponent,
|
|
2171
|
+
SecondaryDropdownComponent,
|
|
2172
|
+
SelecaoEstabelecimentosModalComponent,
|
|
2173
|
+
MenuLateralComponent,
|
|
2174
|
+
DynamicMenuComponent,
|
|
2175
|
+
NotifSubmenuComponent], imports: [CommonModule,
|
|
2176
|
+
ReactiveFormsModule,
|
|
2177
|
+
InfraModule,
|
|
2178
|
+
NgxPaginationModule,
|
|
2179
|
+
PopoverModule,
|
|
2180
|
+
TooltipModule,
|
|
2181
|
+
CommonModule,
|
|
2182
|
+
RouterLink,
|
|
2183
|
+
RouterOutlet], exports: [LoginComponent,
|
|
2184
|
+
NovaSenhaComponent,
|
|
2185
|
+
PrimaryDropdownComponent,
|
|
2186
|
+
SecondaryDropdownComponent,
|
|
2187
|
+
SelecaoEstabelecimentosModalComponent,
|
|
2188
|
+
MenuLateralComponent,
|
|
2189
|
+
DynamicMenuComponent,
|
|
2190
|
+
NotifSubmenuComponent] }); }
|
|
2191
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthModule, imports: [CommonModule,
|
|
2192
|
+
ReactiveFormsModule,
|
|
2193
|
+
InfraModule,
|
|
2194
|
+
NgxPaginationModule,
|
|
2195
|
+
PopoverModule,
|
|
2196
|
+
TooltipModule,
|
|
2197
|
+
CommonModule] }); }
|
|
2198
|
+
}
|
|
2199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthModule, decorators: [{
|
|
2200
|
+
type: NgModule,
|
|
2201
|
+
args: [{
|
|
2202
|
+
declarations: [
|
|
2203
|
+
LoginComponent,
|
|
2204
|
+
NovaSenhaComponent,
|
|
2205
|
+
PrimaryDropdownComponent,
|
|
2206
|
+
SecondaryDropdownComponent,
|
|
2207
|
+
SelecaoEstabelecimentosModalComponent,
|
|
2208
|
+
MenuLateralComponent,
|
|
2209
|
+
DynamicMenuComponent,
|
|
2210
|
+
NotifSubmenuComponent
|
|
2211
|
+
],
|
|
2212
|
+
imports: [
|
|
2213
|
+
CommonModule,
|
|
2214
|
+
ReactiveFormsModule,
|
|
2215
|
+
InfraModule,
|
|
2216
|
+
NgxPaginationModule,
|
|
2217
|
+
PopoverModule,
|
|
2218
|
+
TooltipModule,
|
|
2219
|
+
CommonModule,
|
|
2220
|
+
RouterLink,
|
|
2221
|
+
RouterOutlet
|
|
2222
|
+
],
|
|
2223
|
+
exports: [
|
|
2224
|
+
LoginComponent,
|
|
2225
|
+
NovaSenhaComponent,
|
|
2226
|
+
PrimaryDropdownComponent,
|
|
2227
|
+
SecondaryDropdownComponent,
|
|
2228
|
+
SelecaoEstabelecimentosModalComponent,
|
|
2229
|
+
MenuLateralComponent,
|
|
2230
|
+
DynamicMenuComponent,
|
|
2231
|
+
NotifSubmenuComponent
|
|
2232
|
+
]
|
|
2233
|
+
}]
|
|
2234
|
+
}] });
|
|
2235
|
+
|
|
2236
|
+
class ListEstabService {
|
|
2237
|
+
constructor(http) {
|
|
2238
|
+
this.http = http;
|
|
2239
|
+
this.cacheName = "";
|
|
2240
|
+
this.menuKey = `${this.cacheName}_ListaEstabs`;
|
|
2241
|
+
this.baseUrl = "assets/jsons/lista-estabs.json";
|
|
2242
|
+
this.storage = window.localStorage;
|
|
2243
|
+
}
|
|
2244
|
+
getList() {
|
|
2245
|
+
let iMenu = this.get();
|
|
2246
|
+
let httpCall = this.http.get(this.baseUrl).pipe(tap((iMenuFromServer) => {
|
|
2247
|
+
this.set(iMenuFromServer);
|
|
2248
|
+
}));
|
|
2249
|
+
// Caso o menu já esteja gravado no local, é retornado ele no observable e logo em seguida
|
|
2250
|
+
// é realizada a chamada HTTP para buscar o mais novo menu.
|
|
2251
|
+
if (iMenu) {
|
|
2252
|
+
let obs = of(iMenu);
|
|
2253
|
+
let obsMerged = merge(obs, httpCall);
|
|
2254
|
+
return obsMerged;
|
|
2255
|
+
}
|
|
2256
|
+
return httpCall;
|
|
2257
|
+
}
|
|
2258
|
+
set(value) {
|
|
2259
|
+
let iMenuJson = JSON.stringify(value);
|
|
2260
|
+
this.storage.setItem(this.menuKey, iMenuJson);
|
|
2261
|
+
}
|
|
2262
|
+
get() {
|
|
2263
|
+
let possibleIMenus = this.storage.getItem(this.menuKey);
|
|
2264
|
+
if (possibleIMenus) {
|
|
2265
|
+
let iMenus = JSON.parse(possibleIMenus);
|
|
2266
|
+
return iMenus;
|
|
2267
|
+
}
|
|
2268
|
+
return null;
|
|
2269
|
+
}
|
|
2270
|
+
remove() {
|
|
2271
|
+
this.storage.removeItem(this.menuKey);
|
|
2272
|
+
}
|
|
2273
|
+
getCacheName(cacheName) {
|
|
2274
|
+
//passando propriedades do produto para a service
|
|
2275
|
+
this.cacheName = cacheName;
|
|
2276
|
+
}
|
|
2277
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ListEstabService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2278
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ListEstabService, providedIn: 'root' }); }
|
|
2279
|
+
}
|
|
2280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ListEstabService, decorators: [{
|
|
2281
|
+
type: Injectable,
|
|
2282
|
+
args: [{
|
|
2283
|
+
providedIn: 'root'
|
|
2284
|
+
}]
|
|
2285
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
2286
|
+
|
|
2287
|
+
class IMenu {
|
|
2288
|
+
constructor() {
|
|
2289
|
+
this.LABEL = "";
|
|
2290
|
+
this.DESCRICAO = "";
|
|
2291
|
+
this.URL = "";
|
|
2292
|
+
this.CLASS_ICON = "";
|
|
2293
|
+
this.URL_DASHBOARD = "";
|
|
2294
|
+
this.TAG = "";
|
|
2295
|
+
this.STRUCT_LIST = [];
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
class InfraUsuarioImg {
|
|
2300
|
+
constructor() {
|
|
2301
|
+
this.TENANT_ID = 0;
|
|
2302
|
+
this.ID = 0;
|
|
2303
|
+
this.IMAGEM = "";
|
|
2304
|
+
this.FILENAME = "";
|
|
2305
|
+
this.DATACRIACAO = new Date();
|
|
2306
|
+
this.IS_ACTIVE = false;
|
|
2307
|
+
this.USUARIOID = "";
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
class CustomPropriedadesLogin {
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
class AuthGuard {
|
|
2315
|
+
constructor(router, authStorageService) {
|
|
2316
|
+
this.router = router;
|
|
2317
|
+
this.authStorageService = authStorageService;
|
|
2318
|
+
}
|
|
2319
|
+
IsUserAuth() {
|
|
2320
|
+
return this.authStorageService.isLoggedInSub
|
|
2321
|
+
.pipe(map((isLoggedIn) => {
|
|
2322
|
+
if (!isLoggedIn || this.authStorageService.isExternalLogin) {
|
|
2323
|
+
let login = this.router.parseUrl("/auth/login");
|
|
2324
|
+
return login;
|
|
2325
|
+
}
|
|
2326
|
+
return true;
|
|
2327
|
+
}));
|
|
2328
|
+
}
|
|
2329
|
+
canActivate(_route, _state) {
|
|
2330
|
+
return this.IsUserAuth();
|
|
2331
|
+
}
|
|
2332
|
+
canLoad(_route) {
|
|
2333
|
+
return this.IsUserAuth();
|
|
2334
|
+
}
|
|
2335
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthGuard, deps: [{ token: i1$1.Router }, { token: AuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2336
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthGuard, providedIn: 'root' }); }
|
|
2337
|
+
}
|
|
2338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthGuard, decorators: [{
|
|
2339
|
+
type: Injectable,
|
|
2340
|
+
args: [{ providedIn: 'root' }]
|
|
2341
|
+
}], ctorParameters: () => [{ type: i1$1.Router }, { type: AuthStorageService }] });
|
|
2342
|
+
|
|
2343
|
+
class ExternaLoginlGuard {
|
|
2344
|
+
constructor(router, authService, authStorageService, serverService) {
|
|
2345
|
+
this.router = router;
|
|
2346
|
+
this.authService = authService;
|
|
2347
|
+
this.authStorageService = authStorageService;
|
|
2348
|
+
this.serverService = serverService;
|
|
2349
|
+
}
|
|
2350
|
+
canActivate(_route, _state) {
|
|
2351
|
+
let param = atob(_route.paramMap.get('param'));
|
|
2352
|
+
return this.IsUserAuth(param);
|
|
2353
|
+
}
|
|
2354
|
+
navigateToError() {
|
|
2355
|
+
this.authStorageService.isExternalLogin = true;
|
|
2356
|
+
let login = this.router.parseUrl("/error-404");
|
|
2357
|
+
return login;
|
|
2358
|
+
}
|
|
2359
|
+
IsUserAuth(param) {
|
|
2360
|
+
return this.authStorageService.isLoggedInSub
|
|
2361
|
+
.pipe(take$1(1), switchMap((isLoggedIn) => {
|
|
2362
|
+
// Split dos parâmetros para o login externo
|
|
2363
|
+
var params = param.split('$');
|
|
2364
|
+
let domain = params[0];
|
|
2365
|
+
let user = params[1];
|
|
2366
|
+
let password = params[2];
|
|
2367
|
+
if (isLoggedIn && !this.authStorageService.isExternalLogin && this.authStorageService.dominio.toLowerCase() == domain.toLowerCase()) {
|
|
2368
|
+
return of(true);
|
|
2369
|
+
}
|
|
2370
|
+
;
|
|
2371
|
+
// antes alteração - se precisar voltar
|
|
2372
|
+
return this.logOnExternal(domain, user, password);
|
|
2373
|
+
}));
|
|
2374
|
+
}
|
|
2375
|
+
// Executa o Login Externo
|
|
2376
|
+
async logOnExternal(domain, user, password) {
|
|
2377
|
+
const retConfig = await this.handleGetServer();
|
|
2378
|
+
if (!retConfig) {
|
|
2379
|
+
return this.navigateToError();
|
|
2380
|
+
}
|
|
2381
|
+
try {
|
|
2382
|
+
const error = await lastValueFrom(this.authService.loginExternal(domain, user, password));
|
|
2383
|
+
if (error) {
|
|
2384
|
+
return this.navigateToError();
|
|
2385
|
+
}
|
|
2386
|
+
return true;
|
|
2387
|
+
}
|
|
2388
|
+
catch (error) {
|
|
2389
|
+
return this.navigateToError();
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
// Retorna os parâmetros de configuração.
|
|
2393
|
+
getServer() {
|
|
2394
|
+
return new Promise((resolve, reject) => {
|
|
2395
|
+
this.serverService.getServer().subscribe({
|
|
2396
|
+
next: response => {
|
|
2397
|
+
resolve(true);
|
|
2398
|
+
},
|
|
2399
|
+
error: error => {
|
|
2400
|
+
reject(error);
|
|
2401
|
+
}
|
|
2402
|
+
});
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
// Handle para busca dos parâmetros de configuração.
|
|
2406
|
+
async handleGetServer() {
|
|
2407
|
+
try {
|
|
2408
|
+
const response = await this.getServer();
|
|
2409
|
+
return true;
|
|
2410
|
+
}
|
|
2411
|
+
catch (error) {
|
|
2412
|
+
return false;
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ExternaLoginlGuard, deps: [{ token: i1$1.Router }, { token: AuthService }, { token: AuthStorageService }, { token: ServerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2416
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ExternaLoginlGuard, providedIn: 'root' }); }
|
|
2417
|
+
}
|
|
2418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ExternaLoginlGuard, decorators: [{
|
|
2419
|
+
type: Injectable,
|
|
2420
|
+
args: [{ providedIn: 'root' }]
|
|
2421
|
+
}], ctorParameters: () => [{ type: i1$1.Router }, { type: AuthService }, { type: AuthStorageService }, { type: ServerService }] });
|
|
2422
|
+
|
|
2423
|
+
/**
|
|
2424
|
+
* Protege a página de login de ser carregada quando o usuário já está logado,
|
|
2425
|
+
* redirecionando ele para a página home da aplicação.
|
|
2426
|
+
*/
|
|
2427
|
+
class LoginGuard {
|
|
2428
|
+
constructor(router, authStorageService) {
|
|
2429
|
+
this.router = router;
|
|
2430
|
+
this.authStorageService = authStorageService;
|
|
2431
|
+
}
|
|
2432
|
+
/**
|
|
2433
|
+
* Verifica se pode carregar a tela de login caso o usuário não esteja logado e
|
|
2434
|
+
* a rota seja de login.
|
|
2435
|
+
*
|
|
2436
|
+
* @param route Rota atual
|
|
2437
|
+
* @param segments Segmentos.
|
|
2438
|
+
* @returns
|
|
2439
|
+
*/
|
|
2440
|
+
canLoad(_route, _segments) {
|
|
2441
|
+
if (_route.path === "auth/login" && this.authStorageService.isLoggedInSub.value && !this.authStorageService.isExternalLogin) {
|
|
2442
|
+
return this.router.createUrlTree(["/home"]);
|
|
2443
|
+
}
|
|
2444
|
+
return true;
|
|
2445
|
+
}
|
|
2446
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LoginGuard, deps: [{ token: i1$1.Router }, { token: AuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2447
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LoginGuard, providedIn: 'root' }); }
|
|
2448
|
+
}
|
|
2449
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LoginGuard, decorators: [{
|
|
2450
|
+
type: Injectable,
|
|
2451
|
+
args: [{ providedIn: 'root' }]
|
|
2452
|
+
}], ctorParameters: () => [{ type: i1$1.Router }, { type: AuthStorageService }] });
|
|
2453
|
+
|
|
2454
|
+
/**
|
|
2455
|
+
* \brief Intercepta uma chamada HTTP para inserir o usuário logado no header em conjunto
|
|
2456
|
+
* com o login para uso da API.
|
|
2457
|
+
*
|
|
2458
|
+
* Depende do serviço de autenticação.
|
|
2459
|
+
*/
|
|
2460
|
+
class AuthAplicInterceptor {
|
|
2461
|
+
constructor(authCheckService, _environmentService, token) {
|
|
2462
|
+
this.authCheckService = authCheckService;
|
|
2463
|
+
this._environmentService = _environmentService;
|
|
2464
|
+
this.token = token;
|
|
2465
|
+
}
|
|
2466
|
+
intercept(req, next) {
|
|
2467
|
+
// convert promise to observable using 'from' operator
|
|
2468
|
+
return from(this.handle(req, next));
|
|
2469
|
+
}
|
|
2470
|
+
async handle(req, next) {
|
|
2471
|
+
let changedReq = req;
|
|
2472
|
+
if (this.authCheckService.needsAuthRequest(req.url, req.method, this._environmentService.needsAuthAplic)) {
|
|
2473
|
+
// Verifica se o Token precisa ser renovado
|
|
2474
|
+
await this.token.renewToken();
|
|
2475
|
+
// Adiciona as autenticações necessárias ao servidor.
|
|
2476
|
+
let headers = req.headers.set('Authorization', `Bearer ${this.token.authToken}`);
|
|
2477
|
+
changedReq = req.clone({ headers: headers });
|
|
2478
|
+
}
|
|
2479
|
+
return await lastValueFrom(next.handle(changedReq));
|
|
2480
|
+
}
|
|
2481
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthAplicInterceptor, deps: [{ token: i5.CheckUrlAndMethodService }, { token: EnvironmentService }, { token: AuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2482
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthAplicInterceptor, providedIn: 'root' }); }
|
|
2483
|
+
}
|
|
2484
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthAplicInterceptor, decorators: [{
|
|
2485
|
+
type: Injectable,
|
|
2486
|
+
args: [{ providedIn: 'root' }]
|
|
2487
|
+
}], ctorParameters: () => [{ type: i5.CheckUrlAndMethodService }, { type: EnvironmentService }, { type: AuthStorageService }] });
|
|
2488
|
+
|
|
2489
|
+
/**
|
|
2490
|
+
* \brief Intercepta uma chamada HTTP para inserir a autenticação da Sispro.
|
|
2491
|
+
*/
|
|
2492
|
+
class AuthInfraInterceptor {
|
|
2493
|
+
constructor(authCheckService, _environmentService) {
|
|
2494
|
+
this.authCheckService = authCheckService;
|
|
2495
|
+
this._environmentService = _environmentService;
|
|
2496
|
+
}
|
|
2497
|
+
intercept(req, next) {
|
|
2498
|
+
let changedReq = req;
|
|
2499
|
+
if (this.authCheckService.needsAuthRequest(req.url, req.method, this._environmentService.needsAuthInfra)) {
|
|
2500
|
+
// Adiciona as autenticações necessárias ao servidor. Autenticação básica.
|
|
2501
|
+
let headers = req.headers.set("Authorization", `Basic ${btoa(`${localStorage.getItem('configServerUser')}:${localStorage.getItem('configServerPassword')}`)}
|
|
2502
|
+
`);
|
|
2503
|
+
changedReq = req.clone({ headers: headers });
|
|
2504
|
+
}
|
|
2505
|
+
return next.handle(changedReq);
|
|
2506
|
+
}
|
|
2507
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthInfraInterceptor, deps: [{ token: i5.CheckUrlAndMethodService }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2508
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthInfraInterceptor, providedIn: 'root' }); }
|
|
2509
|
+
}
|
|
2510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthInfraInterceptor, decorators: [{
|
|
2511
|
+
type: Injectable,
|
|
2512
|
+
args: [{ providedIn: 'root' }]
|
|
2513
|
+
}], ctorParameters: () => [{ type: i5.CheckUrlAndMethodService }, { type: EnvironmentService }] });
|
|
2514
|
+
|
|
2515
|
+
/**
|
|
2516
|
+
* Generated bundle index. Do not edit.
|
|
2517
|
+
*/
|
|
2518
|
+
|
|
2519
|
+
export { AuthAplicInterceptor, AuthGuard, AuthInfraInterceptor, AuthModule, AuthService, AuthStorageService, CustomPropriedadesLogin, DynamicMenuComponent, EnvironmentService, ExternaLoginlGuard, IMenu, InfraUsuarioImg, LibCustomLoginService, LibCustomMenuService, ListEstabService, LoginComponent, LoginGuard, MenuConfigService, MenuLateralComponent, MenuServicesService, NotifSubmenuComponent, NovaSenhaComponent, PrimaryDropdownComponent, SecondaryDropdownComponent, SelecaoEstabelecimentosModalComponent, ServerService };
|
|
2520
|
+
//# sourceMappingURL=ngx-sp-auth.mjs.map
|