overhead stuff
This commit is contained in:
@ -0,0 +1,41 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { OverheadAdvanceService } from '../data-object-service';
|
||||
import { OverheadAdvance } from '../data-objects';
|
||||
import { MessageService } from '../message.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-overhead-advance-list',
|
||||
templateUrl: './overhead-advance-list.component.html',
|
||||
styleUrls: ['./overhead-advance-list.component.css']
|
||||
})
|
||||
export class OverheadAdvanceListComponent implements OnInit {
|
||||
|
||||
overheadAdvances: OverheadAdvance[]
|
||||
dataSource: MatTableDataSource<OverheadAdvance>
|
||||
displayedColumns: string[] = [ "description", "amount", "startdate", "enddate" ]
|
||||
|
||||
constructor(
|
||||
private overheadAdvanceService: OverheadAdvanceService,
|
||||
private messageService: MessageService
|
||||
) { }
|
||||
|
||||
async getOverheadAdvances(): Promise<void> {
|
||||
try {
|
||||
this.messageService.add("Trying to load overheadAdvances")
|
||||
this.overheadAdvances = await this.overheadAdvanceService.getOverheadAdvances()
|
||||
this.messageService.add("OverheadAdvances loaded")
|
||||
|
||||
this.dataSource = new MatTableDataSource<OverheadAdvance>(this.overheadAdvances)
|
||||
} catch (err) {
|
||||
this.messageService.add(`Error in getOverheadAdvances: ${ JSON.stringify(err, undefined, 4) }`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.messageService.add("OverheadAdvanceListComponent.ngOnInit")
|
||||
this.getOverheadAdvances()
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user