amr 5 anos atrás
pai
commit
b316eaee0b

+ 1 - 1
src/app/dashboard/application-for-housing/application-for-housing.component.html

@@ -110,7 +110,7 @@
              
             <div class="row">
               <div class="col-12">
-                  <button type="submit" class="btn btn-success rightW"  [disabled]="send" >حفظ</button>
+                  <button type="submit" class="btn btn-success rightW"  [disabled]="send || saveTherequist" >حفظ</button>
                 <button type="button" class="btn btn-warning rightW" (click)="authService.backFromEdit()" style="margin:20px 10px;">إلغاء</button>
               </div>
             </div>

+ 9 - 13
src/app/dashboard/application-for-housing/application-for-housing.component.ts

@@ -125,6 +125,8 @@ export class ApplicationForHousingComponent implements OnInit {
           if(status == 'employee free to make new request'){
             this.location.back();
             this.toastr.warning('لديك طلب بالفعل');
+            console.log("Fuck");
+            
             
           }else if(status == 'employee free to make new request'){
             console.log('Done');
@@ -216,27 +218,23 @@ export class ApplicationForHousingComponent implements OnInit {
       if(this.files[i].file_type){
         this.files[i].file_type = this.files[i].file_type.toLowerCase();
       }
-      if(this.files[i].file != null && this.files[i].title == null){
-       this.toastr.warning('ادخل عنوان الملف رقم ' + (i+1) );
-       this.checked = true;
-      }else if(this.files[i].file == null && this.files[i].title != null){
-        this.files.splice(i , 1);
-      }else if(this.files[i].file == null && this.files[i].title == null){
+      if(!this.files[i].file){
         this.files.splice(i , 1);
-       } else {
+      }
+     else  if(!this.files[i].title){
+      this.toastr.warning('ادخل عنوان الملف رقم ' + (i+1) );
+      return 0;
+     } else {
        delete this.files[i].nameFile;
         this.applyForm.files.push(this.files[i]);
       }
     }
-    if(!this.checked){
-     
 
     console.log(this.applyForm);
      this.http.post(this.authService.pathApi + '/add_housing_request' , this.applyForm )
       .subscribe(
          res => {
            console.log(res);
-           this.checked = false;
            this.toastr.success('تم حفظ الطلب ');
           //  this.router.navigate(['/service/' + this.userId + '/' +  this.serviceId + '/followCommunicationList/58']);
           this.location.back();
@@ -246,9 +244,7 @@ export class ApplicationForHousingComponent implements OnInit {
            this.toastr.error('حدث خطأ في الاتصال ');
           }
        );
-    }else{
-      console.log('i cant send the request');
-    }
+    
   
     }
 

+ 7 - 1
src/app/dashboard/females_request_types/females-request-types-add/females-request-types-add.component.ts

@@ -135,8 +135,14 @@ export class FemalesRequestTypesAddComponent implements OnInit {
         },
         (error) => {
           this.disable = false;
-          console.log(error);
+          console.log(error.error);
+          if(error.error.error == 'Requests already uses this type can not modify it'){
+            this.toastr.warning('لا يوجد صلاحية لتعديل الطلب')
+          }else{
+            console.log(error);
           this.toastr.error('خطأ في الخادم ، رجاء المحارله لاحقا');
+          }
+          
         }
       )
     } else {

+ 2 - 2
src/app/dashboard/females_request_types/females-request-types-list/females-request-types-list.component.html

@@ -4,7 +4,7 @@
     <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>
+        <li class="headingText-w activeLi-w" style="margin-right:5px">تحديد انواع الطلبات</li>
       </ul>
     </div>
   </div>
@@ -17,7 +17,7 @@
       </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)"/>
+          <input type="text" placeholder="البحث (اسم الطلب)" class="form-control inputSearchTable-w" style="margin-top:13px;" (input)="filtterFunc($event)"/>
           <hr>
         </div>
       </div>

+ 13 - 0
src/app/dashboard/females_request_types/females-request-types-list/females-request-types-list.component.ts

@@ -154,6 +154,8 @@ export class FemalesRequestTypesListComponent implements OnInit {
         },
         err => {
           console.log(err);
+          this.spinner.hide();
+
         }
       );
     }
