diff --git a/src/app/_layout/footer/footer.component.html b/src/app/_layout/footer/footer.component.html
index 599393c..6a5fa9d 100644
--- a/src/app/_layout/footer/footer.component.html
+++ b/src/app/_layout/footer/footer.component.html
@@ -13,7 +13,7 @@
href="https://allbestsistem.com/"
target="_blank"
style="background-color: #ffffff !important;"
- >Smart Building Management Systems (V@2024-08-26.3)
+ >Smart Building Management Systems (V@2024-08-27.2)
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
index 15de807..ee3e4af 100644
--- 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
@@ -83,7 +83,7 @@
-
+
-
+
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
index f0493b1..3a50203 100644
--- 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
@@ -8,7 +8,6 @@ import {
import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
import { DeviceService } from "../../service/device.service";
-
@Component({
selector: "app-control-scheduler",
templateUrl: "./control-scheduler.component.html",
@@ -62,9 +61,9 @@ export class ControlSchedulerComponent {
ngOnInit() {
this.createForm();
- if (this.mode === 'add') {
+ if (this.mode === "add") {
this.labelModal = "Add Scheduler";
- } else if (this.mode === 'edit') {
+ } else if (this.mode === "edit") {
this.editForm();
this.labelModal = "Edit Scheduler";
}
@@ -88,7 +87,7 @@ export class ControlSchedulerComponent {
this.myForm = this.fb.group(controls);
}
- editForm(){
+ editForm() {
this.selectedDays = this.data.days || [];
this.myForm.patchValue({
name: this.data.name,
@@ -97,7 +96,7 @@ export class ControlSchedulerComponent {
active: this.data.active,
switch: this.data.switch,
});
-
+
// Patch the form with the selected days
this.selectedDays.forEach((day) => {
this.myForm.patchValue({
@@ -123,20 +122,35 @@ export class ControlSchedulerComponent {
.map((day) => day.value);
// Construct the final output
- const result = {
- name: formValues.name,
- device_id: formValues.device_id,
- timeset: formValues.timeset,
- recurring: formValues.recurring,
- active: formValues.active,
- switch: formValues.switch,
- days: selectedDays,
- };
+ let result = {};
+
+ if (this.mode === "add") {
+ result = {
+ name: formValues.name,
+ device_id: formValues.device_id,
+ timeset: formValues.timeset,
+ recurring: formValues.recurring,
+ active: formValues.active,
+ switch: formValues.switch,
+ days: selectedDays,
+ };
+ } else {
+ result = {
+ id: this.data.id,
+ name: formValues.name,
+ device_id: formValues.device_id,
+ timeset: formValues.timeset,
+ recurring: formValues.recurring,
+ active: formValues.active,
+ switch: formValues.switch,
+ days: selectedDays,
+ };
+ }
if (this.myForm.valid) {
this.activeModal.close(result);
} else {
- this.markFormGroupTouched(this.myForm)
+ this.markFormGroupTouched(this.myForm);
}
// console.log("Form Result: ", result);
diff --git a/src/app/content/hemat-app/device/device-control/device-control.component.ts b/src/app/content/hemat-app/device/device-control/device-control.component.ts
index 4d3068c..a3a9117 100644
--- a/src/app/content/hemat-app/device/device-control/device-control.component.ts
+++ b/src/app/content/hemat-app/device/device-control/device-control.component.ts
@@ -175,7 +175,9 @@ export class DeviceControlComponent {
}
schedulerItem(row) {
- this.router.navigate(["/device/scheduler", row.id, row.name]);
+ console.log(row);
+
+ this.router.navigate(["/device/scheduler", row.id]);
}
// schedulerItem(item) {
diff --git a/src/app/content/hemat-app/device/device.module.ts b/src/app/content/hemat-app/device/device.module.ts
index e255770..901aed6 100644
--- a/src/app/content/hemat-app/device/device.module.ts
+++ b/src/app/content/hemat-app/device/device.module.ts
@@ -69,7 +69,7 @@ import { SchedulerListComponent } from './scheduler-list/scheduler-list.componen
data: { mode: 'view' }
},
{
- path: 'scheduler/:id/:name',
+ path: 'scheduler/:id',
component: SchedulerListComponent,
data: { mode: 'scheduler' }
}
diff --git a/src/app/content/hemat-app/device/scheduler-list/scheduler-list.component.css b/src/app/content/hemat-app/device/scheduler-list/scheduler-list.component.css
index 918279b..0ca1ac6 100644
--- a/src/app/content/hemat-app/device/scheduler-list/scheduler-list.component.css
+++ b/src/app/content/hemat-app/device/scheduler-list/scheduler-list.component.css
@@ -52,4 +52,3 @@
background-color: #d1d9ff;
color: #303f9f;
}
-
\ No newline at end of file
diff --git a/src/app/content/hemat-app/device/scheduler-list/scheduler-list.component.html b/src/app/content/hemat-app/device/scheduler-list/scheduler-list.component.html
index 289a87a..6863f27 100644
--- a/src/app/content/hemat-app/device/scheduler-list/scheduler-list.component.html
+++ b/src/app/content/hemat-app/device/scheduler-list/scheduler-list.component.html
@@ -15,7 +15,7 @@
>
-
-
- Building is required
-
-
+
+ Floor is required.
+
diff --git a/src/app/content/hemat-app/service/device.service.ts b/src/app/content/hemat-app/service/device.service.ts
index 6f94925..4601b60 100644
--- a/src/app/content/hemat-app/service/device.service.ts
+++ b/src/app/content/hemat-app/service/device.service.ts
@@ -99,6 +99,16 @@ export class DeviceService {
return this.http.get(url, { headers });
}
+ getDeviceByid(id): Observable {
+ const endpoint = `/devices`;
+ const url = `${BASE_URL}${endpoint}/${id}`;
+ const headers = new HttpHeaders({
+ 'Content-Type': 'application/json',
+ 'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
+ });
+ return this.http.get(url, { headers });
+ }
+
filterDashboard(building, floor): Observable {
const endpoint = `/building/dashboard/list`;
const params = new URLSearchParams({
@@ -146,6 +156,16 @@ export class DeviceService {
return this.http.put(url, data, { headers });
}
+ putDeviceSchedulerActive(data, id): Observable {
+ const endpoint = `/device-scheduler/${id}/Active`;
+ const url = `${BASE_URL}${endpoint}`;
+ const headers = new HttpHeaders({
+ "Content-Type": "application/json",
+ "x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
+ });
+ return this.http.put(url, data, { headers });
+ }
+
deleteDeviceScheduler(id): Observable {
const endpoint = `/device-scheduler/${id}`;
const url = `${BASE_URL}${endpoint}`;
diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html
index bc791ab..d812386 100644
--- a/src/app/login/login.component.html
+++ b/src/app/login/login.component.html
@@ -138,7 +138,7 @@
- (v@2024.08.26.3)
+ (v@2024.08.27.2)