Browse Source

fix: review changes

pull/68/head
mantovanig 4 years ago
parent
commit
f87e3a6f51
  1. 4
      apps/client/src/app/components/transactions-table/transactions-table.component.html
  2. 6
      apps/client/src/app/components/transactions-table/transactions-table.component.ts
  3. 14
      apps/client/src/app/pages/transactions/transactions-page.component.ts
  4. 2
      apps/client/src/app/pages/transactions/transactions-page.html

4
apps/client/src/app/components/transactions-table/transactions-table.component.html

@ -177,8 +177,8 @@
<button i18n mat-menu-item (click)="onUpdateTransaction(element)">
Edit
</button>
<button i18n mat-menu-item (click)="onDuplicateTransaction(element)">
Duplicate
<button i18n mat-menu-item (click)="onCloneTransaction(element)">
Clone
</button>
<button i18n mat-menu-item (click)="onDeleteTransaction(element.id)">
Delete

6
apps/client/src/app/components/transactions-table/transactions-table.component.ts

@ -35,8 +35,8 @@ export class TransactionsTableComponent
@Input() transactions: OrderModel[];
@Output() transactionDeleted = new EventEmitter<string>();
@Output() transactionToClone = new EventEmitter<OrderModel>();
@Output() transactionToUpdate = new EventEmitter<OrderModel>();
@Output() transactionToDuplicate = new EventEmitter<OrderModel>();
@ViewChild(MatSort) sort: MatSort;
@ -124,8 +124,8 @@ export class TransactionsTableComponent
this.transactionToUpdate.emit(aTransaction);
}
public onDuplicateTransaction(aTransaction: OrderModel) {
this.transactionToDuplicate.emit(aTransaction);
public onCloneTransaction(aTransaction: OrderModel) {
this.transactionToClone.emit(aTransaction);
}
public openPositionDialog({

14
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: () => {
@ -123,10 +127,6 @@ export class TransactionsPageComponent implements OnInit {
});
}
public onDuplicateTransaction(aTransaction: OrderModel) {
this.openCreateTransactionDialog(aTransaction);
}
public openUpdateTransactionDialog({
accountId,
currency,
@ -184,14 +184,14 @@ export class TransactionsPageComponent implements OnInit {
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: aTransaction?.currency || null,
currency: aTransaction?.currency ?? null,
date: new Date(),
fee: 0,
quantity: null,
symbol: aTransaction?.symbol || null,
symbol: aTransaction?.symbol ?? null,
type: 'BUY',
unitPrice: null
}

2
apps/client/src/app/pages/transactions/transactions-page.html

@ -9,8 +9,8 @@
[showActions]="!hasImpersonationId && hasPermissionToDeleteOrder"
[transactions]="transactions"
(transactionDeleted)="onDeleteTransaction($event)"
(transactionToClone)="onCloneTransaction($event)"
(transactionToUpdate)="onUpdateTransaction($event)"
(transactionToDuplicate)="onDuplicateTransaction($event)"
></gf-transactions-table>
</div>
</div>

Loading…
Cancel
Save