added about data for team member

myteam
umasoodch 6 years ago
parent 6eeca7479d
commit 93e59d2618

@ -1109,6 +1109,9 @@ public getMonthNameAr(value: number): string {
public openMyTeamPage() { public openMyTeamPage() {
this.nav.navigateForward(['/my-team/home']); this.nav.navigateForward(['/my-team/home']);
} }
public openMyTeamDetailPage() {
this.nav.navigateForward(['/my-team/details']);
}
public openPage(link: string) { public openPage(link: string) {
this.nav.navigateForward([link]); this.nav.navigateForward([link]);

@ -45,10 +45,19 @@
font-size: 18px; font-size: 18px;
color: black; color: black;
margin: 0; margin: 0;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
} }
.title{ .title{
font-size: 15px; font-size: 15px;
color: #888; color: #888;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: block;
} }
} }
.image-container{ .image-container{

@ -49,47 +49,69 @@
</div> </div>
</div> </div>
<div class="emplyee-information-indetail"> <div class="segments-container">
<ion-segment
(ionChange)="segmentChanged($event)"
[value]="activeSegment">
<ion-segment-button
value="Attendance"
[ngClass]="activeSegment == 'Attendance' ? 'active-Segment' : 'normal-Segment'" >
<ion-label>Attendance</ion-label>
</ion-segment-button>
<ion-segment-button
value="Team Members"
[ngClass]="activeSegment == 'Team Members' ? 'active-Segment' : 'normal-Segment'">
<ion-label>Team Members</ion-label>
</ion-segment-button>
<ion-segment-button
value="About"
[ngClass]="activeSegment == 'About' ? 'active-Segment' : 'normal-Segment'">
<ion-label>About</ion-label>
</ion-segment-button>
</ion-segment>
</div>
<div class="employee-information-indetail" *ngIf="activeSegment === 'About'">
<ion-row> <ion-row>
<ion-col [size]="6"> <ion-col [size]="6" style="border-right: 1px solid #ccc;">
<h2>Employee</h2> <h2>Employee ID</h2>
<p>197400</p> <p>{{employee.EMPLOYEE_NUMBER}}</p>
</ion-col> </ion-col>
<ion-col [size]="6"> <ion-col [size]="6">
<h2>Category</h2> <h2>Category</h2>
<p>Permanent</p> <p>{{employee.EMPLOYMENT_CATEGORY_MEANING}}</p>
</ion-col> </ion-col>
<ion-col [size]="12"> <ion-col [size]="12">
<h2>Category</h2> <h2>Address</h2>
<p>Permanent</p> <p>{{employee.LOCATION_NAME}}</p>
</ion-col> </ion-col>
<ion-col [size]="12"> <ion-col [size]="12">
<h2>Category</h2> <h2>Phone Number</h2>
<p>Permanent</p> <p>{{employee.EMPLOYEE_MOBILE_NUMBER}}</p>
</ion-col> </ion-col>
<ion-col [size]="12"> <ion-col [size]="12">
<h2>Category</h2> <h2>Business Group</h2>
<p>Permanent</p> <p>{{employee.ORGANIZATION_NAME}}</p>
</ion-col> </ion-col>
<ion-col [size]="12"> <ion-col [size]="12">
<h2>Category</h2> <h2>Job</h2>
<p>Permanent</p> <p>{{employee.JOB_NAME}}</p>
</ion-col> </ion-col>
<ion-col [size]="12"> <ion-col [size]="12">
<h2>Category</h2> <h2>Payroll</h2>
<p>Permanent</p> <p>{{employee.PAYROLL_NAME}}</p>
</ion-col> </ion-col>
<ion-col [size]="12"> <ion-col [size]="12">
<h2>Category</h2> <h2>Organization Email Address</h2>
<p>Permanent</p> <p>{{employee.EMPLOYEE_EMAIL_ADDRESS}}</p>
</ion-col> </ion-col>
<ion-col [size]="12"> <ion-col [size]="12">
<h2>Category</h2> <h2>Position</h2>
<p>Permanent</p> <p>{{employee.POSITION_NAME}}</p>
</ion-col> </ion-col>
<ion-col [size]="12"> <ion-col [size]="12">
<h2>Category</h2> <h2>Grade</h2>
<p>Permanent</p> <p>{{employee.GRADE_NAME}}</p>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div> </div>

@ -107,8 +107,55 @@ ion-title{
} }
} }
} }
.emplyee-information-indetail{ .employee-information-indetail{
background: white; background: white;
margin-top: 50px; margin-top: 15px;
border-radius: 20px; border-radius: 20px;
} ion-col{
padding: 15px;
border-bottom: 1px solid #ccc;
}
h2{
font-size: 13px;
font-family: WorkSans-Bold;
margin: 0;
}
p{
font-size: 13px;
margin: 0;
}
}
.segments-container {
border-radius: 100px;
overflow: hidden;
margin-top: 15px;
background: white;
color: black;
}
.active-Segment {
font-size: 0.3cm !important;
background: #22c6b3 !important;
text-transform: none;
--color-checked: none;
border-radius: 100px;
}
.active-Segment ion-label{
font-size: 11px;
color: white !important;
}
.normal-Segment ion-label{
color: black !important;
font-size: 11px;
}
.normal-Segment {
font-size: 0.3cm !important;
text-transform: none;
--color-checked: none;
}
.colum-container{
padding: 15px;
border-bottom: 1px solid #ccc;
}

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

