Hima 5 роки тому
батько
коміт
b9a80461fe

+ 3 - 7
src/app/dashboard/dashboard.module.ts

@@ -18,12 +18,11 @@ import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
 import { CountdownModule, Config } from 'ngx-countdown';
 
-//import { NumberDerictiveDirective } from './../number-derictive.directive';
-//import { EnglishCharactersDirective } from './../shared/english-characters.directive';
+
 import { ModalModule } from 'ngx-modialog';
 import { FiltterPipePipe } from './../filtter-pipe.pipe';
 import { JwSocialButtonsModule } from 'jw-angular-social-buttons';
-//import { OnlyNumberDirective } from '../shared/only-number.directive';
+
 import { ShortenPipe } from '../shorten.pipe';
 import { HigriDateComponent } from '../higri-date/higri-date.component';
 
@@ -32,7 +31,6 @@ import { DashBoardRouting } from './dashboard-routing';
 
 import { DashboardService } from './../shared/dashboard.service';
 import { EventService } from './../shared/event.service';
-import { HospitalService } from './../shared/hospital.service';
 import { ReportService } from './../shared/report.service';
 
 import { DashboardContent } from './dashboard-content';
@@ -87,8 +85,7 @@ import { VisitingTimesListComponent } from './visiting-times/visiting-times-list
 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';
 import { SupervisorListComponent } from './supervisor/supervisor-list/supervisor-list.component';
@@ -277,7 +274,6 @@ import { RecordInfoBuildingAddComponent } from './record-info-building/record-in
     providers: [
         UserService,
         ReportService,
-        HospitalService,
         EventService,
         DashboardService,
     ],

+ 1 - 2
src/app/dashboard/hospitals/add-hospital/add-hospital.component.ts

@@ -3,7 +3,6 @@ import { AuthServiceService } from './../../../shared/auth-service.service';
 import { ActivatedRoute, Params } from '@angular/router';
 import { Subscription } from 'rxjs';
 import { Location } from '@angular/common';
-import { HospitalService } from './../../../shared/hospital.service';
 import { FormGroup,FormControl, Validators, FormArray, FormBuilder } from '@angular/forms';
 import { Component, OnInit, OnDestroy } from '@angular/core';
 import { NgxSpinnerService } from 'ngx-spinner';
@@ -16,10 +15,10 @@ import * as Quill from 'quill';
   templateUrl: './add-hospital.component.html',
   styleUrls: ['./add-hospital.component.css']
 })
