Browse Source

migrated the tags selector component of the holding detail dialog to form control.

pull/5655/head
jassu2244 1 month ago
parent
commit
794e56b0cd
  1. 12
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
  2. 3
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html

12
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -100,7 +100,7 @@ import { HoldingDetailDialogParams } from './interfaces/interfaces';
templateUrl: 'holding-detail-dialog.html'
})
export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
public activityForm: FormGroup;
public holdingForm: FormGroup;
public accounts: Account[];
public assetClass: string;
public assetSubClass: string;
@ -178,7 +178,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
}
public ngOnInit() {
this.activityForm = this.formBuilder.group({
this.holdingForm = this.formBuilder.group({
tags: [] as string[]
});
@ -187,7 +187,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
{ id: this.data.symbol, type: 'SYMBOL' }
];
this.activityForm
this.holdingForm
.get('tags')
.valueChanges.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((tags: Tag[]) => {
@ -427,7 +427,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
};
});
this.activityForm.setValue({ tags: this.tags }, { emitEvent: false });
this.holdingForm.setValue({ tags: this.tags }, { emitEvent: false });
this.transactionCount = transactionCount;
this.totalItems = transactionCount;
@ -585,10 +585,6 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
}
}
public onTagsChanged(tags: Tag[]) {
this.activityForm.get('tags').setValue(tags);
}
public onUpdateActivity(aActivity: Activity) {
this.router.navigate(
internalRoutes.portfolio.subRoutes.activities.routerLink,

3
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html

@ -412,11 +412,10 @@
</mat-tab-group>
<gf-tags-selector
[formControl]="holdingForm.get('tags')"
[hasPermissionToCreateTag]="hasPermissionToCreateOwnTag"
[readonly]="!data.hasPermissionToUpdateOrder"
[tags]="activityForm.get('tags')?.value"
[tagsAvailable]="tagsAvailable"
(tagsChanged)="onTagsChanged($event)"
/>
@if (

Loading…
Cancel
Save