@senior-gestao-relacionamento/angular-components 1.2.0 → 1.3.0

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.
Files changed (88) hide show
  1. package/bundles/senior-gestao-relacionamento-angular-components.umd.js +202 -172
  2. package/bundles/senior-gestao-relacionamento-angular-components.umd.js.map +1 -1
  3. package/bundles/senior-gestao-relacionamento-angular-components.umd.min.js +12 -12
  4. package/bundles/senior-gestao-relacionamento-angular-components.umd.min.js.map +1 -1
  5. package/esm2015/public-api.js +2 -1
  6. package/esm2015/senior-gestao-relacionamento-angular-components.js +2 -1
  7. package/esm2015/services/current-collaborator/current-collaborator.module.js +2 -2
  8. package/esm2015/services/current-collaborator/current-collaborator.service.js +27 -30
  9. package/esm2015/services/current-collaborator/models/collaborator-dto.js +1 -1
  10. package/esm2015/services/current-collaborator/models/collaborator-e-070-fil-crmx-dto.js +1 -0
  11. package/esm2015/services/current-collaborator/models/collaborator-e-070-fil-crmx.js +32 -0
  12. package/esm2015/services/current-collaborator/models/collaborator-squad.js +1 -6
  13. package/esm2015/services/current-collaborator/models/collaborator.js +6 -11
  14. package/esm2015/services/current-collaborator/models/e-070-emp-dto.js +1 -0
  15. package/esm2015/services/current-collaborator/models/e-070-emp.js +15 -0
  16. package/esm2015/services/current-collaborator/models/e-070-fil-crmx-dto.js +1 -0
  17. package/esm2015/services/current-collaborator/models/e-070-fil-crmx.js +25 -0
  18. package/esm2015/services/current-collaborator/models/e-070-fil-dto.js +1 -0
  19. package/esm2015/services/current-collaborator/models/e-070-fil.js +22 -0
  20. package/esm2015/services/current-collaborator/models/index.js +6 -4
  21. package/esm2015/services/current-collaborator/models/squad-dto.js +1 -1
  22. package/esm2015/services/current-collaborator/models/squad.js +1 -6
  23. package/esm2015/services/standard-filters/index.js +3 -0
  24. package/esm2015/services/standard-filters/standard filters.module.js +18 -0
  25. package/esm2015/services/standard-filters/standard filters.service.js +47 -0
  26. package/esm2015/services/storage/storage.service.js +16 -15
  27. package/esm5/public-api.js +2 -1
  28. package/esm5/senior-gestao-relacionamento-angular-components.js +2 -1
  29. package/esm5/services/current-collaborator/current-collaborator.module.js +2 -2
  30. package/esm5/services/current-collaborator/current-collaborator.service.js +27 -30
  31. package/esm5/services/current-collaborator/models/collaborator-dto.js +1 -1
  32. package/esm5/services/current-collaborator/models/collaborator-e-070-fil-crmx-dto.js +1 -0
  33. package/esm5/services/current-collaborator/models/collaborator-e-070-fil-crmx.js +35 -0
  34. package/esm5/services/current-collaborator/models/collaborator-squad.js +1 -6
  35. package/esm5/services/current-collaborator/models/collaborator.js +6 -11
  36. package/esm5/services/current-collaborator/models/e-070-emp-dto.js +1 -0
  37. package/esm5/services/current-collaborator/models/e-070-emp.js +20 -0
  38. package/esm5/services/current-collaborator/models/e-070-fil-crmx-dto.js +1 -0
  39. package/esm5/services/current-collaborator/models/e-070-fil-crmx.js +28 -0
  40. package/esm5/services/current-collaborator/models/e-070-fil-dto.js +1 -0
  41. package/esm5/services/current-collaborator/models/e-070-fil.js +27 -0
  42. package/esm5/services/current-collaborator/models/index.js +6 -4
  43. package/esm5/services/current-collaborator/models/squad-dto.js +1 -1
  44. package/esm5/services/current-collaborator/models/squad.js +1 -6
  45. package/esm5/services/standard-filters/index.js +3 -0
  46. package/esm5/services/standard-filters/standard filters.module.js +21 -0
  47. package/esm5/services/standard-filters/standard filters.service.js +51 -0
  48. package/esm5/services/storage/storage.service.js +16 -37
  49. package/fesm2015/senior-gestao-relacionamento-angular-components.js +158 -104
  50. package/fesm2015/senior-gestao-relacionamento-angular-components.js.map +1 -1
  51. package/fesm5/senior-gestao-relacionamento-angular-components.js +177 -133
  52. package/fesm5/senior-gestao-relacionamento-angular-components.js.map +1 -1
  53. package/package.json +1 -1
  54. package/public-api.d.ts +1 -0
  55. package/senior-gestao-relacionamento-angular-components.d.ts +1 -0
  56. package/senior-gestao-relacionamento-angular-components.metadata.json +1 -1
  57. package/services/current-collaborator/models/collaborator-dto.d.ts +1 -1
  58. package/services/current-collaborator/models/{collaborator-branch-dto.d.ts → collaborator-e-070-fil-crmx-dto.d.ts} +2 -2
  59. package/services/current-collaborator/models/collaborator-e-070-fil-crmx.d.ts +16 -0
  60. package/services/current-collaborator/models/collaborator.d.ts +3 -3
  61. package/services/current-collaborator/models/e-070-emp-dto.d.ts +5 -0
  62. package/services/current-collaborator/models/e-070-emp.d.ts +8 -0
  63. package/services/current-collaborator/models/e-070-fil-crmx-dto.d.ts +5 -0
  64. package/services/current-collaborator/models/e-070-fil-crmx.d.ts +9 -0
  65. package/services/current-collaborator/models/e-070-fil-dto.d.ts +6 -0
  66. package/services/current-collaborator/models/e-070-fil.d.ts +10 -0
  67. package/services/current-collaborator/models/index.d.ts +10 -6
  68. package/services/standard-filters/index.d.ts +2 -0
  69. package/services/standard-filters/standard filters.module.d.ts +2 -0
  70. package/services/standard-filters/standard filters.service.d.ts +12 -0
  71. package/services/storage/storage.service.d.ts +5 -3
  72. package/esm2015/services/current-collaborator/models/branch-dto.js +0 -1
  73. package/esm2015/services/current-collaborator/models/branch.js +0 -26
  74. package/esm2015/services/current-collaborator/models/collaborator-branch-dto.js +0 -1
  75. package/esm2015/services/current-collaborator/models/collaborator-branch.js +0 -37
  76. package/esm2015/services/current-collaborator/models/company-dto.js +0 -1
  77. package/esm2015/services/current-collaborator/models/company.js +0 -18
  78. package/esm5/services/current-collaborator/models/branch-dto.js +0 -1
  79. package/esm5/services/current-collaborator/models/branch.js +0 -29
  80. package/esm5/services/current-collaborator/models/collaborator-branch-dto.js +0 -1
  81. package/esm5/services/current-collaborator/models/collaborator-branch.js +0 -40
  82. package/esm5/services/current-collaborator/models/company-dto.js +0 -1
  83. package/esm5/services/current-collaborator/models/company.js +0 -21
  84. package/services/current-collaborator/models/branch-dto.d.ts +0 -8
  85. package/services/current-collaborator/models/branch.d.ts +0 -12
  86. package/services/current-collaborator/models/collaborator-branch.d.ts +0 -16
  87. package/services/current-collaborator/models/company-dto.d.ts +0 -6
  88. package/services/current-collaborator/models/company.d.ts +0 -9
