"use strict"; var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.EmployeePickerComponent = void 0; var core_1 = require("@angular/core"); var forms_1 = require("@angular/forms"); var searchEmployee_1 = require("../_models/Employee/searchEmployee"); var enums_1 = require("../_models/enums"); var Dynamic_Picker_1 = require("./dynamic-picker/Dynamic-Picker"); var kendo_data_query_1 = require("@progress/kendo-data-query"); var kendo_svg_icons_1 = require("@progress/kendo-svg-icons"); var EmployeePickerComponent = function () { var _classDecorators = [(0, core_1.Component)({ selector: 'app-employee-picker', templateUrl: './employee-picker.component.html', // styleUrls: ['../../assets/kendo-grid/grid.css'], styles: ["\n .no-padding {\n padding: 0;\n }\n\n .k-overlay {\n opacity: 0;\n border: 1px solid #52527A;\n }\n .link-button {\n background: none;\n border: none;\n color: #007bff;\n text-decoration: underline;\n cursor: pointer;\n padding: 0;\n font-size: inherit;\n }"], encapsulation: core_1.ViewEncapsulation.None, standalone: false, })]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; var _instanceExtraInitializers = []; var _payrollTypeID_decorators; var _payrollTypeID_initializers = []; var _payrollTypeID_extraInitializers = []; var _isRecruitment_decorators; var _isRecruitment_initializers = []; var _isRecruitment_extraInitializers = []; var _set_isClear_decorators; var _set_setSelectedEmp_decorators; var _set_setSelectedEmpByID_decorators; var _pickerFormGroup_decorators; var _pickerFormGroup_initializers = []; var _pickerFormGroup_extraInitializers = []; var _pickerformControlName_decorators; var _pickerformControlName_initializers = []; var _pickerformControlName_extraInitializers = []; var _set_MultiSelect_decorators; var _set_isActive_decorators; var _set_searchForSalary_decorators; var _set_searchForUndoSalary_decorators; var _cancel_decorators; var _cancel_initializers = []; var _cancel_extraInitializers = []; var _ItemSelected_decorators; var _ItemSelected_initializers = []; var _ItemSelected_extraInitializers = []; var _fixedGrades_decorators; var _fixedGrades_initializers = []; var _fixedGrades_extraInitializers = []; var EmployeePickerComponent = _classThis = /** @class */ (function () { function EmployeePickerComponent_1(api, apiService, formBuilder, router, route, empSrvc, basicService, pickerService, loadingService, notificationService) { this.api = (__runInitializers(this, _instanceExtraInitializers), api); this.apiService = apiService; this.formBuilder = formBuilder; this.router = router; this.route = route; this.empSrvc = empSrvc; this.basicService = basicService; this.pickerService = pickerService; this.loadingService = loadingService; this.notificationService = notificationService; this.icons = [kendo_svg_icons_1.saveIcon, kendo_svg_icons_1.gearIcon, kendo_svg_icons_1.fileExcelIcon, kendo_svg_icons_1.filePdfIcon, kendo_svg_icons_1.searchIcon, kendo_svg_icons_1.cancelIcon]; this.genders = enums_1.EnumExtension.getNamesAndValues(enums_1.EnumGender); this.active = true; this.showPopUp = false; this.showAdvancePopUp = false; this.checkboxOnly = false; this.mode = 'multiple'; this.taggedSelection = []; this.searchEmployees = []; this.loadingEmployee = false; this.selectedGender = undefined; this.checkLive = false; this.checkConfirmed = false; this.checkPFMember = false; this.checkOTEligibility = false; this.checkExpatriate = false; this.checkIA = false; this.checkAccessCard = false; this.isDatePickerDisabled = true; this.fromDate = new Date(); this.toDate = new Date(); this.joiningfromDate = new Date(); this.joiningtoDate = new Date(); this.checkLiveNo = false; this.checkConfirmedNo = false; this.checkPFMemberNo = false; this.checkOTEligibilityNo = false; this.checkExpatriateNo = false; this.checkAccessCardNo = false; this.checkJoiningDate = false; this.employeeCount = 0; this.count = 0; this.isMoreOptionsVisible = false; this.isSpanArrowDown = true; this.isSpanArrowUp = false; this.gridHeight = 305; this.payrollTypeID = __runInitializers(this, _payrollTypeID_initializers, void 0); this.isRecruitment = (__runInitializers(this, _payrollTypeID_extraInitializers), __runInitializers(this, _isRecruitment_initializers, void 0)); this.editedEmpId = __runInitializers(this, _isRecruitment_extraInitializers); this.gridMultiSelect = false; this.pickerFormGroup = __runInitializers(this, _pickerFormGroup_initializers, void 0); this.pickerformControlName = (__runInitializers(this, _pickerFormGroup_extraInitializers), __runInitializers(this, _pickerformControlName_initializers, 'EmployeeID')); this._searchForSalary = (__runInitializers(this, _pickerformControlName_extraInitializers), false); this._searchForUndoSalary = false; this.cancel = __runInitializers(this, _cancel_initializers, new core_1.EventEmitter()); this.ItemSelected = (__runInitializers(this, _cancel_extraInitializers), __runInitializers(this, _ItemSelected_initializers, new core_1.EventEmitter())); // Do not change this class without discuss to Salauddin shamim /** role-permission-entry ctor */ this.fixedGrades = (__runInitializers(this, _ItemSelected_extraInitializers), __runInitializers(this, _fixedGrades_initializers, undefined)); this.pageSize = (__runInitializers(this, _fixedGrades_extraInitializers), 25); this.skip = 0; this.selectAllState = "unchecked"; this.selectedItems = []; this.sort = [ { field: "employeeNo", dir: "asc", }, ]; this.designationpicker = new Dynamic_Picker_1.DynamicPicker(Dynamic_Picker_1.EnumDynamicpickerType.Designation, true); this.locationPicker = new Dynamic_Picker_1.DynamicPicker(Dynamic_Picker_1.EnumDynamicpickerType.Location, true); this.departmentPicker = new Dynamic_Picker_1.DynamicPicker(Dynamic_Picker_1.EnumDynamicpickerType.Department, true); this.gradePicker = new Dynamic_Picker_1.DynamicPicker(Dynamic_Picker_1.EnumDynamicpickerType.Grade, true); this.categoryPicker = new Dynamic_Picker_1.DynamicPicker(Dynamic_Picker_1.EnumDynamicpickerType.Category, true); this.religionPicker = new Dynamic_Picker_1.DynamicPicker(Dynamic_Picker_1.EnumDynamicpickerType.Religion, true); this.taggedSelection = []; this.selectedEmployee = null; this.searchEmployees = []; if (this.pickerFormGroup === undefined) { this.pickerFormGroup = new forms_1.FormGroup({ EmployeeID: new forms_1.FormControl(''), EmployeeCount: new forms_1.FormControl('') }); } } Object.defineProperty(EmployeePickerComponent_1.prototype, "isClear", { set: function (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; } }, enumerable: false, configurable: true }); Object.defineProperty(EmployeePickerComponent_1.prototype, "setSelectedEmp", { set: function (inputedEmp) { 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_1.SearchEmployee(); this.selectedAutoCmptEmp = ''; } }, enumerable: false, configurable: true }); Object.defineProperty(EmployeePickerComponent_1.prototype, "setSelectedEmpByID", { set: function (empID) { this.editedEmpId = empID; if (this.editedEmpId !== undefined) { this.search(); } }, enumerable: false, configurable: true }); Object.defineProperty(EmployeePickerComponent_1.prototype, "MultiSelect", { set: function (ismultiselect) { if (ismultiselect !== undefined) { /* this.gridMultiSelect = true;*/ this.gridMultiSelect = ismultiselect; this.setSelectableSettings(); } }, enumerable: false, configurable: true }); Object.defineProperty(EmployeePickerComponent_1.prototype, "isActive", { set: function (isActive) { this.active = isActive; }, enumerable: false, configurable: true }); Object.defineProperty(EmployeePickerComponent_1.prototype, "searchForSalary", { set: function (searchForSalary) { this._searchForSalary = searchForSalary; }, enumerable: false, configurable: true }); Object.defineProperty(EmployeePickerComponent_1.prototype, "searchForUndoSalary", { set: function (searchForUndoSalary) { this._searchForUndoSalary = searchForUndoSalary; }, enumerable: false, configurable: true }); EmployeePickerComponent_1.prototype.ngOnInit = function () { this.checkLive = true; this.loadingService.ShowLoadingPanel = false; this.setSelectableSettings(); this.valueChangedSubscription == this.pickerService.dataChanged.subscribe(function (x) { if (x) { //this.employeeCount = x; } }); }; EmployeePickerComponent_1.prototype.onDataChange = function (event) { this.skip = event.skip; this.loadData(); }; EmployeePickerComponent_1.prototype.moreSearchClick = function () { 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; } }; EmployeePickerComponent_1.prototype.loadData = function () { var _this = this; this.gridView = { data: (0, kendo_data_query_1.orderBy)(this.data.slice(this.skip, this.skip + this.pageSize), this.sort), total: this.data.length, }; this.selectedItems = []; this.gridView.data.forEach(function (x) { if (_this.taggedSelection.findIndex(function (y) { return y == x.employeeID; }) != -1) { _this.selectedItems.push(x.employeeID); } }); }; EmployeePickerComponent_1.prototype.onSelectedKeysChange = function (evt) { var _this = this; var 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(function (x) { var ind = evt.findIndex(function (y) { return y == x.employeeID; }); if (ind != -1) { var rv = _this.taggedSelection.findIndex(function (r) { return r == x.employeeID; }); if (rv == -1) _this.taggedSelection.push(x.employeeID); } else { var rvt = _this.taggedSelection.findIndex(function (r) { return r == x.employeeID; }); if (rvt != -1) _this.taggedSelection.splice(rvt, 1); } }); this.selectAllState = "indeterminate"; } else { this.selectAllState = "checked"; } }; EmployeePickerComponent_1.prototype.onSelectAllChange = function (checkedState) { if (checkedState === "checked") { this.taggedSelection = this.searchEmployees.map(function (item) { return item.employeeID; }); this.selectedItems = this.searchEmployees.map(function (item) { return item.employeeID; }); this.selectAllState = "checked"; } else { this.taggedSelection = []; this.selectedItems = []; this.selectAllState = "unchecked"; } }; EmployeePickerComponent_1.prototype.setSelectableSettings = function () { if (this.gridMultiSelect === false) { this.selectableSettings = { checkboxOnly: true, mode: 'single', // this.mode }; } else { this.selectableSettings = { checkboxOnly: true, mode: 'multiple', // this.mode }; } }; EmployeePickerComponent_1.prototype.joiningDateCheckBoxClick = function (type, isYes) { //console.log(isYes); this.isDatePickerDisabled = !isYes; if (this.checkJoiningDate === true) this.checkJoiningDate = false; else { this.checkJoiningDate = true; } }; EmployeePickerComponent_1.prototype.yesNoCheckBoxClick = function (type, isYes) { 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; } } }; EmployeePickerComponent_1.prototype.hasNumber = function (myString) { return /\d/.test(myString); }; EmployeePickerComponent_1.prototype.handleFilter = function (value) { var _this = this; var str = value; if (value.length === 0 || this.empCodeNameList === undefined) { this.empCodeNameList = []; this.empCodeNameListSource = []; } if (str !== '') { this.empCodeNameList = []; /*if (this.empCodeNameList.length === 0) {*/ var code = ''; var name_1 = ''; if (this.hasNumber(value)) { code = value; } else { name_1 = value; } this.loadingEmployee = true; this.empSrvc.getEmpCodeName(code, name_1) .subscribe(function (resp) { _this.searchEmployees = resp; }, function (err) { // ON ERROR _this.loadingEmployee = false; }, function () { // ON Success _this.loadingEmployee = false; _this.empCodeNameListSource = []; _this.searchEmployees.forEach(function (x) { _this.empCodeNameListSource.push(x.employeeNo + ' ' + x.name); }); _this.empCodeNameList = _this.empCodeNameListSource.filter(function (s) { return 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 EmployeePickerComponent_1.prototype.valueChange = function (value) { if (value !== undefined && value !== '') { var str_1 = value.trim().split(' '); var Searchemp = this.searchEmployees.find(function (x) { return x.employeeNo === str_1[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; } }; EmployeePickerComponent_1.prototype.autoCompleteSelected = function (value) { this.selectedEmployee = value; }; EmployeePickerComponent_1.prototype.search = function () { var _this = this; //debugger var srcManager = new searchEmployee_1.SearchManager(enums_1.EnumSearchFrom.Employee); srcManager.withName = true; srcManager.searchForSalary = this._searchForSalary; srcManager.searchUndoSalary = this._searchForUndoSalary; if (this.checkJoiningDate == undefined && this.checkJoiningDate == true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.JoiningDate, enums_1.EnumSearchObjDataType.Date, this.joiningfromDate); srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.JoiningDate, enums_1.EnumSearchObjDataType.Date, this.joiningtoDate); } if (this.employeeCode !== undefined && this.employeeCode != null && this.employeeCode !== '') { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.EmployeeNo, enums_1.EnumSearchObjDataType.String, this.employeeCode.trim()); } if (this.employeeName !== undefined && this.employeeName !== null && this.employeeName !== '') { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Name, enums_1.EnumSearchObjDataType.String, this.employeeName.trim(), enums_1.EnumSQLOperator.Like); } if (this.payrollTypeID !== undefined) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.PayrollTypeID, enums_1.EnumSearchObjDataType.Number, this.payrollTypeID, enums_1.EnumSQLOperator.EqualTo); } if (this.departmentPicker.selectedIDs !== undefined && this.departmentPicker.selectedIDs.length > 0) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.DepartmentID, enums_1.EnumSearchObjDataType.String, this.departmentPicker.getSelectedValuesIn(), enums_1.EnumSQLOperator.In); } if (this.designationpicker.selectedIDs !== undefined && this.designationpicker.selectedIDs.length > 0) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.DesignationID, enums_1.EnumSearchObjDataType.String, this.designationpicker.getSelectedValuesIn(), enums_1.EnumSQLOperator.In); } if (this.locationPicker.selectedIDs !== undefined && this.locationPicker.selectedIDs.length > 0) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.LocationID, enums_1.EnumSearchObjDataType.String, this.locationPicker.getSelectedValuesIn(), enums_1.EnumSQLOperator.In); } if (this.categoryPicker.selectedIDs !== undefined && this.categoryPicker.selectedIDs.length > 0) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.CategoryID, enums_1.EnumSearchObjDataType.String, this.categoryPicker.getSelectedValuesIn(), enums_1.EnumSQLOperator.In); } if (this.religionPicker.selectedIDs !== undefined && this.religionPicker.selectedIDs.length > 0) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.ReligionID, enums_1.EnumSearchObjDataType.String, this.religionPicker.getSelectedValuesIn(), enums_1.EnumSQLOperator.In); } if (this.gradePicker.selectedIDs !== undefined && this.gradePicker.selectedIDs.length > 0) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.GradeID, enums_1.EnumSearchObjDataType.String, this.gradePicker.getSelectedValuesIn(), enums_1.EnumSQLOperator.In); } else if (this.fixedGrades != undefined) { var str; str = ''; this.fixedGrades.forEach(function (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(enums_1.EnumSearchParameter.GradeID, enums_1.EnumSearchObjDataType.String, str, enums_1.EnumSQLOperator.In); } if (this.selectedGender !== undefined) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Gender, enums_1.EnumSearchObjDataType.Number, this.selectedGender, enums_1.EnumSQLOperator.EqualTo); } if (this.checkConfirmed === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Confirm, enums_1.EnumSearchObjDataType.boolean, this.checkConfirmed, enums_1.EnumSQLOperator.EqualTo); } else if (this.checkConfirmedNo === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Confirm, enums_1.EnumSearchObjDataType.boolean, false, enums_1.EnumSQLOperator.EqualTo); } if (this.checkPFMember === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.PFMember, enums_1.EnumSearchObjDataType.boolean, this.checkPFMember, enums_1.EnumSQLOperator.EqualTo); } else if (this.checkPFMemberNo === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.PFMember, enums_1.EnumSearchObjDataType.boolean, false, enums_1.EnumSQLOperator.EqualTo); } if (this.checkOTEligibility === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.OTEligible, enums_1.EnumSearchObjDataType.boolean, this.checkOTEligibility, enums_1.EnumSQLOperator.EqualTo); } else if (this.checkOTEligibilityNo === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.OTEligible, enums_1.EnumSearchObjDataType.boolean, false, enums_1.EnumSQLOperator.EqualTo); } if (this.checkExpatriate === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Expatriate, enums_1.EnumSearchObjDataType.boolean, this.checkExpatriate, enums_1.EnumSQLOperator.EqualTo); } else if (this.checkExpatriateNo === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Expatriate, enums_1.EnumSearchObjDataType.boolean, false, enums_1.EnumSQLOperator.EqualTo); } if (this.checkLive === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Status, enums_1.EnumSearchObjDataType.Number, 1, enums_1.EnumSQLOperator.EqualTo); } if (this.checkLiveNo === true) { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Status, enums_1.EnumSearchObjDataType.Number, 2, enums_1.EnumSQLOperator.EqualTo); } if (this.checkIA === true) srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.Status, enums_1.EnumSearchObjDataType.Number, enums_1.EnumEmployeeStatus.IA, enums_1.EnumSQLOperator.EqualTo); if (this.nidno === "") srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.NationalID, enums_1.EnumSearchObjDataType.String, this.nidno, enums_1.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(enums_1.EnumSearchParameter.FromEmployeeNO, enums_1.EnumSearchObjDataType.Number, Number(this.employeeCodeFrom) - 1, enums_1.EnumSQLOperator.GraterThan); srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.ToEmployeeNO, enums_1.EnumSearchObjDataType.Number, Number(this.employeeCodeTo) + 1, enums_1.EnumSQLOperator.SmallerThan); } if (this.employeeCodes != "") { srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.EmployeeNoIn, enums_1.EnumSearchObjDataType.String, this.employeeCodes, enums_1.EnumSQLOperator.In); } if (this.isDatePickerDisabled === false) { var fdate = new Date(this.empFromDate); var tdate = new Date(this.empToDate); srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.JoiningDateFrom, enums_1.EnumSearchObjDataType.Date, new Date(fdate.setDate(fdate.getDate() - 1)).toDateString(), enums_1.EnumSQLOperator.GraterThan); srcManager.Parameter.AddParam(enums_1.EnumSearchParameter.JoiningDateTo, enums_1.EnumSearchObjDataType.Date, new Date(tdate.setDate(tdate.getDate() + 1)).toDateString(), enums_1.EnumSQLOperator.SmallerThan); } this.searchEmployees = []; this.loadingService.ShowLoadingPanel = true; this.empSrvc.getSearchEmployee(srcManager) .subscribe(function (resp) { _this.searchEmployees = resp; }, function (err) { _this.loadingService.ShowLoadingPanel = false; // ON ERROR }, function () { 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) { var editeEmp = _this.searchEmployees.find(function (x) { return x.employeeID === _this.editedEmpId; }); _this.selectedAutoCmptEmp = editeEmp.employeeNo + ' ' + editeEmp.name; ; } // ON Success }); }; EmployeePickerComponent_1.prototype.onCancel = function (e) { this.closeForm(); }; EmployeePickerComponent_1.prototype.onSelect = function (e) { var _this = this; this.selectedEmployees = []; this.selectedEmployee = undefined; if (this.taggedSelection.length > 0) { if (this.gridMultiSelect === true) { this.taggedSelection.forEach(function (empid) { _this.selectedEmployees.push(_this.searchEmployees.find(function (x) { return x.employeeID === empid; })); }); } else { this.selectedItems.forEach(function (empid) { _this.selectedEmployee = _this.searchEmployees.find(function (x) { return 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; }; EmployeePickerComponent_1.prototype.SetEmployee = function (employeeid) { var _this = this; this.empSrvc.getSearchEmployeebyid(employeeid) .subscribe(function (resp) { _this.selectedEmployee = resp; }, function (err) { // ON ERROR }, function () { }); }; EmployeePickerComponent_1.prototype.closeForm = function () { this.showPopUp = false; this.EmployeeCount(); this.cancel.emit(); }; EmployeePickerComponent_1.prototype.closeAdvanceForm = function () { this.showAdvancePopUp = false; // this.EmployeeCount(); // this.cancel.emit(); }; EmployeePickerComponent_1.prototype.EmployeeCount = function () { if (this.selectedEmployees != undefined) { this.employeeCount = this.selectedEmployees.length; } else { this.employeeCount = 0; } }; EmployeePickerComponent_1.prototype.OpenForm = function () { //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; }; EmployeePickerComponent_1.prototype.advanceSearchClick = function () { this.showAdvancePopUp = true; }; EmployeePickerComponent_1.prototype.onClickAdvanceSelect = function () { 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(); }; EmployeePickerComponent_1.prototype.onClickClear = function () { 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 = []; }; return EmployeePickerComponent_1; }()); __setFunctionName(_classThis, "EmployeePickerComponent"); (function () { var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; _payrollTypeID_decorators = [(0, core_1.Input)()]; _isRecruitment_decorators = [(0, core_1.Input)()]; _set_isClear_decorators = [(0, core_1.Input)()]; _set_setSelectedEmp_decorators = [(0, core_1.Input)()]; _set_setSelectedEmpByID_decorators = [(0, core_1.Input)()]; _pickerFormGroup_decorators = [(0, core_1.Input)()]; _pickerformControlName_decorators = [(0, core_1.Input)()]; _set_MultiSelect_decorators = [(0, core_1.Input)()]; _set_isActive_decorators = [(0, core_1.Input)()]; _set_searchForSalary_decorators = [(0, core_1.Input)()]; _set_searchForUndoSalary_decorators = [(0, core_1.Input)()]; _cancel_decorators = [(0, core_1.Output)()]; _ItemSelected_decorators = [(0, core_1.Output)()]; _fixedGrades_decorators = [(0, core_1.Input)()]; __esDecorate(_classThis, null, _set_isClear_decorators, { kind: "setter", name: "isClear", static: false, private: false, access: { has: function (obj) { return "isClear" in obj; }, set: function (obj, value) { obj.isClear = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_setSelectedEmp_decorators, { kind: "setter", name: "setSelectedEmp", static: false, private: false, access: { has: function (obj) { return "setSelectedEmp" in obj; }, set: function (obj, value) { obj.setSelectedEmp = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_setSelectedEmpByID_decorators, { kind: "setter", name: "setSelectedEmpByID", static: false, private: false, access: { has: function (obj) { return "setSelectedEmpByID" in obj; }, set: function (obj, value) { obj.setSelectedEmpByID = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_MultiSelect_decorators, { kind: "setter", name: "MultiSelect", static: false, private: false, access: { has: function (obj) { return "MultiSelect" in obj; }, set: function (obj, value) { obj.MultiSelect = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_isActive_decorators, { kind: "setter", name: "isActive", static: false, private: false, access: { has: function (obj) { return "isActive" in obj; }, set: function (obj, value) { obj.isActive = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_searchForSalary_decorators, { kind: "setter", name: "searchForSalary", static: false, private: false, access: { has: function (obj) { return "searchForSalary" in obj; }, set: function (obj, value) { obj.searchForSalary = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_searchForUndoSalary_decorators, { kind: "setter", name: "searchForUndoSalary", static: false, private: false, access: { has: function (obj) { return "searchForUndoSalary" in obj; }, set: function (obj, value) { obj.searchForUndoSalary = value; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(null, null, _payrollTypeID_decorators, { kind: "field", name: "payrollTypeID", static: false, private: false, access: { has: function (obj) { return "payrollTypeID" in obj; }, get: function (obj) { return obj.payrollTypeID; }, set: function (obj, value) { obj.payrollTypeID = value; } }, metadata: _metadata }, _payrollTypeID_initializers, _payrollTypeID_extraInitializers); __esDecorate(null, null, _isRecruitment_decorators, { kind: "field", name: "isRecruitment", static: false, private: false, access: { has: function (obj) { return "isRecruitment" in obj; }, get: function (obj) { return obj.isRecruitment; }, set: function (obj, value) { obj.isRecruitment = value; } }, metadata: _metadata }, _isRecruitment_initializers, _isRecruitment_extraInitializers); __esDecorate(null, null, _pickerFormGroup_decorators, { kind: "field", name: "pickerFormGroup", static: false, private: false, access: { has: function (obj) { return "pickerFormGroup" in obj; }, get: function (obj) { return obj.pickerFormGroup; }, set: function (obj, value) { obj.pickerFormGroup = value; } }, metadata: _metadata }, _pickerFormGroup_initializers, _pickerFormGroup_extraInitializers); __esDecorate(null, null, _pickerformControlName_decorators, { kind: "field", name: "pickerformControlName", static: false, private: false, access: { has: function (obj) { return "pickerformControlName" in obj; }, get: function (obj) { return obj.pickerformControlName; }, set: function (obj, value) { obj.pickerformControlName = value; } }, metadata: _metadata }, _pickerformControlName_initializers, _pickerformControlName_extraInitializers); __esDecorate(null, null, _cancel_decorators, { kind: "field", name: "cancel", static: false, private: false, access: { has: function (obj) { return "cancel" in obj; }, get: function (obj) { return obj.cancel; }, set: function (obj, value) { obj.cancel = value; } }, metadata: _metadata }, _cancel_initializers, _cancel_extraInitializers); __esDecorate(null, null, _ItemSelected_decorators, { kind: "field", name: "ItemSelected", static: false, private: false, access: { has: function (obj) { return "ItemSelected" in obj; }, get: function (obj) { return obj.ItemSelected; }, set: function (obj, value) { obj.ItemSelected = value; } }, metadata: _metadata }, _ItemSelected_initializers, _ItemSelected_extraInitializers); __esDecorate(null, null, _fixedGrades_decorators, { kind: "field", name: "fixedGrades", static: false, private: false, access: { has: function (obj) { return "fixedGrades" in obj; }, get: function (obj) { return obj.fixedGrades; }, set: function (obj, value) { obj.fixedGrades = value; } }, metadata: _metadata }, _fixedGrades_initializers, _fixedGrades_extraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); EmployeePickerComponent = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); __runInitializers(_classThis, _classExtraInitializers); })(); return EmployeePickerComponent = _classThis; }(); exports.EmployeePickerComponent = EmployeePickerComponent; //# sourceMappingURL=employee-picker.component.js.map