@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,22 +1,22 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('js-cookie'), require('@seniorsistemas/senior-platform-data'), require('@angular/core'), require('rxjs'), require('@stomp/stompjs'), require('sockjs-client'), require('moment'), require('@angular/common/http'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@senior-gestao-relacionamento/angular-components', ['exports', 'js-cookie', '@seniorsistemas/senior-platform-data', '@angular/core', 'rxjs', '@stomp/stompjs', 'sockjs-client', 'moment', '@angular/common/http', 'rxjs/operators'], factory) :
4
- (global = global || self, factory((global['senior-gestao-relacionamento'] = global['senior-gestao-relacionamento'] || {}, global['senior-gestao-relacionamento']['angular-components'] = {}), global.jsCookie, global.seniorPlatformData, global.ng.core, global.rxjs, global.stompjs, global.SockJS, global.moment, global.ng.common.http, global.rxjs.operators));
5
- }(this, (function (exports, jsCookie, seniorPlatformData, core, rxjs, stompjs, SockJS, moment, http, operators) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('js-cookie'), require('@angular/core'), require('rxjs'), require('@stomp/stompjs'), require('sockjs-client'), require('@angular/common/http'), require('rxjs/operators')) :
3
+ typeof define === 'function' && define.amd ? define('@senior-gestao-relacionamento/angular-components', ['exports', 'js-cookie', '@angular/core', 'rxjs', '@stomp/stompjs', 'sockjs-client', '@angular/common/http', 'rxjs/operators'], factory) :
4
+ (global = global || self, factory((global['senior-gestao-relacionamento'] = global['senior-gestao-relacionamento'] || {}, global['senior-gestao-relacionamento']['angular-components'] = {}), global.jsCookie, global.ng.core, global.rxjs, global.stompjs, global.SockJS, global.ng.common.http, global.rxjs.operators));
5
+ }(this, (function (exports, jsCookie, core, rxjs, stompjs, SockJS, http, operators) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
8
+ Copyright (c) Microsoft Corporation. All rights reserved.
9
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10
+ this file except in compliance with the License. You may obtain a copy of the
11
+ License at http://www.apache.org/licenses/LICENSE-2.0
9
12
 
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
13
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
+ MERCHANTABLITY OR NON-INFRINGEMENT.
12
17
 
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
18
+ See the Apache Version 2.0 License for specific language governing permissions
19
+ and limitations under the License.
20
20
  ***************************************************************************** */
21
21
  /* global Reflect, Promise */
22
22
 
@@ -72,11 +72,10 @@
72
72
  }
73
73
 
74
74
  function __awaiter(thisArg, _arguments, P, generator) {
75
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
76
75
  return new (P || (P = Promise))(function (resolve, reject) {
77
76
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
78
77
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
79
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
78
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
80
79
  step((generator = generator.apply(thisArg, _arguments || [])).next());
81
80
  });
82
81
  }
@@ -109,25 +108,19 @@
109
108
  }
110
109
  }
111
110
 
112
- function __createBinding(o, m, k, k2) {
113
- if (k2 === undefined) k2 = k;
114
- o[k2] = m[k];
115
- }
116
-
117
111
  function __exportStar(m, exports) {
118
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
112
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
119
113
  }
120
114
 
