@cauca-911/management 13.0.1 → 13.0.4

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 (55) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +4 -4
  3. package/assets/i18n/cauca/en-management.json +17 -16
  4. package/assets/i18n/cauca/es-management.json +17 -0
  5. package/assets/i18n/cauca/fr-management.json +17 -16
  6. package/{esm2015/cauca-911-management.js → esm2020/cauca-911-management.mjs} +1 -1
  7. package/esm2020/lib/cauca-management-group/cauca-management-group.component.mjs +289 -0
  8. package/esm2020/lib/cauca-management-user/cauca-management-user.component.mjs +96 -0
  9. package/esm2020/lib/cauca-management.component.mjs +23 -0
  10. package/esm2020/lib/cauca-management.module.mjs +57 -0
  11. package/esm2020/lib/cauca-management.service.mjs +14 -0
  12. package/esm2020/lib/shared/models/group-model.mjs +8 -0
  13. package/esm2020/lib/shared/models/group-permission-model.mjs +9 -0
  14. package/esm2020/lib/shared/models/permission-model.mjs +8 -0
  15. package/esm2020/lib/shared/models/user-group-model.mjs +8 -0
  16. package/esm2020/lib/shared/models/user-model.mjs +12 -0
  17. package/esm2020/lib/shared/models/user-permission-model.mjs +9 -0
  18. package/esm2020/lib/shared/services/management-group.service.mjs +34 -0
  19. package/esm2020/lib/shared/services/management-permission.service.mjs +31 -0
  20. package/esm2020/lib/shared/services/management-user.service.mjs +49 -0
  21. package/{esm2015/public-api.js → esm2020/public-api.mjs} +1 -1
  22. package/fesm2015/cauca-911-management.mjs +654 -0
  23. package/fesm2015/cauca-911-management.mjs.map +1 -0
  24. package/fesm2020/cauca-911-management.mjs +618 -0
  25. package/fesm2020/cauca-911-management.mjs.map +1 -0
  26. package/lib/cauca-management-group/cauca-management-group.component.d.ts +2 -2
  27. package/lib/cauca-management-user/cauca-management-user.component.d.ts +2 -2
  28. package/lib/cauca-management.component.d.ts +2 -2
  29. package/lib/cauca-management.module.d.ts +3 -2
  30. package/lib/cauca-management.service.d.ts +2 -2
  31. package/lib/shared/models/group-model.d.ts +1 -0
  32. package/lib/shared/services/management-group.service.d.ts +2 -2
  33. package/lib/shared/services/management-permission.service.d.ts +2 -2
  34. package/lib/shared/services/management-user.service.d.ts +2 -2
  35. package/package.json +21 -8
  36. package/bundles/cauca-911-management.umd.js +0 -703
  37. package/bundles/cauca-911-management.umd.js.map +0 -1
  38. package/bundles/cauca-911-management.umd.min.js +0 -2
  39. package/bundles/cauca-911-management.umd.min.js.map +0 -1
  40. package/esm2015/lib/cauca-management-group/cauca-management-group.component.js +0 -298
  41. package/esm2015/lib/cauca-management-user/cauca-management-user.component.js +0 -106
  42. package/esm2015/lib/cauca-management.component.js +0 -27
  43. package/esm2015/lib/cauca-management.module.js +0 -56
  44. package/esm2015/lib/cauca-management.service.js +0 -14
  45. package/esm2015/lib/shared/models/group-model.js +0 -8
  46. package/esm2015/lib/shared/models/group-permission-model.js +0 -9
  47. package/esm2015/lib/shared/models/permission-model.js +0 -8
  48. package/esm2015/lib/shared/models/user-group-model.js +0 -8
  49. package/esm2015/lib/shared/models/user-model.js +0 -12
  50. package/esm2015/lib/shared/models/user-permission-model.js +0 -9
  51. package/esm2015/lib/shared/services/management-group.service.js +0 -34
  52. package/esm2015/lib/shared/services/management-permission.service.js +0 -31
  53. package/esm2015/lib/shared/services/management-user.service.js +0 -49
  54. package/fesm2015/cauca-911-management.js +0 -634
  55. package/fesm2015/cauca-911-management.js.map +0 -1
@@ -1,703 +0,0 @@
1
- (function (global, factory) {
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
-
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
- })();
22
-
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
- })();
53
-
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
- })();
86
-
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
- })();
134
-
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
- })();
164
-
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
- })();
468
-
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;
480
- }());
481
-
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
- })();
588
-
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
- })();
640
-
641
- var UserGroupModel = /** @class */ (function () {
642
- function UserGroupModel() {
643
- this.idUserGroup = '';
644
- this.idGroup = '';
645
- this.idUser = '';
646
- }
647
- return UserGroupModel;
648
- }());
649
-
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;
658
- }());
659
-
660
- var GroupModel = /** @class */ (function () {
661
- function GroupModel() {
662
- this.name = '';
663
- this.users = [];
664
- this.permissions = [];
665
- }
666
- return GroupModel;
667
- }());
668
-
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;
677
- }());
678
-
679
- /*
680
- * Public API Surface of cauca-management
681
- */
682
-
683
- /**
684
- * Generated bundle index. Do not edit.
685
- */
686
-
687
- exports.CaucaManagementComponent = CaucaManagementComponent;
688
- exports.CaucaManagementGroupComponent = CaucaManagementGroupComponent;
689
- exports.CaucaManagementModule = CaucaManagementModule;
690
- exports.CaucaManagementService = CaucaManagementService;
691
- exports.CaucaManagementUserComponent = CaucaManagementUserComponent;
692
- exports.GroupModel = GroupModel;
693
- exports.GroupPermissionModel = GroupPermissionModel;
694
- exports.ManagementGroupService = ManagementGroupService;
695
- exports.ManagementUserService = ManagementUserService;
696
- exports.UserGroupModel = UserGroupModel;
697
- exports.UserModel = UserModel;
698
- exports.UserPermissionModel = UserPermissionModel;
699
-
700
- Object.defineProperty(exports, '__esModule', { value: true });
701
-
702
- })));
703
- //# sourceMappingURL=cauca-911-management.umd.js.map