amr лет назад: 5
Родитель
Сommit
34094748df

+ 6 - 5
src/app/dashboard/create-report/add-new-report/add-new-report.component.html

@@ -72,16 +72,16 @@
                       <div class="col-12 col-sm-12 col-md-4 col-lg-4">
                         <div class="form-group">
                           <label for="reportTopic" style="float: right;margin-right: 5px">  الموقع الرئيسي </label>
-                          <select name="main_location_id" [(ngModel)]="dataForm.main_location_id" class="form-control" (change)="onChangemainLocation($event)">
-                            <option *ngFor="let location of locationList" [value]="location.id"> {{location.name}} </option>    
+                          <select name="main_location_id" [(ngModel)]="dataForm.main_location_id" class="form-control"  (change)="onChangemainLocation($event)" required >
+                            <option *ngFor="let location of locationList" [value]="location.id" required> {{location.name}} </option>    
                           </select>                  
                         </div>     
                      </div>
                      <div class="col-12 col-sm-12 col-md-4 col-lg-4" *ngIf="dataForm.main_location_id != ''">
                       <div class="form-group">
                         <label for="sub_location_id"  style="float: right;margin-right: 5px">  الموقع الفرعي </label>
-                        <select name="sub_location_id" [(ngModel)]="dataForm.sub_location_id" class="form-control" (change)="changeSubLocation($event)">
-                          <option *ngFor="let location of subLocationList" [value]="location.id"> {{location.name}} </option>    
+                        <select name="sub_location_id" [(ngModel)]="dataForm.sub_location_id" class="form-control" (change)="changeSubLocation($event)" required >
+                          <option *ngFor="let location of subLocationList" [value]="location.id" required> {{location.name}} </option>    
                         </select>
                       </div>
                      </div>
@@ -120,7 +120,8 @@
                           <td style="position: relative;">
                             <input type="file" name="file{{i}}" id="file{{i}}" class="inputfile" alife-file-to-base64 (onFileChanged)="onFileChanges($event,i)"/>
                             <label for="file{{i}}" class="iconUpload-w"><i class="fas fa-upload"></i></label>
-                            <!-- <span class="fileName-w" *ngIf="file.nameFile" style="color:green">File Chossen</span> -->
+                            <span class="fileName-w" *ngIf="file.nameFile" style="color:green"> <i class='fas fa-check'style=" float: left; padding-top: 4px; "></i>
+                            </span>
                           </td>
                           <!-- <td><a href="{{authSer.pathImg + file.nameFile}}" target="_blank"><i class="fas fa-download"></i></a></td> -->
                           <td><button type="button" class="btn btn-danger form-control deleteRow-w" (click)="onDeleteRow(i)">حذف</button></td>

+ 6 - 3
src/app/dashboard/create-report/add-new-report/add-new-report.component.ts

@@ -1,7 +1,7 @@
 import { NgxSpinnerService } from 'ngx-spinner';
 import { DashboardService } from './../../../shared/dashboard.service';import { HttpClient } from '@angular/common/http';
 import { AuthServiceService } from './../../../shared/auth-service.service';
-import { ActivatedRoute, Params } from '@angular/router';
+import { ActivatedRoute, Params, Router } from '@angular/router';
 import { Component, OnInit, ViewChild } from '@angular/core';
 import { NgForm } from '@angular/forms';
 import { ToastrService } from 'ngx-toastr';
@@ -24,7 +24,8 @@ export class AddNewReportComponent implements OnInit {
     private spiner: NgxSpinnerService,
     private location: Location,
     private authService: AuthServiceService,
-    private userService: UserService
+    private userService: UserService,
+    private router: Router
     ) { }
 
     locationList = [];
