Hima 5 years ago
parent
commit
f31650023d

+ 5 - 0
package-lock.json

@@ -1349,6 +1349,11 @@
         "humanize-ms": "^1.2.1"
       }
     },
+    "agm-direction": {
+      "version": "0.7.6",
+      "resolved": "https://registry.npmjs.org/agm-direction/-/agm-direction-0.7.6.tgz",
+      "integrity": "sha512-DefGnQSFpDnEM71t9bzNT5t5R2Xb2l41Y64pEmIe+hwEuZKMpCPIQ+4/tpEY3pdZoSOOEtNAEKyLUpvshWOnXg=="
+    },
     "ajv": {
       "version": "6.5.3",
       "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz",

+ 1 - 0
package.json

@@ -28,6 +28,7 @@
     "@types/es6-promise": "^3.3.0",
     "@types/hammerjs": "^2.0.36",
     "@types/jwt-decode": "^2.2.1",
+    "agm-direction": "^0.7.6",
     "alife-file-to-base64": "0.0.2",
     "angular-calendar": "^0.26.4",
     "angular-font-awesome": "^3.1.2",

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

@@ -386,7 +386,7 @@ input,button {
 
 .externalPageContentt-w .recordsContent-w .medical .body #demo2 {
     width: 100%;
-    height: 100;
+    height: 100%;
 }
 
 .externalPageContentt-w .recordsContent-w .medical .body #demo2 .active {

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

@@ -165,7 +165,7 @@
                                 <div class="carousel-inner">
                                     <div class="carousel-item" *ngFor="let achievement of achievements; let i = index" [ngClass]="i == 0 ? 'active' : ''">
                                         <div class="carousel-caption">
-                                            <p>{{achievement.description}}</p>
+                                            <p [innerHtml]="achievement.description"></p>
                                         </div>   
                                     </div>
                                 </div>
@@ -179,14 +179,14 @@
               </div>
             </div>
 
-            <!-- <div class="col-12">
+            <div class="col-12">
               <div class="maps">
                 <h1>إتصل بنا</h1>
                 <agm-map [latitude]="lat" [longitude]="lng">
                     <agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
                   </agm-map>
               </div>
-            </div> -->
+            </div>
       
           </div>
         </div>
@@ -255,8 +255,39 @@
                   <div class="col-12 col-sm-12 col-md-4 col-lg-4">
                     <div class="advertisimentServices-w text-center">
                       <h1>Advertising services</h1>
-                      <div class="body">
-                         
+                       <div class="body">
+                        <div id="carouselExample" class="carousel slide" data-ride="carousel" data-interval="9000">
+                          <div class="carousel-inner row w-100 mx-auto" role="listbox">
+                              <div class="carousel-item col-md-4" *ngFor="let image of firstAdvertisiment;let i = index" [ngClass]="i == 0 ? 'active' : '' ">
+                                  <img class="img-fluid mx-auto d-block" src="{{authSer.pathImg + image.photo}}" alt="slide 1">
+                              </div>
+                          </div>
+                          <a class="carousel-control-prev" href="#carouselExample" role="button" data-slide="prev">
+                              <i class="fa fa-chevron-left fa-lg text-muted"></i>
+                              <span class="sr-only">Previous</span>
+                          </a>
+                          <a class="carousel-control-next text-faded" href="#carouselExample" role="button" data-slide="next">
+                              <i class="fa fa-chevron-right fa-lg text-muted"></i>
+                              <span class="sr-only">Next</span>
+                          </a>
+                        </div>
+
+                        <div id="carouselExample2" class="carousel slide" data-ride="carousel" data-interval="9000">
+                          <div class="carousel-inner row w-100 mx-auto" role="listbox">
+                            <div class="carousel-item col-md-4" *ngFor="let slide2 of secondAdvertisiment;let i = index" [ngClass]=" i == 0 ? 'active' : '' ">
+                                <img class="img-fluid mx-auto d-block" src="{{authSer.pathImg + slide2.photo}}" alt="slide 1">
+                            </div>
+                          </div>
+                          <a class="carousel-control-prev" href="#carouselExample2" role="button" data-slide="prev">
+                              <i class="fa fa-chevron-left fa-lg text-muted"></i>
+                              <span class="sr-only">Previous</span>
+                          </a>
+                          <a class="carousel-control-next text-faded" href="#carouselExample2" role="button" data-slide="next">
+                              <i class="fa fa-chevron-right fa-lg text-muted"></i>
+                              <span class="sr-only">Next</span>
+                          </a>
+                        </div>
+
                       </div>
                     </div>
                   </div>
@@ -301,7 +332,7 @@
                         <div class="datePicker-w">
                           <h1>Events Calendar</h1>
                           <div class="body">
-      
+                             <app-external-events></app-external-events>
                           </div>
                         </div>
                       </div>
@@ -329,7 +360,7 @@
                                   <div class="carousel-inner">
                                       <div class="carousel-item" *ngFor="let achievement of achievements; let i = index" [ngClass]="i == 0 ? 'active' : ''">
                                           <div class="carousel-caption">
-                                              <p>{{achievement.description_en}}</p>
+                                              <p [innerHtml]="achievement.description_en"></p>
                                           </div>   
                                       </div>
                                   </div>

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

@@ -32,8 +32,9 @@ export class ExternalPageContentComponent implements OnInit, OnDestroy, AfterCon
   achievements = [];
 
   title: string = 'My first AGM project';
-  lat: number;
-  lng: number;
+  
+  lat: number =  24.380000;
+  lng: number = 46.430000;
 
   contentSubscription:Subscription;
 

+ 1 - 1
src/app/External-Page/external-page-header/external-page-header.component.css

@@ -500,7 +500,7 @@ input,button {
   .menuHeaderEn-w li a {
       float: left;
       margin: 0 15px;
-      color: #049288 !important;
+      color: #049288;
       transition: all 0.5s;
   }
 

+ 1 - 1
src/app/Internal-Page/internal-page-content/internal-page-content.component.ts

@@ -101,7 +101,7 @@ export class InternalPageContentComponent implements OnInit {
   ngOnInit() {
    //console.log(this.checkTokenExpire);
        //get profile data
-       this.spinner.show();
+    //this.spinner.show();
     this.userservice.getUserDataProfile();
     this.authSer.homeActivate = true;
     

+ 1 - 1
src/app/Internal-Page/internal-page-header/internal-page-header.component.html

@@ -105,7 +105,7 @@
                                     <a href="{{parent.link}}" style="text-decoration:none"> <span class="parentName-w"> {{parent.name}}</span> </a>
                                     <i class="fa fa-caret-down"  *ngIf="parent['childs'].length > 0"></i>
                                 </button>
-                                <div class="dropdown-content"  *ngIf="parent['childs'].length > 0">
+                                <div class="dropdown-content" *ngIf="parent['childs'].length > 0">
                                     <div class="row">
                                         <div *ngFor="let child of parent['childs']" style="width:100%;">
                                             <ul class="list-unstyled" style="width: 100%; padding: 0 10px;">

+ 9 - 1
src/app/Internal-Page/internal-page-header/internal-page-header.component.ts

@@ -5,6 +5,7 @@ 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',
@@ -17,7 +18,10 @@ export class InternalPageHeaderComponent implements OnInit {
     private userservice: UserService, 
     private internalService: InternalPageService, 
     private route: ActivatedRoute,
-    private router: Router) { }
+    private spinner: NgxSpinnerService,
+    private router: Router) {
+      this.spinner.show();
+     }
   
     
   currentDate: any = Date.now();
@@ -86,6 +90,10 @@ export class InternalPageHeaderComponent implements OnInit {
     this.router.navigate(['InternalPage/home']);
   }
 
+  getData(parentData) {
+    console.log(parentData);
+  }
+
 
   
 

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

@@ -23,7 +23,9 @@ export class InternalPageComponent implements OnInit {
     private userservice: UserService, 
     private route: ActivatedRoute,
     private internalService: InternalPageService,
-    private spinner: NgxSpinnerService,) { }
+    private spinner: NgxSpinnerService,) {
+      this.spinner.show();
+     }
 
     // joinUs = [];
     // reportsData = [];
@@ -57,14 +59,12 @@ export class InternalPageComponent implements OnInit {
 
   ngOnInit() {
 
-    this.spinner.show();
 
-    //this.spinner.show();
+    this.spinner.show();
     this.authSer.showDashboardHeader = false;
     
    //get profile data
     this.userservice.getUserDataProfile();
-    this.spinner.hide();
     //get parent and child data
    
     //this.router.navigate(['InternalPage/home']);

+ 1 - 1
src/app/app-routing.module.ts

@@ -1,6 +1,6 @@
 import { CanDeactivateGuard } from './shared/can-deactivate-guards.service';
 import { NgModule } from '@angular/core';
-import { Routes, RouterModule } from '@angular/router';
+import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
 import { LoginComponent } from './login/login.component';
 import { RegesterComponent } from './regester/regester.component';
 import { PageNotFoundComponent } from './page-not-found/page-not-found.component';

+ 2 - 1
src/app/dashboard/dashboard-routing.ts

@@ -1,3 +1,4 @@
+import { MapComponent } from './map/map.component';
 import { NgModule } from '@angular/core';
 import { RouterModule, Routes } from '@angular/router';
 
@@ -131,7 +132,7 @@ const dashboardRouting: Routes = [
     {path: 'advertisingList/:advertisingListIds', component: AdvertisingServicesListComponent , canActivate: [AuthGuard]},
     {path: 'addAdvertising', component: AddAdvertisingServiceComponent, canActivate: [AuthGuard] },
     {path: 'advertising/:typeAdvertising/:advertisingId', component: AddAdvertisingServiceComponent , canActivate: [AuthGuard]},
-
+    {path: 'map/:mapId', component: MapComponent, canActivate: [AuthGuard]},
   ]},
 ];
 

+ 6 - 0
src/app/dashboard/dashboard.module.ts

@@ -93,9 +93,11 @@ import { UserService } from '../shared/user.service';
 import { VisitingTimesListComponent } from './visiting-times/visiting-times-list/visiting-times-list.component';
 import { ExternalAchievementsListComponent } from './external-achievements/external-achievements-list/external-achievements-list.component';
 import { StatisticsListComponent } from './statistics/statistics-list/statistics-list.component';
+import { MapComponent } from './map/map.component';
 // import { NumberDirective } from './number.directive';
 // import { EnglishDirective } from './english.directive';
 
+import { AgmCoreModule } from '@agm/core';
 
 
 @NgModule({
@@ -159,6 +161,7 @@ import { StatisticsListComponent } from './statistics/statistics-list/statistics
         AddStatisticComponent,
         AdvertisingServicesListComponent,
         AddAdvertisingServiceComponent,
+        MapComponent,
     ],
     imports: [
         CommonModule,
@@ -171,6 +174,9 @@ import { StatisticsListComponent } from './statistics/statistics-list/statistics
         ModalModule.forRoot(),
         FormsModule,
         ReactiveFormsModule,
+        AgmCoreModule.forRoot({
+            apiKey: 'AIzaSyAxlgymaua-8BszEryfQIOr9PLKrtEqU2I'
+          }),
         QuillModule
     ],
     providers: [

+ 4 - 0
src/app/dashboard/hospitals/add-hospital/add-hospital.component.ts

@@ -295,6 +295,7 @@ export class AddHospitalComponent implements OnInit, OnDestroy {
                 this.checkSaveClick = false;
                 console.log(responce);
                 this.toastr.success('تم التعديل بنجاح ');
+                this.location.back();
               }, (error) => {
                 this.checkSaveClick = false;
                 console.log(error);
@@ -307,6 +308,7 @@ export class AddHospitalComponent implements OnInit, OnDestroy {
                 this.checkSaveClick = false;
                 console.log(responce);
                 this.toastr.success('تم التعديل بنجاح ');
+                this.location.back();
               }, (error) => {
                 this.checkSaveClick = false;
                 console.log(error);
@@ -326,6 +328,7 @@ export class AddHospitalComponent implements OnInit, OnDestroy {
                 this.checkSaveClick = false;
                 console.log(responce);
                 this.toastr.success('تم التعديل بنجاح ');
+                this.location.back();
               }, (error) => {
                 this.checkSaveClick = false;
                 console.log(error);
@@ -338,6 +341,7 @@ export class AddHospitalComponent implements OnInit, OnDestroy {
                 this.checkSaveClick = false;
                 console.log(responce);
                 this.toastr.success('تم التعديل بنجاح ');
+                this.location.back();
               }, (error) => {
                 this.checkSaveClick = false;
                 console.log(error);

+ 1 - 1
src/app/dashboard/hospitals/hospital-list/hospital-list.component.html

@@ -3,7 +3,7 @@
   <div class="row">
     <div class="col-12">
         <ul class="list-unstyled titileLi-w">
-          <li class="headingText-w"> {{typeServices}} > </li>
+          <li class="headingText-w"> {{typeServices}}  </li>
           <li class="headingText-w activeLi-w" style="margin-right:5px">{{typeLink}}</li>
         </ul>
     </div>

+ 4 - 0
src/app/dashboard/map/map.component.css

@@ -0,0 +1,4 @@
+
+agm-map {
+    height: 400px;
+  }

+ 44 - 0
src/app/dashboard/map/map.component.html

@@ -0,0 +1,44 @@
+<!-- <agm-map [latitude]="lat" [longitude]="lng">
+  <agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
+</agm-map> -->
+<!-- <agm-map [latitude]="lat" [longitude]="lng" [zoom]="zoom" [disableDefaultUI]="false" (mapClick)="mapClicked($event)">
+  <agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
+</agm-map> -->
+
+<div class="container">
+  <div class="row">
+    <div class="col-12">
+        <agm-map 
+        [latitude]="lat"
+        [longitude]="lng"
+        [zoom]="zoom"
+        [disableDefaultUI]="false"
+        [zoomControl]="false"
+        (mapClick)="mapClicked($event)">
+      
+        <agm-marker 
+            *ngFor="let m of markers; let i = index"
+            (markerClick)="clickedMarker(m.label, i)"
+            [latitude]="m.lat"
+            [longitude]="m.lng"
+            [label]="m.label"
+            [markerDraggable]="m.draggable"
+            (dragEnd)="markerDragEnd(m, $event)">
+            
+          <agm-info-window>
+            <strong>InfoWindow content</strong>
+          </agm-info-window>
+          
+        </agm-marker>
+        
+        <agm-circle [latitude]="lat + 0.3" [longitude]="lng" 
+            [radius]="5000"
+            [fillColor]="'red'"
+            [circleDraggable]="true"
+            [editable]="true">
+        </agm-circle>
+      
+      </agm-map>
+    </div>
+  </div>
+</div>

+ 109 - 0
src/app/dashboard/map/map.component.ts

@@ -0,0 +1,109 @@
+import { AuthServiceService } from './../../shared/auth-service.service';
+import { HttpClient } from '@angular/common/http';
+import { Component, OnInit } from '@angular/core';
+import { MouseEvent } from '@agm/core';
+import { NgxSpinnerService } from 'ngx-spinner';
+import { ToastrService } from 'ngx-toastr';
+
+
+@Component({
+  selector: 'app-map',
+  templateUrl: './map.component.html',
+  styleUrls: ['./map.component.css']
+})
+export class MapComponent implements OnInit {
+
+  constructor(private http: HttpClient, 
+    private spinner: NgxSpinnerService, 
+    private toastr: ToastrService,
+    private authSer: AuthServiceService) { 
+    this.spinner.show();
+  }
+
+  lat: number =  24.380000;//51.673858;
+  lng: number = 46.430000;  //= 7.815982;
+
+  zoom: number = 8;
+
+
+
+  
+  markers: marker[] = [
+	  {
+		  lat: 46.430000,
+		  lng: 46.430000,
+		  label: 'A',
+		  draggable: true
+	  }
+  ];
+
+
+  ngOnInit() {
+    
+    this.http.get(this.authSer.pathApi + '/get_reach_map/1').subscribe(
+      (responce) => {
+        console.log(responce);
+        this.lat = responce['reach_map'].latitude;
+        this.lng = responce['reach_map'].longitude;
+        this.markers[0].lat = responce['reach_map'].latitude
+        this.markers[0].lng = responce['reach_map'].longitude
+        this.spinner.hide();
+      },
+      (error) => {
+        console.log(error);
+      }
+    );
+
+  }
+
+  clickedMarker(label: string, index: number) {
+    console.log(`clicked the marker: ${label || index}`)
+  }
+
+  mapClicked($event: MouseEvent) {
+    
+    const dataMap={
+      latitude: $event.coords.lat,
+      longitude: $event.coords.lng,
+      id: 1
+    }
+
+    console.log('responce map', dataMap);
+    this.markers[0].lat = $event.coords.lat;
+    this.markers[0].lng = $event.coords.lng;
+    // this.markers.push({
+    //   lat: $event.coords.lat,
+    //   lng: $event.coords.lng,
+    //   draggable: true
+    // });
+
+    this.http.post(this.authSer.pathApi + '/edit_reach_map', dataMap).subscribe(
+      (responce) => {
+        console.log(responce);
+        this.toastr.success('تم حفظ الموقع');
+      },
+      (error) => {
+        console.log(error);
+        this.toastr.error('خطأ في الموقع إنتظر قليلاً');
+      }
+    );
+
+    console.log(this.markers);
+  }
+
+  markerDragEnd(m: marker, $event: MouseEvent) {
+    console.log('dragEnd', m, $event);
+  }
+
+  
+
+}
+
+
+  // just an interface for type safety.
+  interface marker {
+    lat: number;
+    lng: number;
+    label?: string;
+    draggable: boolean;
+  }

+ 1 - 1
src/app/dashboard/news/news-list/news-list.component.html

@@ -69,7 +69,7 @@
           </td>
           <td>{{news.title}}</td>
           <td>
-            {{news.ranking}}
+            {{news.ranking == 10000 ? 'المزيد' : news.ranking}}
             <!-- <select class="form-control" [ngModel]="news.ranking" (change)="changeRanking($event, news.id)">
               <option value="1">1</option>
               <option value="2">2</option>

+ 4 - 0
src/app/dashboard/service-item/service-item.component.ts

@@ -207,6 +207,8 @@ export class ServiceItemComponent implements OnInit {
           } else if(this.pages[0].id == 22) {
             console.log('/service/' + this.userId + '/' + service.id + '/advertisingList/' + this.pages[0].id);
             this.router.navigate(['/service/' + this.userId + '/' + service.id + '/advertisingList/' + this.pages[0].id]);
+          } else if(this.pages[0].id == 28) {
+            this.router.navigate(['/service/' + this.userId + '/' + service.id + '/map/' + this.pages[0].id]);
           }
           this.spinner.hide();
         },
@@ -279,6 +281,8 @@ export class ServiceItemComponent implements OnInit {
       this.router.navigate(['statisticsList/' + dataPage.id], {relativeTo: this.route});
     } else if(dataPage.id == 22) {
       this.router.navigate(['advertisingList/' + dataPage.id], {relativeTo: this.route});
+    } else if(dataPage.id == 28) {
+      this.router.navigate(['map/' + dataPage.id], {relativeTo: this.route});
     }
   }
 

+ 3 - 0
src/app/servicesItems/services.component.ts

@@ -147,6 +147,9 @@ getDataService(dataService){
           } else if(this.pages[0].id == 26) {
             console.log('/service/' + this.idUser + '/' + dataService.id + '/statisticsList/' + this.pages[0].id);
             this.router.navigate(['/service/' + this.idUser + '/' + dataService.id + '/statisticsList/' + this.pages[0].id]);
+          } else if(this.pages[0].id == 28) {
+            console.log('/service/' + this.idUser + '/' + dataService.id + '/map/' + this.pages[0].id);
+            this.router.navigate(['/service/' + this.idUser + '/' + dataService.id + '/map/' + this.pages[0].id]);
           }
           this.spinner.hide();
         },

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

@@ -163,7 +163,7 @@ export class AuthServiceService {
   onLanguageContent(typeLang:string) {
     localStorage.setItem('lang', typeLang);
     this.setLocalLang();
-    window.location.reload();
+    //window.location.reload();
   }