@@ -170,9 +172,13 @@ export class FemalesRequestTypesListComponent implements OnInit {
           this.dataList = res['types'];
           this.count = res['count'];
           this.perPagePagenation = res['per_page'];
+          this.spinner.hide();
+
         },
         err => {
           console.log(err);
+          this.spinner.hide();
+
           
         }
 
@@ -190,9 +196,13 @@ export class FemalesRequestTypesListComponent implements OnInit {
           this.dataList = res['types'];
           this.count = res['count'];
           this.perPagePagenation = res['per_page'];
+          this.spinner.hide();
+
         },
         err => {
           console.log(err);
+          this.spinner.hide();
+
           
         }
 
@@ -212,9 +222,12 @@ export class FemalesRequestTypesListComponent implements OnInit {
           this.dataList = res['types'];
           this.count = res['count'];
           this.perPagePagenation = res['per_page'];
+          this.spinner.hide();
+
         },
         err => {
           console.log(err);
+          this.spinner.hide();
           
         }
 

+ 2 - 2
src/app/dashboard/link_unit_to_covenants/link-unit-to-covenants-add/link-unit-to-covenants-add.component.html

@@ -75,8 +75,8 @@
                             </div> 
                             <div class="col-6"  *ngIf="categoryId == category_conv.category_id ">
                               <div class="form-group">
-                                <input type="number" class="form-control" placeholer="amount" min="1"  [(ngModel)]="category_conv.covenant_amount" [ngModelOptions]="{standalone: true}"/>
-                                <p style="color: red" *ngIf="over">تخطيت الحد المسموح</p>
+                                <input type="number" class="form-control" placeholer="amount" min="1" max="{{category_conv.available_amount}}"  [(ngModel)]="category_conv.covenant_amount" [ngModelOptions]="{standalone: true}"/>
+                                <!-- <p style="color: red" *ngIf="over">تخطيت الحد المسموح</p> -->
                               </div>
                             </div>
                       </div>

+ 28 - 15
src/app/dashboard/link_unit_to_covenants/link-unit-to-covenants-add/link-unit-to-covenants-add.component.ts

