perbaikan summary device

This commit is contained in:
Fuzi_fauzia 2024-06-27 14:41:51 +07:00
parent 530b64cb10
commit 197b428d18
2 changed files with 19 additions and 6 deletions

View File

@ -16,7 +16,7 @@
Total Device
</h6>
<h3 style="color: #ffffff !important">
{{ filteredRows?.length }}
{{ summaryTotal?.length }}
</h3>
</div>
<div class="align-self-center">

View File

@ -20,6 +20,7 @@ export class DeviceComponent implements OnInit {
totalOn: any;
totalOff: any;
filteredRows: any[];
summaryTotal: any[];
searchTerm: string = "";
buildingSelected: any;
statusSelected: any;
@ -68,13 +69,17 @@ export class DeviceComponent implements OnInit {
this.buildingSelected = this.storedData.buildingId;
if (this.newDeviceActive === true) {
}
this.fetchData(
this.buildingSelected,
this.categorySelected,
this.statusSelected
);
this.summaryDevice(
this.buildingSelected,
this.categorySelected,
this.statusSelected
);
this.dataListMaster();
this.dataListBuilding();
}
@ -98,10 +103,18 @@ export class DeviceComponent implements OnInit {
voltageName: item.voltage_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
).length;
this.totalOff = this.filteredRows.filter(
this.totalOff = res.results.data.filter(
(row) => row.status_id === 3
).length;
});
@ -128,7 +141,7 @@ export class DeviceComponent implements OnInit {
});
}
allDevice(){
allDevice() {
this.fetchData(
this.buildingSelected,
this.categorySelected,