Просмотр исходного кода

CR026 Item 1 support JPG PNG

CR026
Jason Chuang 2 дней назад
Родитель
Сommit
42ff4d0b65
4 измененных файлов: 27 добавлений и 3 удалений
  1. +21
    -3
      src/pages/Proof/Reply_Public/ProofForm.js
  2. +2
    -0
      src/translations/en.json
  3. +2
    -0
      src/translations/zh-CN.json
  4. +2
    -0
      src/translations/zh-HK.json

+ 21
- 3
src/pages/Proof/Reply_Public/ProofForm.js Просмотреть файл

@@ -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) => {


+ 2
- 0
src/translations/en.json Просмотреть файл

@@ -44,6 +44,8 @@
"requireFile": "Please select a file to upload",
"requireValidFile": "Please upload a valid file",
"requireValidFileWithPdfFormat": "Please upload a valid file (file format: .pdf)",
"requireValidFileWithProofReplyFormat": "Please upload a valid file (file format: .pdf, .jpg, .jpeg, .png)",
"acceptProofReplyFileFormats": "Accept file formats: pdf, jpg, jpeg and png.",
"requireValidFileWithFormat": "Please upload a valid file (file format: .doc, .docx, .xls, .xlsx)",
"submissionSuccess": "Application submitted successfully",
"noMoreThen40Words": "Must not exceed 40 characters",


+ 2
- 0
src/translations/zh-CN.json Просмотреть файл

@@ -44,6 +44,8 @@
"requireFile": "请选择上传档案",
"requireValidFile": "请上传有效档案",
"requireValidFileWithPdfFormat": "请上传有效档案 (档案格式: .pdf)",
"requireValidFileWithProofReplyFormat": "请上传有效档案 (档案格式: .pdf, .jpg, .jpeg, .png)",
"acceptProofReplyFileFormats": "接受档案格式:pdf、jpg、jpeg 及 png。",
"requireValidFileWithFormat": "请上传有效档案 (档案格式: .doc, .docx, .xls, .xlsx)",
"submissionSuccess": "申请提交成功",
"noMoreThen40Words": "不得超过 40 个字符",


+ 2
- 0
src/translations/zh-HK.json Просмотреть файл

@@ -44,6 +44,8 @@
"requireFile": "請選擇上傳檔案",
"requireValidFile": "請上傳有效檔案",
"requireValidFileWithPdfFormat": "請上傳有效檔案 (檔案格式: .pdf)",
"requireValidFileWithProofReplyFormat": "請上傳有效檔案 (檔案格式: .pdf, .jpg, .jpeg, .png)",
"acceptProofReplyFileFormats": "接受檔案格式:pdf、jpg、jpeg 及 png。",
"requireValidFileWithFormat": "請上傳有效檔案 (檔案格式: .doc, .docx, .xls, .xlsx)",
"submissionSuccess": "申請提交成功",
"noMoreThen40Words": "不得超過 40 個字符",


Загрузка…
Отмена
Сохранить