รายการออกคำสั่ง owner เห็นหมด #1551 & Fix Bug ลูกจ้างประจำสมัครสอบเป็น ขรก. #2343
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m38s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m38s
This commit is contained in:
parent
2951630b7b
commit
c7c2f3a6c2
1 changed files with 18 additions and 13 deletions
|
|
@ -187,17 +187,27 @@ export class CommandController extends Controller {
|
|||
(x) =>
|
||||
x.orgRevision?.orgRevisionIsCurrent == true && x.orgRevision?.orgRevisionIsDraft == false,
|
||||
)[0]?.isDirector || false;
|
||||
if (isDirector) {
|
||||
let _data: any = {
|
||||
let _data: any = {
|
||||
root: null,
|
||||
child1: null,
|
||||
child2: null,
|
||||
child3: null,
|
||||
child4: null,
|
||||
};
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
_data = await new permission().PermissionOrgList(request, "COMMAND");
|
||||
}
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
_data = await new permission().PermissionOrgList(request, "COMMAND");
|
||||
}
|
||||
if (isDirector || _data.privilege == "OWNER") {
|
||||
// let _data: any = {
|
||||
// root: null,
|
||||
// child1: null,
|
||||
// child2: null,
|
||||
// child3: null,
|
||||
// child4: null,
|
||||
// };
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// _data = await new permission().PermissionOrgList(request, "COMMAND");
|
||||
// }
|
||||
const profiles = await this.profileRepository
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
|
|
@ -6208,7 +6218,6 @@ export class CommandController extends Controller {
|
|||
});
|
||||
const list = await getRoles();
|
||||
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
|
||||
const _null: any = null;
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
|
|
@ -6362,6 +6371,7 @@ export class CommandController extends Controller {
|
|||
relations: ["roleKeycloaks", "profileInsignias", "profileAvatars"],
|
||||
});
|
||||
let _oldInsigniaIds: string[] = [];
|
||||
//ลูกจ้างประจำ หรือ บุคคลภายนอก
|
||||
if (!profile) {
|
||||
//กรณีลูกจ้างประจำมาสอบเป็นข้าราชการ ต้อง update สถานะโปรไฟล์เดิม
|
||||
let profileEmployee: any = await this.profileEmployeeRepository.findOne({
|
||||
|
|
@ -6393,7 +6403,7 @@ export class CommandController extends Controller {
|
|||
await this.salaryHistoryRepo.save(history, { data: req });
|
||||
|
||||
if (profileEmployee.profileInsignias.length > 0) {
|
||||
_oldInsigniaIds = profileEmployee.profileInsignias.filter().map((x: any) => x.id);
|
||||
_oldInsigniaIds = profileEmployee.profileInsignias?.map((x: any) => x.id) ?? [];
|
||||
}
|
||||
await removeProfileInOrganize(profileEmployee.id, "EMPLOYEE");
|
||||
if (profileEmployee.keycloak != null) {
|
||||
|
|
@ -6469,7 +6479,7 @@ export class CommandController extends Controller {
|
|||
["PLACEMENT_TRANSFER", "RETIRE_RESIGN"].includes(profile.leaveType)
|
||||
) {
|
||||
if (profile.profileInsignias.length > 0) {
|
||||
_oldInsigniaIds = profile.profileInsignias.map((x: any) => x.id);
|
||||
_oldInsigniaIds = profile.profileInsignias?.map((x: any) => x.id) ?? [];
|
||||
}
|
||||
profile = Object.assign({ ...item.bodyProfile, ...meta });
|
||||
profile.dateRetire = _dateRetire;
|
||||
|
|
@ -6627,7 +6637,6 @@ export class CommandController extends Controller {
|
|||
}),
|
||||
);
|
||||
}
|
||||
|
||||
//Certificates
|
||||
if (item.bodyCertificates && item.bodyCertificates.length > 0) {
|
||||
await Promise.all(
|
||||
|
|
@ -6644,7 +6653,6 @@ export class CommandController extends Controller {
|
|||
}),
|
||||
);
|
||||
}
|
||||
|
||||
//FamilyCouple
|
||||
if (item.bodyMarry != null) {
|
||||
const profileCouple = new ProfileFamilyCouple();
|
||||
|
|
@ -6666,7 +6674,6 @@ export class CommandController extends Controller {
|
|||
coupleHistory.profileFamilyCoupleId = profileCouple.id;
|
||||
await this.profileFamilyCoupleHistoryRepo.save(coupleHistory, { data: req });
|
||||
}
|
||||
|
||||
//FamilyFather
|
||||
if (item.bodyFather != null) {
|
||||
const profileFather = new ProfileFamilyFather();
|
||||
|
|
@ -6687,7 +6694,6 @@ export class CommandController extends Controller {
|
|||
fatherHistory.profileFamilyFatherId = profileFather.id;
|
||||
await this.profileFamilyFatherHistoryRepo.save(fatherHistory, { data: req });
|
||||
}
|
||||
|
||||
//FamilyMother
|
||||
if (item.bodyMother != null) {
|
||||
const profileMother = new ProfileFamilyMother();
|
||||
|
|
@ -6708,7 +6714,6 @@ export class CommandController extends Controller {
|
|||
motherHistory.profileFamilyMotherId = profileMother.id;
|
||||
await this.profileFamilyMotherHistoryRepo.save(motherHistory, { data: req });
|
||||
}
|
||||
|
||||
//Salary
|
||||
if (item.bodySalarys && item.bodySalarys != null) {
|
||||
const dest_item = await this.salaryRepo.findOne({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue