Fix number

This commit is contained in:
Kostya Struga 2022-07-19 16:59:29 +03:00
parent fd721a6e07
commit 39bf703b6c
4 changed files with 7 additions and 5 deletions

View File

@ -29,6 +29,7 @@
[inProgress]="inProgress$"
[units]="'%'"
[type]="errorStyle"
[formatNumber]="true"
></fb-info-card>
<fb-info-card
fxFlex="25"
@ -36,6 +37,7 @@
[value]="blockedSum$ | async"
[inProgress]="inProgress$"
[type]="errorStyle"
[formatNumber]="true"
></fb-info-card>
</div>
<div fxFlexFill fxLayout="column" fxLayoutAlign="space-between center" [fxLayoutGap]="layoutGapM">

View File

@ -35,22 +35,18 @@ export class BaseAnalyticsService {
);
this.attemptedPayments$ = this.searchParameters$.pipe(
switchMap((value) => this.analyticsService.getAttemptedPaymentsCount(value)),
filter((r) => !!r),
shareReplay(1)
);
this.blockedPayments$ = this.searchParameters$.pipe(
switchMap((value) => this.analyticsService.getBlockedPaymentsCount(value)),
filter((r) => !!r),
shareReplay(1)
);
this.ratioOfBlocked$ = this.searchParameters$.pipe(
switchMap((value) => this.analyticsService.getBlockedPaymentsRatio(value)),
filter((r) => !!r),
shareReplay(1)
);
this.blockedSum$ = this.searchParameters$.pipe(
switchMap((value) => this.analyticsService.getBlockedPaymentsSum(value)),
filter((r) => !!r),
shareReplay(1)
);
this.chartDataX$ = this.searchParameters$.pipe(

View File

@ -4,7 +4,10 @@
<div *ngIf="inProgress | async" fxLayout fxLayoutAlign="center" style="height: 33px; width: 135px">
<mat-progress-spinner color="primary" mode="indeterminate" diameter="33"></mat-progress-spinner>
</div>
<h1 *ngIf="!(inProgress | async)" [class]="type" fxLayoutAlign="center">
<h1 *ngIf="!(inProgress | async) && !formatNumber" [class]="type" fxLayoutAlign="center">
{{ value | formatNumber }} {{ units }}
</h1>
<h1 *ngIf="!(inProgress | async) && formatNumber" [class]="type" fxLayoutAlign="center">
{{ value | formatNumber | number: '.1-4' }} {{ units }}
</h1>
</mat-card-content>

View File

@ -12,6 +12,7 @@ export class FbInfoCardComponent {
@Input() units = '';
@Input() type: string;
@Input() inProgress: Observable<boolean>;
@Input() formatNumber = false;
numberFormat(num) {
return num === 'NaN' || !num ? 0.0 : num;