penambahan floor pada room building dan code pada mster floor
This commit is contained in:
parent
d70edcebd8
commit
9b4ac3b992
|
@ -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)
|
||||
</a></span
|
||||
>
|
||||
</p>
|
||||
|
|
|
@ -66,23 +66,21 @@
|
|||
</div>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="statusId" style="color: #242222"
|
||||
>Status *</label
|
||||
<label for="floorId" style="color: #242222"
|
||||
>Floor *</label
|
||||
>
|
||||
<div class="input-group">
|
||||
<select
|
||||
id="statusId"
|
||||
id="floorId"
|
||||
class="form-control"
|
||||
formControlName="statusId"
|
||||
formControlName="floorId"
|
||||
[ngClass]="{
|
||||
'is-invalid': submitted && f.statusId.errors
|
||||
'is-invalid': submitted && f.floorId.errors
|
||||
}"
|
||||
>
|
||||
<option
|
||||
*ngFor="let data of dataMasterStatus"
|
||||
*ngFor="let data of dataFloorList"
|
||||
[value]="data.id"
|
||||
>
|
||||
{{ data.name }}
|
||||
|
@ -91,11 +89,11 @@
|
|||
</div>
|
||||
<small
|
||||
class="form-text text-muted danger"
|
||||
*ngIf="submitted && f.statusId.errors"
|
||||
*ngIf="submitted && f.floorId.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.statusId.errors.required">
|
||||
Status is required
|
||||
<div *ngIf="f.floorId.errors.required">
|
||||
Building is required
|
||||
</div>
|
||||
</small>
|
||||
</div>
|
||||
|
@ -190,6 +188,38 @@
|
|||
</div>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="statusId" style="color: #242222"
|
||||
>Status *</label
|
||||
>
|
||||
<div class="input-group">
|
||||
<select
|
||||
id="statusId"
|
||||
class="form-control"
|
||||
formControlName="statusId"
|
||||
[ngClass]="{
|
||||
'is-invalid': submitted && f.statusId.errors
|
||||
}"
|
||||
>
|
||||
<option
|
||||
*ngFor="let data of dataMasterStatus"
|
||||
[value]="data.id"
|
||||
>
|
||||
{{ data.name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<small
|
||||
class="form-text text-muted danger"
|
||||
*ngIf="submitted && f.statusId.errors"
|
||||
class="invalid-feedback"
|
||||
>
|
||||
<div *ngIf="f.statusId.errors.required">
|
||||
Status is required
|
||||
</div>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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"]);
|
||||
|
|
|
@ -94,6 +94,22 @@
|
|||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
|
||||
<ngx-datatable-column
|
||||
name="floorEntity"
|
||||
[flexGrow]="1"
|
||||
[minWidth]="90"
|
||||
>
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span class="style-custom-label">Floor</span>
|
||||
</ng-template>
|
||||
<ng-template
|
||||
ngx-datatable-cell-template
|
||||
let-value="value"
|
||||
>
|
||||
<p class="style-custom-label">{{ value.name }}</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
|
||||
<ngx-datatable-column
|
||||
name="statusEntity"
|
||||
[flexGrow]="1"
|
||||
|
|
|
@ -47,7 +47,9 @@ export class ListMonitoringComponent {
|
|||
fetchData() {
|
||||
this.monitoringApiService.getBuildingRoomList().subscribe((res) => {
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,20 @@
|
|||
Name is required.
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6" *ngIf="floor">
|
||||
<label for="code" style="color: #242222">Code:</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="code"
|
||||
formControlName="code"
|
||||
maxlength="10"
|
||||
(input)="toUppercase($event)"
|
||||
/>
|
||||
<div *ngIf="myForm.get('code').touched && myForm.get('code').invalid" class="text-danger">
|
||||
code is required.
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6" *ngIf="category">
|
||||
<label for="icon" style="color: #242222">Icon:</label>
|
||||
<app-select-icon [selectedIcon]="selectedIcon" (iconSelected)="onIconSelected($event)"></app-select-icon>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -73,6 +73,23 @@
|
|||
<p class="style-custom-label">{{ value }}</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column
|
||||
name="code"
|
||||
[flexGrow]="1"
|
||||
[minWidth]="90"
|
||||
>
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span class="style-custom-label">Code</span>
|
||||
</ng-template>
|
||||
<ng-template
|
||||
ngx-datatable-cell-template
|
||||
let-value="value"
|
||||
>
|
||||
<p class="style-custom-label">
|
||||
{{ value }}
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column
|
||||
name="StatusName"
|
||||
[flexGrow]="1"
|
||||
|
|
|
@ -89,6 +89,7 @@ export class MasterFloorComponent {
|
|||
|
||||
modalRef.componentInstance.headerId = this.dataMasterCategori.id;
|
||||
modalRef.componentInstance.mode = "add";
|
||||
modalRef.componentInstance.floor = true;
|
||||
modalRef.result.then(
|
||||
(result) => {
|
||||
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 (
|
||||
|
|
|
@ -111,6 +111,15 @@ export class BuildingService {
|
|||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getListFloorDataUnmap(id): Observable<any> {
|
||||
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<any>(url, { headers });
|
||||
}
|
||||
|
||||
getMasterRoomData(page: number = 1, limit: number = 100): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room?page=${page}&limit=${limit}`;
|
||||
const headers = new HttpHeaders({
|
||||
|
|
|
@ -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.26.01)</span>
|
||||
<span>(v@2024.08.8.01)</span>
|
||||
</p>
|
||||
<!-- <div class="card-body">
|
||||
<a
|
||||
|
|
Loading…
Reference in New Issue