This commit is contained in:
harid 2025-10-01 16:31:40 +07:00
parent 08af004d4a
commit 18aa974c3d
4 changed files with 114 additions and 38 deletions

View file

@ -220,6 +220,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
let _OrgLeave:any = []
let orgLeave:string = ""
let posNoLeave:string = ""
let _profileSalary:any = null;
if (record?.isLeave /*&& record?.profileSalary.length > 0*/) {
const profileSalary = await this.salaryRepo.find({
select: [
@ -255,16 +256,34 @@ export class ProfileGovernmentEmployeeController extends Controller {
createdAt: "DESC"
}
});
_OrgLeave = [
profileSalary.length > 0 && profileSalary[0].orgChild4 ? profileSalary[0].orgChild4 : null,
profileSalary.length > 0 && profileSalary[0].orgChild3 ? profileSalary[0].orgChild3 : null,
profileSalary.length > 0 && profileSalary[0].orgChild2 ? profileSalary[0].orgChild2 : null,
profileSalary.length > 0 && profileSalary[0].orgChild1 ? profileSalary[0].orgChild1 : null,
profileSalary.length > 0 && profileSalary[0].orgRoot ? profileSalary[0].orgRoot : null,
];
// _OrgLeave = [
// profileSalary.length > 0 && profileSalary[0].orgChild4 ? profileSalary[0].orgChild4 : null,
// profileSalary.length > 0 && profileSalary[0].orgChild3 ? profileSalary[0].orgChild3 : null,
// profileSalary.length > 0 && profileSalary[0].orgChild2 ? profileSalary[0].orgChild2 : null,
// profileSalary.length > 0 && profileSalary[0].orgChild1 ? profileSalary[0].orgChild1 : null,
// profileSalary.length > 0 && profileSalary[0].orgRoot ? profileSalary[0].orgRoot : null,
// ];
if (record.leaveType == "RETIRE") {
_profileSalary = record?.profileSalary.length > 1
? record?.profileSalary[1]
: null;
} else {
_profileSalary = record?.profileSalary[0];
}
if (_profileSalary) {
_OrgLeave = [
_profileSalary.orgChild4 ?? null,
_profileSalary.orgChild3 ?? null,
_profileSalary.orgChild2 ?? null,
_profileSalary.orgChild1 ?? null,
_profileSalary.orgRoot ?? null,
];
} else {
_OrgLeave = [];
}
orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
posNoLeave = profileSalary.length > 0
? `${profileSalary[0].posNoAbb} ${profileSalary[0].posNo}`
posNoLeave = _profileSalary != null
? `${_profileSalary.posNoAbb} ${_profileSalary.posNo}`
: ""
}
const data = {
@ -372,6 +391,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
let _OrgLeave:any = []
let orgLeave:string = ""
let posNoLeave:string = ""
let _profileSalary:any = null;
if (record?.isLeave /*&& record?.profileSalary.length > 0*/) {
const profileSalary = await this.salaryRepo.find({
select: [
@ -407,16 +427,34 @@ export class ProfileGovernmentEmployeeController extends Controller {
createdAt: "DESC"
}
});
_OrgLeave = [
profileSalary.length > 0 && profileSalary[0].orgChild4 ? profileSalary[0].orgChild4 : null,
profileSalary.length > 0 && profileSalary[0].orgChild3 ? profileSalary[0].orgChild3 : null,
profileSalary.length > 0 && profileSalary[0].orgChild2 ? profileSalary[0].orgChild2 : null,
profileSalary.length > 0 && profileSalary[0].orgChild1 ? profileSalary[0].orgChild1 : null,
profileSalary.length > 0 && profileSalary[0].orgRoot ? profileSalary[0].orgRoot : null,
];
// _OrgLeave = [
// profileSalary.length > 0 && profileSalary[0].orgChild4 ? profileSalary[0].orgChild4 : null,
// profileSalary.length > 0 && profileSalary[0].orgChild3 ? profileSalary[0].orgChild3 : null,
// profileSalary.length > 0 && profileSalary[0].orgChild2 ? profileSalary[0].orgChild2 : null,
// profileSalary.length > 0 && profileSalary[0].orgChild1 ? profileSalary[0].orgChild1 : null,
// profileSalary.length > 0 && profileSalary[0].orgRoot ? profileSalary[0].orgRoot : null,
// ];
if (record.leaveType == "RETIRE") {
_profileSalary = record?.profileSalary.length > 1
? record?.profileSalary[1]
: null;
} else {
_profileSalary = record?.profileSalary[0];
}
if (_profileSalary) {
_OrgLeave = [
_profileSalary.orgChild4 ?? null,
_profileSalary.orgChild3 ?? null,
_profileSalary.orgChild2 ?? null,
_profileSalary.orgChild1 ?? null,
_profileSalary.orgRoot ?? null,
];
} else {
_OrgLeave = [];
}
orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
posNoLeave = profileSalary.length > 0
? `${profileSalary[0].posNoAbb} ${profileSalary[0].posNo}`
posNoLeave = _profileSalary != null
? `${_profileSalary.posNoAbb} ${_profileSalary.posNo}`
: ""
}
const data = {