CP adding electricity, gas & water components and update the dashboard links
This commit is contained in:
parent
1795fdf666
commit
506a9ea3af
@ -43,6 +43,9 @@ import { BetComponent } from './control-panel/bet/bet.component';
|
||||
import { PanelMenuModule } from 'primeng/panelmenu';
|
||||
import { EnergyComponent } from './control-panel/profile/dashboard/energy/energy.component';
|
||||
import { SidebarDashboardComponent, SidebarNavItemComponent, SidebarNavDropItemComponent } from './control-panel/profile/dashboard/sidebar/sidebarDashboard.component';
|
||||
import { ElectricityComponent } from './control-panel/profile/dashboard/energy/electricity/electricity.component';
|
||||
import { GasComponent } from './control-panel/profile/dashboard/energy/gas/gas.component';
|
||||
import { WaterComponent } from './control-panel/profile/dashboard/energy/water/water.component';
|
||||
|
||||
|
||||
|
||||
@ -82,7 +85,10 @@ export function HttpLoaderFactory(http: HttpClient) {
|
||||
EnergyComponent,
|
||||
SidebarDashboardComponent,
|
||||
SidebarNavItemComponent,
|
||||
SidebarNavDropItemComponent
|
||||
SidebarNavDropItemComponent,
|
||||
ElectricityComponent,
|
||||
GasComponent,
|
||||
WaterComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
||||
@ -3,5 +3,8 @@
|
||||
|
||||
<div id="content">
|
||||
<app-energy *ngIf="ActiveTab == 'energy'"></app-energy>
|
||||
<app-electricity *ngIf="ActiveTab == 'energy/electricity'"></app-electricity>
|
||||
<app-gas *ngIf="ActiveTab == 'energy/gas'"></app-gas>
|
||||
<app-water *ngIf="ActiveTab == 'energy/water'"></app-water>
|
||||
</div>
|
||||
</div>
|
||||
@ -13,21 +13,34 @@ export class DashboardComponent implements OnInit {
|
||||
ActiveTab = '';
|
||||
|
||||
constructor(private _router: Router,
|
||||
private _route: ActivatedRoute) { }
|
||||
private _route: ActivatedRoute) {
|
||||
this.ActivateTab();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._router.events.subscribe(e => {
|
||||
if (e instanceof NavigationEnd) {
|
||||
console.log('current route: ', this._router.url.toString());
|
||||
console.log(this._router.url.match(this.UrlRegex)[0]);
|
||||
this.ActivateTab();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ActivateTab() {
|
||||
this.ActiveTab = this._router.url.match(this.UrlRegex)[0];
|
||||
switch (this._router.url.match(this.UrlRegex)[0]) {
|
||||
case 'dashboard/energy':
|
||||
this.ActiveTab = 'energy';
|
||||
break;
|
||||
case 'dashboard/energy/electricity':
|
||||
this.ActiveTab = 'energy/electricity';
|
||||
break;
|
||||
case 'dashboard/energy/gas':
|
||||
this.ActiveTab = 'energy/gas';
|
||||
break;
|
||||
case 'dashboard/energy/water':
|
||||
this.ActiveTab = 'energy/water';
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<p>electricity works!</p>
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ElectricityComponent } from './electricity.component';
|
||||
|
||||
describe('ElectricityComponent', () => {
|
||||
let component: ElectricityComponent;
|
||||
let fixture: ComponentFixture<ElectricityComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ElectricityComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ElectricityComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-electricity',
|
||||
templateUrl: './electricity.component.html',
|
||||
styleUrls: ['./electricity.component.css']
|
||||
})
|
||||
export class ElectricityComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<p>gas works!</p>
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GasComponent } from './gas.component';
|
||||
|
||||
describe('GasComponent', () => {
|
||||
let component: GasComponent;
|
||||
let fixture: ComponentFixture<GasComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ GasComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GasComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-gas',
|
||||
templateUrl: './gas.component.html',
|
||||
styleUrls: ['./gas.component.css']
|
||||
})
|
||||
export class GasComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<p>water works!</p>
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WaterComponent } from './water.component';
|
||||
|
||||
describe('WaterComponent', () => {
|
||||
let component: WaterComponent;
|
||||
let fixture: ComponentFixture<WaterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WaterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WaterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-water',
|
||||
templateUrl: './water.component.html',
|
||||
styleUrls: ['./water.component.css']
|
||||
})
|
||||
export class WaterComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user