From 23996461ea96953e551326aa04071d391a4fa181 Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Mon, 19 Oct 2020 19:30:17 +0200 Subject: [PATCH] FEAT #13271 TIME 0:20 fix reset criteria (specific beheavior contact) --- .../contact/autocomplete/contact-autocomplete.component.ts | 5 +++++ .../app/search/criteria-tool/criteria-tool.component.ts | 6 +++++- .../app/search/result-list/search-result-list.component.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/frontend/app/contact/autocomplete/contact-autocomplete.component.ts b/src/frontend/app/contact/autocomplete/contact-autocomplete.component.ts index 384f0f20ba0..be0d553472a 100755 --- a/src/frontend/app/contact/autocomplete/contact-autocomplete.component.ts +++ b/src/frontend/app/contact/autocomplete/contact-autocomplete.component.ts @@ -380,4 +380,9 @@ export class ContactAutocompleteComponent implements OnInit { getInputValue() { return this.myControl.value; } + + + resetInputValue() { + this.myControl.setValue(''); + } } diff --git a/src/frontend/app/search/criteria-tool/criteria-tool.component.ts b/src/frontend/app/search/criteria-tool/criteria-tool.component.ts index 2efc4b30d52..4371313f579 100644 --- a/src/frontend/app/search/criteria-tool/criteria-tool.component.ts +++ b/src/frontend/app/search/criteria-tool/criteria-tool.component.ts @@ -143,7 +143,7 @@ export class CriteriaToolComponent implements OnInit { } isCurrentCriteriaById(criteriaIds: string[]) { - return this.currentCriteria.filter((currCrit: any) => criteriaIds.indexOf(currCrit.identifier) === 0).length > 0; + return this.currentCriteria.filter((currCrit: any) => criteriaIds.indexOf(currCrit.identifier) > -1).length > 0; } @@ -311,6 +311,10 @@ export class CriteriaToolComponent implements OnInit { field.control.setValue(criteria[field.identifier].values); } } + + if ((['recipients', 'senders'].indexOf(field.identifier) > -1 || field.type === 'contact') && this.functions.empty(criteria[field.identifier].values)) { + this.appContactAutocomplete.toArray().filter((component: any) => component.id === field.identifier)[0].resetInputValue(); + } }); if (Object.keys(criteria)[0] === 'meta') { diff --git a/src/frontend/app/search/result-list/search-result-list.component.ts b/src/frontend/app/search/result-list/search-result-list.component.ts index 8fe349473d0..d2f66468cd6 100644 --- a/src/frontend/app/search/result-list/search-result-list.component.ts +++ b/src/frontend/app/search/result-list/search-result-list.component.ts @@ -562,7 +562,7 @@ export class SearchResultListComponent implements OnInit, OnDestroy { if (Object.keys(this.criteria).indexOf(this.indexingFieldService.mappingdata[data.value]) > -1) { if (Array.isArray(this.criteria[this.indexingFieldService.mappingdata[data.value]].values)) { this.criteria[this.indexingFieldService.mappingdata[data.value]].values.forEach((val: any) => { - data.displayValue = this.highlightPipe.transform(data.displayValue, val.label.replace(/ /g, '')); + data.displayValue = this.highlightPipe.transform(data.displayValue, !this.functions.empty(val.label) ? val.label.replace(/ /g, '') : val); }); } else { data.displayValue = this.highlightPipe.transform(data.displayValue, this.criteria[this.indexingFieldService.mappingdata[data.value]].values); -- GitLab