@senior-gestao-relacionamento/angular-components 1.5.0 → 1.6.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 (42) hide show
  1. package/bundles/senior-gestao-relacionamento-angular-components.umd.js +102 -3
  2. package/bundles/senior-gestao-relacionamento-angular-components.umd.js.map +1 -1
  3. package/bundles/senior-gestao-relacionamento-angular-components.umd.min.js +1 -1
  4. package/bundles/senior-gestao-relacionamento-angular-components.umd.min.js.map +1 -1
  5. package/esm2015/services/current-collaborator/current-collaborator.service.js +12 -12
  6. package/esm2015/services/current-collaborator/models/collaborator-dto.js +1 -1
  7. package/esm2015/services/current-collaborator/models/collaborator.js +4 -4
  8. package/esm2015/services/current-tenant/current-tenant.module.js +20 -0
  9. package/esm2015/services/current-tenant/current-tenant.service.js +66 -0
  10. package/esm2015/services/current-tenant/index.js +4 -0
  11. package/esm2015/services/current-tenant/models/index.js +2 -0
  12. package/esm2015/services/current-tenant/models/modulo-dto.js +1 -0
  13. package/esm2015/services/current-tenant/models/modulo.js +15 -0
  14. package/esm2015/services/index.js +2 -1
  15. package/esm2015/services/standard-filters/standard-filters.service.js +2 -2
  16. package/esm5/services/current-collaborator/current-collaborator.service.js +9 -9
  17. package/esm5/services/current-collaborator/models/collaborator-dto.js +1 -1
  18. package/esm5/services/current-collaborator/models/collaborator.js +4 -4
  19. package/esm5/services/current-tenant/current-tenant.module.js +23 -0
  20. package/esm5/services/current-tenant/current-tenant.service.js +69 -0
  21. package/esm5/services/current-tenant/index.js +4 -0
  22. package/esm5/services/current-tenant/models/index.js +2 -0
  23. package/esm5/services/current-tenant/models/modulo-dto.js +1 -0
  24. package/esm5/services/current-tenant/models/modulo.js +20 -0
  25. package/esm5/services/index.js +2 -1
  26. package/esm5/services/standard-filters/standard-filters.service.js +2 -2
  27. package/fesm2015/senior-gestao-relacionamento-angular-components.js +94 -7
  28. package/fesm2015/senior-gestao-relacionamento-angular-components.js.map +1 -1
  29. package/fesm5/senior-gestao-relacionamento-angular-components.js +100 -4
  30. package/fesm5/senior-gestao-relacionamento-angular-components.js.map +1 -1
  31. package/package.json +2 -24
  32. package/senior-gestao-relacionamento-angular-components.metadata.json +1 -1
  33. package/services/current-collaborator/current-collaborator.service.d.ts +4 -4
  34. package/services/current-collaborator/models/collaborator-dto.d.ts +1 -1
  35. package/services/current-collaborator/models/collaborator.d.ts +5 -5
  36. package/services/current-tenant/current-tenant.module.d.ts +2 -0
  37. package/services/current-tenant/current-tenant.service.d.ts +19 -0
  38. package/services/current-tenant/index.d.ts +3 -0
  39. package/services/current-tenant/models/index.d.ts +2 -0
  40. package/services/current-tenant/models/modulo-dto.d.ts +5 -0
  41. package/services/current-tenant/models/modulo.d.ts +8 -0
  42. package/services/index.d.ts +1 -0
@@ -913,13 +913,13 @@
913
913
  observer.next(Collaborator.fromDto(collaboratorDto));
914
914
  }
