diff --git a/Mohem/src/app/hmg-common/ui/employee-hierarchy-card/employee-hierarchy-card.component.html b/Mohem/src/app/hmg-common/ui/employee-hierarchy-card/employee-hierarchy-card.component.html index e7248013..db88266e 100644 --- a/Mohem/src/app/hmg-common/ui/employee-hierarchy-card/employee-hierarchy-card.component.html +++ b/Mohem/src/app/hmg-common/ui/employee-hierarchy-card/employee-hierarchy-card.component.html @@ -9,7 +9,7 @@
-
39
+
{{employeeSubordinates}}

{{name}}

{{title}} diff --git a/Mohem/src/app/hmg-common/ui/employee-hierarchy-card/employee-hierarchy-card.component.ts b/Mohem/src/app/hmg-common/ui/employee-hierarchy-card/employee-hierarchy-card.component.ts index 32812f3e..0ce31370 100644 --- a/Mohem/src/app/hmg-common/ui/employee-hierarchy-card/employee-hierarchy-card.component.ts +++ b/Mohem/src/app/hmg-common/ui/employee-hierarchy-card/employee-hierarchy-card.component.ts @@ -14,7 +14,7 @@ export class EmployeeHierarchyCardComponent implements OnInit { @Input() title: string; @Input() employeeImage: string; @Input() employeePhoneNumber: string; - // tslint:disable-next-line: no-output-on-prefix + @Input() employeeSubordinates: number; @Output() onGetDetails = new EventEmitter(); constructor( diff --git a/Mohem/src/app/my-team/employee-hierarchy/employee-hierarchy.component.html b/Mohem/src/app/my-team/employee-hierarchy/employee-hierarchy.component.html index c38e4c63..5314293a 100644 --- a/Mohem/src/app/my-team/employee-hierarchy/employee-hierarchy.component.html +++ b/Mohem/src/app/my-team/employee-hierarchy/employee-hierarchy.component.html @@ -14,11 +14,11 @@ [title]="subordinate.POSITION_NAME" [employeeImage]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'" [employeePhoneNumber]="subordinate.EMPLOYEE_MOBILE_NUMBER" - (onGetDetails)="getDetails(i)"> + (onGetDetails)="getDetails(subordinate)"> -
    +
    • + [employeeSubordinates]="subordinate.NUM_OF_SUBORDINATES" + (onGetDetails)="getDetails(subordinate)">
    diff --git a/Mohem/src/app/my-team/employee-hierarchy/employee-hierarchy.component.ts b/Mohem/src/app/my-team/employee-hierarchy/employee-hierarchy.component.ts index b3200645..12f65d3d 100644 --- a/Mohem/src/app/my-team/employee-hierarchy/employee-hierarchy.component.ts +++ b/Mohem/src/app/my-team/employee-hierarchy/employee-hierarchy.component.ts @@ -5,6 +5,7 @@ import { AuthenticationService } from 'src/app/hmg-common/services/authenticatio import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; import { MyTeamService } from '../service/my-team.service'; import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user'; +import { AnyARecord } from 'dns'; @Component({ selector: 'app-employee-hierarchy', @@ -16,6 +17,7 @@ export class EmployeeHierarchyComponent implements OnInit { public hierarchyData: any; public subordinateHierarchyList: any; public supervisorHierarchyList: any; + public currentEmployee: any; constructor( public ts: TranslatorService, @@ -26,7 +28,13 @@ export class EmployeeHierarchyComponent implements OnInit { ) { } ngOnInit() { - this.getProfile(); + this.currentEmployee = this.common.sharedService.getSharedData('employee-hierarchy', false); + if (!this.currentEmployee) { + this.getProfile(); + } else { + this.personalInfo = this.currentEmployee; + this.getEmployeeHierachy(); + } } public getProfile() { @@ -38,6 +46,12 @@ export class EmployeeHierarchyComponent implements OnInit { }); } + public filterArrayOnLVL(incomingArray: any) { + return incomingArray.filter(a => { + return a.LVL != 1; + }); + } + public getEmployeeHierachy() { const body = { P_SELECTED_EMPLOYEE_NUMBER: this.personalInfo.EMPLOYEE_NUMBER, @@ -47,12 +61,22 @@ export class EmployeeHierarchyComponent implements OnInit { this.myTeamService.getEmployeeHierachy(body).subscribe((result: any) => { if (this.cs.validResponse(result)) { this.hierarchyData = result.SupervisorHierarchyLists; - this.subordinateHierarchyList = this.hierarchyData.SubordinateHierarchyList; - let rawSupervisorHierarchyList = this.hierarchyData.SupervisorHierarchyList; - this.supervisorHierarchyList = rawSupervisorHierarchyList.reverse(); + + let serverSubordinateData = this.hierarchyData.SubordinateHierarchyList; + this.subordinateHierarchyList = this.filterArrayOnLVL(serverSubordinateData); + + let serverSupervisorHierarchyList = this.hierarchyData.SupervisorHierarchyList; + let serverSupervisorData = serverSupervisorHierarchyList.reverse(); + this.supervisorHierarchyList = this.filterArrayOnLVL(serverSupervisorData); } }); } + public getDetails(i: any) { + console.log(i); + this.common.sharedService.setSharedData(i, 'employee-hierarchy'); + this.cs.openEmployeeHierarchy(); + } + } diff --git a/Mohem/src/app/pending-transaction/home/home.component.ts b/Mohem/src/app/pending-transaction/home/home.component.ts index e722d588..a0835bba 100644 --- a/Mohem/src/app/pending-transaction/home/home.component.ts +++ b/Mohem/src/app/pending-transaction/home/home.component.ts @@ -3,6 +3,8 @@ import { EitService } from 'src/app/eit/services/eit.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { ServiceService } from '../service/service.service'; +import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; @Component({ selector: 'app-home', @@ -16,19 +18,30 @@ export class HomeComponent implements OnInit { public dateTo: any; public dateFrom: any; public transactionDetails; - constructor(public cs: CommonService, private elementRef: ElementRef, public trServcice: ServiceService, public ts: TranslatorService, public eitService: EitService) { } + public personalInfo: any; + constructor(public cs: CommonService, private elementRef: ElementRef, public trServcice: ServiceService, public ts: TranslatorService, public eitService: EitService, public authService: AuthenticationService) { } ngOnInit() { - - - this.getPendingTransaction(); + this.getProfile(); this.direction = TranslatorService.getCurrentLanguageName(); + } + public getProfile() { + this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => { + if (user) { + this.personalInfo = user; + this.getPendingTransaction(); + } + }); } + + getPendingTransaction() { this.cs.startLoading(); this.trServcice.getPendingRequests({ + 'P_MENU_TYPE': 'E', + 'P_SELECTED_EMPLOYEE_NUMBER': this.personalInfo.EMPLOYEE_NUMBER }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { this.cs.stopLoading(); this.transactions = response['GetPendingReqFunctionsList']; @@ -37,6 +50,8 @@ export class HomeComponent implements OnInit { getPendingRequestDetails() { this.cs.startLoading(); this.trServcice.getPendingRequestDetails({ + 'P_MENU_TYPE': 'E', + 'P_SELECTED_EMPLOYEE_NUMBER': this.personalInfo.EMPLOYEE_NUMBER, 'P_FUNCTION_ID': this.selectedTransaction, 'P_CREATION_DATE_FROM': "/Date(" + Date.parse(this.dateFrom) + '+0300' + ")/", 'P_CREATION_DATE_TO': "/Date(" + Date.parse(this.dateTo) + '+0300' + ")/", diff --git a/Mohem/src/app/pending-transaction/service/service.service.ts b/Mohem/src/app/pending-transaction/service/service.service.ts index f5521403..c3e25155 100644 --- a/Mohem/src/app/pending-transaction/service/service.service.ts +++ b/Mohem/src/app/pending-transaction/service/service.service.ts @@ -19,7 +19,7 @@ export class ServiceService { getPendingRequests(request, onError, errorLabel) { this.authService.authenticateRequest(request); - request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + // request.P_SELECTED_EMPLOYEE_NUMBER = request.P_SELECTED_EMPLOYEE_NUMBER; return this.con.postNoLoad( ServiceService.GET_PENDING_REQ_FUNCTIONS, request, @@ -29,7 +29,6 @@ export class ServiceService { } getPendingRequestDetails(request, onError, errorLabel) { this.authService.authenticateRequest(request); - request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; return this.con.postNoLoad( ServiceService.GET_PENDING_REQ_DETAILS, request,