diff --git a/CHANGELOG.md b/CHANGELOG.md
index 175e6da02..d57ad99f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Included quick links in the search results of the assistant
- Added a skeleton loader to the changelog page
- Extended the content of the _Self-Hosting_ section by information about additional data providers on the Frequently Asked Questions (FAQ) page
+- Enhanced the create or update activity dialog to display the current holdings as default options
### Changed
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 4982125fe..f65d551a5 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
@@ -2,6 +2,7 @@ import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto';
import { UpdateOrderDto } from '@ghostfolio/api/app/order/update-order.dto';
import { UserService } from '@ghostfolio/client/services/user/user.service';
import { getDateFormatString } from '@ghostfolio/common/helper';
+import { LookupItem } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { translate } from '@ghostfolio/ui/i18n';
@@ -44,6 +45,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
public currencyOfAssetProfile: string;
public currentMarketPrice = null;
public defaultDateFormat: string;
+ public defaultLookupItems: LookupItem[] = [];
public hasPermissionToCreateOwnTag: boolean;
public isLoading = false;
public isToday = isToday;
@@ -83,6 +85,35 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
this.defaultDateFormat = getDateFormatString(this.locale);
this.platforms = platforms;
+ this.dataService
+ .fetchPortfolioHoldings()
+ .pipe(takeUntil(this.unsubscribeSubject))
+ .subscribe(({ holdings }) => {
+ this.defaultLookupItems = holdings
+ .filter(({ assetSubClass }) => {
+ return !['CASH'].includes(assetSubClass);
+ })
+ .sort((a, b) => {
+ return a.name?.localeCompare(b.name);
+ })
+ .map((holding) => {
+ return {
+ assetClass: holding.assetClass,
+ assetSubClass: holding.assetSubClass,
+ currency: holding.currency,
+ dataProviderInfo: {
+ dataSource: holding.dataSource,
+ isPremium: false,
+ name: holding.name,
+ url: holding.url
+ },
+ dataSource: holding.dataSource,
+ name: holding.name,
+ symbol: holding.symbol
+ };
+ });
+ });
+
this.tagsAvailable =
this.data.user?.tags?.map((tag) => {
return {
diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html
index a1ca6e323..6392456b5 100644
--- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html
+++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html
@@ -124,6 +124,7 @@
Name, symbol or ISIN
diff --git a/libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts b/libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts
index 4d73e3c53..ff14f30e1 100644
--- a/libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts
+++ b/libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts
@@ -14,6 +14,7 @@ import {
Input,
OnDestroy,
OnInit,
+ SimpleChanges,
ViewChild
} from '@angular/core';
import {
@@ -107,10 +108,6 @@ export class GfSymbolAutocompleteComponent
this.control.disable();
}
- if (this.defaultLookupItems?.length) {
- this.showDefaultOptions();
- }
-
this.control.valueChanges
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(() => {
@@ -159,6 +156,12 @@ export class GfSymbolAutocompleteComponent
});
}
+ public ngOnChanges(changes: SimpleChanges) {
+ if (changes['defaultLookupItems'] && this.defaultLookupItems?.length) {
+ this.showDefaultOptions();
+ }
+ }
+
public displayFn(aLookupItem: LookupItem) {
return aLookupItem?.symbol ?? '';
}