import { Router, ActivatedRoute, Params } from '@angular/router'; import { InternalPageService } from './../../shared/internal-page.service'; import { UserService } from './../../shared/user.service'; import { AuthServiceService } from './../../shared/auth-service.service'; import { Component, OnInit } from '@angular/core'; import 'hijri-date'; import HijriDate,{toHijri} from 'hijri-date/lib/safe'; @Component({ selector: 'app-internal-page-header', templateUrl: './internal-page-header.component.html', styleUrls: ['./internal-page-header.component.css'] }) export class InternalPageHeaderComponent implements OnInit { constructor(private authSer: AuthServiceService, private userservice: UserService, private internalService: InternalPageService, private route: ActivatedRoute, private router: Router) { } currentDate: any = Date.now(); currentEnglishDate: any = Date.now(); showActiveBackground: boolean = false; ngOnInit() { this.authSer.setLocalLang(); console.log('tooooken', this.authSer.isAuthenticated()); this.internalService.getParentData().subscribe( (responce) => { this.authSer.parentsPage = responce['parents']; console.log('parents pageees', this.authSer.parentsPage); }, (error) => { console.log(error); } ); //this.spinner.show(); this.authSer.showDashboardHeader = false; this.internalService.getParentData(); //console.log(this.checkTokenExpire); //get profile data this.userservice.getUserDataProfile(); this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header'); } onLogin() { this.router.navigate(['/login']); } onGetProfile() { console.log('profile/' + this.authSer.dataLoginUser['id']); this.router.navigate(['profile/' + this.authSer.dataLoginUser['id']]); } //log out function onLogout() { localStorage.clear(); this.router.navigate(['login']); } onDashBoard() { this.router.navigate(['services/' + this.authSer.dataLoginUser['id']]); } goToHome() { this.router.navigate(['InternalPage/home']); } }