mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 23:05:46 +00:00
refactor(FE): Normalize status keys to uppercase in status utilities
This commit is contained in:
@@ -38,37 +38,26 @@ import { Color } from '@/types/theme';
|
|||||||
// ===== STATUS BADGE UTILITIES =====
|
// ===== STATUS BADGE UTILITIES =====
|
||||||
const statusTextMap: Record<string, string> = {
|
const statusTextMap: Record<string, string> = {
|
||||||
APPROVED: 'Disetujui',
|
APPROVED: 'Disetujui',
|
||||||
Disetujui: 'Disetujui',
|
|
||||||
REJECTED: 'Ditolak',
|
REJECTED: 'Ditolak',
|
||||||
Ditolak: 'Ditolak',
|
|
||||||
CREATED: 'Pengajuan',
|
CREATED: 'Pengajuan',
|
||||||
Pengajuan: 'Pengajuan',
|
|
||||||
UPDATED: 'Diperbarui',
|
UPDATED: 'Diperbarui',
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStatusText = (status: string): string => {
|
const getStatusText = (status: string): string => {
|
||||||
return statusTextMap[status] || status;
|
const normalizedStatus = status.toUpperCase();
|
||||||
|
return statusTextMap[normalizedStatus] || status;
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusBadgeColorMap: Record<string, Color> = {
|
const statusBadgeColorMap: Record<string, Color> = {
|
||||||
APPROVED: 'success',
|
APPROVED: 'success',
|
||||||
Disetujui: 'success',
|
|
||||||
approved: 'success',
|
|
||||||
disetujui: 'success',
|
|
||||||
REJECTED: 'error',
|
REJECTED: 'error',
|
||||||
Ditolak: 'error',
|
|
||||||
rejected: 'error',
|
|
||||||
ditolak: 'error',
|
|
||||||
CREATED: 'neutral',
|
CREATED: 'neutral',
|
||||||
Pengajuan: 'neutral',
|
|
||||||
created: 'neutral',
|
|
||||||
pengajuan: 'neutral',
|
|
||||||
UPDATED: 'warning',
|
UPDATED: 'warning',
|
||||||
updated: 'warning',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStatusBadgeColor = (status: string): Color => {
|
const getStatusBadgeColor = (status: string): Color => {
|
||||||
return statusBadgeColorMap[status] || 'neutral';
|
const normalizedStatus = status.toUpperCase();
|
||||||
|
return statusBadgeColorMap[normalizedStatus] || 'neutral';
|
||||||
};
|
};
|
||||||
|
|
||||||
const RowOptionsMenu = ({
|
const RowOptionsMenu = ({
|
||||||
|
|||||||
Reference in New Issue
Block a user