From a1b259ac9f405dbce31263c77fad3dc49867cdb0 Mon Sep 17 00:00:00 2001
From: Fuzi_fauzia
Date: Wed, 3 Jul 2024 13:01:36 +0700
Subject: [PATCH] perbaikan master
---
src/app/_layout/footer/footer.component.html | 2 +-
.../master-building.component.ts | 3 +-
.../master-category.component.ts | 5 ++-
.../master-duration-use.component.ts | 3 +-
.../master-floor/master-floor.component.ts | 3 +-
.../master-role/master-role.component.ts | 3 +-
.../add-edit-master-room.component.ts | 6 ++--
.../master-room/master-room.component.ts | 36 +++++++++++--------
.../master-status/master-status.component.ts | 3 +-
.../master-type/master-type.component.ts | 3 +-
.../master-voltage.component.ts | 3 +-
src/app/login/login.component.html | 2 +-
12 files changed, 42 insertions(+), 30 deletions(-)
diff --git a/src/app/_layout/footer/footer.component.html b/src/app/_layout/footer/footer.component.html
index d3a7438..1375712 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: #000000 !important;"
- >Smart Building Management Systems (V@2024-07-2.02)
+ >Smart Building Management Systems (V@2024-07-3.01)
diff --git a/src/app/content/hemat-app/master/master-building/master-building.component.ts b/src/app/content/hemat-app/master/master-building/master-building.component.ts
index 805dddf..25de63a 100644
--- a/src/app/content/hemat-app/master/master-building/master-building.component.ts
+++ b/src/app/content/hemat-app/master/master-building/master-building.component.ts
@@ -45,7 +45,8 @@ export class MasterBuildingComponent {
fetchData() {
this.monitoringApiService.getMasterBuildingData().subscribe((res) => {
this.data = res.results.data;
- this.filteredRows = this.data;
+ // this.filteredRows = this.data;
+ this.filteredRows = this.data.sort((a, b) => b.id - a.id);
});
}
diff --git a/src/app/content/hemat-app/master/master-category/master-category.component.ts b/src/app/content/hemat-app/master/master-category/master-category.component.ts
index 0079df0..6357ea0 100644
--- a/src/app/content/hemat-app/master/master-category/master-category.component.ts
+++ b/src/app/content/hemat-app/master/master-category/master-category.component.ts
@@ -53,9 +53,8 @@ export class MasterCategoryComponent implements OnInit {
this.dataMasterCategori = res.results.data.find(
(item) => item.name === "master_category"
);
- this.filteredRows = this.dataMasterCategori.headerDetailParam;
- console.log(this.filteredRows);
-
+ // this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ this.filteredRows = this.dataMasterCategori.headerDetailParam.sort((a, b) => b.id - a.id);
});
}
diff --git a/src/app/content/hemat-app/master/master-duration-use/master-duration-use.component.ts b/src/app/content/hemat-app/master/master-duration-use/master-duration-use.component.ts
index 15094de..c0432c9 100644
--- a/src/app/content/hemat-app/master/master-duration-use/master-duration-use.component.ts
+++ b/src/app/content/hemat-app/master/master-duration-use/master-duration-use.component.ts
@@ -48,7 +48,8 @@ export class MasterDurationUseComponent {
this.dataMasterCategori = res.results.data.find(
(item) => item.name === "master_duration"
);
- this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ // this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ this.filteredRows = this.dataMasterCategori.headerDetailParam.sort((a, b) => b.id - a.id);
});
}
diff --git a/src/app/content/hemat-app/master/master-floor/master-floor.component.ts b/src/app/content/hemat-app/master/master-floor/master-floor.component.ts
index 787d044..c3cdfc5 100644
--- a/src/app/content/hemat-app/master/master-floor/master-floor.component.ts
+++ b/src/app/content/hemat-app/master/master-floor/master-floor.component.ts
@@ -48,7 +48,8 @@ export class MasterFloorComponent {
this.dataMasterCategori = res.results.data.find(
(item) => item.name === "master_floor"
);
- this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ // this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ this.filteredRows = this.dataMasterCategori.headerDetailParam.sort((a, b) => b.id - a.id);
});
}
diff --git a/src/app/content/hemat-app/master/master-role/master-role.component.ts b/src/app/content/hemat-app/master/master-role/master-role.component.ts
index 844d0ca..85aa99b 100644
--- a/src/app/content/hemat-app/master/master-role/master-role.component.ts
+++ b/src/app/content/hemat-app/master/master-role/master-role.component.ts
@@ -48,7 +48,8 @@ export class MasterRoleComponent {
this.dataMasterCategori = res.results.data.find(
(item) => item.name === "master_role"
);
- this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ // this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ this.filteredRows = this.dataMasterCategori.headerDetailParam.sort((a, b) => b.id - a.id);
});
}
diff --git a/src/app/content/hemat-app/master/master-room/add-edit-master-room/add-edit-master-room.component.ts b/src/app/content/hemat-app/master/master-room/add-edit-master-room/add-edit-master-room.component.ts
index 662c0ac..d90cb84 100644
--- a/src/app/content/hemat-app/master/master-room/add-edit-master-room/add-edit-master-room.component.ts
+++ b/src/app/content/hemat-app/master/master-room/add-edit-master-room/add-edit-master-room.component.ts
@@ -31,7 +31,7 @@ export class AddEditMasterRoomComponent {
this.createForm();
this.listDataStatus();
this.listDataBuilding();
- console.log(this.mode);
+ console.log(this.dataRow);
if (this.mode) {
this.labelRoom = "Add New Row"
} else {
@@ -54,10 +54,10 @@ export class AddEditMasterRoomComponent {
editForm() {
this.myForm = this.fb.group({
id: this.dataRow.id,
- name: [this.dataRow.name, Validators.required],
+ name: [this.dataRow.roomEntity.name, Validators.required],
statusId: [this.dataRow.statusId, Validators.required],
buildingId: [this.dataRow.buildingId, Validators.required],
- description: [this.dataRow.description, Validators.required],
+ description: [this.dataRow.roomEntity.description, Validators.required],
});
}
diff --git a/src/app/content/hemat-app/master/master-room/master-room.component.ts b/src/app/content/hemat-app/master/master-room/master-room.component.ts
index 8fba965..02f9e5f 100644
--- a/src/app/content/hemat-app/master/master-room/master-room.component.ts
+++ b/src/app/content/hemat-app/master/master-room/master-room.component.ts
@@ -42,9 +42,9 @@ export class MasterRoomComponent {
fetchData() {
this.monitoringApiService.getBuildingRoomList().subscribe((res) => {
this.data = res;
- this.filteredRows = this.data.results.data;
+ this.filteredRows = this.data.results.data.sort((a, b) => b.id - a.id);
+ // this.data.results.data.sort((a, b) => b.id - a.id);
console.log(this.filteredRows);
-
});
}
@@ -52,25 +52,27 @@ export class MasterRoomComponent {
if (!this.searchTerm) {
this.filteredRows = [...this.data.results.data];
} else {
+ const searchTermLC = this.searchTerm.toLowerCase();
this.filteredRows = this.data.results.data.filter((row) =>
- this.rowContainsSearchTerm(row)
+ this.rowContainsSearchTerm(row, searchTermLC)
);
}
}
- rowContainsSearchTerm(row: any): boolean {
- const searchTermLC = this.searchTerm.toLowerCase();
- return Object.values(row).some(
- (value) =>
- value !== null && value.toString().toLowerCase().includes(searchTermLC)
+ rowContainsSearchTerm(row: any, searchTermLC: string): boolean {
+ return (
+ row.roomEntity.name.toLowerCase().includes(searchTermLC) ||
+ row.roomEntity.description.toLowerCase().includes(searchTermLC) ||
+ row.buildingEntity.name.toLowerCase().includes(searchTermLC) ||
+ row.statusEntity.name.toLowerCase().includes(searchTermLC)
);
}
openAddMasterModal() {
const modalRef = this.modalService.open(AddEditMasterRoomComponent, {
size: "lg",
- backdrop: 'static', // Add this line
- keyboard: false // Add this line
+ backdrop: "static", // Add this line
+ keyboard: false, // Add this line
});
modalRef.componentInstance.mode = "add";
@@ -86,7 +88,7 @@ export class MasterRoomComponent {
.subscribe((res) => {
const transformedData = {
buildingId: result.buildingId,
- roomId: res.data.id,
+ roomId: [res.data.id],
statusId: result.statusId,
};
this.monitoringApiService
@@ -106,8 +108,8 @@ export class MasterRoomComponent {
editRow(row) {
const modalRef = this.modalService.open(AddEditMasterRoomComponent, {
size: "lg",
- backdrop: 'static', // Add this line
- keyboard: false // Add this line
+ backdrop: "static", // Add this line
+ keyboard: false, // Add this line
});
modalRef.componentInstance.dataRow = row;
@@ -132,9 +134,13 @@ export class MasterRoomComponent {
const confirmDelete = confirm("Are you sure you want to delete this item?");
if (confirmDelete) {
this.monitoringApiService
- .deleteHeaderDetailParam(row.id)
+ .deleteHeaderDetailParam(row.roomEntity.id)
.subscribe((res) => {
- this.fetchData();
+ this.monitoringApiService
+ .deleteRoomBuilding(row.id)
+ .subscribe((res) => {
+ this.fetchData();
+ });
});
}
}
diff --git a/src/app/content/hemat-app/master/master-status/master-status.component.ts b/src/app/content/hemat-app/master/master-status/master-status.component.ts
index 0aba3be..54a0017 100644
--- a/src/app/content/hemat-app/master/master-status/master-status.component.ts
+++ b/src/app/content/hemat-app/master/master-status/master-status.component.ts
@@ -48,7 +48,8 @@ export class MasterStatusComponent {
this.dataMasterCategori = res.results.data.find(
(item) => item.name === "master_status"
);
- this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ // this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ this.filteredRows = this.dataMasterCategori.headerDetailParam.sort((a, b) => b.id - a.id);
});
}
diff --git a/src/app/content/hemat-app/master/master-type/master-type.component.ts b/src/app/content/hemat-app/master/master-type/master-type.component.ts
index 17b1f99..a6bed8a 100644
--- a/src/app/content/hemat-app/master/master-type/master-type.component.ts
+++ b/src/app/content/hemat-app/master/master-type/master-type.component.ts
@@ -48,7 +48,8 @@ export class MasterTypeComponent {
this.dataMasterCategori = res.results.data.find(
(item) => item.name === "master_type"
);
- this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ // this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ this.filteredRows = this.dataMasterCategori.headerDetailParam.sort((a, b) => b.id - a.id);
});
}
diff --git a/src/app/content/hemat-app/master/master-voltage/master-voltage.component.ts b/src/app/content/hemat-app/master/master-voltage/master-voltage.component.ts
index f4546fc..0449979 100644
--- a/src/app/content/hemat-app/master/master-voltage/master-voltage.component.ts
+++ b/src/app/content/hemat-app/master/master-voltage/master-voltage.component.ts
@@ -48,7 +48,8 @@ export class MasterVoltageComponent {
this.dataMasterCategori = res.results.data.find(
(item) => item.name === "master_voltage"
);
- this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ // this.filteredRows = this.dataMasterCategori.headerDetailParam;
+ this.filteredRows = this.dataMasterCategori.headerDetailParam.sort((a, b) => b.id - a.id);
});
}
diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html
index a03c586..77f7b7b 100644
--- a/src/app/login/login.component.html
+++ b/src/app/login/login.component.html
@@ -138,7 +138,7 @@
- (v@2024.07.2.02)
+ (v@2024.07.3.01)