created all delete functions

This commit is contained in:
2025-11-21 18:51:35 +01:00
parent 230560dbbc
commit ebea9f1a6b
7 changed files with 46 additions and 12 deletions

View File

@@ -43,7 +43,7 @@
<div style="display: flex; align-items: center;">
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer"></nz-icon>
<nz-divider nzType="vertical"></nz-divider>
<nz-icon nzType="delete" nzTheme="outline" class="text-red-600 cursor-pointer"></nz-icon>
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(author.id)" class="text-red-600 cursor-pointer"></nz-icon>
</div>
</td>
</div>

View File

@@ -51,7 +51,19 @@ export class AuthorTable implements OnInit {
this.authorsLoading.set(false)
}
delete() {
return
async delete(author:number) {
try {
await firstValueFrom(this.authorsService.deleteAuthorEndpoint(author))
this.notificationService.success(
'Success',
'Suppression effectuée'
)
} catch (e) {
this.notificationService.error(
'Erreur',
'Impossible de supprimer la ligne'
)
}
await this.fetchauthors();
}
}

View File

@@ -22,7 +22,7 @@
<div style="display: flex; align-items: center;">
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer"></nz-icon>
<nz-divider nzType="vertical"></nz-divider>
<nz-icon nzType="delete" nzTheme="outline" class="text-red-600 cursor-pointer"></nz-icon>
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(book.id)" class="text-red-600 cursor-pointer"></nz-icon>
</div>
</td>
</div>

View File

@@ -50,7 +50,19 @@ export class BookTable implements OnInit {
this.booksLoading.set(false)
}
delete() {
return
async delete(book:number) {
try {
await firstValueFrom(this.booksService.deleteBookEndpoint(book))
this.notificationService.success(
'Success',
'Suppression effectuée'
)
} catch (e) {
this.notificationService.error(
'Erreur',
'Impossible de supprimer la ligne'
)
}
await this.fetchbooks();
}
}

View File

@@ -23,7 +23,7 @@
<div style="display: flex; align-items: center;">
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer"></nz-icon>
<nz-divider nzType="vertical"></nz-divider>
<nz-icon nzType="delete" nzTheme="outline" class="text-red-600 cursor-pointer"></nz-icon>
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(loan.id)" class="text-red-600 cursor-pointer"></nz-icon>
</div>
</td>
</div>

View File

@@ -51,7 +51,19 @@ export class LoanTable implements OnInit {
this.loansLoading.set(false)
}
delete() {
return
async delete(loan: number) {
try {
await firstValueFrom(this.loansService.deleteLoanEndpoint(loan))
this.notificationService.success(
'Success',
'Suppression effectuée'
)
} catch (e) {
this.notificationService.error(
'Erreur',
'Impossible de supprimer la ligne'
)
}
await this.fetchloans();
}
}

View File

@@ -46,9 +46,7 @@
(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>
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(user.id)" class="text-red-600 cursor-pointer"></nz-icon>
</div>
</td>
</tr>