2017-07-13 18:34:57 +03:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2017-04-18 19:12:29 +03:00
|
|
|
|
2017-06-26 12:38:12 +03:00
|
|
|
import { NgaSidebarService, NgaMenuService } from '@akveo/nga-theme';
|
|
|
|
|
import { NgaThemeService } from '@akveo/nga-theme/services/theme.service';
|
2017-07-13 11:49:38 +03:00
|
|
|
import { UserService } from '../../../@core/data/users.service';
|
2017-04-18 19:12:29 +03:00
|
|
|
|
|
|
|
|
@Component({
|
2017-05-06 14:52:41 +03:00
|
|
|
selector: 'ngx-header',
|
2017-04-28 15:14:05 +03:00
|
|
|
styleUrls: ['./header.component.scss'],
|
2017-04-18 19:12:29 +03:00
|
|
|
template: `
|
|
|
|
|
<div class="left">
|
2017-06-21 17:34:10 +03:00
|
|
|
<a (click)="toggleSidebar()" href="#"><i class="control-icon ion ion-navicon"></i></a>
|
2017-04-26 20:11:54 +03:00
|
|
|
<span class="logo" (click)="goToHome()">NgX <a>Admin</a></span>
|
2017-06-07 14:14:57 +03:00
|
|
|
<div class="theme-buttons">
|
2017-06-13 16:16:52 +03:00
|
|
|
<button class="btn btn-hero-primary" (click)="selectCosmicTheme()">Cosmic</button>
|
|
|
|
|
<button class="btn btn-hero-warning" (click)="selectLightTheme()">Light</button>
|
|
|
|
|
<button class="btn btn-hero-info" (click)="selectDefaultTheme()">Default</button>
|
2017-06-07 14:14:57 +03:00
|
|
|
</div>
|
2017-04-18 19:12:29 +03:00
|
|
|
</div>
|
2017-05-11 15:05:04 +03:00
|
|
|
|
2017-06-21 17:34:10 +03:00
|
|
|
<nga-actions size="medium" class="right">
|
2017-05-19 19:45:42 +03:00
|
|
|
<nga-action><nga-search type="rotate-layout"></nga-search></nga-action>
|
2017-04-29 18:41:44 +03:00
|
|
|
<nga-action icon="ion-ios-email-outline"></nga-action>
|
|
|
|
|
<nga-action disabled icon="ion-ios-bell-outline"></nga-action>
|
|
|
|
|
<nga-action>
|
2017-07-13 18:34:57 +03:00
|
|
|
<nga-user [menu]="userMenu" [name]="user?.name" [picture]="user?.picture"></nga-user>
|
2017-04-29 18:41:44 +03:00
|
|
|
</nga-action>
|
|
|
|
|
<nga-action icon="ion-ios-gear-outline"></nga-action>
|
|
|
|
|
</nga-actions>
|
2017-04-21 17:23:44 +03:00
|
|
|
`,
|
2017-04-18 19:12:29 +03:00
|
|
|
})
|
2017-07-13 18:34:57 +03:00
|
|
|
export class HeaderComponent implements OnInit {
|
2017-04-29 18:41:44 +03:00
|
|
|
|
2017-07-13 11:49:38 +03:00
|
|
|
user: any;
|
|
|
|
|
|
2017-04-29 18:41:44 +03:00
|
|
|
userMenu = [
|
|
|
|
|
{
|
|
|
|
|
title: 'Profile',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Log out',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2017-04-21 17:23:44 +03:00
|
|
|
constructor(private sidebarService: NgaSidebarService,
|
2017-06-21 17:34:10 +03:00
|
|
|
private menuService: NgaMenuService,
|
2017-07-13 11:49:38 +03:00
|
|
|
private themeService: NgaThemeService,
|
|
|
|
|
private userService: UserService) {
|
2017-07-13 18:34:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.userService.getUsers()
|
|
|
|
|
.subscribe((users: any) => this.user = users.nick);
|
2017-04-18 19:12:29 +03:00
|
|
|
}
|
|
|
|
|
|
2017-06-21 17:34:10 +03:00
|
|
|
toggleSidebar(): boolean {
|
2017-04-18 19:12:29 +03:00
|
|
|
this.sidebarService.toggle(true);
|
2017-06-21 17:34:10 +03:00
|
|
|
return false;
|
2017-04-18 19:12:29 +03:00
|
|
|
}
|
2017-04-21 17:23:44 +03:00
|
|
|
|
|
|
|
|
goToHome() {
|
|
|
|
|
this.menuService.navigateHome();
|
|
|
|
|
}
|
2017-04-26 08:59:57 +03:00
|
|
|
|
2017-06-07 14:14:57 +03:00
|
|
|
selectCosmicTheme() {
|
|
|
|
|
this.themeService.changeTheme('cosmic');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectLightTheme() {
|
|
|
|
|
this.themeService.changeTheme('light');
|
2017-04-26 08:59:57 +03:00
|
|
|
}
|
2017-05-11 15:05:04 +03:00
|
|
|
|
|
|
|
|
selectDefaultTheme() {
|
|
|
|
|
this.themeService.changeTheme('default');
|
|
|
|
|
}
|
2017-04-18 19:12:29 +03:00
|
|
|
}
|