more ledger stuff

This commit is contained in:
2021-10-31 22:27:00 +01:00
parent 2b883aee02
commit 797151d547
2 changed files with 36 additions and 8 deletions

View File

@ -5,8 +5,29 @@
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-accordion>
<app-account [selectedAccountId]="accountId" [shallBeRentPayment]="false"></app-account> <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-content>
</mat-card> </mat-card>

View File

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