2017-07-28 14:54:29 +03:00
|
|
|
import { Component, Input, OnInit } from '@angular/core';
|
2017-04-18 19:12:29 +03:00
|
|
|
|
2017-09-20 12:54:26 +03:00
|
|
|
import { NbMenuService, NbSidebarService } from '@nebular/theme';
|
2017-07-13 11:49:38 +03:00
|
|
|
import { UserService } from '../../../@core/data/users.service';
|
2019-01-08 16:17:20 +03:00
|
|
|
import { AnalyticsService } from '../../../@core/utils';
|
|
|
|
|
import { LayoutService } from '../../../@core/utils';
|
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-09-07 16:43:31 +03:00
|
|
|
templateUrl: './header.component.html',
|
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-10-20 17:31:36 +03:00
|
|
|
@Input() position = 'normal';
|
2017-07-28 14:54:29 +03:00
|
|
|
|
2017-07-13 11:49:38 +03:00
|
|
|
user: any;
|
|
|
|
|
|
2017-09-07 16:43:31 +03:00
|
|
|
userMenu = [{ title: 'Profile' }, { title: 'Log out' }];
|
2017-04-29 18:41:44 +03:00
|
|
|
|
2017-08-01 17:42:21 +03:00
|
|
|
constructor(private sidebarService: NbSidebarService,
|
|
|
|
|
private menuService: NbMenuService,
|
2017-09-20 15:48:30 +03:00
|
|
|
private userService: UserService,
|
2018-08-09 15:24:44 +03:00
|
|
|
private analyticsService: AnalyticsService,
|
|
|
|
|
private layoutService: LayoutService) {
|
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-07-28 14:54:29 +03:00
|
|
|
this.sidebarService.toggle(true, 'menu-sidebar');
|
2018-08-09 15:24:44 +03:00
|
|
|
this.layoutService.changeLayoutSize();
|
|
|
|
|
|
2017-07-28 14:54:29 +03:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-21 17:23:44 +03:00
|
|
|
goToHome() {
|
|
|
|
|
this.menuService.navigateHome();
|
|
|
|
|
}
|
2017-09-20 15:48:30 +03:00
|
|
|
|
|
|
|
|
startSearch() {
|
|
|
|
|
this.analyticsService.trackEvent('startSearch');
|
|
|
|
|
}
|
2017-04-18 19:12:29 +03:00
|
|
|
}
|