pull/4370/merge
dandevaud 3 weeks ago committed by GitHub
commit ca59feb831
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -16,6 +16,7 @@
[tooltip]="element.name"
/>
</td>
<td *matFooterCellDef class="px-1" mat-footer-cell></td>
</ng-container>
<ng-container matColumnDef="nameWithSymbol">
@ -38,6 +39,7 @@
<small class="text-muted">{{ element.symbol }}</small>
</div>
</td>
<td *matFooterCellDef class="px-1" mat-footer-cell>Total</td>
</ng-container>
<ng-container matColumnDef="dateOfFirstActivity">
@ -62,6 +64,11 @@
/>
</div>
</td>
<td
*matFooterCellDef
class="d-none d-lg-table-cell justify-content-end px-1"
mat-footer-cell
></td>
</ng-container>
<ng-container matColumnDef="valueInBaseCurrency">
@ -86,6 +93,14 @@
/>
</div>
</td>
<td *matFooterCellDef class="d-none d-lg-table-cell px-1" mat-footer-cell>
<gf-value
[isCurrency]="true"
[locale]="locale"
[value]="totalValue"
></gf-value>
</td>
</ng-container>
<ng-container matColumnDef="allocationInPercentage">
@ -107,6 +122,7 @@
/>
</div>
</td>
<td *matFooterCellDef class="px-1" mat-footer-cell></td>
</ng-container>
<ng-container matColumnDef="performance">
@ -130,6 +146,16 @@
/>
</div>
</td>
<td *matFooterCellDef class="px-1" mat-footer-cell>
<div class="d-flex justify-content-end">
<gf-value
[colorizeSign]="true"
[isCurrency]="true"
[locale]="locale"
[value]="totalChange"
></gf-value>
</div>
</td>
</ng-container>
<ng-container matColumnDef="performanceInPercentage" stickyEnd>
@ -156,6 +182,16 @@
/>
</div>
</td>
<td *matFooterCellDef class="px-1" mat-footer-cell>
<div class="d-flex justify-content-end">
<gf-value
[colorizeSign]="true"
[isPercent]="true"
[locale]="locale"
[value]="totalChangePercentage"
></gf-value>
</div>
</td>
</ng-container>
<tr *matHeaderRowDef="displayedColumns" mat-header-row></tr>
@ -175,6 +211,11 @@
})
"
></tr>
<tr
*matFooterRowDef="displayedColumns"
mat-footer-row
[ngClass]="{ hidden: isLoading }"
></tr>
</table>
</div>

@ -67,6 +67,10 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy {
public isLoading = true;
public routeQueryParams: Subscription;
protected totalValue = 0;
protected totalChange = 0;
protected totalChangePercentage = 0;
private unsubscribeSubject = new Subject<void>();
public ngOnChanges() {
@ -89,6 +93,16 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy {
this.dataSource = new MatTableDataSource(this.holdings);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
this.totalValue = this.dataSource.data.reduce(
(sum, current) => (sum += current.valueInBaseCurrency),
0
);
this.totalChange = this.dataSource.data.reduce(
(sum, current) => (sum += current.netPerformanceWithCurrencyEffect),
0
);
this.totalChangePercentage =
this.totalChange / (this.totalValue - this.totalChange);
if (this.holdings) {
this.isLoading = false;

Loading…
Cancel
Save