more ledger stuff

This commit is contained in:
Wolfgang Hottgenroth 2021-10-31 22:27:00 +01:00
parent 2b883aee02
commit 797151d547
Signed by: wn
GPG Key ID: E49AF3B9EF6DD469
2 changed files with 36 additions and 8 deletions

View File

@ -5,8 +5,29 @@
</mat-card-title>
</mat-card-header>
<mat-card-content>
<app-account [selectedAccountId]="accountId" [shallBeRentPayment]="false"></app-account>
<mat-accordion>
<mat-expansion-panel (opened)="collapseIncomeDetails = true"
(closed)="collapseIncomeDetails = false">
<mat-expansion-panel-header>
<mat-panel-title>
Einnahmen
</mat-panel-title>
<mat-panel-description>
</mat-panel-description>
</mat-expansion-panel-header>
<app-account [selectedAccountId]="incomeAccountId" [shallBeRentPayment]="false"></app-account>
</mat-expansion-panel>
<mat-expansion-panel (opened)="collapseExpenseDetails = true"
(closed)="collapseExpenseDetails = false">
<mat-expansion-panel-header>
<mat-panel-title>
Ausgaben
</mat-panel-title>
<mat-panel-description>
</mat-panel-description>
</mat-expansion-panel-header>
<app-account [selectedAccountId]="expenseAccountId" [shallBeRentPayment]="false"></app-account>
</mat-expansion-panel>
</mat-accordion>
</mat-card-content>
</mat-card>

View File

@ -1,5 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { AccountService } from '../data-object-service';
import { Account } from '../data-objects';
import { ExtApiService } from '../ext-data-object-service';
import { MessageService } from '../message.service';
@ -11,8 +10,14 @@ import { MessageService } from '../message.service';
})
export class LedgerComponent implements OnInit {
account: Account
accountId: number
incomeAccount: Account
incomeAccountId: number
expenseAccount: Account
expenseAccountId: number
collapseIncomeDetails: boolean = false
collapseExpenseDetails: boolean = false
constructor(
private extApiService: ExtApiService,
@ -22,7 +27,8 @@ export class LedgerComponent implements OnInit {
async getAccount(): Promise<void> {
try {
this.messageService.add("Trying to load ledger account")
this.account = await this.extApiService.getAccountByDescription('Ledger')
this.incomeAccount = await this.extApiService.getAccountByDescription('LedgerIncome')
this.expenseAccount = await this.extApiService.getAccountByDescription('LedgerExpense')
this.messageService.add("Account loaded")
} catch (err) {
this.messageService.add(JSON.stringify(err, undefined, 4))
@ -31,7 +37,8 @@ export class LedgerComponent implements OnInit {
async ngOnInit(): Promise<void> {
await this.getAccount()
this.accountId = this.account.id
this.incomeAccountId = this.incomeAccount.id
this.expenseAccountId = this.expenseAccount.id
}
}