|
|
|
|
@ -20,18 +20,59 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
public activeSegment = 'About';
|
|
|
|
|
pageNum = 1;
|
|
|
|
|
pageLimit = 50;
|
|
|
|
|
modalFlag: any = false;
|
|
|
|
|
empSubordinate: any;
|
|
|
|
|
employee: any;
|
|
|
|
|
IsReachEnd = false;
|
|
|
|
|
isReachEnd = false;
|
|
|
|
|
searchKey: any;
|
|
|
|
|
public searchKeySelect: any;
|
|
|
|
|
public isSearch = false;
|
|
|
|
|
public searchKeySelect = 'Name';
|
|
|
|
|
public getEmployeeSubordinatesRequestObject: any;
|
|
|
|
|
infiniteRequest: any;
|
|
|
|
|
isSpecialist = false;
|
|
|
|
|
selMenu: MenuResponse = new MenuResponse();
|
|
|
|
|
public opendEmployees: any = [];
|
|
|
|
|
public headerTitle = '';
|
|
|
|
|
public userImage: any = '../assets/imgs/profile.png';
|
|
|
|
|
|
|
|
|
|
public filters = [
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'All',
|
|
|
|
|
active: true,
|
|
|
|
|
color: '#124375'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'Present',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#18a169'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'Absent',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#38c9b3'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'Late',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#114475'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public slideOptsOne = {
|
|
|
|
|
slidesPerView: 4,
|
|
|
|
|
spaceBetween: 10
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public previousActiveIndex = 0;
|
|
|
|
|
public currentActiveIndex = 0;
|
|
|
|
|
public searchNameOrUserName = '';
|
|
|
|
|
public searchEmail = '';
|
|
|
|
|
public showEmailInput = false;
|
|
|
|
|
public showUserNameOrNameInput = true;
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public menuService: MenuService,
|
|
|
|
|
public common: CommonService,
|
|
|
|
|
@ -47,11 +88,12 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public segmentChanged(event: any) {
|
|
|
|
|
console.log(event);
|
|
|
|
|
this.activeSegment = event.detail.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
intializeMemberDetail(userID?) {
|
|
|
|
|
this.empSubordinate = [];
|
|
|
|
|
this.activeSegment = 'About';
|
|
|
|
|
this.pageLimit = 50;
|
|
|
|
|
this.pageNum = 1;
|
|
|
|
|
this.employee = this.common.sharedService.getSharedData(MyTeamService.EMPLOYEE_SHARED_DATA, false);
|
|
|
|
|
@ -60,14 +102,9 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
this.opendEmployees.push(this.employee);
|
|
|
|
|
this.common.sharedService.setSharedData(this.opendEmployees, DetailsComponent.opendEmployeesARR);
|
|
|
|
|
}
|
|
|
|
|
this.selMenu = this.common.sharedService.getSharedData(
|
|
|
|
|
MenuResponse.SHARED_DATA,
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
if (this.employee) {
|
|
|
|
|
this.getEmpSubordinate(userID);
|
|
|
|
|
}
|
|
|
|
|
@ -76,11 +113,12 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
goback() {
|
|
|
|
|
const user = this.authService.getAuthenticatedUser();
|
|
|
|
|
if (this.employee.SUPERVISOR_NUMBER === user.EMPLOYEE_NUMBER || this.opendEmployees.length == 1){
|
|
|
|
|
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++){
|
|
|
|
|
// tslint:disable-next-line: prefer-for-of
|
|
|
|
|
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],
|
|
|
|
|
@ -93,47 +131,30 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchEmployeeTwo() {
|
|
|
|
|
console.log('umar 1999');
|
|
|
|
|
this.isSearch = true;
|
|
|
|
|
this.empSubordinate = [];
|
|
|
|
|
this.getEmpSubordinate('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clearSearchTwo() {
|
|
|
|
|
this.isSearch = false;
|
|
|
|
|
this.getEmployeeSubordinatesRequestObject.P_PAGE_NUM = 1;
|
|
|
|
|
this.empSubordinate = [];
|
|
|
|
|
this.isReachEnd = false;
|
|
|
|
|
this.searchNameOrUserName = '';
|
|
|
|
|
this.searchEmail = '';
|
|
|
|
|
this.getEmpSubordinate('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getEmpSubordinate(userID) {
|
|
|
|
|
this.modalFlag = this.employee.isModal;
|
|
|
|
|
let selEmpNo: string = null;
|
|
|
|
|
this.pageNum = 1;
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
let searchEmpNum = '';
|
|
|
|
|
let searchEmpName = '';
|
|
|
|
|
let searchEmpEmail = '';
|
|
|
|
|
if (this.searchKey) {
|
|
|
|
|
switch (this.searchKeySelect) {
|
|
|
|
|
case '1': {
|
|
|
|
|
searchEmpName = this.searchKey;
|
|
|
|
|
searchEmpNum = '';
|
|
|
|
|
searchEmpEmail = '';
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '2': {
|
|
|
|
|
searchEmpNum = this.searchKey;
|
|
|
|
|
searchEmpName = '';
|
|
|
|
|
searchEmpEmail = '';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case '3': {
|
|
|
|
|
searchEmpEmail = this.searchKey;
|
|
|
|
|
searchEmpNum = '';
|
|
|
|
|
searchEmpName = '';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
searchEmpNum = '';
|
|
|
|
|
searchEmpName = '';
|
|
|
|
|
searchEmpEmail = '';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
searchEmpNum = '';
|
|
|
|
|
searchEmpName = '';
|
|
|
|
|
searchEmpEmail = '';
|
|
|
|
|
}
|
|
|
|
|
this.isReachEnd = false;
|
|
|
|
|
const searchEmpNum = (this.searchKeySelect === 'User Name') ? this.searchNameOrUserName : '';
|
|
|
|
|
const searchEmpName = (this.searchKeySelect === 'Name') ? this.searchNameOrUserName : '';
|
|
|
|
|
const searchEmpEmail = (this.searchKeySelect === 'Email') ? this.searchEmail : '';
|
|
|
|
|
if (userID) {
|
|
|
|
|
selEmpNo = userID;
|
|
|
|
|
} else {
|
|
|
|
|
@ -147,83 +168,64 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
P_PAGE_NUM: this.pageNum,
|
|
|
|
|
P_PAGE_LIMIT: this.pageLimit
|
|
|
|
|
};
|
|
|
|
|
this.infiniteRequest = body;
|
|
|
|
|
this.myTeamService
|
|
|
|
|
.getEmployeeSubordinates(body)
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
this.handleEmpResult(result);
|
|
|
|
|
});
|
|
|
|
|
this.getEmployeeSubordinatesRequestObject = body;
|
|
|
|
|
this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => {
|
|
|
|
|
console.log('one');
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.handleEmpResult(result.GetEmployeeSubordinatesList);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleEmpResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
if (this.common.hasData(result.GetEmployeeSubordinatesList)) {
|
|
|
|
|
this.empSubordinate = result.GetEmployeeSubordinatesList;
|
|
|
|
|
this.infiniteRequest.P_PAGE_NUM = this.pageNum++;
|
|
|
|
|
const lastItemIndex = this.empSubordinate.length - 1;
|
|
|
|
|
if (result.GetEmployeeSubordinatesList[lastItemIndex]) {
|
|
|
|
|
const lastitem = result.GetEmployeeSubordinatesList[lastItemIndex];
|
|
|
|
|
if (lastitem.NO_OF_ROWS === lastitem.ROW_NUM) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
}
|
|
|
|
|
const lastItemIndex = result.length - 1;
|
|
|
|
|
const lastItem = result[lastItemIndex];
|
|
|
|
|
if (lastItem) {
|
|
|
|
|
if (lastItem.NO_OF_ROWS === lastItem.ROW_NUM) {
|
|
|
|
|
this.isReachEnd = true;
|
|
|
|
|
if (this.infiniteScroll) {
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.empSubordinate = [];
|
|
|
|
|
this.isReachEnd = false;
|
|
|
|
|
if (this.infiniteScroll) {
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
doInfinite(infiniteScroll) {
|
|
|
|
|
if (!this.IsReachEnd && this.infiniteRequest) {
|
|
|
|
|
this.myTeamService
|
|
|
|
|
.getEmployeeSubordinates(this.infiniteRequest)
|
|
|
|
|
.subscribe(
|
|
|
|
|
(result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
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) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
}
|
|
|
|
|
this.empSubordinate.push(vr);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (infiniteScroll) { this.infiniteScroll.complete(); }
|
|
|
|
|
},
|
|
|
|
|
Error => console.log(Error),
|
|
|
|
|
() => this.infiniteScroll.complete()
|
|
|
|
|
);
|
|
|
|
|
if (this.common.hasData(result)) {
|
|
|
|
|
this.getEmployeeSubordinatesRequestObject.P_PAGE_NUM++;
|
|
|
|
|
if (this.empSubordinate.length === 0) {
|
|
|
|
|
this.empSubordinate = result;
|
|
|
|
|
} else {
|
|
|
|
|
this.empSubordinate = this.empSubordinate.concat(result);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (infiniteScroll) { this.infiniteScroll.complete(); }
|
|
|
|
|
this.empSubordinate = [];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
doInfinite(infiniteScroll) {
|
|
|
|
|
if (!this.isReachEnd) {
|
|
|
|
|
this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => {
|
|
|
|
|
console.log('two');
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.handleEmpResult(result.GetEmployeeSubordinatesList);
|
|
|
|
|
}
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (this.infiniteScroll) {
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDetails(index) {
|
|
|
|
|
this.common.sharedService.setSharedData(
|
|
|
|
|
this.empSubordinate[index],
|
|
|
|
|
MyTeamService.EMPLOYEE_SHARED_DATA
|
|
|
|
|
);
|
|
|
|
|
this.common.sharedService.setSharedData(this.empSubordinate[index], MyTeamService.EMPLOYEE_SHARED_DATA);
|
|
|
|
|
this.intializeMemberDetail();
|
|
|
|
|
}
|
|
|
|
|
async presentModal() {
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: DetailsComponent,
|
|
|
|
|
keyboardClose: true,
|
|
|
|
|
animated: false
|
|
|
|
|
});
|
|
|
|
|
const dismissed = modal.onDidDismiss();
|
|
|
|
|
dismissed.then(() => {
|
|
|
|
|
this.modalFlag = false;
|
|
|
|
|
});
|
|
|
|
|
return await modal.present();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getMenuEntries(item) {
|
|
|
|
|
let selEmpNo = null;
|
|
|
|
|
const respID: any = -999;
|
|
|
|
|
@ -261,19 +263,11 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sortMenuEntires(list) {
|
|
|
|
|
this.close().then(() => {
|
|
|
|
|
});
|
|
|
|
|
const tree = this.common.list_to_tree(list);
|
|
|
|
|
this.common.sharedService.setSharedData(tree, 'menuEntries');
|
|
|
|
|
this.common.openEITPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async close() {
|
|
|
|
|
const modal = await this.modalController.getTop();
|
|
|
|
|
if (modal) {
|
|
|
|
|
modal.dismiss();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
goToSubordinate() {
|
|
|
|
|
this.selMenu.search = true;
|
|
|
|
|
this.common.sharedService.setSharedData(
|
|
|
|
|
@ -283,9 +277,14 @@ export class DetailsComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
this.common.openMyTeamPage();
|
|
|
|
|
}
|
|
|
|
|
dismiss() {
|
|
|
|
|
this.modalController.dismiss({
|
|
|
|
|
dismissed: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
showSelectedField(value: any) {
|
|
|
|
|
if (this.searchKeySelect === 'User Name' || this.searchKeySelect === 'User Name') {
|
|
|
|
|
this.showEmailInput = false;
|
|
|
|
|
this.showUserNameOrNameInput = true;
|
|
|
|
|
} else if (this.searchKeySelect === 'Email') {
|
|
|
|
|
this.showUserNameOrNameInput = false;
|
|
|
|
|
this.showEmailInput = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|