diff --git a/src/app/content/hemat-app/device/device.component.html b/src/app/content/hemat-app/device/device.component.html
index 7a8cfc9..9568122 100644
--- a/src/app/content/hemat-app/device/device.component.html
+++ b/src/app/content/hemat-app/device/device.component.html
@@ -16,7 +16,7 @@
Total Device
- {{ filteredRows?.length }}
+ {{ summaryTotal?.length }}
diff --git a/src/app/content/hemat-app/device/device.component.ts b/src/app/content/hemat-app/device/device.component.ts
index baf91c3..297f627 100644
--- a/src/app/content/hemat-app/device/device.component.ts
+++ b/src/app/content/hemat-app/device/device.component.ts
@@ -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,