121
115
  function __values(o) {
122
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
116
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
123
117
  if (m) return m.call(o);
124
- if (o && typeof o.length === "number") return {
118
+ return {
125
119
  next: function () {
126
120
  if (o && i >= o.length) o = void 0;
127
121
  return { value: o && o[i++], done: !o };
128
122
  }
129
123
  };
130
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
131
124
  }
132
125
 
133
126
  function __read(o, n) {
@@ -206,65 +199,28 @@
206
199
 
207
200
  function __importDefault(mod) {
208
201
  return (mod && mod.__esModule) ? mod : { default: mod };
209
- }
210
-
211
- function __classPrivateFieldGet(receiver, privateMap) {
212
- if (!privateMap.has(receiver)) {
213
- throw new TypeError("attempted to get private field on non-instance");
214
- }
215
- return privateMap.get(receiver);
216
- }
217
-
218
- function __classPrivateFieldSet(receiver, privateMap, value) {
219
- if (!privateMap.has(receiver)) {
220
- throw new TypeError("attempted to set private field on non-instance");
221
- }
222
- privateMap.set(receiver, value);
223
- return value;
224
202
  }
225
203
 
226
204
  var StorageService = /** @class */ (function () {
227
205
  function StorageService() {
228
206
  }
207
+ StorageService.getUser = function () {
208
+ return JSON.parse(localStorage.getItem('SENIOR_USER_INFO')).data;
209
+ };
229
210
  StorageService.getUserId = function () {
230
- return __awaiter(this, void 0, void 0, function () {
231
- var user$1;
232
- return __generator(this, function (_a) {
233
- switch (_a.label) {
234
- case 0: return [4 /*yield*/, seniorPlatformData.user.getUserData()];
235
- case 1:
236
- user$1 = _a.sent();
237
- return [2 /*return*/, user$1.id];
238
- }
239
- });
240
- });
211
+ return StorageService.getUser().id;
241
212
  };
242
213
  StorageService.store = function (key, value) {
243
- return __awaiter(this, void 0, void 0, function () {
244
- var userId;
245
- return __generator(this, function (_a) {
246
- switch (_a.label) {
247
- case 0: return [4 /*yield*/, this.getUserId()];
248
- case 1:
249
- userId = _a.sent();
250
- localStorage.setItem(userId + "_" + key, JSON.stringify(value));
251
- return [2 /*return*/];
252
- }
253
- });
254
- });
214
+ var userId = StorageService.getUserId();
215
+ localStorage.setItem(userId + "_" + key, JSON.stringify(value));
255
216
  };
256
217
  StorageService.get = function (key) {
257
- return __awaiter(this, void 0, void 0, function () {
258
- var userId;
259
- return __generator(this, function (_a) {
260
- switch (_a.label) {
261
- case 0: return [4 /*yield*/, this.getUserId()];
262
- case 1:
263
- userId = _a.sent();
264
- return [2 /*return*/, JSON.parse(localStorage.getItem(userId + "_" + key)) || {}];
265
- }
266
- });
267
- });
218
+ var userId = StorageService.getUserId();
219
+ var value = localStorage.getItem(userId + "_" + key);
220
+ if (value) {
221
+ return JSON.parse(value);
222
+ }
223
+ return null;
268
224
  };
269
225
  StorageService.getComSeniorToken = function () {
270
226
  return JSON.parse(jsCookie.get('com.senior.token'));
@@ -287,6 +243,9 @@
287
243
  StorageService.getToken = function () {
288
244
  return StorageService.getComSeniorToken().access_token;
289
245
  };
246
+ StorageService.isUserAdmin = function () {
247
+ return StorageService.getUsername() === 'admin';
248
+ };
290
249
  return StorageService;
291
250
  }());
292
251
 
@@ -418,103 +377,121 @@
418
377
  return WebsocketService;
419
378
  }());
420
379
 
421
- var Company = /** @class */ (function () {
422
- function Company() {
423
- this.active = false;
380
+ var User = /** @class */ (function () {
381
+ function User() {
382
+ this.blocked = false;
424
383
  }
425
- Company.fromDto = function (companyDto, originEntity) {
426
- var model = __assign({}, companyDto);
384
+ User.fromDto = function (userDto, originEntity) {
385
+ var model = __assign({}, userDto);
427
386
  var lookupSeparator = ' - ';
428
- var displayFields = ['code', 'name'];
387
+ var displayFields = ['username', 'fullName'];
429
388
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
430
389
  return model;
431
390
  };
432
- Company.toDto = function (company, originEntity) {
433
- var dto = __assign({}, company);
391
+ User.toDto = function (user, originEntity) {
392
+ var dto = __assign({}, user);
434
393
  delete dto.label;
435
394
  return dto;
436
395
  };
437
- return Company;
396
+ return User;
438
397
  }());
439
398
 
440
- var Branch = /** @class */ (function () {
441
- function Branch() {
442
- this.master = false;
443
- this.active = false;
399
+ var E070Emp = /** @class */ (function () {
400
+ function E070Emp() {
401
+ }
402
+ E070Emp.fromDto = function (e070EmpDto, originEntity) {
403
+ var model = __assign({}, e070EmpDto);
404
+ var lookupSeparator = ' - ';
405
+ var displayFields = ['codEmp', 'nomEmp'];
406
+ model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
407
+ return model;
408
+ };
409
+ E070Emp.toDto = function (e070Emp, originEntity) {
410
+ var dto = __assign({}, e070Emp);
411
+ delete dto.label;
412
+ return dto;
413
+ };
414
+ return E070Emp;
415
+ }());
416
+
417
+ var E070Fil = /** @class */ (function () {
418
+ function E070Fil() {
444
419
  }
445
- Branch.fromDto = function (branchDto, originEntity) {
446
- var model = __assign({}, branchDto);
420
+ E070Fil.fromDto = function (e070FilDto, originEntity) {
421
+ var model = __assign({}, e070FilDto);
447
422
  var lookupSeparator = ' - ';
448
- var displayFields = ['company.code', 'company.name', 'code', 'name'];
423
+ var displayFields = ['e070emp.codEmp', 'e070emp.nomEmp', 'codFil', 'nomFil'];
449
424
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
450
- if (originEntity !== 'Company' && model.company) {
451
- model.company = Company.fromDto(model.company, 'Branch');
425
+ if (originEntity !== 'E070Emp' && model.e070emp) {
426
+ model.e070emp = E070Emp.fromDto(model.e070emp, 'E070Fil');
452
427
  }
453
428
  return model;
454
429
  };
455
- Branch.toDto = function (branch, originEntity) {
456
- var dto = __assign({}, branch);
430
+ E070Fil.toDto = function (e070Fil, originEntity) {
431
+ var dto = __assign({}, e070Fil);
457
432
  delete dto.label;
458
- if (originEntity !== 'Company' && dto.company) {
459
- dto.company = Company.toDto(dto.company, 'Branch');
433
+ if (originEntity !== 'E070Emp' && dto.e070emp) {
434
+ dto.e070emp = E070Emp.toDto(dto.e070emp, 'E070Fil');
460
435
  }
461
436
  return dto;
462
437
  };
463
- return Branch;
438
+ return E070Fil;
464
439
  }());
465
440
 
466
- var User = /** @class */ (function () {
467
- function User() {
468
- this.blocked = false;
441
+ var E070FilCrmx = /** @class */ (function () {
442
+ function E070FilCrmx() {
443
+ this.active = false;
469
444
  }
470
- User.fromDto = function (userDto, originEntity) {
471
- var model = __assign({}, userDto);
445
+ E070FilCrmx.fromDto = function (e070FilCrmxDto, originEntity) {
446
+ var model = __assign({}, e070FilCrmxDto);
472
447
  var lookupSeparator = ' - ';
473
- var displayFields = ['username', 'fullName'];
448
+ var displayFields = ['e070fil.e070emp.codEmp', 'e070fil.e070emp.nomEmp', 'e070fil.codFil', 'e070fil.nomFil'];
474
449
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
450
+ if (originEntity !== 'E070Fil' && model.e070fil) {
451
+ model.e070fil = E070Fil.fromDto(model.e070fil, 'E070FilCrmx');
452
+ }
475
453
  return model;
476
454
  };
477
- User.toDto = function (user, originEntity) {
478
- var dto = __assign({}, user);
455
+ E070FilCrmx.toDto = function (e070FilCrmx, originEntity) {
456
+ var dto = __assign({}, e070FilCrmx);
479
457
  delete dto.label;
458
+ if (originEntity !== 'E070Fil' && dto.e070fil) {
459
+ dto.e070fil = E070Fil.toDto(dto.e070fil, 'E070FilCrmx');
460
+ }
480
461
  return dto;
481
462
  };
482
- return User;
463
+ return E070FilCrmx;
483
464
  }());
484
465
 
485
- var CollaboratorBranch = /** @class */ (function () {
486
- function CollaboratorBranch() {
466
+ var CollaboratorE070FilCrmx = /** @class */ (function () {
467
+ function CollaboratorE070FilCrmx() {
487
468
  this.master = false;
488
469
  }
489
- CollaboratorBranch.fromDto = function (collaboratorBranchDto, originEntity) {
490
- var model = __assign({}, collaboratorBranchDto);
491
- model.createdAt = model.createdAt && moment(model.createdAt).toDate();
492
- model.changedAt = model.changedAt && moment(model.changedAt).toDate();
470
+ CollaboratorE070FilCrmx.fromDto = function (collaboratorE070FilCrmxDto, originEntity) {
471
+ var model = __assign({}, collaboratorE070FilCrmxDto);
493
472
  var lookupSeparator = ' - ';
494
- var displayFields = ['branch.company.code', 'branch.company.name', 'branch.code', 'branch.name', 'master'];
473
+ var displayFields = ['e070filCrmx.e070fil.codFil', 'e070filCrmx.e070fil.nomFil'];
495
474
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
496
475
  if (originEntity !== 'Collaborator' && model.collaborator) {
497
- model.collaborator = Collaborator.fromDto(model.collaborator, 'CollaboratorBranch');
476
+ model.collaborator = Collaborator.fromDto(model.collaborator, 'CollaboratorE070FilCrmx');
498
477
  }
499
- if (originEntity !== 'Branch' && model.branch) {
500
- model.branch = Branch.fromDto(model.branch, 'CollaboratorBranch');
478
+ if (originEntity !== 'E070FilCrmx' && model.e070filCrmx) {
479
+ model.e070filCrmx = E070FilCrmx.fromDto(model.e070filCrmx, 'CollaboratorE070FilCrmx');
501
480
  }
502
481
  return model;
503
482
  };
504
- CollaboratorBranch.toDto = function (collaboratorBranch, originEntity) {
505
- var dto = __assign({}, collaboratorBranch);
506
- dto.createdAt = dto.createdAt && moment(dto.createdAt).format();
507
- dto.changedAt = dto.changedAt && moment(dto.changedAt).format();
483
+ CollaboratorE070FilCrmx.toDto = function (collaboratorE070FilCrmx, originEntity) {
484
+ var dto = __assign({}, collaboratorE070FilCrmx);
508
485
  delete dto.label;
509
486
  if (originEntity !== 'Collaborator' && dto.collaborator) {
510
- dto.collaborator = Collaborator.toDto(dto.collaborator, 'CollaboratorBranch');
487
+ dto.collaborator = Collaborator.toDto(dto.collaborator, 'CollaboratorE070FilCrmx');
511
488
  }
512
- if (originEntity !== 'Branch' && dto.branch) {
513
- dto.branch = Branch.toDto(dto.branch, 'CollaboratorBranch');
489
+ if (originEntity !== 'E070FilCrmx' && dto.e070filCrmx) {
490
+ dto.e070filCrmx = E070FilCrmx.toDto(dto.e070filCrmx, 'CollaboratorE070FilCrmx');
514
491
  }
515
492
  return dto;
516
493
  };
517
- return CollaboratorBranch;
494
+ return CollaboratorE070FilCrmx;
518
495
  }());
519
496
 
520
497
  var Squad = /** @class */ (function () {
@@ -522,8 +499,6 @@
522
499
  }
523
500
  Squad.fromDto = function (squadDto, originEntity) {
524
501
  var model = __assign({}, squadDto);
525
- model.createdAt = model.createdAt && moment(model.createdAt).toDate();
526
- model.changedAt = model.changedAt && moment(model.changedAt).toDate();
527
502
  var lookupSeparator = ' - ';
528
503
  var displayFields = ['name'];
529
504
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
@@ -531,8 +506,6 @@
531
506
  };
532
507
  Squad.toDto = function (squad, originEntity) {
533
508
  var dto = __assign({}, squad);
534
- dto.createdAt = dto.createdAt && moment(dto.createdAt).format();
535
- dto.changedAt = dto.changedAt && moment(dto.changedAt).format();
536
509
  delete dto.label;
537
510
  return dto;
538
511
  };
@@ -544,8 +517,6 @@
544
517
  }
545
518
  CollaboratorSquad.fromDto = function (collaboratorSquadDto, originEntity) {
546
519
  var model = __assign({}, collaboratorSquadDto);
547
- model.createdAt = model.createdAt && moment(model.createdAt).toDate();
548
- model.changedAt = model.changedAt && moment(model.changedAt).toDate();
549
520
  var lookupSeparator = ' - ';
550
521
  var displayFields = ['squad.name'];
551
522
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
@@ -559,8 +530,6 @@
559
530
  };
560
531
  CollaboratorSquad.toDto = function (collaboratorSquad, originEntity) {
561
532
  var dto = __assign({}, collaboratorSquad);
562
- dto.createdAt = dto.createdAt && moment(dto.createdAt).format();
563
- dto.changedAt = dto.changedAt && moment(dto.changedAt).format();
564
533
  delete dto.label;
565
534
  if (originEntity !== 'Collaborator' && dto.collaborator) {
566
535
  dto.collaborator = Collaborator.toDto(dto.collaborator, 'CollaboratorSquad');
@@ -580,8 +549,6 @@
580
549
  }
581
550
  Collaborator.fromDto = function (collaboratorDto, originEntity) {
582
551
  var model = __assign({}, collaboratorDto);
583
- model.createdAt = model.createdAt && moment(model.createdAt).toDate();
584
- model.changedAt = model.changedAt && moment(model.changedAt).toDate();
585
552
  var lookupSeparator = ' - ';
586
553
  var displayFields = ['code', 'name'];
587
554
  model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
@@ -591,8 +558,8 @@
591
558
  if (originEntity !== 'Collaborator' && model.leader) {
592
559
  model.leader = Collaborator.fromDto(model.leader, 'Collaborator');
593
560
  }
594
- if (originEntity !== 'CollaboratorBranch' && model.branches) {
595
- model.branches = Object.values(model.branches).map(function (item) { return CollaboratorBranch.fromDto(item, 'Collaborator'); });
561
+ if (originEntity !== 'CollaboratorE070FilCrmx' && model.branches) {
562
+ model.branches = Object.values(model.branches).map(function (item) { return CollaboratorE070FilCrmx.fromDto(item, 'Collaborator'); });
596
563
  }
597
564
  if (originEntity !== 'CollaboratorSquad' && model.squads) {
598
565
  model.squads = Object.values(model.squads).map(function (item) { return CollaboratorSquad.fromDto(item, 'Collaborator'); });
@@ -601,8 +568,6 @@
601
568
  };
602
569
  Collaborator.toDto = function (collaborator, originEntity) {
603
570
  var dto = __assign({}, collaborator);
604
- dto.createdAt = dto.createdAt && moment(dto.createdAt).format();
605
- dto.changedAt = dto.changedAt && moment(dto.changedAt).format();
606
571
  delete dto.label;
607
572
  if (originEntity !== 'User' && dto.user) {
608
573
  dto.user = User.toDto(dto.user, 'Collaborator');
@@ -610,9 +575,9 @@
610
575
  if (originEntity !== 'Collaborator' && dto.leader) {
611
576
  dto.leader = Collaborator.toDto(dto.leader, 'Collaborator');
612
577
  }
613
- if (originEntity !== 'CollaboratorBranch' && dto.branches) {
578
+ if (originEntity !== 'CollaboratorE070FilCrmx' && dto.branches) {
614
579
  dto.branches = Object.values(dto.branches)
615
- .map(function (item) { return CollaboratorBranch.toDto(item, 'Collaborator'); })
580
+ .map(function (item) { return CollaboratorE070FilCrmx.toDto(item, 'Collaborator'); })
616
581
  .filter(function (item) { return Object.keys(item).length; });
617
582
  }
618
583
  if (originEntity !== 'CollaboratorSquad' && dto.squads) {
@@ -634,7 +599,7 @@
634
599
  CurrentCollaboratorService.prototype.validate = function () {
635
600
  var _this = this;
636
601
  this.call(false).subscribe(function (collaborator) {
637
- if (collaborator.active === false) {
602
+ if (collaborator.active === false && !StorageService.isUserAdmin()) {
638
603
  _this.redirect('collaborator-inactive');
639
604
  }
640
605
  });
@@ -645,43 +610,40 @@
645
610
  CurrentCollaboratorService.prototype.call = function (useCache) {
646
611
  var _this = this;
647
612
  return new rxjs.Observable(function (observer) {
648
- StorageService.get(_this.COLLABORATOR_KEY).then(function (collaboratorDto) {
649
- if (collaboratorDto.hasOwnProperty('id') && useCache) {
613
+ var collaboratorDto = StorageService.get(_this.COLLABORATOR_KEY);
614
+ if (collaboratorDto !== null && useCache) {
615
+ observer.next(Collaborator.fromDto(collaboratorDto));
616
+ }
617
+ else {
618
+ _this.http.get('crmx_collaborator/foundation/queries/getCurrentCollaborator')
619
+ .pipe(operators.takeUntil(_this.ngUnsubscribe), operators.catchError(function (err) {
620
+ var statusCode = 404;
621
+ if (err.status === statusCode && !StorageService.isUserAdmin()) {
622
+ _this.redirect('collaborator-not-found');
623
+ }
624
+ ;
625
+ throw err;
626
+ }))
627
+ .subscribe(function (collaboratorDto) {
628
+ StorageService.store(_this.COLLABORATOR_KEY, _this.removeCircularReferences(collaboratorDto));
650
629
  observer.next(Collaborator.fromDto(collaboratorDto));
651
- }
652
- else {
653
- _this.http.get('crmx/collaborator/queries/getCurrentCollaborator')
654
- .pipe(operators.takeUntil(_this.ngUnsubscribe), operators.catchError(function (err) {
655
- if (err.status === 404) {
656
- _this.redirect('collaborator-not-found');
657
- }
658
- ;
659
- throw err;
660
- }))
661
- .subscribe(function (collaboratorDto) {
662
- StorageService.store(_this.COLLABORATOR_KEY, _this.removeCircularReferences(collaboratorDto));
663
- observer.next(Collaborator.fromDto(collaboratorDto));
664
- });
665
- }
666
- });
630
+ });
631
+ }
667
632
  });
668
633
  };
669
634
  CurrentCollaboratorService.prototype.redirect = function (page) {
670
- if (!location.hostname.includes('interno.senior.com.br')) {
671
- location.href = location.origin + '/gestao-relacionamento/crmx/collaborator/#/' + page;
672
- }
635
+ location.href = StorageService.getBaseUrl() + '/gestao-relacionamento/crmx_collaborator/foundation/#/' + page;
673
636
  };
674
637
  CurrentCollaboratorService.prototype.removeCircularReferences = function (obj) {
675
638
  var seen = new WeakSet();
676
639
  return JSON.parse(JSON.stringify(obj, function (key, value) {
677
- var rtn;
678
- if (typeof value === 'object' && value !== null) {
679
- if (!seen.has(value)) {
680
- seen.add(value);
681
- rtn = value;
640
+ if (typeof value === 'object') {
641
+ if (seen.has(value)) {
642
+ return undefined;
682
643
  }
644
+ seen.add(value);
683
645
  }
684
- return rtn;
646
+ return value;
685
647
  }));
686
648
  };
687
649
  CurrentCollaboratorService.ctorParameters = function () { return [
@@ -699,7 +661,7 @@
699
661
  CurrentCollaboratorModule = __decorate([
700
662
  core.NgModule({
701
663
  imports: [
702
- http.HttpClientModule,
664
+ http.HttpClientModule
703
665
  ],
704
666
  providers: [
705
667
  CurrentCollaboratorService
@@ -709,19 +671,87 @@
709
671
  return CurrentCollaboratorModule;
710
672
  }());
711
673
 
712
- exports.Branch = Branch;
674
+ var StandardFiltersService = /** @class */ (function () {
675
+ function StandardFiltersService(currentCollaboratorService) {
676
+ this.currentCollaboratorService = currentCollaboratorService;
677
+ }
678
+ StandardFiltersService.prototype.addFilterE070emp = function (filterQuery, alias) {
679
+ var _this = this;
680
+ return new rxjs.Observable(function (observer) {
681
+ _this.currentCollaboratorService.get().subscribe(function (collaborator) {
682
+ var ids = Array.from(new Set(collaborator.branches.map(function (branch) { return branch.e070filCrmx.e070fil.e070emp.id; })));
683
+ observer.next(_this.addFilterIn(filterQuery, alias, 'id', ids));
684
+ });
685
+ });
686
+ };
687
+ StandardFiltersService.prototype.addFilterE070fil = function (filterQuery, alias) {
688
+ var _this = this;
689
+ return new rxjs.Observable(function (observer) {
690
+ _this.currentCollaboratorService.get().subscribe(function (collaborator) {
691
+ var ids = Array.from(new Set(collaborator.branches.map(function (branch) { return branch.e070filCrmx.id; })));
692
+ observer.next(_this.addFilterIn(filterQuery, alias, 'id', ids));
693
+ });
694
+ });
695
+ };
696
+ StandardFiltersService.prototype.addFilterActive = function (filterQuery, alias) {
697
+ var filter = this.addAlias(alias, 'active = true');
698
+ return this.addFilter(filterQuery, filter);
699
+ };
700
+ StandardFiltersService.prototype.addFilter = function (filterQuery, filter) {
701
+ return (filterQuery ? filterQuery + " and " : '') + filter;
702
+ };
703
+ StandardFiltersService.prototype.addFilterIn = function (filterQuery, alias, field, values) {
704
+ var _this = this;
705
+ var filters = values.map(function (value) { return _this.addAlias(alias, field) + " eq '" + value + "'"; });
706
+ return this.addFilter(filterQuery, "(" + filters.join(' or ') + ")");
707
+ };
708
+ StandardFiltersService.prototype.addAlias = function (alias, filter) {
709
+ return (alias ? alias + "." : '') + filter;
710
+ };
711
+ StandardFiltersService.ctorParameters = function () { return [
712
+ { type: CurrentCollaboratorService }
713
+ ]; };
714
+ StandardFiltersService = __decorate([
715
+ core.Injectable()
716
+ ], StandardFiltersService);
717
+ return StandardFiltersService;
718
+ }());
719
+
720
+ var StandardFiltersModule = /** @class */ (function () {
721
+ function StandardFiltersModule() {
722
+ }
723
+ StandardFiltersModule = __decorate([
724
+ core.NgModule({
725
+ imports: [
726
+ CurrentCollaboratorModule
727
+ ],
728
+ providers: [
729
+ StandardFiltersService
730
+ ],
731
+ })
732
+ ], StandardFiltersModule);
733
+ return StandardFiltersModule;
734
+ }());
735
+
713
736
  exports.Collaborator = Collaborator;
714
- exports.CollaboratorBranch = CollaboratorBranch;
715
- exports.Company = Company;
737
+ exports.CollaboratorE070FilCrmx = CollaboratorE070FilCrmx;
738
+ exports.CollaboratorSquad = CollaboratorSquad;
716
739
  exports.CurrentCollaboratorModule = CurrentCollaboratorModule;
717
740
  exports.CurrentCollaboratorService = CurrentCollaboratorService;
718
741
  exports.DateValidatorsService = DateValidatorsService;
742
+ exports.E070Emp = E070Emp;
743
+ exports.E070Fil = E070Fil;
744
+ exports.E070FilCrmx = E070FilCrmx;
719
745
  exports.FormGroupValidatorsService = FormGroupValidatorsService;
720
746
  exports.Squad = Squad;
747
+ exports.StandardFiltersModule = StandardFiltersModule;
748
+ exports.StandardFiltersService = StandardFiltersService;
721
749
  exports.StorageService = StorageService;
722
750
  exports.StringConverterService = StringConverterService;
723
751
  exports.User = User;
724
752
  exports.WebsocketService = WebsocketService;
753
+ exports.ɵa = CurrentCollaboratorModule;
754
+ exports.ɵb = CurrentCollaboratorService;
725
755
 
726
756
  Object.defineProperty(exports, '__esModule', { value: true });
727
757