Browse Source

Refactoring

pull/4117/head
Thomas Kaul 8 months ago
parent
commit
be592296d0
  1. 7
      apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts
  2. 6
      apps/client/src/app/core/notification/notification.service.ts

7
apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts

@ -54,16 +54,13 @@ export class PortfolioSummaryComponent implements OnChanges {
public onEditEmergencyFund() {
this.notificationService.prompt({
confirmFn: (value) => {
// If empty/deleted value by user, default to 0.
const emergencyFund = parseFloat(value.trim()) || 0;
if (emergencyFund >= 0) {
this.emergencyFundChanged.emit(emergencyFund);
}
},
confirmLabel: $localize`Save`,
defaultValue: this.summary.emergencyFund?.total?.toString() ?? '0',
title: $localize`Please enter the amount of your emergency fund:`,
valueLabel: $localize`Emergency fund`
title: $localize`Please set the amount of your emergency fund.`
});
}
}

6
apps/client/src/app/core/notification/notification.service.ts

@ -101,9 +101,9 @@ export class NotificationService {
valueLabel: aParams.valueLabel
});
return dialog.afterClosed().subscribe((value: string) => {
if (value !== undefined && isFunction(aParams.confirmFn)) {
aParams.confirmFn(value);
return dialog.afterClosed().subscribe((result: string) => {
if (result !== 'discard' && isFunction(aParams.confirmFn)) {
aParams.confirmFn(result);
}
});
}

Loading…
Cancel
Save