|
|
|
@ -1,7 +1,5 @@
|
|
|
|
|
import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto';
|
|
|
|
|
import { UpdateOrderDto } from '@ghostfolio/api/app/order/update-order.dto';
|
|
|
|
|
import { DataService } from '@ghostfolio/client/services/data.service';
|
|
|
|
|
import { validateObjectForForm } from '@ghostfolio/client/util/form.util';
|
|
|
|
|
import { getDateFormatString } from '@ghostfolio/common/helper';
|
|
|
|
|
import { translate } from '@ghostfolio/ui/i18n';
|
|
|
|
|
|
|
|
|
@ -24,6 +22,8 @@ import { isAfter, isToday } from 'date-fns';
|
|
|
|
|
import { EMPTY, Observable, Subject, lastValueFrom, of } from 'rxjs';
|
|
|
|
|
import { catchError, delay, map, startWith, takeUntil } from 'rxjs/operators';
|
|
|
|
|
|
|
|
|
|
import { DataService } from '../../../../services/data.service';
|
|
|
|
|
import { validateObjectForForm } from '../../../../util/form.util';
|
|
|
|
|
import { CreateOrUpdateActivityDialogParams } from './interfaces/interfaces';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@ -124,7 +124,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
|
|
|
|
name: [this.data.activity?.SymbolProfile?.name, Validators.required],
|
|
|
|
|
quantity: [this.data.activity?.quantity, Validators.required],
|
|
|
|
|
searchSymbol: [
|
|
|
|
|
!!this.data.activity?.SymbolProfile
|
|
|
|
|
this.data.activity?.SymbolProfile
|
|
|
|
|
? {
|
|
|
|
|
dataSource: this.data.activity?.SymbolProfile?.dataSource,
|
|
|
|
|
symbol: this.data.activity?.SymbolProfile?.symbol
|
|
|
|
@ -476,7 +476,11 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
|
|
|
|
fee: this.activityForm.get('fee').value,
|
|
|
|
|
quantity: this.activityForm.get('quantity').value,
|
|
|
|
|
symbol:
|
|
|
|
|
this.activityForm.get('searchSymbol')?.value?.symbol ??
|
|
|
|
|
(['FEE', 'INTEREST', 'ITEM', 'LIABILITY'].includes(
|
|
|
|
|
this.activityForm.get('type').value
|
|
|
|
|
)
|
|
|
|
|
? undefined
|
|
|
|
|
: this.activityForm.get('searchSymbol')?.value?.symbol) ??
|
|
|
|
|
this.activityForm.get('name')?.value,
|
|
|
|
|
tags: this.activityForm.get('tags').value,
|
|
|
|
|
type: this.activityForm.get('type').value,
|
|
|
|
@ -485,8 +489,9 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (this.mode === 'create') {
|
|
|
|
|
(activity as CreateOrderDto).updateAccountBalance =
|
|
|
|
|
this.activityForm.get('updateAccountBalance').value;
|
|
|
|
|
activity.updateAccountBalance = this.activityForm.get(
|
|
|
|
|
'updateAccountBalance'
|
|
|
|
|
).value;
|
|
|
|
|
|
|
|
|
|
await validateObjectForForm({
|
|
|
|
|
classDto: CreateOrderDto,
|
|
|
|
@ -495,7 +500,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
|
|
|
|
object: activity
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.dialogRef.close(activity as CreateOrderDto);
|
|
|
|
|
this.dialogRef.close(activity);
|
|
|
|
|
} else {
|
|
|
|
|
(activity as UpdateOrderDto).id = this.data.activity.id;
|
|
|
|
|
|
|
|
|
|