|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { useState } from 'react';
|
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
|
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
import NumberFormat from 'react-number-format';
|
|
|
|
@ -52,6 +52,11 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
const onSave = () => {
|
|
|
|
|
// TODO : validation check 추가
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('scCode', rowData.scCode);
|
|
|
|
|
formData.append('scSeq', rowData.scSeq);
|
|
|
|
|
formData.append('scState', rowData.scState);
|
|
|
|
|
formData.append('scTransfer', rowData.scTransfer);
|
|
|
|
|
formData.append('scDatagb', rowData.scDatagb);
|
|
|
|
|
formData.append('scCarnum', scCarnum);
|
|
|
|
|
formData.append('scName', scName);
|
|
|
|
|
formData.append('scDong', scDong);
|
|
|
|
@ -61,23 +66,44 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
formData.append('scWdate', scWdate);
|
|
|
|
|
formData.append('scJbtime', scJbtime);
|
|
|
|
|
formData.append('scPos', scPos);
|
|
|
|
|
formData.append('zipcode1', zipcode1);
|
|
|
|
|
formData.append('zipcode1', zipcode1 ? zipcode1.substring(0, 3) : '');
|
|
|
|
|
formData.append('zipcode2', zipcode1 ? zipcode1.substring(3) : '');
|
|
|
|
|
formData.append('scJuso', scJuso);
|
|
|
|
|
formData.append('scBunji', scBunji);
|
|
|
|
|
|
|
|
|
|
Object.values(picads).forEach((v) => {
|
|
|
|
|
formData.append('picadFiles', v);
|
|
|
|
|
});
|
|
|
|
|
// eslint-disable-next-line no-plusplus
|
|
|
|
|
for (let idx = 1; idx < 5; idx++) {
|
|
|
|
|
if (rowData[`scPicad${idx}`]) {
|
|
|
|
|
formData.append(`scPicad${idx}`, rowData[`scPicad${idx}`]);
|
|
|
|
|
// const file = new File();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.values(frecads).forEach((v) => {
|
|
|
|
|
formData.append('frecadFiles', v);
|
|
|
|
|
});
|
|
|
|
|
// eslint-disable-next-line no-plusplus
|
|
|
|
|
for (let idx = 1; idx < 5; idx++) {
|
|
|
|
|
if (rowData[`scFrecad${idx}`]) {
|
|
|
|
|
formData.append(`scFrecad${idx}`, rowData[`scFrecad${idx}`]);
|
|
|
|
|
// const file = new File();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.values(contads).forEach((v) => {
|
|
|
|
|
formData.append('contadFiles', v);
|
|
|
|
|
});
|
|
|
|
|
console.log(picads, frecads, contads);
|
|
|
|
|
handleModalSave(formData);
|
|
|
|
|
// eslint-disable-next-line no-plusplus
|
|
|
|
|
for (let idx = 1; idx < 9; idx++) {
|
|
|
|
|
if (rowData[`scContad${idx}`]) {
|
|
|
|
|
formData.append(`scContad${idx}`, rowData[`scContad${idx}`]);
|
|
|
|
|
// const file = new File();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
handleModalSave('SAVE', formData);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleChangeFile = (e) => {
|
|
|
|
@ -123,6 +149,16 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
setIsPostOpen(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
// eslint-disable-next-line no-plusplus
|
|
|
|
|
for (let idx = 1; idx < 5; idx++) {
|
|
|
|
|
if (rowData[`scPicad${idx}`]) {
|
|
|
|
|
console.log(rowData[`scPicad${idx}`]);
|
|
|
|
|
// const file = new File();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Grid mt={2}>
|
|
|
|
@ -274,7 +310,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
|
|
|
|
|
<Grid container spacing={1} item xs={12} mt={1}>
|
|
|
|
|
<Grid item sm={3}>
|
|
|
|
|
<FileReadInputForm
|
|
|
|
|
<FileInputForms
|
|
|
|
|
isDisabled={false}
|
|
|
|
|
fieldName="scPicad"
|
|
|
|
|
index={1}
|
|
|
|
@ -381,8 +417,9 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
<FileInputForms
|
|
|
|
|
isDisabled={false}
|
|
|
|
|
fieldName="scContad"
|
|
|
|
|
index={1}
|
|
|
|
|
labelName="첨부자료1"
|
|
|
|
|
index={1}
|
|
|
|
|
fileName={rowData.scContad1}
|
|
|
|
|
selectedFile={contads.scContad1?.name}
|
|
|
|
|
handleChangeFile={handleChangeFile}
|
|
|
|
|
alert={alert}
|
|
|
|
@ -395,6 +432,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
fieldName="scContad"
|
|
|
|
|
labelName="첨부자료2"
|
|
|
|
|
index={2}
|
|
|
|
|
fileName={rowData.scContad2}
|
|
|
|
|
selectedFile={contads.scContad2?.name}
|
|
|
|
|
handleChangeFile={handleChangeFile}
|
|
|
|
|
alert={alert}
|
|
|
|
@ -407,6 +445,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
fieldName="scContad"
|
|
|
|
|
labelName="첨부자료3"
|
|
|
|
|
index={3}
|
|
|
|
|
fileName={rowData.scContad3}
|
|
|
|
|
selectedFile={contads.scContad3?.name}
|
|
|
|
|
handleChangeFile={handleChangeFile}
|
|
|
|
|
alert={alert}
|
|
|
|
@ -418,6 +457,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
fieldName="scContad"
|
|
|
|
|
labelName="첨부자료4"
|
|
|
|
|
index={4}
|
|
|
|
|
fileName={rowData.scContad4}
|
|
|
|
|
selectedFile={contads.scContad4?.name}
|
|
|
|
|
handleChangeFile={handleChangeFile}
|
|
|
|
|
alert={alert}
|
|
|
|
@ -427,8 +467,9 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
<FileInputForms
|
|
|
|
|
isDisabled={typeof contads.scContad4 === 'undefined'}
|
|
|
|
|
fieldName="scContad"
|
|
|
|
|
index={5}
|
|
|
|
|
labelName="첨부자료5"
|
|
|
|
|
index={5}
|
|
|
|
|
fileName={rowData.scContad5}
|
|
|
|
|
selectedFile={contads.scContad5?.name}
|
|
|
|
|
handleChangeFile={handleChangeFile}
|
|
|
|
|
alert={alert}
|
|
|
|
@ -441,6 +482,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
fieldName="scContad"
|
|
|
|
|
labelName="첨부자료6"
|
|
|
|
|
index={6}
|
|
|
|
|
fileName={rowData.scContad6}
|
|
|
|
|
selectedFile={contads.scContad6?.name}
|
|
|
|
|
handleChangeFile={handleChangeFile}
|
|
|
|
|
alert={alert}
|
|
|
|
@ -453,6 +495,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
fieldName="scContad"
|
|
|
|
|
labelName="첨부자료7"
|
|
|
|
|
index={7}
|
|
|
|
|
fileName={rowData.scContad7}
|
|
|
|
|
selectedFile={contads.scContad7?.name}
|
|
|
|
|
handleChangeFile={handleChangeFile}
|
|
|
|
|
alert={alert}
|
|
|
|
@ -464,6 +507,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
|
|
|
|
|
fieldName="scContad"
|
|
|
|
|
labelName="첨부자료8"
|
|
|
|
|
index={8}
|
|
|
|
|
fileName={rowData.scContad8}
|
|
|
|
|
selectedFile={contads.scContad8?.name}
|
|
|
|
|
handleChangeFile={handleChangeFile}
|
|
|
|
|
alert={alert}
|
|
|
|
|