My Subordinate Page implemented
parent
ae42645e6a
commit
22a11a3214
@ -0,0 +1,55 @@
|
|||||||
|
<ion-header>
|
||||||
|
<ion-toolbar class="header-toolbar">
|
||||||
|
<ion-title color="light">{{headerTitle}}</ion-title>
|
||||||
|
<ion-buttons slot="primary">
|
||||||
|
<ion-button style="background: none !important;" *ngIf="!isSearch" (click)="goToSubordinate()">
|
||||||
|
<ion-icon slot="icon-only" name="search"></ion-icon>
|
||||||
|
</ion-button>
|
||||||
|
</ion-buttons>
|
||||||
|
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
|
||||||
|
<ion-content padding>
|
||||||
|
|
||||||
|
<ion-list *ngIf="isSearch">
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>{{"general, search" | translate}} </ion-label>
|
||||||
|
<ion-select okText='{{"general, ok" | translate }}' cancelText='{{"general, cancel" | translate }}'
|
||||||
|
[(ngModel)]="searchKeySelect">
|
||||||
|
<ion-select-option value="1" selected="true">{{"searchForReplacment, name" | translate}}</ion-select-option>
|
||||||
|
<ion-select-option value="2">{{"searchForReplacment, userName" | translate}}</ion-select-option>
|
||||||
|
<ion-select-option value="3">{{"searchForReplacment, email" | translate}}</ion-select-option>
|
||||||
|
</ion-select>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item>
|
||||||
|
<ion-input [(ngModel)]="searchKey" placeholder='{{"general, enter" | translate}}'></ion-input>
|
||||||
|
</ion-item>
|
||||||
|
</ion-list>
|
||||||
|
<div>
|
||||||
|
<ion-list no-lines *ngIf="empSubordinate && empSubordinate.length>0">
|
||||||
|
<ion-item no-border *ngFor="let subordinate of empSubordinate;let i=index" (click)="getDetails(i);">
|
||||||
|
<ion-avatar item-start>
|
||||||
|
<!-- <img *ngIf="subordinate.EMPLOYEE_IMAGE" src="data:image/*;base64,{{ subordinate.EMPLOYEE_IMAGE}}"> -->
|
||||||
|
<img
|
||||||
|
[src]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'">
|
||||||
|
</ion-avatar>
|
||||||
|
<p class="boldTxt">{{subordinate.EMPLOYEE_NAME}}</p>
|
||||||
|
<p>{{subordinate.POSITION_NAME}}</p>
|
||||||
|
<ion-badge item-end>{{subordinate.NUM_OF_SUBORDINATES}}</ion-badge>
|
||||||
|
</ion-item>
|
||||||
|
</ion-list>
|
||||||
|
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
|
||||||
|
<ion-infinite-scroll-content></ion-infinite-scroll-content>
|
||||||
|
</ion-infinite-scroll>
|
||||||
|
</div>
|
||||||
|
</ion-content>
|
||||||
|
|
||||||
|
<ion-footer *ngIf="isSearch">
|
||||||
|
|
||||||
|
<div class="centerDiv">
|
||||||
|
<ion-button class="footer-button" color="customnavy" ion-button (click)="getEmpSubordinate()">
|
||||||
|
{{ 'general, search' | translate }}</ion-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ion-footer>
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { HomeComponent } from './home.component';
|
||||||
|
|
||||||
|
describe('HomeComponent', () => {
|
||||||
|
let component: HomeComponent;
|
||||||
|
let fixture: ComponentFixture<HomeComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ HomeComponent ],
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(HomeComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,170 @@
|
|||||||
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
|
||||||
|
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
|
||||||
|
import { MyTeamService } from 'src/app/my-team/service/my-team.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-home',
|
||||||
|
templateUrl: './home.component.html',
|
||||||
|
styleUrls: ['./home.component.scss'],
|
||||||
|
})
|
||||||
|
export class HomeComponent implements OnInit {
|
||||||
|
|
||||||
|
pageNum: number = 1;
|
||||||
|
pageLimit: number = 50;
|
||||||
|
empSubordinate: any;
|
||||||
|
employee: any;
|
||||||
|
public headerTitle: string = "";
|
||||||
|
IsReachEnd: boolean = false;
|
||||||
|
searchKey: any;
|
||||||
|
isSearch: boolean = false;
|
||||||
|
public searchKeySelect: any;
|
||||||
|
infiniteRequest: any;
|
||||||
|
selMenu: MenuResponse = new MenuResponse();
|
||||||
|
|
||||||
|
constructor(public cs: CommonService, public myTeamService: MyTeamService) {
|
||||||
|
this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, true);
|
||||||
|
this.headerTitle = this.selMenu.List_Menu.MENU_NAME;
|
||||||
|
this.isSearch = this.cs.sharedService.getSharedData("isSearch") ? this.cs.sharedService.getSharedData("isSearch") : false;
|
||||||
|
|
||||||
|
//this.employee
|
||||||
|
if (!this.isSearch)
|
||||||
|
this.getEmpSubordinate();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() { }
|
||||||
|
|
||||||
|
getEmpSubordinate() {
|
||||||
|
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 = "";
|
||||||
|
}
|
||||||
|
if (this.isSearch)
|
||||||
|
selEmpNo = null;
|
||||||
|
else
|
||||||
|
selEmpNo = this.cs.sharedService.getSharedData(LoginRequest.SHARED_DATA, true);
|
||||||
|
// this.employee=this.empSubordinate[index];
|
||||||
|
// selEmpNo=this.employee.EMPLOYEE_NUMBER;
|
||||||
|
const body = {
|
||||||
|
P_SELECTED_EMPLOYEE_NUMBER: selEmpNo,
|
||||||
|
P_SEARCH_EMPLOYEE_NUMBER: searchEmpNum,
|
||||||
|
P_SEARCH_EMPLOYEE_DISPLAY_NAME: searchEmpName,
|
||||||
|
P_SEARCH_EMAIL_ADDRESS: searchEmpEmail,
|
||||||
|
P_PAGE_NUM: this.pageNum,
|
||||||
|
P_PAGE_LIMIT: this.pageLimit
|
||||||
|
}
|
||||||
|
this.infiniteRequest = body;
|
||||||
|
this.myTeamService.getEmployeeSubordinates(body).
|
||||||
|
subscribe((result: any) => {
|
||||||
|
this.handleEmpResult(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleEmpResult(result) {
|
||||||
|
//let employeeSubordinate=resFlag.GetEmployeeSubordinatesList;
|
||||||
|
//this.nav.push("MyTeamPage",{empSubordinate:employeeSubordinate});
|
||||||
|
if (this.cs.validResponse(result)) {
|
||||||
|
if (this.cs.hasData(result.GetEmployeeSubordinatesList)) {
|
||||||
|
this.empSubordinate = result.GetEmployeeSubordinatesList;
|
||||||
|
this.pageNum++;
|
||||||
|
let lastItemIndex = this.empSubordinate.length - 1;
|
||||||
|
if (result.GetEmployeeSubordinatesList[lastItemIndex]) {
|
||||||
|
let lastitem = result.GetEmployeeSubordinatesList[lastItemIndex];
|
||||||
|
if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) {
|
||||||
|
this.IsReachEnd = true;
|
||||||
|
} else {
|
||||||
|
this.IsReachEnd = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.empSubordinate = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
doInfinite(infiniteScroll) {
|
||||||
|
if (!this.IsReachEnd && this.infiniteRequest) {
|
||||||
|
|
||||||
|
this.infiniteRequest.P_PAGE_NUM = this.pageNum;
|
||||||
|
this.myTeamService.getEmployeeSubordinates(this.infiniteRequest).
|
||||||
|
subscribe((result: any) => {
|
||||||
|
if (this.cs.validResponse(result)) {
|
||||||
|
this.pageNum++;
|
||||||
|
if (this.cs.hasData(result.GetWorkList)) {
|
||||||
|
result.GetEmployeeSubordinatesList.forEach(vr => {
|
||||||
|
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)
|
||||||
|
infiniteScroll.target.complete();
|
||||||
|
|
||||||
|
|
||||||
|
// console.log(resFlag);
|
||||||
|
}, (Error) => console.log(Error), () => infiniteScroll.target.complete());
|
||||||
|
} else {
|
||||||
|
if (infiniteScroll)
|
||||||
|
infiniteScroll.target.complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getDetails(index) {
|
||||||
|
// this.navCtrl.push("MyTeamPage", { employee: this.empSubordinate[index] });
|
||||||
|
this.cs.sharedService.setSharedData({ employee: this.empSubordinate[index] }, 'MyTeamPage');
|
||||||
|
this.cs.openMyTeamPage();
|
||||||
|
}
|
||||||
|
toggleSearch() {
|
||||||
|
this.isSearch = !this.isSearch;
|
||||||
|
}
|
||||||
|
goToSubordinate() {
|
||||||
|
// this.navCtrl.push("MySubordinatePage", { isSearch: true });
|
||||||
|
this.cs.sharedService.setSharedData(true, 'isSearch');
|
||||||
|
this.cs.openMySubordinatePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
import { HmgCommonModule } from 'src/app/hmg-common/hmg-common.module';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { MySubordinatePage } from './my-subordinate.page';
|
||||||
|
import { HomeComponent } from './home/home.component';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: MySubordinatePage,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'home',
|
||||||
|
component: HomeComponent,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
IonicModule,
|
||||||
|
HmgCommonModule,
|
||||||
|
RouterModule.forChild(routes)
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
MySubordinatePage,
|
||||||
|
HomeComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class MySubordinatePageModule { }
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<ion-content>
|
||||||
|
<ion-router-outlet></ion-router-outlet>
|
||||||
|
</ion-content>
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { MySubordinatePage } from './my-subordinate.page';
|
||||||
|
|
||||||
|
describe('MySubordinatePage', () => {
|
||||||
|
let component: MySubordinatePage;
|
||||||
|
let fixture: ComponentFixture<MySubordinatePage>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ MySubordinatePage ],
|
||||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(MySubordinatePage);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-my-subordinate',
|
||||||
|
templateUrl: './my-subordinate.page.html',
|
||||||
|
styleUrls: ['./my-subordinate.page.scss'],
|
||||||
|
})
|
||||||
|
export class MySubordinatePage implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue