@masterteam/users-groups 0.0.39 → 0.0.41

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.
@@ -5,26 +5,44 @@ import { Breadcrumb } from '@masterteam/components/breadcrumb';
5
5
  import { CrudStateBase, REQUEST_CONTEXT, handleApiRequest, UserSearchFieldConfig, ValidatorConfig, UploadFileFieldConfig, TextareaFieldConfig } from '@masterteam/components';
6
6
  import { Action, Selector, State, Store, select } from '@ngxs/store';
7
7
  import { HttpClient, HttpContext } from '@angular/common/http';
8
+ import { of, from, concatMap, map, toArray, catchError, finalize } from 'rxjs';
8
9
  import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';
9
10
  import { TranslocoService, TranslocoDirective, TranslocoPipe } from '@jsverse/transloco';
10
11
  import { Page } from '@masterteam/components/page';
11
12
  import { Button } from '@masterteam/components/button';
12
13
  import { Table } from '@masterteam/components/table';
14
+ import { TruncateTooltip } from '@masterteam/components/tooltip';
13
15
  import * as i1 from 'primeng/skeleton';
14
16
  import { SkeletonModule } from 'primeng/skeleton';
15
17
  import { Icon } from '@masterteam/icons';
16
18
  import { ModalService } from '@masterteam/components/modal';
17
19
  import { toSignal } from '@angular/core/rxjs-interop';
18
- import * as i2 from '@angular/forms';
20
+ import * as i1$1 from '@angular/forms';
19
21
  import { FormControl, ReactiveFormsModule } from '@angular/forms';
20
22
  import { DynamicForm } from '@masterteam/forms/dynamic-form';
21
23
  import { ModalRef, DialogService } from '@masterteam/components/dialog';
22
24
  import { Tabs } from '@masterteam/components/tabs';
23
- import { finalize } from 'rxjs';
25
+ import { ToastService } from '@masterteam/components/toast';
24
26
  import { Avatar } from '@masterteam/components/avatar';
27
+ import { EmptyState } from '@masterteam/components/empty-state';
28
+ import { TextField } from '@masterteam/components/text-field';
25
29
  import { Tree } from '@masterteam/components/tree';
26
30
  import { SecureImagePipe } from '@masterteam/components/upload-field';
27
31
 
32
+ class GetUserLockStatuses {
33
+ userIds;
34
+ static type = '[UsersGroups] Get User Lock Statuses';
35
+ constructor(userIds) {
36
+ this.userIds = userIds;
37
+ }
38
+ }
39
+ class UnlockUser {
40
+ userId;
41
+ static type = '[UsersGroups] Unlock User';
42
+ constructor(userId) {
43
+ this.userId = userId;
44
+ }
45
+ }
28
46
  class GetUsers {
29
47
  static type = '[UsersGroups] Get Users';
30
48
  }
@@ -79,6 +97,13 @@ class GetUserSummary {
79
97
  this.userName = userName;
80
98
  }
81
99
  }
