mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
39 lines
1004 B
TypeScript
39 lines
1004 B
TypeScript
import StatusBadge from '@/components/helper/StatusBadge';
|
|
|
|
import { BaseApproval } from '@/types/api/api-general';
|
|
import { Color } from '@/types/theme';
|
|
|
|
interface RealizationStatusBadgeProps {
|
|
approval?: BaseApproval;
|
|
}
|
|
|
|
const RealizationStatusBadge = ({ approval }: RealizationStatusBadgeProps) => {
|
|
const isLatestApprovalRejected = approval?.action === 'REJECTED';
|
|
|
|
const isExpenseRealized = approval?.step_number && approval.step_number >= 5;
|
|
|
|
const realizationStatus = isExpenseRealized
|
|
? 'Sudah Realisasi'
|
|
: 'Belum Realisasi';
|
|
|
|
let realizationStatusBadgeColor: Color = isExpenseRealized
|
|
? 'success'
|
|
: 'warning';
|
|
|
|
if (isLatestApprovalRejected) {
|
|
realizationStatusBadgeColor = 'error';
|
|
}
|
|
|
|
return (
|
|
<StatusBadge
|
|
color={realizationStatusBadgeColor}
|
|
text={isLatestApprovalRejected ? 'Ditolak' : realizationStatus}
|
|
className={{
|
|
badge: 'whitespace-nowrap max-w-max w-fit',
|
|
}}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default RealizationStatusBadge;
|