parent
ef2476b74f
commit
f6366a6818
@ -0,0 +1,454 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import NumberFormat from 'react-number-format';
|
||||
import { useAlert } from 'react-alert';
|
||||
import format from 'date-fns/format';
|
||||
|
||||
import { Grid, TextField, MenuItem, Select, FormControl, InputLabel, InputAdornment } from '@mui/material';
|
||||
import Button from '@mui/material/Button';
|
||||
import { IconSearch } from '@tabler/icons';
|
||||
|
||||
import { getComboCodeList } from 'apis/common';
|
||||
import FileInputForms from 'views/form/FileInputForms';
|
||||
|
||||
const toDate = new Date();
|
||||
|
||||
const ModifyResidentDataForm = ({ rowData, handleModalSave }) => {
|
||||
const alert = useAlert();
|
||||
|
||||
const [scCarnum, setScCarnum] = useState(rowData.scCarnum);
|
||||
const [scName, setScName] = useState(rowData.scName);
|
||||
const [scDong, setScDong] = useState(rowData.scDong);
|
||||
const [scContDoc, setScContDoc] = useState();
|
||||
const [selectedContDoc, setSelectedContDoc] = useState(rowData.scContDoc);
|
||||
const [scIngb, setScIngb] = useState();
|
||||
const [selectedIngb, setSelectedIngb] = useState(rowData.scIngb);
|
||||
const [zippost1, setZippost1] = useState(`${rowData.zippost1}${rowData.zippost2}`);
|
||||
const [scJuso, setScJuso] = useState(rowData.scJuso);
|
||||
const [scBunji, setScBunji] = useState(rowData.scBunji);
|
||||
const [scWdate, setScWdate] = useState(rowData.scWdate);
|
||||
const [scCdate, setScCdate] = useState(rowData.scCdate);
|
||||
const [scJbtime, setScJbtime] = useState(rowData.scJbtime);
|
||||
const [scPos, setScPos] = useState('');
|
||||
|
||||
const [picads, setPicads] = useState({});
|
||||
const [frecads, setFrecads] = useState({});
|
||||
const [contads, setContads] = useState({});
|
||||
|
||||
const onSave = () => {
|
||||
// TODO : validation check 추가
|
||||
const formData = new FormData();
|
||||
formData.append('scCarnum', scCarnum);
|
||||
formData.append('scName', scName);
|
||||
formData.append('scDong', scDong);
|
||||
formData.append('scContDoc', selectedContDoc);
|
||||
formData.append('scCdate', scCdate);
|
||||
formData.append('scIngb', selectedIngb);
|
||||
formData.append('scWdate', scWdate);
|
||||
formData.append('scJbtime', scJbtime);
|
||||
formData.append('scPos', scPos);
|
||||
formData.append('zippost1', zippost1);
|
||||
formData.append('scJuso', scJuso);
|
||||
formData.append('scBunji', scBunji);
|
||||
|
||||
Object.values(picads).forEach((v) => {
|
||||
formData.append('picadFiles', v);
|
||||
});
|
||||
|
||||
Object.values(frecads).forEach((v) => {
|
||||
formData.append('frecadFiles', v);
|
||||
});
|
||||
|
||||
Object.values(contads).forEach((v) => {
|
||||
formData.append('contadFiles', v);
|
||||
});
|
||||
|
||||
handleModalSave(formData);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
// setSelectedContDoc('11');
|
||||
setScContDoc([]);
|
||||
getComboCodeList({ codeMcd: 'SC_CONT_DOC' }).then((res) => {
|
||||
console.log(res);
|
||||
setScContDoc(res.data);
|
||||
});
|
||||
getComboCodeList({ codeMcd: 'RC_INGB' }).then((res) => {
|
||||
console.log(res);
|
||||
setScIngb(res.data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleChangeFile = (e) => {
|
||||
const fileKey = e.target.name;
|
||||
const fileArrKey = fileKey + e.target.dataset.index;
|
||||
|
||||
if (fileKey === 'scPicad') {
|
||||
setPicads((picads) => {
|
||||
const updated = { ...picads };
|
||||
updated[fileArrKey] = e.target.files[0];
|
||||
return updated;
|
||||
});
|
||||
} else if (fileKey === 'scFrecad') {
|
||||
setFrecads((frecads) => {
|
||||
const updated = { ...frecads };
|
||||
updated[fileArrKey] = e.target.files[0];
|
||||
return updated;
|
||||
});
|
||||
} else if (fileKey === 'scContad') {
|
||||
setContads((contads) => {
|
||||
const updated = { ...contads };
|
||||
updated[fileArrKey] = e.target.files[0];
|
||||
return updated;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Grid mt={2}>
|
||||
<Grid container spacing={0.5} item xs={12} mb={1.5}>
|
||||
<Grid item sm={3}>
|
||||
<TextField
|
||||
required
|
||||
label="차량번호"
|
||||
size="small"
|
||||
fullWidth
|
||||
value={scCarnum}
|
||||
onChange={(e) => setScCarnum(e?.target?.value)}
|
||||
autoFocus
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<TextField required label="성명" size="small" fullWidth value={scName} onChange={(e) => setScName(e?.target?.value)} />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<TextField required label="동명" size="small" fullWidth value={scDong} onChange={(e) => setScDong(e?.target?.value)} />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel required>진술유형</InputLabel>
|
||||
<Select size="small" defaultValue="11" onChange={(e) => setSelectedContDoc(e?.target?.value)}>
|
||||
{scContDoc &&
|
||||
scContDoc.map((contDoc) => (
|
||||
<MenuItem key={contDoc.code} value={contDoc.code}>
|
||||
{contDoc.value}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={0.5} item xs={12} mb={1.5}>
|
||||
<Grid item sm={3}>
|
||||
<NumberFormat
|
||||
size="small"
|
||||
customInput={TextField}
|
||||
required
|
||||
label="접수일자"
|
||||
format="########"
|
||||
fullWidth
|
||||
value={scCdate}
|
||||
onChange={(e) => setScCdate(e?.target?.value)}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel required>접수방법</InputLabel>
|
||||
<Select size="small" defaultValue="1" onChange={(e) => setSelectedIngb(e?.target?.value)}>
|
||||
{scIngb &&
|
||||
scIngb.map((ingb) => (
|
||||
<MenuItem key={ingb.code} value={ingb.code}>
|
||||
{ingb.value}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<NumberFormat
|
||||
size="small"
|
||||
customInput={TextField}
|
||||
required
|
||||
label="위반일자"
|
||||
format="########"
|
||||
fullWidth
|
||||
value={scWdate}
|
||||
onChange={(e) => setScWdate(e?.target?.value)}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<NumberFormat
|
||||
size="small"
|
||||
customInput={TextField}
|
||||
required
|
||||
label="위반시간"
|
||||
format="####"
|
||||
fullWidth
|
||||
value={scJbtime}
|
||||
onChange={(e) => setScJbtime(e?.target?.value)}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={0.5} item xs={12} mb={2}>
|
||||
<Grid item sm={12}>
|
||||
<TextField
|
||||
size="small"
|
||||
required
|
||||
label="위반장소"
|
||||
fullWidth
|
||||
value={rowData.scPos}
|
||||
onChange={(e) => setScPos(e?.target?.value)}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={0.5} item xs={12} mb={2}>
|
||||
<Grid item sm={1.7}>
|
||||
<TextField
|
||||
size="small"
|
||||
fullWidth
|
||||
required
|
||||
label="우편번호"
|
||||
value={zippost1}
|
||||
onChange={(e) => setZippost1(e?.target?.value)}
|
||||
InputProps={{
|
||||
display: 'none',
|
||||
readOnly: true,
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<IconSearch stroke={1.5} size="1rem" cursor="pointer" />
|
||||
</InputAdornment>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={7}>
|
||||
<TextField
|
||||
size="small"
|
||||
required
|
||||
label="주소"
|
||||
fullWidth
|
||||
value={scJuso}
|
||||
onChange={(e) => setScJuso(e?.target?.value)}
|
||||
InputProps={{ readOnly: true }}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3.3}>
|
||||
<TextField size="small" required label="번지" fullWidth value={scBunji} onChange={(e) => setScBunji(e?.target?.value)} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid container spacing={1} item xs={12} mt={1}>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={false}
|
||||
fieldName="scPicad"
|
||||
index={1}
|
||||
labelName="단속사진1"
|
||||
fileName={rowData.scPicad1}
|
||||
selectedFile={picads.scPicad1?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
isOrgFileInfo
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof picads.scPicad1 === 'undefined'}
|
||||
fieldName="scPicad"
|
||||
labelName="단속사진2"
|
||||
index={2}
|
||||
fileName={rowData.scPicad2}
|
||||
selectedFile={picads.scPicad2?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
isOrgFileInfo
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof picads.scPicad2 === 'undefined'}
|
||||
fieldName="scPicad"
|
||||
labelName="단속사진3"
|
||||
index={3}
|
||||
fileName={rowData.scPicad3}
|
||||
selectedFile={picads.scPicad3?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof picads.scPicad3 === 'undefined'}
|
||||
fieldName="scPicad"
|
||||
labelName="단속사진4"
|
||||
index={4}
|
||||
fileName={rowData.scPicad4}
|
||||
selectedFile={picads.scPicad4?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={1} item xs={12} mt={1}>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={false}
|
||||
fieldName="scFrecad"
|
||||
index={1}
|
||||
labelName="진술서1"
|
||||
fileName={rowData.scFrecad1}
|
||||
selectedFile={frecads.scFrecad1?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
isOrgFileInfo
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof frecads.scFrecad1 === 'undefined'}
|
||||
fieldName="scFrecad"
|
||||
labelName="진술서2"
|
||||
index={2}
|
||||
fileName={rowData.scFrecad2}
|
||||
selectedFile={frecads.scFrecad2?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
isOrgFileInfo
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof frecads.scFrecad2 === 'undefined'}
|
||||
fieldName="scFrecad"
|
||||
labelName="진술서3"
|
||||
index={3}
|
||||
fileName={rowData.scFrecad3}
|
||||
selectedFile={frecads.scFrecad3?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof frecads.scFrecad3 === 'undefined'}
|
||||
fieldName="scFrecad"
|
||||
labelName="진술서4"
|
||||
index={4}
|
||||
fileName={rowData.scFrecad4}
|
||||
selectedFile={frecads.scFrecad4?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={1} item xs={12} mt={1}>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={false}
|
||||
fieldName="scContad"
|
||||
index={1}
|
||||
labelName="첨부자료1"
|
||||
selectedFile={contads.scContad1?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
isOrgFileInfo
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof contads.scContad1 === 'undefined'}
|
||||
fieldName="scContad"
|
||||
labelName="첨부자료2"
|
||||
index={2}
|
||||
selectedFile={contads.scContad2?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
isOrgFileInfo
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof contads.scContad2 === 'undefined'}
|
||||
fieldName="scContad"
|
||||
labelName="첨부자료3"
|
||||
index={3}
|
||||
selectedFile={contads.scContad3?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof contads.scContad3 === 'undefined'}
|
||||
fieldName="scContad"
|
||||
labelName="첨부자료4"
|
||||
index={4}
|
||||
selectedFile={contads.scContad4?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof contads.scContad4 === 'undefined'}
|
||||
fieldName="scContad"
|
||||
index={5}
|
||||
labelName="첨부자료5"
|
||||
selectedFile={contads.scContad5?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
isOrgFileInfo
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof contads.scContad5 === 'undefined'}
|
||||
fieldName="scContad"
|
||||
labelName="첨부자료6"
|
||||
index={6}
|
||||
selectedFile={contads.scContad6?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
isOrgFileInfo
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof contads.scContad6 === 'undefined'}
|
||||
fieldName="scContad"
|
||||
labelName="첨부자료7"
|
||||
index={7}
|
||||
selectedFile={contads.scContad7?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FileInputForms
|
||||
isDisabled={typeof contads.scContad7 === 'undefined'}
|
||||
fieldName="scContad"
|
||||
labelName="첨부자료8"
|
||||
index={8}
|
||||
selectedFile={contads.scContad8?.name}
|
||||
handleChangeFile={handleChangeFile}
|
||||
alert={alert}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item sx={{ marginTop: 3 }}>
|
||||
{/* <Button variant="contained" color="primary" size="small" startIcon={<IconFileExport />} onClick={onSave}> */}
|
||||
<Button disabled variant="contained" color="primary" size="small" onClick={onSave}>
|
||||
저장
|
||||
</Button>
|
||||
</Grid>
|
||||
</>
|
||||
);
|
||||
};
|
||||
ModifyResidentDataForm.propTypes = {
|
||||
rowData: PropTypes.object.isRequired,
|
||||
handleModalSave: PropTypes.func.isRequired
|
||||
};
|
||||
export default ModifyResidentDataForm;
|
@ -0,0 +1,207 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
// material-ui
|
||||
import { Button, Divider, FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from '@mui/material';
|
||||
|
||||
// assets
|
||||
import { IconSearch } from '@tabler/icons';
|
||||
import PersonAddTwoToneIcon from '@mui/icons-material/PersonAddTwoTone';
|
||||
|
||||
// berry ui
|
||||
import MainCard from 'ui-component/cards/MainCard';
|
||||
|
||||
// project imports
|
||||
import MuiDataGrid from 'views/form/MuiDataGrid';
|
||||
|
||||
import xitCmm from 'commons/XitCmm';
|
||||
import CmmModal from 'views/form/Modal/CmmModal';
|
||||
import SaveResidentSimsaForm from './SaveResidentSimsaForm';
|
||||
import NumberFormat from 'react-number-format';
|
||||
import ExcelDownload from 'views/form/ExcelDownload';
|
||||
import { findParkingTargets, saveParkingTargets } from 'apis/parking';
|
||||
|
||||
const ResidentRegister = () => {
|
||||
const [rcIrTransfer, setRcIrTransfer] = useState('1');
|
||||
const [rcSeq1, setRcSeq1] = useState('2022200801');
|
||||
const [rcSeq2, setRcSeq2] = useState('2022200899');
|
||||
const [selection, setSelection] = useState([]);
|
||||
const [totalCount, setTotalCount] = useState(0);
|
||||
const [rowsStatus, setRowsStatus] = useState({
|
||||
page: 0,
|
||||
pageSize: 100,
|
||||
rows: []
|
||||
});
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const columns = [
|
||||
{ headerName: 'No', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 },
|
||||
{ headerName: '접수번호', headerAlign: 'center', field: 'rcSeq', align: 'center' },
|
||||
{ headerName: '최초차량번호', headerAlign: 'center', field: 'mmOcarno', align: 'center', minWidth: 110 },
|
||||
{ headerName: '최종차량번호', headerAlign: 'center', field: 'mmNcarno', align: 'center', minWidth: 110 },
|
||||
{ headerName: '성명', headerAlign: 'center', field: 'rcName', minWidth: 150 },
|
||||
{ headerName: '진술유형', headerAlign: 'center', field: 'rcContDocNm', minWidth: 130 },
|
||||
{
|
||||
headerName: '접수일자',
|
||||
headerAlign: 'center',
|
||||
field: 'rcDate',
|
||||
align: 'center',
|
||||
format: '####-##-##'
|
||||
// valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`
|
||||
},
|
||||
{ headerName: '접수방법', headerAlign: 'center', field: 'rcIngbNm', align: 'center' }
|
||||
];
|
||||
|
||||
const search = () => {
|
||||
const params = {
|
||||
rcIrTransfer,
|
||||
rcSeq1,
|
||||
rcSeq2
|
||||
};
|
||||
|
||||
findParkingTargets(params).then((response) => {
|
||||
if (response && response.data) {
|
||||
setTotalCount(response.count);
|
||||
setRowsStatus((prevRows) => ({ ...prevRows, rows: response.data }));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
if (selection.length === 0) {
|
||||
xitCmm.alertParam(`처리할 데이타가 없습니다`);
|
||||
} else {
|
||||
setOpen(true);
|
||||
// alert(`저장할 데이타 => ${selectRows}`);
|
||||
}
|
||||
};
|
||||
|
||||
const submitParkingSimsa = (params) => {
|
||||
const param = {
|
||||
...params,
|
||||
rcIrTransfer,
|
||||
rcSeq1,
|
||||
rcSeq2,
|
||||
rcCodes: selection.map((d) => rowsStatus.rows[d - 1].rcCode)
|
||||
};
|
||||
setOpen(false);
|
||||
// return false;
|
||||
|
||||
saveParkingTargets(param).then(() => {
|
||||
setSelection([]);
|
||||
search();
|
||||
});
|
||||
};
|
||||
|
||||
const handleSearch = () => {
|
||||
if (rcSeq1 && rcSeq2) {
|
||||
search();
|
||||
}
|
||||
};
|
||||
|
||||
const handleOnKeyDown = (event) => {
|
||||
if (event.type === 'keydown' && event.key === 'Enter' && rcSeq1 && rcSeq2) {
|
||||
search();
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelection = (newSelection) => {
|
||||
setSelection(newSelection);
|
||||
};
|
||||
|
||||
return (
|
||||
<MainCard>
|
||||
<Grid container spacing={2} alignItems="center">
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={1}>
|
||||
<Grid item>
|
||||
<FormControl>
|
||||
<FormLabel component="legend" required>
|
||||
자료등록여부
|
||||
</FormLabel>
|
||||
<RadioGroup
|
||||
row
|
||||
aria-label="category"
|
||||
name="row-radio-buttons-group"
|
||||
value={rcIrTransfer}
|
||||
onChange={(e) => setRcIrTransfer(e.target.value)}
|
||||
>
|
||||
<FormControlLabel value="1" control={<Radio />} label="미등록" />
|
||||
<FormControlLabel value="2" control={<Radio />} label="등록" />
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<NumberFormat
|
||||
customInput={TextField}
|
||||
size="small"
|
||||
required
|
||||
id="rcSeq1"
|
||||
name="rcSeq1"
|
||||
value={rcSeq1}
|
||||
onChange={(e) => setRcSeq1(e.target.value.replace(/-/g, ''))}
|
||||
placeholder="yyyy-MM-9999"
|
||||
onKeyDown={handleOnKeyDown}
|
||||
label="접수번호(시작)"
|
||||
format="####-######"
|
||||
/>
|
||||
-
|
||||
<NumberFormat
|
||||
customInput={TextField}
|
||||
size="small"
|
||||
required
|
||||
id="rcSeq2"
|
||||
name="rcSeq2"
|
||||
value={rcSeq2}
|
||||
onChange={(e) => setRcSeq2(e.target.value.replace(/-/g, ''))}
|
||||
placeholder="yyyy-MM-9999"
|
||||
onKeyDown={handleOnKeyDown}
|
||||
label="접수번호(종료)"
|
||||
format="####-######"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Button variant="contained" color="primary" size="small" startIcon={<IconSearch />} onClick={handleSearch}>
|
||||
검색
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Button
|
||||
disabled={selection.length === 0}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
size="small"
|
||||
startIcon={<PersonAddTwoToneIcon />}
|
||||
onClick={handleSave}
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<ExcelDownload fileName="심사등록대상" gridColumns={columns} excelDatas={rowsStatus.rows} isDisabled={totalCount === 0} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Divider />
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Divider />
|
||||
</Grid>
|
||||
<MuiDataGrid
|
||||
// apiRef={apiRef}
|
||||
isCheckbox
|
||||
isHideFooter
|
||||
columns={columns}
|
||||
rowsState={rowsStatus}
|
||||
totalCount={totalCount}
|
||||
setRowsStatus={setRowsStatus}
|
||||
handleSelection={handleSelection}
|
||||
/>
|
||||
<CmmModal isBackdrop title="심의등록" open={open} setOpen={setOpen}>
|
||||
<SaveResidentSimsaForm isDisabled={selection.length === 0} handleModalSave={submitResidentSimsa} />
|
||||
</CmmModal>
|
||||
</MainCard>
|
||||
);
|
||||
};
|
||||
export default ResidentRegister;
|
@ -0,0 +1,172 @@
|
||||
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';
|
||||
|
||||
const toDate = new Date();
|
||||
|
||||
const SaveResidentSimsaForm = ({ handleModalSave }) => {
|
||||
const [msuTeam, setMsuTeam] = useState(combo.teams[0].code);
|
||||
const [msSdate, setMsSdate] = useState(format(toDate, 'yyyy-MM-dd'));
|
||||
const [msStartsi, setMsStartsi] = useState(getHours(toDate));
|
||||
const [msEdate, setMsEdate] = useState(format(toDate, 'yyyy-MM-dd'));
|
||||
const [msChasu, setMsChasu] = useState(99);
|
||||
const [msCdate, setMsCdate] = useState(format(toDate, 'yyyy-MM-dd'));
|
||||
const [msClosesi, setMsClosesi] = useState(getHours(toDate));
|
||||
|
||||
const onSave = () => {
|
||||
// TODO : validation check 추가
|
||||
handleModalSave({
|
||||
msuTeam,
|
||||
msSdate,
|
||||
msStartsi,
|
||||
msEdate,
|
||||
msChasu,
|
||||
msCdate,
|
||||
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(getHours(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}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel required>팀</InputLabel>
|
||||
<Select name="reviewYear" defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
|
||||
{combo.teams.map((team) => (
|
||||
<MenuItem key={team.code} value={team.code}>
|
||||
{team.value}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={2}>
|
||||
<NumberFormat
|
||||
customInput={TextField}
|
||||
required
|
||||
id="msChasu"
|
||||
name="msChasu"
|
||||
label="차수"
|
||||
format="######"
|
||||
fullWidth
|
||||
value={msChasu}
|
||||
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>
|
||||
<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(getHours(newValue));
|
||||
}}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item sx={{ marginTop: 3 }}>
|
||||
<Button variant="contained" color="primary" size="small" startIcon={<IconFileExport />} onClick={onSave}>
|
||||
저장
|
||||
</Button>
|
||||
</Grid>
|
||||
</>
|
||||
);
|
||||
};
|
||||
SaveResidentSimsaForm.propTypes = {
|
||||
handleModalSave: PropTypes.func.isRequired
|
||||
// isDisabled: PropTypes.bool.isRequired
|
||||
};
|
||||
export default SaveResidentSimsaForm;
|
Loading…
Reference in New Issue