915
915
  else {
916
- _this.http.get('crmx_collaborator/foundation/queries/getCurrentCollaborator')
916
+ _this.http
917
+ .get('crmx_collaborator/foundation/queries/getCurrentCollaborator')
917
918
  .pipe(operators.takeUntil(_this.ngUnsubscribe), operators.catchError(function (err) {
918
919
  var statusCode = 404;
919
920
  if (err.status === statusCode) {
920
921
  _this.redirect('collaborator-not-found');
921
922
  }
922
- ;
923
923
  throw err;
924
924
  }))
925
925
  .subscribe(function (collaboratorDto) {
@@ -988,6 +988,102 @@
988
988
  return CurrentCollaboratorModule;
989
989
  }());
990
990
 
991
+ var Modulo = /** @class */ (function () {
992
+ function Modulo() {
993
+ }
994
+ Modulo.fromDto = function (moduleDto, originEntity) {
995
+ var model = __assign({}, moduleDto);
996
+ var lookupSeparator = ' - ';
997
+ var displayFields = ['modulo'];
998
+ model.label = displayFields.map(function (field) { return model[field]; }).join(lookupSeparator);
999
+ return model;
1000
+ };
1001
+ Modulo.toDto = function (module, originEntity) {
1002
+ var dto = __assign({}, module);
1003
+ delete dto.label;
1004
+ return dto;
1005
+ };
1006
+ return Modulo;
1007
+ }());
1008
+
1009
+ var CurrentTenantService = /** @class */ (function () {
1010
+ function CurrentTenantService(http, storageService) {
1011
+ this.http = http;
1012
+ this.storageService = storageService;
1013
+ this.ngUnsubscribe = new rxjs.Subject();
1014
+ this.ERPX_MODULE_KEY = 'ERPX_MODULE';
1015
+ }
1016
+ CurrentTenantService.prototype.validate = function () {
1017
+ var _this = this;
1018
+ return new rxjs.Observable(function (observer) {
1019
+ _this.call(false).subscribe(function (modulo) {
1020
+ if (modulo.ativo === false) {
1021
+ _this.redirect('module-inactive');
1022
+ }
1023
+ else {
1024
+ observer.next(modulo);
1025
+ observer.complete();
1026
+ }
1027
+ });
1028
+ });
1029
+ };
1030
+ CurrentTenantService.prototype.call = function (useCache) {
1031
+ var _this = this;
1032
+ return new rxjs.Observable(function (observer) {
1033
+ var moduleDto = _this.storageService.get(_this.ERPX_MODULE_KEY);
1034
+ if (moduleDto !== null && useCache) {
1035
+ observer.next(Modulo.fromDto(moduleDto));
1036
+ }
1037
+ else {
1038
+ _this.http
1039
+ .get('erpx_fnd/empresa/entities/modulos?filter=modulo%20eq%20%27CRM%27%20and%20ativo%20eq%20%27true%27')
1040
+ .pipe(operators.takeUntil(_this.ngUnsubscribe), operators.catchError(function (err) {
1041
+ throw err;
1042
+ }))
1043
+ .subscribe(function (response) {
1044
+ if (response.totalElements === 0) {
1045
+ _this.redirect('module-inactive');
1046
+ }
1047
+ else {
1048
+ var moduloDto = response.contents[0];
1049
+ _this.storageService.store(_this.ERPX_MODULE_KEY, moduloDto);
1050
+ observer.next(Modulo.fromDto(moduloDto));
1051
+ }
1052
+ });
1053
+ }
1054
+ observer.complete();
1055
+ });
1056
+ };
1057
+ CurrentTenantService.prototype.redirect = function (page) {
1058
+ location.href = this.storageService.getBaseUrl() + "/gestao-relacionamento/crmx_collaborator/foundation/#/" + page;
1059
+ };
1060
+ CurrentTenantService.ctorParameters = function () { return [
1061
+ { type: http.HttpClient },
1062
+ { type: StorageService }
1063
+ ]; };
1064
+ CurrentTenantService = __decorate([
1065
+ core.Injectable()
1066
+ ], CurrentTenantService);
1067
+ return CurrentTenantService;
1068
+ }());
1069
+
1070
+ var CurrentTenantModule = /** @class */ (function () {
1071
+ function CurrentTenantModule() {
1072
+ }
1073
+ CurrentTenantModule = __decorate([
1074
+ core.NgModule({
1075
+ imports: [
1076
+ http.HttpClientModule,
1077
+ StorageModule,
1078
+ ],
1079
+ providers: [
1080
+ CurrentTenantService
1081
+ ],
1082
+ })
1083
+ ], CurrentTenantModule);
1084
+ return CurrentTenantModule;
1085
+ }());
1086
+
991
1087
 
992
1088
  (function (MonthEnum) {
993
1089
  MonthEnum["JANUARY"] = "JANUARY";
@@ -1177,7 +1273,7 @@
1177
1273
  });
1178
1274
  };
1179
1275
  StandardFiltersService.prototype.addFilterActive = function (filterQuery, alias) {
1180
- var filter = this.addAlias(alias, 'active = true');
1276
+ var filter = this.addAlias(alias, 'active eq true');
1181
1277
  return this.addFilter(filterQuery, filter);
1182
1278
  };
1183
1279
  StandardFiltersService.prototype.addFilter = function (filterQuery, filter) {
@@ -1470,12 +1566,15 @@
1470
1566
  exports.CollaboratorSquad = CollaboratorSquad;
1471
1567
  exports.CurrentCollaboratorModule = CurrentCollaboratorModule;
1472
1568
  exports.CurrentCollaboratorService = CurrentCollaboratorService;
1569
+ exports.CurrentTenantModule = CurrentTenantModule;
1570
+ exports.CurrentTenantService = CurrentTenantService;
1473
1571
  exports.DateValidatorsService = DateValidatorsService;
1474
1572
  exports.E070Emp = E070Emp;
1475
1573
  exports.E070Fil = E070Fil;
1476
1574
  exports.E070FilCrmx = E070FilCrmx;
1477
1575
  exports.Event = Event;
1478
1576
  exports.FormGroupValidatorsService = FormGroupValidatorsService;
1577
+ exports.Modulo = Modulo;
1479
1578
  exports.RefreshWebsocketAlertComponent = RefreshWebsocketAlertComponent;
1480
1579
  exports.RefreshWebsocketAlertModule = RefreshWebsocketAlertModule;
1481
1580
  exports.ReportsComponent = ReportsComponent;