From 63bb70502d8f49226deb950a303a8e3607f78ded Mon Sep 17 00:00:00 2001 From: jonsadev Date: Fri, 11 Jan 2019 12:15:33 -0700 Subject: [PATCH] web-ui: Display accumulated total value for input and output on detail transactions --- .../transaction-details.component.html | 11 +++++++---- .../transaction-details.component.ts | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/web-ui/src/app/components/transaction-details/transaction-details.component.html b/web-ui/src/app/components/transaction-details/transaction-details.component.html index a2b2667d..d769aafc 100644 --- a/web-ui/src/app/components/transaction-details/transaction-details.component.html +++ b/web-ui/src/app/components/transaction-details/transaction-details.component.html @@ -46,13 +46,13 @@
- + - + - + @@ -78,7 +78,10 @@ - + +
{{'label.noInput' | translate}}
{{'label.from' | translate}}{{ getTotal(collapsedInput) | explorerCurrency }}
{{'label.output' | translate}} + {{ getTotal(collapsedOutput) | explorerCurrency }} +
diff --git a/web-ui/src/app/components/transaction-details/transaction-details.component.ts b/web-ui/src/app/components/transaction-details/transaction-details.component.ts index 3a8890ef..5eac8fd2 100644 --- a/web-ui/src/app/components/transaction-details/transaction-details.component.ts +++ b/web-ui/src/app/components/transaction-details/transaction-details.component.ts @@ -73,6 +73,10 @@ export class TransactionDetailsComponent implements OnInit { .length; } + getTotal(rows: TransactionValue[]): number { + return rows.map((row) => row.value).reduce((a, b) => a + b); + } + getFee(tx: Transaction): number { const vout = tx.output.map(t => t.value).reduce((a, b) => a + b, 0); return Math.max(0, this.getVIN(tx) - vout);