penambahan button new device
This commit is contained in:
@@ -43,10 +43,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<div
|
||||
class="card"
|
||||
style="background-color: #252525 !important"
|
||||
>
|
||||
<div class="card" style="background-color: #252525 !important">
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="media d-flex">
|
||||
@@ -80,10 +77,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<div
|
||||
class="card"
|
||||
style="background-color: #252525 !important"
|
||||
>
|
||||
<div class="card" style="background-color: #252525 !important">
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="media d-flex">
|
||||
@@ -132,6 +126,7 @@
|
||||
class="select-custom"
|
||||
[items]="dataBuildingList"
|
||||
[searchable]="true"
|
||||
[disabled]="newDeviceActive"
|
||||
bindLabel="name"
|
||||
bindValue="id"
|
||||
placeholder="Select Building"
|
||||
@@ -146,6 +141,7 @@
|
||||
class="select-custom"
|
||||
[items]="dataMasterCategori"
|
||||
[searchable]="true"
|
||||
[disabled]="newDeviceActive"
|
||||
bindLabel="name"
|
||||
bindValue="id"
|
||||
placeholder="Select Category"
|
||||
@@ -160,6 +156,7 @@
|
||||
class="select-custom"
|
||||
[items]="dataMasterStatus"
|
||||
[searchable]="true"
|
||||
[disabled]="newDeviceActive"
|
||||
bindLabel="name"
|
||||
bindValue="id"
|
||||
placeholder="Select Status"
|
||||
@@ -179,7 +176,7 @@
|
||||
border-color: #ffffff !important;
|
||||
border-radius: 12px;
|
||||
"
|
||||
[disabled]="spinnerFilterActive"
|
||||
[disabled]="spinnerFilterActive || newDeviceActive"
|
||||
>
|
||||
<i
|
||||
class="la la-search"
|
||||
@@ -253,6 +250,52 @@
|
||||
<span style="font-weight: 600">Export</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-6 col-md-3 mb-2">
|
||||
<button
|
||||
class="btn btn-secondary btn-block"
|
||||
*ngIf="!newDeviceActive"
|
||||
[disabled]="spinnerNewDeviceActive"
|
||||
(click)="newDevice()"
|
||||
style="
|
||||
background-color: #bef264 !important;
|
||||
border-color: #bef264 !important;
|
||||
color: #000000 !important;
|
||||
"
|
||||
>
|
||||
<i
|
||||
class="la la-spinner spinner"
|
||||
*ngIf="spinnerNewDeviceActive"
|
||||
></i>
|
||||
<i
|
||||
class="ri-sticky-note-add-fill"
|
||||
*ngIf="!spinnerNewDeviceActive"
|
||||
></i>
|
||||
|
||||
<span style="font-weight: 600">New Device</span>
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-secondary btn-block"
|
||||
*ngIf="newDeviceActive"
|
||||
[disabled]="spinnerNewDeviceActive"
|
||||
(click)="allDevice()"
|
||||
style="
|
||||
background-color: #bef264 !important;
|
||||
border-color: #bef264 !important;
|
||||
color: #000000 !important;
|
||||
"
|
||||
>
|
||||
<i
|
||||
class="la la-spinner spinner"
|
||||
*ngIf="spinnerNewDeviceActive"
|
||||
></i>
|
||||
<i
|
||||
class="ri-arrow-left-circle-line"
|
||||
*ngIf="!spinnerNewDeviceActive"
|
||||
></i>
|
||||
|
||||
<span style="font-weight: 600">All Device</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-dashboard">
|
||||
|
||||
@@ -35,7 +35,9 @@ export class DeviceComponent implements OnInit {
|
||||
public breadcrumb: any;
|
||||
spinnerActive: boolean = false;
|
||||
spinnerExportActive: boolean = false;
|
||||
|
||||
spinnerNewDeviceActive: boolean = false;
|
||||
newDeviceActive: boolean = false;
|
||||
|
||||
singlebasicSelected: any;
|
||||
|
||||
constructor(
|
||||
@@ -64,6 +66,10 @@ export class DeviceComponent implements OnInit {
|
||||
};
|
||||
this.storedData = JSON.parse(localStorage.getItem("currentUser"));
|
||||
this.buildingSelected = this.storedData.buildingId;
|
||||
|
||||
if (this.newDeviceActive === true) {
|
||||
|
||||
}
|
||||
this.fetchData(
|
||||
this.buildingSelected,
|
||||
this.categorySelected,
|
||||
@@ -74,6 +80,8 @@ export class DeviceComponent implements OnInit {
|
||||
}
|
||||
|
||||
fetchData(buildingSelected, categorySelected, statusSelected) {
|
||||
this.newDeviceActive = false;
|
||||
this.buildingSelected = buildingSelected;
|
||||
this.deviceService
|
||||
.getDeviceData(buildingSelected, categorySelected, statusSelected)
|
||||
.subscribe((res) => {
|
||||
@@ -99,6 +107,35 @@ export class DeviceComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
newDevice() {
|
||||
this.spinnerNewDeviceActive = true;
|
||||
this.newDeviceActive = true;
|
||||
this.deviceService.getDeviceData(0, 0, 0).subscribe((res) => {
|
||||
this.data = res;
|
||||
this.filteredRows = this.data.results.data;
|
||||
this.spinnerNewDeviceActive = false;
|
||||
this.data_device = this.filteredRows.map((item) => ({
|
||||
buildingName: item.building_name,
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icon: item.icon,
|
||||
watt: item.watt,
|
||||
categoryName: item.category_name,
|
||||
typeName: item.type_name,
|
||||
voltageName: item.voltage_name,
|
||||
statusName: item.status_name,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
allDevice(){
|
||||
this.fetchData(
|
||||
this.buildingSelected,
|
||||
this.categorySelected,
|
||||
this.statusSelected
|
||||
);
|
||||
}
|
||||
|
||||
dataListMaster() {
|
||||
this.monitoringApiService.getMasterListData().subscribe((data) => {
|
||||
const dataCategory = data.data.find(
|
||||
|
||||
Reference in New Issue
Block a user