From 7af8b9c7911fc7604da9dd305ce0cb2351893bec Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 17 Jul 2019 15:05:06 +0300 Subject: [PATCH] My Specialist Page Implemented --- Mohem/src/app/app-routing.module.ts | 3 +- .../services/common/common.service.ts | 3 + .../my-specialist/home/home.component.html | 46 +++++ .../my-specialist/home/home.component.scss | 6 + .../my-specialist/home/home.component.spec.ts | 27 +++ .../app/my-specialist/home/home.component.ts | 178 ++++++++++++++++++ .../src/app/my-specialist/models/employee.ts | 70 +++++++ .../models/specialist.response.ts | 8 + .../app/my-specialist/my-specialist.module.ts | 38 ++++ .../app/my-specialist/my-specialist.page.html | 3 + .../app/my-specialist/my-specialist.page.scss | 0 .../my-specialist/my-specialist.page.spec.ts | 27 +++ .../app/my-specialist/my-specialist.page.ts | 15 ++ .../service/my-specialist.service.spec.ts | 12 ++ .../service/my-specialist.service.ts | 21 +++ 15 files changed, 456 insertions(+), 1 deletion(-) create mode 100644 Mohem/src/app/my-specialist/home/home.component.html create mode 100644 Mohem/src/app/my-specialist/home/home.component.scss create mode 100644 Mohem/src/app/my-specialist/home/home.component.spec.ts create mode 100644 Mohem/src/app/my-specialist/home/home.component.ts create mode 100755 Mohem/src/app/my-specialist/models/employee.ts create mode 100755 Mohem/src/app/my-specialist/models/specialist.response.ts create mode 100644 Mohem/src/app/my-specialist/my-specialist.module.ts create mode 100644 Mohem/src/app/my-specialist/my-specialist.page.html create mode 100644 Mohem/src/app/my-specialist/my-specialist.page.scss create mode 100644 Mohem/src/app/my-specialist/my-specialist.page.spec.ts create mode 100644 Mohem/src/app/my-specialist/my-specialist.page.ts create mode 100644 Mohem/src/app/my-specialist/service/my-specialist.service.spec.ts create mode 100644 Mohem/src/app/my-specialist/service/my-specialist.service.ts diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index e531d005..8095ad29 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -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' } ]; diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index 53d342c6..f2d4c527 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -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(); diff --git a/Mohem/src/app/my-specialist/home/home.component.html b/Mohem/src/app/my-specialist/home/home.component.html new file mode 100644 index 00000000..b8d3c5ce --- /dev/null +++ b/Mohem/src/app/my-specialist/home/home.component.html @@ -0,0 +1,46 @@ + + + + {{headerTitle}} + + + + + + + + {{"general, search" | translate}} + + {{'searchForReplacment, name' | translate}} + {{'searchForReplacment, userName' | translate}} + {{'searchForReplacment, email' | translate}} + + + + + + + + + + + +

{{subordinate.EMPLOYEE_NAME}}

+

{{subordinate.POSITION_NAME}}

+ +
+
+ + + + +
+ + +
+ + {{ 'general, search' | translate }} +
+
\ No newline at end of file diff --git a/Mohem/src/app/my-specialist/home/home.component.scss b/Mohem/src/app/my-specialist/home/home.component.scss new file mode 100644 index 00000000..a27a7ef0 --- /dev/null +++ b/Mohem/src/app/my-specialist/home/home.component.scss @@ -0,0 +1,6 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } \ No newline at end of file diff --git a/Mohem/src/app/my-specialist/home/home.component.spec.ts b/Mohem/src/app/my-specialist/home/home.component.spec.ts new file mode 100644 index 00000000..5ec1377b --- /dev/null +++ b/Mohem/src/app/my-specialist/home/home.component.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/Mohem/src/app/my-specialist/home/home.component.ts b/Mohem/src/app/my-specialist/home/home.component.ts new file mode 100644 index 00000000..022c0c8f --- /dev/null +++ b/Mohem/src/app/my-specialist/home/home.component.ts @@ -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; + } + +} diff --git a/Mohem/src/app/my-specialist/models/employee.ts b/Mohem/src/app/my-specialist/models/employee.ts new file mode 100755 index 00000000..34a86821 --- /dev/null +++ b/Mohem/src/app/my-specialist/models/employee.ts @@ -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; +} \ No newline at end of file diff --git a/Mohem/src/app/my-specialist/models/specialist.response.ts b/Mohem/src/app/my-specialist/models/specialist.response.ts new file mode 100755 index 00000000..090e6348 --- /dev/null +++ b/Mohem/src/app/my-specialist/models/specialist.response.ts @@ -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 []; +} diff --git a/Mohem/src/app/my-specialist/my-specialist.module.ts b/Mohem/src/app/my-specialist/my-specialist.module.ts new file mode 100644 index 00000000..ac7c9b51 --- /dev/null +++ b/Mohem/src/app/my-specialist/my-specialist.module.ts @@ -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 { } diff --git a/Mohem/src/app/my-specialist/my-specialist.page.html b/Mohem/src/app/my-specialist/my-specialist.page.html new file mode 100644 index 00000000..67cbe279 --- /dev/null +++ b/Mohem/src/app/my-specialist/my-specialist.page.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Mohem/src/app/my-specialist/my-specialist.page.scss b/Mohem/src/app/my-specialist/my-specialist.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/my-specialist/my-specialist.page.spec.ts b/Mohem/src/app/my-specialist/my-specialist.page.spec.ts new file mode 100644 index 00000000..458b063b --- /dev/null +++ b/Mohem/src/app/my-specialist/my-specialist.page.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/Mohem/src/app/my-specialist/my-specialist.page.ts b/Mohem/src/app/my-specialist/my-specialist.page.ts new file mode 100644 index 00000000..b6af72d0 --- /dev/null +++ b/Mohem/src/app/my-specialist/my-specialist.page.ts @@ -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() { + } + +} diff --git a/Mohem/src/app/my-specialist/service/my-specialist.service.spec.ts b/Mohem/src/app/my-specialist/service/my-specialist.service.spec.ts new file mode 100644 index 00000000..90744012 --- /dev/null +++ b/Mohem/src/app/my-specialist/service/my-specialist.service.spec.ts @@ -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(); + }); +}); diff --git a/Mohem/src/app/my-specialist/service/my-specialist.service.ts b/Mohem/src/app/my-specialist/service/my-specialist.service.ts new file mode 100644 index 00000000..424c2c5f --- /dev/null +++ b/Mohem/src/app/my-specialist/service/my-specialist.service.ts @@ -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 { + const request = item; + this.authService.authenticateRequest(request); + return this.con.post(MySpecialistService.getUserInfo, request, onError, errorLabel); + } +}