diff --git a/src/app/content/dashboard/sales/sales.component.css b/src/app/content/dashboard/sales/sales.component.css index f3a877a..66fce9d 100644 --- a/src/app/content/dashboard/sales/sales.component.css +++ b/src/app/content/dashboard/sales/sales.component.css @@ -52,7 +52,7 @@ } :host ::ng-deep .donut-chart2 .ct-series-b .ct-slice-donut { - stroke: #ff4961; + stroke: #7949ff; stroke-width: 5.5px !important; } :host ::ng-deep .donut-chart2 { diff --git a/src/app/content/hemat-app/monitoring/building/building.component.css b/src/app/content/hemat-app/monitoring/building/building.component.css index 41da42e..8af24e3 100644 --- a/src/app/content/hemat-app/monitoring/building/building.component.css +++ b/src/app/content/hemat-app/monitoring/building/building.component.css @@ -6,3 +6,32 @@ background: rgba(255, 249, 249, 0.5) !important; } +:host ::ng-deep .donut-chart1 .ct-series-a .ct-slice-donut { + stroke: #49ff52; + stroke-width: 20px !important; +} + +:host ::ng-deep .donut-chart1 .ct-series-b .ct-slice-donut { + stroke: #757575; + stroke-width: 20px !important; +} + +:host ::ng-deep .donut-chart2 .ct-series-a .ct-slice-donut { + stroke: #fff049; + stroke-width: 20px !important; +} + +:host ::ng-deep .donut-chart2 .ct-series-b .ct-slice-donut { + stroke: #757575; + stroke-width: 20px !important; +} + +:host ::ng-deep .donut-chart3 .ct-series-a .ct-slice-donut { + stroke: #ff4c49; + stroke-width: 20px !important; +} + +:host ::ng-deep .donut-chart3 .ct-series-b .ct-slice-donut { + stroke: #757575; + stroke-width: 20px !important; +} \ No newline at end of file diff --git a/src/app/content/hemat-app/monitoring/building/building.component.html b/src/app/content/hemat-app/monitoring/building/building.component.html index dec2d6c..2207b46 100644 --- a/src/app/content/hemat-app/monitoring/building/building.component.html +++ b/src/app/content/hemat-app/monitoring/building/building.component.html @@ -7,7 +7,13 @@
- +
-
+
@@ -41,14 +50,16 @@
- - +
+ + +
{ + this.data = Response + this.filteredRows = Response + for (let i = 0; i < this.filteredRows.length; i++) { + if (this.filteredRows[i].donut.series[0] <= 50) { + this.colorChart = "donut-chart1" + } else if (this.filteredRows[i].donut.series[0] > 50 && this.filteredRows[i].donut.series[0] < 75) { + this.colorChart = "donut-chart2" + } else { + this.colorChart = "donut-chart3" + } + } + }); + } + + filterRows() { + if (!this.searchTerm) { + this.filteredRows = [...this.data]; + } else { + this.filteredRows = this.data.filter((row) => + this.rowContainsSearchTerm(row) + ); + } + } + + rowContainsSearchTerm(row: any): boolean { + const searchTermLC = this.searchTerm.toLowerCase(); + return Object.values(row).some( + (value) => + value !== null && value.toString().toLowerCase().includes(searchTermLC) + ); } } diff --git a/src/app/content/hemat-app/monitoring/monitoring.service.ts b/src/app/content/hemat-app/monitoring/monitoring.service.ts new file mode 100644 index 0000000..f3d4122 --- /dev/null +++ b/src/app/content/hemat-app/monitoring/monitoring.service.ts @@ -0,0 +1,51 @@ +import { Injectable } from '@angular/core'; +import { Observable, of, throwError } from 'rxjs'; +import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; +import { catchError, tap, map } from 'rxjs/operators'; + +const httpOptions = { + headers: new HttpHeaders({ 'Content-Type': 'application/json' }) +}; +@Injectable({ + providedIn: 'root' +}) +export class TableMonitoringService { + + apiBaseURL = 'assets/data'; + loadMonitoringRoomDataURL = null; + loadMonitoringBuildingDataURL = null; + constructor(private http: HttpClient) { + this.loadMonitoringRoomDataURL = `${this.apiBaseURL}/hemat/monitoring.json`; + this.loadMonitoringBuildingDataURL = `${this.apiBaseURL}/hemat/building.json`; + } + private handleError(error: HttpErrorResponse) { + if (error.error instanceof ErrorEvent) { + // Error + console.error('error:', error.error.message); + } else { + // Error + console.error( + `Api server returned ${error.status}, ` + + `error body: ${error.error}`); + } + // throwError is observable + return throwError('Error has happened'); + } + + private extractData(res: Response) { + const body = res; + return body || {}; + } + + + getMonitoringRoomData(): Observable { + return this.http.get(this.loadMonitoringRoomDataURL, httpOptions); + } + + getMonitoringBuildingData(): Observable { + return this.http.get(this.loadMonitoringBuildingDataURL, httpOptions); + } + + +} + diff --git a/src/app/content/hemat-app/monitoring/room/room.component.html b/src/app/content/hemat-app/monitoring/room/room.component.html index 8c8127f..78448fb 100644 --- a/src/app/content/hemat-app/monitoring/room/room.component.html +++ b/src/app/content/hemat-app/monitoring/room/room.component.html @@ -7,7 +7,8 @@
- +