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'; import { NgxSpinnerService } from 'ngx-spinner'; @Component({ selector: 'app-internal-page-header', templateUrl: './internal-page-header.component.html', styleUrls: ['./internal-page-header.component.css'] }) export class InternalPageHeaderComponent implements OnInit { constructor(public authSer: AuthServiceService, private userservice: UserService, private internalService: InternalPageService, private route: ActivatedRoute, private spinner: NgxSpinnerService, private router: Router) { spinner.show(); } dataLoginUser:any; currentDate: any = Date.now(); currentEnglishDate: any = Date.now(); showActiveBackground: boolean = false; ngOnInit() { this.authSer.footerData = []; if(!this.authSer.isAuthenticated()) { console.log('user data internal header', this.authSer.returnUserData()); this.dataLoginUser = this.authSer.returnUserData(); } this.authSer.onGetFooterData('internal').subscribe( (responce) => { this.authSer.footerData = responce['footer']; }, (error) => { console.log(error); } ); this.authSer.setLocalLang(); this.internalService.getParentData().subscribe( (responce) => { this.authSer.parentsPage = responce['parents']; }, (error) => { console.log(error); } ); //this.spinner.show(); this.authSer.showDashboardHeader = false; this.internalService.getParentData(); this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header'); } onLogin() { this.router.navigate(['auth/login']); } onGetProfile() { this.router.navigate(['auth/profile/' + this.authSer.dataLoginUser['id']]); } //log out function onLogout() { localStorage.clear(); this.router.navigate(['auth/login']); } onDashBoard() { this.router.navigate(['services/' + this.authSer.dataLoginUser['id']]); } goToHome() { this.router.navigate(['/InternalPage']); } getData(parentData) { console.log(parentData); } }