44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { Component, OnInit, ViewChild } from "@angular/core";
|
|
import { MatPaginator } from "@angular/material/paginator";
|
|
import { MatTableDataSource } from "@angular/material/table";
|
|
|
|
import { DropZoneResp } from "../../models/dropzone";
|
|
import { ServiceApiGet } from "../../services/service-api-get.service";
|
|
import { ServiceComm } from "../../services/service-comm.service";
|
|
|
|
@Component({
|
|
selector: "app-list-of-dzs",
|
|
templateUrl: "./list-of-dzs.component.html",
|
|
styleUrls: ["./list-of-dzs.component.css"]
|
|
})
|
|
export class ListOfDzsComponent implements OnInit {
|
|
public displayedColumns: Array<string> = [
|
|
"id",
|
|
"name",
|
|
"latitude",
|
|
"longitude",
|
|
"address",
|
|
"email",
|
|
"type"
|
|
];
|
|
public dataSourceTable;
|
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
|
|
|
constructor(
|
|
private serviceApi: ServiceApiGet,
|
|
private serviceComm: ServiceComm
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
this.serviceComm.updatedComponentTitle("List of DZs");
|
|
this.getListOfDropZones();
|
|
}
|
|
|
|
getListOfDropZones() {
|
|
this.serviceApi.getListOfDropZones().subscribe(data => {
|
|
this.dataSourceTable = new MatTableDataSource<DropZoneResp>(data);
|
|
this.dataSourceTable.paginator = this.paginator;
|
|
});
|
|
}
|
|
}
|