@cauca-911/management 12.0.0 → 13.0.1

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 (44) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +4 -4
  3. package/assets/i18n/cauca/en-management.json +16 -16
  4. package/assets/i18n/cauca/fr-management.json +16 -16
  5. package/bundles/cauca-911-management.umd.js +663 -500
  6. package/bundles/cauca-911-management.umd.js.map +1 -1
  7. package/bundles/cauca-911-management.umd.min.js +2 -0
  8. package/bundles/cauca-911-management.umd.min.js.map +1 -0
  9. package/cauca-911-management.d.ts +5 -5
  10. package/esm2015/cauca-911-management.js +5 -6
  11. package/esm2015/lib/cauca-management-group/cauca-management-group.component.js +298 -212
  12. package/esm2015/lib/cauca-management-user/cauca-management-user.component.js +106 -57
  13. package/esm2015/lib/cauca-management.component.js +27 -14
  14. package/esm2015/lib/cauca-management.module.js +56 -35
  15. package/esm2015/lib/cauca-management.service.js +14 -13
  16. package/esm2015/lib/shared/models/group-model.js +8 -8
  17. package/esm2015/lib/shared/models/group-permission-model.js +9 -9
  18. package/esm2015/lib/shared/models/permission-model.js +8 -8
  19. package/esm2015/lib/shared/models/user-group-model.js +8 -8
  20. package/esm2015/lib/shared/models/user-model.js +12 -11
  21. package/esm2015/lib/shared/models/user-permission-model.js +9 -9
  22. package/esm2015/lib/shared/services/management-group.service.js +34 -38
  23. package/esm2015/lib/shared/services/management-permission.service.js +31 -35
  24. package/esm2015/lib/shared/services/management-user.service.js +49 -53
  25. package/esm2015/public-api.js +16 -16
  26. package/fesm2015/cauca-911-management.js +606 -456
  27. package/fesm2015/cauca-911-management.js.map +1 -1
  28. package/lib/cauca-management-group/cauca-management-group.component.d.ts +45 -42
  29. package/lib/cauca-management-user/cauca-management-user.component.d.ts +20 -17
  30. package/lib/cauca-management.component.d.ts +8 -5
  31. package/lib/cauca-management.module.d.ts +14 -2
  32. package/lib/cauca-management.service.d.ts +6 -3
  33. package/lib/shared/models/group-model.d.ts +9 -9
  34. package/lib/shared/models/group-permission-model.d.ts +7 -7
  35. package/lib/shared/models/permission-model.d.ts +7 -7
  36. package/lib/shared/models/user-group-model.d.ts +6 -6
  37. package/lib/shared/models/user-model.d.ts +15 -14
  38. package/lib/shared/models/user-permission-model.d.ts +7 -7
  39. package/lib/shared/services/management-group.service.d.ts +17 -14
  40. package/lib/shared/services/management-permission.service.d.ts +16 -13
  41. package/lib/shared/services/management-user.service.d.ts +23 -20
  42. package/package.json +9 -7
  43. package/public-api.d.ts +12 -12
  44. package/cauca-911-management.metadata.json +0 -1
@@ -1,523 +1,687 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('devextreme-angular/ui/check-box'), require('devextreme-angular/ui/list'), require('devextreme-angular/ui/tag-box'), require('@cauca-911/core'), require('@cauca-911/devextreme'), require('@angular/cdk/layout'), require('rxjs/operators'), require('@angular/common/http'), require('@angular/common')) :
3
- typeof define === 'function' && define.amd ? define('@cauca-911/management', ['exports', '@angular/core', 'devextreme-angular/ui/check-box', 'devextreme-angular/ui/list', 'devextreme-angular/ui/tag-box', '@cauca-911/core', '@cauca-911/devextreme', '@angular/cdk/layout', 'rxjs/operators', '@angular/common/http', '@angular/common'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["cauca-911"] = global["cauca-911"] || {}, global["cauca-911"].management = {}), global.ng.core, global["devextreme-angular/ui/check-box"], global["devextreme-angular/ui/list"], global["devextreme-angular/ui/tag-box"], global["@cauca-911/core"], global["@cauca-911/devextreme"], global.ng.cdk.layout, global.rxjs.operators, global.ng.common.http, global.ng.common));
5
- })(this, (function (exports, i0, checkBox, list, tagBox, i1, devextreme, layout, operators, i2, common) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@ngx-translate/core'), require('devextreme-angular/ui/check-box'), require('devextreme-angular/ui/list'), require('devextreme-angular/ui/tag-box'), require('@cauca-911/core'), require('@cauca-911/devextreme'), require('rxjs/operators'), require('@angular/common/http'), require('@angular/cdk/layout'), require('devextreme-angular/ui/nested'), require('devextreme-angular/core'), require('@angular/common')) :
3
+ typeof define === 'function' && define.amd ? define('@cauca-911/management', ['exports', '@angular/core', '@ngx-translate/core', 'devextreme-angular/ui/check-box', 'devextreme-angular/ui/list', 'devextreme-angular/ui/tag-box', '@cauca-911/core', '@cauca-911/devextreme', 'rxjs/operators', '@angular/common/http', '@angular/cdk/layout', 'devextreme-angular/ui/nested', 'devextreme-angular/core', '@angular/common'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['cauca-911'] = global['cauca-911'] || {}, global['cauca-911'].management = {}), global.ng.core, global.i1, global.i10, global.i9, global.i8, global.i1$1, global.i5, global.rxjs.operators, global.ng.common.http, global.ng.cdk.layout, global.i6, global.i7, global.ng.common));
5
+ }(this, (function (exports, i0, i1, i10, i9, i8, i1$1, i5, operators, i2, i4, i6, i7, common) { 'use strict';
6
6
 
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
7
+ var CaucaManagementService = /** @class */ (function () {
8
+ function CaucaManagementService() {
9
+ }
10
+ return CaucaManagementService;
11
+ }());
12
+ CaucaManagementService.ɵfac = function CaucaManagementService_Factory(t) { return new (t || CaucaManagementService)(); };
13
+ CaucaManagementService.ɵprov = i0.ɵɵdefineInjectable({ token: CaucaManagementService, factory: CaucaManagementService.ɵfac, providedIn: 'root' });
14
+ /*@__PURE__*/ (function () {
15
+ i0.ɵsetClassMetadata(CaucaManagementService, [{
16
+ type: i0.Injectable,
17
+ args: [{
18
+ providedIn: 'root'
19
+ }]
20
+ }], function () { return []; }, null);
21
+ })();
24
22
 
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
27
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
23
+ var CaucaManagementComponent = /** @class */ (function () {
24
+ function CaucaManagementComponent() {
25
+ }
26
+ CaucaManagementComponent.prototype.ngOnInit = function () {
27
+ };
28
+ return CaucaManagementComponent;
29
+ }());
30
+ CaucaManagementComponent.ɵfac = function CaucaManagementComponent_Factory(t) { return new (t || CaucaManagementComponent)(); };
31
+ CaucaManagementComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaucaManagementComponent, selectors: [["cauca-management"]], decls: 3, vars: 3, template: function CaucaManagementComponent_Template(rf, ctx) {
32
+ if (rf & 1) {
33
+ i0.ɵɵelementStart(0, "div");
34
+ i0.ɵɵtext(1);
35
+ i0.ɵɵpipe(2, "translate");
36
+ i0.ɵɵelementEnd();
37
+ }
38
+ if (rf & 2) {
39
+ i0.ɵɵadvance(1);
40
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, "core.noGenericComponentOnThisLibrary"));
41
+ }
42
+ }, pipes: [i1.TranslatePipe], encapsulation: 2 });
43
+ /*@__PURE__*/ (function () {
44
+ i0.ɵsetClassMetadata(CaucaManagementComponent, [{
45
+ type: i0.Component,
46
+ args: [{
47
+ selector: 'cauca-management',
48
+ templateUrl: './cauca-management.component.html',
49
+ styles: []
50
+ }]
51
+ }], function () { return []; }, null);
52
+ })();
28
53
 
29
- var CaucaManagementService = /** @class */ (function () {
30
- function CaucaManagementService() {
31
- }
32
- return CaucaManagementService;
33
- }());
34
- CaucaManagementService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function CaucaManagementService_Factory() { return new CaucaManagementService(); }, token: CaucaManagementService, providedIn: "root" });
35
- CaucaManagementService.decorators = [
36
- { type: i0.Injectable, args: [{
37
- providedIn: 'root'
38
- },] }
39
- ];
40
- CaucaManagementService.ctorParameters = function () { return []; };
41
-
42
- var CaucaManagementComponent = /** @class */ (function () {
43
- function CaucaManagementComponent() {
44
- }
45
- CaucaManagementComponent.prototype.ngOnInit = function () {
46
- };
47
- return CaucaManagementComponent;
48
- }());
49
- CaucaManagementComponent.decorators = [
50
- { type: i0.Component, args: [{
51
- selector: 'cauca-management',
52
- template: "<div>{{'core.noGenericComponentOnThisLibrary' | translate}}</div>"
53
- },] }
54
- ];
55
- CaucaManagementComponent.ctorParameters = function () { return []; };
56
-
57
- var ManagementGroupService = /** @class */ (function () {
58
- function ManagementGroupService(coreService, http) {
59
- this.http = http;
60
- this.config = coreService.getConfig();
61
- }
62
- ManagementGroupService.prototype.getAll = function () {
63
- return this.http.get(this.config.apiUrl + "GroupManagement");
64
- };
65
- ManagementGroupService.prototype.get = function (idGroup) {
66
- return this.http.get(this.config.apiUrl + "GroupManagement/" + idGroup);
67
- };
68
- ManagementGroupService.prototype.save = function (group) {
69
- return this.http.post(this.config.apiUrl + "GroupManagement", group);
70
- };
71
- ManagementGroupService.prototype.delete = function (idGroup) {
72
- return this.http.delete(this.config.apiUrl + "GroupManagement/" + idGroup);
73
- };
74
- ManagementGroupService.prototype.hasExistingGroupName = function (group) {
75
- return this.http.post(this.config.apiUrl + "GroupManagement/GroupNameAlreadyExist", group);
76
- };
77
- return ManagementGroupService;
78
- }());
79
- ManagementGroupService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ManagementGroupService_Factory() { return new ManagementGroupService(i0__namespace.ɵɵinject(i1__namespace.CaucaCoreService), i0__namespace.ɵɵinject(i2__namespace.HttpClient)); }, token: ManagementGroupService, providedIn: "root" });
80
- ManagementGroupService.decorators = [
81
- { type: i0.Injectable, args: [{
82
- providedIn: 'root'
83
- },] }
84
- ];
85
- ManagementGroupService.ctorParameters = function () { return [
86
- { type: i1.CaucaCoreService },
87
- { type: i2.HttpClient }
88
- ]; };
54
+ var ManagementGroupService = /** @class */ (function () {
55
+ function ManagementGroupService(coreService, http) {
56
+ this.http = http;
57
+ this.config = coreService.getConfig();
58
+ }
59
+ ManagementGroupService.prototype.getAll = function () {
60
+ return this.http.get(this.config.apiUrl + "GroupManagement");
61
+ };
62
+ ManagementGroupService.prototype.get = function (idGroup) {
63
+ return this.http.get(this.config.apiUrl + "GroupManagement/" + idGroup);
64
+ };
65
+ ManagementGroupService.prototype.save = function (group) {
66
+ return this.http.post(this.config.apiUrl + "GroupManagement", group);
67
+ };
68
+ ManagementGroupService.prototype.delete = function (idGroup) {
69
+ return this.http.delete(this.config.apiUrl + "GroupManagement/" + idGroup);
70
+ };
71
+ ManagementGroupService.prototype.hasExistingGroupName = function (group) {
72
+ return this.http.post(this.config.apiUrl + "GroupManagement/GroupNameAlreadyExist", group);
73
+ };
74
+ return ManagementGroupService;
75
+ }());
76
+ ManagementGroupService.ɵfac = function ManagementGroupService_Factory(t) { return new (t || ManagementGroupService)(i0.ɵɵinject(i1$1.CaucaCoreService), i0.ɵɵinject(i2.HttpClient)); };
77
+ ManagementGroupService.ɵprov = i0.ɵɵdefineInjectable({ token: ManagementGroupService, factory: ManagementGroupService.ɵfac, providedIn: 'root' });
78
+ /*@__PURE__*/ (function () {
79
+ i0.ɵsetClassMetadata(ManagementGroupService, [{
80
+ type: i0.Injectable,
81
+ args: [{
82
+ providedIn: 'root'
83
+ }]
84
+ }], function () { return [{ type: i1$1.CaucaCoreService }, { type: i2.HttpClient }]; }, null);
85
+ })();
89
86
 
90
- var ManagementUserService = /** @class */ (function () {
91
- function ManagementUserService(coreService, http) {
92
- this.http = http;
93
- this.config = coreService.getConfig();
94
- }
95
- ManagementUserService.prototype.getAll = function () {
96
- return this.http.get(this.config.apiUrl + "UserManagement");
97
- };
98
- ManagementUserService.prototype.get = function (idUser) {
99
- return this.http.get(this.config.apiUrl + "UserManagement/" + idUser);
100
- };
101
- ManagementUserService.prototype.getGroup = function (idUser) {
102
- return this.http.get(this.config.apiUrl + "UserManagement/" + idUser + "/groups");
103
- };
104
- ManagementUserService.prototype.addGroup = function (userGroup) {
105
- return this.http.post(this.config.apiUrl + "UserManagement/group", userGroup);
106
- };
107
- ManagementUserService.prototype.deleteGroup = function (idUserGroup) {
108
- return this.http.delete(this.config.apiUrl + "UserManagement/groups/" + idUserGroup);
109
- };
110
- ManagementUserService.prototype.addPermission = function (userPermission) {
111
- return this.http.post(this.config.apiUrl + "UserManagement/permission", userPermission);
112
- };
113
- ManagementUserService.prototype.deletePermission = function (idUserPermission) {
114
- return this.http.delete(this.config.apiUrl + "UserManagement/groups/" + idUserPermission);
115
- };
116
- ManagementUserService.prototype.save = function (user) {
117
- return this.http.post(this.config.apiUrl + "UserManagement", user);
118
- };
119
- ManagementUserService.prototype.delete = function (idUser) {
120
- return this.http.delete(this.config.apiUrl + "UserManagement/" + idUser);
121
- };
122
- ManagementUserService.prototype.hasExistingUserName = function (user) {
123
- return this.http.post(this.config.apiUrl + "UserManagement/UserNameAlreadyExist", user);
124
- };
125
- return ManagementUserService;
126
- }());
127
- ManagementUserService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ManagementUserService_Factory() { return new ManagementUserService(i0__namespace.ɵɵinject(i1__namespace.CaucaCoreService), i0__namespace.ɵɵinject(i2__namespace.HttpClient)); }, token: ManagementUserService, providedIn: "root" });
128
- ManagementUserService.decorators = [
129
- { type: i0.Injectable, args: [{
130
- providedIn: 'root'
131
- },] }
132
- ];
133
- ManagementUserService.ctorParameters = function () { return [
134
- { type: i1.CaucaCoreService },
135
- { type: i2.HttpClient }
136
- ]; };
87
+ var ManagementUserService = /** @class */ (function () {
88
+ function ManagementUserService(coreService, http) {
89
+ this.http = http;
90
+ this.config = coreService.getConfig();
91
+ }
92
+ ManagementUserService.prototype.getAll = function () {
93
+ return this.http.get(this.config.apiUrl + "UserManagement");
94
+ };
95
+ ManagementUserService.prototype.get = function (idUser) {
96
+ return this.http.get(this.config.apiUrl + "UserManagement/" + idUser);
97
+ };
98
+ ManagementUserService.prototype.getGroup = function (idUser) {
99
+ return this.http.get(this.config.apiUrl + "UserManagement/" + idUser + "/groups");
100
+ };
101
+ ManagementUserService.prototype.addGroup = function (userGroup) {
102
+ return this.http.post(this.config.apiUrl + "UserManagement/group", userGroup);
103
+ };
104
+ ManagementUserService.prototype.deleteGroup = function (idUserGroup) {
105
+ return this.http.delete(this.config.apiUrl + "UserManagement/groups/" + idUserGroup);
106
+ };
107
+ ManagementUserService.prototype.addPermission = function (userPermission) {
108
+ return this.http.post(this.config.apiUrl + "UserManagement/permission", userPermission);
109
+ };
110
+ ManagementUserService.prototype.deletePermission = function (idUserPermission) {
111
+ return this.http.delete(this.config.apiUrl + "UserManagement/groups/" + idUserPermission);
112
+ };
113
+ ManagementUserService.prototype.save = function (user) {
114
+ return this.http.post(this.config.apiUrl + "UserManagement", user);
115
+ };
116
+ ManagementUserService.prototype.delete = function (idUser) {
117
+ return this.http.delete(this.config.apiUrl + "UserManagement/" + idUser);
118
+ };
119
+ ManagementUserService.prototype.hasExistingUserName = function (user) {
120
+ return this.http.post(this.config.apiUrl + "UserManagement/UserNameAlreadyExist", user);
121
+ };
122
+ return ManagementUserService;
123
+ }());
124
+ ManagementUserService.ɵfac = function ManagementUserService_Factory(t) { return new (t || ManagementUserService)(i0.ɵɵinject(i1$1.CaucaCoreService), i0.ɵɵinject(i2.HttpClient)); };
125
+ ManagementUserService.ɵprov = i0.ɵɵdefineInjectable({ token: ManagementUserService, factory: ManagementUserService.ɵfac, providedIn: 'root' });
126
+ /*@__PURE__*/ (function () {
127
+ i0.ɵsetClassMetadata(ManagementUserService, [{
128
+ type: i0.Injectable,
129
+ args: [{
130
+ providedIn: 'root'
131
+ }]
132
+ }], function () { return [{ type: i1$1.CaucaCoreService }, { type: i2.HttpClient }]; }, null);
133
+ })();
137
134
 
