Merge branch 'develop' into develop-Bright
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m6s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m6s
This commit is contained in:
commit
2f834d3644
9 changed files with 450 additions and 354 deletions
|
|
@ -1653,12 +1653,13 @@ export class CommandController extends Controller {
|
||||||
_profile.leaveDate = _Date;
|
_profile.leaveDate = _Date;
|
||||||
_profile.dateLeave = _Date;
|
_profile.dateLeave = _Date;
|
||||||
_profile.lastUpdatedAt = _Date;
|
_profile.lastUpdatedAt = _Date;
|
||||||
if (_profile.keycloak != null && _profile.keycloak != "") {
|
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
|
||||||
// console.log("4. disable keycloak/authen")
|
// console.log("4. disable keycloak/authen")
|
||||||
const delUserKeycloak = await deleteUser(_profile.keycloak, adminToken);
|
const delUserKeycloak = await deleteUser(_profile.keycloak, adminToken);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// _profile.keycloak = "";
|
// _profile.keycloak = "";
|
||||||
|
_profile.isDelete = true;
|
||||||
_profile.roleKeycloaks = [];
|
_profile.roleKeycloaks = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1710,12 +1711,13 @@ export class CommandController extends Controller {
|
||||||
_profileEmp.leaveDate = _Date;
|
_profileEmp.leaveDate = _Date;
|
||||||
_profileEmp.dateLeave = _Date;
|
_profileEmp.dateLeave = _Date;
|
||||||
_profileEmp.lastUpdatedAt = _Date;
|
_profileEmp.lastUpdatedAt = _Date;
|
||||||
if (_profileEmp.keycloak != null && _profileEmp.keycloak != "") {
|
if (_profileEmp.keycloak != null && _profileEmp.keycloak != "" && _profileEmp.isDelete === false) {
|
||||||
// disable keycloak/authen
|
// disable keycloak/authen
|
||||||
const delUserKeycloak = await deleteUser(_profileEmp.keycloak, adminToken);
|
const delUserKeycloak = await deleteUser(_profileEmp.keycloak, adminToken);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// _profileEmp.keycloak = "";
|
// _profileEmp.keycloak = "";
|
||||||
|
_profileEmp.isDelete = true;
|
||||||
_profileEmp.roleKeycloaks = [];
|
_profileEmp.roleKeycloaks = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4130,13 +4132,14 @@ export class CommandController extends Controller {
|
||||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||||
}
|
}
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
if (profile.keycloak != null) {
|
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// profile.keycloak = _null;
|
// profile.keycloak = _null;
|
||||||
profile.roleKeycloaks = [];
|
profile.roleKeycloaks = [];
|
||||||
profile.isActive = false;
|
profile.isActive = false;
|
||||||
|
profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
profile.leaveCommandId = item.commandId ?? _null;
|
profile.leaveCommandId = item.commandId ?? _null;
|
||||||
|
|
@ -4290,6 +4293,7 @@ export class CommandController extends Controller {
|
||||||
profile.amount = item.amount ?? _null;
|
profile.amount = item.amount ?? _null;
|
||||||
profile.amountSpecial = item.amountSpecial ?? _null;
|
profile.amountSpecial = item.amountSpecial ?? _null;
|
||||||
profile.isActive = true;
|
profile.isActive = true;
|
||||||
|
profile.isDelete = false;
|
||||||
}
|
}
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
|
|
||||||
|
|
@ -4535,13 +4539,14 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
if (profile.keycloak != null) {
|
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// profile.keycloak = _null;
|
// profile.keycloak = _null;
|
||||||
profile.roleKeycloaks = [];
|
profile.roleKeycloaks = [];
|
||||||
profile.isActive = false;
|
profile.isActive = false;
|
||||||
|
profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
profile.leaveCommandId = item.commandId ?? _null;
|
profile.leaveCommandId = item.commandId ?? _null;
|
||||||
|
|
@ -4756,13 +4761,14 @@ export class CommandController extends Controller {
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
const _null: any = null;
|
const _null: any = null;
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
if (profile.keycloak != null) {
|
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// profile.keycloak = _null;
|
// profile.keycloak = _null;
|
||||||
profile.roleKeycloaks = [];
|
profile.roleKeycloaks = [];
|
||||||
profile.isActive = false;
|
profile.isActive = false;
|
||||||
|
profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
profile.isLeave = item.isLeave;
|
profile.isLeave = item.isLeave;
|
||||||
|
|
@ -5253,13 +5259,14 @@ export class CommandController extends Controller {
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
retireTypeName = clearProfile.retireTypeName ?? "";
|
retireTypeName = clearProfile.retireTypeName ?? "";
|
||||||
if (_profile.keycloak != null) {
|
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// _profile.keycloak = _null;
|
// _profile.keycloak = _null;
|
||||||
_profile.roleKeycloaks = [];
|
_profile.roleKeycloaks = [];
|
||||||
_profile.isActive = false;
|
_profile.isActive = false;
|
||||||
|
_profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
|
|
@ -5437,13 +5444,14 @@ export class CommandController extends Controller {
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
retireTypeName = clearProfile.retireTypeName ?? "";
|
retireTypeName = clearProfile.retireTypeName ?? "";
|
||||||
if (_profile.keycloak != null) {
|
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// _profile.keycloak = _null;
|
// _profile.keycloak = _null;
|
||||||
_profile.roleKeycloaks = [];
|
_profile.roleKeycloaks = [];
|
||||||
_profile.isActive = false;
|
_profile.isActive = false;
|
||||||
|
_profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
|
|
@ -5776,13 +5784,14 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
if (_profile.keycloak != null) {
|
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// _profile.keycloak = _null;
|
// _profile.keycloak = _null;
|
||||||
_profile.roleKeycloaks = [];
|
_profile.roleKeycloaks = [];
|
||||||
_profile.isActive = false;
|
_profile.isActive = false;
|
||||||
|
_profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
|
|
@ -6214,13 +6223,14 @@ export class CommandController extends Controller {
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
const _null: any = null;
|
const _null: any = null;
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
if (_profile.keycloak != null) {
|
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// _profile.keycloak = _null;
|
// _profile.keycloak = _null;
|
||||||
_profile.roleKeycloaks = [];
|
_profile.roleKeycloaks = [];
|
||||||
_profile.isActive = false;
|
_profile.isActive = false;
|
||||||
|
_profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
_profile.leaveCommandId = item.commandId ?? _null;
|
||||||
|
|
@ -6637,6 +6647,7 @@ export class CommandController extends Controller {
|
||||||
profile.isLeave = item.bodyProfile.isLeave;
|
profile.isLeave = item.bodyProfile.isLeave;
|
||||||
profile.isRetirement = false;
|
profile.isRetirement = false;
|
||||||
profile.isActive = true;
|
profile.isActive = true;
|
||||||
|
profile.isDelete = false;
|
||||||
profile.dateLeave = _null;
|
profile.dateLeave = _null;
|
||||||
profile.dateRetire = _dateRetire;
|
profile.dateRetire = _dateRetire;
|
||||||
profile.dateRetireLaw = _dateRetireLaw;
|
profile.dateRetireLaw = _dateRetireLaw;
|
||||||
|
|
|
||||||
|
|
@ -7796,10 +7796,11 @@ export class OrganizationController extends Controller {
|
||||||
profile.leaveType = "RETIRE";
|
profile.leaveType = "RETIRE";
|
||||||
profile.isActive = false;
|
profile.isActive = false;
|
||||||
|
|
||||||
if (profile.keycloak != null && profile.keycloak != "") {
|
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak, token);
|
const delUserKeycloak = await deleteUser(profile.keycloak, token);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
profile.keycloak = "";
|
// profile.keycloak = "";
|
||||||
|
profile.isDelete = true;
|
||||||
profile.roleKeycloaks = [];
|
profile.roleKeycloaks = [];
|
||||||
checkOfficer += 1;
|
checkOfficer += 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -7824,10 +7825,11 @@ export class OrganizationController extends Controller {
|
||||||
profileEmp.lastUpdatedAt = new Date();
|
profileEmp.lastUpdatedAt = new Date();
|
||||||
profileEmp.isActive = false;
|
profileEmp.isActive = false;
|
||||||
|
|
||||||
if (profileEmp.keycloak != null && profileEmp.keycloak != "") {
|
if (profileEmp.keycloak != null && profileEmp.keycloak != "" && profileEmp.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(profileEmp.keycloak, token);
|
const delUserKeycloak = await deleteUser(profileEmp.keycloak, token);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
profileEmp.keycloak = "";
|
// profileEmp.keycloak = "";
|
||||||
|
profileEmp.isDelete = true;
|
||||||
profileEmp.roleKeycloaks = [];
|
profileEmp.roleKeycloaks = [];
|
||||||
checkEmployee += 1;
|
checkEmployee += 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ export class ProfileChangeNameController extends Controller {
|
||||||
await this.profileRepository.save(profile, { data: req });
|
await this.profileRepository.save(profile, { data: req });
|
||||||
setLogDataDiff(req, { before, after: profile });
|
setLogDataDiff(req, { before, after: profile });
|
||||||
|
|
||||||
if (profile != null && profile.keycloak != null) {
|
if (profile != null && profile.keycloak != null && profile.isDelete === false) {
|
||||||
const result = await updateName(
|
const result = await updateName(
|
||||||
profile.keycloak,
|
profile.keycloak,
|
||||||
profile.firstName,
|
profile.firstName,
|
||||||
|
|
@ -186,7 +186,7 @@ export class ProfileChangeNameController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update //update 17/07
|
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update //update 17/07
|
||||||
if (profile != null && profile.keycloak != null) {
|
if (profile != null && profile.keycloak != null && profile.isDelete === false) {
|
||||||
const result = await updateName(
|
const result = await updateName(
|
||||||
profile.keycloak,
|
profile.keycloak,
|
||||||
profile.firstName,
|
profile.firstName,
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
||||||
await this.profileEmployeeRepo.save(profile, { data: req });
|
await this.profileEmployeeRepo.save(profile, { data: req });
|
||||||
setLogDataDiff(req, { before, after: profile });
|
setLogDataDiff(req, { before, after: profile });
|
||||||
|
|
||||||
if (profile != null && profile.keycloak != null) {
|
if (profile != null && profile.keycloak != null && profile.isDelete === false) {
|
||||||
const result = await updateName(
|
const result = await updateName(
|
||||||
profile.keycloak,
|
profile.keycloak,
|
||||||
profile.firstName,
|
profile.firstName,
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
||||||
await this.profileEmployeeRepo.save(profile, { data: req });
|
await this.profileEmployeeRepo.save(profile, { data: req });
|
||||||
setLogDataDiff(req, { before, after: profile });
|
setLogDataDiff(req, { before, after: profile });
|
||||||
|
|
||||||
if (profile != null && profile.keycloak != null) {
|
if (profile != null && profile.keycloak != null && profile.isDelete === false) {
|
||||||
const result = await updateName(
|
const result = await updateName(
|
||||||
profile.keycloak,
|
profile.keycloak,
|
||||||
profile.firstName,
|
profile.firstName,
|
||||||
|
|
|
||||||
|
|
@ -1098,7 +1098,9 @@ export class ProfileController extends Controller {
|
||||||
certificateType: item.certificateType ?? null,
|
certificateType: item.certificateType ?? null,
|
||||||
issuer: item.issuer ?? null,
|
issuer: item.issuer ?? null,
|
||||||
certificateNo: item.certificateNo ? Extension.ToThaiNumber(item.certificateNo) : null,
|
certificateNo: item.certificateNo ? Extension.ToThaiNumber(item.certificateNo) : null,
|
||||||
detail: Extension.ToThaiNumber(`${item.issuer ?? ""} ${item.certificateNo ?? ""}`.trim()),
|
detail: Extension.ToThaiNumber(
|
||||||
|
`${item.issuer ?? ""} ${item.certificateNo ?? ""}`.trim(),
|
||||||
|
),
|
||||||
issueToExpireDate: item.issueDate
|
issueToExpireDate: item.issueDate
|
||||||
? item.expireDate
|
? item.expireDate
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
|
|
@ -1130,7 +1132,9 @@ export class ProfileController extends Controller {
|
||||||
degree: item.name ? Extension.ToThaiNumber(item.name) : "",
|
degree: item.name ? Extension.ToThaiNumber(item.name) : "",
|
||||||
place: item.place ? Extension.ToThaiNumber(item.place) : "",
|
place: item.place ? Extension.ToThaiNumber(item.place) : "",
|
||||||
duration: item.duration ? Extension.ToThaiNumber(item.duration) : "",
|
duration: item.duration ? Extension.ToThaiNumber(item.duration) : "",
|
||||||
date: Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.startDate)} - ${Extension.ToThaiFullDate2(item.endDate)}`)
|
date: Extension.ToThaiNumber(
|
||||||
|
`${Extension.ToThaiFullDate2(item.startDate)} - ${Extension.ToThaiFullDate2(item.endDate)}`,
|
||||||
|
),
|
||||||
}))
|
}))
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
|
|
@ -1138,7 +1142,7 @@ export class ProfileController extends Controller {
|
||||||
degree: "",
|
degree: "",
|
||||||
place: "",
|
place: "",
|
||||||
duration: "",
|
duration: "",
|
||||||
date: ""
|
date: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -1181,14 +1185,14 @@ export class ProfileController extends Controller {
|
||||||
? `${item.startDate ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate)) : ""} - ${item.endDate ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate)) : ""}`
|
? `${item.startDate ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate)) : ""} - ${item.endDate ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate)) : ""}`
|
||||||
: `${item.startDate ? Extension.ToThaiNumber(Extension.ToThaiShortYear(new Date(item.startDate))) : ""} - ${item.endDate ? Extension.ToThaiNumber(Extension.ToThaiShortYear(new Date(item.endDate))) : ""}`,
|
: `${item.startDate ? Extension.ToThaiNumber(Extension.ToThaiShortYear(new Date(item.startDate))) : ""} - ${item.endDate ? Extension.ToThaiNumber(Extension.ToThaiShortYear(new Date(item.endDate))) : ""}`,
|
||||||
degree: `${item.degree ?? ""} ${item.field ?? ""}`.trim(),
|
degree: `${item.degree ?? ""} ${item.field ?? ""}`.trim(),
|
||||||
level: item.educationLevel
|
level: item.educationLevel,
|
||||||
}))
|
}))
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
institute: "",
|
institute: "",
|
||||||
date: "",
|
date: "",
|
||||||
degree: "",
|
degree: "",
|
||||||
level: ""
|
level: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const salary_raw = await this.salaryRepo.find({
|
const salary_raw = await this.salaryRepo.find({
|
||||||
|
|
@ -1308,7 +1312,9 @@ export class ProfileController extends Controller {
|
||||||
section: item.section ? Extension.ToThaiNumber(item.section) : "",
|
section: item.section ? Extension.ToThaiNumber(item.section) : "",
|
||||||
page: item.page ? Extension.ToThaiNumber(item.page) : "",
|
page: item.page ? Extension.ToThaiNumber(item.page) : "",
|
||||||
refCommandDate: item.refCommandDate
|
refCommandDate: item.refCommandDate
|
||||||
? Extension.ToThaiNumber(`ราชกิจจานุเบกษา เล่มที่ ${item.volume ?? "-"} ตอนที่ ${item.section ?? "-"} ลว. ${Extension.ToThaiFullDate2(item.refCommandDate)}`)
|
? Extension.ToThaiNumber(
|
||||||
|
`ราชกิจจานุเบกษา เล่มที่ ${item.volume ?? "-"} ตอนที่ ${item.section ?? "-"} ลว. ${Extension.ToThaiFullDate2(item.refCommandDate)}`,
|
||||||
|
)
|
||||||
: "-",
|
: "-",
|
||||||
note: item.note ? Extension.ToThaiNumber(item.note) : "",
|
note: item.note ? Extension.ToThaiNumber(item.note) : "",
|
||||||
}))
|
}))
|
||||||
|
|
@ -1325,7 +1331,7 @@ export class ProfileController extends Controller {
|
||||||
section: "",
|
section: "",
|
||||||
page: "",
|
page: "",
|
||||||
refCommandDate: "",
|
refCommandDate: "",
|
||||||
note: ""
|
note: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -1405,9 +1411,7 @@ export class ProfileController extends Controller {
|
||||||
|
|
||||||
// Merge มาสาย/ขาดราชการเข้า leaves array
|
// Merge มาสาย/ขาดราชการเข้า leaves array
|
||||||
absentLate_raw.forEach((item) => {
|
absentLate_raw.forEach((item) => {
|
||||||
const year = item.year
|
const year = item.year ? Extension.ToThaiNumber((item.year + 543).toString()) : "";
|
||||||
? Extension.ToThaiNumber((item.year + 543).toString())
|
|
||||||
: "";
|
|
||||||
|
|
||||||
let yearData = leaves.find((data) => data.year === year);
|
let yearData = leaves.find((data) => data.year === year);
|
||||||
|
|
||||||
|
|
@ -1441,7 +1445,7 @@ export class ProfileController extends Controller {
|
||||||
// });
|
// });
|
||||||
|
|
||||||
if (leaves.length === 0) {
|
if (leaves.length === 0) {
|
||||||
leaves.push({year:""});
|
leaves.push({ year: "" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const leave2_raw = await this.profileLeaveRepository
|
const leave2_raw = await this.profileLeaveRepository
|
||||||
|
|
@ -1473,12 +1477,12 @@ export class ProfileController extends Controller {
|
||||||
const displayType =
|
const displayType =
|
||||||
leaveTypeCode === "LV-008" && item.leaveSubTypeName
|
leaveTypeCode === "LV-008" && item.leaveSubTypeName
|
||||||
? item.leaveSubTypeName
|
? item.leaveSubTypeName
|
||||||
: (item.name || "-");
|
: item.name || "-";
|
||||||
|
|
||||||
// ข้อที่ 2: แสดง reason ก่อนเสมอ ถ้ามี coupleDayLevelCountry ค่อยแสดงประเทศ
|
// ข้อที่ 2: แสดง reason ก่อนเสมอ ถ้ามี coupleDayLevelCountry ค่อยแสดงประเทศ
|
||||||
const displayReason = item.coupleDayLevelCountry
|
const displayReason = item.coupleDayLevelCountry
|
||||||
? `${item.reason || ""} ลาไปประเทศ ${item.coupleDayLevelCountry}`.trim()
|
? `${item.reason || ""} ลาไปประเทศ ${item.coupleDayLevelCountry}`.trim()
|
||||||
: (item.reason || "-");
|
: item.reason || "-";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
date:
|
date:
|
||||||
|
|
@ -1570,79 +1574,93 @@ export class ProfileController extends Controller {
|
||||||
];
|
];
|
||||||
|
|
||||||
const position_raw = await this.salaryRepo.find({
|
const position_raw = await this.salaryRepo.find({
|
||||||
where: [{
|
where: [
|
||||||
profileId: id,
|
{
|
||||||
commandCode: In(["0","1","2","3","4","8","9","10","11","12","13","14","15","16","20"]),
|
profileId: id,
|
||||||
// isEntry: false,
|
commandCode: In([
|
||||||
},
|
"0",
|
||||||
{ profileId: id, commandCode: IsNull() }],
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"8",
|
||||||
|
"9",
|
||||||
|
"10",
|
||||||
|
"11",
|
||||||
|
"12",
|
||||||
|
"13",
|
||||||
|
"14",
|
||||||
|
"15",
|
||||||
|
"16",
|
||||||
|
"20",
|
||||||
|
]),
|
||||||
|
// isEntry: false,
|
||||||
|
},
|
||||||
|
{ profileId: id, commandCode: IsNull() },
|
||||||
|
],
|
||||||
order: { order: "ASC" },
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
let _commandName:any = "";
|
let _commandName: any = "";
|
||||||
let _commandDateAffect:any = ""
|
let _commandDateAffect: any = "";
|
||||||
const positionList =
|
const positionList =
|
||||||
position_raw.length > 0
|
position_raw.length > 0
|
||||||
? await Promise.all(position_raw.map(async(item, idx, arr) => {
|
? await Promise.all(
|
||||||
const isLast = idx === arr.length - 1;
|
position_raw.map(async (item, idx, arr) => {
|
||||||
if (isLast) {
|
const isLast = idx === arr.length - 1;
|
||||||
_commandDateAffect = item.commandDateAffect
|
if (isLast) {
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
_commandDateAffect = item.commandDateAffect
|
||||||
: "";
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||||
}
|
: "";
|
||||||
const _code = item.commandCode ? Number(item.commandCode) : null;
|
}
|
||||||
if (_code != null) {
|
const _code = item.commandCode ? Number(item.commandCode) : null;
|
||||||
_commandName = await this.commandCodeRepository.findOne({
|
if (_code != null) {
|
||||||
select: { name: true, code: true },
|
_commandName = await this.commandCodeRepository.findOne({
|
||||||
where: { code: _code }
|
select: { name: true, code: true },
|
||||||
});
|
where: { code: _code },
|
||||||
}
|
});
|
||||||
const codeSitAbb = item.posNumCodeSitAbb ?? "-"
|
}
|
||||||
const commandNo = item.commandNo && item.commandYear
|
const codeSitAbb = item.posNumCodeSitAbb ?? "-";
|
||||||
? item.commandNo+"/"+(item.commandYear > 2500 ? item.commandYear : item.commandYear + 543)
|
const commandNo =
|
||||||
: "-"
|
item.commandNo && item.commandYear
|
||||||
const dateAffect = item.commandDateAffect
|
? item.commandNo +
|
||||||
? `${Extension.ToThaiFullDate2(item.commandDateAffect)}`
|
"/" +
|
||||||
: "-"
|
(item.commandYear > 2500 ? item.commandYear : item.commandYear + 543)
|
||||||
return {
|
: "-";
|
||||||
commandName: _commandName && _commandName.name
|
const dateAffect = item.commandDateAffect
|
||||||
? _commandName.name
|
? `${Extension.ToThaiFullDate2(item.commandDateAffect)}`
|
||||||
: item.commandName,
|
: "-";
|
||||||
commandDateAffect: item.commandDateAffect
|
return {
|
||||||
? Extension.ToThaiNumber(
|
commandName:
|
||||||
Extension.ToThaiFullDate2(item.commandDateAffect)
|
_commandName && _commandName.name ? _commandName.name : item.commandName,
|
||||||
)
|
commandDateAffect: item.commandDateAffect
|
||||||
: "",
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||||
commandDateSign: item.commandDateSign
|
|
||||||
? Extension.ToThaiNumber(
|
|
||||||
Extension.ToThaiFullDate2(item.commandDateSign)
|
|
||||||
)
|
|
||||||
: "",
|
|
||||||
posNo:
|
|
||||||
item.posNoAbb && item.posNo
|
|
||||||
? Extension.ToThaiNumber(`${item.posNoAbb} ${item.posNo}`)
|
|
||||||
: "",
|
: "",
|
||||||
position: item.positionName,
|
commandDateSign: item.commandDateSign
|
||||||
posType: item.positionType,
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign))
|
||||||
posLevel: item.positionLevel
|
: "",
|
||||||
? Extension.ToThaiNumber(item.positionLevel)
|
posNo:
|
||||||
: item.positionCee
|
item.posNoAbb && item.posNo
|
||||||
? Extension.ToThaiNumber(item.positionCee)
|
? Extension.ToThaiNumber(`${item.posNoAbb} ${item.posNo}`)
|
||||||
: null,
|
: "",
|
||||||
amount: item.amount
|
position: item.positionName,
|
||||||
? Extension.ToThaiNumber(
|
posType: item.positionType,
|
||||||
Number(item.amount).toLocaleString()
|
posLevel: item.positionLevel
|
||||||
)
|
? Extension.ToThaiNumber(item.positionLevel)
|
||||||
: "",
|
: item.positionCee
|
||||||
positionSalaryAmount: item.positionSalaryAmount
|
? Extension.ToThaiNumber(item.positionCee)
|
||||||
? Extension.ToThaiNumber(
|
: null,
|
||||||
Number(item.positionSalaryAmount).toLocaleString()
|
amount: item.amount
|
||||||
)
|
? Extension.ToThaiNumber(Number(item.amount).toLocaleString())
|
||||||
: "",
|
: "",
|
||||||
refDoc: Extension.ToThaiNumber(
|
positionSalaryAmount: item.positionSalaryAmount
|
||||||
`คำสั่ง ${codeSitAbb} ที่ ${commandNo} ลว. ${dateAffect}`
|
? Extension.ToThaiNumber(Number(item.positionSalaryAmount).toLocaleString())
|
||||||
),
|
: "",
|
||||||
};
|
refDoc: Extension.ToThaiNumber(
|
||||||
}))
|
`คำสั่ง ${codeSitAbb} ที่ ${commandNo} ลว. ${dateAffect}`,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
)
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
commandName: "",
|
commandName: "",
|
||||||
|
|
@ -1654,7 +1672,7 @@ export class ProfileController extends Controller {
|
||||||
posLevel: "",
|
posLevel: "",
|
||||||
amount: "",
|
amount: "",
|
||||||
positionSalaryAmount: "",
|
positionSalaryAmount: "",
|
||||||
refDoc: ""
|
refDoc: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -1703,49 +1721,46 @@ export class ProfileController extends Controller {
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
let _actpositions = [];
|
let _actpositions = [];
|
||||||
if (actposition_raw.length > 0){
|
if (actposition_raw.length > 0) {
|
||||||
for (const item of actposition_raw) {
|
for (const item of actposition_raw) {
|
||||||
let _commandTypename: string = "รักษาการในตำแหน่ง";
|
let _commandTypename: string = "รักษาการในตำแหน่ง";
|
||||||
let _document: string = "-";
|
let _document: string = "-";
|
||||||
let _org: string = "-";
|
let _org: string = "-";
|
||||||
|
|
||||||
if (item.commandId) {
|
if (item.commandId) {
|
||||||
const {
|
const { posNumCodeSitAbb, commandTypeName, commandNo, commandYear, commandExcecuteDate } =
|
||||||
posNumCodeSitAbb,
|
await getPosNumCodeSit(item.commandId, "REPORTED");
|
||||||
commandTypeName,
|
|
||||||
commandNo,
|
|
||||||
commandYear,
|
|
||||||
commandExcecuteDate,
|
|
||||||
} = await getPosNumCodeSit(item.commandId, "REPORTED");
|
|
||||||
|
|
||||||
_document = Extension.ToThaiNumber(`คำสั่ง ${posNumCodeSitAbb ?? "-"} ที่ ${commandNo}/${commandYear>2500?commandYear:commandYear+543} ลว. ${(Extension.ToThaiFullDate2(commandExcecuteDate))}`)
|
_document = Extension.ToThaiNumber(
|
||||||
|
`คำสั่ง ${posNumCodeSitAbb ?? "-"} ที่ ${commandNo}/${commandYear > 2500 ? commandYear : commandYear + 543} ลว. ${Extension.ToThaiFullDate2(commandExcecuteDate)}`,
|
||||||
|
);
|
||||||
_commandTypename = commandTypeName;
|
_commandTypename = commandTypeName;
|
||||||
}
|
}
|
||||||
// ค้นหาหน่วยงานที่รักษาการ
|
// ค้นหาหน่วยงานที่รักษาการ
|
||||||
const _posmasterAct = await this.posMasterActRepository.findOne({
|
const _posmasterAct = await this.posMasterActRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
posMasterChildId: posMasterId ?? "",
|
posMasterChildId: posMasterId ?? "",
|
||||||
statusReport: "DONE"
|
statusReport: "DONE",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
if (_posmasterAct) {
|
if (_posmasterAct) {
|
||||||
const _posMater = await this.posMasterRepo.findOne({
|
const _posMater = await this.posMasterRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: _posmasterAct.posMasterId
|
id: _posmasterAct.posMasterId,
|
||||||
},
|
},
|
||||||
relations:{
|
relations: {
|
||||||
orgRoot: true,
|
orgRoot: true,
|
||||||
orgChild1: true,
|
orgChild1: true,
|
||||||
orgChild2: true,
|
orgChild2: true,
|
||||||
orgChild3: true,
|
orgChild3: true,
|
||||||
orgChild4: true,
|
orgChild4: true,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
let child4 = _posMater?.orgChild4?.orgChild4Name ?? ""
|
let child4 = _posMater?.orgChild4?.orgChild4Name ?? "";
|
||||||
let child3 = _posMater?.orgChild3?.orgChild3Name ?? ""
|
let child3 = _posMater?.orgChild3?.orgChild3Name ?? "";
|
||||||
let child2 = _posMater?.orgChild2?.orgChild2Name ?? ""
|
let child2 = _posMater?.orgChild2?.orgChild2Name ?? "";
|
||||||
let child1 = _posMater?.orgChild1?.orgChild1Name ?? ""
|
let child1 = _posMater?.orgChild1?.orgChild1Name ?? "";
|
||||||
let root = _posMater?.orgRoot?.orgRootName ?? ""
|
let root = _posMater?.orgRoot?.orgRootName ?? "";
|
||||||
_org = `${child4} ${child3} ${child2} ${child1} ${root}`.trim();
|
_org = `${child4} ${child3} ${child2} ${child1} ${root}`.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1763,14 +1778,14 @@ export class ProfileController extends Controller {
|
||||||
position: item.position ? Extension.ToThaiNumber(item.position) : "",
|
position: item.position ? Extension.ToThaiNumber(item.position) : "",
|
||||||
commandName: _commandTypename,
|
commandName: _commandTypename,
|
||||||
agency: _org,
|
agency: _org,
|
||||||
note: _posmasterAct && _posmasterAct?.posMasterOrder
|
note:
|
||||||
? Extension.ToThaiNumber(_posmasterAct?.posMasterOrder.toString())
|
_posmasterAct && _posmasterAct?.posMasterOrder
|
||||||
: "-",
|
? Extension.ToThaiNumber(_posmasterAct?.posMasterOrder.toString())
|
||||||
|
: "-",
|
||||||
document: _document,
|
document: _document,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
_actpositions.push({
|
_actpositions.push({
|
||||||
date: "",
|
date: "",
|
||||||
position: "",
|
position: "",
|
||||||
|
|
@ -1786,7 +1801,7 @@ export class ProfileController extends Controller {
|
||||||
where: { profileId: id, /*status: "PENDING",*/ isDeleted: false },
|
where: { profileId: id, /*status: "PENDING",*/ isDeleted: false },
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
let _assistances = []
|
let _assistances = [];
|
||||||
if (assistance_raw.length > 0) {
|
if (assistance_raw.length > 0) {
|
||||||
for (const item of assistance_raw) {
|
for (const item of assistance_raw) {
|
||||||
let _commandTypename: string = item.commandName ?? "ให้ช่วยราชการ";
|
let _commandTypename: string = item.commandName ?? "ให้ช่วยราชการ";
|
||||||
|
|
@ -1794,15 +1809,12 @@ export class ProfileController extends Controller {
|
||||||
let _org: string = item.agency ? Extension.ToThaiNumber(item.agency) : "-";
|
let _org: string = item.agency ? Extension.ToThaiNumber(item.agency) : "-";
|
||||||
|
|
||||||
if (item.commandId) {
|
if (item.commandId) {
|
||||||
const {
|
const { posNumCodeSitAbb, commandTypeName, commandNo, commandYear, commandExcecuteDate } =
|
||||||
posNumCodeSitAbb,
|
await getPosNumCodeSit(item.commandId);
|
||||||
commandTypeName,
|
|
||||||
commandNo,
|
|
||||||
commandYear,
|
|
||||||
commandExcecuteDate,
|
|
||||||
} = await getPosNumCodeSit(item.commandId);
|
|
||||||
|
|
||||||
_document = Extension.ToThaiNumber(`คำสั่ง ${posNumCodeSitAbb ?? "-"} ที่ ${commandNo}/${commandYear>2500?commandYear:commandYear+543} ลว. ${(Extension.ToThaiFullDate2(commandExcecuteDate))}`)
|
_document = Extension.ToThaiNumber(
|
||||||
|
`คำสั่ง ${posNumCodeSitAbb ?? "-"} ที่ ${commandNo}/${commandYear > 2500 ? commandYear : commandYear + 543} ลว. ${Extension.ToThaiFullDate2(commandExcecuteDate)}`,
|
||||||
|
);
|
||||||
_commandTypename = commandTypeName;
|
_commandTypename = commandTypeName;
|
||||||
}
|
}
|
||||||
_assistances.push({
|
_assistances.push({
|
||||||
|
|
@ -1849,7 +1861,9 @@ export class ProfileController extends Controller {
|
||||||
agency: "-",
|
agency: "-",
|
||||||
refCommandNo: item.refCommandNo
|
refCommandNo: item.refCommandNo
|
||||||
? item.refCommandDate
|
? item.refCommandDate
|
||||||
? Extension.ToThaiNumber(`${item.refCommandNo} ลว. ${Extension.ToThaiFullDate2(item.refCommandDate)}`)
|
? Extension.ToThaiNumber(
|
||||||
|
`${item.refCommandNo} ลว. ${Extension.ToThaiFullDate2(item.refCommandDate)}`,
|
||||||
|
)
|
||||||
: Extension.ToThaiNumber(item.refCommandNo)
|
: Extension.ToThaiNumber(item.refCommandNo)
|
||||||
: "-",
|
: "-",
|
||||||
}))
|
}))
|
||||||
|
|
@ -1870,9 +1884,14 @@ export class ProfileController extends Controller {
|
||||||
assessments_raw.length > 0
|
assessments_raw.length > 0
|
||||||
? assessments_raw.map((item) => ({
|
? assessments_raw.map((item) => ({
|
||||||
year: item.year ? Extension.ToThaiNumber((parseInt(item.year) + 543).toString()) : "",
|
year: item.year ? Extension.ToThaiNumber((parseInt(item.year) + 543).toString()) : "",
|
||||||
period: item.period && item.period == "APR"
|
period:
|
||||||
? Extension.ToThaiNumber(`1 เม.ย. ${(parseInt(item.year) + 543 - 1).toString()} - 31 มี.ค. ${(parseInt(item.year) + 543).toString()}`)
|
item.period && item.period == "APR"
|
||||||
: Extension.ToThaiNumber(`1 ต.ค. ${(parseInt(item.year) + 543 - 1).toString()} - 30 ก.ย. ${(parseInt(item.year) + 543).toString()}`),
|
? Extension.ToThaiNumber(
|
||||||
|
`1 เม.ย. ${(parseInt(item.year) + 543 - 1).toString()} - 31 มี.ค. ${(parseInt(item.year) + 543).toString()}`,
|
||||||
|
)
|
||||||
|
: Extension.ToThaiNumber(
|
||||||
|
`1 ต.ค. ${(parseInt(item.year) + 543 - 1).toString()} - 30 ก.ย. ${(parseInt(item.year) + 543).toString()}`,
|
||||||
|
),
|
||||||
point1: item.point1 ? Extension.ToThaiNumber(item.point1.toString()) : "",
|
point1: item.point1 ? Extension.ToThaiNumber(item.point1.toString()) : "",
|
||||||
point1Total: item.point1Total
|
point1Total: item.point1Total
|
||||||
? Extension.ToThaiNumber(item.point1Total.toString())
|
? Extension.ToThaiNumber(item.point1Total.toString())
|
||||||
|
|
@ -1935,33 +1954,41 @@ export class ProfileController extends Controller {
|
||||||
const otherIncome =
|
const otherIncome =
|
||||||
otherIncome_raw.length > 0
|
otherIncome_raw.length > 0
|
||||||
? await Promise.all(
|
? await Promise.all(
|
||||||
otherIncome_raw.map(async(item) => {
|
otherIncome_raw.map(async (item) => {
|
||||||
const codeSitAbb = item.posNumCodeSitAbb ?? "-"
|
const codeSitAbb = item.posNumCodeSitAbb ?? "-";
|
||||||
const commandNo = item.commandNo && item.commandYear
|
const commandNo =
|
||||||
? item.commandNo+"/"+(item.commandYear > 2500 ? item.commandYear : item.commandYear + 543)
|
item.commandNo && item.commandYear
|
||||||
: "-"
|
? item.commandNo +
|
||||||
const dateAffect = item.commandDateAffect
|
"/" +
|
||||||
? `${Extension.ToThaiFullDate2(item.commandDateAffect)}`
|
(item.commandYear > 2500 ? item.commandYear : item.commandYear + 543)
|
||||||
: "-"
|
: "-";
|
||||||
return {
|
const dateAffect = item.commandDateAffect
|
||||||
commandName: item.commandName ?? "",
|
? `${Extension.ToThaiFullDate2(item.commandDateAffect)}`
|
||||||
commandDateAffect: item.commandDateAffect
|
: "-";
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
return {
|
||||||
: "",
|
commandName: item.commandName ?? "",
|
||||||
commandDateSign: item.commandDateSign
|
commandDateAffect: item.commandDateAffect
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||||
: "",
|
: "",
|
||||||
commandNo: item.commandNo ? Extension.ToThaiNumber(item.commandNo) : "",
|
commandDateSign: item.commandDateSign
|
||||||
position: item.positionName,
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign))
|
||||||
posLevel: item.positionLevel
|
: "",
|
||||||
? Extension.ToThaiNumber(item.positionLevel)
|
commandNo: item.commandNo ? Extension.ToThaiNumber(item.commandNo) : "",
|
||||||
: item.positionCee
|
position: item.positionName,
|
||||||
? Extension.ToThaiNumber(item.positionCee)
|
posLevel: item.positionLevel
|
||||||
: null,
|
? Extension.ToThaiNumber(item.positionLevel)
|
||||||
amount: item.amount ? Extension.ToThaiNumber(Number(item.amount).toLocaleString()) : "",
|
: item.positionCee
|
||||||
refDoc: Extension.ToThaiNumber(`คำสั่ง ${codeSitAbb} ที่ ${commandNo} ลว. ${dateAffect}`)
|
? Extension.ToThaiNumber(item.positionCee)
|
||||||
}
|
: null,
|
||||||
}))
|
amount: item.amount
|
||||||
|
? Extension.ToThaiNumber(Number(item.amount).toLocaleString())
|
||||||
|
: "",
|
||||||
|
refDoc: Extension.ToThaiNumber(
|
||||||
|
`คำสั่ง ${codeSitAbb} ที่ ${commandNo} ลว. ${dateAffect}`,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
)
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
commandName: "",
|
commandName: "",
|
||||||
|
|
@ -1971,7 +1998,7 @@ export class ProfileController extends Controller {
|
||||||
position: "",
|
position: "",
|
||||||
posLevel: "",
|
posLevel: "",
|
||||||
amount: "",
|
amount: "",
|
||||||
refDoc: ""
|
refDoc: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -2018,7 +2045,7 @@ export class ProfileController extends Controller {
|
||||||
)
|
)
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
let portfolios:any[] = [];
|
let portfolios: any[] = [];
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.GetData(req, `/development/portfolio/kk1/${profiles?.keycloak}`)
|
.GetData(req, `/development/portfolio/kk1/${profiles?.keycloak}`)
|
||||||
.then((x) => {
|
.then((x) => {
|
||||||
|
|
@ -2031,7 +2058,7 @@ export class ProfileController extends Controller {
|
||||||
portfolios = portfolios.map((x: any) => ({
|
portfolios = portfolios.map((x: any) => ({
|
||||||
name: x.name ? Extension.ToThaiNumber(x.name) : "-",
|
name: x.name ? Extension.ToThaiNumber(x.name) : "-",
|
||||||
year: x.year ? Extension.ToThaiNumber(x.year.toString()) : "-",
|
year: x.year ? Extension.ToThaiNumber(x.year.toString()) : "-",
|
||||||
position: `${x.position ?? "-"}`
|
position: `${x.position ?? "-"}`,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
const org =
|
const org =
|
||||||
|
|
@ -2039,19 +2066,21 @@ export class ProfileController extends Controller {
|
||||||
(_child3 == null ? "" : _child3 + " ") +
|
(_child3 == null ? "" : _child3 + " ") +
|
||||||
(_child2 == null ? "" : _child2 + " ") +
|
(_child2 == null ? "" : _child2 + " ") +
|
||||||
(_child1 == null ? "" : _child1 + " ") +
|
(_child1 == null ? "" : _child1 + " ") +
|
||||||
(_root == null ? "" : _root).trim()
|
(_root == null ? "" : _root).trim();
|
||||||
const _position = profiles?.position != null ?
|
const _position =
|
||||||
profiles?.posLevel != null
|
profiles?.position != null
|
||||||
? `${profiles.position}${profiles.posLevel.posLevelName}`
|
? profiles?.posLevel != null
|
||||||
: profiles.position
|
? `${profiles.position}${profiles.posLevel.posLevelName}`
|
||||||
: ""
|
: profiles.position
|
||||||
|
: "";
|
||||||
const ocAssistance = await this.profileAssistanceRepository.findOne({
|
const ocAssistance = await this.profileAssistanceRepository.findOne({
|
||||||
select: ["agency", "profileId", "commandName", "status", "isDeleted"],
|
select: ["agency", "profileId", "commandName", "status", "isDeleted"],
|
||||||
where: {
|
where: {
|
||||||
profileId: id,
|
profileId: id,
|
||||||
commandName: "ให้ช่วยราชการ",
|
commandName: "ให้ช่วยราชการ",
|
||||||
status: "PENDING",
|
status: "PENDING",
|
||||||
isDeleted: false, },
|
isDeleted: false,
|
||||||
|
},
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
const data = {
|
const data = {
|
||||||
|
|
@ -2080,7 +2109,8 @@ export class ProfileController extends Controller {
|
||||||
ocFullPath: org,
|
ocFullPath: org,
|
||||||
ocAssistance: ocAssistance?.agency ?? org,
|
ocAssistance: ocAssistance?.agency ?? org,
|
||||||
root: _root == null ? "" : _root,
|
root: _root == null ? "" : _root,
|
||||||
agency: (_child4 == null ? "" : _child4 + " ") +
|
agency:
|
||||||
|
(_child4 == null ? "" : _child4 + " ") +
|
||||||
(_child3 == null ? "" : _child3 + " ") +
|
(_child3 == null ? "" : _child3 + " ") +
|
||||||
(_child2 == null ? "" : _child2 + " ") +
|
(_child2 == null ? "" : _child2 + " ") +
|
||||||
(_child1 == null ? "" : _child1).trim(),
|
(_child1 == null ? "" : _child1).trim(),
|
||||||
|
|
@ -2212,7 +2242,7 @@ export class ProfileController extends Controller {
|
||||||
profileAbility,
|
profileAbility,
|
||||||
otherIncome,
|
otherIncome,
|
||||||
portfolios,
|
portfolios,
|
||||||
retires
|
retires,
|
||||||
};
|
};
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
|
|
@ -5391,7 +5421,7 @@ export class ProfileController extends Controller {
|
||||||
await this.profileRepo.save(record);
|
await this.profileRepo.save(record);
|
||||||
// setLogDataDiff(request, { before, after: record });
|
// setLogDataDiff(request, { before, after: record });
|
||||||
|
|
||||||
if (record != null && record.keycloak != null) {
|
if (record != null && record.keycloak != null && record.isDelete === false) {
|
||||||
const result = await updateName(
|
const result = await updateName(
|
||||||
record.keycloak,
|
record.keycloak,
|
||||||
record.firstName,
|
record.firstName,
|
||||||
|
|
@ -5710,7 +5740,7 @@ export class ProfileController extends Controller {
|
||||||
await this.profileRepo.save(record, { data: request });
|
await this.profileRepo.save(record, { data: request });
|
||||||
setLogDataDiff(request, { before, after: record });
|
setLogDataDiff(request, { before, after: record });
|
||||||
|
|
||||||
if (record != null && record.keycloak != null) {
|
if (record != null && record.keycloak != null && record.isDelete === false) {
|
||||||
const result = await updateName(
|
const result = await updateName(
|
||||||
record.keycloak,
|
record.keycloak,
|
||||||
record.firstName,
|
record.firstName,
|
||||||
|
|
@ -11260,13 +11290,14 @@ export class ProfileController extends Controller {
|
||||||
// profile.position = _null;
|
// profile.position = _null;
|
||||||
// profile.posLevelId = _null;
|
// profile.posLevelId = _null;
|
||||||
// profile.posTypeId = _null;
|
// profile.posTypeId = _null;
|
||||||
if (profile.keycloak != null) {
|
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// profile.keycloak = _null;
|
// profile.keycloak = _null;
|
||||||
profile.roleKeycloaks = [];
|
profile.roleKeycloaks = [];
|
||||||
profile.isActive = false;
|
profile.isActive = false;
|
||||||
|
profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.profileRepo.save(profile, { data: request });
|
await this.profileRepo.save(profile, { data: request });
|
||||||
|
|
@ -11372,7 +11403,10 @@ export class ProfileController extends Controller {
|
||||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
.where("profile.isActive = :isActive", { isActive: false })
|
.where(body.system ? "profile.isActive = :isActive" : "profile.isDelete = :isDelete", {
|
||||||
|
isActive: false,
|
||||||
|
isDelete: true,
|
||||||
|
})
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });
|
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });
|
||||||
|
|
|
||||||
|
|
@ -871,7 +871,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
// กรองเอา object ที่ไม่มี year ออก
|
// กรองเอา object ที่ไม่มี year ออก
|
||||||
const filteredLeaves = leaves.filter(item => item.year && item.year !== "");
|
const filteredLeaves = leaves.filter((item) => item.year && item.year !== "");
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
||||||
|
|
@ -1135,7 +1135,9 @@ export class ProfileEmployeeController extends Controller {
|
||||||
certificateType: item.certificateType ?? null,
|
certificateType: item.certificateType ?? null,
|
||||||
issuer: item.issuer ?? null,
|
issuer: item.issuer ?? null,
|
||||||
certificateNo: item.certificateNo ? Extension.ToThaiNumber(item.certificateNo) : null,
|
certificateNo: item.certificateNo ? Extension.ToThaiNumber(item.certificateNo) : null,
|
||||||
detail: Extension.ToThaiNumber(`${item.issuer ?? ""} ${item.certificateNo ?? ""}`.trim()),
|
detail: Extension.ToThaiNumber(
|
||||||
|
`${item.issuer ?? ""} ${item.certificateNo ?? ""}`.trim(),
|
||||||
|
),
|
||||||
issueToExpireDate: item.issueDate
|
issueToExpireDate: item.issueDate
|
||||||
? item.expireDate
|
? item.expireDate
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
|
|
@ -1167,7 +1169,9 @@ export class ProfileEmployeeController extends Controller {
|
||||||
degree: item.name ? Extension.ToThaiNumber(item.name) : "",
|
degree: item.name ? Extension.ToThaiNumber(item.name) : "",
|
||||||
place: item.place ? Extension.ToThaiNumber(item.place) : "",
|
place: item.place ? Extension.ToThaiNumber(item.place) : "",
|
||||||
duration: item.duration ? Extension.ToThaiNumber(item.duration) : "",
|
duration: item.duration ? Extension.ToThaiNumber(item.duration) : "",
|
||||||
date: Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.startDate)} - ${Extension.ToThaiFullDate2(item.endDate)}`)
|
date: Extension.ToThaiNumber(
|
||||||
|
`${Extension.ToThaiFullDate2(item.startDate)} - ${Extension.ToThaiFullDate2(item.endDate)}`,
|
||||||
|
),
|
||||||
}))
|
}))
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
|
|
@ -1175,7 +1179,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
degree: "",
|
degree: "",
|
||||||
place: "",
|
place: "",
|
||||||
duration: "",
|
duration: "",
|
||||||
date: ""
|
date: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -1218,14 +1222,14 @@ export class ProfileEmployeeController extends Controller {
|
||||||
? `${item.startDate ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate)) : ""} - ${item.endDate ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate)) : ""}`
|
? `${item.startDate ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate)) : ""} - ${item.endDate ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate)) : ""}`
|
||||||
: `${item.startDate ? Extension.ToThaiNumber(Extension.ToThaiShortYear(new Date(item.startDate))) : ""} - ${item.endDate ? Extension.ToThaiNumber(Extension.ToThaiShortYear(new Date(item.endDate))) : ""}`,
|
: `${item.startDate ? Extension.ToThaiNumber(Extension.ToThaiShortYear(new Date(item.startDate))) : ""} - ${item.endDate ? Extension.ToThaiNumber(Extension.ToThaiShortYear(new Date(item.endDate))) : ""}`,
|
||||||
degree: `${item.degree ?? ""} ${item.field ?? ""}`.trim(),
|
degree: `${item.degree ?? ""} ${item.field ?? ""}`.trim(),
|
||||||
level: item.educationLevel
|
level: item.educationLevel,
|
||||||
}))
|
}))
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
institute: "",
|
institute: "",
|
||||||
date: "",
|
date: "",
|
||||||
degree: "",
|
degree: "",
|
||||||
level: ""
|
level: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const salary_raw = await this.salaryRepo.find({
|
const salary_raw = await this.salaryRepo.find({
|
||||||
|
|
@ -1441,9 +1445,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
|
|
||||||
// Merge มาสาย/ขาดราชการเข้า leaves array
|
// Merge มาสาย/ขาดราชการเข้า leaves array
|
||||||
absentLate_raw.forEach((item) => {
|
absentLate_raw.forEach((item) => {
|
||||||
const year = item.year
|
const year = item.year ? Extension.ToThaiNumber((item.year + 543).toString()) : "";
|
||||||
? Extension.ToThaiNumber((item.year + 543).toString())
|
|
||||||
: "";
|
|
||||||
|
|
||||||
let yearData = leaves.find((data) => data.year === year);
|
let yearData = leaves.find((data) => data.year === year);
|
||||||
|
|
||||||
|
|
@ -1477,7 +1479,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
// });
|
// });
|
||||||
|
|
||||||
if (leaves.length === 0) {
|
if (leaves.length === 0) {
|
||||||
leaves.push({year:""});
|
leaves.push({ year: "" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const leave2_raw = await this.profileLeaveRepository
|
const leave2_raw = await this.profileLeaveRepository
|
||||||
|
|
@ -1509,12 +1511,12 @@ export class ProfileEmployeeController extends Controller {
|
||||||
const displayType =
|
const displayType =
|
||||||
leaveTypeCode === "LV-008" && item.leaveSubTypeName
|
leaveTypeCode === "LV-008" && item.leaveSubTypeName
|
||||||
? item.leaveSubTypeName
|
? item.leaveSubTypeName
|
||||||
: (item.name || "-");
|
: item.name || "-";
|
||||||
|
|
||||||
// ข้อที่ 2: แสดง reason ก่อนเสมอ ถ้ามี coupleDayLevelCountry ค่อยแสดงประเทศ
|
// ข้อที่ 2: แสดง reason ก่อนเสมอ ถ้ามี coupleDayLevelCountry ค่อยแสดงประเทศ
|
||||||
const displayReason = item.coupleDayLevelCountry
|
const displayReason = item.coupleDayLevelCountry
|
||||||
? `${item.reason || ""} ลาไปประเทศ ${item.coupleDayLevelCountry}`.trim()
|
? `${item.reason || ""} ลาไปประเทศ ${item.coupleDayLevelCountry}`.trim()
|
||||||
: (item.reason || "-");
|
: item.reason || "-";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
date:
|
date:
|
||||||
|
|
@ -1606,79 +1608,93 @@ export class ProfileEmployeeController extends Controller {
|
||||||
];
|
];
|
||||||
|
|
||||||
const position_raw = await this.salaryRepo.find({
|
const position_raw = await this.salaryRepo.find({
|
||||||
where: [{
|
where: [
|
||||||
profileEmployeeId: id,
|
{
|
||||||
commandCode: In(["0","1","2","3","4","8","9","10","11","12","13","14","15","16","20"]),
|
profileEmployeeId: id,
|
||||||
// isEntry: false,
|
commandCode: In([
|
||||||
},
|
"0",
|
||||||
{ profileEmployeeId: id, commandCode: IsNull() }],
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"8",
|
||||||
|
"9",
|
||||||
|
"10",
|
||||||
|
"11",
|
||||||
|
"12",
|
||||||
|
"13",
|
||||||
|
"14",
|
||||||
|
"15",
|
||||||
|
"16",
|
||||||
|
"20",
|
||||||
|
]),
|
||||||
|
// isEntry: false,
|
||||||
|
},
|
||||||
|
{ profileEmployeeId: id, commandCode: IsNull() },
|
||||||
|
],
|
||||||
order: { order: "ASC" },
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
let _commandName:any = "";
|
let _commandName: any = "";
|
||||||
let _commandDateAffect:any = ""
|
let _commandDateAffect: any = "";
|
||||||
const positionList =
|
const positionList =
|
||||||
position_raw.length > 0
|
position_raw.length > 0
|
||||||
? await Promise.all(position_raw.map(async(item, idx, arr) => {
|
? await Promise.all(
|
||||||
const isLast = idx === arr.length - 1;
|
position_raw.map(async (item, idx, arr) => {
|
||||||
if (isLast) {
|
const isLast = idx === arr.length - 1;
|
||||||
_commandDateAffect = item.commandDateAffect
|
if (isLast) {
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
_commandDateAffect = item.commandDateAffect
|
||||||
: "";
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||||
}
|
: "";
|
||||||
const _code = item.commandCode ? Number(item.commandCode) : null;
|
}
|
||||||
if (_code != null) {
|
const _code = item.commandCode ? Number(item.commandCode) : null;
|
||||||
_commandName = await this.commandCodeRepository.findOne({
|
if (_code != null) {
|
||||||
select: { name: true, code: true },
|
_commandName = await this.commandCodeRepository.findOne({
|
||||||
where: { code: _code }
|
select: { name: true, code: true },
|
||||||
});
|
where: { code: _code },
|
||||||
}
|
});
|
||||||
const codeSitAbb = item.posNumCodeSitAbb ?? "-"
|
}
|
||||||
const commandNo = item.commandNo && item.commandYear
|
const codeSitAbb = item.posNumCodeSitAbb ?? "-";
|
||||||
? item.commandNo+"/"+(item.commandYear > 2500 ? item.commandYear : item.commandYear + 543)
|
const commandNo =
|
||||||
: "-"
|
item.commandNo && item.commandYear
|
||||||
const dateAffect = item.commandDateAffect
|
? item.commandNo +
|
||||||
? `${Extension.ToThaiFullDate2(item.commandDateAffect)}`
|
"/" +
|
||||||
: "-"
|
(item.commandYear > 2500 ? item.commandYear : item.commandYear + 543)
|
||||||
return {
|
: "-";
|
||||||
commandName: _commandName && _commandName.name
|
const dateAffect = item.commandDateAffect
|
||||||
? _commandName.name
|
? `${Extension.ToThaiFullDate2(item.commandDateAffect)}`
|
||||||
: item.commandName,
|
: "-";
|
||||||
commandDateAffect: item.commandDateAffect
|
return {
|
||||||
? Extension.ToThaiNumber(
|
commandName:
|
||||||
Extension.ToThaiFullDate2(item.commandDateAffect)
|
_commandName && _commandName.name ? _commandName.name : item.commandName,
|
||||||
)
|
commandDateAffect: item.commandDateAffect
|
||||||
: "",
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||||
commandDateSign: item.commandDateSign
|
|
||||||
? Extension.ToThaiNumber(
|
|
||||||
Extension.ToThaiFullDate2(item.commandDateSign)
|
|
||||||
)
|
|
||||||
: "",
|
|
||||||
posNo:
|
|
||||||
item.posNoAbb && item.posNo
|
|
||||||
? Extension.ToThaiNumber(`${item.posNoAbb} ${item.posNo}`)
|
|
||||||
: "",
|
: "",
|
||||||
position: item.positionName,
|
commandDateSign: item.commandDateSign
|
||||||
posType: item.positionType,
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign))
|
||||||
posLevel: item.positionLevel
|
: "",
|
||||||
? Extension.ToThaiNumber(item.positionLevel)
|
posNo:
|
||||||
: item.positionCee
|
item.posNoAbb && item.posNo
|
||||||
? Extension.ToThaiNumber(item.positionCee)
|
? Extension.ToThaiNumber(`${item.posNoAbb} ${item.posNo}`)
|
||||||
: null,
|
: "",
|
||||||
amount: item.amount
|
position: item.positionName,
|
||||||
? Extension.ToThaiNumber(
|
posType: item.positionType,
|
||||||
Number(item.amount).toLocaleString()
|
posLevel: item.positionLevel
|
||||||
)
|
? Extension.ToThaiNumber(item.positionLevel)
|
||||||
: "",
|
: item.positionCee
|
||||||
positionSalaryAmount: item.positionSalaryAmount
|
? Extension.ToThaiNumber(item.positionCee)
|
||||||
? Extension.ToThaiNumber(
|
: null,
|
||||||
Number(item.positionSalaryAmount).toLocaleString()
|
amount: item.amount
|
||||||
)
|
? Extension.ToThaiNumber(Number(item.amount).toLocaleString())
|
||||||
: "",
|
: "",
|
||||||
refDoc: Extension.ToThaiNumber(
|
positionSalaryAmount: item.positionSalaryAmount
|
||||||
`คำสั่ง ${codeSitAbb} ที่ ${commandNo} ลว. ${dateAffect}`
|
? Extension.ToThaiNumber(Number(item.positionSalaryAmount).toLocaleString())
|
||||||
),
|
: "",
|
||||||
};
|
refDoc: Extension.ToThaiNumber(
|
||||||
}))
|
`คำสั่ง ${codeSitAbb} ที่ ${commandNo} ลว. ${dateAffect}`,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
)
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
commandName: "",
|
commandName: "",
|
||||||
|
|
@ -1690,7 +1706,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
posLevel: "",
|
posLevel: "",
|
||||||
amount: "",
|
amount: "",
|
||||||
positionSalaryAmount: "",
|
positionSalaryAmount: "",
|
||||||
refDoc: ""
|
refDoc: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -1760,48 +1776,52 @@ export class ProfileEmployeeController extends Controller {
|
||||||
// document: "",
|
// document: "",
|
||||||
// },
|
// },
|
||||||
// ];
|
// ];
|
||||||
const actposition = [{
|
const actposition = [
|
||||||
date: "",
|
{
|
||||||
position: "",
|
date: "",
|
||||||
commandName: "",
|
position: "",
|
||||||
agency: "",
|
commandName: "",
|
||||||
document: "",
|
agency: "",
|
||||||
}];
|
document: "",
|
||||||
|
},
|
||||||
|
];
|
||||||
const duty_raw = await this.dutyRepository.find({
|
const duty_raw = await this.dutyRepository.find({
|
||||||
where: { profileEmployeeId: id, isDeleted: false },
|
where: { profileEmployeeId: id, isDeleted: false },
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
const duty =
|
const duty =
|
||||||
duty_raw.length > 0
|
duty_raw.length > 0
|
||||||
? duty_raw.map((item) => ({
|
? duty_raw.map((item) => ({
|
||||||
date:
|
date:
|
||||||
item.dateStart && item.dateEnd
|
item.dateStart && item.dateEnd
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
|
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
|
||||||
)
|
)
|
||||||
: item.dateStart
|
: item.dateStart
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
||||||
: item.dateEnd
|
: item.dateEnd
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
|
||||||
: "",
|
: "",
|
||||||
type: "-",
|
type: "-",
|
||||||
detail: Extension.ToThaiNumber(item.detail),
|
detail: Extension.ToThaiNumber(item.detail),
|
||||||
agency: "-",
|
agency: "-",
|
||||||
refCommandNo: item.refCommandNo
|
refCommandNo: item.refCommandNo
|
||||||
? item.refCommandDate
|
? item.refCommandDate
|
||||||
? Extension.ToThaiNumber(`${item.refCommandNo} ลว. ${Extension.ToThaiFullDate2(item.refCommandDate)}`)
|
? Extension.ToThaiNumber(
|
||||||
: Extension.ToThaiNumber(item.refCommandNo)
|
`${item.refCommandNo} ลว. ${Extension.ToThaiFullDate2(item.refCommandDate)}`,
|
||||||
: "-",
|
)
|
||||||
}))
|
: Extension.ToThaiNumber(item.refCommandNo)
|
||||||
: [
|
: "-",
|
||||||
{
|
}))
|
||||||
date: "",
|
: [
|
||||||
type: "",
|
{
|
||||||
detail: "",
|
date: "",
|
||||||
agency: "",
|
type: "",
|
||||||
refCommandNo: "",
|
detail: "",
|
||||||
},
|
agency: "",
|
||||||
];
|
refCommandNo: "",
|
||||||
|
},
|
||||||
|
];
|
||||||
const assessments_raw = await this.profileAssessmentsRepository.find({
|
const assessments_raw = await this.profileAssessmentsRepository.find({
|
||||||
where: { profileEmployeeId: id, isDeleted: false },
|
where: { profileEmployeeId: id, isDeleted: false },
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
|
|
@ -1810,9 +1830,14 @@ export class ProfileEmployeeController extends Controller {
|
||||||
assessments_raw.length > 0
|
assessments_raw.length > 0
|
||||||
? assessments_raw.map((item) => ({
|
? assessments_raw.map((item) => ({
|
||||||
year: item.year ? Extension.ToThaiNumber((parseInt(item.year) + 543).toString()) : "",
|
year: item.year ? Extension.ToThaiNumber((parseInt(item.year) + 543).toString()) : "",
|
||||||
period: item.period && item.period == "APR"
|
period:
|
||||||
? Extension.ToThaiNumber(`1 เม.ย. ${(parseInt(item.year) + 543 - 1).toString()} - 31 มี.ค. ${(parseInt(item.year) + 543).toString()}`)
|
item.period && item.period == "APR"
|
||||||
: Extension.ToThaiNumber(`1 ต.ค. ${(parseInt(item.year) + 543 - 1).toString()} - 30 ก.ย. ${(parseInt(item.year) + 543).toString()}`),
|
? Extension.ToThaiNumber(
|
||||||
|
`1 เม.ย. ${(parseInt(item.year) + 543 - 1).toString()} - 31 มี.ค. ${(parseInt(item.year) + 543).toString()}`,
|
||||||
|
)
|
||||||
|
: Extension.ToThaiNumber(
|
||||||
|
`1 ต.ค. ${(parseInt(item.year) + 543 - 1).toString()} - 30 ก.ย. ${(parseInt(item.year) + 543).toString()}`,
|
||||||
|
),
|
||||||
point1: item.point1 ? Extension.ToThaiNumber(item.point1.toString()) : "",
|
point1: item.point1 ? Extension.ToThaiNumber(item.point1.toString()) : "",
|
||||||
point1Total: item.point1Total
|
point1Total: item.point1Total
|
||||||
? Extension.ToThaiNumber(item.point1Total.toString())
|
? Extension.ToThaiNumber(item.point1Total.toString())
|
||||||
|
|
@ -1874,33 +1899,41 @@ export class ProfileEmployeeController extends Controller {
|
||||||
const otherIncome =
|
const otherIncome =
|
||||||
otherIncome_raw.length > 0
|
otherIncome_raw.length > 0
|
||||||
? await Promise.all(
|
? await Promise.all(
|
||||||
otherIncome_raw.map(async(item) => {
|
otherIncome_raw.map(async (item) => {
|
||||||
const codeSitAbb = item.posNumCodeSitAbb ?? "-"
|
const codeSitAbb = item.posNumCodeSitAbb ?? "-";
|
||||||
const commandNo = item.commandNo && item.commandYear
|
const commandNo =
|
||||||
? item.commandNo+"/"+(item.commandYear > 2500 ? item.commandYear : item.commandYear + 543)
|
item.commandNo && item.commandYear
|
||||||
: "-"
|
? item.commandNo +
|
||||||
const dateAffect = item.commandDateAffect
|
"/" +
|
||||||
? `${Extension.ToThaiFullDate2(item.commandDateAffect)}`
|
(item.commandYear > 2500 ? item.commandYear : item.commandYear + 543)
|
||||||
: "-"
|
: "-";
|
||||||
return {
|
const dateAffect = item.commandDateAffect
|
||||||
commandName: item.commandName ?? "",
|
? `${Extension.ToThaiFullDate2(item.commandDateAffect)}`
|
||||||
commandDateAffect: item.commandDateAffect
|
: "-";
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
return {
|
||||||
: "",
|
commandName: item.commandName ?? "",
|
||||||
commandDateSign: item.commandDateSign
|
commandDateAffect: item.commandDateAffect
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||||
: "",
|
: "",
|
||||||
commandNo: item.commandNo ? Extension.ToThaiNumber(item.commandNo) : "",
|
commandDateSign: item.commandDateSign
|
||||||
position: item.positionName,
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign))
|
||||||
posLevel: item.positionLevel
|
: "",
|
||||||
? Extension.ToThaiNumber(item.positionLevel)
|
commandNo: item.commandNo ? Extension.ToThaiNumber(item.commandNo) : "",
|
||||||
: item.positionCee
|
position: item.positionName,
|
||||||
? Extension.ToThaiNumber(item.positionCee)
|
posLevel: item.positionLevel
|
||||||
: null,
|
? Extension.ToThaiNumber(item.positionLevel)
|
||||||
amount: item.amount ? Extension.ToThaiNumber(Number(item.amount).toLocaleString()) : "",
|
: item.positionCee
|
||||||
refDoc: Extension.ToThaiNumber(`คำสั่ง ${codeSitAbb} ที่ ${commandNo} ลว. ${dateAffect}`)
|
? Extension.ToThaiNumber(item.positionCee)
|
||||||
}
|
: null,
|
||||||
}))
|
amount: item.amount
|
||||||
|
? Extension.ToThaiNumber(Number(item.amount).toLocaleString())
|
||||||
|
: "",
|
||||||
|
refDoc: Extension.ToThaiNumber(
|
||||||
|
`คำสั่ง ${codeSitAbb} ที่ ${commandNo} ลว. ${dateAffect}`,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
)
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
commandName: "",
|
commandName: "",
|
||||||
|
|
@ -1910,7 +1943,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
position: "",
|
position: "",
|
||||||
posLevel: "",
|
posLevel: "",
|
||||||
amount: "",
|
amount: "",
|
||||||
refDoc: ""
|
refDoc: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -1957,19 +1990,24 @@ export class ProfileEmployeeController extends Controller {
|
||||||
(_child3 == null ? "" : _child3 + " ") +
|
(_child3 == null ? "" : _child3 + " ") +
|
||||||
(_child2 == null ? "" : _child2 + " ") +
|
(_child2 == null ? "" : _child2 + " ") +
|
||||||
(_child1 == null ? "" : _child1 + " ") +
|
(_child1 == null ? "" : _child1 + " ") +
|
||||||
(_root == null ? "" : _root).trim()
|
(_root == null ? "" : _root).trim();
|
||||||
const _position = (profiles?.position != null ?
|
const _position = (
|
||||||
profiles.posType != null && profiles?.posLevel != null
|
profiles?.position != null
|
||||||
? Extension.ToThaiNumber(`${profiles.position} ${profiles.posType.posTypeShortName} ${profiles.posLevel.posLevelName}`)
|
? profiles.posType != null && profiles?.posLevel != null
|
||||||
: profiles.position
|
? Extension.ToThaiNumber(
|
||||||
: "").trim()
|
`${profiles.position} ${profiles.posType.posTypeShortName} ${profiles.posLevel.posLevelName}`,
|
||||||
|
)
|
||||||
|
: profiles.position
|
||||||
|
: ""
|
||||||
|
).trim();
|
||||||
const ocAssistance = await this.profileAssistanceRepository.findOne({
|
const ocAssistance = await this.profileAssistanceRepository.findOne({
|
||||||
select: ["agency", "profileEmployeeId", "commandName", "status", "isDeleted"],
|
select: ["agency", "profileEmployeeId", "commandName", "status", "isDeleted"],
|
||||||
where: {
|
where: {
|
||||||
profileEmployeeId: id,
|
profileEmployeeId: id,
|
||||||
commandName: "ให้ช่วยราชการ",
|
commandName: "ให้ช่วยราชการ",
|
||||||
status: "PENDING",
|
status: "PENDING",
|
||||||
isDeleted: false, },
|
isDeleted: false,
|
||||||
|
},
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -2041,7 +2079,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
ocFullPath: org,
|
ocFullPath: org,
|
||||||
ocAssistance: ocAssistance?.agency ?? org,
|
ocAssistance: ocAssistance?.agency ?? org,
|
||||||
root: _root == null ? "" : _root,
|
root: _root == null ? "" : _root,
|
||||||
agency: (_child4 == null ? "" : _child4 + " ") +
|
agency:
|
||||||
|
(_child4 == null ? "" : _child4 + " ") +
|
||||||
(_child3 == null ? "" : _child3 + " ") +
|
(_child3 == null ? "" : _child3 + " ") +
|
||||||
(_child2 == null ? "" : _child2 + " ") +
|
(_child2 == null ? "" : _child2 + " ") +
|
||||||
(_child1 == null ? "" : _child1).trim(),
|
(_child1 == null ? "" : _child1).trim(),
|
||||||
|
|
@ -2172,7 +2211,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
assessments,
|
assessments,
|
||||||
profileAbility,
|
profileAbility,
|
||||||
otherIncome,
|
otherIncome,
|
||||||
retires
|
retires,
|
||||||
};
|
};
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
|
|
@ -5684,13 +5723,14 @@ export class ProfileEmployeeController extends Controller {
|
||||||
// profile.position = _null;
|
// profile.position = _null;
|
||||||
// profile.posLevelId = _null;
|
// profile.posLevelId = _null;
|
||||||
// profile.posTypeId = _null;
|
// profile.posTypeId = _null;
|
||||||
if (profile.keycloak != null) {
|
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// profile.keycloak = _null;
|
// profile.keycloak = _null;
|
||||||
profile.roleKeycloaks = [];
|
profile.roleKeycloaks = [];
|
||||||
profile.isActive = false;
|
profile.isActive = false;
|
||||||
|
profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
|
|
@ -6162,7 +6202,10 @@ export class ProfileEmployeeController extends Controller {
|
||||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
.where("profile.isActive = :isActive", { isActive: false })
|
.where(body.system ? "profile.isActive = :isActive" : "profile.isDelete = :isDelete", {
|
||||||
|
isActive: false,
|
||||||
|
isDelete: true,
|
||||||
|
})
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });
|
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });
|
||||||
|
|
|
||||||
|
|
@ -3583,13 +3583,14 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
// profile.position = _null;
|
// profile.position = _null;
|
||||||
// profile.posLevelId = _null;
|
// profile.posLevelId = _null;
|
||||||
// profile.posTypeId = _null;
|
// profile.posTypeId = _null;
|
||||||
if (profile.keycloak != null) {
|
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete == false) {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||||
if (delUserKeycloak) {
|
if (delUserKeycloak) {
|
||||||
// Task #228
|
// Task #228
|
||||||
// profile.keycloak = _null;
|
// profile.keycloak = _null;
|
||||||
profile.roleKeycloaks = [];
|
profile.roleKeycloaks = [];
|
||||||
profile.isActive = false;
|
profile.isActive = false;
|
||||||
|
profile.isDelete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ export class KeycloakController extends Controller {
|
||||||
profile.keycloak = userId;
|
profile.keycloak = userId;
|
||||||
}
|
}
|
||||||
profile.email = body.email == null ? _null : body.email;
|
profile.email = body.email == null ? _null : body.email;
|
||||||
|
profile.isDelete = false;
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
|
|
||||||
// Update Keycloak with profile prefix after profile is loaded
|
// Update Keycloak with profile prefix after profile is loaded
|
||||||
|
|
@ -202,6 +203,7 @@ export class KeycloakController extends Controller {
|
||||||
profile.keycloak = userId;
|
profile.keycloak = userId;
|
||||||
}
|
}
|
||||||
profile.email = body.email == null ? _null : body.email;
|
profile.email = body.email == null ? _null : body.email;
|
||||||
|
profile.isDelete = false;
|
||||||
await this.profileEmpRepo.save(profile);
|
await this.profileEmpRepo.save(profile);
|
||||||
// Update Keycloak with profile prefix after profile is loaded
|
// Update Keycloak with profile prefix after profile is loaded
|
||||||
await updateUserAttributes(userId, {
|
await updateUserAttributes(userId, {
|
||||||
|
|
@ -277,6 +279,7 @@ export class KeycloakController extends Controller {
|
||||||
// Task #228
|
// Task #228
|
||||||
// const _null: any = null;
|
// const _null: any = null;
|
||||||
// profileEmp.keycloak = _null;
|
// profileEmp.keycloak = _null;
|
||||||
|
profileEmp.isDelete = true;
|
||||||
profileEmp.roleKeycloaks = [];
|
profileEmp.roleKeycloaks = [];
|
||||||
await this.profileEmpRepo.save(profileEmp);
|
await this.profileEmpRepo.save(profileEmp);
|
||||||
}
|
}
|
||||||
|
|
@ -284,6 +287,7 @@ export class KeycloakController extends Controller {
|
||||||
// Task #228
|
// Task #228
|
||||||
// const _null: any = null;
|
// const _null: any = null;
|
||||||
// profile.keycloak = _null;
|
// profile.keycloak = _null;
|
||||||
|
profile.isDelete = true;
|
||||||
profile.roleKeycloaks = [];
|
profile.roleKeycloaks = [];
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
|
|
@ -569,7 +573,7 @@ export class KeycloakController extends Controller {
|
||||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
// .where("profile.keycloak IS NOT NULL AND profile.keycloak != ''")
|
// .where("profile.keycloak IS NOT NULL AND profile.keycloak != ''")
|
||||||
.where("profile.isActive = :isActive", { isActive: true })
|
.where("profile.isDelete = :isDelete", { isDelete: false })
|
||||||
.andWhere(checkChildFromRole)
|
.andWhere(checkChildFromRole)
|
||||||
.andWhere(conditions)
|
.andWhere(conditions)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
|
|
@ -613,7 +617,7 @@ export class KeycloakController extends Controller {
|
||||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
// .where("profileEmployee.keycloak IS NOT NULL AND profileEmployee.keycloak != ''")
|
// .where("profileEmployee.keycloak IS NOT NULL AND profileEmployee.keycloak != ''")
|
||||||
.where("profileEmployee.isActive = :isActive", { isActive: true })
|
.where("profileEmployee.isDelete = :isDelete", { isDelete: false })
|
||||||
.andWhere(checkChildFromRole)
|
.andWhere(checkChildFromRole)
|
||||||
.andWhere(conditions)
|
.andWhere(conditions)
|
||||||
.andWhere({ employeeClass: "PERM" })
|
.andWhere({ employeeClass: "PERM" })
|
||||||
|
|
@ -758,6 +762,7 @@ export class KeycloakController extends Controller {
|
||||||
profile.keycloak = userId;
|
profile.keycloak = userId;
|
||||||
}
|
}
|
||||||
profile.email = body.email == null ? _null : body.email;
|
profile.email = body.email == null ? _null : body.email;
|
||||||
|
profile.isDelete = false;
|
||||||
await this.profileEmpRepo.save(profile);
|
await this.profileEmpRepo.save(profile);
|
||||||
// Update Keycloak with profile prefix after profile is loaded
|
// Update Keycloak with profile prefix after profile is loaded
|
||||||
await updateUserAttributes(userId, {
|
await updateUserAttributes(userId, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue