Browse Source

Merge branch 'ibrahimBranch2' into amr

amr 5 years ago
parent
commit
11566e3ac0

+ 3 - 3
src/app/External-Page/external-page-header/external-page-header.component.ts

@@ -17,8 +17,8 @@ export class ExternalPageHeaderComponent implements OnInit {
     currentDate: any = Date.now();//ararbic date 
     currentEnglishDate: any = Date.now(); //english date
 
-    dataLoginUser: any;
 
+    dataLoginUser:any;
 
   ngOnInit() {
 
@@ -29,8 +29,8 @@ export class ExternalPageHeaderComponent implements OnInit {
     this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
     
     if(!this.authSer.isAuthenticated()) {
-      console.log('user data ', this.authSer.returnUserData());
-      this.dataLoginUser = JSON.parse(localStorage.getItem('userData'));
+      console.log('user data external header', this.authSer.returnUserData());
+      this.dataLoginUser = this.authSer.returnUserData();
     }
 
     console.log(this.dataLoginUser);

+ 4 - 10
src/app/Internal-Page/internal-page-header/internal-page-header.component.ts

@@ -23,11 +23,7 @@ export class InternalPageHeaderComponent implements OnInit {
       spinner.show();
      }
   
-     dataLoginUser = {
-      name: '',
-      photo: '',
-      id: '',
-    }
+  dataLoginUser:any;
     
   currentDate: any = Date.now();
 
@@ -40,11 +36,9 @@ export class InternalPageHeaderComponent implements OnInit {
    
      this.authSer.footerData = [];
      
-     if(!this.authSer.isAuthenticated()) {
-      const userLoginData = JSON.parse(localStorage.getItem('userData'));
-      this.dataLoginUser.name = userLoginData ? userLoginData.name : '';
-      this.dataLoginUser.photo = userLoginData ? userLoginData.photo : '';
-      this.dataLoginUser.id = userLoginData ? userLoginData.id : null;
+    if(!this.authSer.isAuthenticated()) {
+      console.log('user data internal header', this.authSer.returnUserData());
+      this.dataLoginUser = this.authSer.returnUserData();
     }
 
     this.authSer.onGetFooterData('internal').subscribe(

+ 3 - 3
src/app/app.component.html

@@ -8,9 +8,9 @@
 
  <app-header></app-header>
 
-    <div class="routerLinkContainer-w" [style.min-height.px]="myInnerHeight">
-        <router-outlet></router-outlet>
-    </div>
+<div class="routerLinkContainer-w" [style.min-height.px]="myInnerHeight">
+    <router-outlet></router-outlet>
+</div>
 
 <app-footer></app-footer>
 

+ 5 - 5
src/app/app.component.ts

@@ -13,13 +13,13 @@ import { Component, OnInit } from '@angular/core';
 export class AppComponent implements OnInit {
 
   myInnerHeight = window.innerHeight;
-
-constructor(private spinner: NgxSpinnerService) {
+  dataLoginUser: any;
+  
+constructor(private spinner: NgxSpinnerService, 
+  private authSer: AuthServiceService) {
   this.spinner.show();
 }
-  ngOnInit() {
-
-  }
+  ngOnInit() {}
 
  
 }

+ 1 - 1
src/app/dashboard/header/header.component.html

@@ -1,6 +1,6 @@
 <div class="headerDashBoard" *ngIf="authSer.showDashboardHeader">   
     <!-- top Header content -->
-    <div class="header" *ngIf="authSer.showHeaderDashBoard">
+    <div class="header">
       <div class="container">
         <div class="row">
           <div class="col-6 col-sm-6 col-md-6 col-lg-6">

+ 4 - 5
src/app/dashboard/header/header.component.ts

@@ -25,15 +25,14 @@ export class HeaderComponent implements OnInit {
   ngOnInit() {
 
     this.authSer.showHeaderLogin = false;
-    this.authSer.showHeaderDashBoard = true;
-    this.authSer.showDashboardHeader = true;
+    this.authSer.showHeaderDashBoard = false;
+    this.authSer.showDashboardHeader = false;
 
     this.authSer.checkExternalFooter = false;
 
     if(!this.authSer.isAuthenticated()) {
-      console.log('user data ', this.authSer.returnUserData());
-      this.dataLoginUser = JSON.parse(localStorage.getItem('userData'));
-      console.log('data loginnnnn', this.dataLoginUser);
+      console.log('user data internal header', this.authSer.returnUserData());
+      this.dataLoginUser = this.authSer.returnUserData();
     }
 
 

+ 2 - 1
src/app/shared/auth-service.service.ts

@@ -93,7 +93,8 @@ export class AuthServiceService {
 
   //return user data 
   returnUserData() {
-    return JSON.parse(localStorage.getItem('userObject'));
+    this.dataLoginUser = JSON.parse(localStorage.getItem('userObject'));
+    return this.dataLoginUser;
   }
 
 

+ 2 - 0
src/app/shared/user.service.ts

@@ -16,6 +16,8 @@ export class UserService {
       private spinner: NgxSpinnerService) { }
 
 
+
+
   //get profile data
   getUserDataProfile() {
     this.http.get(this.authService.pathApi + '/profile').subscribe(