diff --git a/src/app/_layout/footer/footer.component.html b/src/app/_layout/footer/footer.component.html index 104ad54..c9a39b4 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-07-26.01) + >Smart Building Management Systems (V@2024-08-8.01)

diff --git a/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.html b/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.html index 12f24c0..c2b44f8 100644 --- a/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.html +++ b/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.html @@ -66,23 +66,21 @@ - -
- Floor *
+ + +
+ +
+ Status is required +
+
+
diff --git a/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.ts b/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.ts index 9e426ee..f6f6ef5 100644 --- a/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.ts +++ b/src/app/content/hemat-app/list-monitoring/add-edit-list/add-edit-list.component.ts @@ -22,6 +22,7 @@ export class AddEditListComponent { dataBuildingList: any; dataRoomList: any; + dataFloorList: any; dataMasterStatus: any; roombuildingId: any; dataRoomBuilding: any; @@ -60,11 +61,13 @@ export class AddEditListComponent { this.dataListBuilding(); this.dataListRoom(); this.dataListMaster(); + this.dataListFloor(); this.projectInfo = this.formBuilder.group({ buildingId: ["", Validators.required], roomId: [""], statusId: ["", Validators.required], + floorId: ["", Validators.required], userArray: this.formBuilder.array([this.createRoom()]), }); this.userList = this.projectInfo.get('userArray') as FormArray; @@ -221,6 +224,18 @@ export class AddEditListComponent { }); } + dataListFloor() { + this.monitoringApiService.getListFloorDataUnmap(6).subscribe(data => { + console.log(data); + + const newArray = data.data.map(item => ({ + id: item.id, + name: `${item.name} (${item.code})` + })); + this.dataFloorList = newArray + }); + } + dataListMaster() { this.monitoringApiService.getMasterListData().subscribe(data => { const dataStatus = data.data.find( @@ -239,7 +254,8 @@ export class AddEditListComponent { const transformedData = { buildingId: formData.buildingId, roomId: formData.userArray.map(room => room.roomId), - statusId: formData.statusId + statusId: formData.statusId, + floorId: formData.floorId }; this.monitoringApiService.postBatchBuilding(transformedData).subscribe((res) => { this.router.navigate(["/list-monitoring"]); diff --git a/src/app/content/hemat-app/list-monitoring/list-monitoring.component.html b/src/app/content/hemat-app/list-monitoring/list-monitoring.component.html index a2f0c62..2260a6a 100644 --- a/src/app/content/hemat-app/list-monitoring/list-monitoring.component.html +++ b/src/app/content/hemat-app/list-monitoring/list-monitoring.component.html @@ -94,6 +94,22 @@ + + + Floor + + +

{{ value.name }}

+
+
+ { this.data = res; - this.filteredRows = this.data.results.data; + // this.filteredRows = this.data.results.data; + this.filteredRows = this.data.results.data.sort((a, b) => b.id - a.id); + }); } @@ -66,7 +68,8 @@ export class ListMonitoringComponent { return ( row.buildingEntity.name.toLowerCase().includes(searchTermLC) || row.roomEntity.name.toLowerCase().includes(searchTermLC) || - row.statusEntity.name.toLowerCase().includes(searchTermLC) + row.statusEntity.name.toLowerCase().includes(searchTermLC) || + row.floorEntity.name.toLowerCase().includes(searchTermLC) ); } diff --git a/src/app/content/hemat-app/master/add-edit-master/add-edit-master.component.html b/src/app/content/hemat-app/master/add-edit-master/add-edit-master.component.html index 2dccb2c..8c8ef08 100644 --- a/src/app/content/hemat-app/master/add-edit-master/add-edit-master.component.html +++ b/src/app/content/hemat-app/master/add-edit-master/add-edit-master.component.html @@ -20,6 +20,20 @@ Name is required. +
+ + +
+ code is required. +
+
diff --git a/src/app/content/hemat-app/master/add-edit-master/add-edit-master.component.ts b/src/app/content/hemat-app/master/add-edit-master/add-edit-master.component.ts index fb685a8..e850f9e 100644 --- a/src/app/content/hemat-app/master/add-edit-master/add-edit-master.component.ts +++ b/src/app/content/hemat-app/master/add-edit-master/add-edit-master.component.ts @@ -14,6 +14,7 @@ export class AddEditMasterComponent implements OnInit { @Input() dataRow: any; @Input() mode: any; @Input() category: boolean = false; + @Input() floor: boolean = false; myForm: FormGroup; dataMasterStatus: any; selectedIcon: string = ''; @@ -53,9 +54,20 @@ export class AddEditMasterComponent implements OnInit { formControls['icon'] = [undefined, Validators.required]; } + if (this.floor) { + formControls['code'] = ['', Validators.required]; + } + this.myForm = this.fb.group(formControls); } + toUppercase(event: Event) { + const input = event.target as HTMLInputElement; + input.value = input.value.toUpperCase(); + this.myForm.get('code').setValue(input.value); + } + + editForm() { console.log(this.dataRow); @@ -71,6 +83,9 @@ export class AddEditMasterComponent implements OnInit { this.selectedIcon = this.dataRow.icon || undefined; } + if (this.floor) { + formControls['code'] = [this.dataRow.code || '' , Validators.required]; + } this.myForm = this.fb.group(formControls); } @@ -108,8 +123,6 @@ export class AddEditMasterComponent implements OnInit { } onIconSelected(icon: string): void { - console.log(icon); - this.selectedIcon = icon; this.myForm.get('icon').setValue(icon); // Set nilai icon ke dalam form } diff --git a/src/app/content/hemat-app/master/master-floor/master-floor.component.html b/src/app/content/hemat-app/master/master-floor/master-floor.component.html index 8d22bf7..509c568 100644 --- a/src/app/content/hemat-app/master/master-floor/master-floor.component.html +++ b/src/app/content/hemat-app/master/master-floor/master-floor.component.html @@ -73,6 +73,23 @@

{{ value }}

+ + + Code + + +

+ {{ value }} +

+
+
{ console.log(result); @@ -104,6 +105,12 @@ export class MasterFloorComponent { .subscribe((res) => { console.log(res); this.fetchData(); + if (res.status === 400) { + this.toastr.error("Warning", "Data yang anda masukan double.", { + timeOut: 5000, + closeButton: true, + }); + } }); } } @@ -132,6 +139,7 @@ export class MasterFloorComponent { modalRef.componentInstance.headerId = this.dataMasterCategori.id; modalRef.componentInstance.dataRow = row; modalRef.componentInstance.mode = "edit"; + modalRef.componentInstance.floor = true; modalRef.result.then( (result) => { if (result) { @@ -145,6 +153,14 @@ export class MasterFloorComponent { .putHeaderDetailParam(result, row.id) .subscribe((res) => { this.fetchData(); + console.log(res); + + if (res.status === 400) { + this.toastr.error("Warning", "Data yang anda masukan double.", { + timeOut: 5000, + closeButton: true, + }); + } }); } else { if ( diff --git a/src/app/content/hemat-app/service/monitoring-api.service.ts b/src/app/content/hemat-app/service/monitoring-api.service.ts index 063638e..ad3c85b 100644 --- a/src/app/content/hemat-app/service/monitoring-api.service.ts +++ b/src/app/content/hemat-app/service/monitoring-api.service.ts @@ -111,6 +111,15 @@ export class BuildingService { return this.http.get(url, { headers }); } + getListFloorDataUnmap(id): Observable { + const url = `https://kapi.absys.ninja/hemat/header-detail-param/list/unmap-room-building?headerId=${id}`; + const headers = new HttpHeaders({ + "Content-Type": "application/json", + "x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT", + }); + return this.http.get(url, { headers }); + } + getMasterRoomData(page: number = 1, limit: number = 100): Observable { const url = `https://kapi.absys.ninja/hemat/room?page=${page}&limit=${limit}`; const headers = new HttpHeaders({ diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html index be7bea7..cc0c001 100644 --- a/src/app/login/login.component.html +++ b/src/app/login/login.component.html @@ -138,7 +138,7 @@

- (v@2024.07.26.01) + (v@2024.08.8.01)