diff --git a/src/app/_layout/footer/footer.component.html b/src/app/_layout/footer/footer.component.html index 8ce6dfc..4623f2c 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-20.2) + >Smart Building Management Systems (V@2024-08-21.2)

diff --git a/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.html b/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.html index c35999f..0d5e1e8 100644 --- a/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.html +++ b/src/app/content/hemat-app/device/add-edit-device/add-edit-device.component.html @@ -69,7 +69,7 @@
- -
- Voltage is required -
-
+ Voltage is required. +
@@ -270,12 +274,12 @@ class="btn btn-primary" style=" color: #ffffff !important; - background-color: #37A647 !important; + background-color: #37a647 !important; " (click)="saveEdit()" *ngIf="mode === 'edit'" > - Save + Save
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 fe12280..cbb650c 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 @@ -253,36 +253,50 @@ export class AddEditDeviceComponent implements OnInit { } saveEdit() { - if (this.projectInfo.get("roomBuildingId").value) { - this.monitoringApiService - .putDevice(this.projectInfo.value, this.deviceId) - .subscribe((data) => { - this.router.navigate(["/device"]); - }); - } else { - Swal.fire({ - title: "Apakah kamu yakin?", - text: "Data lokasi device tidak dapat diubah!", - icon: "warning", - showCancelButton: true, - confirmButtonColor: "#3085d6", - cancelButtonColor: "#d33", - confirmButtonText: "Yes, save it!", - }).then((result) => { - if (result.isConfirmed) { - this.monitoringApiService - .putDevice(this.projectInfo.value, this.deviceId) - .subscribe((data) => { - this.router.navigate(["/device"]); - }); - Swal.fire({ - title: "Saved!", - text: "Data berhasil disimpan.", - icon: "success", + if (this.projectInfo.valid) { + if (this.projectInfo.get("roomBuildingId").value) { + this.monitoringApiService + .putDevice(this.projectInfo.value, this.deviceId) + .subscribe((data) => { + this.router.navigate(["/device"]); }); - } - }); + } else { + Swal.fire({ + title: "Apakah kamu yakin?", + text: "Data lokasi device tidak dapat diubah!", + icon: "warning", + showCancelButton: true, + confirmButtonColor: "#3085d6", + cancelButtonColor: "#d33", + confirmButtonText: "Yes, save it!", + }).then((result) => { + if (result.isConfirmed) { + this.monitoringApiService + .putDevice(this.projectInfo.value, this.deviceId) + .subscribe((data) => { + this.router.navigate(["/device"]); + }); + Swal.fire({ + title: "Saved!", + text: "Data berhasil disimpan.", + icon: "success", + }); + } + }); + } + } else { + this.markFormGroupTouched(this.projectInfo) } + + } + + markFormGroupTouched(formGroup: FormGroup) { + (Object as any).values(formGroup.controls).forEach((control) => { + control.markAsTouched(); + if (control.controls) { + this.markFormGroupTouched(control); + } + }); } cancel() { diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html index 7cee3c3..6268a4f 100644 --- a/src/app/login/login.component.html +++ b/src/app/login/login.component.html @@ -138,7 +138,7 @@

- (v@2024.08.20.2) + (v@2024.08.21.2)