All files / src/app/components/users-table users-table.component.html

100% Statements 75/75
100% Branches 6/6
100% Functions 0/0
100% Lines 34/34

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  404x 7x 7x 7x   7x 7x     202x   202x     4x 4x 4x 4x 4x 4x 4x 4x   7x   368x 368x 368x 368x 16x 176x 16x 16x 176x 16x 16x 352x 132x   16x 44x     16x     7x  
<div class="margin-bot">
    <button [routerLink]="['/admin']" class="button is-rounded">
        <i class="pi pi-chevron-left"></i>
        <span>Admin</span>
    </button>
 
    <span class="title margin-left">Users</span>
</div>
 
<div class="container">
    <p-table [value]="users" [tableStyle]="{ 'min-width': '50rem' }" [paginator]="true" [rows]="10"
    [rowsPerPageOptions]="[10, 20, 50]" [showCurrentPageReport]="true"
    currentPageReportTemplate="{first} - {last} of {totalRecords} users" [rowHover]="true">
        <ng-template #header>
            <tr>
                <th pSortableColumn="lastname">Lastname <p-sortIcon field="lastname"></p-sortIcon></th>
                <th pSortableColumn="firstname">Firstname <p-sortIcon field="firstname"></p-sortIcon></th>
                <th pSortableColumn="email">Email <p-sortIcon field="email"></p-sortIcon></th>
                <th pSortableColumn="company_id">Company <p-sortIcon field="company_id"></p-sortIcon></th>
                <th pSortableColumn="is_blocked">Status <p-sortIcon field="is_blocked"></p-sortIcon></th>
                <th pSortableColumn="is_admin">Role <p-sortIcon field="is_admin"></p-sortIcon></th>
                <th>Action</th>
            </tr>
        </ng-template>
        <ng-template #body let-user>
            <tr>
                <td>{{ user.lastname }}</td>
                <td>{{ user.firstname }}</td>
                <td>{{ user.email }}</td>
                <td>{{ user.company_id }}</td>
                <td>
                    <p-tag [value]="getStatus(user.is_blocked)" [severity]="user.is_blocked ? 'warn' : 'success' " />
                </td>
                <td>
                    <p-tag [value]="getRole(user.is_admin)" [severity]="user.is_admin ? 'contrast' : 'info' " />
                </td>
                <td>
                    @if (this.actualUserId !== user.id) {
                        <a href="#" [routerLink]="['/users/', user.id]" class="pi pi-pen-to-square"><i class="fa fa-edit edit"></i></a>
                    }
                    @else {
                        <a href="#" [routerLink]="['/profile']" class="pi pi-pen-to-square"><i class="fa fa-edit edit"></i></a>
                    }
                </td>
            </tr>
        </ng-template>
    </p-table>
</div>