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