Browse Source

fix update activity, hide update cash balance on edit (#1959)

* Fix update activity, hide update cash balance on edit

* Update changelog
pull/1961/head
Francisco Silva 2 years ago
committed by GitHub
parent
commit
8e000baef2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 2
      apps/api/src/app/order/create-order.dto.ts
  3. 4
      apps/api/src/app/order/update-order.dto.ts
  4. 7
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
  5. 10
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html

4
CHANGELOG.md

@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the market price on the first buy date in the chart of the position detail dialog - Improved the market price on the first buy date in the chart of the position detail dialog
- Restructured the admin control panel with a new settings tab - Restructured the admin control panel with a new settings tab
### Fixed
- Fixed an error that occurred while editing an activity caused by the cash balance update
## 1.268.0 - 2023-05-08 ## 1.268.0 - 2023-05-08
### Added ### Added

2
apps/api/src/app/order/create-order.dto.ts

@ -68,5 +68,5 @@ export class CreateOrderDto {
@IsBoolean() @IsBoolean()
@IsOptional() @IsOptional()
updateAccountBalance: boolean; updateAccountBalance?: boolean;
} }

4
apps/api/src/app/order/update-order.dto.ts

@ -67,8 +67,4 @@ export class UpdateOrderDto {
@IsNumber() @IsNumber()
unitPrice: number; unitPrice: number;
@IsBoolean()
@IsOptional()
updateAccountBalance: boolean;
} }

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

@ -415,13 +415,14 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
: this.activityForm.controls['searchSymbol'].value.symbol, : this.activityForm.controls['searchSymbol'].value.symbol,
tags: this.activityForm.controls['tags'].value, tags: this.activityForm.controls['tags'].value,
type: this.activityForm.controls['type'].value, type: this.activityForm.controls['type'].value,
unitPrice: this.activityForm.controls['unitPrice'].value, unitPrice: this.activityForm.controls['unitPrice'].value
updateAccountBalance:
this.activityForm.controls['updateAccountBalance'].value
}; };
if (this.data.activity.id) { if (this.data.activity.id) {
(activity as UpdateOrderDto).id = this.data.activity.id; (activity as UpdateOrderDto).id = this.data.activity.id;
} else {
(activity as CreateOrderDto).updateAccountBalance =
this.activityForm.controls['updateAccountBalance'].value;
} }
this.dialogRef.close({ activity }); this.dialogRef.close({ activity });

10
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html

@ -18,8 +18,12 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div [ngClass]="{'mb-3': data.activity.id}">
<mat-form-field appearance="outline" class="mb-1 without-hint w-100"> <mat-form-field
appearance="outline"
class="w-100"
[ngClass]="{'mb-1 without-hint': !data.activity.id}"
>
<mat-label i18n>Account</mat-label> <mat-label i18n>Account</mat-label>
<mat-select formControlName="accountId"> <mat-select formControlName="accountId">
<mat-option <mat-option
@ -32,7 +36,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="mb-3"> <div class="mb-3" [ngClass]="{'d-none': data.activity.id}">
<mat-checkbox color="primary" formControlName="updateAccountBalance" i18n <mat-checkbox color="primary" formControlName="updateAccountBalance" i18n
>Update Cash Balance</mat-checkbox >Update Cash Balance</mat-checkbox
> >

Loading…
Cancel
Save