fix
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m11s

This commit is contained in:
Adisak 2026-02-13 16:56:56 +07:00
parent 7029b18a97
commit 0a3deb4293

View file

@ -297,7 +297,7 @@ export class CommandController extends Controller {
status == null || status == undefined || status == ""
? null
: status.trim().toLocaleUpperCase() == "NEW" ||
status.trim().toLocaleUpperCase() == "DRAFT"
status.trim().toLocaleUpperCase() == "DRAFT"
? ["NEW", "DRAFT"]
: [status.trim().toLocaleUpperCase()],
},
@ -419,7 +419,7 @@ export class CommandController extends Controller {
orgRevision: true,
orgRoot: true,
orgChild1: true,
orgChild2: true,
orgChild2: true,
orgChild3: true,
orgChild4: true,
},
@ -431,20 +431,20 @@ export class CommandController extends Controller {
x.orgRevision?.orgRevisionIsDraft === false &&
x.orgRevision?.orgRevisionIsCurrent === true,
);
const posNo =
currentHolder != null && currentHolder.orgChild4 != null
? `${currentHolder.orgChild4.orgChild4ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild3 != null
? `${currentHolder.orgChild3.orgChild3ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild2 != null
? `${currentHolder.orgChild2.orgChild2ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild1 != null
? `${currentHolder.orgChild1.orgChild1ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder?.orgRoot != null
? `${currentHolder.orgRoot.orgRootShortName} ${currentHolder.posMasterNo}`
: null;
currentHolder != null && currentHolder.orgChild4 != null
? `${currentHolder.orgChild4.orgChild4ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild3 != null
? `${currentHolder.orgChild3.orgChild3ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild2 != null
? `${currentHolder.orgChild2.orgChild2ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild1 != null
? `${currentHolder.orgChild1.orgChild1ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder?.orgRoot != null
? `${currentHolder.orgRoot.orgRootShortName} ${currentHolder.posMasterNo}`
: null;
const position = await this.positionRepository.findOne({
where: {
positionIsSelected: true,
@ -751,7 +751,7 @@ export class CommandController extends Controller {
@Request() request: RequestWithUser,
) {
await new permission().PermissionUpdate(request, "COMMAND");
if (!Array.isArray(requestBody)) {
throw new HttpError(HttpStatusCode.BAD_REQUEST, "รูปแบบข้อมูลไม่ถูกต้อง");
}
@ -801,8 +801,8 @@ export class CommandController extends Controller {
.PostData(request, path + "/delete", {
refIds: [commandRecive.refId],
})
.then(async (res) => {})
.catch(() => {});
.then(async (res) => { })
.catch(() => { });
const commandId = commandRecive.commandId;
await this.commandReciveRepository.delete(commandRecive.id);
@ -845,8 +845,8 @@ export class CommandController extends Controller {
.PostData(request, path + "/delete", {
refIds: [commandRecive.refId],
})
.then(async (res) => {})
.catch(() => {});
.then(async (res) => { })
.catch(() => { });
const commandId = commandRecive.commandId;
await this.commandReciveRepository.delete(commandRecive.id);
@ -889,8 +889,8 @@ export class CommandController extends Controller {
.PostData(request, path + "/delete", {
refIds: [commandRecive.refId],
})
.then(async (res) => {})
.catch(() => {});
.then(async (res) => { })
.catch(() => { });
const commandId = commandRecive.commandId;
await this.commandReciveRepository.delete(commandRecive.id);
@ -1174,8 +1174,8 @@ export class CommandController extends Controller {
.PostData(request, path + "/delete", {
refIds: command.commandRecives.map((x) => x.refId),
})
.then(async (res) => {})
.catch(() => {});
.then(async (res) => { })
.catch(() => { });
await this.commandReciveRepository.delete({ commandId: command.id });
command.status = "CANCEL";
@ -1240,8 +1240,8 @@ export class CommandController extends Controller {
.PostData(request, path + "/delete", {
refIds: command.commandRecives.map((x) => x.refId),
})
.then(async (res) => {})
.catch(() => {});
.then(async (res) => { })
.catch(() => { });
await this.commandSendCCRepository.delete({ commandSendId: In(commandSend.map((x) => x.id)) });
await this.commandReciveRepository.delete({ commandId: command.id });
@ -1393,11 +1393,11 @@ export class CommandController extends Controller {
let profiles =
command && command.commandRecives.length > 0
? command.commandRecives
.filter((x) => x.profileId != null)
.map((x) => ({
receiverUserId: x.profileId,
notiLink: "",
}))
.filter((x) => x.profileId != null)
.map((x) => ({
receiverUserId: x.profileId,
notiLink: "",
}))
: [];
const msgNoti = {
@ -1429,8 +1429,8 @@ export class CommandController extends Controller {
refIds: command.commandRecives.filter((x) => x.refId != null).map((x) => x.refId),
status: "WAITING",
})
.then(async (res) => {})
.catch(() => {});
.then(async (res) => { })
.catch(() => { });
await this.commandRepository.save(command);
} else {
const path = commandTypePath(command.commandType.code);
@ -1567,7 +1567,7 @@ export class CommandController extends Controller {
);
await this.profileRepository.save(profiles);
}
} catch {}
} catch { }
type = "EMPLOYEE";
try {
@ -1599,7 +1599,7 @@ export class CommandController extends Controller {
);
await this.profileEmployeeRepository.save(profiles);
}
} catch {}
} catch { }
return new HttpSuccess();
}
@ -1663,7 +1663,7 @@ export class CommandController extends Controller {
}),
);
}
} catch {}
} catch { }
type = "EMPLOYEE";
try {
@ -1718,7 +1718,7 @@ export class CommandController extends Controller {
}),
);
}
} catch {}
} catch { }
return new HttpSuccess();
}
@ -1931,7 +1931,7 @@ export class CommandController extends Controller {
.then((x) => {
res = x;
})
.catch((x) => {});
.catch((x) => { });
}
let _command;
@ -2009,76 +2009,76 @@ export class CommandController extends Controller {
profile?.current_holders.length == 0
? null
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id) !=
null &&
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
?.orgChild4 != null
null &&
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
?.orgChild4 != null
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild4.orgChild4ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id) !=
null &&
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
?.orgChild3 != null
null &&
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
?.orgChild3 != null
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild3.orgChild3ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
: profile?.current_holders.find(
(x) => x.orgRevisionId == orgRevisionActive?.id,
) != null &&
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
?.orgChild2 != null
(x) => x.orgRevisionId == orgRevisionActive?.id,
) != null &&
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
?.orgChild2 != null
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild2.orgChild2ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
: profile?.current_holders.find(
(x) => x.orgRevisionId == orgRevisionActive?.id,
) != null &&
profile?.current_holders.find(
(x) => x.orgRevisionId == orgRevisionActive?.id,
)?.orgChild1 != null
(x) => x.orgRevisionId == orgRevisionActive?.id,
) != null &&
profile?.current_holders.find(
(x) => x.orgRevisionId == orgRevisionActive?.id,
)?.orgChild1 != null
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild1.orgChild1ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
: profile?.current_holders.find(
(x) => x.orgRevisionId == orgRevisionActive?.id,
) != null &&
profile?.current_holders.find(
(x) => x.orgRevisionId == orgRevisionActive?.id,
)?.orgRoot != null
(x) => x.orgRevisionId == orgRevisionActive?.id,
) != null &&
profile?.current_holders.find(
(x) => x.orgRevisionId == orgRevisionActive?.id,
)?.orgRoot != null
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgRoot.orgRootShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
: null;
const root =
profile?.current_holders == null ||
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
? null
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
?.orgRoot;
?.orgRoot;
const child1 =
profile?.current_holders == null ||
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
? null
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
?.orgChild1;
?.orgChild1;
const child2 =
profile?.current_holders == null ||
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
? null
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
?.orgChild2;
?.orgChild2;
const child3 =
profile?.current_holders == null ||
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
? null
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
?.orgChild3;
?.orgChild3;
const child4 =
profile?.current_holders == null ||
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
profile?.current_holders.length == 0 ||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
? null
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
?.orgChild4;
?.orgChild4;
let _root = root?.orgRootName;
let _child1 = child1?.orgChild1Name;
@ -2139,10 +2139,10 @@ export class CommandController extends Controller {
commandCode != "C-PM-21"
? profile?.isLeave == false
? (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root)
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root)
: orgLeave
: profileTemp.org,
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
@ -2157,8 +2157,8 @@ export class CommandController extends Controller {
commandCode != "C-PM-21"
? profile?.posType && profile?.posLevel
? Extension.ToThaiNumber(
`${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`,
)
`${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`,
)
: "-"
: Extension.ToThaiNumber(profileTemp.posLevel),
posNo:
@ -2172,19 +2172,19 @@ export class CommandController extends Controller {
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile?.dateRetire))
: profile?.birthDate && commandCode == "C-PM-21"
? Extension.ToThaiNumber(
Extension.ToThaiShortDate_monthYear(
new Date(
profile.birthDate.getFullYear() + 60,
profile.birthDate.getMonth(),
profile.birthDate.getDate(),
),
Extension.ToThaiShortDate_monthYear(
new Date(
profile.birthDate.getFullYear() + 60,
profile.birthDate.getMonth(),
profile.birthDate.getDate(),
),
)
),
)
: "-",
dateExecute: command.commandExcecuteDate
? Extension.ToThaiNumber(
Extension.ToThaiShortDate_monthYear(command.commandExcecuteDate),
)
Extension.ToThaiShortDate_monthYear(command.commandExcecuteDate),
)
: "-",
remark: x.remarkVertical ? x.remarkVertical : "-",
};
@ -2285,7 +2285,7 @@ export class CommandController extends Controller {
.then(async (res) => {
_command = res;
})
.catch(() => {});
.catch(() => { });
let issue =
command.isBangkok == "OFFICE"
@ -2342,13 +2342,13 @@ export class CommandController extends Controller {
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(command.commandExcecuteDate)),
operators: operators.length > 0
? operators.map(x => ({
fullName: `${x.prefix ?? ""}${x.firstName ?? ""} ${x.lastName ?? ""}`,
roleName: x.roleName
}))
fullName: `${x.prefix ?? ""}${x.firstName ?? ""} ${x.lastName ?? ""}`,
roleName: x.roleName
}))
: [{
fullName: "",
roleName: "เจ้าหน้าที่ดำเนินการ"
}]
fullName: "",
roleName: "เจ้าหน้าที่ดำเนินการ"
}]
},
});
}
@ -2585,7 +2585,7 @@ export class CommandController extends Controller {
orgRevision: true,
orgRoot: true,
orgChild1: true,
orgChild2: true,
orgChild2: true,
orgChild3: true,
orgChild4: true,
},
@ -2597,20 +2597,20 @@ export class CommandController extends Controller {
x.orgRevision?.orgRevisionIsDraft === false &&
x.orgRevision?.orgRevisionIsCurrent === true,
);
const posNo =
currentHolder != null && currentHolder.orgChild4 != null
? `${currentHolder.orgChild4.orgChild4ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild3 != null
? `${currentHolder.orgChild3.orgChild3ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild2 != null
? `${currentHolder.orgChild2.orgChild2ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild1 != null
? `${currentHolder.orgChild1.orgChild1ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder?.orgRoot != null
? `${currentHolder.orgRoot.orgRootShortName} ${currentHolder.posMasterNo}`
: null;
currentHolder != null && currentHolder.orgChild4 != null
? `${currentHolder.orgChild4.orgChild4ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild3 != null
? `${currentHolder.orgChild3.orgChild3ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild2 != null
? `${currentHolder.orgChild2.orgChild2ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder.orgChild1 != null
? `${currentHolder.orgChild1.orgChild1ShortName} ${currentHolder.posMasterNo}`
: currentHolder != null && currentHolder?.orgRoot != null
? `${currentHolder.orgRoot.orgRootShortName} ${currentHolder.posMasterNo}`
: null;
const position = await this.positionRepository.findOne({
where: {
positionIsSelected: true,
@ -2656,8 +2656,8 @@ export class CommandController extends Controller {
refIds: requestBody.persons.filter((x) => x.refId != null).map((x) => x.refId),
status: "REPORT",
})
.then(async (res) => {})
.catch(() => {});
.then(async (res) => { })
.catch(() => { });
let order =
command.commandRecives == null || command.commandRecives.length <= 0
? 0
@ -3430,27 +3430,27 @@ export class CommandController extends Controller {
? x.orgChild1.orgChild1Name + "\n" + x.orgRoot.orgRootName
: x.orgChild3 == null
? x.orgChild2.orgChild2Name +
"\n" +
x.orgChild1.orgChild1Name +
"\n" +
x.orgRoot.orgRootName
: x.orgChild4 == null
? x.orgChild3.orgChild3Name +
"\n" +
x.orgChild2.orgChild2Name +
"\n" +
x.orgChild1.orgChild1Name +
"\n" +
x.orgRoot.orgRootName
: x.orgChild4 == null
? x.orgChild3.orgChild3Name +
"\n" +
x.orgChild2.orgChild2Name +
"\n" +
x.orgChild1.orgChild1Name +
"\n" +
x.orgRoot.orgRootName
: x.orgChild4.orgChild4Name +
"\n" +
x.orgChild3.orgChild3Name +
"\n" +
x.orgChild2.orgChild2Name +
"\n" +
x.orgChild1.orgChild1Name +
"\n" +
x.orgRoot.orgRootName,
"\n" +
x.orgChild3.orgChild3Name +
"\n" +
x.orgChild2.orgChild2Name +
"\n" +
x.orgChild1.orgChild1Name +
"\n" +
x.orgRoot.orgRootName,
positionName: x?.current_holder.position ?? _null,
profileId: x?.current_holder.id ?? _null,
});
@ -3978,7 +3978,7 @@ export class CommandController extends Controller {
// relations: ["roleKeycloaks"],
relations: {
roleKeycloaks: true,
posType: true ,
posType: true,
posLevel: true
}
});
@ -4048,18 +4048,18 @@ export class CommandController extends Controller {
const curRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
});
let orgRootRef = null;
let orgChild1Ref = null;
let orgChild2Ref = null;
let orgChild3Ref = null;
let orgChild4Ref = null;
let orgRootRef = null;
let orgChild1Ref = null;
let orgChild2Ref = null;
let orgChild3Ref = null;
let orgChild4Ref = null;
if (curRevision) {
const curPosMaster = await this.posMasterRepository.findOne({
where: {
current_holderId: profile.id,
orgRevisionId: curRevision.id,
},
relations:{
relations: {
orgRoot: true,
orgChild1: true,
orgChild2: true,
@ -4243,7 +4243,7 @@ export class CommandController extends Controller {
profile.isActive = true;
}
await this.profileRepository.save(profile);
// Task #2190
// Task #2190
if (code && ["C-PM-17", "C-PM-18"].includes(code)) {
let organizeName = "";
if (orgRootRef) {
@ -4377,7 +4377,7 @@ export class CommandController extends Controller {
// relations: ["roleKeycloaks"],
relations: {
roleKeycloaks: true,
posType: true ,
posType: true,
posLevel: true
}
});
@ -4448,18 +4448,18 @@ export class CommandController extends Controller {
const curRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
});
let orgRootRef = null;
let orgChild1Ref = null;
let orgChild2Ref = null;
let orgChild3Ref = null;
let orgChild4Ref = null;
let orgRootRef = null;
let orgChild1Ref = null;
let orgChild2Ref = null;
let orgChild3Ref = null;
let orgChild4Ref = null;
if (curRevision) {
const curPosMaster = await this.employeePosMasterRepository.findOne({
where: {
current_holderId: profile.id,
orgRevisionId: curRevision.id,
},
relations:{
relations: {
orgRoot: true,
orgChild1: true,
orgChild2: true,
@ -4494,7 +4494,7 @@ export class CommandController extends Controller {
// profile.posLevelId = _null;
}
await this.profileEmployeeRepository.save(profile);
// Task #2190
// Task #2190
if (code && ["C-PM-23", "C-PM-43"].includes(code)) {
let organizeName = "";
if (orgRootRef) {
@ -5024,14 +5024,14 @@ export class CommandController extends Controller {
orgRevisionIsDraft: false,
},
});
let orgRootRef = null;
let orgRootRef = null;
let orgChild1Ref = null;
let orgChild2Ref = null;
let orgChild3Ref = null;
let orgChild4Ref = null;
let profile;
let isEmployee:boolean = false;
let retireTypeName:string = "";
let isEmployee: boolean = false;
let retireTypeName: string = "";
// ขรก.
if (item.profileType && item.profileType.trim().toUpperCase() == "OFFICER") {
profile = await this.profileRepository.findOne({
@ -5073,11 +5073,11 @@ export class CommandController extends Controller {
const orgRevisionRef =
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
orgRootRef = orgRevisionRef?.orgRoot ?? null;
orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
orgRootRef = orgRevisionRef?.orgRoot ?? null;
orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
let position =
profile.current_holders
@ -5216,7 +5216,7 @@ export class CommandController extends Controller {
}
await this.profileRepository.save(_profile);
}
}
}
// ลูกจ้าง
else {
isEmployee = true;
@ -5251,12 +5251,12 @@ export class CommandController extends Controller {
const nextOrder = lastSalary ? lastSalary.order + 1 : 1;
const orgRevisionRef =
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
orgRootRef = orgRevisionRef?.orgRoot ?? null;
orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
orgRootRef = orgRevisionRef?.orgRoot ?? null;
orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
// ประวัติตำแหน่ง
const data = new ProfileSalary();
data.posNumCodeSit = _posNumCodeSit;
@ -5407,9 +5407,9 @@ export class CommandController extends Controller {
].filter(Boolean);
organizeName = names.join(" ");
}
let _posLevelName: string = !isEmployee
? `${profile.posLevel?.posLevelName}`
: `${profile.posType?.posTypeName} ${profile.posLevel?.posLevelName}`;
let _posLevelName: string = !isEmployee
? `${profile.posLevel?.posLevelName}`
: `${profile.posType?.posTypeName} ${profile.posLevel?.posLevelName}`;
await PostRetireToExprofile(
// profile.citizenId ?? "",
// profile.prefix ?? "",
@ -5814,8 +5814,8 @@ export class CommandController extends Controller {
}
}
const leaveType = await this.leaveType.findOne({
select:{ id: true, limit: true, code: true },
where:{ code: "LV-005" }
select: { id: true, limit: true, code: true },
where: { code: "LV-005" }
});
await Promise.all(
body.data.map(async (item) => {
@ -5865,26 +5865,26 @@ export class CommandController extends Controller {
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild4 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild4 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild2 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
: null;
const posNo = `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`;
@ -6118,26 +6118,26 @@ export class CommandController extends Controller {
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild4 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild4 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild2 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
: null;
const posNo = `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`;
@ -6899,7 +6899,7 @@ export class CommandController extends Controller {
profile.posLevelId = positionNew.posLevelId;
profile.posTypeId = positionNew.posTypeId;
profile.position = positionNew.positionName;
profile.dateStart = new Date();
// profile.dateStart = new Date();
await this.profileRepository.save(profile, { data: req });
setLogDataDiff(req, { before, after: profile });
await this.positionRepository.save(positionNew, { data: req });
@ -6979,8 +6979,8 @@ export class CommandController extends Controller {
prefix: avatar,
fileName: fileName,
})
.then(() => {})
.catch(() => {});
.then(() => { })
.catch(() => { });
}
}
}),
@ -8091,7 +8091,7 @@ export class CommandController extends Controller {
.then(async (res) => {
_command = res;
})
.catch(() => {});
.catch(() => { });
let issue =
command.isBangkok == "OFFICE"