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  420x 7x 7x 7x   7x 7x     210x   210x     4x 4x 4x 4x 4x 4x 4x 4x   7x   324x 324x 324x 324x 12x 156x 12x 12x 156x 12x 12x 312x 104x   12x 52x     12x     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_active">Status <p-sortIcon field="is_active"></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-users>
            <tr>
                <td>{{ users.lastname }}</td>
                <td>{{ users.firstname }}</td>
                <td>{{ users.email }}</td>
                <td>{{ users.company_id }}</td>
                <td>
                    <p-tag [value]="getStatus(users.is_active)" [severity]="users.is_active ? 'warn' : 'success' " />
                </td>
                <td>
                    <p-tag [value]="getRole(users.is_admin)" [severity]="users.is_admin ? 'contrast' : 'info' " />
                </td>
                <td>
                    @if (this.actualUserId !== users.id) {
                        <a href="#" [routerLink]="['/users/', users.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>