import { AuthServiceService } from './../../shared/auth-service.service';
import { Component, OnInit, LOCALE_ID, Inject } from '@angular/core';
import { Router } from '@angular/router';
import * as moment from 'moment';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import { UserService } from '../../shared/user.service';

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.css']
})

export class HeaderComponent implements OnInit {

  imgSrc: string = '../../../assets/image'; 


  constructor(private authSer: AuthServiceService ,
    private userSer: UserService,
    private router: Router) { }


  ngOnInit() {

    this.authSer.showHeaderLogin = true;
    this.authSer.showHeaderDashBoard = false;

    
    const m = moment().format('iYYYY/iM/iD');
    console.log(m);
   
    this.userSer.getUserDataProfile();
    console.log();
   
  }

  onGetProfile() {
    console.log('profile/'  + this.authSer.dataLoginUser['id']);
    this.router.navigate(['profile/'  + this.authSer.dataLoginUser['id']]);
  }

  //log out function
  onLogout() {
    localStorage.clear();
    //localStorage.setItem('token' , '');
    this.router.navigate(['login']);
  }

  onInternalPage() {
    this.router.navigate(['/InternalPage/home']);
  }


}