2024-10-14 10:01:49 +06:00
|
|
|
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
|
|
import { HrEmployee } from '../../../_models/HREmployee/hrEmployee';
|
|
|
|
import { SearchEmployee } from '../../../_models/Employee/searchEmployee';
|
|
|
|
import { EmployeeServices } from '../../../_services/employee/employee.service';
|
|
|
|
import { ApiService } from '../../../app.api.service';
|
|
|
|
import { HRMNotificationService } from '../../../app.notification.service';
|
|
|
|
import { DataTransferService } from '../../../data.transfer.service';
|
|
|
|
import { AppWindowPopUp } from '../../../app.windowPopup.service';
|
|
|
|
import { UntilityHandlerService } from '../../../utility.hanldler.service';
|
|
|
|
import { Employee } from '../../../_models/Employee/employee';
|
|
|
|
import { DynamicPicker, EnumDynamicpickerType } from '../../../picker/dynamic-picker/Dynamic-Picker';
|
|
|
|
import { EmpLifeCycle } from '../../../_models/Employee/empLifeCycle';
|
|
|
|
import { EmployeeStatus } from '../../../_models/Employee/employeeStatus';
|
|
|
|
import { EmpLifeCycleServices } from '../../../_services/employee/empLifeCycle.service';
|
|
|
|
import { Grade } from '../../../_models/Basic/grade';
|
|
|
|
import { Department } from '../../../_models/Basic/department';
|
|
|
|
import { Designation } from '../../../_models/HRBasic/designation';
|
|
|
|
import { Location } from '../../../_models/Basic/location';
|
|
|
|
import { Category } from '../../../_models/Basic/category';
|
|
|
|
import { EmployeeGradeSalary } from '../../../_models/Employee/employeeGradeSalary';
|
|
|
|
import { BasicService } from '../../../_services/Basic/basic.service';
|
|
|
|
import { EnumArrearType, EnumBloodGroup, EnumEmployeeStatus, EnumLifeCycleComponent, EnumPFMembershipType, EnumStatus } from '../../../_models/enums';
|
|
|
|
import { OrganogramBasic } from '../../../_models/Payroll/organogramBasic';
|
|
|
|
import { OrganogramService } from '../../../_services/payroll/organogram.service';
|
|
|
|
import { loadingPanelService } from '../../../hrm-loding panel/loding.panel.service';
|
|
|
|
import { CostCenter } from '../../../_models/Basic/costcenter';
|
|
|
|
import { RowClassArgs } from '@progress/kendo-angular-grid';
|
|
|
|
import { PayrollType } from '../../../_models/Authentication/payrollType';
|
|
|
|
import { GrievanceManagementService } from '../../../_services/grievance-management/grievanceManagement.service';
|
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
|
|
import { WorkflowService } from '../../../_services/workflow/workflow.service';
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-life-cycle-entry',
|
|
|
|
templateUrl: './life-cycle-entry.component.html',
|
|
|
|
styleUrls: ['./life-cycle-entry.component.css'],
|
|
|
|
encapsulation: ViewEncapsulation.None,
|
|
|
|
styles: [`
|
|
|
|
.k-grid tr.passive {
|
|
|
|
background-color: #ADD8E6;
|
|
|
|
}
|
|
|
|
`],
|
|
|
|
})
|
|
|
|
export class LifeCycleEntryComponent implements OnInit {
|
|
|
|
_fromValidator: FormGroup;
|
|
|
|
_employee: Employee;
|
|
|
|
_designationPicker: DynamicPicker;
|
|
|
|
_departmentPicker: DynamicPicker;
|
|
|
|
_gradePicker: DynamicPicker;
|
|
|
|
_categoryPicker: DynamicPicker;
|
|
|
|
_costcenterPicker: DynamicPicker;
|
|
|
|
_locationPicker: DynamicPicker;
|
|
|
|
_empLifeCycle: EmpLifeCycle;
|
|
|
|
_statusString: string;
|
|
|
|
_lifecycleHistory: EmpLifeCycle[];
|
|
|
|
_employeeStatus: EmployeeStatus[];
|
|
|
|
_payrollTypes: PayrollType[];
|
|
|
|
_complains: any[];
|
|
|
|
_punishments: any[];
|
|
|
|
_selectedPayrollTypeID: number;
|
|
|
|
_selectedComplainID: number;
|
|
|
|
_selectedPunishmentID: number;
|
|
|
|
_sDescription: string;
|
|
|
|
_selectedEventID: number;
|
|
|
|
_lifeCycleComponent: EnumLifeCycleComponent;
|
|
|
|
_remarks: string;
|
|
|
|
_pickerSelecteEmp: SearchEmployee;
|
|
|
|
_currentGrade: Grade;
|
|
|
|
_gradeList: Grade[] = undefined;
|
|
|
|
@Input() fromCoreHr: boolean;
|
|
|
|
@Input()
|
|
|
|
public set SetEmployee(InputObject: SearchEmployee) {
|
|
|
|
this._pickerSelecteEmp = InputObject;
|
|
|
|
this.GetSelectedEmployee(InputObject);
|
|
|
|
this.empPickerActive = false;
|
|
|
|
}
|
|
|
|
_effectDate: Date = undefined;
|
|
|
|
public empPickerActive: boolean = true;
|
|
|
|
public isDesingation: boolean = false;
|
|
|
|
public isDepartment: boolean = false;
|
|
|
|
public isCategory: boolean = false;
|
|
|
|
public isGrade: boolean = false;
|
|
|
|
public isLocation: boolean = false;
|
|
|
|
public isBasicSalary: boolean = false;
|
|
|
|
public isGrossSalary: boolean = false;
|
|
|
|
public isShowConfirmed: boolean = false;
|
|
|
|
public isPFMember: boolean = false;
|
|
|
|
public isCostCenter: boolean = false;
|
|
|
|
public isshoDistinueDate: boolean = false;
|
|
|
|
public isOrganogram: boolean = false;
|
|
|
|
public isPayrollType: boolean = false;
|
|
|
|
public isComplain: boolean = false;
|
|
|
|
public isPunishment: boolean = false;
|
|
|
|
public _selectedogranogram: OrganogramBasic;
|
|
|
|
public _CurrentEmpgranogram: OrganogramBasic;
|
|
|
|
public gradeSalaries: any;
|
|
|
|
|
|
|
|
constructor(public employeeService: EmployeeServices,
|
|
|
|
public apiservice: ApiService, public basicDataService: BasicService, public lifecycleService: EmpLifeCycleServices,
|
|
|
|
public notificationService: HRMNotificationService,
|
|
|
|
public datatransferservice: DataTransferService, public WindowPopUp: AppWindowPopUp, public grievenceService: GrievanceManagementService,
|
|
|
|
public utilityHandlerService: UntilityHandlerService, public organogramService: OrganogramService,
|
|
|
|
public loadingPanelService: loadingPanelService,
|
|
|
|
public router: Router, public workflowService: WorkflowService,
|
|
|
|
public acrouter: ActivatedRoute,) {
|
|
|
|
if (this.router.url === '/payroll/career-and-profile/life-cycle-entry')
|
|
|
|
this.apiservice.selectedMenuName = 'Employee Life Cycle';
|
|
|
|
|
|
|
|
if (!this.fromCoreHr) {
|
|
|
|
// this.apiservice.selectedMenuName = 'Employee Life Cycle';
|
|
|
|
}
|
|
|
|
this._designationPicker = new DynamicPicker(EnumDynamicpickerType.Designation, false);
|
|
|
|
this._departmentPicker = new DynamicPicker(EnumDynamicpickerType.Department, false);
|
|
|
|
this._gradePicker = new DynamicPicker(EnumDynamicpickerType.Grade, false);
|
|
|
|
this._locationPicker = new DynamicPicker(EnumDynamicpickerType.Location, false);
|
|
|
|
|
|
|
|
this._categoryPicker = new DynamicPicker(EnumDynamicpickerType.Category, false);
|
|
|
|
this._costcenterPicker = new DynamicPicker(EnumDynamicpickerType.CostCenter, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this._employee = new Employee();
|
|
|
|
this._empLifeCycle = new EmpLifeCycle();
|
|
|
|
this._CurrentEmpgranogram = new OrganogramBasic();
|
|
|
|
this.lifecycleService.GetByUserID().subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._employeeStatus = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private refreshGradeSalaries() {
|
|
|
|
if (this._employee !== undefined) {
|
|
|
|
this.lifecycleService.GetSalaryHistory(this._employee.id).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this.gradeSalaries = resp;
|
|
|
|
//console.log(this.gradeSalaries);
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
//if (this.gradeSalaries != undefined) {
|
|
|
|
// this.gradeSalaries.forEach(x => {
|
|
|
|
// x.grade = this._
|
|
|
|
// });
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private CreateFormValidator(): void {
|
|
|
|
|
|
|
|
this._employee = new Employee();
|
|
|
|
this._fromValidator = new FormBuilder().group({
|
|
|
|
loginId: ['', Validators.required],
|
|
|
|
name: ['', Validators.required],
|
|
|
|
password: ['', Validators.required],
|
|
|
|
confirmPassword: ['', Validators.required],
|
|
|
|
passwordHints: '',
|
|
|
|
email: '',
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
EventselectionChange(value: any) {
|
|
|
|
|
|
|
|
this.isDesingation = false;
|
|
|
|
this.isDepartment = false;
|
|
|
|
this.isCategory = false;
|
|
|
|
this.isGrade = false;
|
|
|
|
this.isLocation = false;
|
|
|
|
this.isBasicSalary = false;
|
|
|
|
this.isGrossSalary = false;
|
|
|
|
this.isShowConfirmed = false;
|
|
|
|
this.isPFMember = false;
|
|
|
|
this.isCostCenter = false;
|
|
|
|
this.isPayrollType = false;
|
|
|
|
this.isComplain = false;
|
|
|
|
this.isPunishment = false;
|
|
|
|
this.isshoDistinueDate = false;
|
|
|
|
this._sDescription = "";
|
|
|
|
this._remarks = '';
|
|
|
|
this.isOrganogram = false;
|
|
|
|
|
|
|
|
if (value != undefined) {
|
|
|
|
|
|
|
|
var item: EmployeeStatus = this._employeeStatus.find(x => x.id == value.id);
|
|
|
|
if (item != undefined) {
|
|
|
|
if (item.empStatus == EnumEmployeeStatus.Discontinued) {
|
|
|
|
this.isshoDistinueDate = true;
|
|
|
|
}
|
|
|
|
item.employeeStatusComponents.forEach(c => {
|
2024-12-12 16:44:47 +06:00
|
|
|
//console.log(c);
|
2024-10-14 10:01:49 +06:00
|
|
|
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Basic_salary) {
|
|
|
|
this.isBasicSalary = true;
|
|
|
|
this.prepareGradeList();
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Gross_salary) {
|
|
|
|
this.isGrossSalary = true;
|
|
|
|
this.prepareGradeList();
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Confirm) {
|
|
|
|
this.isShowConfirmed = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.PF_Member) {
|
|
|
|
this.isPFMember = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Grade) {
|
|
|
|
this.isGrade = true;
|
|
|
|
this.prepareGradeList();
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Location) {
|
|
|
|
this.isLocation = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Department) {
|
|
|
|
this.isDepartment = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Designation) {
|
|
|
|
this.isDesingation = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Category) {
|
|
|
|
this.isCategory = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Cost_Center) {
|
|
|
|
this.isCostCenter = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Payroll_Type) {
|
|
|
|
this.isPayrollType = true;
|
|
|
|
this.lifecycleService.GetAllPayrollTypes().subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._payrollTypes = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Grievance) {
|
|
|
|
this.isComplain = true;
|
|
|
|
this.isPunishment = true;
|
|
|
|
this.grievenceService.getAllPunishments().subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._punishments = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
|
|
|
|
}
|
|
|
|
);
|
|
|
|
this.grievenceService.getAllComplains().subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._complains = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Position_With_Properties) {
|
|
|
|
this.isOrganogram = true;
|
|
|
|
this.isDepartment = true;
|
|
|
|
this.isDesingation = true;
|
|
|
|
this.isLocation = true;
|
|
|
|
this.isGrade = true;
|
|
|
|
this.isBasicSalary = true;
|
|
|
|
this.isGrossSalary = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Position_Without_Properties) {
|
|
|
|
this.isOrganogram = true;
|
|
|
|
}
|
|
|
|
if (c.componentType == EnumLifeCycleComponent.Force_Remove_From_Position) {
|
|
|
|
this.isOrganogram = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
this._sDescription = item.description;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
getStatusSring(): string {
|
|
|
|
var str: string = '';
|
|
|
|
if (this._employee != undefined && this._employee.name != '') {
|
|
|
|
|
|
|
|
var emp: Employee = new Employee();
|
|
|
|
str = emp.getStatusString(this._employee.status);
|
|
|
|
}
|
|
|
|
this._statusString = str;
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
private prepareGradeList() {
|
|
|
|
if (this._gradeList == undefined) {
|
|
|
|
this.basicDataService.getAllGrade(EnumStatus.Regardless).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._gradeList = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public GetSelectedEmployee(sremployee: SearchEmployee) {
|
|
|
|
if (sremployee === undefined) {
|
|
|
|
this._empLifeCycle = new EmpLifeCycle();
|
|
|
|
this._lifecycleHistory = [];
|
|
|
|
this._employee = new Employee();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = true;
|
|
|
|
this.employeeService.getEmployeeByID(sremployee.employeeID).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._employee = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
if (this._employee.crgId > 0) {
|
|
|
|
this.showCostCenter();
|
|
|
|
}
|
|
|
|
this.RefreshControl();
|
|
|
|
this.getStatusSring();
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
showCostCenter() {
|
|
|
|
let costCenter = new CostCenter();
|
|
|
|
this.basicDataService.getCostCenter(this._employee.crgId).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
costCenter = resp;
|
|
|
|
},
|
|
|
|
(err) => {
|
|
|
|
console.log(err);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this._employee.costcenterName = costCenter.code + '-' + costCenter.name;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public RefreshControl() {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = true;
|
|
|
|
this.lifecycleService.getEmpLifeCycles(this._employee.id).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._lifecycleHistory = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
this.refreshGradeSalaries();
|
|
|
|
this.EmpRefreshControl();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
organogramselected(org: any) {
|
|
|
|
if (org == undefined) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((org as OrganogramBasic).employeeNoView != undefined) {
|
|
|
|
var str = 'Selected position is not vacant, So currently posted Employee :' + (org as OrganogramBasic).employeeNoView + ':'
|
|
|
|
+ (org as OrganogramBasic).employeeNameView + ' will be vacant. Do you like to proceed?';
|
|
|
|
|
|
|
|
if (!confirm(str)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.organogramService.getOrganogramBasicById(org.id).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._selectedogranogram = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
var item: OrganogramBasic = org;
|
|
|
|
this._departmentPicker.setItem(this._selectedogranogram.departmentID, '', this.basicDataService);
|
|
|
|
this._designationPicker.setItem(this._selectedogranogram.designationID, '', this.basicDataService);
|
|
|
|
this._locationPicker.setItem(this._selectedogranogram.locationID, '', this.basicDataService);
|
|
|
|
this._gradePicker.setItem(this._selectedogranogram.gradeID == undefined ? 0 : this._selectedogranogram.gradeID, '', this.basicDataService);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public EmpRefreshControl() {
|
|
|
|
|
|
|
|
|
|
|
|
if (this._employee.gradeID != null) {
|
|
|
|
this.basicDataService.getGradeByID(this._employee.gradeID).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._currentGrade = resp;
|
|
|
|
this._employee.gradeName = (resp as Grade).name;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._employee.departmentID != null) {
|
|
|
|
this.basicDataService.getDepartmentByID(this._employee.departmentID).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._employee.departmentName = (resp as Department).name;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._employee.designationID != null) {
|
|
|
|
this.basicDataService.getDesignationByID(this._employee.designationID).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._employee.designationName = (resp as Designation).name;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._employee.locationID != null) {
|
|
|
|
this.basicDataService.getLocationByID(this._employee.locationID).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._employee.locationName = (resp as Location).name;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (this._employee.categoryID != null) {
|
|
|
|
this.basicDataService.getCategoryByID(this._employee.categoryID).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._employee.categoryName = (resp as Category).name;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
console.log(err.error);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
this.organogramService.getOrganogramBasicByEmployeeId(this._employee.id).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._CurrentEmpgranogram = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
SetFromDescription(entryType?: string) {
|
|
|
|
this._sDescription = '';
|
|
|
|
if (this._selectedEventID != undefined) {
|
|
|
|
this._sDescription = this._employeeStatus.find(x => x.id == this._selectedEventID).description;
|
|
|
|
}
|
|
|
|
this._empLifeCycle.HREmployee = new HrEmployee();
|
|
|
|
this._empLifeCycle.employee = this._employee;
|
|
|
|
|
|
|
|
if (this.isOrganogram == true && this._selectedogranogram != undefined) {
|
|
|
|
this._sDescription += ', Organogram Position';
|
|
|
|
if (this._CurrentEmpgranogram != null && this._CurrentEmpgranogram != undefined
|
|
|
|
&& this._CurrentEmpgranogram.positionName != '') {
|
|
|
|
this._sDescription += ' From ' + this._CurrentEmpgranogram.positionName + ' To ';
|
|
|
|
}
|
|
|
|
|
|
|
|
this._sDescription += this._selectedogranogram.positionName;
|
|
|
|
this._empLifeCycle.nodeID = this._selectedogranogram.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this._gradePicker.selectedID !== undefined && this._gradePicker.selectedID !== 0) {
|
|
|
|
this._sDescription += ', Grade';
|
|
|
|
if (this._employee.gradeName != '' && this._employee.gradeName != undefined) {
|
|
|
|
this._sDescription += ' From ' + this._employee.gradeName;
|
|
|
|
}
|
|
|
|
|
|
|
|
var gradeList = this._gradePicker.selectedObjects as Grade[];
|
|
|
|
this._sDescription += ' To ' + gradeList[0].name;
|
|
|
|
this._empLifeCycle.gradeID = this._gradePicker.selectedID;
|
|
|
|
}
|
|
|
|
if (this._costcenterPicker.selectedID !== undefined && this._costcenterPicker.selectedID !== 0) {
|
|
|
|
this._sDescription += ', Cost Center';
|
|
|
|
this._empLifeCycle.costCenterID = this._costcenterPicker.selectedID;
|
|
|
|
}
|
|
|
|
if (this._selectedPayrollTypeID != undefined) {
|
|
|
|
//this._sDescription += ', PayrollType';
|
|
|
|
this._empLifeCycle.payrollTypeID = this._selectedPayrollTypeID;
|
|
|
|
this._empLifeCycle.isPayrollTypeChanged = true;
|
|
|
|
}
|
|
|
|
if (this.isComplain == true && this._selectedComplainID != undefined) {
|
|
|
|
this._empLifeCycle.complainID = this._selectedComplainID;
|
|
|
|
this._sDescription += ', Complain:' + this._complains.find(x => x.id == this._selectedComplainID).description;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (this.isPunishment == true && this._selectedPunishmentID != undefined) {
|
|
|
|
this._empLifeCycle.punishmentID = this._selectedPunishmentID;
|
|
|
|
this._sDescription += ', Punishment:' + this._punishments.find(x => x.id == this._selectedPunishmentID).description;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (this._departmentPicker.selectedID !== undefined && this._departmentPicker.selectedID !== 0) {
|
|
|
|
this._sDescription += ', Department';
|
|
|
|
if (this._employee.departmentName != '' && this._employee.departmentName != undefined) {
|
|
|
|
this._sDescription += ' From ' + this._employee.departmentName;
|
|
|
|
}
|
|
|
|
let ItemList = this._departmentPicker.selectedObjects as Department[];
|
|
|
|
this._sDescription += ' To ' + ItemList[0].name;
|
|
|
|
this._empLifeCycle.departmentID = this._departmentPicker.selectedID;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._designationPicker.selectedID !== undefined && this._designationPicker.selectedID !== 0) {
|
|
|
|
this._sDescription += ', Designation';
|
|
|
|
if (this._employee.designationName != '' && this._employee.designationName != undefined) {
|
|
|
|
this._sDescription += ' From ' + this._employee.designationName;
|
|
|
|
}
|
|
|
|
let ItemList = this._designationPicker.selectedObjects as Designation[];
|
|
|
|
this._sDescription += ' To ' + ItemList[0].name;
|
|
|
|
this._empLifeCycle.designationID = this._designationPicker.selectedID;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._locationPicker.selectedID !== undefined && this._locationPicker.selectedID !== 0) {
|
|
|
|
this._sDescription += ', Location';
|
|
|
|
if (this._employee.locationName != '' && this._employee.locationName != undefined) {
|
|
|
|
this._sDescription += ' From ' + this._employee.locationName;
|
|
|
|
}
|
|
|
|
let ItemList = this._locationPicker.selectedObjects as Location[];
|
|
|
|
this._sDescription += ' To ' + ItemList[0].name;
|
|
|
|
this._empLifeCycle.locationID = this._locationPicker.selectedID;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._categoryPicker.selectedID !== undefined && this._categoryPicker.selectedID !== 0) {
|
|
|
|
this._sDescription += ', Category';
|
|
|
|
if (this._employee.categoryName != '' && this._employee.categoryName != undefined) {
|
|
|
|
this._sDescription += ' From ' + this._employee.categoryName;
|
|
|
|
}
|
|
|
|
let ItemList = this._categoryPicker.selectedObjects as Category[];
|
|
|
|
this._sDescription += ' To ' + ItemList[0].name;
|
|
|
|
this._empLifeCycle.categoryID = this._categoryPicker.selectedID;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.grossSalary > 0) {
|
|
|
|
|
|
|
|
this._sDescription += ', Gross-Salary';
|
|
|
|
if (this._employee.grossSalary > 0) {
|
|
|
|
this._sDescription += ' From ' + this._employee.grossSalary.toString();
|
|
|
|
}
|
|
|
|
this._sDescription += ' To ' + this._empLifeCycle.grossSalary;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (entryType == "GrossSalary") {
|
|
|
|
if (this._currentGrade != undefined && this.isGrade == false) {
|
|
|
|
if (this._currentGrade.basicPercentOfGross > 0)
|
|
|
|
this._empLifeCycle.basicSalary = this._empLifeCycle.grossSalary *
|
|
|
|
this._currentGrade.basicPercentOfGross / 100;
|
|
|
|
}
|
|
|
|
else if (this.isGrade == true && this._empLifeCycle.gradeID != undefined) {
|
|
|
|
if (this._empLifeCycle.gradeID != undefined) {
|
|
|
|
var og = this._gradeList.find(x => x.id == this._empLifeCycle.gradeID);
|
|
|
|
if (og.basicPercentOfGross > 0)
|
|
|
|
this._empLifeCycle.basicSalary = this._empLifeCycle.grossSalary *
|
|
|
|
og.basicPercentOfGross / 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._empLifeCycle.basicSalary > 0) {
|
|
|
|
|
|
|
|
this._sDescription += ', Basic-Salary';
|
|
|
|
if (this._employee.basicSalary > 0) {
|
|
|
|
this._sDescription += ' From ' + this._employee.basicSalary.toString();
|
|
|
|
}
|
|
|
|
this._sDescription += ' To ' + this._empLifeCycle.basicSalary;
|
|
|
|
}
|
|
|
|
|
|
|
|
this._empLifeCycle.HREmployee = new HrEmployee();
|
|
|
|
this._empLifeCycle.HREmployee.gender = this._employee.gender;
|
|
|
|
this._empLifeCycle.HREmployee.maritalStatus = this._employee.maritalStatus;
|
|
|
|
this._empLifeCycle.HREmployee.bloodGroup = EnumBloodGroup.None; // default value;
|
|
|
|
this._empLifeCycle.HREmployee.religionID = this._employee.religionID;
|
|
|
|
|
|
|
|
this._empLifeCycle.HREmployee.gradeID = this._empLifeCycle.gradeID;
|
|
|
|
this._empLifeCycle.HREmployee.departmentID = this._empLifeCycle.departmentID;
|
|
|
|
this._empLifeCycle.HREmployee.designationID = this._empLifeCycle.designationID;
|
|
|
|
this._empLifeCycle.HREmployee.locationID = this._empLifeCycle.locationID;
|
|
|
|
this._empLifeCycle.HREmployee.categoryID = this._empLifeCycle.categoryID == null ? this._employee.categoryID : this._empLifeCycle.categoryID;
|
|
|
|
this._empLifeCycle.HREmployee.basicSalary = this._empLifeCycle.basicSalary;
|
|
|
|
this._empLifeCycle.HREmployee.grossSalary = this._empLifeCycle.grossSalary;
|
|
|
|
|
|
|
|
this._empLifeCycle.HREmployee.functionID = this._empLifeCycle.functionID;
|
|
|
|
this._empLifeCycle.HREmployee.companyID = this._empLifeCycle.companyID;
|
|
|
|
this._empLifeCycle.HREmployee.status = EnumEmployeeStatus.Live;
|
|
|
|
|
|
|
|
//if (this._selectedEventID != undefined) {
|
|
|
|
// var evt: EmployeeStatus = this._employeeStatus.find(x => x.id == this._selectedEventID);
|
|
|
|
// if (this._empLifeCycle.employeestatus == EnumEmployeeStatus.Discontinued) {
|
|
|
|
// this._sDescription += this._empLifeCycle.employeestatus.toString();
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
this._empLifeCycle.description = this._sDescription;
|
|
|
|
}
|
|
|
|
|
|
|
|
public rowCallback(context: RowClassArgs) {
|
|
|
|
|
|
|
|
if (context.dataItem.arrearinfo == EnumArrearType.ToCalculate) { // change this condition as you need
|
|
|
|
//console.log(context.dataItem.arrearType)
|
|
|
|
return {
|
|
|
|
passive: true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else return {
|
|
|
|
passive: false
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public ValidateGradeSalary(): boolean {
|
|
|
|
|
|
|
|
if ((this._empLifeCycle.basicSalary != 0 || this._empLifeCycle.grossSalary != 0) || (this._empLifeCycle.gradeID != undefined && this._empLifeCycle.gradeID != null)) {
|
|
|
|
var ogs: EmployeeGradeSalary = new EmployeeGradeSalary();
|
|
|
|
ogs.basicSalary = (this._empLifeCycle.basicSalary == null) ? 0 : this._empLifeCycle.basicSalary;
|
|
|
|
ogs.grossSalary = (this._empLifeCycle.grossSalary == null) ? 0 : this._empLifeCycle.grossSalary;
|
|
|
|
if (this._empLifeCycle.gradeID == null) {
|
|
|
|
if (this._employee.gradeID == null) {
|
|
|
|
this.notificationService.showInfo('Grade not yet assigned to employee.');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ogs.gradeID = this._employee.gradeID;
|
|
|
|
ogs.increment = this._empLifeCycle.incrementNo;
|
|
|
|
//ogs.PayScaleDetailID = cbcGrade.SelectedSlab.ID;
|
|
|
|
} else {
|
|
|
|
ogs.gradeID = this._empLifeCycle.gradeID;
|
|
|
|
ogs.increment = this._empLifeCycle.incrementNo;
|
|
|
|
//ogs.PayScaleDetailID = cbcGrade.SelectedSlab.ID;
|
|
|
|
}
|
|
|
|
if (ogs.basicSalary + ogs.grossSalary == 0) {
|
|
|
|
if (this._employee.basicSalary + this._employee.grossSalary == 0) {
|
|
|
|
this.notificationService.showInfo('Salary(HRBasic/Gross) can\'t be zero.');
|
|
|
|
} else {
|
|
|
|
ogs.basicSalary = this._employee.basicSalary;
|
|
|
|
ogs.grossSalary = this._employee.grossSalary;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ogs.increment = Convert.ToInt16(numIncrement.Value);
|
|
|
|
ogs.employeeID = this._empLifeCycle.employeeID;
|
|
|
|
ogs.gradeSalaryTypeID = this._empLifeCycle.statusDetailID;
|
|
|
|
ogs.effectDate = this._empLifeCycle.effectDate;
|
|
|
|
this._empLifeCycle.employeeGradeSalary = ogs;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
isSalaryDeleteActive(id: number): boolean {
|
|
|
|
var item = this.gradeSalaries.find(x => x.empgradesalaryid == id);
|
|
|
|
var rtim: boolean = false;
|
|
|
|
if (item.arrearinfo == EnumArrearType.ToCalculate) {
|
|
|
|
rtim = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rtim;
|
|
|
|
}
|
|
|
|
|
|
|
|
islifcycleDeleteActive(id: number): boolean {
|
|
|
|
var rtim: boolean = false;
|
|
|
|
var index = this._lifecycleHistory[0].id;
|
|
|
|
if (index == id) {
|
|
|
|
rtim = true;
|
|
|
|
//console.log(index);
|
|
|
|
}
|
|
|
|
return rtim;
|
|
|
|
}
|
|
|
|
|
|
|
|
public deleteArrearGradeSalary(pkid: number) {
|
|
|
|
|
|
|
|
if (!confirm('Are you sure to Delete?')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var item: EmployeeGradeSalary = this.gradeSalaries.find(x => x.empgradesalaryid == pkid);
|
|
|
|
item.arrearType = EnumArrearType.ToCalculate;
|
|
|
|
item.id = pkid;
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = true;
|
|
|
|
this.lifecycleService.deleteGradeSalary(item).subscribe(
|
|
|
|
(x) => {
|
|
|
|
this._empLifeCycle.id = Number(x);
|
|
|
|
},
|
|
|
|
(x) => {
|
|
|
|
this.notificationService.showError(x.error);
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
this.notificationService.showSuccess('Data deleted successfully.');
|
|
|
|
var index = this.gradeSalaries.findIndex(x => x.id == pkid);
|
|
|
|
this.gradeSalaries.splice(index, 1);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public deletelifecycle(pkid: number) {
|
|
|
|
|
|
|
|
if (!confirm('Are you sure to Delete?')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var item: EmpLifeCycle = this._lifecycleHistory.find(x => x.id == pkid);
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = true;
|
|
|
|
this.lifecycleService.DeleteEmpLifecycele(item).subscribe(
|
|
|
|
(x) => {
|
|
|
|
this._empLifeCycle.id = Number(x);
|
|
|
|
},
|
|
|
|
(x) => {
|
|
|
|
this.notificationService.showError(x.error);
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
this.notificationService.showSuccess('Data deleted successfully.');
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
this.getEmployeeRefresh();
|
|
|
|
this.refreshGradeSalaries();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public validateInput() {
|
|
|
|
var bValid = true;
|
|
|
|
if (this.isCategory == true && (this._empLifeCycle.categoryID == undefined || this._empLifeCycle.categoryID == 0)) {
|
|
|
|
this.notificationService.showWarning('Please Select a Category.');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isDesingation == true && (this._empLifeCycle.designationID == undefined || this._empLifeCycle.designationID == null)) {
|
|
|
|
this.notificationService.showWarning('Please Select a Designation.');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
if (this.isDepartment == true && (this._empLifeCycle.departmentID == undefined || this._empLifeCycle.departmentID == null)) {
|
|
|
|
this.notificationService.showWarning('Please Select a Department.');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
if (this.isLocation == true && (this._empLifeCycle.locationID == undefined || this._empLifeCycle.locationID == null)) {
|
|
|
|
this.notificationService.showWarning('Please Select a Location.');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
if (this.isGrade == true && (this._empLifeCycle.gradeID == undefined || this._empLifeCycle.gradeID == null)) {
|
|
|
|
this.notificationService.showWarning('Please Select a Grade.');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isOrganogram == true && (this._empLifeCycle.nodeID == undefined || this._empLifeCycle.nodeID == null)) {
|
|
|
|
|
|
|
|
this.notificationService.showWarning('Please Select a Organogram.');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
if (this.isCostCenter == true && (this._empLifeCycle.costCenterID == undefined || this._empLifeCycle.costCenterID == null)) {
|
|
|
|
this.notificationService.showWarning('Please Select a Cost-center.');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
if (this.isBasicSalary == true && (this._empLifeCycle.basicSalary == undefined || this._empLifeCycle.basicSalary == 0)) {
|
|
|
|
this.notificationService.showWarning('Please enter basic salary.');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
if (this.isGrossSalary == true && (this._empLifeCycle.grossSalary == undefined || this._empLifeCycle.grossSalary == 0)) {
|
|
|
|
this.notificationService.showWarning('Please enter Gross Salary');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
if (this.isShowConfirmed == true && this._empLifeCycle.isConfirm == undefined) {
|
|
|
|
this.notificationService.showWarning('Please check cofirmation');
|
|
|
|
bValid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bValid;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Save() {
|
2024-12-12 16:44:47 +06:00
|
|
|
debugger
|
2024-10-14 10:01:49 +06:00
|
|
|
if (this._selectedEventID == undefined) {
|
|
|
|
this.notificationService.showWarning('Select an event.');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (this._effectDate == undefined) {
|
|
|
|
this.notificationService.showWarning('Select an effect Date.');
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._sDescription == "") {
|
|
|
|
this.notificationService.showWarning('Description field can not be Empty');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.validateInput() == false) return;
|
|
|
|
this._empLifeCycle.effectDate = this._effectDate;
|
|
|
|
|
|
|
|
if (this.isOrganogram == true) {
|
|
|
|
if (this._selectedogranogram == undefined) {
|
|
|
|
this.notificationService.showWarning('Select an organogram Node.');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (this._CurrentEmpgranogram != null && this._selectedogranogram.id == this._CurrentEmpgranogram.id) {
|
|
|
|
this.notificationService.showWarning('New Organogram Node can not same selected organogram node.');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this._empLifeCycle.nodeID = this._selectedogranogram.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._employee == null && this._employee == undefined) {
|
|
|
|
this.notificationService.showWarning('Select an employee.');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._employee.joiningDate != null && this._employee.joiningDate != undefined && new Date(this._employee.joiningDate) > this._empLifeCycle.effectDate) {
|
|
|
|
this.notificationService.showWarning('The effect date cannot be prior to the joining date.');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this._empLifeCycle.employeeID = this._employee.id;
|
|
|
|
this._empLifeCycle.statusDetailID = this._selectedEventID;
|
|
|
|
this._empLifeCycle.description = this._sDescription;
|
|
|
|
this._empLifeCycle.remarks = this._remarks;
|
|
|
|
this._empLifeCycle.isTransferReceived = false;
|
|
|
|
if (this.ValidateGradeSalary() === false) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isPFMember == true) {
|
|
|
|
this._empLifeCycle.pfMemberType = EnumPFMembershipType.Live;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this._empLifeCycle.statusDetailID = this._selectedEventID;
|
|
|
|
const evt: EmployeeStatus = this._employeeStatus.find(x => x.id === this._selectedEventID);
|
|
|
|
this._empLifeCycle.employeestatus = evt.empStatus;
|
|
|
|
this._empLifeCycle.isTransferReceived = evt.isTransferReceived;
|
|
|
|
this._empLifeCycle.id = 0;
|
|
|
|
var ncount = 0;
|
|
|
|
if (this._empLifeCycle.employeestatus == EnumEmployeeStatus.Discontinued) {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = true;
|
|
|
|
this.workflowService.pendingLoanAndWorkflowCount(this._empLifeCycle.employeeID).subscribe(
|
|
|
|
(x) => {
|
|
|
|
ncount = Number(x);
|
|
|
|
},
|
|
|
|
(x) => {
|
|
|
|
this.notificationService.showError(x.error);
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
if (ncount > 0) {
|
|
|
|
if (!confirm('Employee has loan/pending-approval, please settle them before discontinue. Do you like to discontinue forcefully?')) {
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
this.saveCycle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.saveCycle();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.saveCycle();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
saveCycle() {
|
|
|
|
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = true;
|
|
|
|
this.lifecycleService.SaveLifeCycle(this._empLifeCycle).subscribe(
|
|
|
|
(x) => {
|
|
|
|
this._empLifeCycle.id = Number(x);
|
|
|
|
},
|
|
|
|
(x) => {
|
|
|
|
console.log(x);
|
|
|
|
this.notificationService.showError(x.error);
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
this.notificationService.showSuccess('Data saved successfully.');
|
|
|
|
this.RefreshAfterSave();
|
|
|
|
this.clear();
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
RefreshAfterSave() {
|
|
|
|
if (this._empLifeCycle.gradeID != undefined) {
|
|
|
|
this._employee.gradeID = this._empLifeCycle.gradeID;
|
|
|
|
this._employee.gradeName = (this._gradePicker.selectedObjects[0] as Grade).name;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.locationID != undefined) {
|
|
|
|
this._employee.locationID = this._empLifeCycle.locationID;
|
|
|
|
this._employee.locationName = (this._locationPicker.selectedObjects[0] as Location).name;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.departmentID != undefined) {
|
|
|
|
this._employee.departmentID = this._empLifeCycle.departmentID;
|
|
|
|
this._employee.departmentName = (this._departmentPicker.selectedObjects[0] as Department).name;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.categoryID != undefined) {
|
|
|
|
this._employee.categoryID = this._empLifeCycle.categoryID;
|
|
|
|
this._employee.categoryName = (this._categoryPicker.selectedObjects[0] as Category).name;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.designationID != undefined) {
|
|
|
|
this._employee.designationID = this._empLifeCycle.designationID;
|
|
|
|
this._employee.designationName = (this._designationPicker.selectedObjects[0] as Designation).name;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.costCenterID != undefined) {
|
|
|
|
this._employee.crgId = this._empLifeCycle.costCenterID;
|
|
|
|
this._employee.costcenterName = (this._costcenterPicker.selectedObjects[0] as CostCenter).name;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.isConfirm != undefined) {
|
|
|
|
this._employee.isConfirmed = true;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.employeestatus == EnumEmployeeStatus.Discontinued) {
|
|
|
|
this._employee.status = EnumEmployeeStatus.Discontinued;
|
|
|
|
var emp: Employee = new Employee();
|
|
|
|
this._statusString = emp.getStatusString(this._employee.status);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.grossSalary != undefined
|
|
|
|
&& this._empLifeCycle.grossSalary != 0) {
|
|
|
|
this._employee.grossSalary = this._empLifeCycle.grossSalary;
|
|
|
|
}
|
|
|
|
if (this._empLifeCycle.basicSalary != undefined
|
|
|
|
&& this._empLifeCycle.basicSalary != 0) {
|
|
|
|
this._employee.basicSalary = this._empLifeCycle.basicSalary;
|
|
|
|
}
|
|
|
|
|
|
|
|
let cloneUser = Object.assign({}, this._empLifeCycle);
|
|
|
|
this._lifecycleHistory.splice(0, 0, cloneUser);
|
|
|
|
this.refreshGradeSalaries();
|
|
|
|
}
|
|
|
|
clear() {
|
|
|
|
this._selectedEventID = null;
|
|
|
|
this.EventselectionChange(undefined);
|
|
|
|
this._effectDate = undefined;
|
|
|
|
this._sDescription = '';
|
|
|
|
this._empLifeCycle = new EmpLifeCycle();
|
|
|
|
this._remarks = '';
|
|
|
|
this._designationPicker.setItem(0, '', this.basicDataService);
|
|
|
|
this._departmentPicker.setItem(0, '', this.basicDataService);
|
|
|
|
this._locationPicker.setItem(0, '', this.basicDataService);
|
|
|
|
this._gradePicker.setItem(0, '', this.basicDataService);
|
|
|
|
this._categoryPicker.setItem(0, '', this.basicDataService);
|
|
|
|
this._costcenterPicker.setItem(0, '', this.basicDataService);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getEmployeeRefresh() {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = true;
|
|
|
|
this.employeeService.getEmployeeByID(this._employee.id).subscribe(
|
|
|
|
(resp: any) => {
|
|
|
|
this._employee = resp;
|
|
|
|
},
|
|
|
|
(err: any) => {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
this.notificationService.showError(err.error);
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
|
|
this.RefreshControl();
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|