@ -8,10 +8,10 @@ import { GfValueComponent } from '@ghostfolio/ui/value';
import {
ChangeDetectionStrategy ,
Component ,
EventEm itter ,
injec t ,
Input ,
OnChanges ,
O utput
o utput
} from '@angular/core' ;
import { MatTooltipModule } from '@angular/material/tooltip' ;
import { IonIcon } from '@ionic/angular/standalone' ;
@ -40,44 +40,46 @@ export class GfPortfolioSummaryComponent implements OnChanges {
@Input ( ) summary : PortfolioSummary ;
@Input ( ) user : User ;
@Output ( ) emergencyFundChanged = new EventEmitter < number > ( ) ;
public emergencyFundChanged = output < number > ( ) ;
public buyAndSellActivitiesTooltip = translate (
protected readonly buyAndSellActivitiesTooltip = translate (
'BUY_AND_SELL_ACTIVITIES_TOOLTIP'
) ;
public precision = 2 ;
public timeInMarket : string ;
protected precision = 2 ;
protected timeInMarket : string | undefined ;
public get buyingPowerPercentage() {
private readonly notificationService = inject ( NotificationService ) ;
public constructor ( ) {
addIcons ( { ellipsisHorizontalCircleOutline , informationCircleOutline } ) ;
}
protected get buyingPowerPercentage() {
return this . summary ? . totalValueInBaseCurrency
? this . summary . cash / this . summary . totalValueInBaseCurrency
: 0 ;
}
public get emergencyFundPercentage() {
protected get emergencyFundPercentage() {
return this . summary ? . totalValueInBaseCurrency
? ( this . summary . emergencyFund ? . total || 0 ) /
this . summary . totalValueInBaseCurrency
: 0 ;
}
public get excludedFromAnalysisPercentage() {
protected get excludedFromAnalysisPercentage() {
return this . summary ? . totalValueInBaseCurrency
? this . summary . excludedAccountsAndActivities /
this . summary . totalValueInBaseCurrency
: 0 ;
}
public constructor ( private notificationService : NotificationService ) {
addIcons ( { ellipsisHorizontalCircleOutline , informationCircleOutline } ) ;
}
public ngOnChanges() {
if ( this . summary ) {
if (
this . deviceType === 'mobile' &&
this . summary . totalValueInBaseCurrency >=
( this . summary . totalValueInBaseCurrency ? ? 0 ) >=
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES
) {
this . precision = 0 ;
@ -98,7 +100,7 @@ export class GfPortfolioSummaryComponent implements OnChanges {
}
}
public onEditEmergencyFund() {
protected onEditEmergencyFund() {
this . notificationService . prompt ( {
confirmFn : ( value ) = > {
const emergencyFund = parseFloat ( value . trim ( ) ) || 0 ;