perbaikan summary device
This commit is contained in:
parent
530b64cb10
commit
197b428d18
|
@ -16,7 +16,7 @@
|
|||
Total Device
|
||||
</h6>
|
||||
<h3 style="color: #ffffff !important">
|
||||
{{ filteredRows?.length }}
|
||||
{{ summaryTotal?.length }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="align-self-center">
|
||||
|
|
|
@ -20,6 +20,7 @@ export class DeviceComponent implements OnInit {
|
|||
totalOn: any;
|
||||
totalOff: any;
|
||||
filteredRows: any[];
|
||||
summaryTotal: any[];
|
||||
searchTerm: string = "";
|
||||
buildingSelected: any;
|
||||
statusSelected: any;
|
||||
|
@ -37,7 +38,7 @@ export class DeviceComponent implements OnInit {
|
|||
spinnerExportActive: boolean = false;
|
||||
spinnerNewDeviceActive: boolean = false;
|
||||
newDeviceActive: boolean = false;
|
||||
|
||||
|
||||
singlebasicSelected: any;
|
||||
|
||||
constructor(
|
||||
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue