Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

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

Thomas Kaul5f2f484c0091
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf3f2883b7..208d22babf 100644
--- a/CHANGELOG.md
+++ b/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
diff --git a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts
index c718df6867..2886910c4d 100644
--- a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts
+++ b/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;
diff --git a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html
index 4e86ef5ea8..acec70e7b5 100644
--- a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html
+++ b/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