This commit is contained in:
AdisakKanthawilang 2025-05-08 09:21:35 +07:00
parent ea7040f462
commit 465d21eb13
2 changed files with 16 additions and 18 deletions

View file

@ -5628,7 +5628,7 @@ export class ProfileEmployeeController extends Controller {
orgChild3: orgChild3Ref?.orgChild3Name,
orgChild4: orgChild4Ref?.orgChild4Name,
commandYear: new Date().getFullYear() + 543,
commandDateSign: new Date(),
// commandDateSign: new Date(),
commandDateAffect: new Date(),
commandCode: "16",
commandName: "พ้นจากราชการ",
@ -5641,6 +5641,7 @@ export class ProfileEmployeeController extends Controller {
lastUpdateFullName: request.user.name,
createdAt: new Date(),
lastUpdatedAt: new Date(),
remark: "ถึงแก่กรรม",
};
delete data.id;
@ -5655,12 +5656,9 @@ export class ProfileEmployeeController extends Controller {
profile.isLeave = requestBody.isLeave;
profile.leaveReason = requestBody.leaveReason;
profile.dateLeave = requestBody.dateLeave;
if (requestBody.isLeave == true) {
await removeProfileInOrganize(profile.id, "EMPLOYEE");
}
profile.position = _null;
profile.posLevelId = _null;
profile.posTypeId = _null;
// profile.position = _null;
// profile.posLevelId = _null;
// profile.posTypeId = _null;
if (profile.keycloak != null) {
const delUserKeycloak = await deleteUser(profile.keycloak);
if (delUserKeycloak) {
@ -5669,10 +5667,11 @@ export class ProfileEmployeeController extends Controller {
profile.isActive = false;
}
}
profile.leaveType = "RETIRE_DECEASED";
await this.profileRepo.save(profile);
if (requestBody.isLeave == true) {
await removeProfileInOrganize(profile.id, "EMPLOYEE");
}
return new HttpSuccess();
}

View file

@ -3317,7 +3317,7 @@ export class ProfileEmployeeTempController extends Controller {
orgChild3: orgChild3Ref?.orgChild3Name,
orgChild4: orgChild4Ref?.orgChild4Name,
commandYear: new Date().getFullYear() + 543,
commandDateSign: new Date(),
// commandDateSign: new Date(),
commandDateAffect: new Date(),
commandCode: "16",
commandName: "พ้นจากราชการ",
@ -3330,6 +3330,7 @@ export class ProfileEmployeeTempController extends Controller {
lastUpdateFullName: request.user.name,
createdAt: new Date(),
lastUpdatedAt: new Date(),
remark: "ถึงแก่กรรม",
};
delete data.id;
@ -3344,14 +3345,10 @@ export class ProfileEmployeeTempController extends Controller {
profile.isLeave = requestBody.isLeave;
profile.leaveReason = requestBody.leaveReason;
profile.dateLeave = requestBody.dateLeave;
if (requestBody.isLeave == true) {
await removeProfileInOrganize(profile.id, "EMPLOYEE");
}
profile.leaveType = "RETIRE_DECEASED";
profile.position = _null;
profile.posLevelId = _null;
profile.posTypeId = _null;
// profile.position = _null;
// profile.posLevelId = _null;
// profile.posTypeId = _null;
if (profile.keycloak != null) {
const delUserKeycloak = await deleteUser(profile.keycloak);
if (delUserKeycloak) {
@ -3361,7 +3358,9 @@ export class ProfileEmployeeTempController extends Controller {
}
}
await this.profileRepo.save(profile);
if (requestBody.isLeave == true) {
await removeProfileInOrganize(profile.id, "EMPLOYEE");
}
return new HttpSuccess();
}