perbaikan master
This commit is contained in:
parent
b095f870dd
commit
a1b259ac9f
|
@ -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)
|
||||
</a></span
|
||||
>
|
||||
</p>
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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],
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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,10 +134,14 @@ 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.monitoringApiService
|
||||
.deleteRoomBuilding(row.id)
|
||||
.subscribe((res) => {
|
||||
this.fetchData();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
<p
|
||||
class="card-subtitle line-on-side text-muted text-center font-small-3 mx-2 my-1"
|
||||
>
|
||||
<span>(v@2024.07.2.02)</span>
|
||||
<span>(v@2024.07.3.01)</span>
|
||||
</p>
|
||||
<!-- <div class="card-body">
|
||||
<a
|
||||
|
|
Loading…
Reference in New Issue