From cbe146ba1cd65e9244ccc2f310b0f8bebf971b6c Mon Sep 17 00:00:00 2001 From: minuk926 Date: Fri, 29 Jul 2022 18:18:51 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8B=AC=EC=82=AC=EB=8C=80=EC=83=81=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/admin/judge/JudgeTargetSaveForm.jsx | 57 ++++++++++++------- .../admin/parking/SaveParkingTargetForm.jsx | 56 +++++++++++++----- src/views/biz/judge/ProcessJudge.jsx | 2 +- 3 files changed, 79 insertions(+), 36 deletions(-) diff --git a/src/views/biz/admin/judge/JudgeTargetSaveForm.jsx b/src/views/biz/admin/judge/JudgeTargetSaveForm.jsx index 0f32f6a..32484d3 100644 --- a/src/views/biz/admin/judge/JudgeTargetSaveForm.jsx +++ b/src/views/biz/admin/judge/JudgeTargetSaveForm.jsx @@ -14,28 +14,49 @@ import PropTypes from 'prop-types'; import { IconFileExport } from '@tabler/icons'; import combo from 'commons/combo_data'; +import { useAlert } from 'react-alert'; const toDate = new Date(); const JudgeTargetSaveForm = ({ handleModalSave }) => { - const [msuTeam, setMsuTeam] = useState(combo.teams[0].code); + const showAlert = useAlert(); + const [msuTeam, setMsuTeam] = useState(' '); const [msSdate, setMsSdate] = useState(format(toDate, 'yyyy-MM-dd')); - const [msStartsi, setMsStartsi] = useState(getHours(toDate)); + const [msStartsi, setMsStartsi] = useState(`${format(toDate, 'yyyy-MM-dd')} 09:00`); const [msEdate, setMsEdate] = useState(format(toDate, 'yyyy-MM-dd')); - const [msChasu, setMsChasu] = useState(99); + const [msChasu, setMsChasu] = useState(); const [msCdate, setMsCdate] = useState(format(toDate, 'yyyy-MM-dd')); - const [msClosesi, setMsClosesi] = useState(getHours(toDate)); + const [msClosesi, setMsClosesi] = useState(`${format(toDate, 'yyyy-MM-dd')} 18:00`); const onSave = () => { - // TODO : validation check 추가 + if (!msuTeam || msuTeam.length < 3) { + showAlert.show('심의팀을 선택해 주세요'); + return; + } + + if (!msChasu || msChasu.length === 0) { + showAlert.show('심의 차수를 입력해 주세요'); + return; + } + + if (msSdate.toString() >= msEdate.toString()) { + showAlert.show('심의시작일과 심의종료일을 확인해 주세요'); + return; + } + + if (msEdate.toString() > msCdate.toString()) { + showAlert.show('심의종료일과 심의마감일을 확인해 주세요'); + return; + } + handleModalSave({ msuTeam, msSdate, - msStartsi, + msStartsi: getHours(new Date(msStartsi)), msEdate, msChasu, msCdate, - msClosesi + msClosesi: getHours(new Date(msClosesi)) }); }; @@ -70,7 +91,7 @@ const JudgeTargetSaveForm = ({ handleModalSave }) => { mask="__" onChange={(newValue) => { // setMsStartsi(format(newValue, 'HH')); - setMsStartsi(getHours(newValue)); + setMsStartsi(newValue); }} /> @@ -93,8 +114,11 @@ const JudgeTargetSaveForm = ({ handleModalSave }) => { - + 심의팀 setMsuTeam(e.target.value)}> + + 팀선택 + {combo.teams.map((team) => ( {team.value} @@ -109,7 +133,7 @@ const SaveParkingTargetForm = ({ handleModalSave }) => { required id="msChasu" name="msChasu" - label="차수" + label="심의차수" format="######" fullWidth value={msChasu} @@ -151,16 +175,18 @@ const SaveParkingTargetForm = ({ handleModalSave }) => { inputFormat="HH" mask="__" onChange={(newValue) => { - setMsClosesi(getHours(newValue)); + setMsClosesi(newValue); }} /> - - + + + + ); diff --git a/src/views/biz/judge/ProcessJudge.jsx b/src/views/biz/judge/ProcessJudge.jsx index 2bb07a2..fce81df 100644 --- a/src/views/biz/judge/ProcessJudge.jsx +++ b/src/views/biz/judge/ProcessJudge.jsx @@ -22,7 +22,7 @@ const ProcessJudge = (props) => { const getImgList = (row) => { findJudgeImages(row).then((res) => { const { arrFrecadImg, arrContadImg, arrPicadImg } = res; - console.log(arrFrecadImg, arrContadImg, arrPicadImg); + // console.log(arrFrecadImg, arrContadImg, arrPicadImg); setFrecadImgs(arrFrecadImg); setContadImgs(arrContadImg); setPicadImgs(arrPicadImg);