Browse Source

extarnal page

amr 5 years ago
parent
commit
00ebee672a

+ 3 - 3
src/app/External-Page/external-page-content/external-page-content.component.html

@@ -12,7 +12,7 @@
                     </ul>
                     </ul>
                     <div class="carousel-inner">
                     <div class="carousel-inner">
                         <div class="carousel-item" *ngFor="let report of reports; let i = index" [ngClass]="i == 0 ? 'active' : ''">
                         <div class="carousel-item" *ngFor="let report of reports; let i = index" [ngClass]="i == 0 ? 'active' : ''">
-                          <img src="{{report['photo'].photo != 'null' || '' ?  authSer.pathImg + report['photo'].photo : 'not found'  }}" />
+                          <img src="{{ report.photo ? authSer.pathImg + report.photo.photo : '' }}" />
                           <div class="carousel-caption d-md-block">
                           <div class="carousel-caption d-md-block">
                               <h5>{{report.title}}</h5>
                               <h5>{{report.title}}</h5>
                               <p [innerHtml] = "report.description"></p>
                               <p [innerHtml] = "report.description"></p>
@@ -28,7 +28,7 @@
               <div class="col-12">
               <div class="col-12">
                 <div class="eventPart-w">
                 <div class="eventPart-w">
                   <div id="demo1" class="carousel slide" data-ride="carousel">
                   <div id="demo1" class="carousel slide" data-ride="carousel">
-                      <div class="carousel-inner">
+                      <div class="carousel-inner"> 
                           <div class="carousel-item" *ngFor="let event of events; let i = index" [ngClass]="i == 0 ? 'active' : ''">
                           <div class="carousel-item" *ngFor="let event of events; let i = index" [ngClass]="i == 0 ? 'active' : ''">
                               <div class="carousel-caption">
                               <div class="carousel-caption">
                                   <p><img src="../../../assets/image/eventX.png" /> <span> حدث :</span> {{event.name}}</p>
                                   <p><img src="../../../assets/image/eventX.png" /> <span> حدث :</span> {{event.name}}</p>
@@ -232,7 +232,7 @@
                       </ul>
                       </ul>
                       <div class="carousel-inner">
                       <div class="carousel-inner">
                           <div class="carousel-item" *ngFor="let report of reports; let i = index" [ngClass]="i == 0 ? 'active' : ''">
                           <div class="carousel-item" *ngFor="let report of reports; let i = index" [ngClass]="i == 0 ? 'active' : ''">
-                            <img src="{{authSer.pathImg + report['photo'].photo}}" />
+                            <img src="{{ report.photo ? authSer.pathImg + report.photo.photo : '' }}" />
                             <div class="carousel-caption d-none d-md-block">
                             <div class="carousel-caption d-none d-md-block">
                                 <h5>{{report.title_en}}</h5>
                                 <h5>{{report.title_en}}</h5>
                                 <p [innerHtml] = "report.description_en"></p>
                                 <p [innerHtml] = "report.description_en"></p>

+ 1 - 0
src/app/External-Page/external-page-content/external-page-content.component.ts

