Feature/usability improvements in the create or edit transaction dialog (#483)

* Usability improvements
  * Disable the symbol input in edit mode
  * Filter accounts by type (SECURITIES)

* Update changelog
pull/480/head
Thomas Kaul 3 years ago committed by GitHub
parent 0cb632b165
commit bc58ee86ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Locked the symbol input in the edit transaction dialog
- Filtered the account selector by account type (`SECURITIES`) in the create or edit transaction dialog
## 1.78.0 - 20.11.2021 ## 1.78.0 - 20.11.2021
### Added ### Added

@ -84,6 +84,10 @@ export class CreateOrUpdateTransactionDialog implements OnDestroy {
}) })
); );
if (this.data.transaction.id) {
this.searchSymbolCtrl.disable();
}
if (this.data.transaction.symbol) { if (this.data.transaction.symbol) {
this.dataService this.dataService
.fetchSymbolItem({ .fetchSymbolItem({

@ -10,9 +10,7 @@
required required
[(value)]="data.transaction.accountId" [(value)]="data.transaction.accountId"
> >
<mat-option <mat-option *ngFor="let account of data.accounts" [value]="account.id"
*ngFor="let account of data.user?.accounts"
[value]="account.id"
>{{ account.name }}</mat-option >{{ account.name }}</mat-option
> >
</mat-select> </mat-select>

@ -1,8 +1,9 @@
import { User } from '@ghostfolio/common/interfaces'; import { User } from '@ghostfolio/common/interfaces';
import { Order } from '@prisma/client'; import { Account, Order } from '@prisma/client';
export interface CreateOrUpdateTransactionDialogParams { export interface CreateOrUpdateTransactionDialogParams {
accountId: string; accountId: string;
accounts: Account[];
transaction: Order; transaction: Order;
user: User; user: User;
} }

@ -261,6 +261,9 @@ export class TransactionsPageComponent implements OnDestroy, OnInit {
}: OrderModel): void { }: OrderModel): void {
const dialogRef = this.dialog.open(CreateOrUpdateTransactionDialog, { const dialogRef = this.dialog.open(CreateOrUpdateTransactionDialog, {
data: { data: {
accounts: this.user.accounts.filter((account) => {
return account.accountType === 'SECURITIES';
}),
transaction: { transaction: {
accountId, accountId,
currency, currency,
@ -343,6 +346,9 @@ export class TransactionsPageComponent implements OnDestroy, OnInit {
private openCreateTransactionDialog(aTransaction?: OrderModel): void { private openCreateTransactionDialog(aTransaction?: OrderModel): void {
const dialogRef = this.dialog.open(CreateOrUpdateTransactionDialog, { const dialogRef = this.dialog.open(CreateOrUpdateTransactionDialog, {
data: { data: {
accounts: this.user.accounts.filter((account) => {
return account.accountType === 'SECURITIES';
}),
transaction: { transaction: {
accountId: aTransaction?.accountId ?? this.defaultAccountId, accountId: aTransaction?.accountId ?? this.defaultAccountId,
currency: aTransaction?.currency ?? null, currency: aTransaction?.currency ?? null,

Loading…
Cancel
Save