-<h3>Users list</h3>
+<div class="admin-sub-header">
+ <div class="admin-sub-title">Users list</div>
-<table class="table table-hover">
- <thead>
+ <a class="add-button" routerLink="/admin/users/add">
+ <span class="icon icon-add"></span>
+ Add user
+ </a>
+</div>
+
+<p-table
+ [value]="users" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
+ [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
+>
+ <ng-template pTemplate="header">
<tr>
- <th class="table-column-id">ID</th>
- <th>Username</th>
- <th>Created Date</th>
- <th class="text-right">Remove</th>
+ <th pSortableColumn="username">Username <p-sortIcon field="username"></p-sortIcon></th>
+ <th>Email</th>
+ <th>Video quota</th>
+ <th>Role</th>
+ <th pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
+ <th></th>
</tr>
- </thead>
+ </ng-template>
- <tbody>
- <tr *ngFor="let user of users">
- <td>{{ user.id }}</td>
+ <ng-template pTemplate="body" let-user>
+ <tr>
<td>{{ user.username }}</td>
- <td>{{ user.createdAt | date: 'medium' }}</td>
- <td class="text-right">
- <span class="glyphicon glyphicon-remove" *ngIf="!user.isAdmin()" (click)="removeUser(user)"></span>
+ <td>{{ user.email }}</td>
+ <td>{{ user.videoQuota }}</td>
+ <td>{{ user.roleLabel }}</td>
+ <td>{{ user.createdAt }}</td>
+ <td class="action-cell">
+ <my-edit-button [routerLink]="getRouterUserEditLink(user)"></my-edit-button>
+ <my-delete-button (click)="removeUser(user)"></my-delete-button>
</td>
</tr>
- </tbody>
-</table>
-
-<a class="add-user btn btn-success pull-right" [routerLink]="['/admin/users/add']">
- <span class="glyphicon glyphicon-plus"></span>
- Add user
-</a>
+ </ng-template>
+</p-table>