Feature/clone or edit activity from account detail dialog (#3647)
* Clone or edit activity from holding detail dialog * Update changelog
This commit is contained in:
parent
dc1948016f
commit
e85cc0fcfc
@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Added support to clone an activity from the account detail dialog (experimental)
|
||||||
|
- Added support to edit an activity from the account detail dialog (experimental)
|
||||||
- Added support to clone an activity from the holding detail dialog (experimental)
|
- Added support to clone an activity from the holding detail dialog (experimental)
|
||||||
- Added support to edit an activity from the holding detail dialog (experimental)
|
- Added support to edit an activity from the holding detail dialog (experimental)
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import {
|
|||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { Sort, SortDirection } from '@angular/material/sort';
|
import { Sort, SortDirection } from '@angular/material/sort';
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
import { Big } from 'big.js';
|
import { Big } from 'big.js';
|
||||||
import { format, parseISO } from 'date-fns';
|
import { format, parseISO } from 'date-fns';
|
||||||
import { isNumber } from 'lodash';
|
import { isNumber } from 'lodash';
|
||||||
@ -66,6 +67,7 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
|
|||||||
@Inject(MAT_DIALOG_DATA) public data: AccountDetailDialogParams,
|
@Inject(MAT_DIALOG_DATA) public data: AccountDetailDialogParams,
|
||||||
private dataService: DataService,
|
private dataService: DataService,
|
||||||
public dialogRef: MatDialogRef<AccountDetailDialog>,
|
public dialogRef: MatDialogRef<AccountDetailDialog>,
|
||||||
|
private router: Router,
|
||||||
private userService: UserService
|
private userService: UserService
|
||||||
) {
|
) {
|
||||||
this.userService.stateChanged
|
this.userService.stateChanged
|
||||||
@ -92,6 +94,14 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
|
|||||||
this.fetchPortfolioPerformance();
|
this.fetchPortfolioPerformance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onCloneActivity(aActivity: Activity) {
|
||||||
|
this.router.navigate(['/portfolio', 'activities'], {
|
||||||
|
queryParams: { activityId: aActivity.id, createDialog: true }
|
||||||
|
});
|
||||||
|
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
public onClose() {
|
public onClose() {
|
||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
}
|
}
|
||||||
@ -147,6 +157,14 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
|
|||||||
this.fetchActivities();
|
this.fetchActivities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onUpdateActivity(aActivity: Activity) {
|
||||||
|
this.router.navigate(['/portfolio', 'activities'], {
|
||||||
|
queryParams: { activityId: aActivity.id, editDialog: true }
|
||||||
|
});
|
||||||
|
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
private fetchAccount() {
|
private fetchAccount() {
|
||||||
this.dataService
|
this.dataService
|
||||||
.fetchAccount(this.data.accountId)
|
.fetchAccount(this.data.accountId)
|
||||||
|
@ -101,10 +101,17 @@
|
|||||||
[hasPermissionToFilter]="false"
|
[hasPermissionToFilter]="false"
|
||||||
[hasPermissionToOpenDetails]="false"
|
[hasPermissionToOpenDetails]="false"
|
||||||
[locale]="user?.settings?.locale"
|
[locale]="user?.settings?.locale"
|
||||||
[showActions]="false"
|
[showActions]="
|
||||||
|
!data.hasImpersonationId &&
|
||||||
|
data.hasPermissionToCreateOrder &&
|
||||||
|
user?.settings?.isExperimentalFeatures &&
|
||||||
|
!user?.settings?.isRestrictedView
|
||||||
|
"
|
||||||
[sortColumn]="sortColumn"
|
[sortColumn]="sortColumn"
|
||||||
[sortDirection]="sortDirection"
|
[sortDirection]="sortDirection"
|
||||||
[totalItems]="totalItems"
|
[totalItems]="totalItems"
|
||||||
|
(activityToClone)="onCloneActivity($event)"
|
||||||
|
(activityToUpdate)="onUpdateActivity($event)"
|
||||||
(export)="onExport()"
|
(export)="onExport()"
|
||||||
(sortChanged)="onSortChanged($event)"
|
(sortChanged)="onSortChanged($event)"
|
||||||
/>
|
/>
|
||||||
|
@ -2,4 +2,5 @@ export interface AccountDetailDialogParams {
|
|||||||
accountId: string;
|
accountId: string;
|
||||||
deviceType: string;
|
deviceType: string;
|
||||||
hasImpersonationId: boolean;
|
hasImpersonationId: boolean;
|
||||||
|
hasPermissionToCreateOrder: boolean;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,11 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
|
|||||||
data: <AccountDetailDialogParams>{
|
data: <AccountDetailDialogParams>{
|
||||||
accountId: aAccountId,
|
accountId: aAccountId,
|
||||||
deviceType: this.deviceType,
|
deviceType: this.deviceType,
|
||||||
hasImpersonationId: this.hasImpersonationId
|
hasImpersonationId: this.hasImpersonationId,
|
||||||
|
hasPermissionToCreateOrder:
|
||||||
|
!this.hasImpersonationId &&
|
||||||
|
hasPermission(this.user?.permissions, permissions.createOrder) &&
|
||||||
|
!this.user?.settings?.isRestrictedView
|
||||||
},
|
},
|
||||||
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
||||||
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
|
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
PortfolioPosition,
|
PortfolioPosition,
|
||||||
User
|
User
|
||||||
} from '@ghostfolio/common/interfaces';
|
} from '@ghostfolio/common/interfaces';
|
||||||
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
||||||
import { Market, MarketAdvanced } from '@ghostfolio/common/types';
|
import { Market, MarketAdvanced } from '@ghostfolio/common/types';
|
||||||
import { translate } from '@ghostfolio/ui/i18n';
|
import { translate } from '@ghostfolio/ui/i18n';
|
||||||
|
|
||||||
@ -584,7 +585,11 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
|
|||||||
data: <AccountDetailDialogParams>{
|
data: <AccountDetailDialogParams>{
|
||||||
accountId: aAccountId,
|
accountId: aAccountId,
|
||||||
deviceType: this.deviceType,
|
deviceType: this.deviceType,
|
||||||
hasImpersonationId: this.hasImpersonationId
|
hasImpersonationId: this.hasImpersonationId,
|
||||||
|
hasPermissionToCreateOrder:
|
||||||
|
!this.hasImpersonationId &&
|
||||||
|
hasPermission(this.user?.permissions, permissions.createOrder) &&
|
||||||
|
!this.user?.settings?.isRestrictedView
|
||||||
},
|
},
|
||||||
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
||||||
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
|
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user