1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- import { ExternalPageService } from './../../shared/external-page.service';
- import { AuthServiceService } from './../../shared/auth-service.service';
- import { Component, OnInit } from '@angular/core';
- import { Router } from '@angular/router';
- @Component({
- selector: 'app-external-page-header',
- templateUrl: './external-page-header.component.html',
- styleUrls: ['./external-page-header.component.css']
- })
- export class ExternalPageHeaderComponent implements OnInit {
- constructor(public authSer: AuthServiceService,
- private externalService: ExternalPageService,
- private router: Router) { }
-
- currentDate: any = Date.now()//ararbic date
-
- currentEnglishDate: any = Date.now(); //english date
- 372
- dataLoginUser:any;
- ngOnInit() {
- this.authSer.arabicTemplate = true;
- this.authSer.showDashboardHeader = false;
- this.authSer.setLocalLang(); //set languages icons
- console.log('current data ', this.currentDate);
- this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
-
- if(!this.authSer.isAuthenticated()) {
- console.log('user data external header', this.authSer.returnUserData());
- this.dataLoginUser = this.authSer.returnUserData();
- }
- console.log(this.dataLoginUser);
-
- this.authSer.footerData = [];
- this.authSer.onGetFooterData('external').subscribe(
- (responce) => {
- this.authSer.footerData = responce['footer'];
- console.log('fooooooooooooooter dattaaa' , this.authSer.footerData);
- },
- (error) => {
- console.log(error);
- }
- );
-
- //get header data
- this.externalService.getHeader().subscribe(
- (responce) => {
- console.log(responce);
- this.externalService.headerMenus = responce['parents'];
- console.log('menu data' , this.externalService.headerMenus);
- },
- (error) => {
- console.log(error);
- }
- );
- }
- onDashBoard() {
- this.router.navigate(['services/' + this.dataLoginUser.id]);
- }
- goToHome() {
- this.router.navigate(['/ExternalPage']);
- }
- onLogin() {
- this.router.navigate(['auth/login']);
- }
- onGetProfile() {
- this.router.navigate(['auth/profile/' + this.dataLoginUser.id]);
- }
- //log out function
- onLogout() {
- localStorage.clear();
- this.router.navigate(['auth/login']);
- }
- }
|