diff --git a/src/app/components/shared/list-statistic/list-statistic.component.html b/src/app/components/shared/list-statistic/list-statistic.component.html index 38d9106cd103e4d892f679f67e6d4a7871eee61d..25e324e3be02ff74960b4beb2fcfb87a3d14bab2 100644 --- a/src/app/components/shared/list-statistic/list-statistic.component.html +++ b/src/app/components/shared/list-statistic/list-statistic.component.html @@ -1,39 +1,39 @@ <mat-toolbar></mat-toolbar> <mat-progress-bar class="progress-theme" mode="determinate" value="{{total}}" - *ngIf="total > statusGood" color="primary"></mat-progress-bar> + *ngIf="total > status.good" color="primary"></mat-progress-bar> <mat-progress-bar class="progress-theme" mode="determinate" value="{{total}}" - *ngIf="total < statusGood && total >= statusOkay" color="accent"></mat-progress-bar> + *ngIf="total < status.good && total >= status.okay" color="accent"></mat-progress-bar> <mat-progress-bar class="progress-theme" mode="determinate" value="{{total}}" - *ngIf="total < statusOkay && total > statusEmpty" color="warn"></mat-progress-bar> + *ngIf="total < status.okay && total > status.empty" color="warn"></mat-progress-bar> <mat-toolbar></mat-toolbar> <table mat-table [dataSource]="dataSource" class="mat-elevation-z8"> <ng-container matColumnDef="content"> <mat-header-cell *matHeaderCellDef> Content </mat-header-cell> - <mat-cell *matCellDef="let cp" [ngClass]="{'positiveC' : cp.percent >= statusGood, - 'okayC' : cp.percent >= statusOkay && cp.percent < statusGood, 'negativeC' : cp.percent < statusOkay, - 'emptyCC' : cp.percent < statusZero }">{{cp.content.subject}}</mat-cell> + <mat-cell *matCellDef="let cp" [ngClass]="{'positiveC' : cp.percent >= status.good, + 'okayC' : cp.percent >= status.okay && cp.percent < status.good, 'negativeC' : cp.percent < status.okay, + 'emptyCC' : cp.percent < status.zero }">{{cp.content.subject}}</mat-cell> </ng-container> <ng-container matColumnDef="percentage"> <mat-header-cell *matHeaderCellDef> Percentage </mat-header-cell> - <mat-cell *matCellDef="let cp" [ngClass]="{'positiveC' : cp.percent >= statusGood, - 'okayC' : cp.percent >= statusOkay && cp.percent < statusGood, 'negativeC' : cp.percent < statusOkay, - 'emptyC' : cp.percent < statusZero }">{{cp.percent.toFixed() + ' %'}}</mat-cell> + <mat-cell *matCellDef="let cp" [ngClass]="{'positiveC' : cp.percent >= status.good, + 'okayC' : cp.percent >= status.okay && cp.percent < status.good, 'negativeC' : cp.percent < status.okay, + 'emptyC' : cp.percent < status.zero }">{{cp.percent.toFixed() + ' %'}}</mat-cell> </ng-container> <ng-container matColumnDef="counts"> <mat-header-cell *matHeaderCellDef> Total </mat-header-cell> - <mat-cell *matCellDef="let cp" [ngClass]="{'positiveC' : cp.percent >= statusGood, - 'okayC' : cp.percent >= statusOkay && cp.percent < statusGood, 'negativeC' : cp.percent < statusOkay, - 'emptyC' : cp.percent < statusZero }">{{cp.counts}}</mat-cell> + <mat-cell *matCellDef="let cp" [ngClass]="{'positiveC' : cp.percent >= status.good, + 'okayC' : cp.percent >= status.okay && cp.percent < status.good, 'negativeC' : cp.percent < status.okay, + 'emptyC' : cp.percent < status.zero }">{{cp.counts}}</mat-cell> </ng-container> <ng-container matColumnDef="abstentions"> <mat-header-cell *matHeaderCellDef> Abstentions </mat-header-cell> - <mat-cell *matCellDef="let cp" [ngClass]="{'positiveC' : cp.percent >= statusGood, - 'okayC' : cp.percent >= statusOkay && cp.percent < statusGood, 'negativeC' : cp.percent < statusOkay, - 'emptyC' : cp.percent < statusZero }">{{cp.abstentions}}</mat-cell> + <mat-cell *matCellDef="let cp" [ngClass]="{'positiveC' : cp.percent >= status.good, + 'okayC' : cp.percent >= status.okay && cp.percent < status.good, 'negativeC' : cp.percent < status.okay, + 'emptyC' : cp.percent < status.zero }">{{cp.abstentions}}</mat-cell> </ng-container> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> diff --git a/src/app/components/shared/list-statistic/list-statistic.component.ts b/src/app/components/shared/list-statistic/list-statistic.component.ts index 23fbe9394b25688a3b3e9839be91be4527a2c79d..9cec4ae322d3b2e704426e38f8bfcef4c97c8473 100644 --- a/src/app/components/shared/list-statistic/list-statistic.component.ts +++ b/src/app/components/shared/list-statistic/list-statistic.component.ts @@ -31,10 +31,12 @@ export class ListStatisticComponent implements OnInit { @Input() contentGroup: ContentGroup; contents: Content[] = []; displayedColumns = ['content', 'counts', 'abstentions', 'percentage']; - statusGood = 85; - statusOkay = 50; - statusEmpty = -1; - statusZero = 0; + status = { + good: 85 , + okay: 50 , + empty: -1, + zero: 0 + }; dataSource: ContentPercents[]; total = 0; totalP = 0;