diff --git a/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.ts b/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.ts index f496cf1..bfa2996 100644 --- a/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.ts +++ b/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.ts @@ -268,7 +268,7 @@ export class AddEditDeviceComponent implements OnInit { text: "Data lokasi device tidak dapat diubah!", icon: "warning", showCancelButton: true, - confirmButtonColor: "#3085d6", + confirmButtonColor: "#37a647", cancelButtonColor: "#d33", confirmButtonText: "Yes, save it!", }).then((result) => { diff --git a/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.css b/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.css new file mode 100644 index 0000000..756acc8 --- /dev/null +++ b/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.css @@ -0,0 +1,3 @@ +::ng-deep .modal-backdrop.show { + z-index: auto !important; + } \ No newline at end of file diff --git a/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.html b/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.html new file mode 100644 index 0000000..cc61db2 --- /dev/null +++ b/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.html @@ -0,0 +1,89 @@ + + + diff --git a/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.spec.ts b/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.spec.ts new file mode 100644 index 0000000..d15df14 --- /dev/null +++ b/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ControlSchedulerComponent } from './control-scheduler.component'; + +describe('ControlSchedulerComponent', () => { + let component: ControlSchedulerComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ControlSchedulerComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ControlSchedulerComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.ts b/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.ts new file mode 100644 index 0000000..495bcba --- /dev/null +++ b/src/app/content/hemat-app/device/control-scheduler/control-scheduler.component.ts @@ -0,0 +1,50 @@ +import { Component } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; +import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap"; +import { BuildingService } from "../../service/monitoring-api.service"; + +@Component({ + selector: "app-control-scheduler", + templateUrl: "./control-scheduler.component.html", + styleUrls: ["./control-scheduler.component.css"], +}) +export class ControlSchedulerComponent { + labelModal: string = ""; + myForm: FormGroup; + dataMasterStatus: any; + + constructor( + public activeModal: NgbActiveModal, + private monitoringApiService: BuildingService, + private fb: FormBuilder, + ) {} + + ngOnInit() { + + this.dataListMaster(); + this.createForm() + } + + addRow() {} + + createForm() { + this.myForm = this.fb.group({ + timeOn: ["", Validators.required], + status: ["", Validators.required], + timeOff: ["", Validators.required], + }); + } + + dataListMaster() { + this.monitoringApiService.getMasterListData().subscribe((data) => { + const dataCategory = data.data.find( + (item) => item.name === "master_status" + ).headerDetailParam; + this.dataMasterStatus = dataCategory.filter( + (item) => item.statusName.toLowerCase() === "aktif" + ); + console.log(this.dataMasterStatus); + + }); + } +} diff --git a/src/app/content/hemat-app/device/device-control/device-control.component.css b/src/app/content/hemat-app/device/device-control/device-control.component.css index 9e9ceae..709501b 100644 --- a/src/app/content/hemat-app/device/device-control/device-control.component.css +++ b/src/app/content/hemat-app/device/device-control/device-control.component.css @@ -26,4 +26,29 @@ color: #242222 !important; font-family: "Open Sans", sans-serif !important; font-size: 12px; -} \ No newline at end of file +} + +.menu-popup { + position: absolute; + right: 0; + top: 30px; + background-color: white; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + border-radius: 5px; + z-index: 1000; +} + +.menu-popup ul { + list-style-type: none; + margin: 0; + padding: 0; +} + +.menu-popup ul li { + padding: 10px 20px; + cursor: pointer; +} + +.menu-popup ul li:hover { + background-color: #f0f0f0; +} diff --git a/src/app/content/hemat-app/device/device-control/device-control.component.html b/src/app/content/hemat-app/device/device-control/device-control.component.html index 9ee3fac..82686a4 100644 --- a/src/app/content/hemat-app/device/device-control/device-control.component.html +++ b/src/app/content/hemat-app/device/device-control/device-control.component.html @@ -7,7 +7,13 @@
-
+
@@ -61,7 +67,7 @@ class="btn ml-2" (click)="doFilter()" style=" - background-color: #37A647 !important; + background-color: #37a647 !important; border-color: #ffffff !important; border-radius: 12px; color: #ffffff; @@ -84,9 +90,9 @@ class="btn btn-outline-success ml-2" (click)="doCancelFilter()" style=" - background-color: #FBFBFB !important; - border-color: #6B6B6B !important; - color: #6B6B6B; + background-color: #fbfbfb !important; + border-color: #6b6b6b !important; + color: #6b6b6b; border-radius: 12px; " > @@ -155,6 +161,27 @@ }}
+ +
+ + +
+
{ + if (item.id === itemId) { + item.menuOpen = !item.menuOpen; + } else { + item.menuOpen = false; // Close other menus + } + }); + } - addDevice(): void {} + schedulerItem(item) { + console.log(item); + const modalRef = this.modalService.open(ControlSchedulerComponent, { + size: "md", + backdrop: "static", + keyboard: false, + centered: true + }); + + modalRef.componentInstance.mode = "edit"; + modalRef.result.then( + (result) => { + if (result) { + console.log(result); + } + }, + (reason) => { + console.log(`Dismissed: ${reason}`); + } + ); + // Handle edit action + } } diff --git a/src/app/content/hemat-app/device/device.module.ts b/src/app/content/hemat-app/device/device.module.ts index ef2beb0..802208f 100644 --- a/src/app/content/hemat-app/device/device.module.ts +++ b/src/app/content/hemat-app/device/device.module.ts @@ -16,6 +16,7 @@ import { AddEditDeviceComponent } from './add-edit-device/add-edit-device.compon import { ModalAddEditComponent } from './modal-add-edit/modal-add-edit.component'; import { DeviceControlComponent } from './device-control/device-control.component'; import { UiSwitchModule } from 'ngx-ui-switch'; +import { ControlSchedulerComponent } from './control-scheduler/control-scheduler.component'; @@ -24,7 +25,8 @@ import { UiSwitchModule } from 'ngx-ui-switch'; DeviceComponent, AddEditDeviceComponent, ModalAddEditComponent, - DeviceControlComponent + DeviceControlComponent, + ControlSchedulerComponent ], imports: [ CommonModule, diff --git a/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.ts b/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.ts index d225ff5..2c41109 100644 --- a/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.ts +++ b/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.ts @@ -344,7 +344,7 @@ export class AddEditListComponent { text: "You have unsaved changes. Do you really want to leave?", icon: 'warning', showCancelButton: true, - confirmButtonColor: '#3085d6', + confirmButtonColor: '#37a647', cancelButtonColor: '#d33', confirmButtonText: 'Yes, leave', cancelButtonText: 'No, stay'