From d8ede2fd6f231fb543914773a6f4b521dc162f3a Mon Sep 17 00:00:00 2001 From: "hamza.hramchi" <hamza.hramchi@xelians.fr> Date: Thu, 31 Dec 2020 12:33:50 +0100 Subject: [PATCH] FEAT #15550 TIME 0:10 Be able to validate with the Enter key on the search page for the two inputs --- src/frontend/app/search/search.component.html | 2 +- src/frontend/app/search/search.component.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/frontend/app/search/search.component.html b/src/frontend/app/search/search.component.html index c1337b9e69..d99e80b59e 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 474d4d9eab..518af611a0 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 = []; + } + } + } } -- GitLab