refactor(FE-170): add support for 'UPDATED' action in RecordingTable with corresponding status text

This commit is contained in:
rstubryan
2025-11-06 13:27:18 +07:00
parent c9edc407b4
commit 6d8d608cc9
@@ -213,6 +213,8 @@ const ApprovalHistoryModal = ({
? 'success'
: currentApproval.action === 'REJECTED'
? 'error'
: currentApproval.action === 'UPDATED'
? 'warning'
: 'info'
}
>
@@ -222,6 +224,7 @@ const ApprovalHistoryModal = ({
{currentApproval.action === 'APPROVED' && 'Disetujui'}
{currentApproval.action === 'REJECTED' && 'Ditolak'}
{currentApproval.action === 'CREATED' && 'Dibuat'}
{currentApproval.action === 'UPDATED' && 'Diperbarui'}
</span>
</div>
{currentApproval.notes && (
@@ -270,6 +273,8 @@ const ApprovalHistoryModal = ({
? 'success'
: approval.action === 'REJECTED'
? 'error'
: approval.action === 'UPDATED'
? 'warning'
: 'info'
}
size='sm'
@@ -277,6 +282,7 @@ const ApprovalHistoryModal = ({
{approval.action === 'APPROVED' && 'Disetujui'}
{approval.action === 'REJECTED' && 'Ditolak'}
{approval.action === 'CREATED' && 'Dibuat'}
{approval.action === 'UPDATED' && 'Diperbarui'}
</Badge>
</td>
<td className='max-w-xs'>
@@ -690,6 +696,8 @@ const RecordingTable = () => {
? 'success'
: approval.action === 'REJECTED'
? 'error'
: approval.action === 'UPDATED'
? 'warning'
: 'info';
const openApprovalHistory = () => {
@@ -697,6 +705,21 @@ const RecordingTable = () => {
approvalHistoryModal.openModal();
};
const getStatusText = (action: string) => {
switch (action) {
case 'APPROVED':
return 'Disetujui';
case 'REJECTED':
return 'Ditolak';
case 'CREATED':
return 'Dibuat';
case 'UPDATED':
return 'Diperbarui';
default:
return action;
}
};
return (
<Badge
variant='soft'
@@ -708,7 +731,7 @@ const RecordingTable = () => {
onClick={openApprovalHistory}
title='Klik untuk lihat riwayat approval'
>
{approval.step_name}
{getStatusText(approval.action)}
</Badge>
);
},