|
|
|
|
@ -5,6 +5,7 @@ import { AuthenticationService } from 'src/app/hmg-common/services/authenticatio
|
|
|
|
|
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
|
|
|
|
|
import { MyTeamService } from '../service/my-team.service';
|
|
|
|
|
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
|
|
|
|
|
import { AnyARecord } from 'dns';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-employee-hierarchy',
|
|
|
|
|
@ -16,6 +17,7 @@ export class EmployeeHierarchyComponent implements OnInit {
|
|
|
|
|
public hierarchyData: any;
|
|
|
|
|
public subordinateHierarchyList: any;
|
|
|
|
|
public supervisorHierarchyList: any;
|
|
|
|
|
public currentEmployee: any;
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
@ -26,7 +28,13 @@ export class EmployeeHierarchyComponent implements OnInit {
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.getProfile();
|
|
|
|
|
this.currentEmployee = this.common.sharedService.getSharedData('employee-hierarchy', false);
|
|
|
|
|
if (!this.currentEmployee) {
|
|
|
|
|
this.getProfile();
|
|
|
|
|
} else {
|
|
|
|
|
this.personalInfo = this.currentEmployee;
|
|
|
|
|
this.getEmployeeHierachy();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getProfile() {
|
|
|
|
|
@ -38,6 +46,12 @@ export class EmployeeHierarchyComponent implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public filterArrayOnLVL(incomingArray: any) {
|
|
|
|
|
return incomingArray.filter(a => {
|
|
|
|
|
return a.LVL != 1;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getEmployeeHierachy() {
|
|
|
|
|
const body = {
|
|
|
|
|
P_SELECTED_EMPLOYEE_NUMBER: this.personalInfo.EMPLOYEE_NUMBER,
|
|
|
|
|
@ -47,12 +61,22 @@ export class EmployeeHierarchyComponent implements OnInit {
|
|
|
|
|
this.myTeamService.getEmployeeHierachy(body).subscribe((result: any) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.hierarchyData = result.SupervisorHierarchyLists;
|
|
|
|
|
this.subordinateHierarchyList = this.hierarchyData.SubordinateHierarchyList;
|
|
|
|
|
let rawSupervisorHierarchyList = this.hierarchyData.SupervisorHierarchyList;
|
|
|
|
|
this.supervisorHierarchyList = rawSupervisorHierarchyList.reverse();
|
|
|
|
|
|
|
|
|
|
let serverSubordinateData = this.hierarchyData.SubordinateHierarchyList;
|
|
|
|
|
this.subordinateHierarchyList = this.filterArrayOnLVL(serverSubordinateData);
|
|
|
|
|
|
|
|
|
|
let serverSupervisorHierarchyList = this.hierarchyData.SupervisorHierarchyList;
|
|
|
|
|
let serverSupervisorData = serverSupervisorHierarchyList.reverse();
|
|
|
|
|
this.supervisorHierarchyList = this.filterArrayOnLVL(serverSupervisorData);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getDetails(i: any) {
|
|
|
|
|
console.log(i);
|
|
|
|
|
this.common.sharedService.setSharedData(i, 'employee-hierarchy');
|
|
|
|
|
this.cs.openEmployeeHierarchy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|