header.component.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { AuthServiceService } from './../../shared/auth-service.service';
  2. import { Component, OnInit, LOCALE_ID, Inject } from '@angular/core';
  3. import { Router } from '@angular/router';
  4. import * as moment from 'moment';
  5. import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
  6. import { UserService } from '../../shared/user.service';
  7. @Component({
  8. selector: 'app-header',
  9. templateUrl: './header.component.html',
  10. styleUrls: ['./header.component.css']
  11. })
  12. export class HeaderComponent implements OnInit {
  13. imgSrc: string = '../../../assets/image';
  14. constructor(private authSer: AuthServiceService ,
  15. private userSer: UserService,
  16. private router: Router) { }
  17. currentDate: any = Date.now();
  18. ngOnInit() {
  19. this.authSer.showHeaderLogin = true;
  20. this.authSer.showHeaderDashBoard = false;
  21. this.authSer.onGetFooterData('internal').subscribe(
  22. (responce) => {
  23. this.authSer.footerData = responce['footer'];
  24. console.log(this.authSer.footerData);
  25. },
  26. (error) => {
  27. console.log(error);
  28. }
  29. );
  30. // const m = moment().format('iYYYY/iM/iD');
  31. // console.log(m);
  32. this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
  33. this.userSer.getUserDataProfile();
  34. console.log();
  35. }
  36. onGetProfile() {
  37. console.log('profile/' + this.authSer.dataLoginUser['id']);
  38. this.router.navigate(['profile/' + this.authSer.dataLoginUser['id']]);
  39. }
  40. //log out function
  41. onLogout() {
  42. localStorage.clear();
  43. //localStorage.setItem('token' , '');
  44. this.router.navigate(['login']);
  45. }
  46. onInternalPage() {
  47. this.router.navigate(['/InternalPage/home']);
  48. }
  49. }