@@ -33,6 +34,7 @@ export class AddNewReportComponent implements OnInit {
     bindingDateSplitStart;
     checked : boolean = false;
     pageId: number;
+    uploaded: boolean = false;
 
     files = [{
       title : null,
@@ -146,6 +148,7 @@ export class AddNewReportComponent implements OnInit {
       (response)  => {
         console.log(id);
         this.subLocationList = response['locations'];
+        
       },
       (error) => {
         console.log(error)
@@ -178,6 +181,7 @@ export class AddNewReportComponent implements OnInit {
   onFileChanges(event, index:number) {
     console.log(event);
     console.log(index);
+    this.uploaded = true;
     this.files[index].nameFile = event[0].name.substring(0,20) + '....';
     this.files[index].file = event[0].base64;
     this.files[index].file_type = event[0].type.split('/')[1];
@@ -227,6 +231,5 @@ export class AddNewReportComponent implements OnInit {
       console.log('i cant send the request');
     }
   
-    
     }
 }

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

@@ -92,6 +92,7 @@ import { DefinitionTimeListComponent } from './definition-of-time/definition-tim
 import { DefinitionTimeAddComponent } from './definition-of-time/definition-time-add/definition-time-add.component';
 import { AdminstrationContactOfficersListComponent } from './adminstration-contact-officers/adminstration-contact-officers-list/adminstration-contact-officers-list.component';
 import { AddNewReportComponent } from './create-report/add-new-report/add-new-report.component';
+import { MaintenanceCommunicationsListComponent } from './maintenance-communications/maintenance-communications-list/maintenance-communications-list.component';
 
 const dashboardRouting: Routes = [
     {path: 'service/:userID/:serviceID', component: ServiceItemComponent, canActivate: [AuthGuard], children: [
@@ -220,6 +221,7 @@ const dashboardRouting: Routes = [
     {path: 'adminstrationContactOfficers/:adminId', component: AdminstrationContactOfficersListComponent , canActivate: [AuthGuard]},
     {path: 'departmentContactOfficers/:adminId', component: AdminstrationContactOfficersListComponent , canActivate: [AuthGuard]},
     {path: 'addNewReport/:reportId', component: AddNewReportComponent , canActivate: [AuthGuard]},
+    {path: 'maintenanceCommunicationList/:maintCommuicationPageId', component: MaintenanceCommunicationsListComponent , canActivate: [AuthGuard]},
     
 
     

+ 30 - 0
src/app/dashboard/maintenance-communications/maintenance-communications-list/maintenance-communications-list.component.css

@@ -0,0 +1,30 @@
+.table {
+    margin: 30px 0;
+}
+
+.dashButton-w {
+    float: right;
+    margin: 10px;
+}
+
+.custom-control-label::after,
+.custom-control-label::before {
+    width: 1.5rem;
+    height: 1.5rem;
+}
+
+.fixedWidthLabel-w::after,
+.fixedWidthLabel-w::before {
+    width: 1.5rem;
+    height: 1.5rem;
+}
+
+.disblayBlock-w {
+    display: block;
+}
+
+/* .centerIneerItem {
+    display: flex;
+    justify-content: center;
+    text-align: center;
+} */

+ 126 - 3
src/app/dashboard/maintenance-communications/maintenance-communications-list/maintenance-communications-list.component.html

@@ -1,3 +1,126 @@
-<p>
-  maintenance-communications-list works!
-</p>
+<div class="container">
+
+  <div class="row">
+    <div class="col-12">
+      <ul class="list-unstyled titileLi-w">
+        <li class="headingText-w">خدمه البلاغات  </li>
+        <li class="headingText-w activeLi-w" style="margin-right:5px"> تعريف الموقع</li>
+      </ul>
+    </div>
+  </div>
+
+  <div class="containerContent-w">
+    <div class="row">
+      <!-- <div class="col-12 col-sm-12 col-md-6 col-lg-6">
+        <button type="button" class="btn btn-outline-success butttonCreate dashButton-w" (click)="onAdd()" *ngIf="authSer.showAddBtn"><i class="fas fa-plus marginFontAowsome-w"></i>إنشاء جديد</button>
+        <button type="button" class="btn btn-outline-danger butttonDelete dashButton-w" (click)="onDelete()" *ngIf="authSer.showDeleteBtn"><i class="fas fa-times marginFontAowsome-w"></i>حذف</button>
+      </div> -->
+      <div class="col-12 col-sm-12 col-md-12 col-lg-6">
+        <div class="form-group">
+          <span class="spanSelect-w" style="margin-right:10px;">
+            <select [ngModel]="dataTableNumber" class="form-control selectButton-w" (input)="onGetValue($event)">
+              <option value="5">5</option>
+              <option value="10">10</option>
+              <option value="15">15</option>
+              <option value="20">20</option>
+            </select>
+            من العناصر يتم عرضها
+          </span>
+        </div>
+        <div class="form-group" style="float: right; margin: 0 20px;">
+          <span class="spanSelect-w" style="
+          margin-top: -13px; ">
+            <select [ngModel]="filtterStatus" style="width:134px;" class="form-control selectButton-w" (input)="onGetValueFiltter($event)">
+                <option value="all"> الكل </option>
+                <option value="new"> جديد</option>
+                <option value="closed">مغلق</option>
+                <option value="reopen">استأنف</option>
+                <option value="redirect_to_adminstrations">العائد للادارات</option>               
+            </select>
+              النوع
+          </span>
+        </div>
+      </div>
+      <div class="col-12 col-sm-12 col-md-6 col-lg-6">
+        <div class="form-group">
+          <input type="text" placeholder="البحث (اسم التصنيف	)" class="form-control inputSearchTable-w" style="margin-top:13px;" (input)="filtterFunc($event)"/>
+          <hr>
+        </div>
+      </div>
+    </div>
+
+    <!-- <div class="row">
+        <div class="col-12 col-sm-12 col-md-12 col-lg-6">
+          <div class="form-group">
+            <span class="spanSelect-w" style="margin-right:10px;">
+              <select [ngModel]="dataTableNumber" class="form-control selectButton-w" (input)="onGetValue($event)">
+                <option value="5">5</option>
+                <option value="10">10</option>
+                <option value="15">15</option>
+                <option value="20">20</option>
+              </select>
+              من العناصر يتم عرضها
+            </span>
+          </div>
+          <div class="form-group" style="float: right; margin: 0 20px;">
+            <span class="spanSelect-w" style="
+            margin-top: -13px; ">
+              <select [ngModel]="filtterStatus" style="width:134px;" class="form-control selectButton-w" (input)="onGetValueFiltter($event)">
+                  <option value="all"> الكل </option>
+                  <option value="main"> رئيسي</option>
+                  <option value="sub">فرعي</option>
+                  
+              </select>
+                النوع
+            </span>
+          </div>
+        </div>
+        
+    </div> -->
+
+    <table class="table table-bordered" *ngIf="this.count != 0">
+      <thead class="headBackground-w">
+        <tr>
+          <!-- <th>
+            <div class="custom-control custom-checkbox">
+              <input type="checkbox" class="custom-control-input" [(ngModel)]="selectedAll" (change)="selectAll();" id="customCheck" name="example1">
+            </div>
+          </th> -->
+         
+          <th>رقم البلاغ</th>
+          <th>وقت انشاء البلاغ</th>
+          <th>موضوع البلاغ</th>
+          <th>الادارات / الاقسام / الموظفين الموجه لهم</th> 
+          <th>الفئة</th>
+          <th>الحالة</th>
+          <th>عرض التفاصيل</th>         
+          <!-- <th *ngIf="authSer.showEditBtn">تعديل</th> -->
+        </tr>
+      </thead>
+      <tbody>
+        <tr *ngFor="let data of dataList | paginate: { itemsPerPage: perPagePagenation, currentPage: currentPage, totalItems: count }; let i = index ">
+          <!-- <td>
+            <div class="custom-control custom-checkbox centerIneerItem">
+              <input type="checkbox" class="custom-control-input" id="{{data.id}}" [(ngModel)]="data.selected" [value]='data' (change)="checkIfAllSelected();">
+              <label class="custom-control-label disblayBlock-w" for="{{tab.id}}" style="color:#2a2a2a"></label>
+            </div>
+          </td> -->
+          <td>{{data.id}}</td>
+          <td>{{data.created_date + "  /  " +data.created_time }}</td>
+          <td>{{data.subject }}</td>
+          <td >{{data.adminstration_name}}</td>
+          <td>{{data.time_period_name}}</td>
+          <td>{{data.status}}</td>
+          <td>{{data.maintenance_notes}}</td>
+
+      </tr>
+    </tbody>
+  </table>
+  <div class="col-12" *ngIf="this.count == 0" >
+    <!-- taaaaaaaaaaable -->
+    <h2 class="title"> لا يوجد بيانات لعرضها </h2>
+
+  </div>
+  <pagination-controls nextLabel="التالي" previousLabel="السابق" (pageChange)="onPageChange($event)" *ngIf="this.count != 0"></pagination-controls>
+  </div>
+</div>

+ 183 - 1
src/app/dashboard/maintenance-communications/maintenance-communications-list/maintenance-communications-list.component.ts

@@ -1,4 +1,12 @@
+import { AuthServiceService } from './../../../shared/auth-service.service';
+import { NgxSpinnerService } from 'ngx-spinner';
+import { ActivatedRoute, Router, Params } from '@angular/router';
+import { DashboardService } from './../../../shared/dashboard.service';
+import { HttpClient } from '@angular/common/http';
 import { Component, OnInit } from '@angular/core';
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
+import { UserService } from '../../../shared/user.service';
+import { ToastrService } from 'ngx-toastr';
 
 @Component({
   selector: 'app-maintenance-communications-list',
@@ -7,9 +15,183 @@ import { Component, OnInit } from '@angular/core';
 })
 export class MaintenanceCommunicationsListComponent implements OnInit {
 
-  constructor() { }
+  
+  constructor(private http: HttpClient,
+    private route: ActivatedRoute,
+    private router: Router,
+    private modal: Modal,
+    private userSer: UserService,
+    private spinner: NgxSpinnerService,
+    private authSer: AuthServiceService,
+    private toastr: ToastrService,
+    private dashboardSer: DashboardService) { }
+
+    dataList = [];
+    pages= [];
+    pageId: number;
+    Ids = [];
+    count: number;
+    perPagePagenation: number;
+    currentPage:number = 1;
+    filtterStatus = 'all';
+    selectedAll: any;
+    userLoginId:number;
+    serviceId:number;
+    dataTableNumber: number = 5;
+    absorpationListIds = [];
+    dataListIds = [];
 
   ngOnInit() {
+
+      //init values of permisions
+      this.authSer.showAddBtn = false;
+      this.authSer.showDeleteBtn = false;
+      this.authSer.showEditBtn = false;
+      this.authSer.showPermissionsBtn = false;
+      //show / hide notification search in header
+      this.authSer.notificationLogin = true;
+      this.authSer.showSearchHeader = false;
+      this.authSer.showHeaderLogin = false;
+      this.authSer.showHeaderDashBoard = true;
+      this.authSer.showDashboardHeader = true;
+      this.authSer.internalHeader = false;
+
+      this.route.params.subscribe(
+        (parmas: Params) => {
+          this.pageId =  +parmas['maintCommuicationPageId'];
+          localStorage.setItem('pageIdActive', parmas['maintCommuicationPageId']);
+        }
+      );
+
+      this.route.parent.params.subscribe(
+        (params:Params) => {
+            this.userLoginId = params['userID'];
+            this.serviceId = params['serviceID'];
+           
+    
+            this.userSer.getPagesPermetiotns(this.userLoginId, this.serviceId).subscribe(
+              (responce) => {
+                console.log(responce);
+                this.pages = responce['pages'];
+                for(let i = 0; i< this.pages.length; i++) {
+                  if(this.pages[i].id == 58) {
+                    if(this.pages[i]['permissions'][0].name == 'follow_up_communications_for_admin_maintenance') {
+                      this.authSer.showAddBtn = true;
+                      this.authSer.showEditBtn = true;
+                      this.authSer.showDeleteBtn = true;
+                    } else {
+                      console.log('no permissions');
+                    }
+                  } else {
+                    console.log('no events');
+                  }
+                }
+                this.spinner.hide();
+              },
+              (error) => {console.log(error)}
+            );
+          }
+        );
+        console.log('current page',this.pageId)
+        this.dashboardSer.getListData(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
+          (response) => {
+            console.log(response);
+            this.dataList = response['communications'];
+            this.count = response['count'];
+            this.perPagePagenation = response['per_page'];
+           
+          },
+          (error) => {
+            console.log(error);
+          }
+  
+        );
   }
 
+  filtterFunc(data) {
+    this.dataList =[];
+    this.absorpationListIds = [];
+    console.log(data.target.value);
+    const dataSearch = data.target.value;     
+    this.currentPage = 1;
+    console.log('search curent page', this.currentPage);
+    console.log('search page id', this.pageId);
+  
+    this.dashboardSer.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+      (responce) => {
+        console.log(responce);
+        this.dataList = responce['communications'];
+        this.count = responce['count'];
+        this.perPagePagenation = responce['per_page'];
+        console.log('filtter count', this.count);
+        console.log('filtter perPagePAgenation', this.perPagePagenation);
+      },
+      (error) => {
+        console.log(error)
+      }
+    );
+  };
+
+onPageChange(pagenationNumber) {
+  this.spinner.show();
+  this.currentPage = pagenationNumber;
+  this.absorpationListIds = [];
+  console.log(pagenationNumber);
+  console.log(this.pageId);
+  this.dashboardSer.getListData(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
+    (responce) => {
+      console.log(responce);
+      this.dataList = responce['communications'];
+      this.count = responce['count'];
+      this.perPagePagenation = responce['per_page'];
+      console.log('FFFFFF', this.absorpationListIds);
+      this.spinner.hide();
+    },
+    (error) => {
+      console.log(error);
+      this.spinner.hide();
+    }
+  );
+}
+//determine the list count from select element 
+onGetValue(event) {
+  this.spinner.show();
+  this.absorpationListIds = [];
+  this.dataTableNumber = event.target.value;
+  this.dashboardSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
+    (responce) => {
+      console.log(responce);
+      this.absorpationListIds = responce['communications'];
+      this.count = responce['count'];
+      this.perPagePagenation = responce['per_page'];
+      this.spinner.hide();
+    },
+    (error) => {
+      console.log(error);
+      this.spinner.hide();
+    }
+  );
+};
+onGetValueFiltter(event) {
+  console.log(event.target.value)
+  this.spinner.show();
+  this.dataList = [];
+  const typeId = event.target.value;
+  this.filtterStatus = event.target.value;
+  console.log(this.filtterStatus);
+  this.http.get(this.authSer.pathApi +'/page_list/' + this.pageId + '/' + this.currentPage + '/' + this.dataTableNumber + '/' + typeId).subscribe(
+    (responce) => {
+      console.log(responce);
+      this.dataList = responce['communications'];
+      this.count = responce['count'];
+      this.perPagePagenation = responce['per_page'];
+      this.spinner.hide();
+      console.log('UrL>>', this.authSer.pathApi +'/page_list/' + this.pageId + '/' + this.currentPage + '/' + this.dataTableNumber + '/' + typeId)
+    },
+    (error) => {
+      console.log(error);
+    }
+  );
+}
+
 }

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

@@ -439,6 +439,8 @@ export class ServiceItemComponent implements OnInit {
       this.router.navigate(['departmentContactOfficers/' + dataPage.id], {relativeTo: this.route});
     }else if(dataPage.id == 55) {
       this.router.navigate(['addNewReport/' + dataPage.id], {relativeTo: this.route});
+    }else if(dataPage.id == 58) {
+      this.router.navigate(['maintenanceCommunicationList/' + dataPage.id], {relativeTo: this.route});
     }
     
   }

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

@@ -247,6 +247,8 @@ getDataService(dataService){
             this.router.navigate(['/service/' + this.idUser + '/' + dataService.id + '/departmentContactOfficers/' + this.pages[0].id]);
           }else  if(this.pages[0].id == 55) {
             this.router.navigate(['/service/' + this.idUser + '/' + dataService.id + '/addNewReport/' + this.pages[0].id]);
+          }else  if(this.pages[0].id == 58) {
+            this.router.navigate(['/service/' + this.idUser + '/' + dataService.id + '/maintenanceCommunicationList/' + this.pages[0].id]);
           }
         },
         (error) => {