Bläddra i källkod

update public proof

master
Anna Ho 1 år sedan
förälder
incheckning
3c9d846ec1
4 ändrade filer med 97 tillägg och 74 borttagningar
  1. +94
    -74
      src/pages/Proof/Reply_Public/ProofForm.js
  2. +1
    -0
      src/translations/en.json
  3. +1
    -0
      src/translations/zh-CN.json
  4. +1
    -0
      src/translations/zh-HK.json

+ 94
- 74
src/pages/Proof/Reply_Public/ProofForm.js Visa fil

@@ -22,9 +22,9 @@ import { useNavigate } from "react-router-dom";
import * as DateUtils from "utils/DateUtils"
import Loadable from 'components/Loadable';
import { notifyActionSuccess } from 'utils/CommonFunction';
import {PNSPS_BUTTON_THEME} from "themes/buttonConst";
import {ThemeProvider} from "@emotion/react";
import {FormattedMessage, useIntl} from "react-intl";
import { PNSPS_BUTTON_THEME } from "themes/buttonConst";
import { ThemeProvider } from "@emotion/react";
import { FormattedMessage, useIntl } from "react-intl";
const UploadFileTable = Loadable(React.lazy(() => import('./UploadFileTable')));
//import * as ProofStatus from "utils/statusUtils/ProofStatus";

@@ -55,22 +55,28 @@ const FormPanel = ({ formData }) => {
enableReinitialize: true,
initialValues: data,
validationSchema: yup.object().shape({
vaild: yup.string().max(255, intl.formatMessage({id: 'requireLoginPassword'})).required(intl.formatMessage({id: 'requireLoginPassword'})),
vaild: yup.string().max(255, intl.formatMessage({ id: 'requireLoginPassword' })).required(intl.formatMessage({ id: 'requireLoginPassword' })),
}),
onSubmit: values => {
if (isOverTime()) {
setWarningText(intl.formatMessage({ id: 'MSG.proofOutOfTime' }));
setIsWarningPopUp(true);
return;
}

if (actionValue == false && isOverReviseDeadline()) {
setWarningText(intl.formatMessage({ id: 'MSG.overReviseDeadline' }));
setIsWarningPopUp(true);
return;
}

if (!actionValue) {
if (!attachments || attachments.length <= 0) {
setWarningText(intl.formatMessage({id: 'requireFile'}));
setWarningText(intl.formatMessage({ id: 'requireFile' }));
setIsWarningPopUp(true);
return;
}
}

if (isOverTime()) {
setWarningText(intl.formatMessage({id: 'MSG.proofOutOfTime'}));
setIsWarningPopUp(true);
return;
}
// console.log(values);
HttpUtils.postWithFiles({
url: UrlUtils.REPLY_PROOF,
@@ -81,8 +87,8 @@ const FormPanel = ({ formData }) => {
},
files: attachments ? attachments : [],
onSuccess: function (responseData) {
if(responseData.msg){
setWarningText(intl.formatMessage({id: 'MSG.proofOutOfTime'}));
if (responseData.msg) {
setWarningText(intl.formatMessage({ id: 'MSG.proofOutOfTime' }));
setIsWarningPopUp(true);
return;
}
@@ -94,12 +100,12 @@ const FormPanel = ({ formData }) => {
}
},
onFail: function (response) {
setWarningText(intl.formatMessage({id: 'actionFail'}));
setWarningText(intl.formatMessage({ id: 'actionFail' }));
setIsWarningPopUp(true);
console.log(response);
},
onError: function (error) {
setWarningText(intl.formatMessage({id: 'actionFail'}));
setWarningText(intl.formatMessage({ id: 'actionFail' }));
setIsWarningPopUp(true);
console.log(error);
}
@@ -111,13 +117,13 @@ const FormPanel = ({ formData }) => {
let file = event.target.files[0];
if (file) {
if (!file.name.toLowerCase().substr(file.name.length - 4).includes(".pdf")) {
setWarningText(intl.formatMessage({id: 'requireValidFileWithPdfFormat'}));
setWarningText(intl.formatMessage({ id: 'requireValidFileWithPdfFormat' }));
setIsWarningPopUp(true);
document.getElementById("uploadFileBtn").value = "";
return;
}
if (file.size >= (10 * 1024 * 1034)) {
setWarningText(intl.formatMessage({id: 'fileSizeWarning'}));
setWarningText(intl.formatMessage({ id: 'fileSizeWarning' }));
setIsWarningPopUp(true);
return;
}
@@ -132,6 +138,13 @@ const FormPanel = ({ formData }) => {
}

const isOverTime = () => {
let proofPaymentDeadline = DateUtils.convertToDate(formik.values?.proofPaymentDeadline);
if (!proofPaymentDeadline) return true;
let current = new Date();
return current.getTime() > proofPaymentDeadline;
}

const isOverReviseDeadline = () => {
let reviseDeadline = DateUtils.convertToDate(formik.values?.reviseDeadline);
if (!reviseDeadline) return true;
let current = new Date();
@@ -146,7 +159,7 @@ const FormPanel = ({ formData }) => {
content={false}>

<Typography variant="h4" sx={{ textAlign: "left", mb: 2, borderBottom: "1px solid black" }}>
<FormattedMessage id="publicNoticePaymentProofComment"/>
<FormattedMessage id="publicNoticePaymentProofComment" />
</Typography>

<form onSubmit={formik.handleSubmit}>
@@ -168,13 +181,13 @@ const FormPanel = ({ formData }) => {
<Grid item xs={12} md={12} textAlign="left">
<Typography variant="h5">
<FormattedMessage id="proofReply" /> : {formik.values.action ?
(<span style={{ color: 'green' }}>
<FormattedMessage id="proofErrorFree" />
</span>)
:
(<span style={{ color: 'red' }}>
<FormattedMessage id="proofWithError" />
</span>)}
(<span style={{ color: 'green' }}>
<FormattedMessage id="proofErrorFree" />
</span>)
:
(<span style={{ color: 'red' }}>
<FormattedMessage id="proofWithError" />
</span>)}
</Typography>
</Grid>
{/* <Grid item xs={12} md={12} textAlign="left">
@@ -194,7 +207,7 @@ const FormPanel = ({ formData }) => {
formik.values.action ?
null
:
<Grid item xs={12} md={12} textAlign="left" sx={{ width:'95%', maxWidth: {xs:'70vw', sm:'72vw', md:'75vw',lg:'80vw'}}}>
<Grid item xs={12} md={12} textAlign="left" sx={{ width: '95%', maxWidth: { xs: '70vw', sm: '72vw', md: '75vw', lg: '80vw' } }}>
<FileList
lang="ch"
refId={params.id}
@@ -231,8 +244,8 @@ const FormPanel = ({ formData }) => {
setActionValue(event.target.value === "true" ? true : false);
}}
>
<FormControlLabel value={true} control={<Radio />} label={intl.formatMessage({id: 'proofErrorFree'})} />
<FormControlLabel value={false} control={<Radio />} label={intl.formatMessage({id: 'proofWithError'})} />
<FormControlLabel value={true} control={<Radio />} label={intl.formatMessage({ id: 'proofErrorFree' })} />
<FormControlLabel value={false} control={<Radio />} label={intl.formatMessage({ id: 'proofWithError' })} />
</RadioGroup>
</Grid>

@@ -241,45 +254,52 @@ const FormPanel = ({ formData }) => {
actionValue ?
null
:
<>
isOverReviseDeadline() ?
<Grid item xs={12} md={12} textAlign="left">
<Typography variant="h5">
<FormattedMessage id="requiredUploadFix" />:
<Typography variant="h5" style={{color:"red"}}>
<FormattedMessage id="MSG.overReviseDeadline" />
</Typography>
</Grid>

<Grid item xs={12} md={12} textAlign="left">
<input
id="uploadFileBtn"
name="file"
type="file"
accept=".pdf"
style={{ display: 'none' }}
disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)}
onChange={(event) => {
readFile(event)
}}
/>
<label htmlFor="uploadFileBtn">
<ThemeProvider theme={PNSPS_BUTTON_THEME}>
<Button
color="save"
component="span"
variant="contained"
aria-label={intl.formatMessage({id: 'upload'})}
:
<>
<Grid item xs={12} md={12} textAlign="left">
<Typography variant="h5">
<FormattedMessage id="requiredUploadFix" />:
</Typography>
</Grid>

<Grid item xs={12} md={12} textAlign="left">
<input
id="uploadFileBtn"
name="file"
type="file"
accept=".pdf"
style={{ display: 'none' }}
disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)}
>
<FormattedMessage id="upload" />
</Button>
</ThemeProvider>
</label>
</Grid>


<Grid item xs={12} sm={12} md={12} lg={12} textAlign="left" sx={{ width:'95%', maxWidth: {xs:'70vw', sm:'72vw', md:'75vw',lg:'80vw'}}} >
<UploadFileTable key="uploadTable" recordList={attachments} setRecordList={setAttachments} />
</Grid>
</>
onChange={(event) => {
readFile(event)
}}
/>
<label htmlFor="uploadFileBtn">
<ThemeProvider theme={PNSPS_BUTTON_THEME}>
<Button
color="save"
component="span"
variant="contained"
aria-label={intl.formatMessage({ id: 'upload' })}
disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)}
>
<FormattedMessage id="upload" />
</Button>
</ThemeProvider>
</label>
</Grid>


<Grid item xs={12} sm={12} md={12} lg={12} textAlign="left" sx={{ width: '95%', maxWidth: { xs: '70vw', sm: '72vw', md: '75vw', lg: '80vw' } }} >
<UploadFileTable key="uploadTable" recordList={attachments} setRecordList={setAttachments} />
</Grid>
</>
}

<Grid item xs={12} sm={12} md={12} lg={12}>
@@ -297,7 +317,7 @@ const FormPanel = ({ formData }) => {
variant="outlined"
error={Boolean(formik.errors["vaild"])}
helperText={formik.errors["vaild"] ? formik.errors["vaild"] : ' '}
placeholder={intl.formatMessage({id: 'requireLoginPassword'})}
placeholder={intl.formatMessage({ id: 'requireLoginPassword' })}
sx={
{
"& .MuiInputBase-input.Mui-disabled": {
@@ -315,14 +335,14 @@ const FormPanel = ({ formData }) => {

<Grid item xs={12} md={12} textAlign="left">
<ThemeProvider theme={PNSPS_BUTTON_THEME}>
<Button
variant="contained"
color="success"
type="submit"
aria-label={intl.formatMessage({id: 'submitReply'})}
>
<FormattedMessage id="submitReply" />
</Button>
<Button
variant="contained"
color="success"
type="submit"
aria-label={intl.formatMessage({ id: 'submitReply' })}
>
<FormattedMessage id="submitReply" />
</Button>
</ThemeProvider>
</Grid>

@@ -349,14 +369,14 @@ const FormPanel = ({ formData }) => {
}}
>
<DialogTitle>
<FormattedMessage id="attention"/>
<FormattedMessage id="attention" />
</DialogTitle>
<DialogContent style={{ display: 'flex', }}>
<Typography variant="h3" style={{ padding: '16px' }}>{warningText}</Typography>
</DialogContent>
<DialogActions>
<Button
aria-label={intl.formatMessage({id: 'ok'})}
aria-label={intl.formatMessage({ id: 'ok' })}
onClick={() => setIsWarningPopUp(false)}
>
OK


+ 1
- 0
src/translations/en.json Visa fil

@@ -68,6 +68,7 @@
"MSG.payMsg3": "If you have multiple Public Notice applications within the Year {issueYear}, Volume {issueVolume}, Issue {issueNo} of the Official Gazette, you can choose to merge the payment for all the approved manuscripts within this issue in 'My Public Notice' before the payment deadline.",

"MSG.proofOutOfTime": "Response out of time, please apply again.",
"MSG.overReviseDeadline": "Over Revise Deadline",
"MSG.plzSelectApp": "Please select application",
"MSG.actionFail": "Action failed",
"MSG.paymentHolded": "Application number {appNo} is currently in the process of payment. If the payment is unsuccessful, please try again after 20 minutes. We apologise for any inconvenience caused.",


+ 1
- 0
src/translations/zh-CN.json Visa fil

@@ -67,6 +67,7 @@
"MSG.payMsg3": "如你在宪报期数{issueYear} 年{issueVolume} 卷, 第{issueNo} 期内有多于一个公共启事的申请,你可选择完成所有此期所有稿件校对确定后,于缴费期限前在「我的公共启事」内合并付款。 ",

"MSG.proofOutOfTime": "回复逾时,请重新申请。",
"MSG.overReviseDeadline": "超过修改期限",
"MSG.plzSelectApp": "请选择公共启事。",
"MSG.actionFail": "行动失败",
"MSG.paymentHolded": "申请编号 {appNo} 已正在付款的流程中,如相关付款没有成功,请于20分钟后再尝试付款,不便之处,请见谅!",


+ 1
- 0
src/translations/zh-HK.json Visa fil

@@ -67,6 +67,7 @@
"MSG.payMsg3": "如你在憲報期數 {issueYear} 年 {issueVolume} 卷, 第 {issueNo} 期內有多於一個公共啟事的申請,你可選擇完成所有此期所有稿件校對確定後,於繳費期限前在「我的公共啟事」內合併付款。",

"MSG.proofOutOfTime": "回覆逾時,請重新申請。",
"MSG.overReviseDeadline": "超過修改期限",
"MSG.plzSelectApp": "請選擇公共啟事。",
"MSG.actionFail": "行動失敗",
"MSG.paymentHolded": "申請編號 {appNo} 已正在付款的流程中,如相關付款沒有成功,請於20分鐘後再嘗試付款,不便之處,請見諒!",


Laddar…
Avbryt
Spara