pernambahan code pada master room
This commit is contained in:
parent
95fa99799c
commit
3b3757e2a7
|
@ -213,7 +213,11 @@ export class AddEditListComponent {
|
||||||
|
|
||||||
dataListRoom() {
|
dataListRoom() {
|
||||||
this.monitoringApiService.getListRoomDataUnmap().subscribe(data => {
|
this.monitoringApiService.getListRoomDataUnmap().subscribe(data => {
|
||||||
this.dataRoomList = data.data
|
const newArray = data.data.map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
name: `${item.name} (${item.code})`
|
||||||
|
}));
|
||||||
|
this.dataRoomList = newArray
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
<div class="modal-header" style="background-color: #FBFBFB !important">
|
<div class="modal-header" style="background-color: #fbfbfb !important">
|
||||||
<h4 class="modal-title" style="color: #242222">{{labelRoom}}</h4>
|
<h4 class="modal-title" style="color: #242222">{{ labelRoom }}</h4>
|
||||||
<button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross click')">
|
<button
|
||||||
|
type="button"
|
||||||
|
class="close"
|
||||||
|
aria-label="Close"
|
||||||
|
(click)="activeModal.dismiss('Cross click')"
|
||||||
|
>
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" style="background-color: #FBFBFB !important">
|
<div class="modal-body" style="background-color: #fbfbfb !important">
|
||||||
<form [formGroup]="myForm">
|
<form [formGroup]="myForm">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
|
@ -23,6 +28,22 @@
|
||||||
Name is required.
|
Name is required.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="name" style="color: #242222">Room Code:</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
id="code"
|
||||||
|
formControlName="code"
|
||||||
|
maxlength="10"
|
||||||
|
/>
|
||||||
|
<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">
|
<!-- <div class="form-group col-md-6">
|
||||||
<label for="statusId" style="color: #242222">Building:</label>
|
<label for="statusId" style="color: #242222">Building:</label>
|
||||||
<select
|
<select
|
||||||
|
@ -52,7 +73,13 @@
|
||||||
formControlName="description"
|
formControlName="description"
|
||||||
maxlength="50"
|
maxlength="50"
|
||||||
/>
|
/>
|
||||||
<div *ngIf="myForm.get('description').touched && myForm.get('description').invalid" class="text-danger">
|
<div
|
||||||
|
*ngIf="
|
||||||
|
myForm.get('description').touched &&
|
||||||
|
myForm.get('description').invalid
|
||||||
|
"
|
||||||
|
class="text-danger"
|
||||||
|
>
|
||||||
Description is required.
|
Description is required.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,14 +101,14 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer" style="background-color: #FBFBFB !important">
|
<div class="modal-footer" style="background-color: #fbfbfb !important">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
style="
|
style="
|
||||||
color: #242222 !important;
|
color: #242222 !important;
|
||||||
background-color: #FBFBFB !important;
|
background-color: #fbfbfb !important;
|
||||||
border-color: #FBFBFB !important;
|
border-color: #fbfbfb !important;
|
||||||
"
|
"
|
||||||
(click)="activeModal.dismiss('Cross click')"
|
(click)="activeModal.dismiss('Cross click')"
|
||||||
>
|
>
|
||||||
|
@ -90,7 +117,7 @@
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
style="color: #ffffff !important; background-color: #37A647 !important"
|
style="color: #ffffff !important; background-color: #37a647 !important"
|
||||||
(click)="addRow()"
|
(click)="addRow()"
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
|
|
|
@ -48,6 +48,7 @@ export class AddEditMasterRoomComponent {
|
||||||
createForm() {
|
createForm() {
|
||||||
this.myForm = this.fb.group({
|
this.myForm = this.fb.group({
|
||||||
name: ["", Validators.required],
|
name: ["", Validators.required],
|
||||||
|
code: ["", Validators.required],
|
||||||
description: ["", Validators.required],
|
description: ["", Validators.required],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -58,6 +59,7 @@ export class AddEditMasterRoomComponent {
|
||||||
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.name, Validators.required],
|
||||||
|
code: [this.dataRow.code, Validators.required],
|
||||||
description: [this.dataRow.description, Validators.required],
|
description: [this.dataRow.description, Validators.required],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,12 +85,19 @@ export class MasterRoomComponent {
|
||||||
if (result) {
|
if (result) {
|
||||||
const filteredData = {
|
const filteredData = {
|
||||||
name: result.name,
|
name: result.name,
|
||||||
|
code: result.code,
|
||||||
description: result.description,
|
description: result.description,
|
||||||
};
|
};
|
||||||
this.monitoringApiService
|
this.monitoringApiService
|
||||||
.postMasterRoomParam(filteredData)
|
.postMasterRoomParam(filteredData)
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
|
}, (error) => {
|
||||||
|
console.error(error);
|
||||||
|
this.toastr.error("Error", error.error.message, {
|
||||||
|
timeOut: 2000,
|
||||||
|
closeButton: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -115,6 +122,7 @@ export class MasterRoomComponent {
|
||||||
const filteredData = {
|
const filteredData = {
|
||||||
id: result.roomId,
|
id: result.roomId,
|
||||||
name: result.name,
|
name: result.name,
|
||||||
|
code: result.code,
|
||||||
description: result.description,
|
description: result.description,
|
||||||
};
|
};
|
||||||
this.monitoringApiService
|
this.monitoringApiService
|
||||||
|
|
|
@ -325,8 +325,8 @@ export class DetailComponent {
|
||||||
this.chartKwhWater = res.data;
|
this.chartKwhWater = res.data;
|
||||||
this.barChartData[0].data = [];
|
this.barChartData[0].data = [];
|
||||||
this.chartKwhWater.forEach((entry) => {
|
this.chartKwhWater.forEach((entry) => {
|
||||||
this.barChartData[0].data.push(entry.kwh);
|
|
||||||
this.barChartData[1].data.push(entry.kwh);
|
this.barChartData[1].data.push(entry.kwh);
|
||||||
|
this.barChartData[0].data.push(entry.cost);
|
||||||
this.barChartLabels.push(entry.day);
|
this.barChartLabels.push(entry.day);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue