Skip to content
Snippets Groups Projects
Commit dceeb350 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #13271 TIME 0:15 get real count filter

parent 680004a0
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<mat-selection-list #filterList *ngFor="let filterKey of filters | keyvalue" class="filter-list"> <mat-selection-list #filterList *ngFor="let filterKey of filters | keyvalue" class="filter-list">
<div class="catGroupTitle">{{'lang.'+filterKey.key | translate}} ({{filters[filterKey.key]['values'].length}})</div> <ng-container *ngIf="getRealCount(filterKey.key) > 0">
<mat-divider style="width: 80%;"></mat-divider> <div class="catGroupTitle">{{'lang.'+filterKey.key | translate}} ({{getRealCount(filterKey.key)}})</div>
<mat-divider style="width: 80%;"></mat-divider>
</ng-container>
<ng-container *ngFor="let cat of filters[filterKey.key]['values'];let i=index"> <ng-container *ngFor="let cat of filters[filterKey.key]['values'];let i=index">
<ng-container *ngIf="cat.count > 0 || (cat.count === 0 && cat.selected)"> <ng-container *ngIf="cat.count > 0 || (cat.count === 0 && cat.selected)">
<mat-list-option color="primary" class="catContent" *ngIf="i < 5 || filters[filterKey.key]['expand']" (click)="toggleFilter(filterKey.key,i)" [selected]="cat.selected" checkboxPosition="before" [disabled]="isLoadingResults"> <mat-list-option color="primary" class="catContent" *ngIf="i < 5 || filters[filterKey.key]['expand']" (click)="toggleFilter(filterKey.key,i)" [selected]="cat.selected" checkboxPosition="before" [disabled]="isLoadingResults">
...@@ -14,6 +16,6 @@ ...@@ -14,6 +16,6 @@
</mat-list-option> </mat-list-option>
</ng-container> </ng-container>
</ng-container> </ng-container>
<button mat-button *ngIf="filters[filterKey.key]['values'].length > 5" style="width:100%;" color="primary" (click)="toggleDisplay(filterKey.key)">{{filters[filterKey.key]['expand'] ? ('lang.less' | translate) : ('lang.more' | translate) }}<mat-icon style="height:auto;" class="fas" [class.fa-chevron-down]="!filters[filterKey.key]['expand']" [class.fa-chevron-up]="filters[filterKey.key]['expand']"></mat-icon></button> <button mat-button *ngIf="getRealCount(filterKey.key) > 5" style="width:100%;" color="primary" (click)="toggleDisplay(filterKey.key)">{{filters[filterKey.key]['expand'] ? ('lang.less' | translate) : ('lang.more' | translate) }}<mat-icon style="height:auto;" class="fas" [class.fa-chevron-down]="!filters[filterKey.key]['expand']" [class.fa-chevron-up]="filters[filterKey.key]['expand']"></mat-icon></button>
</mat-selection-list> </mat-selection-list>
</mat-expansion-panel> </mat-expansion-panel>
...@@ -36,4 +36,8 @@ export class FilterToolComponent implements OnInit { ...@@ -36,4 +36,8 @@ export class FilterToolComponent implements OnInit {
toggleDisplay(key: string) { toggleDisplay(key: string) {
this.filters[key]['expand'] = !this.filters[key]['expand']; this.filters[key]['expand'] = !this.filters[key]['expand'];
} }
getRealCount(key: string) {
return this.filters[key]['values'].filter((item: any) => item.count > 0 || (item.count === 0 && item.selected)).length;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment