@flusys/ng-auth 9.1.0 → 9.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +2 -0
  2. package/fesm2022/flusys-ng-auth-administration-page.component-DmN4KqiR.mjs +146 -0
  3. package/fesm2022/flusys-ng-auth-administration-page.component-DmN4KqiR.mjs.map +1 -0
  4. package/fesm2022/flusys-ng-auth-branch-form.component-Df_sMC2G.mjs +743 -0
  5. package/fesm2022/flusys-ng-auth-branch-form.component-Df_sMC2G.mjs.map +1 -0
  6. package/fesm2022/flusys-ng-auth-branch-list.component-CWat6QWN.mjs +775 -0
  7. package/fesm2022/flusys-ng-auth-branch-list.component-CWat6QWN.mjs.map +1 -0
  8. package/fesm2022/flusys-ng-auth-company-form.component-BvZ4Pn8j.mjs +198 -0
  9. package/fesm2022/flusys-ng-auth-company-form.component-BvZ4Pn8j.mjs.map +1 -0
  10. package/fesm2022/flusys-ng-auth-company-list.component-Corh9AIh.mjs +241 -0
  11. package/fesm2022/flusys-ng-auth-company-list.component-Corh9AIh.mjs.map +1 -0
  12. package/fesm2022/flusys-ng-auth-extension-order.util-2XWSLqii.mjs +6 -0
  13. package/fesm2022/flusys-ng-auth-extension-order.util-2XWSLqii.mjs.map +1 -0
  14. package/fesm2022/flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs +384 -0
  15. package/fesm2022/flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs.map +1 -0
  16. package/fesm2022/flusys-ng-auth-login-page.component-DQl52Qau.mjs +1074 -0
  17. package/fesm2022/flusys-ng-auth-login-page.component-DQl52Qau.mjs.map +1 -0
  18. package/fesm2022/flusys-ng-auth-profile-page.component-b-8rPEXQ.mjs +1792 -0
  19. package/fesm2022/flusys-ng-auth-profile-page.component-b-8rPEXQ.mjs.map +1 -0
  20. package/fesm2022/flusys-ng-auth-register-page.component-D99y1jiA.mjs +1513 -0
  21. package/fesm2022/flusys-ng-auth-register-page.component-D99y1jiA.mjs.map +1 -0
  22. package/fesm2022/flusys-ng-auth-reset-password-page.component-C0tN_AW1.mjs +538 -0
  23. package/fesm2022/flusys-ng-auth-reset-password-page.component-C0tN_AW1.mjs.map +1 -0
  24. package/fesm2022/flusys-ng-auth-social-callback-page.component-gTD7_LJY.mjs +217 -0
  25. package/fesm2022/flusys-ng-auth-social-callback-page.component-gTD7_LJY.mjs.map +1 -0
  26. package/fesm2022/flusys-ng-auth-social-config-page.component-DpGmcb9n.mjs +541 -0
  27. package/fesm2022/flusys-ng-auth-social-config-page.component-DpGmcb9n.mjs.map +1 -0
  28. package/fesm2022/flusys-ng-auth-user-form.component-CM9UYc0q.mjs +1171 -0
  29. package/fesm2022/flusys-ng-auth-user-form.component-CM9UYc0q.mjs.map +1 -0
  30. package/fesm2022/flusys-ng-auth-user-list.component-Bew7gz-H.mjs +1046 -0
  31. package/fesm2022/flusys-ng-auth-user-list.component-Bew7gz-H.mjs.map +1 -0
  32. package/fesm2022/flusys-ng-auth-verify-email-page.component-DB9iKvt3.mjs +545 -0
  33. package/fesm2022/flusys-ng-auth-verify-email-page.component-DB9iKvt3.mjs.map +1 -0
  34. package/fesm2022/flusys-ng-auth.mjs +3030 -10735
  35. package/fesm2022/flusys-ng-auth.mjs.map +1 -1
  36. package/package.json +5 -5
  37. package/types/flusys-ng-auth.d.ts +978 -1558
@@ -0,0 +1,1046 @@
1
+ import { AUTH_USER_DETAIL_CONFIG, AUTH_USER_LIST_EXTENSION, UserApiService, UserBranchPermissionDialogComponent, UserCompanyPermissionDialogComponent } from "./flusys-ng-auth.mjs";
2
+ import { t as sortByOrder } from "./flusys-ng-auth-extension-order.util-2XWSLqii.mjs";
3
+ import * as i0 from "@angular/core";
4
+ import { Component, computed, inject, signal } from "@angular/core";
5
+ import { APP_CONFIG, isCompanyFeatureEnabled } from "@flusys/ng-core";
6
+ import { Router } from "@angular/router";
7
+ import { HasPermissionDirective, TranslatePipe, TranslateService, USER_PERMISSIONS } from "@flusys/ng-shared";
8
+ import { NgTemplateOutlet } from "@angular/common";
9
+ import { CardComponent, ConfirmationService, DialogComponent, FButtonDirective, IconFieldComponent, InputIconComponent, InputTextDirective, MessageService, TableComponent, TagComponent, TooltipDirective, UiIconComponent } from "@flusys/ng-ui";
10
+ import * as i1 from "@angular/forms";
11
+ import { FormsModule } from "@angular/forms";
12
+ var UserListComponent = class UserListComponent {
13
+ USER_PERMISSIONS = USER_PERMISSIONS;
14
+ router = inject(Router);
15
+ appConfig = inject(APP_CONFIG);
16
+ messageService = inject(MessageService);
17
+ confirmationService = inject(ConfirmationService);
18
+ userService = inject(UserApiService);
19
+ userListExtension = inject(AUTH_USER_LIST_EXTENSION, { optional: true });
20
+ userDetailConfig = inject(AUTH_USER_DETAIL_CONFIG, { optional: true });
21
+ translateAdapter = inject(TranslateService, { optional: true });
22
+ translate(key, vars) {
23
+ return this.translateAdapter?.translate(key, vars) ?? key;
24
+ }
25
+ users = this.userService.data;
26
+ isLoading = this.userService.isLoading;
27
+ total = this.userService.total;
28
+ companyFeatureEnabled = computed(() => isCompanyFeatureEnabled(this.appConfig), ...ngDevMode ? [{ debugName: "companyFeatureEnabled" }] : /* istanbul ignore next */ []);
29
+ extraColumns = computed(() => {
30
+ if (!this.userListExtension) return [];
31
+ return sortByOrder(this.userListExtension.getExtraColumns());
32
+ }, ...ngDevMode ? [{ debugName: "extraColumns" }] : /* istanbul ignore next */ []);
33
+ extraActions = computed(() => {
34
+ if (!this.userListExtension) return [];
35
+ return sortByOrder(this.userListExtension.getExtraActions());
36
+ }, ...ngDevMode ? [{ debugName: "extraActions" }] : /* istanbul ignore next */ []);
37
+ hasUserDetailView = computed(() => !!this.userDetailConfig, ...ngDevMode ? [{ debugName: "hasUserDetailView" }] : /* istanbul ignore next */ []);
38
+ tableColspan = computed(() => 6 + this.extraColumns().length, ...ngDevMode ? [{ debugName: "tableColspan" }] : /* istanbul ignore next */ []);
39
+ showCompanyDialog = signal(false, ...ngDevMode ? [{ debugName: "showCompanyDialog" }] : /* istanbul ignore next */ []);
40
+ showBranchDialog = signal(false, ...ngDevMode ? [{ debugName: "showBranchDialog" }] : /* istanbul ignore next */ []);
41
+ showUserDetailDialog = signal(false, ...ngDevMode ? [{ debugName: "showUserDetailDialog" }] : /* istanbul ignore next */ []);
42
+ selectedUser = signal(null, ...ngDevMode ? [{ debugName: "selectedUser" }] : /* istanbul ignore next */ []);
43
+ _searchTerm = signal("", ...ngDevMode ? [{ debugName: "_searchTerm" }] : /* istanbul ignore next */ []);
44
+ searchTerm = this._searchTerm.asReadonly();
45
+ getFieldValue(user, field) {
46
+ const parts = field.split(".");
47
+ let value = user;
48
+ for (const part of parts) {
49
+ if (value === null || value === void 0) return void 0;
50
+ value = value[part];
51
+ }
52
+ return value;
53
+ }
54
+ isActionVisible(action, user) {
55
+ return action.isVisible ? action.isVisible(user) : true;
56
+ }
57
+ isActionDisabled(action, user) {
58
+ return action.isDisabled ? action.isDisabled(user) : false;
59
+ }
60
+ onExtraAction(action, user) {
61
+ action.onClick(user);
62
+ }
63
+ onViewDetails(user) {
64
+ if (!this.userDetailConfig) return;
65
+ if (this.userDetailConfig.viewMode === "page") this.router.navigate(["/administration/users", user.id]);
66
+ else {
67
+ this.selectedUser.set(user);
68
+ this.showUserDetailDialog.set(true);
69
+ }
70
+ }
71
+ closeUserDetailDialog() {
72
+ this.showUserDetailDialog.set(false);
73
+ this.selectedUser.set(null);
74
+ }
75
+ loadUsers(page = 0, pageSize = 10) {
76
+ this.userService.fetchList(this._searchTerm(), { pagination: {
77
+ currentPage: page,
78
+ pageSize
79
+ } });
80
+ }
81
+ onLazyLoad(event) {
82
+ const first = event.first ?? 0;
83
+ const rows = event.rows ?? 10;
84
+ const page = Math.floor(first / rows);
85
+ this.loadUsers(page, rows);
86
+ }
87
+ onSearchChange(value) {
88
+ this._searchTerm.set(value);
89
+ this.loadUsers(0);
90
+ }
91
+ onCreate() {
92
+ this.router.navigate(["/administration/users/new"]);
93
+ }
94
+ onEdit(user) {
95
+ this.router.navigate(["/administration/users", user.id]);
96
+ }
97
+ onManageCompanyPermissions(user) {
98
+ this.openPermissionDialog(user, this.showCompanyDialog);
99
+ }
100
+ onManageBranchPermissions(user) {
101
+ this.openPermissionDialog(user, this.showBranchDialog);
102
+ }
103
+ openPermissionDialog(user, dialogSignal) {
104
+ this.selectedUser.set(user);
105
+ dialogSignal.set(true);
106
+ }
107
+ onDelete(user) {
108
+ this.confirmationService.confirm({
109
+ message: this.translate("shared.confirm.delete.item", { name: user.name }),
110
+ header: this.translate("administrative.user.delete.title"),
111
+ icon: "exclamation-triangle",
112
+ acceptButtonStyleClass: "p-button-danger",
113
+ accept: async () => {
114
+ try {
115
+ const response = await this.userService.delete({
116
+ id: user.id,
117
+ type: "delete"
118
+ });
119
+ this.messageService.add({
120
+ severity: "success",
121
+ summary: this.translate("shared.success"),
122
+ detail: response.messageKey ? this.translate(response.messageKey, response.messageVariables) : response.message
123
+ });
124
+ this.userService.reload();
125
+ } catch {}
126
+ }
127
+ });
128
+ }
129
+ static ɵfac = i0.ɵɵngDeclareFactory({
130
+ minVersion: "12.0.0",
131
+ version: "22.2.1",
132
+ ngImport: i0,
133
+ type: UserListComponent,
134
+ deps: [],
135
+ target: i0.ɵɵFactoryTarget.Component
136
+ });
137
+ static ɵcmp = i0.ɵɵngDeclareComponent({
138
+ minVersion: "17.0.0",
139
+ version: "22.2.1",
140
+ type: UserListComponent,
141
+ isStandalone: true,
142
+ selector: "lib-user-list",
143
+ ngImport: i0,
144
+ template: `
145
+ <f-card>
146
+ <ng-template #header>
147
+ <div
148
+ class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 p-4"
149
+ >
150
+ <h2 class="text-xl font-semibold m-0">
151
+ {{ 'administrative.user.title' | translate }}
152
+ </h2>
153
+ <div class="flex items-center gap-3 w-full sm:w-auto">
154
+ <f-iconfield class="w-full sm:w-64">
155
+ <f-inputicon icon="search" />
156
+ <input
157
+ fInputText
158
+ type="text"
159
+ [ngModel]="searchTerm()"
160
+ (ngModelChange)="onSearchChange($event)"
161
+ [placeholder]="'shared.search' | translate"
162
+ />
163
+ </f-iconfield>
164
+ <button
165
+ fButton
166
+ *hasPermission="USER_PERMISSIONS.CREATE"
167
+ (click)="onCreate()"
168
+ >
169
+ <ui-icon pButtonIcon name="plus"></ui-icon>
170
+ <span pButtonLabel>{{ 'administrative.user.add' | translate }}</span>
171
+ </button>
172
+ </div>
173
+ </div>
174
+ </ng-template>
175
+
176
+ <div class="overflow-x-auto">
177
+ <f-table
178
+ [value]="users()"
179
+ [loading]="isLoading()"
180
+ [paginator]="total() > 0"
181
+ [rows]="10"
182
+ [rowsPerPageOptions]="[10, 25, 50]"
183
+ [totalRecords]="total()"
184
+ [lazy]="true"
185
+ (onLazyLoad)="onLazyLoad($event)"
186
+ [scrollable]="true"
187
+ >
188
+ <ng-template #header>
189
+ <tr>
190
+ <th>{{ 'administrative.user.name' | translate }}</th>
191
+ <th>{{ 'administrative.email.label' | translate }}</th>
192
+ <th>{{ 'administrative.phone.label' | translate }}</th>
193
+ <th>{{ 'administrative.user.email.verified' | translate }}</th>
194
+ <th>{{ 'shared.status' | translate }}</th>
195
+ @for (col of extraColumns(); track col.key) {
196
+ <th
197
+ [class]="col.styleClass ?? ''"
198
+ [style.width]="col.width ?? 'auto'"
199
+ >
200
+ {{ col.headerKey | translate: null : col.header }}
201
+ </th>
202
+ }
203
+ <th class="w-[180px]">{{ 'shared.actions' | translate }}</th>
204
+ </tr>
205
+ </ng-template>
206
+ <ng-template #body let-user>
207
+ <tr>
208
+ <td>{{ user.name }}</td>
209
+ <td>{{ user.email }}</td>
210
+ <td>{{ user.phone || '-' }}</td>
211
+ <td>
212
+ <f-tag
213
+ [value]="
214
+ user.emailVerified
215
+ ? ('shared.verified' | translate)
216
+ : ('shared.unverified' | translate)
217
+ "
218
+ [severity]="user.emailVerified ? 'success' : 'warn'"
219
+ />
220
+ </td>
221
+ <td>
222
+ <f-tag
223
+ [value]="
224
+ user.isActive
225
+ ? ('shared.active' | translate)
226
+ : ('shared.inactive' | translate)
227
+ "
228
+ [severity]="user.isActive ? 'success' : 'danger'"
229
+ />
230
+ </td>
231
+ @for (col of extraColumns(); track col.key) {
232
+ <td [class]="col.styleClass ?? ''">
233
+ @if (col.template) {
234
+ <ng-container
235
+ [ngTemplateOutlet]="col.template"
236
+ [ngTemplateOutletContext]="{ $implicit: user }"
237
+ />
238
+ } @else if (col.field) {
239
+ {{ getFieldValue(user, col.field) ?? '-' }}
240
+ }
241
+ </td>
242
+ }
243
+ <td>
244
+ <div class="flex gap-1 flex-wrap">
245
+ @if (hasUserDetailView()) {
246
+ <button
247
+ fButton
248
+ [rounded]="true"
249
+ [text]="true"
250
+ severity="info"
251
+ [fTooltip]="'shared.view.details' | translate"
252
+ (click)="onViewDetails(user)"
253
+ >
254
+ <ui-icon pButtonIcon name="eye"></ui-icon>
255
+ </button>
256
+ }
257
+ <button
258
+ fButton
259
+ *hasPermission="USER_PERMISSIONS.UPDATE"
260
+ [rounded]="true"
261
+ [text]="true"
262
+ severity="info"
263
+ [fTooltip]="'shared.edit' | translate"
264
+ (click)="onEdit(user)"
265
+ >
266
+ <ui-icon pButtonIcon name="pencil"></ui-icon>
267
+ </button>
268
+ @if (companyFeatureEnabled()) {
269
+ <button
270
+ fButton
271
+ *hasPermission="USER_PERMISSIONS.UPDATE"
272
+ [rounded]="true"
273
+ [text]="true"
274
+ severity="secondary"
275
+ [fTooltip]="
276
+ 'administrative.permission.company.permissions'
277
+ | translate
278
+ "
279
+ (click)="onManageCompanyPermissions(user)"
280
+ >
281
+ <ui-icon pButtonIcon name="building"></ui-icon>
282
+ </button>
283
+ <button
284
+ fButton
285
+ *hasPermission="USER_PERMISSIONS.UPDATE"
286
+ [rounded]="true"
287
+ [text]="true"
288
+ severity="secondary"
289
+ [fTooltip]="
290
+ 'administrative.permission.branch.permissions'
291
+ | translate
292
+ "
293
+ (click)="onManageBranchPermissions(user)"
294
+ >
295
+ <ui-icon pButtonIcon name="sitemap"></ui-icon>
296
+ </button>
297
+ }
298
+ @for (action of extraActions(); track action.key) {
299
+ @if (isActionVisible(action, user)) {
300
+ <button
301
+ fButton
302
+ [rounded]="true"
303
+ [text]="true"
304
+ [severity]="action.severity ?? 'secondary'"
305
+ [fTooltip]="
306
+ action.labelKey | translate: null : action.label
307
+ "
308
+ [disabled]="isActionDisabled(action, user)"
309
+ (click)="onExtraAction(action, user)"
310
+ >
311
+ <ui-icon pButtonIcon [name]="action.icon"></ui-icon>
312
+ </button>
313
+ }
314
+ }
315
+ <button
316
+ fButton
317
+ *hasPermission="USER_PERMISSIONS.DELETE"
318
+ [rounded]="true"
319
+ [text]="true"
320
+ severity="danger"
321
+ [fTooltip]="'shared.delete' | translate"
322
+ (click)="onDelete(user)"
323
+ >
324
+ <ui-icon pButtonIcon name="trash"></ui-icon>
325
+ </button>
326
+ </div>
327
+ </td>
328
+ </tr>
329
+ </ng-template>
330
+ <ng-template #emptymessage>
331
+ <tr>
332
+ <td [attr.colspan]="tableColspan()" class="text-center py-8">
333
+ {{ 'administrative.user.no.users' | translate }}
334
+ </td>
335
+ </tr>
336
+ </ng-template>
337
+ </f-table>
338
+ </div>
339
+ </f-card>
340
+
341
+ @if (companyFeatureEnabled()) {
342
+ <lib-user-company-permission-dialog
343
+ [visible]="showCompanyDialog()"
344
+ [user]="selectedUser()"
345
+ (closed)="showCompanyDialog.set(false)"
346
+ (permissionsChanged)="loadUsers()"
347
+ />
348
+
349
+ <lib-user-branch-permission-dialog
350
+ [visible]="showBranchDialog()"
351
+ [user]="selectedUser()"
352
+ (closed)="showBranchDialog.set(false)"
353
+ (permissionsChanged)="loadUsers()"
354
+ />
355
+ }
356
+
357
+ @if (hasUserDetailView() && showUserDetailDialog()) {
358
+ <f-dialog
359
+ [header]="'administrative.user.details' | translate"
360
+ [visible]="showUserDetailDialog()"
361
+ [modal]="true"
362
+ [style]="{ width: userDetailConfig?.width ?? '600px' }"
363
+ [draggable]="false"
364
+ [resizable]="false"
365
+ (onHide)="closeUserDetailDialog()"
366
+ >
367
+ @if (selectedUser(); as user) {
368
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
369
+ <div class="flex flex-col gap-2">
370
+ <label class="font-medium text-muted-color">{{
371
+ 'administrative.user.name' | translate
372
+ }}</label>
373
+ <span class="text-color">{{ user.name }}</span>
374
+ </div>
375
+ <div class="flex flex-col gap-2">
376
+ <label class="font-medium text-muted-color">{{
377
+ 'administrative.email.label' | translate
378
+ }}</label>
379
+ <span class="text-color">{{ user.email }}</span>
380
+ </div>
381
+ <div class="flex flex-col gap-2">
382
+ <label class="font-medium text-muted-color">{{
383
+ 'administrative.phone.label' | translate
384
+ }}</label>
385
+ <span class="text-color">{{ user.phone || '-' }}</span>
386
+ </div>
387
+ <div class="flex flex-col gap-2">
388
+ <label class="font-medium text-muted-color">{{
389
+ 'shared.status' | translate
390
+ }}</label>
391
+ <f-tag
392
+ [value]="
393
+ user.isActive
394
+ ? ('shared.active' | translate)
395
+ : ('shared.inactive' | translate)
396
+ "
397
+ [severity]="user.isActive ? 'success' : 'danger'"
398
+ />
399
+ </div>
400
+ <div class="flex flex-col gap-2">
401
+ <label class="font-medium text-muted-color">{{
402
+ 'administrative.user.email.verified' | translate
403
+ }}</label>
404
+ <f-tag
405
+ [value]="
406
+ user.emailVerified
407
+ ? ('shared.verified' | translate)
408
+ : ('shared.unverified' | translate)
409
+ "
410
+ [severity]="user.emailVerified ? 'success' : 'warn'"
411
+ />
412
+ </div>
413
+ @for (col of extraColumns(); track col.key) {
414
+ <div class="flex flex-col gap-2">
415
+ <label class="font-medium text-muted-color">{{
416
+ col.headerKey | translate: null : col.header
417
+ }}</label>
418
+ <span class="text-color">{{
419
+ getFieldValue(user, col.field ?? col.key) ?? '-'
420
+ }}</span>
421
+ </div>
422
+ }
423
+ </div>
424
+ <div class="flex justify-end gap-2 mt-6">
425
+ @if (userDetailConfig?.allowEdit) {
426
+ <button
427
+ fButton
428
+ (click)="onEdit(user); closeUserDetailDialog()"
429
+ >
430
+ <ui-icon pButtonIcon name="pencil"></ui-icon>
431
+ <span pButtonLabel>{{ 'shared.edit' | translate }}</span>
432
+ </button>
433
+ }
434
+ <button
435
+ fButton
436
+ severity="secondary"
437
+ [outlined]="true"
438
+ (click)="closeUserDetailDialog()"
439
+ >
440
+ <span pButtonLabel>{{ 'shared.close' | translate }}</span>
441
+ </button>
442
+ </div>
443
+ }
444
+ </f-dialog>
445
+ }
446
+ `,
447
+ isInline: true,
448
+ dependencies: [
449
+ {
450
+ kind: "directive",
451
+ type: NgTemplateOutlet,
452
+ selector: "[ngTemplateOutlet]",
453
+ inputs: [
454
+ "ngTemplateOutletContext",
455
+ "ngTemplateOutlet",
456
+ "ngTemplateOutletInjector"
457
+ ]
458
+ },
459
+ {
460
+ kind: "ngmodule",
461
+ type: FormsModule
462
+ },
463
+ {
464
+ kind: "directive",
465
+ type: i1.DefaultValueAccessor,
466
+ selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
467
+ },
468
+ {
469
+ kind: "directive",
470
+ type: i1.NgControlStatus,
471
+ selector: "[formControlName],[ngModel],[formControl]"
472
+ },
473
+ {
474
+ kind: "directive",
475
+ type: i1.NgModel,
476
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
477
+ inputs: [
478
+ "name",
479
+ "disabled",
480
+ "ngModel",
481
+ "ngModelOptions"
482
+ ],
483
+ outputs: ["ngModelChange"],
484
+ exportAs: ["ngModel"]
485
+ },
486
+ {
487
+ kind: "component",
488
+ type: CardComponent,
489
+ selector: "f-card",
490
+ inputs: [
491
+ "header",
492
+ "subheader",
493
+ "styleClass",
494
+ "style"
495
+ ]
496
+ },
497
+ {
498
+ kind: "component",
499
+ type: DialogComponent,
500
+ selector: "f-dialog",
501
+ inputs: [
502
+ "header",
503
+ "visible",
504
+ "modal",
505
+ "closable",
506
+ "closeOnEscape",
507
+ "dismissableMask",
508
+ "resizable",
509
+ "draggable",
510
+ "maximizable",
511
+ "blockScroll",
512
+ "returnFocusOnClose",
513
+ "position",
514
+ "style",
515
+ "styleClass",
516
+ "breakpoints"
517
+ ],
518
+ outputs: [
519
+ "visibleChange",
520
+ "onShow",
521
+ "onHide",
522
+ "onMaximize"
523
+ ]
524
+ },
525
+ {
526
+ kind: "directive",
527
+ type: FButtonDirective,
528
+ selector: "[fButton]",
529
+ inputs: [
530
+ "severity",
531
+ "text",
532
+ "outlined",
533
+ "link",
534
+ "variant",
535
+ "rounded",
536
+ "raised",
537
+ "fluid",
538
+ "disabled",
539
+ "loading",
540
+ "loadingIcon",
541
+ "size",
542
+ "label",
543
+ "icon",
544
+ "iconPos",
545
+ "ariaLabel",
546
+ "plain"
547
+ ]
548
+ },
549
+ {
550
+ kind: "component",
551
+ type: IconFieldComponent,
552
+ selector: "f-iconfield",
553
+ inputs: ["iconPosition", "styleClass"]
554
+ },
555
+ {
556
+ kind: "component",
557
+ type: InputIconComponent,
558
+ selector: "f-inputicon",
559
+ inputs: [
560
+ "icon",
561
+ "position",
562
+ "styleClass",
563
+ "style"
564
+ ]
565
+ },
566
+ {
567
+ kind: "directive",
568
+ type: InputTextDirective,
569
+ selector: "[fInputText]",
570
+ inputs: [
571
+ "invalid",
572
+ "touched",
573
+ "variant",
574
+ "size",
575
+ "fluid"
576
+ ]
577
+ },
578
+ {
579
+ kind: "component",
580
+ type: TableComponent,
581
+ selector: "f-table",
582
+ inputs: [
583
+ "value",
584
+ "lazy",
585
+ "loading",
586
+ "rows",
587
+ "totalRecords",
588
+ "rowHover",
589
+ "dataKey",
590
+ "scrollable",
591
+ "scrollHeight",
592
+ "paginator",
593
+ "first",
594
+ "rowsPerPageOptions",
595
+ "showCurrentPageReport",
596
+ "currentPageReportTemplate",
597
+ "tableStyle",
598
+ "styleClass",
599
+ "globalFilterFields",
600
+ "filterDelay",
601
+ "responsiveLayout",
602
+ "selectionMode",
603
+ "sortMode",
604
+ "rowExpandMode",
605
+ "resizableColumns",
606
+ "rowStyleClass",
607
+ "virtualScroll",
608
+ "virtualScrollItemSize",
609
+ "sortField",
610
+ "sortOrder",
611
+ "multiSortMeta",
612
+ "filters",
613
+ "selection",
614
+ "expandedRowKeys",
615
+ "contextMenuSelection"
616
+ ],
617
+ outputs: [
618
+ "sortFieldChange",
619
+ "sortOrderChange",
620
+ "multiSortMetaChange",
621
+ "filtersChange",
622
+ "selectionChange",
623
+ "expandedRowKeysChange",
624
+ "contextMenuSelectionChange",
625
+ "onLazyLoad",
626
+ "onSort",
627
+ "onFilter",
628
+ "onRowSelect",
629
+ "onRowUnselect",
630
+ "onSelectAllChange",
631
+ "onRowExpand",
632
+ "onRowCollapse",
633
+ "onColResize",
634
+ "onRowContextMenu"
635
+ ]
636
+ },
637
+ {
638
+ kind: "component",
639
+ type: TagComponent,
640
+ selector: "f-tag",
641
+ inputs: [
642
+ "value",
643
+ "severity",
644
+ "icon",
645
+ "rounded",
646
+ "color",
647
+ "styleClass",
648
+ "style"
649
+ ]
650
+ },
651
+ {
652
+ kind: "directive",
653
+ type: TooltipDirective,
654
+ selector: "[fTooltip]",
655
+ inputs: [
656
+ "fTooltip",
657
+ "tooltipPosition",
658
+ "positionStyle",
659
+ "tooltipStyleClass",
660
+ "disabled",
661
+ "tooltipEvent",
662
+ "showDelay",
663
+ "hideDelay",
664
+ "life",
665
+ "autoHide",
666
+ "positionTop",
667
+ "positionLeft",
668
+ "escape"
669
+ ]
670
+ },
671
+ {
672
+ kind: "component",
673
+ type: UiIconComponent,
674
+ selector: "ui-icon",
675
+ inputs: [
676
+ "name",
677
+ "size",
678
+ "spin",
679
+ "fill",
680
+ "severity"
681
+ ]
682
+ },
683
+ {
684
+ kind: "directive",
685
+ type: HasPermissionDirective,
686
+ selector: "[hasPermission]",
687
+ inputs: ["hasPermission"]
688
+ },
689
+ {
690
+ kind: "component",
691
+ type: UserCompanyPermissionDialogComponent,
692
+ selector: "lib-user-company-permission-dialog",
693
+ inputs: ["visible", "user"],
694
+ outputs: ["closed", "permissionsChanged"]
695
+ },
696
+ {
697
+ kind: "component",
698
+ type: UserBranchPermissionDialogComponent,
699
+ selector: "lib-user-branch-permission-dialog",
700
+ inputs: ["visible", "user"],
701
+ outputs: ["closed", "permissionsChanged"]
702
+ },
703
+ {
704
+ kind: "pipe",
705
+ type: TranslatePipe,
706
+ name: "translate"
707
+ }
708
+ ]
709
+ });
710
+ };
711
+ i0.ɵɵngDeclareClassMetadata({
712
+ minVersion: "12.0.0",
713
+ version: "22.2.1",
714
+ ngImport: i0,
715
+ type: UserListComponent,
716
+ decorators: [{
717
+ type: Component,
718
+ args: [{
719
+ selector: "lib-user-list",
720
+ imports: [
721
+ NgTemplateOutlet,
722
+ FormsModule,
723
+ CardComponent,
724
+ DialogComponent,
725
+ FButtonDirective,
726
+ IconFieldComponent,
727
+ InputIconComponent,
728
+ InputTextDirective,
729
+ TableComponent,
730
+ TagComponent,
731
+ TooltipDirective,
732
+ UiIconComponent,
733
+ HasPermissionDirective,
734
+ TranslatePipe,
735
+ UserCompanyPermissionDialogComponent,
736
+ UserBranchPermissionDialogComponent
737
+ ],
738
+ template: `
739
+ <f-card>
740
+ <ng-template #header>
741
+ <div
742
+ class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 p-4"
743
+ >
744
+ <h2 class="text-xl font-semibold m-0">
745
+ {{ 'administrative.user.title' | translate }}
746
+ </h2>
747
+ <div class="flex items-center gap-3 w-full sm:w-auto">
748
+ <f-iconfield class="w-full sm:w-64">
749
+ <f-inputicon icon="search" />
750
+ <input
751
+ fInputText
752
+ type="text"
753
+ [ngModel]="searchTerm()"
754
+ (ngModelChange)="onSearchChange($event)"
755
+ [placeholder]="'shared.search' | translate"
756
+ />
757
+ </f-iconfield>
758
+ <button
759
+ fButton
760
+ *hasPermission="USER_PERMISSIONS.CREATE"
761
+ (click)="onCreate()"
762
+ >
763
+ <ui-icon pButtonIcon name="plus"></ui-icon>
764
+ <span pButtonLabel>{{ 'administrative.user.add' | translate }}</span>
765
+ </button>
766
+ </div>
767
+ </div>
768
+ </ng-template>
769
+
770
+ <div class="overflow-x-auto">
771
+ <f-table
772
+ [value]="users()"
773
+ [loading]="isLoading()"
774
+ [paginator]="total() > 0"
775
+ [rows]="10"
776
+ [rowsPerPageOptions]="[10, 25, 50]"
777
+ [totalRecords]="total()"
778
+ [lazy]="true"
779
+ (onLazyLoad)="onLazyLoad($event)"
780
+ [scrollable]="true"
781
+ >
782
+ <ng-template #header>
783
+ <tr>
784
+ <th>{{ 'administrative.user.name' | translate }}</th>
785
+ <th>{{ 'administrative.email.label' | translate }}</th>
786
+ <th>{{ 'administrative.phone.label' | translate }}</th>
787
+ <th>{{ 'administrative.user.email.verified' | translate }}</th>
788
+ <th>{{ 'shared.status' | translate }}</th>
789
+ @for (col of extraColumns(); track col.key) {
790
+ <th
791
+ [class]="col.styleClass ?? ''"
792
+ [style.width]="col.width ?? 'auto'"
793
+ >
794
+ {{ col.headerKey | translate: null : col.header }}
795
+ </th>
796
+ }
797
+ <th class="w-[180px]">{{ 'shared.actions' | translate }}</th>
798
+ </tr>
799
+ </ng-template>
800
+ <ng-template #body let-user>
801
+ <tr>
802
+ <td>{{ user.name }}</td>
803
+ <td>{{ user.email }}</td>
804
+ <td>{{ user.phone || '-' }}</td>
805
+ <td>
806
+ <f-tag
807
+ [value]="
808
+ user.emailVerified
809
+ ? ('shared.verified' | translate)
810
+ : ('shared.unverified' | translate)
811
+ "
812
+ [severity]="user.emailVerified ? 'success' : 'warn'"
813
+ />
814
+ </td>
815
+ <td>
816
+ <f-tag
817
+ [value]="
818
+ user.isActive
819
+ ? ('shared.active' | translate)
820
+ : ('shared.inactive' | translate)
821
+ "
822
+ [severity]="user.isActive ? 'success' : 'danger'"
823
+ />
824
+ </td>
825
+ @for (col of extraColumns(); track col.key) {
826
+ <td [class]="col.styleClass ?? ''">
827
+ @if (col.template) {
828
+ <ng-container
829
+ [ngTemplateOutlet]="col.template"
830
+ [ngTemplateOutletContext]="{ $implicit: user }"
831
+ />
832
+ } @else if (col.field) {
833
+ {{ getFieldValue(user, col.field) ?? '-' }}
834
+ }
835
+ </td>
836
+ }
837
+ <td>
838
+ <div class="flex gap-1 flex-wrap">
839
+ @if (hasUserDetailView()) {
840
+ <button
841
+ fButton
842
+ [rounded]="true"
843
+ [text]="true"
844
+ severity="info"
845
+ [fTooltip]="'shared.view.details' | translate"
846
+ (click)="onViewDetails(user)"
847
+ >
848
+ <ui-icon pButtonIcon name="eye"></ui-icon>
849
+ </button>
850
+ }
851
+ <button
852
+ fButton
853
+ *hasPermission="USER_PERMISSIONS.UPDATE"
854
+ [rounded]="true"
855
+ [text]="true"
856
+ severity="info"
857
+ [fTooltip]="'shared.edit' | translate"
858
+ (click)="onEdit(user)"
859
+ >
860
+ <ui-icon pButtonIcon name="pencil"></ui-icon>
861
+ </button>
862
+ @if (companyFeatureEnabled()) {
863
+ <button
864
+ fButton
865
+ *hasPermission="USER_PERMISSIONS.UPDATE"
866
+ [rounded]="true"
867
+ [text]="true"
868
+ severity="secondary"
869
+ [fTooltip]="
870
+ 'administrative.permission.company.permissions'
871
+ | translate
872
+ "
873
+ (click)="onManageCompanyPermissions(user)"
874
+ >
875
+ <ui-icon pButtonIcon name="building"></ui-icon>
876
+ </button>
877
+ <button
878
+ fButton
879
+ *hasPermission="USER_PERMISSIONS.UPDATE"
880
+ [rounded]="true"
881
+ [text]="true"
882
+ severity="secondary"
883
+ [fTooltip]="
884
+ 'administrative.permission.branch.permissions'
885
+ | translate
886
+ "
887
+ (click)="onManageBranchPermissions(user)"
888
+ >
889
+ <ui-icon pButtonIcon name="sitemap"></ui-icon>
890
+ </button>
891
+ }
892
+ @for (action of extraActions(); track action.key) {
893
+ @if (isActionVisible(action, user)) {
894
+ <button
895
+ fButton
896
+ [rounded]="true"
897
+ [text]="true"
898
+ [severity]="action.severity ?? 'secondary'"
899
+ [fTooltip]="
900
+ action.labelKey | translate: null : action.label
901
+ "
902
+ [disabled]="isActionDisabled(action, user)"
903
+ (click)="onExtraAction(action, user)"
904
+ >
905
+ <ui-icon pButtonIcon [name]="action.icon"></ui-icon>
906
+ </button>
907
+ }
908
+ }
909
+ <button
910
+ fButton
911
+ *hasPermission="USER_PERMISSIONS.DELETE"
912
+ [rounded]="true"
913
+ [text]="true"
914
+ severity="danger"
915
+ [fTooltip]="'shared.delete' | translate"
916
+ (click)="onDelete(user)"
917
+ >
918
+ <ui-icon pButtonIcon name="trash"></ui-icon>
919
+ </button>
920
+ </div>
921
+ </td>
922
+ </tr>
923
+ </ng-template>
924
+ <ng-template #emptymessage>
925
+ <tr>
926
+ <td [attr.colspan]="tableColspan()" class="text-center py-8">
927
+ {{ 'administrative.user.no.users' | translate }}
928
+ </td>
929
+ </tr>
930
+ </ng-template>
931
+ </f-table>
932
+ </div>
933
+ </f-card>
934
+
935
+ @if (companyFeatureEnabled()) {
936
+ <lib-user-company-permission-dialog
937
+ [visible]="showCompanyDialog()"
938
+ [user]="selectedUser()"
939
+ (closed)="showCompanyDialog.set(false)"
940
+ (permissionsChanged)="loadUsers()"
941
+ />
942
+
943
+ <lib-user-branch-permission-dialog
944
+ [visible]="showBranchDialog()"
945
+ [user]="selectedUser()"
946
+ (closed)="showBranchDialog.set(false)"
947
+ (permissionsChanged)="loadUsers()"
948
+ />
949
+ }
950
+
951
+ @if (hasUserDetailView() && showUserDetailDialog()) {
952
+ <f-dialog
953
+ [header]="'administrative.user.details' | translate"
954
+ [visible]="showUserDetailDialog()"
955
+ [modal]="true"
956
+ [style]="{ width: userDetailConfig?.width ?? '600px' }"
957
+ [draggable]="false"
958
+ [resizable]="false"
959
+ (onHide)="closeUserDetailDialog()"
960
+ >
961
+ @if (selectedUser(); as user) {
962
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
963
+ <div class="flex flex-col gap-2">
964
+ <label class="font-medium text-muted-color">{{
965
+ 'administrative.user.name' | translate
966
+ }}</label>
967
+ <span class="text-color">{{ user.name }}</span>
968
+ </div>
969
+ <div class="flex flex-col gap-2">
970
+ <label class="font-medium text-muted-color">{{
971
+ 'administrative.email.label' | translate
972
+ }}</label>
973
+ <span class="text-color">{{ user.email }}</span>
974
+ </div>
975
+ <div class="flex flex-col gap-2">
976
+ <label class="font-medium text-muted-color">{{
977
+ 'administrative.phone.label' | translate
978
+ }}</label>
979
+ <span class="text-color">{{ user.phone || '-' }}</span>
980
+ </div>
981
+ <div class="flex flex-col gap-2">
982
+ <label class="font-medium text-muted-color">{{
983
+ 'shared.status' | translate
984
+ }}</label>
985
+ <f-tag
986
+ [value]="
987
+ user.isActive
988
+ ? ('shared.active' | translate)
989
+ : ('shared.inactive' | translate)
990
+ "
991
+ [severity]="user.isActive ? 'success' : 'danger'"
992
+ />
993
+ </div>
994
+ <div class="flex flex-col gap-2">
995
+ <label class="font-medium text-muted-color">{{
996
+ 'administrative.user.email.verified' | translate
997
+ }}</label>
998
+ <f-tag
999
+ [value]="
1000
+ user.emailVerified
1001
+ ? ('shared.verified' | translate)
1002
+ : ('shared.unverified' | translate)
1003
+ "
1004
+ [severity]="user.emailVerified ? 'success' : 'warn'"
1005
+ />
1006
+ </div>
1007
+ @for (col of extraColumns(); track col.key) {
1008
+ <div class="flex flex-col gap-2">
1009
+ <label class="font-medium text-muted-color">{{
1010
+ col.headerKey | translate: null : col.header
1011
+ }}</label>
1012
+ <span class="text-color">{{
1013
+ getFieldValue(user, col.field ?? col.key) ?? '-'
1014
+ }}</span>
1015
+ </div>
1016
+ }
1017
+ </div>
1018
+ <div class="flex justify-end gap-2 mt-6">
1019
+ @if (userDetailConfig?.allowEdit) {
1020
+ <button
1021
+ fButton
1022
+ (click)="onEdit(user); closeUserDetailDialog()"
1023
+ >
1024
+ <ui-icon pButtonIcon name="pencil"></ui-icon>
1025
+ <span pButtonLabel>{{ 'shared.edit' | translate }}</span>
1026
+ </button>
1027
+ }
1028
+ <button
1029
+ fButton
1030
+ severity="secondary"
1031
+ [outlined]="true"
1032
+ (click)="closeUserDetailDialog()"
1033
+ >
1034
+ <span pButtonLabel>{{ 'shared.close' | translate }}</span>
1035
+ </button>
1036
+ </div>
1037
+ }
1038
+ </f-dialog>
1039
+ }
1040
+ `
1041
+ }]
1042
+ }]
1043
+ });
1044
+ export { UserListComponent };
1045
+
1046
+ //# sourceMappingURL=flusys-ng-auth-user-list.component-Bew7gz-H.mjs.map