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/"
|
href="https://allbestsistem.com/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
style="background-color: #ffffff !important;"
|
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
|
</a></span
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -66,23 +66,21 @@
|
||||||
</div>
|
</div>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="statusId" style="color: #242222"
|
<label for="floorId" style="color: #242222"
|
||||||
>Status *</label
|
>Floor *</label
|
||||||
>
|
>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<select
|
<select
|
||||||
id="statusId"
|
id="floorId"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
formControlName="statusId"
|
formControlName="floorId"
|
||||||
[ngClass]="{
|
[ngClass]="{
|
||||||
'is-invalid': submitted && f.statusId.errors
|
'is-invalid': submitted && f.floorId.errors
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<option
|
<option
|
||||||
*ngFor="let data of dataMasterStatus"
|
*ngFor="let data of dataFloorList"
|
||||||
[value]="data.id"
|
[value]="data.id"
|
||||||
>
|
>
|
||||||
{{ data.name }}
|
{{ data.name }}
|
||||||
|
@ -91,11 +89,11 @@
|
||||||
</div>
|
</div>
|
||||||
<small
|
<small
|
||||||
class="form-text text-muted danger"
|
class="form-text text-muted danger"
|
||||||
*ngIf="submitted && f.statusId.errors"
|
*ngIf="submitted && f.floorId.errors"
|
||||||
class="invalid-feedback"
|
class="invalid-feedback"
|
||||||
>
|
>
|
||||||
<div *ngIf="f.statusId.errors.required">
|
<div *ngIf="f.floorId.errors.required">
|
||||||
Status is required
|
Building is required
|
||||||
</div>
|
</div>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
@ -190,6 +188,38 @@
|
||||||
</div>
|
</div>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,6 +22,7 @@ export class AddEditListComponent {
|
||||||
|
|
||||||
dataBuildingList: any;
|
dataBuildingList: any;
|
||||||
dataRoomList: any;
|
dataRoomList: any;
|
||||||
|
dataFloorList: any;
|
||||||
dataMasterStatus: any;
|
dataMasterStatus: any;
|
||||||
roombuildingId: any;
|
roombuildingId: any;
|
||||||
dataRoomBuilding: any;
|
dataRoomBuilding: any;
|
||||||
|
@ -60,11 +61,13 @@ export class AddEditListComponent {
|
||||||
this.dataListBuilding();
|
this.dataListBuilding();
|
||||||
this.dataListRoom();
|
this.dataListRoom();
|
||||||
this.dataListMaster();
|
this.dataListMaster();
|
||||||
|
this.dataListFloor();
|
||||||
|
|
||||||
this.projectInfo = this.formBuilder.group({
|
this.projectInfo = this.formBuilder.group({
|
||||||
buildingId: ["", Validators.required],
|
buildingId: ["", Validators.required],
|
||||||
roomId: [""],
|
roomId: [""],
|
||||||
statusId: ["", Validators.required],
|
statusId: ["", Validators.required],
|
||||||
|
floorId: ["", Validators.required],
|
||||||
userArray: this.formBuilder.array([this.createRoom()]),
|
userArray: this.formBuilder.array([this.createRoom()]),
|
||||||
});
|
});
|
||||||
this.userList = this.projectInfo.get('userArray') as FormArray;
|
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() {
|
dataListMaster() {
|
||||||
this.monitoringApiService.getMasterListData().subscribe(data => {
|
this.monitoringApiService.getMasterListData().subscribe(data => {
|
||||||
const dataStatus = data.data.find(
|
const dataStatus = data.data.find(
|
||||||
|
@ -239,7 +254,8 @@ export class AddEditListComponent {
|
||||||
const transformedData = {
|
const transformedData = {
|
||||||
buildingId: formData.buildingId,
|
buildingId: formData.buildingId,
|
||||||
roomId: formData.userArray.map(room => room.roomId),
|
roomId: formData.userArray.map(room => room.roomId),
|
||||||
statusId: formData.statusId
|
statusId: formData.statusId,
|
||||||
|
floorId: formData.floorId
|
||||||
};
|
};
|
||||||
this.monitoringApiService.postBatchBuilding(transformedData).subscribe((res) => {
|
this.monitoringApiService.postBatchBuilding(transformedData).subscribe((res) => {
|
||||||
this.router.navigate(["/list-monitoring"]);
|
this.router.navigate(["/list-monitoring"]);
|
||||||
|
|
|
@ -94,6 +94,22 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngx-datatable-column>
|
</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
|
<ngx-datatable-column
|
||||||
name="statusEntity"
|
name="statusEntity"
|
||||||
[flexGrow]="1"
|
[flexGrow]="1"
|
||||||
|
|
|
@ -47,7 +47,9 @@ export class ListMonitoringComponent {
|
||||||
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;
|
||||||
|
this.filteredRows = this.data.results.data.sort((a, b) => b.id - a.id);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +68,8 @@ export class ListMonitoringComponent {
|
||||||
return (
|
return (
|
||||||
row.buildingEntity.name.toLowerCase().includes(searchTermLC) ||
|
row.buildingEntity.name.toLowerCase().includes(searchTermLC) ||
|
||||||
row.roomEntity.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.
|
Name is required.
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="form-group col-md-6" *ngIf="category">
|
||||||
<label for="icon" style="color: #242222">Icon:</label>
|
<label for="icon" style="color: #242222">Icon:</label>
|
||||||
<app-select-icon [selectedIcon]="selectedIcon" (iconSelected)="onIconSelected($event)"></app-select-icon>
|
<app-select-icon [selectedIcon]="selectedIcon" (iconSelected)="onIconSelected($event)"></app-select-icon>
|
||||||
|
|
|
@ -14,6 +14,7 @@ export class AddEditMasterComponent implements OnInit {
|
||||||
@Input() dataRow: any;
|
@Input() dataRow: any;
|
||||||
@Input() mode: any;
|
@Input() mode: any;
|
||||||
@Input() category: boolean = false;
|
@Input() category: boolean = false;
|
||||||
|
@Input() floor: boolean = false;
|
||||||
myForm: FormGroup;
|
myForm: FormGroup;
|
||||||
dataMasterStatus: any;
|
dataMasterStatus: any;
|
||||||
selectedIcon: string = '';
|
selectedIcon: string = '';
|
||||||
|
@ -53,9 +54,20 @@ export class AddEditMasterComponent implements OnInit {
|
||||||
formControls['icon'] = [undefined, Validators.required];
|
formControls['icon'] = [undefined, Validators.required];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.floor) {
|
||||||
|
formControls['code'] = ['', Validators.required];
|
||||||
|
}
|
||||||
|
|
||||||
this.myForm = this.fb.group(formControls);
|
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() {
|
editForm() {
|
||||||
console.log(this.dataRow);
|
console.log(this.dataRow);
|
||||||
|
|
||||||
|
@ -71,6 +83,9 @@ export class AddEditMasterComponent implements OnInit {
|
||||||
this.selectedIcon = this.dataRow.icon || undefined;
|
this.selectedIcon = this.dataRow.icon || undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.floor) {
|
||||||
|
formControls['code'] = [this.dataRow.code || '' , Validators.required];
|
||||||
|
}
|
||||||
this.myForm = this.fb.group(formControls);
|
this.myForm = this.fb.group(formControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +123,6 @@ export class AddEditMasterComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onIconSelected(icon: string): void {
|
onIconSelected(icon: string): void {
|
||||||
console.log(icon);
|
|
||||||
|
|
||||||
this.selectedIcon = icon;
|
this.selectedIcon = icon;
|
||||||
this.myForm.get('icon').setValue(icon); // Set nilai icon ke dalam form
|
this.myForm.get('icon').setValue(icon); // Set nilai icon ke dalam form
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,23 @@
|
||||||
<p class="style-custom-label">{{ value }}</p>
|
<p class="style-custom-label">{{ value }}</p>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngx-datatable-column>
|
</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
|
<ngx-datatable-column
|
||||||
name="StatusName"
|
name="StatusName"
|
||||||
[flexGrow]="1"
|
[flexGrow]="1"
|
||||||
|
|
|
@ -89,6 +89,7 @@ export class MasterFloorComponent {
|
||||||
|
|
||||||
modalRef.componentInstance.headerId = this.dataMasterCategori.id;
|
modalRef.componentInstance.headerId = this.dataMasterCategori.id;
|
||||||
modalRef.componentInstance.mode = "add";
|
modalRef.componentInstance.mode = "add";
|
||||||
|
modalRef.componentInstance.floor = true;
|
||||||
modalRef.result.then(
|
modalRef.result.then(
|
||||||
(result) => {
|
(result) => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
|
@ -104,6 +105,12 @@ export class MasterFloorComponent {
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
this.fetchData();
|
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.headerId = this.dataMasterCategori.id;
|
||||||
modalRef.componentInstance.dataRow = row;
|
modalRef.componentInstance.dataRow = row;
|
||||||
modalRef.componentInstance.mode = "edit";
|
modalRef.componentInstance.mode = "edit";
|
||||||
|
modalRef.componentInstance.floor = true;
|
||||||
modalRef.result.then(
|
modalRef.result.then(
|
||||||
(result) => {
|
(result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -145,6 +153,14 @@ export class MasterFloorComponent {
|
||||||
.putHeaderDetailParam(result, row.id)
|
.putHeaderDetailParam(result, row.id)
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
|
if (res.status === 400) {
|
||||||
|
this.toastr.error("Warning", "Data yang anda masukan double.", {
|
||||||
|
timeOut: 5000,
|
||||||
|
closeButton: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -111,6 +111,15 @@ export class BuildingService {
|
||||||
return this.http.get<any>(url, { headers });
|
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> {
|
getMasterRoomData(page: number = 1, limit: number = 100): Observable<any> {
|
||||||
const url = `https://kapi.absys.ninja/hemat/room?page=${page}&limit=${limit}`;
|
const url = `https://kapi.absys.ninja/hemat/room?page=${page}&limit=${limit}`;
|
||||||
const headers = new HttpHeaders({
|
const headers = new HttpHeaders({
|
||||||
|
|
|
@ -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.26.01)</span>
|
<span>(v@2024.08.8.01)</span>
|
||||||
</p>
|
</p>
|
||||||
<!-- <div class="card-body">
|
<!-- <div class="card-body">
|
||||||
<a
|
<a
|
||||||
|
|
Loading…
Reference in New Issue