Browse Source

Feature/add interest and dividend to account detail dialog (#5347)

* Add interest and dividend to account detail dialog

* Update changelog
pull/5363/head^2
Thomas Kaul 7 days ago
committed by GitHub
parent
commit
5f2f484c00
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 25
      apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts
  3. 24
      apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Added the interest and dividend values to the account detail dialog
### Changed
- Improved the dynamic numerical precision for various values in the account detail dialog

25
apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts

@ -55,11 +55,15 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
public balancePrecision = 2;
public currency: string;
public dataSource: MatTableDataSource<Activity>;
public dividendInBaseCurrency: number;
public dividendInBaseCurrencyPrecision = 2;
public equity: number;
public equityPrecision = 2;
public hasPermissionToDeleteAccountBalance: boolean;
public historicalDataItems: HistoricalDataItem[];
public holdings: PortfolioPosition[];
public interestInBaseCurrency: number;
public interestInBaseCurrencyPrecision = 2;
public isLoadingActivities: boolean;
public isLoadingChart: boolean;
public name: string;
@ -184,6 +188,8 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
({
balance,
currency,
dividendInBaseCurrency,
interestInBaseCurrency,
name,
platform,
transactionCount,
@ -200,6 +206,15 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
}
this.currency = currency;
this.dividendInBaseCurrency = dividendInBaseCurrency;
if (
this.data.deviceType === 'mobile' &&
this.dividendInBaseCurrency >=
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES
) {
this.dividendInBaseCurrencyPrecision = 0;
}
if (isNumber(balance) && isNumber(value)) {
this.equity = new Big(value).minus(balance).toNumber();
@ -214,6 +229,16 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
this.equity = null;
}
this.interestInBaseCurrency = interestInBaseCurrency;
if (
this.data.deviceType === 'mobile' &&
this.interestInBaseCurrency >=
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES
) {
this.interestInBaseCurrencyPrecision = 0;
}
this.name = name;
this.platformName = platform?.name ?? '-';
this.transactionCount = transactionCount;

24
apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html

@ -60,6 +60,30 @@
>Equity</gf-value
>
</div>
<div class="col-6 mb-3">
<gf-value
i18n
size="medium"
[isCurrency]="true"
[locale]="user?.settings?.locale"
[precision]="interestInBaseCurrencyPrecision"
[unit]="user?.settings?.baseCurrency"
[value]="interestInBaseCurrency"
>Interest</gf-value
>
</div>
<div class="col-6 mb-3">
<gf-value
i18n
size="medium"
[isCurrency]="true"
[locale]="user?.settings?.locale"
[precision]="dividendInBaseCurrencyPrecision"
[unit]="user?.settings?.baseCurrency"
[value]="dividendInBaseCurrency"
>Dividend</gf-value
>
</div>
<div class="col-6 mb-3">
<gf-value i18n size="medium" [value]="transactionCount"
>Activities</gf-value

Loading…
Cancel
Save