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