138
- var ManagementPermissionService = /** @class */ (function () {
139
- function ManagementPermissionService(coreService, http) {
140
- this.http = http;
141
- this.config = coreService.getConfig();
142
- }
143
- ManagementPermissionService.prototype.getAll = function () {
144
- return this.http.get(this.config.apiUrl + "PermissionManagement");
145
- };
146
- ManagementPermissionService.prototype.get = function (idPermission) {
147
- return this.http.get(this.config.apiUrl + "PermissionManagement/" + idPermission);
148
- };
149
- ManagementPermissionService.prototype.save = function (permission) {
150
- return this.http.post(this.config.apiUrl + "PermissionManagement", permission);
151
- };
152
- ManagementPermissionService.prototype.delete = function (idPermission) {
153
- return this.http.delete(this.config.apiUrl + "PermissionManagement/" + idPermission);
154
- };
155
- return ManagementPermissionService;
156
- }());
157
- ManagementPermissionService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ManagementPermissionService_Factory() { return new ManagementPermissionService(i0__namespace.ɵɵinject(i1__namespace.CaucaCoreService), i0__namespace.ɵɵinject(i2__namespace.HttpClient)); }, token: ManagementPermissionService, providedIn: "root" });
158
- ManagementPermissionService.decorators = [
159
- { type: i0.Injectable, args: [{
160
- providedIn: 'root'
161
- },] }
162
- ];
163
- ManagementPermissionService.ctorParameters = function () { return [
164
- { type: i1.CaucaCoreService },
165
- { type: i2.HttpClient }
166
- ]; };
135
+ var ManagementPermissionService = /** @class */ (function () {
136
+ function ManagementPermissionService(coreService, http) {
137
+ this.http = http;
138
+ this.config = coreService.getConfig();
139
+ }
140
+ ManagementPermissionService.prototype.getAll = function () {
141
+ return this.http.get(this.config.apiUrl + "PermissionManagement");
142
+ };
143
+ ManagementPermissionService.prototype.get = function (idPermission) {
144
+ return this.http.get(this.config.apiUrl + "PermissionManagement/" + idPermission);
145
+ };
146
+ ManagementPermissionService.prototype.save = function (permission) {
147
+ return this.http.post(this.config.apiUrl + "PermissionManagement", permission);
148
+ };
149
+ ManagementPermissionService.prototype.delete = function (idPermission) {
150
+ return this.http.delete(this.config.apiUrl + "PermissionManagement/" + idPermission);
151
+ };
152
+ return ManagementPermissionService;
153
+ }());
154
+ ManagementPermissionService.ɵfac = function ManagementPermissionService_Factory(t) { return new (t || ManagementPermissionService)(i0.ɵɵinject(i1$1.CaucaCoreService), i0.ɵɵinject(i2.HttpClient)); };
155
+ ManagementPermissionService.ɵprov = i0.ɵɵdefineInjectable({ token: ManagementPermissionService, factory: ManagementPermissionService.ɵfac, providedIn: 'root' });
156
+ /*@__PURE__*/ (function () {
157
+ i0.ɵsetClassMetadata(ManagementPermissionService, [{
158
+ type: i0.Injectable,
159
+ args: [{
160
+ providedIn: 'root'
161
+ }]
162
+ }], function () { return [{ type: i1$1.CaucaCoreService }, { type: i2.HttpClient }]; }, null);
163
+ })();
167
164
 
