|
|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
|
import { Platform, Events, MenuController, ModalController } from '@ionic/angular';
|
|
|
|
|
import { Events, MenuController, ModalController } from '@ionic/angular';
|
|
|
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
|
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
|
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
|
|
|
|
@ -9,6 +9,9 @@ import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbore
|
|
|
|
|
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
|
|
|
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
|
import { EditDetailProfileComponent } from '../modal/edit-detail-profile/edit-detail-profile.component';
|
|
|
|
|
import { ProfileService } from '../service/profile.service'
|
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-home',
|
|
|
|
|
templateUrl: './home.component.html',
|
|
|
|
|
@ -16,25 +19,24 @@ import { EditDetailProfileComponent } from '../modal/edit-detail-profile/edit-de
|
|
|
|
|
})
|
|
|
|
|
export class HomeComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
User_name_Emp: string = '';
|
|
|
|
|
User_Job_name: string;
|
|
|
|
|
public direction: string;
|
|
|
|
|
private menu: MenuController;
|
|
|
|
|
setImage: any;
|
|
|
|
|
// imageSrc: any = "../assets/imgs/profile.png";
|
|
|
|
|
user_image: any = '../assets/imgs/profile.png';
|
|
|
|
|
personalInfo: any;
|
|
|
|
|
appraisalArr: any = [];
|
|
|
|
|
public setImage: any;
|
|
|
|
|
public user_image: any = '../assets/imgs/profile.png';
|
|
|
|
|
public personalInfo: any;
|
|
|
|
|
public appraisalArr: any = [];
|
|
|
|
|
public performanceData: any = [];
|
|
|
|
|
public static PERFORMANCE_DATA = 'perAppData';
|
|
|
|
|
|
|
|
|
|
public personalInfoSegment = true;
|
|
|
|
|
public personalInfoSegment = false;
|
|
|
|
|
public basicDetailsSegment = false;
|
|
|
|
|
public addressSegment = false;
|
|
|
|
|
|
|
|
|
|
public editBasic = false;
|
|
|
|
|
public editAddress = false;
|
|
|
|
|
public targetValue: any;
|
|
|
|
|
public employeeBasicDetails: any = [];
|
|
|
|
|
public fullName: string;
|
|
|
|
|
public maritalStatus: string;
|
|
|
|
|
public birthDate: any;
|
|
|
|
|
public civilIdentityNumber: any;
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
@ -44,34 +46,66 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
public sharedData: SharedDataService,
|
|
|
|
|
public events: Events,
|
|
|
|
|
private sanitizer: DomSanitizer,
|
|
|
|
|
public modalController: ModalController
|
|
|
|
|
// private events: Events,
|
|
|
|
|
// private sanitizer: DomSanitizer,
|
|
|
|
|
|
|
|
|
|
public modalController: ModalController,
|
|
|
|
|
public profileService: ProfileService,
|
|
|
|
|
public router: ActivatedRoute
|
|
|
|
|
) {
|
|
|
|
|
this.direction = TranslatorService.getCurrentDirection();
|
|
|
|
|
this.events.subscribe('img-change', displayImg => {
|
|
|
|
|
console.log('app compont: ' + displayImg);
|
|
|
|
|
this.user_image = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.router.queryParams.subscribe(params => {
|
|
|
|
|
this.targetValue = params.targetValue;
|
|
|
|
|
if (this.targetValue === 'sideMenu') {
|
|
|
|
|
this.personalInfoSegment = true;
|
|
|
|
|
} else if(this.targetValue === 'basicDetails') {
|
|
|
|
|
this.basicDetailsSegment = true;
|
|
|
|
|
} else if(this.targetValue === 'address') {
|
|
|
|
|
this.addressSegment = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.personalInfoSegment = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.getProfile();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getProfile() {
|
|
|
|
|
public getBasicDetails() {
|
|
|
|
|
const body = {
|
|
|
|
|
P_SELECTED_EMPLOYEE_NUMBER: this.personalInfo.EMPLOYEE_NUMBER,
|
|
|
|
|
P_MENU_TYPE: "E",
|
|
|
|
|
P_SELECTED_RESP_ID: -999
|
|
|
|
|
};
|
|
|
|
|
this.profileService.getEmployeeBasicDetails(body).subscribe((result: any) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.employeeBasicDetails = result.GetEmployeeBasicDetailsList;
|
|
|
|
|
console.log(this.employeeBasicDetails);
|
|
|
|
|
for( let i = 0; i < this.employeeBasicDetails.length; i++ ){
|
|
|
|
|
if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'FULL_NAME') {
|
|
|
|
|
this.fullName = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP;
|
|
|
|
|
} else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'MARITAL_STATUS') {
|
|
|
|
|
this.maritalStatus = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP;
|
|
|
|
|
} else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'DATE_OF_BIRTH') {
|
|
|
|
|
this.birthDate = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP;
|
|
|
|
|
} else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'NATIONAL_IDENTIFIER') {
|
|
|
|
|
this.civilIdentityNumber = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getProfile() {
|
|
|
|
|
console.log('getProfile');
|
|
|
|
|
this.authService
|
|
|
|
|
.loadAuthenticatedUser()
|
|
|
|
|
.subscribe((user: AuthenticatedUser) => {
|
|
|
|
|
if (user) {
|
|
|
|
|
console.log(user);
|
|
|
|
|
this.personalInfo = user;
|
|
|
|
|
this.User_name_Emp = this.personalInfo.EMPLOYEE_NAME;
|
|
|
|
|
this.User_Job_name = this.personalInfo.JOB_NAME;
|
|
|
|
|
if (this.cs.getUpdateImage().status) {
|
|
|
|
|
this.user_image = this.sanitizer.bypassSecurityTrustUrl('data:image/png;base64,' + this.cs.getUpdateImage().img);
|
|
|
|
|
} else {
|
|
|
|
|
@ -79,33 +113,24 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
? 'data:image/png;base64,' + user.EMPLOYEE_IMAGE
|
|
|
|
|
: '../assets/imgs/profile.png';
|
|
|
|
|
}
|
|
|
|
|
console.log(user);
|
|
|
|
|
console.log(this.personalInfo);
|
|
|
|
|
console.log('name: ' + this.personalInfo.EMPLOYEE_NAME);
|
|
|
|
|
console.log('user name: ' + user.EMPLOYEE_NAME);
|
|
|
|
|
console.log('name: ' + this.personalInfo.JOB_NAME);
|
|
|
|
|
console.log('job name: ' + user.JOB_NAME);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getBasicDetails();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openEditprofile() {
|
|
|
|
|
this.cs.openProfile();
|
|
|
|
|
public openEditprofile() {
|
|
|
|
|
this.cs.openProfile('sideMenu');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openPerormance() {
|
|
|
|
|
public openPerormance() {
|
|
|
|
|
this.showPerformanceAppraisal();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showPerformanceAppraisal() {
|
|
|
|
|
public showPerformanceAppraisal() {
|
|
|
|
|
this.DS.getPerformanceAppraisal(() => {
|
|
|
|
|
this.showPerformanceAppraisal();
|
|
|
|
|
}).subscribe((result: PerformanceAppraisalResponse) => {
|
|
|
|
|
this.handlePerformanceAppraisalResult(result);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -114,24 +139,21 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
if (this.cs.hasData(result.GetPerformanceAppraisalList)) {
|
|
|
|
|
this.appraisalArr = result.GetPerformanceAppraisalList;
|
|
|
|
|
this.performanceData = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < this.appraisalArr.length; i++) {
|
|
|
|
|
this.performanceData.push({ name: this.appraisalArr[i].APPRAISAL_YEAR, value: parseInt(this.appraisalArr[i].APPRAISAL_SCORE).toFixed() });
|
|
|
|
|
}
|
|
|
|
|
console.log('PerformanceAppraisalResponse');
|
|
|
|
|
this.sharedData.setSharedData(this.performanceData, PerformanceAppraisalResponse.PERFORMANCE_DATA);
|
|
|
|
|
//localStorage.setItem("performanceData", this.performanceData)
|
|
|
|
|
this.cs.openPerformanceevaluation();
|
|
|
|
|
} else {
|
|
|
|
|
let msg: string = this.ts.trPK("userProfile", "no-appraisal");
|
|
|
|
|
this.cs.presentAlert(msg);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectedSegment(segmentData) {
|
|
|
|
|
switch (segmentData) {
|
|
|
|
|
public selectedSegment(segmentData){
|
|
|
|
|
switch (segmentData){
|
|
|
|
|
case "personal":
|
|
|
|
|
this.personalInfoSegment = true;
|
|
|
|
|
this.basicDetailsSegment = false;
|
|
|
|
|
@ -156,8 +178,8 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allowEdit(allowVal) {
|
|
|
|
|
switch (allowVal) {
|
|
|
|
|
public allowEdit(allowVal){
|
|
|
|
|
switch(allowVal){
|
|
|
|
|
case 1:
|
|
|
|
|
this.editBasic = true;
|
|
|
|
|
break;
|
|
|
|
|
@ -167,8 +189,8 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
disableEdit(disableVal) {
|
|
|
|
|
switch (disableVal) {
|
|
|
|
|
public disableEdit(disableVal){
|
|
|
|
|
switch(disableVal){
|
|
|
|
|
case 1:
|
|
|
|
|
this.editBasic = false;
|
|
|
|
|
break;
|
|
|
|
|
@ -176,10 +198,8 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
this.editAddress = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async presentModal() {
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: EditDetailProfileComponent,
|
|
|
|
|
|