employee search ordered and lenth addition

This commit is contained in:
mashfiq 2024-12-10 17:01:26 +06:00
parent 6a436e9b3c
commit b3aaed7af4
2 changed files with 19 additions and 3 deletions

View File

@ -438,12 +438,13 @@ export class EmployeePickerComponent implements OnInit {
} }
handleFilter(value) { handleFilter(value) {
debugger
const str: string = value; const str: string = value;
if (value.length === 0 || this.empCodeNameList === undefined) { if (value.length === 0 || this.empCodeNameList === undefined) {
this.empCodeNameList = []; this.empCodeNameList = [];
this.empCodeNameListSource = []; this.empCodeNameListSource = [];
} }
if (str !== '') { if (str !== '' && str.length > 2) {
this.empCodeNameList = []; this.empCodeNameList = [];
/*if (this.empCodeNameList.length === 0) {*/ /*if (this.empCodeNameList.length === 0) {*/
let code = ''; let code = '';

View File

@ -17,6 +17,7 @@ using Microsoft.Extensions.Options;
using static Azure.Core.HttpHeader; using static Azure.Core.HttpHeader;
using iTextSharp.text; using iTextSharp.text;
using static iTextSharp.text.pdf.AcroFields; using static iTextSharp.text.pdf.AcroFields;
using Org.BouncyCastle.Utilities;
namespace HRM.UI.Controllers namespace HRM.UI.Controllers
{ {
@ -733,7 +734,20 @@ namespace HRM.UI.Controllers
List<SearchEmployee> olist = new List<SearchEmployee>(); List<SearchEmployee> olist = new List<SearchEmployee>();
try try
{ {
olist = _serachManager.FindEmpCodeName((int) currentUser.PayrollTypeID, code, name); //olist = _serachManager.FindEmpCodeName((int) currentUser.PayrollTypeID, code, name);
if(code != "")
{
List<SearchEmployee> unorderedList = _serachManager.FindEmpCodeName((int)currentUser.PayrollTypeID, code, name);
olist = unorderedList
.OrderBy(item => item.EmployeeNo != code) // False (0) for priority value, True (1) for others
.ThenBy(item => item.EmployeeNo).ToList();
}
else
{
olist = _serachManager.FindEmpCodeName((int)currentUser.PayrollTypeID, code, name);
}
//List<Grade> grades = new GradeService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID); //List<Grade> grades = new GradeService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
//List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID); //List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
//List<Department> departments = new DepartmentService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID); //List<Department> departments = new DepartmentService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
@ -746,7 +760,8 @@ namespace HRM.UI.Controllers
// if (designation != null) x.designationName = designation.Name; // if (designation != null) x.designationName = designation.Name;
// var department = departments.FirstOrDefault(d => d.ID == x.DepartmentID); // var department = departments.FirstOrDefault(d => d.ID == x.DepartmentID);
// if (department != null) x.departmentName = department.Name; // if (department != null) x.departmentName = department.Name;
//}); //}); // Secondary ordering (alphabetical)
} }
catch (Exception ex) catch (Exception ex)
{ {