@ -48,11 +48,20 @@
<ion-input *ngIf="showEmailInput" placeholder="Employee Email" [(ngModel)]="searchEmail" pattern="email"></ion-input> <ion-input *ngIf="showEmailInput" placeholder="Employee Email" [(ngModel)]="searchEmail" pattern="email"></ion-input>
<ion-input *ngIf="showUserNameOrNameInput" placeholder="Search" [(ngModel)]="searchNameOrUserName"></ion-input> <ion-input *ngIf="showUserNameOrNameInput" placeholder="Search" [(ngModel)]="searchNameOrUserName"></ion-input>
</ion-col> </ion-col>
<ion-col [size]="2" style="background: #ccc;text-align: center;" no-padding> <ion-col [size]="2" style="background: #ccc;text-align: center;" no-padding (click)="searchEmployee()">
<ion-icon style="margin-top: 10px;font-size: 20px;" class="search-icons" color="light" name="search"></ion-icon> <ion-icon style="margin-top: 10px;font-size: 20px;" class="search-icons" color="light" name="search"></ion-icon>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div> </div>
<div *ngIf="isSearch">
<ion-row class="search-container">
<ion-col style="float: left;" size=[6] (click)="clearSearch()">
<span style="margin-left: 5px;">Clear Search</span>
<ion-icon name="close" ></ion-icon>
</ion-col>
</ion-row>
</div>
<ng-container *ngFor="let subordinate of empSubordinate;let i=index"> <ng-container *ngFor="let subordinate of empSubordinate;let i=index">
<app-employee-information <app-employee-information
@ -60,14 +69,15 @@
[title]="subordinate.POSITION_NAME" [title]="subordinate.POSITION_NAME"
[employeeImage]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'" [employeeImage]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'"
checkIn="08:15" checkIn="08:15"
checkOut="-"> checkOut="-"
(click)="getDetails(i)">
</app-employee-information> </app-employee-information>
</ng-container> </ng-container>
</div> </div>
<!-- <ion-infinite-scroll (ionInfinite)="doInfinite($event)"> <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content> <ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll> --> </ion-infinite-scroll>
</ion-content> </ion-content>

@ -141,3 +141,23 @@ ion-content {
border: 1px solid #ccc; border: 1px solid #ccc;
margin: 0px auto 6px; margin: 0px auto 6px;
} }
.search-container{
margin-top: 15px;
ion-col{
background: white;
border-radius: 12px;
padding-right: 10px;
flex: none;
ion-icon{
margin-right: 3px;
font-size: 14px;
margin-left: 3px;
vertical-align: middle;
}
span{
font-size: 12px;
vertical-align: middle;
}
}
}