168
- var CaucaManagementGroupComponent = /** @class */ (function () {
169
- function CaucaManagementGroupComponent(managementGroupService, managementUserService, managementPermissionService, breakpointObserver) {
170
- var _this = this;
171
- this.managementGroupService = managementGroupService;
172
- this.managementUserService = managementUserService;
173
- this.managementPermissionService = managementPermissionService;
174
- this.showPrintButton = true;
175
- this.hoverStatePermission = true;
176
- this.groups = [];
177
- this.users = [];
178
- this.permissions = [];
179
- this.userFullName = {};
180
- this.showColumn = true;
181
- this.showColumnXS = true;
182
- this.translations = [];
183
- this.calculateUsersCellValue = function (e) {
184
- var users = (e.users ? e.users : []);
185
- var usersNames = [];
186
- users.forEach(function (user) {
187
- var userGroup = _this.users.filter(function (u) { return u.id === user.idUser; });
188
- if (userGroup && userGroup[0]) {
189
- usersNames.push(userGroup[0].firstName + ' ' + userGroup[0].lastName);
190
- }
191
- });
192
- usersNames = usersNames.sort(function (one, two) { return (one < two ? -1 : 1); });
193
- return usersNames.join(', ');
194
- };
195
- this.groupNameAlreadyUsedValidation = function (e) {
196
- return _this.managementGroupService.hasExistingGroupName(e.data).pipe(operators.map(function (exist) {
197
- return !exist;
198
- })).toPromise();
199
- };
200
- breakpointObserver.observe(['(max-width: 1000px)']).subscribe(function (result) {
201
- _this.showColumn = !result.matches;
202
- });
203
- breakpointObserver.observe(['(max-width: 600px)']).subscribe(function (result) {
204
- _this.showColumnXS = !result.matches;
205
- });
206
- }
207
- CaucaManagementGroupComponent.prototype.ngOnInit = function () {
208
- var _this = this;
209
- this.managementUserService.getAll().subscribe(function (data) {
210
- _this.users = data;
211
- _this.users.forEach(function (user) {
212
- if (user.isActive) {
213
- if (user.firstName !== '' && user.lastName !== '') {
214
- _this.userFullName[user.id] = user.firstName + " " + user.lastName;
215
- }
216
- }
217
- });
218
- });
219
- this.managementPermissionService.getAll().subscribe(function (permissions) {
220
- var permissionIndex = permissions.findIndex(function (c) {
221
- return c.tag === 'CanAccessPermissions';
222
- });
223
- if (permissionIndex !== -1) {
224
- permissions.splice(permissionIndex, 1);
225
- }
226
- permissions.sort(function (a, b) {
227
- if (a.name < b.name) {
228
- return -1;
229
- }
230
- if (a.name > b.name) {
231
- return 1;
232
- }
233
- return 0;
234
- });
235
- _this.permissions = permissions;
236
- });
237
- this.getGroups();
238
- };
239
- CaucaManagementGroupComponent.prototype.fullName = function (data) {
240
- if (!data) {
241
- return '';
242
- }
243
- return data.firstName + " " + data.lastName;
244
- };
245
- CaucaManagementGroupComponent.prototype.getGroupUser = function (field, e) {
246
- var users = [];
247
- if (this.groupUsers) {
248
- this.groupUsers.forEach(function (user) {
249
- users.push(user.idUser);
250
- });
251
- }
252
- e.component.option('value', users);
253
- };
254
- CaucaManagementGroupComponent.prototype.setGroupUser = function (field, e) {
255
- var groupUser = [];
256
- e.value.forEach(function (idUser) {
257
- var groupIndex = (field.data.users || []).findIndex(function (g) { return g.idUser === idUser; });
258
- if (groupIndex === -1) {
259
- groupUser.push({ idUser: idUser, });
260
- }
261
- else {
262
- groupUser.push(field.data.users[groupIndex]);
263
- }
264
- });
265
- field.setValue(JSON.parse(JSON.stringify(groupUser)));
266
- };
267
- CaucaManagementGroupComponent.prototype.setGroupPermission = function (field, e) {
268
- var groupUser = [];
269
- e.value.forEach(function (idUser) {
270
- groupUser.push({
271
- idUser: idUser,
272
- });
273
- });
274
- field.setValue(JSON.parse(JSON.stringify(groupUser)));
275
- };
276
- CaucaManagementGroupComponent.prototype.getPermissionStatus = function (field, permission, e) {
277
- var groupPermission = (field.value || []).find(function (p) { return p.idModulePermission === permission.id; });
278
- if (groupPermission) {
279
- e.component.option('value', groupPermission.isAllowed);
280
- }
281
- else {
282
- e.component.option('value', undefined);
283
- }
284
- };
285
- CaucaManagementGroupComponent.prototype.checkBoxToggled = function (field, permission, e) {
286
- if (e.component.skipOnValueChanged) {
287
- e.component.skipOnValueChanged = false;
288
- return;
289
- }
290
- if (e.component.setUndefinedNextTime) {
291
- e.component.setUndefinedNextTime = false;
292
- e.component.skipOnValueChanged = true;
293
- e.component.option('value', undefined);
294
- this.setPermissionStatus(field, permission, undefined);
295
- return;
296
- }
297
- if (e.value === false) {
298
- e.component.setUndefinedNextTime = true;
299
- }
300
- this.setPermissionStatus(field, permission, e.value);
301
- };
302
- CaucaManagementGroupComponent.prototype.onRowInserted = function (e) {
303
- this.saveGroup(e.data);
304
- };
305
- CaucaManagementGroupComponent.prototype.onRowUpdated = function (e) {
306
- this.saveGroup(e.data);
307
- };
308
- CaucaManagementGroupComponent.prototype.onRowRemoved = function (e) {
309
- var _this = this;
310
- var group = e.data;
311
- this.managementGroupService.delete(group.id).subscribe(function () {
312
- _this.getGroups();
313
- });
314
- };
315
- CaucaManagementGroupComponent.prototype.onEditingStart = function (e) {
316
- this.groupUsers = e.data.users;
317
- };
318
- CaucaManagementGroupComponent.prototype.onInitNewRow = function () {
319
- this.groupUsers = [];
320
- };
321
- CaucaManagementGroupComponent.prototype.setPermissionStatus = function (field, permission, value) {
322
- var groupPermissions = field.value || [];
323
- var groupIndex = groupPermissions.findIndex(function (p) { return p.idModulePermission === permission.id; });
324
- if (groupIndex > -1) {
325
- groupPermissions[groupIndex].isAllowed = value;
326
- }
327
- else {
328
- groupPermissions.push({
329
- idModulePermission: permission.id,
330
- isAllowed: value,
331
- });
332
- }
333
- field.setValue(JSON.parse(JSON.stringify(groupPermissions)));
334
- };
335
- CaucaManagementGroupComponent.prototype.saveGroup = function (group) {
336
- var _this = this;
337
- this.removePermissionUndefined(group);
338
- if (group.users) {
339
- group.users.forEach(function (userGroup) {
340
- userGroup.idGroup = group.id;
341
- });
342
- }
343
- if (group.permissions) {
344
- group.permissions.forEach(function (groupPermission) {
345
- groupPermission.idGroup = group.id;
346
- });
347
- }
348
- this.managementGroupService.save(group).subscribe(function () {
349
- _this.getGroups();
350
- });
351
- this.groupUsers = [];
352
- };
353
- CaucaManagementGroupComponent.prototype.removePermissionUndefined = function (group) {
354
- group.permissions = group.permissions.filter(function (permission) { return permission.isAllowed !== undefined; });
355
- };
356
- CaucaManagementGroupComponent.prototype.getGroups = function () {
357
- var _this = this;
358
- this.managementGroupService.getAll().subscribe(function (data) { return _this.groups = data; });
359
- };
360
- return CaucaManagementGroupComponent;
361
- }());
362
- CaucaManagementGroupComponent.decorators = [
363
- { type: i0.Component, args: [{
364
- selector: 'cauca-management-group',
365
- template: "<cauca-dx-data-grid [allowPrint]=\"showPrintButton\" keyExpr=\"id\" [dataSource]=\"groups\"\n (onRowInserted)=\"onRowInserted($event)\" (onInitNewRow)=\"onInitNewRow()\" (onRowUpdated)=\"onRowUpdated($event)\"\n (onEditingStart)=\"onEditingStart($event)\" (onRowRemoved)=\"onRowRemoved($event)\">\n\n <dxi-column dataField=\"name\" [caption]=\"'management.name' | translate\">\n <dxi-validation-rule type=\"async\" [message]=\"'management.groupNameAlreadyUsed' | translate\"\n [validationCallback]=\"groupNameAlreadyUsedValidation\"></dxi-validation-rule>\n </dxi-column>\n <dxi-column dataField=\"users\" [caption]=\"'management.users' | translate\" editCellTemplate=\"usersEditTemplate\"\n [calculateCellValue]=\"calculateUsersCellValue\">\n </dxi-column>\n <dxi-column dataField=\"permissions\" [caption]=\"'management.permissions' | translate\" [visible]=\"false\"\n editCellTemplate=\"permissionsEditTemplate\">\n </dxi-column>\n <dxo-export [enabled]=\"false\"></dxo-export>\n <dxo-editing mode=\"popup\" [allowAdding]=\"true\" [allowUpdating]=\"true\" [allowDeleting]=\"true\" [useIcons]=\"true\">\n <dxo-popup [showTitle]=\"true\" [title]=\"'management.group' | translate\" [fullScreen]=\"!showColumn\"></dxo-popup>\n <dxo-form colCount=\"1\" [labelLocation]=\"showColumnXS ? 'left' : 'top'\">\n <dxi-item dataField=\"name\" [isRequired]=\"true\"></dxi-item>\n <dxi-item dataField=\"users\"></dxi-item>\n <dxi-item dataField=\"permissions\"></dxi-item>\n </dxo-form>\n </dxo-editing>\n\n <div *dxTemplate=\"let field of 'usersEditTemplate'\">\n <dx-tag-box valueExpr=\"id\" [displayExpr]=\"fullName\" [dataSource]=\"users\" [searchEnabled]=\"true\"\n [searchExpr]=\"fullName\" (onInitialized)=\"getGroupUser(field, $event)\"\n (onValueChanged)=\"setGroupUser(field, $event)\">\n </dx-tag-box>\n </div>\n <div *dxTemplate=\"let field of 'permissionsEditTemplate'\">\n <dx-list [dataSource]=\"permissions\" itemTemplate=\"rowTemplate\" [searchEnabled]=\"true\"\n [searchExpr]=\"['name', 'tag']\" [hoverStateEnabled]=\"hoverStatePermission\">\n <div *dxTemplate=\"let permission of 'rowTemplate'\">\n <dx-check-box [text]=\"permission.name\" (onInitialized)=\"getPermissionStatus(field, permission, $event)\"\n (onValueChanged)=\"checkBoxToggled(field, permission, $event)\">\n </dx-check-box>\n </div>\n </dx-list>\n </div>\n</cauca-dx-data-grid>",
366
- styles: [""]
367
- },] }
368
- ];
369
- CaucaManagementGroupComponent.ctorParameters = function () { return [
370
- { type: ManagementGroupService },
371
- { type: ManagementUserService },
372
- { type: ManagementPermissionService },
373
- { type: layout.BreakpointObserver }
374
- ]; };
375
- CaucaManagementGroupComponent.propDecorators = {
376
- showPrintButton: [{ type: i0.Input }],
377
- hoverStatePermission: [{ type: i0.Input }]
378
- };
165
+ function CaucaManagementGroupComponent_div_17_Template(rf, ctx) {
166
+ if (rf & 1) {
167
+ var _r4_1 = i0.ɵɵgetCurrentView();
168
+ i0.ɵɵelementStart(0, "div");
169
+ i0.ɵɵelementStart(1, "dx-tag-box", 13);
170
+ i0.ɵɵlistener("onInitialized", function CaucaManagementGroupComponent_div_17_Template_dx_tag_box_onInitialized_1_listener($event) { i0.ɵɵrestoreView(_r4_1); var field_r2 = ctx.$implicit; var ctx_r3 = i0.ɵɵnextContext(); return ctx_r3.getGroupUser(field_r2, $event); })("onValueChanged", function CaucaManagementGroupComponent_div_17_Template_dx_tag_box_onValueChanged_1_listener($event) { i0.ɵɵrestoreView(_r4_1); var field_r2 = ctx.$implicit; var ctx_r5 = i0.ɵɵnextContext(); return ctx_r5.setGroupUser(field_r2, $event); });
171
+ i0.ɵɵelementEnd();
172
+ i0.ɵɵelementEnd();
173
+ }
174
+ if (rf & 2) {
175
+ var ctx_r0 = i0.ɵɵnextContext();
176
+ i0.ɵɵadvance(1);
177
+ i0.ɵɵproperty("displayExpr", ctx_r0.fullName)("dataSource", ctx_r0.users)("searchEnabled", true)("searchExpr", ctx_r0.fullName);
178
+ }
179
+ }
180
+ function CaucaManagementGroupComponent_div_18_div_2_Template(rf, ctx) {
181
+ if (rf & 1) {
182
+ var _r11_1 = i0.ɵɵgetCurrentView();
183
+ i0.ɵɵelementStart(0, "div");
184
+ i0.ɵɵelementStart(1, "dx-check-box", 15);
185
+ i0.ɵɵlistener("onInitialized", function CaucaManagementGroupComponent_div_18_div_2_Template_dx_check_box_onInitialized_1_listener($event) { i0.ɵɵrestoreView(_r11_1); var permission_r8 = ctx.$implicit; var field_r6 = i0.ɵɵnextContext().$implicit; var ctx_r9 = i0.ɵɵnextContext(); return ctx_r9.getPermissionStatus(field_r6, permission_r8, $event); })("onValueChanged", function CaucaManagementGroupComponent_div_18_div_2_Template_dx_check_box_onValueChanged_1_listener($event) { i0.ɵɵrestoreView(_r11_1); var permission_r8 = ctx.$implicit; var field_r6 = i0.ɵɵnextContext().$implicit; var ctx_r12 = i0.ɵɵnextContext(); return ctx_r12.checkBoxToggled(field_r6, permission_r8, $event); });
186
+ i0.ɵɵelementEnd();
187
+ i0.ɵɵelementEnd();
188
+ }
189
+ if (rf & 2) {
190
+ var permission_r8 = ctx.$implicit;
191
+ i0.ɵɵadvance(1);
192
+ i0.ɵɵproperty("text", permission_r8.name);
193
+ }
194
+ }
195
+ var _c0 = function () { return ["name", "tag"]; };
196
+ function CaucaManagementGroupComponent_div_18_Template(rf, ctx) {
197
+ if (rf & 1) {
198
+ i0.ɵɵelementStart(0, "div");
199
+ i0.ɵɵelementStart(1, "dx-list", 14);
200
+ i0.ɵɵtemplate(2, CaucaManagementGroupComponent_div_18_div_2_Template, 2, 1, "div", 12);
201
+ i0.ɵɵelementEnd();
202
+ i0.ɵɵelementEnd();
203
+ }
204
+ if (rf & 2) {
205
+ var ctx_r1 = i0.ɵɵnextContext();
206
+ i0.ɵɵadvance(1);
207
+ i0.ɵɵproperty("dataSource", ctx_r1.permissions)("searchEnabled", true)("searchExpr", i0.ɵɵpureFunction0(5, _c0))("hoverStateEnabled", ctx_r1.hoverStatePermission);
208
+ i0.ɵɵadvance(1);
209
+ i0.ɵɵproperty("dxTemplateOf", "rowTemplate");
210
+ }
211
+ }
212
+ var CaucaManagementGroupComponent = /** @class */ (function () {
213
+ function CaucaManagementGroupComponent(managementGroupService, managementUserService, managementPermissionService, breakpointObserver) {
214
+ var _this = this;
215
+ this.managementGroupService = managementGroupService;
216
+ this.managementUserService = managementUserService;
217
+ this.managementPermissionService = managementPermissionService;
218
+ this.showPrintButton = true;
219
+ this.hoverStatePermission = true;
220
+ this.groups = [];
221
+ this.users = [];
222
+ this.permissions = [];
223
+ this.userFullName = {};
224
+ this.showColumn = true;
225
+ this.showColumnXS = true;
226
+ this.translations = [];
227
+ this.calculateUsersCellValue = function (e) {
228
+ var users = (e.users ? e.users : []);
229
+ var usersNames = [];
230
+ users.forEach(function (user) {
231
+ var userGroup = _this.users.filter(function (u) { return u.id === user.idUser; });
232
+ if (userGroup && userGroup[0]) {
233
+ usersNames.push(userGroup[0].firstName + ' ' + userGroup[0].lastName);
234
+ }
235
+ });
236
+ usersNames = usersNames.sort(function (one, two) { return (one < two ? -1 : 1); });
237
+ return usersNames.join(', ');
238
+ };
239
+ this.groupNameAlreadyUsedValidation = function (e) { return _this.managementGroupService.hasExistingGroupName(e.data).pipe(operators.map(function (exist) { return !exist; })).toPromise(); };
240
+ breakpointObserver.observe(['(max-width: 1000px)']).subscribe(function (result) {
241
+ _this.showColumn = !result.matches;
242
+ });
243
+ breakpointObserver.observe(['(max-width: 600px)']).subscribe(function (result) {
244
+ _this.showColumnXS = !result.matches;
245
+ });
246
+ }
247
+ CaucaManagementGroupComponent.prototype.ngOnInit = function () {
248
+ var _this = this;
249
+ this.managementUserService.getAll().subscribe(function (data) {
250
+ _this.users = data;
251
+ _this.users.forEach(function (user) {
252
+ if (user.isActive) {
253
+ if (user.firstName !== '' && user.lastName !== '') {
254
+ _this.userFullName[user.id] = user.firstName + " " + user.lastName;
255
+ }
256
+ }
257
+ });
258
+ });
259
+ this.managementPermissionService.getAll().subscribe(function (permissions) {
260
+ var permissionIndex = permissions.findIndex(function (c) { return c.tag === 'CanAccessPermissions'; });
261
+ if (permissionIndex !== -1) {
262
+ permissions.splice(permissionIndex, 1);
263
+ }
264
+ permissions.sort(function (a, b) {
265
+ if (a.name < b.name) {
266
+ return -1;
267
+ }
268
+ if (a.name > b.name) {
269
+ return 1;
270
+ }
271
+ return 0;
272
+ });
273
+ _this.permissions = permissions;
274
+ });
275
+ this.getGroups();
276
+ };
277
+ CaucaManagementGroupComponent.prototype.fullName = function (data) {
278
+ if (!data) {
279
+ return '';
280
+ }
281
+ return data.firstName + " " + data.lastName;
282
+ };
283
+ CaucaManagementGroupComponent.prototype.getGroupUser = function (field, e) {
284
+ var users = [];
285
+ if (this.groupUsers) {
286
+ this.groupUsers.forEach(function (user) {
287
+ users.push(user.idUser);
288
+ });
289
+ }
290
+ e.component.option('value', users);
291
+ };
292
+ CaucaManagementGroupComponent.prototype.setGroupUser = function (field, e) {
293
+ var groupUser = [];
294
+ e.value.forEach(function (idUser) {
295
+ var groupIndex = (field.data.users || []).findIndex(function (g) { return g.idUser === idUser; });
296
+ if (groupIndex === -1) {
297
+ groupUser.push({ idUser: idUser, });
298
+ }
299
+ else {
300
+ groupUser.push(field.data.users[groupIndex]);
301
+ }
302
+ });
303
+ field.setValue(JSON.parse(JSON.stringify(groupUser)));
304
+ };
305
+ CaucaManagementGroupComponent.prototype.setGroupPermission = function (field, e) {
306
+ var groupUser = [];
307
+ e.value.forEach(function (idUser) {
308
+ groupUser.push({
309
+ idUser: idUser,
310
+ });
311
+ });
312
+ field.setValue(JSON.parse(JSON.stringify(groupUser)));
313
+ };
314
+ CaucaManagementGroupComponent.prototype.getPermissionStatus = function (field, permission, e) {
315
+ var groupPermission = (field.value || []).find(function (p) { return p.idModulePermission === permission.id; });
316
+ if (groupPermission) {
317
+ e.component.option('value', groupPermission.isAllowed);
318
+ }
319
+ else {
320
+ e.component.option('value', undefined);
321
+ }
322
+ };
323
+ CaucaManagementGroupComponent.prototype.checkBoxToggled = function (field, permission, e) {
324
+ if (e.component.skipOnValueChanged) {
325
+ e.component.skipOnValueChanged = false;
326
+ return;
327
+ }
328
+ if (e.component.setUndefinedNextTime) {
329
+ e.component.setUndefinedNextTime = false;
330
+ e.component.skipOnValueChanged = true;
331
+ e.component.option('value', undefined);
332
+ this.setPermissionStatus(field, permission, undefined);
333
+ return;
334
+ }
335
+ if (e.value === false) {
336
+ e.component.setUndefinedNextTime = true;
337
+ }
338
+ this.setPermissionStatus(field, permission, e.value);
339
+ };
340
+ CaucaManagementGroupComponent.prototype.onRowInserted = function (e) {
341
+ this.saveGroup(e.data);
342
+ };
343
+ CaucaManagementGroupComponent.prototype.onRowUpdated = function (e) {
344
+ this.saveGroup(e.data);
345
+ };
346
+ CaucaManagementGroupComponent.prototype.onRowRemoved = function (e) {
347
+ var _this = this;
348
+ var group = e.data;
349
+ this.managementGroupService.delete(group.id).subscribe(function () {
350
+ _this.getGroups();
351
+ });
352
+ };
353
+ CaucaManagementGroupComponent.prototype.onEditingStart = function (e) {
354
+ this.groupUsers = e.data.users;
355
+ };
356
+ CaucaManagementGroupComponent.prototype.onInitNewRow = function () {
357
+ this.groupUsers = [];
358
+ };
359
+ CaucaManagementGroupComponent.prototype.setPermissionStatus = function (field, permission, value) {
360
+ var groupPermissions = field.value || [];
361
+ var groupIndex = groupPermissions.findIndex(function (p) { return p.idModulePermission === permission.id; });
362
+ if (groupIndex > -1) {
363
+ groupPermissions[groupIndex].isAllowed = value;
364
+ }
365
+ else {
366
+ groupPermissions.push({
367
+ idModulePermission: permission.id,
368
+ isAllowed: value,
369
+ });
370
+ }
371
+ field.setValue(JSON.parse(JSON.stringify(groupPermissions)));
372
+ };
373
+ CaucaManagementGroupComponent.prototype.saveGroup = function (group) {
374
+ var _this = this;
375
+ this.removePermissionUndefined(group);
376
+ if (group.users) {
377
+ group.users.forEach(function (userGroup) {
378
+ userGroup.idGroup = group.id;
379
+ });
380
+ }
381
+ if (group.permissions) {
382
+ group.permissions.forEach(function (groupPermission) {
383
+ groupPermission.idGroup = group.id;
384
+ });
385
+ }
386
+ this.managementGroupService.save(group).subscribe(function () {
387
+ _this.getGroups();
388
+ });
389
+ this.groupUsers = [];
390
+ };
391
+ CaucaManagementGroupComponent.prototype.removePermissionUndefined = function (group) {
392
+ group.permissions = group.permissions.filter(function (permission) { return permission.isAllowed !== undefined; });
393
+ };
394
+ CaucaManagementGroupComponent.prototype.getGroups = function () {
395
+ var _this = this;
396
+ this.managementGroupService.getAll().subscribe(function (data) { return _this.groups = data; });
397
+ };
398
+ return CaucaManagementGroupComponent;
399
+ }());
400
+ CaucaManagementGroupComponent.ɵfac = function CaucaManagementGroupComponent_Factory(t) { return new (t || CaucaManagementGroupComponent)(i0.ɵɵdirectiveInject(ManagementGroupService), i0.ɵɵdirectiveInject(ManagementUserService), i0.ɵɵdirectiveInject(ManagementPermissionService), i0.ɵɵdirectiveInject(i4.BreakpointObserver)); };
401
+ CaucaManagementGroupComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaucaManagementGroupComponent, selectors: [["cauca-management-group"]], inputs: { showPrintButton: "showPrintButton", hoverStatePermission: "hoverStatePermission" }, decls: 19, vars: 31, consts: [["keyExpr", "id", 3, "allowPrint", "dataSource", "onRowInserted", "onInitNewRow", "onRowUpdated", "onEditingStart", "onRowRemoved"], ["dataField", "name", 3, "caption"], ["type", "async", 3, "message", "validationCallback"], ["dataField", "users", "editCellTemplate", "usersEditTemplate", 3, "caption", "calculateCellValue"], ["dataField", "permissions", "editCellTemplate", "permissionsEditTemplate", 3, "caption", "visible"], [3, "enabled"], ["mode", "popup", 3, "allowAdding", "allowUpdating", "allowDeleting", "useIcons"], [3, "showTitle", "title", "fullScreen"], ["colCount", "1", 3, "labelLocation"], ["dataField", "name", 3, "isRequired"], ["dataField", "users"], ["dataField", "permissions"], [4, "dxTemplate", "dxTemplateOf"], ["valueExpr", "id", 3, "displayExpr", "dataSource", "searchEnabled", "searchExpr", "onInitialized", "onValueChanged"], ["itemTemplate", "rowTemplate", 3, "dataSource", "searchEnabled", "searchExpr", "hoverStateEnabled"], [3, "text", "onInitialized", "onValueChanged"]], template: function CaucaManagementGroupComponent_Template(rf, ctx) {
402
+ if (rf & 1) {
403
+ i0.ɵɵelementStart(0, "cauca-dx-data-grid", 0);
404
+ i0.ɵɵlistener("onRowInserted", function CaucaManagementGroupComponent_Template_cauca_dx_data_grid_onRowInserted_0_listener($event) { return ctx.onRowInserted($event); })("onInitNewRow", function CaucaManagementGroupComponent_Template_cauca_dx_data_grid_onInitNewRow_0_listener() { return ctx.onInitNewRow(); })("onRowUpdated", function CaucaManagementGroupComponent_Template_cauca_dx_data_grid_onRowUpdated_0_listener($event) { return ctx.onRowUpdated($event); })("onEditingStart", function CaucaManagementGroupComponent_Template_cauca_dx_data_grid_onEditingStart_0_listener($event) { return ctx.onEditingStart($event); })("onRowRemoved", function CaucaManagementGroupComponent_Template_cauca_dx_data_grid_onRowRemoved_0_listener($event) { return ctx.onRowRemoved($event); });
405
+ i0.ɵɵelementStart(1, "dxi-column", 1);
406
+ i0.ɵɵpipe(2, "translate");
407
+ i0.ɵɵelement(3, "dxi-validation-rule", 2);
408
+ i0.ɵɵpipe(4, "translate");
409
+ i0.ɵɵelementEnd();
410
+ i0.ɵɵelement(5, "dxi-column", 3);
411
+ i0.ɵɵpipe(6, "translate");
412
+ i0.ɵɵelement(7, "dxi-column", 4);
413
+ i0.ɵɵpipe(8, "translate");
414
+ i0.ɵɵelement(9, "dxo-export", 5);
415
+ i0.ɵɵelementStart(10, "dxo-editing", 6);
416
+ i0.ɵɵelement(11, "dxo-popup", 7);
417
+ i0.ɵɵpipe(12, "translate");
418
+ i0.ɵɵelementStart(13, "dxo-form", 8);
419
+ i0.ɵɵelement(14, "dxi-item", 9);
420
+ i0.ɵɵelement(15, "dxi-item", 10);
421
+ i0.ɵɵelement(16, "dxi-item", 11);
422
+ i0.ɵɵelementEnd();
423
+ i0.ɵɵelementEnd();
424
+ i0.ɵɵtemplate(17, CaucaManagementGroupComponent_div_17_Template, 2, 4, "div", 12);
425
+ i0.ɵɵtemplate(18, CaucaManagementGroupComponent_div_18_Template, 3, 6, "div", 12);
426
+ i0.ɵɵelementEnd();
427
+ }
428
+ if (rf & 2) {
429
+ i0.ɵɵproperty("allowPrint", ctx.showPrintButton)("dataSource", ctx.groups);
430
+ i0.ɵɵadvance(1);
431
+ i0.ɵɵproperty("caption", i0.ɵɵpipeBind1(2, 21, "management.name"));
432
+ i0.ɵɵadvance(2);
433
+ i0.ɵɵproperty("message", i0.ɵɵpipeBind1(4, 23, "management.groupNameAlreadyUsed"))("validationCallback", ctx.groupNameAlreadyUsedValidation);
434
+ i0.ɵɵadvance(2);
435
+ i0.ɵɵproperty("caption", i0.ɵɵpipeBind1(6, 25, "management.users"))("calculateCellValue", ctx.calculateUsersCellValue);
436
+ i0.ɵɵadvance(2);
437
+ i0.ɵɵproperty("caption", i0.ɵɵpipeBind1(8, 27, "management.permissions"))("visible", false);
438
+ i0.ɵɵadvance(2);
439
+ i0.ɵɵproperty("enabled", false);
440
+ i0.ɵɵadvance(1);
441
+ i0.ɵɵproperty("allowAdding", true)("allowUpdating", true)("allowDeleting", true)("useIcons", true);
442
+ i0.ɵɵadvance(1);
443
+ i0.ɵɵproperty("showTitle", true)("title", i0.ɵɵpipeBind1(12, 29, "management.group"))("fullScreen", !ctx.showColumn);
444
+ i0.ɵɵadvance(2);
445
+ i0.ɵɵproperty("labelLocation", ctx.showColumnXS ? "left" : "top");
446
+ i0.ɵɵadvance(1);
447
+ i0.ɵɵproperty("isRequired", true);
448
+ i0.ɵɵadvance(3);
449
+ i0.ɵɵproperty("dxTemplateOf", "usersEditTemplate");
450
+ i0.ɵɵadvance(1);
451
+ i0.ɵɵproperty("dxTemplateOf", "permissionsEditTemplate");
452
+ }
453
+ }, directives: [i5.CaucaDataGridComponent, i6.DxiColumnComponent, i6.DxiValidationRuleComponent, i6.DxoExportComponent, i6.DxoEditingComponent, i6.DxoPopupComponent, i6.DxoFormComponent, i6.DxiItemComponent, i7.DxTemplateDirective, i8.DxTagBoxComponent, i9.DxListComponent, i10.DxCheckBoxComponent], pipes: [i1.TranslatePipe], styles: [""] });
454
+ /*@__PURE__*/ (function () {
455
+ i0.ɵsetClassMetadata(CaucaManagementGroupComponent, [{
456
+ type: i0.Component,
457
+ args: [{
458
+ selector: 'cauca-management-group',
459
+ templateUrl: './cauca-management-group.component.html',
460
+ styleUrls: ['./cauca-management-group.component.scss']
461
+ }]
462
+ }], function () { return [{ type: ManagementGroupService }, { type: ManagementUserService }, { type: ManagementPermissionService }, { type: i4.BreakpointObserver }]; }, { showPrintButton: [{
463
+ type: i0.Input
464
+ }], hoverStatePermission: [{
465
+ type: i0.Input
466
+ }] });
467
+ })();
379
468
 
