amr 5 gadi atpakaļ
vecāks
revīzija
7748b7c602

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

@@ -65,7 +65,7 @@ export class ExternalPageHeaderComponent implements OnInit {
 
   onGetProfile() {
     console.log('profile/'  + this.authSer.dataLoginUser['id']);
-    this.router.navigate(['profile/'  + this.authSer.dataLoginUser['id']]);
+    this.router.navigate(['auth/profile/'  + this.authSer.dataLoginUser['id']]);
   }
 
   //log out function

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

@@ -73,7 +73,7 @@ export class InternalPageHeaderComponent implements OnInit {
 
   onGetProfile() {
     console.log('profile/'  + this.authSer.dataLoginUser['id']);
-    this.router.navigate(['profile/'  + this.authSer.dataLoginUser['id']]);
+    this.router.navigate(['auth/profile/'  + this.authSer.dataLoginUser['id']]);
   }
 
   //log out function

+ 0 - 3
src/app/app-routing.module.ts

@@ -14,8 +14,6 @@ import { TrainningServicesComponent } from './trainning-service/trainning-servic
 const routes: Routes = [
   {path: '', redirectTo: '/ExternalPage', pathMatch: 'full'},
   {path: 'auth', loadChildren:'./auth-services/auth-services.module#AuthServicesModule'},
-  // {path: 'login', component: LoginComponent},
-  // {path: 'signup', component: RegesterComponent},
   {path: 'services/:id', component: ServicesComponent, canActivate: [AuthGuard]},
   {path: 'addRequest/:visitorId', component: AddRequestComponent, canActivate: [AuthGuard]},
   {path: 'editRequest/:visitorId/:requestId', component: AddRequestComponent, canActivate: [AuthGuard]},
@@ -24,7 +22,6 @@ const routes: Routes = [
   {path: 'service/:userID/:serviceID', loadChildren: './dashboard/dashboard.module#DashBoardModule', canLoad: [AuthGuard]},
   {path: 'InternalPage' , loadChildren: './Internal-Page/internal-page.module#InternalPageModule', canLoad: [AuthGuard]},
   {path: 'ExternalPage', loadChildren: './External-Page/external-page.module#ExternalPageModule', canLoad: [AuthGuard]},
-  {path: 'profile/:idProfile', component: RegesterComponent, canActivate: [AuthGuard]},
   {path: 'page-not-found', component: PageNotFoundComponent},
   {path: '**', redirectTo: '/page-not-found', pathMatch: 'full'}
 ];

+ 0 - 2
src/app/app.module.ts

@@ -28,8 +28,6 @@ import { AppComponent } from './app.component';
 import { HttpModule } from '@angular/http';
 import { HttpClientModule } from '@angular/common/http';
 import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
-import { LoginComponent } from './auth-services/login/login.component';
-import { RegesterComponent } from './auth-services/regester/regester.component';
 import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
 import { AuthServiceService } from './shared/auth-service.service';
 import { HTTP_INTERCEPTORS } from '@angular/common/http';

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

@@ -12,7 +12,7 @@ const routes: Routes = [
       {path: '', redirectTo: 'login', pathMatch: 'full'},
       {path: 'login', component: LoginComponent},
       {path: 'register', component: RegesterComponent},
-     
+      {path: 'profile/:idProfile', component:RegesterComponent},
       {path: '**', redirectTo: 'login', pathMatch: 'full'},
     ]},
   ];

+ 1 - 43
src/app/dashboard/create-report/add-new-report/add-new-report.component.html

@@ -23,49 +23,7 @@
             </div>
           </div>
 
-<<<<<<< HEAD
         
-=======
-          <div class="col-12" *ngIf="reportVal">
-            <h2 class="title">بيانات صاحب البلاغ</h2>
-            <div class="row">
-              <div class="col-12">
-                <div class="wrapper">
-                  <div class="col-12">
-                    <input type="text" class="form-control searchEmp" placeholder="البحث ( برقم الهويه / الرقم الوظيفي )" style="width:85%; float:right" appOnlyNumber [(ngModel)]="search" [ngModelOptions]="{standalone: true}"/>
-                    <button class="btn btn-success" type="button" style="float:right; margin:0 2px;" (click)="getValue()">أبحث</button>
-                  </div>
-
-                  <div class="col-12 col-md-4" style="margin: 20px 0">
-                    <div class="form-group">
-                      <label for="name" style="float:right">الإسم<span class="spanReqired-w">*</span></label>
-                      <input type="text" class="form-control" id="name" [ngModel]="reportAuthor.name" [ngModelOptions]="{standalone: true}" [disabled]="true"/>
-                    </div>
-                  </div>
-                  <div class="col-12 col-md-4" style="margin: 20px 0">
-                    <div class="form-group">
-                      <label for="identityNumber" style="float:right">رقم الهويه <span class="spanReqired-w">*</span></label>
-                      <input type="phone" class="form-control" id="identityNumber" [ngModel]="reportAuthor.identity_number" [ngModelOptions]="{standalone: true}" [disabled]="true"/>
-                    </div>
-                  </div>
-                  <div class="col-12 col-md-4" style="margin: 20px 0">
-                    <div class="form-group">
-                      <label for="functionalNumber" style="float:right">رقم الوظيفي <span class="spanReqired-w">*</span></label>
-                      <input type="phone" class="form-control" id="functionalNumber" [ngModel]="reportAuthor.functional_number" [ngModelOptions]="{standalone: true}" [disabled]="true"/>
-                    </div>
-                  </div>
-                  <div class="col-12 col-md-4">
-                    <div class="form-group">
-                      <label for="phone" style="float:right">الهاتف<span class="spanReqired-w">*</span></label>
-                      <input type="phone" class="form-control" id="phone" [ngModel]="reportAuthor.phone" [ngModelOptions]="{standalone: true}" [disabled]="true"/>
-                    </div>
-                  </div>
-                </div>
-              </div>
-            </div>
-          </div>
-
->>>>>>> edd920e7640f2b8f1a78ada19baa948662912dae
           <div class="col-12">
             <h2 class="title">بيانات مقدم البلاغ</h2>
             <div class="row">
@@ -86,7 +44,7 @@
                     <div class="col-12 col-sm-12 col-md-4 col-lg-4">
                       <div class="form-group">
                         <label for="phoneNum"  style="float: right;margin-right: 5px"> الهاتف </label>
-                        <input type="number" placeholder=" الهاتف" class="form-control" name="phoneNum" [ngModel]="dataForm.phoneNum" [disabled]="true" required/>
+                        <input type="number" placeholNeedder=" الهاتف" class="form-control" name="phoneNum" [ngModel]="dataForm.phoneNum" [disabled]="true" required/>
                       </div>  
                   </div>
                     <div class="col-12 col-sm-12 col-md-4 col-lg-4">

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

@@ -37,7 +37,6 @@ import { ExternalSerService } from './../shared/external-ser.service';
 import { MainMenuService } from './../shared/main-menu.service';
 import { FooterService } from './../shared/footer.service';
 import { NewService } from './../shared/new.service';
-import { EventService } from './../shared/event.service';
 import { HospitalService } from './../shared/hospital.service';
 import { ReportService } from './../shared/report.service';
 import { DepartmentService } from './../shared/department.service';
@@ -290,7 +289,6 @@ import { RecordInfoBuildingAddComponent } from './record-info-building/record-in
         DepartmentService,
         ReportService,
         HospitalService,
-        EventService,
         NewService,
         FooterService,
         MainMenuService,

+ 6 - 6
src/app/dashboard/events/add-event/add-event.component.ts

@@ -2,11 +2,11 @@ import { AuthServiceService } from './../../../shared/auth-service.service';
 import { Location } from '@angular/common';
 import { Component, OnInit, ViewChild } from '@angular/core';
 import { Router, ActivatedRoute, Params } from '@angular/router';
-import { EventService } from '../../../shared/event.service';
 import { UserService } from '../../../shared/user.service';
 import { ToastrService } from 'ngx-toastr';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { FormGroup, NgForm } from '@angular/forms';
+import { DashboardService } from 'src/app/shared/dashboard.service';
 
 @Component({
   selector: 'app-add-event',
@@ -36,7 +36,7 @@ export class AddEventComponent implements OnInit {
     time: '',
   }
 
-  constructor(private eventService: EventService,
+  constructor(private dashboard: DashboardService,
     private userService: UserService,
     private location: Location,
     private toastr: ToastrService,
@@ -62,8 +62,8 @@ export class AddEventComponent implements OnInit {
           this.typeMode = true;
           this.typeLink = 'تعديل';
           this.spineer.show();
-          this.eventId = params['editEventId'];
-          this.eventService.getEventData(this.eventId).subscribe(
+          this.eventId = +params['editEventId'];
+          this.dashboard.getItemData(this.eventId, "events").subscribe(
             (responce) => {
               console.log(responce);
               const eventData = responce['event'][0];
@@ -124,7 +124,7 @@ export class AddEventComponent implements OnInit {
 
     console.log(this.eventForm.value); 
     if(this.typeMode) {
-      this.eventService.editEvent(this.eventForm.value , this.eventId).subscribe(
+      this.dashboard.editItem( this.eventId ,this.eventForm.value , "events").subscribe(
         (responce) => {
           console.log(responce);
           this.toastr.success('تمت التعديل بنجاح');
@@ -145,7 +145,7 @@ export class AddEventComponent implements OnInit {
         }
       );
     } else {
-      this.eventService.addEvent(this.eventForm.value).subscribe(
+      this.dashboard.addItem(this.eventForm.value, "events").subscribe(
         (responce) => {
           console.log(responce);
           this.toastr.success('تمت الاضافه بنجاح');

+ 9 - 9
src/app/dashboard/events/events.component.ts

@@ -1,5 +1,4 @@
 import { HttpClient } from '@angular/common/http';
-import { EventService } from './../../shared/event.service';
 import { AuthServiceService } from './../../shared/auth-service.service';
 import { UserService } from './../../shared/user.service';
 import { ActivatedRoute, Router, Params } from '@angular/router';
@@ -7,6 +6,7 @@ import { Component, OnInit } from '@angular/core';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { ToastrService } from 'ngx-toastr';
 import { Modal } from 'ngx-modialog/plugins/bootstrap';
+import { DashboardService } from 'src/app/shared/dashboard.service';
 
 @Component({
   selector: 'app-events',
@@ -22,7 +22,7 @@ export class EventsComponent implements OnInit {
     private toastr: ToastrService,
     private http: HttpClient,
     private modal: Modal,
-    private eventService: EventService,
+    private dashboardSer: DashboardService,
     private router: Router) { }
 
     pageId: number;
@@ -97,7 +97,7 @@ export class EventsComponent implements OnInit {
     );
 
     //get list data 
-    this.eventService.getEventsList(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
+    this.dashboardSer.getListData(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
       (responce) => {
         console.log(responce);
         this.eventsList = responce['events'];
@@ -135,7 +135,7 @@ export class EventsComponent implements OnInit {
     this.currentPage = 1;
     console.log('search curent page', this.currentPage);
     console.log('search page id', this.pageId);
-    this.eventService.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+    this.dashboardSer.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
       (responce) => {
         console.log(responce);
         this.eventsList = responce['events'];
@@ -157,7 +157,7 @@ export class EventsComponent implements OnInit {
     this.eventsList = [];
     //console.log(pagenationNumber);
     //console.log(this.pageId);
-    this.eventService.getEventsList(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
+    this.dashboardSer.getListData(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
       (responce) => {
         console.log(responce);
         this.eventsList = responce['events'];
@@ -182,7 +182,7 @@ export class EventsComponent implements OnInit {
     this.http.post(this.authSer.pathApi + '/rank_event', data).subscribe(
       (responce) => {
         console.log(responce);
-        this.eventService.getEventsList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+        this.dashboardSer.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.eventsList = [];
   this.dataTableNumber = event.target.value;
-  this.eventService.getEventsList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+  this.dashboardSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
     (responce) => {
       console.log(responce);
       this.eventsList = responce['events'];
@@ -244,13 +244,13 @@ onGetValue(event) {
   
         dialogRef.result
         .then( result => 
-          this.eventService.deleteEvent(this.eventsListIds).subscribe(
+          this.dashboardSer.deleteItem(this.eventsListIds, this.pageId).subscribe(
             (responce) => {
               console.log(responce);
               this.toastr.success('تم الحذف');
               this.spinner.show();
               this.eventsList = [];
-              this.eventService.getEventsList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+              this.dashboardSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
                 (responce) => {
                   console.log(responce);
                   this.eventsList = responce['events'];

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

@@ -58,7 +58,7 @@ export class HeaderComponent implements OnInit {
 
   onGetProfile() {
     console.log('profile/'  + this.authSer.dataLoginUser['id']);
-    this.router.navigate(['profile/'  + this.authSer.dataLoginUser['id']]);
+    this.router.navigate(['auth/profile/'  + this.authSer.dataLoginUser['id']]);
   }
 
   //log out function

+ 2 - 2
src/app/dashboard/record-info-building/record-info-building-add/record-info-building-add.component.html

@@ -55,10 +55,10 @@
             <div class="col-12 col-sm-12 col-md-12" *ngFor="let building of formData.building_types; let i = index" style="padding: 20px;">
               <div class="form-group">
                 <div class="col-4">
-                <input type="text" class="form-control" id="building_types" name="building.name" placeholder="نوع المنى" ngModel [(ngModel)]="building.name" required/>
+                <input type="text" class="form-control" id="building.name{{i}}" name="building.name{{i}}" placeholder="نوع المنى" ngModel [(ngModel)]="building.name"  required/>
               </div>
               <div class="col-4">
-                  <input type="number" class="form-control" id="building_types" name="building.value" placeholder="عدد المبنى" ngModel [(ngModel)]="building.value" required/>
+                  <input type="number" class="form-control" id="building.value{{i}}" name="building.value{{i}}" placeholder="عدد المبنى" ngModel [(ngModel)]="building.value" required/>
               </div>
               <div class="col-3">
                   <button type="button" class="btn btn-danger" (click)="onDeleteRow(i)" style="margin: 10px 15px;">حذف</button>

+ 9 - 12
src/app/dashboard/record-info-building/record-info-building-add/record-info-building-add.component.ts

@@ -41,12 +41,7 @@ export class RecordInfoBuildingAddComponent implements OnInit {
     name : '',
     land_area : '',
     status: '',
-    building_types:[
-      {
-        name : '',
-        value : ''
-      }
-    ]
+    building_types:[]
   }
   
 
@@ -66,16 +61,18 @@ export class RecordInfoBuildingAddComponent implements OnInit {
       this.dashBoardSer.getItemData(this.editPageId, 'recordInfoBuilding' ).subscribe(
         res => {
           console.log('ssss', res);
-          const array =this.formData.building_types;
-          this.formData.name = res['housing_complex'].complex_number;
+          const array =res['housing_complex'].types;
+          this.formData.complex_number = res['housing_complex'].complex_number;
           this.formData.name = res['housing_complex'].name;
-          this.formData.name = res['housing_complex'].land_area;
+          this.formData.land_area = res['housing_complex'].land_area;
           this.formData.status  = res['housing_complex'].status;
           for (let i = 0,n = array.length; i < n ; i++) {
-           array[i] = res['housing_complex'].building_types[i];
+          this.formData.building_types.push( res['housing_complex'].types[i]);
             
           }
           this.spinner.hide();
+          console.log(this.formData);
+          
         },
         err => {
           console.log(err);
@@ -101,7 +98,7 @@ export class RecordInfoBuildingAddComponent implements OnInit {
     console.log(this.formData);
     
     if(this.editPageId) {
-      this.dashBoardSer.editItem(this.editPageId, this.definitionForm.value, 'recordInfoBuilding').subscribe(
+      this.dashBoardSer.editItem(this.editPageId, this.formData, 'recordInfoBuilding').subscribe(
         res => {
           console.log(res);
           this.toastr.success('تم التعديل بنجاح');
@@ -113,7 +110,7 @@ export class RecordInfoBuildingAddComponent implements OnInit {
         }
       )
     } else {
-      this.dashBoardSer.addItem( this.definitionForm.value , 'recordInfoBuilding').subscribe(
+      this.dashBoardSer.addItem( this.formData , 'recordInfoBuilding').subscribe(
         res => {
           console.log('ADD',res);
           this.toastr.success('تم الإضافه بنجاح');

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

@@ -15,7 +15,7 @@ export class AuthGuardService {
 
   canActivate(): boolean {
     if (this.auth.isAuthenticated()) {
-      this.router.navigate(['/login']);
+      this.router.navigate(['/auth/login']);
       return false;
     }
     return true;

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

@@ -113,6 +113,8 @@ export class DashboardService {
         return this.http.post(this.authService.pathApi + '/add_covenant', data);
       }else if(addType == 'recordInfoBuilding') {
         return this.http.post(this.authService.pathApi + '/add_housing_complex', data);
+      }else if(addType == 'events') {
+        return this.http.post(this.authService.pathApi + '/add_event' , data);
       }
     }
 
@@ -199,6 +201,8 @@ export class DashboardService {
         return this.http.post(this.authService.pathApi + '/edit_covenant', editData);
       }else if(editPageName == 'recordInfoBuilding') {
         return this.http.post(this.authService.pathApi + '/edit_housing_complex', editData);
+      }else if(editPageName == 'events') {
+        return this.http.post(this.authService.pathApi + '/edit_event', editData);
       }
     }
     
@@ -267,6 +271,8 @@ export class DashboardService {
         return this.http.get(this.authService.pathApi + '/get_covenant/' + pageId);
       }else if(typeGetData == 'recordInfoBuilding') {
         return this.http.get(this.authService.pathApi + '/get_housing_complex/' + pageId);
+      }else if(typeGetData == 'events') {
+        return this.http.get(this.authService.pathApi + '/get_event/' + pageId);
       }
   }
     //delete event
@@ -341,6 +347,8 @@ export class DashboardService {
         return this.http.post(this.authService.pathApi + '/delete_covenant', {'covenant_ids' : dataIds});
       }else if(pageId == 65) {
         return this.http.post(this.authService.pathApi + '/delete_housing_complex', {'housing_complex_ids' : dataIds});
+      }else if (pageId == 8){
+        return this.http.post(this.authService.pathApi + '/delete_events' , {'events_id' : dataIds});
       }
 
 

+ 0 - 54
src/app/shared/event.service.ts

@@ -1,54 +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 EventService {
-
-  constructor(private http: HttpClient, 
-    private spinner: NgxSpinnerService, 
-    private toastr: ToastrService, 
-    private authService: AuthServiceService) { }
-
-  //get hospitals list 
-  getEventsList(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
-  addEvent(dataEvent) {
-    return this.http.post(this.authService.pathApi + '/add_event' , dataEvent);
-  }
-
-  //edit event
-  editEvent( dataRoleEdit,EditRoleId){
-    const editData = dataRoleEdit;
-    editData.id = EditRoleId;
-    console.log(editData);
-    return this.http.post(this.authService.pathApi + '/edit_event', editData);
-  }
-
-  //get event data
-  getEventData(eventId: number) {
-    return this.http.get(this.authService.pathApi + '/get_event/' + eventId);
-  }
-
-  //delete event 
-  deleteEvent(eventsIds) {
-    console.log(eventsIds);
-    return this.http.post(this.authService.pathApi + '/delete_events' , {'events_id' : eventsIds});
-  };
-
-}