integrasi edit device, penyesuaian UI jadi vertical dan penambahan UI list monitoring

This commit is contained in:
Fuzi_fauzia 2024-05-31 17:21:39 +07:00
parent b2c1020c22
commit a6c77fe052
23 changed files with 1512 additions and 866 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
export const ThemeSettingsConfig = {
colorTheme: 'semi-dark', // light, semi-light, semi-dark, dark
layout: {
style: 'horizontal', // style: 'vertical', horizontal,
style: 'vertical', // style: 'vertical', horizontal,
pattern: 'fixed' // fixed, boxed, static
},
menuColor: 'menu-dark', // Vertical: [menu-dark, menu-light] , Horizontal: [navbar-dark, navbar-light]

View File

@ -52,6 +52,10 @@ const appRoutes: Routes = [
path: 'monitoring', loadChildren: () => import('../app/content/hemat-app/monitoring/monitoring.module').then(m => m.MonitoringModule)
, canActivate: [AuthGuard]
},
{
path: 'list-monitoring', loadChildren: () => import('../app/content/hemat-app/list-monitoring/list-monitoring.module').then(m => m.ListMonitoringModule)
, canActivate: [AuthGuard]
},
{
path: 'device', loadChildren: () => import('../app/content/hemat-app/device/device.module').then(m => m.DeviceModule)
, canActivate: [AuthGuard]

View File

@ -55,24 +55,24 @@
</div>
<div class="col-md-6">
<div class="form-group">
<label for="projectinput5">Duration Use *</label>
<label for="categoryId">Category *</label>
<div class="input-group">
<select
id="projectinput5"
id="categoryId"
class="form-control"
formControlName="interestedIn"
formControlName="categoryId"
[ngClass]="{
'is-invalid': submitted && f.interestedIn.errors
'is-invalid': submitted && f.categoryId.errors
}"
>
<option
*ngFor="let interest of interestedIn"
[value]="interest"
*ngFor="let data of dataMasterCategori"
[value]="data.id"
>
{{ interest }}
{{ data.name }}
</option>
</select>
<div class="input-group-append">
<div class="input-group-append" *ngIf="mode === 'edit'">
<button
type="button"
class="btn btn-primary"
@ -84,11 +84,11 @@
</div>
<small
class="form-text text-muted danger"
*ngIf="submitted && f.interestedIn.errors"
*ngIf="submitted && f.categoryId.errors"
class="invalid-feedback"
>
<div *ngIf="f.interestedIn.errors.required">
Interest is required
<div *ngIf="f.categoryId.errors.required">
Category is required
</div>
</small>
</div>
@ -97,24 +97,24 @@
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="projectinput5">Category *</label>
<label for="voltageId">Voltage *</label>
<div class="input-group">
<select
id="projectinput5"
id="voltageId"
class="form-control"
formControlName="interestedIn"
formControlName="voltageId"
[ngClass]="{
'is-invalid': submitted && f.interestedIn.errors
'is-invalid': submitted && f.voltageId.errors
}"
>
<option
*ngFor="let interest of interestedIn"
[value]="interest"
*ngFor="let data of dataMasterVoltage"
[value]="data.id"
>
{{ interest }}
{{ data.name }}
</option>
</select>
<div class="input-group-append">
<div class="input-group-append" *ngIf="mode === 'edit'">
<button
type="button"
class="btn btn-primary"
@ -126,40 +126,40 @@
</div>
<small
class="form-text text-muted danger"
*ngIf="submitted && f.interestedIn.errors"
*ngIf="submitted && f.voltageId.errors"
class="invalid-feedback"
>
<div *ngIf="f.interestedIn.errors.required">
Interest is required
<div *ngIf="f.voltageId.errors.required">
Voltage is required
</div>
</small>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="projectinput5">Selection Option *</label>
<label for="typeId">Type *</label>
<select
id="projectinput5"
id="typeId"
class="form-control"
formControlName="interestedIn"
formControlName="typeId"
[ngClass]="{
'is-invalid': submitted && f.interestedIn.errors
'is-invalid': submitted && f.typeId.errors
}"
>
<option
*ngFor="let interest of interestedIn"
[value]="interest"
*ngFor="let data of dataMasterType"
[value]="data.id"
>
{{ interest }}
{{ data.name }}
</option>
</select>
<small
class="form-text text-muted danger"
*ngIf="submitted && f.interestedIn.errors"
*ngIf="submitted && f.typeId.errors"
class="invalid-feedback"
>
<div *ngIf="f.interestedIn.errors.required">
Interest is required
<div *ngIf="f.typeId.errors.required">
Type is required
</div>
</small>
</div>
@ -168,58 +168,58 @@
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="projectinput5">Location *</label>
<label for="durationId">Duration Use *</label>
<select
id="projectinput5"
id="durationId"
class="form-control"
formControlName="interestedIn"
formControlName="durationId"
[ngClass]="{
'is-invalid': submitted && f.interestedIn.errors
'is-invalid': submitted && f.durationId.errors
}"
>
<option
*ngFor="let interest of interestedIn"
[value]="interest"
*ngFor="let data of dataMasterDuration"
[value]="data.id"
>
{{ interest }}
{{ data.name }}
</option>
</select>
<small
class="form-text text-muted danger"
*ngIf="submitted && f.interestedIn.errors"
*ngIf="submitted && f.durationId.errors"
class="invalid-feedback"
>
<div *ngIf="f.interestedIn.errors.required">
Interest is required
<div *ngIf="f.durationId.errors.required">
Duration is required
</div>
</small>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="projectinput5">Status *</label>
<label for="statusId">Status *</label>
<select
id="projectinput5"
id="statusId"
class="form-control"
formControlName="interestedIn"
formControlName="statusId"
[ngClass]="{
'is-invalid': submitted && f.interestedIn.errors
'is-invalid': submitted && f.statusId.errors
}"
>
<option
*ngFor="let interest of interestedIn"
[value]="interest"
*ngFor="let data of dataMasterStatus"
[value]="data.id"
>
{{ interest }}
{{ data.name }}
</option>
</select>
<small
class="form-text text-muted danger"
*ngIf="submitted && f.interestedIn.errors"
*ngIf="submitted && f.statusId.errors"
class="invalid-feedback"
>
<div *ngIf="f.interestedIn.errors.required">
Interest is required
<div *ngIf="f.statusId.errors.required">
Status is required
</div>
</small>
</div>
@ -228,65 +228,60 @@
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="projectinput5">Location Room *</label>
<label for="roomBuildingId">Location Room *</label>
<select
id="projectinput5"
id="roomBuildingId"
class="form-control"
formControlName="interestedIn"
formControlName="roomBuildingId"
[ngClass]="{
'is-invalid': submitted && f.interestedIn.errors
'is-invalid': submitted && f.roomBuildingId.errors
}"
>
<option
*ngFor="let interest of interestedIn"
[value]="interest"
*ngFor="let data of dataBuildingRoomList"
[value]="data.id"
>
{{ interest }}
{{ data.name }}
</option>
</select>
<small
class="form-text text-muted danger"
*ngIf="submitted && f.interestedIn.errors"
*ngIf="submitted && f.roomBuildingId.errors"
class="invalid-feedback"
>
<div *ngIf="f.interestedIn.errors.required">
Interest is required
<div *ngIf="f.roomBuildingId.errors.required">
location room is required
</div>
</small>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="projectinput5">Type *</label>
<select
id="projectinput5"
<label for="watt">Watt *</label>
<input
type="text"
id="watt"
class="form-control"
formControlName="interestedIn"
formControlName="watt"
placeholder="Watt"
[ngClass]="{
'is-invalid': submitted && f.interestedIn.errors
'is-invalid': submitted && f.watt.errors
}"
>
<option
*ngFor="let interest of interestedIn"
[value]="interest"
>
{{ interest }}
</option>
</select>
/>
<small
class="form-text text-muted danger"
*ngIf="submitted && f.interestedIn.errors"
*ngIf="submitted && f.watt.errors"
class="invalid-feedback"
>
<div *ngIf="f.interestedIn.errors.required">
Interest is required
<div *ngIf="f.watt.errors.required">
watt is required
</div>
</small>
</div>
</div>
</div>
<h4 class="form-section">
<!-- <h4 class="form-section">
<i class="la la-paperclip"></i> Energy Information
</h4>
@ -316,7 +311,7 @@
Interest is required
</div>
</small>
</div>
</div> -->
</div>
<div class="form-actions">
<button
@ -324,9 +319,9 @@
class="btn btn-warning mr-1"
(click)="cancel()"
>
<i class="feather ft-x"></i> Cancel
<i class="feather ft-x"></i> {{mode === 'edit' ? 'Cancel' : 'Back'}}
</button>
<button type="submit" class="btn btn-primary" (click)="saveEdit()">
<button type="submit" class="btn btn-primary" (click)="saveEdit()" *ngIf="mode === 'edit'">
<i class="la la-check"></i> Save
</button>
</div>

