integrasi select floor per building id
This commit is contained in:
parent
0aac2ff194
commit
a9d135f8ef
|
@ -13,7 +13,7 @@
|
||||||
href="https://allbestsistem.com/"
|
href="https://allbestsistem.com/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
style="background-color: #ffffff !important;"
|
style="background-color: #ffffff !important;"
|
||||||
>Smart Building Management Systems (V@2024-08-19.1)
|
>Smart Building Management Systems (V@2024-08-19.2)
|
||||||
</a></span
|
</a></span
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
bindValue="id"
|
bindValue="id"
|
||||||
placeholder="Select Building"
|
placeholder="Select Building"
|
||||||
[(ngModel)]="buildingSelected"
|
[(ngModel)]="buildingSelected"
|
||||||
|
(change)="buildingChange($event)"
|
||||||
>
|
>
|
||||||
</ng-select>
|
</ng-select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
class="select-custom"
|
class="select-custom"
|
||||||
[items]="dataFloorList"
|
[items]="dataFloorList"
|
||||||
[searchable]="true"
|
[searchable]="true"
|
||||||
|
[disabled]="disableFloorList"
|
||||||
bindLabel="name"
|
bindLabel="name"
|
||||||
bindValue="id"
|
bindValue="id"
|
||||||
placeholder="Select Floor"
|
placeholder="Select Floor"
|
||||||
|
|
|
@ -21,6 +21,7 @@ export class BuildingComponent {
|
||||||
spinnerFilterActive = false;
|
spinnerFilterActive = false;
|
||||||
typeData: any;
|
typeData: any;
|
||||||
labelData: any;
|
labelData: any;
|
||||||
|
disableFloorList = true;
|
||||||
|
|
||||||
dataBuildingList: any;
|
dataBuildingList: any;
|
||||||
buildingSelected: any;
|
buildingSelected: any;
|
||||||
|
@ -60,9 +61,9 @@ export class BuildingComponent {
|
||||||
showLabel: false,
|
showLabel: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.listBuilding(this.buildingSelected, this.floorSelected);
|
|
||||||
this.dataListBuilding();
|
this.dataListBuilding();
|
||||||
this.dataListFloor();
|
this.listBuilding(this.buildingSelected, this.floorSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataListBuilding() {
|
dataListBuilding() {
|
||||||
|
@ -73,23 +74,28 @@ export class BuildingComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
dataListFloor() {
|
buildingChange(e) {
|
||||||
this.monitoringApiService.getMasterData().subscribe((data) => {
|
if (e) {
|
||||||
const dataMasterFloor = data.results.data.find(
|
this.dataListFloor(e.id);
|
||||||
(item) => item.name === "master_floor"
|
this.disableFloorList = false;
|
||||||
);
|
} else {
|
||||||
const listFloor = dataMasterFloor.headerDetailParam.sort(
|
this.floorSelected = null;
|
||||||
(a, b) => b.id - a.id
|
this.disableFloorList = true;
|
||||||
);
|
}
|
||||||
const newArray = listFloor
|
}
|
||||||
.map((item) => ({
|
|
||||||
id: item.id,
|
|
||||||
name: `${item.name} (${item.code})`,
|
|
||||||
}))
|
|
||||||
.sort((a, b) => b.id - a.id);
|
|
||||||
|
|
||||||
this.dataFloorList = newArray;
|
dataListFloor(buildingId) {
|
||||||
});
|
this.monitoringApiService
|
||||||
|
.getMasterDataListFloor(buildingId)
|
||||||
|
.subscribe((data) => {
|
||||||
|
const newArray = data.data
|
||||||
|
.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
name: `${item.name} (${item.code})`,
|
||||||
|
}))
|
||||||
|
.sort((a, b) => b.id - a.id);
|
||||||
|
this.dataFloorList = newArray;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
listBuilding(buildingId, floorId) {
|
listBuilding(buildingId, floorId) {
|
||||||
|
@ -116,9 +122,18 @@ export class BuildingComponent {
|
||||||
|
|
||||||
viewDetail(row) {
|
viewDetail(row) {
|
||||||
if (row.building_id !== undefined && row.floor_id === undefined) {
|
if (row.building_id !== undefined && row.floor_id === undefined) {
|
||||||
this.router.navigate(["/monitoring/view-detail-floor", row.building_id, row.id]);
|
this.router.navigate([
|
||||||
|
"/monitoring/view-detail-floor",
|
||||||
|
row.building_id,
|
||||||
|
row.id,
|
||||||
|
]);
|
||||||
} else if (row.building_id !== undefined && row.floor_id !== undefined) {
|
} else if (row.building_id !== undefined && row.floor_id !== undefined) {
|
||||||
this.router.navigate(["/monitoring/view-detail-room", row.building_id, row.floor_id, row.id]);
|
this.router.navigate([
|
||||||
|
"/monitoring/view-detail-room",
|
||||||
|
row.building_id,
|
||||||
|
row.floor_id,
|
||||||
|
row.id,
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(["/monitoring/view-detail-building", row.id]);
|
this.router.navigate(["/monitoring/view-detail-building", row.id]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,15 @@ export class BuildingService {
|
||||||
return this.http.get<any>(url, { headers });
|
return this.http.get<any>(url, { headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getMasterDataListFloor(buildingId): Observable<any> {
|
||||||
|
const url = `https://kapi.absys.ninja/hemat/header-detail-param/list?headerId=6&building_id=${buildingId}`;
|
||||||
|
const headers = new HttpHeaders({
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||||
|
});
|
||||||
|
return this.http.get<any>(url, { headers });
|
||||||
|
}
|
||||||
|
|
||||||
getMasterBuildingData(
|
getMasterBuildingData(
|
||||||
page: number = 1,
|
page: number = 1,
|
||||||
limit: number = 100
|
limit: number = 100
|
||||||
|
|
|
@ -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.08.19.1)</span>
|
<span>(v@2024.08.19.2)</span>
|
||||||
</p>
|
</p>
|
||||||
<!-- <div class="card-body">
|
<!-- <div class="card-body">
|
||||||
<a
|
<a
|
||||||
|
|
Loading…
Reference in New Issue