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';
8 export interface ExampleTab {
16 selector: 'app-header-tabs-component',
17 templateUrl: './header-tabs.component.html',
18 styleUrls: ['./header-tabs.component.css']
20 export class HeaderTabsComponent implements OnInit {
22 asyncTabs: Observable<ExampleTab[]>;
24 @Input("reportId") reportId : string;
25 @Input ("reportMode") reportMode : string;
27 finalReportId : string;
33 constructor(private _router : Router) {
35 this.asyncTabs = new Observable((observer: Observer<ExampleTab[]>) => {
38 {label: 'Definition', content: '<app-pilot-page [reportId]="reportId"></app-pilot-page>'},
44 //console.log(this.reportId);
45 if(this.reportId == "" && this.reportMode=="")
47 this.finalReportId = "-1";
48 this.repMode = "Create";
51 this.reportMode = "Create";
52 console.log(this.finalReportId, this.repMode);
56 if(this.reportId !== undefined && this.reportMode !== undefined)
58 this.finalReportId = this.reportId;
59 this.repMode = this.reportMode;
60 console.log(this.finalReportId, this.repMode);
70 if(this.reportId == "" && this.reportMode=="")
72 this.finalReportId = "-1";
73 this.repMode = "Create";
76 this.reportMode = "Create";
77 console.log(this.finalReportId, this.repMode);
81 if(this.reportId !== undefined && this.reportMode !== undefined)
83 this.finalReportId = this.reportId;
84 this.repMode = this.reportMode;
85 console.log(this.finalReportId, this.repMode);
92 //console.log(this.reportId);
96 if(this.reportId == "" && this.reportMode=="")
98 this.finalReportId = "-1";
99 this.repMode = "Create";
101 this.reportId = "-1";
102 this.reportMode = "Create";
103 console.log(this.finalReportId, this.repMode);
107 if(this.reportId !== undefined && this.reportMode !== undefined)
109 this.finalReportId = this.reportId;
110 this.repMode = this.reportMode;
111 console.log(this.finalReportId, this.repMode);
118 // var id = this.finalReportId;
119 // console.log(this.finalReportId);
121 this.tabChanged = (tabChangeEvent: MatTabChangeEvent): void => {
122 console.log('tabChangeEvent => ', tabChangeEvent);
123 console.log('index => ', tabChangeEvent.index);
127 ngOnChanges(changes: SimpleChanges)
129 this.tabChanged = (tabChangeEvent: MatTabChangeEvent): void => {
130 console.log('tabChangeEvent => ', tabChangeEvent);
131 console.log('index => ', tabChangeEvent.index);
134 // this.navLinks = [{
135 // path : "definition/" + changes["reportId"]["currentValue"],
136 // label : "Definition"
147 // path : "formFields",
148 // label : "Form Fields"
151 // path : "chartWizard",
152 // label : "Chart Wizard"
155 // path : "security",
156 // label : "Security"
163 // path : "run/" + changes["reportId"]["currentValue"],
166 console.log(changes);
168 // this._router.navigate(["search/definition", 7]);