+
 export class AddHospitalComponent implements OnInit, OnDestroy {
 
   constructor(private formBuilder: FormBuilder, 
-    private hospitalService: HospitalService, 
     private route: ActivatedRoute,
     private spinner: NgxSpinnerService,
     private toastr: ToastrService, 

+ 3 - 5
src/app/dashboard/hospitals/hospital-list/hospital-list.component.ts

@@ -2,7 +2,6 @@ import { DashboardService } from './../../../shared/dashboard.service';
 import { Modal } from 'ngx-modialog/plugins/bootstrap';
 import { UserService } from './../../../shared/user.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
-import { HospitalService } from './../../../shared/hospital.service';
 import { ActivatedRoute, Router, Params } from '@angular/router';
 import { Component, OnInit } from '@angular/core';
 import { NgxSpinnerService } from 'ngx-spinner';
@@ -22,8 +21,7 @@ export class HospitalListComponent implements OnInit {
     private spinner: NgxSpinnerService,
     private toastr: ToastrService,
     private modal: Modal,
-    private dashboardService: DashboardService,
-    private hospitalService: HospitalService) {
+    private dashboardService: DashboardService) {
       this.spinner.show();
      }
 
@@ -235,7 +233,7 @@ export class HospitalListComponent implements OnInit {
                   this.spinner.show();
                   this.dataList = [];
                   if(this.pageId == 10, this.pageId == 31) {
-                    this.hospitalService.getHospitalsList(this.pageId , this.currentPage, this.dataTableNumber).subscribe(
+                    this.dashboardService.getListData(this.pageId , this.currentPage, this.dataTableNumber).subscribe(
                       (responce) => {
                         console.log(responce);
                         this.dataList = responce['managements'];
@@ -248,7 +246,7 @@ export class HospitalListComponent implements OnInit {
                       }
                     );
                   } else if(this.pageId == 6 || this.pageId == 30){
-                    this.hospitalService.getHospitalsList(this.pageId , this.currentPage, this.dataTableNumber).subscribe(
+                    this.dashboardService.getListData(this.pageId , this.currentPage, this.dataTableNumber).subscribe(
                       (responce) => {
                         console.log(responce);
                         this.dataList = responce['hospital_centers'];

+ 0 - 1
src/app/dashboard/internal-services/add-internal-services/add-internal-services.component.ts

@@ -4,7 +4,6 @@ import { AuthServiceService } from './../../../shared/auth-service.service';
 import { ActivatedRoute, Params } from '@angular/router';
 import { Subscription, empty } from 'rxjs';
 import { Location } from '@angular/common';
-import { HospitalService } from './../../../shared/hospital.service';
 import { FormGroup,FormControl, Validators, FormArray, FormBuilder } from '@angular/forms';
 import { Component, OnInit, OnDestroy } from '@angular/core';
 import { NgxSpinnerService } from 'ngx-spinner';

+ 6 - 6
src/app/dashboard/lectures/add-lecture/add-lecture.component.ts

@@ -1,3 +1,4 @@
+import { DashboardService } from './../../../shared/dashboard.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { Location } from '@angular/common';
 import { Component, OnInit, ViewChild } from '@angular/core';
@@ -6,7 +7,6 @@ import { UserService } from '../../../shared/user.service';
 import { ToastrService } from 'ngx-toastr';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { FormGroup, NgForm } from '@angular/forms';
-import { LectureService } from '../../../shared/lecture.service';
 
 
 @Component({
@@ -34,8 +34,8 @@ export class AddLectureComponent implements OnInit {
   }
   
 
-  constructor(private lectureServices: LectureService,
-    private userService: UserService,
+  constructor(private userService: UserService,
+    private dashboardSer: DashboardService,
     private location: Location,
     private toastr: ToastrService,
     private authSer: AuthServiceService,
@@ -59,7 +59,7 @@ export class AddLectureComponent implements OnInit {
           this.spineer.show();
           this.typeMode = true;
           this.lectureId = params['editLectureId'];
-          this.lectureServices.getLectureData(this.lectureId).subscribe(
+          this.dashboardSer.getItemData(this.lectureId, 'lecture').subscribe(
             (responce) => {
               console.log(responce);
               const lectureData = responce['lecture'];
@@ -109,7 +109,7 @@ export class AddLectureComponent implements OnInit {
       } else if(startDate[0] == endDate[0] && startDate[1] > endDate[1] && startDate[2] > endDate[2]) {
         this.toastr.warning('يوم البدايه يجب ان تكون أقل من يوم النهايه !');
       }else {
-        this.lectureServices.editLecture(this.lectureForm.value , this.lectureId).subscribe(
+        this.dashboardSer.editItem(this.lectureId, this.lectureForm.value , 'lecture').subscribe(
           (responce) => {
             console.log(responce);
             this.toastr.success('تمت التعديل بنجاح');
@@ -129,7 +129,7 @@ export class AddLectureComponent implements OnInit {
       } else if(startDate[0] == endDate[0] && startDate[1] > endDate[1] && startDate[2] > endDate[2]) {
         this.toastr.warning('يوم البدايه يجب ان تكون أقل من يوم النهايه !');
       }else {
-        this.lectureServices.addLecture(this.lectureForm.value).subscribe(
+        this.dashboardSer.addItem(this.lectureForm.value, 'lecture').subscribe(
           (responce) => {
             console.log(responce);
             this.toastr.success('تمت الاضافه بنجاح');

+ 9 - 9
src/app/dashboard/lectures/lectures-list/lectures-list.component.ts

@@ -1,5 +1,5 @@
+import { DashboardService } from './../../../shared/dashboard.service';
 import { Modal } from 'ngx-modialog/plugins/bootstrap';
-import { LectureService } from './../../../shared/lecture.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { UserService } from './../../../shared/user.service';
 import { HttpClient } from '@angular/common/http';
@@ -23,7 +23,7 @@ export class LecturesListComponent implements OnInit {
     private toastr: ToastrService,
     private http: HttpClient,
     private modal: Modal,
-    private lectureService: LectureService,
+    private dashbordSer: DashboardService,
     private router: Router) { }
 
     pageId: number;
@@ -98,7 +98,7 @@ export class LecturesListComponent implements OnInit {
     );
 
     //get list data 
-    this.lectureService.getLecturesList(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
+    this.dashbordSer.getListData(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
       (responce) => {
         console.log(responce);
         this.lecturesList = responce['lectures'];
@@ -135,7 +135,7 @@ export class LecturesListComponent implements OnInit {
     this.lecturesList = [];
     //console.log(pagenationNumber);
     //console.log(this.pageId);
-    this.lectureService.getLecturesList(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
+    this.dashbordSer.getListData(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
       (responce) => {
         console.log(responce);
         this.lecturesList = responce['lectures'];
@@ -158,7 +158,7 @@ export class LecturesListComponent implements OnInit {
     this.currentPage = 1;
     console.log('search curent page', this.currentPage);
     console.log('search page id', this.pageId);
-    this.lectureService.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+    this.dashbordSer.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
       (responce) => {
         console.log(responce);
         this.lecturesList = responce['lectures'];
@@ -182,7 +182,7 @@ export class LecturesListComponent implements OnInit {
     this.http.post(this.authSer.pathApi + '/rank_lecture', data).subscribe(
       (responce) => {
         console.log(responce);
-        this.lectureService.getLecturesList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+        this.dashbordSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
           (responce) => {
             console.log(responce);
             this.count = responce['count'];
@@ -205,7 +205,7 @@ onGetValue(event) {
   this.spinner.show();
   this.lecturesList = [];
   this.dataTableNumber = event.target.value;
-  this.lectureService.getLecturesList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+  this.dashbordSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
     (responce) => {
       console.log(responce);
       this.lecturesList = responce['lectures'];
@@ -242,13 +242,13 @@ onGetValue(event) {
         .open();
         dialogRef.result
         .then( result =>  
-          this.lectureService.deleteLecture(this.lecturesListIds).subscribe(
+          this.dashbordSer.deleteItem(this.lecturesListIds, this.pageId).subscribe(
             (responce) => {
               console.log(responce);
               this.toastr.success('تم الحذف');
               this.spinner.show();
               this.lecturesList = [];
-              this.lectureService.getLecturesList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+              this.dashbordSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
                 (responce) => {
                   console.log(responce);
                   this.lecturesList = responce['lectures'];

+ 0 - 1
src/app/dashboard/model-vehicle/model-vehicle-list/model-vehicle-list.component.ts

@@ -1,6 +1,5 @@
 import { DashboardService } from './../../../shared/dashboard.service';
 import { Modal } from 'ngx-modialog/plugins/bootstrap';
-import { LectureService } from './../../../shared/lecture.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { UserService } from './../../../shared/user.service';
 import { HttpClient } from '@angular/common/http';

+ 0 - 1
src/app/dashboard/registration-vehicle/registration-vehicle-list/registration-vehicle-list.component.ts

@@ -1,6 +1,5 @@
 import { DashboardService } from './../../../shared/dashboard.service';
 import { Modal } from 'ngx-modialog/plugins/bootstrap';
-import { LectureService } from './../../../shared/lecture.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { UserService } from './../../../shared/user.service';
 import { HttpClient } from '@angular/common/http';

+ 0 - 1
src/app/dashboard/vehicle/vehicle-list/vehicle-list.component.ts

@@ -1,6 +1,5 @@
 import { DashboardService } from './../../../shared/dashboard.service';
 import { Modal } from 'ngx-modialog/plugins/bootstrap';
-import { LectureService } from './../../../shared/lecture.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { UserService } from './../../../shared/user.service';
 import { HttpClient } from '@angular/common/http';

+ 8 - 0
src/app/shared/dashboard.service.ts

@@ -57,6 +57,8 @@ export class DashboardService {
         return this.http.post(this.authService.pathApi + '/add_internal_service' , data);
       } else if(addType == 'achiev'){
         return this.http.post(this.authService.pathApi + '/add_achievement' , data);
+      } else if(addType == 'lecture'){
+        return this.http.post(this.authService.pathApi + '/add_lecture' , data);
       } else if(addType == 'internalHospital') {
         return this.http.post(this.authService.pathApi + '/add_hospitals_centers' , data);
       } else if(addType == 'externalHospital') {
@@ -147,6 +149,8 @@ export class DashboardService {
         return this.http.post(this.authService.pathApi + '/edit_tab', editData);
       } else if(editPageName == 'achiev'){
         return this.http.post(this.authService.pathApi + '/edit_achievement', editData);
+      } else if(editPageName == 'lecture') {
+        return this.http.post(this.authService.pathApi + '/edit_lecture', editData);
       } else if(editPageName == 'internalSer'){
         return this.http.post(this.authService.pathApi + '/', editData);
       } else if(editPageName == 'internalHospital') {
@@ -240,6 +244,8 @@ export class DashboardService {
         return this.http.get(this.authService.pathApi + '/get_tab/' + pageId);
       } else if(typeGetData == 'internalSer'){
         return this.http.get(this.authService.pathApi + '/get_internal_service/' + pageId);
+      } else if(typeGetData == 'lecture') {
+        return this.http.get(this.authService.pathApi + '/get_lecture/' + pageId);
       } else if(typeGetData == 'achiev') {
         return this.http.get(this.authService.pathApi + '/get_achievement/' + pageId);
       } else if(typeGetData == 'hospital') {
@@ -320,6 +326,8 @@ export class DashboardService {
         return this.http.post(this.authService.pathApi + '/delete_department' , {'departments_id' : dataIds});
       } else if(pageId == 12){
         return this.http.post(this.authService.pathApi + '/delete_tabs' , {'tabs_id' : dataIds});
+      } else if(pageId == 15) {
+        return this.http.post(this.authService.pathApi + '/delete_lectures' , {'lectures_id' : dataIds});
       } else if(pageId == 11){
         return this.http.post(this.authService.pathApi + '/delete_achievements' , {'achievements_id' : dataIds});
       } else if(pageId == 14){

+ 0 - 71
src/app/shared/hospital.service.ts

@@ -1,71 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { AuthServiceService } from './auth-service.service';
-import { Injectable } from '@angular/core';
-import { NgxSpinnerService } from 'ngx-spinner';
-import { ToastrService } from 'ngx-toastr';
-
-@Injectable({
-  providedIn: 'root'
-})
-export class HospitalService {
-
-  constructor(private authService: AuthServiceService, 
-    private http: HttpClient,
-    private spinner: NgxSpinnerService, 
-    private toastr: ToastrService) { }
-
-  //get hospitals list 
-  getHospitalsList(pageId: number, currentPage: number, dataTableNumber: number){
-    this.spinner.show();
-    console.log(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/all');
-    return this.http.get(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/all');
-  }
-
-  //get data user from searchBar 
-  getDataUSerSearchBar(data, pageId, pagenationNumber, dataTableNumber) {
-    console.log('url', this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/all/' + data);
-    return this.http.get(this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/all/' + data);
-  }
-
-  //delete hospitals
-  deleteDatas(datasIds, pageId) {
-    if(pageId == 6){
-        console.log(datasIds);
-        return this.http.post(this.authService.pathApi + '/delete_hospitals_centers' , {'hospitals_centers_id' : datasIds});
-    } else if(pageId == 10) {
-      this.spinner.show();
-        console.log(datasIds);
-        return this.http.post(this.authService.pathApi + '/delete_managements' , {'managements_id' : datasIds});
-    }
-  }
-
-  //add hospital 
-  addHospital(hospitalDataForm, pageName) {
-    if(pageName == 'hospital'){
-      return this.http.post(this.authService.pathApi + '/add_hospitals_centers', hospitalDataForm);
-    } else if(pageName == 'management'){
-      return this.http.post(this.authService.pathApi + '/add_management', hospitalDataForm);
-    }
-  }
-
-  //get hospital data
-  getHospitalData(typeId: number, typeEditPage: string) {
-    if(typeEditPage == 'edithos') {
-      return this.http.get(this.authService.pathApi + '/get_hospitals_centers/' + typeId);
-    } else if(typeEditPage == 'editman') {
-      return this.http.get(this.authService.pathApi + '/get_management/' + typeId);
-    }
-  }
-
-  //edit hospital data
-  editHospital(id: number, newData, typePage:string) {
-    newData['id'] = id;
-    console.log(newData);
-    if(typePage == 'hospital') {
-      return this.http.post(this.authService.pathApi + '/edit_hospitals_centers', newData);
-    } else if (typePage == 'management') {
-      return this.http.post(this.authService.pathApi + '/edit_management', newData);
-    }
-  }
-
-}

+ 0 - 56
src/app/shared/lecture.service.ts

@@ -1,56 +0,0 @@
-import { AuthServiceService } from './auth-service.service';
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-import { NgxSpinnerService } from 'ngx-spinner';
-import { ToastrService } from 'ngx-toastr';
-
-@Injectable({
-  providedIn: 'root'
-})
-export class LectureService {
-
-  constructor(private http: HttpClient, 
-    private spinner: NgxSpinnerService, 
-    private toastr: ToastrService, 
-    private authService: AuthServiceService) { }
-
-  //get hospitals list 
-  getLecturesList(pageId: number, currentPage: number, dataTableNumber: number){
-    this.spinner.show();
-    console.log(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/all');
-    return this.http.get(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/all');
-  }
-
-   //get data user from searchBar 
-   getDataUSerSearchBar(data, pageId, pagenationNumber, dataTableNumber) {
-    console.log('url', this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/all/' + data);
-     return this.http.get(this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/all/' + data);
-  }
-
-  //addEvent
-  addLecture(dataEvent) {
-    return this.http.post(this.authService.pathApi + '/add_lecture' , dataEvent);
-  }
-
-  //edit event
-  editLecture( dataRoleEdit,EditRoleId){
-    const editData = dataRoleEdit;
-    editData.id = EditRoleId;
-    console.log(editData);
-    return this.http.post(this.authService.pathApi + '/edit_lecture', editData);
-  }
-
-  //get event data
-  getLectureData(eventId: number) {
-    return this.http.get(this.authService.pathApi + '/get_lecture/' + eventId);
-  }
-
-  //delete event 
-  deleteLecture(eventsIds) {
-      console.log(eventsIds);
-      return this.http.post(this.authService.pathApi + '/delete_lectures' , {'lectures_id' : eventsIds});
-    
-  };
-
-
-}