|
|
|
@@ -185,12 +185,25 @@ const FormPanel = ({ formData }) => { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
const getFileExtension = (fileName) => { |
|
|
|
const name = (fileName || "").toLowerCase(); |
|
|
|
const dot = name.lastIndexOf("."); |
|
|
|
if (dot <= 0 || dot === name.length - 1) { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
return name.substring(dot + 1); |
|
|
|
} |
|
|
|
|
|
|
|
const isAcceptedProofReplyFile = (fileName) => { |
|
|
|
return ["pdf", "jpg", "jpeg", "png"].includes(getFileExtension(fileName)); |
|
|
|
} |
|
|
|
|
|
|
|
const readFile = (event) => { |
|
|
|
let file = event.target.files[0]; |
|
|
|
if (file) { |
|
|
|
if (!file.name.toLowerCase().substr(file.name.length - 4).includes(".pdf")) { |
|
|
|
if (!isAcceptedProofReplyFile(file.name)) { |
|
|
|
setWarningTitle(intl.formatMessage({ id: "attention" })) |
|
|
|
setWarningText(intl.formatMessage({ id: 'requireValidFileWithPdfFormat' })); |
|
|
|
setWarningText(intl.formatMessage({ id: 'requireValidFileWithProofReplyFormat' })); |
|
|
|
setIsWarningPopUp(true); |
|
|
|
document.getElementById("uploadFileBtn").value = ""; |
|
|
|
return; |
|
|
|
@@ -630,6 +643,11 @@ const FormPanel = ({ formData }) => { |
|
|
|
<FormattedMessage id="requiredUploadFix" />: |
|
|
|
</Typography> |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
<Typography variant="subtitle1" component="span" sx={{ color: 'primary.primary' }}> |
|
|
|
<FormattedMessage id="acceptProofReplyFileFormats" /> |
|
|
|
</Typography> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
<ThemeProvider theme={PNSPS_BUTTON_THEME}> |
|
|
|
@@ -660,7 +678,7 @@ const FormPanel = ({ formData }) => { |
|
|
|
id="uploadFileBtn" |
|
|
|
name="file" |
|
|
|
type="file" |
|
|
|
accept=".pdf" |
|
|
|
accept=".pdf,.jpg,.jpeg,.png,application/pdf,image/jpeg,image/png" |
|
|
|
style={{ display: 'none' }} |
|
|
|
disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)} |
|
|
|
onChange={(event) => { |
|
|
|
|