Files
library-frontend/src/app/components/user-table/user-table.html

64 lines
2.7 KiB
HTML

<nz-table [nzData]="users()"
[nzLoading]="usersLoading()"
[nzFrontPagination]="false">
<thead>
<tr style="text-align: center">
<th>Nom</th>
<th>Prénom</th>
<th>Email</th>
<th>Anniversaire</th>
<th>Emprunt</th>
<th style="display: flex; align-items: center;">Action</th>
</tr>
</thead>
<tbody style="text-align: center">
@for (user of users(); track user.id) {
<tr>
<td>{{ user.name }}</td>
<td>{{ user.firstName }}</td>
<td>{{ user.email }}</td>
<td>{{ user.birthDate | date: 'dd/MM/yyyy'}}</td>
<td>
<app-modal type="link" [name]="'Voir les emprunts'">
<nz-table [nzData]="user.loans" [nzFrontPagination]="false">
<thead>
<tr style="text-align: center">
<th>Livre</th>
<th>Date d'enregistrement</th>
<th>Date de retour finale</th>
</tr>
</thead>
<tbody style="text-align: center">
@for (loan of user.loans; track loan.id) {
<tr>
<td>{{ loan.bookTitle }}</td>
<td>{{ loan.date | date: 'dd/MM/yyyy' }}</td>
<td>{{ loan.effectiveReturningDate | date: 'dd/MM/yyyy'}}</td>
</tr>
}
</tbody>
</nz-table>
</app-modal>
</td>
<td>
<div style="display: flex; align-items: center;">
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer"
(click)="openEditModal(user)">
</nz-icon>
<nz-divider nzType="vertical"></nz-divider>
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(user.id)"
class="text-red-600 cursor-pointer">
</nz-icon>
</div>
</td>
</tr>
}
</tbody>
</nz-table>
<div class="hidden">
<app-modal-icon #modalIcon nameIcon="edit" [name]="'Modifier'" (ok)="onModalOk(selectedUser?.id, updateUser, modalIcon)" (cancel)="onModalCancel(modalIcon)">
<app-update-user #updateUser [user]="selectedUser"></app-update-user>
</app-modal-icon>
</div>