fixed pending transactions

MOE-PHASE-2-SPRINT-1
umasoodch 3 years ago
parent 1f1ca83498
commit cbfc0ba389

@ -9,7 +9,7 @@
</ion-col>
<ion-col [size]="9" style="padding: 8px 5px 0px;margin-top: 14px;">
<div>
<div [ngClass]="direction == 'en' ? 'numberEmp':'numberEmp-ar' ">39</div>
<div *ngIf="employeeSubordinates" [ngClass]="direction == 'en' ? 'numberEmp':'numberEmp-ar' ">{{employeeSubordinates}}</div>
<span [ngClass]=" direction == 'en'? 'employee-name' : 'employee-name-ar'" (click)="getDetails()">
<h2 class="name">{{name}}</h2>
<span class="title">{{title}}</span>

@ -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(

@ -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)">
</app-employee-hierarchy-card>
</li>
</ng-container>
<ul *ngIf="personalInfo" class="current-employee">
<ul *ngIf="supervisorHierarchyList || subordinateHierarchyList" class="current-employee">
<li>
<app-employee-hierarchy-card
[name]="personalInfo.EMPLOYEE_NAME"
@ -34,7 +34,8 @@
[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)">
[employeeSubordinates]="subordinate.NUM_OF_SUBORDINATES"
(onGetDetails)="getDetails(subordinate)">
</app-employee-hierarchy-card>
</li>
</ul>

@ -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();
}
}

@ -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' + ")/",

@ -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,

Loading…
Cancel
Save