1 import { Component, OnInit, Input, SimpleChanges } from '@angular/core';
2 import { Router } from '@angular/router';
3 import { environment } from '../../../../../environments/environment';
4 import {MatTabChangeEvent, VERSION} from '@angular/material';
5 import { Observable, Observer } from 'rxjs';
6 import { HeadertabsService } from './headertabs.service';
9 export interface ExampleTab {
17 selector: 'app-header-tabs-component',
18 templateUrl: './header-tabs.component.html',
19 styleUrls: ['./header-tabs.component.css']
21 export class HeaderTabsComponent implements OnInit {
23 asyncTabs: Observable<ExampleTab[]>;
25 @Input("reportId") reportId : string;
26 @Input ("reportMode") reportMode : string;
28 finalReportId : string;
35 constructor(private _router : Router, private _headerTabsService : HeadertabsService) {
37 this.asyncTabs = new Observable((observer: Observer<ExampleTab[]>) => {
40 {label: 'Definition', content: '<app-pilot-page [reportId]="reportId"></app-pilot-page>'},
46 //console.log(this.reportId);
47 if(this.reportId == "" && this.reportMode=="")
49 this.finalReportId = "-1";
50 this.repMode = "Create";
53 this.reportMode = "Create";
54 console.log(this.finalReportId, this.repMode);
58 if(this.reportId !== undefined && this.reportMode !== undefined)
60 this.finalReportId = this.reportId;
61 this.repMode = this.reportMode;
62 console.log(this.finalReportId, this.repMode);
72 if(this.reportId == "" && this.reportMode=="")
74 this.finalReportId = "-1";
75 this.repMode = "Create";
78 this.reportMode = "Create";
79 console.log(this.finalReportId, this.repMode);
83 if(this.reportId !== undefined && this.reportMode !== undefined)
85 this.finalReportId = this.reportId;
86 this.repMode = this.reportMode;
89 this._headerTabsService.getReportTypeData(this.finalReportId)
90 .subscribe((responseReportType) => {
92 this.reportType = responseReportType["reportType"];
93 console.log(this.reportType);
97 console.log(this.finalReportId, this.repMode);
104 //console.log(this.reportId);
108 if(this.reportId == "" && this.reportMode=="")
110 this.finalReportId = "-1";
111 this.repMode = "Create";
113 this.reportId = "-1";
114 this.reportMode = "Create";
115 console.log(this.finalReportId, this.repMode);
119 if(this.reportId !== undefined && this.reportMode !== undefined)
121 this.finalReportId = this.reportId;
122 this.repMode = this.reportMode;
123 console.log(this.finalReportId, this.repMode);
130 // var id = this.finalReportId;
131 // console.log(this.finalReportId);
133 this.tabChanged = (tabChangeEvent: MatTabChangeEvent): void => {
134 console.log('tabChangeEvent => ', tabChangeEvent);
135 console.log('index => ', tabChangeEvent.index);
139 ngOnChanges(changes: SimpleChanges)
141 this.tabChanged = (tabChangeEvent: MatTabChangeEvent): void => {
142 console.log('tabChangeEvent => ', tabChangeEvent);
143 console.log('index => ', tabChangeEvent.index);
146 // this.navLinks = [{
147 // path : "definition/" + changes["reportId"]["currentValue"],
148 // label : "Definition"
159 // path : "formFields",
160 // label : "Form Fields"
163 // path : "chartWizard",
164 // label : "Chart Wizard"
167 // path : "security",
168 // label : "Security"
175 // path : "run/" + changes["reportId"]["currentValue"],
178 console.log(changes);
180 // this._router.navigate(["search/definition", 7]);