diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index 8095ad29..94280fa5 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -17,7 +17,8 @@ const routes: Routes = [ { path: 'eit', loadChildren: './eit/eit.module#EITPageModule' }, { path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' }, { path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' }, - { path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' } + { path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' }, + { path: 'my-subordinate', loadChildren: './my-subordinate/my-subordinate.module#MySubordinatePageModule' } ]; 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 f2d4c527..60f43713 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -992,6 +992,9 @@ export class CommonService { public openMySpecialistPage() { this.nav.navigateForward(["/my-specialist/home"]); } + public openMySubordinatePage() { + this.nav.navigateForward(["/my-subordinate/home"]); + } public reload(url: string, from: string) { console.log("force reload called from:" + from); // window.location.reload(); diff --git a/Mohem/src/app/my-subordinate/home/home.component.html b/Mohem/src/app/my-subordinate/home/home.component.html new file mode 100644 index 00000000..e93a9f6f --- /dev/null +++ b/Mohem/src/app/my-subordinate/home/home.component.html @@ -0,0 +1,55 @@ + + + {{headerTitle}} + + + + + + + + + + + + + + {{"general, search" | translate}} + + {{"searchForReplacment, name" | translate}} + {{"searchForReplacment, userName" | translate}} + {{"searchForReplacment, email" | translate}} + + + + + + +
+ + + + + + +

{{subordinate.EMPLOYEE_NAME}}

+

{{subordinate.POSITION_NAME}}

+ {{subordinate.NUM_OF_SUBORDINATES}} +
+
+ + + +
+
+ + + +
+ + {{ 'general, search' | translate }} +
+ +
\ No newline at end of file diff --git a/Mohem/src/app/my-subordinate/home/home.component.scss b/Mohem/src/app/my-subordinate/home/home.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/my-subordinate/home/home.component.spec.ts b/Mohem/src/app/my-subordinate/home/home.component.spec.ts new file mode 100644 index 00000000..5ec1377b --- /dev/null +++ b/Mohem/src/app/my-subordinate/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-subordinate/home/home.component.ts b/Mohem/src/app/my-subordinate/home/home.component.ts new file mode 100644 index 00000000..a90ba3aa --- /dev/null +++ b/Mohem/src/app/my-subordinate/home/home.component.ts @@ -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(); + } + +} diff --git a/Mohem/src/app/my-subordinate/my-subordinate.module.ts b/Mohem/src/app/my-subordinate/my-subordinate.module.ts new file mode 100644 index 00000000..a1cb931f --- /dev/null +++ b/Mohem/src/app/my-subordinate/my-subordinate.module.ts @@ -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 { } diff --git a/Mohem/src/app/my-subordinate/my-subordinate.page.html b/Mohem/src/app/my-subordinate/my-subordinate.page.html new file mode 100644 index 00000000..67cbe279 --- /dev/null +++ b/Mohem/src/app/my-subordinate/my-subordinate.page.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Mohem/src/app/my-subordinate/my-subordinate.page.scss b/Mohem/src/app/my-subordinate/my-subordinate.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/my-subordinate/my-subordinate.page.spec.ts b/Mohem/src/app/my-subordinate/my-subordinate.page.spec.ts new file mode 100644 index 00000000..a3f73a58 --- /dev/null +++ b/Mohem/src/app/my-subordinate/my-subordinate.page.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/Mohem/src/app/my-subordinate/my-subordinate.page.ts b/Mohem/src/app/my-subordinate/my-subordinate.page.ts new file mode 100644 index 00000000..18d90f87 --- /dev/null +++ b/Mohem/src/app/my-subordinate/my-subordinate.page.ts @@ -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() { + } + +}