diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts | 90 |
1 files changed, 47 insertions, 43 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts index 2705e482..fc34cccd 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts @@ -45,7 +45,7 @@ export class FormFieldsComponent implements OnInit { fieldDefaultSQL : string; errorStackTrace : any; errorMessage : any; - defaultValue : boolean; + defaultValue : any; finalPOSTObj : any; mode : string; showSpinner : boolean; @@ -54,7 +54,7 @@ export class FormFieldsComponent implements OnInit { validateResponseString : string; showVerifySpinner : boolean; Groups : {}[] = []; - + isDefaultSql : boolean; @@ -72,36 +72,24 @@ export class FormFieldsComponent implements OnInit { this.queryObj = {}; this.showVerifySpinner = false; this.Groups = new Array(); + this.isDefaultSql = false; } - ngOnInit() { - this._formFieldsService.getListOfFormFields() - .subscribe((responseFormFields) => { - - // for(let k=0; k<responseFormFields.length; k++) - // { - // this.formFieldsListObj.push(responseFormFields[k]); - for(let m=0; m<responseFormFields.length; m++) - { - // if(responseFormFields[m]["orderSeq"] == k+1) - // { - responseFormFields[m]["orderSeq"] = m+1; - this.formFieldsListObj.push(responseFormFields[m]); - // } - } - // } + .subscribe((responseFormFields) => { + for (let m = 0; m < responseFormFields.length; m++) { + responseFormFields[m]["orderSeq"] = m + 1; + this.formFieldsListObj.push(responseFormFields[m]); + } - this._formFieldsService.getFormFieldGroupsData(this.reportId1) - .subscribe((responseGroupsData) => { - this.Groups = JSON.parse(responseGroupsData["formFieldGroupsJSON"]); - }); - + this._formFieldsService.getFormFieldGroupsData(this.reportId1) + .subscribe((responseGroupsData) => { + this.Groups = JSON.parse(responseGroupsData["formFieldGroupsJSON"]); + }); }); } - isLast( n : number) { @@ -145,6 +133,11 @@ export class FormFieldsComponent implements OnInit { this.postMoveUpwrdObj["orderSeq"] = this.orderSeqOfUp; this.postDownwardObj["orderSeq"] = this.orderSeqOfDown; + + console.log(this.postDownwardObj); + console.log(this.postMoveUpwrdObj); + this.postMoveUpwrdObj["lastUpdatedFieldId"] = this.postDownwardObj["fieldId"]; + this.postDownwardObj["lastUpdatedFieldId"] = this.postMoveUpwrdObj["fieldId"]; this._formFieldsService.postFormFieldData(this.postDownwardObj, this.reportId1) .subscribe((responsePostn) => { @@ -201,6 +194,12 @@ export class FormFieldsComponent implements OnInit { this.postMoveUpwrdObj["orderSeq"] = this.orderSeqOfUp; this.postDownwardObj["orderSeq"] = this.orderSeqOfDown; + + console.log(this.postDownwardObj); + console.log(this.postMoveUpwrdObj); + + this.postMoveUpwrdObj["lastUpdatedFieldId"] = this.postDownwardObj["fieldId"]; + this.postDownwardObj["lastUpdatedFieldId"] = this.postMoveUpwrdObj["fieldId"]; this._formFieldsService.postFormFieldData(this.postDownwardObj, this.reportId1) .subscribe((responsePostn) => { @@ -280,15 +279,19 @@ export class FormFieldsComponent implements OnInit { this.fieldDefaultSQL = responseFormFieldData["fieldDefaultSQL"]; this.errorStackTrace = responseFormFieldData["errorStackTrace"]; this.errorMessage = responseFormFieldData["errorMessage"]; - - if(this.fieldDefaultSQL !== null) - { - this.defaultValue = true; - } - else - { - this.defaultValue = false; - } + this.defaultValue = responseFormFieldData["defaultValue"] ; + if(this.fieldDefaultSQL != null || this.fieldDefaultSQL != "") + this.isDefaultSql = true; + else + this.isDefaultSql = false; + + if(this.defaultValue == null || this.defaultValue == "") + this.isDefaultSql = true; + else + this.isDefaultSql = false; + + if ((this.fieldDefaultSQL == null || this.fieldDefaultSQL == "") && (this.defaultValue == null || this.defaultValue == "")) + this.isDefaultSql = false; if(responseFormFieldData["predefinedValueList"] == null) { @@ -321,8 +324,9 @@ export class FormFieldsComponent implements OnInit { this.fieldDefaultSQL = ""; this.errorStackTrace = ""; this.errorMessage = ""; - this.defaultValue = false; + this.isDefaultSql = false; this.predefinedValueList = []; + this.defaultValue=""; this.showDialog = true; this.closable = true; @@ -391,16 +395,16 @@ export class FormFieldsComponent implements OnInit { this.finalPOSTObj["errorStackTrace"] = this.errorStackTrace; this.finalPOSTObj["errorMessage"] = this.errorMessage; - this.finalPOSTObj["defaultValue"] = this.defaultValue; + this.finalPOSTObj["lastUpdatedFieldId"] = this.fieldId; - if( this.defaultValue === false) - { - this.finalPOSTObj["fieldDefaultSQL"] = null; - } - else - { - this.finalPOSTObj["fieldDefaultSQL"] = this.fieldDefaultSQL; - } + this.finalPOSTObj["fieldDefaultSQL"] = this.fieldDefaultSQL; + + this.finalPOSTObj["defaultValue"] = this.defaultValue; + + if(this.fieldDefaultSQL != "" && this.fieldDefaultSQL != null) + { + this.finalPOSTObj["defaultValue"] = ""; + } this.finalPOSTObj["predefinedValueList"] = this.predefinedValueList; |