1
|
<p-accordion>
|
2
|
<p-accordionTab header="Existing User's Roles">
|
3
|
<p-card *ngIf="!userIPowerClient">
|
4
|
<h4 class="p-text-center">
|
5
|
No selected user
|
6
|
</h4>
|
7
|
</p-card>
|
8
|
<div *ngIf="userIPowerClient?.length > 0 && this.checkIfUserHasValue === true">
|
9
|
<p><strong>{{'ROLES-ASSIGNED-TO-USER' | translate}} {{(user ? user.name : "")}}</strong></p>
|
10
|
<p-confirmDialog message="{{'DELETE-MESSAGE' | translate}}"
|
11
|
header="{{'DELETE-CONFIRMATION' | translate}}"
|
12
|
acceptLabel="{{'ACCEPT_LABEL' | translate}}"
|
13
|
rejectLabel="{{'REJECT_LABEL' | translate}}"
|
14
|
acceptButtonStyleClass="p-button-primary"
|
15
|
rejectButtonStyleClass="p-button-warning"
|
16
|
acceptIcon="null"
|
17
|
rejectIcon="null"
|
18
|
appendTo="body">
|
19
|
</p-confirmDialog>
|
20
|
<p-table [value]="userIPowerClient"
|
21
|
dataKey="id"
|
22
|
[paginator]="false"
|
23
|
[rows]="10"
|
24
|
styleClass="p-datatable-gridlines"
|
25
|
[loading]="loading"
|
26
|
[rowHover]="true"
|
27
|
[autoLayout]="true">
|
28
|
<ng-template pTemplate="header">
|
29
|
<tr>
|
30
|
<th>iPower Client Code</th>
|
31
|
<th>iPower Client Name</th>
|
32
|
<th>Role Code</th>
|
33
|
<th>Status</th>
|
34
|
<th class="one-button"></th>
|
35
|
</tr>
|
36
|
</ng-template>
|
37
|
<ng-template pTemplate="body"
|
38
|
let-userIPowerClient>
|
39
|
<tr *ngIf="userIPowerClient.status == 'Active'">
|
40
|
<td>{{userIPowerClient.ipowerClient.id}}</td>
|
41
|
<td>{{userIPowerClient.ipowerClient.name}}</td>
|
42
|
<td>{{userIPowerClient.role.name}}</td>
|
43
|
<td>{{(userIPowerClient.role.status ? 'ENABLE' : 'DISABLE') | translate}}</td>
|
44
|
<td>
|
45
|
<button pButton
|
46
|
pRipple
|
47
|
type="button"
|
48
|
(click)="disableUserRole(userIPowerClient.id)"
|
49
|
pTooltip="{{'DELETE-ROLE' | translate}}"
|
50
|
icon="pi pi pi-trash"
|
51
|
class="p-button-danger p-button-rounded p-button-outlined">
|
52
|
</button>
|
53
|
</td>
|
54
|
</tr>
|
55
|
</ng-template>
|
56
|
</p-table>
|
57
|
</div>
|
58
|
<p-card *ngIf="this.checkIfUserHasValue === false">
|
59
|
<h4 class="p-text-center">
|
60
|
{{(user ? user.name : "This user")}} has not existing roles
|
61
|
</h4>
|
62
|
</p-card>
|
63
|
</p-accordionTab>
|
64
|
<p-accordionTab header="Assignment of a new role">
|
65
|
<div class="p-formgroup-inline p-jc-center p-mt-0">
|
66
|
<div class="p-field p-m-0">
|
67
|
<label for="receivedFrom">Select Role</label>
|
68
|
<p-dropdown [(ngModel)]="selectedRole"
|
69
|
[options]="roles"
|
70
|
placeholder="Select"
|
71
|
optionLabel="name"
|
72
|
[showClear]="true">
|
73
|
</p-dropdown>
|
74
|
</div>
|
75
|
</div>
|
76
|
<div class="p-formgroup-inline p-jc-center"
|
77
|
*ngIf="!selectedRole?.isGlobal && selectedRole != null">
|
78
|
<div class="p-field p-m-0">
|
79
|
<label for="receivedFrom">Select iPower Client Code</label>
|
80
|
<span class="p-input-icon-left">
|
81
|
<i class="pi pi-search"></i>
|
82
|
<p-autoComplete id="receivedFrom"
|
83
|
size="18"
|
84
|
[(ngModel)]="selectedIpowerClient"
|
85
|
[suggestions]="ipowerClientCodeSuggestions"
|
86
|
(completeMethod)="autosuggestIPowerClientCode($event)"
|
87
|
[forceSelection]="true">
|
88
|
</p-autoComplete>
|
89
|
</span>
|
90
|
</div>
|
91
|
</div>
|
92
|
<div class="p-formgroup-inline p-mt-5 p-jc-center">
|
93
|
<p-button (onClick)="assignmentNewRole()"
|
94
|
label="Assign"
|
95
|
styleClass="p-button-primary"
|
96
|
[disabled]="isDisabled(this.user)">
|
97
|
</p-button>
|
98
|
</div>
|
99
|
|
100
|
</p-accordionTab>
|
101
|
</p-accordion>
|