@@ -36,6 +36,7 @@ export class LinkUnitToCovenantsAddComponent implements OnInit {
   covenants = [];
   final = [] ;
   over : boolean = false;
+  unitId = '';
   constructor(
     private dashBoardSer: DashboardService,
     private toastr: ToastrService,
@@ -109,25 +110,25 @@ export class LinkUnitToCovenantsAddComponent implements OnInit {
           this.formData.housing_complex_id = res['unit'].housing_complex_id;
           this.getBuildingType( this.formData.housing_complex_id);
           this.formData.building_type_id = res['unit'].building_type_id;
+          this.unitId = res['unit'].id;
+          
           this.getBuilding(this.formData.building_type_id);
           this.formData.building_id = res['unit'].building_id;
-        //  this.getUnit( this.formData.building_id);
-          this.formData.unit_id = res['unit'].unit_id;
           this.covenant(this.formData.covenants[0].category_id);
           this.covenants = res['unit'].covenants;
           console.log('conv form',this.formData.covenants);
           console.log('conv', this.covenants);
-          
-          for (let i = 0 , n = this.formData.covenants.length; i < n; i++) {
-           const arr= this.formData.covenants[i].covenants_data; 
-           for (let ii = 0, k = arr.length; ii < k; ii++) {
+        
+        for (let i = 0 , n = this.formData.covenants.length; i < n; i++) {
+          const arr= this.formData.covenants[i].covenants_data; 
+          for (let ii = 0, k = arr.length; ii < k; ii++) {
             for (let j = 0 , m = this.covenants.length; j < m; j++) {
               if(arr[ii].id == this.covenants[j].covenant_id){
                 arr[ii].selected = true;
                 arr[ii].covenant_amount = this.covenants[j].covenant_amount;
               }
-           }
-           
+            }
+            
               
             }
             
@@ -201,6 +202,8 @@ export class LinkUnitToCovenantsAddComponent implements OnInit {
 }
 
 getUnit(event){
+  console.log('unit id >>' , this.unitId);
+  
   this.http.get(this.authSer.pathApi + '/units_list_by_building_id/' + event ).subscribe(
     res => {
       console.log(res);
@@ -209,6 +212,7 @@ getUnit(event){
         this.isBuilding = true;
         console.log(this.units);
 
+
       }else{
            this.isBuilding = false;
         }
@@ -219,6 +223,14 @@ getUnit(event){
       
     }
   );
+  this.formData.unit_id = this.unitId;
+  console.log('dffd',this.formData.unit_id);
+  if (this.editPageId) {
+    this.showcovenant_categories()
+
+  }
+  
+  
 }
 
     covenant(event){ 
@@ -239,16 +251,17 @@ getUnit(event){
 
         //final finalCov array to add categories in covenants
        for(let j = 0 , n =  this.formData.covenants[i].covenants_data.length; j < n; j++) {
+          
               if(event == this.formData.covenants[i].covenants_data[j].id ){
 
                 this.formData.covenants[i].covenants_data[j].covenant_amount = 1
-
-
-                // if(this.formData.covenants[i].covenants_data[j].selected == false){
-                // this.formData.covenants[i].covenants_data[j].covenant_amount = 1
-                // }else{
-                //   this.formData.covenants[i].covenants_data[j].covenant_amount = 0
-                // }
+                  if(this.formData.covenants[i].covenants_data[j].selected == false){
+                    this.formData.covenants[i].covenants_data[j].covenant_amount = 1
+                    }else{
+                      this.formData.covenants[i].covenants_data[j].covenant_amount = 0
+                    }
+                
+                              
               }
         }
        

+ 6 - 3
src/app/dashboard/view_requests_for_adminstration/view-requests-for-adminstration-details/view-requests-for-adminstration-details.component.html

@@ -88,7 +88,7 @@
                         </table>
                       </div>
                       <div class="row">
-                        <div class="col-12 ">
+                        <div class="col-12 " *ngIf="confirmed">
                             <div class="wrapper btns-des">
                           <div class="col-3 col-md-2">
                             <button type="button" class="btn btn-success" [disabled]="acceptCheak" (click)="accept()">قبول</button>
@@ -101,6 +101,9 @@
                           </div>
                           </div>
                         </div>  
+                        <div class="col-12 " *ngIf="!confirmed">
+                          <h3 style="color: green">تم تأكيد الطلب</h3>
+                      </div> 
                       </div>
                       <div class="col-12" *ngIf="refusedCheak">
                       <h2 class="title" > سبب الرفض</h2>
@@ -169,8 +172,8 @@
              
             <div class="row">
               <div class="col-12">
-                  <button type="submit" class="btn btn-success rightW"  [disabled]="notvailed" >حفظ</button>
-                <button type="button" class="btn btn-warning rightW" (click)="authSer.backFromEdit()" style="margin:20px 10px;">إلغاء</button>
+                  <button type="submit" class="btn btn-success rightW"  [disabled]="notvailed" *ngIf="confirmed" >حفظ</button>
+                <button type="button" class="btn btn-warning rightW" (click)="authSer.backFromEdit()" style="margin:20px 10px;">{{!confirmed ? 'رجوع' : 'الغاء'}}</button>
               </div>
             </div>
           </div>

+ 5 - 2
src/app/dashboard/view_requests_for_adminstration/view-requests-for-adminstration-details/view-requests-for-adminstration-details.component.ts

@@ -30,8 +30,8 @@ export class ViewRequestsForAdminstrationDetailsComponent implements OnInit {
   isBuildingType = false;
   isBuilding = false;
   status = ''
-  notvailed: boolean = true
-
+  notvailed: boolean = true;
+  confirmed:boolean = true;
   constructor(
     private dashBoardSer: DashboardService,
     private toastr: ToastrService,
@@ -105,6 +105,9 @@ export class ViewRequestsForAdminstrationDetailsComponent implements OnInit {
           this.unitInformation.building_id = res['request'].unit_information.building_id;
           this.unitInformation.unit_id = res['request'].unit_information.unit_id;
            this.accept();
+        }else if(this.formData.status == 'confirmed'){
+          this.confirmed = false
+
         }else if(this.formData.status == 'waiting'){
           this.waiting()
          }else if(this.formData.status == 'refused') {