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,22 +85,34 @@ export const showApprovel = (
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} else if (data?.status === "APPROVED") {
|
} else if (data?.status === "APPROVED") {
|
||||||
console.log(data?.status);
|
if (role?.head) {
|
||||||
if (data?.department_head && !data?.vp_gm_director) {
|
return null;
|
||||||
return {
|
}
|
||||||
approve:
|
console.log({ role });
|
||||||
action === "reject"
|
if (isBudget) {
|
||||||
? "REJECTED"
|
if (!data?.hrd_ho_unit_name) {
|
||||||
: isField
|
return {
|
||||||
? "APPROVED"
|
approve: action === "reject" ? "REJECTED" : "COMPLETED",
|
||||||
: "NEED APPROVAL",
|
level: "Level HRD HO",
|
||||||
level: "Level VP",
|
};
|
||||||
};
|
}
|
||||||
} else if (!data?.hrd_ho_unit) {
|
} else {
|
||||||
return {
|
if (data?.department_head && !data?.vp_gm_director) {
|
||||||
approve: action === "reject" ? "REJECTED" : "COMPLETED",
|
return {
|
||||||
level: "Level HRD HO",
|
approve:
|
||||||
};
|
action === "reject"
|
||||||
|
? "REJECTED"
|
||||||
|
: isField
|
||||||
|
? "APPROVED"
|
||||||
|
: "NEED APPROVAL",
|
||||||
|
level: "Level VP",
|
||||||
|
};
|
||||||
|
} else if (!data?.hrd_ho_unit) {
|
||||||
|
return {
|
||||||
|
approve: action === "reject" ? "REJECTED" : "COMPLETED",
|
||||||
|
level: "Level HRD HO",
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue