feat: 자료관리 상세 반영

main
minuk926 3 years ago
parent 1db73f0438
commit 2a6534630f

@ -9,8 +9,7 @@ import { GET_CMM_CODE_LIST, GET_FILE_DOWNLOAD } from 'commons/ApiUrl';
export async function getComboCodeList(param) {
const params = { ...param, codeGrpId: 'TRAFFIC', codeLcd: 'GANGNAM_SIMSA' };
// eslint-disable-next-line no-return-await
const res = await axios.get(GET_CMM_CODE_LIST, { params });
return res;
return await axios.get(GET_CMM_CODE_LIST, { params });
}
// TODO: 헤더에서 파일 정보 읽을 수 있도록 변경 필요
@ -23,7 +22,7 @@ export async function fileDownload(id, filename, alert) {
})
// eslint-disable-next-line consistent-return
.then((res) => {
if (res.isAxiosError) alert.show('파일을 다운로드 할 수 없습니다 [파일정보 오류]');
if (res?.isAxiosError || res?.status === 404) alert.show('파일을 다운로드 할 수 없습니다 [파일정보 오류]');
else FileSaver.saveAs(res, filename);
});
}

@ -12,9 +12,11 @@ import {
SAVE_JUDGE_TARGET_LIST,
GET_JUDGE_RESULT_LIST,
GET_PARKING_JUDGE_RESULT_LIST,
REMOVE_JUDGE
REMOVE_JUDGE,
GET_JUDGE_FILE_DOWNLOAD
} from 'commons/ApiUrl';
import { setRowId } from './common';
import FileSaver from 'file-saver';
// eslint-disable-next-line no-return-await
export async function findJudgeDatas(params) {
@ -113,3 +115,35 @@ export async function removeJudge(params) {
// eslint-disable-next-line no-return-await
return await axios.post(REMOVE_JUDGE, params);
}
export async function judgeFileDownload(params, alert) {
await axios
.get(GET_JUDGE_FILE_DOWNLOAD, {
responseType: 'blob',
params
})
// eslint-disable-next-line consistent-return
.then((res) => {
if (res?.isAxiosError || res?.status === 404) {
alert.show('파일을 다운로드 할 수 없습니다 [파일정보 오류]');
} else {
// const onChangeFile = (e) => {
// const file = e.target.files[0];
// if (file.type.includes('image')) {
// alert.show(<img alt="~~~" src={URL.createObjectURL(res.data)} style={{ margin: 'auto' }} />);
// }
// handleChangeFile(file);
// };
// FileSaver.saveAs(res, 'filename');
// eslint-disable-next-line no-lonely-if
if (res?.type.includes('image')) {
// const url = window.URL.createObjectURL(res);
alert.show(<img alt="~~~" src={URL.createObjectURL(res)} style={{ margin: 'auto' }} />);
} else {
FileSaver.saveAs(res, 'filename');
}
}
});
}

@ -33,6 +33,7 @@ export const GET_JUDGE_RESULT_LIST = '/api/v1/ctgy/judge/result';
export const GET_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target';
export const SAVE_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target';
export const REMOVE_JUDGE = '/api/v1/ctgy/judge/remove';
export const GET_JUDGE_FILE_DOWNLOAD = '/api/v1/ctgy/cmm/download/judge';
// 사용자 관리
export const GET_USER_LIST = '/api/v1/ctgy/user';

@ -36,7 +36,7 @@ const XitCmm = {
},
formatDateStr(dateStr, delimiter) {
return dateStr.substring(0, 4) + delimiter + dateStr.substring(4, 2) + delimiter + dateStr.substring(6);
return dateStr.substring(0, 4) + delimiter + dateStr.substring(4, 6) + delimiter + dateStr.substring(6);
},
/**

@ -14,7 +14,7 @@ import 'react-quill/dist/quill.snow.css';
import InputLabel from 'ui-component/extended/Form/InputLabel';
import { Delete, List, Save } from '@mui/icons-material';
import { fileDownload } from '../../../apis/common';
import { fileDownload } from 'apis/common';
import FileForm from 'views/cmm/FileForm';
const PublicBoardForm = (props) => {

@ -0,0 +1,268 @@
import { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import NumberFormat from 'react-number-format';
import { useAlert } from 'react-alert';
import _ from 'lodash';
import { Grid, TextField, MenuItem, Select, FormControl, InputLabel, InputAdornment, Divider } from '@mui/material';
import Button from '@mui/material/Button';
import { IconSearch, IconFileDownload } from '@tabler/icons';
import { judgeFileDownload } from '../../../apis/judge';
import { Delete, FileDownload, FileUpload, List } from '@mui/icons-material';
import ImageFileTextForm from '../../cmm/ImageFileTextForm';
// const toDate = new Date();
const ModifyJudgeDataForm = ({ rowData, handleModalSave, setOpen, contDocs, ingbs }) => {
const showAlert = useAlert();
const [selectedContDoc, setSelectedContDoc] = useState(rowData.scContDoc);
const [selectedIngb, setSelectedIngb] = useState(rowData.scIngb);
const onModify = () => {};
const onList = () => {
setOpen(false);
};
const onRemove = () => {
handleModalSave('DELETE', rowData.scCode);
};
const viewImg = (methodName) => {
judgeFileDownload(
{
scDatagb: rowData.scDatagb,
scCode: rowData.scCode,
methodName
},
showAlert
);
};
return (
<>
<Grid mt={2}>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid item sm={3}>
<TextField disabled required label="차량번호" size="small" fullWidth value={rowData.scCarnum} autoFocus />
</Grid>
<Grid item sm={3}>
<TextField disabled required label="성명" size="small" fullWidth value={rowData.scName} />
</Grid>
<Grid item sm={3}>
<TextField disabled required label="동명" size="small" fullWidth value={rowData.scDong} />
</Grid>
<Grid item sm={3}>
<FormControl fullWidth>
<InputLabel disabled required>
진술유형
</InputLabel>
<Select
disabled
size="small"
defaultValue="11"
value={selectedContDoc}
onChange={(e) => setSelectedContDoc(e?.target?.value)}
>
{contDocs &&
contDocs.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
disabled
size="small"
customInput={TextField}
required
label="접수일자"
format="####-##-##"
fullWidth
value={rowData.scCdate}
/>
</Grid>
<Grid item sm={3}>
<FormControl fullWidth>
<InputLabel disabled required>
접수방법
</InputLabel>
<Select disabled size="small" defaultValue="1" value={selectedIngb} onChange={(e) => setSelectedIngb(e?.target?.value)}>
{ingbs &&
ingbs.map((ingb) => (
<MenuItem key={ingb.code} value={ingb.code}>
{ingb.value}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
<Grid item sm={3}>
<NumberFormat
disabled
size="small"
customInput={TextField}
required
label="위반일자"
format="####-##-##"
fullWidth
value={rowData.scWdate}
/>
</Grid>
<Grid item sm={3}>
<NumberFormat
disabled
size="small"
customInput={TextField}
required
label="위반시간"
format="##:##"
fullWidth
value={rowData.scJbtime}
/>
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid item sm={6}>
<TextField disabled size="small" required label="위반장소" fullWidth value={rowData.scPos} />
</Grid>
<Grid item sm={3}>
<TextField disabled size="small" required label="전송상태" fullWidth value={rowData.scTransferNm} />
</Grid>
<Grid item sm={3}>
<TextField disabled size="small" required label="자료상태" fullWidth value={rowData.scStateNm} />
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid item sm={1.7}>
<TextField
disabled
size="small"
fullWidth
required
label="우편번호"
value={rowData.zippost1}
InputProps={{
display: 'none',
readOnly: true,
endAdornment: (
<InputAdornment position="end">
<IconSearch stroke={1.5} size="1rem" cursor="pointer" />
</InputAdornment>
)
}}
/>
</Grid>
<Grid item sm={7}>
<TextField disabled size="small" required label="주소" fullWidth value={rowData.scJuso} />
</Grid>
<Grid item sm={3.3}>
<TextField disabled size="small" required label="번지" fullWidth value={rowData.scBunji} />
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item sm={3}>
<ImageFileTextForm labelName="단속사진1" fileName={rowData.scPicad1} handleViewImg={viewImg} methodName="getScPicad1" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="단속사진2" fileName={rowData.scPicad2} handleViewImg={viewImg} methodName="getScPicad2" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="단속사진3" fileName={rowData.scPicad3} handleViewImg={viewImg} methodName="getScPicad3" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="단속사진4" fileName={rowData.scPicad4} handleViewImg={viewImg} methodName="getScPicad4" />
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item sm={3}>
<ImageFileTextForm labelName="진술서1" fileName={rowData.scFrecad1} handleViewImg={viewImg} methodName="getScFrecad1" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="진술서2" fileName={rowData.scFrecad2} handleViewImg={viewImg} methodName="getScFrecad2" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="진술서3" fileName={rowData.scFrecad3} handleViewImg={viewImg} methodName="getScFrecad3" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="진술서4" fileName={rowData.scFrecad4} handleViewImg={viewImg} methodName="getScFrecad4" />
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
{/* {_.range(1, 9, 1).map((idx) => { */}
{/* // eslint-disable-next-line no-eval */}
{/* const fName = `rowData.scContad${idx}`; */}
{/* return ( */}
{/* <Grid item sm={3}> */}
{/* <ImageFileTextForm labelName={`첨부자료${idx}`} fileName={fName} handleViewImg={viewImg} methodName={`getScContad${idx}`} /> */}
{/* </Grid> */}
{/* ); */}
{/* })} */}
<Grid item sm={3}>
<ImageFileTextForm labelName="첨부자료1" fileName={rowData.scContad1} handleViewImg={viewImg} methodName="getScContad1" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="첨부자료2" fileName={rowData.scContad2} handleViewImg={viewImg} methodName="getScContad2" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="첨부자료3" fileName={rowData.scContad3} handleViewImg={viewImg} methodName="getScContad3" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="첨부자료4" fileName={rowData.scContad4} handleViewImg={viewImg} methodName="getScContad4" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="첨부자료5" fileName={rowData.scContad5} handleViewImg={viewImg} methodName="getScContad5" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="첨부자료6" fileName={rowData.scContad6} handleViewImg={viewImg} methodName="getScContad6" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="첨부자료7" fileName={rowData.scContad7} handleViewImg={viewImg} methodName="getScContad7" />
</Grid>
<Grid item sm={3}>
<ImageFileTextForm labelName="첨부자료8" fileName={rowData.scContad8} handleViewImg={viewImg} methodName="getScContad8" />
</Grid>
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item xs={12}>
<Divider />
</Grid>
</Grid>
<Grid item container spacing={0.5} xs={12} mt={1}>
<Grid item>
<Button variant="contained" size="small" startIcon={<List />} onClick={onList}>
목록
</Button>
</Grid>
<Grid item style={{ marginLeft: 'auto' }}>
<Button variant="contained" color="primary" size="small" onClick={onModify}>
변경하기
</Button>
</Grid>
<Grid item>
<Button variant="contained" size="small" startIcon={<Delete />} onClick={onRemove}>
삭제
</Button>
</Grid>
</Grid>
</>
);
};
ModifyJudgeDataForm.propTypes = {
rowData: PropTypes.object.isRequired,
handleModalSave: PropTypes.func.isRequired,
setOpen: PropTypes.func.isRequired
};
export default ModifyJudgeDataForm;

