perbaikan master
This commit is contained in:
parent
b095f870dd
commit
a1b259ac9f
|
@ -13,7 +13,7 @@
|
||||||
href="https://allbestsistem.com/"
|
href="https://allbestsistem.com/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
style="background-color: #000000 !important;"
|
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
|
</a></span
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -45,7 +45,8 @@ export class MasterBuildingComponent {
|
||||||
fetchData() {
|
fetchData() {
|
||||||
this.monitoringApiService.getMasterBuildingData().subscribe((res) => {
|
this.monitoringApiService.getMasterBuildingData().subscribe((res) => {
|
||||||
this.data = res.results.data;
|
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(
|
this.dataMasterCategori = res.results.data.find(
|
||||||
(item) => item.name === "master_category"
|
(item) => item.name === "master_category"
|
||||||
);
|
);
|
||||||
this.filteredRows = this.dataMasterCategori.headerDetailParam;
|
// this.filteredRows = this.dataMasterCategori.headerDetailParam;
|
||||||
console.log(this.filteredRows);
|
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(
|
this.dataMasterCategori = res.results.data.find(
|
||||||
(item) => item.name === "master_duration"
|
(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(
|
this.dataMasterCategori = res.results.data.find(
|
||||||
(item) => item.name === "master_floor"
|
(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(
|
this.dataMasterCategori = res.results.data.find(
|
||||||
(item) => item.name === "master_role"
|
(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.createForm();
|
||||||
this.listDataStatus();
|
this.listDataStatus();
|
||||||
this.listDataBuilding();
|
this.listDataBuilding();
|
||||||
console.log(this.mode);
|
console.log(this.dataRow);
|
||||||
if (this.mode) {
|
if (this.mode) {
|
||||||
this.labelRoom = "Add New Row"
|
this.labelRoom = "Add New Row"
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,10 +54,10 @@ export class AddEditMasterRoomComponent {
|
||||||
editForm() {
|
editForm() {
|
||||||
this.myForm = this.fb.group({
|
this.myForm = this.fb.group({
|
||||||
id: this.dataRow.id,
|
id: this.dataRow.id,
|
||||||
name: [this.dataRow.name, Validators.required],
|
name: [this.dataRow.roomEntity.name, Validators.required],
|
||||||
statusId: [this.dataRow.statusId, Validators.required],
|
statusId: [this.dataRow.statusId, Validators.required],
|
||||||
buildingId: [this.dataRow.buildingId, 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() {
|
fetchData() {
|
||||||
this.monitoringApiService.getBuildingRoomList().subscribe((res) => {
|
this.monitoringApiService.getBuildingRoomList().subscribe((res) => {
|
||||||
this.data = 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);
|
console.log(this.filteredRows);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,25 +52,27 @@ export class MasterRoomComponent {
|
||||||
if (!this.searchTerm) {
|
if (!this.searchTerm) {
|
||||||
this.filteredRows = [...this.data.results.data];
|
this.filteredRows = [...this.data.results.data];
|
||||||
} else {
|
} else {
|
||||||
|
const searchTermLC = this.searchTerm.toLowerCase();
|
||||||
this.filteredRows = this.data.results.data.filter((row) =>
|
this.filteredRows = this.data.results.data.filter((row) =>
|
||||||
this.rowContainsSearchTerm(row)
|
this.rowContainsSearchTerm(row, searchTermLC)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rowContainsSearchTerm(row: any): boolean {
|
rowContainsSearchTerm(row: any, searchTermLC: string): boolean {
|
||||||
const searchTermLC = this.searchTerm.toLowerCase();
|
return (
|
||||||
return Object.values(row).some(
|
row.roomEntity.name.toLowerCase().includes(searchTermLC) ||
|
||||||
(value) =>
|
row.roomEntity.description.toLowerCase().includes(searchTermLC) ||
|
||||||
value !== null && value.toString().toLowerCase().includes(searchTermLC)
|
row.buildingEntity.name.toLowerCase().includes(searchTermLC) ||
|
||||||
|
row.statusEntity.name.toLowerCase().includes(searchTermLC)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
openAddMasterModal() {
|
openAddMasterModal() {
|
||||||
const modalRef = this.modalService.open(AddEditMasterRoomComponent, {
|
const modalRef = this.modalService.open(AddEditMasterRoomComponent, {
|
||||||
size: "lg",
|
size: "lg",
|
||||||
backdrop: 'static', // Add this line
|
backdrop: "static", // Add this line
|
||||||
keyboard: false // Add this line
|
keyboard: false, // Add this line
|
||||||
});
|
});
|
||||||
|
|
||||||
modalRef.componentInstance.mode = "add";
|
modalRef.componentInstance.mode = "add";
|
||||||
|
@ -86,7 +88,7 @@ export class MasterRoomComponent {
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
const transformedData = {
|
const transformedData = {
|
||||||
buildingId: result.buildingId,
|
buildingId: result.buildingId,
|
||||||
roomId: res.data.id,
|
roomId: [res.data.id],
|
||||||
statusId: result.statusId,
|
statusId: result.statusId,
|
||||||
};
|
};
|
||||||
this.monitoringApiService
|
this.monitoringApiService
|
||||||
|
@ -106,8 +108,8 @@ export class MasterRoomComponent {
|
||||||
editRow(row) {
|
editRow(row) {
|
||||||
const modalRef = this.modalService.open(AddEditMasterRoomComponent, {
|
const modalRef = this.modalService.open(AddEditMasterRoomComponent, {
|
||||||
size: "lg",
|
size: "lg",
|
||||||
backdrop: 'static', // Add this line
|
backdrop: "static", // Add this line
|
||||||
keyboard: false // Add this line
|
keyboard: false, // Add this line
|
||||||
});
|
});
|
||||||
|
|
||||||
modalRef.componentInstance.dataRow = row;
|
modalRef.componentInstance.dataRow = row;
|
||||||
|
@ -132,9 +134,13 @@ export class MasterRoomComponent {
|
||||||
const confirmDelete = confirm("Are you sure you want to delete this item?");
|
const confirmDelete = confirm("Are you sure you want to delete this item?");
|
||||||
if (confirmDelete) {
|
if (confirmDelete) {
|
||||||
this.monitoringApiService
|
this.monitoringApiService
|
||||||
.deleteHeaderDetailParam(row.id)
|
.deleteHeaderDetailParam(row.roomEntity.id)
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
this.fetchData();
|
this.monitoringApiService
|
||||||
|
.deleteRoomBuilding(row.id)
|
||||||
|
.subscribe((res) => {
|
||||||
|
this.fetchData();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ export class MasterStatusComponent {
|
||||||
this.dataMasterCategori = res.results.data.find(
|
this.dataMasterCategori = res.results.data.find(
|
||||||
(item) => item.name === "master_status"
|
(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(
|
this.dataMasterCategori = res.results.data.find(
|
||||||
(item) => item.name === "master_type"
|
(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(
|
this.dataMasterCategori = res.results.data.find(
|
||||||
(item) => item.name === "master_voltage"
|
(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
|
<p
|
||||||
class="card-subtitle line-on-side text-muted text-center font-small-3 mx-2 my-1"
|
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>
|
</p>
|
||||||
<!-- <div class="card-body">
|
<!-- <div class="card-body">
|
||||||
<a
|
<a
|
||||||
|
|
Loading…
Reference in New Issue