@ -92,7 +92,7 @@ export class HomeComponent implements OnInit {
) {} ) {}
ngOnInit() { ngOnInit() {
// this.common.sharedService.setSharedData( [], DetailsComponent.opendEmployeesARR); this.common.sharedService.setSharedData( [], DetailsComponent.opendEmployeesARR);
this.setIntitial(); this.setIntitial();
} }
@ -117,8 +117,9 @@ export class HomeComponent implements OnInit {
} }
searchEmployee() { searchEmployee() {
// this.isSearch = true; this.isSearch = true;
// this.getEmpSubordinate(); this.empSubordinate = [];
this.getEmpSubordinate();
} }
getEmpSubordinate() { getEmpSubordinate() {
@ -130,6 +131,8 @@ export class HomeComponent implements OnInit {
if (this.isSearch) { if (this.isSearch) {
this.selEmpNo = null; this.selEmpNo = null;
} else {
this.selEmpNo = this.selMenu.userid;
} }
const body = { const body = {
@ -142,51 +145,44 @@ export class HomeComponent implements OnInit {
}; };
this.getEmployeeSubordinatesRequestObject = body; this.getEmployeeSubordinatesRequestObject = body;
this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => { this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => {
this.handleEmpResult(result); if (this.common.validResponse(result)) {
}); this.handleEmpResult(result.GetEmployeeSubordinatesList);
}
});
} }
handleEmpResult(result) { handleEmpResult(result) {
if (this.common.validResponse(result)) { const lastItemIndex = result.length - 1;
if (this.common.hasData(result.GetEmployeeSubordinatesList)) { const lastItem = result[lastItemIndex];
this.empSubordinate = result.GetEmployeeSubordinatesList; if (lastItem) {
if (lastItem.NO_OF_ROWS === lastItem.ROW_NUM) {
this.isReachEnd = true;
this.infiniteScroll.complete();
} else {
this.isReachEnd = false;
this.infiniteScroll.complete();
}
}
if (this.common.hasData(result)) {
this.getEmployeeSubordinatesRequestObject.P_PAGE_NUM++; this.getEmployeeSubordinatesRequestObject.P_PAGE_NUM++;
const lastItemIndex = this.empSubordinate.length - 1; if (this.empSubordinate.length === 0) {
if (result.GetEmployeeSubordinatesList[lastItemIndex]) { this.empSubordinate = result;
const lastitem = result.GetEmployeeSubordinatesList[lastItemIndex]; } else {
if (lastitem.NO_OF_ROWS === lastitem.ROW_NUM) { this.empSubordinate = this.empSubordinate.concat(result);
this.isReachEnd = true;
} else {
this.isReachEnd = false;
}
} }
} else { } else {
this.empSubordinate = []; this.empSubordinate = [];
} }
}
} }
doInfinite(infiniteScroll) { doInfinite(infiniteScroll) {
if (!this.isReachEnd) { if (!this.isReachEnd) {
this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => { this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
this.getEmployeeSubordinatesRequestObject.P_PAGE_NUM++; this.handleEmpResult(result.GetEmployeeSubordinatesList);
if (this.common.hasData(result.GetEmployeeSubordinatesList)) {
result.GetEmployeeSubordinatesList.forEach(element => {
if (element.ROW_NUM === element.NO_OF_ROWS) {
this.isReachEnd = true;
} else {
this.isReachEnd = false;
}
this.empSubordinate.push(element);
});
} else {
this.isReachEnd = true;
}
} }
this.infiniteScroll.complete(); this.infiniteScroll.complete();
} });
);
} else { } else {
if (this.infiniteScroll) { if (this.infiniteScroll) {
this.infiniteScroll.complete(); this.infiniteScroll.complete();
@ -194,12 +190,20 @@ export class HomeComponent implements OnInit {
} }
} }
clearSearch() {
this.isSearch = false;
this.getEmployeeSubordinatesRequestObject.P_PAGE_NUM = 1;
this.empSubordinate = [];
this.isReachEnd = false;
this.searchNameOrUserName = '';
this.searchEmail = '';
this.getEmpSubordinate();
}
getDetails(index) { 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.common.sharedService.setSharedData(this.selMenu, MenuResponse.SHARED_DATA); this.common.sharedService.setSharedData(this.selMenu, MenuResponse.SHARED_DATA);
// this.close().then(() => { this.common.openMyTeamDetailPage();
// this.common.openMyTeamDetails();
// });
} }
goToSubordinate() { goToSubordinate() {

@ -47,7 +47,6 @@
<ion-icon name="search" ></ion-icon> <ion-icon name="search" ></ion-icon>
<span>Advanced Search</span> <span>Advanced Search</span>
</ion-col> </ion-col>
</ion-row> </ion-row>
<div [ngClass]="isEmptyObject() ? 'work-list-container' : ''"> <div [ngClass]="isEmptyObject() ? 'work-list-container' : ''">

Loading…
Cancel
Save