ajout de filtrage dans les cas similaires

This commit is contained in:
Tykayn 2025-09-25 17:47:29 +02:00 committed by tykayn
parent a4645638cd
commit a2afad0545
2 changed files with 7 additions and 1 deletions

View file

@ -93,6 +93,8 @@
class="search" class="search"
placeholder="Use keywords for a precise research" placeholder="Use keywords for a precise research"
[(ngModel)]="searchSimilarInput" [(ngModel)]="searchSimilarInput"
(input)="filterResults()"
(keyup.enter)="filterResults()"
type="text"> type="text">
<button (click)="filterResults()" class="search-submit"> <button (click)="filterResults()" class="search-submit">
<i class="ri-send-plane-fill"></i> <i class="ri-send-plane-fill"></i>

View file

@ -40,11 +40,15 @@ export class SimilarCases {
this.appState = app; this.appState = app;
// Initialize filteredSimilarCases with all cases by default // Initialize filteredSimilarCases with all cases by default
this.filteredSimilarCases = this.appState.similarCases || []; this.filteredSimilarCases = this.appState.similarCases || [];
// Réappliquer le filtre si un terme est présent
if (this.searchSimilarInput && this.searchSimilarInput.trim()) {
this.filterResults();
}
}); });
} }
filterResults() { filterResults() {
if (!this.appState.similarCases) { if (!this.appState || !Array.isArray(this.appState.similarCases)) {
this.filteredSimilarCases = []; this.filteredSimilarCases = [];
return; return;
} }