diff options
Diffstat (limited to 'ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib')
3 files changed, 38 insertions, 30 deletions
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts index ede8aa25..d92ce320 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts @@ -12,6 +12,7 @@ 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; @@ -35,7 +36,18 @@ export class RdpDataTableEditComponent implements OnInit { } saveChanges() { - this.passEntry.emit(this.rowdata); + 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(); } diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html index a87a7b70..4f98abd5 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html @@ -8,6 +8,7 @@ <i class="icon ion-md-person-add"></i> Add </button> </div> + <span class="rdp-spinner" *ngIf="showSpinner"></span> <!-- <rdp-scroll-container [more]="hasMore()" [scrollOffset]="2500" [scrollDelay]="3000" (scrolled)="handleScroll($event)" [class.full]="full" [class.part]="!full"> --> <table mat-table #table [dataSource]="dataSource" style="width: 100%" matSort> diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts index 7187ca07..b833c6fb 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts @@ -77,7 +77,7 @@ export class RdpDataTableComponent<T> implements OnChanges, AfterViewInit, OnIni showAddButton: boolean = true; result : any; totalRowsCount: any; - + showSpinner: boolean; constructor(public dataTableService: RdpDataTableService, private rdpModal: RdpModalService) { } @@ -221,36 +221,31 @@ export class RdpDataTableComponent<T> implements OnChanges, AfterViewInit, OnIni * @param rowData */ openEditModalPopup(rowData: any) { + this.showSpinner = true; + console.log("Row data : ", rowData); this.cloneObject = Object.assign({}, rowData) - console.log("Copied Object : ", this.cloneObject); - if (this.cloneObject) { - const modalRef = this.rdpModal.open(RdpDataTableEditComponent, { size: 'lg' }); - modalRef.componentInstance.title = 'Edit'; - modalRef.componentInstance.settings = this.settings; - if (this.cloneObject != 'undefined' && this.cloneObject) { - modalRef.componentInstance.rowdata = this.cloneObject; - modalRef.componentInstance.isEditMode = true; - this.isEditMode = true; - } else { - modalRef.componentInstance.rowdata = {}; - modalRef.componentInstance.isEditMode = false; - this.isEditMode = false; - } - modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => { - if (receivedEntry) { - console.log("Original Object : ", rowData); - let response = this.updateRow(receivedEntry); - console.log("Response form application ",response); - console.log("Entry : ",receivedEntry); - rowData = receivedEntry; - if(this.dataTableService.response == "Success"){ - console.log("Result is success, update the tabel"); - this.columnsInfoList.push(receivedEntry); - console.log("Updtae column info list : ", this.columnsInfoList); - } - } - }); + console.log("Update or Add functionality intialized"); + const modalRef = this.rdpModal.open(RdpDataTableEditComponent, { size: 'lg' }); + modalRef.componentInstance.title = 'Edit'; + modalRef.componentInstance.settings = this.settings; + if (this.cloneObject.data != 'undefined' && this.cloneObject) { + modalRef.componentInstance.rowdata = this.cloneObject; + modalRef.componentInstance.applicationService = this.applicationService; + modalRef.componentInstance.isEditMode = true; + this.isEditMode = true; + } else { + modalRef.componentInstance.rowdata = {}; + modalRef.componentInstance.isEditMode = false; + this.isEditMode = false; } + modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => { + if (receivedEntry) { + this.data = receivedEntry; + this.setData(this.data); + } + this.showSpinner = false; + }); + } handleScroll = (scrolled: boolean) => { |