integrasi edit device, penyesuaian UI jadi vertical dan penambahan UI list monitoring
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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{
|
||||
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,18 +31,27 @@ 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,
|
||||
});
|
||||
}
|
||||
|
||||
editForm(){
|
||||
editForm() {
|
||||
this.myForm = this.fb.group({
|
||||
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");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user