@@ -62,11 +62,11 @@
diff --git a/src/app/content/hemat-app/monitoring/detail/detail.component.ts b/src/app/content/hemat-app/monitoring/detail/detail.component.ts
index cabe6b1..b34e2d9 100644
--- a/src/app/content/hemat-app/monitoring/detail/detail.component.ts
+++ b/src/app/content/hemat-app/monitoring/detail/detail.component.ts
@@ -2,6 +2,7 @@ import { Component } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { BlockUI, NgBlockUI } from "ng-block-ui";
import { ChartApiService } from "src/app/_services/chart.api";
+import { BuildingService } from "../../service/monitoring-api.service";
interface Sales {
name: string;
sales: string;
@@ -24,10 +25,17 @@ export class DetailComponent {
ExpenseschartOption: any;
donutChart2: any;
public breadcrumb: any;
+ // integrasi
+ electric: any;
+ water: any;
+ device: any;
+ room: any;
+ //......
constructor(
private chartApiservice: ChartApiService,
private router: Router,
- private route: ActivatedRoute
+ private route: ActivatedRoute,
+ private monitoringApiService: BuildingService,
) {}
hitRateOptions = {
bodyClass: ['bg-hexagons', 'pt-0'],
@@ -88,6 +96,14 @@ export class DetailComponent {
};
}
+ this.route.params.subscribe(params => {
+ const buildingId = params['id'];
+ if (buildingId) {
+ this.fetchData(buildingId);
+ this.devicePerBuilding(buildingId);
+ }
+ });
+
this.chartApiservice.getStatisticsData().subscribe(Response => {
this.salesData = Response;
this.getlineArea();
@@ -282,4 +298,17 @@ export class DetailComponent {
this.blockUISalesRecieptsDues.stop();
}, 2500);
}
+
+ //integrasi
+ fetchData(buildingId) {
+ this.monitoringApiService.getRoomByBuildingId(buildingId).subscribe((res) => {
+ this.room = res.resp.map(entry => entry.roomEntity).length;
+ });
+ }
+
+ devicePerBuilding(buildingId) {
+ this.monitoringApiService.listDevicePerBuilding(buildingId).subscribe((res) => {
+ this.device = res.resp.reduce((sum, item) => sum + item.total_device, 0);
+ });
+ }
}
diff --git a/src/app/content/hemat-app/monitoring/room/room.component.ts b/src/app/content/hemat-app/monitoring/room/room.component.ts
index 6d868f6..fd2b209 100644
--- a/src/app/content/hemat-app/monitoring/room/room.component.ts
+++ b/src/app/content/hemat-app/monitoring/room/room.component.ts
@@ -30,7 +30,6 @@ export class RoomComponent implements OnInit {
});
this.route.params.subscribe(params => {
const buildingId = params['id'];
- console.log(buildingId);
if (buildingId) {
this.fetchData(buildingId);
}
diff --git a/src/app/content/hemat-app/service/monitoring-api.service.ts b/src/app/content/hemat-app/service/monitoring-api.service.ts
index 8d5cab3..86f7b2c 100644
--- a/src/app/content/hemat-app/service/monitoring-api.service.ts
+++ b/src/app/content/hemat-app/service/monitoring-api.service.ts
@@ -26,6 +26,15 @@ export class BuildingService {
return this.http.get