added search into all selects on all forms

This commit is contained in:
2025-11-23 14:38:25 +01:00
parent af1dec318f
commit aa96fa25ca
9 changed files with 24 additions and 7 deletions

View File

@@ -25,7 +25,7 @@
</nz-form-label>
<nz-form-control nzSpan="40" nzErrorTip="Ce champ est requis">
<nz-select formControlName="authorId" [nzPlaceHolder]="'Choisir un auteur'">
<nz-select formControlName="authorId" [nzPlaceHolder]="'Choisir un auteur'" nzShowSearch [nzFilterOption]="filterAuthor">
@for (author of authors(); track author.id) {
<nz-option [nzValue]="author.id" [nzLabel]="author.firstName + ' ' + author.name"></nz-option>
}

View File

@@ -37,4 +37,8 @@ export class CreateBook implements OnInit {
async ngOnInit() {
await this.fetchAuthors();
}
filterAuthor(input: string, option: any) {
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
}
}

View File

@@ -5,7 +5,7 @@
</nz-form-label>
<nz-form-control nzSpan="40" nzErrorTip="Ce champ est requis">
<nz-select formControlName="userId" [nzPlaceHolder]="'Choisir un utilisateur'">
<nz-select formControlName="userId" [nzPlaceHolder]="'Choisir un utilisateur'" nzShowSearch [nzFilterOption]="filter">
@for (user of users(); track user.id) {
<nz-option [nzValue]="user.id" [nzLabel]="user.firstName + ' ' + user.name"></nz-option>
}
@@ -19,7 +19,7 @@
</nz-form-label>
<nz-form-control nzSpan="40" nzErrorTip="Ce champ est requis">
<nz-select formControlName="bookId" [nzPlaceHolder]="'Choisir un livre'">
<nz-select formControlName="bookId" [nzPlaceHolder]="'Choisir un livre'" nzShowSearch [nzFilterOption]="filter">
@for (book of books(); track book.id) {
<nz-option [nzValue]="book.id" [nzLabel]="book.title"></nz-option>
}

View File

@@ -60,4 +60,8 @@ export class CreateLoan implements OnInit {
await this.fetchUsers();
await this.fetchBooks();
}
filter(input: string, option: any) {
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
}
}

View File

@@ -1,5 +1,6 @@
<nz-table [nzData]="loans()"
[nzLoading]="loansLoading()">
[nzLoading]="loansLoading()"
[nzFrontPagination]="false">
<thead>
<tr style="text-align: center">
<th>Utilisateur</th>

View File

@@ -25,7 +25,7 @@
</nz-form-label>
<nz-form-control nzSpan="40" nzErrorTip="Ce champ est requis">
<nz-select formControlName="authorId" [nzPlaceHolder]="'Choisir un auteur'">
<nz-select formControlName="authorId" [nzPlaceHolder]="'Choisir un auteur'" nzShowSearch [nzFilterOption]="filterAuthor">
@for (author of authors(); track author.id) {
<nz-option [nzValue]="author.id" [nzLabel]="author.firstName + ' ' + author.name"></nz-option>
}

View File

@@ -49,4 +49,8 @@ export class UpdateBook implements OnInit {
async ngOnInit() {
await this.fetchAuthors();
}
filterAuthor(input: string, option: any) {
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
}
}

View File

@@ -5,7 +5,7 @@
</nz-form-label>
<nz-form-control nzSpan="40" nzErrorTip="Ce champ est requis">
<nz-select formControlName="userId" [nzPlaceHolder]="'Choisir un utilisateur'">
<nz-select formControlName="userId" [nzPlaceHolder]="'Choisir un utilisateur'" nzShowSearch [nzFilterOption]="filter">
@for (user of users(); track user.id) {
<nz-option [nzValue]="user.id" [nzLabel]="user.firstName + ' ' + user.name"></nz-option>
}
@@ -19,7 +19,7 @@
</nz-form-label>
<nz-form-control nzSpan="40" nzErrorTip="Ce champ est requis">
<nz-select formControlName="bookId" [nzPlaceHolder]="'Choisir un livre'">
<nz-select formControlName="bookId" [nzPlaceHolder]="'Choisir un livre'" nzShowSearch [nzFilterOption]="filter">
@for (book of books(); track book.id) {
<nz-option [nzValue]="book.id" [nzLabel]="book.title"></nz-option>
}

View File

@@ -84,4 +84,8 @@ export class UpdateLoan implements OnInit {
await this.fetchUsers();
await this.fetchBooks();
}
filter(input: string, option: any) {
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
}
}