Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop

This commit is contained in:
kittapath 2024-12-26 19:36:38 +07:00
commit b488b70f3b

View file

@ -222,10 +222,44 @@ export class ProfileController extends Controller {
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
const salary_raw = await this.salaryRepository.find({
select: [
"date",
"position",
"posNo",
"positionType",
"positionLevel",
"positionSalaryAmount",
"refCommandNo",
"amount",
"templateDoc",
],
where: { profileId: 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,
positionLine: item.positionLine != null ? item.positionLine : "-",
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
}))
: [
{
date: "-",
positionLine: "-",
posNo: "-",
},
];
const educations = await this.educationRepository.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileId: id },
order: { lastUpdatedAt: "DESC" },
order: { startDate: "ASC" },
});
const Education =
educations && educations.length > 0
@ -265,19 +299,32 @@ export class ProfileController extends Controller {
registrationAddress: Extension.ToThaiNumber(
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
),
salaryDate:
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
date:
salary_raw.length > 0 && salary_raw[0].date != null
? Extension.ToThaiNumber(
Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date),
Extension.ToThaiShortDate(salary_raw[0].date),
)
: "-",
positionName: profile.position != null ? profile.position : "-",
appointText:
profile.dateAppoint != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profile.dateAppoint))
: "-",
posNo:
salary_raw.length > 0 && salary_raw[0].posNo != null
? Extension.ToThaiNumber(
Extension.ToThaiNumber(salary_raw[0].posNo),
)
: "-",
positionLine:
salary_raw.length > 0 && salary_raw[0].positionLine != null
? Extension.ToThaiNumber(
Extension.ToThaiNumber(salary_raw[0].positionLine),
)
: "-",
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
educations: Education,
salarys: salarys,
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
};
@ -561,7 +608,7 @@ export class ProfileController extends Controller {
const salarys =
salary_raw.length > 0
? salary_raw.map((item) => ({
salaryDate: item.date
salaryDate: item.date
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.date))
: null,
position: item.position != null ? Extension.ToThaiNumber(item.position) : null,