|
|
|
|
@ -1,35 +1,36 @@
|
|
|
|
|
import { Component, OnInit,ViewChild } from "@angular/core";
|
|
|
|
|
import { Location } from "@angular/common";
|
|
|
|
|
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
|
|
|
|
|
import { CommonService } from "src/app/hmg-common/services/common/common.service";
|
|
|
|
|
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
|
|
|
|
|
import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response";
|
|
|
|
|
import { MyTeamService } from "../service/my-team.service";
|
|
|
|
|
import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service";
|
|
|
|
|
import { ModalController } from "@ionic/angular";
|
|
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
|
|
|
import { Location } from '@angular/common';
|
|
|
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
|
|
|
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
|
|
|
|
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
|
|
|
|
|
import { MyTeamService } from '../service/my-team.service';
|
|
|
|
|
import { MenuService } from 'src/app/hmg-common/services/menu/menuservice.service';
|
|
|
|
|
import { ModalController } from '@ionic/angular';
|
|
|
|
|
import { IonInfiniteScroll } from '@ionic/angular';
|
|
|
|
|
@Component({
|
|
|
|
|
selector: "app-details",
|
|
|
|
|
templateUrl: "./details.component.html",
|
|
|
|
|
styleUrls: ["./details.component.scss"]
|
|
|
|
|
selector: 'app-details',
|
|
|
|
|
templateUrl: './details.component.html',
|
|
|
|
|
styleUrls: ['./details.component.scss']
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export class DetailsComponent implements OnInit {
|
|
|
|
|
public static opendEmployeesARR='opend_employees_arr';
|
|
|
|
|
public static opendEmployeesARR = 'opend_employees_arr';
|
|
|
|
|
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
|
|
|
|
pageNum: number = 1;
|
|
|
|
|
pageLimit: number = 50;
|
|
|
|
|
public activeSegment = 'About';
|
|
|
|
|
pageNum = 1;
|
|
|
|
|
pageLimit = 50;
|
|
|
|
|
modalFlag: any = false;
|
|
|
|
|
empSubordinate: any;
|
|
|
|
|
employee: any;
|
|
|
|
|
IsReachEnd: boolean = false;
|
|
|
|
|
IsReachEnd = false;
|
|
|
|
|
searchKey: any;
|
|
|
|
|
public searchKeySelect: any;
|
|
|
|
|
infiniteRequest: any;
|
|
|
|
|
isSpecialist: boolean = false;
|
|
|
|
|
isSpecialist = false;
|
|
|
|
|
selMenu: MenuResponse = new MenuResponse();
|
|
|
|
|
public opendEmployees :any=[];
|
|
|
|
|
public headerTitle: string = "";
|
|
|
|
|
public opendEmployees: any = [];
|
|
|
|
|
public headerTitle = '';
|
|
|
|
|
public userImage: any = '../assets/imgs/profile.png';
|
|
|
|
|
constructor(
|
|
|
|
|
public menuService: MenuService,
|
|
|
|
|
@ -39,58 +40,48 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
public modalController: ModalController,
|
|
|
|
|
private location: Location,
|
|
|
|
|
public authService: AuthenticationService,
|
|
|
|
|
) {
|
|
|
|
|
console.log("Constuctor called");
|
|
|
|
|
}
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
// this.intializeMemberDetail();
|
|
|
|
|
this.intializeMemberDetail();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public segmentChanged(event: any) {
|
|
|
|
|
console.log(event);
|
|
|
|
|
this.activeSegment = event.detail.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
intializeMemberDetail(userID?){
|
|
|
|
|
|
|
|
|
|
intializeMemberDetail(userID?) {
|
|
|
|
|
this.pageLimit = 50;
|
|
|
|
|
this.pageNum = 1;
|
|
|
|
|
this.employee = this.common.sharedService.getSharedData(
|
|
|
|
|
MyTeamService.EMPLOYEE_SHARED_DATA,
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
let employees = this.common.sharedService.getSharedData( DetailsComponent.opendEmployeesARR, false);
|
|
|
|
|
if( employees ){
|
|
|
|
|
this.employee = this.common.sharedService.getSharedData(MyTeamService.EMPLOYEE_SHARED_DATA, false);
|
|
|
|
|
const employees = this.common.sharedService.getSharedData( DetailsComponent.opendEmployeesARR, false);
|
|
|
|
|
if ( employees ) {
|
|
|
|
|
this.opendEmployees.push(this.employee);
|
|
|
|
|
this.common.sharedService.setSharedData(this.opendEmployees, DetailsComponent.opendEmployeesARR);
|
|
|
|
|
}
|
|
|
|
|
//this.opendEmployees = employees;
|
|
|
|
|
|
|
|
|
|
console.log(this.employee);
|
|
|
|
|
this.selMenu = this.common.sharedService.getSharedData(
|
|
|
|
|
MenuResponse.SHARED_DATA,
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
this.headerTitle = this.selMenu.List_Menu.MENU_NAME;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.isSpecialist = this.common.sharedService.getSharedData(
|
|
|
|
|
'isSpecialist',
|
|
|
|
|
false
|
|
|
|
|
) ? true :false;
|
|
|
|
|
this.headerTitle = this.selMenu.List_Menu.MENU_NAME;
|
|
|
|
|
|
|
|
|
|
// this.isSpecialist = this.navParams.get("isSpecialist")
|
|
|
|
|
// ? this.navParams.get("isSpecialist")
|
|
|
|
|
// : false;
|
|
|
|
|
this.isSpecialist = this.common.sharedService.getSharedData('isSpecialist', false) ? true : false;
|
|
|
|
|
|
|
|
|
|
if (this.employee) this.getEmpSubordinate(userID);
|
|
|
|
|
if (this.employee) {
|
|
|
|
|
this.getEmpSubordinate(userID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
goback() {
|
|
|
|
|
//this.location.back();
|
|
|
|
|
const user = this.authService.getAuthenticatedUser();
|
|
|
|
|
if(this.employee.SUPERVISOR_NUMBER==user.EMPLOYEE_NUMBER || this.opendEmployees.length == 1){
|
|
|
|
|
this.opendEmployees=[];
|
|
|
|
|
if (this.employee.SUPERVISOR_NUMBER === user.EMPLOYEE_NUMBER || this.opendEmployees.length == 1){
|
|
|
|
|
this.opendEmployees = [];
|
|
|
|
|
this.common.openMyTeamPage();
|
|
|
|
|
}else{
|
|
|
|
|
for(let i=0;i<this.opendEmployees.length;i++){
|
|
|
|
|
if(this.opendEmployees[i].EMPLOYEE_NUMBER==this.employee.SUPERVISOR_NUMBER){
|
|
|
|
|
} else {
|
|
|
|
|
for (let i = 0; i < this.opendEmployees.length; i++){
|
|
|
|
|
if (this.opendEmployees[i].EMPLOYEE_NUMBER === this.employee.SUPERVISOR_NUMBER) {
|
|
|
|
|
this.common.sharedService.setSharedData(
|
|
|
|
|
this.opendEmployees[i],
|
|
|
|
|
MyTeamService.EMPLOYEE_SHARED_DATA
|
|
|
|
|
@ -101,50 +92,51 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
this.intializeMemberDetail(this.employee.SUPERVISOR_NUMBER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getEmpSubordinate(userID) {
|
|
|
|
|
this.modalFlag = this.employee.isModal;
|
|
|
|
|
let selEmpNo: string = null;
|
|
|
|
|
this.pageNum = 1;
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
let searchEmpNum = "";
|
|
|
|
|
let searchEmpName = "";
|
|
|
|
|
let searchEmpEmail = "";
|
|
|
|
|
let searchEmpNum = '';
|
|
|
|
|
let searchEmpName = '';
|
|
|
|
|
let searchEmpEmail = '';
|
|
|
|
|
if (this.searchKey) {
|
|
|
|
|
switch (this.searchKeySelect) {
|
|
|
|
|
case "1": {
|
|
|
|
|
case '1': {
|
|
|
|
|
searchEmpName = this.searchKey;
|
|
|
|
|
searchEmpNum = "";
|
|
|
|
|
searchEmpEmail = "";
|
|
|
|
|
searchEmpNum = '';
|
|
|
|
|
searchEmpEmail = '';
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "2": {
|
|
|
|
|
case '2': {
|
|
|
|
|
searchEmpNum = this.searchKey;
|
|
|
|
|
searchEmpName = "";
|
|
|
|
|
searchEmpEmail = "";
|
|
|
|
|
searchEmpName = '';
|
|
|
|
|
searchEmpEmail = '';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "3": {
|
|
|
|
|
case '3': {
|
|
|
|
|
searchEmpEmail = this.searchKey;
|
|
|
|
|
searchEmpNum = "";
|
|
|
|
|
searchEmpName = "";
|
|
|
|
|
searchEmpNum = '';
|
|
|
|
|
searchEmpName = '';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
searchEmpNum = "";
|
|
|
|
|
searchEmpName = "";
|
|
|
|
|
searchEmpEmail = "";
|
|
|
|
|
searchEmpNum = '';
|
|
|
|
|
searchEmpName = '';
|
|
|
|
|
searchEmpEmail = '';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
searchEmpNum = "";
|
|
|
|
|
searchEmpName = "";
|
|
|
|
|
searchEmpEmail = "";
|
|
|
|
|
searchEmpNum = '';
|
|
|
|
|
searchEmpName = '';
|
|
|
|
|
searchEmpEmail = '';
|
|
|
|
|
}
|
|
|
|
|
if(userID){
|
|
|
|
|
selEmpNo=userID;
|
|
|
|
|
}else{
|
|
|
|
|
if (userID) {
|
|
|
|
|
selEmpNo = userID;
|
|
|
|
|
} else {
|
|
|
|
|
selEmpNo = this.employee.EMPLOYEE_NUMBER;
|
|
|
|
|
}
|
|
|
|
|
const body = {
|
|
|
|
|
@ -164,17 +156,14 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleEmpResult(result) {
|
|
|
|
|
//let employeeSubordinate=resFlag.GetEmployeeSubordinatesList;
|
|
|
|
|
//this.nav.push("MyTeamPage",{empSubordinate:employeeSubordinate});
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
if (this.common.hasData(result.GetEmployeeSubordinatesList)) {
|
|
|
|
|
this.empSubordinate = result.GetEmployeeSubordinatesList;
|
|
|
|
|
// this.pageNum++;
|
|
|
|
|
this.infiniteRequest.P_PAGE_NUM= this.pageNum++;
|
|
|
|
|
let lastItemIndex = this.empSubordinate.length - 1;
|
|
|
|
|
this.infiniteRequest.P_PAGE_NUM = this.pageNum++;
|
|
|
|
|
const lastItemIndex = this.empSubordinate.length - 1;
|
|
|
|
|
if (result.GetEmployeeSubordinatesList[lastItemIndex]) {
|
|
|
|
|
let lastitem = result.GetEmployeeSubordinatesList[lastItemIndex];
|
|
|
|
|
if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) {
|
|
|
|
|
const lastitem = result.GetEmployeeSubordinatesList[lastItemIndex];
|
|
|
|
|
if (lastitem.NO_OF_ROWS === lastitem.ROW_NUM) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
@ -187,86 +176,74 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
doInfinite(infiniteScroll) {
|
|
|
|
|
if (!this.IsReachEnd && this.infiniteRequest) {
|
|
|
|
|
// this.infiniteRequest.P_PAGE_NUM = this.pageNum;
|
|
|
|
|
this.myTeamService
|
|
|
|
|
.getEmployeeSubordinates(this.infiniteRequest)
|
|
|
|
|
.subscribe(
|
|
|
|
|
(result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.infiniteRequest.P_PAGE_NUM= this.pageNum++;
|
|
|
|
|
this.infiniteRequest.P_PAGE_NUM = this.pageNum++;
|
|
|
|
|
|
|
|
|
|
if (this.common.hasData(result.GetEmployeeSubordinatesList)) {
|
|
|
|
|
result.GetEmployeeSubordinatesList.forEach(vr => {
|
|
|
|
|
if (vr.ROW_NUM == vr.NO_OF_ROWS) {
|
|
|
|
|
if (vr.ROW_NUM === vr.NO_OF_ROWS) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
}
|
|
|
|
|
this.empSubordinate.push(vr);
|
|
|
|
|
// this.pro.GetVacationRulesList.push(vr);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//this.P_PAGE_NUM++;
|
|
|
|
|
if (infiniteScroll) this.infiniteScroll.complete();
|
|
|
|
|
|
|
|
|
|
// console.log(resFlag);
|
|
|
|
|
if (infiniteScroll) { this.infiniteScroll.complete(); }
|
|
|
|
|
},
|
|
|
|
|
Error => console.log(Error),
|
|
|
|
|
() => this.infiniteScroll.complete()
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
if (infiniteScroll) this.infiniteScroll.complete();
|
|
|
|
|
if (infiniteScroll) { this.infiniteScroll.complete(); }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getDetails(index) {
|
|
|
|
|
//this.empSubordinate[index].isModal = true;
|
|
|
|
|
this.common.sharedService.setSharedData(
|
|
|
|
|
this.empSubordinate[index],
|
|
|
|
|
MyTeamService.EMPLOYEE_SHARED_DATA
|
|
|
|
|
);
|
|
|
|
|
this.intializeMemberDetail();
|
|
|
|
|
// this.presentModal();
|
|
|
|
|
}
|
|
|
|
|
async presentModal() {
|
|
|
|
|
//this.modalFlag = true;
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: DetailsComponent,
|
|
|
|
|
keyboardClose: true,
|
|
|
|
|
animated: false
|
|
|
|
|
});
|
|
|
|
|
let dismissed = modal.onDidDismiss();
|
|
|
|
|
const dismissed = modal.onDidDismiss();
|
|
|
|
|
dismissed.then(() => {
|
|
|
|
|
this.modalFlag = false;
|
|
|
|
|
});
|
|
|
|
|
return await modal.present();
|
|
|
|
|
}
|
|
|
|
|
getMenuEntries(item) {
|
|
|
|
|
let selEmpNo: String = null;
|
|
|
|
|
let respID: any = -999;
|
|
|
|
|
let menuType: string = "M";
|
|
|
|
|
let selEmpNo = null;
|
|
|
|
|
const respID: any = -999;
|
|
|
|
|
let menuType = 'M';
|
|
|
|
|
let nationality: string;
|
|
|
|
|
if (this.isSpecialist == true) {
|
|
|
|
|
// respID = this.sharedData.getSharedData(
|
|
|
|
|
// MenuResponse.SHARED_SEL_RESP_ID,
|
|
|
|
|
// true
|
|
|
|
|
// );
|
|
|
|
|
menuType = "S";
|
|
|
|
|
if (this.isSpecialist === true) {
|
|
|
|
|
menuType = 'S';
|
|
|
|
|
}
|
|
|
|
|
selEmpNo = item.EMPLOYEE_NUMBER;
|
|
|
|
|
nationality = item.NATIONALITY_CODE;
|
|
|
|
|
|
|
|
|
|
const body = {
|
|
|
|
|
P_MENU_TYPE: menuType, //to check
|
|
|
|
|
P_MENU_TYPE: menuType, // to check
|
|
|
|
|
P_SELECTED_EMPLOYEE_NUMBER: selEmpNo,
|
|
|
|
|
P_SELECTED_RESP_ID: respID,
|
|
|
|
|
NationalityCode: nationality
|
|
|
|
|
};
|
|
|
|
|
//set emp and resp id
|
|
|
|
|
this.common.sharedService.setSharedData(selEmpNo, MenuResponse.SHARED_SEL_EMP);
|
|
|
|
|
this.common.sharedService.setSharedData(
|
|
|
|
|
// set emp and resp id
|
|
|
|
|
this.common.sharedService.setSharedData(selEmpNo, MenuResponse.SHARED_SEL_EMP);
|
|
|
|
|
this.common.sharedService.setSharedData(
|
|
|
|
|
body.P_SELECTED_RESP_ID,
|
|
|
|
|
MenuResponse.SHARED_SEL_RESP_ID
|
|
|
|
|
);
|
|
|
|
|
@ -286,12 +263,9 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
sortMenuEntires(list) {
|
|
|
|
|
this.close().then(() => {
|
|
|
|
|
});
|
|
|
|
|
let tree = this.common.list_to_tree(list);
|
|
|
|
|
this.common.sharedService.setSharedData(tree, "menuEntries");
|
|
|
|
|
// this.common.navigateForward("/eit/homepage");
|
|
|
|
|
const tree = this.common.list_to_tree(list);
|
|
|
|
|
this.common.sharedService.setSharedData(tree, 'menuEntries');
|
|
|
|
|
this.common.openEITPage();
|
|
|
|
|
// let tree = this.common.list_to_tree(list);
|
|
|
|
|
// this.navCtrl.push("MenuEntriesPage", { menuEntries: tree });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async close() {
|
|
|
|
|
@ -301,14 +275,13 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
goToSubordinate() {
|
|
|
|
|
this.selMenu.search=true;
|
|
|
|
|
this.selMenu.search = true;
|
|
|
|
|
this.common.sharedService.setSharedData(
|
|
|
|
|
this.selMenu,
|
|
|
|
|
MenuResponse.SHARED_DATA
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.common.openMyTeamPage();
|
|
|
|
|
//this.navCtrl.push("MySubordinatePage", { isSearch: true });
|
|
|
|
|
}
|
|
|
|
|
dismiss() {
|
|
|
|
|
this.modalController.dismiss({
|
|
|
|
|
|