internal-page-header.component.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { Router } from '@angular/router';
  2. import { InternalPageService } from './../../shared/internal-page.service';
  3. import { UserService } from './../../shared/user.service';
  4. import { AuthServiceService } from './../../shared/auth-service.service';
  5. import { Component, OnInit } from '@angular/core';
  6. @Component({
  7. selector: 'app-internal-page-header',
  8. templateUrl: './internal-page-header.component.html',
  9. styleUrls: ['./internal-page-header.component.css']
  10. })
  11. export class InternalPageHeaderComponent implements OnInit {
  12. constructor(private authSer: AuthServiceService,
  13. private userservice: UserService,
  14. private internalService: InternalPageService,
  15. private router: Router) { }
  16. parentsPage = [];
  17. currentDate: number = Date.now();
  18. ngOnInit() {
  19. this.authSer.arabicTemplate = true;
  20. this.authSer.arabicLanguage = true;
  21. this.authSer.englishLanguage = false;
  22. console.log('tooooken', this.authSer.isAuthenticated());
  23. this.internalService.getParentData().subscribe(
  24. (responce) => {
  25. this.parentsPage = responce['parents'];
  26. console.log('parents pageees', this.parentsPage);
  27. },
  28. (error) => {
  29. console.log(error);
  30. }
  31. );
  32. //this.spinner.show();
  33. this.authSer.showDashboardHeader = false;
  34. this.internalService.getParentData();
  35. //console.log(this.checkTokenExpire);
  36. //get profile data
  37. this.userservice.getUserDataProfile();
  38. this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar');
  39. }
  40. onLogin() {
  41. this.router.navigate(['/login']);
  42. }
  43. onGetProfile() {
  44. console.log('profile/' + this.authSer.dataLoginUser['id']);
  45. this.router.navigate(['profile/' + this.authSer.dataLoginUser['id']]);
  46. }
  47. //log out function
  48. onLogout() {
  49. localStorage.clear();
  50. this.router.navigate(['login']);
  51. }
  52. onDashBoard() {
  53. this.router.navigate(['dashboard/' + this.authSer.dataLoginUser['id']]);
  54. }
  55. goToHome() {
  56. this.router.navigate(['InternalPage/home']);
  57. }
  58. }