feat: enhance approval logic to include role checks and improve decision flow

This commit is contained in:
faisolavolut 2025-02-25 12:04:22 +07:00
parent 6ca09a9cf1
commit f1df9b4b08
1 changed files with 28 additions and 17 deletions

View File

@ -41,7 +41,6 @@ export const showApprovel = (
};
const isBudget = data?.mp_planning_header_id ? true : false;
const isField = data?.organization_category === "Non Field" ? false : true;
console.log(data?.status);
if (data?.status === "NEED APPROVAL") {
if (data?.department_head && !data?.vp_gm_director) {
return {
@ -86,7 +85,18 @@ export const showApprovel = (
}
return null;
} else if (data?.status === "APPROVED") {
console.log(data?.status);
if (role?.head) {
return null;
}
console.log({ role });
if (isBudget) {
if (!data?.hrd_ho_unit_name) {
return {
approve: action === "reject" ? "REJECTED" : "COMPLETED",
level: "Level HRD HO",
};
}
} else {
if (data?.department_head && !data?.vp_gm_director) {
return {
approve:
@ -104,5 +114,6 @@ export const showApprovel = (
};
}
}
}
return null;
};