external-page-header.component.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { ExternalPageService } from './../../shared/external-page.service';
  2. import { AuthServiceService } from './../../shared/auth-service.service';
  3. import { Component, OnInit } from '@angular/core';
  4. import { Router } from '@angular/router';
  5. @Component({
  6. selector: 'app-external-page-header',
  7. templateUrl: './external-page-header.component.html',
  8. styleUrls: ['./external-page-header.component.css']
  9. })
  10. export class ExternalPageHeaderComponent implements OnInit {
  11. constructor(private authSer: AuthServiceService,
  12. private externalService: ExternalPageService,
  13. private router: Router) { }
  14. currentDate: any = Date.now();//ararbic date
  15. currentEnglishDate: any = Date.now(); //english date
  16. ngOnInit() {
  17. this.authSer.arabicTemplate = true;
  18. this.authSer.showDashboardHeader = false;
  19. this.authSer.setLocalLang(); //set languages icons
  20. this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
  21. this.authSer.footerData = [];
  22. this.authSer.onGetFooterData('external').subscribe(
  23. (responce) => {
  24. this.authSer.footerData = responce['footer'];
  25. console.log('fooooooooooooooter dattaaa' , this.authSer.footerData);
  26. },
  27. (error) => {
  28. console.log(error);
  29. }
  30. );
  31. //get header data
  32. this.externalService.getHeader().subscribe(
  33. (responce) => {
  34. console.log(responce);
  35. this.externalService.headerMenus = responce['parents'];
  36. console.log('menu data' , this.externalService.headerMenus);
  37. },
  38. (error) => {
  39. console.log(error);
  40. }
  41. );
  42. }
  43. onDashBoard() {
  44. this.router.navigate(['services/' + this.authSer.dataLoginUser['id']]);
  45. }
  46. goToHome() {
  47. this.router.navigate(['/ExternalPage']);
  48. }
  49. onLogin() {
  50. this.router.navigate(['/login']);
  51. }
  52. onGetProfile() {
  53. console.log('profile/' + this.authSer.dataLoginUser['id']);
  54. this.router.navigate(['profile/' + this.authSer.dataLoginUser['id']]);
  55. }
  56. //log out function
  57. onLogout() {
  58. localStorage.clear();
  59. this.router.navigate(['login']);
  60. }
  61. }