fixed pending transactions

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

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

@ -14,7 +14,7 @@ export class EmployeeHierarchyCardComponent implements OnInit {
@Input() title: string; @Input() title: string;
@Input() employeeImage: string; @Input() employeeImage: string;
@Input() employeePhoneNumber: string; @Input() employeePhoneNumber: string;
// tslint:disable-next-line: no-output-on-prefix @Input() employeeSubordinates: number;
@Output() onGetDetails = new EventEmitter(); @Output() onGetDetails = new EventEmitter();
constructor( constructor(

@ -14,11 +14,11 @@
[title]="subordinate.POSITION_NAME" [title]="subordinate.POSITION_NAME"
[employeeImage]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'" [employeeImage]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'"
[employeePhoneNumber]="subordinate.EMPLOYEE_MOBILE_NUMBER" [employeePhoneNumber]="subordinate.EMPLOYEE_MOBILE_NUMBER"
(onGetDetails)="getDetails(i)"> (onGetDetails)="getDetails(subordinate)">
</app-employee-hierarchy-card> </app-employee-hierarchy-card>
</li> </li>
</ng-container> </ng-container>
<ul *ngIf="personalInfo" class="current-employee"> <ul *ngIf="supervisorHierarchyList || subordinateHierarchyList" class="current-employee">
<li> <li>
<app-employee-hierarchy-card <app-employee-hierarchy-card
[name]="personalInfo.EMPLOYEE_NAME" [name]="personalInfo.EMPLOYEE_NAME"
@ -34,7 +34,8 @@
[title]="subordinate.POSITION_NAME" [title]="subordinate.POSITION_NAME"
[employeeImage]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'" [employeeImage]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'"
[employeePhoneNumber]="subordinate.EMPLOYEE_MOBILE_NUMBER" [employeePhoneNumber]="subordinate.EMPLOYEE_MOBILE_NUMBER"
(onGetDetails)="getDetails(i)"> [employeeSubordinates]="subordinate.NUM_OF_SUBORDINATES"
(onGetDetails)="getDetails(subordinate)">
</app-employee-hierarchy-card> </app-employee-hierarchy-card>
</li> </li>
</ul> </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 { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
import { MyTeamService } from '../service/my-team.service'; import { MyTeamService } from '../service/my-team.service';
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user'; import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
import { AnyARecord } from 'dns';
@Component({ @Component({
selector: 'app-employee-hierarchy', selector: 'app-employee-hierarchy',
@ -16,6 +17,7 @@ export class EmployeeHierarchyComponent implements OnInit {
public hierarchyData: any; public hierarchyData: any;
public subordinateHierarchyList: any; public subordinateHierarchyList: any;
public supervisorHierarchyList: any; public supervisorHierarchyList: any;
public currentEmployee: any;
constructor( constructor(
public ts: TranslatorService, public ts: TranslatorService,
@ -26,7 +28,13 @@ export class EmployeeHierarchyComponent implements OnInit {
) { } ) { }
ngOnInit() { 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() { 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() { public getEmployeeHierachy() {
const body = { const body = {
P_SELECTED_EMPLOYEE_NUMBER: this.personalInfo.EMPLOYEE_NUMBER, P_SELECTED_EMPLOYEE_NUMBER: this.personalInfo.EMPLOYEE_NUMBER,
@ -47,12 +61,22 @@ export class EmployeeHierarchyComponent implements OnInit {
this.myTeamService.getEmployeeHierachy(body).subscribe((result: any) => { this.myTeamService.getEmployeeHierachy(body).subscribe((result: any) => {
if (this.cs.validResponse(result)) { if (this.cs.validResponse(result)) {
this.hierarchyData = result.SupervisorHierarchyLists; this.hierarchyData = result.SupervisorHierarchyLists;
this.subordinateHierarchyList = this.hierarchyData.SubordinateHierarchyList;
let rawSupervisorHierarchyList = this.hierarchyData.SupervisorHierarchyList; let serverSubordinateData = this.hierarchyData.SubordinateHierarchyList;
this.supervisorHierarchyList = rawSupervisorHierarchyList.reverse(); 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 { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { ServiceService } from '../service/service.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({ @Component({
selector: 'app-home', selector: 'app-home',
@ -16,19 +18,30 @@ export class HomeComponent implements OnInit {
public dateTo: any; public dateTo: any;
public dateFrom: any; public dateFrom: any;
public transactionDetails; 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() { ngOnInit() {
this.getProfile();
this.getPendingTransaction();
this.direction = TranslatorService.getCurrentLanguageName(); this.direction = TranslatorService.getCurrentLanguageName();
}
public getProfile() {
this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
if (user) {
this.personalInfo = user;
this.getPendingTransaction();
}
});
} }
getPendingTransaction() { getPendingTransaction() {
this.cs.startLoading(); this.cs.startLoading();
this.trServcice.getPendingRequests({ this.trServcice.getPendingRequests({
'P_MENU_TYPE': 'E',
'P_SELECTED_EMPLOYEE_NUMBER': this.personalInfo.EMPLOYEE_NUMBER
}, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => {
this.cs.stopLoading(); this.cs.stopLoading();
this.transactions = response['GetPendingReqFunctionsList']; this.transactions = response['GetPendingReqFunctionsList'];
@ -37,6 +50,8 @@ export class HomeComponent implements OnInit {
getPendingRequestDetails() { getPendingRequestDetails() {
this.cs.startLoading(); this.cs.startLoading();
this.trServcice.getPendingRequestDetails({ this.trServcice.getPendingRequestDetails({
'P_MENU_TYPE': 'E',
'P_SELECTED_EMPLOYEE_NUMBER': this.personalInfo.EMPLOYEE_NUMBER,
'P_FUNCTION_ID': this.selectedTransaction, 'P_FUNCTION_ID': this.selectedTransaction,
'P_CREATION_DATE_FROM': "/Date(" + Date.parse(this.dateFrom) + '+0300' + ")/", 'P_CREATION_DATE_FROM': "/Date(" + Date.parse(this.dateFrom) + '+0300' + ")/",
'P_CREATION_DATE_TO': "/Date(" + Date.parse(this.dateTo) + '+0300' + ")/", 'P_CREATION_DATE_TO': "/Date(" + Date.parse(this.dateTo) + '+0300' + ")/",

@ -19,7 +19,7 @@ export class ServiceService {
getPendingRequests(request, onError, errorLabel) { getPendingRequests(request, onError, errorLabel) {
this.authService.authenticateRequest(request); 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( return this.con.postNoLoad(
ServiceService.GET_PENDING_REQ_FUNCTIONS, ServiceService.GET_PENDING_REQ_FUNCTIONS,
request, request,
@ -29,7 +29,6 @@ export class ServiceService {
} }
getPendingRequestDetails(request, onError, errorLabel) { getPendingRequestDetails(request, onError, errorLabel) {
this.authService.authenticateRequest(request); this.authService.authenticateRequest(request);
request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName;
return this.con.postNoLoad( return this.con.postNoLoad(
ServiceService.GET_PENDING_REQ_DETAILS, ServiceService.GET_PENDING_REQ_DETAILS,
request, request,

Loading…
Cancel
Save