142 lines
3.1 KiB
JavaScript
142 lines
3.1 KiB
JavaScript
import dayjs from 'dayjs';
|
|
|
|
/**
|
|
* 이벤트 유형 이름 가져오기
|
|
* @param {string} eventType - 이벤트 유형 코드
|
|
* @returns {string} - 이벤트 유형 이름
|
|
*/
|
|
export const getEventTypeName = (eventType) => {
|
|
switch (eventType) {
|
|
case 'meeting':
|
|
return '정기 모임';
|
|
case 'tournament':
|
|
return '토너먼트';
|
|
case 'training':
|
|
return '교육/강습';
|
|
case 'social':
|
|
return '친목 모임';
|
|
case 'other':
|
|
return '기타';
|
|
default:
|
|
return eventType;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 이벤트 유형 심각도 가져오기
|
|
* @param {string} eventType - 이벤트 유형 코드
|
|
* @returns {string} - 심각도 클래스
|
|
*/
|
|
export const getEventTypeSeverity = (eventType) => {
|
|
switch (eventType) {
|
|
case 'meeting':
|
|
return 'info';
|
|
case 'tournament':
|
|
return 'danger';
|
|
case 'training':
|
|
return 'success';
|
|
case 'social':
|
|
return 'warning';
|
|
case 'other':
|
|
return 'secondary';
|
|
default:
|
|
return 'info';
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 상태 이름 가져오기
|
|
* @param {string} status - 상태 코드
|
|
* @returns {string} - 상태 이름
|
|
*/
|
|
export const getStatusName = (status) => {
|
|
switch (status) {
|
|
case 'scheduled':
|
|
return '예정됨';
|
|
case 'in_progress':
|
|
return '진행중';
|
|
case 'completed':
|
|
return '완료됨';
|
|
case 'cancelled':
|
|
return '취소됨';
|
|
default:
|
|
return status;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 상태 심각도 가져오기
|
|
* @param {string} status - 상태 코드
|
|
* @returns {string} - 심각도 클래스
|
|
*/
|
|
export const getStatusSeverity = (status) => {
|
|
switch (status) {
|
|
case 'scheduled':
|
|
return 'info';
|
|
case 'in_progress':
|
|
return 'warning';
|
|
case 'completed':
|
|
return 'success';
|
|
case 'cancelled':
|
|
return 'danger';
|
|
default:
|
|
return 'info';
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 날짜 포맷팅
|
|
* @param {string|Date} date - 날짜
|
|
* @returns {string} - 포맷팅된 날짜 문자열
|
|
*/
|
|
export const formatDate = (date) => {
|
|
if (!date) return '';
|
|
return dayjs(date).format('YYYY-MM-DD HH:mm');
|
|
};
|
|
|
|
/**
|
|
* 이벤트 유형 옵션
|
|
*/
|
|
export const eventTypeOptions = [
|
|
{ name: '정기 모임', value: 'meeting' },
|
|
{ name: '토너먼트', value: 'tournament' },
|
|
{ name: '교육/강습', value: 'training' },
|
|
{ name: '친목 모임', value: 'social' },
|
|
{ name: '기타', value: 'other' }
|
|
];
|
|
|
|
/**
|
|
* 상태 옵션
|
|
*/
|
|
export const statusOptions = [
|
|
{ name: '예정됨', value: 'scheduled' },
|
|
{ name: '진행중', value: 'in_progress' },
|
|
{ name: '완료됨', value: 'completed' },
|
|
{ name: '취소됨', value: 'cancelled' }
|
|
];
|
|
|
|
/**
|
|
* 새 이벤트 객체 생성
|
|
* @param {number} clubId - 클럽 ID
|
|
* @returns {Object} - 새 이벤트 객체
|
|
*/
|
|
export const createNewEvent = (clubId) => {
|
|
const now = new Date();
|
|
return {
|
|
clubId,
|
|
title: '',
|
|
description: '',
|
|
eventType: 'meeting',
|
|
startDate: now,
|
|
endDate: now,
|
|
location: '',
|
|
status: 'scheduled',
|
|
maxParticipants: 0,
|
|
teamCount: 1,
|
|
gameCount: 3,
|
|
participantFee: 0,
|
|
laneCount: 0,
|
|
registrationDeadline: now
|
|
};
|
|
};
|