@ -14,7 +14,7 @@ import FileInputForms from 'views/cmm/FileInputForms';
// const toDate = new Date();
const ModifyJudgeDataForm = ({ rowData, handleModalSave }) => {
const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
const alert = useAlert();
const [scCarnum, setScCarnum] = useState(rowData.scCarnum);
@ -147,7 +147,7 @@ const ModifyJudgeDataForm = ({ rowData, handleModalSave }) => {
customInput={TextField}
required
label="접수일자"
format="########"
format="####-##-##"
fullWidth
value={scCdate}
onChange={(e) => setScCdate(e?.target?.value)}
@ -172,7 +172,7 @@ const ModifyJudgeDataForm = ({ rowData, handleModalSave }) => {
customInput={TextField}
required
label="위반일자"
format="########"
format="####-##-##"
fullWidth
value={scWdate}
onChange={(e) => setScWdate(e?.target?.value)}
@ -184,7 +184,7 @@ const ModifyJudgeDataForm = ({ rowData, handleModalSave }) => {
customInput={TextField}
required
label="위반시간"
format="####"
format="##:##"
fullWidth
value={scJbtime}
onChange={(e) => setScJbtime(e?.target?.value)}
@ -454,8 +454,8 @@ const ModifyJudgeDataForm = ({ rowData, handleModalSave }) => {
</>
);
};
ModifyJudgeDataForm.propTypes = {
JudgeDataModifyForm.propTypes = {
rowData: PropTypes.object.isRequired,
handleModalSave: PropTypes.func.isRequired
};
export default ModifyJudgeDataForm;
export default JudgeDataModifyForm;

@ -14,15 +14,15 @@ import FileInputForms from 'views/cmm/FileInputForms';
const toDate = new Date();
const NewJudgeDataForm = ({ handleModalSave }) => {
const JudgeDataNewForm = ({ handleModalSave, scDatagb, contDocs, ingbs }) => {
const alert = useAlert();
const [scCarnum, setScCarnum] = useState('');
const [scName, setScName] = useState('');
const [scDong, setScDong] = useState('');
const [scContDoc, setScContDoc] = useState();
// const [scContDoc, setScContDoc] = useState();
const [selectedContDoc, setSelectedContDoc] = useState('11');
const [scIngb, setScIngb] = useState();
// const [scIngb, setScIngb] = useState();
const [selectedIngb, setSelectedIngb] = useState('1');
const [zippost1, setZippost1] = useState(null);
const [scJuso, setScJuso] = useState('');
@ -39,14 +39,15 @@ const NewJudgeDataForm = ({ handleModalSave }) => {
const onSave = () => {
// TODO : validation check
const formData = new FormData();
formData.append('scDatagb', scDatagb);
formData.append('scCarnum', scCarnum);
formData.append('scName', scName);
formData.append('scDong', scDong);
formData.append('scContDoc', selectedContDoc);
formData.append('scCdate', scCdate);
formData.append('scCdate', scCdate ? scCdate?.replace(/-/g, '') : '');
formData.append('scIngb', selectedIngb);
formData.append('scWdate', scWdate);
formData.append('scJbtime', scJbtime);
formData.append('scWdate', scWdate ? scWdate?.replace(/-/g, '') : '');
formData.append('scJbtime', scJbtime ? scJbtime?.replace(/:/g, '') : '');
formData.append('scPos', scPos);
formData.append('zippost1', zippost1);
formData.append('scJuso', scJuso);
@ -64,21 +65,21 @@ const NewJudgeDataForm = ({ handleModalSave }) => {
formData.append('contadFiles', v);
});
handleModalSave(formData);
handleModalSave('SAVE', 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);
});
}, []);
// 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;
@ -129,9 +130,14 @@ const NewJudgeDataForm = ({ handleModalSave }) => {
<Grid item sm={3}>
<FormControl fullWidth>
<InputLabel required>진술유형</InputLabel>
<Select size="small" defaultValue={selectedContDoc} onChange={(e) => setSelectedContDoc(e?.target?.value)}>
{scContDoc &&
scContDoc.map((contDoc) => (
<Select
size="small"
defaultValue={selectedContDoc}
value={selectedContDoc}
onChange={(e) => setSelectedContDoc(e?.target?.value)}
>
{contDocs &&
contDocs.map((contDoc) => (
<MenuItem key={contDoc.code} value={contDoc.code}>
{contDoc.value}
</MenuItem>
@ -147,7 +153,7 @@ const NewJudgeDataForm = ({ handleModalSave }) => {
customInput={TextField}
required
label="접수일자"
format="########"
format="####-##-##"
fullWidth
value={scCdate}
onChange={(e) => setScCdate(e?.target?.value)}
@ -156,9 +162,9 @@ const NewJudgeDataForm = ({ handleModalSave }) => {
<Grid item sm={3}>
<FormControl fullWidth>
<InputLabel required>접수방법</InputLabel>
<Select size="small" defaultValue={selectedIngb} onChange={(e) => setSelectedIngb(e?.target?.value)}>
{scIngb &&
scIngb.map((ingb) => (
<Select size="small" defaultValue={selectedIngb} value={selectedIngb} onChange={(e) => setSelectedIngb(e?.target?.value)}>
{ingbs &&
ingbs.map((ingb) => (
<MenuItem key={ingb.code} value={ingb.code}>
{ingb.value}
</MenuItem>
@ -172,7 +178,7 @@ const NewJudgeDataForm = ({ handleModalSave }) => {
customInput={TextField}
required
label="위반일자"
format="########"
format="####-##-##"
fullWidth
value={scWdate}
onChange={(e) => setScWdate(e?.target?.value)}
@ -184,7 +190,7 @@ const NewJudgeDataForm = ({ handleModalSave }) => {
customInput={TextField}
required
label="위반시간"
format="####"
format="##:##"
fullWidth
value={scJbtime}
onChange={(e) => setScJbtime(e?.target?.value)}
@ -439,7 +445,8 @@ const NewJudgeDataForm = ({ handleModalSave }) => {
</>
);
};
NewJudgeDataForm.propTypes = {
handleModalSave: PropTypes.func.isRequired
JudgeDataNewForm.propTypes = {
handleModalSave: PropTypes.func.isRequired,
scDatagb: PropTypes.string.isRequired
};
export default NewJudgeDataForm;
export default JudgeDataNewForm;

@ -9,12 +9,19 @@ import MainCard from 'ui-component/cards/MainCard';
import MuiDataGrid from 'views/cmm/MuiDataGrid';
import CmmModal from 'views/cmm/CmmModal';
import { findJudge, findJudgeDatas, saveJudgeData } from 'apis/judge';
import NewJudgeDataForm from 'views/biz/judge/NewJudgeDataForm';
import ModifyJudgeDataForm from 'views/biz/judge/ModifyJudgeDataForm';
import JudgeDataNewForm from 'views/biz/judge/JudgeDataNewForm';
import PropTypes from 'prop-types';
import xitCmm from '../../../commons/XitCmm';
import xitCmm from 'commons/XitCmm';
import DetailJudgeDataForm from './JudgeDataDetailForm';
import { useAlert } from 'react-alert';
import { removePublicBoard, savePublicBoard } from '../../../apis/public';
import { getComboCodeList } from '../../../apis/common';
const JudgeDataReview = ({ scDatagb, menuName }) => {
const showAlert = useAlert();
const [scContDocs, setScContDocs] = useState([]);
const [scIngbs, setScIngbs] = useState([]);
const [open, setOpen] = useState(false);
const [create, setCreate] = useState(false);
// const [selectedRow, setSelectedRow] = useState({});
@ -55,8 +62,8 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
align: 'center',
width: 120,
valueFormatter: (params) => {
if (params.value == null || params.value.length < 8) return params.value;
return xitCmm.formatDateStr(params.value, '-');
if (params.value !== null || params.value.length === 8) return xitCmm.formatDateStr(params.value, '-');
return params.value;
}
},
{ headerName: '접수방법', headerAlign: 'center', field: 'scIngbNm', align: 'center' },
@ -81,9 +88,24 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
}, [rowsState.page, rowsState.pageSize, scDatagb]);
useEffect(() => {
getComboCodeList({ codeMcd: 'SC_CONT_DOC' }).then((res) => {
setScContDocs(res.data);
});
getComboCodeList({ codeMcd: 'RC_INGB' }).then((res) => {
setScIngbs(res.data);
});
search();
}, [search]);
useEffect(() => {
getComboCodeList({ codeMcd: 'SC_CONT_DOC' }).then((res) => {
setScContDocs(res.data);
});
getComboCodeList({ codeMcd: 'RC_INGB' }).then((res) => {
setScIngbs(res.data);
});
}, []);
const handleCreate = () => {
setTitle(`${menuName} 의견진술 자료 신규 등록`);
setCreate(true);
@ -101,11 +123,23 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
}
};
const handleSaveResident = (payload) => {
saveJudgeData(payload).then(() => {
const handleSaveResident = (type, payload) => {
switch (type) {
case 'SAVE':
saveJudgeData(payload).then((res) => {
if (res?.success) {
search();
setOpen(false);
} else {
showAlert.show(`${res?.data.message}`);
}
});
break;
case 'DELETE':
alert('~~~~~~삭제 구현~~~~~~');
break;
default:
}
};
return (
@ -130,8 +164,17 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
{create && <NewJudgeDataForm handleModalSave={handleSaveResident} />}
{!create && <ModifyJudgeDataForm handleModalSave={handleSaveResident} rowData={rowData} />}
{create && <JudgeDataNewForm handleModalSave={handleSaveResident} scDatagb={scDatagb} contDocs={scContDocs} ingbs={scIngbs} />}
{/* {!create && <JudgeDataModifyForm handleModalSave={handleSaveResident} rowData={rowData} />} */}
{!create && (
<DetailJudgeDataForm
handleModalSave={handleSaveResident}
rowData={rowData}
setOpen={setOpen}
contDocs={scContDocs}
ingbs={scIngbs}
/>
)}
</CmmModal>
</MainCard>
);

@ -15,7 +15,7 @@ import MuiDataGrid from 'views/cmm/MuiDataGrid';
import xitCmm from 'commons/XitCmm';
import CmmModal from 'views/cmm/CmmModal';
import SaveJudgeTargetForm from 'views/biz/judge/SaveJudgeTargetForm';
import JudgeTargetSaveForm from 'views/biz/judge/JudgeTargetSaveForm';
import NumberFormat from 'react-number-format';
import ExcelDownload from 'views/cmm/ExcelDownload';
import { findJudgeTargets, saveJudgeTargets } from 'apis/judge';
@ -213,7 +213,7 @@ const JudgeRegistReview = ({ scDatagb, menuName }) => {
selectionModel={selectionModel}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<SaveJudgeTargetForm isDisabled={selectionModel.length === 0} handleModalSave={submitResidentTargets} />
<JudgeTargetSaveForm isDisabled={selectionModel.length === 0} handleModalSave={submitResidentTargets} />
</CmmModal>
</MainCard>
);

@ -17,7 +17,7 @@ import combo from 'commons/combo_data';
const toDate = new Date();
const SaveJudgeTargetForm = ({ handleModalSave }) => {
const JudgeTargetSaveForm = ({ handleModalSave }) => {
const [msuTeam, setMsuTeam] = useState(combo.teams[0].code);
const [msSdate, setMsSdate] = useState(format(toDate, 'yyyy-MM-dd'));
const [msStartsi, setMsStartsi] = useState(getHours(toDate));
@ -172,8 +172,8 @@ const SaveJudgeTargetForm = ({ handleModalSave }) => {
</>
);
};
SaveJudgeTargetForm.propTypes = {
JudgeTargetSaveForm.propTypes = {
handleModalSave: PropTypes.func.isRequired
// isDisabled: PropTypes.bool.isRequired
};
export default SaveJudgeTargetForm;
export default JudgeTargetSaveForm;

@ -0,0 +1,37 @@
import { InputAdornment, TextField } from '@mui/material';
import { FileDownload } from '@mui/icons-material';
import PropTypes from 'prop-types';
const ImageFileTextForm = ({ labelName, fileName = '', methodName, handleViewImg }) => (
<>
{fileName && (
<TextField
disabled
size="small"
fullWidth
label={labelName}
value={fileName}
onClick={(e) => handleViewImg(methodName)}
InputProps={{
display: 'none',
endAdornment: (
<InputAdornment position="end">
<FileDownload stroke={1.5} size="1rem" cursor="pointer" />
</InputAdornment>
)
}}
/>
)}
{!fileName && (
<TextField disabled size="small" fullWidth label={labelName} value={fileName} onClick={(e) => handleViewImg(methodName)} />
)}
</>
);
ImageFileTextForm.propTypes = {
labelName: PropTypes.string.isRequired,
fileName: PropTypes.string,
methodName: PropTypes.string.isRequired,
handleViewImg: PropTypes.func.isRequired
};
export default ImageFileTextForm;
Loading…
Cancel
Save