View File

@ -11,47 +11,26 @@ import { BuildingService } from "../../service/monitoring-api.service";
})
export class AddEditDeviceComponent implements OnInit{
@ViewChild("f", { read: true }) userProfileForm: NgForm;
dataMasterCategori: any;
dataMasterVoltage: any;
dataMasterType: any;
dataMasterDuration: any;
dataMasterStatus: any;
dataBuildingRoomList: any;
deviceId: any;
model: any = {};
dataDevice: any;
mode: string;
@BlockUI("projectInfo") blockUIProjectInfo: NgBlockUI;
@BlockUI("userProfile") blockUIUserProfile: NgBlockUI;
options = {
minimize: true,
reload: true,
expand: true,
close: true,
};
public breadcrumb: any;
projectInfo: FormGroup;
submitted = false;
interestedIn = [
"design",
"development",
"illustration",
"branding",
"video",
"design",
"development",
"illustration",
"branding",
"video",
];
budget = [
"less than 5000$",
"5000$ - 10000$",
"10000$ - 20000$",
"more than 20000$",
];
priority = ["Low", "Medium", "High"];
status = ["Not Started", "Started", "Fixed"];
constructor(
private formBuilder: FormBuilder,
private router: Router,
@ -60,28 +39,29 @@ export class AddEditDeviceComponent implements OnInit{
) {}
ngOnInit() {
this.route.data.subscribe((data) => {
this.mode = data.mode;
});
this.route.params.subscribe(params => {
const deviceId = params['id'];
if (deviceId) {
this.loadDevice(deviceId);
const id = params['id'];
this.deviceId = id;
if (id) {
this.loadDevice(id);
this.dataListMaster();
this.dataListRoomBuilding();
}
});
this.setBreadcrumb()
this.route.data.subscribe((data) => {
this.mode = data.mode;
});
this.projectInfo = this.formBuilder.group({
name: ["", Validators.required],
lastName: ["", Validators.required],
email: ["", [Validators.required, Validators.email]],
phone: ["", Validators.required],
company: ["", Validators.required],
interestedIn: ["", Validators.required],
budget: ["", Validators.required],
selectFile: [, Validators.required],
aboutProject: ["", Validators.required],
categoryId: ["", Validators.required],
voltageId: ["", Validators.required],
typeId: ["", Validators.required],
durationId: ["", Validators.required],
statusId: ["", Validators.required],
roomBuildingId: ["", Validators.required],
watt: ["", Validators.required],
});
}
@ -92,11 +72,70 @@ export class AddEditDeviceComponent implements OnInit{
});
}
dataListMaster() {
this.monitoringApiService.getMasterListData().subscribe(data => {
const dataCategory = data.data.find(
(item) => item.name === "master_category"
).headerDetailParam;
this.dataMasterCategori = dataCategory.filter(item => item.status === "2")
const dataVoltage = data.data.find(
(item) => item.name === "master_voltage"
).headerDetailParam;
this.dataMasterVoltage = dataVoltage.filter(item => item.status === "2")
const dataType = data.data.find(
(item) => item.name === "master_type"
).headerDetailParam;
this.dataMasterType = dataType.filter(item => item.status === "2")
const dataDuration = data.data.find(
(item) => item.name === "master_duration"
).headerDetailParam;
this.dataMasterDuration = dataDuration.filter(item => item.status === "2")
const dataStatus = data.data.find(
(item) => item.name === "master_status"
).headerDetailParam;
this.dataMasterStatus = dataStatus.filter(item => item.status === "2")
});
}
dataListRoomBuilding() {
this.monitoringApiService.getBuildingRoomList().subscribe(data => {
const newArray = data.results.data.map(item => ({
id: item.id,
name: `${item.buildingEntity.name} (${item.roomEntity.name})`
}));
this.dataBuildingRoomList = newArray
});
}
formGetDevice(data){
console.log(data);
this.projectInfo.patchValue({
name: data.data.name,
categoryId: data.data.categoryId,
voltageId: data.data.voltageId,
typeId: data.data.typeId,
durationId: data.data.durationId,
statusId: data.data.statusId,
roomBuildingId: data.data.roomBuildingId,
watt: data.data.watt
});
if (this.mode === 'view') {
this.formDisable();
}
}
formDisable(){
this.projectInfo.get('name').disable()
this.projectInfo.get('categoryId').disable()
this.projectInfo.get('voltageId').disable()
this.projectInfo.get('typeId').disable()
this.projectInfo.get('durationId').disable()
this.projectInfo.get('statusId').disable()
this.projectInfo.get('roomBuildingId').disable()
this.projectInfo.get('watt').disable()
}
setBreadcrumb() {
@ -189,7 +228,9 @@ export class AddEditDeviceComponent implements OnInit{
}
saveEdit() {
this.monitoringApiService.putDevice(this.projectInfo.value, this.deviceId).subscribe(data => {
this.router.navigate(["/device"]);
});
}
cancel() {

View File

@ -0,0 +1,190 @@
: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: #545454;
font-weight: bold;
color: white;
}
:host ::ng-deep .ngx-datatable.bootstrap .datatable-footer {
background: #727e8e;
color: #ededed;
margin-top: -1px;
overflow: inherit;
}
:host ::ng-deep .ngx-datatable.bootstrap .datatable-header {
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 .block-ui-wrapper {
background: rgba(255, 249, 249, 0.5) !important;
}
:host ::ng-deep .ngx-datatable .datatable-footer .selected-count .datatable-pager {
flex: 0 0 0%;
}
:host ::ng-deep .ngx-datatable {
display: -webkit-box;
}

View File

@ -0,0 +1,192 @@
<div class="app-content content">
<div class="content-wrapper">
<div class="content-header row mb-1">
<app-breadcrumb class="col-12" [breadcrumb]="breadcrumb"></app-breadcrumb>
</div>
<div class="content-body">
<section id="configuration">
<div class="row">
<div
class="col-12"
*blockUI="'zeroConfiguration'; message: 'Loading'"
>
<m-card>
<ng-container mCardHeaderTitle>
Cost Management Table
</ng-container>
<ng-container mCardBody>
<div class="row mb-2">
<div class="col-md-6">
<input
type="text"
class="form-control"
placeholder="Search..."
[(ngModel)]="searchTerm"
(input)="filterRows()"
(touchstart)="onTouchStart($event)"
/>
</div>
<div class="col-md-6 text-right">
<button
class="btn btn-secondary"
[routerLink]="['/cost-management/add-row']"
>
<i class="feather ft-plus"></i>&nbsp; Add new data
</button>
</div>
</div>
<div class="card-dashboard">
<ngx-datatable
class="bootstrap table-bordered"
[limit]="10"
[rows]="filteredRows"
[columnMode]="'force'"
[headerHeight]="50"
[footerHeight]="50"
[rowHeight]="50"
fxFlex="auto"
[scrollbarH]="true"
>
<ngx-datatable-column
name="#"
[flexGrow]="1"
[minWidth]="10"
>
<ng-template
ngx-datatable-cell-template
let-rowIndex="rowIndex"
>
{{ rowIndex + 1 }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column
name="Name"
[flexGrow]="1"
[minWidth]="90"
>
<ng-template ngx-datatable-header-template>
<span>Estimasi Cost Name</span>
</ng-template>
<ng-template
let-value="value"
ngx-datatable-cell-template
>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column
name="Position"
[flexGrow]="1"
[minWidth]="90"
>
<ng-template ngx-datatable-header-template>
<span>Category</span>
</ng-template>
<ng-template
ngx-datatable-cell-template
let-value="value"
>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column
name="Office"
[flexGrow]="1"
[minWidth]="90"
>
<ng-template ngx-datatable-header-template>
<span>Location</span>
</ng-template>
<ng-template
ngx-datatable-cell-template
let-value="value"
>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column
name="Age"
[flexGrow]="1"
[minWidth]="40"
>
<ng-template ngx-datatable-header-template>
<span>Location Room</span>
</ng-template>
<ng-template
ngx-datatable-cell-template
let-value="value"
>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column
name="Startdate"
[flexGrow]="1"
[minWidth]="90"
>
<ng-template ngx-datatable-header-template>
<span>Duration Use</span>
</ng-template>
<ng-template
ngx-datatable-cell-template
let-value="value"
>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column
name="Salary"
[flexGrow]="1"
[minWidth]="90"
>
<ng-template ngx-datatable-header-template>
<span>Status</span>
</ng-template>
<ng-template
ngx-datatable-cell-template
let-value="value"
>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column
name="Actions"
[flexGrow]="1"
[minWidth]="150"
>
<ng-template
ngx-datatable-cell-template
let-rowIndex="rowIndex"
let-row="row"
>
<button
class="btn btn-sm btn-info mr-1"
(click)="viewRow(row)"
>
<i class="ficon feather ft-eye"></i>
</button>
<button
class="btn btn-sm btn-warning mr-1"
(click)="editRow(row)"
>
<i class="ficon feather ft-edit"></i>
</button>
<button
class="btn btn-sm btn-danger"
(click)="deleteRow(row)"
>
<i class="ficon feather ft-trash-2"></i>
</button>
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
</div>
</ng-container>
</m-card>
</div>
</div>
</section>
</div>
</div>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ListMonitoringComponent } from './list-monitoring.component';
describe('ListMonitoringComponent', () => {
let component: ListMonitoringComponent;
let fixture: ComponentFixture<ListMonitoringComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ListMonitoringComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ListMonitoringComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,82 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { TableApiService } from 'src/app/_services/table-api.service';
@Component({
selector: 'app-list-monitoring',
templateUrl: './list-monitoring.component.html',
styleUrls: ['./list-monitoring.component.css']
})
export class ListMonitoringComponent {
public breadcrumb: any;
data: any;
filteredRows: any[];
searchTerm: string = "";
rows: any = [];
constructor(
private tableApiservice: TableApiService,
private router: Router
) {}
ngOnInit() {
this.breadcrumb = {
mainlabel: "Cost Management",
links: [
{
name: "Home",
isLink: false,
},
{
name: "Cost Management",
isLink: false,
},
],
};
this.fetchData();
}
fetchData() {
this.tableApiservice.getTableInitialisationData().subscribe((response) => {
this.data = response;
this.filteredRows = this.data.rows;
});
}
filterRows() {
if (!this.searchTerm) {
this.filteredRows = [...this.data.rows];
} else {
this.filteredRows = this.data.rows.filter((row) =>
this.rowContainsSearchTerm(row)
);
}
}
rowContainsSearchTerm(row: any): boolean {
const searchTermLC = this.searchTerm.toLowerCase();
return Object.values(row).some(
(value) =>
value !== null &&
value.toString().toLowerCase().includes(searchTermLC)
);
}
viewRow(row) {
console.log("View row:", row);
this.router.navigate(["/cost-management/view", row.name]);
}
editRow(row) {
console.log("Edit row:", row);
this.router.navigate(["/cost-management/edit", row.name]);
}
deleteRow(row) {
console.log("Delete row:", row);
}
onTouchStart(event: Event) {
event.preventDefault(); // Add this if necessary
}
}

View File

@ -0,0 +1,44 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { NgSelectModule } from '@ng-select/ng-select';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ClipboardModule } from 'ngx-clipboard';
import { CardModule } from '../../partials/general/card/card.module';
import { BreadcrumbModule } from 'src/app/_layout/breadcrumb/breadcrumb.module';
import { BlockUIModule } from 'ng-block-ui';
import { BlockTemplateComponent } from '../../../_layout/blockui/block-template.component';
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
import { ListMonitoringComponent } from './list-monitoring.component';
@NgModule({
declarations: [
ListMonitoringComponent
],
imports: [
CommonModule,
CardModule,
BreadcrumbModule,
NgSelectModule,
FormsModule,
ReactiveFormsModule,
ClipboardModule,
PerfectScrollbarModule,
NgxDatatableModule,
BlockUIModule.forRoot({
template: BlockTemplateComponent
}),
RouterModule.forChild([
{
path: '',
component: ListMonitoringComponent
},
])
]
})
export class ListMonitoringModule { }

View File

@ -23,8 +23,9 @@
class="form-control"
formControlName="status"
>
<option value="1">Aktif</option>
<option value="0">Tidak Aktif</option>
<option *ngFor="let data of dataMasterStatus" [value]="data.id">
{{ data.name }}
</option>
</select>
</div>
</div>

View File

@ -1,25 +1,29 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { Component, Input, OnInit } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
import { BuildingService } from "../../service/monitoring-api.service";
@Component({
selector: 'app-add-edit-master',
templateUrl: './add-edit-master.component.html',
styleUrls: ['./add-edit-master.component.css']
selector: "app-add-edit-master",
templateUrl: "./add-edit-master.component.html",
styleUrls: ["./add-edit-master.component.css"],
})
export class AddEditMasterComponent implements OnInit {
@Input() headerId: number;
@Input() dataRow: any;
@Input() mode: any;
myForm: FormGroup;
dataMasterStatus: any;
constructor(public activeModal: NgbActiveModal, private fb: FormBuilder) {}
constructor(
public activeModal: NgbActiveModal,
private fb: FormBuilder,
private monitoringApiService: BuildingService
) {}
ngOnInit() {
this.createForm();
console.log(this.dataRow);
console.log(this.headerId);
console.log(this.mode);
this.dataListMaster();
if (this.dataRow) {
this.editForm();
}
@ -27,9 +31,9 @@ export class AddEditMasterComponent implements OnInit{
createForm() {
this.myForm = this.fb.group({
name: ['', Validators.required],
status: ['', Validators.required],
headerId: this.headerId
name: ["", Validators.required],
status: [2, Validators.required],
headerId: this.headerId,
});
}
@ -38,7 +42,16 @@ export class AddEditMasterComponent implements OnInit{
id: this.dataRow.id,
name: this.dataRow.name,
status: this.dataRow.status,
headerId: this.dataRow.headerId
headerId: this.dataRow.headerId,
});
}
dataListMaster() {
this.monitoringApiService.getMasterListData().subscribe((data) => {
const dataCategory = data.data.find(
(item) => item.name === "master_status"
).headerDetailParam;
this.dataMasterStatus = dataCategory.filter(item => item.status === "2");
});
}

View File

@ -86,7 +86,7 @@
ngx-datatable-cell-template
let-value="value"
>
{{ value === '1' ? 'Aktif' : 'Tidak Aktif'}}
{{ value === '2' ? 'Aktif' : 'Tidak Aktif'}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column

View File

@ -86,7 +86,7 @@
ngx-datatable-cell-template
let-value="value"
>
{{ value === '1' ? 'Aktif' : 'Tidak Aktif'}}
{{ value === '2' ? 'Aktif' : 'Tidak Aktif'}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column

View File

@ -86,7 +86,7 @@
ngx-datatable-cell-template
let-value="value"
>
{{ value === '1' ? 'Aktif' : 'Tidak Aktif'}}
{{ value === '2' ? 'Aktif' : 'Tidak Aktif'}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column

View File

@ -86,7 +86,7 @@
ngx-datatable-cell-template
let-value="value"
>
{{ value === '1' ? 'Aktif' : 'Tidak Aktif'}}
{{ value === '2' ? 'Aktif' : 'Tidak Aktif'}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column

View File

@ -86,7 +86,7 @@
ngx-datatable-cell-template
let-value="value"
>
{{ value === '1' ? 'Aktif' : 'Tidak Aktif'}}
{{ value === '2' ? 'Aktif' : 'Tidak Aktif'}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column

View File

@ -86,7 +86,7 @@
ngx-datatable-cell-template
let-value="value"
>
{{ value === '1' ? 'Aktif' : 'Tidak Aktif'}}
{{ value === '2' ? 'Aktif' : 'Tidak Aktif'}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column

View File

@ -86,7 +86,7 @@
ngx-datatable-cell-template
let-value="value"
>
{{ value === '1' ? 'Aktif' : 'Tidak Aktif'}}
{{ value === '2' ? 'Aktif' : 'Tidak Aktif'}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column

View File

@ -16,12 +16,12 @@
/>
</div>
<div class="col-md-6 text-right">
<button
<!-- <button
class="btn btn-secondary"
[routerLink]="['/monitoring/add-new-building']"
>
<i class="feather ft-plus"></i>&nbsp; Add new building
</button>
</button> -->
</div>
</div>
<div class="row mt-2">

View File

@ -81,6 +81,15 @@ export class BuildingService {
return this.http.get<any>(url, { headers });
}
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({
@ -194,4 +203,22 @@ export class BuildingService {
});
return this.http.post<any>(url, data, { headers });
}
getBuildingRoomList(page: number = 1, limit: number = 100): 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 });
}
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 });
}
}

View File

@ -16,7 +16,7 @@ html {
width: 100%;
body {
height: 900px;
height: 100%;
&.fixed-navbar {
padding-top: $navbar-height;