Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Add duplicate action on transactions table (#68)
Mantovani Gabriele631efff7ae99
diff --git a/apps/client/src/app/components/transactions-table/transactions-table.component.html b/apps/client/src/app/components/transactions-table/transactions-table.component.htmlindex 7c0bd479dd..9d21651803 100644--- a/apps/client/src/app/components/transactions-table/transactions-table.component.html+++ b/apps/client/src/app/components/transactions-table/transactions-table.component.html@@ -177,6 +177,9 @@<button i18n mat-menu-item (click)="onUpdateTransaction(element)">Edit</button>+ <button i18n mat-menu-item (click)="onCloneTransaction(element)">+ Clone+ </button><button i18n mat-menu-item (click)="onDeleteTransaction(element.id)">Delete</button>diff --git a/apps/client/src/app/components/transactions-table/transactions-table.component.ts b/apps/client/src/app/components/transactions-table/transactions-table.component.tsindex b4d20b33f5..4978701f4c 100644--- a/apps/client/src/app/components/transactions-table/transactions-table.component.ts+++ b/apps/client/src/app/components/transactions-table/transactions-table.component.ts@@ -35,6 +35,7 @@ export class TransactionsTableComponent@Input() transactions: OrderModel[];@Output() transactionDeleted = new EventEmitter<string>();+ @Output() transactionToClone = new EventEmitter<OrderModel>();@Output() transactionToUpdate = new EventEmitter<OrderModel>();@ViewChild(MatSort) sort: MatSort;@@ -123,6 +124,10 @@ export class TransactionsTableComponentthis.transactionToUpdate.emit(aTransaction);}+ public onCloneTransaction(aTransaction: OrderModel) {+ this.transactionToClone.emit(aTransaction);+ }+public openPositionDialog({symbol,titlediff --git a/apps/client/src/app/pages/transactions/transactions-page.component.ts b/apps/client/src/app/pages/transactions/transactions-page.component.tsindex ef02e49c0c..bfae6b8a12 100644--- a/apps/client/src/app/pages/transactions/transactions-page.component.ts+++ b/apps/client/src/app/pages/transactions/transactions-page.component.ts@@ -109,6 +109,10 @@ export class TransactionsPageComponent implements OnInit {});}+ public onCloneTransaction(aTransaction: OrderModel) {+ this.openCreateTransactionDialog(aTransaction);+ }+public onDeleteTransaction(aId: string) {this.dataService.deleteOrder(aId).subscribe({next: () => {@@ -175,20 +179,21 @@ export class TransactionsPageComponent implements OnInit {this.unsubscribeSubject.complete();}- private openCreateTransactionDialog(): void {+ private openCreateTransactionDialog(aTransaction?: OrderModel): void {const dialogRef = this.dialog.open(CreateOrUpdateTransactionDialog, {data: {accounts: this.user?.accounts,transaction: {- accountId: this.user?.accounts.find((account) => {+ accountId: aTransaction?.accountId ?? this.user?.accounts.find((account) => {return account.isDefault;})?.id,- currency: null,+ currency: aTransaction?.currency ?? null,+ dataSource: aTransaction?.dataSource ?? null,date: new Date(),fee: 0,quantity: null,- symbol: null,- type: 'BUY',+ symbol: aTransaction?.symbol ?? null,+ type: aTransaction?.type ?? 'BUY',unitPrice: null}},diff --git a/apps/client/src/app/pages/transactions/transactions-page.html b/apps/client/src/app/pages/transactions/transactions-page.htmlindex d290f54ed2..fc7b9d3a88 100644--- a/apps/client/src/app/pages/transactions/transactions-page.html+++ b/apps/client/src/app/pages/transactions/transactions-page.html@@ -9,6 +9,7 @@[showActions]="!hasImpersonationId && hasPermissionToDeleteOrder"[transactions]="transactions"(transactionDeleted)="onDeleteTransaction($event)"+ (transactionToClone)="onCloneTransaction($event)"(transactionToUpdate)="onUpdateTransaction($event)"></gf-transactions-table></div>