diff --git a/src/views/biz/resident/SaveResidentDataForm.jsx b/src/views/biz/resident/SaveResidentDataForm.jsx index 88ba0d2..12af0c1 100644 --- a/src/views/biz/resident/SaveResidentDataForm.jsx +++ b/src/views/biz/resident/SaveResidentDataForm.jsx @@ -1,23 +1,15 @@ import { useCallback, useEffect, 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, IconButton, InputAdornment } 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 { IconFileExport, IconSearch } from '@tabler/icons'; import { getComboCodeList } from 'apis/common'; -import combo from '../../../commons/combo_data'; -import { FileDownload, FileUpload } from '@mui/icons-material'; import { useAlert } from 'react-alert'; -import FileInputForm from '../../form/FileInputForm'; import FileInputForms from '../../form/FileInputForms'; +import * as React from 'react'; const toDate = new Date(); @@ -38,13 +30,22 @@ const SaveResidentDataForm = ({ isDisabled = true, handleModalSave }) => { const [scCdate, setScCdate] = useState(); const [scJbtime, setScJbtime] = useState(); - const [scPicad, setScPcad] = useState([]); - - const [selectedImgFile, setSelectedImgFile] = useState(''); - const [selectedFile, setSelectedFile] = useState(''); + const [picads, setPicads] = useState([]); + const [frecads, setFrecads] = useState([]); const onSave = () => { - handleModalSave({}); + const scPicadFiles = Object.values(picads); + const scFrecadFiles = Object.values(frecads); + // for (const [k, v] of Object.entries(scPicad)) { + // scPicadFiles.push(v); + // } + console.log(scPicadFiles, scFrecadFiles); + + // for(let i=0 of scPicad) { + // console.log(picad); + // return picad; + // }); + // handleModalSave({}); }; useEffect(() => { @@ -61,14 +62,38 @@ const SaveResidentDataForm = ({ isDisabled = true, handleModalSave }) => { }, []); const handleChangeFile = (e) => { - // eslint-disable-next-line no-debugger - // debugger; - // console.log(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; + }); + // let isNew = true; + // scPicad.map((picad) => { + // if (picad.name === fileArrKey) { + // isNew = false; + // return { ...picad, value: 'kk' }; + // } + // return { ...picad }; + // }); + // if (isNew) { + // setScPicad([...scPicad, { name: fileArrKey, value: '1111' }]); + // } else { + // setScPicad([scPicad]); + // } + } - const idx = Number(e.target.dataset.index) + 1; - setScPcad([...scPicad, e.target.files[0]]); // setScPcad([...scPicad, {`[${e.target.name}]${idx}`: e.target.files[0] }); - console.log(scPicad); + console.log(picads); // console.log(e); // setSelectedFile(e.target.files[0].name); @@ -90,6 +115,7 @@ const SaveResidentDataForm = ({ isDisabled = true, handleModalSave }) => { fullWidth value={scCarnum} onValueChange={(values) => setScCarnum(values.value)} + autoFocus /> @@ -164,20 +190,37 @@ const SaveResidentDataForm = ({ isDisabled = true, handleModalSave }) => { - + setScCarnum(values.value)} + onValueChange={(values) => setZippost1(values.value)} + InputProps={{ + display: 'none', + readOnly: true, + endAdornment: ( + + + + ) + }} /> - setScJuso(values.value)} /> + setScJuso(values.value)} + InputProps={{ readOnly: true }} + /> - + setScBunji(values.value)} /> @@ -187,9 +230,9 @@ const SaveResidentDataForm = ({ isDisabled = true, handleModalSave }) => { { { + + + + + + + + + + + + + + diff --git a/src/views/form/FileInputForm.jsx b/src/views/form/FileInputForm.jsx index 7364640..afa6dd1 100644 --- a/src/views/form/FileInputForm.jsx +++ b/src/views/form/FileInputForm.jsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { Button, Grid, TextField } from '@mui/material'; import { FileUpload } from '@mui/icons-material';