perbaikan summary device
This commit is contained in:
parent
530b64cb10
commit
197b428d18
|
@ -16,7 +16,7 @@
|
||||||
Total Device
|
Total Device
|
||||||
</h6>
|
</h6>
|
||||||
<h3 style="color: #ffffff !important">
|
<h3 style="color: #ffffff !important">
|
||||||
{{ filteredRows?.length }}
|
{{ summaryTotal?.length }}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="align-self-center">
|
<div class="align-self-center">
|
||||||
|
|
|
@ -20,6 +20,7 @@ export class DeviceComponent implements OnInit {
|
||||||
totalOn: any;
|
totalOn: any;
|
||||||
totalOff: any;
|
totalOff: any;
|
||||||
filteredRows: any[];
|
filteredRows: any[];
|
||||||
|
summaryTotal: any[];
|
||||||
searchTerm: string = "";
|
searchTerm: string = "";
|
||||||
buildingSelected: any;
|
buildingSelected: any;
|
||||||
statusSelected: any;
|
statusSelected: any;
|
||||||
|
@ -68,13 +69,17 @@ export class DeviceComponent implements OnInit {
|
||||||
this.buildingSelected = this.storedData.buildingId;
|
this.buildingSelected = this.storedData.buildingId;
|
||||||
|
|
||||||
if (this.newDeviceActive === true) {
|
if (this.newDeviceActive === true) {
|
||||||
|
|
||||||
}
|
}
|
||||||
this.fetchData(
|
this.fetchData(
|
||||||
this.buildingSelected,
|
this.buildingSelected,
|
||||||
this.categorySelected,
|
this.categorySelected,
|
||||||
this.statusSelected
|
this.statusSelected
|
||||||
);
|
);
|
||||||
|
this.summaryDevice(
|
||||||
|
this.buildingSelected,
|
||||||
|
this.categorySelected,
|
||||||
|
this.statusSelected
|
||||||
|
);
|
||||||
this.dataListMaster();
|
this.dataListMaster();
|
||||||
this.dataListBuilding();
|
this.dataListBuilding();
|
||||||
}
|
}
|
||||||
|
@ -98,10 +103,18 @@ export class DeviceComponent implements OnInit {
|
||||||
voltageName: item.voltage_name,
|
voltageName: item.voltage_name,
|
||||||
statusName: item.status_name,
|
statusName: item.status_name,
|
||||||
}));
|
}));
|
||||||
this.totalOn = this.filteredRows.filter(
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
summaryDevice(buildingSelected, categorySelected, statusSelected) {
|
||||||
|
this.deviceService
|
||||||
|
.getDeviceData(buildingSelected, categorySelected, statusSelected)
|
||||||
|
.subscribe((res) => {
|
||||||
|
this.summaryTotal = res.results.data;
|
||||||
|
this.totalOn = res.results.data.filter(
|
||||||
(row) => row.status_id === 2
|
(row) => row.status_id === 2
|
||||||
).length;
|
).length;
|
||||||
this.totalOff = this.filteredRows.filter(
|
this.totalOff = res.results.data.filter(
|
||||||
(row) => row.status_id === 3
|
(row) => row.status_id === 3
|
||||||
).length;
|
).length;
|
||||||
});
|
});
|
||||||
|
@ -128,7 +141,7 @@ export class DeviceComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
allDevice(){
|
allDevice() {
|
||||||
this.fetchData(
|
this.fetchData(
|
||||||
this.buildingSelected,
|
this.buildingSelected,
|
||||||
this.categorySelected,
|
this.categorySelected,
|
||||||
|
|
Loading…
Reference in New Issue