380
- var UserModel = /** @class */ (function () {
381
- function UserModel() {
382
- this.userName = '';
383
- this.firstName = '';
384
- this.lastName = '';
385
- this.password = '';
386
- this.email = '';
387
- this.isActive = true;
388
- }
389
- return UserModel;
469
+ var UserModel = /** @class */ (function () {
470
+ function UserModel() {
471
+ this.userName = '';
472
+ this.firstName = '';
473
+ this.lastName = '';
474
+ this.password = '';
475
+ this.email = '';
476
+ this.isActive = true;
477
+ this.twoFactorAuthenticatorEnabled = false;
478
+ }
479
+ return UserModel;
390
480
  }());
391
481
 
392
- var CaucaManagementUserComponent = /** @class */ (function () {
393
- function CaucaManagementUserComponent(managementUserService, breakpointObserver) {
394
- var _this = this;
395
- this.managementUserService = managementUserService;
396
- this.users = [
397
- new UserModel()
398
- ];
399
- this.showColumnXS = true;
400
- this.userNameAlreadyUsedValidation = function (e) {
401
- return _this.managementUserService.hasExistingUserName(e.data).pipe(operators.map(function (exist) {
402
- return !exist;
403
- })).toPromise();
404
- };
405
- breakpointObserver.observe(['(max-width: 600px)']).subscribe(function (result) {
406
- _this.showColumnXS = !result.matches;
407
- });
408
- }
409
- CaucaManagementUserComponent.prototype.ngOnInit = function () {
410
- this.getUsers();
411
- };
412
- CaucaManagementUserComponent.prototype.onRowInserted = function (e) {
413
- this.saveGroup(e.data);
414
- };
415
- CaucaManagementUserComponent.prototype.onRowUpdated = function (e) {
416
- this.saveGroup(e.key);
417
- };
418
- CaucaManagementUserComponent.prototype.onRowRemoved = function (e) {
419
- var _this = this;
420
- var user = e.data;
421
- this.managementUserService.delete(user.id).subscribe(function (data) {
422
- _this.getUsers();
423
- });
424
- };
425
- CaucaManagementUserComponent.prototype.saveGroup = function (user) {
426
- var _this = this;
427
- this.managementUserService.save(user).subscribe(function () {
428
- _this.getUsers();
429
- });
430
- };
431
- CaucaManagementUserComponent.prototype.getUsers = function () {
432
- var _this = this;
433
- this.managementUserService.getAll().subscribe(function (data) { return _this.users = data; });
434
- };
435
- return CaucaManagementUserComponent;
436
- }());
437
- CaucaManagementUserComponent.decorators = [
438
- { type: i0.Component, args: [{
439
- selector: 'cauca-management-user',
440
- template: "<cauca-dx-data-grid\n keyExpr=\"id\"\n [dataSource]=\"users\"\n (onRowInserted)=\"onRowInserted($event)\"\n (onRowUpdated)=\"onRowUpdated($event)\"\n (onRowRemoved)=\"onRowRemoved($event)\">\n\n <dxi-column dataField=\"userName\" [caption]=\"'management.userName' | translate\">\n <dxi-validation-rule type=\"async\" [message]=\"'management.userNameAlreadyUsed' | translate\" [validationCallback]=\"userNameAlreadyUsedValidation\"></dxi-validation-rule>\n </dxi-column>\n <dxi-column dataField=\"isActive\" [caption]=\"'management.isActive' | translate\" [visible]=\"false\"></dxi-column>\n <dxi-column dataField=\"firstName\" [caption]=\"'management.firstName' | translate\"></dxi-column>\n <dxi-column dataField=\"lastName\" [caption]=\"'management.lastName' | translate\"></dxi-column>\n <dxi-column dataField=\"groups\" [caption]=\"'management.group' | translate\"></dxi-column>\n\n <dxo-editing mode=\"popup\" [allowAdding]=\"true\" [allowUpdating]=\"true\" [allowDeleting]=\"true\" [useIcons]=\"true\">\n <dxo-popup [showTitle]=\"true\" [title]=\"'management.group' | translate\"></dxo-popup>\n <dxo-form colCount=\"2\" [labelLocation]=\"showColumnXS ? 'left' : 'top'\">\n <dxi-item dataField=\"userName\" [isRequired]=\"true\"></dxi-item>\n <dxi-item dataField=\"isActive\"></dxi-item>\n <dxi-item dataField=\"firstName\"></dxi-item>\n <dxi-item dataField=\"lastName\"></dxi-item>\n <dxi-item dataField=\"group\"></dxi-item>\n </dxo-form>\n </dxo-editing>\n</cauca-dx-data-grid>\n",
441
- styles: [""]
442
- },] }
443
- ];
444
- CaucaManagementUserComponent.ctorParameters = function () { return [
445
- { type: ManagementUserService },
446
- { type: layout.BreakpointObserver }
447
- ]; };
482
+ var CaucaManagementUserComponent = /** @class */ (function () {
483
+ function CaucaManagementUserComponent(managementUserService, breakpointObserver) {
484
+ var _this = this;
485
+ this.managementUserService = managementUserService;
486
+ this.users = [
487
+ new UserModel()
488
+ ];
489
+ this.showColumnXS = true;
490
+ this.userNameAlreadyUsedValidation = function (e) { return _this.managementUserService.hasExistingUserName(e.data).pipe(operators.map(function (exist) { return !exist; })).toPromise(); };
491
+ breakpointObserver.observe(['(max-width: 600px)']).subscribe(function (result) {
492
+ _this.showColumnXS = !result.matches;
493
+ });
494
+ }
495
+ CaucaManagementUserComponent.prototype.ngOnInit = function () {
496
+ this.getUsers();
497
+ };
498
+ CaucaManagementUserComponent.prototype.onRowInserted = function (e) {
499
+ this.saveGroup(e.data);
500
+ };
501
+ CaucaManagementUserComponent.prototype.onRowUpdated = function (e) {
502
+ this.saveGroup(e.key);
503
+ };
504
+ CaucaManagementUserComponent.prototype.onRowRemoved = function (e) {
505
+ var _this = this;
506
+ var user = e.data;
507
+ this.managementUserService.delete(user.id).subscribe(function (data) {
508
+ _this.getUsers();
509
+ });
510
+ };
511
+ CaucaManagementUserComponent.prototype.saveGroup = function (user) {
512
+ var _this = this;
513
+ this.managementUserService.save(user).subscribe(function () {
514
+ _this.getUsers();
515
+ });
516
+ };
517
+ CaucaManagementUserComponent.prototype.getUsers = function () {
518
+ var _this = this;
519
+ this.managementUserService.getAll().subscribe(function (data) { return _this.users = data; });
520
+ };
521
+ return CaucaManagementUserComponent;
522
+ }());
523
+ CaucaManagementUserComponent.ɵfac = function CaucaManagementUserComponent_Factory(t) { return new (t || CaucaManagementUserComponent)(i0.ɵɵdirectiveInject(ManagementUserService), i0.ɵɵdirectiveInject(i4.BreakpointObserver)); };
524
+ CaucaManagementUserComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaucaManagementUserComponent, selectors: [["cauca-management-user"]], decls: 22, vars: 31, consts: [["keyExpr", "id", 3, "dataSource", "onRowInserted", "onRowUpdated", "onRowRemoved"], ["dataField", "userName", 3, "caption"], ["type", "async", 3, "message", "validationCallback"], ["dataField", "isActive", 3, "caption", "visible"], ["dataField", "firstName", 3, "caption"], ["dataField", "lastName", 3, "caption"], ["dataField", "groups", 3, "caption"], ["mode", "popup", 3, "allowAdding", "allowUpdating", "allowDeleting", "useIcons"], [3, "showTitle", "title"], ["colCount", "2", 3, "labelLocation"], ["dataField", "userName", 3, "isRequired"], ["dataField", "isActive"], ["dataField", "firstName"], ["dataField", "lastName"], ["dataField", "group"]], template: function CaucaManagementUserComponent_Template(rf, ctx) {
525
+ if (rf & 1) {
526
+ i0.ɵɵelementStart(0, "cauca-dx-data-grid", 0);
527
+ i0.ɵɵlistener("onRowInserted", function CaucaManagementUserComponent_Template_cauca_dx_data_grid_onRowInserted_0_listener($event) { return ctx.onRowInserted($event); })("onRowUpdated", function CaucaManagementUserComponent_Template_cauca_dx_data_grid_onRowUpdated_0_listener($event) { return ctx.onRowUpdated($event); })("onRowRemoved", function CaucaManagementUserComponent_Template_cauca_dx_data_grid_onRowRemoved_0_listener($event) { return ctx.onRowRemoved($event); });
528
+ i0.ɵɵelementStart(1, "dxi-column", 1);
529
+ i0.ɵɵpipe(2, "translate");
530
+ i0.ɵɵelement(3, "dxi-validation-rule", 2);
531
+ i0.ɵɵpipe(4, "translate");
532
+ i0.ɵɵelementEnd();
533
+ i0.ɵɵelement(5, "dxi-column", 3);
534
+ i0.ɵɵpipe(6, "translate");
535
+ i0.ɵɵelement(7, "dxi-column", 4);
536
+ i0.ɵɵpipe(8, "translate");
537
+ i0.ɵɵelement(9, "dxi-column", 5);
538
+ i0.ɵɵpipe(10, "translate");
539
+ i0.ɵɵelement(11, "dxi-column", 6);
540
+ i0.ɵɵpipe(12, "translate");
541
+ i0.ɵɵelementStart(13, "dxo-editing", 7);
542
+ i0.ɵɵelement(14, "dxo-popup", 8);
543
+ i0.ɵɵpipe(15, "translate");
544
+ i0.ɵɵelementStart(16, "dxo-form", 9);
545
+ i0.ɵɵelement(17, "dxi-item", 10);
546
+ i0.ɵɵelement(18, "dxi-item", 11);
547
+ i0.ɵɵelement(19, "dxi-item", 12);
548
+ i0.ɵɵelement(20, "dxi-item", 13);
549
+ i0.ɵɵelement(21, "dxi-item", 14);
550
+ i0.ɵɵelementEnd();
551
+ i0.ɵɵelementEnd();
552
+ i0.ɵɵelementEnd();
553
+ }
554
+ if (rf & 2) {
555
+ i0.ɵɵproperty("dataSource", ctx.users);
556
+ i0.ɵɵadvance(1);
557
+ i0.ɵɵproperty("caption", i0.ɵɵpipeBind1(2, 17, "management.userName"));
558
+ i0.ɵɵadvance(2);
559
+ i0.ɵɵproperty("message", i0.ɵɵpipeBind1(4, 19, "management.userNameAlreadyUsed"))("validationCallback", ctx.userNameAlreadyUsedValidation);
560
+ i0.ɵɵadvance(2);
561
+ i0.ɵɵproperty("caption", i0.ɵɵpipeBind1(6, 21, "management.isActive"))("visible", false);
562
+ i0.ɵɵadvance(2);
563
+ i0.ɵɵproperty("caption", i0.ɵɵpipeBind1(8, 23, "management.firstName"));
564
+ i0.ɵɵadvance(2);
565
+ i0.ɵɵproperty("caption", i0.ɵɵpipeBind1(10, 25, "management.lastName"));
566
+ i0.ɵɵadvance(2);
567
+ i0.ɵɵproperty("caption", i0.ɵɵpipeBind1(12, 27, "management.group"));
568
+ i0.ɵɵadvance(2);
569
+ i0.ɵɵproperty("allowAdding", true)("allowUpdating", true)("allowDeleting", true)("useIcons", true);
570
+ i0.ɵɵadvance(1);
571
+ i0.ɵɵproperty("showTitle", true)("title", i0.ɵɵpipeBind1(15, 29, "management.group"));
572
+ i0.ɵɵadvance(2);
573
+ i0.ɵɵproperty("labelLocation", ctx.showColumnXS ? "left" : "top");
574
+ i0.ɵɵadvance(1);
575
+ i0.ɵɵproperty("isRequired", true);
576
+ }
577
+ }, directives: [i5.CaucaDataGridComponent, i6.DxiColumnComponent, i6.DxiValidationRuleComponent, i6.DxoEditingComponent, i6.DxoPopupComponent, i6.DxoFormComponent, i6.DxiItemComponent], pipes: [i1.TranslatePipe], styles: [""] });
578
+ /*@__PURE__*/ (function () {
579
+ i0.ɵsetClassMetadata(CaucaManagementUserComponent, [{
580
+ type: i0.Component,
581
+ args: [{
582
+ selector: 'cauca-management-user',
583
+ templateUrl: './cauca-management-user.component.html',
584
+ styleUrls: ['./cauca-management-user.component.scss']
585
+ }]
586
+ }], function () { return [{ type: ManagementUserService }, { type: i4.BreakpointObserver }]; }, null);
587
+ })();
448
588
 
