Merge branch 'develop'
This commit is contained in:
commit
6ed9e5ab1f
2 changed files with 76 additions and 30 deletions
|
|
@ -1780,8 +1780,7 @@ export class CommandController extends Controller {
|
||||||
},
|
},
|
||||||
select: ["orgRootId"],
|
select: ["orgRootId"],
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
posMaster = await this.posMasterRepository.find({
|
posMaster = await this.posMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
current_holderId: In(requestBody.persons.map((x) => x.profileId)),
|
current_holderId: In(requestBody.persons.map((x) => x.profileId)),
|
||||||
|
|
@ -1795,7 +1794,7 @@ export class CommandController extends Controller {
|
||||||
if (["C-PM-38", "C-PM-40"].includes(commandCode)) {
|
if (["C-PM-38", "C-PM-40"].includes(commandCode)) {
|
||||||
_posMaster = await this.posMasterRepository.find({
|
_posMaster = await this.posMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: In(posMaster.map((x:any) => x.orgRootId)),
|
orgRootId: In(posMaster.map((x: any) => x.orgRootId)),
|
||||||
orgChild1: IsNull(),
|
orgChild1: IsNull(),
|
||||||
orgChild2: IsNull(),
|
orgChild2: IsNull(),
|
||||||
orgChild3: IsNull(),
|
orgChild3: IsNull(),
|
||||||
|
|
@ -1809,7 +1808,7 @@ export class CommandController extends Controller {
|
||||||
} else {
|
} else {
|
||||||
_posMaster = await this.posMasterRepository.find({
|
_posMaster = await this.posMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: In(posMaster.map((x:any) => x.orgRootId)),
|
orgRootId: In(posMaster.map((x: any) => x.orgRootId)),
|
||||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||||
isDirector: true,
|
isDirector: true,
|
||||||
current_holderId: Not(IsNull()),
|
current_holderId: Not(IsNull()),
|
||||||
|
|
@ -4166,28 +4165,28 @@ export class CommandController extends Controller {
|
||||||
history.profileSalaryId = data.id;
|
history.profileSalaryId = data.id;
|
||||||
await this.salaryHistoryRepo.save(history, { data: req });
|
await this.salaryHistoryRepo.save(history, { data: req });
|
||||||
|
|
||||||
if (profile != null) {
|
// if (profile != null) {
|
||||||
profile.position = position?.positionName ?? "";
|
// profile.position = position?.positionName ?? "";
|
||||||
profile.posTypeId = position?.posTypeId ?? "";
|
// profile.posTypeId = position?.posTypeId ?? "";
|
||||||
profile.posLevelId = position?.posLevelId ?? "";
|
// profile.posLevelId = position?.posLevelId ?? "";
|
||||||
profile.lastUpdateUserId = req.user.sub;
|
// profile.lastUpdateUserId = req.user.sub;
|
||||||
profile.lastUpdateFullName = req.user.name;
|
// profile.lastUpdateFullName = req.user.name;
|
||||||
profile.lastUpdatedAt = new Date();
|
// profile.lastUpdatedAt = new Date();
|
||||||
await this.profileRepository.save(profile);
|
// await this.profileRepository.save(profile);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const posMasters = await this.posMasterRepository.find({
|
// const posMasters = await this.posMasterRepository.find({
|
||||||
where: { id: In(body.refIds.map((x) => x.refId)) },
|
// where: { id: In(body.refIds.map((x) => x.refId)) },
|
||||||
});
|
// });
|
||||||
const data = posMasters.map((_data) => ({
|
// const data = posMasters.map((_data) => ({
|
||||||
..._data,
|
// ..._data,
|
||||||
current_holderId: _data.next_holderId,
|
// current_holderId: _data.next_holderId,
|
||||||
next_holderId: null,
|
// next_holderId: null,
|
||||||
statusReport: "PENDING",
|
// statusReport: "PENDING",
|
||||||
}));
|
// }));
|
||||||
await this.posMasterRepository.save(data);
|
// await this.posMasterRepository.save(data);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -222,10 +222,44 @@ export class ProfileController extends Controller {
|
||||||
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
|
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
|
||||||
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
|
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
|
||||||
|
|
||||||
|
const salary_raw = await this.salaryRepository.find({
|
||||||
|
select: [
|
||||||
|
"date",
|
||||||
|
"position",
|
||||||
|
"posNo",
|
||||||
|
"positionType",
|
||||||
|
"positionLevel",
|
||||||
|
"positionSalaryAmount",
|
||||||
|
"refCommandNo",
|
||||||
|
"amount",
|
||||||
|
"templateDoc",
|
||||||
|
],
|
||||||
|
where: { profileId: id },
|
||||||
|
order: { date: "ASC" },
|
||||||
|
});
|
||||||
|
|
||||||
|
const salarys =
|
||||||
|
salary_raw.length > 1
|
||||||
|
? salary_raw.slice(1).map((item) => ({
|
||||||
|
date: item.date
|
||||||
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date))
|
||||||
|
: null,
|
||||||
|
positionLine: item.positionLine != null ? item.positionLine : "-",
|
||||||
|
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
||||||
|
}))
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
date: "-",
|
||||||
|
positionLine: "-",
|
||||||
|
posNo: "-",
|
||||||
|
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const educations = await this.educationRepository.find({
|
const educations = await this.educationRepository.find({
|
||||||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
order: { lastUpdatedAt: "DESC" },
|
order: { startDate: "ASC" },
|
||||||
});
|
});
|
||||||
const Education =
|
const Education =
|
||||||
educations && educations.length > 0
|
educations && educations.length > 0
|
||||||
|
|
@ -265,19 +299,32 @@ export class ProfileController extends Controller {
|
||||||
registrationAddress: Extension.ToThaiNumber(
|
registrationAddress: Extension.ToThaiNumber(
|
||||||
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||||
),
|
),
|
||||||
salaryDate:
|
date:
|
||||||
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
|
salary_raw.length > 0 && salary_raw[0].date != null
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date),
|
Extension.ToThaiShortDate(salary_raw[0].date),
|
||||||
)
|
)
|
||||||
: "-",
|
: "-",
|
||||||
positionName: profile.position != null ? profile.position : "-",
|
positionName: profile.position != null ? profile.position : "-",
|
||||||
appointText:
|
appointText:
|
||||||
profile.dateAppoint != null
|
profile.dateAppoint != null
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profile.dateAppoint))
|
||||||
|
: "-",
|
||||||
|
posNo:
|
||||||
|
salary_raw.length > 0 && salary_raw[0].posNo != null
|
||||||
|
? Extension.ToThaiNumber(
|
||||||
|
Extension.ToThaiNumber(salary_raw[0].posNo),
|
||||||
|
)
|
||||||
|
: "-",
|
||||||
|
positionLine:
|
||||||
|
salary_raw.length > 0 && salary_raw[0].positionLine != null
|
||||||
|
? Extension.ToThaiNumber(
|
||||||
|
Extension.ToThaiNumber(salary_raw[0].positionLine),
|
||||||
|
)
|
||||||
: "-",
|
: "-",
|
||||||
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
educations: Education,
|
educations: Education,
|
||||||
|
salarys: salarys,
|
||||||
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
|
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -561,7 +608,7 @@ export class ProfileController extends Controller {
|
||||||
const salarys =
|
const salarys =
|
||||||
salary_raw.length > 0
|
salary_raw.length > 0
|
||||||
? salary_raw.map((item) => ({
|
? salary_raw.map((item) => ({
|
||||||
salaryDate: item.date
|
salaryDate: item.date
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.date))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.date))
|
||||||
: null,
|
: null,
|
||||||
position: item.position != null ? Extension.ToThaiNumber(item.position) : null,
|
position: item.position != null ? Extension.ToThaiNumber(item.position) : null,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue