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

@ -232,7 +232,14 @@ export class ProfileController extends Controller {
"refCommandNo",
"amount",
"templateDoc",
"positionLine",
"position",
"orgRoot",
"orgChild1",
"orgChild2",
"orgChild3",
"orgChild4",
"mpCee",
"positionExecutive",
],
where: { profileId: id },
order: { date: "ASC" },
@ -242,24 +249,28 @@ export class ProfileController extends Controller {
salary_raw.length > 1
? salary_raw.slice(1).map((item) => ({
date: item.date ? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date)) : null,
positionLine: item.positionLine != null ? item.positionLine : "-",
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: "-",
positionLine: "-",
position: "-",
posNo: "-",
orgRoot: null,
orgChild1: null,
orgChild2: null,
orgChild3: null,
orgChild4: null,
mpCee: null,
positionExecutive: null,
},
];
@ -292,55 +303,63 @@ export class ProfileController 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.amount != null ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
profile.amount != null ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "",
registrationAddress: Extension.ToThaiNumber(
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
),
date:
salary_raw.length > 0 && salary_raw[0].date != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(salary_raw[0].date))
: "-",
positionName: profile.position != null ? profile.position : "-",
: "",
positionName: profile.position != null ? profile.position : "",
appointText:
profile.dateAppoint != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(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 != null
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 != null
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 != null
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 != null
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 != null
salary_raw.length > 0 && salary_raw[0].orgRoot && salary_raw[0].orgRoot != "-"
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].orgRoot))
: ""
}`,
@ -349,7 +368,7 @@ export class ProfileController extends Controller {
salarys: salarys.map((item) => {
return {
...item,
org: `${item.orgChild4 != null ? item.orgChild4 + " " : ""}${item.orgChild3 != null ? item.orgChild3 + " " : ""}${item.orgChild2 != null ? item.orgChild2 + " " : ""}${item.orgChild1 != null ? item.orgChild1 + " " : ""}${item.orgRoot != null ? item.orgRoot + " " : ""}`,
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}`,