449
- var CaucaManagementModule = /** @class */ (function () {
450
- function CaucaManagementModule() {
451
- }
452
- return CaucaManagementModule;
453
- }());
454
- CaucaManagementModule.decorators = [
455
- { type: i0.NgModule, args: [{
456
- declarations: [
457
- CaucaManagementComponent,
458
- CaucaManagementGroupComponent,
459
- CaucaManagementUserComponent
460
- ],
461
- imports: [
462
- common.CommonModule,
463
- checkBox.DxCheckBoxModule,
464
- list.DxListModule,
465
- tagBox.DxTagBoxModule,
466
- i1.CaucaCoreForChildModule,
467
- devextreme.CaucaDevextremeModule,
468
- ],
469
- exports: [
470
- CaucaManagementComponent,
471
- CaucaManagementUserComponent,
472
- CaucaManagementGroupComponent,
473
- ]
474
- },] }
475
- ];
589
+ var CaucaManagementModule = /** @class */ (function () {
590
+ function CaucaManagementModule() {
591
+ }
592
+ return CaucaManagementModule;
593
+ }());
594
+ CaucaManagementModule.ɵmod = i0.ɵɵdefineNgModule({ type: CaucaManagementModule });
595
+ CaucaManagementModule.ɵinj = i0.ɵɵdefineInjector({ factory: function CaucaManagementModule_Factory(t) { return new (t || CaucaManagementModule)(); }, imports: [[
596
+ common.CommonModule,
597
+ i10.DxCheckBoxModule,
598
+ i9.DxListModule,
599
+ i8.DxTagBoxModule,
600
+ i1$1.CaucaCoreForChildModule,
601
+ i5.CaucaDevextremeModule,
602
+ ]] });
603
+ (function () {
604
+ (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CaucaManagementModule, { declarations: [CaucaManagementComponent,
605
+ CaucaManagementGroupComponent,
606
+ CaucaManagementUserComponent], imports: [common.CommonModule,
607
+ i10.DxCheckBoxModule,
608
+ i9.DxListModule,
609
+ i8.DxTagBoxModule,
610
+ i1$1.CaucaCoreForChildModule,
611
+ i5.CaucaDevextremeModule], exports: [CaucaManagementComponent,
612
+ CaucaManagementUserComponent,
613
+ CaucaManagementGroupComponent] });
614
+ })();
615
+ /*@__PURE__*/ (function () {
616
+ i0.ɵsetClassMetadata(CaucaManagementModule, [{
617
+ type: i0.NgModule,
618
+ args: [{
619
+ declarations: [
620
+ CaucaManagementComponent,
621
+ CaucaManagementGroupComponent,
622
+ CaucaManagementUserComponent
623
+ ],
624
+ imports: [
625
+ common.CommonModule,
626
+ i10.DxCheckBoxModule,
627
+ i9.DxListModule,
628
+ i8.DxTagBoxModule,
629
+ i1$1.CaucaCoreForChildModule,
630
+ i5.CaucaDevextremeModule,
631
+ ],
632
+ exports: [
633
+ CaucaManagementComponent,
634
+ CaucaManagementUserComponent,
635
+ CaucaManagementGroupComponent,
636
+ ]
637
+ }]
638
+ }], null, null);
639
+ })();
476
640
 
