diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.ts')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.ts | 1036 |
1 files changed, 535 insertions, 501 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.ts index 58f3e45c..ccd6dbcb 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.ts @@ -1,528 +1,562 @@ -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; -import { DefinitionSaveDialogComponent } from './definition-save-dialog/definition-save-dialog.component'; -import {ActivatedRoute} from "@angular/router"; -import { environment } from '../../../../../../environments/environment'; -import { DefinitionService } from './definition.service'; +import {Component, OnInit, Input, Output, EventEmitter, OnDestroy} from '@angular/core'; +import {HttpClient, HttpHeaders} from '@angular/common/http'; +import {NgbModal} from '@ng-bootstrap/ng-bootstrap'; +import {DefinitionSaveDialogComponent} from './definition-save-dialog/definition-save-dialog.component'; +import {ActivatedRoute, Router} from '@angular/router'; +import {environment} from '../../../../../../environments/environment'; +import {DefinitionService} from './definition.service'; import {CdkDragDrop, moveItemInArray, transferArrayItem} from '@angular/cdk/drag-drop'; +import {isInteger, toInteger} from '@ng-bootstrap/ng-bootstrap/util/util'; @Component({ - selector: 'app-definition', - templateUrl: './definition.component.html', - styleUrls: ['./definition.component.css'], - providers: [ NgbModal] + selector: 'app-definition', + templateUrl: './definition.component.html', + styleUrls: ['./definition.component.css'], + providers: [NgbModal] }) -export class DefinitionComponent implements OnInit { - - - - - showSpinner : boolean; - - @Input() closable = true; - - @Input("reportId") reportId1 : string; - @Input ("reportMode") reportMode : string; - - - finalPostObj = {}; - finalGetObj = {}; - - isEdit : boolean; - reportId : number; - reportName : string; - reportDescription : string; - reportType : string; - dataSrc : string; - helpText : string; - reportDefinition : string; - pageSize : number; - hideFormFields : boolean; - maxRows : number; - colsFrozen : number; - gridAlign : string; - emptyMessage : string; - heightContainer : number; - widthContainer : number; - allowScheduler : boolean; - sizedByContent : boolean; - hideFormFields1 : boolean; - hideChart : boolean; - hideReportData : boolean; - hideExcel : boolean; - hidePDF : boolean; - disableColumnSort : boolean; - runTimeFormNum : number; - reportTitle : string; - reportSubTitle : string; - oneTime : boolean; - hourly : boolean; - daily : boolean; - MonFri : boolean; - Weekly : boolean; - Monthly : boolean; - - oneTime1 : boolean; - hourly1 : boolean; - daily1 : boolean; - MonFri1 : boolean; - Weekly1 : boolean; - Monthly1 : boolean; - - displayArea : string; - definitionPostResponse1 : any; - - definitionPostResponse : any; - - showDialog : boolean; - status : string; - message : string; - dashboardObj : any; - dashboardLayoutHTML : any; - - pilotModalComponent : DefinitionSaveDialogComponent; - - IncomingReportId : number; - displayOptionsArr : {}[] = []; - - constructor(private _http : HttpClient, private _route : ActivatedRoute, private _definitionService : DefinitionService) { - this.showSpinner = true; - this.IncomingReportId = -1; - this.dashboardObj = []; - this.dashboardLayoutHTML = ""; - } - - - ngOnInit() { - this.isEdit = true; - this.showDialog = false; - this.showSpinner = true; - this._route.params.subscribe(params => { - - if(params["reportId"] !== undefined) - { - this.IncomingReportId = params["reportId"]; - this.reportId1 = params["reportId"]; - } - }); - if(this.IncomingReportId == -1 && this.reportMode == "Create") - { - this._definitionService.getDefinitionPageDetails(this.IncomingReportId, this.reportMode) - .subscribe((response) => { - this.finalGetObj = response; - - this.reportId = response["reportId"]; - this.reportName = response["reportName"]; - this.reportDescription = response["reportDescr"]; - this.reportType = response["reportType"]; - this.dataSrc = response["dbInfo"]; - this.helpText = response["formHelpText"]; - this.reportDefinition = response["repDefType"]; - this.pageSize = response["pageSize"]; - this.hideFormFields1 = response["hideFormFieldsAfterRun"]; - this.maxRows = response["maxRowsInExcelCSVDownload"]; - this.colsFrozen = response["frozenColumns"]; - this.gridAlign = response["dataGridAlign"]; - this.emptyMessage = response["emptyMessage"]; - - if(response["dashboardLayoutJSON"]) - { - this.dashboardObj = JSON.parse(response["dashboardLayoutJSON"]); - this.dashboardLayoutHTML = response["dashboardLayoutHTML"]; - } +export class DefinitionComponent implements OnInit, OnDestroy { + showSpinner: boolean; + @Input() closable = true; + @Input('reportId') reportId1: string; + @Input('reportMode') reportMode: string; + @Output() outputReportType = new EventEmitter<any>(); + finalPostObj = {}; + finalGetObj = {}; + isEdit: boolean; + reportId: number; + reportName: string; + reportDescription: string; + reportType: string; + dataSrc: string; + helpText: string; + reportDefinition: string; + pageSize: number; + hideFormFields: boolean; + maxRows: number; + colsFrozen: number; + gridAlign: string; + emptyMessage: string; + heightContainer: number; + widthContainer: number; + allowScheduler: boolean; + sizedByContent: boolean; + hideFormFields1: boolean; + hideChart: boolean; + hideReportData: boolean; + hideExcel: boolean; + hidePDF: boolean; + disableColumnSort: boolean; + runTimeFormNum: number; + reportTitle: string; + reportSubTitle: string; + oneTime: boolean; + hourly: boolean; + daily: boolean; + MonFri: boolean; + Weekly: boolean; + Monthly: boolean; + oneTime1: boolean; + hourly1: boolean; + daily1: boolean; + MonFri1: boolean; + Weekly1: boolean; + Monthly1: boolean; + displayArea: string; + definitionPostResponse1: any; + definitionPostResponse: any; + showDialog: boolean; + status: string; + message: string; + dashboardObj: any; + dashboardLayoutHTML: any; + pilotModalComponent: DefinitionSaveDialogComponent; + IncomingReportId: number; + displayOptionsArr: {}[] = []; + + constructor(private _http: HttpClient, private _route: ActivatedRoute, private _definitionService: DefinitionService, private _router: Router) { + this.showSpinner = true; + this.IncomingReportId = -1; + this.dashboardObj = []; + this.dashboardLayoutHTML = ''; + this.displayOptionsArr = []; + } - if(response["displayArea"]) - { - for(let i=0; i<response["displayArea"].length; i++) - { - if(response["displayArea"][i]["selected"] === true) - { - this.displayArea = response["displayArea"][i]["name"]; + ngOnDestroy(): void { + if (this.reportMode == 'Copy') { + this.clearSession(); } - } - } - - this.heightContainer = response["dataContainerHeight"]; - this.widthContainer = response["dataContainerWidth"]; - this.allowScheduler = (response["allowScheduler"] == "Y" ? true : false); - this.sizedByContent = (response["sizedByContent"] == "Y" ? true : false); - - this.displayOptionsArr = response["displayOptions"]; - + } - for(let cont of this.displayOptionsArr) - { - if(cont["name"] == "HideFormFields") - { - this.hideFormFields = cont["selected"]; - } - if(cont["name"] == "HideChart") - { - this.hideChart = cont["selected"]; - } - if(cont["name"] == "HideReportData") - { - this.hideReportData = cont["selected"]; - } - if(cont["name"] == "HideExcel") - { - this.hideExcel = cont["selected"]; + ngOnInit() { + sessionStorage.clear(); + const myItem = localStorage.getItem('id'); + localStorage.clear(); + localStorage.setItem('id', myItem); + this.isEdit = true; + this.showDialog = false; + this.showSpinner = true; + this._route.params.subscribe(params => { + if (params['reportId'] !== undefined) { + this.IncomingReportId = params['reportId']; + this.reportId1 = params['reportId']; + } + }); + if (this.IncomingReportId == -1 && this.reportMode == 'Create') { + this._definitionService.getDefinitionPageDetails(this.IncomingReportId, this.reportMode) + .subscribe((response) => { + this.finalGetObj = response; + this.reportId = response['reportId']; + this.reportName = response['reportName']; + this.reportDescription = response['reportDescr']; + this.reportType = response['reportType']; + this.dataSrc = response['dbInfo']; + this.helpText = response['formHelpText']; + this.reportDefinition = response['repDefType']; + this.pageSize = response['pageSize']; + this.hideFormFields1 = response['hideFormFieldsAfterRun']; + this.maxRows = response['maxRowsInExcelCSVDownload']; + this.colsFrozen = response['frozenColumns']; + this.gridAlign = response['dataGridAlign']; + this.emptyMessage = response['emptyMessage']; + if (response['dashboardLayoutJSON']) { + this.dashboardObj = JSON.parse(response['dashboardLayoutJSON']); + this.dashboardLayoutHTML = response['dashboardLayoutHTML']; + } + if (response['displayArea']) { + for (let i = 0; i < response["displayArea"].length; i++) { + if (response['displayArea'][i]['selected'] === true) { + this.displayArea = response['displayArea'][i]['name']; + } + } + } + this.heightContainer = response['dataContainerHeight']; + this.widthContainer = response['dataContainerWidth']; + this.allowScheduler = (response['allowScheduler'] == 'Y' ? true : false); + this.sizedByContent = (response['sizedByContent'] == 'Y' ? true : false); + this.displayOptionsArr = response['displayOptions']; + if (this.displayOptionsArr !== null) { + if (this.displayOptionsArr.length > 0) { + for (let cont of this.displayOptionsArr) { + if (cont['name'] == 'HideFormFields') { + this.hideFormFields = cont['selected']; + } + if (cont['name'] == 'HideChart') { + this.hideChart = cont['selected']; + } + if (cont['name'] == 'HideReportData') { + this.hideReportData = cont['selected']; + } + if (cont['name'] == 'HideExcel') { + this.hideExcel = cont['selected']; + } + if (cont['name'] == 'HidePdf') { + this.hidePDF = cont['selected']; + } + } + } + } + this.disableColumnSort = response['runtimeColSortDisabled']; + this.runTimeFormNum = response['numFormCols']; + this.reportTitle = response['reportTitle']; + this.reportSubTitle = response['reportSubTitle']; + this.oneTime = (response['oneTimeRec'] == 'Y' ? true : false); + this.hourly = (response['hourlyRec'] == 'Y' ? true : false); + this.daily = (response['dailyRec'] == 'Y' ? true : false); + this.MonFri = (response['dailyMFRec'] == 'Y' ? true : false); + this.Weekly = (response['weeklyRec'] == 'Y' ? true : false); + this.Monthly = (response['monthlyRec'] == 'Y' ? true : false); + this.showSpinner = false; + }); } - if(cont["name"] == "HidePdf") - { - this.hidePDF = cont["selected"]; + if ((this.IncomingReportId !== -1 && this.reportMode == 'Edit')) { + this._definitionService.getDefinitionPageDetails(this.IncomingReportId, this.reportMode) + .subscribe((response) => { + this.finalGetObj = response; + this.reportId = response['reportId']; + this.reportName = response['reportName']; + this.reportDescription = response['reportDescr']; + this.reportType = response['reportType']; + if (this.reportMode == 'Copy') { + this.finalPostObj['reportId'] = -1; + this.IncomingReportId = -1; + this.reportId = -1; + } + if (this.reportType === 'Linear') { + this.dataSrc = response['dbInfo']; + this.helpText = response['formHelpText']; + this.reportDefinition = response['repDefType']; + this.pageSize = response['pageSize']; + this.hideFormFields1 = response['hideFormFieldsAfterRun']; + this.maxRows = response['maxRowsInExcelCSVDownload']; + this.colsFrozen = response['frozenColumns']; + this.gridAlign = response['dataGridAlign']; + this.emptyMessage = response['emptyMessage']; + if (response['displayArea']) { + for (let i = 0; i < response["displayArea"].length; i++) { + if (response['displayArea'][i]['selected'] === true) { + this.displayArea = response['displayArea'][i]['name']; + } + } + } + this.heightContainer = response['dataContainerHeight']; + this.widthContainer = response['dataContainerWidth']; + this.allowScheduler = (response['allowScheduler'] == 'Y' ? true : false); + this.sizedByContent = (response['sizedByContent'] == 'Y' ? true : false); + this.displayOptionsArr = response['displayOptions']; + for (let cont of this.displayOptionsArr) { + if (cont['name'] == 'HideFormFields') { + this.hideFormFields = cont['selected']; + } + if (cont['name'] == 'HideChart') { + this.hideChart = cont['selected']; + } + if (cont['name'] == 'HideReportData') { + this.hideReportData = cont['selected']; + } + if (cont['name'] == 'HideExcel') { + this.hideExcel = cont['selected']; + } + if (cont['name'] == 'HidePdf') { + this.hidePDF = cont['selected']; + } + } + this.disableColumnSort = response['runtimeColSortDisabled']; + this.runTimeFormNum = response['numFormCols']; + + this.reportTitle = response['reportTitle']; + this.reportSubTitle = response['reportSubTitle']; + this.oneTime = (response['oneTimeRec'] == 'Y' ? true : false); + this.hourly = (response['hourlyRec'] == 'Y' ? true : false); + this.daily = (response['dailyRec'] == 'Y' ? true : false); + this.MonFri = (response['dailyMFRec'] == 'Y' ? true : false); + this.Weekly = (response['weeklyRec'] == 'Y' ? true : false); + this.Monthly = (response['monthlyRec'] == 'Y' ? true : false); + } else { + if (response['dashboardLayoutJSON']) { + this.dashboardObj = JSON.parse(response['dashboardLayoutJSON']); + } + if (response['dashboardLayoutHTML']) { + this.dashboardLayoutHTML = response['dashboardLayoutHTML']; + } + } + this.showSpinner = false; + }); } - } - - this.disableColumnSort = response["runtimeColSortDisabled"]; - this.runTimeFormNum = response["numFormCols"]; - this.reportTitle = response["reportTitle"]; - this.reportSubTitle = response["reportSubTitle"]; - this.oneTime = (response["oneTimeRec"] == "Y" ? true : false ); - this.hourly = (response["hourlyRec"] == "Y" ? true : false ); - this.daily = (response["dailyRec"] == "Y" ? true : false ); - this.MonFri = (response["dailyMFRec"] == "Y" ? true : false ); - this.Weekly = (response["weeklyRec"] == "Y" ? true : false ); - this.Monthly = (response["monthlyRec"] == "Y" ? true : false ); - - this.showSpinner = false; - - }); - } - - if(this.IncomingReportId !== -1 && this.reportMode == "Edit") - { - this._definitionService.getDefinitionPageDetails(this.IncomingReportId, this.reportMode) - .subscribe((response) => { - this.finalGetObj = response; - - this.reportId = response["reportId"]; - this.reportName = response["reportName"]; - this.reportDescription = response["reportDescr"]; - this.reportType = response["reportType"]; - - if(this.reportType === "Linear") - { - this.dataSrc = response["dbInfo"]; - this.helpText = response["formHelpText"]; - this.reportDefinition = response["repDefType"]; - this.pageSize = response["pageSize"]; - this.hideFormFields1 = response["hideFormFieldsAfterRun"]; - this.maxRows = response["maxRowsInExcelCSVDownload"]; - this.colsFrozen = response["frozenColumns"]; - this.gridAlign = response["dataGridAlign"]; - this.emptyMessage = response["emptyMessage"]; - - if(response["displayArea"]) - { - for(let i=0; i<response["displayArea"].length; i++) - { - if(response["displayArea"][i]["selected"] === true) - { - this.displayArea = response["displayArea"][i]["name"]; + if (this.reportMode == 'Copy') { + this._definitionService.copyReportById(this.IncomingReportId) + .subscribe((response) => { + this._definitionService.getDefinitionPageDetails(this.IncomingReportId, this.reportMode) + .subscribe((response) => { + this.finalGetObj = response; + this.reportId = -1; + this.reportName = response['reportName']; + this.reportDescription = response['reportDescr']; + this.reportType = response['reportType']; + if (this.reportType === 'Linear') { + this.dataSrc = response['dbInfo']; + this.helpText = response['formHelpText']; + this.reportDefinition = response['repDefType']; + this.pageSize = response['pageSize']; + this.hideFormFields1 = response['hideFormFieldsAfterRun']; + this.maxRows = response['maxRowsInExcelCSVDownload']; + this.colsFrozen = response['frozenColumns']; + this.gridAlign = response['dataGridAlign']; + this.emptyMessage = response['emptyMessage']; + if (response['displayArea']) { + for (let i = 0; i < response["displayArea"].length; i++) { + if (response['displayArea'][i]['selected'] === true) { + this.displayArea = response['displayArea'][i]['name']; + } + } + } + this.heightContainer = response['dataContainerHeight']; + this.widthContainer = response['dataContainerWidth']; + this.allowScheduler = (response['allowScheduler'] == 'Y' ? true : false); + this.sizedByContent = (response['sizedByContent'] == 'Y' ? true : false); + this.displayOptionsArr = response['displayOptions']; + for (let cont of this.displayOptionsArr) { + if (cont['name'] == 'HideFormFields') { + this.hideFormFields = cont['selected']; + } + if (cont['name'] == 'HideChart') { + this.hideChart = cont['selected']; + } + if (cont['name'] == 'HideReportData') { + this.hideReportData = cont['selected']; + } + if (cont['name'] == 'HideExcel') { + this.hideExcel = cont['selected']; + } + if (cont['name'] == 'HidePdf') { + this.hidePDF = cont['selected']; + } + } + this.disableColumnSort = response['runtimeColSortDisabled']; + this.runTimeFormNum = response['numFormCols']; + + this.reportTitle = response['reportTitle']; + this.reportSubTitle = response['reportSubTitle']; + this.oneTime = (response['oneTimeRec'] == 'Y' ? true : false); + this.hourly = (response['hourlyRec'] == 'Y' ? true : false); + this.daily = (response['dailyRec'] == 'Y' ? true : false); + this.MonFri = (response['dailyMFRec'] == 'Y' ? true : false); + this.Weekly = (response['weeklyRec'] == 'Y' ? true : false); + this.Monthly = (response['monthlyRec'] == 'Y' ? true : false); + } else { + if (response['dashboardLayoutJSON']) { + this.dashboardObj = JSON.parse(response['dashboardLayoutJSON']); + } + if (response['dashboardLayoutHTML']) { + this.dashboardLayoutHTML = response['dashboardLayoutHTML']; + } + } + this.showSpinner = false; + }); + this.showSpinner = false; + }); } - } } - - - - this.heightContainer = response["dataContainerHeight"]; - this.widthContainer = response["dataContainerWidth"]; - this.allowScheduler = (response["allowScheduler"] == "Y" ? true : false); - this.sizedByContent = (response["sizedByContent"] == "Y" ? true : false); - this.displayOptionsArr = response["displayOptions"]; - for(let cont of this.displayOptionsArr) - { - if(cont["name"] == "HideFormFields") - { - this.hideFormFields = cont["selected"]; + saveDefinitionInfo() { + if ((this.IncomingReportId == -1 && this.reportMode == 'Create')) { + this.finalPostObj['tabName'] = 'Definition'; + this.finalPostObj['tabId'] = 'Def'; + this.finalPostObj['reportId'] = this.reportId; + this.finalPostObj['reportName'] = this.reportName; + this.finalPostObj['reportDescr'] = this.reportDescription; + this.finalPostObj['reportType'] = this.reportType; + this.finalPostObj['reportTypeList'] = null; + this.finalPostObj['dbInfo'] = this.dataSrc; + this.finalPostObj['formHelpText'] = this.helpText; + this.finalPostObj['pageSize'] = this.pageSize; + this.finalPostObj['dbInfoList'] = [ + { + 'id': 'local', + 'name': 'local', + 'selected': false + } + ]; + this.finalPostObj['displayArea'] = [ + { + 'id': 'HOME', + 'name': 'HOME', + 'selected': (this.displayArea == 'HOME' ? true : false) + }, + { + 'id': 'CUSTOMER', + 'name': 'CUSTOMER', + 'selected': (this.displayArea == 'CUSTOMER' ? true : false) + }, + { + 'id': 'REPORTS', + 'name': 'REPORTS', + 'selected': (this.displayArea == 'REPORTS' ? true : false) + } + ]; + this.finalPostObj['hideFormFieldsAfterRun'] = this.hideFormFields1; + this.finalPostObj['maxRowsInExcelCSVDownload'] = this.maxRows; + this.finalPostObj['frozenColumns'] = this.colsFrozen; + this.finalPostObj['dataGridAlign'] = this.gridAlign; + this.finalPostObj['emptyMessage'] = this.emptyMessage; + this.finalPostObj['dataContainerHeight'] = this.heightContainer; + this.finalPostObj['dataContainerWidth'] = this.widthContainer; + this.finalPostObj['displayOptions'] = [ + { + 'name': 'HideFormFields', + 'selected': (this.hideFormFields == undefined ? false : this.hideFormFields) + }, + { + 'name': 'HideChart', + 'selected': (this.hideChart == undefined ? false : this.hideChart) + }, + { + 'name': 'HideReportData', + 'selected': (this.hideReportData == undefined ? false : this.hideReportData) + }, + { + 'name': 'HideExcel', + 'selected': (this.hideExcel == undefined ? false : this.hideExcel) + }, + { + 'name': 'HidePdf', + 'selected': (this.hidePDF == undefined ? false : this.hidePDF) + } + ]; + this.finalPostObj['runtimeColSortDisabled'] = this.disableColumnSort; + this.finalPostObj['numFormCols'] = this.runTimeFormNum; + this.finalPostObj['reportTitle'] = this.reportTitle; + this.finalPostObj['reportSubTitle'] = this.reportSubTitle; + this.finalPostObj['oneTimeRec'] = this.oneTime; + this.finalPostObj['hourlyRec'] = this.hourly; + this.finalPostObj['dailyRec'] = this.daily; + this.finalPostObj['dailyMFRec'] = this.MonFri; + this.finalPostObj['weeklyRec'] = this.Weekly; + this.finalPostObj['monthlyRec'] = this.Monthly; + this.finalPostObj['allowScheduler'] = (this.allowScheduler == true ? 'Y' : 'N'); + this.finalPostObj['sizedByContent'] = (this.sizedByContent == true ? 'Y' : 'N'); + this.finalPostObj['repDefType'] = this.reportDefinition; + if (this.reportType === 'Dashboard') { + this.finalPostObj['dashboardLayoutJSON'] = JSON.stringify(this.dashboardObj); + this.finalPostObj['dashboardLayoutHTML'] = this.dashboardLayoutHTML; + } + this._http.post(environment.baseUrl + 'report/wizard/save_def_tab_data/Create', this.finalPostObj, {headers: new HttpHeaders({'Content-Type': 'application/json'})}) + .subscribe((response) => { + if (response['message'] === 'Success Definition of given report is saved in session.') { + this.status = 'Success!'; + this.message = 'Your change has been saved! Definition is updated.'; + if (this.reportType == 'Dashboard') { + let stackTrace = ''; + stackTrace = response['anyStacktrace']; + stackTrace = stackTrace.substring(0, stackTrace.indexOf('-')); + this.reportId = parseInt(stackTrace); + this._router.navigate(['v2/reports', 'Edit', this.reportId]); + } + this.showDialog = !this.showDialog; + this.closable = true; + } else { + this.status = 'Failure!'; + this.message = 'Definition could not be updated.'; + this.showDialog = !this.showDialog; + this.closable = true; + } + }); } - if(cont["name"] == "HideChart") - { - this.hideChart = cont["selected"]; + if ((this.IncomingReportId !== -1 && this.reportMode == 'Edit') || this.reportMode == 'Copy') { + this.finalPostObj['tabName'] = 'Definition'; + this.finalPostObj['tabId'] = 'Def'; + this.finalPostObj['reportId'] = this.reportId; + this.finalPostObj['reportName'] = this.reportName; + this.finalPostObj['reportDescr'] = this.reportDescription; + this.finalPostObj['reportType'] = this.reportType; + if (this.reportMode == 'Copy') { + this.finalPostObj['reportId'] = -1; + this.IncomingReportId = -1; + } + if (this.reportType === 'Dashboard') { + this.finalPostObj['dashboardLayoutJSON'] = JSON.stringify(this.dashboardObj); + this.finalPostObj['dashboardLayoutHTML'] = this.dashboardLayoutHTML; + } else { + this.finalPostObj['reportTypeList'] = null; + this.finalPostObj['dbInfo'] = this.dataSrc; + this.finalPostObj['formHelpText'] = this.helpText; + this.finalPostObj['pageSize'] = this.pageSize; + this.finalPostObj['dbInfoList'] = [ + { + 'id': 'local', + 'name': 'local', + 'selected': false + } + ]; + this.finalPostObj['displayArea'] = [ + { + 'id': 'HOME', + 'name': 'HOME', + 'selected': (this.displayArea == 'HOME' ? true : false) + }, + { + 'id': 'CUSTOMER', + 'name': 'CUSTOMER', + 'selected': (this.displayArea == 'CUSTOMER' ? true : false) + }, + { + 'id': 'REPORTS', + 'name': 'REPORTS', + 'selected': (this.displayArea == 'REPORTS' ? true : false) + } + ]; + this.finalPostObj['hideFormFieldsAfterRun'] = this.hideFormFields1; + this.finalPostObj['maxRowsInExcelCSVDownload'] = this.maxRows; + this.finalPostObj['frozenColumns'] = this.colsFrozen; + this.finalPostObj['dataGridAlign'] = this.gridAlign; + this.finalPostObj['emptyMessage'] = this.emptyMessage; + this.finalPostObj['dataContainerHeight'] = this.heightContainer; + this.finalPostObj['dataContainerWidth'] = this.widthContainer; + this.finalPostObj['displayOptions'] = [ + { + 'name': 'HideFormFields', + 'selected': (this.hideFormFields == undefined ? false : this.hideFormFields) + }, + { + 'name': 'HideChart', + 'selected': (this.hideChart == undefined ? false : this.hideChart) + }, + { + 'name': 'HideReportData', + 'selected': (this.hideReportData == undefined ? false : this.hideReportData) + }, + { + 'name': 'HideExcel', + 'selected': (this.hideExcel == undefined ? false : this.hideExcel) + }, + { + 'name': 'HidePdf', + 'selected': (this.hidePDF == undefined ? false : this.hidePDF) + } + ]; + this.finalPostObj['runtimeColSortDisabled'] = this.disableColumnSort; + this.finalPostObj['numFormCols'] = this.runTimeFormNum; + this.finalPostObj['reportTitle'] = this.reportTitle; + this.finalPostObj['reportSubTitle'] = this.reportSubTitle; + this.finalPostObj['oneTimeRec'] = this.oneTime; + this.finalPostObj['hourlyRec'] = this.hourly; + this.finalPostObj['dailyRec'] = this.daily; + this.finalPostObj['dailyMFRec'] = this.MonFri; + this.finalPostObj['weeklyRec'] = this.Weekly; + this.finalPostObj['monthlyRec'] = this.Monthly; + this.finalPostObj['allowScheduler'] = (this.allowScheduler == true ? 'Y' : 'N'); + this.finalPostObj['sizedByContent'] = (this.sizedByContent == true ? 'Y' : 'N'); + this.finalPostObj['repDefType'] = this.reportDefinition; + } + this._definitionService.portDefinitionPageDetails(this.IncomingReportId, this.finalPostObj) + .subscribe((response) => { + if (response['message'] === 'Success Definition of given report is saved in session.') { + this.status = 'Success!'; + this.message = 'Your change has been saved! Definition is updated.'; + if (this.reportMode == 'Copy') { + let stackTrace = ''; + stackTrace = response['anyStacktrace']; + stackTrace = stackTrace.substring(0, stackTrace.indexOf('-')); + this.reportId = parseInt(stackTrace); + this._router.navigate(['v2/reports', 'Edit', this.reportId]); + } + this.showDialog = !this.showDialog; + this.closable = true; + if (this.reportType == 'Dashboard') { + + } + } else { + this.status = 'Failure!'; + this.message = 'Definition could not be updated.'; + this.showDialog = !this.showDialog; + this.closable = true; + } + }); } - if(cont["name"] == "HideReportData") - { - this.hideReportData = cont["selected"]; - } - if(cont["name"] == "HideExcel") - { - this.hideExcel = cont["selected"]; - } - if(cont["name"] == "HidePdf") - { - this.hidePDF = cont["selected"]; - } - } - - this.disableColumnSort = response["runtimeColSortDisabled"]; - this.runTimeFormNum = response["numFormCols"];; - this.reportTitle = response["reportTitle"]; - this.reportSubTitle = response["reportSubTitle"]; - this.oneTime = (response["oneTimeRec"] == "Y" ? true : false ); - this.hourly = (response["hourlyRec"] == "Y" ? true : false ); - this.daily = (response["dailyRec"] == "Y" ? true : false ); - this.MonFri = (response["dailyMFRec"] == "Y" ? true : false ); - this.Weekly = (response["weeklyRec"] == "Y" ? true : false ); - this.Monthly = (response["monthlyRec"] == "Y" ? true : false ); - } - else - { - if(response["dashboardLayoutJSON"]) - { - this.dashboardObj = JSON.parse(response["dashboardLayoutJSON"]); - - } - - if(response["dashboardLayoutHTML"]) - { - this.dashboardLayoutHTML = response["dashboardLayoutHTML"]; - - } - - } - - this.showSpinner = false; - - }); - } - - - } - - - saveDefinitionInfo(){ - - if(this.IncomingReportId == -1 && this.reportMode == "Create") - { - this.finalPostObj["tabName"] = "Definition"; - this.finalPostObj["tabId"] = "Def"; - this.finalPostObj["reportId"] = this.reportId; - this.finalPostObj["reportName"] = this.reportName; - this.finalPostObj["reportDescr"] = this.reportDescription; - this.finalPostObj["reportType"] = this.reportType; - this.finalPostObj["reportTypeList"] = null; - this.finalPostObj["dbInfo"] = this.dataSrc; - this.finalPostObj["formHelpText"] = this.helpText; - this.finalPostObj["pageSize"] = this.pageSize; - - this.finalPostObj["dbInfoList"] = [ - { - "id": "local", - "name": "local", - "selected": false - } - ]; - this.finalPostObj["displayArea"] = [ - { - "id": "HOME", - "name": "HOME", - "selected": (this.displayArea == "HOME" ? true : false) - }, - { - "id": "CUSTOMER", - "name": "CUSTOMER", - "selected": (this.displayArea == "CUSTOMER" ? true : false) - }, - { - "id": "REPORTS", - "name": "REPORTS", - "selected": (this.displayArea == "REPORTS" ? true : false) - } - ]; - this.finalPostObj["hideFormFieldsAfterRun"] = this.hideFormFields1; - this.finalPostObj["maxRowsInExcelCSVDownload"] = this.maxRows; - this.finalPostObj["frozenColumns"] = this.colsFrozen; - this.finalPostObj["dataGridAlign"] = this.gridAlign; - this.finalPostObj["emptyMessage"] = this.emptyMessage; - this.finalPostObj["dataContainerHeight"] = this.heightContainer; - this.finalPostObj["dataContainerWidth"] = this.widthContainer; - this.finalPostObj["displayOptions"] = [ - { - "name": "HideFormFields", - "selected": (this.hideFormFields == undefined ? false : this.hideFormFields ) - }, - { - "name": "HideChart", - "selected": (this.hideChart == undefined ? false : this.hideChart ) - }, - { - "name": "HideReportData", - "selected": (this.hideReportData == undefined ? false : this.hideReportData ) - }, - { - "name": "HideExcel", - "selected": (this.hideExcel == undefined ? false : this.hideExcel ) - }, - { - "name": "HidePdf", - "selected": (this.hidePDF == undefined ? false : this.hidePDF ) - } - ]; - this.finalPostObj["runtimeColSortDisabled"] = this.disableColumnSort; - this.finalPostObj["numFormCols"] = this.runTimeFormNum; - this.finalPostObj["reportTitle"] = this.reportTitle; - this.finalPostObj["reportSubTitle"] = this.reportSubTitle; - this.finalPostObj["oneTimeRec"] = this.oneTime; - this.finalPostObj["hourlyRec"] = this.hourly; - this.finalPostObj["dailyRec"] = this.daily; - this.finalPostObj["dailyMFRec"] = this.MonFri; - this.finalPostObj["weeklyRec"] = this.Weekly; - this.finalPostObj["monthlyRec"] = this.Monthly; - this.finalPostObj["allowScheduler"] = (this.allowScheduler == true ? "Y" : "N" ); - this.finalPostObj["sizedByContent"] = (this.sizedByContent == true ? "Y" : "N" ); - this.finalPostObj["repDefType"] = this.reportDefinition; - - this._http.post(environment.baseUrl + "report/wizard/save_def_tab_data/Create", this.finalPostObj, { headers: new HttpHeaders({'Content-Type': 'application/json'})}) - .subscribe((response) => { - if(response["message"] === "Success Definition of given report is saved in session.") - { - this.status = "Success!"; - this.message = "Your change has been saved! Definition is updated."; - this.showDialog = !this.showDialog; - this.closable = true; } - else - { - this.status = "Failure!"; - this.message = "Definition could not be updated."; - this.showDialog = !this.showDialog; - this.closable = true; - } - }); + close() { + this.showDialog = !this.showDialog; + this.closable = false; } - if(this.IncomingReportId !== -1 && this.reportMode == "Edit") - { - - this.finalPostObj["tabName"] = "Definition"; - this.finalPostObj["tabId"] = "Def"; - this.finalPostObj["reportId"] = this.reportId; - this.finalPostObj["reportName"] = this.reportName; - this.finalPostObj["reportDescr"] = this.reportDescription; - this.finalPostObj["reportType"] = this.reportType; - - if(this.reportType === "Dashboard") - { - this.finalPostObj["dashboardLayoutJSON"] = JSON.stringify(this.dashboardObj); - this.finalPostObj["dashboardLayoutHTML"] = this.dashboardLayoutHTML; - } - else - { - - this.finalPostObj["reportTypeList"] = null; - this.finalPostObj["dbInfo"] = this.dataSrc; - this.finalPostObj["formHelpText"] = this.helpText; - this.finalPostObj["pageSize"] = this.pageSize; + onTransferDashboardObj(transferredDashboardObj: any) { + this.dashboardObj = transferredDashboardObj; - this.finalPostObj["dbInfoList"] = [ - { - "id": "local", - "name": "local", - "selected": false - } - ]; - this.finalPostObj["displayArea"] = [ - { - "id": "HOME", - "name": "HOME", - "selected": (this.displayArea == "HOME" ? true : false) - }, - { - "id": "CUSTOMER", - "name": "CUSTOMER", - "selected": (this.displayArea == "CUSTOMER" ? true : false) - }, - { - "id": "REPORTS", - "name": "REPORTS", - "selected": (this.displayArea == "REPORTS" ? true : false) - } - ]; - this.finalPostObj["hideFormFieldsAfterRun"] = this.hideFormFields1; - this.finalPostObj["maxRowsInExcelCSVDownload"] = this.maxRows; - this.finalPostObj["frozenColumns"] = this.colsFrozen; - this.finalPostObj["dataGridAlign"] = this.gridAlign; - this.finalPostObj["emptyMessage"] = this.emptyMessage; - this.finalPostObj["dataContainerHeight"] = this.heightContainer; - this.finalPostObj["dataContainerWidth"] = this.widthContainer; - this.finalPostObj["displayOptions"] = [ - { - "name": "HideFormFields", - "selected": (this.hideFormFields == undefined ? false : this.hideFormFields ) - }, - { - "name": "HideChart", - "selected": (this.hideChart == undefined ? false : this.hideChart ) - }, - { - "name": "HideReportData", - "selected": (this.hideReportData == undefined ? false : this.hideReportData ) - }, - { - "name": "HideExcel", - "selected": (this.hideExcel == undefined ? false : this.hideExcel ) - }, - { - "name": "HidePdf", - "selected": (this.hidePDF == undefined ? false : this.hidePDF ) - } - ]; - this.finalPostObj["runtimeColSortDisabled"] = this.disableColumnSort; - this.finalPostObj["numFormCols"] = this.runTimeFormNum; - this.finalPostObj["reportTitle"] = this.reportTitle; - this.finalPostObj["reportSubTitle"] = this.reportSubTitle; - this.finalPostObj["oneTimeRec"] = this.oneTime; - this.finalPostObj["hourlyRec"] = this.hourly; - this.finalPostObj["dailyRec"] = this.daily; - this.finalPostObj["dailyMFRec"] = this.MonFri; - this.finalPostObj["weeklyRec"] = this.Weekly; - this.finalPostObj["monthlyRec"] = this.Monthly; - this.finalPostObj["allowScheduler"] = (this.allowScheduler == true ? "Y" : "N" ); - this.finalPostObj["sizedByContent"] = (this.sizedByContent == true ? "Y" : "N" ); - this.finalPostObj["repDefType"] = this.reportDefinition; } + clearSession() { + this._definitionService.clearSession() + .subscribe((response) => { + console.log(response); + this._router.navigate(['v2/report-list']); + }); - this._definitionService.portDefinitionPageDetails(this.IncomingReportId, this.finalPostObj) - .subscribe((response) => { - - if(response["message"] === "Success Definition of given report is saved in session.") - { - this.status = "Success!"; - this.message = "Your change has been saved! Definition is updated."; - this.showDialog = !this.showDialog; - this.closable = true; } - else - { - this.status = "Failure!"; - this.message = "Definition could not be updated."; - this.showDialog = !this.showDialog; - this.closable = true; - } - }); + getReportType() { + let outPutValues = []; + outPutValues['reportType'] = this.reportType; + this.outputReportType.emit(outPutValues); } - - } - - close() { - this.showDialog = !this.showDialog; - this.closable = false; - } - - onTransferDashboardObj(transferredDashboardObj : any) - { - this.dashboardObj = transferredDashboardObj; - - } - - - - } |