multi-project/projects/app/_modules/layout/header/user-bar/header-user-bar.component.ts

47 lines
1.1 KiB
TypeScript

import {Component, Input} from '@angular/core';
import {AuthenticationService} from "@app/_services";
import {Router} from "@angular/router";
@Component({
selector: 'header-user-bar',
templateUrl: 'header-user-bar.component.html',
styleUrls: ['header-user-bar.component.scss']
})
export class HeaderUserBarComponent {
@Input() user: any;
public menuItems = <any>[];
public ddHidden = true;
constructor(public authService: AuthenticationService, private router: Router) {
}
get avatar() {
return this.user?.avatar?.data;
}
get isJournalVisible() {
return !this.authService.isMainCompanyMember || this.authService.isExpert || this.authService.isAdmin;
}
ngOnInit() {
}
close() {
this.ddHidden = true;
}
logout() {
if (confirm('Вы деествительно хотите выйти из системы?')) {
this.authService.logout();
this.ddHidden = true;
this.router.navigate(['']).then();
}
}
link(link: string) {
this.ddHidden = true;
this.router.navigate([link]).then();
}
}