locale stuff

This commit is contained in:
2021-09-09 18:00:24 +02:00
parent 8276e39a7e
commit 6fcd785be0
16 changed files with 250 additions and 23 deletions

View File

@ -24,4 +24,8 @@ table {
.rightaligned {
justify-self: right;
}
.large {
font-size: large;
}

View File

@ -10,7 +10,7 @@
(closed)="collapse = false">
<mat-expansion-panel-header>
<mat-panel-title *ngIf="!collapse">
Kontoübersicht
Kontoübersicht, Saldo: {{saldo?.saldo | number:'1.2-2'}} €
</mat-panel-title>
<mat-panel-description>
</mat-panel-description>
@ -34,6 +34,9 @@
<button #addAccountEntryButton type="submit" mat-raised-button color="primary">Buchung speichern</button>
</form>
</div>
<div class="large">
Saldo: {{saldo?.saldo | number:'1.2-2'}} €
</div>
<div id="secondBlock">
<table mat-table [dataSource]="accountEntriesDataSource" #zftable>
<ng-container matColumnDef="description">

View File

@ -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)}`)