From 6dabf7516a725bcfc3e862fb8971132d82ebfba8 Mon Sep 17 00:00:00 2001 From: Eduardo Marinho <87383586+SirZemar@users.noreply.github.com> Date: Wed, 22 May 2024 17:15:08 +0100 Subject: [PATCH] Feature/preselect account in create or update activity dialog (#3413) * Preselect account if there is only one * Update changelog --- CHANGELOG.md | 1 + .../create-or-update-activity-dialog.component.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ca71c164..3a86dfb03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Improved the usability of the create or update activity dialog by preselecting the (only) account - Improved the usability of the date range selector in the assistant - Refactored the holding detail dialog to a standalone component - Refreshed the cryptocurrencies list 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 f49860028..9d3bcc6c9 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 @@ -91,7 +91,12 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { }); this.activityForm = this.formBuilder.group({ - accountId: [this.data.activity?.accountId, Validators.required], + accountId: [ + this.data.accounts.length === 1 && !this.data.activity?.accountId + ? this.data.accounts[0].id + : this.data.activity?.accountId, + Validators.required + ], assetClass: [this.data.activity?.SymbolProfile?.assetClass], assetSubClass: [this.data.activity?.SymbolProfile?.assetSubClass], comment: [this.data.activity?.comment],