477
- var UserGroupModel = /** @class */ (function () {
478
- function UserGroupModel() {
479
- this.idUserGroup = '';
480
- this.idGroup = '';
481
- this.idUser = '';
482
- }
483
- return UserGroupModel;
641
+ var UserGroupModel = /** @class */ (function () {
642
+ function UserGroupModel() {
643
+ this.idUserGroup = '';
644
+ this.idGroup = '';
645
+ this.idUser = '';
646
+ }
647
+ return UserGroupModel;
484
648
  }());
485
649
 
486
- var UserPermissionModel = /** @class */ (function () {
487
- function UserPermissionModel() {
488
- this.idUserPermission = '';
489
- this.isAllowed = false;
490
- this.idUser = '';
491
- this.idModulePermission = '';
492
- }
493
- return UserPermissionModel;
650
+ var UserPermissionModel = /** @class */ (function () {
651
+ function UserPermissionModel() {
652
+ this.idUserPermission = '';
653
+ this.isAllowed = false;
654
+ this.idUser = '';
655
+ this.idModulePermission = '';
656
+ }
657
+ return UserPermissionModel;
494
658
  }());
495
659
 
496
- var GroupModel = /** @class */ (function () {
497
- function GroupModel() {
498
- this.name = '';
499
- this.users = [];
500
- this.permissions = [];
501
- }
502
- return GroupModel;
660
+ var GroupModel = /** @class */ (function () {
661
+ function GroupModel() {
662
+ this.name = '';
663
+ this.users = [];
664
+ this.permissions = [];
665
+ }
666
+ return GroupModel;
503
667
  }());
504
668
 
505
- var GroupPermissionModel = /** @class */ (function () {
506
- function GroupPermissionModel() {
507
- this.idGroupPermission = '';
508
- this.isAllowed = false;
509
- this.idGroup = '';
510
- this.idModulePermission = '';
511
- }
512
- return GroupPermissionModel;
669
+ var GroupPermissionModel = /** @class */ (function () {
670
+ function GroupPermissionModel() {
671
+ this.idGroupPermission = '';
672
+ this.isAllowed = false;
673
+ this.idGroup = '';
674
+ this.idModulePermission = '';
675
+ }
676
+ return GroupPermissionModel;
513
677
  }());
514
678
 
515
- /*
516
- * Public API Surface of cauca-management
679
+ /*
680
+ * Public API Surface of cauca-management
517
681
  */
518
682
 
519
- /**
520
- * Generated bundle index. Do not edit.
683
+ /**
684
+ * Generated bundle index. Do not edit.
521
685
  */
522
686
 
523
687
  exports.CaucaManagementComponent = CaucaManagementComponent;
@@ -532,9 +696,8 @@
532
696
  exports.UserGroupModel = UserGroupModel;
533
697
  exports.UserModel = UserModel;
534
698
  exports.UserPermissionModel = UserPermissionModel;
535
- exports["ɵa"] = ManagementPermissionService;
536
699
 
537
700
  Object.defineProperty(exports, '__esModule', { value: true });
538
701
 
539
- }));
702
+ })));
540
703
  //# sourceMappingURL=cauca-911-management.umd.js.map