@@ -76,6 +76,7 @@ export class ExternalPageContentComponent implements OnInit, OnDestroy {
       (responce) => {
       (responce) => {
         console.log(responce);
         console.log(responce);
         this.reports = responce['data'].reports;
         this.reports = responce['data'].reports;
+        console.log(this.reports);
         for(let i = 0; i < this.reports.length; i++) {
         for(let i = 0; i < this.reports.length; i++) {
           if(this.reports[i].description.length > 100) {
           if(this.reports[i].description.length > 100) {
             this.reports[i].description = this.reports[i].description.substring(0,300) + '.......';
             this.reports[i].description = this.reports[i].description.substring(0,300) + '.......';

+ 4 - 4
src/app/External-Page/external-page-header/external-page-header.component.html

@@ -8,8 +8,8 @@
                             <li class="profileData-w">
                             <li class="profileData-w">
                                 <div class="dropdown">
                                 <div class="dropdown">
                                     <button class="btn dropdown-toggle buttonW" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                     <button class="btn dropdown-toggle buttonW" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                        <img src="{{dataLoginUser.photo ? authSer.pathImg + dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
-                                        {{ dataLoginUser.name ? dataLoginUser.name : '' }} 
+                                        <img src="{{dataLoginUser? authSer.pathImg + dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
+                                        {{ dataLoginUser? dataLoginUser.name : 'user' }} 
                                     </button>
                                     </button>
                                     <div class="dropdown-menu" style="text-align:right" aria-labelledby="dropdownMenuButton"> 
                                     <div class="dropdown-menu" style="text-align:right" aria-labelledby="dropdownMenuButton"> 
                                         <button class="dropdown-item" style="cursor: pointer;" >
                                         <button class="dropdown-item" style="cursor: pointer;" >
@@ -133,8 +133,8 @@
                             <li class="profileData-w">
                             <li class="profileData-w">
                                 <div class="dropdown">
                                 <div class="dropdown">
                                     <button class="btn dropdown-toggle buttonW" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                     <button class="btn dropdown-toggle buttonW" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                        <img src="{{authSer.dataLoginUser['photo'] ? authSer.pathImg + authSer.dataLoginUser['photo'] : authSer.imgSrc}}" title="imageProfile" alt="" />
-                                        {{ authSer.dataLoginUser['name'] }}
+                                        <img src="{{dataLoginUser? authSer.pathImg + dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
+                                        {{ dataLoginUser? dataLoginUser.name : 'user' }}
                                     </button>
                                     </button>
                                     <div class="dropdown-menu" style="text-align:right" aria-labelledby="dropdownMenuButton"> 
                                     <div class="dropdown-menu" style="text-align:right" aria-labelledby="dropdownMenuButton"> 
                                         <button class="dropdown-item" style="cursor: pointer;" >
                                         <button class="dropdown-item" style="cursor: pointer;" >

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

@@ -17,11 +17,8 @@ export class ExternalPageHeaderComponent implements OnInit {
     currentDate: any = Date.now();//ararbic date 
     currentDate: any = Date.now();//ararbic date 
     currentEnglishDate: any = Date.now(); //english date
     currentEnglishDate: any = Date.now(); //english date
 
 
-    dataLoginUser = {
-      name: '',
-      photo: '',
-      id: '',
-    }
+    dataLoginUser: any;
+
 
 
   ngOnInit() {
   ngOnInit() {
 
 
@@ -32,10 +29,8 @@ export class ExternalPageHeaderComponent implements OnInit {
     this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
     this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
     
     
     if(!this.authSer.isAuthenticated()) {
     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;
+      console.log('user data ', this.authSer.returnUserData());
+      this.dataLoginUser = JSON.parse(localStorage.getItem('userData'));
     }
     }
 
 
     console.log(this.dataLoginUser);
     console.log(this.dataLoginUser);

+ 4 - 4
src/app/Internal-Page/internal-page-content/internal-page-content.component.html

@@ -2,7 +2,7 @@
     <div class="container">
     <div class="container">
         <div class="contentPage-w">
         <div class="contentPage-w">
             <div class="advertisiment">
             <div class="advertisiment">
-                <img src="{{ authSer.pathImg + advertisiment.photo }}" />
+                <img *ngIf="advertisiment.photo" src="{{ advertisiment.photo ? authSer.pathImg + advertisiment.photo : ''}}" />
             </div>
             </div>
 
 
             <div class="servicesContent-w">
             <div class="servicesContent-w">
@@ -13,7 +13,7 @@
                                 <div class="col-lg-6 col-md-12 col-sm-4 col-xs-12 editRowPadding-w" *ngFor="let service of externalServices">
                                 <div class="col-lg-6 col-md-12 col-sm-4 col-xs-12 editRowPadding-w" *ngFor="let service of externalServices">
                                     <a class="hyperLink" (click)="onGetService(service)">
                                     <a class="hyperLink" (click)="onGetService(service)">
                                         <div class="serviceItem-w">
                                         <div class="serviceItem-w">
-                                            <img src="{{authSer.pathImg + service.photo}}" title="TITLE NEED SHOW ON HOVER"/>
+                                            <img src="{{service.photo ? authSer.pathImg + service.photo : ''}}" title="TITLE NEED SHOW ON HOVER"/>
                                             <p>{{service.name}}</p>
                                             <p>{{service.name}}</p>
                                         </div>
                                         </div>
                                     </a>
                                     </a>
@@ -26,7 +26,7 @@
                                 <div *ngIf="reportsData.length > 1"> 
                                 <div *ngIf="reportsData.length > 1"> 
                                     <ngb-carousel #myCarousel="ngbCarousel">
                                     <ngb-carousel #myCarousel="ngbCarousel">
                                         <ng-template ngbSlide *ngFor="let report of reportsData; let i = index" id={{i}} >
                                         <ng-template ngbSlide *ngFor="let report of reportsData; let i = index" id={{i}} >
-                                            <img [src]="authSer.pathImg + report.photo.photo" alt="Random first slide">
+                                            <img [src]="report.photo ? authSer.pathImg + report.photo.photo : ''" alt="Random first slide">
                                             <div class="carousel-caption">
                                             <div class="carousel-caption">
                                             <h4>{{report.title}}</h4>
                                             <h4>{{report.title}}</h4>
                                             <p class="paragraphTemplate-w" [innerHTML] = "report.description"> </p>
                                             <p class="paragraphTemplate-w" [innerHTML] = "report.description"> </p>
@@ -272,7 +272,7 @@
                 <div class="slider" *ngIf="reportsData.length > 1">
                 <div class="slider" *ngIf="reportsData.length > 1">
                 <ngb-carousel>
                 <ngb-carousel>
                     <ng-template *ngFor="let report of reportsData" ngbSlide>
                     <ng-template *ngFor="let report of reportsData" ngbSlide>
-                    <img src="{{authSer.pathImg + report.photo.photo}}" alt="Random first slide">
+                    <img src="{{report.photo ? authSer.pathImg + report.photo.photo : ''}}" alt="Random first slide">
                     <div class="carousel-caption">
                     <div class="carousel-caption">
                         <h4>{{report.title_en}}</h4>
                         <h4>{{report.title_en}}</h4>
                         <p class="paragraphTemplate-w" [innerHTML] = "report.description_en"></p>
                         <p class="paragraphTemplate-w" [innerHTML] = "report.description_en"></p>

+ 1 - 0
src/app/app.component.ts

@@ -1,3 +1,4 @@
+import { AuthServiceService } from 'src/app/shared/auth-service.service';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { Component, OnInit } from '@angular/core';
 import { Component, OnInit } from '@angular/core';
 
 

+ 2 - 0
src/app/dashboard/dasboard-content.html

@@ -1,3 +1,5 @@
+<!-- <app-header></app-header> -->
+
 <div class="routerLinkContainer-w" [style.min-height.px]="screenHeight">
 <div class="routerLinkContainer-w" [style.min-height.px]="screenHeight">
     <router-outlet></router-outlet>
     <router-outlet></router-outlet>
 </div>
 </div>

+ 4 - 0
src/app/dashboard/dashboard-content.ts

@@ -15,8 +15,10 @@ export class DashboardContent implements OnInit {
   }
   }
 
 
 
 
+
   ngOnInit() {
   ngOnInit() {
     this.authSer.arabicTemplate = true; //to make footer arabic all time 
     this.authSer.arabicTemplate = true; //to make footer arabic all time 
+    
   }
   }
 
 
 
 
@@ -28,6 +30,8 @@ export class DashboardContent implements OnInit {
         console.log(this.screenHeight);
         console.log(this.screenHeight);
   }
   }
 
 
+ 
+
 
 
 
 
 }
 }

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

@@ -11,8 +11,8 @@
                           <li class="profileData-w">
                           <li class="profileData-w">
                             <div class="btn-group" ngbDropdown role="group" aria-label="Button group with nested dropdown">
                             <div class="btn-group" ngbDropdown role="group" aria-label="Button group with nested dropdown">
                                 <button class="buttonW" ngbDropdownToggle>
                                 <button class="buttonW" ngbDropdownToggle>
-                                    <img src="{{dataLoginUser.photo ? authSer.pathImg + dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
-                                      {{dataLoginUser.name ? dataLoginUser.name : 'user' }} 
+                                    <img src="{{authSer.dataLoginUser? authSer.pathImg + authSer.dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
+                                      {{authSer.dataLoginUser? authSer.dataLoginUser.name : 'user' }} 
                                 </button>
                                 </button>
                   
                   
                             <div class="dropdown-menu" style="text-align:right" ngbDropdownMenu>
                             <div class="dropdown-menu" style="text-align:right" ngbDropdownMenu>

+ 7 - 13
src/app/dashboard/header/header.component.ts

@@ -20,28 +20,22 @@ export class HeaderComponent implements OnInit {
     
     
   currentDate: any = Date.now();
   currentDate: any = Date.now();
   
   
-  dataLoginUser = {
-    name: '',
-    photo: '',
-    id: '',
-  }
+  dataLoginUser: any;
 
 
   ngOnInit() {
   ngOnInit() {
 
 
-    this.authSer.showHeaderLogin = true;
-    this.authSer.showHeaderDashBoard = false;
-
+    this.authSer.showHeaderLogin = false;
+    this.authSer.showHeaderDashBoard = true;
+    this.authSer.showDashboardHeader = true;
 
 
     this.authSer.checkExternalFooter = false;
     this.authSer.checkExternalFooter = false;
 
 
     if(!this.authSer.isAuthenticated()) {
     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;
+      console.log('user data ', this.authSer.returnUserData());
+      this.dataLoginUser = JSON.parse(localStorage.getItem('userData'));
+      console.log('data loginnnnn', this.dataLoginUser);
     }
     }
 
 
-    console.log(this.dataLoginUser);
 
 
     if(this.authSer.checkExternalFooter) {
     if(this.authSer.checkExternalFooter) {
     } else {
     } else {

+ 4 - 2
src/app/dashboard/main-menu/add-menu/add-menu.component.ts

@@ -78,7 +78,9 @@ export class AddMenuComponent implements OnInit {
           this.servicesName = 'خدمه إداره المحتوي';
           this.servicesName = 'خدمه إداره المحتوي';
         } else if(this.serviceId == 2) {
         } else if(this.serviceId == 2) {
           this.servicesName = 'خدمه أدراه الصفحه الخارجيه';
           this.servicesName = 'خدمه أدراه الصفحه الخارجيه';
+          
         }
         }
+        
       }
       }
     );
     );
 
 
@@ -91,7 +93,7 @@ export class AddMenuComponent implements OnInit {
           this.dashBoardService.getItemData(this.menuId, 'mainMenu').subscribe(
           this.dashBoardService.getItemData(this.menuId, 'mainMenu').subscribe(
             (responce) => {
             (responce) => {
               console.log(responce);
               console.log(responce);
-              console.log(responce['menu']);
+              console.log('here is the menu', responce['menu']);
               this.menu.name = responce['menu'].name;
               this.menu.name = responce['menu'].name;
               this.menu.name_en = responce['menu'].name_en;
               this.menu.name_en = responce['menu'].name_en;
               this.menu.link = responce['menu'].link;
               this.menu.link = responce['menu'].link;
@@ -127,7 +129,7 @@ export class AddMenuComponent implements OnInit {
       }
       }
     );
     );
 
 
-    this.dashBoardService.getParentList().subscribe(
+    this.dashBoardService.getParentList(this.serviceId).subscribe(
       (responce) => {
       (responce) => {
         console.log('parents' , responce);
         console.log('parents' , responce);
         this.parentList = responce['menus'];
         this.parentList = responce['menus'];

+ 0 - 1
src/app/dashboard/tabs/add-tab/add-tab.component.html

@@ -67,7 +67,6 @@
 
 
             <div class="col-12 col-sm-12 col-md-4" style="margin-bottom:30px">
             <div class="col-12 col-sm-12 col-md-4" style="margin-bottom:30px">
                 <div class="form-group text-center imgContainer">
                 <div class="form-group text-center imgContainer">
-                
                   <button class="btn btn-default" *ngIf="checkShowDownloadFile" type="button" style="position: absolute; background:transparent; border:none; left:17px; top:32px"> <a href="{{authSer.pathImg + tab.file}}"><i class="fas fa-download"></i></a></button>
                   <button class="btn btn-default" *ngIf="checkShowDownloadFile" type="button" style="position: absolute; background:transparent; border:none; left:17px; top:32px"> <a href="{{authSer.pathImg + tab.file}}"><i class="fas fa-download"></i></a></button>
                 </div>
                 </div>
             </div>
             </div>

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

@@ -71,6 +71,7 @@ export class AuthServiceService {
 
 
   dataLoginUser: any;
   dataLoginUser: any;
   
   
+  
   //login function
   //login function
   login(dataForm) {
   login(dataForm) {
     console.log(dataForm);
     console.log(dataForm);

+ 7 - 1
src/app/shared/dashboard.service.ts

@@ -529,8 +529,14 @@ export class DashboardService {
     }
     }
 
 
       //get parent list 
       //get parent list 
-  getParentList() {
+  getParentList(serviceId: number) {
+    if(serviceId == 2){
+    console.log(this.authService.pathApi + '/parents_list/' + 1);
+    return this.http.get(this.authService.pathApi + '/parents_list/' + 1);
+      
+    }else if(serviceId == 6){
     return this.http.get(this.authService.pathApi + '/parents_list');
     return this.http.get(this.authService.pathApi + '/parents_list');
+    }
   }
   }
 
 
 
 

+ 4 - 0
src/app/shared/internal-page.service.ts

@@ -10,11 +10,15 @@ export class InternalPageService {
   constructor(private http: HttpClient, public authSer: AuthServiceService) { }
   constructor(private http: HttpClient, public authSer: AuthServiceService) { }
 
 
 
 
+
   //get internl page data 
   //get internl page data 
   getInternalPageData() {
   getInternalPageData() {
+
     if(this.authSer.isAuthenticated()) {
     if(this.authSer.isAuthenticated()) {
+      console.log(this.authSer.isAuthenticated());
       return this.http.get(this.authSer.pathApi + '/internal_page');
       return this.http.get(this.authSer.pathApi + '/internal_page');
     } else {
     } else {
+      console.log(this.authSer.isAuthenticated());
       return this.http.get(this.authSer.pathApi + '/internal_page/1');
       return this.http.get(this.authSer.pathApi + '/internal_page/1');
     }
     }
   }
   }