전투시스템 중지 처리
This commit is contained in:
@@ -6,31 +6,22 @@ import Loading from '../../common/Loading';
|
||||
import {
|
||||
Title,
|
||||
BtnWrapper,
|
||||
SearchBarAlert, SelectInput, InputLabel, DatePickerWrapper,
|
||||
SearchBarAlert, SelectInput,
|
||||
} from '../../../styles/Components';
|
||||
|
||||
import {
|
||||
FormHelperText,
|
||||
FormInput,
|
||||
FormLabel,
|
||||
FormTextArea,
|
||||
FormTextAreaWrapper,
|
||||
MessageWrapper,
|
||||
FormRowGroup,
|
||||
NoticeInputRow2,
|
||||
NoticeInputItem2,
|
||||
BoxWrapper,
|
||||
FormStatusBar,
|
||||
FormStatusLabel,
|
||||
FormStatusWarning,
|
||||
FormButtonContainer,
|
||||
StyledSelectInput, TimeSeparator, TimeContainer,
|
||||
} from '../../../styles/ModuleComponents';
|
||||
import { HourList, MinuteList, modalTypes } from '../../../assets/data';
|
||||
import { DynamicModal, Modal, DateTimeRangePicker, SingleDatePicker, SingleTimePicker } from '../../common';
|
||||
import { LandAuctionModify, LandAuctionSingleRegist } from '../../../apis';
|
||||
import { modalTypes } from '../../../assets/data';
|
||||
import { DynamicModal, Modal, SingleDatePicker, SingleTimePicker } from '../../common';
|
||||
import { NONE, TYPE_MODIFY, TYPE_REGISTRY } from '../../../assets/data/adminConstants';
|
||||
import { landAuctionStatus, landAuctionStatusType, languageType, CurrencyType } from '../../../assets/data';
|
||||
import { useModal } from '../../../utils/hook';
|
||||
import { convertKTCDate } from '../../../utils';
|
||||
import {
|
||||
@@ -39,10 +30,9 @@ import {
|
||||
battleEventStatus,
|
||||
battleRepeatType,
|
||||
} from '../../../assets/data/options';
|
||||
import DatePickerComponent from '../../common/Date/DatePickerComponent';
|
||||
import { BattleEventModify, BattleEventSingleRegist } from '../../../apis/Battle';
|
||||
import { battleEventStatusType } from '../../../assets/data/types';
|
||||
import { result } from 'lodash';
|
||||
import { isValidDayRange } from '../../../utils/date';
|
||||
|
||||
const BattleEventModal = ({ modalType, detailView, handleDetailView, content, setDetailData, configData, rewardData }) => {
|
||||
const { t } = useTranslation();
|
||||
@@ -105,6 +95,17 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
|
||||
const newDate = new Date(date);
|
||||
|
||||
if(resultData.repeat_type !== NONE && resultData.event_end_dt){
|
||||
const endDate = new Date(resultData.event_end_dt);
|
||||
const startDay = new Date(newDate.getFullYear(), newDate.getMonth(), newDate.getDate());
|
||||
const endDay = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
|
||||
|
||||
if (endDay <= startDay) {
|
||||
setAlertMsg(t('BATTLE_EVENT_MODAL_START_DIFF_END_WARNING'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setResultData(prev => ({
|
||||
...prev,
|
||||
event_start_dt: newDate
|
||||
@@ -134,9 +135,9 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
|
||||
// 종료 날짜 변경 핸들러
|
||||
const handleEndDateChange = (date) => {
|
||||
if (!date || !resultData.start_dt) return;
|
||||
if (!date || !resultData.event_start_dt) return;
|
||||
|
||||
const startDate = new Date(resultData.start_dt);
|
||||
const startDate = new Date(resultData.event_start_dt);
|
||||
const endDate = new Date(date);
|
||||
|
||||
// 일자만 비교하기 위해 년/월/일만 추출
|
||||
@@ -144,22 +145,27 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
const endDay = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
|
||||
|
||||
if (endDay <= startDay) {
|
||||
setAlertMsg('종료일은 시작일보다 하루 이후여야 합니다.');
|
||||
setAlertMsg(t('BATTLE_EVENT_MODAL_START_DIFF_END_WARNING'));
|
||||
return;
|
||||
}
|
||||
|
||||
const newDate = new Date(date);
|
||||
newDate.setHours(23, 59, 59, 0);
|
||||
|
||||
setResultData(prev => ({
|
||||
...prev,
|
||||
event_end_dt: newDate
|
||||
event_end_dt: endDate
|
||||
}));
|
||||
};
|
||||
|
||||
const handleConfigChange = (e) => {
|
||||
const config = configData.find(data => data.id === e.target.value);
|
||||
setResultData({ ...resultData, config_id: config.id, round_time: config.round_time });
|
||||
const config = configData.find(data => String(data.id) === String(e.target.value));
|
||||
if (config) {
|
||||
setResultData({
|
||||
...resultData,
|
||||
config_id: config.id,
|
||||
round_time: config.round_time
|
||||
});
|
||||
} else {
|
||||
console.warn('Config not found for value:', e.target.value);
|
||||
}
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
@@ -174,18 +180,20 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
if (!checkCondition()) return;
|
||||
|
||||
const minAllowedTime = new Date(new Date().getTime() + 10 * 60000);
|
||||
if (resultData.event_start_dt < minAllowedTime) {
|
||||
setAlertMsg(t('BATTLE_EVENT_MADEL_START_DT_WARNING'));
|
||||
const startDt = resultData.event_start_dt;
|
||||
const endDt = resultData.event_end_dt;
|
||||
if (startDt < minAllowedTime) {
|
||||
setAlertMsg(t('BATTLE_EVENT_MODAL_START_DT_WARNING'));
|
||||
return;
|
||||
}
|
||||
if(resultData.repeat_type !== 'NONE' && resultData.event_start_dt >= resultData.event_end_dt) {
|
||||
setAlertMsg(t('LAND_AUCTION_MADEL_AUCTION_DIFF_AUCTION'))
|
||||
if(resultData.repeat_type !== 'NONE' && !isValidDayRange(startDt, endDt)) {
|
||||
setAlertMsg(t('BATTLE_EVENT_MODAL_START_DIFF_END_WARNING'))
|
||||
return;
|
||||
}
|
||||
|
||||
//화면에 머물면서 상태는 안바꼈을 경우가 있기에 시작시간 지났을경우 차단
|
||||
if (modalType === TYPE_MODIFY && resultData.event_start_dt < new Date()) {
|
||||
setAlertMsg(t('LAND_AUCTION_MADEL_MODIFY_START'));
|
||||
if (modalType === TYPE_MODIFY && startDt < new Date()) {
|
||||
setAlertMsg(t('BATTLE_EVENT_MODAL_START_DT_WARNING'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,8 +220,6 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
handleModalClose('registConfirm');
|
||||
if(data.result === "SUCCESS") {
|
||||
handleModalView('registComplete');
|
||||
}else if(data.result === "ERROR_AUCTION_STATUS_IMPOSSIBLE"){
|
||||
setAlertMsg(t('LAND_AUCTION_ERROR_MODIFY_STATUS'));
|
||||
}else{
|
||||
setAlertMsg(t('UPDATE_FAIL'));
|
||||
}
|
||||
@@ -227,8 +233,8 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
handleModalClose('registConfirm');
|
||||
if(data.result === "SUCCESS") {
|
||||
handleModalView('registComplete');
|
||||
}else if(data.result === "ERROR_LAND_AUCTION_IMPOSSIBLE"){
|
||||
setAlertMsg(t('LAND_AUCTION_ERROR_PROGRESS'));
|
||||
}else if(data.result === "ERROR_BATTLE_EVENT_TIME_OVER"){
|
||||
setAlertMsg(t('BATTLE_EVENT_MODAL_TIME_CHECK_WARNING'));
|
||||
}else{
|
||||
setAlertMsg(t('REGIST_FAIL'));
|
||||
}
|
||||
@@ -380,7 +386,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
현재상태: {battleEventStatus.find(data => data.value === content?.status)?.name || "등록"}
|
||||
</FormStatusLabel>
|
||||
<FormStatusWarning>
|
||||
{isView('registry') ? '' : t('LAND_AUCTION_MODAL_STATUS_WARNING')}
|
||||
{isView('registry') ? '' : t('BATTLE_EVENT_MODAL_STATUS_WARNING')}
|
||||
</FormStatusWarning>
|
||||
</FormStatusBar>
|
||||
<FormButtonContainer $gap="5px">
|
||||
@@ -415,7 +421,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
|
||||
<DynamicModal
|
||||
modalType={modalTypes.confirmOkCancel}
|
||||
view={modalState.registConfirmModal}
|
||||
modalText={isView('modify') ? t('LAND_UPDATE_CONFIRM') : t('LAND_REGIST_CONFIRM')}
|
||||
modalText={isView('modify') ? t('BATTLE_EVENT_UPDATE_CONFIRM') : t('BATTLE_EVENT_REGIST_CONFIRM')}
|
||||
handleSubmit={() => handleSubmit('registConfirm')}
|
||||
handleCancel={() => handleModalClose('registConfirm')}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user