add new pages
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MessageService } from '../message.service';
|
||||
import { CommercialPremiseService } from '../data-object-service';
|
||||
import { CommercialPremise } from '../data-objects';
|
||||
import { MatTableDataSource } from '@angular/material/table'
|
||||
|
||||
@Component({
|
||||
selector: 'app-my-commercial-units',
|
||||
templateUrl: './my-commercial-units.component.html',
|
||||
styleUrls: ['./my-commercial-units.component.css']
|
||||
})
|
||||
export class MyCommercialUnitsComponent implements OnInit {
|
||||
|
||||
commercialPremises: CommercialPremise[]
|
||||
dataSource: MatTableDataSource<CommercialPremise>
|
||||
displayedColumns: string[] = ["description", "premise"]
|
||||
|
||||
constructor(private commercialPremiseService: CommercialPremiseService, private messageService: MessageService) { }
|
||||
|
||||
async getCommercialPremises(): Promise<void> {
|
||||
try {
|
||||
this.messageService.add("Trying to load commercialPremises")
|
||||
this.commercialPremises = await this.commercialPremiseService.getCommercialPremises()
|
||||
this.messageService.add("CommercialPremises loaded")
|
||||
|
||||
this.dataSource = new MatTableDataSource<CommercialPremise>(this.commercialPremises)
|
||||
} catch (err) {
|
||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.messageService.add("MyCommercialUnitsComponent.ngOnInit")
|
||||
this.getCommercialPremises()
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user