overhead stuff

This commit is contained in:
2021-09-02 18:26:55 +02:00
parent 7c180f0986
commit 1ce54cf9cf
11 changed files with 257 additions and 6 deletions

View File

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