edit import profile salary

This commit is contained in:
kittapath 2025-01-13 14:40:07 +07:00
parent 134296b5b1
commit 444168ace2
4 changed files with 267 additions and 36 deletions

View file

@ -222,6 +222,56 @@ export class ProfileEmployeeTempController extends Controller {
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
const salary_raw = await this.salaryRepo.find({
select: [
"date",
"position",
"posNo",
"positionType",
"positionLevel",
"positionSalaryAmount",
"refCommandNo",
"amount",
"templateDoc",
"orgRoot",
"orgChild1",
"orgChild2",
"orgChild3",
"orgChild4",
"mpCee",
"positionExecutive",
],
where: { profileEmployeeId: id },
order: { date: "ASC" },
});
const salarys =
salary_raw.length > 1
? salary_raw.slice(1).map((item) => ({
date: item.date ? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date)) : null,
position: item.position != null ? item.position : "-",
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
orgRoot: item.orgRoot,
orgChild1: item.orgChild1,
orgChild2: item.orgChild2,
orgChild3: item.orgChild3,
orgChild4: item.orgChild4,
mpCee: item.mpCee,
positionExecutive: item.positionExecutive,
}))
: [
{
date: "-",
position: "-",
posNo: "-",
orgRoot: null,
orgChild1: null,
orgChild2: null,
orgChild3: null,
orgChild4: null,
mpCee: null,
positionExecutive: null,
},
];
const educations = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileEmployeeId: id },
@ -251,19 +301,19 @@ export class ProfileEmployeeTempController extends Controller {
prefix: profile.prefix != null ? profile.prefix : null,
firstName: profile.firstName != null ? profile.firstName : null,
lastName: profile.lastName != null ? profile.lastName : null,
citizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-",
citizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
dateOfBirth:
profile.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
: "-",
: "",
dateRetire:
profile.dateRetire != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
: "-",
: "",
salaryAmount:
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
: "-",
: "",
registrationAddress: Extension.ToThaiNumber(
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
),
@ -272,14 +322,57 @@ export class ProfileEmployeeTempController extends Controller {
? Extension.ToThaiNumber(
Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date),
)
: "-",
positionName: profile.position != null ? profile.position : "-",
: "",
positionName: profile.position != null ? profile.position : "",
appointText:
profile.dateAppoint != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
: "-",
: "",
posNo:
salary_raw.length > 0 && salary_raw[0].posNo != null
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].posNo))
: "",
position:
salary_raw.length > 0 && salary_raw[0].position != null
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].position))
: "",
mpCee:
salary_raw.length > 0 && salary_raw[0].mpCee != null
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].mpCee))
: "",
positionExecutive:
salary_raw.length > 0 && salary_raw[0].positionExecutive != null
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].positionExecutive))
: "",
org: `${
salary_raw.length > 0 && salary_raw[0].orgChild4 && salary_raw[0].orgChild4 != "-"
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].orgChild4)) + " "
: ""
}${
salary_raw.length > 0 && salary_raw[0].orgChild3 && salary_raw[0].orgChild3 != "-"
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].orgChild3)) + " "
: ""
}${
salary_raw.length > 0 && salary_raw[0].orgChild2 && salary_raw[0].orgChild2 != "-"
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].orgChild2)) + " "
: ""
}${
salary_raw.length > 0 && salary_raw[0].orgChild1 && salary_raw[0].orgChild1 != "-"
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].orgChild1)) + " "
: ""
}${
salary_raw.length > 0 && salary_raw[0].orgRoot && salary_raw[0].orgRoot != "-"
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].orgRoot))
: ""
}`,
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
educations: Education,
salarys: salarys.map((item) => {
return {
...item,
org: `${item.orgChild4 && item.orgChild4 != "-" ? item.orgChild4 + " " : ""}${item.orgChild3 && item.orgChild3 != "-" ? item.orgChild3 + " " : ""}${item.orgChild2 && item.orgChild2 != "-" ? item.orgChild2 + " " : ""}${item.orgChild1 && item.orgChild1 != "-" ? item.orgChild1 + " " : ""}${item.orgRoot && item.orgRoot != "-" ? item.orgRoot + " " : ""}`,
};
}),
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_MGT}`,
};