mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
feat(FE-195,196): create RealizationStatusBadge component
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
import PillBadge from '@/components/PillBadge';
|
||||||
|
|
||||||
|
import { BaseApproval } from '@/types/api/api-general';
|
||||||
|
|
||||||
|
interface RealizationStatusBadgeProps {
|
||||||
|
approval?: BaseApproval;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RealizationStatusBadge = ({ approval }: RealizationStatusBadgeProps) => {
|
||||||
|
const isLatestApprovalRejected = approval?.action === 'REJECTED';
|
||||||
|
|
||||||
|
const isExpenseRealized = approval?.step_number && approval.step_number >= 4;
|
||||||
|
|
||||||
|
const realizationStatus = isExpenseRealized
|
||||||
|
? 'Sudah Realisasi'
|
||||||
|
: 'Belum Realisasi';
|
||||||
|
|
||||||
|
let realizationStatusPillBadgeColor:
|
||||||
|
| 'yellow'
|
||||||
|
| 'green'
|
||||||
|
| 'gray'
|
||||||
|
| 'red'
|
||||||
|
| 'purple'
|
||||||
|
| 'blue' = isExpenseRealized ? 'green' : 'yellow';
|
||||||
|
|
||||||
|
if (isLatestApprovalRejected) {
|
||||||
|
realizationStatusPillBadgeColor = 'red';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PillBadge
|
||||||
|
content={isLatestApprovalRejected ? 'Ditolak' : realizationStatus}
|
||||||
|
color={realizationStatusPillBadgeColor}
|
||||||
|
className='text-xs'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RealizationStatusBadge;
|
||||||
Reference in New Issue
Block a user