|
@@ -1,9 +1,10 @@
|
|
|
|
+import { Subscription } from 'rxjs';
|
|
import { AuthServiceService } from './../../../shared/auth-service.service';
|
|
import { AuthServiceService } from './../../../shared/auth-service.service';
|
|
import { NgxSpinnerService } from 'ngx-spinner';
|
|
import { NgxSpinnerService } from 'ngx-spinner';
|
|
import { ActivatedRoute, Router, Params } from '@angular/router';
|
|
import { ActivatedRoute, Router, Params } from '@angular/router';
|
|
import { DashboardService } from './../../../shared/dashboard.service';
|
|
import { DashboardService } from './../../../shared/dashboard.service';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { HttpClient } from '@angular/common/http';
|
|
-import { Component, OnInit } from '@angular/core';
|
|
|
|
|
|
+import { Component, OnInit, OnDestroy } from '@angular/core';
|
|
import { Modal } from 'ngx-modialog/plugins/bootstrap';
|
|
import { Modal } from 'ngx-modialog/plugins/bootstrap';
|
|
import { UserService } from '../../../shared/user.service';
|
|
import { UserService } from '../../../shared/user.service';
|
|
import { ToastrService } from 'ngx-toastr';
|
|
import { ToastrService } from 'ngx-toastr';
|
|
@@ -13,7 +14,7 @@ import { ToastrService } from 'ngx-toastr';
|
|
templateUrl: './adminstration-contact-officers-list.component.html',
|
|
templateUrl: './adminstration-contact-officers-list.component.html',
|
|
styleUrls: ['./adminstration-contact-officers-list.component.css']
|
|
styleUrls: ['./adminstration-contact-officers-list.component.css']
|
|
})
|
|
})
|
|
-export class AdminstrationContactOfficersListComponent implements OnInit {
|
|
|
|
|
|
+export class AdminstrationContactOfficersListComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
constructor(private http: HttpClient,
|
|
constructor(private http: HttpClient,
|
|
private route: ActivatedRoute,
|
|
private route: ActivatedRoute,
|
|
@@ -44,9 +45,24 @@ export class AdminstrationContactOfficersListComponent implements OnInit {
|
|
selected: boolean = false;
|
|
selected: boolean = false;
|
|
checkSaveDisabled:boolean = false;
|
|
checkSaveDisabled:boolean = false;
|
|
|
|
|
|
|
|
+ subscriptionVar: Subscription;
|
|
|
|
+
|
|
ngOnInit() {
|
|
ngOnInit() {
|
|
|
|
+ //init the values of permision boolean
|
|
|
|
+ this.authSer.showAddBtn = false;
|
|
|
|
+ this.authSer.showDeleteBtn = false;
|
|
|
|
+ this.authSer.showEditBtn = false;
|
|
|
|
+ //show / hide notification search in header
|
|
|
|
+ this.authSer.notificationLogin = true;
|
|
|
|
+ this.authSer.showSearchHeader = false;
|
|
|
|
+ this.authSer.showHeaderLogin = false;
|
|
|
|
+ this.authSer.showHeaderDashBoard = true;
|
|
|
|
+ this.authSer.showDashboardHeader = true;
|
|
|
|
+ this.authSer.internalHeader = false;
|
|
|
|
+
|
|
|
|
+ this.spinner.show();
|
|
|
|
|
|
- this.route.params.subscribe(
|
|
|
|
|
|
+ this.subscriptionVar = this.route.params.subscribe(
|
|
(params) =>{
|
|
(params) =>{
|
|
this.pageId = params['adminId'];
|
|
this.pageId = params['adminId'];
|
|
localStorage.setItem('pageIdActive', params['adminId']);
|
|
localStorage.setItem('pageIdActive', params['adminId']);
|
|
@@ -55,8 +71,8 @@ export class AdminstrationContactOfficersListComponent implements OnInit {
|
|
this.http.get(this.authSer.pathApi + '/current_employees_officer_for_adminstration').subscribe(
|
|
this.http.get(this.authSer.pathApi + '/current_employees_officer_for_adminstration').subscribe(
|
|
|
|
|
|
(response) => {
|
|
(response) => {
|
|
- console.log('xx', response);
|
|
|
|
this.currentadmins = response['officers'];
|
|
this.currentadmins = response['officers'];
|
|
|
|
+ this.spinner.hide();
|
|
},
|
|
},
|
|
(error) => {
|
|
(error) => {
|
|
console.log(error);
|
|
console.log(error);
|
|
@@ -69,11 +85,9 @@ export class AdminstrationContactOfficersListComponent implements OnInit {
|
|
console.log(response);
|
|
console.log(response);
|
|
this.emplyees = response['users'];
|
|
this.emplyees = response['users'];
|
|
for (let i = 0; i< this.currentadmins.length; i++) {
|
|
for (let i = 0; i< this.currentadmins.length; i++) {
|
|
- for(let j = 0; j < this.emplyees.length; j++)
|
|
|
|
- {
|
|
|
|
|
|
+ for(let j = 0; j < this.emplyees.length; j++) {
|
|
if(this.currentadmins[i].id == this.emplyees[j].id){
|
|
if(this.currentadmins[i].id == this.emplyees[j].id){
|
|
this.emplyees[i].selected = true;
|
|
this.emplyees[i].selected = true;
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -84,18 +98,15 @@ export class AdminstrationContactOfficersListComponent implements OnInit {
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
- else if(this.pageId == 57){
|
|
|
|
-
|
|
|
|
|
|
+ } else if(this.pageId == 57){
|
|
this.http.get(this.authSer.pathApi + '/current_employees_officer_for_department').subscribe(
|
|
this.http.get(this.authSer.pathApi + '/current_employees_officer_for_department').subscribe(
|
|
|
|
|
|
(response) => {
|
|
(response) => {
|
|
- console.log('xx', response);
|
|
|
|
this.currentadmins = response['officers'];
|
|
this.currentadmins = response['officers'];
|
|
|
|
+ this.spinner.hide();
|
|
},
|
|
},
|
|
(error) => {
|
|
(error) => {
|
|
console.log(error);
|
|
console.log(error);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
);
|
|
);
|
|
@@ -104,11 +115,9 @@ export class AdminstrationContactOfficersListComponent implements OnInit {
|
|
console.log(response);
|
|
console.log(response);
|
|
this.emplyees = response['users'];
|
|
this.emplyees = response['users'];
|
|
for (let i = 0; i< this.currentadmins.length; i++) {
|
|
for (let i = 0; i< this.currentadmins.length; i++) {
|
|
- for(let j = 0; j < this.emplyees.length; j++)
|
|
|
|
- {
|
|
|
|
|
|
+ for(let j = 0; j < this.emplyees.length; j++) {
|
|
if(this.currentadmins[i].id == this.emplyees[j].id){
|
|
if(this.currentadmins[i].id == this.emplyees[j].id){
|
|
this.emplyees[i].selected = true;
|
|
this.emplyees[i].selected = true;
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -117,8 +126,6 @@ export class AdminstrationContactOfficersListComponent implements OnInit {
|
|
console.log(error);
|
|
console.log(error);
|
|
}
|
|
}
|
|
);
|
|
);
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
);
|
|
@@ -137,6 +144,10 @@ selectAll() {
|
|
return item.selected == true;
|
|
return item.selected == true;
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ ngOnDestroy() {
|
|
|
|
+ this.subscriptionVar.unsubscribe();
|
|
|
|
+ }
|
|
|
|
|
|
onSubmit(){
|
|
onSubmit(){
|
|
const employeesIds = [];
|
|
const employeesIds = [];
|
|
@@ -194,11 +205,5 @@ selectAll() {
|
|
}
|
|
}
|
|
this.checkSaveDisabled = false;
|
|
this.checkSaveDisabled = false;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|