diff --git a/src/components/pages/purchase/PurchaseTable.tsx b/src/components/pages/purchase/PurchaseTable.tsx index 81f45cc9..9af19b42 100644 --- a/src/components/pages/purchase/PurchaseTable.tsx +++ b/src/components/pages/purchase/PurchaseTable.tsx @@ -16,6 +16,7 @@ import RowDropdownOptions from '@/components/table/RowDropdownOptions'; import RowCollapseOptions from '@/components/table/RowCollapseOptions'; import RowOptionsMenuWrapper from '@/components/table/RowOptionsMenuWrapper'; import RequirePermission from '@/components/helper/RequirePermission'; +import Badge from '@/components/Badge'; import { cn, formatDate } from '@/lib/helper'; import { isResponseSuccess } from '@/lib/api-helper'; @@ -153,6 +154,57 @@ const PurchaseTable = () => { return `${diffDays} hari`; }, }, + { + header: 'Status Approval', + cell: (props) => { + const approval = props.row.original.latest_approval; + if (!approval) return '-'; + + const isRejected = approval.action === 'REJECTED'; + + let statusColor: + | 'warning' + | 'success' + | 'neutral' + | 'error' + | 'primary' + | 'info' = 'neutral'; + + switch (approval.step_number) { + case 1: + statusColor = 'neutral'; + break; + case 2: + statusColor = 'primary'; + break; + case 3: + statusColor = 'info'; + break; + case 4: + statusColor = 'warning'; + break; + case 5: + statusColor = 'success'; + break; + } + + if (isRejected) { + statusColor = 'error'; + } + + return ( + + {isRejected ? 'Ditolak' : approval.step_name} + + ); + }, + }, { header: 'Aksi', cell: (props) => {