|
|
@@ -54,25 +54,25 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { |
|
|
|
enableReinitialize: true, |
|
|
|
initialValues: loadedData, |
|
|
|
validationSchema: yup.object().shape({ |
|
|
|
contactPerson: yup.string().max(40, "不得超過 40 個字符").required(intl.formatMessage({id: 'requireContactPerson'})), |
|
|
|
contactPerson: yup.string().max(40, intl.formatMessage({id: 'noMoreThen40Words'})).required(intl.formatMessage({id: 'requireContactPerson'})), |
|
|
|
tel_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})).required(intl.formatMessage({id: 'requireDialingCode'})), |
|
|
|
fax_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})), |
|
|
|
phoneNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).required(intl.formatMessage({id: 'requireContactNumber'})), |
|
|
|
faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})), |
|
|
|
remarks: yup.string().max(255, "不得超過 255 個字符").nullable(), |
|
|
|
remarks: yup.string().max(255,intl.formatMessage({id: 'noMoreThen255Words'})).nullable(), |
|
|
|
}), |
|
|
|
onSubmit: values => { |
|
|
|
if (!values.issueId) { |
|
|
|
setWarningText("請選擇目標期數"); |
|
|
|
setWarningText(intl.formatMessage({id: 'requireTargetVol'})); |
|
|
|
setIsWarningPopUp(true); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!attachment) { |
|
|
|
setWarningText("請選擇上傳檔案"); |
|
|
|
setWarningText(intl.formatMessage({id: 'requireFile'})); |
|
|
|
setIsWarningPopUp(true); |
|
|
|
return; |
|
|
|
} else if (!attachment.size || attachment.size <= 0) { |
|
|
|
setWarningText("請上傳有效檔案"); |
|
|
|
setWarningText(intl.formatMessage({id: 'requireValidFile'})); |
|
|
|
setIsWarningPopUp(true); |
|
|
|
return; |
|
|
|
} else if (attachment.size >= (10 * 1024 * 1034)) { |
|
|
@@ -99,7 +99,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { |
|
|
|
}, |
|
|
|
files: [attachment], |
|
|
|
onSuccess: function () { |
|
|
|
notifyActionSuccess('申請提交成功!') |
|
|
|
notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') |
|
|
|
navigate("/publicNotice"); |
|
|
|
// location.reload(); |
|
|
|
} |
|
|
@@ -117,7 +117,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { |
|
|
|
) { |
|
|
|
setAttachment(event.target.files[0]); |
|
|
|
} else { |
|
|
|
setWarningText("請上傳有效檔案 (檔案格式: .doc, .docx, .xls, .xlsx)"); |
|
|
|
setWarningText(intl.formatMessage({id: 'requireValidFileWithFormat'})); |
|
|
|
setIsWarningPopUp(true); |
|
|
|
setAttachment({}); |
|
|
|
document.getElementById("uploadFileBtn").value = ""; |
|
|
@@ -184,7 +184,9 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { |
|
|
|
<Grid container alignItems={"center"}> |
|
|
|
<Grid item xs={12} md={3} lg={3} |
|
|
|
sx={{ display: 'flex', alignItems: 'center' }}> |
|
|
|
<Typography variant="h5">目標期數:</Typography> |
|
|
|
<Typography variant="h5"> |
|
|
|
<FormattedMessage id="targetVol" />: |
|
|
|
</Typography> |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} md={9} lg={6}> |
|
|
|
<RadioGroup |
|
|
@@ -209,7 +211,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { |
|
|
|
<Grid item xs={12} md={3} lg={3} |
|
|
|
sx={{ display: 'flex', alignItems: 'center' }}> |
|
|
|
<Typography variant="h5"> |
|
|
|
<FormattedMessage id="draftFile"/> ({"檔案大小應<10MB"}): |
|
|
|
<FormattedMessage id="draftFile"/> ({intl.formatMessage({id: 'fileSizeWarning'})}): |
|
|
|
</Typography> |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} md={6} lg={6} sx={{ wordBreak: 'break-word' }}> |
|
|
@@ -231,7 +233,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { |
|
|
|
component="span" |
|
|
|
variant="outlined" |
|
|
|
size="large" |
|
|
|
>{attachment ? "上傳檔案" : "重新上傳"}</Button> |
|
|
|
>{attachment ? intl.formatMessage({id: 'uploadFileBtn'}) : intl.formatMessage({id: 'reUpload'})}</Button> |
|
|
|
</label> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|