From 90270dbcd5612a16b4fde20e6194dd2a15901efd Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 5 Jul 2026 16:51:16 +0200 Subject: [PATCH] Add tags support in accounts --- .../holding-detail-dialog.component.ts | 15 ++++++++- .../holding-detail-dialog.html | 1 + .../tags-selector.component.html | 22 +++++++++++-- .../tags-selector/tags-selector.component.ts | 31 ++++++++++++------- 4 files changed, 54 insertions(+), 15 deletions(-) diff --git a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts index 3ddcd4e19..b2cdedbc5 100644 --- a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts +++ b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts @@ -77,7 +77,7 @@ import { swapVerticalOutline, walletOutline } from 'ionicons/icons'; -import { isNumber, round } from 'lodash'; +import { isNumber, round, uniqBy } from 'lodash'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { switchMap } from 'rxjs/operators'; @@ -179,6 +179,7 @@ export class GfHoldingDetailDialogComponent implements OnInit { protected sortColumn = 'date'; protected sortDirection: SortDirection = 'desc'; protected tagsAvailable: Tag[]; + protected tagsOfAccounts: Tag[]; protected readonly translate = translate; protected user: User; protected value: number; @@ -265,6 +266,18 @@ export class GfHoldingDetailDialogComponent implements OnInit { .subscribe(({ accounts }) => { this.accounts = accounts; + this.tagsOfAccounts = uniqBy( + accounts.flatMap(({ tags }) => { + return tags ?? []; + }), + 'id' + ).map((tag) => { + return { + ...tag, + name: translate(tag.name) + }; + }); + this.changeDetectorRef.markForCheck(); }); diff --git a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html index 0007bedc5..04388bddb 100644 --- a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html +++ b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html @@ -427,6 +427,7 @@ [hasPermissionToCreateTag]="hasPermissionToCreateOwnTag" [readonly]="!data.hasPermissionToUpdateActivity" [tagsAvailable]="tagsAvailable" + [tagsReadOnly]="tagsOfAccounts" /> diff --git a/libs/ui/src/lib/tags-selector/tags-selector.component.html b/libs/ui/src/lib/tags-selector/tags-selector.component.html index 82f465555..92ea2b210 100644 --- a/libs/ui/src/lib/tags-selector/tags-selector.component.html +++ b/libs/ui/src/lib/tags-selector/tags-selector.component.html @@ -2,10 +2,19 @@