finish all getall into table
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<nz-table [nzData]="authors()"
|
||||
[nzLoading]="authorsLoading()">
|
||||
[nzLoading]="authorsLoading()"
|
||||
[nzFrontPagination]="false">
|
||||
<thead>
|
||||
<tr style="text-align: center">
|
||||
<th>Prénom</th>
|
||||
@@ -15,7 +16,8 @@
|
||||
<td>{{ author.firstName }}</td>
|
||||
<td>
|
||||
<app-modal type="link" [name]="'Voir les livres'">
|
||||
<nz-table [nzData]="authors()">
|
||||
<nz-table [nzData]="authors()"
|
||||
[nzFrontPagination]="false">
|
||||
<thead>
|
||||
<tr style="text-align: center">
|
||||
<th>Titre</th>
|
||||
@@ -36,10 +38,19 @@
|
||||
</app-modal>
|
||||
</td>
|
||||
<td>
|
||||
<app-modal [name]="'Modifier'">
|
||||
<app-update-loan></app-update-loan>
|
||||
</app-modal>
|
||||
<button nz-button nzType="primary" (click)="delete()" class="bg-red-600 border-red-600">Supprimer</button>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<td>
|
||||
<app-modal [name]="'Modifier'">
|
||||
<app-update-author></app-update-author>
|
||||
</app-modal>
|
||||
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
|
||||
<div>
|
||||
<button nz-button nzType="primary" (click)="delete()" class="bg-red-600 border-red-600">Supprimer</button>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@@ -5,20 +5,22 @@ import {AuthorsService, GetAuthorDto} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||
import {UpdateLoan} from "../update-loan/update-loan";
|
||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||
import {UpdateAuthor} from "../update-author/update-author";
|
||||
|
||||
@Component({
|
||||
selector: 'app-author-card',
|
||||
selector: 'app-author-table',
|
||||
imports: [
|
||||
Modal,
|
||||
NzButtonComponent,
|
||||
NzTableComponent,
|
||||
UpdateLoan
|
||||
NzDividerComponent,
|
||||
UpdateAuthor
|
||||
],
|
||||
templateUrl: './author-card.html',
|
||||
styleUrl: './author-card.css',
|
||||
templateUrl: './author-table.html',
|
||||
styleUrl: './author-table.css',
|
||||
})
|
||||
export class AuthorCard implements OnInit {
|
||||
export class AuthorTable implements OnInit {
|
||||
private authorsService = inject(AuthorsService);
|
||||
private notificationService = inject(NzNotificationService)
|
||||
|
||||
@@ -36,6 +38,8 @@ export class AuthorCard implements OnInit {
|
||||
try {
|
||||
const authors = await firstValueFrom(this.authorsService.getAllAuthorsEndpoint());
|
||||
|
||||
this.authors.set(authors);
|
||||
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
@@ -1,29 +0,0 @@
|
||||
<nz-table [nzData]="books()"
|
||||
[nzLoading]="booksLoading()">
|
||||
<thead>
|
||||
<tr style="text-align: center">
|
||||
<th>Titre</th>
|
||||
<th>ISBN</th>
|
||||
<th>Auteur</th>
|
||||
<th>Date de publication</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="text-align: center">
|
||||
@for (book of books(); track book.id) {
|
||||
<tr>
|
||||
<td>{{ book.title}}</td>
|
||||
<td>{{ book.isbn }}</td>
|
||||
<td>{{ book.bookAuthorName }} {{ book.bookAuthorFirstName }}</td>
|
||||
<td>{{ book.releaseYear}}</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<app-modal [name]="'Modifier'">
|
||||
<app-update-user></app-update-user>
|
||||
</app-modal>
|
||||
<button nz-button nzType="primary" (click)="delete()" class="bg-red-600 border-red-600">Supprimer</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</nz-table>
|
||||
36
src/app/components/book-table/book-table.html
Normal file
36
src/app/components/book-table/book-table.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<nz-table [nzData]="books()"
|
||||
[nzLoading]="booksLoading()"
|
||||
[nzFrontPagination]="false">
|
||||
<thead>
|
||||
<tr style="text-align: center">
|
||||
<th>Titre</th>
|
||||
<th>ISBN</th>
|
||||
<th>Auteur</th>
|
||||
<th>Date de publication</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="text-align: center">
|
||||
@for (book of books(); track book.id) {
|
||||
<tr>
|
||||
<td>{{ book.title}}</td>
|
||||
<td>{{ book.isbn }}</td>
|
||||
<td>{{ book.bookAuthorName }} {{ book.bookAuthorFirstName }}</td>
|
||||
<td>{{ book.releaseYear}}</td>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<td>
|
||||
<app-modal [name]="'Modifier'">
|
||||
<app-update-book></app-update-book>
|
||||
</app-modal>
|
||||
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
|
||||
<div>
|
||||
<button nz-button nzType="primary" (click)="delete()" class="bg-red-600 border-red-600">Supprimer</button>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</nz-table>
|
||||
@@ -5,20 +5,22 @@ import {BooksService, GetBookDto} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||
import {UpdateUser} from "../update-user/update-user";
|
||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||
import {UpdateBook} from "../update-book/update-book";
|
||||
|
||||
@Component({
|
||||
selector: 'app-book-card',
|
||||
selector: 'app-book-table',
|
||||
imports: [
|
||||
Modal,
|
||||
NzButtonComponent,
|
||||
NzTableComponent,
|
||||
UpdateUser,
|
||||
NzDividerComponent,
|
||||
UpdateBook,
|
||||
],
|
||||
templateUrl: './book-card.html',
|
||||
styleUrl: './book-card.css',
|
||||
templateUrl: './book-table.html',
|
||||
styleUrl: './book-table.css',
|
||||
})
|
||||
export class BookCard implements OnInit {
|
||||
export class BookTable implements OnInit {
|
||||
private booksService = inject(BooksService);
|
||||
private notificationService = inject(NzNotificationService)
|
||||
|
||||
@@ -36,6 +38,9 @@ export class BookCard implements OnInit {
|
||||
try {
|
||||
const books = await firstValueFrom(this.booksService.getAllBooksEndpoint());
|
||||
|
||||
this.books.set(books);
|
||||
|
||||
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
@@ -18,12 +18,19 @@
|
||||
<td>{{ loan.date | date: 'dd/MM/yyyy' }}</td>
|
||||
<td>{{ loan.plannedReturningDate | date: 'dd/MM/yyyy'}}</td>
|
||||
<td>{{ loan.effectiveReturningDate | date: 'dd/MM/yyyy'}}</td>
|
||||
<td>
|
||||
<app-modal [name]="'Modifier'">
|
||||
<app-update-loan></app-update-loan>
|
||||
</app-modal>
|
||||
<button nz-button nzType="primary" (click)="delete()" class="bg-red-600 border-red-600">Supprimer</button>
|
||||
</td>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<td>
|
||||
<app-modal [name]="'Modifier'">
|
||||
<app-update-loan></app-update-loan>
|
||||
</app-modal>
|
||||
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
|
||||
<div>
|
||||
<button nz-button nzType="primary" (click)="delete()" class="bg-red-600 border-red-600">Supprimer</button>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@@ -7,6 +7,7 @@ import {UpdateLoan} from "../update-loan/update-loan";
|
||||
import {GetLoanDto, LoansService} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||
|
||||
@Component({
|
||||
selector: 'app-loan-table',
|
||||
@@ -15,7 +16,8 @@ import {firstValueFrom} from "rxjs";
|
||||
Modal,
|
||||
NzButtonComponent,
|
||||
NzTableComponent,
|
||||
UpdateLoan
|
||||
UpdateLoan,
|
||||
NzDividerComponent,
|
||||
],
|
||||
templateUrl: './loan-table.html',
|
||||
styleUrl: './loan-table.css',
|
||||
@@ -38,6 +40,8 @@ export class LoanTable implements OnInit {
|
||||
try {
|
||||
const loans = await firstValueFrom(this.loansService.getAllLoanEndpoint())
|
||||
|
||||
this.loans.set(loans);
|
||||
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<nz-table [nzData]="users()"
|
||||
[nzLoading]="usersLoading()">
|
||||
[nzLoading]="usersLoading()"
|
||||
[nzFrontPagination]="false"
|
||||
>
|
||||
<thead>
|
||||
<tr style="text-align: center">
|
||||
<th>Nom</th>
|
||||
@@ -19,7 +21,8 @@
|
||||
<td>{{ user.birthDate | date: 'dd/MM/yyyy'}}</td>
|
||||
<td>
|
||||
<app-modal type="link" [name]="'Voir les emprunts'">
|
||||
<nz-table [nzData]="users()">
|
||||
<nz-table [nzData]="users()"
|
||||
[nzFrontPagination]="false">
|
||||
<thead>
|
||||
<tr style="text-align: center">
|
||||
<th>Livre</th>
|
||||
@@ -40,10 +43,19 @@
|
||||
</app-modal>
|
||||
</td>
|
||||
<td>
|
||||
<app-modal [name]="'Modifier'">
|
||||
<app-update-user></app-update-user>
|
||||
</app-modal>
|
||||
<button nz-button nzType="primary" (click)="delete()" class="bg-red-600 border-red-600">Supprimer</button>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<td>
|
||||
<app-modal [name]="'Modifier'">
|
||||
<app-update-user></app-update-user>
|
||||
</app-modal>
|
||||
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
|
||||
<div>
|
||||
<button nz-button nzType="primary" (click)="delete()" class="bg-red-600 border-red-600">Supprimer</button>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {UpdateUser} from "../update-user/update-user";
|
||||
import {GetUserDto, UsersService} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-table',
|
||||
@@ -16,6 +17,7 @@ import {firstValueFrom} from "rxjs";
|
||||
NzButtonComponent,
|
||||
NzTableComponent,
|
||||
UpdateUser,
|
||||
NzDividerComponent,
|
||||
],
|
||||
templateUrl: './user-table.html',
|
||||
styleUrl: './user-table.css',
|
||||
@@ -38,6 +40,7 @@ export class UserTable implements OnInit {
|
||||
try {
|
||||
const users = await firstValueFrom(this.usersService.getAllUsersEndpoint())
|
||||
|
||||
this.users.set(users);
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
|
||||
Reference in New Issue
Block a user