feat: enhance approval logic to include role checks and improve decision flow
This commit is contained in:
parent
6ca09a9cf1
commit
f1df9b4b08
|
|
@ -41,7 +41,6 @@ export const showApprovel = (
|
||||||
};
|
};
|
||||||
const isBudget = data?.mp_planning_header_id ? true : false;
|
const isBudget = data?.mp_planning_header_id ? true : false;
|
||||||
const isField = data?.organization_category === "Non Field" ? false : true;
|
const isField = data?.organization_category === "Non Field" ? false : true;
|
||||||
console.log(data?.status);
|
|
||||||
if (data?.status === "NEED APPROVAL") {
|
if (data?.status === "NEED APPROVAL") {
|
||||||
if (data?.department_head && !data?.vp_gm_director) {
|
if (data?.department_head && !data?.vp_gm_director) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -86,7 +85,18 @@ export const showApprovel = (
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} else if (data?.status === "APPROVED") {
|
} 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) {
|
if (data?.department_head && !data?.vp_gm_director) {
|
||||||
return {
|
return {
|
||||||
approve:
|
approve:
|
||||||
|
|
@ -104,5 +114,6 @@ export const showApprovel = (
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue