Skip to content

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

Feature/disable option to update cash balance if date is not today (#3229)

Thomas Kaul6f3cce1c5f2c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7da7e2f939..0e0559738b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Disabled the option to update the cash balance of an account if date is not today
- Improved the usability of the date range support by specific years (`2023`, `2022`, `2021`, etc.) in the assistant (experimental)
- Introduced a factory for the portfolio calculations to support different algorithms in future
diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
index b628aba468..4fb8e9d817 100644
--- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
+++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
@@ -275,6 +275,17 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
}
);
+ this.activityForm.controls['date'].valueChanges.subscribe(() => {
+ if (isToday(this.activityForm.controls['date'].value)) {
+ this.activityForm.controls['updateAccountBalance'].enable();
+ } else {
+ this.activityForm.controls['updateAccountBalance'].disable();
+ this.activityForm.controls['updateAccountBalance'].setValue(false);
+ }
+
+ this.changeDetectorRef.markForCheck();
+ });
+
this.activityForm.controls['searchSymbol'].valueChanges.subscribe(() => {
if (this.activityForm.controls['searchSymbol'].invalid) {
this.data.activity.SymbolProfile = null;