diff options
author | Rachitha Ramappa <rachitha.ramappa@att.com> | 2020-03-27 10:55:45 +0530 |
---|---|---|
committer | Rachitha Ramappa <rachitha.ramappa@att.com> | 2020-03-27 11:06:41 +0530 |
commit | 13758cf841eda6ab5c2c7b7ffa204ee42f298644 (patch) | |
tree | 861de6ce63dc7f318b52d6e8b1061829f22cc89e /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 | |
parent | 7d3ad2425c0a774179ddb522e741d977c3bcf992 (diff) |
Menu mandatory field, add/update fixes
Change-Id: I238d9ba1ae20210bd305461ebc2fd6180ee9940d
Issue-ID: PORTAL-864
Signed-off-by: rachitha.ramappa@att.com
Diffstat (limited to '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')
-rw-r--r-- | 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 | 53 |
1 files changed, 40 insertions, 13 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 d92ce320..5437c174 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 @@ -1,6 +1,8 @@ import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { RdpDataTableService } from '../../shared/rdp-data-table.service'; +import { RdpModalService } from '../../services/rdp-modal.service'; +import { RdpInformationModelComponent } from '../../rdp-information-model/rdp-information-model.component'; @Component({ selector: 'rdp-rdp-data-table-edit', @@ -18,7 +20,10 @@ export class RdpDataTableEditComponent implements OnInit { selectedRowData: any; public columnsInfoList = []; - constructor(public activeModal: NgbActiveModal, public rdpDataTableService: RdpDataTableService) { } + constructor( + public activeModal: NgbActiveModal, + public rdpDataTableService: RdpDataTableService, + private rdpModal: RdpModalService) { } ngOnInit() { this.modalPopupTitle = "Edit"; @@ -36,19 +41,41 @@ export class RdpDataTableEditComponent implements OnInit { } 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); - } - }) + let validationResult = this.validateRowData(this.rowdata); + if (validationResult) { + console.log("Validation is complete") + 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(); + } + } + + validateRowData(rowData): any { + let columnData = this.settings.columns; + let validate: boolean = true; + for (let column of columnData) { + if (column.isMandatory) { + if (rowData[column.title] == undefined || rowData[column.title] == null + || rowData[column.title] == "") { + const modelRef = this.rdpModal.open(RdpInformationModelComponent, { size: 'lg' }); + modelRef.componentInstance.title = 'Missing Mandatory Field'; + modelRef.componentInstance.message = "Please fill mandatory field " + column.dispalyTitle; + validate = false; + break; + } } - }) - this.activeModal.close(); + } + return validate; } columnDataChanged($event, columnTitle) { |