blob: d92ce320ed573bd033544581a7da513d4c851c66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { RdpDataTableService } from '../../shared/rdp-data-table.service';
@Component({
selector: 'rdp-rdp-data-table-edit',
templateUrl: './rdp-data-table-edit.component.html',
styleUrls: ['./rdp-data-table-edit.component.scss']
})
export class RdpDataTableEditComponent implements OnInit {
@Input() settings: any;
@Input() rowdata: any;
@Input() isEditMode: boolean;
@Input() applicationService: any;
@Output() passEntry: EventEmitter<any> = new EventEmitter();
modalPopupTitle: string;
selectedRowData: any;
public columnsInfoList = [];
constructor(public activeModal: NgbActiveModal, public rdpDataTableService: RdpDataTableService) { }
ngOnInit() {
this.modalPopupTitle = "Edit";
if (this.rowdata) {
this.selectedRowData = JSON.stringify(this.rowdata);
}
if (this.settings) {
if (this.settings.modalPopupTitle) {
this.modalPopupTitle = this.settings.modalPopupTitle;
}
for (var index in this.settings.columns) {
this.columnsInfoList.push(this.settings.columns[index]);
}
}
}
saveChanges() {
this.applicationService.update(this.rowdata);
this.applicationService.statusResponse.subscribe(responseData => {
if (responseData == "200") {
console.log("Success")
this.applicationService.get();
this.applicationService.updatedData.subscribe(val => {
if (val) {
this.passEntry.emit(val);
}
})
}
})
this.activeModal.close();
}
columnDataChanged($event, columnTitle) {
this.rowdata[columnTitle] = $event;
}
}
|