My Specialist Page Implemented

MOHEMM-Q3-DEV-LATEST
haroon amjad 7 years ago
parent 0023dd3ad8
commit 7af8b9c791

@ -16,7 +16,8 @@ const routes: Routes = [
{ path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' },
{ path: 'eit', loadChildren: './eit/eit.module#EITPageModule' },
{ path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' },
{ path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' }
{ path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' },
{ path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' }
];

@ -989,6 +989,9 @@ export class CommonService {
public openWorklistRollReplacement() {
this.nav.navigateForward(["/notification/work-list-replacement-roll"]);
}
public openMySpecialistPage() {
this.nav.navigateForward(["/my-specialist/home"]);
}
public reload(url: string, from: string) {
console.log("force reload called from:" + from);
// window.location.reload();

@ -0,0 +1,46 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<nav-buttons></nav-buttons>
<ion-title color="light">{{headerTitle}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-list>
<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>
<ion-list no-lines *ngIf="specialistEmpList && specialistEmpList.length>0">
<ion-item no-border *ngFor="let subordinate of specialistEmpList;let i=index" (click)="getSpecialistInfo(i);">
<ion-avatar item-start>
<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>
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button class="footer-button" color="customnavy" ion-button (click)="getEmployeeProfile()">
{{ 'general, search' | translate }}</ion-button>
</div>
</ion-footer>

@ -0,0 +1,6 @@
.footer-button {
border-radius: 2px;
padding: 0 1.1em;
min-height: 45px;
min-width: 200px;
}

@ -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,178 @@
import { MySpecialistService } from './../service/my-specialist.service';
import { SpecialistResponse } from './../models/specialist.response';
import { Component, OnInit } from '@angular/core';
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
export class HomeComponent implements OnInit {
isSearch: boolean = false;
mySpecList: any;
searchKey: any;
searchKeySelect: any;
P_USER_NAME: string;
headerTitle: string = "";
selMenu: MenuResponse;
specialistEmpList: any;
IsReachEnd: boolean = false;
P_PAGE_NUM: number;
P_PAGE_LIMIT: number;
request: any;
specialistItem: any;
constructor(public cs: CommonService, private ts: TranslatorService, public mySpecialistService: MySpecialistService) { }
ngOnInit() {
let item = this.cs.sharedService.getSharedData('mySpecList', false);
this.specialistItem = item;
this.P_USER_NAME = this.cs.sharedService.getSharedData(LoginRequest.SHARED_DATA, false);
this.selMenu = new MenuResponse();
this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false);
this.headerTitle = this.selMenu.List_Menu.SUB_MENU_NAME;
this.P_PAGE_LIMIT = 50;
this.P_PAGE_NUM = 1;
this.getEmployeeProfile();
}
getEmployeeProfile() {
let searchEmpNum: string = "";
let searchEmpName: string = "";
let searchEmpEmail: string = "";
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 = "";
}
let item: any = this.specialistItem;
this.P_PAGE_NUM = 1;
let selEmpNo: string = null;
let respID: number;
this.IsReachEnd = false;
this.cs.sharedService.setSharedData(item.RESP_ID, MenuResponse.SHARED_SEL_RESP_ID);
if (item.MENU_TYPE == 'S') {
selEmpNo = null;
respID = item.RESP_ID;
}
const request = {
P_SELECTED_EMPLOYEE_NUMBER: selEmpNo,
P_SELECTED_RESP_ID: respID,
P_PAGE_NUM: this.P_PAGE_NUM,
P_PAGE_LIMIT: this.P_PAGE_LIMIT,
P_SEARCH_EMPLOYEE_NUMBER: searchEmpNum,
P_SEARCH_EMPLOYEE_DISPLAY_NAME: searchEmpName,
P_SEARCH_EMAIL_ADDRESS: searchEmpEmail
}
this.request = request;
this.mySpecialistService.getUserInformation(
request).
subscribe((result: SpecialistResponse) => {
this.handleSpecialistResult(result);
});
}
private handleSpecialistResult(result) {
if (this.cs.validResponse(result)) {
//this.isSearch=false;
if (this.cs.hasData(result.MemberInformationList)) {
this.request.P_PAGE_NUM++;
this.specialistEmpList = result.MemberInformationList;
let lastItemIndex = result.MemberInformationList.length - 1;
if (result.MemberInformationList[lastItemIndex]) {
let lastitem = result.MemberInformationList[lastItemIndex];
if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) {
this.IsReachEnd = true;
} else {
this.IsReachEnd = false;
}
// this.navCtrl.push('SmsAuthenticatePage');
}
} else {
this.specialistEmpList = [];
}
// this.navCtrl.push("MyTeamPage",{employee:result.MemberInformationList[0],empSubordinate:{},isSecondLevel:true});
}
}
private getSpecialistInfo(i) {
// this.navCtrl.push("MyTeamPage", { employee: this.specialistEmpList[i], isSpecialist: true });
this.cs.openMyTeamPage();
}
doInfinite(infiniteScroll) {
if (!this.IsReachEnd) {
this.mySpecialistService.getUserInformation(
this.request).
subscribe((result: SpecialistResponse) => {
if (this.cs.validResponse(result)) {
if (this.cs.hasData(result.MemberInformationList)) {
this.request.P_PAGE_NUM++;
result.MemberInformationList.forEach(element => {
if (element.ROW_NUM == element.NO_OF_ROWS) {
this.IsReachEnd = true;
} else {
this.IsReachEnd = false;
}
this.specialistEmpList.push(element);
// 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();
}
}
toggleSearch() {
this.isSearch = !this.isSearch;
}
}

@ -0,0 +1,70 @@
export class MemberInformationList {
public ACTUAL_TERMINATION_DATE: string;
public ASSIGNMENT_END_DATE: string;
public ASSIGNMENT_ID: number;
public ASSIGNMENT_NUMBER: string;
public ASSIGNMENT_START_DATE: string;
public ASSIGNMENT_STATUS_TYPE_ID: number;
public ASSIGNMENT_TYPE: string;
public BUSINESS_GROUP_ID: number
public BUSINESS_GROUP_NAME: string;
public CURRENT_EMPLOYEE_FLAG: string;
public EMPLOYEE_DISPLAY_NAME: string;
public EMPLOYEE_EMAIL_ADDRESS: string;
public EMPLOYEE_IMAGE: string;
public EMPLOYEE_MOBILE_NUMBER: string;
public EMPLOYEE_NAME: string;
public EMPLOYEE_NUMBER: string;
public EMPLOYEE_WORK_NUMBER: string;
public EMPLOYMENT_CATEGORY: string;
public EMPLOYMENT_CATEGORY_MEANING: string;
public FREQUENCY: string;
public FREQUENCY_MEANING: string;
public FROM_ROW_NUM: number;
public GRADE_ID: number;
public GRADE_NAME: string;
public HIRE_DATE: string;
public JOB_ID: number;
public JOB_NAME: string;
public LOCATION_ID: number;
public LOCATION_NAME: string;
public MANUAL_TIMECARD_FLAG: string;
public MANUAL_TIMECARD_MEANING: string;
public NATIONALITY_CODE: string;
public NATIONALITY_MEANING: string;
public NATIONAL_IDENTIFIER: string;
public NORMAL_HOURS: number;
public NO_OF_ROWS: number;
public ORGANIZATION_ID: number;
public ORGANIZATION_NAME: string;
public PAYROLL_CODE: string;
public PAYROLL_ID: number;
public PAYROLL_NAME: string;
public PERSON_ID: number;
public PERSON_TYPE: string;
public PERSON_TYPE_ID: number;
public PER_INFORMATION_CATEGORY: string;
public POSITION_ID: number;
public POSITION_NAME: string;
public PRIMARY_FLAG: string;
public ROW_NUM: number;
public SUPERVISOR_ASSIGNMENT_ID: string;
public SUPERVISOR_DISPLAY_NAME: string;
public SUPERVISOR_EMAIL_ADDRESS: string;
public SUPERVISOR_ID: number;
public SUPERVISOR_MOBILE_NUMBER: string;
public SUPERVISOR_NAME: string;
public SUPERVISOR_NUMBER: string;
public SUPERVISOR_WORK_NUMBER: string;
public SWIPES_EXEMPTED_FLAG: string;
public SWIPES_EXEMPTED_MEANING: string;
public SYSTEM_PERSON_TYPE: string;
public TK_EMAIL_ADDRESS: string;
public TK_EMPLOYEE_DISPLAY_NAME: string;
public TK_EMPLOYEE_NAME: string;
public TK_EMPLOYEE_NUMBER:string;
public TK_PERSON_ID: number;
public TO_ROW_NUM: number;
public UNIT_NUMBER: string;
public USER_STATUS: string;
}

@ -0,0 +1,8 @@
import { MemberInformationList } from './employee';
import { Response } from '../../hmg-common/services/models/response';
export class SpecialistResponse extends Response {
public static SHARED_DATA = 'specilaist-list';
public MemberInformationList: MemberInformationList [];
}

@ -0,0 +1,38 @@
import { HomeComponent } from './home/home.component';
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 { MySpecialistPage } from './my-specialist.page';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
const routes: Routes = [
{
path: '',
component: MySpecialistPage,
children: [
{
path: 'home',
component: HomeComponent,
}
]
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [
MySpecialistPage,
HomeComponent
]
})
export class MySpecialistPageModule { }

@ -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 { MySpecialistPage } from './my-specialist.page';
describe('MySpecialistPage', () => {
let component: MySpecialistPage;
let fixture: ComponentFixture<MySpecialistPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MySpecialistPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MySpecialistPage);
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-specialist',
templateUrl: './my-specialist.page.html',
styleUrls: ['./my-specialist.page.scss'],
})
export class MySpecialistPage implements OnInit {
constructor() { }
ngOnInit() {
}
}

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { MySpecialistService } from './my-specialist.service';
describe('MySpecialistService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: MySpecialistService = TestBed.get(MySpecialistService);
expect(service).toBeTruthy();
});
});

@ -0,0 +1,21 @@
import { Injectable } from '@angular/core';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { Observable } from 'rxjs';
import { SpecialistResponse } from '../models/specialist.response';
@Injectable({
providedIn: 'root'
})
export class MySpecialistService {
public static getUserInfo = 'Services/ERP.svc/REST/Get_UserInformation'; //submitter Info
constructor(public authService: AuthenticationService, public con: ConnectorService) { }
public getUserInformation(item: any, onError?: any, errorLabel?: string): Observable<SpecialistResponse> {
const request = item;
this.authService.authenticateRequest(request);
return this.con.post(MySpecialistService.getUserInfo, request, onError, errorLabel);
}
}
Loading…
Cancel
Save