100
+ class GetGroupSummary {
101
+ groupId;
102
+ static type = '[UsersGroups] Get Group Summary';
103
+ constructor(groupId) {
104
+ this.groupId = groupId;
105
+ }
106
+ }
82
107
  class ResetUserPassword {
83
108
  id;
84
109
  payload;
@@ -135,12 +160,15 @@ class DeleteGroup {
135
160
  var UsersGroupsActionKey;
136
161
  (function (UsersGroupsActionKey) {
137
162
  UsersGroupsActionKey["GetUsers"] = "getUsers";
163
+ UsersGroupsActionKey["GetUserLockStatuses"] = "getUserLockStatuses";
164
+ UsersGroupsActionKey["UnlockUser"] = "unlockUser";
138
165
  UsersGroupsActionKey["GetUser"] = "getUser";
139
166
  UsersGroupsActionKey["CreateUser"] = "createUser";
140
167
  UsersGroupsActionKey["UpdateUser"] = "updateUser";
141
168
  UsersGroupsActionKey["DeleteUser"] = "deleteUser";
142
169
  UsersGroupsActionKey["LinkUserToApplication"] = "linkUserToApplication";
143
170
  UsersGroupsActionKey["GetUserSummary"] = "getUserSummary";
171
+ UsersGroupsActionKey["GetGroupSummary"] = "getGroupSummary";
144
172
  UsersGroupsActionKey["AddUserToGroup"] = "addUserToGroup";
145
173
  UsersGroupsActionKey["DeleteUserFromGroup"] = "deleteUserFromGroup";
146
174
  UsersGroupsActionKey["GetGroups"] = "getGroups";
@@ -168,6 +196,12 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
168
196
  // ============================================================================
169
197
  // Data Selectors - Individual selectors for fine-grained reactivity
170
198
  // ============================================================================
199
+ static unlockableUserIds(state) {
200
+ return state.unlockableUserIds;
201
+ }
202
+ static unlockResponses(state) {
203
+ return state.unlockResponses;
204
+ }
171
205
  static getUsers(state) {
172
206
  return state.users;
173
207
  }
@@ -177,6 +211,9 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
177
211
  static getUserSummary(state) {
178
212
  return state.userSummary;
179
213
  }
214
+ static getGroupSummary(state) {
215
+ return state.groupSummary;
216
+ }
180
217
  static getGroups(state) {
181
218
  return state.groups;
182
219
  }
@@ -195,7 +232,52 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
195
232
  // ============================================================================
196
233
  // CRUD Actions
197
234
  // ============================================================================
235
+ getUserLockStatuses(ctx, { userIds }) {
236
+ ctx.patchState({ unlockableUserIds: [] });
237
+ const ids = [...new Set(userIds.filter(Boolean))];
238
+ if (!ids.length)
239
+ return of(undefined);
240
+ const batches = [];
241
+ for (let start = 0; start < ids.length; start += 200)
242
+ batches.push(ids.slice(start, start + 200));
243
+ return handleApiRequest({
244
+ ctx,
245
+ key: UsersGroupsActionKey.GetUserLockStatuses,
246
+ request$: from(batches).pipe(concatMap((batch) => this.http.post('identity/users/lock-status', { userIds: batch }, {
247
+ context: this.context,
248
+ headers: { noMessage: 'true' },
249
+ })), map((response) => response.data), toArray()),
250
+ onSuccess: (batches) => ({
251
+ unlockableUserIds: batches
252
+ .flat()
253
+ .filter((status) => status.isLocked && status.canUnlock)
254
+ .map((status) => status.userId),
255
+ }),
256
+ }).pipe(catchError(() => of(undefined))); // Unknown/denied status keeps the action hidden.
257
+ }
258
+ unlockUser(ctx, { userId }) {
259
+ // Gateway authorizes with the current application's token. The shared
260
+ // gateway-auth interceptor routes this endpoint independently of token scope.
261
+ // Drop only this user's previous result: another row's unlock may be in flight.
262
+ const { [userId]: _previous, ...unlockResponses } = ctx.getState().unlockResponses;
263
+ ctx.patchState({ unlockResponses });
264
+ return handleApiRequest({
265
+ ctx,
266
+ key: UsersGroupsActionKey.UnlockUser,
267
+ request$: this.http.post(`identity/users/${encodeURIComponent(userId)}/unlock`, null, { context: this.context, headers: { noMessage: 'true' } }),
268
+ onSuccess: (response) => ({
269
+ unlockResponses: {
270
+ ...ctx.getState().unlockResponses,
271
+ [userId]: response.data,
272
+ },
273
+ unlockableUserIds: ctx
274
+ .getState()
275
+ .unlockableUserIds.filter((id) => id !== userId),
276
+ }),
277
+ });
278
+ }
198
279
  getUsers(ctx) {
280
+ ctx.dispatch(new GetUserLockStatuses([]));
199
281
  const req$ = this.http.get('Identity/users', {
200
282
  context: this.context,
201
283
  });
@@ -203,9 +285,11 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
203
285
  ctx,
204
286
  key: UsersGroupsActionKey.GetUsers,
205
287
  request$: req$,
206
- onSuccess: (response) => ({
207
- users: response.data ?? [],
208
- }),
288
+ onSuccess: (response) => {
289
+ const users = response.data ?? [];
290
+ ctx.dispatch(new GetUserLockStatuses(users.map((user) => user.id)));
291
+ return { users };
292
+ },
209
293
  });
210
294
  }
211
295
  getUser(ctx, { userName }) {
@@ -326,6 +410,9 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
326
410
  getUserSummary(ctx, { userName }) {
327
411
  const encodedUserName = this.encodeUserName(userName);
328
412
  const req$ = this.http.get(`identity/users/${encodedUserName}/summary`, { context: this.context });
413
+ // Drop the previous user's summary first: if this request fails, the
414
+ // drawer must show the error, not someone else's access.
415
+ ctx.patchState({ userSummary: null });
329
416
  return handleApiRequest({
330
417
  ctx,
331
418
  key: UsersGroupsActionKey.GetUserSummary,
@@ -335,6 +422,19 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
335
422
  }),
336
423
  });
337
424
  }
425
+ getGroupSummary(ctx, { groupId }) {
426
+ const req$ = this.http.get(`identity/groups/${encodeURIComponent(String(groupId))}/summary`, { context: this.context });
427
+ // Same as the user summary: never leave another group's details on screen.
428
+ ctx.patchState({ groupSummary: null });
429
+ return handleApiRequest({
430
+ ctx,
431
+ key: UsersGroupsActionKey.GetGroupSummary,
432
+ request$: req$,
433
+ onSuccess: (response) => ({
434
+ groupSummary: response.data ?? null,
435
+ }),
436
+ });
437
+ }
338
438
  resetUserPassword(ctx, { id, payload }) {
339
439
  const encodedUserName = this.encodeUserName(id);
340
440
  const req$ = this.http.put(`Identity/users/${encodedUserName}/password/reset`, payload, {
@@ -441,6 +541,12 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
441
541
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UsersGroupsState, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
442
542
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UsersGroupsState });
443
543
  };
544
+ __decorate([
545
+ Action(GetUserLockStatuses, { cancelUncompleted: true })
546
+ ], UsersGroupsState.prototype, "getUserLockStatuses", null);
547
+ __decorate([
548
+ Action(UnlockUser)
549
+ ], UsersGroupsState.prototype, "unlockUser", null);
444
550
  __decorate([
445
551
  Action(GetUsers)
446
552
  ], UsersGroupsState.prototype, "getUsers", null);
@@ -465,6 +571,9 @@ __decorate([
465
571
  __decorate([
466
572
  Action(GetUserSummary)
467
573
  ], UsersGroupsState.prototype, "getUserSummary", null);
574
+ __decorate([
575
+ Action(GetGroupSummary)
576
+ ], UsersGroupsState.prototype, "getGroupSummary", null);
468
577
  __decorate([
469
578
  Action(ResetUserPassword)
470
579
  ], UsersGroupsState.prototype, "resetUserPassword", null);
@@ -489,6 +598,12 @@ __decorate([
489
598
  __decorate([
490
599
  Action(ClearSelectedGroup)
491
600
  ], UsersGroupsState.prototype, "clearSelectedGroup", null);
601
+ __decorate([
602
+ Selector()
603
+ ], UsersGroupsState, "unlockableUserIds", null);
604
+ __decorate([
605
+ Selector()
606
+ ], UsersGroupsState, "unlockResponses", null);
492
607
  __decorate([
493
608
  Selector()
494
609
  ], UsersGroupsState, "getUsers", null);
@@ -498,6 +613,9 @@ __decorate([
498
613
  __decorate([
499
614
  Selector()
500
615
  ], UsersGroupsState, "getUserSummary", null);
616
+ __decorate([
617
+ Selector()
618
+ ], UsersGroupsState, "getGroupSummary", null);
501
619
  __decorate([
502
620
  Selector()
503
621
  ], UsersGroupsState, "getGroups", null);
@@ -515,8 +633,11 @@ UsersGroupsState = __decorate([
515
633
  name: 'usersGroups',
516
634
  defaults: {
517
635
  users: [],
636
+ unlockableUserIds: [],
637
+ unlockResponses: {},
518
638
  selectedUser: null,
519
639
  userSummary: null,
640
+ groupSummary: null,
520
641
  groups: [],
521
642
  selectedGroup: null,
522
643
  loadingActive: [],
@@ -526,22 +647,26 @@ UsersGroupsState = __decorate([
526
647
  ], UsersGroupsState);
527
648
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UsersGroupsState, decorators: [{
528
649
  type: Injectable
529
- }], propDecorators: { getUsers: [], getUser: [], createUser: [], addUserToGroup: [], updateUser: [], deleteUser: [], linkUserToApplication: [], getUserSummary: [], resetUserPassword: [], deleteUserFromGroup: [], getGroups: [], getGroup: [], createGroup: [], updateGroup: [], deleteGroup: [], clearSelectedGroup: [] } });
650
+ }], propDecorators: { getUserLockStatuses: [], unlockUser: [], getUsers: [], getUser: [], createUser: [], addUserToGroup: [], updateUser: [], deleteUser: [], linkUserToApplication: [], getUserSummary: [], getGroupSummary: [], resetUserPassword: [], deleteUserFromGroup: [], getGroups: [], getGroup: [], createGroup: [], updateGroup: [], deleteGroup: [], clearSelectedGroup: [] } });
530
651
 
531
652
  class UsersGroupsFacade {
532
653
  store = inject(Store);
533
654
  // ============================================================================
534
655
  // Data Selectors - Memoized by NGXS (fine-grained reactivity)
535
656
  // ============================================================================
657
+ unlockableUserIds = select(UsersGroupsState.unlockableUserIds);
658
+ unlockResponses = select(UsersGroupsState.unlockResponses);
536
659
  users = select(UsersGroupsState.getUsers);
537
660
  selectedUser = select(UsersGroupsState.getSelectedUser);
538
661
  userSummary = select(UsersGroupsState.getUserSummary);
662
+ groupSummary = select(UsersGroupsState.getGroupSummary);
539
663
  groups = select(UsersGroupsState.getGroups);
540
664
  selectedGroup = select(UsersGroupsState.getSelectedGroup);
541
665
  // ============================================================================
542
666
  // Loading/Error Slices - Memoized by NGXS
543
667
  // ============================================================================
544
668
  loadingActive = select(UsersGroupsState.getLoadingActive);
669
+ errors = select(UsersGroupsState.getErrors);
545
670
  // ============================================================================
546
671
  // Loading Signals - Computed from slice (minimal reactivity)
547
672
  // ============================================================================
@@ -552,6 +677,9 @@ class UsersGroupsFacade {
552
677
  isDeletingUser = computed(() => this.loadingActive().includes(UsersGroupsActionKey.DeleteUser), ...(ngDevMode ? [{ debugName: "isDeletingUser" }] : /* istanbul ignore next */ []));
553
678
  isLinkingUserToApplication = computed(() => this.loadingActive().includes(UsersGroupsActionKey.LinkUserToApplication), ...(ngDevMode ? [{ debugName: "isLinkingUserToApplication" }] : /* istanbul ignore next */ []));
554
679
  isLoadingUserSummary = computed(() => this.loadingActive().includes(UsersGroupsActionKey.GetUserSummary), ...(ngDevMode ? [{ debugName: "isLoadingUserSummary" }] : /* istanbul ignore next */ []));
680
+ userSummaryError = computed(() => this.errors()[UsersGroupsActionKey.GetUserSummary] ?? null, ...(ngDevMode ? [{ debugName: "userSummaryError" }] : /* istanbul ignore next */ []));
681
+ isLoadingGroupSummary = computed(() => this.loadingActive().includes(UsersGroupsActionKey.GetGroupSummary), ...(ngDevMode ? [{ debugName: "isLoadingGroupSummary" }] : /* istanbul ignore next */ []));
682
+ groupSummaryError = computed(() => this.errors()[UsersGroupsActionKey.GetGroupSummary] ?? null, ...(ngDevMode ? [{ debugName: "groupSummaryError" }] : /* istanbul ignore next */ []));
555
683
  isLoadingGroups = computed(() => this.loadingActive().includes(UsersGroupsActionKey.GetGroups), ...(ngDevMode ? [{ debugName: "isLoadingGroups" }] : /* istanbul ignore next */ []));
556
684
  isLoadingGroup = computed(() => this.loadingActive().includes(UsersGroupsActionKey.GetGroup), ...(ngDevMode ? [{ debugName: "isLoadingGroup" }] : /* istanbul ignore next */ []));
557
685
  isSavingGroup = computed(() => this.loadingActive().includes(UsersGroupsActionKey.CreateGroup) ||
@@ -563,6 +691,9 @@ class UsersGroupsFacade {
563
691
  // ============================================================================
564
692
  // Action Dispatchers
565
693
  // ============================================================================
694
+ unlockUser(userId) {
695
+ return this.store.dispatch(new UnlockUser(userId));
696
+ }
566
697
  getUsers() {
567
698
  return this.store.dispatch(new GetUsers());
568
699
  }
@@ -590,6 +721,9 @@ class UsersGroupsFacade {
590
721
  getUserSummary(userName) {
591
722
  return this.store.dispatch(new GetUserSummary(userName));
592
723
  }
724
+ getGroupSummary(groupId) {
725
+ return this.store.dispatch(new GetGroupSummary(groupId));
726
+ }
593
727
  resetUserPassword(id, payload) {
594
728
  return this.store.dispatch(new ResetUserPassword(id, payload));
595
729
  }
@@ -649,8 +783,9 @@ class UsersGroups {
649
783
  ];
650
784
  ngOnInit() {
651
785
  const selectedTab = this.route.snapshot.firstChild?.data['componentType'];
786
+ // No users load here: the Users page is the only reader and loads them
787
+ // itself. Loading here too doubled both Identity/users and lock-status.
652
788
  this.selectedTab.set(selectedTab || 'users');
653
- this.facade.getUsers();
654
789
  }
655
790
  goBack() {
656
791
  this.router.navigate(['control-panel/product-settings']);
@@ -923,7 +1058,7 @@ class UserForm {
923
1058
  }
924
1059
  }
925
1060
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
926
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserForm, isStandalone: true, selector: "mt-user-form", inputs: { userForEdit: { classPropertyName: "userForEdit", publicName: "userForEdit", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getUserFormLoading()) {\r\n <div class=\"flex justify-center\">\r\n <div class=\"w-60\">\r\n <mt-tabs\r\n [(active)]=\"selectedTab\"\r\n [options]=\"tabsList\"\r\n fluid\r\n size=\"small\"\r\n [disabled]=\"!!this.userForEdit()?.userName\"\r\n ></mt-tabs>\r\n </div>\r\n </div>\r\n\r\n <form class=\"col-span-1\">\r\n @if (selectedTab() === \"internal\") {\r\n <mt-dynamic-form\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n } @else {\r\n <mt-dynamic-form\r\n [formConfig]=\"externalUserFormConfig()\"\r\n [formControl]=\"externalUserFormControl\"\r\n />\r\n }\r\n </form>\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateUserLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedUser() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateUserLoading()\"\r\n [disabled]=\"isSubmitDisabled()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
1061
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserForm, isStandalone: true, selector: "mt-user-form", inputs: { userForEdit: { classPropertyName: "userForEdit", publicName: "userForEdit", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getUserFormLoading()) {\r\n <div class=\"flex justify-center\">\r\n <div class=\"w-60\">\r\n <mt-tabs\r\n [(active)]=\"selectedTab\"\r\n [options]=\"tabsList\"\r\n fluid\r\n size=\"small\"\r\n [disabled]=\"!!this.userForEdit()?.userName\"\r\n ></mt-tabs>\r\n </div>\r\n </div>\r\n\r\n <form class=\"col-span-1\">\r\n @if (selectedTab() === \"internal\") {\r\n <mt-dynamic-form\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n } @else {\r\n <mt-dynamic-form\r\n [formConfig]=\"externalUserFormConfig()\"\r\n [formControl]=\"externalUserFormControl\"\r\n />\r\n }\r\n </form>\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateUserLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedUser() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateUserLoading()\"\r\n [disabled]=\"isSubmitDisabled()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
927
1062
  }
928
1063
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserForm, decorators: [{
929
1064
  type: Component,
@@ -1011,7 +1146,7 @@ class ResetPasswordForm {
1011
1146
  });
1012
1147
  }
1013
1148
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ResetPasswordForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
1014
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: ResetPasswordForm, isStandalone: true, selector: "mt-reset-password-form", inputs: { user: { classPropertyName: "user", publicName: "user", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <form class=\"p-4\" [class]=\"modal.contentClass\">\r\n <mt-dynamic-form\r\n [formConfig]=\"resetPasswordFormConfig()\"\r\n [formControl]=\"resetPasswordFormControl\"\r\n />\r\n </form>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"passwordResetLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"'save' | transloco\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"passwordResetLoading()\"\r\n [disabled]=\"!this.resetPasswordFormControl.valid\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
1149
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: ResetPasswordForm, isStandalone: true, selector: "mt-reset-password-form", inputs: { user: { classPropertyName: "user", publicName: "user", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <form class=\"p-4\" [class]=\"modal.contentClass\">\r\n <mt-dynamic-form\r\n [formConfig]=\"resetPasswordFormConfig()\"\r\n [formControl]=\"resetPasswordFormControl\"\r\n />\r\n </form>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"passwordResetLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"'save' | transloco\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"passwordResetLoading()\"\r\n [disabled]=\"!this.resetPasswordFormControl.valid\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
1015
1150
  }
1016
1151
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ResetPasswordForm, decorators: [{
1017
1152
  type: Component,
@@ -1026,239 +1161,456 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1026
1161
  ], providers: [DialogService], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <form class=\"p-4\" [class]=\"modal.contentClass\">\r\n <mt-dynamic-form\r\n [formConfig]=\"resetPasswordFormConfig()\"\r\n [formControl]=\"resetPasswordFormControl\"\r\n />\r\n </form>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"passwordResetLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"'save' | transloco\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"passwordResetLoading()\"\r\n [disabled]=\"!this.resetPasswordFormControl.valid\"\r\n />\r\n </div>\r\n</ng-container>\r\n" }]
1027
1162
  }], propDecorators: { user: [{ type: i0.Input, args: [{ isSignal: true, alias: "user", required: false }] }] } });
1028
1163
 
1029
- class UserLinkedGroups {
1164
+ /**
1165
+ * Drawer size shared by the user and group summaries — wide enough for the
1166
+ * four tabs and the scope trees, full-bleed on narrow screens.
1167
+ */
1168
+ const ACCESS_SUMMARY_DRAWER_CLASS = '!w-[90%] md:!w-[44rem] !absolute !shadow-none';
1169
+ /**
1170
+ * Resolves a `TranslatableDto`, or a string that is one serialized as JSON —
1171
+ * the summaries return workflow `sourceName` / `stepName` and some group
1172
+ * descriptions as `{"ar":"…","en":"…"}` text.
1173
+ *
1174
+ * The active language wins over `display`: `display` is resolved in the
1175
+ * language of the request, so it goes stale when the user switches language
1176
+ * with the drawer open.
1177
+ */
1178
+ function resolveTranslated(value, lang) {
1179
+ if (!value)
1180
+ return '';
1181
+ if (typeof value === 'object') {
1182
+ const v = value;
1183
+ return v[lang] || v.display || v.en || v.ar || '';
1184
+ }
1185
+ if (typeof value === 'string') {
1186
+ const trimmed = value.trim();
1187
+ if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
1188
+ try {
1189
+ const parsed = JSON.parse(trimmed);
1190
+ return parsed[lang] || parsed['en'] || parsed['ar'] || '';
1191
+ }
1192
+ catch {
1193
+ return value;
1194
+ }
1195
+ }
1196
+ return value;
1197
+ }
1198
+ return '';
1199
+ }
1200
+ /** Case-insensitive "any of these contains the term" for client-side search. */
1201
+ function matchesSearch(term, ...values) {
1202
+ const needle = term.trim().toLowerCase();
1203
+ if (!needle)
1204
+ return true;
1205
+ return values.some((value) => !!value && value.toLowerCase().includes(needle));
1206
+ }
1207
+ /**
1208
+ * Groups accessibilities by category. On the wire `name` carries the
1209
+ * category's label and `moduleName` the item itself, so a flat list repeats
1210
+ * the same subtitle on every row.
1211
+ */
1212
+ function groupAccessibilities(accessibilities, lang) {
1213
+ const groups = new Map();
1214
+ for (const accessibility of accessibilities) {
1215
+ const key = accessibility.category || accessibility.moduleKey || '';
1216
+ let group = groups.get(key);
1217
+ if (!group) {
1218
+ group = {
1219
+ key,
1220
+ label: resolveTranslated(accessibility.name, lang) || key,
1221
+ items: [],
1222
+ };
1223
+ groups.set(key, group);
1224
+ }
1225
+ group.items.push({
1226
+ id: accessibility.id,
1227
+ name: resolveTranslated(accessibility.moduleName, lang) ||
1228
+ accessibility.moduleKey ||
1229
+ '',
1230
+ requiresMfa: !!accessibility.enableMFACheck,
1231
+ });
1232
+ }
1233
+ return [...groups.values()];
1234
+ }
1235
+ // ============================================================================
1236
+ // Tree builders — group permissions/roles by Template → Level → Module so the
1237
+ // repeated scope context collapses into shared parent nodes instead of being
1238
+ // duplicated on every row.
1239
+ // ============================================================================
1240
+ function buildPermissionTree(permissions, lang, labels) {
1241
+ const roots = [];
1242
+ for (const permission of permissions) {
1243
+ const container = resolveScopeContainer(roots, 'perm', permission.scope, permission.templateName, lang, labels);
1244
+ container.push({
1245
+ key: `perm-${permission.id}`,
1246
+ label: resolveTranslated(permission.name, lang),
1247
+ icon: 'security.shield-tick',
1248
+ data: { type: 'permission' },
1249
+ });
1250
+ }
1251
+ return finalizeTree(roots, 'permission');
1252
+ }
1253
+ function buildRoleTree(roles, lang, labels) {
1254
+ const roots = [];
1255
+ for (const role of roles) {
1256
+ const container = resolveScopeContainer(roots, 'role', role.scope, role.templateName, lang, labels);
1257
+ const assignments = (role.levelDataAssignments ?? [])
1258
+ .map((assignment, index) => {
1259
+ const parentPath = (assignment.parents ?? [])
1260
+ .map((parent) => parent.levelDataName)
1261
+ .filter(Boolean)
1262
+ .join(' / ');
1263
+ const name = assignment.levelDataName ?? '';
1264
+ return {
1265
+ key: `role-${role.id}-assign-${assignment.levelDataId ?? index}`,
1266
+ label: parentPath ? `${name} · ${parentPath}` : name,
1267
+ icon: 'map.marker-pin-01',
1268
+ data: { type: 'assignment' },
1269
+ };
1270
+ })
1271
+ .filter((node) => !!node.label);
1272
+ container.push({
1273
+ key: `role-${role.id}`,
1274
+ label: resolveTranslated(role.name, lang),
1275
+ icon: 'user.user-check-01',
1276
+ data: { type: 'role' },
1277
+ children: assignments.length ? assignments : undefined,
1278
+ });
1279
+ }
1280
+ return finalizeTree(roots, 'role');
1281
+ }
1282
+ /**
1283
+ * Walks/creates the scope spine for a row and returns the children array the
1284
+ * leaf (permission/role) should be pushed into:
1285
+ * - level scope → Template → Level → (Module)
1286
+ * - module scope with no level → "Other modules" → Module
1287
+ * - no scope → "Unknown scope"
1288
+ */
1289
+ function resolveScopeContainer(roots, prefix, scope, fallbackTemplateName, lang, labels) {
1290
+ const level = scope?.level;
1291
+ const moduleScope = scope?.module;
1292
+ if (!level) {
1293
+ if (!moduleScope) {
1294
+ return getOrCreateChild(roots, `${prefix}-unknown`, () => ({
1295
+ key: `${prefix}-unknown`,
1296
+ label: labels.unknownScope,
1297
+ icon: 'general.help-circle',
1298
+ data: { type: 'unknown', order: 2 },
1299
+ children: [],
1300
+ })).children;
1301
+ }
1302
+ const otherNode = getOrCreateChild(roots, `${prefix}-other`, () => ({
1303
+ key: `${prefix}-other`,
1304
+ label: labels.otherModules,
1305
+ icon: 'layout.layers-three-01',
1306
+ data: { type: 'other', order: 1 },
1307
+ children: [],
1308
+ }));
1309
+ return moduleContainer(otherNode, `${prefix}-other`, moduleScope, lang, labels);
1310
+ }
1311
+ const templateKey = `${prefix}-tpl-${level.templateId ?? 'na'}`;
1312
+ const templateNode = getOrCreateChild(roots, templateKey, () => ({
1313
+ key: templateKey,
1314
+ label: resolveTranslated(level.templateName ?? fallbackTemplateName, lang) ||
1315
+ labels.unknownScope,
1316
+ icon: 'custom.building',
1317
+ data: { type: 'template', order: 0 },
1318
+ children: [],
1319
+ }));
1320
+ const levelKey = `${templateKey}-lvl-${level.id ?? 'na'}`;
1321
+ const levelNode = getOrCreateChild(templateNode.children, levelKey, () => ({
1322
+ key: levelKey,
1323
+ label: resolveTranslated(level.name, lang) || labels.unknownScope,
1324
+ icon: 'custom.hierarchy-structure',
1325
+ data: { type: 'level', order: level.order ?? 0 },
1326
+ children: [],
1327
+ }));
1328
+ return moduleScope
1329
+ ? moduleContainer(levelNode, levelKey, moduleScope, lang, labels)
1330
+ : levelNode.children;
1331
+ }
1332
+ function moduleContainer(parent, parentKey, moduleScope, lang, labels) {
1333
+ const moduleKey = `${parentKey}-mod-${moduleScope.id ?? moduleScope.levelModuleId ?? 'na'}`;
1334
+ return getOrCreateChild(parent.children, moduleKey, () => ({
1335
+ key: moduleKey,
1336
+ label: resolveTranslated(moduleScope.name, lang) || labels.unknownScope,
1337
+ icon: 'file.folder',
1338
+ data: { type: 'module', order: 0 },
1339
+ children: [],
1340
+ })).children;
1341
+ }
1342
+ function getOrCreateChild(children, key, factory) {
1343
+ const existing = children.find((node) => node.key === key);
1344
+ if (existing)
1345
+ return existing;
1346
+ const created = factory();
1347
+ children.push(created);
1348
+ return created;
1349
+ }
1350
+ const SCOPE_NODE_TYPES = new Set([
1351
+ 'template',
1352
+ 'level',
1353
+ 'module',
1354
+ 'other',
1355
+ 'unknown',
1356
+ ]);
1357
+ const isScopeNode = (node) => SCOPE_NODE_TYPES.has(node.data?.type ?? '');
1358
+ /**
1359
+ * Orders the scope nodes (templates and modules by name, levels by their
1360
+ * configured order, the "other"/"unknown" buckets last), keeps a node's own
1361
+ * permissions/roles above its sub-scopes, and appends a descendant-leaf count
1362
+ * to every scope node's label.
1363
+ */
1364
+ function finalizeTree(nodes, leafType) {
1365
+ orderNodes(nodes);
1366
+ appendScopeCounts(nodes, leafType);
1367
+ return nodes;
1368
+ }
1369
+ function orderNodes(nodes) {
1370
+ const leaves = nodes.filter((node) => !isScopeNode(node));
1371
+ const scopes = nodes.filter(isScopeNode).sort(compareScopeNodes);
1372
+ nodes.splice(0, nodes.length, ...leaves, ...scopes);
1373
+ for (const node of scopes) {
1374
+ if (node.children?.length)
1375
+ orderNodes(node.children);
1376
+ }
1377
+ }
1378
+ function compareScopeNodes(a, b) {
1379
+ const rank = scopeRank(a) - scopeRank(b);
1380
+ if (rank !== 0)
1381
+ return rank;
1382
+ if (a.data?.type === 'level' && b.data?.type === 'level') {
1383
+ const byOrder = (a.data?.order ?? 0) - (b.data?.order ?? 0);
1384
+ if (byOrder !== 0)
1385
+ return byOrder;
1386
+ }
1387
+ return (a.label ?? '').localeCompare(b.label ?? '');
1388
+ }
1389
+ function scopeRank(node) {
1390
+ switch (node.data?.type) {
1391
+ case 'other':
1392
+ return 1;
1393
+ case 'unknown':
1394
+ return 2;
1395
+ default:
1396
+ return 0;
1397
+ }
1398
+ }
1399
+ function appendScopeCounts(nodes, leafType) {
1400
+ for (const node of nodes) {
1401
+ if (isScopeNode(node) && node.children?.length) {
1402
+ node.label = `${node.label} (${countLeaves(node, leafType)})`;
1403
+ appendScopeCounts(node.children, leafType);
1404
+ }
1405
+ }
1406
+ }
1407
+ function countLeaves(node, leafType) {
1408
+ if (node.data?.type === leafType)
1409
+ return 1;
1410
+ return (node.children ?? []).reduce((sum, child) => sum + countLeaves(child, leafType), 0);
1411
+ }
1412
+
1413
+ const TONE_CLASSES = {
1414
+ neutral: 'border-surface-200 bg-surface-50 text-surface-700 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-200',
1415
+ success: 'border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-200',
1416
+ warn: 'border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-800 dark:bg-amber-900/30 dark:text-amber-200',
1417
+ danger: 'border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-800 dark:bg-rose-900/30 dark:text-rose-200',
1418
+ info: 'border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-800 dark:bg-sky-900/30 dark:text-sky-200',
1419
+ primary: 'border-primary-200 bg-primary-50 text-primary-700 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-200',
1420
+ };
1421
+ /** The status chip both access summaries use — one shape, six tones. */
1422
+ class SummaryPill {
1423
+ tone = input('neutral', ...(ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []));
1424
+ classes = computed(() => `inline-flex shrink-0 items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium whitespace-nowrap ${TONE_CLASSES[this.tone()]}`, ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
1425
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SummaryPill, deps: [], target: i0.ɵɵFactoryTarget.Component });
1426
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: SummaryPill, isStandalone: true, selector: "mt-summary-pill", inputs: { tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: '<ng-content />', isInline: true });
1427
+ }
1428
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SummaryPill, decorators: [{
1429
+ type: Component,
1430
+ args: [{
1431
+ selector: 'mt-summary-pill',
1432
+ standalone: true,
1433
+ template: '<ng-content />',
1434
+ host: { '[class]': 'classes()' },
1435
+ }]
1436
+ }], propDecorators: { tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }] } });
1437
+
1438
+ /** Search appears once the list is long enough to need it. */
1439
+ const SEARCH_THRESHOLD$2 = 6;
1440
+ /**
1441
+ * The Accessibilities tab body, shared by the user and group summaries:
1442
+ * application accessibilities grouped under their category.
1443
+ */
1444
+ class SummaryAccessibilities {
1445
+ translocoService = inject(TranslocoService);
1446
+ accessibilities = input([], ...(ngDevMode ? [{ debugName: "accessibilities" }] : /* istanbul ignore next */ []));
1447
+ /** Empty-state copy, which names the subject ("this user" / "this group"). */
1448
+ emptyMessage = input('', ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
1449
+ searchControl = new FormControl('', { nonNullable: true });
1450
+ searchTerm = toSignal(this.searchControl.valueChanges, {
1451
+ initialValue: '',
1452
+ });
1453
+ groups = computed(() => groupAccessibilities(this.accessibilities(), this.translocoService.getActiveLang()), ...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
1454
+ showSearch = computed(() => this.accessibilities().length > SEARCH_THRESHOLD$2, ...(ngDevMode ? [{ debugName: "showSearch" }] : /* istanbul ignore next */ []));
1455
+ filteredGroups = computed(() => {
1456
+ const term = this.searchTerm();
1457
+ if (!term.trim())
1458
+ return this.groups();
1459
+ return this.groups()
1460
+ .map((group) => matchesSearch(term, group.label)
1461
+ ? group
1462
+ : {
1463
+ ...group,
1464
+ items: group.items.filter((item) => matchesSearch(term, item.name)),
1465
+ })
1466
+ .filter((group) => group.items.length > 0);
1467
+ }, ...(ngDevMode ? [{ debugName: "filteredGroups" }] : /* istanbul ignore next */ []));
1468
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SummaryAccessibilities, deps: [], target: i0.ɵɵFactoryTarget.Component });
1469
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: SummaryAccessibilities, isStandalone: true, selector: "mt-summary-accessibilities", inputs: { accessibilities: { classPropertyName: "accessibilities", publicName: "accessibilities", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n @if (accessibilities().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"emptyMessage()\"\r\n [description]=\"t('accessibilities-hint')\"\r\n />\r\n } @else {\r\n <div class=\"flex flex-col gap-3\">\r\n @if (showSearch()) {\r\n <mt-text-field\r\n [formControl]=\"searchControl\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-accessibilities')\"\r\n />\r\n }\r\n\r\n @for (group of filteredGroups(); track group.key) {\r\n <section class=\"rounded-md border border-surface\">\r\n <header\r\n class=\"flex items-center justify-between gap-2 rounded-t-md border-b border-surface bg-surface-50 px-3 py-2\"\r\n >\r\n <span class=\"truncate text-sm font-semibold text-color\">\r\n {{ group.label }}\r\n </span>\r\n <span class=\"shrink-0 text-xs text-muted-color\">\r\n {{ group.items.length }}\r\n </span>\r\n </header>\r\n <ul>\r\n @for (item of group.items; track item.id) {\r\n <li\r\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\r\n >\r\n <mt-icon\r\n icon=\"security.lock-unlocked-01\"\r\n class=\"shrink-0 text-lg text-primary\"\r\n />\r\n <span\r\n class=\"min-w-0 flex-1 truncate text-sm text-color\"\r\n [title]=\"item.name\"\r\n >\r\n {{ item.name }}\r\n </span>\r\n @if (item.requiresMfa) {\r\n <mt-summary-pill tone=\"info\">{{ t(\"mfa\") }}</mt-summary-pill>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </section>\r\n } @empty {\r\n <mt-empty-state\r\n variant=\"filtered\"\r\n illustration=\"none\"\r\n [title]=\"t('no-search-results')\"\r\n />\r\n }\r\n </div>\r\n }\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: SummaryPill, selector: "mt-summary-pill", inputs: ["tone"] }] });
1470
+ }
1471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SummaryAccessibilities, decorators: [{
1472
+ type: Component,
1473
+ args: [{ selector: 'mt-summary-accessibilities', standalone: true, imports: [
1474
+ TranslocoDirective,
1475
+ ReactiveFormsModule,
1476
+ TextField,
1477
+ EmptyState,
1478
+ Icon,
1479
+ SummaryPill,
1480
+ ], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n @if (accessibilities().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"emptyMessage()\"\r\n [description]=\"t('accessibilities-hint')\"\r\n />\r\n } @else {\r\n <div class=\"flex flex-col gap-3\">\r\n @if (showSearch()) {\r\n <mt-text-field\r\n [formControl]=\"searchControl\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-accessibilities')\"\r\n />\r\n }\r\n\r\n @for (group of filteredGroups(); track group.key) {\r\n <section class=\"rounded-md border border-surface\">\r\n <header\r\n class=\"flex items-center justify-between gap-2 rounded-t-md border-b border-surface bg-surface-50 px-3 py-2\"\r\n >\r\n <span class=\"truncate text-sm font-semibold text-color\">\r\n {{ group.label }}\r\n </span>\r\n <span class=\"shrink-0 text-xs text-muted-color\">\r\n {{ group.items.length }}\r\n </span>\r\n </header>\r\n <ul>\r\n @for (item of group.items; track item.id) {\r\n <li\r\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\r\n >\r\n <mt-icon\r\n icon=\"security.lock-unlocked-01\"\r\n class=\"shrink-0 text-lg text-primary\"\r\n />\r\n <span\r\n class=\"min-w-0 flex-1 truncate text-sm text-color\"\r\n [title]=\"item.name\"\r\n >\r\n {{ item.name }}\r\n </span>\r\n @if (item.requiresMfa) {\r\n <mt-summary-pill tone=\"info\">{{ t(\"mfa\") }}</mt-summary-pill>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </section>\r\n } @empty {\r\n <mt-empty-state\r\n variant=\"filtered\"\r\n illustration=\"none\"\r\n [title]=\"t('no-search-results')\"\r\n />\r\n }\r\n </div>\r\n }\r\n</ng-container>\r\n" }]
1481
+ }], propDecorators: { accessibilities: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessibilities", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }] } });
1482
+
1483
+ /** Search appears once the list is long enough to need it. */
1484
+ const SEARCH_THRESHOLD$1 = 6;
1485
+ /**
1486
+ * One user's access, opened as a drawer from the users table: the groups the
1487
+ * user belongs to, the roles they hold (direct and from team membership), the
1488
+ * permissions those produce, and their application accessibilities.
1489
+ * `GET identity/users/{userName}/summary`.
1490
+ */
1491
+ class UserAccessSummary {
1030
1492
  facade = inject(UsersGroupsFacade);
1031
1493
  translocoService = inject(TranslocoService);
1032
- ref = inject(ModalRef);
1494
+ /** The users-table row; renders the header before the summary arrives. */
1033
1495
  user = input(null, ...(ngDevMode ? [{ debugName: "user" }] : /* istanbul ignore next */ []));
1034
1496
  context = new HttpContext().set(REQUEST_CONTEXT, {
1035
1497
  useBaseUrl: true,
1036
1498
  });
1037
1499
  loading = this.facade.isLoadingUserSummary;
1500
+ error = this.facade.userSummaryError;
1038
1501
  summary = this.facade.userSummary;
1502
+ lang = toSignal(this.translocoService.langChanges$, {
1503
+ initialValue: this.translocoService.getActiveLang(),
1504
+ });
1039
1505
  activeTab = signal('groups', ...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
1506
+ groupSearch = new FormControl('', { nonNullable: true });
1507
+ groupSearchTerm = toSignal(this.groupSearch.valueChanges, {
1508
+ initialValue: '',
1509
+ });
1510
+ profile = computed(() => {
1511
+ const row = this.user();
1512
+ const fromSummary = this.summary()?.user;
1513
+ return {
1514
+ displayName: fromSummary?.displayName || row?.displayName || '',
1515
+ userName: fromSummary?.userName || row?.userName || '',
1516
+ image: fromSummary?.image || row?.image || '',
1517
+ isExternal: !!(fromSummary?.isExternal ?? row?.isExternal),
1518
+ };
1519
+ }, ...(ngDevMode ? [{ debugName: "profile" }] : /* istanbul ignore next */ []));
1040
1520
  groups = computed(() => {
1041
1521
  const lang = this.lang();
1042
1522
  return (this.summary()?.groups ?? []).map((group) => ({
1043
1523
  id: group.id,
1044
- name: this.resolveTranslated(group.name, lang),
1524
+ name: resolveTranslated(group.name, lang),
1525
+ description: resolveTranslated(group.description, lang),
1045
1526
  isActivated: !!group.isActivated,
1046
1527
  membersCount: group.membersCount ?? 0,
1047
1528
  }));
1048
1529
  }, ...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
1049
- permissionCount = computed(() => this.summary()?.permissions?.length ?? 0, ...(ngDevMode ? [{ debugName: "permissionCount" }] : /* istanbul ignore next */ []));
1050
- roleCount = computed(() => this.summary()?.roles?.length ?? 0, ...(ngDevMode ? [{ debugName: "roleCount" }] : /* istanbul ignore next */ []));
1051
- permissionTree = computed(() => this.buildPermissionTree(this.summary()?.permissions ?? [], this.lang()), ...(ngDevMode ? [{ debugName: "permissionTree" }] : /* istanbul ignore next */ []));
1052
- roleTree = computed(() => this.buildRoleTree(this.summary()?.roles ?? [], this.lang()), ...(ngDevMode ? [{ debugName: "roleTree" }] : /* istanbul ignore next */ []));
1053
- accessibilities = computed(() => {
1054
- const lang = this.lang();
1055
- return (this.summary()?.accessibilities ?? []).map((accessibility) => ({
1056
- id: accessibility.id,
1057
- name: this.resolveTranslated(accessibility.moduleName, lang),
1058
- category: this.resolveTranslated(accessibility.name, lang),
1059
- }));
1060
- }, ...(ngDevMode ? [{ debugName: "accessibilities" }] : /* istanbul ignore next */ []));
1061
- userImage = computed(() => this.summary()?.user?.image ?? this.user()?.image ?? '', ...(ngDevMode ? [{ debugName: "userImage" }] : /* istanbul ignore next */ []));
1062
- userDisplayName = computed(() => this.summary()?.user?.displayName ?? this.user()?.displayName ?? '', ...(ngDevMode ? [{ debugName: "userDisplayName" }] : /* istanbul ignore next */ []));
1063
- tabs = computed(() => [
1064
- {
1065
- label: `${this.translocoService.translate('users-groups.groups')} (${this.groups().length})`,
1066
- value: 'groups',
1067
- },
1068
- {
1069
- label: `${this.translocoService.translate('users-groups.permissions')} (${this.permissionCount()})`,
1070
- value: 'permissions',
1071
- },
1072
- {
1073
- label: `${this.translocoService.translate('users-groups.roles')} (${this.roleCount()})`,
1074
- value: 'roles',
1075
- },
1076
- {
1077
- label: `${this.translocoService.translate('users-groups.accessibilities')} (${this.accessibilities().length})`,
1078
- value: 'accessibilities',
1079
- },
1080
- ], ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
1081
- isEmpty = computed(() => {
1082
- if (this.loading())
1083
- return false;
1084
- switch (this.activeTab()) {
1085
- case 'groups':
1086
- return this.groups().length === 0;
1087
- case 'permissions':
1088
- return this.permissionCount() === 0;
1089
- case 'roles':
1090
- return this.roleCount() === 0;
1091
- case 'accessibilities':
1092
- return this.accessibilities().length === 0;
1093
- }
1094
- }, ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
1530
+ filteredGroups = computed(() => {
1531
+ const term = this.groupSearchTerm();
1532
+ return this.groups().filter((group) => matchesSearch(term, group.name, group.description));
1533
+ }, ...(ngDevMode ? [{ debugName: "filteredGroups" }] : /* istanbul ignore next */ []));
1534
+ showGroupSearch = computed(() => this.groups().length > SEARCH_THRESHOLD$1, ...(ngDevMode ? [{ debugName: "showGroupSearch" }] : /* istanbul ignore next */ []));
1535
+ accessibilities = computed(() => this.summary()?.accessibilities ?? [], ...(ngDevMode ? [{ debugName: "accessibilities" }] : /* istanbul ignore next */ []));
1536
+ treeLabels = computed(() => {
1537
+ this.lang();
1538
+ return {
1539
+ otherModules: this.translocoService.translate('users-groups.other-modules'),
1540
+ unknownScope: this.translocoService.translate('users-groups.unknown-scope'),
1541
+ };
1542
+ }, ...(ngDevMode ? [{ debugName: "treeLabels" }] : /* istanbul ignore next */ []));
1543
+ permissionTree = computed(() => buildPermissionTree(this.summary()?.permissions ?? [], this.lang(), this.treeLabels()), ...(ngDevMode ? [{ debugName: "permissionTree" }] : /* istanbul ignore next */ []));
1544
+ roleTree = computed(() => buildRoleTree(this.summary()?.roles ?? [], this.lang(), this.treeLabels()), ...(ngDevMode ? [{ debugName: "roleTree" }] : /* istanbul ignore next */ []));
1545
+ tabs = computed(() => {
1546
+ this.lang();
1547
+ const summary = this.summary();
1548
+ const count = (value) => (summary ? value : null);
1549
+ return [
1550
+ {
1551
+ label: this.translocoService.translate('users-groups.groups'),
1552
+ value: 'groups',
1553
+ icon: 'user.users-01',
1554
+ badge: count(this.groups().length),
1555
+ },
1556
+ {
1557
+ label: this.translocoService.translate('users-groups.roles'),
1558
+ value: 'roles',
1559
+ icon: 'user.user-check-01',
1560
+ badge: count(summary?.roles?.length ?? 0),
1561
+ },
1562
+ {
1563
+ label: this.translocoService.translate('users-groups.permissions'),
1564
+ value: 'permissions',
1565
+ icon: 'security.shield-tick',
1566
+ badge: count(summary?.permissions?.length ?? 0),
1567
+ },
1568
+ {
1569
+ label: this.translocoService.translate('users-groups.accessibilities'),
1570
+ value: 'accessibilities',
1571
+ icon: 'security.lock-unlocked-01',
1572
+ badge: count(this.accessibilities().length),
1573
+ },
1574
+ ];
1575
+ }, ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
1095
1576
  ngOnInit() {
1577
+ this.load();
1578
+ }
1579
+ load() {
1096
1580
  const userName = this.user()?.userName;
1097
1581
  if (!userName)
1098
1582
  return;
1099
- this.facade.getUserSummary(userName);
1583
+ // The failure is rendered from the store's error slice.
1584
+ this.facade.getUserSummary(userName).subscribe({ error: () => undefined });
1100
1585
  }
1101
- lang() {
1102
- return this.translocoService.getActiveLang();
1103
- }
1104
- resolveTranslated(value, lang) {
1105
- if (!value)
1106
- return '';
1107
- if (typeof value === 'object') {
1108
- const v = value;
1109
- return v['display'] || v[lang] || v['en'] || v['ar'] || '';
1110
- }
1111
- if (typeof value === 'string') {
1112
- const trimmed = value.trim();
1113
- if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
1114
- try {
1115
- const parsed = JSON.parse(trimmed);
1116
- return parsed[lang] || parsed['en'] || parsed['ar'] || '';
1117
- }
1118
- catch {
1119
- return value;
1120
- }
1121
- }
1122
- return value;
1123
- }
1124
- return '';
1125
- }
1126
- // ============================================================================
1127
- // Tree builders — group permissions/roles by Template → Level → Module so the
1128
- // repeated scope context collapses into shared parent nodes instead of being
1129
- // duplicated on every row.
1130
- // ============================================================================
1131
- buildPermissionTree(permissions, lang) {
1132
- const roots = [];
1133
- for (const permission of permissions) {
1134
- const container = this.resolveScopeContainer(roots, 'perm', permission.scope, permission.templateName, lang);
1135
- container.push({
1136
- key: `perm-${permission.id}`,
1137
- label: this.resolveTranslated(permission.name, lang),
1138
- icon: 'security.shield-tick',
1139
- data: { type: 'permission' },
1140
- });
1141
- }
1142
- this.appendScopeCounts(roots, 'permission');
1143
- return roots;
1144
- }
1145
- buildRoleTree(roles, lang) {
1146
- const roots = [];
1147
- for (const role of roles) {
1148
- const container = this.resolveScopeContainer(roots, 'role', role.scope, role.templateName, lang);
1149
- const assignments = (role.levelDataAssignments ?? [])
1150
- .map((assignment, index) => {
1151
- const parentPath = (assignment.parents ?? [])
1152
- .map((parent) => parent.levelDataName)
1153
- .filter(Boolean)
1154
- .join(' / ');
1155
- const name = assignment.levelDataName ?? '';
1156
- return {
1157
- key: `role-${role.id}-assign-${assignment.levelDataId ?? index}`,
1158
- label: parentPath ? `${name} · ${parentPath}` : name,
1159
- icon: 'map.marker-pin-01',
1160
- data: { type: 'assignment' },
1161
- };
1162
- })
1163
- .filter((node) => !!node.label);
1164
- container.push({
1165
- key: `role-${role.id}`,
1166
- label: this.resolveTranslated(role.name, lang),
1167
- icon: 'user.user-check-01',
1168
- data: { type: 'role' },
1169
- children: assignments.length ? assignments : undefined,
1170
- });
1171
- }
1172
- this.appendScopeCounts(roots, 'role');
1173
- return roots;
1174
- }
1175
- /**
1176
- * Walks/creates the Template → Level → Module spine for a scope and returns the
1177
- * children array the leaf (permission/role) should be pushed into.
1178
- */
1179
- resolveScopeContainer(roots, prefix, scope, fallbackTemplateName, lang) {
1180
- const level = scope?.level;
1181
- const templateKey = `${prefix}-tpl-${level?.templateId ?? 'na'}`;
1182
- const templateNode = this.getOrCreateChild(roots, templateKey, () => ({
1183
- key: templateKey,
1184
- label: this.resolveTranslated(level?.templateName ?? fallbackTemplateName, lang) || this.unknownScopeLabel(),
1185
- icon: 'custom.building',
1186
- data: { type: 'template' },
1187
- children: [],
1188
- }));
1189
- const levelKey = `${templateKey}-lvl-${level?.id ?? 'na'}`;
1190
- const levelNode = this.getOrCreateChild(templateNode.children, levelKey, () => ({
1191
- key: levelKey,
1192
- label: this.resolveTranslated(level?.name, lang) || this.unknownScopeLabel(),
1193
- icon: 'custom.hierarchy-structure',
1194
- data: { type: 'level' },
1195
- children: [],
1196
- }));
1197
- const moduleScope = scope?.module;
1198
- if (!moduleScope) {
1199
- return levelNode.children;
1200
- }
1201
- const moduleKey = `${levelKey}-mod-${moduleScope.id ?? moduleScope.levelModuleId ?? 'na'}`;
1202
- const moduleNode = this.getOrCreateChild(levelNode.children, moduleKey, () => ({
1203
- key: moduleKey,
1204
- label: this.resolveTranslated(moduleScope.name, lang) ||
1205
- this.unknownScopeLabel(),
1206
- icon: 'file.folder',
1207
- data: { type: 'module' },
1208
- children: [],
1209
- }));
1210
- return moduleNode.children;
1211
- }
1212
- getOrCreateChild(children, key, factory) {
1213
- const existing = children.find((node) => node.key === key);
1214
- if (existing)
1215
- return existing;
1216
- const created = factory();
1217
- children.push(created);
1218
- return created;
1219
- }
1220
- /** Appends a descendant-leaf count to each grouping (template/level/module) node. */
1221
- appendScopeCounts(nodes, leafType) {
1222
- for (const node of nodes) {
1223
- const type = node.data?.type;
1224
- if ((type === 'template' || type === 'level' || type === 'module') &&
1225
- node.children?.length) {
1226
- node.label = `${node.label} (${this.countLeaves(node, leafType)})`;
1227
- }
1228
- if (node.children?.length) {
1229
- this.appendScopeCounts(node.children, leafType);
1230
- }
1231
- }
1232
- }
1233
- countLeaves(node, leafType) {
1234
- if (node.data?.type === leafType)
1235
- return 1;
1236
- return (node.children ?? []).reduce((sum, child) => sum + this.countLeaves(child, leafType), 0);
1237
- }
1238
- unknownScopeLabel() {
1239
- return this.translocoService.translate('users-groups.unknown-scope');
1240
- }
1241
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserLinkedGroups, deps: [], target: i0.ɵɵFactoryTarget.Component });
1242
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserLinkedGroups, isStandalone: true, selector: "mt-user-linked-groups", inputs: { user: { classPropertyName: "user", publicName: "user", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"flex flex-col gap-4 p-4 max-h-[75vh] overflow-auto\">\r\n <div class=\"flex items-center min-w-0\">\r\n <mt-tabs\r\n class=\"flex-1 min-w-0\"\r\n [options]=\"tabs()\"\r\n [(active)]=\"activeTab\"\r\n mode=\"underline\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n ></mt-tabs>\r\n <div\r\n class=\"flex items-center gap-2 pb-2 px-2 shrink-0 border-b border-slate-200 dark:border-slate-700\"\r\n >\r\n <mt-avatar\r\n [image]=\"\r\n userImage()\r\n ? $any(userImage() | secureImage: true : context : 'avatar/')\r\n : ''\r\n \"\r\n [icon]=\"'user.user-01'\"\r\n styleClass=\"w-8! h-8! text-lg! text-gray-600! bg-surface-300!\"\r\n ></mt-avatar>\r\n <div class=\"flex flex-col min-w-0\">\r\n <span\r\n class=\"text-sm font-medium text-slate-600 dark:text-slate-100 truncate\"\r\n [title]=\"userDisplayName()\"\r\n >\r\n {{ userDisplayName() }}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n @if (loading()) {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n </div>\r\n } @else if (isEmpty()) {\r\n <div\r\n class=\"flex flex-col items-center justify-center text-center py-10 gap-2 text-slate-500 dark:text-slate-400\"\r\n >\r\n <mt-icon icon=\"general.link-broken-01\" class=\"text-2xl\" />\r\n <span class=\"text-sm font-medium\">\r\n @switch (activeTab()) {\r\n @case (\"groups\") {\r\n {{ t(\"no-linked-groups\") }}\r\n }\r\n @case (\"permissions\") {\r\n {{ t(\"no-permissions\") }}\r\n }\r\n @case (\"roles\") {\r\n {{ t(\"no-roles\") }}\r\n }\r\n @case (\"accessibilities\") {\r\n {{ t(\"no-accessibilities\") }}\r\n }\r\n }\r\n </span>\r\n </div>\r\n } @else {\r\n @switch (activeTab()) {\r\n @case (\"groups\") {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3 pb-3\">\r\n @for (group of groups(); track group.id) {\r\n <div\r\n class=\"flex flex-col gap-2 rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 p-3 hover:shadow-sm transition-shadow\"\r\n >\r\n <div class=\"flex items-start justify-between gap-2\">\r\n <div class=\"flex items-center gap-3 min-w-0\">\r\n <span\r\n class=\"inline-flex items-center justify-center rounded-md bg-indigo-50 dark:bg-indigo-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-indigo-600 dark:text-indigo-300 text-xl\"\r\n />\r\n </span>\r\n <div class=\"flex flex-col min-w-0\">\r\n <span\r\n class=\"text-md text-slate-800 dark:text-slate-100 truncate\"\r\n [title]=\"group.name\"\r\n >\r\n {{ group.name }}\r\n </span>\r\n <span\r\n class=\"inline-flex items-center gap-1 text-xs text-slate-500 dark:text-slate-400\"\r\n >\r\n <mt-icon icon=\"user.users-01\" class=\"text-sm\" />\r\n {{ group.membersCount }} {{ t(\"users\") }}\r\n </span>\r\n </div>\r\n </div>\r\n\r\n @if (group.isActivated) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 px-2 py-0.5 shrink-0\"\r\n >\r\n <span\r\n class=\"w-1.5 h-1.5 rounded-full bg-emerald-500\"\r\n ></span>\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"active\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-100 dark:bg-slate-700 px-2 py-0.5 shrink-0\"\r\n >\r\n <span\r\n class=\"w-1.5 h-1.5 rounded-full bg-slate-400\"\r\n ></span>\r\n <span\r\n class=\"text-slate-600 dark:text-slate-200 text-xs font-medium\"\r\n >\r\n {{ t(\"inactive\") }}\r\n </span>\r\n </span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @case (\"permissions\") {\r\n <mt-tree\r\n class=\"block pb-3\"\r\n [value]=\"permissionTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-permissions')\"\r\n />\r\n }\r\n\r\n @case (\"roles\") {\r\n <mt-tree\r\n class=\"block pb-3\"\r\n [value]=\"roleTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-roles')\"\r\n />\r\n }\r\n\r\n @case (\"accessibilities\") {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3 pb-3\">\r\n @for (accessibility of accessibilities(); track accessibility.id) {\r\n <div\r\n class=\"flex items-center gap-3 rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 p-3\"\r\n >\r\n <span\r\n class=\"inline-flex items-center justify-center rounded-md bg-sky-50 dark:bg-sky-900/30 p-2 shrink-0\"\r\n >\r\n <mt-icon\r\n icon=\"security.lock-unlocked-01\"\r\n class=\"text-sky-600 dark:text-sky-300 text-xl\"\r\n />\r\n </span>\r\n <div class=\"flex flex-col min-w-0 flex-1\">\r\n <span\r\n class=\"text-md text-slate-800 dark:text-slate-100 truncate\"\r\n [title]=\"accessibility.name\"\r\n >\r\n {{ accessibility.name }}\r\n </span>\r\n @if (accessibility.category) {\r\n <span class=\"text-xs text-slate-500 dark:text-slate-400\">\r\n {{ accessibility.category }}\r\n </span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n }\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: Tree, selector: "mt-tree", inputs: ["value", "selection", "selectionMode", "nodeIcon", "propagateSelectionUp", "propagateSelectionDown", "checkAllChildren", "loading", "emptyMessage", "checkAllLabel", "filterPlaceholder", "dataKey", "filter", "filterMode", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "styleClass", "style", "pInputs", "nodeActions", "nodeContextmenuActions", "contextMenuSelection"], outputs: ["selectionChange", "contextMenuSelectionChange", "action"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "pipe", type: SecureImagePipe, name: "secureImage" }] });
1586
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserAccessSummary, deps: [], target: i0.ɵɵFactoryTarget.Component });
1587
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserAccessSummary, isStandalone: true, selector: "mt-user-access-summary", inputs: { user: { classPropertyName: "user", publicName: "user", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex h-full min-h-0 flex-col" }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <!-- Who this is \u2014 rendered from the table row, so it never waits on the request. -->\r\n <div class=\"min-h-0 flex-1 overflow-y-auto\">\r\n <section class=\"flex items-center gap-3 border-b border-surface p-4\">\r\n <mt-avatar\r\n [image]=\"\r\n profile().image\r\n ? $any(profile().image | secureImage: true : context : 'avatar/')\r\n : ''\r\n \"\r\n icon=\"user.user-01\"\r\n size=\"large\"\r\n styleClass=\"text-surface-600! bg-surface-200!\"\r\n />\r\n\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n <div class=\"flex min-w-0 flex-wrap items-center gap-2\">\r\n <h2\r\n class=\"min-w-0 truncate text-base font-semibold text-color\"\r\n [title]=\"profile().displayName\"\r\n >\r\n {{ profile().displayName }}\r\n </h2>\r\n @if (profile().isExternal) {\r\n <mt-summary-pill tone=\"neutral\">\r\n <mt-icon icon=\"general.link-external-02\" class=\"text-xs\" />\r\n {{ t(\"external\") }}\r\n </mt-summary-pill>\r\n } @else {\r\n <mt-summary-pill tone=\"success\">\r\n <mt-icon icon=\"user.users-01\" class=\"text-xs\" />\r\n {{ t(\"internal\") }}\r\n </mt-summary-pill>\r\n }\r\n </div>\r\n\r\n @if (profile().userName) {\r\n <span\r\n class=\"inline-flex min-w-0 items-center gap-1 text-sm text-muted-color\"\r\n >\r\n <mt-icon icon=\"user.user-01\" class=\"shrink-0 text-sm\" />\r\n <span class=\"truncate\">{{ profile().userName }}</span>\r\n </span>\r\n }\r\n </div>\r\n </section>\r\n\r\n <div class=\"sticky top-0 z-10 bg-content px-4 pt-2\">\r\n <mt-tabs [options]=\"tabs()\" [(active)]=\"activeTab\" mode=\"underline\" />\r\n </div>\r\n\r\n <div class=\"p-4\">\r\n @if (loading()) {\r\n <div class=\"flex flex-col gap-3\">\r\n @for (row of [1, 2, 3, 4]; track row) {\r\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n } @else if (error()) {\r\n <div\r\n class=\"flex flex-col items-start gap-3 rounded-md border border-rose-200 bg-rose-50 p-4 dark:border-rose-800 dark:bg-rose-900/30\"\r\n role=\"alert\"\r\n >\r\n <div class=\"flex flex-col gap-1\">\r\n <span\r\n class=\"text-sm font-semibold text-rose-700 dark:text-rose-200\"\r\n >\r\n {{ t(\"summary-load-failed\") }}\r\n </span>\r\n <span class=\"text-sm text-rose-600 dark:text-rose-300\">\r\n {{ t(\"summary-load-failed-hint\") }}\r\n </span>\r\n </div>\r\n <mt-button\r\n icon=\"arrow.refresh-cw-02\"\r\n severity=\"danger\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [label]=\"t('try-again')\"\r\n (onClick)=\"load()\"\r\n />\r\n </div>\r\n } @else {\r\n @switch (activeTab()) {\r\n @case (\"groups\") {\r\n @if (groups().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-linked-groups')\"\r\n [description]=\"t('user-groups-hint')\"\r\n />\r\n } @else {\r\n <div class=\"flex flex-col gap-3\">\r\n @if (showGroupSearch()) {\r\n <mt-text-field\r\n [formControl]=\"groupSearch\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-groups')\"\r\n />\r\n }\r\n <ul class=\"rounded-md border border-surface\">\r\n @for (group of filteredGroups(); track group.id) {\r\n <li\r\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\r\n >\r\n <mt-avatar\r\n icon=\"user.users-01\"\r\n shape=\"square\"\r\n styleClass=\"bg-primary-50! text-primary!\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 flex-col\">\r\n <span\r\n class=\"truncate text-sm font-medium text-color\"\r\n [title]=\"group.name\"\r\n >\r\n {{ group.name }}\r\n </span>\r\n @if (group.description) {\r\n <span\r\n class=\"truncate text-xs text-muted-color\"\r\n [title]=\"group.description\"\r\n >\r\n {{ group.description }}\r\n </span>\r\n }\r\n </div>\r\n <span\r\n class=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted-color\"\r\n >\r\n <mt-icon icon=\"user.user-01\" class=\"text-sm\" />\r\n {{ group.membersCount }}\r\n </span>\r\n @if (group.isActivated) {\r\n <mt-summary-pill tone=\"success\">\r\n {{ t(\"active\") }}\r\n </mt-summary-pill>\r\n } @else {\r\n <mt-summary-pill tone=\"neutral\">\r\n {{ t(\"inactive\") }}\r\n </mt-summary-pill>\r\n }\r\n </li>\r\n } @empty {\r\n <li>\r\n <mt-empty-state\r\n variant=\"filtered\"\r\n illustration=\"none\"\r\n [title]=\"t('no-search-results')\"\r\n />\r\n </li>\r\n }\r\n </ul>\r\n </div>\r\n }\r\n }\r\n\r\n @case (\"roles\") {\r\n @if (roleTree().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-roles')\"\r\n [description]=\"t('user-roles-hint')\"\r\n />\r\n } @else {\r\n <mt-tree\r\n class=\"block\"\r\n [value]=\"roleTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-roles')\"\r\n />\r\n }\r\n }\r\n\r\n @case (\"permissions\") {\r\n @if (permissionTree().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-permissions')\"\r\n [description]=\"t('user-permissions-hint')\"\r\n />\r\n } @else {\r\n <mt-tree\r\n class=\"block\"\r\n [value]=\"permissionTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-permissions')\"\r\n />\r\n }\r\n }\r\n\r\n @case (\"accessibilities\") {\r\n <mt-summary-accessibilities\r\n [accessibilities]=\"accessibilities()\"\r\n [emptyMessage]=\"t('no-accessibilities')\"\r\n />\r\n }\r\n }\r\n }\r\n </div>\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: Tree, selector: "mt-tree", inputs: ["value", "selection", "selectionMode", "nodeIcon", "propagateSelectionUp", "propagateSelectionDown", "checkAllChildren", "loading", "emptyMessage", "checkAllLabel", "filterPlaceholder", "dataKey", "filter", "filterMode", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "styleClass", "style", "pInputs", "nodeActions", "nodeContextmenuActions", "contextMenuSelection"], outputs: ["selectionChange", "contextMenuSelectionChange", "action"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: SummaryAccessibilities, selector: "mt-summary-accessibilities", inputs: ["accessibilities", "emptyMessage"] }, { kind: "component", type: SummaryPill, selector: "mt-summary-pill", inputs: ["tone"] }, { kind: "pipe", type: SecureImagePipe, name: "secureImage" }] });
1243
1588
  }
1244
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserLinkedGroups, decorators: [{
1589
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserAccessSummary, decorators: [{
1245
1590
  type: Component,
1246
- args: [{ selector: 'mt-user-linked-groups', standalone: true, imports: [
1247
- CommonModule,
1591
+ args: [{ selector: 'mt-user-access-summary', standalone: true, host: { class: 'flex h-full min-h-0 flex-col' }, imports: [
1248
1592
  TranslocoDirective,
1593
+ ReactiveFormsModule,
1249
1594
  SkeletonModule,
1250
1595
  Icon,
1251
1596
  Tabs,
1252
1597
  Tree,
1253
1598
  Avatar,
1599
+ Button,
1600
+ TextField,
1601
+ EmptyState,
1254
1602
  SecureImagePipe,
1255
- ], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"flex flex-col gap-4 p-4 max-h-[75vh] overflow-auto\">\r\n <div class=\"flex items-center min-w-0\">\r\n <mt-tabs\r\n class=\"flex-1 min-w-0\"\r\n [options]=\"tabs()\"\r\n [(active)]=\"activeTab\"\r\n mode=\"underline\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n ></mt-tabs>\r\n <div\r\n class=\"flex items-center gap-2 pb-2 px-2 shrink-0 border-b border-slate-200 dark:border-slate-700\"\r\n >\r\n <mt-avatar\r\n [image]=\"\r\n userImage()\r\n ? $any(userImage() | secureImage: true : context : 'avatar/')\r\n : ''\r\n \"\r\n [icon]=\"'user.user-01'\"\r\n styleClass=\"w-8! h-8! text-lg! text-gray-600! bg-surface-300!\"\r\n ></mt-avatar>\r\n <div class=\"flex flex-col min-w-0\">\r\n <span\r\n class=\"text-sm font-medium text-slate-600 dark:text-slate-100 truncate\"\r\n [title]=\"userDisplayName()\"\r\n >\r\n {{ userDisplayName() }}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n @if (loading()) {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n </div>\r\n } @else if (isEmpty()) {\r\n <div\r\n class=\"flex flex-col items-center justify-center text-center py-10 gap-2 text-slate-500 dark:text-slate-400\"\r\n >\r\n <mt-icon icon=\"general.link-broken-01\" class=\"text-2xl\" />\r\n <span class=\"text-sm font-medium\">\r\n @switch (activeTab()) {\r\n @case (\"groups\") {\r\n {{ t(\"no-linked-groups\") }}\r\n }\r\n @case (\"permissions\") {\r\n {{ t(\"no-permissions\") }}\r\n }\r\n @case (\"roles\") {\r\n {{ t(\"no-roles\") }}\r\n }\r\n @case (\"accessibilities\") {\r\n {{ t(\"no-accessibilities\") }}\r\n }\r\n }\r\n </span>\r\n </div>\r\n } @else {\r\n @switch (activeTab()) {\r\n @case (\"groups\") {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3 pb-3\">\r\n @for (group of groups(); track group.id) {\r\n <div\r\n class=\"flex flex-col gap-2 rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 p-3 hover:shadow-sm transition-shadow\"\r\n >\r\n <div class=\"flex items-start justify-between gap-2\">\r\n <div class=\"flex items-center gap-3 min-w-0\">\r\n <span\r\n class=\"inline-flex items-center justify-center rounded-md bg-indigo-50 dark:bg-indigo-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-indigo-600 dark:text-indigo-300 text-xl\"\r\n />\r\n </span>\r\n <div class=\"flex flex-col min-w-0\">\r\n <span\r\n class=\"text-md text-slate-800 dark:text-slate-100 truncate\"\r\n [title]=\"group.name\"\r\n >\r\n {{ group.name }}\r\n </span>\r\n <span\r\n class=\"inline-flex items-center gap-1 text-xs text-slate-500 dark:text-slate-400\"\r\n >\r\n <mt-icon icon=\"user.users-01\" class=\"text-sm\" />\r\n {{ group.membersCount }} {{ t(\"users\") }}\r\n </span>\r\n </div>\r\n </div>\r\n\r\n @if (group.isActivated) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 px-2 py-0.5 shrink-0\"\r\n >\r\n <span\r\n class=\"w-1.5 h-1.5 rounded-full bg-emerald-500\"\r\n ></span>\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"active\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-100 dark:bg-slate-700 px-2 py-0.5 shrink-0\"\r\n >\r\n <span\r\n class=\"w-1.5 h-1.5 rounded-full bg-slate-400\"\r\n ></span>\r\n <span\r\n class=\"text-slate-600 dark:text-slate-200 text-xs font-medium\"\r\n >\r\n {{ t(\"inactive\") }}\r\n </span>\r\n </span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @case (\"permissions\") {\r\n <mt-tree\r\n class=\"block pb-3\"\r\n [value]=\"permissionTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-permissions')\"\r\n />\r\n }\r\n\r\n @case (\"roles\") {\r\n <mt-tree\r\n class=\"block pb-3\"\r\n [value]=\"roleTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-roles')\"\r\n />\r\n }\r\n\r\n @case (\"accessibilities\") {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3 pb-3\">\r\n @for (accessibility of accessibilities(); track accessibility.id) {\r\n <div\r\n class=\"flex items-center gap-3 rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 p-3\"\r\n >\r\n <span\r\n class=\"inline-flex items-center justify-center rounded-md bg-sky-50 dark:bg-sky-900/30 p-2 shrink-0\"\r\n >\r\n <mt-icon\r\n icon=\"security.lock-unlocked-01\"\r\n class=\"text-sky-600 dark:text-sky-300 text-xl\"\r\n />\r\n </span>\r\n <div class=\"flex flex-col min-w-0 flex-1\">\r\n <span\r\n class=\"text-md text-slate-800 dark:text-slate-100 truncate\"\r\n [title]=\"accessibility.name\"\r\n >\r\n {{ accessibility.name }}\r\n </span>\r\n @if (accessibility.category) {\r\n <span class=\"text-xs text-slate-500 dark:text-slate-400\">\r\n {{ accessibility.category }}\r\n </span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n }\r\n </div>\r\n</ng-container>\r\n" }]
1603
+ SummaryAccessibilities,
1604
+ SummaryPill,
1605
+ ], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <!-- Who this is \u2014 rendered from the table row, so it never waits on the request. -->\r\n <div class=\"min-h-0 flex-1 overflow-y-auto\">\r\n <section class=\"flex items-center gap-3 border-b border-surface p-4\">\r\n <mt-avatar\r\n [image]=\"\r\n profile().image\r\n ? $any(profile().image | secureImage: true : context : 'avatar/')\r\n : ''\r\n \"\r\n icon=\"user.user-01\"\r\n size=\"large\"\r\n styleClass=\"text-surface-600! bg-surface-200!\"\r\n />\r\n\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n <div class=\"flex min-w-0 flex-wrap items-center gap-2\">\r\n <h2\r\n class=\"min-w-0 truncate text-base font-semibold text-color\"\r\n [title]=\"profile().displayName\"\r\n >\r\n {{ profile().displayName }}\r\n </h2>\r\n @if (profile().isExternal) {\r\n <mt-summary-pill tone=\"neutral\">\r\n <mt-icon icon=\"general.link-external-02\" class=\"text-xs\" />\r\n {{ t(\"external\") }}\r\n </mt-summary-pill>\r\n } @else {\r\n <mt-summary-pill tone=\"success\">\r\n <mt-icon icon=\"user.users-01\" class=\"text-xs\" />\r\n {{ t(\"internal\") }}\r\n </mt-summary-pill>\r\n }\r\n </div>\r\n\r\n @if (profile().userName) {\r\n <span\r\n class=\"inline-flex min-w-0 items-center gap-1 text-sm text-muted-color\"\r\n >\r\n <mt-icon icon=\"user.user-01\" class=\"shrink-0 text-sm\" />\r\n <span class=\"truncate\">{{ profile().userName }}</span>\r\n </span>\r\n }\r\n </div>\r\n </section>\r\n\r\n <div class=\"sticky top-0 z-10 bg-content px-4 pt-2\">\r\n <mt-tabs [options]=\"tabs()\" [(active)]=\"activeTab\" mode=\"underline\" />\r\n </div>\r\n\r\n <div class=\"p-4\">\r\n @if (loading()) {\r\n <div class=\"flex flex-col gap-3\">\r\n @for (row of [1, 2, 3, 4]; track row) {\r\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n } @else if (error()) {\r\n <div\r\n class=\"flex flex-col items-start gap-3 rounded-md border border-rose-200 bg-rose-50 p-4 dark:border-rose-800 dark:bg-rose-900/30\"\r\n role=\"alert\"\r\n >\r\n <div class=\"flex flex-col gap-1\">\r\n <span\r\n class=\"text-sm font-semibold text-rose-700 dark:text-rose-200\"\r\n >\r\n {{ t(\"summary-load-failed\") }}\r\n </span>\r\n <span class=\"text-sm text-rose-600 dark:text-rose-300\">\r\n {{ t(\"summary-load-failed-hint\") }}\r\n </span>\r\n </div>\r\n <mt-button\r\n icon=\"arrow.refresh-cw-02\"\r\n severity=\"danger\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [label]=\"t('try-again')\"\r\n (onClick)=\"load()\"\r\n />\r\n </div>\r\n } @else {\r\n @switch (activeTab()) {\r\n @case (\"groups\") {\r\n @if (groups().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-linked-groups')\"\r\n [description]=\"t('user-groups-hint')\"\r\n />\r\n } @else {\r\n <div class=\"flex flex-col gap-3\">\r\n @if (showGroupSearch()) {\r\n <mt-text-field\r\n [formControl]=\"groupSearch\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-groups')\"\r\n />\r\n }\r\n <ul class=\"rounded-md border border-surface\">\r\n @for (group of filteredGroups(); track group.id) {\r\n <li\r\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\r\n >\r\n <mt-avatar\r\n icon=\"user.users-01\"\r\n shape=\"square\"\r\n styleClass=\"bg-primary-50! text-primary!\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 flex-col\">\r\n <span\r\n class=\"truncate text-sm font-medium text-color\"\r\n [title]=\"group.name\"\r\n >\r\n {{ group.name }}\r\n </span>\r\n @if (group.description) {\r\n <span\r\n class=\"truncate text-xs text-muted-color\"\r\n [title]=\"group.description\"\r\n >\r\n {{ group.description }}\r\n </span>\r\n }\r\n </div>\r\n <span\r\n class=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted-color\"\r\n >\r\n <mt-icon icon=\"user.user-01\" class=\"text-sm\" />\r\n {{ group.membersCount }}\r\n </span>\r\n @if (group.isActivated) {\r\n <mt-summary-pill tone=\"success\">\r\n {{ t(\"active\") }}\r\n </mt-summary-pill>\r\n } @else {\r\n <mt-summary-pill tone=\"neutral\">\r\n {{ t(\"inactive\") }}\r\n </mt-summary-pill>\r\n }\r\n </li>\r\n } @empty {\r\n <li>\r\n <mt-empty-state\r\n variant=\"filtered\"\r\n illustration=\"none\"\r\n [title]=\"t('no-search-results')\"\r\n />\r\n </li>\r\n }\r\n </ul>\r\n </div>\r\n }\r\n }\r\n\r\n @case (\"roles\") {\r\n @if (roleTree().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-roles')\"\r\n [description]=\"t('user-roles-hint')\"\r\n />\r\n } @else {\r\n <mt-tree\r\n class=\"block\"\r\n [value]=\"roleTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-roles')\"\r\n />\r\n }\r\n }\r\n\r\n @case (\"permissions\") {\r\n @if (permissionTree().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-permissions')\"\r\n [description]=\"t('user-permissions-hint')\"\r\n />\r\n } @else {\r\n <mt-tree\r\n class=\"block\"\r\n [value]=\"permissionTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-permissions')\"\r\n />\r\n }\r\n }\r\n\r\n @case (\"accessibilities\") {\r\n <mt-summary-accessibilities\r\n [accessibilities]=\"accessibilities()\"\r\n [emptyMessage]=\"t('no-accessibilities')\"\r\n />\r\n }\r\n }\r\n }\r\n </div>\r\n </div>\r\n</ng-container>\r\n" }]
1256
1606
  }], propDecorators: { user: [{ type: i0.Input, args: [{ isSignal: true, alias: "user", required: false }] }] } });
1257
1607
 
1258
1608
  class Users {
1259
1609
  typeCol = viewChild.required('typeCol');
1260
1610
  applicationLinkCol = viewChild.required('applicationLinkCol');
1611
+ emailCol = viewChild.required('emailCol');
1261
1612
  facade = inject(UsersGroupsFacade);
1613
+ toast = inject(ToastService);
1262
1614
  modal = inject(ModalService);
1263
1615
  translocoService = inject(TranslocoService);
1264
1616
  users = computed(() => {
@@ -1314,13 +1666,32 @@ class Users {
1314
1666
  ], ...(ngDevMode ? [{ debugName: "tableActions" }] : /* istanbul ignore next */ []));
1315
1667
  deletingRowIds = signal([], ...(ngDevMode ? [{ debugName: "deletingRowIds" }] : /* istanbul ignore next */ []));
1316
1668
  linkingRowIds = signal([], ...(ngDevMode ? [{ debugName: "linkingRowIds" }] : /* istanbul ignore next */ []));
1669
+ unlockingRowIds = signal([], ...(ngDevMode ? [{ debugName: "unlockingRowIds" }] : /* istanbul ignore next */ []));
1317
1670
  rowActions = signal([
1318
1671
  {
1319
- icon: 'general.link-01',
1672
+ icon: 'security.lock-unlocked-01',
1673
+ tooltip: this.translocoService.translate('users-groups.unlock-account'),
1674
+ color: 'secondary',
1675
+ action: (row) => this.unlockUser(row),
1676
+ hidden: (row) => !row.id || !this.facade.unlockableUserIds().includes(row.id),
1677
+ loading: (row) => this.unlockingRowIds().includes(row.id),
1678
+ // A dialog, not a popup: the cross-application warning needs a header
1679
+ // and a bounded width (a popup stretches it across the table).
1680
+ confirmation: {
1681
+ type: 'dialog',
1682
+ header: this.translocoService.translate('users-groups.unlock-account'),
1683
+ message: this.translocoService.translate('users-groups.unlock-confirm-message'),
1684
+ icon: 'security.lock-unlocked-01',
1685
+ acceptLabel: this.translocoService.translate('users-groups.unlock-account'),
1686
+ rejectLabel: this.translocoService.translate('users-groups.cancel'),
1687
+ },
1688
+ },
1689
+ {
1690
+ icon: 'general.eye',
1320
1691
  tooltip: this.translocoService.translate('users-groups.access-summary'),
1321
1692
  color: 'secondary',
1322
1693
  action: (row) => {
1323
- this.openLinkedGroupsDialog(row);
1694
+ this.openAccessSummary(row);
1324
1695
  },
1325
1696
  hidden: (row) => !this.isLinkedToCurrentApplication(row),
1326
1697
  },
@@ -1424,8 +1795,16 @@ class Users {
1424
1795
  },
1425
1796
  },
1426
1797
  {
1798
+ // The table lays out as `auto`: a long address would set the column's
1799
+ // minimum width, and the widest content also takes the largest share of
1800
+ // the spare width. The cell truncates at 16rem and the column is pinned
1801
+ // to that plus the cell's 2rem padding, so other columns keep the room.
1427
1802
  key: 'email',
1428
1803
  label: this.translocoService.translate('users-groups.email'),
1804
+ type: 'custom',
1805
+ customCellTpl: this.emailCol(),
1806
+ width: '18rem',
1807
+ exportable: true,
1429
1808
  filterConfig: {
1430
1809
  type: 'text',
1431
1810
  label: this.translocoService.translate('users-groups.email'),
@@ -1451,6 +1830,31 @@ class Users {
1451
1830
  ngOnInit() {
1452
1831
  this.facade.getUsers();
1453
1832
  }
1833
+ unlockUser(user) {
1834
+ const id = user.id;
1835
+ if (!id ||
1836
+ !this.facade.unlockableUserIds().includes(id) ||
1837
+ this.unlockingRowIds().includes(id))
1838
+ return;
1839
+ this.unlockingRowIds.update((ids) => [...ids, id]);
1840
+ this.facade
1841
+ .unlockUser(id)
1842
+ .pipe(finalize(() => this.unlockingRowIds.update((ids) => ids.filter((value) => value !== id))))
1843
+ .subscribe({
1844
+ next: () => {
1845
+ this.toast.success(this.facade.unlockResponses()[id]?.message ||
1846
+ this.translocoService.translate('users-groups.unlock-succeeded'));
1847
+ this.facade.getUsers();
1848
+ },
1849
+ error: (error) => {
1850
+ const message = error?.error?.errors?.message ?? error?.error?.message;
1851
+ this.toast.error(typeof message === 'string' && message.trim()
1852
+ ? message
1853
+ : this.translocoService.translate('users-groups.unlock-failed'));
1854
+ this.facade.getUsers();
1855
+ },
1856
+ });
1857
+ }
1454
1858
  isLinkedToCurrentApplication(user) {
1455
1859
  return user?.isLinkedToCurrentApplication !== false;
1456
1860
  }
@@ -1510,10 +1914,12 @@ class Users {
1510
1914
  },
1511
1915
  });
1512
1916
  }
1513
- openLinkedGroupsDialog(user) {
1514
- this.modal.openModal(UserLinkedGroups, 'dialog', {
1515
- header: this.translocoService.translate('users-groups.summary'),
1516
- styleClass: '!w-[50rem]',
1917
+ openAccessSummary(user) {
1918
+ this.modal.openModal(UserAccessSummary, 'drawer', {
1919
+ header: this.translocoService.translate('users-groups.access-summary'),
1920
+ styleClass: ACCESS_SUMMARY_DRAWER_CLASS,
1921
+ position: 'end',
1922
+ appendTo: 'page-content',
1517
1923
  dismissableMask: true,
1518
1924
  dismissible: true,
1519
1925
  inputValues: {
@@ -1522,12 +1928,49 @@ class Users {
1522
1928
  });
1523
1929
  }
1524
1930
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Users, deps: [], target: i0.ɵɵFactoryTarget.Component });
1525
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Users, isStandalone: true, selector: "mt-users", viewQueries: [{ propertyName: "typeCol", first: true, predicate: ["typeCol"], descendants: true, isSignal: true }, { propertyName: "applicationLinkCol", first: true, predicate: ["applicationLinkCol"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"mt-5\">\r\n <ng-template #typeCol let-row>\r\n @if (row.isExternal) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-external-02\"\r\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\r\n />\r\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\r\n {{ t(\"external\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"internal\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #applicationLinkCol let-row>\r\n @if (isLinkedToCurrentApplication(row)) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.user-check-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"linked\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-broken-01\"\r\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\r\n />\r\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\r\n {{ t(\"not-linked\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"users()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"false\"\r\n [loading]=\"loading()\"\r\n storageKey=\"users-groups-users-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }] });
1931
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Users, isStandalone: true, selector: "mt-users", viewQueries: [{ propertyName: "typeCol", first: true, predicate: ["typeCol"], descendants: true, isSignal: true }, { propertyName: "applicationLinkCol", first: true, predicate: ["applicationLinkCol"], descendants: true, isSignal: true }, { propertyName: "emailCol", first: true, predicate: ["emailCol"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <!-- mt-table wraps row actions; a locked row has five, so keep them on one line. -->\r\n <div class=\"mt-5 [&_.mt-actions-column>div]:flex-nowrap\">\r\n <ng-template #typeCol let-row>\r\n @if (row.isExternal) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-external-02\"\r\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\r\n />\r\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\r\n {{ t(\"external\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"internal\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #applicationLinkCol let-row>\r\n @if (isLinkedToCurrentApplication(row)) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.user-check-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"linked\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-broken-01\"\r\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\r\n />\r\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\r\n {{ t(\"not-linked\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #emailCol let-row>\r\n <span\r\n class=\"block max-w-64 truncate\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >{{ row.email }}</span\r\n >\r\n </ng-template>\r\n\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"users()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"false\"\r\n [loading]=\"loading()\"\r\n storageKey=\"users-groups-users-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "directive", type: TruncateTooltip, selector: "[mtTruncateTooltip]" }] });
1526
1932
  }
1527
1933
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Users, decorators: [{
1528
1934
  type: Component,
1529
- args: [{ selector: 'mt-users', standalone: true, imports: [CommonModule, SkeletonModule, Table, Icon, TranslocoDirective], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"mt-5\">\r\n <ng-template #typeCol let-row>\r\n @if (row.isExternal) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-external-02\"\r\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\r\n />\r\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\r\n {{ t(\"external\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"internal\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #applicationLinkCol let-row>\r\n @if (isLinkedToCurrentApplication(row)) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.user-check-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"linked\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-broken-01\"\r\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\r\n />\r\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\r\n {{ t(\"not-linked\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"users()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"false\"\r\n [loading]=\"loading()\"\r\n storageKey=\"users-groups-users-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n" }]
1530
- }], propDecorators: { typeCol: [{ type: i0.ViewChild, args: ['typeCol', { isSignal: true }] }], applicationLinkCol: [{ type: i0.ViewChild, args: ['applicationLinkCol', { isSignal: true }] }] } });
1935
+ args: [{ selector: 'mt-users', standalone: true, imports: [
1936
+ CommonModule,
1937
+ SkeletonModule,
1938
+ Table,
1939
+ Icon,
1940
+ TranslocoDirective,
1941
+ TruncateTooltip,
1942
+ ], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <!-- mt-table wraps row actions; a locked row has five, so keep them on one line. -->\r\n <div class=\"mt-5 [&_.mt-actions-column>div]:flex-nowrap\">\r\n <ng-template #typeCol let-row>\r\n @if (row.isExternal) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-external-02\"\r\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\r\n />\r\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\r\n {{ t(\"external\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"internal\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #applicationLinkCol let-row>\r\n @if (isLinkedToCurrentApplication(row)) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.user-check-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"linked\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-broken-01\"\r\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\r\n />\r\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\r\n {{ t(\"not-linked\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #emailCol let-row>\r\n <span\r\n class=\"block max-w-64 truncate\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >{{ row.email }}</span\r\n >\r\n </ng-template>\r\n\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"users()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"false\"\r\n [loading]=\"loading()\"\r\n storageKey=\"users-groups-users-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n" }]
1943
+ }], propDecorators: { typeCol: [{ type: i0.ViewChild, args: ['typeCol', { isSignal: true }] }], applicationLinkCol: [{ type: i0.ViewChild, args: ['applicationLinkCol', { isSignal: true }] }], emailCol: [{ type: i0.ViewChild, args: ['emailCol', { isSignal: true }] }] } });
1944
+
1945
+ /**
1946
+ * A group's description is a single string on the wire: the backend changed it
1947
+ * from a translatable object to `string` (Pplus5.BE `4abe2647`, Jan 2026) and
1948
+ * returns it untouched. Both languages therefore travel JSON-encoded inside
1949
+ * that string — `{"ar":"…","en":"…"}`, the shape the seeded Administrators
1950
+ * group already uses. Groups saved before this hold plain text.
1951
+ */
1952
+ function parseGroupDescription(value) {
1953
+ const text = value ?? '';
1954
+ const trimmed = text.trim();
1955
+ if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
1956
+ try {
1957
+ const parsed = JSON.parse(trimmed);
1958
+ return { en: parsed.en ?? '', ar: parsed.ar ?? '' };
1959
+ }
1960
+ catch {
1961
+ // Plain text that happens to be wrapped in braces.
1962
+ }
1963
+ }
1964
+ // Plain text has no language of its own; showing it in both fields keeps it
1965
+ // visible whichever language the user reads the group in.
1966
+ return { en: text, ar: text };
1967
+ }
1968
+ /** Both languages empty → `""`, the backend's own default for no description. */
1969
+ function serializeGroupDescription(description) {
1970
+ const en = description?.en?.trim() ?? '';
1971
+ const ar = description?.ar?.trim() ?? '';
1972
+ return en || ar ? JSON.stringify({ ar, en }) : '';
1973
+ }
1531
1974
 
1532
1975
  class GroupForm {
1533
1976
  modal = inject(ModalService);
@@ -1569,9 +2012,15 @@ class GroupForm {
1569
2012
  order: 1,
1570
2013
  },
1571
2014
  new TextareaFieldConfig({
1572
- key: 'description',
1573
- label: this.translocoService.translate('users-groups.description'),
1574
- placeholder: this.translocoService.translate('users-groups.description'),
2015
+ key: 'description.en',
2016
+ label: this.translocoService.translate('users-groups.description-en'),
2017
+ placeholder: this.translocoService.translate('users-groups.description-en'),
2018
+ order: 3,
2019
+ }),
2020
+ new TextareaFieldConfig({
2021
+ key: 'description.ar',
2022
+ label: this.translocoService.translate('users-groups.description-ar'),
2023
+ placeholder: this.translocoService.translate('users-groups.description-ar'),
1575
2024
  order: 3,
1576
2025
  }),
1577
2026
  ],
@@ -1642,8 +2091,12 @@ class GroupForm {
1642
2091
  ngOnInit() {
1643
2092
  if (this.groupForEdit()?.id) {
1644
2093
  this.facade.getGroup(this.groupForEdit()?.id || null).subscribe((_) => {
1645
- if (this.selectedGroup()) {
1646
- this.groupFormControl.patchValue(this.selectedGroup());
2094
+ const group = this.selectedGroup();
2095
+ if (group) {
2096
+ this.groupFormControl.patchValue({
2097
+ ...group,
2098
+ description: parseGroupDescription(group.description),
2099
+ });
1647
2100
  }
1648
2101
  });
1649
2102
  }
@@ -1662,7 +2115,7 @@ class GroupForm {
1662
2115
  const payload = {
1663
2116
  name: this.groupFormControl.value?.name,
1664
2117
  workspace: this.groupFormControl.value?.workspace,
1665
- description: this.groupFormControl.value?.description,
2118
+ description: serializeGroupDescription(this.groupFormControl.value?.description),
1666
2119
  };
1667
2120
  this.facade.updateGroup(this.groupForEdit()?.id, payload).subscribe({
1668
2121
  next: () => {
@@ -1677,7 +2130,7 @@ class GroupForm {
1677
2130
  const payload = {
1678
2131
  name: this.groupFormControl.value?.name,
1679
2132
  workspace: this.groupFormControl.value?.workspace,
1680
- description: this.groupFormControl.value?.description,
2133
+ description: serializeGroupDescription(this.groupFormControl.value?.description),
1681
2134
  };
1682
2135
  this.facade.createGroup(payload).subscribe({
1683
2136
  next: () => {
@@ -1700,7 +2153,7 @@ class GroupForm {
1700
2153
  }
1701
2154
  }
1702
2155
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: GroupForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
1703
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: GroupForm, isStandalone: true, selector: "mt-group-form", inputs: { groupForEdit: { classPropertyName: "groupForEdit", publicName: "groupForEdit", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], viewQueries: [{ propertyName: "userCol", first: true, predicate: ["userCol"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getGroupFormLoading()) {\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"groupFormConfig()\"\r\n [formControl]=\"groupFormControl\"\r\n />\r\n </form>\r\n\r\n @if (groupForEdit()) {\r\n <div class=\"flex gap-3 items-end mt-6 pt-4 border-t-1 border-surface\">\r\n <mt-dynamic-form\r\n class=\"flex-1\"\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n <mt-button\r\n icon=\"general.plus\"\r\n class=\"mb-1\"\r\n variant=\"outlined\"\r\n (click)=\"onAddUser()\"\r\n [disabled]=\"\r\n addUserToGroupLoading() ||\r\n isUserExistInMembers() ||\r\n !internalUserFormControl.value?.userField\r\n \"\r\n />\r\n </div>\r\n\r\n <mt-table\r\n noCard\r\n [data]=\"selectedGroup()?.members || []\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"rowActions()\"\r\n storageKey=\"users-groups-group-members-table\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [loading]=\"addUserToGroupLoading()\"\r\n >\r\n </mt-table>\r\n <ng-template #userCol let-row>\r\n <div class=\"flex items-center gap-2\">\r\n <mt-avatar [icon]=\"'custom.user-pp'\"> </mt-avatar>\r\n {{ row?.displayName }}\r\n </div>\r\n </ng-template>\r\n }\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateGroupLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedGroup() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateGroupLoading()\"\r\n [disabled]=\"!this.groupFormControl.valid || createUpdateGroupLoading()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
2156
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: GroupForm, isStandalone: true, selector: "mt-group-form", inputs: { groupForEdit: { classPropertyName: "groupForEdit", publicName: "groupForEdit", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], viewQueries: [{ propertyName: "userCol", first: true, predicate: ["userCol"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getGroupFormLoading()) {\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"groupFormConfig()\"\r\n [formControl]=\"groupFormControl\"\r\n />\r\n </form>\r\n\r\n @if (groupForEdit()) {\r\n <div class=\"flex gap-3 items-end mt-6 pt-4 border-t-1 border-surface\">\r\n <mt-dynamic-form\r\n class=\"flex-1\"\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n <mt-button\r\n icon=\"general.plus\"\r\n class=\"mb-1\"\r\n variant=\"outlined\"\r\n (click)=\"onAddUser()\"\r\n [disabled]=\"\r\n addUserToGroupLoading() ||\r\n isUserExistInMembers() ||\r\n !internalUserFormControl.value?.userField\r\n \"\r\n />\r\n </div>\r\n\r\n <mt-table\r\n noCard\r\n [data]=\"selectedGroup()?.members || []\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"rowActions()\"\r\n storageKey=\"users-groups-group-members-table\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [loading]=\"addUserToGroupLoading()\"\r\n >\r\n </mt-table>\r\n <ng-template #userCol let-row>\r\n <div class=\"flex items-center gap-2\">\r\n <mt-avatar [icon]=\"'custom.user-pp'\"> </mt-avatar>\r\n {{ row?.displayName }}\r\n </div>\r\n </ng-template>\r\n }\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateGroupLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedGroup() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateGroupLoading()\"\r\n [disabled]=\"!this.groupFormControl.valid || createUpdateGroupLoading()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
1704
2157
  }
1705
2158
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: GroupForm, decorators: [{
1706
2159
  type: Component,
@@ -1717,6 +2170,283 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1717
2170
  ], providers: [DialogService], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getGroupFormLoading()) {\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"groupFormConfig()\"\r\n [formControl]=\"groupFormControl\"\r\n />\r\n </form>\r\n\r\n @if (groupForEdit()) {\r\n <div class=\"flex gap-3 items-end mt-6 pt-4 border-t-1 border-surface\">\r\n <mt-dynamic-form\r\n class=\"flex-1\"\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n <mt-button\r\n icon=\"general.plus\"\r\n class=\"mb-1\"\r\n variant=\"outlined\"\r\n (click)=\"onAddUser()\"\r\n [disabled]=\"\r\n addUserToGroupLoading() ||\r\n isUserExistInMembers() ||\r\n !internalUserFormControl.value?.userField\r\n \"\r\n />\r\n </div>\r\n\r\n <mt-table\r\n noCard\r\n [data]=\"selectedGroup()?.members || []\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"rowActions()\"\r\n storageKey=\"users-groups-group-members-table\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [loading]=\"addUserToGroupLoading()\"\r\n >\r\n </mt-table>\r\n <ng-template #userCol let-row>\r\n <div class=\"flex items-center gap-2\">\r\n <mt-avatar [icon]=\"'custom.user-pp'\"> </mt-avatar>\r\n {{ row?.displayName }}\r\n </div>\r\n </ng-template>\r\n }\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateGroupLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedGroup() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateGroupLoading()\"\r\n [disabled]=\"!this.groupFormControl.valid || createUpdateGroupLoading()\"\r\n />\r\n </div>\r\n</ng-container>\r\n" }]
1718
2171
  }], ctorParameters: () => [], propDecorators: { groupForEdit: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupForEdit", required: false }] }], userCol: [{ type: i0.ViewChild, args: ['userCol', { isSignal: true }] }] } });
1719
2172
 
2173
+ /** Search appears once the list is long enough to need it. */
2174
+ const SEARCH_THRESHOLD = 6;
2175
+ /**
2176
+ * Usage categories the backend emits today, in display order. Anything else
2177
+ * is rendered under its own humanized name after these — the contract says
2178
+ * new values arrive without notice.
2179
+ */
2180
+ const USAGE_CATEGORIES = {
2181
+ Approval: { key: 'approval', icon: 'general.check-verified-01' },
2182
+ Escalation: { key: 'escalation', icon: 'arrow.chevron-up-double' },
2183
+ Notification: { key: 'notification', icon: 'alert.bell-01' },
2184
+ Visibility: { key: 'visibility', icon: 'general.eye' },
2185
+ Navigation: { key: 'navigation', icon: 'map.route' },
2186
+ Workspace: { key: 'workspace', icon: 'layout.layout-grid-01' },
2187
+ AccessControl: { key: 'access-control', icon: 'security.lock-01' },
2188
+ Uncategorized: { key: 'uncategorized', icon: 'layout.layers-three-01' },
2189
+ };
2190
+ const CATEGORY_ORDER = Object.keys(USAGE_CATEGORIES);
2191
+ const USAGE_SOURCES = {
2192
+ ProcessSchema: 'process-schema',
2193
+ EscalationSchema: 'escalation-schema',
2194
+ AlertDefinition: 'alert-definition',
2195
+ NotificationTemplate: 'notification-template',
2196
+ Category: 'category',
2197
+ NavigationItem: 'navigation-item',
2198
+ WorkspaceBuilder: 'workspace-builder',
2199
+ Accessibility: 'accessibility',
2200
+ };
2201
+ const NOTIFICATION_CHANNELS = new Set(['app', 'email', 'sms']);
2202
+ const WARNING_CODES = {
2203
+ NoEffectiveUsers: 'no-effective-users',
2204
+ ScopeUnresolved: 'scope-unresolved',
2205
+ NoNotificationChannels: 'no-notification-channels',
2206
+ };
2207
+ /**
2208
+ * Lifecycle flags carried in `metadata` as `"True"`/`"False"` strings. A
2209
+ * `"False"` value means the referencing definition is not live, which the row
2210
+ * shows instead of implying the reference is in effect.
2211
+ */
2212
+ const INACTIVE_METADATA_FLAGS = {
2213
+ isPublished: 'unpublished',
2214
+ isEnabled: 'disabled',
2215
+ isActive: 'inactive',
2216
+ isVisible: 'hidden',
2217
+ };
2218
+ const IMPACT_KEYS = [
2219
+ 'activeRequestsCount',
2220
+ 'pendingStepsCount',
2221
+ 'activeEscalationsCount',
2222
+ 'pendingEscalationStepsCount',
2223
+ 'activeAlertStatesCount',
2224
+ ];
2225
+ /**
2226
+ * One group's access, opened as a drawer from the groups table: its members,
2227
+ * the permissions assigned to it, its application accessibilities, and the
2228
+ * configuration that references it. `GET identity/groups/{groupId}/summary`
2229
+ * (Pplus5.BE `Docs/Group-Access-Summary-Frontend-Contract.md`).
2230
+ */
2231
+ class GroupAccessSummary {
2232
+ facade = inject(UsersGroupsFacade);
2233
+ translocoService = inject(TranslocoService);
2234
+ /** The groups-table row; renders the header before the summary arrives. */
2235
+ group = input(null, ...(ngDevMode ? [{ debugName: "group" }] : /* istanbul ignore next */ []));
2236
+ context = new HttpContext().set(REQUEST_CONTEXT, {
2237
+ useBaseUrl: true,
2238
+ });
2239
+ loading = this.facade.isLoadingGroupSummary;
2240
+ error = this.facade.groupSummaryError;
2241
+ summary = this.facade.groupSummary;
2242
+ lang = toSignal(this.translocoService.langChanges$, {
2243
+ initialValue: this.translocoService.getActiveLang(),
2244
+ });
2245
+ activeTab = signal('members', ...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
2246
+ memberSearch = new FormControl('', { nonNullable: true });
2247
+ memberSearchTerm = toSignal(this.memberSearch.valueChanges, {
2248
+ initialValue: '',
2249
+ });
2250
+ usageSearch = new FormControl('', { nonNullable: true });
2251
+ usageSearchTerm = toSignal(this.usageSearch.valueChanges, {
2252
+ initialValue: '',
2253
+ });
2254
+ header = computed(() => {
2255
+ const lang = this.lang();
2256
+ const group = this.summary()?.group ?? this.group();
2257
+ return {
2258
+ name: resolveTranslated(group?.name, lang),
2259
+ description: resolveTranslated(group?.description, lang),
2260
+ isActivated: !!group?.isActivated,
2261
+ };
2262
+ }, ...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
2263
+ members = computed(() => {
2264
+ this.lang();
2265
+ return (this.summary()?.members ?? []).map((member) => {
2266
+ const flags = [];
2267
+ if (member.isDeleted) {
2268
+ flags.push({ label: this.t('member-deleted'), tone: 'danger' });
2269
+ }
2270
+ else if (member.isActive === false) {
2271
+ flags.push({ label: this.t('inactive'), tone: 'neutral' });
2272
+ }
2273
+ if (!member.isLinkedToCurrentApplication) {
2274
+ flags.push({ label: this.t('not-linked'), tone: 'warn' });
2275
+ }
2276
+ return {
2277
+ id: member.id,
2278
+ displayName: member.displayName || member.fullName || member.userName || '',
2279
+ userName: member.userName ?? '',
2280
+ email: member.email ?? '',
2281
+ photo: member.photoUrl ?? '',
2282
+ flags,
2283
+ };
2284
+ });
2285
+ }, ...(ngDevMode ? [{ debugName: "members" }] : /* istanbul ignore next */ []));
2286
+ filteredMembers = computed(() => {
2287
+ const term = this.memberSearchTerm();
2288
+ return this.members().filter((member) => matchesSearch(term, member.displayName, member.userName, member.email));
2289
+ }, ...(ngDevMode ? [{ debugName: "filteredMembers" }] : /* istanbul ignore next */ []));
2290
+ showMemberSearch = computed(() => this.members().length > SEARCH_THRESHOLD, ...(ngDevMode ? [{ debugName: "showMemberSearch" }] : /* istanbul ignore next */ []));
2291
+ permissionTree = computed(() => buildPermissionTree(this.summary()?.permissions ?? [], this.lang(), {
2292
+ otherModules: this.t('other-modules'),
2293
+ unknownScope: this.t('unknown-scope'),
2294
+ }), ...(ngDevMode ? [{ debugName: "permissionTree" }] : /* istanbul ignore next */ []));
2295
+ accessibilities = computed(() => this.summary()?.accessibilities ?? [], ...(ngDevMode ? [{ debugName: "accessibilities" }] : /* istanbul ignore next */ []));
2296
+ usageCategories = computed(() => {
2297
+ const lang = this.lang();
2298
+ const categories = new Map();
2299
+ (this.summary()?.usageSummary?.items ?? []).forEach((usage, index) => {
2300
+ const key = usage.usageCategory || 'Uncategorized';
2301
+ let category = categories.get(key);
2302
+ if (!category) {
2303
+ const known = USAGE_CATEGORIES[key];
2304
+ category = {
2305
+ key,
2306
+ label: known ? this.t(`usage-category.${known.key}`) : humanize(key),
2307
+ icon: known?.icon ?? 'layout.layers-three-01',
2308
+ items: [],
2309
+ };
2310
+ categories.set(key, category);
2311
+ }
2312
+ category.items.push(this.toUsageView(usage, index, lang));
2313
+ });
2314
+ return [...categories.values()].sort((a, b) => categoryRank(a.key) - categoryRank(b.key));
2315
+ }, ...(ngDevMode ? [{ debugName: "usageCategories" }] : /* istanbul ignore next */ []));
2316
+ filteredUsageCategories = computed(() => {
2317
+ const term = this.usageSearchTerm();
2318
+ if (!term.trim())
2319
+ return this.usageCategories();
2320
+ return this.usageCategories()
2321
+ .map((category) => ({
2322
+ ...category,
2323
+ items: category.items.filter((usage) => matchesSearch(term, usage.title, usage.stepName, usage.scopeLabel, usage.sourceLabel, category.label)),
2324
+ }))
2325
+ .filter((category) => category.items.length > 0);
2326
+ }, ...(ngDevMode ? [{ debugName: "filteredUsageCategories" }] : /* istanbul ignore next */ []));
2327
+ usageCount = computed(() => this.summary()?.usageSummary?.items?.length ?? 0, ...(ngDevMode ? [{ debugName: "usageCount" }] : /* istanbul ignore next */ []));
2328
+ showUsageSearch = computed(() => this.usageCount() > SEARCH_THRESHOLD, ...(ngDevMode ? [{ debugName: "showUsageSearch" }] : /* istanbul ignore next */ []));
2329
+ /** Configuration references that make deleting/disabling the group risky. */
2330
+ blockingCount = computed(() => this.summary()?.usageSummary?.blockingUsagesCount ?? 0, ...(ngDevMode ? [{ debugName: "blockingCount" }] : /* istanbul ignore next */ []));
2331
+ impactTiles = computed(() => {
2332
+ this.lang();
2333
+ const impact = this.summary()?.usageSummary?.runtimeImpact;
2334
+ if (!impact)
2335
+ return [];
2336
+ const tiles = IMPACT_KEYS.map((key) => ({
2337
+ key,
2338
+ label: this.t(`impact.${key}`),
2339
+ value: impact[key],
2340
+ }));
2341
+ return tiles.some((tile) => tile.value > 0) ? tiles : [];
2342
+ }, ...(ngDevMode ? [{ debugName: "impactTiles" }] : /* istanbul ignore next */ []));
2343
+ tabs = computed(() => {
2344
+ this.lang();
2345
+ const summary = this.summary();
2346
+ const count = (value) => (summary ? value : null);
2347
+ return [
2348
+ {
2349
+ label: this.t('members'),
2350
+ value: 'members',
2351
+ icon: 'user.users-01',
2352
+ badge: count(this.members().length),
2353
+ },
2354
+ {
2355
+ label: this.t('permissions'),
2356
+ value: 'permissions',
2357
+ icon: 'security.shield-tick',
2358
+ badge: count(summary?.permissions?.length ?? 0),
2359
+ },
2360
+ {
2361
+ label: this.t('accessibilities'),
2362
+ value: 'accessibilities',
2363
+ icon: 'security.lock-unlocked-01',
2364
+ badge: count(this.accessibilities().length),
2365
+ },
2366
+ {
2367
+ label: this.t('usages'),
2368
+ value: 'usages',
2369
+ icon: 'layout.layers-three-01',
2370
+ badge: count(this.usageCount()),
2371
+ },
2372
+ ];
2373
+ }, ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
2374
+ ngOnInit() {
2375
+ this.load();
2376
+ }
2377
+ load() {
2378
+ const groupId = this.group()?.id;
2379
+ if (groupId === undefined || groupId === null)
2380
+ return;
2381
+ // The failure is rendered from the store's error slice.
2382
+ this.facade.getGroupSummary(groupId).subscribe({ error: () => undefined });
2383
+ }
2384
+ toUsageView(usage, index, lang) {
2385
+ const sourceKey = USAGE_SOURCES[usage.source];
2386
+ const scopes = [usage.scope, ...(usage.relatedScopes ?? [])].filter((scope) => !!scope);
2387
+ return {
2388
+ id: `${usage.source}-${usage.usageType}-${usage.sourceId}-${usage.stepId}-${index}`,
2389
+ title: resolveTranslated(usage.sourceName, lang) ||
2390
+ (usage.sourceId !== null ? `#${usage.sourceId}` : ''),
2391
+ sourceLabel: sourceKey
2392
+ ? this.t(`usage-source.${sourceKey}`)
2393
+ : humanize(usage.source),
2394
+ stepName: resolveTranslated(usage.stepName, lang),
2395
+ scopeLabel: [...new Set(scopes.map((scope) => scopeLabel(scope, lang)))]
2396
+ .filter(Boolean)
2397
+ .join(', '),
2398
+ channels: (usage.channels ?? []).map((channel) => NOTIFICATION_CHANNELS.has(channel)
2399
+ ? this.t(`channel.${channel}`)
2400
+ : channel),
2401
+ states: Object.entries(INACTIVE_METADATA_FLAGS)
2402
+ .filter(([flag]) => usage.metadata?.[flag]?.toLowerCase() === 'false')
2403
+ .map(([, key]) => this.t(`usage-state.${key}`)),
2404
+ warnings: (usage.warnings ?? []).map((warning) => WARNING_CODES[warning.code]
2405
+ ? this.t(`usage-warning.${WARNING_CODES[warning.code]}`)
2406
+ : warning.message),
2407
+ impact: IMPACT_KEYS.filter((key) => (usage.runtimeImpact?.[key] ?? 0) > 0).map((key) => `${usage.runtimeImpact[key]} ${this.t(`impact.${key}`)}`),
2408
+ };
2409
+ }
2410
+ t(key) {
2411
+ return this.translocoService.translate(`users-groups.${key}`);
2412
+ }
2413
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: GroupAccessSummary, deps: [], target: i0.ɵɵFactoryTarget.Component });
2414
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: GroupAccessSummary, isStandalone: true, selector: "mt-group-access-summary", inputs: { group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex h-full min-h-0 flex-col" }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <!-- Which group \u2014 rendered from the table row, so it never waits on the request. -->\r\n <div class=\"min-h-0 flex-1 overflow-y-auto\">\r\n <section class=\"flex items-center gap-3 border-b border-surface p-4\">\r\n <mt-avatar\r\n icon=\"user.users-01\"\r\n size=\"large\"\r\n shape=\"square\"\r\n styleClass=\"bg-primary-50! text-primary!\"\r\n />\r\n\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n <div class=\"flex min-w-0 flex-wrap items-center gap-2\">\r\n <h2\r\n class=\"min-w-0 truncate text-base font-semibold text-color\"\r\n [title]=\"header().name\"\r\n >\r\n {{ header().name }}\r\n </h2>\r\n @if (header().isActivated) {\r\n <mt-summary-pill tone=\"success\">{{ t(\"active\") }}</mt-summary-pill>\r\n } @else {\r\n <mt-summary-pill tone=\"neutral\">{{\r\n t(\"inactive\")\r\n }}</mt-summary-pill>\r\n }\r\n </div>\r\n\r\n @if (header().description) {\r\n <p\r\n class=\"line-clamp-2 text-sm text-muted-color\"\r\n [title]=\"header().description\"\r\n >\r\n {{ header().description }}\r\n </p>\r\n }\r\n </div>\r\n </section>\r\n\r\n <div class=\"sticky top-0 z-10 bg-content px-4 pt-2\">\r\n <mt-tabs [options]=\"tabs()\" [(active)]=\"activeTab\" mode=\"underline\" />\r\n </div>\r\n\r\n <div class=\"p-4\">\r\n @if (loading()) {\r\n <div class=\"flex flex-col gap-3\">\r\n @for (row of [1, 2, 3, 4]; track row) {\r\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n } @else if (error()) {\r\n <div\r\n class=\"flex flex-col items-start gap-3 rounded-md border border-rose-200 bg-rose-50 p-4 dark:border-rose-800 dark:bg-rose-900/30\"\r\n role=\"alert\"\r\n >\r\n <div class=\"flex flex-col gap-1\">\r\n <span\r\n class=\"text-sm font-semibold text-rose-700 dark:text-rose-200\"\r\n >\r\n {{ t(\"summary-load-failed\") }}\r\n </span>\r\n <span class=\"text-sm text-rose-600 dark:text-rose-300\">\r\n {{ t(\"summary-load-failed-hint\") }}\r\n </span>\r\n </div>\r\n <mt-button\r\n icon=\"arrow.refresh-cw-02\"\r\n severity=\"danger\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [label]=\"t('try-again')\"\r\n (onClick)=\"load()\"\r\n />\r\n </div>\r\n } @else {\r\n @switch (activeTab()) {\r\n @case (\"members\") {\r\n @if (members().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-members')\"\r\n [description]=\"t('group-members-hint')\"\r\n />\r\n } @else {\r\n <div class=\"flex flex-col gap-3\">\r\n @if (showMemberSearch()) {\r\n <mt-text-field\r\n [formControl]=\"memberSearch\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-members')\"\r\n />\r\n }\r\n <ul class=\"rounded-md border border-surface\">\r\n @for (member of filteredMembers(); track member.id) {\r\n <li\r\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\r\n >\r\n <mt-avatar\r\n [image]=\"\r\n member.photo\r\n ? $any(\r\n member.photo\r\n | secureImage: true : context : 'avatar/'\r\n )\r\n : ''\r\n \"\r\n icon=\"user.user-01\"\r\n styleClass=\"text-surface-600! bg-surface-200!\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 flex-col\">\r\n <span\r\n class=\"truncate text-sm font-medium text-color\"\r\n [title]=\"member.displayName\"\r\n >\r\n {{ member.displayName }}\r\n </span>\r\n @if (member.email || member.userName) {\r\n <span\r\n class=\"truncate text-xs text-muted-color\"\r\n [title]=\"member.email || member.userName\"\r\n >\r\n {{ member.email || member.userName }}\r\n </span>\r\n }\r\n </div>\r\n @for (flag of member.flags; track flag.label) {\r\n <mt-summary-pill [tone]=\"flag.tone\">\r\n {{ flag.label }}\r\n </mt-summary-pill>\r\n }\r\n </li>\r\n } @empty {\r\n <li>\r\n <mt-empty-state\r\n variant=\"filtered\"\r\n illustration=\"none\"\r\n [title]=\"t('no-search-results')\"\r\n />\r\n </li>\r\n }\r\n </ul>\r\n </div>\r\n }\r\n }\r\n\r\n @case (\"permissions\") {\r\n @if (permissionTree().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('group-no-permissions')\"\r\n [description]=\"t('group-permissions-hint')\"\r\n />\r\n } @else {\r\n <mt-tree\r\n class=\"block\"\r\n [value]=\"permissionTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-permissions')\"\r\n />\r\n }\r\n }\r\n\r\n @case (\"accessibilities\") {\r\n <mt-summary-accessibilities\r\n [accessibilities]=\"accessibilities()\"\r\n [emptyMessage]=\"t('group-no-accessibilities')\"\r\n />\r\n }\r\n\r\n @case (\"usages\") {\r\n @if (usageCount() === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-usages')\"\r\n [description]=\"t('usages-coverage')\"\r\n />\r\n } @else {\r\n <div class=\"flex flex-col gap-4\">\r\n @if (blockingCount() > 0) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900/30 dark:text-amber-200\"\r\n role=\"status\"\r\n >\r\n <mt-icon\r\n icon=\"alert.alert-triangle\"\r\n class=\"mt-0.5 shrink-0 text-base\"\r\n />\r\n <span>\r\n {{\r\n t(\"usages-blocking-note\", { count: blockingCount() })\r\n }}\r\n </span>\r\n </div>\r\n }\r\n\r\n @if (impactTiles().length) {\r\n <section class=\"flex flex-col gap-2\">\r\n <div class=\"flex flex-col\">\r\n <span class=\"text-sm font-semibold text-color\">\r\n {{ t(\"runtime-impact\") }}\r\n </span>\r\n <span class=\"text-xs text-muted-color\">\r\n {{ t(\"runtime-impact-hint\") }}\r\n </span>\r\n </div>\r\n <div class=\"grid grid-cols-2 gap-2 sm:grid-cols-3\">\r\n @for (tile of impactTiles(); track tile.key) {\r\n <div\r\n class=\"flex flex-col gap-0.5 rounded-md border border-surface bg-surface-50 px-3 py-2 dark:bg-surface-800\"\r\n >\r\n <span\r\n class=\"text-lg font-semibold text-color tabular-nums\"\r\n >\r\n {{ tile.value }}\r\n </span>\r\n <span class=\"text-xs text-muted-color\">\r\n {{ tile.label }}\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n </section>\r\n }\r\n\r\n @if (showUsageSearch()) {\r\n <mt-text-field\r\n [formControl]=\"usageSearch\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-usages')\"\r\n />\r\n }\r\n\r\n @for (\r\n category of filteredUsageCategories();\r\n track category.key\r\n ) {\r\n <section class=\"rounded-md border border-surface\">\r\n <header\r\n class=\"flex items-center justify-between gap-2 rounded-t-md border-b border-surface bg-surface-50 px-3 py-2 dark:bg-surface-800\"\r\n >\r\n <span\r\n class=\"inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-color\"\r\n >\r\n <mt-icon\r\n [icon]=\"category.icon\"\r\n class=\"shrink-0 text-base text-primary\"\r\n />\r\n <span class=\"truncate\">{{ category.label }}</span>\r\n </span>\r\n <span class=\"shrink-0 text-xs text-muted-color\">\r\n {{ category.items.length }}\r\n </span>\r\n </header>\r\n\r\n <ul>\r\n @for (usage of category.items; track usage.id) {\r\n <li\r\n class=\"flex flex-col gap-1.5 border-b border-surface px-3 py-2.5 last:border-b-0\"\r\n >\r\n <div class=\"flex min-w-0 items-start gap-2\">\r\n <div class=\"flex min-w-0 flex-1 flex-col\">\r\n <span\r\n class=\"truncate text-sm font-medium text-color\"\r\n [title]=\"usage.title\"\r\n >\r\n {{ usage.title }}\r\n </span>\r\n <span class=\"truncate text-xs text-muted-color\">\r\n {{ usage.sourceLabel }}\r\n @if (usage.stepName) {\r\n \u00B7 {{ t(\"step\") }}: {{ usage.stepName }}\r\n }\r\n </span>\r\n </div>\r\n @for (state of usage.states; track state) {\r\n <mt-summary-pill tone=\"warn\">\r\n {{ state }}\r\n </mt-summary-pill>\r\n }\r\n </div>\r\n\r\n @if (usage.scopeLabel || usage.channels.length) {\r\n <div class=\"flex flex-wrap items-center gap-1.5\">\r\n @if (usage.scopeLabel) {\r\n <span\r\n class=\"inline-flex min-w-0 items-center gap-1 text-xs text-muted-color\"\r\n >\r\n <mt-icon\r\n icon=\"custom.hierarchy-structure\"\r\n class=\"shrink-0 text-sm\"\r\n />\r\n <span\r\n class=\"truncate\"\r\n [title]=\"usage.scopeLabel\"\r\n >\r\n {{ usage.scopeLabel }}\r\n </span>\r\n </span>\r\n }\r\n @for (channel of usage.channels; track channel) {\r\n <mt-summary-pill tone=\"info\">\r\n {{ channel }}\r\n </mt-summary-pill>\r\n }\r\n </div>\r\n }\r\n\r\n @if (usage.impact.length) {\r\n <span class=\"text-xs text-muted-color\">\r\n {{ usage.impact.join(\" \u00B7 \") }}\r\n </span>\r\n }\r\n\r\n @for (warning of usage.warnings; track $index) {\r\n <span\r\n class=\"inline-flex items-start gap-1 text-xs text-amber-700 dark:text-amber-300\"\r\n >\r\n <mt-icon\r\n icon=\"alert.alert-triangle\"\r\n class=\"mt-px shrink-0 text-sm\"\r\n />\r\n {{ warning }}\r\n </span>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </section>\r\n } @empty {\r\n <mt-empty-state\r\n variant=\"filtered\"\r\n illustration=\"none\"\r\n [title]=\"t('no-search-results')\"\r\n />\r\n }\r\n </div>\r\n }\r\n }\r\n }\r\n }\r\n </div>\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: Tree, selector: "mt-tree", inputs: ["value", "selection", "selectionMode", "nodeIcon", "propagateSelectionUp", "propagateSelectionDown", "checkAllChildren", "loading", "emptyMessage", "checkAllLabel", "filterPlaceholder", "dataKey", "filter", "filterMode", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "styleClass", "style", "pInputs", "nodeActions", "nodeContextmenuActions", "contextMenuSelection"], outputs: ["selectionChange", "contextMenuSelectionChange", "action"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: SummaryAccessibilities, selector: "mt-summary-accessibilities", inputs: ["accessibilities", "emptyMessage"] }, { kind: "component", type: SummaryPill, selector: "mt-summary-pill", inputs: ["tone"] }, { kind: "pipe", type: SecureImagePipe, name: "secureImage" }] });
2415
+ }
2416
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: GroupAccessSummary, decorators: [{
2417
+ type: Component,
2418
+ args: [{ selector: 'mt-group-access-summary', standalone: true, host: { class: 'flex h-full min-h-0 flex-col' }, imports: [
2419
+ TranslocoDirective,
2420
+ ReactiveFormsModule,
2421
+ SkeletonModule,
2422
+ Icon,
2423
+ Tabs,
2424
+ Tree,
2425
+ Avatar,
2426
+ Button,
2427
+ TextField,
2428
+ EmptyState,
2429
+ SecureImagePipe,
2430
+ SummaryAccessibilities,
2431
+ SummaryPill,
2432
+ ], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <!-- Which group \u2014 rendered from the table row, so it never waits on the request. -->\r\n <div class=\"min-h-0 flex-1 overflow-y-auto\">\r\n <section class=\"flex items-center gap-3 border-b border-surface p-4\">\r\n <mt-avatar\r\n icon=\"user.users-01\"\r\n size=\"large\"\r\n shape=\"square\"\r\n styleClass=\"bg-primary-50! text-primary!\"\r\n />\r\n\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n <div class=\"flex min-w-0 flex-wrap items-center gap-2\">\r\n <h2\r\n class=\"min-w-0 truncate text-base font-semibold text-color\"\r\n [title]=\"header().name\"\r\n >\r\n {{ header().name }}\r\n </h2>\r\n @if (header().isActivated) {\r\n <mt-summary-pill tone=\"success\">{{ t(\"active\") }}</mt-summary-pill>\r\n } @else {\r\n <mt-summary-pill tone=\"neutral\">{{\r\n t(\"inactive\")\r\n }}</mt-summary-pill>\r\n }\r\n </div>\r\n\r\n @if (header().description) {\r\n <p\r\n class=\"line-clamp-2 text-sm text-muted-color\"\r\n [title]=\"header().description\"\r\n >\r\n {{ header().description }}\r\n </p>\r\n }\r\n </div>\r\n </section>\r\n\r\n <div class=\"sticky top-0 z-10 bg-content px-4 pt-2\">\r\n <mt-tabs [options]=\"tabs()\" [(active)]=\"activeTab\" mode=\"underline\" />\r\n </div>\r\n\r\n <div class=\"p-4\">\r\n @if (loading()) {\r\n <div class=\"flex flex-col gap-3\">\r\n @for (row of [1, 2, 3, 4]; track row) {\r\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n } @else if (error()) {\r\n <div\r\n class=\"flex flex-col items-start gap-3 rounded-md border border-rose-200 bg-rose-50 p-4 dark:border-rose-800 dark:bg-rose-900/30\"\r\n role=\"alert\"\r\n >\r\n <div class=\"flex flex-col gap-1\">\r\n <span\r\n class=\"text-sm font-semibold text-rose-700 dark:text-rose-200\"\r\n >\r\n {{ t(\"summary-load-failed\") }}\r\n </span>\r\n <span class=\"text-sm text-rose-600 dark:text-rose-300\">\r\n {{ t(\"summary-load-failed-hint\") }}\r\n </span>\r\n </div>\r\n <mt-button\r\n icon=\"arrow.refresh-cw-02\"\r\n severity=\"danger\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [label]=\"t('try-again')\"\r\n (onClick)=\"load()\"\r\n />\r\n </div>\r\n } @else {\r\n @switch (activeTab()) {\r\n @case (\"members\") {\r\n @if (members().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-members')\"\r\n [description]=\"t('group-members-hint')\"\r\n />\r\n } @else {\r\n <div class=\"flex flex-col gap-3\">\r\n @if (showMemberSearch()) {\r\n <mt-text-field\r\n [formControl]=\"memberSearch\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-members')\"\r\n />\r\n }\r\n <ul class=\"rounded-md border border-surface\">\r\n @for (member of filteredMembers(); track member.id) {\r\n <li\r\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\r\n >\r\n <mt-avatar\r\n [image]=\"\r\n member.photo\r\n ? $any(\r\n member.photo\r\n | secureImage: true : context : 'avatar/'\r\n )\r\n : ''\r\n \"\r\n icon=\"user.user-01\"\r\n styleClass=\"text-surface-600! bg-surface-200!\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 flex-col\">\r\n <span\r\n class=\"truncate text-sm font-medium text-color\"\r\n [title]=\"member.displayName\"\r\n >\r\n {{ member.displayName }}\r\n </span>\r\n @if (member.email || member.userName) {\r\n <span\r\n class=\"truncate text-xs text-muted-color\"\r\n [title]=\"member.email || member.userName\"\r\n >\r\n {{ member.email || member.userName }}\r\n </span>\r\n }\r\n </div>\r\n @for (flag of member.flags; track flag.label) {\r\n <mt-summary-pill [tone]=\"flag.tone\">\r\n {{ flag.label }}\r\n </mt-summary-pill>\r\n }\r\n </li>\r\n } @empty {\r\n <li>\r\n <mt-empty-state\r\n variant=\"filtered\"\r\n illustration=\"none\"\r\n [title]=\"t('no-search-results')\"\r\n />\r\n </li>\r\n }\r\n </ul>\r\n </div>\r\n }\r\n }\r\n\r\n @case (\"permissions\") {\r\n @if (permissionTree().length === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('group-no-permissions')\"\r\n [description]=\"t('group-permissions-hint')\"\r\n />\r\n } @else {\r\n <mt-tree\r\n class=\"block\"\r\n [value]=\"permissionTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-permissions')\"\r\n />\r\n }\r\n }\r\n\r\n @case (\"accessibilities\") {\r\n <mt-summary-accessibilities\r\n [accessibilities]=\"accessibilities()\"\r\n [emptyMessage]=\"t('group-no-accessibilities')\"\r\n />\r\n }\r\n\r\n @case (\"usages\") {\r\n @if (usageCount() === 0) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-usages')\"\r\n [description]=\"t('usages-coverage')\"\r\n />\r\n } @else {\r\n <div class=\"flex flex-col gap-4\">\r\n @if (blockingCount() > 0) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900/30 dark:text-amber-200\"\r\n role=\"status\"\r\n >\r\n <mt-icon\r\n icon=\"alert.alert-triangle\"\r\n class=\"mt-0.5 shrink-0 text-base\"\r\n />\r\n <span>\r\n {{\r\n t(\"usages-blocking-note\", { count: blockingCount() })\r\n }}\r\n </span>\r\n </div>\r\n }\r\n\r\n @if (impactTiles().length) {\r\n <section class=\"flex flex-col gap-2\">\r\n <div class=\"flex flex-col\">\r\n <span class=\"text-sm font-semibold text-color\">\r\n {{ t(\"runtime-impact\") }}\r\n </span>\r\n <span class=\"text-xs text-muted-color\">\r\n {{ t(\"runtime-impact-hint\") }}\r\n </span>\r\n </div>\r\n <div class=\"grid grid-cols-2 gap-2 sm:grid-cols-3\">\r\n @for (tile of impactTiles(); track tile.key) {\r\n <div\r\n class=\"flex flex-col gap-0.5 rounded-md border border-surface bg-surface-50 px-3 py-2 dark:bg-surface-800\"\r\n >\r\n <span\r\n class=\"text-lg font-semibold text-color tabular-nums\"\r\n >\r\n {{ tile.value }}\r\n </span>\r\n <span class=\"text-xs text-muted-color\">\r\n {{ tile.label }}\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n </section>\r\n }\r\n\r\n @if (showUsageSearch()) {\r\n <mt-text-field\r\n [formControl]=\"usageSearch\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-usages')\"\r\n />\r\n }\r\n\r\n @for (\r\n category of filteredUsageCategories();\r\n track category.key\r\n ) {\r\n <section class=\"rounded-md border border-surface\">\r\n <header\r\n class=\"flex items-center justify-between gap-2 rounded-t-md border-b border-surface bg-surface-50 px-3 py-2 dark:bg-surface-800\"\r\n >\r\n <span\r\n class=\"inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-color\"\r\n >\r\n <mt-icon\r\n [icon]=\"category.icon\"\r\n class=\"shrink-0 text-base text-primary\"\r\n />\r\n <span class=\"truncate\">{{ category.label }}</span>\r\n </span>\r\n <span class=\"shrink-0 text-xs text-muted-color\">\r\n {{ category.items.length }}\r\n </span>\r\n </header>\r\n\r\n <ul>\r\n @for (usage of category.items; track usage.id) {\r\n <li\r\n class=\"flex flex-col gap-1.5 border-b border-surface px-3 py-2.5 last:border-b-0\"\r\n >\r\n <div class=\"flex min-w-0 items-start gap-2\">\r\n <div class=\"flex min-w-0 flex-1 flex-col\">\r\n <span\r\n class=\"truncate text-sm font-medium text-color\"\r\n [title]=\"usage.title\"\r\n >\r\n {{ usage.title }}\r\n </span>\r\n <span class=\"truncate text-xs text-muted-color\">\r\n {{ usage.sourceLabel }}\r\n @if (usage.stepName) {\r\n \u00B7 {{ t(\"step\") }}: {{ usage.stepName }}\r\n }\r\n </span>\r\n </div>\r\n @for (state of usage.states; track state) {\r\n <mt-summary-pill tone=\"warn\">\r\n {{ state }}\r\n </mt-summary-pill>\r\n }\r\n </div>\r\n\r\n @if (usage.scopeLabel || usage.channels.length) {\r\n <div class=\"flex flex-wrap items-center gap-1.5\">\r\n @if (usage.scopeLabel) {\r\n <span\r\n class=\"inline-flex min-w-0 items-center gap-1 text-xs text-muted-color\"\r\n >\r\n <mt-icon\r\n icon=\"custom.hierarchy-structure\"\r\n class=\"shrink-0 text-sm\"\r\n />\r\n <span\r\n class=\"truncate\"\r\n [title]=\"usage.scopeLabel\"\r\n >\r\n {{ usage.scopeLabel }}\r\n </span>\r\n </span>\r\n }\r\n @for (channel of usage.channels; track channel) {\r\n <mt-summary-pill tone=\"info\">\r\n {{ channel }}\r\n </mt-summary-pill>\r\n }\r\n </div>\r\n }\r\n\r\n @if (usage.impact.length) {\r\n <span class=\"text-xs text-muted-color\">\r\n {{ usage.impact.join(\" \u00B7 \") }}\r\n </span>\r\n }\r\n\r\n @for (warning of usage.warnings; track $index) {\r\n <span\r\n class=\"inline-flex items-start gap-1 text-xs text-amber-700 dark:text-amber-300\"\r\n >\r\n <mt-icon\r\n icon=\"alert.alert-triangle\"\r\n class=\"mt-px shrink-0 text-sm\"\r\n />\r\n {{ warning }}\r\n </span>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n </section>\r\n } @empty {\r\n <mt-empty-state\r\n variant=\"filtered\"\r\n illustration=\"none\"\r\n [title]=\"t('no-search-results')\"\r\n />\r\n }\r\n </div>\r\n }\r\n }\r\n }\r\n }\r\n </div>\r\n </div>\r\n</ng-container>\r\n" }]
2433
+ }], propDecorators: { group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: false }] }] } });
2434
+ function scopeLabel(scope, lang) {
2435
+ const template = resolveTranslated(scope.level?.templateName, lang);
2436
+ const name = resolveTranslated(scope.displayName, lang);
2437
+ return template && template !== name
2438
+ ? `${template} › ${name}`
2439
+ : name || template;
2440
+ }
2441
+ function categoryRank(key) {
2442
+ const index = CATEGORY_ORDER.indexOf(key);
2443
+ return index === -1 ? CATEGORY_ORDER.length : index;
2444
+ }
2445
+ /** `NotificationTemplate` → `Notification Template`, for values we do not know yet. */
2446
+ function humanize(value) {
2447
+ return value.replace(/([a-z])([A-Z])/g, '$1 $2').trim();
2448
+ }
2449
+
1720
2450
  class Groups {
1721
2451
  facade = inject(UsersGroupsFacade);
1722
2452
  modal = inject(ModalService);
@@ -1734,6 +2464,14 @@ class Groups {
1734
2464
  ], ...(ngDevMode ? [{ debugName: "tableActions" }] : /* istanbul ignore next */ []));
1735
2465
  deletingRowIds = signal([], ...(ngDevMode ? [{ debugName: "deletingRowIds" }] : /* istanbul ignore next */ []));
1736
2466
  rowActions = signal([
2467
+ {
2468
+ icon: 'general.eye',
2469
+ tooltip: this.translocoService.translate('users-groups.group-summary'),
2470
+ color: 'secondary',
2471
+ action: (row) => {
2472
+ this.openAccessSummary(row);
2473
+ },
2474
+ },
1737
2475
  {
1738
2476
  icon: 'custom.pencil',
1739
2477
  tooltip: this.translocoService.translate('edit'),
@@ -1800,8 +2538,21 @@ class Groups {
1800
2538
  },
1801
2539
  });
1802
2540
  }
2541
+ openAccessSummary(group) {
2542
+ this.modal.openModal(GroupAccessSummary, 'drawer', {
2543
+ header: this.translocoService.translate('users-groups.group-summary'),
2544
+ styleClass: ACCESS_SUMMARY_DRAWER_CLASS,
2545
+ position: 'end',
2546
+ appendTo: 'page-content',
2547
+ dismissableMask: true,
2548
+ dismissible: true,
2549
+ inputValues: {
2550
+ group,
2551
+ },
2552
+ });
2553
+ }
1803
2554
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Groups, deps: [], target: i0.ɵɵFactoryTarget.Component });
1804
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.8", type: Groups, isStandalone: true, selector: "mt-groups", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"mt-5\">\r\n <mt-table\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"allGroups()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"false\"\r\n [loading]=\"loading()\"\r\n storageKey=\"users-groups-groups-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n", styles: [".groups{padding:2rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }] });
2555
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.8", type: Groups, isStandalone: true, selector: "mt-groups", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"mt-5\">\r\n <mt-table\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"allGroups()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"false\"\r\n [loading]=\"loading()\"\r\n storageKey=\"users-groups-groups-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n", styles: [".groups{padding:2rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }] });
1805
2556
  }
1806
2557
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Groups, decorators: [{
1807
2558
  type: Component,
@@ -1814,5 +2565,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1814
2565
  * Generated bundle index. Do not edit.
1815
2566
  */
1816
2567
 
1817
- export { AddUserToGroup, ClearSelectedGroup, CreateGroup, CreateUser, DeleteGroup, DeleteUser, DeleteUserFromGroup, GetGroup, GetGroups, GetUser, GetUserSummary, GetUsers, GroupForm, Groups, LinkUserToApplication, ResetUserPassword, UpdateGroup, UpdateUser, UserForm, Users, UsersGroups, UsersGroupsActionKey, UsersGroupsFacade, UsersGroupsState };
2568
+ export { AddUserToGroup, ClearSelectedGroup, CreateGroup, CreateUser, DeleteGroup, DeleteUser, DeleteUserFromGroup, GetGroup, GetGroupSummary, GetGroups, GetUser, GetUserLockStatuses, GetUserSummary, GetUsers, GroupForm, Groups, LinkUserToApplication, ResetUserPassword, UnlockUser, UpdateGroup, UpdateUser, UserForm, Users, UsersGroups, UsersGroupsActionKey, UsersGroupsFacade, UsersGroupsState };
1818
2569
  //# sourceMappingURL=masterteam-users-groups.mjs.map