diff --git a/src/frontend/app/search/search.component.html b/src/frontend/app/search/search.component.html index c1337b9e6932ed0d2d4d5397e3c77d2f24b7d9de..d99e80b59e5d3822e525127220ad094912728b49 100644 --- a/src/frontend/app/search/search.component.html +++ b/src/frontend/app/search/search.component.html @@ -154,7 +154,7 @@ <ion-item> <ion-label color="secondary" position="floating">{{'lang.' + filter.id + 'Search' | translate}} </ion-label> - <ion-input [(ngModel)]="filter.val" [value]="filter.val"></ion-input> + <ion-input [(ngModel)]="filter.val" [value]="filter.val" (keyup.enter)="launchSearch()" (ionChange)="checkInput()"></ion-input> </ion-item> </ng-container> <ng-container *ngIf="filter.type === 'checkbox'"> diff --git a/src/frontend/app/search/search.component.ts b/src/frontend/app/search/search.component.ts index 474d4d9eab261f366ea549bae8c75bd43314d6a2..518af611a0994dce4e6f9c232e413cc02fe8ff78 100644 --- a/src/frontend/app/search/search.component.ts +++ b/src/frontend/app/search/search.component.ts @@ -452,4 +452,13 @@ export class SearchComponent implements OnInit { const obj = this.filters.filter((item: any) => item.id === 'workflowStates')[0].values; return obj.find((element: any) => element.id === filter).label; } + + checkInput() { + if ((this.filters.find((el: any) => el.id === 'title').val === '') && (this.filters.find((el: any) => el.id === 'reference').val === '')) { + if (this.filters.find((el: any) => el.id === 'workflowStates').val.length === 0 || this.filters.find((el: any) => el.id === 'workflowUsers').val.length === 0) { + this.clearFilters(); + this.currentFilters = []; + } + } + } }