fix: 심사대상 등록 유효성 체크 fix

mpower
minuk926 2 years ago
parent c952afc0f6
commit cbe146ba1c

@ -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);
}}
/>
</LocalizationProvider>
@ -93,8 +114,11 @@ const JudgeTargetSaveForm = ({ handleModalSave }) => {
</Grid>
<Grid item xs={12} sm={2}>
<FormControl fullWidth>
<InputLabel required></InputLabel>
<InputLabel required>심의</InputLabel>
<Select defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
<MenuItem key={0} value=" ">
팀선택
</MenuItem>
{combo.teams.map((team) => (
<MenuItem key={team.code} value={team.code}>
{team.value}
@ -109,10 +133,10 @@ const JudgeTargetSaveForm = ({ handleModalSave }) => {
required
id="msChasu"
name="msChasu"
label="차수"
label="심의차수"
format="######"
fullWidth
value={msChasu}
value={msChasu || ''}
onValueChange={(values) => setMsChasu(values.value)}
/>
</Grid>
@ -130,14 +154,6 @@ const JudgeTargetSaveForm = ({ handleModalSave }) => {
}}
/>
</LocalizationProvider>
{/* <TextField */}
{/* type="date" */}
{/* value={msCdate} */}
{/* defaultValue={msCdate} */}
{/* InputLabelProps={{ shrink: true }} */}
{/* onChange={(e) => setMsCdate(format(e.target.value), 'yyyy-MM-dd')} */}
{/* /> */}
</Grid>
<Grid item xs={12} sm={4}>
<LocalizationProvider dateAdapter={DateAdapter} locale={koLocale}>
@ -151,7 +167,8 @@ const JudgeTargetSaveForm = ({ handleModalSave }) => {
inputFormat="HH"
mask="__"
onChange={(newValue) => {
setMsClosesi(getHours(newValue));
console.log(newValue);
setMsClosesi(newValue);
}}
/>
</LocalizationProvider>

@ -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 SaveParkingTargetForm = ({ 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 SaveParkingTargetForm = ({ handleModalSave }) => {
mask="__"
onChange={(newValue) => {
// setMsStartsi(format(newValue, 'HH'));
setMsStartsi(getHours(newValue));
setMsStartsi(newValue);
}}
/>
</LocalizationProvider>
@ -93,8 +114,11 @@ const SaveParkingTargetForm = ({ handleModalSave }) => {
</Grid>
<Grid item xs={12} sm={2}>
<FormControl fullWidth>
<InputLabel required></InputLabel>
<InputLabel required>심의</InputLabel>
<Select name="reviewYear" defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
<MenuItem key={0} value=" ">
팀선택
</MenuItem>
{combo.teams.map((team) => (
<MenuItem key={team.code} value={team.code}>
{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);
}}
/>
</LocalizationProvider>
</Grid>
</Grid>
<Grid item sx={{ marginTop: 3 }}>
<Button variant="contained" color="primary" size="small" startIcon={<IconFileExport />} onClick={onSave}>
저장
</Button>
<Grid item container spacing={0.5} xs={12} mt={1}>
<Grid item style={{ marginLeft: 'auto' }}>
<Button variant="contained" color="primary" size="small" startIcon={<IconFileExport />} onClick={onSave}>
저장
</Button>
</Grid>
</Grid>
</>
);

@ -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);

Loading…
Cancel
Save