@@ -1,56 +1,32 @@
1
- import { __awaiter, __generator, __decorate, __assign } from 'tslib';
2
1
  import { get } from 'js-cookie';
3
- import { user } from '@seniorsistemas/senior-platform-data';
2
+ import { __decorate, __assign } from 'tslib';
4
3
  import { ɵɵdefineInjectable, Injectable, NgModule } from '@angular/core';
5
4
  import { Subject, Observable } from 'rxjs';
6
5
  import { Stomp } from '@stomp/stompjs';
7
6
  import * as SockJS from 'sockjs-client';
8
- import * as moment from 'moment';
9
7
  import { HttpClient, HttpClientModule } from '@angular/common/http';
10
8
  import { takeUntil, catchError } from 'rxjs/operators';
11
9
 
12
10
  var StorageService = /** @class */ (function () {
13
11
  function StorageService() {
14
12
  }
13
+ StorageService.getUser = function () {
14
+ return JSON.parse(localStorage.getItem('SENIOR_USER_INFO')).data;
15
+ };
15
16
  StorageService.getUserId = function () {
16
- return __awaiter(this, void 0, void 0, function () {
17
- var user$1;
18
- return __generator(this, function (_a) {
19
- switch (_a.label) {
20
- case 0: return [4 /*yield*/, user.getUserData()];
21
- case 1:
22
- user$1 = _a.sent();
23
- return [2 /*return*/, user$1.id];
24
- }
25
- });
26
- });
17
+ return StorageService.getUser().id;
27
18
  };
28
19
  StorageService.store = function (key, value) {
29
- return __awaiter(this, void 0, void 0, function () {
30
- var userId;
31
- return __generator(this, function (_a) {
32
- switch (_a.label) {
33
- case 0: return [4 /*yield*/, this.getUserId()];
34
- case 1:
35
- userId = _a.sent();
36
- localStorage.setItem(userId + "_" + key, JSON.stringify(value));
37
- return [2 /*return*/];
38
- }
39
- });
40
- });
20
+ var userId = StorageService.getUserId();
21
+ localStorage.setItem(userId + "_" + key, JSON.stringify(value));
41
22
  };
42
23
  StorageService.get = function (key) {
43
- return __awaiter(this, void 0, void 0, function () {
44
- var userId;
45
- return __generator(this, function (_a) {
46
- switch (_a.label) {
47
- case 0: return [4 /*yield*/, this.getUserId()];
48
- case 1:
49
- userId = _a.sent();
50
- return [2 /*return*/, JSON.parse(localStorage.getItem(userId + "_" + key)) || {}];
51
- }
52
- });
53
- });
24
+ var userId = StorageService.getUserId();
25
+ var value = localStorage.getItem(userId + "_" + key);
26
+ if (value) {
27
+ return JSON.parse(value);
28
+ }
29
+ return null;
54
30
  };
55
31
  StorageService.getComSeniorToken = function () {
56
32
  return JSON.parse(get('com.senior.token'));
@@ -73,6 +49,9 @@ var StorageService = /** @class */ (function () {
73
49
  StorageService.getToken = function () {
74
50
  return StorageService.getComSeniorToken().access_token;
75
51
  };
52
+ StorageService.isUserAdmin = function () {
53
+ return StorageService.getUsername() === 'admin';
54
+ };
76
55
  return StorageService;
77
56
  }());
78
57
 
@@ -204,103 +183,121 @@ var WebsocketService = /** @class */ (function () {
204
183
  return WebsocketService;
205
184
  }());
206
185
 
207
- var Company = /** @class */ (function () {
208
- function Company() {
209
- this.active = false;
186
+ var User = /** @class */ (function () {
187
+ function User() {
188
+ this.blocked = false;
210
189
  }
211
- Company.fromDto = function (companyDto, originEntity) {
212
- var model = __assign({}, companyDto);
190
+ User.fromDto = function (userDto, originEntity) {
191
+ var model = __assign({}, userDto);
213
192
  var lookupSeparator = ' - ';
214
- var displayFields = ['code', 'name'];
193
+ var displayFields = ['username', 'fullName'];
215
194
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
216
195
  return model;
217
196
  };
218
- Company.toDto = function (company, originEntity) {
219
- var dto = __assign({}, company);
197
+ User.toDto = function (user, originEntity) {
198
+ var dto = __assign({}, user);
220
199
  delete dto.label;
221
200
  return dto;
222
201
  };
223
- return Company;
202
+ return User;
224
203
  }());
225
204
 
226
- var Branch = /** @class */ (function () {
227
- function Branch() {
228
- this.master = false;
229
- this.active = false;
205
+ var E070Emp = /** @class */ (function () {
206
+ function E070Emp() {
207
+ }
208
+ E070Emp.fromDto = function (e070EmpDto, originEntity) {
209
+ var model = __assign({}, e070EmpDto);
210
+ var lookupSeparator = ' - ';
211
+ var displayFields = ['codEmp', 'nomEmp'];
212
+ model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
213
+ return model;
214
+ };
215
+ E070Emp.toDto = function (e070Emp, originEntity) {
216
+ var dto = __assign({}, e070Emp);
217
+ delete dto.label;
218
+ return dto;
219
+ };
220
+ return E070Emp;
221
+ }());
222
+
223
+ var E070Fil = /** @class */ (function () {
224
+ function E070Fil() {
230
225
  }
231
- Branch.fromDto = function (branchDto, originEntity) {
232
- var model = __assign({}, branchDto);
226
+ E070Fil.fromDto = function (e070FilDto, originEntity) {
227
+ var model = __assign({}, e070FilDto);
233
228
  var lookupSeparator = ' - ';
234
- var displayFields = ['company.code', 'company.name', 'code', 'name'];
229
+ var displayFields = ['e070emp.codEmp', 'e070emp.nomEmp', 'codFil', 'nomFil'];
235
230
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
236
- if (originEntity !== 'Company' && model.company) {
237
- model.company = Company.fromDto(model.company, 'Branch');
231
+ if (originEntity !== 'E070Emp' && model.e070emp) {
232
+ model.e070emp = E070Emp.fromDto(model.e070emp, 'E070Fil');
238
233
  }
239
234
  return model;
240
235
  };
241
- Branch.toDto = function (branch, originEntity) {
242
- var dto = __assign({}, branch);
236
+ E070Fil.toDto = function (e070Fil, originEntity) {
237
+ var dto = __assign({}, e070Fil);
243
238
  delete dto.label;
244
- if (originEntity !== 'Company' && dto.company) {
245
- dto.company = Company.toDto(dto.company, 'Branch');
239
+ if (originEntity !== 'E070Emp' && dto.e070emp) {
240
+ dto.e070emp = E070Emp.toDto(dto.e070emp, 'E070Fil');
246
241
  }
247
242
  return dto;
248
243
  };
249
- return Branch;
244
+ return E070Fil;
250
245
  }());
251
246
 
252
- var User = /** @class */ (function () {
253
- function User() {
254
- this.blocked = false;
247
+ var E070FilCrmx = /** @class */ (function () {
248
+ function E070FilCrmx() {
249
+ this.active = false;
255
250
  }
256
- User.fromDto = function (userDto, originEntity) {
257
- var model = __assign({}, userDto);
251
+ E070FilCrmx.fromDto = function (e070FilCrmxDto, originEntity) {
252
+ var model = __assign({}, e070FilCrmxDto);
258
253
  var lookupSeparator = ' - ';
259
- var displayFields = ['username', 'fullName'];
254
+ var displayFields = ['e070fil.e070emp.codEmp', 'e070fil.e070emp.nomEmp', 'e070fil.codFil', 'e070fil.nomFil'];
260
255
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
256
+ if (originEntity !== 'E070Fil' && model.e070fil) {
257
+ model.e070fil = E070Fil.fromDto(model.e070fil, 'E070FilCrmx');
258
+ }
261
259
  return model;
262
260
  };
263
- User.toDto = function (user, originEntity) {
264
- var dto = __assign({}, user);
261
+ E070FilCrmx.toDto = function (e070FilCrmx, originEntity) {
262
+ var dto = __assign({}, e070FilCrmx);
265
263
  delete dto.label;
264
+ if (originEntity !== 'E070Fil' && dto.e070fil) {
265
+ dto.e070fil = E070Fil.toDto(dto.e070fil, 'E070FilCrmx');
266
+ }
266
267
  return dto;
267
268
  };
268
- return User;
269
+ return E070FilCrmx;
269
270
  }());
270
271
 
271
- var CollaboratorBranch = /** @class */ (function () {
272
- function CollaboratorBranch() {
272
+ var CollaboratorE070FilCrmx = /** @class */ (function () {
273
+ function CollaboratorE070FilCrmx() {
273
274
  this.master = false;
274
275
  }
275
- CollaboratorBranch.fromDto = function (collaboratorBranchDto, originEntity) {
276
- var model = __assign({}, collaboratorBranchDto);
277
- model.createdAt = model.createdAt && moment(model.createdAt).toDate();
278
- model.changedAt = model.changedAt && moment(model.changedAt).toDate();
276
+ CollaboratorE070FilCrmx.fromDto = function (collaboratorE070FilCrmxDto, originEntity) {
277
+ var model = __assign({}, collaboratorE070FilCrmxDto);
279
278
  var lookupSeparator = ' - ';
280
- var displayFields = ['branch.company.code', 'branch.company.name', 'branch.code', 'branch.name', 'master'];
279
+ var displayFields = ['e070filCrmx.e070fil.codFil', 'e070filCrmx.e070fil.nomFil'];
281
280
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
282
281
  if (originEntity !== 'Collaborator' && model.collaborator) {
283
- model.collaborator = Collaborator.fromDto(model.collaborator, 'CollaboratorBranch');
282
+ model.collaborator = Collaborator.fromDto(model.collaborator, 'CollaboratorE070FilCrmx');
284
283
  }
285
- if (originEntity !== 'Branch' && model.branch) {
286
- model.branch = Branch.fromDto(model.branch, 'CollaboratorBranch');
284
+ if (originEntity !== 'E070FilCrmx' && model.e070filCrmx) {
285
+ model.e070filCrmx = E070FilCrmx.fromDto(model.e070filCrmx, 'CollaboratorE070FilCrmx');
287
286
  }
288
287
  return model;
289
288
  };
290
- CollaboratorBranch.toDto = function (collaboratorBranch, originEntity) {
291
- var dto = __assign({}, collaboratorBranch);
292
- dto.createdAt = dto.createdAt && moment(dto.createdAt).format();
293
- dto.changedAt = dto.changedAt && moment(dto.changedAt).format();
289
+ CollaboratorE070FilCrmx.toDto = function (collaboratorE070FilCrmx, originEntity) {
290
+ var dto = __assign({}, collaboratorE070FilCrmx);
294
291
  delete dto.label;
295
292
  if (originEntity !== 'Collaborator' && dto.collaborator) {
296
- dto.collaborator = Collaborator.toDto(dto.collaborator, 'CollaboratorBranch');
293
+ dto.collaborator = Collaborator.toDto(dto.collaborator, 'CollaboratorE070FilCrmx');
297
294
  }
298
- if (originEntity !== 'Branch' && dto.branch) {
299
- dto.branch = Branch.toDto(dto.branch, 'CollaboratorBranch');
295
+ if (originEntity !== 'E070FilCrmx' && dto.e070filCrmx) {
296
+ dto.e070filCrmx = E070FilCrmx.toDto(dto.e070filCrmx, 'CollaboratorE070FilCrmx');
300
297
  }
301
298
  return dto;
302
299
  };
303
- return CollaboratorBranch;
300
+ return CollaboratorE070FilCrmx;
304
301
  }());
305
302
 
306
303
  var Squad = /** @class */ (function () {
@@ -308,8 +305,6 @@ var Squad = /** @class */ (function () {
308
305
  }
309
306
  Squad.fromDto = function (squadDto, originEntity) {
310
307
  var model = __assign({}, squadDto);
311
- model.createdAt = model.createdAt && moment(model.createdAt).toDate();
312
- model.changedAt = model.changedAt && moment(model.changedAt).toDate();
313
308
  var lookupSeparator = ' - ';
314
309
  var displayFields = ['name'];
315
310
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
@@ -317,8 +312,6 @@ var Squad = /** @class */ (function () {
317
312
  };
318
313
  Squad.toDto = function (squad, originEntity) {
319
314
  var dto = __assign({}, squad);
320
- dto.createdAt = dto.createdAt && moment(dto.createdAt).format();
321
- dto.changedAt = dto.changedAt && moment(dto.changedAt).format();
322
315
  delete dto.label;
323
316
  return dto;
324
317
  };
@@ -330,8 +323,6 @@ var CollaboratorSquad = /** @class */ (function () {
330
323
  }
331
324
  CollaboratorSquad.fromDto = function (collaboratorSquadDto, originEntity) {
332
325
  var model = __assign({}, collaboratorSquadDto);
333
- model.createdAt = model.createdAt && moment(model.createdAt).toDate();
334
- model.changedAt = model.changedAt && moment(model.changedAt).toDate();
335
326
  var lookupSeparator = ' - ';
336
327
  var displayFields = ['squad.name'];
337
328
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
@@ -345,8 +336,6 @@ var CollaboratorSquad = /** @class */ (function () {
345
336
  };
346
337
  CollaboratorSquad.toDto = function (collaboratorSquad, originEntity) {
347
338
  var dto = __assign({}, collaboratorSquad);
348
- dto.createdAt = dto.createdAt && moment(dto.createdAt).format();
349
- dto.changedAt = dto.changedAt && moment(dto.changedAt).format();
350
339
  delete dto.label;
351
340
  if (originEntity !== 'Collaborator' && dto.collaborator) {
352
341
  dto.collaborator = Collaborator.toDto(dto.collaborator, 'CollaboratorSquad');
@@ -366,8 +355,6 @@ var Collaborator = /** @class */ (function () {
366
355
  }
367
356
  Collaborator.fromDto = function (collaboratorDto, originEntity) {
368
357
  var model = __assign({}, collaboratorDto);
369
- model.createdAt = model.createdAt && moment(model.createdAt).toDate();
370
- model.changedAt = model.changedAt && moment(model.changedAt).toDate();
371
358
  var lookupSeparator = ' - ';
372
359
  var displayFields = ['code', 'name'];
373
360
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
@@ -377,8 +364,8 @@ var Collaborator = /** @class */ (function () {
377
364
  if (originEntity !== 'Collaborator' && model.leader) {
378
365
  model.leader = Collaborator.fromDto(model.leader, 'Collaborator');
379
366
  }
380
- if (originEntity !== 'CollaboratorBranch' && model.branches) {
381
- model.branches = Object.values(model.branches).map(function (item) { return CollaboratorBranch.fromDto(item, 'Collaborator'); });
367
+ if (originEntity !== 'CollaboratorE070FilCrmx' && model.branches) {
368
+ model.branches = Object.values(model.branches).map(function (item) { return CollaboratorE070FilCrmx.fromDto(item, 'Collaborator'); });
382
369
  }
383
370
  if (originEntity !== 'CollaboratorSquad' && model.squads) {
384
371
  model.squads = Object.values(model.squads).map(function (item) { return CollaboratorSquad.fromDto(item, 'Collaborator'); });
@@ -387,8 +374,6 @@ var Collaborator = /** @class */ (function () {
387
374
  };
388
375
  Collaborator.toDto = function (collaborator, originEntity) {
389
376
  var dto = __assign({}, collaborator);
390
- dto.createdAt = dto.createdAt && moment(dto.createdAt).format();
391
- dto.changedAt = dto.changedAt && moment(dto.changedAt).format();
392
377
  delete dto.label;
393
378
  if (originEntity !== 'User' && dto.user) {
394
379
  dto.user = User.toDto(dto.user, 'Collaborator');
@@ -396,9 +381,9 @@ var Collaborator = /** @class */ (function () {
396
381
  if (originEntity !== 'Collaborator' && dto.leader) {
397
382
  dto.leader = Collaborator.toDto(dto.leader, 'Collaborator');
398
383
  }
399
- if (originEntity !== 'CollaboratorBranch' && dto.branches) {
384
+ if (originEntity !== 'CollaboratorE070FilCrmx' && dto.branches) {
400
385
  dto.branches = Object.values(dto.branches)
401
- .map(function (item) { return CollaboratorBranch.toDto(item, 'Collaborator'); })
386
+ .map(function (item) { return CollaboratorE070FilCrmx.toDto(item, 'Collaborator'); })
402
387
  .filter(function (item) { return Object.keys(item).length; });
403
388
  }
404
389
  if (originEntity !== 'CollaboratorSquad' && dto.squads) {
@@ -420,7 +405,7 @@ var CurrentCollaboratorService = /** @class */ (function () {
420
405
  CurrentCollaboratorService.prototype.validate = function () {
421
406
  var _this = this;
422
407
  this.call(false).subscribe(function (collaborator) {
423
- if (collaborator.active === false) {
408
+ if (collaborator.active === false && !StorageService.isUserAdmin()) {
424
409
  _this.redirect('collaborator-inactive');
425
410
  }
426
411
  });
@@ -431,43 +416,40 @@ var CurrentCollaboratorService = /** @class */ (function () {
431
416
  CurrentCollaboratorService.prototype.call = function (useCache) {
432
417
  var _this = this;
433
418
  return new Observable(function (observer) {
434
- StorageService.get(_this.COLLABORATOR_KEY).then(function (collaboratorDto) {
435
- if (collaboratorDto.hasOwnProperty('id') && useCache) {
419
+ var collaboratorDto = StorageService.get(_this.COLLABORATOR_KEY);
420
+ if (collaboratorDto !== null && useCache) {
421
+ observer.next(Collaborator.fromDto(collaboratorDto));
422
+ }
423
+ else {
424
+ _this.http.get('crmx_collaborator/foundation/queries/getCurrentCollaborator')
425
+ .pipe(takeUntil(_this.ngUnsubscribe), catchError(function (err) {
426
+ var statusCode = 404;
427
+ if (err.status === statusCode && !StorageService.isUserAdmin()) {
428
+ _this.redirect('collaborator-not-found');
429
+ }
430
+ ;
431
+ throw err;
432
+ }))
433
+ .subscribe(function (collaboratorDto) {
434
+ StorageService.store(_this.COLLABORATOR_KEY, _this.removeCircularReferences(collaboratorDto));
436
435
  observer.next(Collaborator.fromDto(collaboratorDto));
437
- }
438
- else {
439
- _this.http.get('crmx/collaborator/queries/getCurrentCollaborator')
440
- .pipe(takeUntil(_this.ngUnsubscribe), catchError(function (err) {
441
- if (err.status === 404) {
442
- _this.redirect('collaborator-not-found');
443
- }
444
- ;
445
- throw err;
446
- }))
447
- .subscribe(function (collaboratorDto) {
448
- StorageService.store(_this.COLLABORATOR_KEY, _this.removeCircularReferences(collaboratorDto));
449
- observer.next(Collaborator.fromDto(collaboratorDto));
450
- });
451
- }
452
- });
436
+ });
437
+ }
453
438
  });
454
439
  };
455
440
  CurrentCollaboratorService.prototype.redirect = function (page) {
456
- if (!location.hostname.includes('interno.senior.com.br')) {
457
- location.href = location.origin + '/gestao-relacionamento/crmx/collaborator/#/' + page;
458
- }
441
+ location.href = StorageService.getBaseUrl() + '/gestao-relacionamento/crmx_collaborator/foundation/#/' + page;
459
442
  };
460
443
  CurrentCollaboratorService.prototype.removeCircularReferences = function (obj) {
461
444
  var seen = new WeakSet();
462
445
  return JSON.parse(JSON.stringify(obj, function (key, value) {
463
- var rtn;
464
- if (typeof value === 'object' && value !== null) {
465
- if (!seen.has(value)) {
466
- seen.add(value);
467
- rtn = value;
446
+ if (typeof value === 'object') {
447
+ if (seen.has(value)) {
448
+ return undefined;
468
449
  }
450
+ seen.add(value);
469
451
  }
470
- return rtn;
452
+ return value;
471
453
  }));
472
454
  };
473
455
  CurrentCollaboratorService.ctorParameters = function () { return [
@@ -485,7 +467,7 @@ var CurrentCollaboratorModule = /** @class */ (function () {
485
467
  CurrentCollaboratorModule = __decorate([
486
468
  NgModule({
487
469
  imports: [
488
- HttpClientModule,
470
+ HttpClientModule
489
471
  ],
490
472
  providers: [
491
473
  CurrentCollaboratorService
@@ -495,9 +477,71 @@ var CurrentCollaboratorModule = /** @class */ (function () {
495
477
  return CurrentCollaboratorModule;
496
478
  }());
497
479
 
480
+ var StandardFiltersService = /** @class */ (function () {
481
+ function StandardFiltersService(currentCollaboratorService) {
482
+ this.currentCollaboratorService = currentCollaboratorService;
483
+ }
484
+ StandardFiltersService.prototype.addFilterE070emp = function (filterQuery, alias) {
485
+ var _this = this;
486
+ return new Observable(function (observer) {
487
+ _this.currentCollaboratorService.get().subscribe(function (collaborator) {
488
+ var ids = Array.from(new Set(collaborator.branches.map(function (branch) { return branch.e070filCrmx.e070fil.e070emp.id; })));
489
+ observer.next(_this.addFilterIn(filterQuery, alias, 'id', ids));
490
+ });
491
+ });
492
+ };
493
+ StandardFiltersService.prototype.addFilterE070fil = function (filterQuery, alias) {
494
+ var _this = this;
495
+ return new Observable(function (observer) {
496
+ _this.currentCollaboratorService.get().subscribe(function (collaborator) {
497
+ var ids = Array.from(new Set(collaborator.branches.map(function (branch) { return branch.e070filCrmx.id; })));
498
+ observer.next(_this.addFilterIn(filterQuery, alias, 'id', ids));
499
+ });
500
+ });
501
+ };
502
+ StandardFiltersService.prototype.addFilterActive = function (filterQuery, alias) {
503
+ var filter = this.addAlias(alias, 'active = true');
504
+ return this.addFilter(filterQuery, filter);
505
+ };
506
+ StandardFiltersService.prototype.addFilter = function (filterQuery, filter) {
507
+ return (filterQuery ? filterQuery + " and " : '') + filter;
508
+ };
509
+ StandardFiltersService.prototype.addFilterIn = function (filterQuery, alias, field, values) {
510
+ var _this = this;
511
+ var filters = values.map(function (value) { return _this.addAlias(alias, field) + " eq '" + value + "'"; });
512
+ return this.addFilter(filterQuery, "(" + filters.join(' or ') + ")");
513
+ };
514
+ StandardFiltersService.prototype.addAlias = function (alias, filter) {
515
+ return (alias ? alias + "." : '') + filter;
516
+ };
517
+ StandardFiltersService.ctorParameters = function () { return [
518
+ { type: CurrentCollaboratorService }
519
+ ]; };
520
+ StandardFiltersService = __decorate([
521
+ Injectable()
522
+ ], StandardFiltersService);
523
+ return StandardFiltersService;
524
+ }());
525
+
526
+ var StandardFiltersModule = /** @class */ (function () {
527
+ function StandardFiltersModule() {
528
+ }
529
+ StandardFiltersModule = __decorate([
530
+ NgModule({
531
+ imports: [
532
+ CurrentCollaboratorModule
533
+ ],
534
+ providers: [
535
+ StandardFiltersService
536
+ ],
537
+ })
538
+ ], StandardFiltersModule);
539
+ return StandardFiltersModule;
540
+ }());
541
+
498
542
  /**
499
543
  * Generated bundle index. Do not edit.
500
544
  */
501
545
 
502
- export { Branch, Collaborator, CollaboratorBranch, Company, CurrentCollaboratorModule, CurrentCollaboratorService, DateValidatorsService, FormGroupValidatorsService, Squad, StorageService, StringConverterService, User, WebsocketService };
546
+ export { Collaborator, CollaboratorE070FilCrmx, CollaboratorSquad, CurrentCollaboratorModule, CurrentCollaboratorService, DateValidatorsService, E070Emp, E070Fil, E070FilCrmx, FormGroupValidatorsService, Squad, StandardFiltersModule, StandardFiltersService, StorageService, StringConverterService, User, WebsocketService, CurrentCollaboratorModule as ɵa, CurrentCollaboratorService as ɵb };
503
547
  //# sourceMappingURL=senior-gestao-relacionamento-angular-components.js.map