ค้นหาทะเบียนประวัติ
This commit is contained in:
parent
b216b20c77
commit
e2b65aaabf
1 changed files with 30 additions and 23 deletions
|
|
@ -245,35 +245,42 @@ export class ProfileController extends Controller {
|
|||
"posLevelId",
|
||||
"posTypeId",
|
||||
],
|
||||
where: {
|
||||
citizenId: Like(`%${keyword}%`),
|
||||
position: Like(`%${keyword}%`),
|
||||
prefix: Like(`%${keyword}%`),
|
||||
firstName: Like(`%${keyword}%`),
|
||||
lastName: Like(`%${keyword}%`),
|
||||
// posLevel: { posLevelName: keyword },
|
||||
// posType: { posTypeName: Like(`%${keyword}%`) },
|
||||
// salaryEmployeeMins: { group: keyword },
|
||||
// salaryEmployee: { group: keyword },
|
||||
},
|
||||
order: { createdAt: "ASC" },
|
||||
skip: (page - 1) * pageSize,
|
||||
take: pageSize,
|
||||
});
|
||||
if (keyword != undefined && keyword !== "") {
|
||||
const formattedKeyword = keyword.toLowerCase().replace(/\s+/g, "");
|
||||
const filteredProfile = profile.filter(
|
||||
(x) =>
|
||||
(x.prefix + x.firstName + x.lastName).replace(/\s+/g, "").includes(formattedKeyword) ||
|
||||
x.citizenId?.toString().includes(keyword) ||
|
||||
x.position?.toString().includes(keyword),
|
||||
);
|
||||
// if (keyword != undefined && keyword !== "") {
|
||||
// const formattedKeyword = keyword.toLowerCase().replace(/\s+/g, "");
|
||||
// const filteredProfile = profile.filter(
|
||||
// (x) =>
|
||||
// (x.prefix + x.firstName + x.lastName).replace(/\s+/g, "").includes(formattedKeyword) ||
|
||||
// x.citizenId?.toString().includes(keyword) ||
|
||||
// x.position?.toString().includes(keyword),
|
||||
// );
|
||||
|
||||
const formattedData = filteredProfile.map((item) => ({
|
||||
id: item.id,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
citizenId: item.citizenId,
|
||||
position: item.position,
|
||||
posLevelId: item.posLevelId,
|
||||
posTypeId: item.posTypeId,
|
||||
}));
|
||||
// const formattedData = filteredProfile.map((item) => ({
|
||||
// id: item.id,
|
||||
// prefix: item.prefix,
|
||||
// firstName: item.firstName,
|
||||
// lastName: item.lastName,
|
||||
// citizenId: item.citizenId,
|
||||
// position: item.position,
|
||||
// posLevelId: item.posLevelId,
|
||||
// posTypeId: item.posTypeId,
|
||||
// }));
|
||||
|
||||
return new HttpSuccess({ data: formattedData, total: formattedData.length });
|
||||
}
|
||||
|
||||
// if (!profile) {
|
||||
// return new HttpSuccess([]);
|
||||
// return new HttpSuccess({ data: formattedData, total: formattedData.length });
|
||||
// }
|
||||
|
||||
const formattedData = profile.map((item) => ({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue