EchoTex_Payroll/HRM.UI/ClientApp/src/app/picker/employee-picker.component.ts

793 lines
30 KiB
TypeScript

import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { ApiService } from '../app.api.service';
import { EmployeeServices } from '../_services/employee/employee.service';
import { SelectableSettings, SelectAllCheckboxState } from '@progress/kendo-angular-grid';
import { SearchEmployee, SearchManager } from '../_models/Employee/searchEmployee';
import { EnumEmployeeStatus, EnumExtension, EnumGender, EnumSearchFrom, EnumSearchObjDataType, EnumSearchParameter, EnumSQLOperator } from '../_models/enums';
import { DynamicPicker, EnumDynamicpickerType } from './dynamic-picker/Dynamic-Picker';
import { BasicService } from '../_services/Basic/basic.service';
import { Subscription } from 'rxjs';
import { PickerDataTransferService } from '../data.transfer.service';
import { loadingPanelService } from '../hrm-loding panel/loding.panel.service';
import { HRMNotificationService } from '../app.notification.service';
import {
GridDataResult, PageChangeEvent
} from "@progress/kendo-angular-grid";
import { SortDescriptor, orderBy } from "@progress/kendo-data-query";
@Component({
selector: 'app-employee-picker',
templateUrl: './employee-picker.component.html',
// styleUrls: ['../../assets/kendo-grid/grid.css'],
styles: [`
.no-padding {
padding: 0;
}
.k-overlay {
opacity: 0;
border: 1px solid #52527A;
}
.link-button {
background: none;
border: none;
color: #007bff;
text-decoration: underline;
cursor: pointer;
padding: 0;
font-size: inherit;
}`],
encapsulation: ViewEncapsulation.None,
})
// #############################
// Do not change this class without discuss to Salauddin shamim
export class EmployeePickerComponent implements OnInit {
valueChangedSubscription: Subscription;
genders: any = EnumExtension.getNamesAndValues(EnumGender);
public employeeCode: string;
public employeeName: string;
public active = true;
public showPopUp = false;
public showAdvancePopUp = false;
public checkboxOnly = false;
public mode = 'multiple';
public selectableSettings: SelectableSettings;
taggedSelection: number[] = [];
public searchEmployees: SearchEmployee[] = [];
private loadingEmployee = false;
public selectedEmployees: SearchEmployee[];
public selectedEmployee: SearchEmployee;
departmentPicker: DynamicPicker;
locationPicker: DynamicPicker;
gradePicker: DynamicPicker;
categoryPicker: DynamicPicker;
religionPicker: DynamicPicker;
selectedGender = undefined;
designationpicker: DynamicPicker;
checkLive = false;
checkConfirmed = false;
checkPFMember = false;
checkOTEligibility = false;
checkExpatriate = false;
checkIA = false;
checkAccessCard = false;
isDatePickerDisabled = true;
fromDate: Date = new Date();
toDate: Date = new Date();
empFromDate: Date;
empToDate: Date;
joiningfromDate: Date = new Date();
joiningtoDate: Date = new Date();
checkLiveNo = false;
checkConfirmedNo = false;
checkPFMemberNo = false;
checkOTEligibilityNo = false;
checkExpatriateNo = false;
checkAccessCardNo = false;
checkJoiningDate: boolean = false;
employeeCodeFrom: string;
employeeCodeTo: string;
employeeCodes: string;
nidno: string;
employeeCount: number = 0;
count: number = 0;
isMoreOptionsVisible: boolean = false;
isSpanArrowDown: boolean = true;
isSpanArrowUp: boolean = false;
gridHeight: number = 305;
@Input() public payrollTypeID: number;
@Input() public isRecruitment: number;
@Input() public set isClear(value) {
debugger;
if (value) {
this.selectedItems = [];
// this.count=0;
this.taggedSelection.length = 0;
this.employeeCount = 0;
}
else {
this.selectedItems = [];
// this.count=0;
this.taggedSelection.length = 0;
this.employeeCount = 0;
}
}
@Input()
public set setSelectedEmp(inputedEmp: SearchEmployee) {
if (inputedEmp !== undefined) {
this.selectedEmployee = inputedEmp;
this.taggedSelection = [];
this.taggedSelection.push(this.selectedEmployee.employeeID);
this.selectedAutoCmptEmp = this.selectedEmployee.employeeNo + ' ' + this.selectedEmployee.name;
this.ItemSelected.emit(this.selectedEmployee);
} else {
this.selectedEmployee = new SearchEmployee();
this.selectedAutoCmptEmp = '';
}
}
editedEmpId: number;
@Input()
public set setSelectedEmpByID(empID) {
this.editedEmpId = empID;
if (this.editedEmpId !== undefined) {
this.search();
}
}
private empCodeNameList: Array<string>;
private empCodeNameListSource: Array<string>;
public selectedAutoCmptEmp: string;
public gridMultiSelect = false;
@Input() pickerFormGroup: FormGroup;
@Input() pickerformControlName = 'EmployeeID';
@Input()
public set MultiSelect(ismultiselect: boolean) {
if (ismultiselect !== undefined) {
/* this.gridMultiSelect = true;*/
this.gridMultiSelect = ismultiselect;
this.setSelectableSettings();
}
}
@Input()
public set isActive(isActive: boolean) {
this.active = isActive;
}
public _searchForSalary: boolean = false;
public _searchForUndoSalary: boolean = false;
@Input()
public set searchForSalary(searchForSalary: boolean) {
this._searchForSalary = searchForSalary;
}
@Input()
public set searchForUndoSalary(searchForUndoSalary: boolean) {
this._searchForUndoSalary = searchForUndoSalary;
}
@Output() cancel: EventEmitter<any> = new EventEmitter();
@Output() ItemSelected: EventEmitter<any> = new EventEmitter();
// Do not change this class without discuss to Salauddin shamim
/** role-permission-entry ctor */
@Input() fixedGrades: number[] = undefined;
public pageSize = 25;
public skip = 0;
public gridView: GridDataResult;
public data: unknown[];
public selectAllState: SelectAllCheckboxState = "unchecked";
public selectedItems: number[] = [];
constructor(public api: ApiService,
public formBuilder: FormBuilder,
public router: Router,
public route: ActivatedRoute,
public empSrvc: EmployeeServices,
public basicService: BasicService,
public pickerService: PickerDataTransferService,
public loadingService: loadingPanelService, public notificationService: HRMNotificationService
) {
this.designationpicker = new DynamicPicker(EnumDynamicpickerType.Designation, true);
this.locationPicker = new DynamicPicker(EnumDynamicpickerType.Location, true);
this.departmentPicker = new DynamicPicker(EnumDynamicpickerType.Department, true);
this.gradePicker = new DynamicPicker(EnumDynamicpickerType.Grade, true);
this.categoryPicker = new DynamicPicker(EnumDynamicpickerType.Category, true);
this.religionPicker = new DynamicPicker(EnumDynamicpickerType.Religion, true);
this.taggedSelection = [];
this.selectedEmployee = null;
this.searchEmployees = [];
if (this.pickerFormGroup === undefined) {
this.pickerFormGroup = new FormGroup({
EmployeeID: new FormControl(''),
EmployeeCount: new FormControl('')
});
}
}
ngOnInit() {
this.checkLive = true;
this.loadingService.ShowLoadingPanel = false;
this.setSelectableSettings();
this.valueChangedSubscription == this.pickerService.dataChanged.subscribe(
x => {
if (x) {
//this.employeeCount = x;
}
}
);
}
public onDataChange(event: PageChangeEvent): void {
this.skip = event.skip;
this.loadData();
}
moreSearchClick() {
this.isMoreOptionsVisible = !this.isMoreOptionsVisible;
if (this.isMoreOptionsVisible === true) {
this.isSpanArrowDown = !this.isSpanArrowDown;
this.isSpanArrowUp = !this.isSpanArrowUp;
this.gridHeight = 180;
} else {
this.isSpanArrowDown = !this.isSpanArrowDown;
this.isSpanArrowUp = !this.isSpanArrowUp;
this.gridHeight = 305;
}
}
public sort: SortDescriptor[] = [
{
field: "employeeNo",
dir: "asc",
},
];
public loadData(): void {
this.gridView = {
data: orderBy(this.data.slice(this.skip, this.skip + this.pageSize), this.sort),
total: this.data.length,
};
this.selectedItems = [];
this.gridView.data.forEach(x => {
if (this.taggedSelection.findIndex(y => y == x.employeeID) != -1) {
this.selectedItems.push(x.employeeID);
}
}
);
}
public onSelectedKeysChange(evt: any): void {
const len = evt.length;
if (len === 0) {
this.taggedSelection = [];
this.selectAllState = "unchecked";
} else if (len > 0 && len <= this.searchEmployees.length) {
var pagedata = this.gridView.data;
pagedata.forEach(x => {
var ind = evt.findIndex(y => y == x.employeeID);
if (ind != -1) {
var rv = this.taggedSelection.findIndex(r => r == x.employeeID)
if (rv == -1) this.taggedSelection.push(x.employeeID);
}
else {
var rvt = this.taggedSelection.findIndex(r => r == x.employeeID)
if (rvt != -1) this.taggedSelection.splice(rvt, 1);
}
});
this.selectAllState = "indeterminate";
} else {
this.selectAllState = "checked";
}
}
public onSelectAllChange(checkedState: SelectAllCheckboxState): void {
if (checkedState === "checked") {
this.taggedSelection = this.searchEmployees.map((item) => item.employeeID);
this.selectedItems = this.searchEmployees.map((item) => item.employeeID);
this.selectAllState = "checked";
} else {
this.taggedSelection = [];
this.selectedItems = [];
this.selectAllState = "unchecked";
}
}
setSelectableSettings(): void {
if (this.gridMultiSelect === false) {
this.selectableSettings = {
checkboxOnly: true,
mode: 'single', // this.mode
};
} else {
this.selectableSettings = {
checkboxOnly: true,
mode: 'multiple', // this.mode
};
}
}
joiningDateCheckBoxClick(type: number, isYes: boolean) {
//console.log(isYes);
this.isDatePickerDisabled = !isYes;
if (this.checkJoiningDate === true)
this.checkJoiningDate = false;
else {
this.checkJoiningDate = true;
}
}
yesNoCheckBoxClick(type: number, isYes: any) {
if (type == 1) {
if (isYes == true) {
this.checkLiveNo = false;
} else {
this.checkLiveNo = true;
}
}
if (type == 2) {
if (isYes == true) {
this.checkLive = false;
} else {
this.checkLive = true;
}
}
//if (type == 3) {
// if (isYes == true) {
// this.checkConfirmedNo = false;
// }
// else {
// this.checkConfirmedNo = true;
// }
//}
//if (type == 4) {
// if (isYes == true) {
// this.checkConfirmed = false;
// }
// else {
// this.checkConfirmed = true;
// }
//}
//if (type == 5) {
// if (isYes == true) {
// this.checkPFMemberNo = false;
// }
// else {
// this.checkPFMemberNo = true;
// }
//}
//if (type == 6) {
// if (isYes == true) {
// this.checkPFMember = false;
// }
// else {
// this.checkPFMember = true;
// }
//}
//if (type == 7) {
// if (isYes == true) {
// this.checkOTEligibilityNo = false;
// }
// else {
// this.checkOTEligibilityNo = true;
// }
//}
//if (type == 8) {
// if (isYes == true) {
// this.checkOTEligibility = false;
// }
// else {
// this.checkOTEligibility = true;
// }
//}
//if (type == 9) {
// if (isYes == true) {
// this.checkOTEligibilityNo = false;
// }
// else {
// this.checkOTEligibilityNo = true;
// }
//}
//if (type == 10) {
// if (isYes == true) {
// this.checkExpatriate = false;
// }
// else {
// this.checkExpatriate = true;
// }
//}
if (type == 11) {
if (isYes == true) {
this.checkIA = true;
this.checkLive = false;
this.checkLiveNo = false;
}
else {
this.checkIA = false;
}
}
}
hasNumber(myString) {
return /\d/.test(myString);
}
handleFilter(value) {
debugger
const str: string = value;
if (value.length === 0 || this.empCodeNameList === undefined) {
this.empCodeNameList = [];
this.empCodeNameListSource = [];
}
if (str !== '' && str.length > 2) {
this.empCodeNameList = [];
/*if (this.empCodeNameList.length === 0) {*/
let code = '';
let name = '';
if (this.hasNumber(value)) {
code = value;
} else {
name = value;
}
this.loadingEmployee = true;
this.empSrvc.getEmpCodeName(code, name)
.subscribe(
(resp: any) => {
this.searchEmployees = resp;
},
(err: any) => {
// ON ERROR
this.loadingEmployee = false;
},
() => {
// ON Success
this.loadingEmployee = false;
this.empCodeNameListSource = [];
this.searchEmployees.forEach(x => {
this.empCodeNameListSource.push(x.employeeNo + ' ' + x.name);
});
this.empCodeNameList = this.empCodeNameListSource.filter((s) =>
s.toLowerCase().indexOf(value.toLowerCase()) !== -1);
}
);
/*} else {
this.empCodeNameList = this.empCodeNameListSource.filter((s) =>
s.toLowerCase().indexOf(value.toLowerCase()) !== -1);
}*/
}
}
// Do not change this class without discuss to Salauddin shamim
public valueChange(value: string): void {
if (value !== undefined && value !== '') {
const str: string[] = value.trim().split(' ');
const Searchemp = this.searchEmployees.find(x => x.employeeNo === str[0]);
if (Searchemp !== undefined) {
this.selectedEmployee = Searchemp;
this.ItemSelected.emit(this.selectedEmployee);
this.selectedItems.push(this.selectedEmployee.employeeID);
this.taggedSelection.push(this.selectedEmployee.employeeID);
// this.pickerFormGroup[this.pickerformControlName].value = undefined;
} else {
this.selectedEmployee = undefined;
this.ItemSelected.emit(undefined);
this.selectedItems = [];
this.taggedSelection = [];
}
} else {
this.selectedEmployee = undefined;
this.ItemSelected.emit(undefined);
this.selectedItems = [];
this.taggedSelection = [];
// this.pickerFormGroup[this.pickerformControlName].value = undefined;
}
}
public autoCompleteSelected(value: any): void {
this.selectedEmployee = value;
}
search() {
//debugger
const srcManager: SearchManager = new SearchManager(EnumSearchFrom.Employee);
srcManager.withName = true;
srcManager.searchForSalary = this._searchForSalary;
srcManager.searchUndoSalary = this._searchForUndoSalary;
if (this.checkJoiningDate == undefined && this.checkJoiningDate == true) {
srcManager.Parameter.AddParam(EnumSearchParameter.JoiningDate, EnumSearchObjDataType.Date, this.joiningfromDate);
srcManager.Parameter.AddParam(EnumSearchParameter.JoiningDate, EnumSearchObjDataType.Date, this.joiningtoDate);
}
if (this.employeeCode !== undefined && this.employeeCode != null && this.employeeCode !== '') {
srcManager.Parameter.AddParam(EnumSearchParameter.EmployeeNo, EnumSearchObjDataType.String, this.employeeCode.trim());
}
if (this.employeeName !== undefined && this.employeeName !== null && this.employeeName !== '') {
srcManager.Parameter.AddParam(EnumSearchParameter.Name, EnumSearchObjDataType.String, this.employeeName.trim(), EnumSQLOperator.Like);
}
if (this.payrollTypeID !== undefined) {
srcManager.Parameter.AddParam(EnumSearchParameter.PayrollTypeID, EnumSearchObjDataType.Number, this.payrollTypeID, EnumSQLOperator.EqualTo);
}
if (this.departmentPicker.selectedIDs !== undefined && this.departmentPicker.selectedIDs.length > 0) {
srcManager.Parameter.AddParam(EnumSearchParameter.DepartmentID, EnumSearchObjDataType.String, this.departmentPicker.getSelectedValuesIn(), EnumSQLOperator.In);
}
if (this.designationpicker.selectedIDs !== undefined && this.designationpicker.selectedIDs.length > 0) {
srcManager.Parameter.AddParam(EnumSearchParameter.DesignationID, EnumSearchObjDataType.String, this.designationpicker.getSelectedValuesIn(), EnumSQLOperator.In);
}
if (this.locationPicker.selectedIDs !== undefined && this.locationPicker.selectedIDs.length > 0) {
srcManager.Parameter.AddParam(EnumSearchParameter.LocationID, EnumSearchObjDataType.String, this.locationPicker.getSelectedValuesIn(), EnumSQLOperator.In);
}
if (this.categoryPicker.selectedIDs !== undefined && this.categoryPicker.selectedIDs.length > 0) {
srcManager.Parameter.AddParam(EnumSearchParameter.CategoryID, EnumSearchObjDataType.String, this.categoryPicker.getSelectedValuesIn(), EnumSQLOperator.In);
}
if (this.religionPicker.selectedIDs !== undefined && this.religionPicker.selectedIDs.length > 0) {
srcManager.Parameter.AddParam(EnumSearchParameter.ReligionID, EnumSearchObjDataType.String, this.religionPicker.getSelectedValuesIn(), EnumSQLOperator.In);
}
if (this.gradePicker.selectedIDs !== undefined && this.gradePicker.selectedIDs.length > 0) {
srcManager.Parameter.AddParam(EnumSearchParameter.GradeID, EnumSearchObjDataType.String, this.gradePicker.getSelectedValuesIn(), EnumSQLOperator.In);
} else if (this.fixedGrades != undefined) {
var str: string;
str = '';
this.fixedGrades.forEach(x => {
str = str + x + ',';
});
if (str.length > 0) {
str = str.substring(0, str.length - 1);
}
if (str.length < 1) {
this.notificationService.showWarning('Please select a Grade');
return;
}
srcManager.Parameter.AddParam(EnumSearchParameter.GradeID, EnumSearchObjDataType.String, str, EnumSQLOperator.In);
}
if (this.selectedGender !== undefined) {
srcManager.Parameter.AddParam(EnumSearchParameter.Gender, EnumSearchObjDataType.Number, this.selectedGender, EnumSQLOperator.EqualTo);
}
if (this.checkConfirmed === true) {
srcManager.Parameter.AddParam(EnumSearchParameter.Confirm, EnumSearchObjDataType.boolean, this.checkConfirmed, EnumSQLOperator.EqualTo);
} else if (this.checkConfirmedNo === true) {
srcManager.Parameter.AddParam(EnumSearchParameter.Confirm, EnumSearchObjDataType.boolean, false, EnumSQLOperator.EqualTo);
}
if (this.checkPFMember === true) {
srcManager.Parameter.AddParam(EnumSearchParameter.PFMember, EnumSearchObjDataType.boolean, this.checkPFMember, EnumSQLOperator.EqualTo);
} else if (this.checkPFMemberNo === true) {
srcManager.Parameter.AddParam(EnumSearchParameter.PFMember, EnumSearchObjDataType.boolean, false, EnumSQLOperator.EqualTo);
}
if (this.checkOTEligibility === true) {
srcManager.Parameter.AddParam(EnumSearchParameter.OTEligible, EnumSearchObjDataType.boolean, this.checkOTEligibility, EnumSQLOperator.EqualTo);
} else if (this.checkOTEligibilityNo === true) {
srcManager.Parameter.AddParam(EnumSearchParameter.OTEligible, EnumSearchObjDataType.boolean, false, EnumSQLOperator.EqualTo);
}
if (this.checkExpatriate === true) {
srcManager.Parameter.AddParam(EnumSearchParameter.Expatriate, EnumSearchObjDataType.boolean, this.checkExpatriate, EnumSQLOperator.EqualTo);
} else if (this.checkExpatriateNo === true) {
srcManager.Parameter.AddParam(EnumSearchParameter.Expatriate, EnumSearchObjDataType.boolean, false, EnumSQLOperator.EqualTo);
}
if (this.checkLive === true) {
//Previous Code For Only Live Employee
srcManager.Parameter.AddParam(EnumSearchParameter.Status, EnumSearchObjDataType.Number, 1, EnumSQLOperator.EqualTo);
//New Code For Live And Waiting For Join
// srcManager.Parameter.AddParam(EnumSearchParameter.Status, EnumSearchObjDataType.Number, '1,6', EnumSQLOperator.In);
}
if (this.checkLiveNo === true) {
//Previous Code For Only Not Live
// srcManager.Parameter.AddParam(EnumSearchParameter.Status, EnumSearchObjDataType.Number, 2, EnumSQLOperator.EqualTo);
//New Code For Live And Waiting For Join
srcManager.Parameter.AddParam(EnumSearchParameter.Status, EnumSearchObjDataType.Number, '2,6', EnumSQLOperator.In);
}
if (this.checkIA === true)
srcManager.Parameter.AddParam(EnumSearchParameter.Status, EnumSearchObjDataType.Number, EnumEmployeeStatus.IA, EnumSQLOperator.EqualTo);
if (this.nidno === "")
srcManager.Parameter.AddParam(EnumSearchParameter.NationalID, EnumSearchObjDataType.String, this.nidno, EnumSQLOperator.EqualTo);
// if (this.employeeCodeFrom != "" && this.employeeCodeTo != "" &&
// Number(this.employeeCodeFrom) != NaN && Number(this.employeeCodeTo) != NaN) {
// srcManager.Parameter.AddParam(EnumSearchParameter.FromEmployeeNO, EnumSearchObjDataType.Number, Number( this.employeeCodeFrom) - 1, EnumSQLOperator.GraterThan);
// srcManager.Parameter.AddParam(EnumSearchParameter.ToEmployeeNO, EnumSearchObjDataType.Number,Number( this.employeeCodeTo) +1, EnumSQLOperator.SmallerThan);
// }
if (this.employeeCodeFrom != "" && this.employeeCodeTo != "" &&
!Number.isNaN(Number(this.employeeCodeFrom)) && !Number.isNaN(Number(this.employeeCodeTo))) {
srcManager.Parameter.AddParam(EnumSearchParameter.FromEmployeeNO, EnumSearchObjDataType.Number, Number(this.employeeCodeFrom) - 1, EnumSQLOperator.GraterThan);
srcManager.Parameter.AddParam(EnumSearchParameter.ToEmployeeNO, EnumSearchObjDataType.Number, Number(this.employeeCodeTo) + 1, EnumSQLOperator.SmallerThan);
}
if (this.employeeCodes != "") {
srcManager.Parameter.AddParam(EnumSearchParameter.EmployeeNoIn, EnumSearchObjDataType.String, this.employeeCodes, EnumSQLOperator.In);
}
if (this.isDatePickerDisabled === false) {
var fdate = new Date(this.empFromDate);
var tdate = new Date(this.empToDate);
srcManager.Parameter.AddParam(EnumSearchParameter.JoiningDateFrom, EnumSearchObjDataType.Date, new Date(fdate.setDate(
fdate.getDate() - 1)).toDateString(), EnumSQLOperator.GraterThan);
srcManager.Parameter.AddParam(EnumSearchParameter.JoiningDateTo, EnumSearchObjDataType.Date,
new Date(tdate.setDate(tdate.getDate() + 1)).toDateString(), EnumSQLOperator.SmallerThan);
}
this.searchEmployees = [];
this.loadingService.ShowLoadingPanel = true;
this.empSrvc.getSearchEmployee(srcManager)
.subscribe(
(resp: any) => {
this.searchEmployees = resp;
},
(err: any) => {
this.loadingService.ShowLoadingPanel = false;
// ON ERROR
},
() => {
if (this.searchEmployees != undefined) {
this.skip = 0;
this.selectedItems = [];
this.taggedSelection = [];
this.data = this.searchEmployees;
this.loadData();
}
this.count = this.searchEmployees.length;
this.loadingService.ShowLoadingPanel = false;
if (this.editedEmpId !== undefined) {
const editeEmp = this.searchEmployees.find(x => x.employeeID === this.editedEmpId);
this.selectedAutoCmptEmp = editeEmp.employeeNo + ' ' + editeEmp.name;;
}
// ON Success
}
);
}
public onCancel(e): void {
this.closeForm();
}
public onSelect(e): void {
this.selectedEmployees = [];
this.selectedEmployee = undefined;
if (this.taggedSelection.length > 0) {
if (this.gridMultiSelect === true) {
this.taggedSelection.forEach(empid => {
this.selectedEmployees.push(this.searchEmployees.find(x => x.employeeID === empid));
});
} else {
this.selectedItems.forEach(empid => {
this.selectedEmployee = this.searchEmployees.find(x => x.employeeID === empid);
});
}
}
if (this.gridMultiSelect === false) {
this.selectedAutoCmptEmp = this.selectedEmployee.employeeNo + '-' + this.selectedEmployee.name;
this.ItemSelected.emit(this.selectedEmployee);
} else {
this.ItemSelected.emit(this.selectedEmployees);
}
this.EmployeeCount();
this.showPopUp = false;
}
private SetEmployee(employeeid: number): void {
this.empSrvc.getSearchEmployeebyid(employeeid)
.subscribe(
(resp: any) => {
this.selectedEmployee = resp;
},
(err: any) => {
// ON ERROR
},
() => {
}
);
}
private closeForm(): void {
this.showPopUp = false;
this.EmployeeCount();
this.cancel.emit();
}
private closeAdvanceForm(): void {
this.showAdvancePopUp = false;
// this.EmployeeCount();
// this.cancel.emit();
}
private EmployeeCount(): void {
if (this.selectedEmployees != undefined) {
this.employeeCount = this.selectedEmployees.length;
} else {
this.employeeCount = 0;
}
}
private OpenForm(): void {
//this.selectedEmployees = [];
//this.selectedEmployee = new SearchEmployee();
//this.taggedSelection = [];
//this.selectedItems = [];
if (this.selectedEmployee != undefined && this.searchEmployees != undefined) {
this.selectedItems.push(this.selectedEmployee.employeeID);
this.taggedSelection.push(this.selectedEmployee.employeeID);
}
this.showPopUp = true;
}
private advanceSearchClick(): void {
this.showAdvancePopUp = true;
}
private onClickAdvanceSelect() {
if (!this.isDatePickerDisabled) {
this.empFromDate = this.joiningfromDate;
this.empToDate = this.joiningtoDate;
}
else {
this.empFromDate = undefined;
this.empToDate = undefined;
}
if (this.employeeCodeFrom === '' || this.employeeCodeTo === '') {
this.employeeCodeFrom = undefined;
this.employeeCodeFrom = undefined;
}
this.closeAdvanceForm();
}
public onClickClear() {
this.employeeCodeFrom = undefined;
this.employeeCodeTo = undefined;
this.empFromDate = undefined;
this.empToDate = undefined;
this.employeeCodes = undefined;
this.nidno = undefined;
// this.joiningDateCheckBoxClick(11,false);
this.checkJoiningDate = false;
this.isDatePickerDisabled = true;
this.selectedItems = [];
this.taggedSelection = [];
}
}