| @@ -51,6 +51,7 @@ const FormPanel = ({ formData }) => { | |||||
| const [warningTitle, setWarningTitle] = React.useState(""); | const [warningTitle, setWarningTitle] = React.useState(""); | ||||
| const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | ||||
| const [warningText, setWarningText] = React.useState(""); | const [warningText, setWarningText] = React.useState(""); | ||||
| const [isSubmitting, setIsSubmitting] = React.useState(false); | |||||
| const [isOnlyOnlinePayment, setOnlyOnlinePayment] = React.useState(); | const [isOnlyOnlinePayment, setOnlyOnlinePayment] = React.useState(); | ||||
| const [isNoPayment, setNoPayment] = React.useState(); | const [isNoPayment, setNoPayment] = React.useState(); | ||||
| @@ -87,6 +88,7 @@ const FormPanel = ({ formData }) => { | |||||
| 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 => { | onSubmit: values => { | ||||
| if (isSubmitting) return; | |||||
| if (isOverTime() && !isDummyLoggedIn()) { | if (isOverTime() && !isDummyLoggedIn()) { | ||||
| setWarningTitle(intl.formatMessage({ id: "attention" })) | setWarningTitle(intl.formatMessage({ id: "attention" })) | ||||
| setWarningText(intl.formatMessage({ id: 'MSG.proofOutOfTime' })); | setWarningText(intl.formatMessage({ id: 'MSG.proofOutOfTime' })); | ||||
| @@ -124,6 +126,7 @@ const FormPanel = ({ formData }) => { | |||||
| } | } | ||||
| } | } | ||||
| // console.log(values); | // console.log(values); | ||||
| setIsSubmitting(true); | |||||
| HttpUtils.postWithFiles({ | HttpUtils.postWithFiles({ | ||||
| url: UrlUtils.REPLY_PROOF, | url: UrlUtils.REPLY_PROOF, | ||||
| params: { | params: { | ||||
| @@ -134,8 +137,15 @@ const FormPanel = ({ formData }) => { | |||||
| }, | }, | ||||
| files: attachments ? attachments : [], | files: attachments ? attachments : [], | ||||
| onSuccess: function (responseData) { | onSuccess: function (responseData) { | ||||
| setIsSubmitting(false); | |||||
| // console.log(responseData) | // console.log(responseData) | ||||
| if (responseData.success === false) { | if (responseData.success === false) { | ||||
| if (responseData.msg) { | |||||
| setWarningTitle(intl.formatMessage({ id: "attention" })) | |||||
| setWarningText(intl.formatMessage({ id: responseData.msg })); | |||||
| setIsWarningPopUp(true); | |||||
| return; | |||||
| } | |||||
| navigate("/publicNotice/" + responseData.id); | navigate("/publicNotice/" + responseData.id); | ||||
| } else { | } else { | ||||
| if (responseData.msg) { | if (responseData.msg) { | ||||
| @@ -153,12 +163,14 @@ const FormPanel = ({ formData }) => { | |||||
| } | } | ||||
| }, | }, | ||||
| onFail: function (response) { | onFail: function (response) { | ||||
| setIsSubmitting(false); | |||||
| setWarningTitle(intl.formatMessage({ id: "attention" })) | setWarningTitle(intl.formatMessage({ id: "attention" })) | ||||
| setWarningText(intl.formatMessage({ id: 'actionFail' })); | setWarningText(intl.formatMessage({ id: 'actionFail' })); | ||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| console.log(response); | console.log(response); | ||||
| }, | }, | ||||
| onError: function (error) { | onError: function (error) { | ||||
| setIsSubmitting(false); | |||||
| setWarningTitle(intl.formatMessage({ id: "attention" })) | setWarningTitle(intl.formatMessage({ id: "attention" })) | ||||
| setWarningText(intl.formatMessage({ id: 'actionFail' })); | setWarningText(intl.formatMessage({ id: 'actionFail' })); | ||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| @@ -688,7 +700,7 @@ const FormPanel = ({ formData }) => { | |||||
| <Button | <Button | ||||
| variant="contained" | variant="contained" | ||||
| type="submit" | type="submit" | ||||
| disabled={actionValue == false && isOverReviseDeadline()} | |||||
| disabled={(actionValue == false && isOverReviseDeadline()) || isSubmitting} | |||||
| aria-label={intl.formatMessage({ id: 'submitReply' })} | aria-label={intl.formatMessage({ id: 'submitReply' })} | ||||
| sx={{ | sx={{ | ||||
| backgroundColor: '#0C489E', | backgroundColor: '#0C489E', | ||||
| @@ -696,7 +708,7 @@ const FormPanel = ({ formData }) => { | |||||
| '&:hover': { backgroundColor: '#093A7A' }, | '&:hover': { backgroundColor: '#093A7A' }, | ||||
| }} | }} | ||||
| > | > | ||||
| <FormattedMessage id="submitReply" /> | |||||
| {isSubmitting ? <FormattedMessage id="loading" /> : <FormattedMessage id="submitReply" />} | |||||
| </Button> | </Button> | ||||
| </ThemeProvider> | </ThemeProvider> | ||||
| </Grid> | </Grid> | ||||
| @@ -33,6 +33,7 @@ import {FormattedMessage, useIntl} from "react-intl"; | |||||
| const ForgotPasswordApplyForm = () => { | const ForgotPasswordApplyForm = () => { | ||||
| const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | ||||
| const [isSubmitting, setIsSubmitting] = React.useState(false); | |||||
| // const [warningText, setWarningText] = React.useState("");s | // const [warningText, setWarningText] = React.useState("");s | ||||
| // const [attachment, setAttachment] = React.useState({}); | // const [attachment, setAttachment] = React.useState({}); | ||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| @@ -59,7 +60,9 @@ const ForgotPasswordApplyForm = () => { | |||||
| username: yup.string().required(intl.formatMessage({id: 'requireUsername'})), | username: yup.string().required(intl.formatMessage({id: 'requireUsername'})), | ||||
| }), | }), | ||||
| onSubmit: values => { | onSubmit: values => { | ||||
| if (isSubmitting) return; | |||||
| // console.log(values) | // console.log(values) | ||||
| setIsSubmitting(true); | |||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: UrlUtils.POST_FORGOT_PASSWORD_EMAIL, | url: UrlUtils.POST_FORGOT_PASSWORD_EMAIL, | ||||
| params: { | params: { | ||||
| @@ -67,11 +70,13 @@ const ForgotPasswordApplyForm = () => { | |||||
| }, | }, | ||||
| // files: [attachment], | // files: [attachment], | ||||
| onSuccess: function () { | onSuccess: function () { | ||||
| setIsSubmitting(false); | |||||
| // notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') | // notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') | ||||
| navigate('/forgot/password/sent'); | navigate('/forgot/password/sent'); | ||||
| // location.reload(); | // location.reload(); | ||||
| }, | }, | ||||
| onError:function () { | |||||
| onError: function () { | |||||
| setIsSubmitting(false); | |||||
| navigate('/forgot/password/sent'); | navigate('/forgot/password/sent'); | ||||
| } | } | ||||
| }); | }); | ||||
| @@ -177,8 +182,9 @@ const ForgotPasswordApplyForm = () => { | |||||
| aria-label={intl.formatMessage({id: 'continue'})} | aria-label={intl.formatMessage({id: 'continue'})} | ||||
| variant="contained" | variant="contained" | ||||
| type="submit" | type="submit" | ||||
| disabled={isSubmitting} | |||||
| > | > | ||||
| <FormattedMessage id="continue"/> | |||||
| {isSubmitting ? <FormattedMessage id="loading"/> : <FormattedMessage id="continue"/>} | |||||
| </Button> | </Button> | ||||
| </ThemeProvider> | </ThemeProvider> | ||||
| </Grid> | </Grid> | ||||
| @@ -33,6 +33,7 @@ import {FormattedMessage, useIntl} from "react-intl"; | |||||
| const ForgotUsernameApplyForm = () => { | const ForgotUsernameApplyForm = () => { | ||||
| const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | ||||
| const [isSubmitting, setIsSubmitting] = React.useState(false); | |||||
| // const [warningText, setWarningText] = React.useState("");s | // const [warningText, setWarningText] = React.useState("");s | ||||
| // const [attachment, setAttachment] = React.useState({}); | // const [attachment, setAttachment] = React.useState({}); | ||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| @@ -61,7 +62,9 @@ const ForgotUsernameApplyForm = () => { | |||||
| emailAddress: yup.string().email(intl.formatMessage({id: 'validEmailFormat'})).max(255).required(intl.formatMessage({id: 'requireEmail'})), | emailAddress: yup.string().email(intl.formatMessage({id: 'validEmailFormat'})).max(255).required(intl.formatMessage({id: 'requireEmail'})), | ||||
| }), | }), | ||||
| onSubmit: values => { | onSubmit: values => { | ||||
| if (isSubmitting) return; | |||||
| // console.log(values) | // console.log(values) | ||||
| setIsSubmitting(true); | |||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: UrlUtils.POST_FORGOT_USERNAME_EMAIL, | url: UrlUtils.POST_FORGOT_USERNAME_EMAIL, | ||||
| params: { | params: { | ||||
| @@ -69,11 +72,13 @@ const ForgotUsernameApplyForm = () => { | |||||
| }, | }, | ||||
| // files: [attachment], | // files: [attachment], | ||||
| onSuccess: function () { | onSuccess: function () { | ||||
| setIsSubmitting(false); | |||||
| // notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') | // notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') | ||||
| navigate('/forgot/username/sent'); | navigate('/forgot/username/sent'); | ||||
| // location.reload(); | // location.reload(); | ||||
| }, | }, | ||||
| onError:function () { | |||||
| onError: function () { | |||||
| setIsSubmitting(false); | |||||
| navigate('/forgot/username/sent'); | navigate('/forgot/username/sent'); | ||||
| } | } | ||||
| }); | }); | ||||
| @@ -176,8 +181,9 @@ const ForgotUsernameApplyForm = () => { | |||||
| aria-label={intl.formatMessage({id: 'continue'})} | aria-label={intl.formatMessage({id: 'continue'})} | ||||
| variant="contained" | variant="contained" | ||||
| type="submit" | type="submit" | ||||
| disabled={isSubmitting} | |||||
| > | > | ||||
| <FormattedMessage id="continue"/> | |||||
| {isSubmitting ? <FormattedMessage id="loading"/> : <FormattedMessage id="continue"/>} | |||||
| </Button> | </Button> | ||||
| </ThemeProvider> | </ThemeProvider> | ||||
| </Grid> | </Grid> | ||||
| @@ -92,6 +92,7 @@ | |||||
| "MSG.payMsg3": "If you have multiple Public Notice applications within the Year {issueYear}, Volume {issueVolume}, Issue {issueNo} of the Gazette, you can choose to combine the payments for all the approved manuscripts within this issue in 'My Public Notice' before the payment deadline.", | "MSG.payMsg3": "If you have multiple Public Notice applications within the Year {issueYear}, Volume {issueVolume}, Issue {issueNo} of the Gazette, you can choose to combine the payments for all the approved manuscripts within this issue in 'My Public Notice' before the payment deadline.", | ||||
| "MSG.proofOutOfTime": "Proofing timed out. Please apply again.", | "MSG.proofOutOfTime": "Proofing timed out. Please apply again.", | ||||
| "MSG.proofAlreadyReplied": "This proof has already been replied to. Please refresh the page.", | |||||
| "MSG.overReviseDeadline": "Deadline for online manuscript revision is over. Please apply again as necessary.", | "MSG.overReviseDeadline": "Deadline for online manuscript revision is over. Please apply again as necessary.", | ||||
| "MSG.plzSelectPaymentMethod": "Please select payment methods", | "MSG.plzSelectPaymentMethod": "Please select payment methods", | ||||
| "MSG.plzSelectApp": "Please select application", | "MSG.plzSelectApp": "Please select application", | ||||
| @@ -128,6 +128,7 @@ | |||||
| "MSG.payMsg3": "如你在宪报期数{issueYear} 年{issueVolume} 卷, 第{issueNo} 期内有多于一个公共启事的申请,你可选择完成此期所有稿件校对确定后,于缴费限期前在「我的公共启事」内合并付款。", | "MSG.payMsg3": "如你在宪报期数{issueYear} 年{issueVolume} 卷, 第{issueNo} 期内有多于一个公共启事的申请,你可选择完成此期所有稿件校对确定后,于缴费限期前在「我的公共启事」内合并付款。", | ||||
| "MSG.proofOutOfTime": "回复逾时,请重新申请。", | "MSG.proofOutOfTime": "回复逾时,请重新申请。", | ||||
| "MSG.proofAlreadyReplied": "此校对已回复,请刷新页面。", | |||||
| "MSG.overReviseDeadline": "网上俢订稿件最后限期已过,请按情况重新申请。", | "MSG.overReviseDeadline": "网上俢订稿件最后限期已过,请按情况重新申请。", | ||||
| "MSG.plzSelectPaymentMethod": "请选择付款方式", | "MSG.plzSelectPaymentMethod": "请选择付款方式", | ||||
| "MSG.plzSelectApp": "请选择公共启事。", | "MSG.plzSelectApp": "请选择公共启事。", | ||||
| @@ -128,6 +128,7 @@ | |||||
| "MSG.payMsg3": "如你在憲報期數 {issueYear} 年 {issueVolume} 卷, 第 {issueNo} 期內有多於一個公共啟事的申請,你可選擇完成此期所有稿件校對確定後,於繳費限期前在「我的公共啟事」內合併付款。", | "MSG.payMsg3": "如你在憲報期數 {issueYear} 年 {issueVolume} 卷, 第 {issueNo} 期內有多於一個公共啟事的申請,你可選擇完成此期所有稿件校對確定後,於繳費限期前在「我的公共啟事」內合併付款。", | ||||
| "MSG.proofOutOfTime": "回覆逾時,請重新申請。", | "MSG.proofOutOfTime": "回覆逾時,請重新申請。", | ||||
| "MSG.proofAlreadyReplied": "此校對已回覆,請重新整理頁面。", | |||||
| "MSG.overReviseDeadline": "網上俢訂稿件最後限期已過,請按情況重新申請。", | "MSG.overReviseDeadline": "網上俢訂稿件最後限期已過,請按情況重新申請。", | ||||
| "MSG.plzSelectApp": "請選擇公共啟事。", | "MSG.plzSelectApp": "請選擇公共啟事。", | ||||
| "MSG.plzSelectPaymentMethod": "請選擇付款方式", | "MSG.plzSelectPaymentMethod": "請選擇付款方式", | ||||