Skip to content

Commit

Permalink
filters with 0
Browse files Browse the repository at this point in the history
  • Loading branch information
amirbashan committed Dec 25, 2024
1 parent daaf933 commit ab467a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@for (item of filtersState.staticFilters; track item.key) {
@if (item.key?.indexOf('human_situation') === 0 && item.key && filtersState.situationsMap[item.key]) {
<app-situation
*ngIf='isShowFilter(item)'
[situation]='filtersState.situationsMap[item.key]'
[selected]='(filtersState.allFilteredSituations || []).indexOf(item.key) > -1'
[selectable]='true'
Expand All @@ -21,6 +22,7 @@
></app-situation>
} @else if (item.key?.indexOf('human_service') === 0 && item.key && filtersState.responsesMap[item.key]) {
<app-response
*ngIf='isShowFilter(item)'
[response]='filtersState.responsesMap[item.key]'
[selected]='(filtersState.currentSearchParams.filter_responses || []).indexOf(item.key) > -1'
[dynamic]='true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ export class SearchFiltersBarComponent implements OnInit {

ngOnInit(): void {
}

isShowFilter(item: any): boolean {
if (!item) return false;
const isSituationSelected = this.filtersState.allFilteredSituations.includes(item.key);
const isResponseSelected = this.filtersState.allFilteredResponses.includes(item.key);
return isSituationSelected || isResponseSelected || item.doc_count > 0;
}
}

0 comments on commit ab467a0

Please sign in to comment.