|
|
|
@ -2,31 +2,27 @@ import { useState } from 'react';
|
|
|
|
|
|
|
|
|
|
import NumberFormat from 'react-number-format';
|
|
|
|
|
import format from 'date-fns/format';
|
|
|
|
|
import getHours from 'date-fns/getHours';
|
|
|
|
|
import koLocale from 'date-fns/locale/ko';
|
|
|
|
|
|
|
|
|
|
import { Grid, TextField, MenuItem, Select, FormControl, InputLabel } from '@mui/material';
|
|
|
|
|
import DateAdapter from '@mui/lab/AdapterDateFns';
|
|
|
|
|
import LocalizationProvider from '@mui/lab/LocalizationProvider';
|
|
|
|
|
import { DatePicker, TimePicker } from '@mui/lab';
|
|
|
|
|
import Button from '@mui/material/Button';
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
import { IconFileExport } from '@tabler/icons';
|
|
|
|
|
|
|
|
|
|
import combo from 'commons/combo_data';
|
|
|
|
|
import { useAlert } from 'react-alert';
|
|
|
|
|
import { MuiXDatePicker, MuiXMobileTimePicker } from 'views/cmm/MuiXDatePicker';
|
|
|
|
|
|
|
|
|
|
const toDate = new Date();
|
|
|
|
|
|
|
|
|
|
const SaveParkingTargetForm = ({ handleModalSave }) => {
|
|
|
|
|
const showAlert = useAlert();
|
|
|
|
|
const [msuTeam, setMsuTeam] = useState(' ');
|
|
|
|
|
const [msChasu, setMsChasu] = useState();
|
|
|
|
|
const [msSdate, setMsSdate] = useState(format(toDate, 'yyyy-MM-dd'));
|
|
|
|
|
const [msStartsi, setMsStartsi] = useState(`${format(toDate, 'yyyy-MM-dd')} 09:00`);
|
|
|
|
|
const [msStartsi, setMsStartsi] = useState('00');
|
|
|
|
|
const [msEdate, setMsEdate] = useState(format(toDate, 'yyyy-MM-dd'));
|
|
|
|
|
const [msChasu, setMsChasu] = useState();
|
|
|
|
|
const [msCdate, setMsCdate] = useState(format(toDate, 'yyyy-MM-dd'));
|
|
|
|
|
const [msClosesi, setMsClosesi] = useState(`${format(toDate, 'yyyy-MM-dd')} 18:00`);
|
|
|
|
|
const [msClosesi, setMsClosesi] = useState('23');
|
|
|
|
|
|
|
|
|
|
const onSave = () => {
|
|
|
|
|
if (!msuTeam || msuTeam.length < 3) {
|
|
|
|
@ -44,78 +40,39 @@ const SaveParkingTargetForm = ({ handleModalSave }) => {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (msEdate.toString() > msCdate.toString()) {
|
|
|
|
|
showAlert.show('심의종료일과 심의마감일을 확인해 주세요');
|
|
|
|
|
if (msEdate.replace(/-/g, '') > msCdate.replace(/-/g, '')) {
|
|
|
|
|
showAlert.show('심사 종료일자가 심사 마감일자보다 클 수 없습니다.');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (msStartsi.length < 2) {
|
|
|
|
|
showAlert.show('심사 시작시간은 필수입니다.');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (msClosesi.length < 2) {
|
|
|
|
|
showAlert.show('심사 마감시간은 필수입니다.');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleModalSave({
|
|
|
|
|
msuTeam,
|
|
|
|
|
msChasu,
|
|
|
|
|
msSdate,
|
|
|
|
|
msStartsi: getHours(new Date(msStartsi)),
|
|
|
|
|
msStartsi,
|
|
|
|
|
msEdate,
|
|
|
|
|
msChasu,
|
|
|
|
|
msCdate,
|
|
|
|
|
msClosesi: getHours(new Date(msClosesi))
|
|
|
|
|
msClosesi
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Grid container spacing={2} mt={1.5}>
|
|
|
|
|
<Grid item xs={12} sm={4}>
|
|
|
|
|
<LocalizationProvider dateAdapter={DateAdapter} locale={koLocale}>
|
|
|
|
|
<DatePicker
|
|
|
|
|
// size="small"
|
|
|
|
|
renderInput={(props) => <TextField fullWidth {...props} />}
|
|
|
|
|
label="심의시작일"
|
|
|
|
|
value={msSdate}
|
|
|
|
|
inputFormat="yyyy-MM-dd"
|
|
|
|
|
mask="____-__-__"
|
|
|
|
|
onChange={(newValue) => {
|
|
|
|
|
setMsSdate(format(newValue, 'yyyy-MM-dd'));
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</LocalizationProvider>
|
|
|
|
|
{/* <MuiDatePicker label="심의시작일" date={msSdate} setDate={setMsSdate()} /> */}
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={4}>
|
|
|
|
|
<LocalizationProvider dateAdapter={DateAdapter} locale={koLocale}>
|
|
|
|
|
<TimePicker
|
|
|
|
|
size="small"
|
|
|
|
|
views={['hours']}
|
|
|
|
|
renderInput={(props) => <TextField fullWidth {...props} />}
|
|
|
|
|
label="심의시작시간"
|
|
|
|
|
value={msStartsi}
|
|
|
|
|
inputFormat="HH"
|
|
|
|
|
mask="__"
|
|
|
|
|
onChange={(newValue) => {
|
|
|
|
|
// setMsStartsi(format(newValue, 'HH'));
|
|
|
|
|
setMsStartsi(newValue);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</LocalizationProvider>
|
|
|
|
|
{/* <MuiTimePicker label="심의시작시간" date={msStartsi} setDate={setMsStartsi()} /> */}
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={4}>
|
|
|
|
|
<LocalizationProvider dateAdapter={DateAdapter} locale={koLocale}>
|
|
|
|
|
<DatePicker
|
|
|
|
|
size="small"
|
|
|
|
|
renderInput={(props) => <TextField fullWidth {...props} />}
|
|
|
|
|
label="심의종료일"
|
|
|
|
|
value={msEdate}
|
|
|
|
|
inputFormat="yyyy-MM-dd"
|
|
|
|
|
mask="____-__-__"
|
|
|
|
|
onChange={(newValue) => {
|
|
|
|
|
setMsEdate(format(newValue, 'yyyy-MM-dd'));
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</LocalizationProvider>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={2}>
|
|
|
|
|
<Grid item xs={12} sm={6}>
|
|
|
|
|
<FormControl fullWidth>
|
|
|
|
|
<InputLabel required>심의팀</InputLabel>
|
|
|
|
|
<Select name="reviewYear" defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
|
|
|
|
|
<Select defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
|
|
|
|
|
<MenuItem key={0} value=" ">
|
|
|
|
|
팀선택
|
|
|
|
|
</MenuItem>
|
|
|
|
@ -127,7 +84,7 @@ const SaveParkingTargetForm = ({ handleModalSave }) => {
|
|
|
|
|
</Select>
|
|
|
|
|
</FormControl>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={2}>
|
|
|
|
|
<Grid item xs={12} sm={6}>
|
|
|
|
|
<NumberFormat
|
|
|
|
|
customInput={TextField}
|
|
|
|
|
required
|
|
|
|
@ -140,45 +97,21 @@ const SaveParkingTargetForm = ({ handleModalSave }) => {
|
|
|
|
|
onValueChange={(values) => setMsChasu(values.value)}
|
|
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={4}>
|
|
|
|
|
<LocalizationProvider dateAdapter={DateAdapter} locale={koLocale}>
|
|
|
|
|
<DatePicker
|
|
|
|
|
size="small"
|
|
|
|
|
renderInput={(props) => <TextField fullWidth {...props} />}
|
|
|
|
|
label="심의마감일"
|
|
|
|
|
value={msCdate}
|
|
|
|
|
inputFormat="yyyy-MM-dd"
|
|
|
|
|
mask="____-__-__"
|
|
|
|
|
onChange={(newValue) => {
|
|
|
|
|
setMsCdate(format(newValue, 'yyyy-MM-dd'));
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</LocalizationProvider>
|
|
|
|
|
|
|
|
|
|
{/* <TextField */}
|
|
|
|
|
{/* type="date" */}
|
|
|
|
|
{/* value={msCdate} */}
|
|
|
|
|
{/* defaultValue={msCdate} */}
|
|
|
|
|
{/* InputLabelProps={{ shrink: true }} */}
|
|
|
|
|
{/* onChange={(e) => setMsCdate(format(e.target.value), 'yyyy-MM-dd')} */}
|
|
|
|
|
{/* /> */}
|
|
|
|
|
<Grid item xs={12} sm={6}>
|
|
|
|
|
<MuiXDatePicker label="심사 시작일자" date={msSdate} setDate={setMsSdate} />
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={4}>
|
|
|
|
|
<LocalizationProvider dateAdapter={DateAdapter} locale={koLocale}>
|
|
|
|
|
<TimePicker
|
|
|
|
|
size="small"
|
|
|
|
|
views={['hours']}
|
|
|
|
|
// renderInput={(props) => <TextField fullWidth {...props} />}
|
|
|
|
|
renderInput={(props) => <NumberFormat customInput={TextField} fullWidth {...props} format="##" />}
|
|
|
|
|
label="심의마감시간"
|
|
|
|
|
value={msClosesi}
|
|
|
|
|
inputFormat="HH"
|
|
|
|
|
mask="__"
|
|
|
|
|
onChange={(newValue) => {
|
|
|
|
|
setMsClosesi(newValue);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</LocalizationProvider>
|
|
|
|
|
<Grid item xs={12} sm={6}>
|
|
|
|
|
<MuiXMobileTimePicker label="심사 시작시간" date={`${format(toDate, 'yyyy-MM-dd')} ${msStartsi}:00`} setDate={setMsStartsi} />
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={6}>
|
|
|
|
|
<MuiXDatePicker label="심사 종료일자" date={msEdate} setDate={setMsEdate} />
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={6} />
|
|
|
|
|
<Grid item xs={12} sm={6}>
|
|
|
|
|
<MuiXDatePicker label="심사 마감일자" date={msCdate} setDate={setMsCdate} />
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} sm={6}>
|
|
|
|
|
<MuiXMobileTimePicker label="심사 마감시간" date={`${format(toDate, 'yyyy-MM-dd')} ${msClosesi}:00`} setDate={setMsClosesi} />
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item container spacing={0.5} xs={12} mt={1}>
|
|
|
|
|