locale stuff
This commit is contained in:
@ -3,6 +3,8 @@ import { MatButton } from '@angular/material/button';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { AccountEntryService, AccountService } from '../data-object-service';
|
||||
import { Account, AccountEntry, NULL_AccountEntry } from '../data-objects';
|
||||
import { ExtApiService } from '../ext-data-object-service';
|
||||
import { Saldo } from '../ext-data-objects';
|
||||
import { MessageService } from '../message.service';
|
||||
|
||||
@Component({
|
||||
@ -21,6 +23,8 @@ export class AccountComponent implements OnInit {
|
||||
accountEntries: AccountEntry[]
|
||||
accountEntriesDataSource: MatTableDataSource<AccountEntry>
|
||||
accountEntriesDisplayedColumns: string[] = [ "description", "amount", "createdAt" ]
|
||||
saldo: Saldo
|
||||
|
||||
|
||||
newAccountEntry: AccountEntry = NULL_AccountEntry
|
||||
|
||||
@ -28,6 +32,7 @@ export class AccountComponent implements OnInit {
|
||||
constructor(
|
||||
private accountService: AccountService,
|
||||
private accountEntryService: AccountEntryService,
|
||||
private extApiService: ExtApiService,
|
||||
private messageService: MessageService
|
||||
) { }
|
||||
|
||||
@ -47,8 +52,10 @@ export class AccountComponent implements OnInit {
|
||||
async getAccountEntries(): Promise<void> {
|
||||
try {
|
||||
this.accountEntries = await this.accountEntryService.getAccountEntrysByAccount(this.selectedAccountId)
|
||||
this.accountEntries.reverse()
|
||||
this.messageService.add(`AccountEntries: ${JSON.stringify(this.accountEntries, undefined, 4)}`)
|
||||
this.accountEntriesDataSource = new MatTableDataSource<AccountEntry>(this.accountEntries)
|
||||
this.saldo = await this.extApiService.getAccountSaldo(this.selectedAccountId)
|
||||
} catch (err) {
|
||||
this.messageService.add(`Error in getAccountEntries: ${JSON.stringify(err, undefined, 4)}`)
|
||||
}
|
||||
@ -61,7 +68,7 @@ export class AccountComponent implements OnInit {
|
||||
this.messageService.add(`addAccountEntry: ${ JSON.stringify(this.newAccountEntry, undefined, 4) }`)
|
||||
this.newAccountEntry = await this.accountEntryService.postAccountEntry(this.newAccountEntry)
|
||||
this.messageService.add(`New accountEntry created: ${this.newAccountEntry.id}`)
|
||||
this.newAccountEntry = { 'account': this.account.id, 'amount': 0, 'created_at': '', 'description': '', 'id': 0 }
|
||||
this.newAccountEntry = { 'account': this.account.id, 'amount': undefined, 'created_at': '', 'description': '', 'id': 0 }
|
||||
this.getAccountEntries()
|
||||
} catch (err) {
|
||||
this.messageService.add(`Error in addAccountEntry: ${JSON.stringify(err, undefined, 4)}`)
|
||||
|
Reference in New Issue
Block a user