Browse Source

Show decimal `transactionCount` and singular for 1 transaction

pull/327/head
Ivo Valchev 4 years ago
parent
commit
335453f4a3
  1. 5
      apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html
  2. 8
      apps/client/src/app/components/value/value.component.ts

5
apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html

@ -102,9 +102,10 @@
</div> </div>
<div class="col-6 mb-3"> <div class="col-6 mb-3">
<gf-value <gf-value
label="Transactions" [label]="transactionCount == 1 ? 'Transaction' : 'Transactions'"
size="medium" size="medium"
[isCurrency]="true" [isCurrency]="false"
[isInteger]="true"
[locale]="data.locale" [locale]="data.locale"
[value]="transactionCount" [value]="transactionCount"
></gf-value> ></gf-value>

8
apps/client/src/app/components/value/value.component.ts

@ -20,6 +20,7 @@ export class ValueComponent implements OnChanges, OnInit {
@Input() currency: string; @Input() currency: string;
@Input() isCurrency: boolean; @Input() isCurrency: boolean;
@Input() isPercent: boolean; @Input() isPercent: boolean;
@Input() isInteger: boolean;
@Input() label: string; @Input() label: string;
@Input() locale: string; @Input() locale: string;
@Input() position: string; @Input() position: string;
@ -84,6 +85,13 @@ export class ValueComponent implements OnChanges, OnInit {
minimumFractionDigits: 2 minimumFractionDigits: 2
}); });
} catch {} } catch {}
} else if (this.isInteger) {
try {
this.formattedValue = this.value?.toLocaleString(this.locale, {
maximumFractionDigits: 0,
minimumFractionDigits: 0
});
} catch {}
} }
} else { } else {
try { try {

Loading…
Cancel
Save