fee pages

This commit is contained in:
2021-09-07 17:52:02 +02:00
parent 356c8c0bbd
commit cf35af9c1e
13 changed files with 288 additions and 5 deletions

View File

@ -0,0 +1,42 @@
import { Component, OnInit } from '@angular/core';
import { MatTableDataSource } from '@angular/material/table';
import { FeeService } from '../data-object-service';
import { Fee } from '../data-objects';
import { MessageService } from '../message.service';
@Component({
selector: 'app-fee-list',
templateUrl: './fee-list.component.html',
styleUrls: ['./fee-list.component.css']
})
export class FeeListComponent implements OnInit {
fees: Fee[]
dataSource: MatTableDataSource<Fee>
displayedColumns: string[] = [ "description", "amount", "fee_type", "startdate", "enddate" ]
constructor(
private feeService: FeeService,
private messageService: MessageService
) { }
async getFees(): Promise<void> {
try {
this.messageService.add("Trying to load fees")
this.fees = await this.feeService.getFees()
this.messageService.add("Fees loaded")
this.dataSource = new MatTableDataSource<Fee>(this.fees)
} catch (err) {
this.messageService.add(`Error in getFees: ${ JSON.stringify(err, undefined, 4) }`)
}
}
ngOnInit(): void {
this.messageService.add("FeeListComponent.ngOnInit")
this.getFees()
}
}