|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto'; |
|
|
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface'; |
|
|
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface'; |
|
|
import { GfDialogFooterComponent } from '@ghostfolio/client/components/dialog-footer/dialog-footer.component'; |
|
|
import { GfDialogFooterComponent } from '@ghostfolio/client/components/dialog-footer/dialog-footer.component'; |
|
|
import { GfDialogHeaderComponent } from '@ghostfolio/client/components/dialog-header/dialog-header.component'; |
|
|
import { GfDialogHeaderComponent } from '@ghostfolio/client/components/dialog-header/dialog-header.component'; |
|
|
@ -57,6 +58,7 @@ import { isUUID } from 'class-validator'; |
|
|
import { format, isSameMonth, isToday, parseISO } from 'date-fns'; |
|
|
import { format, isSameMonth, isToday, parseISO } from 'date-fns'; |
|
|
import { addIcons } from 'ionicons'; |
|
|
import { addIcons } from 'ionicons'; |
|
|
import { |
|
|
import { |
|
|
|
|
|
arrowDownCircleOutline, |
|
|
createOutline, |
|
|
createOutline, |
|
|
flagOutline, |
|
|
flagOutline, |
|
|
readerOutline, |
|
|
readerOutline, |
|
|
@ -167,6 +169,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { |
|
|
private userService: UserService |
|
|
private userService: UserService |
|
|
) { |
|
|
) { |
|
|
addIcons({ |
|
|
addIcons({ |
|
|
|
|
|
arrowDownCircleOutline, |
|
|
createOutline, |
|
|
createOutline, |
|
|
flagOutline, |
|
|
flagOutline, |
|
|
readerOutline, |
|
|
readerOutline, |
|
|
@ -557,6 +560,37 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { |
|
|
this.dialogRef.close(); |
|
|
this.dialogRef.close(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public onCloseHolding() { |
|
|
|
|
|
const today = new Date(); |
|
|
|
|
|
|
|
|
|
|
|
const activity: CreateOrderDto = { |
|
|
|
|
|
accountId: this.accounts.length === 1 ? this.accounts[0].id : null, |
|
|
|
|
|
comment: null, |
|
|
|
|
|
currency: this.SymbolProfile.currency, |
|
|
|
|
|
dataSource: this.SymbolProfile.dataSource, |
|
|
|
|
|
date: today.toISOString(), |
|
|
|
|
|
fee: 0, |
|
|
|
|
|
quantity: this.quantity, |
|
|
|
|
|
symbol: this.SymbolProfile.symbol, |
|
|
|
|
|
tags: this.tags.map(({ id }) => { |
|
|
|
|
|
return id; |
|
|
|
|
|
}), |
|
|
|
|
|
type: 'SELL', |
|
|
|
|
|
unitPrice: this.marketPrice |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.dataService |
|
|
|
|
|
.postOrder(activity) |
|
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
|
|
.subscribe(() => { |
|
|
|
|
|
this.router.navigate( |
|
|
|
|
|
internalRoutes.portfolio.subRoutes.activities.routerLink |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public onExport() { |
|
|
public onExport() { |
|
|
const activityIds = this.dataSource.data.map(({ id }) => { |
|
|
const activityIds = this.dataSource.data.map(({ id }) => { |
|
|
return id; |
|
|
return id; |
|
|
|