my-team page update
parent
40679c2509
commit
41f804e672
@ -1,26 +1,27 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
|
||||
{
|
||||
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
|
||||
data: { preload: true, delay: 1000 }
|
||||
},
|
||||
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
|
||||
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
|
||||
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
|
||||
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' },
{ path: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' }
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
|
||||
{
|
||||
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
|
||||
data: { preload: true, delay: 1000 }
|
||||
},
|
||||
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
|
||||
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
|
||||
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
|
||||
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' }
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
|
||||
],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
|
||||
],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
|
||||
@ -0,0 +1,158 @@
|
||||
|
||||
<ion-header>
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<ion-buttons slot="start">
|
||||
<ion-back-button color="light" class="btnBack"></ion-back-button>
|
||||
<ion-icon class="search-icons" color="light" name="arrow-back" *ngIf="modalFlag" (click)="dismiss()"></ion-icon>
|
||||
</ion-buttons>
|
||||
<ion-title color="light" >{{headerTitle}}</ion-title>
|
||||
<ion-buttons slot="end">
|
||||
<button ion-button icon-only class="btnBack" *ngIf="isSpecialist == false" (click)="goToSubordinate();">
|
||||
<ion-icon class="search-icons" color="light" name="search"></ion-icon>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content padding>
|
||||
<div *ngIf="employee">
|
||||
<ion-card>
|
||||
|
||||
<ion-card-header class="boxHdr">
|
||||
<div class="hrTitle">{{employee.EMPLOYEE_NAME}}</div>
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<div>
|
||||
<div class="centerDiv profileDiv">
|
||||
<!-- <p class="TxtPlace boldTxt">{{User_name_Emp}}</p> -->
|
||||
<ion-img class="profileImg"
|
||||
[src]="employee.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+employee.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'">
|
||||
</ion-img>
|
||||
</div>
|
||||
<ion-grid class="profile-grid">
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','empNo')}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.EMPLOYEE_NUMBER}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<!-- <ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{"userProfile.name" | translate}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.EMPLOYEE_NAME}}</label>
|
||||
</ion-col>
|
||||
</ion-row> -->
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','busG')}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.BUSINESS_GROUP_NAME}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','job')}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.JOB_NAME}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','locName')}} </label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.LOCATION_NAME}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','payrol')}} </label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.PAYROLL_NAME}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','orgEmail')}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.EMPLOYEE_EMAIL_ADDRESS}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','orgName')}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.ORGANIZATION_NAME}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','position')}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.POSITION_NAME}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','grade')}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.GRADE_NAME}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col class="colBold" col-5>
|
||||
<label>{{ts.trPK('userProfile','category')}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-7>
|
||||
<label>{{employee.EMPLOYMENT_CATEGORY_MEANING}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<!-- <ion-row (click)="getMenuEntries(employee);">
|
||||
<ion-col col-7> -->
|
||||
<!-- <label for="">Request for {{employee.EMPLOYEE_NAME}}</label> -->
|
||||
<!-- </ion-col>
|
||||
</ion-row> -->
|
||||
</ion-grid>
|
||||
</div>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
<div class="centerDiv">
|
||||
<ion-button color="customnavy" (click)="getMenuEntries(employee)">{{ts.trPK('myTeam','requestFor')}}
|
||||
{{employee.EMPLOYEE_NAME}}</ion-button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="isSpecialist == false" >
|
||||
<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 slot="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 slot="end">{{subordinate.NUM_OF_SUBORDINATES}}</ion-badge>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
<ion-infinite-scroll threshold="100px" (ionInfinite)="doInfinite($event)">
|
||||
<ion-infinite-scroll-content
|
||||
loadingSpinner="bubbles"
|
||||
loadingText="Loading more data...">
|
||||
</ion-infinite-scroll-content>
|
||||
</ion-infinite-scroll>
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
@ -0,0 +1 @@
|
||||
.search-icons{font-size:.7cm}
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DetailsComponent } from './details.component';
|
||||
|
||||
describe('DetailsComponent', () => {
|
||||
let component: DetailsComponent;
|
||||
let fixture: ComponentFixture<DetailsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DetailsComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,252 @@
|
||||
import { Component, OnInit,ViewChild } from "@angular/core";
|
||||
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"]
|
||||
})
|
||||
|
||||
export class DetailsComponent implements OnInit {
|
||||
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
||||
pageNum: number = 1;
|
||||
pageLimit: number = 50;
|
||||
modalFlag: any = false;
|
||||
empSubordinate: any;
|
||||
employee: any;
|
||||
IsReachEnd: boolean = false;
|
||||
searchKey: any;
|
||||
public searchKeySelect: any;
|
||||
infiniteRequest: any;
|
||||
isSpecialist: boolean = false;
|
||||
selMenu: MenuResponse = new MenuResponse();
|
||||
public headerTitle: string = "";
|
||||
constructor(
|
||||
public menuService: MenuService,
|
||||
public common: CommonService,
|
||||
public myTeamService: MyTeamService,
|
||||
public ts: TranslatorService,
|
||||
public modalController: ModalController
|
||||
) {
|
||||
console.log("Constuctor called");
|
||||
}
|
||||
ngOnInit() {
|
||||
this.pageLimit = 50;
|
||||
this.pageNum = 1;
|
||||
this.employee = this.common.sharedService.getSharedData(
|
||||
MyTeamService.EMPLOYEE_SHARED_DATA,
|
||||
false
|
||||
);
|
||||
console.log(this.employee);
|
||||
// this.selMenu = this.common.sharedService.getSharedData(
|
||||
// MenuResponse.SHARED_DATA,
|
||||
// true
|
||||
// );
|
||||
// this.headerTitle = this.selMenu.List_Menu.MENU_NAME;
|
||||
// this.isSpecialist = this.navParams.get("isSpecialist")
|
||||
// ? this.navParams.get("isSpecialist")
|
||||
// : false;
|
||||
|
||||
if (this.employee) this.getEmpSubordinate();
|
||||
}
|
||||
getEmpSubordinate() {
|
||||
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 = "";
|
||||
}
|
||||
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.common.validResponse(result)) {
|
||||
if (this.common.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.common.validResponse(result)) {
|
||||
this.pageNum++;
|
||||
if (this.common.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) this.infiniteScroll.complete();
|
||||
|
||||
// console.log(resFlag);
|
||||
},
|
||||
Error => console.log(Error),
|
||||
() => this.infiniteScroll.complete()
|
||||
);
|
||||
} else {
|
||||
if (infiniteScroll) this.infiniteScroll.complete();
|
||||
}
|
||||
}
|
||||
getDetails(index) {
|
||||
this.empSubordinate[index].isModal = true;
|
||||
this.common.sharedService.setSharedData(
|
||||
this.empSubordinate[index],
|
||||
MyTeamService.EMPLOYEE_SHARED_DATA
|
||||
);
|
||||
this.presentModal();
|
||||
}
|
||||
async presentModal() {
|
||||
//this.modalFlag = true;
|
||||
const modal = await this.modalController.create({
|
||||
component: DetailsComponent,
|
||||
keyboardClose: true,
|
||||
animated: false
|
||||
});
|
||||
let 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 nationality: string;
|
||||
if (this.isSpecialist == true) {
|
||||
// respID = this.sharedData.getSharedData(
|
||||
// MenuResponse.SHARED_SEL_RESP_ID,
|
||||
// true
|
||||
// );
|
||||
menuType = "S";
|
||||
}
|
||||
selEmpNo = item.EMPLOYEE_NUMBER;
|
||||
nationality = item.NATIONALITY_CODE;
|
||||
|
||||
const body = {
|
||||
P_MENU_TYPE: menuType, //to check
|
||||
P_SELECTED_EMPLOYEE_NUMBER: selEmpNo,
|
||||
P_SELECTED_RESP_ID: respID,
|
||||
NationalityCode: nationality
|
||||
};
|
||||
//set emp and resp id
|
||||
// this.sharedData.setSharedData(selEmpNo, MenuResponse.SHARED_SEL_EMP);
|
||||
// this.sharedData.setSharedData(
|
||||
// body.P_SELECTED_RESP_ID,
|
||||
// MenuResponse.SHARED_SEL_RESP_ID
|
||||
// );
|
||||
this.menuService.getMenuEntires(body).subscribe((result: MenuResponse) => {
|
||||
this.handleMenuEntiresResult(result);
|
||||
});
|
||||
}
|
||||
|
||||
private handleMenuEntiresResult(result) {
|
||||
if (this.common.validResponse(result)) {
|
||||
if (this.common.hasData(result.GetMenuEntriesList)) {
|
||||
this.sortMenuEntires(result.GetMenuEntriesList);
|
||||
}
|
||||
}
|
||||
}
|
||||
sortMenuEntires(list) {
|
||||
// let tree = this.common.list_to_tree(list);
|
||||
// this.navCtrl.push("MenuEntriesPage", { menuEntries: tree });
|
||||
}
|
||||
|
||||
goToSubordinate() {
|
||||
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({
|
||||
dismissed: true
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
|
||||
<ion-header>
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<ion-buttons slot="start">
|
||||
<ion-back-button color="light" class="btnBack"></ion-back-button>
|
||||
<ion-icon class="search-icons" color="light" name="arrow-back" *ngIf="isSearch" (click)="dismiss()"></ion-icon>
|
||||
</ion-buttons>
|
||||
<ion-title color="light" >{{headerTitle}}</ion-title>
|
||||
<ion-buttons slot="end">
|
||||
<button ion-button icon-only class="btnBack" *ngIf="!isSearch" (click)="goToSubordinate();">
|
||||
<ion-icon class="search-icons" color="light" name="search"></ion-icon>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
|
||||
</ion-toolbar>
|
||||
|
||||
</ion-header>
|
||||
<ion-content padding>
|
||||
<ion-list *ngIf="isSearch">
|
||||
<ion-item>
|
||||
<ion-label>{{ts.trPK('general','search')}} </ion-label>
|
||||
<ion-select okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}"
|
||||
[(ngModel)]="searchKeySelect">
|
||||
<ion-select-option value="1" selected="true" selected>{{ts.trPK('searchForReplacment','name')}}</ion-select-option>
|
||||
<ion-select-option value="2">{{ts.trPK('searchForReplacment','userName')}} </ion-select-option>
|
||||
<ion-select-option value="3">{{ts.trPK('searchForReplacment','email')}} </ion-select-option>
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-input [(ngModel)]="searchKey" placeholder="{{ts.trPK('general','enter')}}"></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 class="badge">{{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 color="customnavy" (click)="getEmpSubordinate()">{{ts.trPK('general','search')}} </ion-button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
@ -0,0 +1,6 @@
|
||||
.search-icons{font-size:.7cm}
|
||||
.badge{
|
||||
padding: 10px;
|
||||
border-radius: 50%;
|
||||
width: 50px;
|
||||
}
|
||||
@ -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,208 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
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 { ModalController } from "@ionic/angular";
|
||||
@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;
|
||||
public isSearch: boolean = false;
|
||||
public searchKeySelect: any;
|
||||
infiniteRequest: any;
|
||||
selMenu: any;
|
||||
selEmpNo: any;
|
||||
constructor(
|
||||
public ts: TranslatorService,
|
||||
public authService: AuthenticationService,
|
||||
public common: CommonService,
|
||||
public myTeamService: MyTeamService,
|
||||
public modalController: ModalController
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.setIntitial();
|
||||
}
|
||||
getData() {}
|
||||
setIntitial() {
|
||||
this.selMenu = this.common.sharedService.getSharedData(
|
||||
MenuResponse.SHARED_DATA,
|
||||
false
|
||||
);
|
||||
this.headerTitle = this.selMenu.List_Menu.MENU_NAME;
|
||||
this.selEmpNo = this.selMenu.userid;
|
||||
this.isSearch = this.selMenu.search ? this.selMenu.search : this.isSearch;
|
||||
// this.isSearch=this.navParams.get("isSearch")?this.navParams.get("isSearch") : false;
|
||||
if(!this.isSearch)
|
||||
this.getEmpSubordinate();
|
||||
}
|
||||
getEmpSubordinate() {
|
||||
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) {
|
||||
this.selEmpNo = null;
|
||||
}
|
||||
|
||||
const body = {
|
||||
P_SELECTED_EMPLOYEE_NUMBER: this.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) {
|
||||
if (this.common.validResponse(result)) {
|
||||
if (this.common.hasData(result.GetEmployeeSubordinatesList)) {
|
||||
this.empSubordinate = result.GetEmployeeSubordinatesList;
|
||||
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;
|
||||
}
|
||||
}
|
||||
} 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.common.validResponse(result)) {
|
||||
this.pageNum++;
|
||||
if (this.common.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.complete();
|
||||
}
|
||||
// console.log(resFlag);
|
||||
},
|
||||
Error => console.log(Error),
|
||||
() => infiniteScroll.complete()
|
||||
);
|
||||
} else {
|
||||
if (infiniteScroll) {
|
||||
infiniteScroll.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
getDetails(index) {
|
||||
|
||||
this.common.sharedService.setSharedData(
|
||||
this.empSubordinate[index],
|
||||
MyTeamService.EMPLOYEE_SHARED_DATA
|
||||
);
|
||||
|
||||
this.common.sharedService.setSharedData(
|
||||
this.selMenu,
|
||||
MenuResponse.SHARED_DATA
|
||||
);
|
||||
|
||||
this.common.openMyTeamDetails();
|
||||
this.modalController.dismiss();
|
||||
//this.navCtrl.push("MyTeamPage",{employee:this.empSubordinate[index]});
|
||||
}
|
||||
toggleSearch() {
|
||||
this.isSearch = !this.isSearch;
|
||||
}
|
||||
goToSubordinate() {
|
||||
//this.navCtrl.push("MySubordinatePage",{isSearch:true});
|
||||
//this.getEmpSubordinate();
|
||||
this.presentModal();
|
||||
}
|
||||
async presentModal() {
|
||||
const modal = await this.modalController.create({
|
||||
component: HomeComponent,
|
||||
keyboardClose: true,
|
||||
animated: false,
|
||||
componentProps:{isSearch:true}
|
||||
});
|
||||
let dismissed = modal.onDidDismiss();
|
||||
dismissed.then(() => {
|
||||
this.isSearch = false;
|
||||
});
|
||||
return await modal.present();
|
||||
}
|
||||
dismiss(){
|
||||
this.modalController.dismiss({
|
||||
dismissed: true
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import { DetailsComponent } from './details/details.component';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { MyTeamPage } from './my-team.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: MyTeamPage,
|
||||
children:[{
|
||||
path: 'home',
|
||||
component: HomeComponent
|
||||
},
|
||||
{
|
||||
path: 'details',
|
||||
component: DetailsComponent
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
RouterModule.forChild(routes)
|
||||
],
|
||||
declarations: [MyTeamPage,HomeComponent,DetailsComponent]
|
||||
})
|
||||
export class MyTeamPageModule {}
|
||||
@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
|
||||
<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 { MyTeamPage } from './my-team.page';
|
||||
|
||||
describe('MyTeamPage', () => {
|
||||
let component: MyTeamPage;
|
||||
let fixture: ComponentFixture<MyTeamPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MyTeamPage ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MyTeamPage);
|
||||
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-team',
|
||||
templateUrl: './my-team.page.html',
|
||||
styleUrls: ['./my-team.page.scss'],
|
||||
})
|
||||
export class MyTeamPage implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MyTeamService } from './my-team.service';
|
||||
|
||||
describe('MyTeamService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: MyTeamService = TestBed.get(MyTeamService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
|
||||
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MyTeamService {
|
||||
public static EMPLOYEE_SHARED_DATA = 'employee';
|
||||
public static getMyTeam = 'Services/ERP.svc/REST/GET_EMPLOYEE_SUBORDINATES';
|
||||
constructor(
|
||||
public con: ConnectorService,
|
||||
private authService: AuthenticationService
|
||||
) { }
|
||||
public getEmployeeSubordinates(absence: any, onError?: any, errorLabel?: string){
|
||||
const request = absence;
|
||||
this.authService.authenticateRequest(request);
|
||||
return this.con.post(MyTeamService.getMyTeam, request, onError, errorLabel);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue