diff --git a/src/pages/DemandNote/Create/SearchForm.js b/src/pages/DemandNote/Create/SearchForm.js
index 796b181..140e93f 100644
--- a/src/pages/DemandNote/Create/SearchForm.js
+++ b/src/pages/DemandNote/Create/SearchForm.js
@@ -13,7 +13,7 @@ import * as DateUtils from "utils/DateUtils";
import * as UrlUtils from "utils/ApiPathConst";
import * as HttpUtils from "utils/HttpUtils";
import { useNavigate } from "react-router-dom";
-import { notifyDownloadSuccess } from 'utils/CommonFunction';
+import { notifyActionError } from 'utils/CommonFunction';
import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst";
import { ThemeProvider } from "@emotion/react";
import { useIntl } from "react-intl";
@@ -118,8 +118,11 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
params: {
"dnIdList": dnIdList
},
- onSuccess: function () {
- notifyDownloadSuccess();
+ onResponse: function () {
+ // 200: browser handles save; no success toast
+ },
+ onError: function () {
+ notifyActionError(intl.formatMessage({ id: 'downloadFailed' }));
}
});
}
diff --git a/src/pages/DemandNote/Details/ApplicationDetailCard.js b/src/pages/DemandNote/Details/ApplicationDetailCard.js
index f71362d..9af9945 100644
--- a/src/pages/DemandNote/Details/ApplicationDetailCard.js
+++ b/src/pages/DemandNote/Details/ApplicationDetailCard.js
@@ -15,11 +15,12 @@ import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils";
import * as HttpUtils from "utils/HttpUtils";
import DownloadIcon from '@mui/icons-material/Download';
-import { notifyDownloadSuccess } from 'utils/CommonFunction';
+import { notifyActionError } from 'utils/CommonFunction';
+import { useIntl } from 'react-intl';
// ==============================|| DASHBOARD - DEFAULT ||============================== //
const ApplicationDetailCard = ({ data }) => {
-
+ const intl = useIntl();
const [appDetail, setAppDetails] = React.useState({});
React.useEffect(() => {
@@ -33,8 +34,11 @@ const ApplicationDetailCard = ({ data }) => {
fileId: appDetail.appFileId,
skey: appDetail.appSkey,
filename: appDetail.appFilename,
+ onResponse: function () {},
+ onError: function () {
+ notifyActionError(intl.formatMessage({ id: 'downloadFailed' }));
+ }
});
- notifyDownloadSuccess();
};
return (
diff --git a/src/pages/DemandNote/Details/DnDetailCard.js b/src/pages/DemandNote/Details/DnDetailCard.js
index e60f200..ee79a77 100644
--- a/src/pages/DemandNote/Details/DnDetailCard.js
+++ b/src/pages/DemandNote/Details/DnDetailCard.js
@@ -14,12 +14,13 @@ import Loadable from 'components/Loadable';
const MainCard = Loadable(React.lazy(() => import('components/MainCard')));
import DownloadIcon from '@mui/icons-material/Download';
-import { notifyDownloadSuccess } from 'utils/CommonFunction';
+import { notifyActionError } from 'utils/CommonFunction';
+import { useIntl } from 'react-intl';
// ==============================|| DASHBOARD - DEFAULT ||============================== //
const DnDetailCard = ({ data }) => {
-
+ const intl = useIntl();
const [dnData, setDnData] = React.useState({});
React.useEffect(() => {
@@ -33,8 +34,9 @@ const DnDetailCard = ({ data }) => {
fileId: dnData.fileId,
skey: dnData.skey,
filename: dnData.filename,
- onResponse: function () {
- notifyDownloadSuccess();
+ onResponse: function () {},
+ onError: function () {
+ notifyActionError(intl.formatMessage({ id: 'downloadFailed' }));
}
});
};
diff --git a/src/pages/DemandNote/Search/DataGrid.js b/src/pages/DemandNote/Search/DataGrid.js
index fc2afda..8e2a88e 100644
--- a/src/pages/DemandNote/Search/DataGrid.js
+++ b/src/pages/DemandNote/Search/DataGrid.js
@@ -13,7 +13,7 @@ import * as FormatUtils from "utils/FormatUtils";
import * as StatusUtils from "utils/statusUtils/DnStatus";
import { useNavigate } from "react-router-dom";
import { FiDataGrid } from "components/FiDataGrid";
-import { notifyDownloadSuccess } from 'utils/CommonFunction';
+import { notifyActionError } from 'utils/CommonFunction';
import {
DEMAND_NOTE_EXPORT,
DEMAND_NOTE_SEND,
@@ -26,10 +26,11 @@ import * as HttpUtils from "utils/HttpUtils";
import { PNSPS_BUTTON_THEME } from "themes/buttonConst";
import { ThemeProvider } from "@emotion/react";
import { isGrantedAny } from "auth/utils";
+import { useIntl } from "react-intl";
// ==============================|| EVENT TABLE ||============================== //
export default function SearchDemandNote({ applySearch, searchCriteria, applyGridOnReady }) {
-
+ const intl = useIntl();
const [isConfirmPopUp, setConfirmPopUp] = useState(false);
const [isRevokePopUp, setRevokePopUp] = useState(false);
const [isSendPopUp, setSendPopUp] = useState(false);
@@ -80,8 +81,9 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri
params: {
dnIdList: idList
},
- onSuccess: function () {
- notifyDownloadSuccess();
+ onResponse: function () {},
+ onError: function () {
+ notifyActionError(intl.formatMessage({ id: 'downloadFailed' }));
}
});
}
@@ -92,11 +94,12 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri
fileId: params.row.fileId,
skey: params.row.skey,
filename: params.row.filename,
- onResponse:()=>{
- setOnDownload(false)
+ onResponse: () => {
+ setOnDownload(false);
},
- onError:()=>{
- setOnDownload(false)
+ onError: () => {
+ setOnDownload(false);
+ notifyActionError(intl.formatMessage({ id: 'downloadFailed' }));
}
});
};
diff --git a/src/pages/Proof/Create_FromApp/ProofForm.js b/src/pages/Proof/Create_FromApp/ProofForm.js
index d9f1d2c..b67bdc8 100644
--- a/src/pages/Proof/Create_FromApp/ProofForm.js
+++ b/src/pages/Proof/Create_FromApp/ProofForm.js
@@ -170,8 +170,8 @@ const FormPanel = ({ formData }) => {
msg = "Action Failed: There is already a pending payment and proofreading record for client review."
} else if (msg === "haveProofed") {
msg = "Action Failed: An active proof is already created for this application."
- } else if (msg === "applicationNotFound") {
- msg = "Application not found."
+ } else {
+ msg = intl.formatMessage({ id: msg });
}
setWarningText(msg);
setIsWarningPopUp(true);
diff --git a/src/pages/Proof/Reply_GLD/ApplicationDetails.js b/src/pages/Proof/Reply_GLD/ApplicationDetails.js
index f3c1f51..c241b75 100644
--- a/src/pages/Proof/Reply_GLD/ApplicationDetails.js
+++ b/src/pages/Proof/Reply_GLD/ApplicationDetails.js
@@ -11,6 +11,7 @@ import {
} from '@mui/material';
import { useFormik } from 'formik';
+import { useIntl } from 'react-intl';
import {isGranted} from "auth/utils";
import {useState,useEffect,lazy} from "react";
import * as HttpUtils from "utils/HttpUtils"
@@ -31,10 +32,13 @@ const ApplicationDetailCard = ({
}) => {
const params = useParams();
+ const intl = useIntl();
const [data, setData] = useState({});
const [cancelPopUp, setCancelPopUp] = useState(false);
const [onDownload, setOnDownload] = useState(false);
+ const [alertMsg, setAlertMsg] = useState('');
+ const [showAlert, setShowAlert] = useState(false);
useEffect(() => {
if (formData) {
@@ -97,8 +101,14 @@ const ApplicationDetailCard = ({
setCancelPopUp(false);
HttpUtils.get({
url: UrlUtils.CANCEL_PROOF + "/" + params.id,
- onSuccess: function () {
- window.location.reload(false);
+ onSuccess: function (responseData) {
+ if (responseData && responseData.success === false) {
+ const msg = responseData.msg ? intl.formatMessage({ id: responseData.msg }) : intl.formatMessage({ id: 'proofAlreadyCancelled' });
+ setAlertMsg(msg);
+ setShowAlert(true);
+ } else {
+ window.location.reload(false);
+ }
}
});
}
@@ -189,7 +199,7 @@ const ApplicationDetailCard = ({
- {StatusUtils.getStatusByText(data.appStatus)}
+ {StatusUtils.getStatusByTextEng(data.appStatus, data.creditor)}
@@ -349,6 +359,15 @@ const ApplicationDetailCard = ({
+
diff --git a/src/pages/Proof/Reply_Public/ProofForm.js b/src/pages/Proof/Reply_Public/ProofForm.js
index 2d9511c..b52bf77 100644
--- a/src/pages/Proof/Reply_Public/ProofForm.js
+++ b/src/pages/Proof/Reply_Public/ProofForm.js
@@ -166,14 +166,16 @@ const FormPanel = ({ formData }) => {
onFail: function (response) {
setIsSubmitting(false);
setWarningTitle(intl.formatMessage({ id: "attention" }))
- setWarningText(intl.formatMessage({ id: 'actionFail' }));
+ const msg = response?.data?.msg ? intl.formatMessage({ id: response.data.msg }) : intl.formatMessage({ id: 'actionFail' });
+ setWarningText(msg);
setIsWarningPopUp(true);
console.log(response);
},
onError: function (error) {
setIsSubmitting(false);
setWarningTitle(intl.formatMessage({ id: "attention" }))
- setWarningText(intl.formatMessage({ id: 'actionFail' }));
+ const msg = error?.response?.data?.msg ? intl.formatMessage({ id: error.response.data.msg }) : intl.formatMessage({ id: 'actionFail' });
+ setWarningText(msg);
setIsWarningPopUp(true);
console.log(error);
}
diff --git a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js
index 931ec83..d831392 100644
--- a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js
+++ b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js
@@ -33,9 +33,9 @@ import CloseIcon from '@mui/icons-material/Close';
import EditNoteIcon from '@mui/icons-material/EditNote';
import DownloadIcon from '@mui/icons-material/Download';
import ReplayIcon from '@mui/icons-material/Replay';
-import { notifyDownloadSuccess } from 'utils/CommonFunction';
+import { notifyActionError } from 'utils/CommonFunction';
import { isGrantedAny } from "auth/utils";
-// import { useIntl } from "react-intl";
+import { useIntl } from "react-intl";
// ==============================|| DASHBOARD - DEFAULT ||============================== //
const ApplicationDetailCard = (
@@ -59,13 +59,15 @@ const ApplicationDetailCard = (
const [mode, setMode] = useState("");
const { register, handleSubmit } = useForm()
- // const intl = useIntl();
+ const intl = useIntl();
const [isWarningPopUp, setIsWarningPopUp] = useState(false);
const [warningText, setWarningText] = useState("");
const [remarksPopUp, setRemarksPopUp] = useState(false);
const [onDownload, setOnDownload] = useState(false);
+ // eslint-disable-next-line no-unused-vars -- isProofCheckLoading in onProofClick + Button disabled; setIsProofCheckLoading in onProofClick callbacks
+ const [isProofCheckLoading, setIsProofCheckLoading] = useState(false);
useEffect(() => {
//if user data from parent are not null
@@ -125,12 +127,12 @@ const ApplicationDetailCard = (
fileId: fileDetail?.id,
skey: fileDetail?.skey,
filename: fileDetail?.filename,
- onResponse:()=>{
- setOnDownload(false)
- notifyDownloadSuccess()
+ onResponse: () => {
+ setOnDownload(false);
},
- onError:()=>{
- setOnDownload(false)
+ onError: () => {
+ setOnDownload(false);
+ notifyActionError(intl.formatMessage({ id: 'downloadFailed' }));
}
});
setUploadStatus(true)
@@ -178,10 +180,13 @@ const ApplicationDetailCard = (
};
const onProofClick = () => {
+ if (isProofCheckLoading) return;
if (applicationDetailData.data.groupNo) {
+ setIsProofCheckLoading(true);
HttpUtils.get({
url: CHECK_CREATE_PROOF + "/" + currentApplicationDetailData.id,
onSuccess: function (responeData) {
+ setIsProofCheckLoading(false);
if (responeData.success == true) {
window.open("/proof/create/" + currentApplicationDetailData.id, "_blank", "noreferrer");
window.addEventListener("focus", onFocus)
@@ -191,13 +196,15 @@ const ApplicationDetailCard = (
msg = "Action Failed: There is already a pending payment and proofreading record for client review."
} else if (msg === "haveProofed") {
msg = "Action Failed: An active proof is already created for this application."
- } else if (msg === "applicationNotFound") {
- msg = "Application not found."
+ } else {
+ msg = intl.formatMessage({ id: msg });
}
setWarningText(msg);
setIsWarningPopUp(true);
}
- }
+ },
+ onFail: () => setIsProofCheckLoading(false),
+ onError: () => setIsProofCheckLoading(false)
});
} else {
setWarningText("Please generate Gazette Code before Create Proof.");
@@ -258,6 +265,7 @@ const ApplicationDetailCard = (