summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.ts
blob: 0259fdefb2eb33f73d0070b8edeb93b6c7459efd (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
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]
})
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 = [];
    }

    ngOnDestroy(): void {
        if (this.reportMode == 'Copy') {
            this.clearSession();
        }
    }

    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 ((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;
                });
        }
        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;
                });
        }
    }


    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;
            if (this.reportTitle && this.reportTitle.length > 0) {
                this.finalPostObj['reportTitle'] = this.reportTitle;
            } else {
                this.finalPostObj['reportTitle'] = this.reportName;
            }
            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.dashboardObj = this.dashboardObj.sort(function (a, b) {
                    if (a['x'] === b['x']) {
                        return a['y'] - b['y'];
                    } else {
                        return a['x'] - b['x'];
                    }
                });
                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/app/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 ((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.dashboardObj = this.dashboardObj.sort(function (a, b) {
                    if (a['x'] === b['x']) {
                        return a['y'] - b['y'];
                    } else {
                        return a['x'] - b['x'];
                    }
                });
                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;
                if ( this.reportTitle && this.reportTitle.length > 0) {
                    this.finalPostObj['reportTitle'] = this.reportTitle;
                } else {
                    this.finalPostObj['reportTitle'] = this.reportName;;
                }
                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/app/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;
                    }
                });
        }
    }

    close() {
        this.showDialog = !this.showDialog;
        this.closable = false;
    }

    onTransferDashboardObj(transferredDashboardObj: any) {
        this.dashboardObj = transferredDashboardObj;

    }

    clearSession() {
        this._definitionService.clearSession()
            .subscribe((response) => {
                console.log(response);
                this._router.navigate(['v2/app/report-list']);
            });

    }

    getReportType() {
        let outPutValues = [];
        outPutValues['reportType'] = this.reportType;
        this.outputReportType.emit(outPutValues);
    }
}