klik detail per floor dan room
This commit is contained in:
parent
b5cf71d008
commit
21b75ca610
|
@ -115,15 +115,16 @@ export class BuildingComponent {
|
|||
}
|
||||
|
||||
viewDetail(row) {
|
||||
console.log(row.floor_id);
|
||||
console.log(row.building_id);
|
||||
if (row.building_id !== undefined && row.floor_id === undefined) {
|
||||
this.router.navigate(["/monitoring/view-detail-floor", row.id]);
|
||||
this.router.navigate(["/monitoring/view-detail-floor", row.building_id, row.id]);
|
||||
} else if (row.building_id !== undefined && row.floor_id !== undefined) {
|
||||
this.router.navigate(["/monitoring/view-detail-room", row.id]);
|
||||
this.router.navigate(["/monitoring/view-detail-room", row.building_id, row.floor_id, row.id]);
|
||||
} else {
|
||||
this.router.navigate(["/monitoring/view-detail-building", row.id]);
|
||||
}
|
||||
console.log(row.floor_id);
|
||||
console.log(row.building_id);
|
||||
|
||||
|
||||
// this.router.navigate(["/monitoring/view-detail", row.id]);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ export class DetailComponent {
|
|||
room: any;
|
||||
topCard: any;
|
||||
summaryCost: any;
|
||||
airQuality: any;
|
||||
temperature: any;
|
||||
deviceCategory: any;
|
||||
chartKwhWater: any;
|
||||
|
@ -85,19 +84,41 @@ export class DetailComponent {
|
|||
});
|
||||
this.breadcrumbLink();
|
||||
this.route.params.subscribe((params) => {
|
||||
const buildingId = params["id"];
|
||||
console.log(buildingId);
|
||||
|
||||
this.paramsId = params["id"];
|
||||
if (buildingId) {
|
||||
this.dataEnergyMonitoringTopCard(buildingId);
|
||||
this.dataEnergyMonitoringSummary(buildingId);
|
||||
this.dataEnergyMonitoringSAir(buildingId);
|
||||
this.dataEnergyDeviceCategory(buildingId);
|
||||
this.dataEnergyChartKwhWater(buildingId);
|
||||
this.dataDeviceIr();
|
||||
this.getAirQualityData();
|
||||
|
||||
const buildingId = params["buildingId"];
|
||||
const floorId = params["floorId"];
|
||||
const roomId = params["roomId"];
|
||||
console.log(buildingId, 'buildingId');
|
||||
console.log(floorId, 'floorId');
|
||||
console.log(roomId, 'roomId');
|
||||
|
||||
if (buildingId !== undefined && floorId === undefined && roomId === undefined) {
|
||||
this.dataEnergyMonitoringTopCard(buildingId, 0, 0);
|
||||
this.dataEnergyMonitoringSummary(buildingId, 0, 0);
|
||||
this.dataEnergyDeviceCategory(buildingId, 0, 0);
|
||||
this.dataEnergyChartKwhWater(buildingId, 0, 0);
|
||||
} else if (buildingId !== undefined && floorId !== undefined && roomId === undefined) {
|
||||
this.dataEnergyMonitoringTopCard(buildingId, floorId, 0);
|
||||
this.dataEnergyMonitoringSummary(buildingId, floorId, 0);
|
||||
this.dataEnergyDeviceCategory(buildingId, floorId, 0);
|
||||
this.dataEnergyChartKwhWater(buildingId, floorId, 0);
|
||||
} else if (buildingId !== undefined && floorId !== undefined && roomId !== undefined) {
|
||||
this.dataEnergyMonitoringTopCard(buildingId, floorId, roomId);
|
||||
this.dataEnergyMonitoringSummary(buildingId, floorId, roomId);
|
||||
this.dataEnergyDeviceCategory(buildingId, floorId, roomId);
|
||||
this.dataEnergyChartKwhWater(buildingId, floorId, roomId);
|
||||
}
|
||||
|
||||
this.paramsId = params["buildingId"];
|
||||
this.dataDeviceIr();
|
||||
this.getAirQualityData();
|
||||
// if (buildingId) {
|
||||
// this.dataEnergyMonitoringTopCard(buildingId);
|
||||
// this.dataEnergyMonitoringSummary(buildingId);
|
||||
// this.dataEnergyMonitoringSAir(buildingId);
|
||||
// this.dataEnergyDeviceCategory(buildingId);
|
||||
// this.dataEnergyChartKwhWater(buildingId);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -219,14 +240,6 @@ export class DetailComponent {
|
|||
],
|
||||
};
|
||||
}
|
||||
//integrasi
|
||||
dataEnergyMonitoringTopCard(buildingId) {
|
||||
this.energyMonitoringService
|
||||
.getDashboardTopCard(buildingId)
|
||||
.subscribe((res) => {
|
||||
this.topCard = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
dataDeviceIr() {
|
||||
const today = new Date().getDay();
|
||||
|
@ -234,40 +247,39 @@ export class DetailComponent {
|
|||
const now = new Date();
|
||||
this.currentDate = now.toLocaleDateString();
|
||||
this.currentTime = now.toLocaleTimeString();
|
||||
this.deviceService.getDeviceStatus(452).subscribe((res) => {
|
||||
console.log(res);
|
||||
this.energyMonitoringService.getDeviceStatus(452).subscribe((res) => {
|
||||
this.roomTemperature = res.result[0].value;
|
||||
this.roomHumidity = res.result[1].value;
|
||||
});
|
||||
}
|
||||
|
||||
dataEnergyMonitoringSummary(buildingId) {
|
||||
//integrasi
|
||||
dataEnergyMonitoringTopCard(buildingId, floorId, roomId) {
|
||||
this.energyMonitoringService
|
||||
.getDashboardSummary(buildingId)
|
||||
.getDashboardTopCard(buildingId, floorId, roomId)
|
||||
.subscribe((res) => {
|
||||
this.topCard = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
dataEnergyMonitoringSummary(buildingId, floorId, roomId) {
|
||||
this.energyMonitoringService
|
||||
.getDashboardSummary(buildingId, floorId, roomId)
|
||||
.subscribe((res) => {
|
||||
this.summaryCost = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
dataEnergyMonitoringSAir(buildingId) {
|
||||
dataEnergyDeviceCategory(buildingId, floorId, roomId) {
|
||||
this.energyMonitoringService
|
||||
.getDashboardAirQuality(buildingId)
|
||||
.subscribe((res) => {
|
||||
this.airQuality = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
dataEnergyDeviceCategory(buildingId) {
|
||||
this.energyMonitoringService
|
||||
.getDashboardDeviceCategory(buildingId)
|
||||
.getDashboardDeviceCategory(buildingId, floorId, roomId)
|
||||
.subscribe((res) => {
|
||||
this.deviceCategory = res.data[0];
|
||||
});
|
||||
}
|
||||
|
||||
dataEnergyChartKwhWater(buildingId) {
|
||||
dataEnergyChartKwhWater(buildingId, floorId, roomId) {
|
||||
this.energyMonitoringService
|
||||
.getDashboardChartKwhWater(buildingId)
|
||||
.getDashboardChartKwhWater(buildingId, floorId, roomId)
|
||||
.subscribe((res) => {
|
||||
this.chartKwhWater = res.data;
|
||||
console.log(this.chartKwhWater);
|
||||
|
|
|
@ -90,17 +90,17 @@ import { ClipboardModule } from 'ngx-clipboard';
|
|||
data: { mode: 'room' }
|
||||
},
|
||||
{
|
||||
path: 'view-detail-building/:id',
|
||||
path: 'view-detail-building/:buildingId',
|
||||
component: DetailComponent,
|
||||
data: { mode: 'building' }
|
||||
},
|
||||
{
|
||||
path: 'view-detail-floor/:id',
|
||||
path: 'view-detail-floor/:buildingId/:floorId',
|
||||
component: DetailComponent,
|
||||
data: { mode: 'floor' }
|
||||
},
|
||||
{
|
||||
path: 'view-detail-room/:id',
|
||||
path: 'view-detail-room/:buildingId/:floorId/:roomId',
|
||||
component: DetailComponent,
|
||||
data: { mode: 'room' }
|
||||
},
|
||||
|
|
|
@ -17,8 +17,8 @@ export class EnergyMonitoringService {
|
|||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getDashboardTopCard(id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/top-card?building_id=${id}`;
|
||||
getDashboardTopCard(building_id, floor_id, room_id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/top-card?building_id=${building_id}&floor_id=${floor_id}&room_id=${room_id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
|
@ -26,8 +26,8 @@ export class EnergyMonitoringService {
|
|||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getDashboardSummary(id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/summary-cost?building_id=${id}`;
|
||||
getDashboardSummary(building_id, floor_id, room_id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/summary-cost?building_id=${building_id}&floor_id=${floor_id}&room_id=${room_id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
|
@ -35,8 +35,25 @@ export class EnergyMonitoringService {
|
|||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getDashboardAirQuality(id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/air-quality?building_id=${id}`;
|
||||
// getDashboardTemperature(id): Observable<any> {
|
||||
// const url = `https://kapi.absys.ninja/hemat/dashboard/temperature-humidity?building_id=${id}`;
|
||||
// const headers = new HttpHeaders({
|
||||
// 'Content-Type': 'application/json',
|
||||
// 'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
// });
|
||||
// return this.http.get<any>(url, { headers });
|
||||
// }
|
||||
|
||||
getDashboardDeviceCategory(building_id, floor_id, room_id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/device-category-use?building_id=${building_id}&floor_id=${floor_id}&room_id=${room_id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
getDashboardChartKwhWater(building_id, floor_id, room_id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/chartKwhWater?building_id=${building_id}&floor_id=${floor_id}&room_id=${room_id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
|
@ -44,24 +61,9 @@ export class EnergyMonitoringService {
|
|||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getDashboardTemperature(id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/temperature-humidity?building_id=${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
getDashboardDeviceCategory(id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/device-category-use?building_id=${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
getDashboardChartKwhWater(id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/chartKwhWater?building_id=${id}`;
|
||||
getDeviceStatus(id): Observable<any> {
|
||||
const endpoint = `devices`;
|
||||
const url = `https://kapi.absys.ninja/hemat/${endpoint}/status?id=${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
|
|
Loading…
Reference in New Issue