177 lines
5.0 KiB
JavaScript
177 lines
5.0 KiB
JavaScript
// enumMappings.js: 영어 enum 값을 한글 라벨로 변환하는 매핑 및 함수 모음
|
|
|
|
export const GENDER_OPTIONS = [
|
|
{ name: '남성', value: 'male' },
|
|
{ name: '여성', value: 'female' }
|
|
];
|
|
export const GENDER_LABELS = GENDER_OPTIONS.reduce(
|
|
(acc, cur) => ({ ...acc, [cur.value]: cur.name }),
|
|
{}
|
|
);
|
|
|
|
export const MEMBER_TYPE_OPTIONS = [
|
|
{ name: '정회원', value: 'regular' },
|
|
{ name: '준회원', value: 'associate' },
|
|
{ name: '게스트', value: 'guest' },
|
|
{ name: '운영진', value: 'manager' },
|
|
{ name: '모임장', value: 'owner' }
|
|
];
|
|
export const MEMBER_TYPE_LABELS = MEMBER_TYPE_OPTIONS.reduce(
|
|
(acc, cur) => ({ ...acc, [cur.value]: cur.name }),
|
|
{}
|
|
);
|
|
|
|
export const STATUS_OPTIONS = [
|
|
{ name: '활성', value: 'active' },
|
|
{ name: '비활성', value: 'inactive' },
|
|
{ name: '정지', value: 'suspended' },
|
|
{ name: '삭제', value: 'deleted' }
|
|
];
|
|
export const STATUS_LABELS = STATUS_OPTIONS.reduce(
|
|
(acc, cur) => ({ ...acc, [cur.value]: cur.name }),
|
|
{}
|
|
);
|
|
|
|
export const PARTICIPANT_STATUS_OPTIONS = [
|
|
{ name: '참가예정', value: 'pending' },
|
|
{ name: '참가확정', value: 'confirmed' },
|
|
{ name: '취소', value: 'canceled' }
|
|
];
|
|
export const PARTICIPANT_STATUS_LABELS = PARTICIPANT_STATUS_OPTIONS.reduce(
|
|
(acc, cur) => ({ ...acc, [cur.value]: cur.name }),
|
|
{}
|
|
);
|
|
|
|
export const EVENT_STATUS_OPTIONS = [
|
|
{ name: '준비', value: 'ready' },
|
|
{ name: '활성', value: 'active' },
|
|
{ name: '완료', value: 'completed' },
|
|
{ name: '취소', value: 'canceled' },
|
|
{ name: '삭제', value: 'deleted' }
|
|
];
|
|
export const EVENT_STATUS_LABELS = EVENT_STATUS_OPTIONS.reduce(
|
|
(acc, cur) => ({ ...acc, [cur.value]: cur.name }),
|
|
{}
|
|
);
|
|
|
|
export const EVENT_TYPE_OPTIONS = [
|
|
{ name: '정기전', value: 'regular' },
|
|
{ name: '교류전', value: 'exchange' },
|
|
{ name: '토너먼트', value: 'tournament' },
|
|
{ name: '번개', value: 'lightning' },
|
|
{ name: '친선전', value: 'friendly' },
|
|
{ name: '기타', value: 'other' }
|
|
];
|
|
export const EVENT_TYPE_LABELS = EVENT_TYPE_OPTIONS.reduce(
|
|
(acc, cur) => ({ ...acc, [cur.value]: cur.name }),
|
|
{}
|
|
);
|
|
|
|
export const PAYMENT_STATUS_OPTIONS = [
|
|
{ name: '미납', value: 'unpaid' },
|
|
{ name: '납부완료', value: 'paid' },
|
|
{ name: '대기', value: 'pending' },
|
|
{ name: '취소', value: 'canceled' }
|
|
];
|
|
export const PAYMENT_STATUS_LABELS = PAYMENT_STATUS_OPTIONS.reduce(
|
|
(acc, cur) => ({ ...acc, [cur.value]: cur.name }),
|
|
{}
|
|
);
|
|
|
|
|
|
export const AVERAGE_CALCULATION_PERIOD_OPTIONS = [
|
|
{ name: '전체', value: 'total' },
|
|
{ name: '최근 1년', value: '1year' },
|
|
{ name: '최근 6개월', value: '6month' },
|
|
{ name: '최근 3개월', value: '3month' },
|
|
{ name: '상반기', value: 'firsthalf' },
|
|
{ name: '하반기', value: 'secondhalf' },
|
|
{ name: '분기별', value: 'quarterly' }
|
|
];
|
|
export const AVERAGE_CALCULATION_PERIOD_LABELS = AVERAGE_CALCULATION_PERIOD_OPTIONS.reduce(
|
|
(acc, cur) => ({ ...acc, [cur.value]: cur.name }),
|
|
{}
|
|
);
|
|
|
|
export function getGenderLabel(code) {
|
|
return GENDER_LABELS[code] || '-';
|
|
}
|
|
export function getMemberTypeLabel(code) {
|
|
return MEMBER_TYPE_LABELS[code] || '-';
|
|
}
|
|
export function getStatusLabel(code) {
|
|
return STATUS_LABELS[code] || '-';
|
|
}
|
|
|
|
export function getParticipantStatusLabel(code) {
|
|
return PARTICIPANT_STATUS_LABELS[code] || '-';
|
|
}
|
|
|
|
export function getEventStatusLabel(code) {
|
|
return EVENT_STATUS_LABELS[code] || '-';
|
|
}
|
|
export function getEventTypeLabel(code) {
|
|
return EVENT_TYPE_LABELS[code] || '-';
|
|
}
|
|
|
|
export function getPaymentStatusLabel(code) {
|
|
return PAYMENT_STATUS_LABELS[code] || '-';
|
|
}
|
|
|
|
export function getAverageCalculationPeriodLabel(code) {
|
|
return AVERAGE_CALCULATION_PERIOD_LABELS[code] || '-';
|
|
}
|
|
|
|
export function getMemberTypeSeverity(type) {
|
|
switch (type) {
|
|
case 'regular': return 'success';
|
|
case 'associate': return 'info';
|
|
case 'guest': return 'warning';
|
|
case 'manager': return 'primary';
|
|
case 'owner': return 'danger';
|
|
default: return 'secondary';
|
|
}
|
|
}
|
|
|
|
// 이벤트 유형별 Badge 색상 반환
|
|
export function getEventTypeSeverity(type) {
|
|
switch (type) {
|
|
case 'regular': return 'success';
|
|
case 'exchange': return 'primary';
|
|
case 'tournament': return 'warning';
|
|
case 'lightning': return 'info';
|
|
case 'friendly': return 'success';
|
|
case 'other': return 'secondary';
|
|
default: return 'secondary';
|
|
}
|
|
}
|
|
|
|
export function getStatusSeverity(status) {
|
|
switch (status) {
|
|
case 'ready': return 'info';
|
|
case 'active': return 'success';
|
|
case 'completed': return 'primary';
|
|
case 'canceled': return 'danger';
|
|
case 'deleted': return 'secondary';
|
|
default: return 'secondary';
|
|
}
|
|
}
|
|
|
|
export function getPaymentStatusSeverity(status) {
|
|
switch (status) {
|
|
case 'unpaid': return 'danger';
|
|
case 'paid': return 'success';
|
|
case 'pending': return 'warning';
|
|
case 'canceled': return 'danger';
|
|
default: return 'secondary';
|
|
}
|
|
}
|
|
|
|
export function getParticipantStatusSeverity(status) {
|
|
switch (status) {
|
|
case 'pending': return 'info';
|
|
case 'confirmed': return 'success';
|
|
case 'canceled': return 'danger';
|
|
default: return 'secondary';
|
|
}
|
|
} |