mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
fix(FE): fix chickins approvals status
This commit is contained in:
@@ -34,7 +34,7 @@ const ChickinFormKandang = ({
|
||||
isLoading: approvalsLoading,
|
||||
refresh: refreshApprovals,
|
||||
} = useApprovalSteps({
|
||||
latestApproval: initialValues?.approval,
|
||||
latestApproval: initialValues?.chickin_approval,
|
||||
approvalLines: CHICKINS_APPROVAL_LINE,
|
||||
moduleName: 'CHICKINS',
|
||||
moduleId: initialValues?.id.toString() ?? '',
|
||||
|
||||
@@ -60,8 +60,9 @@ const ChickinLogsView = ({
|
||||
</div>
|
||||
) : (
|
||||
(initialValues?.chickins || []).map((chickin, index) => {
|
||||
const isApproved = chickin.usage_qty !== 0;
|
||||
const isPending = chickin.pending_usage_qty !== 0;
|
||||
const isApproved =
|
||||
initialValues.chickin_approval?.step_number === 2;
|
||||
const isPending = initialValues.chickin_approval?.step_number === 1;
|
||||
const quantity = isApproved
|
||||
? chickin.usage_qty
|
||||
: isPending
|
||||
@@ -146,18 +147,19 @@ const ChickinLogsView = ({
|
||||
})
|
||||
)}
|
||||
|
||||
{initialValues?.approval?.step_number <= 2 && (
|
||||
<RequirePermission permissions='lti.production.chickins.approve'>
|
||||
<Button
|
||||
color='success'
|
||||
onClick={handleClickApprove}
|
||||
className='w-full'
|
||||
>
|
||||
<Icon width={24} height={24} icon='material-symbols:check' />
|
||||
Approve Semua Chick In
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
)}
|
||||
{initialValues.chickin_approval &&
|
||||
initialValues?.chickin_approval?.step_number < 2 && (
|
||||
<RequirePermission permissions='lti.production.chickins.approve'>
|
||||
<Button
|
||||
color='success'
|
||||
onClick={handleClickApprove}
|
||||
className='w-full'
|
||||
>
|
||||
<Icon width={24} height={24} icon='material-symbols:check' />
|
||||
Approve Semua Chick In
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
)}
|
||||
|
||||
{chickinErrorMessage && (
|
||||
<div className='w-full' onClick={() => setChickinErrorMessage('')}>
|
||||
|
||||
Reference in New Issue
Block a user