|
|
|
@ -1,13 +1,11 @@
|
|
|
|
<div class="page-content">
|
|
|
|
<div class="page-content">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
|
|
|
|
|
|
|
<!-- User Selection Card -->
|
|
|
|
<!-- User Selection Card -->
|
|
|
|
<div class="card shadow-sm mb-4">
|
|
|
|
<div class="card shadow-sm mb-4">
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="card-body">
|
|
|
|
<form [formGroup]="permission" class="row align-items-center">
|
|
|
|
<form [formGroup]="permission" class="row align-items-center">
|
|
|
|
|
|
|
|
|
|
|
|
<label class="col-md-2 col-form-label fw-semibold">
|
|
|
|
<label class="col-md-2 col-form-label fw-semibold">
|
|
|
|
{{ 'userCode' | translate }}
|
|
|
|
{{ "userCode" | translate }}
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="col-md-6">
|
|
|
|
@ -15,7 +13,7 @@
|
|
|
|
class="form-select"
|
|
|
|
class="form-select"
|
|
|
|
formControlName="userCode"
|
|
|
|
formControlName="userCode"
|
|
|
|
[items]="users"
|
|
|
|
[items]="users"
|
|
|
|
bindLabel="userName"
|
|
|
|
bindLabel="displayName"
|
|
|
|
bindValue="userId"
|
|
|
|
bindValue="userId"
|
|
|
|
placeholder="{{ 'choose' | translate }}"
|
|
|
|
placeholder="{{ 'choose' | translate }}"
|
|
|
|
(change)="onUserChange()"
|
|
|
|
(change)="onUserChange()"
|
|
|
|
@ -24,10 +22,22 @@
|
|
|
|
[dropdownPosition]="'auto'"
|
|
|
|
[dropdownPosition]="'auto'"
|
|
|
|
[virtualScroll]="true"
|
|
|
|
[virtualScroll]="true"
|
|
|
|
[bufferAmount]="20"
|
|
|
|
[bufferAmount]="20"
|
|
|
|
appendTo="body">
|
|
|
|
appendTo="body"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<!-- Custom template for dropdown options -->
|
|
|
|
|
|
|
|
<ng-template ng-option-tmp let-item="item">
|
|
|
|
|
|
|
|
<div class="d-flex flex-column">
|
|
|
|
|
|
|
|
<span class="fw-medium">{{ item.userName }}</span>
|
|
|
|
|
|
|
|
<small class="text-muted">{{ item.userId }}</small>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</ng-template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Optional: Custom template for selected item -->
|
|
|
|
|
|
|
|
<ng-template ng-label-tmp let-item="item">
|
|
|
|
|
|
|
|
<span>{{ item.userName }} ({{ item.userId }})</span>
|
|
|
|
|
|
|
|
</ng-template>
|
|
|
|
</ng-select>
|
|
|
|
</ng-select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@ -35,47 +45,60 @@
|
|
|
|
<!-- Permissions Table Card -->
|
|
|
|
<!-- Permissions Table Card -->
|
|
|
|
<div class="card shadow-sm" *ngIf="showPermissions">
|
|
|
|
<div class="card shadow-sm" *ngIf="showPermissions">
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="card-body">
|
|
|
|
|
|
|
|
<h4 class="card-title mb-3">{{ "permissions" | translate }}</h4>
|
|
|
|
<h4 class="card-title mb-3">{{ 'permissions' | translate }}</h4>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="table-responsive scrollable-table">
|
|
|
|
<div class="table-responsive scrollable-table">
|
|
|
|
<table class="table table-hover table-bordered table-sm permission-table">
|
|
|
|
<table
|
|
|
|
|
|
|
|
class="table table-hover table-bordered table-sm permission-table"
|
|
|
|
|
|
|
|
>
|
|
|
|
<thead class="table-light">
|
|
|
|
<thead class="table-light">
|
|
|
|
<tr>
|
|
|
|
<tr>
|
|
|
|
<th style="width: 40px;"></th>
|
|
|
|
<th style="width: 40px"></th>
|
|
|
|
<th>{{ 'Permissions' | translate }}</th>
|
|
|
|
<th>{{ "Permissions" | translate }}</th>
|
|
|
|
<th style="width: 120px;" class="text-center">{{ 'allow' | translate }}</th>
|
|
|
|
<th style="width: 120px" class="text-center">
|
|
|
|
|
|
|
|
{{ "allow" | translate }}
|
|
|
|
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
<tbody>
|
|
|
|
<ng-container *ngTemplateOutlet="permissionRow; context: { nodes: permissions, level: 0 }"></ng-container>
|
|
|
|
<ng-container
|
|
|
|
|
|
|
|
*ngTemplateOutlet="
|
|
|
|
|
|
|
|
permissionRow;
|
|
|
|
|
|
|
|
context: { nodes: permissions, level: 0 }
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
></ng-container>
|
|
|
|
</tbody>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="text-end mt-3">
|
|
|
|
<div class="text-end mt-3">
|
|
|
|
<button class="btn btn-primary btn-sm px-4" (click)="savePermissions()">
|
|
|
|
<button
|
|
|
|
{{ 'save' | translate }}
|
|
|
|
class="btn btn-primary btn-sm px-4"
|
|
|
|
|
|
|
|
(click)="savePermissions()"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ "save" | translate }}
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Recursive Permission Rows -->
|
|
|
|
<!-- Recursive Permission Rows -->
|
|
|
|
<ng-template #permissionRow let-nodes="nodes" let-level="level">
|
|
|
|
<ng-template #permissionRow let-nodes="nodes" let-level="level">
|
|
|
|
<ng-container *ngFor="let node of nodes">
|
|
|
|
<ng-container *ngFor="let node of nodes">
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<tr>
|
|
|
|
<td class="text-center">
|
|
|
|
<td class="text-center">
|
|
|
|
<span *ngIf="node.children?.length || node.buttons?.length"
|
|
|
|
<span
|
|
|
|
class="expand-icon"
|
|
|
|
*ngIf="node.children?.length || node.buttons?.length"
|
|
|
|
(click)="toggleExpand(node)">
|
|
|
|
class="expand-icon"
|
|
|
|
<i class="bx" [ngClass]="node.expanded ? 'bx-chevron-down' : 'bx-chevron-right'"></i>
|
|
|
|
(click)="toggleExpand(node)"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<i
|
|
|
|
|
|
|
|
class="bx"
|
|
|
|
|
|
|
|
[ngClass]="node.expanded ? 'bx-chevron-down' : 'bx-chevron-right'"
|
|
|
|
|
|
|
|
></i>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
@ -84,18 +107,31 @@
|
|
|
|
</td>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<td class="text-center">
|
|
|
|
<td class="text-center">
|
|
|
|
<input type="checkbox" [checked]="node.checked" (change)="toggleNode(node, $event)">
|
|
|
|
<input
|
|
|
|
|
|
|
|
type="checkbox"
|
|
|
|
|
|
|
|
[checked]="node.checked"
|
|
|
|
|
|
|
|
(change)="toggleNode(node, $event)"
|
|
|
|
|
|
|
|
/>
|
|
|
|
</td>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<ng-container *ngIf="node.expanded">
|
|
|
|
<ng-container *ngIf="node.expanded">
|
|
|
|
<ng-container *ngIf="node.children?.length">
|
|
|
|
<ng-container *ngIf="node.children?.length">
|
|
|
|
<ng-container *ngTemplateOutlet="permissionRow; context: { nodes: node.children, level: level + 1 }"></ng-container>
|
|
|
|
<ng-container
|
|
|
|
|
|
|
|
*ngTemplateOutlet="
|
|
|
|
|
|
|
|
permissionRow;
|
|
|
|
|
|
|
|
context: { nodes: node.children, level: level + 1 }
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
></ng-container>
|
|
|
|
</ng-container>
|
|
|
|
</ng-container>
|
|
|
|
<ng-container *ngIf="node.buttons?.length">
|
|
|
|
<ng-container *ngIf="node.buttons?.length">
|
|
|
|
<ng-container *ngTemplateOutlet="permissionRow; context: { nodes: node.buttons, level: level + 1 }"></ng-container>
|
|
|
|
<ng-container
|
|
|
|
|
|
|
|
*ngTemplateOutlet="
|
|
|
|
|
|
|
|
permissionRow;
|
|
|
|
|
|
|
|
context: { nodes: node.buttons, level: level + 1 }
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
></ng-container>
|
|
|
|
</ng-container>
|
|
|
|
</ng-container>
|
|
|
|
</ng-container>
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
|
|
</ng-container>
|
|
|
|
</ng-container>
|
|
|
|
</ng-template>
|
|
|
|
</ng-template>
|
|
|
|
|