integrasi building list dan room list
This commit is contained in:
@@ -131,7 +131,7 @@
|
||||
class="btn btn-float btn-square btn-outline-secondary"
|
||||
triggers="hover:click:hover"
|
||||
ngbTooltip="Room"
|
||||
[routerLink]="['/monitoring/monitoring-room']"
|
||||
(click)="viewRoom(data)"
|
||||
>
|
||||
<i class="feather ft-log-in"></i>
|
||||
</button>
|
||||
|
||||
@@ -47,39 +47,28 @@ export class BuildingComponent {
|
||||
showLabel: false,
|
||||
},
|
||||
};
|
||||
this.fetchData();
|
||||
// this.buildingData();
|
||||
this.listBuilding();
|
||||
}
|
||||
|
||||
fetchData() {
|
||||
// this.monitoringApiService.getBuildingData().subscribe((res) => {
|
||||
// this.data = res;
|
||||
// this.filteredRows = res.data;
|
||||
// console.log(this.filteredRows);
|
||||
|
||||
// this.dataTop = [];
|
||||
// for (let i = 0; i < res.length; i++) {
|
||||
// if (res[i].topUse.label[i]) {
|
||||
// this.dataTop.push({
|
||||
// label: res[i].topUse.label ? res[i].topUse.label : '',
|
||||
// value: res[i].topUse.value ? res[i].topUse.value : 0,
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
this.monitoringService.getMonitoringBuildingData().subscribe((res) => {
|
||||
this.data = res;
|
||||
this.filteredRows = res;
|
||||
listBuilding() {
|
||||
this.monitoringApiService.listBuilding().subscribe((res) => {
|
||||
console.log(res.data);
|
||||
this.data = res.data;
|
||||
this.filteredRows = res.data;
|
||||
|
||||
this.dataTop = [];
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
if (res[i].topUse.label[i]) {
|
||||
this.dataTop.push({
|
||||
label: res[i].topUse.label,
|
||||
value: res[i].topUse.value,
|
||||
});
|
||||
const maxItems = 4;
|
||||
|
||||
res.data.forEach((item) => {
|
||||
for (let i = 0; i < maxItems; i++) {
|
||||
if (item.topUse.label[i] !== undefined) {
|
||||
this.dataTop.push({
|
||||
label: item.topUse.label,
|
||||
value: item.topUse.value,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -114,4 +103,9 @@ export class BuildingComponent {
|
||||
editRow(row) {
|
||||
this.router.navigate(["/monitoring/edit-new-building", row.id]);
|
||||
}
|
||||
|
||||
viewRoom(row){
|
||||
console.log(row);
|
||||
this.router.navigate(["/monitoring/monitoring-room", row.id]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user