fix ประวัติแบบย่อ

This commit is contained in:
AdisakKanthawilang 2024-12-26 19:32:31 +07:00
parent dcbda3b94e
commit 5f927858bc

View file

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