Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 10x 10x 10x 10x 11x 11x 10x 10x | import { Theme } from '@repo/ui/themes/types';
import { ActivityState, RequestStatus } from '@/types/request';
export const REQUEST_ACTIONS = {
APPROVE: 'APPROVE',
REJECT: 'REJECT',
PROCEED: 'PROCEED',
CLOSE: 'CLOSE',
COMPLETE: 'COMPLETE',
};
export const REQUEST_FIELDS = {
MEAL_CONFIG: 'mealConfig',
CATEGORY: 'category',
DATA: 'data',
} as const;
export const STATUS_MAP: Record<RequestStatus, string> = {
[RequestStatus.PENDING]: 'Pending',
[RequestStatus.APPROVE]: 'Approved',
[RequestStatus.REJECT]: 'Rejected',
[RequestStatus.CLOSE]: 'Closed',
[RequestStatus.DONE]: 'Done',
[RequestStatus.CANCEL]: 'Cancelled',
};
export const getStatusColor = (status: string, theme: Theme): string => {
const colors: Record<string, string> = {
Pending: theme.colors.text.warning,
Approved: theme.colors.text.success,
Rejected: theme.colors.text.error,
Closed: theme.colors.text.success,
Done: theme.colors.text.success,
Cancelled: theme.colors.text.default,
};
return colors[status] || theme.colors.text.default;
};
export const HISTORY_ACTION_MESSAGES = {
APPROVED: 'has approved',
REJECTED: 'has rejected',
CANCELLED: 'has cancelled',
PROCEEDED: 'marked proceed',
COMPLETED: 'has completed',
CLOSED: 'has closed',
PENDING: 'has pending',
};
export const ACTION_MAP: Record<ActivityState, string> = {
[ActivityState.PENDING]: HISTORY_ACTION_MESSAGES.PENDING,
[ActivityState.DONE]: HISTORY_ACTION_MESSAGES.COMPLETED,
[ActivityState.CLOSE]: HISTORY_ACTION_MESSAGES.CLOSED,
[ActivityState.CANCEL]: HISTORY_ACTION_MESSAGES.CANCELLED,
[ActivityState.APPROVE]: HISTORY_ACTION_MESSAGES.APPROVED,
[ActivityState.REJECT]: HISTORY_ACTION_MESSAGES.REJECTED,
};
|