123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- import { Router, ActivatedRoute, Params } from '@angular/router';
- import { InternalPageService } from './../../shared/internal-page.service';
- import { UserService } from './../../shared/user.service';
- import { AuthServiceService } from './../../shared/auth-service.service';
- import { Component, OnInit } from '@angular/core';
- import 'hijri-date';
- import HijriDate,{toHijri} from 'hijri-date/lib/safe';
- import { NgxSpinnerService } from 'ngx-spinner';
- @Component({
- selector: 'app-internal-page-header',
- templateUrl: './internal-page-header.component.html',
- styleUrls: ['./internal-page-header.component.css']
- })
- export class InternalPageHeaderComponent implements OnInit {
- constructor(public authSer: AuthServiceService,
- private userservice: UserService,
- private internalService: InternalPageService,
- private route: ActivatedRoute,
- private spinner: NgxSpinnerService,
- private router: Router) {
- spinner.show();
- }
-
- dataLoginUser = {
- name: '',
- photo: '',
- }
-
- currentDate: any = Date.now();
- currentEnglishDate: any = Date.now();
- showActiveBackground: boolean = false;
-
- ngOnInit() {
-
- this.authSer.footerData = [];
-
- if(!this.authSer.isAuthenticated()) {
- this.dataLoginUser.name = this.authSer.returnUserData().name;
- this.dataLoginUser.photo = this.authSer.returnUserData().photo;
- }
- this.authSer.onGetFooterData('internal').subscribe(
- (responce) => {
- this.authSer.footerData = responce['footer'];
- console.log(this.authSer.footerData);
- },
- (error) => {
- console.log(error);
- }
- );
- this.authSer.setLocalLang();
- console.log('tooooken', this.authSer.isAuthenticated());
- this.internalService.getParentData().subscribe(
- (responce) => {
- this.authSer.parentsPage = responce['parents'];
- console.log('parents pageees', this.authSer.parentsPage);
- },
- (error) => {
- console.log(error);
- }
- );
-
-
- this.authSer.showDashboardHeader = false;
- this.internalService.getParentData();
-
-
-
- this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
- }
- onLogin() {
- this.router.navigate(['auth/login']);
- }
- onGetProfile() {
- console.log('profile/' + this.authSer.dataLoginUser['id']);
- this.router.navigate(['auth/profile/' + this.authSer.dataLoginUser['id']]);
- }
-
- onLogout() {
- localStorage.clear();
- this.router.navigate(['auth/login']);
- }
- onDashBoard() {
- this.router.navigate(['services/' + this.authSer.dataLoginUser['id']]);
- }
- goToHome() {
- this.router.navigate(['/InternalPage']);
- }
- getData(parentData) {
- console.log(parentData);
- }
-
-
- }
|