Browse Source

Enable update balance for fee

pull/3145/head
Thomas Kaul 1 year ago
parent
commit
08e958286d
  1. 2
      apps/api/src/app/order/order.service.ts
  2. 16
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

2
apps/api/src/app/order/order.service.ts

@ -148,7 +148,7 @@ export class OrderService {
.plus(data.fee) .plus(data.fee)
.toNumber(); .toNumber();
if (data.type === 'BUY') { if (['BUY', 'FEE'].includes(data.type)) {
amount = new Big(amount).mul(-1).toNumber(); amount = new Big(amount).mul(-1).toNumber();
} }

16
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

@ -260,6 +260,17 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
this.activityForm.controls['currency'].setValue(currency); this.activityForm.controls['currency'].setValue(currency);
this.activityForm.controls['currencyOfFee'].setValue(currency); this.activityForm.controls['currencyOfFee'].setValue(currency);
this.activityForm.controls['currencyOfUnitPrice'].setValue(currency); this.activityForm.controls['currencyOfUnitPrice'].setValue(currency);
if (['FEE', 'INTEREST'].includes(type)) {
if (this.activityForm.controls['accountId'].value) {
this.activityForm.controls['updateAccountBalance'].enable();
} else {
this.activityForm.controls['updateAccountBalance'].disable();
this.activityForm.controls['updateAccountBalance'].setValue(
false
);
}
}
} }
} }
); );
@ -374,7 +385,10 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
this.activityForm.controls['unitPriceInCustomCurrency'].setValue(0); this.activityForm.controls['unitPriceInCustomCurrency'].setValue(0);
} }
if (type === 'INTEREST') { if (
['FEE', 'INTEREST'].includes(type) &&
this.activityForm.controls['accountId'].value
) {
this.activityForm.controls['updateAccountBalance'].enable(); this.activityForm.controls['updateAccountBalance'].enable();
} else { } else {
this.activityForm.controls['updateAccountBalance'].disable(); this.activityForm.controls['updateAccountBalance'].disable();

Loading…
Cancel
Save