penambahan button cancel device control
This commit is contained in:
parent
8ea2f9f23b
commit
fc9947da15
|
@ -61,7 +61,8 @@
|
|||
(click)="doFilter()"
|
||||
style="
|
||||
background-color: #252525 !important;
|
||||
border-color: #bef264 !important;
|
||||
border-color: #ffffff !important;
|
||||
border-radius: 12px;
|
||||
"
|
||||
[disabled]="spinnerFilterActive"
|
||||
>
|
||||
|
@ -76,6 +77,19 @@
|
|||
*ngIf="spinnerFilterActive"
|
||||
></i>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-success ml-2"
|
||||
(click)="doCancelFilter()"
|
||||
style="
|
||||
background-color: #252525 !important;
|
||||
border-color: #ffffff !important;
|
||||
color: #ffffff;
|
||||
border-radius: 12px;
|
||||
"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,6 +2,7 @@ import { Component } from "@angular/core";
|
|||
import { Router } from "@angular/router";
|
||||
import { BuildingService } from "../../service/monitoring-api.service";
|
||||
import { DeviceService } from "../../service/device.service";
|
||||
import { ToastrService } from "ngx-toastr";
|
||||
|
||||
@Component({
|
||||
selector: "app-device-control",
|
||||
|
@ -42,7 +43,8 @@ export class DeviceControlComponent {
|
|||
constructor(
|
||||
private router: Router,
|
||||
private deviceService: DeviceService,
|
||||
private monitoringApiService: BuildingService
|
||||
private monitoringApiService: BuildingService,
|
||||
private toastr: ToastrService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -103,6 +105,12 @@ export class DeviceControlComponent {
|
|||
}
|
||||
|
||||
doFilter() {
|
||||
if (!this.buildingSelected) {
|
||||
this.toastr.error("Warning", "Filter Building tidak boleh kosong.", {
|
||||
timeOut: 5000,
|
||||
closeButton: true,
|
||||
});
|
||||
} else {
|
||||
this.spinnerFilterActive = true;
|
||||
this.fetchData(
|
||||
this.buildingSelected,
|
||||
|
@ -113,6 +121,15 @@ export class DeviceControlComponent {
|
|||
this.spinnerFilterActive = false;
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
doCancelFilter() {
|
||||
this.storedData = JSON.parse(localStorage.getItem("currentUser"));
|
||||
this.buildingSelected = this.storedData.buildingId;
|
||||
this.categorySelected = undefined;
|
||||
this.statusSelected = undefined;
|
||||
this.fetchData(this.buildingSelected, 0, 0);
|
||||
}
|
||||
|
||||
filterRows() {
|
||||
if (!this.searchTerm) {
|
||||
|
|
Loading…
Reference in New Issue