import { ExternalPageService } from './../../shared/external-page.service'; import { AuthServiceService } from './../../shared/auth-service.service'; import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; @Component({ selector: 'app-external-page-header', templateUrl: './external-page-header.component.html', styleUrls: ['./external-page-header.component.css'] }) export class ExternalPageHeaderComponent implements OnInit { constructor(public authSer: AuthServiceService, private externalService: ExternalPageService, private router: Router) { } currentDate: any = Date.now()//ararbic date currentEnglishDate: any = Date.now(); //english date 372 dataLoginUser:any; ngOnInit() { this.authSer.arabicTemplate = true; this.authSer.showDashboardHeader = false; this.authSer.setLocalLang(); //set languages icons console.log('current data ', this.currentDate); this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header'); if(!this.authSer.isAuthenticated()) { console.log('user data external header', this.authSer.returnUserData()); this.dataLoginUser = this.authSer.returnUserData(); } console.log(this.dataLoginUser); this.authSer.footerData = []; this.authSer.onGetFooterData('external').subscribe( (responce) => { this.authSer.footerData = responce['footer']; console.log('fooooooooooooooter dattaaa' , this.authSer.footerData); }, (error) => { console.log(error); } ); //get header data this.externalService.getHeader().subscribe( (responce) => { console.log(responce); this.externalService.headerMenus = responce['parents']; console.log('menu data' , this.externalService.headerMenus); }, (error) => { console.log(error); } ); } onDashBoard() { this.router.navigate(['services/' + this.dataLoginUser.id]); } goToHome() { this.router.navigate(['/ExternalPage']); } onLogin() { this.router.navigate(['auth/login']); } onGetProfile() { this.router.navigate(['auth/profile/' + this.dataLoginUser.id]); } //log out function onLogout() { localStorage.clear(); this.router.navigate(['auth/login']); } }