Browse Source

Fix sustainable retirement income for redacted values

pull/7976/head
Thomas Kaul 2 weeks ago
parent
commit
873cee8df2
  1. 6
      apps/client/src/app/pages/portfolio/fire/fire-page.component.ts
  2. 30
      apps/client/src/app/pages/portfolio/fire/fire-page.html

6
apps/client/src/app/pages/portfolio/fire/fire-page.component.ts

@ -8,6 +8,7 @@ import {
User User
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { hasScope, scopes } from '@ghostfolio/common/scopes';
import { GfFireCalculatorComponent } from '@ghostfolio/ui/fire-calculator'; import { GfFireCalculatorComponent } from '@ghostfolio/ui/fire-calculator';
import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator';
import { DataService } from '@ghostfolio/ui/services'; import { DataService } from '@ghostfolio/ui/services';
@ -53,6 +54,7 @@ export class GfFirePageComponent implements OnInit {
protected fireWealth: FireWealth; protected fireWealth: FireWealth;
protected hasImpersonationId: boolean; protected hasImpersonationId: boolean;
protected hasPermissionToShowValues: boolean;
protected hasPermissionToUpdateUserSettings: boolean; protected hasPermissionToUpdateUserSettings: boolean;
protected isLoading = false; protected isLoading = false;
protected retirementDate: Date; protected retirementDate: Date;
@ -142,6 +144,10 @@ export class GfFirePageComponent implements OnInit {
if (state?.user) { if (state?.user) {
this.user = state.user; this.user = state.user;
this.hasPermissionToShowValues =
hasScope(this.user.scopes, scopes.portfolioReadValues) &&
!this.user.settings.isRestrictedView;
this.hasPermissionToUpdateUserSettings = this.hasPermissionToUpdateUserSettings =
this.user.subscription?.type === SubscriptionType.Basic this.user.subscription?.type === SubscriptionType.Basic
? false ? false

30
apps/client/src/app/pages/portfolio/fire/fire-page.html

@ -73,7 +73,11 @@
[isCurrency]="true" [isCurrency]="true"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency" [unit]="user?.settings?.baseCurrency"
[value]="withdrawalRatePerYear?.toNumber()" [value]="
hasPermissionToShowValues
? withdrawalRatePerYear?.toNumber()
: null
"
/> />
per year</span per year</span
> >
@ -84,7 +88,11 @@
[isCurrency]="true" [isCurrency]="true"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency" [unit]="user?.settings?.baseCurrency"
[value]="withdrawalRatePerMonth?.toNumber()" [value]="
hasPermissionToShowValues
? withdrawalRatePerMonth?.toNumber()
: null
"
/> />
per month</span per month</span
>, based on your total assets of >, based on your total assets of
@ -94,7 +102,11 @@
[isCurrency]="true" [isCurrency]="true"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency" [unit]="user?.settings?.baseCurrency"
[value]="fireWealth?.today.valueInBaseCurrency" [value]="
hasPermissionToShowValues
? fireWealth?.today.valueInBaseCurrency
: null
"
/></span> /></span>
and a safe withdrawal rate (SWR) of</ng-container and a safe withdrawal rate (SWR) of</ng-container
> >
@ -137,7 +149,11 @@
[isCurrency]="true" [isCurrency]="true"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency" [unit]="user?.settings?.baseCurrency"
[value]="withdrawalRatePerYearProjected?.toNumber()" [value]="
hasPermissionToShowValues
? withdrawalRatePerYearProjected?.toNumber()
: null
"
/> />
per year</span per year</span
> >
@ -148,7 +164,11 @@
[isCurrency]="true" [isCurrency]="true"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[unit]="user?.settings?.baseCurrency" [unit]="user?.settings?.baseCurrency"
[value]="withdrawalRatePerMonthProjected?.toNumber()" [value]="
hasPermissionToShowValues
? withdrawalRatePerMonthProjected?.toNumber()
: null
"
/> />
per month</span per month</span
>, assuming a >, assuming a

Loading…
Cancel
Save