perbaikan service
This commit is contained in:
parent
c54fdd0f55
commit
7a28e52e89
|
@ -320,7 +320,7 @@ export class AddEditListComponent {
|
|||
} else {
|
||||
delete this.projectInfo.value.userArray;
|
||||
this.monitoringApiService
|
||||
.puttBuildingRoom(this.projectInfo.value, this.roombuildingId)
|
||||
.putBuildingRoom(this.projectInfo.value, this.roombuildingId)
|
||||
.subscribe((data) => {
|
||||
this.router.navigate(["/list-monitoring"]);
|
||||
});
|
||||
|
|
|
@ -66,7 +66,6 @@ export class DetailComponent {
|
|||
private currencyPipe: CurrencyPipe,
|
||||
private router: Router,
|
||||
private authService: LoginService,
|
||||
private deviceService: DeviceService
|
||||
) {}
|
||||
|
||||
get formattedSummaryCost(): string {
|
||||
|
|
|
@ -0,0 +1,444 @@
|
|||
:host ::ng-deep .progress-bar {
|
||||
background-color: #bef264 !important;
|
||||
}
|
||||
|
||||
:host ::ng-deep .donut-chart2 .ct-series-a .ct-slice-donut {
|
||||
stroke: #8a8a8a;
|
||||
stroke-width: 20px !important;
|
||||
}
|
||||
|
||||
:host ::ng-deep .donut-chart2 .ct-series-b .ct-slice-donut {
|
||||
stroke: #bef264;
|
||||
stroke-width: 20px !important;
|
||||
}
|
||||
|
||||
:host ::ng-deep .donut-chart2 .ct-label {
|
||||
fill: #ffffff;
|
||||
color: rgb(255, 255, 255);
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
:host ::ng-deep .sp-line-total-cost .ct-series-a .ct-point {
|
||||
stroke: #bef264;
|
||||
}
|
||||
|
||||
:host ::ng-deep .sp-line-total-cost .ct-series-a .ct-line {
|
||||
stroke: #bef264;
|
||||
}
|
||||
|
||||
:host ::ng-deep .sp-line-total-cost .ct-series-a .ct-area {
|
||||
fill: #bef264;
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
:host ::ng-deep .sp-line-total-cost .ct-point {
|
||||
stroke-width: 0px;
|
||||
}
|
||||
|
||||
.ct-chart-bar .ct-series .ct-bar {
|
||||
stroke-width: 20px !important; /* Atur lebar bar sesuai kebutuhan */
|
||||
}
|
||||
|
||||
.ct-chart-bar .ct-label.ct-horizontal {
|
||||
margin-left: -10px !important; /* Mengatur margin label horizontal */
|
||||
margin-right: -10px !important;
|
||||
}
|
||||
|
||||
:host ::ng-deep .donut-chart3 .ct-series-a .ct-bar {
|
||||
stroke: #bef264;
|
||||
fill: none;
|
||||
stroke-width: 30px;
|
||||
}
|
||||
|
||||
:host ::ng-deep .donut-chart3 .ct-series-b .ct-bar {
|
||||
stroke: #bef264;
|
||||
fill: none;
|
||||
stroke-width: 30px;
|
||||
}
|
||||
|
||||
:host ::ng-deep .donut-chart3 .ct-label {
|
||||
fill: #ffffff;
|
||||
color: rgb(255, 255, 255);
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ct-label.ct-horizontal {
|
||||
font-size: 12px; /* Adjust font size */
|
||||
transform: rotate(-45deg); /* Rotate labels if needed for better fit */
|
||||
text-anchor: end;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ct-chart-bar .ct-labels .ct-label.ct-horizontal {
|
||||
margin-right: 20px; /* Adjust margin for labels */
|
||||
}
|
||||
|
||||
.chart-title {
|
||||
font-size: 18px;
|
||||
margin-bottom: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Hide the default calendar icon */
|
||||
input[type="month"]::-webkit-calendar-picker-indicator {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
/* table */
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-header
|
||||
.datatable-header-cell
|
||||
.datatable-header-cell-label {
|
||||
font-family: inherit;
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
color: #6b6f82;
|
||||
}
|
||||
:host ::ng-deep .ngx-datatable .datatable-row-center,
|
||||
.ngx-datatable .datatable-row-group,
|
||||
.ngx-datatable .datatable-row-right {
|
||||
position: relative;
|
||||
height: 50px !important;
|
||||
}
|
||||
|
||||
:host ::ng-deep .datatable-icon-right:before {
|
||||
font-family: "icofont";
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
:host ::ng-deep .datatable-icon-skip:before {
|
||||
font-family: "icofont";
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
:host ::ng-deep .datatable-icon-left:before {
|
||||
font-family: "icofont";
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
:host ::ng-deep .datatable-icon-left:before {
|
||||
content: "\2039";
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
:host ::ng-deep .datatable-icon-prev:before {
|
||||
content: "\00AB";
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
:host ::ng-deep .datatable-icon-right:before {
|
||||
content: "\203A";
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
:host ::ng-deep .datatable-icon-skip:before {
|
||||
content: "\00BB";
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-left,
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-right,
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-prev {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
padding: 0px 09px;
|
||||
background-color: #d4d2e7;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-right,
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-right {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
padding: 0px 09px;
|
||||
background-color: #d4d2e7;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-skip {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
padding: 0px 09px;
|
||||
background-color: #d4d2e7;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-prev {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
padding: 0px 09px;
|
||||
background-color: #d4d2e7;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
ul
|
||||
li:not(.disabled).active
|
||||
a,
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
ul[_ngcontent-c11]
|
||||
li[_ngcontent-c11]:not(.disabled):hover
|
||||
a[_ngcontent-c11] {
|
||||
background-color: #d4d2e7;
|
||||
font-weight: bold;
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ngx-datatable.bootstrap .datatable-footer .datatable-pager a {
|
||||
height: 32px;
|
||||
min-width: 34px;
|
||||
line-height: 22px;
|
||||
padding: 0;
|
||||
border-radius: 3px;
|
||||
margin: 0 3px;
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
padding-top: 3px;
|
||||
text-decoration: none;
|
||||
vertical-align: bottom;
|
||||
color: #7c8091;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-left,
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-right[_ngcontent-c11],
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-prev[_ngcontent-c11] {
|
||||
font-size: 14px;
|
||||
line-height: 9px;
|
||||
padding: 0px 08px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-left,
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-right[_ngcontent-c11],
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-prev[_ngcontent-c11] {
|
||||
font-size: 0px;
|
||||
line-height: 22px;
|
||||
padding: 0px 09px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-right,
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-right[_ngcontent-c11],
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-prev[_ngcontent-c11] {
|
||||
font-size: 0px;
|
||||
line-height: 22px;
|
||||
padding: 0px 09px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-skip,
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-right[_ngcontent-c11],
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-prev[_ngcontent-c11] {
|
||||
font-size: 0px;
|
||||
line-height: 22px;
|
||||
padding: 0px 09px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
.datatable-icon-prev,
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-right[_ngcontent-c11],
|
||||
.ngx-datatable.bootstrap[_ngcontent-c11]
|
||||
.datatable-footer[_ngcontent-c11]
|
||||
.datatable-pager[_ngcontent-c11]
|
||||
.datatable-icon-prev[_ngcontent-c11] {
|
||||
font-size: 0px;
|
||||
line-height: 22px;
|
||||
padding: 0px 09px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
ul
|
||||
li:not(.disabled):hover
|
||||
a {
|
||||
background-color: #545454;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
ul
|
||||
li:not(.disabled).active
|
||||
a,
|
||||
.ngx-datatable.bootstrap
|
||||
.datatable-footer
|
||||
.datatable-pager
|
||||
ul
|
||||
li:not(.disabled):hover
|
||||
a {
|
||||
background-color: #252525;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ngx-datatable.bootstrap .datatable-footer {
|
||||
background: #DDE1E6;
|
||||
color: #242222;
|
||||
margin-top: -1px;
|
||||
overflow: inherit;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ngx-datatable.bootstrap .datatable-header {
|
||||
background: #DDE1E6;
|
||||
color: #242222;
|
||||
font-weight: bold;
|
||||
height: unset !important;
|
||||
overflow: inherit;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ngx-datatable .datatable-footer .datatable-pager {
|
||||
flex: 0 0 0%;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ngx-datatable .datatable-footer .datatable-pager .pager {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
:host
|
||||
::ng-deep
|
||||
.ngx-datatable
|
||||
.datatable-footer
|
||||
.selected-count
|
||||
.datatable-pager {
|
||||
flex: 0 0 0%;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ngx-datatable {
|
||||
display: -webkit-box;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ng-select .ng-select-container {
|
||||
color: #242222 !important;
|
||||
background-color: #FBFBFB !important;
|
||||
height: 40px !important;
|
||||
border-radius: 12px !important;
|
||||
box-shadow: 0 2px 4px rgba(36, 34, 34, 0.2) !important; /* Bayangan lebih tipis */
|
||||
}
|
||||
|
||||
:host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-input>input {
|
||||
color: #242222 !important;
|
||||
}
|
||||
|
||||
:host ::ng-deep .ngx-datatable.bootstrap .datatable-body-row {
|
||||
background-color: #FBFBFB; /* Black color for table rows */
|
||||
}
|
||||
|
||||
:host ::ng-deep .ngx-datatable.bootstrap .datatable-body-row:hover {
|
||||
background-color: #DDE1E6; /* Darker black for hover effect */
|
||||
}
|
||||
|
||||
.text-custom-label{
|
||||
color: #242222 !important;
|
||||
font-family: "Open Sans", sans-serif !important;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.text-custom-data{
|
||||
color: #242222 !important;
|
||||
font-family: "Open Sans", sans-serif !important;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.style-custom-label{
|
||||
color: #242222 !important;
|
||||
}
|
||||
|
||||
::ng-deep .modal-backdrop.show {
|
||||
z-index: auto !important;
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
<div class="modal-body" style="background-color: #FBFBFB !important">
|
||||
<h4 style="color: #242222; margin-bottom: 20px !important">
|
||||
Comparison of Water and Electricity Costs > {{ dataRow.building }}
|
||||
</h4>
|
||||
<p style="color: #242222">Room : {{ dataRow?.roomName }}</p>
|
||||
<p style="color: #242222">Category : {{ dataRow?.categoryName }}</p>
|
||||
|
||||
<div class="card-dashboard">
|
||||
<ngx-datatable
|
||||
class="bootstrap table-bordered"
|
||||
[limit]="10"
|
||||
[rows]="data_cost"
|
||||
[columnMode]="'force'"
|
||||
[headerHeight]="50"
|
||||
[footerHeight]="50"
|
||||
[rowHeight]="50"
|
||||
fxFlex="auto"
|
||||
[scrollbarH]="true"
|
||||
>
|
||||
<ngx-datatable-column name="#" [flexGrow]="0.5" [minWidth]="30">
|
||||
<ng-template ngx-datatable-cell-template let-rowIndex="rowIndex">
|
||||
<p style="color: #242222 !important">
|
||||
{{ rowIndex + 1 }}
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="periode" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Tanggal</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">
|
||||
{{ value | date : "dd/MM/yyyy" }}
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="deviceName" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Device</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">{{ value }}</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="roomName" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Room</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">{{ value }}</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="categoryName" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Category</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">{{ value }}</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column
|
||||
name="estimationCost"
|
||||
[flexGrow]="1"
|
||||
[minWidth]="90"
|
||||
>
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Estimation Cost</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">
|
||||
{{
|
||||
value.toLocaleString("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR"
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="totalKwh" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Total Kwh</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">{{ value }}</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="watt" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Watt</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">{{ value }}</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="duration" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Duration</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">{{ value }}</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="priceKwh" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #242222 !important">Price Kwh</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #242222 !important">
|
||||
{{
|
||||
value.toLocaleString("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR"
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
</ngx-datatable>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="modal-footer justify-content-between"
|
||||
style="background-color: #FBFBFB !important; border-style: none !important"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="btn"
|
||||
style="
|
||||
color: #242222;
|
||||
width: 25%;
|
||||
background-color: #FBFBFB !important;
|
||||
border-color: #242222 !important;
|
||||
border-radius: 10px;
|
||||
"
|
||||
(click)="activeModal.dismiss('Cross click')"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn"
|
||||
style="
|
||||
color: #242222 !important;
|
||||
width: 25%;
|
||||
background-color: #DDE1E6 !important;
|
||||
border-color: #DDE1E6 !important;
|
||||
border-radius: 10px;
|
||||
"
|
||||
[disabled]="spinnerExportActive"
|
||||
(click)="export()"
|
||||
>
|
||||
<i class="la la-spinner spinner" *ngIf="spinnerExportActive"></i>
|
||||
Export
|
||||
</button>
|
||||
</div>
|
|
@ -0,0 +1,23 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ModalExportComponent } from './modal-export.component';
|
||||
|
||||
describe('ModalExportComponent', () => {
|
||||
let component: ModalExportComponent;
|
||||
let fixture: ComponentFixture<ModalExportComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ModalExportComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ModalExportComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,103 @@
|
|||
import { Component, Input } from "@angular/core";
|
||||
import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
|
||||
import { DeviceService } from "../../service/device.service";
|
||||
import { CostManagementService } from "../../service/cost-management.service";
|
||||
import { TableexcelService } from "src/app/_services/tableexcel.service";
|
||||
import { LoginService } from "../../service/login.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-modal-export",
|
||||
templateUrl: "./modal-export.component.html",
|
||||
styleUrls: ["./modal-export.component.css"],
|
||||
})
|
||||
export class ModalExportComponent {
|
||||
@Input() buildingId: number;
|
||||
@Input() dataRow: any;
|
||||
data: any;
|
||||
filteredRows: any[];
|
||||
data_device: any[];
|
||||
kwhTerm: string = "";
|
||||
costTerm: string = "";
|
||||
data_cost: any;
|
||||
dataExport: any;
|
||||
formattedEndDate: any;
|
||||
spinnerExportActive = false;
|
||||
constructor(
|
||||
public activeModal: NgbActiveModal,
|
||||
private costService: CostManagementService,
|
||||
private tableexcelService: TableexcelService,
|
||||
private authService: LoginService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.authService.startTokenCheck();
|
||||
this.authService.startTrackingActivity();
|
||||
const dateRow = this.convertToUTC7(this.dataRow.endDate)
|
||||
this.formattedEndDate = dateRow.slice(0, 7);
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
console.log(this.dataRow);
|
||||
this.fetchData(
|
||||
this.dataRow.categoryId,
|
||||
this.dataRow.roomId,
|
||||
this.formattedEndDate
|
||||
);
|
||||
}
|
||||
|
||||
fetchData(category, room, period) {
|
||||
this.costService
|
||||
.getCostDetail(category, room, period)
|
||||
.subscribe((response) => {
|
||||
this.dataExport = response.data;
|
||||
console.log(this.dataExport);
|
||||
this.data_cost = response.data.map((item) => ({
|
||||
deviceName: item.device_name,
|
||||
roomName: item.room_name,
|
||||
categoryName: item.category_name,
|
||||
estimationCost: item.estimation_cost,
|
||||
totalKwh: item.total_kwh,
|
||||
watt: item.watt,
|
||||
duration: item.duration,
|
||||
priceKwh: item.price_kwh,
|
||||
// periode: item.periode,
|
||||
periode: this.convertToUTC7(item.periode)
|
||||
}));
|
||||
console.log(this.data_cost);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
convertToUTC7(dateString: string): string {
|
||||
const date = new Date(dateString);
|
||||
const utc7Offset = 7 * 60; // UTC+7 in minutes
|
||||
const localOffset = date.getTimezoneOffset();
|
||||
const totalOffset = utc7Offset - localOffset;
|
||||
const utc7Date = new Date(date.getTime() + totalOffset * 60 * 1000);
|
||||
return utc7Date.toISOString();
|
||||
}
|
||||
|
||||
export() {
|
||||
this.spinnerExportActive = true;
|
||||
setTimeout(() => {
|
||||
const columnsToExport = [
|
||||
"periode",
|
||||
"deviceName",
|
||||
"roomName",
|
||||
"categoryName",
|
||||
"estimationCost",
|
||||
"totalKwh",
|
||||
"watt",
|
||||
"duration",
|
||||
"priceKwh",
|
||||
];
|
||||
this.tableexcelService.exportAsExcelFileManageDetail(
|
||||
this.data_cost,
|
||||
"export_detail_cost_management",
|
||||
columnsToExport
|
||||
);
|
||||
this.spinnerExportActive = false;
|
||||
this.activeModal.close("Export completed");
|
||||
}, 3000);
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ import { ControlDeviceSeemoreComponent } from './control-device-seemore/control-
|
|||
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { HttpErrorInterceptorService } from 'src/app/interceptors/http-error-interceptor.service';
|
||||
import { ClipboardModule } from 'ngx-clipboard';
|
||||
import { ModalExportComponent } from './modal-export/modal-export.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
@ -40,7 +41,8 @@ import { ClipboardModule } from 'ngx-clipboard';
|
|||
FilterTopUsePipe,
|
||||
SurveillanceComponent,
|
||||
WaterComponent,
|
||||
ControlDeviceSeemoreComponent
|
||||
ControlDeviceSeemoreComponent,
|
||||
ModalExportComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
|
|
|
@ -6,68 +6,41 @@ import { Observable } from "rxjs";
|
|||
providedIn: "root",
|
||||
})
|
||||
export class EnergyMonitoringService {
|
||||
private readonly baseUrl = 'https://kapi.absys.ninja/hemat';
|
||||
private readonly apiKey = 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT';
|
||||
private readonly headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': this.apiKey
|
||||
});
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
private get<T>(endpoint: string, params: any = {}): Observable<T> {
|
||||
const url = `${this.baseUrl}/${endpoint}`;
|
||||
return this.http.get<T>(url, { headers: this.headers, params });
|
||||
}
|
||||
|
||||
getListRoomData(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room/list`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('room/list');
|
||||
}
|
||||
|
||||
getDashboardTopCard(building_id, floor_id, room_id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/top-card?building_id=${building_id}&floor_id=${floor_id}&room_id=${room_id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
getDashboardTopCard(buildingId: string, floorId: string, roomId: string): Observable<any> {
|
||||
return this.get<any>('dashboard/top-card', { building_id: buildingId, floor_id: floorId, room_id: roomId });
|
||||
}
|
||||
|
||||
getDashboardSummary(building_id, floor_id, room_id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/summary-cost?building_id=${building_id}&floor_id=${floor_id}&room_id=${room_id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
getDashboardSummary(buildingId: string, floorId: string, roomId: string): Observable<any> {
|
||||
return this.get<any>('dashboard/summary-cost', { building_id: buildingId, floor_id: floorId, room_id: roomId });
|
||||
}
|
||||
|
||||
// getDashboardTemperature(id): Observable<any> {
|
||||
// const url = `https://kapi.absys.ninja/hemat/dashboard/temperature-humidity?building_id=${id}`;
|
||||
// const headers = new HttpHeaders({
|
||||
// 'Content-Type': 'application/json',
|
||||
// 'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
// });
|
||||
// return this.http.get<any>(url, { headers });
|
||||
// }
|
||||
|
||||
getDashboardDeviceCategory(building_id, floor_id, room_id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/device-category-use?building_id=${building_id}&floor_id=${floor_id}&room_id=${room_id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
getDashboardChartKwhWater(building_id, floor_id, room_id): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/dashboard/chartKwhWater?building_id=${building_id}&floor_id=${floor_id}&room_id=${room_id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
getDashboardDeviceCategory(buildingId: string, floorId: string, roomId: string): Observable<any> {
|
||||
return this.get<any>('dashboard/device-category-use', { building_id: buildingId, floor_id: floorId, room_id: roomId });
|
||||
}
|
||||
|
||||
getDeviceStatus(id): Observable<any> {
|
||||
const endpoint = `devices`;
|
||||
const url = `https://kapi.absys.ninja/hemat/${endpoint}/status?id=${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
getDashboardChartKwhWater(buildingId: string, floorId: string, roomId: string): Observable<any> {
|
||||
return this.get<any>('dashboard/chartKwhWater', { building_id: buildingId, floor_id: floorId, room_id: roomId });
|
||||
}
|
||||
|
||||
getDeviceStatus(deviceId: any): Observable<any> {
|
||||
return this.get<any>('devices/status', { id: deviceId });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,131 +14,6 @@ export class MasterService {
|
|||
this.loadDataIcon = `${this.apiBaseURL}/hemat/remixicons.json`;
|
||||
}
|
||||
|
||||
getMasterListData(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-param/list`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getMasterData(page: number = 1, limit: number = 100): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-param?page=${page}&limit=${limit}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
postHeaderDetailParam(data: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-detail-param`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.post<any>(url, data, { headers });
|
||||
}
|
||||
putHeaderDetailParam(data: any, id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-detail-param/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.put<any>(url, data, { headers });
|
||||
}
|
||||
|
||||
deleteHeaderDetailParam(id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-detail-param/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.delete<any>(url, { headers });
|
||||
}
|
||||
|
||||
postMasterBuildingParam(data: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.post<any>(url, data, { headers });
|
||||
}
|
||||
|
||||
getMasterBuildingData(page: number = 1, limit: number = 100): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building?page=${page}&limit=${limit}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getBuildingList(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building/list`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
putMasterBuildingParam(data: any, id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.put<any>(url, data, { headers });
|
||||
}
|
||||
|
||||
deleteMasterBuildingParam(id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.delete<any>(url, { headers });
|
||||
}
|
||||
|
||||
postMasterRoomParam(data: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.post<any>(url, data, { headers });
|
||||
}
|
||||
|
||||
putMasterRoomParam(data: any, id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.put<any>(url, data, { headers });
|
||||
}
|
||||
|
||||
getListRoomData(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room/list`;
|
||||
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({
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT'
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getIconData(): Observable<any> {
|
||||
return this.http.get(this.loadDataIcon, httpOptions);
|
||||
}
|
||||
|
|
|
@ -2,290 +2,162 @@ import { Injectable } from "@angular/core";
|
|||
import { HttpClient, HttpHeaders } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
||||
};
|
||||
|
||||
@Injectable({
|
||||
providedIn: "root",
|
||||
})
|
||||
export class BuildingService {
|
||||
private readonly apiBaseURL = 'https://kapi.absys.ninja/hemat';
|
||||
private readonly apiKey = 'j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT';
|
||||
private readonly headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": this.apiKey,
|
||||
});
|
||||
|
||||
loadDataIcon = null;
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
private get<T>(endpoint: string, params: any = {}): Observable<T> {
|
||||
const url = `${this.apiBaseURL}/${endpoint}`;
|
||||
return this.http.get<T>(url, { headers: this.headers, params });
|
||||
}
|
||||
|
||||
private post<T>(endpoint: string, data: any): Observable<T> {
|
||||
const url = `${this.apiBaseURL}/${endpoint}`;
|
||||
return this.http.post<T>(url, data, { headers: this.headers });
|
||||
}
|
||||
|
||||
private put<T>(endpoint: string, data: any): Observable<T> {
|
||||
const url = `${this.apiBaseURL}/${endpoint}`;
|
||||
return this.http.put<T>(url, data, { headers: this.headers });
|
||||
}
|
||||
|
||||
private delete<T>(endpoint: string, params: any = {}): Observable<T> {
|
||||
const url = `${this.apiBaseURL}/${endpoint}`;
|
||||
return this.http.delete<T>(url, { headers: this.headers, params });
|
||||
}
|
||||
|
||||
postLogin(data: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/users/login`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.post<any>(url, data, { headers });
|
||||
return this.post<any>('users/login', data);
|
||||
}
|
||||
|
||||
listBuilding(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building/dashboard/list`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('building/dashboard/list');
|
||||
}
|
||||
|
||||
getBuildingData(page: number = 1, limit: number = 10): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building?page=${page}&limit=${limit}`;
|
||||
// const headers = new HttpHeaders().set('Content-Type', 'application/json');
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
getRoomByBuildingId(buildingId: string): Observable<any> {
|
||||
return this.get<any>('room-building/list/byIds', { buildingId });
|
||||
}
|
||||
|
||||
getRoomByBuildingId(buildingId: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room-building/list/byIds?buildingId=${buildingId}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
}
|
||||
|
||||
getDeviceById(deviceId: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/devices/${deviceId}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
getDeviceById(deviceId: string): Observable<any> {
|
||||
return this.get<any>(`devices/${deviceId}`);
|
||||
}
|
||||
|
||||
getMasterListData(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-param/list`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('header-param/list');
|
||||
}
|
||||
|
||||
getMasterData(page: number = 1, limit: number = 100): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-param?page=${page}&limit=${limit}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('header-param', { page, limit });
|
||||
}
|
||||
|
||||
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 });
|
||||
getMasterDataListFloor(buildingId: string): Observable<any> {
|
||||
return this.get<any>('header-detail-param/list', { headerId: 6, building_id: buildingId });
|
||||
}
|
||||
|
||||
getMasterBuildingData(
|
||||
page: number = 1,
|
||||
limit: number = 100
|
||||
): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building?page=${page}&limit=${limit}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
getMasterBuildingData(page: number = 1, limit: number = 100): Observable<any> {
|
||||
return this.get<any>('building', { page, limit });
|
||||
}
|
||||
|
||||
getBuildingList(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building/list`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('building/list');
|
||||
}
|
||||
|
||||
getListRoomData(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room/list`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('room/list');
|
||||
}
|
||||
|
||||
getListRoomDataUnmap(): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room/list/unmap`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('room/list/unmap');
|
||||
}
|
||||
|
||||
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 });
|
||||
getListFloorDataUnmap(id: any): Observable<any> {
|
||||
return this.get<any>('header-detail-param/list/unmap-room-building', { headerId: id });
|
||||
}
|
||||
|
||||
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({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('room', { page, limit });
|
||||
}
|
||||
|
||||
getCostManagement(page: number = 1, limit: number = 100): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/cost_management?page=${page}&limit=${limit}&building_id=4&periode=2024-06`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('cost_management', { page, limit, building_id: 4, periode: '2024-06' });
|
||||
}
|
||||
|
||||
postHeaderDetailParam(data: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-detail-param`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.post<any>(url, data, { headers });
|
||||
}
|
||||
putHeaderDetailParam(data: any, id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-detail-param/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.put<any>(url, data, { headers });
|
||||
return this.post<any>('header-detail-param', data);
|
||||
}
|
||||
|
||||
deleteHeaderDetailParam(id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/header-detail-param/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.delete<any>(url, { headers });
|
||||
putHeaderDetailParam(data: any, id: string): Observable<any> {
|
||||
return this.put<any>(`header-detail-param/${id}`, data);
|
||||
}
|
||||
|
||||
deleteHeaderDetailParam(id: string): Observable<any> {
|
||||
return this.delete<any>(`header-detail-param/${id}`);
|
||||
}
|
||||
|
||||
postMasterBuildingParam(data: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.post<any>(url, data, { headers });
|
||||
}
|
||||
putMasterBuildingParam(data: any, id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.put<any>(url, data, { headers });
|
||||
return this.post<any>('building', data);
|
||||
}
|
||||
|
||||
deleteMasterBuildingParam(id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/building/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.delete<any>(url, { headers });
|
||||
putMasterBuildingParam(data: any, id: string): Observable<any> {
|
||||
return this.put<any>(`building/${id}`, data);
|
||||
}
|
||||
|
||||
deleteMasterBuildingParam(id: string): Observable<any> {
|
||||
return this.delete<any>(`building/${id}`);
|
||||
}
|
||||
|
||||
postMasterRoomParam(data: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.post<any>(url, data, { headers });
|
||||
return this.post<any>('room', data);
|
||||
}
|
||||
|
||||
putMasterRoomParam(data: any, id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.put<any>(url, data, { headers });
|
||||
putMasterRoomParam(data: any, id: string): Observable<any> {
|
||||
return this.put<any>(`room/${id}`, data);
|
||||
}
|
||||
|
||||
deleteRoom(id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.delete<any>(url, { headers });
|
||||
deleteRoom(id: string): Observable<any> {
|
||||
return this.delete<any>(`room/${id}`);
|
||||
}
|
||||
|
||||
postBatchBuilding(data: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room-building/post-batch/room`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.post<any>(url, data, { headers });
|
||||
return this.post<any>('room-building/post-batch/room', data);
|
||||
}
|
||||
|
||||
getBuildingRoomList(page: number = 1, limit: number = 1000): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room-building?page=${page}&limit=${limit}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
return this.get<any>('room-building', { page, limit });
|
||||
}
|
||||
|
||||
puttBuildingRoom(data: any, id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room-building/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.put<any>(url, data, { headers });
|
||||
putBuildingRoom(data: any, id: string): Observable<any> {
|
||||
return this.put<any>(`room-building/${id}`, data);
|
||||
}
|
||||
|
||||
putDevice(data: any, id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/devices/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.put<any>(url, data, { headers });
|
||||
putDevice(data: any, id: string): Observable<any> {
|
||||
return this.put<any>(`devices/${id}`, data);
|
||||
}
|
||||
|
||||
getRoomBuildingById(roomBuildingId: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room-building/${roomBuildingId}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.get<any>(url, { headers });
|
||||
getRoomBuildingById(roomBuildingId: string): Observable<any> {
|
||||
return this.get<any>(`room-building/${roomBuildingId}`);
|
||||
}
|
||||
|
||||
deleteRoomBuilding(id: any): Observable<any> {
|
||||
const url = `https://kapi.absys.ninja/hemat/room-building/${id}`;
|
||||
const headers = new HttpHeaders({
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": "j2yaYvPSQcsEEmHh3NEobfiXyyXmmnHT",
|
||||
});
|
||||
return this.http.delete<any>(url, { headers });
|
||||
deleteRoomBuilding(id: string): Observable<any> {
|
||||
return this.delete<any>(`room-building/${id}`);
|
||||
}
|
||||
|
||||
getDevicesWithSwitchMapping(devices: any[]): any[] {
|
||||
return devices.filter((device) =>
|
||||
device.mapping.some((map: any) => map.name.includes('switch'))
|
||||
// device.mapping.some((map: any) => console.log(map))
|
||||
);
|
||||
getIconData(): Observable<any> {
|
||||
return this.http.get(this.loadDataIcon, httpOptions);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue