fee pages
This commit is contained in:
42
ui/hv2-ui/src/app/fee-list/fee-list.component.ts
Normal file
42
ui/hv2-ui/src/app/fee-list/fee-list.component.ts
Normal 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()
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user