Browse Source

add external dashboard

Hima 5 years ago
parent
commit
5f05596383

+ 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">خدمه إداره المحتوي > </li>
+          <li class="headingText-w"> {{typeServices}} > </li>
           <li class="headingText-w activeLi-w" style="margin-right:5px">{{typeLink}}</li>
         </ul>
     </div>

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

@@ -37,6 +37,7 @@ export class HospitalListComponent implements OnInit {
   typeLink: string = '';
   dataTableNumber: number = 5;
   pages = [];
+  typeServices: string = '';
 
   ngOnInit() {
 
@@ -60,8 +61,13 @@ export class HospitalListComponent implements OnInit {
         this.pageId = params['typePageId'];
         if(this.pageId == 6) {
           this.typeLink = 'المستشفيات والمراكز';
+          this.typeServices = 'خدمه إداره المحتوي';
         } else if(this.pageId == 10) {
           this.typeLink = 'الإدرات';
+          this.typeServices = 'خدمه الصلاحيات';
+        } else if(this.pageId == 30) {
+          this.typeLink = 'المستشفيات والمراكز';
+          this.typeServices = 'خدمه إداره الصفحه الخارجيه';
         }
       }
     );
@@ -71,7 +77,7 @@ export class HospitalListComponent implements OnInit {
       (params: Params) => {
         this.userLoginId = params['userID'];
         this.serviceId = params['serviceID'];
-        if(this.pageId == 6) {
+        if(this.pageId == 6 || this.pageId == 30) {
           this.hospitalService.getHospitalsList(this.pageId , this.currentPage, this.dataTableNumber).subscribe(
             (responce) => {
               console.log(responce);
@@ -100,6 +106,18 @@ export class HospitalListComponent implements OnInit {
                       this.authSer.showDeleteBtn = true;
                     }
                   }
+                } else if(this.pages[i].id == 30){
+                  for(let j = 0; j < this.pages[i].permissions.length; j++) {
+                    if(this.pages[i].permissions[j].name == 'add_hospitals_centers_ex'){
+                      this.authSer.showAddBtn = true;
+                    }
+                    if(this.pages[i].permissions[j].name == 'edit_hospitals_centers_ex'){
+                      this.authSer.showEditBtn = true;
+                    }
+                    if(this.pages[i].permissions[j].name == 'delete_hospitals_centers_ex'){
+                      this.authSer.showDeleteBtn = true;
+                    }
+                  }
                 }else {
                   console.log('no roles');
                 }
@@ -204,7 +222,7 @@ export class HospitalListComponent implements OnInit {
                         console.log(error);
                       }
                     );
-                  } else if(this.pageId == 6){
+                  } else if(this.pageId == 6 || this.pageId == 30){
                     this.hospitalService.getHospitalsList(this.pageId , this.currentPage, this.dataTableNumber).subscribe(
                       (responce) => {
                         console.log(responce);
@@ -240,7 +258,7 @@ export class HospitalListComponent implements OnInit {
     this.currentPage = 1;
     console.log('search curent page', this.currentPage);
     console.log('search page id', this.pageId);
-    if(this.pageId == 6){
+    if(this.pageId == 6 || this.pageId == 30){
       this.hospitalService.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
         (responce) => {
           console.log(responce);
@@ -276,7 +294,7 @@ export class HospitalListComponent implements OnInit {
     this.spinner.show();
     this.dataList = [];
     this.dataTableNumber = event.target.value;
-    if(this.pageId == 6) {
+    if(this.pageId == 6 || this.pageId == 30) {
       this.hospitalService.getHospitalsList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
         (responce) => {
           console.log(responce);
@@ -309,7 +327,7 @@ export class HospitalListComponent implements OnInit {
 
   //add hospitals 
   onAdd() {
-    if(this.pageId == 6) {
+    if(this.pageId == 6 || this.pageId == 30) {
       this.router.navigate(['service/' + this.userLoginId + '/' + this.serviceId + '/add/Hospital']);
     } else if(this.pageId == 10) {
       this.router.navigate(['service/' + this.userLoginId + '/' + this.serviceId + '/add/Management']);

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

@@ -130,7 +130,7 @@ export class ServiceItemComponent implements OnInit {
         (error) => {console.log(error)}
       );
 
-    } else if(service.id == 6) {
+    } else if(service.id == 6 || service.id == 2) {
       //خدمه اداره المحتوي
       this.extraPages = [];
       this.userservice.getPagesPermetiotns(this.userId, service.id).subscribe(
@@ -183,24 +183,14 @@ export class ServiceItemComponent implements OnInit {
             this.router.navigate(['/service/' + this.userId + '/' + service.id + '/mainMenuList/' + this.pages[0].id]);
           } else if(this.pages[0].id == 24) {
             this.router.navigate(['/service/' + this.userId + '/' + service.id + '/advertisimentList/' + this.pages[0].id]);
+          } else if(this.pages[0].id == 30) {
+            console.log('/service/' + this.userId + '/' + service.id + '/hospitalsList/' + this.pages[0].id);
+            this.router.navigate(['/service/' + this.userId + '/' + service.id + '/hospitalsList/' + this.pages[0].id]);
           }
           this.spinner.hide();
         },
         (error) => {console.log(error)}
       );
-    } else if(service.id == 2) {
-      this.userSer.getPagesPermetiotns(this.userId, this.servicesId).subscribe(
-        (responce) => {
-          console.log(responce);
-          this.mobilePages = responce['pages'];
-          this.pages = responce['pages'];
-          this.authSer.showMoreLinks = false;
-          console.log(this.pages);
-        },
-        (error) => {
-          console.log(error);
-        }
-      )
     }
   }
 

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

@@ -135,6 +135,10 @@ export class ServicesComponent implements OnInit, OnDestroy {
         (responce) => {
           console.log(responce);
           this.pages = responce['pages'];
+          if(this.pages[0].id == 30) {
+            console.log('/service/' + this.idUser + '/' + dataService.id + '/hospitalsList/' + this.pages[0].id);
+            this.router.navigate(['/service/' + this.idUser + '/' + dataService.id + '/hospitalsList/' + this.pages[0].id]);
+          } 
         },
         (error) => {
           console.log(error);