Hima 5 anos atrás
pai
commit
cea20e771e
64 arquivos alterados com 1548 adições e 876 exclusões
  1. 330 341
      package-lock.json
  2. 4 1
      package.json
  3. 12 9
      src/app/Internal-Page/internal-page-content/internal-page-content.component.html
  4. 1 3
      src/app/Internal-Page/internal-page-content/internal-page-content.component.ts
  5. 1 1
      src/app/Internal-Page/internal-page-header/internal-page-header.component.css
  6. 3 3
      src/app/Internal-Page/internal-page-header/internal-page-header.component.html
  7. 8 9
      src/app/Internal-Page/internal-page-header/internal-page-header.component.ts
  8. 0 3
      src/app/Internal-Page/internal-page/internal-page.component.ts
  9. 0 3
      src/app/Internal-Page/news-page/news-page.component.ts
  10. 9 7
      src/app/app.module.ts
  11. 29 11
      src/app/dashboard/achievements/achievement-list/achievement.component.ts
  12. 10 4
      src/app/dashboard/add-join-us/add-join-us.component.html
  13. 33 7
      src/app/dashboard/add-join-us/add-join-us.component.ts
  14. 84 64
      src/app/dashboard/events/add-event/add-event.component.html
  15. 24 3
      src/app/dashboard/events/add-event/add-event.component.ts
  16. 1 0
      src/app/dashboard/events/events.component.html
  17. 30 11
      src/app/dashboard/events/events.component.ts
  18. 2 2
      src/app/dashboard/external-services/add-external/add-external.component.css
  19. 2 2
      src/app/dashboard/external-services/add-external/add-external.component.html
  20. 5 3
      src/app/dashboard/external-services/add-external/add-external.component.ts
  21. 29 11
      src/app/dashboard/external-services/external-list/external-list.component.ts
  22. 29 12
      src/app/dashboard/footer/footer-list/footer-list.component.ts
  23. 2 2
      src/app/dashboard/header/header.component.ts
  24. 2 2
      src/app/dashboard/hospitals/add-hospital/add-hospital.component.html
  25. 44 19
      src/app/dashboard/hospitals/add-hospital/add-hospital.component.ts
  26. 29 11
      src/app/dashboard/hospitals/hospital-list/hospital-list.component.ts
  27. 20 7
      src/app/dashboard/internal-services/add-internal-services/add-internal-services.component.css
  28. 4 5
      src/app/dashboard/internal-services/add-internal-services/add-internal-services.component.html
  29. 193 72
      src/app/dashboard/internal-services/add-internal-services/add-internal-services.component.ts
  30. 52 12
      src/app/dashboard/internal-services/internal-services.component.ts
  31. 53 11
      src/app/dashboard/lectures/lectures-list/lectures-list.component.ts
  32. 4 0
      src/app/dashboard/main-menu/add-menu/add-menu.component.css
  33. 2 3
      src/app/dashboard/main-menu/add-menu/add-menu.component.html
  34. 9 1
      src/app/dashboard/main-menu/add-menu/add-menu.component.ts
  35. 2 2
      src/app/dashboard/main-menu/main-list/main-list.component.html
  36. 45 11
      src/app/dashboard/main-menu/main-list/main-list.component.ts
  37. 35 11
      src/app/dashboard/news/add-news/add-news.component.css
  38. 13 10
      src/app/dashboard/news/add-news/add-news.component.html
  39. 122 43
      src/app/dashboard/news/add-news/add-news.component.ts
  40. 1 1
      src/app/dashboard/news/news-list/news-list.component.html
  41. 37 14
      src/app/dashboard/news/news-list/news-list.component.ts
  42. 8 0
      src/app/dashboard/tabs/add-tab/add-tab.component.ts
  43. 34 11
      src/app/dashboard/tabs/tab-list/tab-list.component.ts
  44. 2 2
      src/app/dashboard/users/users.component.html
  45. 3 0
      src/app/dashboard/users/users.component.ts
  46. 11 0
      src/app/higri-date/higri-date.component.css
  47. 13 0
      src/app/higri-date/higri-date.component.html
  48. 71 0
      src/app/higri-date/higri-date.component.ts
  49. 4 2
      src/app/login/login.component.css
  50. 2 7
      src/app/shared/achievements.service.ts
  51. 54 25
      src/app/shared/auth-service.service.ts
  52. 2 7
      src/app/shared/event.service.ts
  53. 0 6
      src/app/shared/external-ser.service.ts
  54. 2 7
      src/app/shared/footer.service.ts
  55. 2 11
      src/app/shared/hospital.service.ts
  56. 2 7
      src/app/shared/internal-ser.service.ts
  57. 1 0
      src/app/shared/islamic-date.service.ts
  58. 1 5
      src/app/shared/lecture.service.ts
  59. 1 7
      src/app/shared/main-menu.service.ts
  60. 2 7
      src/app/shared/new.service.ts
  61. 2 7
      src/app/shared/tabs.service.ts
  62. BIN
      src/assets/image/Group 408.png
  63. BIN
      src/assets/image/Group 408@2x.png
  64. 16 18
      src/styles.css

Diferenças do arquivo suprimidas por serem muito extensas
+ 330 - 341
package-lock.json


+ 4 - 1
package.json

@@ -29,6 +29,7 @@
     "angular-font-awesome": "^3.1.2",
     "angular2-collapsible": "^0.6.1",
     "angular2-jwt": "^0.2.3",
+    "angular2-modal": "^3.0.3",
     "angularx-flatpickr": "^6.1.0",
     "bootstrap": "^4.1.3",
     "core-js": "^2.5.4",
@@ -36,6 +37,7 @@
     "date-fns": "^1.30.1",
     "flatpickr": "^4.5.2",
     "font-awesome": "^4.7.0",
+    "hijri-date": "^0.2.2",
     "jquery": "^3.3.1",
     "jwt-decode": "^2.2.0",
     "materialize-css": "^1.0.0",
@@ -48,6 +50,7 @@
     "ng2-opd-popup": "^1.1.21",
     "ng2-toastr": "^4.1.2",
     "ngx-hijri-lib": "^1.0.6",
+    "ngx-modialog": "^5.0.1",
     "ngx-moment": "^3.3.0",
     "ngx-pagination": "^3.2.1",
     "ngx-quill": "^3.0.0",
@@ -60,7 +63,7 @@
     "zone.js": "~0.8.26"
   },
   "devDependencies": {
-    "@angular-devkit/build-angular": "^0.12.1",
+    "@angular-devkit/build-angular": "^0.12.2",
     "@angular/cli": "~7.0.6",
     "@angular/compiler-cli": "~7.0.0",
     "@angular/language-service": "~7.0.0",

+ 12 - 9
src/app/Internal-Page/internal-page-content/internal-page-content.component.html

@@ -19,15 +19,18 @@
 
                         <div class="col-12 col-md-8 order-1 order-sm-1 order-md-2">
                             <div class="slider">
-                                <ngb-carousel #myCarousel="ngbCarousel">
-                                    <ng-template ngbSlide *ngFor="let report of reportsData; let i = index" id={{i}} >
-                                        <img [src]="[authSer.pathImg + report.photo]" alt="Random first slide">
-                                        <div class="carousel-caption">
-                                        <p class="paragraphTemplate-w" [innerHTML] = "report.description"></p>
-                                        <span class="extra" (click)="onExtraPage(report.id)" *ngIf="report.description">المزيد</span>
-                                        </div>
-                                    </ng-template>
-                                </ngb-carousel>
+                                <div *ngIf="reportsData.length > 1">
+                                        <ngb-carousel #myCarousel="ngbCarousel">
+                                                <ng-template ngbSlide *ngFor="let report of reportsData; let i = index" id={{i}} >
+                                                    <img [src]="[authSer.pathImg + report.photo]" alt="Random first slide">
+                                                    <div class="carousel-caption">
+                                                    <p class="paragraphTemplate-w" [innerHTML] = "report.description"></p>
+                                                    <span class="extra" (click)="onExtraPage(report.id)" *ngIf="report.description">المزيد</span>
+                                                    </div>
+                                                </ng-template>
+                                            </ngb-carousel>
+                                </div>
+                               
                             </div>
                         </div>
                     </div>

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

@@ -67,9 +67,7 @@ export class InternalPageContentComponent implements OnInit {
 
     this.spinner.show();
 
-    this.authSer.arabicTemplate = true;
-    this.authSer.arabicLanguage = true;
-    this.authSer.englishLanguage = false;
+   
 
     // this.myCarousel.activeId = '2';
 

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

@@ -284,7 +284,7 @@ input,button {
     background-color: #FAFAFA;
     cursor: pointer;
     transition: all 0.5s; */
-    margin: 0 10px;
+    margin: 2px 10px;
     padding: 5px;
     padding: 2px 5px;
     color: #03887f;

+ 3 - 3
src/app/Internal-Page/internal-page-header/internal-page-header.component.html

@@ -27,7 +27,7 @@
                     </div>
                 </div>
                 <div class="col-2 col-sm-2 col-md-4 col-lg-4 d-none d-sm-none d-md-block d-lg-block">
-                    <p class="dateW"> {{currentDate}} </p>
+                    <p class="dateW"> {{currentDate}}</p>
                     <span class="ar" (click)="authSer.onLanguageContent('ar')" [ngClass]="{'activeLanguage':authSer. arabicLanguage}" *ngIf="authSer.showArabicIcon">Aa</span>
                     <span class="en" (click)="authSer.onLanguageContent('en')" [ngClass]="{'activeLanguage': authSer.englishLanguage}" *ngIf="authSer.showEnglishIcon">En</span>
                 </div>
@@ -69,7 +69,7 @@
                     <div ngbDropdown class="d-inline-block d-lg-none mobileMenu-w">
                         <button class="btn btn-outline-primary menuMobile-w" id="dropdownBasic1" ngbDropdownToggle style="color:#61a59b"><i class="fas fa-bars"></i></button>
                         <div ngbDropdownMenu aria-labelledby="dropdownBasic1" class="dropDownMobile-w">
-                            <button class="dropdown-item" (click)="goToHome()" style="font-weight:bold; color:#00A99D;font-size:14px;">الرئيسيه</button>
+                            <button class="dropdown-item" style="font-weight:bold; color:#00A99D;font-size:14px;"> <a href="/home">الرئيسيه</a></button>
                             <div *ngFor="let parent of parentsPage; let i = index" class="dropdown">
                                     <button class="dropbtn" *ngIf="parent['childs'].length > 0">
                                         <span class="parentName-w"> {{parent.name}}  <i class="fa fa-caret-down" *ngIf="parent['childs'].length > 0"></i></span>
@@ -155,7 +155,7 @@
                     </div>
                 </div>
                 <div class="col-2 col-sm-2 col-md-4 col-lg-4  d-none d-sm-none d-md-block d-lg-block">
-                    <p class="dateW"> {{currentDate}} </p>
+                    <p class="dateW"> {{currentEnglishDate | date:'fullDate'}} </p>
                     <span class="ar" (click)="authSer.onLanguageContent('ar')" [ngClass]="{'activeLanguage':authSer. arabicLanguage}" *ngIf="authSer.showArabicIcon">Aa</span>
                     <span class="en" (click)="authSer.onLanguageContent('en')" [ngClass]="{'activeLanguage': authSer.englishLanguage}" *ngIf="authSer.showEnglishIcon">En</span>
                 </div>

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

@@ -3,6 +3,8 @@ import { InternalPageService } from './../../shared/internal-page.service';
 import { UserService } from './../../shared/user.service';
 import { AuthServiceService } from './../../shared/auth-service.service';
 import { Component, OnInit } from '@angular/core';
+import 'hijri-date';
+import HijriDate,{toHijri} from 'hijri-date/lib/safe';
 
 @Component({
   selector: 'app-internal-page-header',
@@ -17,15 +19,15 @@ export class InternalPageHeaderComponent implements OnInit {
     private router: Router) { }
   
     parentsPage = [];
-    currentDate: number = Date.now();
+    
+    currentDate: any = Date.now();
 
 
+    currentEnglishDate: any = Date.now();
+     
   ngOnInit() {
 
-
-    this.authSer.arabicTemplate = true;
-    this.authSer.arabicLanguage = true;
-    this.authSer.englishLanguage = false;
+    this.authSer.setLocalLang();
     console.log('tooooken', this.authSer.isAuthenticated());
     this.internalService.getParentData().subscribe(
       (responce) => {
@@ -36,8 +38,6 @@ export class InternalPageHeaderComponent implements OnInit {
         console.log(error);
       }
     );
-
-
     
     //this.spinner.show();
     this.authSer.showDashboardHeader = false;
@@ -46,8 +46,7 @@ export class InternalPageHeaderComponent implements OnInit {
       //get profile data
     this.userservice.getUserDataProfile();
 
-    this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar');
-
+    this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
   }
 
   onLogin() {

+ 0 - 3
src/app/Internal-Page/internal-page/internal-page.component.ts

@@ -55,9 +55,6 @@ export class InternalPageComponent implements OnInit {
 
   ngOnInit() {
 
-    this.authSer.arabicTemplate = true;
-    this.authSer.arabicLanguage = true;
-    this.authSer.englishLanguage = false;
     this.spinner.show();
 
     //this.spinner.show();

+ 0 - 3
src/app/Internal-Page/news-page/news-page.component.ts

@@ -24,9 +24,6 @@ export class NewsPageComponent implements OnInit {
   ngOnInit() {
 
   this.spinner.show();
-  this.authSer.arabicTemplate = true;
-  this.authSer.arabicLanguage = true;
-  this.authSer.englishLanguage = false;
   
     this.route.params.subscribe(
       (params: Params) => {

+ 9 - 7
src/app/app.module.ts

@@ -21,9 +21,9 @@ import { ResponceInterceptService } from './shared/responce-intercept.service';
 import { TokenInterceptorService } from './shared/token-interceptor.service';
 import { BrowserModule } from '@angular/platform-browser';
 
-import { registerLocaleData } from '@angular/common';
-import localeFr from '@angular/common/locales/ar';
-import { NgModule} from '@angular/core';
+
+import { NgModule } from '@angular/core';
+
 
 
 import { QuillModule } from 'ngx-quill';
@@ -94,10 +94,9 @@ import { FlatpickrModule } from 'angularx-flatpickr';
 import { CalendarModule, DateAdapter } from 'angular-calendar';
 import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
 import { ShortenPipe } from './shorten.pipe';
-import 'zone.js/dist/zone';
-import 'zone.js/dist/long-stack-trace-zone';
-
-
+import { HigriDateComponent } from './higri-date/higri-date.component';
+import { ModalModule } from 'ngx-modialog';
+import { BootstrapModalModule } from 'ngx-modialog/plugins/bootstrap';
 
 @NgModule({
   declarations: [
@@ -150,6 +149,7 @@ import 'zone.js/dist/long-stack-trace-zone';
     AddMenuComponent,
     AddJoinUsComponent,
     ShortenPipe,
+    HigriDateComponent,
   ],
   imports: [
     BrowserModule,
@@ -166,6 +166,8 @@ import 'zone.js/dist/long-stack-trace-zone';
     AlifeFileToBase64Module,
     BrowserAnimationsModule,  // <-- include required BrowserAnimationsModule
     CollapsibleModule,
+    ModalModule.forRoot(),
+    BootstrapModalModule,
     ToastrModule.forRoot(), // ToastrModule added
     NgbModule.forRoot(),
     FlatpickrModule.forRoot(),

+ 29 - 11
src/app/dashboard/achievements/achievement-list/achievement.component.ts

@@ -1,3 +1,4 @@
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { AchievementsService } from './../../../shared/achievements.service';
 import { ActivatedRoute, Router, Params } from '@angular/router';
@@ -21,6 +22,7 @@ export class AchievementComponent implements OnInit {
     private authSer: AuthServiceService,
     private userSer: UserService,
     private toastr: ToastrService,
+    private modal: Modal,
     private achievementsServie: AchievementsService) { }
 
   pageId: number;
@@ -193,17 +195,33 @@ export class AchievementComponent implements OnInit {
 
     console.log(this.rolesId);
 
-    this.achievementsServie.deleteAchievement(this.rolesId).subscribe(
-      (responce) => {
-        console.log(responce);
-        this.toastr.success('تم الحذف');
-        window.location.reload();
-      },
-      (error) => {
-        console.log(error);
-        this.spinner.hide();
-      },
-    );
+    if(this.rolesId.length > 0) {
+      const dialogRef = this.modal.alert()
+      .size('sm')
+      .showClose(true)
+      .title('تأكيد الحذف')
+      .body(`
+          <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+          `)
+      .open();
+      dialogRef.result
+      .then( result =>     
+        this.achievementsServie.deleteAchievement(this.rolesId).subscribe(
+          (responce) => {
+            console.log(responce);
+            this.toastr.success('تم الحذف');
+            window.location.reload();
+          },
+          (error) => {
+            console.log(error);
+            this.spinner.hide();
+          },
+        )
+      );
+    } else {
+      this.toastr.warning('لم يتم إختيار أي عنصر للمسح !');
+    }
+
   };
 
   //add roles

+ 10 - 4
src/app/dashboard/add-join-us/add-join-us.component.html

@@ -38,11 +38,17 @@
             <div class="col-12 col-sm-12 col-md-4 col-lg-4">
               <div class="form-group">
                 <label for="date_employment_hij" style="float:right">تاريخ التوظيف الهجري <span class="spanReqired-w">*</span></label>
-                <input type="date" class="form-control" placeholder="تاريخ التوظيف الهجري" id="date_employment_hij" formControlName="date_of_employment_hij" />
+                <!-- <input type="date" class="form-control" placeholder="تاريخ التوظيف الهجري" id="date_employment_hij" formControlName="date_of_employment_hij" /> -->
+                <div *ngIf='bindingDateSplit && checkMode'>
+                  <app-higri-date (onDatePicked)="getDate($event)" [myDate]="bindingDateSplit"></app-higri-date>
+                </div>
+                <div *ngIf='!checkMode'>
+                  <app-higri-date (onDatePicked)="getDate($event)" ></app-higri-date>
+                </div>
               </div>
             </div>
-
-
+              
+              
             <div class="col-12 col-sm-12 col-md-4 col-lg-4">
               <div class="form-group">
                 <label style="float:right">الاداره <span class="spanReqired-w">*</span></label>
@@ -53,7 +59,7 @@
             </div>
 
           </div>
-          <button type="submit" [disabled]="!joinUsForm.valid" class="btn btn-success regesterBtn-w">حفظ</button>
+          <button type="submit" [disabled]="!joinUsForm.valid || checkSaveClick" class="btn btn-success regesterBtn-w">حفظ</button>
         </form>
       </div>
 

+ 33 - 7
src/app/dashboard/add-join-us/add-join-us.component.ts

@@ -2,13 +2,14 @@ import { AuthServiceService } from './../../shared/auth-service.service';
 import { HttpClient } from '@angular/common/http';
 import { UserService } from './../../shared/user.service';
 import { ActivatedRoute, Params, Router } from '@angular/router';
-import { Component, OnInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild, Input } from '@angular/core';
 import { ToastrService } from 'ngx-toastr';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { FormGroup, FormControl, Validators } from '@angular/forms';
 import { Location } from '@angular/common';
 
 
+
 @Component({
   selector: 'app-add-join-us',
   templateUrl: './add-join-us.component.html',
@@ -31,10 +32,15 @@ export class AddJoinUsComponent implements OnInit {
     checkChangeImage: boolean = false;
     checkValidImg: boolean = false;
     photoEdit: boolean = true;
+    checkSaveClick: boolean = false;
     imageBase64: string = '';
     photoType: string = '';
     joinId: number;
+    higriDateVal: string;
+    bindingDateSplit;
+
 
+   
 
 
   ngOnInit() {
@@ -62,7 +68,7 @@ export class AddJoinUsComponent implements OnInit {
     this.joinUsForm = new FormGroup({
       name: new FormControl(null, Validators.required),
       name_en: new FormControl(null, Validators.required),
-      date_of_employment_hij: new FormControl(null, Validators.required),
+      //date_of_employment_hij: new FormControl(null, Validators.required),
       adminstration_id: new FormControl(null, Validators.required),
     });
 
@@ -92,11 +98,20 @@ export class AddJoinUsComponent implements OnInit {
             this.joinUsForm.patchValue({
               name: responce['user'].name,
               name_en: responce['user'].name_en,
-              date_of_employment_hij: responce['user'].date_of_employment_hij,
+              //date_of_employment_hij: responce['user'].date_of_employment_hij,
               adminstration_id: responce['user'].adminstration_id,
             });
             this.urlImg = responce['user'].photo ? this.authSer.pathImg + responce['user'].photo : this.urlImg;
-              console.log(this.urlImg);
+            const date = responce['user'].date_of_employment_hij.split('-');
+            
+            this.bindingDateSplit = {
+              'year': parseInt(date[0]),
+              'month': parseInt(date[1]),
+              'day': parseInt(date[2])
+            };
+            this.higriDateVal = responce['user'].date_of_employment_hij;
+            console.log(this.bindingDateSplit);
+              
               this.spineer.hide();
           }
          );
@@ -129,12 +144,21 @@ export class AddJoinUsComponent implements OnInit {
   }
  }
 
+  //get value date from child component 
+  public getDate(date: any):void {
+    console.log( date);
+    this.higriDateVal = date.year + '-' + date.month + '-' + date.day;
+    console.log('higrii date', this.higriDateVal);
+  }
+
 
 
   onSubmittedForm() {
+    this.checkSaveClick = true;
     console.log(this.joinUsForm.value);
     const formData = this.joinUsForm.value;
-
+    formData['date_of_employment_hij'] = this.higriDateVal;
+    console.log(formData);
     if(this.checkChangeImage){
       formData['photo'] = this.imageBase64;
       formData['photo_type'] = this.photoType[1];
@@ -147,7 +171,6 @@ export class AddJoinUsComponent implements OnInit {
 
     
     if(this.checkMode) {
-      alert(this.checkMode);
       formData['id'] = this.joinId;
       console.log(formData);
       if(this.imageBase64 == '' && this.photoEdit == true) {
@@ -155,11 +178,13 @@ export class AddJoinUsComponent implements OnInit {
       } else {
         this.userSer.onEditUser(formData, 'joinUs').subscribe(
           (responce) => {
+            this.checkSaveClick = true;
             console.log(responce);
             this.toastr.success('تم التعديل بنجاح');
             this.location.back();
           },
           (error) => {
+            this.checkSaveClick = false;
             console.log(error);
             this.toastr.error('خطأ في التعديل');
           }
@@ -172,11 +197,13 @@ export class AddJoinUsComponent implements OnInit {
       } else {
         this.userSer.addUser(formData, 'joinUs').subscribe(
           (responce) => {
+            this.checkSaveClick = true;
             console.log(responce);
             this.toastr.success('تم الاضافه بنجاح');
             this.location.back();
           },
           (error) => {
+            this.checkSaveClick = false;
             console.log(error);
             this.toastr.error('خطأ في الإنشاء');
           }
@@ -185,5 +212,4 @@ export class AddJoinUsComponent implements OnInit {
     }
 
   }
-
 }

+ 84 - 64
src/app/dashboard/events/add-event/add-event.component.html

@@ -5,92 +5,112 @@
       <div class="col-12">
         <ul class="list-unstyled titileLi-w">
           <li class="headingText-w">خدمه إداره المحتوي > </li>
-          <li class="headingText-w" style="cursor:pointer" (click)="authSer.perviousLocation()">مشاركه اللحظات > </li>
+          <li class="headingText-w" style="cursor:pointer" (click)="authSer.perviousLocation()"> إداره التهاني والتعازي > </li>
           <li class="headingText-w activeLi-w" style="margin-right:5px"> {{typeLink}} </li>
         </ul>
       </div>
     </div>
+
     <div class="containerContent-w">
-    <div class="row">
-      <div class="col-12">
-        <form (ngSubmit)="onSubmitted()" #f="ngForm">
-          <div class="row">
-            <div class="col-12 col-sm-12 col-md-4 col-lg-4">
-              <div class="form-group">
-                <label for="name" style="float: right; margin-right: 5px"> الأسم باللغه العربيه <span class="spanReqired-w">*</span></label>
-                <input type="text" class="form-control" id="name" name="name" ngModel [ngModel]="event.name" #name="ngModel" required/>
+      <div class="row">
+        <div class="col-12">
+          <form (ngSubmit)="onSubmitted()" #f="ngForm">
+            <div class="row">
+                
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <div class="form-group">
+                  <label for="employeName" style="float: right; margin-right: 5px"> إسم الموظف باللغه العربيه <span class="spanReqired-w">*</span></label>
+                  <input type="text" class="form-control" id="employeName" name="employee_name" ngModel [ngModel]="event.employee_name" #name="ngModel" required/>
+                </div>
               </div>
-            </div>
-            <div class="col-12 col-sm-12 col-md-4 col-lg-4">
-              <div class="form-group">
-                <label for="name_en" style="float: right; margin-right: 5px">الأسم باللغه الإنجليزيه <span class="spanReqired-w">*</span></label>
-                <input type="text" class="form-control" id="name_en" name="name_en" ngModel [ngModel]="event.name_en" #name="ngModel" required/>
+
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <div class="form-group">
+                  <label for="employeNname_en" style="float: right; margin-right: 5px"> إسم الموظف باللغه الإنجليزيه <span class="spanReqired-w">*</span></label>
+                  <input type="text" class="form-control" id="employeNname_en" name="employee_name_en" ngModel [ngModel]="event.employee_name_en" #name="ngModel" required/>
+                </div>
               </div>
-            </div>
-            <div class="col-12 col-sm-12 col-md-4 col-lg-4">
-              <div class="form-group">
-                <label for="ranking" style="float: right; margin-right: 5px">الترتيب <span class="spanReqired-w">*</span></label>
-                <select class="form-control" name="ranking" [ngModel]="event.ranking" id="ranking" required>
-                  <option value="1">1</option>
-                  <option value="2">2</option>
-                  <option value="3">3</option>
-                  <option value="4">4</option>
-                  <option value="5">5</option>
-                  <option value="6">6</option>
-                  <option value="10000">المزيد</option>
-                </select>
-                <!-- <span *ngIf="!name.valid && name.touched"></span>  -->
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <div class="form-group">
+                  <label for="name" style="float: right; margin-right: 5px"> الأسم باللغه العربيه <span class="spanReqired-w">*</span></label>
+                  <input type="text" class="form-control" id="name" name="name" ngModel [ngModel]="event.name" #name="ngModel" required/>
+                </div>
+              </div>
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <div class="form-group">
+                  <label for="name_en" style="float: right; margin-right: 5px">الأسم باللغه الإنجليزيه <span class="spanReqired-w">*</span></label>
+                  <input type="text" class="form-control" id="name_en" name="name_en" ngModel [ngModel]="event.name_en" #name="ngModel" required/>
+                </div>
+              </div>
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <div class="form-group">
+                  <label for="ranking" style="float: right; margin-right: 5px">الترتيب <span class="spanReqired-w">*</span></label>
+                  <select class="form-control" name="ranking" [ngModel]="event.ranking" id="ranking" required>
+                    <option value="1">1</option>
+                    <option value="2">2</option>
+                    <option value="3">3</option>
+                    <option value="4">4</option>
+                    <option value="5">5</option>
+                    <option value="6">6</option>
+                    <option value="10000">المزيد</option>
+                  </select>
+                  <!-- <span *ngIf="!name.valid && name.touched"></span>  -->
+                </div>
               </div>
-            </div>
 
-            <div class="col-12 col-sm-12 col-md-4 col-lg-4">
-              <div class="form-group">
-                <label for="display_location" style="float: right; margin-right: 5px"> الصفحه <span class="spanReqired-w">*</span></label>
-                <select class="form-control" name="display_location" [ngModel]="event.display_location" id="display_location" required>
-                  <option value="internal">داخليه</option>
-                  <option value="external">خارجيه</option>
-                  <option value="both">كلاهما</option>
-                </select>
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <div class="form-group">
+                  <label for="display_location" style="float: right; margin-right: 5px"> الصفحه <span class="spanReqired-w">*</span></label>
+                  <select class="form-control" name="display_location" [ngModel]="event.display_location" id="display_location" required>
+                    <option value="internal">داخليه</option>
+                    <option value="external">خارجيه</option>
+                    <option value="both">كلاهما</option>
+                  </select>
+                </div>
+              </div>
+
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <div class="form-group">
+                  <label for="type" style="float: right;margin-right: 5px"> النوع <span class="spanReqired-w">*</span></label>
+                  <select class="form-control" name="type" [ngModel]="event.type" id="type" required>
+                    <option value="1">تهاني</option>
+                    <option value="0">تعازي</option>
+                  </select>
+                </div>
               </div>
-            </div>
 
-            <div class="col-12 col-sm-12 col-md-4 col-lg-4">
-              <div class="form-group">
-                <label for="type" style="float: right;margin-right: 5px"> النوع <span class="spanReqired-w">*</span></label>
-                <select class="form-control" name="type" [ngModel]="event.type" id="type" required>
-                  <option value="1">تهاني</option>
-                  <option value="0">تعازي</option>
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <label for="status" style="float: right; margin-right: 5px">الحاله <span class="spanReqired-w">*</span></label>
+                <select class="form-control" name="status" [ngModel]="event.status" id="status" required>
+                  <option value="1">فعال</option>
+                  <option value="0">غير فعال</option>
                 </select>
               </div>
-            </div>
 
-            <div class="col-12 col-sm-12 col-md-4 col-lg-4">
-              <label for="status" style="float: right; margin-right: 5px">الحاله <span class="spanReqired-w">*</span></label>
-              <select class="form-control" name="status" [ngModel]="event.status" id="status" required>
-                <option value="1">فعال</option>
-                <option value="0">غير فعال</option>
-              </select>
-            </div>
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <label for="date" style="float: right; margin-right: 5px">التاريخ</label>
+                <div *ngIf='bindingDateSplit && checkMode'>
+                  <app-higri-date (onDatePicked)="getDate($event)" [myDate]="bindingDateSplit"></app-higri-date>
+                </div>
+                <div *ngIf='!checkMode'>
+                  <app-higri-date (onDatePicked)="getDate($event)" ></app-higri-date>
+                </div>
+              </div>
 
-            <div class="col-12 col-sm-12 col-md-4 col-lg-4">
-              <label for="date" style="float: right; margin-right: 5px">التاريخ</label>
-              <input type="date" class="form-control" [ngModel]="event.date" id="date" name="date" />
-            </div>
+              <div class="col-12 col-sm-12 col-md-4 col-lg-4">
+                <label for="time" style="float: right; margin-right: 5px">الوقت</label>
+                <input type="time" class="form-control" [ngModel]="event.time" id="time" name="time" />
+              </div>
 
-            <div class="col-12 col-sm-12 col-md-4 col-lg-4">
-              <label for="time" style="float: right; margin-right: 5px">الوقت</label>
-              <input type="time" class="form-control" [ngModel]="event.time" id="time" name="time" />
             </div>
 
-          </div>
+            <button type="submit" class="btn btn-success rightW" [disabled]="!f.valid || checkSaveClick">حفظ</button>
 
-          <button type="submit" class="btn btn-success rightW" [disabled]="!f.valid">حفظ</button>
-
-        </form>
+          </form>
 
+        </div>
       </div>
     </div>
-  </div>
 
   </div>
 </div>

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

@@ -21,18 +21,21 @@ export class AddEventComponent implements OnInit {
   typeMode: boolean = false;
   typeLink: string = '';
   eventId: number;
+  bindingDateSplit;
+  higriDateVal:string;
+  checkSaveClick:boolean = false;
 
   event = {
+    employee_name: '',
+    employee_name_en: '',
     name: '',
     name_en: '',
     ranking: '',
     display_location: '',
     type: '',
     status: '',
-    date: '',
     time: '',
   }
-  
 
   constructor(private eventService: EventService,
     private userService: UserService,
@@ -52,6 +55,8 @@ export class AddEventComponent implements OnInit {
     this.authSer.showDashboardHeader = true;
     this.authSer.internalHeader = false;
     
+    this.event.status = '1';
+
     this.route.params.subscribe(
       (params: Params) => {
         if(params['typeEventMode'] == 'edit') {
@@ -70,6 +75,9 @@ export class AddEventComponent implements OnInit {
               this.event.display_location = eventData.display_location;
               this.event.type = eventData.type;
               this.event.status = eventData.status;
+              const dateTime = eventData.event_time.split(' ');
+              this.event.time = dateTime[1];
+              this.bindingDateSplit = dateTime[0];
               this.spineer.hide();
             },
             (error) => {
@@ -83,10 +91,19 @@ export class AddEventComponent implements OnInit {
     );
   }
 
+    //get value date from child component 
+    public getDate(date: any):void {
+      console.log( date);
+      this.higriDateVal = date.year + '-' + date.month + '-' + date.day;
+      console.log('higrii date', this.higriDateVal);
+    }
+  
+
   //submitted form
   onSubmitted() {
-
+    this.checkSaveClick = true;
     console.log(this.eventForm.value);
+    this.eventForm.value['date'] = this.higriDateVal;
     this.eventForm.value.event_time = this.eventForm.value.date + this.eventForm.value.time;
     delete this.eventForm.value.time;
 
@@ -97,10 +114,12 @@ export class AddEventComponent implements OnInit {
           console.log(responce);
           this.toastr.success('تمت التعديل بنجاح');
           this.location.back();
+          this.checkSaveClick = false;
         },
         (error) => {
           this.toastr.error('حدث خطأ !');
           console.log(error);
+          this.checkSaveClick = false;
         }
       );
     } else {
@@ -109,10 +128,12 @@ export class AddEventComponent implements OnInit {
           console.log(responce);
           this.toastr.success('تمت الاضافه بنجاح');
           this.location.back();
+          this.checkSaveClick = false;
         },
         (error) => {
           this.toastr.error('حدث خطأ !');
           console.log(error);
+          this.checkSaveClick = false;
         }
       );
     }

+ 1 - 0
src/app/dashboard/events/events.component.html

@@ -22,6 +22,7 @@
       </div>
     </div>
   </div>
+  
   <div class="containerContent-w">
     <div class="row">
         <div class="col-12 col-sm-12 col-md-12 col-lg-6">

+ 30 - 11
src/app/dashboard/events/events.component.ts

@@ -6,6 +6,7 @@ import { ActivatedRoute, Router, Params } from '@angular/router';
 import { Component, OnInit } from '@angular/core';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { ToastrService } from 'ngx-toastr';
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
 
 @Component({
   selector: 'app-events',
@@ -20,6 +21,7 @@ export class EventsComponent implements OnInit {
     private authSer: AuthServiceService,
     private toastr: ToastrService,
     private http: HttpClient,
+    private modal: Modal,
     private eventService: EventService,
     private router: Router) { }
 
@@ -204,17 +206,34 @@ onGetValue(event) {
 
     console.log(this.eventsListIds);
 
-  this.eventService.deleteEvent(this.eventsListIds).subscribe(
-    (responce) => {
-      console.log(responce);
-      this.toastr.success('تم الحذف');
-      window.location.reload();
-    },
-    (error) => {
-      console.log(error);
-      this.spinner.hide();
-    },
-  );
+    if(this.eventsListIds.length > 0) {
+
+      const dialogRef = this.modal.alert()
+      .size('sm')
+      .showClose(true)
+      .title('تأكيد الحذف')
+      .body(`
+          <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+          `)
+      .open();
+  
+        dialogRef.result
+        .then( result => 
+          this.eventService.deleteEvent(this.eventsListIds).subscribe(
+            (responce) => {
+              console.log(responce);
+              this.toastr.success('تم الحذف');
+              window.location.reload();
+            },
+            (error) => {
+              console.log(error);
+              this.spinner.hide();
+            },
+          )
+        );
+    } else {
+      this.toastr.warning('لم يتم إختيار أي عنصر للمسح !');
+    }
   };
 
   //add function

+ 2 - 2
src/app/dashboard/external-services/add-external/add-external.component.css

@@ -32,10 +32,10 @@
     display: inline-block;
     border-radius: 0 0 20px 20px;
     position: absolute;
-    right: 37px;
     border: 1px solid #ccc;
     border-radius: 50%;
-    top: 10px;
+    bottom: -8px;
+    left: 43%;
 }
 
 .inputfile {

+ 2 - 2
src/app/dashboard/external-services/add-external/add-external.component.html

@@ -48,13 +48,13 @@
                     <div class="form-group">
                       <label for="ranking" style="float: right; margin-right: 5px">الترتيب  <span class="spanReqired-w">*</span></label>
                       <select class="form-control" name="ranking" [ngModel]="external.ranking" id="ranking" required>
-                        <option value="10000">المزيد</option>
                         <option value="1">1</option>
                         <option value="2">2</option>
                         <option value="3">3</option>
                         <option value="4">4</option>
                         <option value="5">5</option>
                         <option value="6">6</option>
+                        <option value="10000">المزيد</option>
                       </select>
                     </div>
                   </div>
@@ -68,7 +68,7 @@
                   </div>
                 </div>
 
-                <button type="submit" class="btn btn-success rightW" [disabled]="!f.valid">حفظ</button>
+                <button type="submit" class="btn btn-success rightW" [disabled]="!f.valid || checkSaveClick">حفظ</button>
 
               </form>
 

+ 5 - 3
src/app/dashboard/external-services/add-external/add-external.component.ts

@@ -23,6 +23,7 @@ export class AddExternalComponent implements OnInit {
   checkValidImg: boolean = true;
   typeMode: boolean = false;
   photoEdit: boolean = true;
+  checkSaveClick:boolean = false;
   typeLink: string = '';
   externalId: number;
 
@@ -51,7 +52,7 @@ export class AddExternalComponent implements OnInit {
     this.authSer.showHeaderDashBoard = true;
     this.authSer.showDashboardHeader = true;
     this.authSer.internalHeader = false;
-    
+    this.external.status = "1";
     this.route.params.subscribe(
       (params: Params) => {
         if(params['typeExternalMode'] == 'edit') {
@@ -107,6 +108,7 @@ export class AddExternalComponent implements OnInit {
 
  //on submitted
  onSubmitted() {
+   this.checkSaveClick = true;
   const formData = this.externalFormData.value;
   if(this.checkChangeImage){
     formData['photo'] = this.imageBase64;
@@ -118,7 +120,7 @@ export class AddExternalComponent implements OnInit {
     console.log(formData);
   }
   if(this.typeMode){
-    if(this.photoType[1] != 'png' && this.photoEdit == true) {
+    if((this.photoType[1] != 'png' && this.photoType[1] != 'gif') && this.photoEdit == true) {
       this.toastr.warning('الصوره يجب أن تكون بصيغه Png');
     } else if(this.imageBase64 == '' && this.photoEdit == true){
       this.toastr.warning('قم باختيار صوره !');
@@ -136,7 +138,7 @@ export class AddExternalComponent implements OnInit {
       );
     }
   } else {
-    if(this.photoType[1] != 'png') {
+    if(this.photoType[1] != 'png' && this.photoType[1] != 'gif') {
       this.toastr.warning('الصوره يجب أن تكون بصيغه Png');
     } else if(this.imageBase64 == ''){
       this.toastr.warning('قم باختيار صوره !');

+ 29 - 11
src/app/dashboard/external-services/external-list/external-list.component.ts

@@ -1,3 +1,4 @@
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
 import { HttpClient } from '@angular/common/http';
 import { ExternalSerService } from './../../../shared/external-ser.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
@@ -35,6 +36,7 @@ export class ExternalListComponent implements OnInit {
     private toastr: ToastrService,
     private externalService: ExternalSerService,
     private spinner: NgxSpinnerService,
+    private modal: Modal,
     private authSer: AuthServiceService) { }
 
   ngOnInit() {
@@ -225,18 +227,34 @@ export class ExternalListComponent implements OnInit {
     }
 
     console.log(this.externalsListIds);
+    if(this.externalsListIds.length > 0) {
+      const dialogRef = this.modal.alert()
+      .size('sm')
+      .showClose(true)
+      .title('تأكيد الحذف')
+      .body(`
+          <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+          `)
+      .open();
+        dialogRef.result
+        .then( result => 
+          this.externalService.deleteEvent(this.externalsListIds).subscribe(
+            (responce) => {
+              console.log(responce);
+              this.toastr.success('تم الحذف');
+              window.location.reload();
+            },
+            (error) => {
+              console.log(error);
+              this.spinner.hide();
+            },
+          )
+        );
+    } else {
+      this.toastr.warning('لم يتم إختيار أي عنصر للمسح !');
+    }
 
-    this.externalService.deleteEvent(this.externalsListIds).subscribe(
-      (responce) => {
-        console.log(responce);
-        this.toastr.success('تم الحذف');
-        window.location.reload();
-      },
-      (error) => {
-        console.log(error);
-        this.spinner.hide();
-      },
-    );
+  
   };
 
   //add function

+ 29 - 12
src/app/dashboard/footer/footer-list/footer-list.component.ts

@@ -1,3 +1,4 @@
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { FooterService } from './../../../shared/footer.service';
@@ -33,6 +34,7 @@ export class FooterListComponent implements OnInit {
     private router: Router, 
     private userSer: UserService,
     private http: HttpClient,
+    private modal: Modal,
     private toastr: ToastrService,
     private footerService: FooterService,
     private spinner: NgxSpinnerService,
@@ -202,18 +204,33 @@ export class FooterListComponent implements OnInit {
     }
 
     console.log(this.footerListIds);
-
-    this.footerService.deleteFooter(this.footerListIds).subscribe(
-      (responce) => {
-        console.log(responce);
-        this.toastr.success('تم الحذف');
-        window.location.reload();
-      },
-      (error) => {
-        console.log(error);
-        this.spinner.hide();
-      },
-    );
+    if(this.footerListIds.length > 0) {
+      const dialogRef = this.modal.alert()
+      .size('sm')
+      .showClose(true)
+      .title('تأكيد الحذف')
+      .body(`
+          <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+          `)
+      .open();
+  
+        dialogRef.result
+        .then( result => 
+          this.footerService.deleteFooter(this.footerListIds).subscribe(
+            (responce) => {
+              console.log(responce);
+              this.toastr.success('تم الحذف');
+              window.location.reload();
+            },
+            (error) => {
+              console.log(error);
+              this.spinner.hide();
+            },
+          )
+        );
+    } else {
+      this.toastr.warning('لم يتم إختيار أي عنصر للمسح ');
+    }
   };
 
   //add function

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

@@ -20,7 +20,7 @@ export class HeaderComponent implements OnInit {
     private userSer: UserService,
     private router: Router) { }
     
-    currentDate: number = Date.now();
+    currentDate: any = Date.now();
 
 
   ngOnInit() {
@@ -31,7 +31,7 @@ export class HeaderComponent implements OnInit {
     
     // const m = moment().format('iYYYY/iM/iD');
     // console.log(m);
-    this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar');
+    this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
 
    
     this.userSer.getUserDataProfile();

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

@@ -76,11 +76,11 @@
       
                     </div>
           
-                    <button type="button" class="btn btn-danger rightW" (click)="removeTitle(i)">حذف</button>
+                    <button type="button" class="btn btn-danger rightW" (click)="removeTitle(i)" *ngIf="i == 0 ? false : true">حذف</button>
                   </div>
                 </div>
       
-                  <button type="submit" class="btn btn-success rightW" [disabled]="!addHospitalForm.valid">حفظ</button>
+                  <button type="submit" class="btn btn-success rightW" [disabled]="!addHospitalForm.valid || checkSaveClick">حفظ</button>
       
               </form>
             </div>

+ 44 - 19
src/app/dashboard/hospitals/add-hospital/add-hospital.component.ts

@@ -28,6 +28,7 @@ export class AddHospitalComponent implements OnInit, OnDestroy {
   addHospitalForm: FormGroup;
   fields: FormArray;
   typeMode: boolean = false;
+  checkSaveClick:boolean = false;
   typePageEdit: string = '';
   typeCreatePage: string = '';
   typeLink = 'إنشاء جديد';
@@ -172,35 +173,45 @@ export class AddHospitalComponent implements OnInit, OnDestroy {
   //submitted form
   onSubmitted() {
 
+    this.checkSaveClick = true;
     console.log(this.addHospitalForm.value);
     const formHospitalData = this.addHospitalForm.value;
+    console.log(formHospitalData.fields[0].title);
 
   if(this.typeCreatePage == 'Hospital') {
-    if(formHospitalData['fields'][0].title == '' || formHospitalData['fields'][0].description == '') {
+    if(formHospitalData.fields[0].title == '' || formHospitalData.fields[0].description == '') {
         this.toastr.warning('أدخل عنوان ووصف واحد علي الاقل !');
+        this.checkSaveClick = false;
       } else {
         this.hospitalService.addHospital(formHospitalData, 'hospital').subscribe(
           (responce) => {
+            this.checkSaveClick = false;
             console.log(responce);
             this.toastr.success('تم الاضافه بنجاح');
             this.location.back();
           },
           (error) => {
+            this.checkSaveClick = false;
+            this.toastr.error('خطأ في الإنشاء');
             console.log(error);
           }
         );
       }
     } else if(this.typeCreatePage == 'Management') {
-      if(formHospitalData['fields'][0].title == '' || formHospitalData['fields'][0].description == '') {
+      if(formHospitalData.fields[0].title == '' || formHospitalData.fields[0].description == '') {
           this.toastr.warning('أدخل عنوان ووصف واحد علي الاقل !');
+          this.checkSaveClick = false;
         } else {
           this.hospitalService.addHospital(formHospitalData, 'management').subscribe(
             (responce) => {
+              this.checkSaveClick = false;
               console.log(responce);
               this.toastr.success('تم الاضافه بنجاح');
               this.location.back();
             },
             (error) => {
+              this.checkSaveClick = false;
+              this.toastr.error('خطأ في الاضافه');
               console.log(error);
             }
           );
@@ -210,25 +221,39 @@ export class AddHospitalComponent implements OnInit, OnDestroy {
     if(this.typeMode) {
 
       if(this.typePageEdit == 'edithos'){
-        this.hospitalService.editHospital(this.typeId, formHospitalData, 'hospital').subscribe(
-          (responce) => {
-            console.log(responce);
-            this.toastr.success('تم التعديل بنجاح ');
-          }, (error) => {
-            console.log(error);
-            this.toastr.error('فشل التعديل !');
-          }
-        );
+        if(formHospitalData.fields[0].title == '' || formHospitalData.fields[0].description == '') {
+          this.toastr.warning('أدخل عنوان ووصف واحد علي الاقل !');
+          this.checkSaveClick = false;
+        } else {
+          this.hospitalService.editHospital(this.typeId, formHospitalData, 'hospital').subscribe(
+            (responce) => {
+              this.checkSaveClick = false;
+              console.log(responce);
+              this.toastr.success('تم التعديل بنجاح ');
+            }, (error) => {
+              this.checkSaveClick = false;
+              console.log(error);
+              this.toastr.error('فشل التعديل !');
+            }
+          );
+        }
       } else if(this.typePageEdit == 'editman'){
+        if(formHospitalData.fields[0].title == '' || formHospitalData.fields[0].description == '') {
+          this.toastr.warning('أدخل عنوان ووصف واحد علي الاقل !');
+          this.checkSaveClick = false;
+        } else {
           this.hospitalService.editHospital(this.typeId, formHospitalData, 'management').subscribe(
-              (responce) => {
-                console.log(responce);
-                this.toastr.success('تم التعديل بنجاح ');
-              }, (error) => {
-                console.log(error);
-                this.toastr.error('فشل التعديل !');
-              }
-            )
+            (responce) => {
+              this.checkSaveClick = false;
+              console.log(responce);
+              this.toastr.success('تم التعديل بنجاح ');
+            }, (error) => {
+              this.checkSaveClick = false;
+              console.log(error);
+              this.toastr.error('فشل التعديل !');
+            }
+          )
+        }
       }
     }
 

+ 29 - 11
src/app/dashboard/hospitals/hospital-list/hospital-list.component.ts

@@ -1,3 +1,4 @@
+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';
@@ -19,6 +20,7 @@ export class HospitalListComponent implements OnInit {
     private userSer: UserService,
     private spinner: NgxSpinnerService,
     private toastr: ToastrService,
+    private modal: Modal,
     private hospitalService: HospitalService) { }
 
   dataList = [];
@@ -172,17 +174,33 @@ export class HospitalListComponent implements OnInit {
 
       console.log(this.dataListIds);
 
-    this.hospitalService.deleteDatas(this.dataListIds, this.pageId).subscribe(
-      (responce) => {
-        console.log(responce);
-        this.toastr.success('تم الحذف');
-        window.location.reload();
-      },
-      (error) => {
-        console.log(error);
-        this.spinner.hide();
-      },
-    );
+      if(this.dataListIds.length > 0) {
+      const dialogRef = this.modal.alert()
+      .size('sm')
+      .showClose(true)
+      .title('تأكيد الحذف')
+      .body(`
+          <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+          `)
+      .open();
+        dialogRef.result
+            .then( result => 
+              this.hospitalService.deleteDatas(this.dataListIds, this.pageId).subscribe(
+                (responce) => {
+                  console.log(responce);
+                  this.toastr.success('تم الحذف');
+                  window.location.reload();
+                },
+                (error) => {
+                  console.log(error);
+                  this.spinner.hide();
+                },
+              )
+            );
+
+      } else {
+        this.toastr.warning('لم يتم إختيار أي عنصر للمسح !');
+      }
   };
 
   //filtter function

+ 20 - 7
src/app/dashboard/internal-services/add-internal-services/add-internal-services.component.css

@@ -4,12 +4,10 @@
 }
 
 .imgProfile {
-    width: 70px;
-    height: 70px;
+    width: 150px;
+    height: 130px;
     border-radius: 20px 20px 0 0;
-    border-radius: 50%;
-    border: 1px solid #ccc;
-
+    border-radius: 10px;
 }
 
 .imgContainer {
@@ -23,13 +21,28 @@
     width: 30px;
     font-size: 1.25em;
     font-weight: 700;
-    color: #252525;
     display: inline-block;
     border-radius: 0 0 20px 20px;
     position: absolute;
+    background-color: #fff;
+    border: 1px solid #ccc;
+    border-radius: 50%;
+    top: 1px;
+    left: 34%;
+}
+
+.deleteImg {
+    width: 30px;
+    font-size: 1.25em;
+    font-weight: 700;
+    display: inline-block;
+    border-radius: 0 0 20px 20px;
+    position: absolute;
+    background-color: #fff;
     border: 1px solid #ccc;
     border-radius: 50%;
-    bottom: 0;
+    top: 1px;
+    right: 34%;
 }
 
 .inputfile {

+ 4 - 5
src/app/dashboard/internal-services/add-internal-services/add-internal-services.component.html

@@ -43,7 +43,7 @@
 
             <div class="col-12 col-sm-12 col-md-4">
               <div class="form-group">
-                <button class="btn btn-secondary form-control" style="margin-top:30px" type="button" (click)="onAddTitle(i)">أضف المزيد من الوصف</button>
+                <button class="btn btn-secondary form-control" style="margin-top:30px" type="button" (click)="onAddTitle()">أضف المزيد من الوصف</button>
               </div>
             </div>
           </div>
@@ -57,8 +57,7 @@
                     <div class="form-group text-center imgContainer">
                       <img [src]="urlImg[i]" class="imgProfile" height="200">
                       <input type="file" name="file{{i}}" id="file{{i}}" class="inputfile" alife-file-to-base64 (onFileChanged)="onFileChanges($event,i)" (change)="getUrl($event,i)" formControlName="photo"/>
-                      <label for="file{{i}}" class="iconUpload-w"  *ngIf="showOpenFile[i]"><i class="fas fa-upload"></i></label>
-                      <label class="iconUpload-w" *ngIf="showCloseFile[i]" (click)="closePhoto(i)"><i class="fas fa-times"></i></label>
+                      <label for="file{{i}}" class="iconUpload-w"><i class="fas fa-upload"></i></label>
                     </div>
                   </div>
                   <label for="name" style="float: right;">الأسم باللغه العربيه</label>
@@ -78,13 +77,13 @@
                     <option value="1">فعال</option>
                     <option value="0">غير فعال</option>
                   </select>
-                  <button type="button" class="btn btn-danger rightW" (click)="removeTitle(i)">حذف</button>
+                  <button type="button" class="btn btn-danger rightW" *ngIf="i == 0 ? false : true" style="position: absolute; top:0" (click)="removeTitle(i)"><i class="fas fa-trash-alt"></i></button>
                 </div>
               </div>
             </div>
           </div>
 
-          <button type="submit" class="btn btn-success rightW" [disabled]="!addInternalForm.valid">حفظ</button>
+          <button type="submit" class="btn btn-success rightW" [disabled]="!addInternalForm.valid || checkSaveClick">حفظ</button>
 
         </form>
       </div>

+ 193 - 72
src/app/dashboard/internal-services/add-internal-services/add-internal-services.component.ts

@@ -1,3 +1,4 @@
+import { HttpClient } from '@angular/common/http';
 import { InternalSerService } from './../../../shared/internal-ser.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { ActivatedRoute, Params } from '@angular/router';
@@ -24,25 +25,31 @@ export class AddInternalServicesComponent implements OnInit {
     private spinner: NgxSpinnerService,
     private toastr: ToastrService, 
     private authSer: AuthServiceService,
+    private http: HttpClient,
     private location: Location) { }
 
   addInternalForm: FormGroup;
   fields: FormArray;
-  typeMode: boolean = false;
+  typeMode: boolean = false; //to check edit or create
   typePageEdit: string = '';
   typeCreatePage: string = '';
   typeLink = 'إنشاء جديد';
   pageId: number;
   editSubscription: Subscription;
   typeCreateSubscription: Subscription;
+  editObjectPhoto = [];
   fieldsData = [];
-  imageBase64 = [];
+  imageBase64 = [{
+    photo: '',
+    photo_type: '',
+  }];
+  checkSaveClick:boolean = false;
+  checkAdd:boolean = false;
   photoType: string = '';
-  checkChangeImage = [false];
-  showOpenFile = [true];
-  showCloseFile = [false];
+  checkChangeImage = [false]; //check change for any image if change in edit mode or no
+  checkValidateField: boolean = false; //loop in imageBase64 array and check if one of them not have image or no
+
   urlImg =  ['../../assets/image/avatar.png'];
-  i = 0;
   
   ngOnInit() {
     //show / hide notification search in header
@@ -58,11 +65,12 @@ export class AddInternalServicesComponent implements OnInit {
     this.authSer.showDashboardHeader = true;
     this.authSer.internalHeader = false;
     
+    
     //init form data 
     this.addInternalForm = new FormGroup({
       name: new FormControl(null , Validators.required),
       name_en: new FormControl(null , Validators.required),
-      status: new FormControl(null, Validators.required),
+      status: new FormControl('1', Validators.required),
       fields: this.formBuilder.array([ this.createItem() ])
     });
 
@@ -71,7 +79,6 @@ export class AddInternalServicesComponent implements OnInit {
     this.editSubscription =  this.route.params.subscribe(
         (params: Params) => {
           if(params['typeInternalMode'] == 'edit') {
-            
             this.typeLink = 'تعديل';
             this.imageBase64 = [];
             //redifine form data
@@ -105,6 +112,7 @@ export class AddInternalServicesComponent implements OnInit {
                         name: this.fieldsData[i].name,
                         name_en: this.fieldsData[i].name_en,
                         link: this.fieldsData[i].link,
+                        photo: this.fieldsData[i].photo,
                         apperance: this.fieldsData[i].apperance,
                         status: this.fieldsData[i].status,
                       })
@@ -113,11 +121,12 @@ export class AddInternalServicesComponent implements OnInit {
 
                   for(let i=0; i<this.fieldsData.length; i++) {
                     this.urlImg[i] = this.fieldsData[i].photo ? this.authSer.pathImg + this.fieldsData[i].photo : '../../assets/image/avatar.png';
-                    this.showCloseFile[i] = true;
-                    this.showOpenFile[i] = false;
                     this.checkChangeImage[i] = false;
                   }
 
+                  console.log('edit image base 64' , this.imageBase64);
+                  console.log('edit check change image', this.checkChangeImage);
+                  console.log('edit mode url image ' , this.urlImg);
                   this.spinner.hide();
               },
               (error) => {
@@ -133,57 +142,112 @@ export class AddInternalServicesComponent implements OnInit {
 
   //to make at least on element in form array
   createItem(): FormGroup {
-    return this.formBuilder.group({
-      name: '',
-      name_en: '',
-      photo: '',
-      link: '',
-      apperance: '',
-      status: '',
-    });
+    if(this.typeMode) {
+      return this.formBuilder.group({
+        name: '',
+        name_en: '',
+        photo: '',
+        link: '',
+        apperance: '',
+        status: '1',
+      });
+    } else {
+      return this.formBuilder.group({
+        name: '',
+        name_en: '',
+        photo: '',
+        photo_type: '',
+        link: '',
+        apperance: '',
+        status: '1',
+      });
+    }
+    
   };
  
   //add more title
-  onAddTitle(i) {
+  onAddTitle() {
     this.fields = this.addInternalForm.get('fields') as FormArray;
     this.fields.push(this.createItem());
-    this.imageBase64[this.i] = [{
-      photo : "",
-      photo_type: "",
-    }];
-    this.i++;
     console.log(this.imageBase64);
     this.urlImg.push('../../assets/image/avatar.png');
-    this.showOpenFile.push(true);
-    this.showCloseFile.push(false);
+    console.log(this.urlImg);
     this.checkChangeImage.push(false);
+    if(!this.typeMode){
+      this.imageBase64.push({
+        photo: '',
+        photo_type: '',
+      });
+    }
+   
+    this.checkAdd = true;
+    console.log('image base 64',this.imageBase64);
+    console.log('check change image', this.checkChangeImage);
   }
 
   //remove from array form
   removeTitle(index: number) {
     this.fields = this.addInternalForm.get('fields') as FormArray;
     this.fields.removeAt(index);
+    this.imageBase64.splice(index,1);
+    console.log(this.imageBase64);
+    this.urlImg.splice(index, 1);
+    console.log(this.urlImg);
   }
 
 
 
   onFileChanges(event,i) {
-
     console.log(event);
-    this.photoType = event[0].type.split('/');
-    console.log(i);
+    var id_field = '';
+    
+    if(this.typeMode) {
+      
+      if(!this.checkAdd) {
+        id_field = this.fieldsData[i].id;
+      }
 
-    this.imageBase64[i]={
-      photo : event[0].base64,
-      photo_type: this.photoType[1],
-    };
+      this.editObjectPhoto['index'] = i;
 
-    console.log(this.imageBase64);
+      const dataUploadEdit = {
+        field_id : id_field,
+        photo: event[0].base64,
+        photo_type: event[0].type.split('/')[1].toLowerCase(),
+      };
+
+      if(dataUploadEdit.photo_type != 'png') {
+
+        if(dataUploadEdit.photo_type != 'gif') {
+          this.toastr.warning('الصوره بصيغه png أو gif');
+        }
 
-    this.checkChangeImage[i] = true;
-    this.showCloseFile[i] = true;
-    this.showOpenFile[i] = false;
+      } else {
 
+        this.http.post(this.authSer.pathApi + '/upload_internal_service_field' , dataUploadEdit ).subscribe(
+          (responce) => {
+            console.log(responce['photo']);
+            this.editObjectPhoto.push({
+              index: i,
+              photo: responce['photo'],
+            });
+            console.log('oooooooooooooooooooooooooooo',this.editObjectPhoto);
+          },
+          (error) => {
+            console.log(error);
+          }
+        )
+      }
+    } else {
+      this.photoType = event[0].type.split('/');
+      this.imageBase64[i]={
+        photo : event[0].base64,
+        photo_type: this.photoType[1].toLowerCase(),
+      };
+      this.checkChangeImage[i] = true;
+      console.log(' cheeck change iamge' , this.checkChangeImage);
+      console.log('base 64 images',this.imageBase64);
+    }
+    
   }
 
   //to upload url to view
@@ -198,61 +262,118 @@ export class AddInternalServicesComponent implements OnInit {
   }
  }
 
- //to close and upload photo
- closePhoto(i) {
-    this.showCloseFile[i] = false;
-    this.showOpenFile[i] = true;
-    this.urlImg[i] =  '../../assets/image/avatar.png';
-    this.imageBase64[i] = {
-      photo: "",
-      photo_type: "",
-    }
-    console.log(this.imageBase64);
- }
+
+
 
 
    //submitted form
    onSubmitted() {
 
+    this.checkSaveClick = true;
+
     const formInternalData = this.addInternalForm.value;
-    
-    for(let i = 0; i< formInternalData['fields'].length; i++) {
-      for(let j = 0; j < this.imageBase64.length; j++) {
-        formInternalData['fields'][i].photo = this.imageBase64[i].photo;
-        formInternalData['fields'][i].photo_type = this.imageBase64[i].photo_type;
+    console.log(formInternalData);
+
+
+
+    if(this.typeMode) {
+
+      //save edit
+
+      for(let i = 0; i< formInternalData['fields'].length; i++) {
+        for(let j = 0; j < this.editObjectPhoto.length; j++) {
+          if(this.editObjectPhoto[j].index == formInternalData['fields'][i].id) {
+            formInternalData['fields'][i].photo = this.editObjectPhoto[j].photo;
+          }
+        }
       }
-    }
 
-    console.log(formInternalData);
+      console.log(formInternalData);
+
+      for(let i = 0; i < formInternalData['fields'].length; i++) {
+        if(formInternalData['fields'][i].photo == '') {
+          this.toastr.warning('قم باختيار صوره للعنصر ' + (i+1) );
+          this.checkValidateField = true;
+          this.checkSaveClick = false;
+        } else if(formInternalData['fields'][i].name == '' || formInternalData['fields'][i].name_en == '' || formInternalData['fields'][i].apperance == '' || formInternalData['fields'][i].status == ''){
+          this.toastr.warning('من فضلك قم بإكمال بيانات العنصر ' + (i + 1) );
+          this.checkValidateField = true;
+          this.checkSaveClick = false;this.checkValidateField = true;
+          this.checkSaveClick = false;
+        } else {
+          this.checkValidateField = false;
+          this.checkSaveClick = false;
+        }
+      }
+
+      if(this.checkValidateField) {
+        console.log('valid imagaes');
+      } else {
+        // this.internalServices.editInternal(this.pageId, formInternalData).subscribe(
+        //   (responce) => {
+        //     console.log(responce);
+        //     this.toastr.success('تم التعديل بنجاح ');
+        //     this.checkSaveClick = false;
+        //   }, (error) => {
+        //     console.log(error);
+        //     this.toastr.error('فشل التعديل !');
+        //     this.checkSaveClick = false;
+        //   }
+        // );
+      }
+      
 
-    if(formInternalData['fields'].length == 0) {
-      this.toastr.warning('أدخل عنوان ووصف واحد علي الاقل !');
-    } else if(formInternalData['fields'][0].name == '' || formInternalData['fields'][0].apperance == '' || formInternalData['fields'][0].status == '') {
-      this.toastr.warning('أدخل عنوان ووصف واحد علي الاقل !');
     } else {
+      //save create 
+      for(let i = 0; i< formInternalData['fields'].length; i++) {
+        for(let j = 0; j < this.imageBase64.length; j++) {
+          formInternalData['fields'][i].photo = this.imageBase64[i].photo;
+          formInternalData['fields'][i].photo_type = this.imageBase64[i].photo_type;
+        }
+      }
+  
+      console.log('image base 64', this.imageBase64);
+      console.log(formInternalData);
+  
+      for(let i=0; i< formInternalData['fields'].length; i++) {
+        if(formInternalData['fields'][i].photo == '') {
+          this.checkValidateField = true;
+          this.checkSaveClick = false;
+          this.toastr.warning('من فضلك  قم بإدخال صوره العنصر ' + ' ' + (i + 1) );
+        } else if(formInternalData['fields'][i].photo_type != 'png') {
+          if(formInternalData['fields'][i].photo_type != 'gif') {
+            this.toastr.warning(' يجب أن تكون الصوره بصيغه png او gif للعنصر' + ' ' + (i + 1) );
+          }
+          this.checkValidateField = true;
+          this.checkSaveClick = false;
+        }else if(formInternalData['fields'][i].name == '' || formInternalData['fields'][i].apperance == '' || formInternalData['fields'][i].status == '') {
+          this.toastr.warning('من فضلك قم بإكمال بيانات العنصر ' + (i + 1) );
+          this.checkValidateField = true;
+          this.checkSaveClick = false;
+        }
+        else {
+          console.log('rightImage');
+          this.checkSaveClick = false;
+          this.checkValidateField = false;
+        }
+      }
+
+      if(this.checkValidateField) {
+        console.log('logical images error');
+      }else {
         this.internalServices.addInternal(formInternalData).subscribe(
           (responce) => {
             console.log(responce);
             this.toastr.success('تم الاضافه بنجاح');
             this.location.back();
+            this.checkSaveClick = false;
           },
           (error) => {
             console.log(error);
+            this.checkSaveClick = false;
           }
         );
-    }
-
-
-    if(this.typeMode) {
-      this.internalServices.editInternal(this.pageId, formInternalData).subscribe(
-        (responce) => {
-          console.log(responce);
-          this.toastr.success('تم التعديل بنجاح ');
-        }, (error) => {
-          console.log(error);
-          this.toastr.error('فشل التعديل !');
-        }
-      );
+      }
     }
 
   };

+ 52 - 12
src/app/dashboard/internal-services/internal-services.component.ts

@@ -1,3 +1,4 @@
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
 import { AuthServiceService } from './../../shared/auth-service.service';
 import { ActivatedRoute, Router, Params } from '@angular/router';
 import { Component, OnInit } from '@angular/core';
@@ -20,6 +21,7 @@ export class InternalServicesComponent implements OnInit {
     private userSer: UserService,
     private spinner: NgxSpinnerService,
     private toastr: ToastrService,
+    private modal: Modal,
     private internalService: InternalSerService) { }
 
   dataList = [];
@@ -39,7 +41,7 @@ export class InternalServicesComponent implements OnInit {
 
   ngOnInit() {
 
-    this.spinner.show();
+  this.spinner.show();
 
   //init the values of permision boolean
   this.authSer.showAddBtn = false;
@@ -132,17 +134,32 @@ export class InternalServicesComponent implements OnInit {
 
       console.log(this.dataListIds);
 
-    this.internalService.deleteDatas(this.dataListIds, this.pageId).subscribe(
-      (responce) => {
-        console.log(responce);
-        this.toastr.success('تم الحذف');
-        window.location.reload();
-      },
-      (error) => {
-        console.log(error);
-        this.spinner.hide();
-      },
-    );
+      if(this.dataListIds.length > 0) {
+        const dialogRef = this.modal.alert()
+        .size('sm')
+        .showClose(true)
+        .title('تأكيد الحذف')
+        .body(`
+            <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+            `)
+        .open();
+          dialogRef.result
+          .then( result => 
+            this.internalService.deleteDatas(this.dataListIds, this.pageId).subscribe(
+              (responce) => {
+                console.log(responce);
+                this.toastr.success('تم الحذف');
+                window.location.reload();
+              },
+              (error) => {
+                console.log(error);
+                this.spinner.hide();
+              },
+            )
+          );
+      } else {
+        this.toastr.warning('لم يتم إختيار أي عنصر للمسح !');
+      }
   };
 
   //filtter function
@@ -168,6 +185,29 @@ export class InternalServicesComponent implements OnInit {
       );
   };
 
+    //change page 
+    onPageChange(pagenationNumber) {
+      this.spinner.show();
+      this.currentPage = pagenationNumber;
+      this.dataList = [];
+      //console.log(pagenationNumber);
+      //console.log(this.pageId);
+      this.internalService.getInternalsList(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
+        (responce) => {
+          console.log(responce);
+          this.dataList = responce['internal_services'];
+          this.count = responce['count'];
+          this.perPagePagenation = responce['per_page'];
+          console.log(this.dataList);
+          this.spinner.hide();
+        },
+        (error) => {
+          console.log(error);
+          this.spinner.hide();
+        }
+      );
+    }
+
   //determine the list count from select element 
   onGetValue(event) {
     this.spinner.show();

+ 53 - 11
src/app/dashboard/lectures/lectures-list/lectures-list.component.ts

@@ -1,3 +1,4 @@
+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';
@@ -21,6 +22,7 @@ export class LecturesListComponent implements OnInit {
     private authSer: AuthServiceService,
     private toastr: ToastrService,
     private http: HttpClient,
+    private modal: Modal,
     private lectureService: LectureService,
     private router: Router) { }
 
@@ -125,6 +127,28 @@ export class LecturesListComponent implements OnInit {
     });
   }
 
+  //change page 
+  onPageChange(pagenationNumber) {
+    this.spinner.show();
+    this.currentPage = pagenationNumber;
+    this.lecturesList = [];
+    //console.log(pagenationNumber);
+    //console.log(this.pageId);
+    this.lectureService.getLecturesList(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
+      (responce) => {
+        console.log(responce);
+        this.lecturesList = responce['lectures'];
+        this.count = responce['count'];
+        this.perPagePagenation = responce['per_page'];
+        console.log(this.lecturesList);
+        this.spinner.hide();
+      },
+      (error) => {
+        console.log(error);
+        this.spinner.hide();
+      }
+    );
+  }
   //filtter function
   filtterFunc(data) {
     this.lecturesList = [];
@@ -205,17 +229,35 @@ onGetValue(event) {
 
     console.log(this.lecturesListIds);
 
-  this.lectureService.deleteLecture(this.lecturesListIds).subscribe(
-    (responce) => {
-      console.log(responce);
-      this.toastr.success('تم الحذف');
-      window.location.reload();
-    },
-    (error) => {
-      console.log(error);
-      this.spinner.hide();
-    },
-  );
+    if(this.lecturesListIds.length > 0) {
+      
+      const dialogRef = this.modal.alert()
+        .size('sm')
+        .showClose(true)
+        .title('تأكيد الحذف')
+        .body(`
+            <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+            `)
+        .open();
+        dialogRef.result
+        .then( result =>  
+          this.lectureService.deleteLecture(this.lecturesListIds).subscribe(
+            (responce) => {
+              console.log(responce);
+              this.toastr.success('تم الحذف');
+              window.location.reload();
+            },
+            (error) => {
+              console.log(error);
+              this.spinner.hide();
+            },
+          )
+        );
+    } else {
+      this.toastr.warning('لم يتم إختيار اي عنصر للحذف !');
+    }
+
+  
   };
 
   //add function

+ 4 - 0
src/app/dashboard/main-menu/add-menu/add-menu.component.css

@@ -90,4 +90,8 @@ input,select {
     display: inline-block !important;
     float: right !important;
     margin: 40px 0 !important;
+}
+
+.ql-container  {
+    min-height: 100px !important;
 }

+ 2 - 3
src/app/dashboard/main-menu/add-menu/add-menu.component.html

@@ -25,7 +25,6 @@
                           <input type="file" name="file" id="file" class="inputfile" alife-file-to-base64 (onFileChanged)="onFileChanges($event)" (change)="getUrl($event)" [(fileModel)]="files" />
                           <label for="file" class="iconUpload-w"><i class="fas fa-upload"></i></label>
                       </div>
-                      <!-- <span *ngIf="checkValidImg" style="color: red">must be in 'png' format</span> -->
                     </div>
                     
                     <div class="col-12 col-sm-12 col-md-4 col-lg-4">
@@ -53,13 +52,13 @@
                       <div class="form-group">
                         <label for="ranking" style="float: right; margin-right: 5px">الترتيب <span class="spanReqired-w">*</span></label>
                         <select class="form-control" name="ranking" [ngModel]="menu.ranking" id="ranking" required>  
-                          <option value="1000">المزيد</option>
                           <option value="1">1</option>
                           <option value="2">2</option>
                           <option value="3">3</option>
                           <option value="4">4</option>
                           <option value="5">5</option>
                           <option value="6">6</option>
+                          <option value="1000">المزيد</option>
                         </select>
                       </div>
                     </div>
@@ -82,7 +81,7 @@
       
                   </div>
                   
-                  <button type="submit" class="btn btn-success rightW" [disabled]="!f.valid">حفظ</button>
+                  <button type="submit" class="btn btn-success rightW" [disabled]="!f.valid || checkSaveClick">حفظ</button>
         
                 </form>
         

+ 9 - 1
src/app/dashboard/main-menu/add-menu/add-menu.component.ts

@@ -23,6 +23,7 @@ export class AddMenuComponent implements OnInit {
   checkValidImg: boolean = true;
   typeMode: boolean = false;
   photoEdit: boolean = true;
+  checkSaveClick:boolean = false;
   typeLink: string = '';
   menuId: number;
   parentList = [];
@@ -36,6 +37,8 @@ export class AddMenuComponent implements OnInit {
     ranking: '',
   };
 
+
+
   constructor(private toastr: ToastrService, 
     private spinner: NgxSpinnerService,
     private location: Location,
@@ -53,7 +56,7 @@ export class AddMenuComponent implements OnInit {
     this.authSer.showHeaderDashBoard = true;
     this.authSer.showDashboardHeader = true;
     this.authSer.internalHeader = false;
-    
+    this.menu.status = '1';
     this.route.params.subscribe(
       (params: Params) => {
         if(params['typeMenuMode'] == 'edit') {
@@ -121,6 +124,7 @@ export class AddMenuComponent implements OnInit {
 
  //on submitted
  onSubmitted() {
+   this.checkSaveClick = true;//to make save disabled after one click
   const formData = this.externalFormData.value;
   if(this.checkChangeImage){
     formData['photo'] = this.imageBase64;
@@ -140,8 +144,10 @@ export class AddMenuComponent implements OnInit {
           console.log(responce);
           this.toastr.success('تمت التعديل بنجاح');
           this.location.back();
+          this.checkSaveClick = false;
         },
         (error) => {
+          this.checkSaveClick = true;
           console.log(error);
           this.toastr.error('خطأ في التعديل !');
         }
@@ -156,9 +162,11 @@ export class AddMenuComponent implements OnInit {
           console.log(responce);
           this.toastr.success('تمت الاضافه بنجاح');
           this.location.back();
+          this.checkSaveClick = false;
         },
         (error) => {
           console.log(error);
+          this.checkSaveClick = true;
           this.toastr.error('خطأ في الحفظ !');
         }
       );

+ 2 - 2
src/app/dashboard/main-menu/main-list/main-list.component.html

@@ -77,8 +77,8 @@
                   <option value="6">6</option>
                 </select> -->
               </td>
-              <td>{{menu.status == 1 ? 'نشط' : menu.status == 0 ? 'غير نشط' : 'not found' }}</td>
-              <td>{{menu.parent_name ? menu.parent_name : 'لايوجد'}}</td>
+              <td>{{menu.status == 1 ? 'فعال' : menu.status == 0 ? 'غير فعال' : 'not found' }}</td>
+              <td>{{menu.parent_name ? menu.parent_name : '__'}}</td>
               <td *ngIf="authSer.showEditBtn"><button type="button" class="btn btn-outline-secondary" (click)="onEdit(menu.id)"><i class="fas fa-edit"></i></button></td>
             </tr>
           </tbody>

+ 45 - 11
src/app/dashboard/main-menu/main-list/main-list.component.ts

@@ -6,6 +6,9 @@ import { ActivatedRoute, Router, Params } from '@angular/router';
 import { UserService } from '../../../shared/user.service';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { ToastrService } from 'ngx-toastr';
+import { Overlay } from 'ngx-modialog';
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
+
 
 @Component({
   selector: 'app-main-list',
@@ -34,6 +37,7 @@ export class MainListComponent implements OnInit {
     private toastr: ToastrService,
     private mainService: MainMenuService,
     private spinner: NgxSpinnerService,
+    private modal: Modal,
     private authSer: AuthServiceService) { }
 
   ngOnInit() {
@@ -216,6 +220,7 @@ export class MainListComponent implements OnInit {
   };
   
   onDelete() {
+
     this.menuListIds = [];
     for(let i = 0; i < this.menuList.length; i++) {
       if(this.menuList[i].selected == true) {
@@ -224,18 +229,47 @@ export class MainListComponent implements OnInit {
     }
 
     console.log(this.menuListIds);
+    if(this.menuListIds.length > 0) {
+      const dialogRef = this.modal.alert()
+      .size('sm')
+      .showClose(true)
+      .title('تأكيد الحذف')
+      .body(`
+          <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+          `)
+      .open();
+  
+        dialogRef.result
+        .then( result => 
+          this.mainService.deleteMain(this.menuListIds).subscribe(
+              (responce) => {
+                console.log(responce);
+                this.toastr.success('تم الحذف');
+                window.location.reload();
+              },
+              (error) => {
+                console.log(error);
+                this.toastr.error('حدث خطأ رجاء الانتظار وحاول ثانيه');
+                this.spinner.hide();
+              }
+          )
+        );
+    } else {
+      this.toastr.warning('لم يتم أختيار أي عنصر للحذف !');
+    }
 
-    this.mainService.deleteMain(this.menuListIds).subscribe(
-      (responce) => {
-        console.log(responce);
-        this.toastr.success('تم الحذف');
-        window.location.reload();
-      },
-      (error) => {
-        console.log(error);
-        this.spinner.hide();
-      },
-    );
+    
+    // this.mainService.deleteMain(this.menuListIds).subscribe(
+    //   (responce) => {
+    //     console.log(responce);
+    //     this.toastr.success('تم الحذف');
+    //     window.location.reload();
+    //   },
+    //   (error) => {
+    //     console.log(error);
+    //     this.spinner.hide();
+    //   },
+    // );
   };
 
   //add function

+ 35 - 11
src/app/dashboard/news/add-news/add-news.component.css

@@ -23,33 +23,34 @@
 
 
 .imgProfile {
-    width: 70px;
-    height: 70px;
-    border-radius: 20px 20px 0 0;
-    border-radius: 50%;
+    width: 100%;
+    height: 100%;
     border: 1px solid #ccc;
-
+    border-radius: 20px;
 }
 
 .imgContainer {
-    width: 200px;
+    width: 100%;
+    height: 200px;
     position: relative;
     border-radius: 20px;
-    margin: 30px auto;
+    margin: 30px 0;
+    border: 1px solid #ccc;
 }
+
+
 .iconUpload-w {
     width: 30px;
     font-size: 1.25em;
     font-weight: 700;
-    color: #252525;
     display: inline-block;
     border-radius: 0 0 20px 20px;
+    background-color: #fff;
     position: absolute;
-    right: 37px;
     border: 1px solid #ccc;
     border-radius: 50%;
-    bottom: 0;
-    right: 42%;
+    top: 10px;
+    right: 10px;
 }
 
 .inputfile {
@@ -66,6 +67,29 @@ input,select {
     background-color: #f9f9f9;
     border: 2px solid #bda380;
 }
+
+.deleteBtn-w {
+    width: 30px;
+    font-size: 16px;
+    font-weight: 700;
+    color: #252525;
+    display: inline-block;
+    border-radius: 0 0 20px 20px;
+    position: absolute;
+    border: 1px solid #ccc;
+    border-radius: 50%;
+    top: 10px;
+    left: 10px;
+    cursor: pointer;
+    background: transparent;
+    border: 1px solid #ccc;
+    transition: all 0.5s;
+}
+
+.deleteBtn-w:hover {
+    background-color: #00a99d;
+    color: #fff;
+}
 /* .inputfile + label {
     width: 100%;
     font-size: 1.25em;

+ 13 - 10
src/app/dashboard/news/add-news/add-news.component.html

@@ -10,20 +10,13 @@
           </ul>
         </div>
     </div>
+
     <div class="containerContent-w">
       <div class="row">
         <div class="col-12">
 
           <form (ngSubmit)="onSubmitted()" #f="ngForm">
             <div class="row">
-              <div class="col-12 col-sm-12 col-md-12 col-lg-12" style="margin-bottom:30px">
-                <div class="form-group text-center imgContainer">
-                    <img [src]="urlImg" class="imgProfile" height="200">
-                    <input type="file" name="file" id="file" class="inputfile" alife-file-to-base64 (onFileChanged)="onFileChanges($event)" (change)="getUrl($event)" [(fileModel)]="files" />
-                    <label for="file" class="iconUpload-w"><i class="fas fa-upload"></i></label>
-                </div>
-              </div>
-
               <div class="col-12 col-sm-12 col-md-4 col-lg-4">
                 <div class="form-group">
                   <label for="title" style="float: right; margin-right: 5px">العنوان بالغه العربيه <span class="spanReqired-w">*</span></label>
@@ -89,8 +82,18 @@
                   </div>
               </div>
 
-
-
+              <div class="col-12 col-sm-12 col-md-12 col-lg-12" style="margin-bottom:30px">
+                <button type="button" class="btn btn-default" (click)="plusImage()">أضف صوره</button>
+                <div class="row">
+                  <div class="col-12 col-sm-3" *ngFor="let image of images; let i = index">
+                    <div class="form-group text-center imgContainer">
+                      <img [src]="image.urlImg" class="imgProfile">
+                      <input type="file" name="file{{i}}" id="file{{i}}" class="inputfile" alife-file-to-base64 (onFileChanged)="onFileChanges($event,i)" (change)="getUrl($event,i)" [(fileModel)]="files" />
+                      <label for="file{{i}}" class="iconUpload-w"><i class="fas fa-upload"></i></label>
+                    </div>
+                  </div>
+                </div>
+              </div>
             </div>
 
             <button type="submit" class="btn btn-success rightW" [disabled]="!f.valid">حفظ</button>

+ 122 - 43
src/app/dashboard/news/add-news/add-news.component.ts

@@ -1,3 +1,4 @@
+import { HttpClient } from '@angular/common/http';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { ActivatedRoute, Params } from '@angular/router';
@@ -20,14 +21,16 @@ export class AddNewsComponent implements OnInit {
   @ViewChild('f') newForm: NgForm;
   typeMode: boolean = false;
   newId: number;
-  checkChangeImage: boolean = false;
   checkValidImg: boolean = true;
   imageBase64: string = '';
   photoType: string = '';
   typeLink: string = '';
+  checkSaveClick: boolean = false;
   photoEdit:boolean = true;
 
 
+  
+
   new = {
     title: '',
     title_en: '',
@@ -39,16 +42,31 @@ export class AddNewsComponent implements OnInit {
     description_en: '',
   }
 
-  urlImg: string =  '../../assets/image/avatar.png';
+  images = [{
+    base64: '',
+    photoType: '',
+    urlImg: '../../assets/image/avatar.png'
+  }];
+
+  //add more div photo
+  plusImage() {
+    this.images.push({
+     base64: '',
+     photoType: '',
+     urlImg: '../../assets/image/avatar.png',
+    });
+  }
+
+
 
-  
 
   constructor(private newService: NewService,
     private userService: UserService,
     private authSer: AuthServiceService,
     private location: Location,
     private toastr: ToastrService,
-    private route: ActivatedRoute, 
+    private route: ActivatedRoute,
+    private http: HttpClient, 
     private authService: AuthServiceService,
     private spineer: NgxSpinnerService) { }
 
@@ -60,11 +78,13 @@ export class AddNewsComponent implements OnInit {
     this.authSer.showHeaderDashBoard = true;
     this.authSer.showDashboardHeader = true;
     this.authSer.internalHeader = false;
+    this.new.status = '1';
     
     this.route.params.subscribe(
       (params: Params) => {
         if(params['typeNewMode'] == 'edit') {
           this.typeLink = 'تعديل';
+          this.images = [];
           this.spineer.show();
           this.typeMode = true;
           this.newId = params['editNewId'];
@@ -81,9 +101,23 @@ export class AddNewsComponent implements OnInit {
               this.new.status = newData.status;
               this.new.description = newData.description;
               this.new.description_en = newData.description_en;
-              if(responce['report'].photo) {
+              if(responce['report'].photos) {
                 this.checkValidImg = false;
-                this.urlImg = this.authService.pathImg + responce['report'].photo;
+                for(let i = 0 ; i < newData.photos.length; i++) {
+                  // this.images[i] = {
+                  //   base64: '',
+                  //   photoType: '',
+                  //   urlImg: this.authSer.pathImg +  newData.photos[i].photo,
+                  // }
+
+                 
+                  this.images.push({
+                    base64: '',//this.onFileChanges(newData.photos[i].photo,i),
+                    photoType: '',
+                    urlImg : this.authSer.pathImg +  newData.photos[i].photo,
+                  });
+                  console.log('imageeeees' , this.images);
+                }
               }
               this.spineer.hide();
             },
@@ -99,80 +133,125 @@ export class AddNewsComponent implements OnInit {
   }
 
 
-  onFileChanges(event) {
+
+  onFileChanges(event,index) {
     console.log(event);
-    this.imageBase64 = event[0].base64;
-    this.photoType = event[0].type.split('/');
-    console.log(this.photoType[1]);
-    //console.log(this.imageBase64);
-    this.checkChangeImage = true;
-    this.checkValidImg = false;
+    console.log('upload image index' , index);
+    let dateEditUplad = {};
+
+    if(this.typeMode) {
+      dateEditUplad = {
+        'photo': event[0].base64,
+        'photo_type': event[0].type.split('/')[1],
+        report_id:  this.newId,
+      }
+      this.http.post(this.authSer.pathApi + '/upload_report_photo', dateEditUplad).subscribe(
+        (responce) => {
+          console.log(responce);
+        },
+        (error) => {
+          console.log(error);
+        }
+      )
+    } else {
+      this.imageBase64 = event[0].base64;
+      this.images[index].base64 = this.imageBase64;
+      this.photoType = event[0].type.split('/');
+      this.images[index].photoType = this.photoType[1];
+      console.log('images array' , this.images);
+      this.checkValidImg = false;
+    }
   }
 
-  getUrl(event) {   
+  getUrl(event,index) {   
     if (event.target.files && event.target.files[0]) {
     var reader = new FileReader();
     reader.readAsDataURL(event.target.files[0]); // read file as data url
     reader.onload = (event) => { // called once readAsDataURL is completed
-      this.urlImg = event.target['result'];
+      //this.urlImg = event.target['result'];
+      this.images[index].urlImg = event.target['result'];
     }
   }
  }
 
+
+
   //submitted form
   onSubmitted() {
-    const formData = this.newForm.value;
 
-    if(this.checkChangeImage){
-      formData['photo'] = this.imageBase64;
-      formData['photo_type'] = this.photoType[1];
-    }else {
-      delete formData.photo;
-      delete formData.photo_type; 
-      this.photoEdit = false
-      console.log(formData);
-    }
-    
+    this.checkSaveClick = true;
+
+    const formData = this.newForm.value;
+      
     if(this.typeMode){
       if(this.photoType[1] != 'png' && this.photoEdit == true) {
         this.toastr.warning('الصوره يجب أن تكون بصيغه Png');
       } else if(this.imageBase64 == '' && this.photoEdit == true){
         this.toastr.warning('قم باختيار صوره !');
       } else {
-        // formData['photo'] = this.imageBase64;
-        // formData['photo_type'] = this.photoType[1];
-        this.newService.editNew(formData, this.newId).subscribe(
-          (responce) => {
-            console.log(responce);
-            this.toastr.success('تمت التعديل بنجاح');
-            this.location.back();
-          },
-          (error) => {
-            console.log(error);
-            this.toastr.error('خطأ في التعديل !');
+        //to remove photo from object not has edit on it
+        const images = [];
+        for(let i = 0; i < this.images.length; i++) {
+          if(this.images[i].base64 == '') {
+            this.images.splice(this.images.indexOf(this.images[i]) , 1);
+          } else {
+            images.push({
+              photo: this.images[i].base64,
+              photo_type: this.images[i].photoType,
+            });
           }
-        );
+        }
+
+        formData['images'] = images;
+
+        console.log(formData);
+
+        // this.newService.editNew(formData, this.newId).subscribe(
+        //   (responce) => {
+        //     console.log(responce);
+        //     this.toastr.success('تمت التعديل بنجاح');
+        //     this.location.back();
+        //   },
+        //   (error) => {
+        //     console.log(error);
+        //     this.toastr.error('خطأ في التعديل !');
+        //   }
+        // );
       }
     } else {
-      if(this.photoType[1] != 'png') {
-        this.toastr.warning('الصوره يجب أن تكون بصيغه Png');
-      } else if(this.imageBase64 == ''){
+      if(this.images[0].base64 == ''){
         this.toastr.warning('قم باختيار صوره !');
       } else {
-        // formData['photo'] = this.imageBase64;
-        // formData['photo_type'] = this.photoType[1];
+
+        const images = [];
+
+        for(let i = 0; i < this.images.length; i++) {
+          images.push({
+            photo: this.images[i].base64,
+            photo_type: this.images[i].photoType,
+          });
+        }
+
+        formData['images'] = images;
+
+        console.log(formData);
+
         this.newService.addNew(formData).subscribe(
           (responce) => {
             console.log(responce);
             this.toastr.success('تمت الاضافه بنجاح');
             this.location.back();
+            this.checkSaveClick = false;
           },
           (error) => {
+            this.checkSaveClick = true;
             console.log(error);
             this.toastr.error('خطأ في الحفظ !');
           }
         );
+
       }
     }
   }
+
 }

+ 1 - 1
src/app/dashboard/news/news-list/news-list.component.html

@@ -79,7 +79,7 @@
               <option value="6">6</option>
             </select> -->
           </td>
-          <td>{{news.status == '0' ? 'نشر' : news.status == '1' ? 'مسوده' : 'not found'}}</td>
+          <td>{{news.status == '1' ? 'نشر' : news.status == '0' ? 'مسوده' : 'not found'}}</td>
           <td>{{news.created_at}}</td>
           <td>{{news.display_location == 'internal' ? 'داخلي' : news.status == 'external' ? 'خارجي' : 'كلاهما'}}</td>
           <td>{{news.created_by_name}}</td>

+ 37 - 14
src/app/dashboard/news/news-list/news-list.component.ts

@@ -6,6 +6,7 @@ import { Component, OnInit } from '@angular/core';
 import { ToastrService } from 'ngx-toastr';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { NewService } from '../../../shared/new.service';
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
 
 @Component({
   selector: 'app-news-list',
@@ -20,6 +21,7 @@ export class NewsListComponent implements OnInit {
     private http: HttpClient,
     private toastr: ToastrService,
     private newService: NewService,
+    private modal: Modal,
     private spinner: NgxSpinnerService,
     private authSer: AuthServiceService) { }
 
@@ -105,7 +107,12 @@ export class NewsListComponent implements OnInit {
     this.newService.getnewsList(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
       (responce) => {
         console.log(responce);
-        this.newsList = responce['reports'];
+        this.newsList = responce['reports'];  
+        for(let i = 0; i<this.newsList.length ; i++) {
+          var date = this.newsList[i].created_at.split(' ')[0].split('-');
+          this.newsList[i].created_at = this.authSer.writeHijri( new Date(date[0],date[1],date[2]),'ar','system'); 
+        }
+
         this.count = responce['count'];
         this.perPagePagenation = responce['per_page'];
         console.log('evennnnts', this.newsList);
@@ -232,18 +239,35 @@ export class NewsListComponent implements OnInit {
       }
   
       console.log(this.newsListIds);
-  
-      this.newService.deleteNew(this.newsListIds).subscribe(
-        (responce) => {
-          console.log(responce);
-          this.toastr.success('تم الحذف');
-          window.location.reload();
-        },
-        (error) => {
-          console.log(error);
-          this.spinner.hide();
-        },
-      );
+
+      if(this.newsListIds.length > 0) {
+
+        const dialogRef = this.modal.alert()
+        .size('sm')
+        .showClose(true)
+        .title('تأكيد الحذف')
+        .body(`
+            <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+            `)
+        .open();
+        dialogRef.result
+        .then( result =>  
+          this.newService.deleteNew(this.newsListIds).subscribe(
+            (responce) => {
+              console.log(responce);
+              this.toastr.success('تم الحذف');
+              window.location.reload();
+            },
+            (error) => {
+              this.toastr.success('يوجد خطأ إنتظر قليلا وأعد المحاوله ');
+              console.log(error);
+              this.spinner.hide();
+            },
+          )
+        );
+      } else {
+        this.toastr.warning('لم يتم إختيار أي عنصر للمسح !');
+      }
     };
   
     //add function
@@ -257,5 +281,4 @@ export class NewsListComponent implements OnInit {
       this.router.navigate(['service/' + this.userLoginId + '/' + this.serviceId + '/' + 'new/edit/' + editNewID]);
     }
     
-
 }

+ 8 - 0
src/app/dashboard/tabs/add-tab/add-tab.component.ts

@@ -18,6 +18,8 @@ export class AddTabComponent implements OnInit {
   @ViewChild('f') formTabData: NgForm;
 
   typeMode: boolean = false;
+  checkSaveclick:boolean = false;
+
   eventId: number;
   tabId: number;
   typeLink: string = '';
@@ -46,6 +48,7 @@ export class AddTabComponent implements OnInit {
     this.authSer.showHeaderLogin = false;
     this.authSer.showHeaderDashBoard = true;
     this.authSer.internalHeader = false;
+    this.tab.status = "1";
     
     this.route.params.subscribe(
       (params: Params) => {
@@ -81,6 +84,7 @@ export class AddTabComponent implements OnInit {
 
   //on submitted form
   onSubmitted() {
+    this.checkSaveclick = true;
     console.log(this.formTabData.value);
     if(this.typeMode) {
       this.tabService.editEvent(this.formTabData.value, this.tabId).subscribe(
@@ -88,10 +92,12 @@ export class AddTabComponent implements OnInit {
           console.log(responce);
           this.toastr.success('تم التعديل بنجاح');
           this.location.back();
+          this.checkSaveclick = false;
         },
         (error) => {
           console.log(error);
           this.toastr.error('خطأ في التعديل ');
+          this.checkSaveclick = false;
         }
       )
     } else {
@@ -100,10 +106,12 @@ export class AddTabComponent implements OnInit {
           console.log(responce);
           this.toastr.success('تم الاضافه بنجاح');
           this.location.back();
+          this.checkSaveclick = false;
         },
         (error) => {
           console.log(error);
           this.toastr.error('خطأ في الأضافه ');
+          this.checkSaveclick = false;
         }
       );
     }

+ 34 - 11
src/app/dashboard/tabs/tab-list/tab-list.component.ts

@@ -1,3 +1,4 @@
+import { Modal } from 'ngx-modialog/plugins/bootstrap';
 import { TabsService } from './../../../shared/tabs.service';
 import { AuthServiceService } from './../../../shared/auth-service.service';
 import { ToastrService } from 'ngx-toastr';
@@ -35,6 +36,7 @@ export class TabListComponent implements OnInit {
     private tabService: TabsService,
     private toastr: ToastrService,
     private spinner: NgxSpinnerService,
+    private modal: Modal,
     private authSer: AuthServiceService) { }
 
   ngOnInit() {
@@ -95,6 +97,10 @@ export class TabListComponent implements OnInit {
       (responce) => {
         console.log(responce);
         this.tabsList = responce['tabs'];
+        for(let i = 0; i<this.tabsList.length ; i++) {
+          var date = this.tabsList[i].created_at.split(' ')[0].split('-');
+          this.tabsList[i].created_at = this.authSer.writeHijri( new Date(date[0],date[1],date[2]),'ar','system'); 
+        }
         this.count = responce['count'];
         this.perPagePagenation = responce['per_page'];
         this.spinner.hide();
@@ -213,6 +219,7 @@ export class TabListComponent implements OnInit {
   }
 
   onDelete() {
+
     this.tabsListIds = [];
     for(let i = 0; i < this.tabsList.length; i++) {
       if(this.tabsList[i].selected == true) {
@@ -222,17 +229,33 @@ export class TabListComponent implements OnInit {
 
     console.log(this.tabsListIds);
 
-  this.tabService.deleteTab(this.tabsListIds).subscribe(
-    (responce) => {
-      console.log(responce);
-      this.toastr.success('تم الحذف');
-      window.location.reload();
-    },
-    (error) => {
-      console.log(error);
-      this.spinner.hide();
-      },
-    );
+    if(this.tabsListIds.length > 0) {
+      const dialogRef = this.modal.alert()
+      .size('sm')
+      .showClose(true)
+      .title('تأكيد الحذف')
+      .body(`
+          <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
+          `)
+      .open();
+  
+        dialogRef.result
+        .then( result => 
+          this.tabService.deleteTab(this.tabsListIds).subscribe(
+            (responce) => {
+              console.log(responce);
+              this.toastr.success('تم الحذف');
+              window.location.reload();
+            },
+            (error) => {
+              console.log(error);
+              this.spinner.hide();
+              },
+            )
+        );
+    } else {
+      this.toastr.warning('لم يتم إختيار أي عنصر للمسح !');
+    }
   };
 
   //add function

+ 2 - 2
src/app/dashboard/users/users.component.html

@@ -52,7 +52,7 @@
                 </div>
               </th>
               <th>الاسم</th>
-              <th>البريد الإلكتروني</th>
+              <th *ngIf="checkListType">البريد الإلكتروني</th>
               <th *ngIf="authSer.showEditBtn">تعديل</th>
               <th *ngIf="authSer.showPermissionsBtn">الصلاحيات</th>
               <!-- <th *ngIf="authSer.showReport">التقارير</th> -->
@@ -67,7 +67,7 @@
                 </div>
               </td>
               <td>{{user.name}}</td>
-              <td>{{user.email}}</td>
+              <td *ngIf="checkListType">{{user.email}}</td>
               <td *ngIf="authSer.showEditBtn"><button type="button" class="btn btn-outline-secondary" (click)="onEdit(user.id)"><i class="fas fa-edit"></i></button></td>
               <td *ngIf="authSer.showPermissionsBtn"><button type="button" class="btn btn-outline-secondary" (click)="onGetPermission(user.id)"><i class="fas fa-hand-paper"></i></button></td>
               <!-- <td *ngIf="authSer.showReport"><button class="btn btn-outline-secondary" (click)="onGetReport(user.id)"><i class="fas fa-address-card"></i></button></td> -->

+ 3 - 0
src/app/dashboard/users/users.component.ts

@@ -39,6 +39,7 @@ export class UsersComponent implements OnInit {
   userLoginId:number;
   pages = [];
   dataTableNumber: number = 5;
+  checkListType: boolean;
 
   @ViewChild('') filtterBar = '';
 
@@ -68,9 +69,11 @@ export class UsersComponent implements OnInit {
         if(this.pageId == 1) {
           this.typeLink = 'المستخدمين';
           this.typeService = 'خدمه الصلاحيات';
+          this.checkListType = true;
         } else if(this.pageId == 9) {
           this.typeLink = 'إنضم إلينا';
           this.typeService = 'خدمه إداره المحتوي';
+          this.checkListType = false;
         }
       }
     );

+ 11 - 0
src/app/higri-date/higri-date.component.css

@@ -0,0 +1,11 @@
+.calendar {
+    position: absolute;
+    left: 16px;
+    top: 32px;
+    border: 1px solid #ccc;
+}
+
+ngb-datepicker-navigation-select>.custom-select {
+    padding: 0% !important;
+    height:0 !important;
+}

+ 13 - 0
src/app/higri-date/higri-date.component.html

@@ -0,0 +1,13 @@
+<input class="form-control" 
+    (ngModelChange)="onSearchChange($event)" 
+    placeholder="yyyy-mm-dd"
+    name="dp" 
+    [(ngModel)]="model" 
+    ngbDatepicker #d="ngbDatepicker" />
+            
+<div class="input-group-append">
+    <button class="btn btn-outline-secondary calendar" (click)="d.toggle()" type="button"><i class="fas fa-calendar-minus"></i></button>
+</div>
+
+
+

+ 71 - 0
src/app/higri-date/higri-date.component.ts

@@ -0,0 +1,71 @@
+import { Component, Injectable, OnInit, EventEmitter, Output, Input } from '@angular/core';
+
+import {
+  NgbDate,NgbDateStruct, NgbCalendar, NgbCalendarIslamicUmalqura, NgbDatepickerI18n
+} from '@ng-bootstrap/ng-bootstrap';
+
+const WEEKDAYS = ['ن', 'ث', 'ر', 'خ', 'ج', 'س', 'ح'];
+const MONTHS = ['محرم', 'صفر', 'ربيع الأول', 'ربيع الآخر', 'جمادى الأولى', 'جمادى الآخرة', 'رجب', 'شعبان', 'رمضان', 'شوال',
+  'ذو القعدة', 'ذو الحجة'];
+
+  @Injectable()
+  export class IslamicI18n extends NgbDatepickerI18n {
+    
+
+    getWeekdayShortName(weekday: number) {
+      return WEEKDAYS[weekday - 1];
+    }
+
+    getMonthShortName(month: number) {
+      return MONTHS[month - 1];
+    }
+
+    getMonthFullName(month: number) {
+      return MONTHS[month - 1];
+    }
+
+    getDayAriaLabel(date: NgbDateStruct): string {
+      return `${date.day}-${date.month}-${date.year}`;
+    }
+}
+
+@Component({
+  selector: 'app-higri-date',
+  templateUrl: './higri-date.component.html',
+  styleUrls: ['./higri-date.component.css'],
+  providers: [
+    {provide: NgbCalendar, useClass: NgbCalendarIslamicUmalqura},
+    {provide: NgbDatepickerI18n, useClass: IslamicI18n}
+  ]
+})
+export class HigriDateComponent implements OnInit {
+  
+  @Output() onDatePicked: EventEmitter<NgbDate> = new EventEmitter<NgbDate>();
+  @Input() myDate;
+  model: NgbDateStruct;
+
+
+  ngOnInit() {
+    this.model = this.myDate;
+    console.log('moooodeeeeeeeeel' , this.myDate);
+  }
+
+
+
+  constructor(private calendar: NgbCalendar) {}
+ 
+ 
+ 
+
+  onSearchChange(date) {
+    this.onDatePicked.emit(date);
+  }
+ 
+ 
+  onGetDateVal(event) {
+    alert('hello');
+    console.log(event);
+  }
+
+
+}

+ 4 - 2
src/app/login/login.component.css

@@ -17,8 +17,7 @@
     margin: 30px auto;
     padding: 80px 0;
     border: 1px solid #ccc;
-    background-color: #fff;
-    opacity: 0.7;
+    background: rgba(255, 255, 255, 0.5);
 }
 
 .formContent-w h2 {
@@ -80,6 +79,9 @@
 .formContent-w input.ng-touched.ng-invalid{
     border: 2px solid #ff386a;
 } 
+.ql-container {
+    min-height: 100px !important;
+}
 
 /* start media query */
 @media(max-width: 767px) {

+ 2 - 7
src/app/shared/achievements.service.ts

@@ -28,13 +28,8 @@ export class AchievementsService {
 
     //delete user 
     deleteAchievement(achievementsIds) {
-      if(achievementsIds.length > 0){
-        console.log(achievementsIds);
-        return this.http.post(this.authService.pathApi + '/delete_achievements' , {'achievements_id' : achievementsIds});
-      } else {
-        this.spinner.hide();
-        this.toastr.warning('لم يتم أختيار أي مجموعه للحذف !');
-      }
+      console.log(achievementsIds);
+      return this.http.post(this.authService.pathApi + '/delete_achievements' , {'achievements_id' : achievementsIds});
     };
 
     //add

+ 54 - 25
src/app/shared/auth-service.service.ts

@@ -36,11 +36,11 @@ export class AuthServiceService {
   showDashboardHeader: boolean = false;
   internalHeader: boolean = false;
 
-  arabicTemplate: boolean = true;
-  arabicLanguage: boolean = true;
-  englishLanguage:boolean = false;
-  showArabicIcon:boolean = false;
-  showEnglishIcon:boolean = true;
+  arabicTemplate: boolean;
+  arabicLanguage: boolean;
+  englishLanguage:boolean;
+  showArabicIcon:boolean;
+  showEnglishIcon:boolean;
 
   pathApi: string = 'http://hospital.rabbittec.com/back_end/api';
   pathImg: string = "http://hospital.rabbittec.com/back_end/public/";
@@ -50,7 +50,6 @@ export class AuthServiceService {
 
   showSearchHeader: boolean = true;
 
-
   cachedRequests: Array<HttpRequest<any>> = [];
   notificationLogin: boolean = true;
 
@@ -103,27 +102,40 @@ export class AuthServiceService {
     this.location.back();
   }
 
+  setLocalLang(){
+    if(! localStorage.getItem('lang')){
+      localStorage.setItem('lang', "ar");
 
-  //language content
-  onLanguageContent(typeLang:string) {
-    if(typeLang == 'ar') {
       this.arabicTemplate = true;
       this.arabicLanguage = true;
-      this.showArabicIcon = false;
-      this.showEnglishIcon = true;
       this.englishLanguage = false;
-
-      console.log('click AR , show Arabic', this.showArabicIcon);
-      console.log('click AR , show English', this.showEnglishIcon);
-    } else if(typeLang == 'en'){
-      this.arabicTemplate = false;
-      this.arabicLanguage = false;
-      this.englishLanguage = true;
-      this.showArabicIcon = true;
-      this.showEnglishIcon = false;
-      console.log('click EN , show Arabic', this.showArabicIcon);
-      console.log('click EN , show English', this.showEnglishIcon);
+      this.showArabicIcon= false;
+      this.showEnglishIcon=true;
+    }else{
+      if(localStorage.getItem('lang')=='ar'){
+
+        this.arabicTemplate = true;
+        this.arabicLanguage = true;
+        this.englishLanguage = false;
+        this.showArabicIcon= false;
+        this.showEnglishIcon=true;
+      }else if(localStorage.getItem('lang')=='en'){
+        this.arabicTemplate = false;
+        this.arabicLanguage = false;
+        this.englishLanguage = true;
+        this.showArabicIcon = true;
+        this.showEnglishIcon = false;
+      }
     }
+
+  }
+
+  //language content
+  onLanguageContent(typeLang:string) {
+    localStorage.setItem('lang', typeLang);
+    this.setLocalLang();
+
+    
   }
 
 
@@ -132,13 +144,30 @@ export class AuthServiceService {
     return this.http.get(this.pathApi + '/get_footers_links');
   }
 
-   writeHijri(date, lang) {
-    var date = date || new Date();
+   writeHijri(date, lang, type) {
+    
     lang = lang || 'en';
+    
     var options = {
       year: 'numeric', month: 'long', day: 'numeric'
     };
-    return date.toLocaleString(lang + '-u-ca-islamic', options);
+
+    var days = ['الأحد', 'الأثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعه', 'السبت'];
+
+     if(type == 'system') {
+      var date = date;
+     } else if(type == 'header') {
+       date = new Date();
+       var dayName = days[date.getDay()];
+     }
+    //var date = date || new Date();
+    if(dayName) {
+      return dayName + ' ' + date.toLocaleString(lang + '-u-ca-islamic', options);
+    } else {
+      return date.toLocaleString(lang + '-u-ca-islamic', options);
+
+    }
+    
   }
 
 

+ 2 - 7
src/app/shared/event.service.ts

@@ -47,13 +47,8 @@ export class EventService {
 
   //delete event 
   deleteEvent(eventsIds) {
-    if(eventsIds.length > 0){
-      console.log(eventsIds);
-      return this.http.post(this.authService.pathApi + '/delete_event' , {'events_id' : eventsIds});
-    } else {
-      this.spinner.hide();
-      this.toastr.warning('لم يتم أختيار أي مجموعه للحذف !');
-    }
+    console.log(eventsIds);
+    return this.http.post(this.authService.pathApi + '/delete_events' , {'events_id' : eventsIds});
   };
 
 }

+ 0 - 6
src/app/shared/external-ser.service.ts

@@ -29,13 +29,7 @@ export class ExternalSerService {
 
   //delete data 
   deleteEvent(externalsIds) {
-    if(externalsIds.length > 0){
-      console.log(externalsIds);
       return this.http.post(this.authService.pathApi + '/delete_external_services' , {'external_services_id' : externalsIds});
-    } else {
-      this.spinner.hide();
-      this.toastr.warning('لم يتم أختيار أي مجموعه للحذف !');
-    }
   };
 
   //add external 

+ 2 - 7
src/app/shared/footer.service.ts

@@ -29,13 +29,8 @@ export class FooterService {
 
   //delete data 
   deleteFooter(footersId) {
-    if(footersId.length > 0){
-      console.log(footersId);
-      return this.http.post(this.authService.pathApi + '/delete_footers' , {'footers_id' : footersId});
-    } else {
-      this.spinner.hide();
-      this.toastr.warning('لم يتم أختيار أي مجموعه للحذف !');
-    }
+    console.log(footersId);
+    return this.http.post(this.authService.pathApi + '/delete_footers' , {'footers_id' : footersId});
   };
 
   //add external 

+ 2 - 11
src/app/shared/hospital.service.ts

@@ -30,22 +30,13 @@ export class HospitalService {
   //delete hospitals
   deleteDatas(datasIds, pageId) {
     if(pageId == 6){
-      if(datasIds.length > 0){
         console.log(datasIds);
         return this.http.post(this.authService.pathApi + '/delete_hospitals_centers' , {'hospitals_centers_id' : datasIds});
-      } else {
-        this.spinner.hide();
-        this.toastr.warning('لم يتم أختيار أي عنصر للحذف !');
-      }
-    } else if(pageId == 7) {
+    } else if(pageId == 10) {
       this.spinner.show();
-      if(datasIds.length > 0){
         console.log(datasIds);
         return this.http.post(this.authService.pathApi + '/delete_managements' , {'managements_id' : datasIds});
-      } else {
-        this.spinner.hide();
-        this.toastr.warning('لم يتم أختيار أي عنصر للحذف !');
-      }
+      
     }
   }
 

+ 2 - 7
src/app/shared/internal-ser.service.ts

@@ -30,13 +30,8 @@ export class InternalSerService {
 
   //delete hospitals
   deleteDatas(datasIds, pageId) {
-    if(datasIds.length > 0){
-      console.log(datasIds);
-      return this.http.post(this.authService.pathApi + '/delete_internal_services' , {'internal_services_id' : datasIds});
-    } else {
-      this.spinner.hide();
-      this.toastr.warning('لم يتم أختيار أي عنصر للحذف !');
-    }
+    console.log(datasIds);
+    return this.http.post(this.authService.pathApi + '/delete_internal_services' , {'internal_services_id' : datasIds});
   }
 
   //add hospital 

+ 1 - 0
src/app/shared/islamic-date.service.ts

@@ -0,0 +1 @@
+

+ 1 - 5
src/app/shared/lecture.service.ts

@@ -47,13 +47,9 @@ export class LectureService {
 
   //delete event 
   deleteLecture(eventsIds) {
-    if(eventsIds.length > 0){
       console.log(eventsIds);
       return this.http.post(this.authService.pathApi + '/delete_lectures' , {'lectures_id' : eventsIds});
-    } else {
-      this.spinner.hide();
-      this.toastr.warning('لم يتم أختيار أي مجموعه للحذف !');
-    }
+    
   };
 
 

+ 1 - 7
src/app/shared/main-menu.service.ts

@@ -28,13 +28,7 @@ export class MainMenuService {
 
   //delete data 
   deleteMain(mainsIds) {
-    if(mainsIds.length > 0){
-      console.log(mainsIds);
-      return this.http.post(this.authService.pathApi + '/delete_menus' , {'menus_id' : mainsIds});
-    } else {
-      this.spinner.hide();
-      this.toastr.warning('لم يتم أختيار أي مجموعه للحذف !');
-    }
+    return this.http.post(this.authService.pathApi + '/delete_menus' , {'menus_id' : mainsIds});
   };
 
   //add external 

+ 2 - 7
src/app/shared/new.service.ts

@@ -28,13 +28,8 @@ export class NewService {
 
     //delete data 
     deleteNew(externalsIds) {
-      if(externalsIds.length > 0){
-        console.log(externalsIds);
-        return this.http.post(this.authService.pathApi + '/delete_reports' , {'reports_id' : externalsIds});
-      } else {
-        this.spinner.hide();
-        this.toastr.warning('لم يتم أختيار أي مجموعه للحذف !');
-      }
+      console.log(externalsIds);
+      return this.http.post(this.authService.pathApi + '/delete_reports' , {'reports_id' : externalsIds});  
     };
   
     //add external 

+ 2 - 7
src/app/shared/tabs.service.ts

@@ -29,13 +29,8 @@ export class TabsService {
 
    //delete event 
    deleteTab(tabsIds) {
-    if(tabsIds.length > 0){
-      console.log(tabsIds);
-      return this.http.post(this.authService.pathApi + '/delete_tabs' , {'tabs_id' : tabsIds});
-    } else {
-      this.spinner.hide();
-      this.toastr.warning('لم يتم أختيار أي مجموعه للحذف !');
-    }
+    console.log(tabsIds);
+    return this.http.post(this.authService.pathApi + '/delete_tabs' , {'tabs_id' : tabsIds});
   };
 
     //addEvent

BIN
src/assets/image/Group 408.png


BIN
src/assets/image/Group 408@2x.png


+ 16 - 18
src/styles.css

@@ -66,25 +66,24 @@ input:-webkit-autofill:active  {
   margin: 0 15px;
   font-size: 12px;
 }
-/*
-input.ng-invalid {
-  border: 1px solid red;
-}
 
-input.ng-invalid.ng-touched {
-  border: 1px solid red;
+.modal-content {
+  text-align: right;
 }
 
-
-select.ng-invalid {
-  border: 1px solid red;
+.modal-content h4 {
+  font-size: 17px;
 }
 
-select.ng-invalid.ng-touched {
-  border: 1px solid red;
-} */
+.modal-header {
+  display: block;
+  text-align: right;
+}
 
 
+.modal-header h3 {
+  font-size: 17px;
+}
 
 @media(max-width: 767px){
     .hidden-xs {
@@ -324,12 +323,12 @@ select.ng-invalid.ng-touched {
 
   .table tbody tr:nth-child(even){
     background-color: #CFCFCF;
-    color: #CAB59A;
+    color: #bda380;
     font-weight: bold;
   }
   .table tbody tr:nth-child(odd){
     background-color: #f5f2f2;
-    color: #CAB59A;
+    color: #bda380;
     font-weight: bold;
   }
 
@@ -379,8 +378,7 @@ select.ng-invalid.ng-touched {
     width: 100%;
     min-height: 500px;
     padding: 40px 20px;
-    background-color: #fff;
-    opacity: 0.7;
+    background-color: rgba(255, 255, 255, 0.5);
     border: 1px solid #888;
   }
 
@@ -392,11 +390,11 @@ select.ng-invalid.ng-touched {
     width: 100%;
     display: inline-block;
     padding: 20px;
+    min-height: 600px;
     margin: 30px 0;
     border: 1px solid #888;
     border-top: 5px solid #bda380;
-    background-color: #fff;
-    opacity: 0.8;
+    background: rgba(255, 255, 255, 0.5);
     overflow-x: auto;
   }