ให้ออกจากราชการ
This commit is contained in:
parent
3edc66081f
commit
f4180cbfdf
1 changed files with 60 additions and 39 deletions
|
|
@ -88,18 +88,18 @@ export async function calculateGovAge(profileId: string, type: string) {
|
||||||
|
|
||||||
return { years, months, days };
|
return { years, months, days };
|
||||||
};
|
};
|
||||||
let profile:any;
|
let profile: any;
|
||||||
profile = await AppDataSource.getRepository(Profile).findOne({
|
profile = await AppDataSource.getRepository(Profile).findOne({
|
||||||
where:{
|
where: {
|
||||||
id:profileId
|
id: profileId,
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
if(isEmployee){
|
if (isEmployee) {
|
||||||
profile = await AppDataSource.getRepository(ProfileEmployee).findOne({
|
profile = await AppDataSource.getRepository(ProfileEmployee).findOne({
|
||||||
where:{
|
where: {
|
||||||
id:profileId
|
id: profileId,
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
// const firstStartDate = new Date(records[0].date);
|
// const firstStartDate = new Date(records[0].date);
|
||||||
const firstStartDate = profile?.dateAppoint ? profile?.dateAppoint : new Date();
|
const firstStartDate = profile?.dateAppoint ? profile?.dateAppoint : new Date();
|
||||||
|
|
@ -334,7 +334,7 @@ export async function checkReturnCommandType(commandId: string) {
|
||||||
|
|
||||||
export async function checkExceptCommandType(commandId: string) {
|
export async function checkExceptCommandType(commandId: string) {
|
||||||
const commandRepository = AppDataSource.getRepository(Command);
|
const commandRepository = AppDataSource.getRepository(Command);
|
||||||
const commandReciveRepository = AppDataSource.getRepository(CommandRecive)
|
const commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
||||||
const _type = await commandRepository.findOne({
|
const _type = await commandRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: commandId,
|
id: commandId,
|
||||||
|
|
@ -342,32 +342,36 @@ export async function checkExceptCommandType(commandId: string) {
|
||||||
relations: ["commandType"],
|
relations: ["commandType"],
|
||||||
});
|
});
|
||||||
if (!["C-PM-25", "C-PM-26"].includes(String(_type?.commandType.code))) {
|
if (!["C-PM-25", "C-PM-26"].includes(String(_type?.commandType.code))) {
|
||||||
return { status: false, LeaveType: null, leaveRemark: null};
|
return { status: false, LeaveType: null, leaveRemark: null };
|
||||||
}
|
}
|
||||||
const _commandRecive = await commandReciveRepository.findOne({
|
const _commandRecive = await commandReciveRepository.findOne({
|
||||||
where: { commandId: commandId }
|
where: { commandId: commandId },
|
||||||
});
|
});
|
||||||
|
|
||||||
let _leaveType: string =""
|
let _leaveType: string = "";
|
||||||
switch(String(_type?.commandType.code)){
|
switch (String(_type?.commandType.code)) {
|
||||||
case "C-PM-25" : {
|
case "C-PM-25": {
|
||||||
_leaveType = "DISCIPLINE_SUSPEND"; //คำสั่งพักจากราชการ
|
_leaveType = "DISCIPLINE_SUSPEND"; //คำสั่งพักจากราชการ
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "C-PM-26" : {
|
case "C-PM-26": {
|
||||||
_leaveType = "DISCIPLINE_SUSPEND"; //คำสั่งให้ออกจากราชการไว้ก่อน
|
_leaveType = "DISCIPLINE_SUSPEND"; //คำสั่งให้ออกจากราชการไว้ก่อน
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
_leaveType = ""
|
_leaveType = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { status: true, LeaveType: _leaveType, leaveRemark: _commandRecive ? _commandRecive.remarkVertical : null };
|
return {
|
||||||
|
status: true,
|
||||||
|
LeaveType: _leaveType,
|
||||||
|
leaveRemark: _commandRecive ? _commandRecive.remarkVertical : null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkCommandType(commandId: string) {
|
export async function checkCommandType(commandId: string) {
|
||||||
const commandRepository = AppDataSource.getRepository(Command);
|
const commandRepository = AppDataSource.getRepository(Command);
|
||||||
const commandReciveRepository = AppDataSource.getRepository(CommandRecive)
|
const commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
||||||
const _type = await commandRepository.findOne({
|
const _type = await commandRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: commandId,
|
id: commandId,
|
||||||
|
|
@ -376,53 +380,68 @@ export async function checkCommandType(commandId: string) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!["C-PM-12", "C-PM-13", "C-PM-17", "C-PM-18", "C-PM-23", "C-PM-19", "C-PM-20"].includes(
|
![
|
||||||
String(_type?.commandType.code),
|
"C-PM-12",
|
||||||
)
|
"C-PM-13",
|
||||||
|
"C-PM-17",
|
||||||
|
"C-PM-18",
|
||||||
|
"C-PM-23",
|
||||||
|
"C-PM-19",
|
||||||
|
"C-PM-20",
|
||||||
|
"C-PM-43",
|
||||||
|
].includes(String(_type?.commandType.code))
|
||||||
) {
|
) {
|
||||||
// return false;
|
// return false;
|
||||||
return { status: false, LeaveType: null, leaveRemark: null};
|
return { status: false, LeaveType: null, leaveRemark: null };
|
||||||
}
|
}
|
||||||
// return true;
|
// return true;
|
||||||
const _commandRecive = await commandReciveRepository.findOne({
|
const _commandRecive = await commandReciveRepository.findOne({
|
||||||
where: { commandId: commandId }
|
where: { commandId: commandId },
|
||||||
});
|
});
|
||||||
|
|
||||||
let _leaveType: string =""
|
let _leaveType: string = "";
|
||||||
switch(String(_type?.commandType.code)){
|
switch (String(_type?.commandType.code)) {
|
||||||
case "C-PM-12" : {
|
case "C-PM-12": {
|
||||||
_leaveType = "PROBATION_REPORT";
|
_leaveType = "PROBATION_REPORT";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "C-PM-13" : {
|
case "C-PM-13": {
|
||||||
_leaveType = "PLACEMENT_TRANSFER";
|
_leaveType = "PLACEMENT_TRANSFER";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "C-PM-17" : {
|
case "C-PM-17": {
|
||||||
_leaveType = "RETIRE_RESIGN";
|
_leaveType = "RETIRE_RESIGN";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "C-PM-18" : {
|
case "C-PM-18": {
|
||||||
_leaveType = "RETIRE_OUT";
|
_leaveType = "RETIRE_OUT";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "C-PM-19" : {
|
case "C-PM-19": {
|
||||||
_leaveType = "DISCIPLINE_RESULT_REMOVE";
|
_leaveType = "DISCIPLINE_RESULT_REMOVE";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "C-PM-20" : {
|
case "C-PM-20": {
|
||||||
_leaveType = "DISCIPLINE_RESULT_DISMISS";
|
_leaveType = "DISCIPLINE_RESULT_DISMISS";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "C-PM-23" : {
|
case "C-PM-23": {
|
||||||
_leaveType = "RETIRE_RESIGN_EMP";
|
_leaveType = "RETIRE_RESIGN_EMP";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "C-PM-43": {
|
||||||
|
_leaveType = "RETIRE_OUT_EMP";
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
_leaveType = ""
|
_leaveType = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { status: true, LeaveType: _leaveType, leaveRemark: _commandRecive ? _commandRecive.remarkVertical : null };
|
return {
|
||||||
|
status: true,
|
||||||
|
LeaveType: _leaveType,
|
||||||
|
leaveRemark: _commandRecive ? _commandRecive.remarkVertical : null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//logs
|
//logs
|
||||||
|
|
@ -548,6 +567,8 @@ export function commandTypePath(commandCode: string): string | null {
|
||||||
return "/retirement/resign/leave-cancel/report";
|
return "/retirement/resign/leave-cancel/report";
|
||||||
case "C-PM-42":
|
case "C-PM-42":
|
||||||
return "/retirement/resign-employee/leave-cancel/report";
|
return "/retirement/resign-employee/leave-cancel/report";
|
||||||
|
case "C-PM-43":
|
||||||
|
return "/retirement/out/command/report";
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue