diff --git a/apps/client/src/app/components/accounts-table/accounts-table.component.html b/apps/client/src/app/components/accounts-table/accounts-table.component.html index d3ece8977..c402f5b3e 100644 --- a/apps/client/src/app/components/accounts-table/accounts-table.component.html +++ b/apps/client/src/app/components/accounts-table/accounts-table.component.html @@ -5,9 +5,10 @@ class="d-none d-lg-table-cell px-1" mat-header-cell > - +
- + +
(); + @Output() accountToggleExcluded = new EventEmitter(); @Output() accountToUpdate = new EventEmitter(); @ViewChild(MatSort) sort: MatSort; @@ -87,6 +88,10 @@ export class AccountsTableComponent implements OnChanges, OnDestroy, OnInit { } } + public onToggleExcluded(aAccount: AccountModel) { + this.accountToggleExcluded.emit(aAccount); + } + public onOpenAccountDetailDialog(accountId: string) { this.router.navigate([], { queryParams: { accountId, accountDetailDialog: true } diff --git a/apps/client/src/app/pages/accounts/accounts-page.component.ts b/apps/client/src/app/pages/accounts/accounts-page.component.ts index ab03340df..ca4a7d88f 100644 --- a/apps/client/src/app/pages/accounts/accounts-page.component.ts +++ b/apps/client/src/app/pages/accounts/accounts-page.component.ts @@ -144,6 +144,32 @@ export class AccountsPageComponent implements OnDestroy, OnInit { }); } + public onToggleExcluded(aAccount: AccountModel) { + let account: UpdateAccountDto = { + accountType: aAccount.accountType, + balance: aAccount.balance, + comment: aAccount.comment, + currency: aAccount.currency, + id: aAccount.id, + isExcluded: !(aAccount.isExcluded), + name: aAccount.name, + platformId: aAccount.platformId + } + this.dataService + .putAccount(account) + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe({ + next: () => { + this.userService + .get(true) + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe(); + + this.fetchAccounts(); + } + }); + } + public onUpdateAccount(aAccount: AccountModel) { this.router.navigate([], { queryParams: { accountId: aAccount.id, editDialog: true } diff --git a/apps/client/src/app/pages/accounts/accounts-page.html b/apps/client/src/app/pages/accounts/accounts-page.html index 6057802df..8a9fa9ab5 100644 --- a/apps/client/src/app/pages/accounts/accounts-page.html +++ b/apps/client/src/app/pages/accounts/accounts-page.html @@ -13,6 +13,7 @@ [totalValueInBaseCurrency]="totalValueInBaseCurrency" [transactionCount]="transactionCount" (accountDeleted)="onDeleteAccount($event)" + (accountToggleExcluded)="onToggleExcluded($event)" (accountToUpdate)="onUpdateAccount($event)" >