select account to work on
This commit is contained in:
parent
f7eca3844d
commit
fcd2633c72
@ -5,6 +5,16 @@
|
|||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<app-account #fallbackAccountComponent [selectedAccountId]="fallbackAccountId" [shallBeRentPayment]="false"></app-account>
|
<div>
|
||||||
|
<span>Konto auswählen: </span>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-select #mapSelect [(ngModel)]="accountId" name="account">
|
||||||
|
<mat-label>Mieter</mat-label>
|
||||||
|
<mat-option *ngFor="let p of accounts" [value]="p.id">{{p.description}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<app-account [selectedAccountId]="accountId" [shallBeRentPayment]="false"></app-account>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { AccountComponent } from '../account/account.component';
|
import { AccountComponent } from '../account/account.component';
|
||||||
|
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,23 +12,23 @@ import { MessageService } from '../message.service';
|
|||||||
})
|
})
|
||||||
export class LedgerComponent implements OnInit {
|
export class LedgerComponent implements OnInit {
|
||||||
|
|
||||||
fallbackAccount: Account
|
accounts: Account[]
|
||||||
fallbackAccountId: number
|
accountId: number
|
||||||
|
|
||||||
|
|
||||||
@ViewChild('fallbackAccountComponent') fallbackAccountComponent: AccountComponent
|
@ViewChild('accountComponent') accountComponent: AccountComponent
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private extApiService: ExtApiService,
|
private accountService: AccountService,
|
||||||
private messageService: MessageService
|
private messageService: MessageService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
async getAccount(): Promise<void> {
|
async getAccount(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
this.messageService.add("Trying to load fallback account")
|
this.messageService.add("Trying to load accounts")
|
||||||
this.fallbackAccount = await this.extApiService.getAccountByDescription('fallback_account')
|
this.accounts = await this.accountService.getAccounts()
|
||||||
this.messageService.add("Account loaded")
|
this.messageService.add("Accounts loaded")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||||
}
|
}
|
||||||
@ -35,7 +36,6 @@ export class LedgerComponent implements OnInit {
|
|||||||
|
|
||||||
async ngOnInit(): Promise<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
await this.getAccount()
|
await this.getAccount()
|
||||||
this.fallbackAccountId = this.fallbackAccount.id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user