Sfoglia il codice sorgente

Add success msg

master
cyril.tsui 1 anno fa
parent
commit
96d4b3b729
19 ha cambiato i file con 335 aggiunte e 9143 eliminazioni
  1. +182
    -9114
      package-lock.json
  2. +1
    -0
      package.json
  3. +3
    -0
      src/App.js
  4. +2
    -0
      src/pages/OrganizationDetailPage/OrganizationCard.js
  5. +2
    -0
      src/pages/OrganizationDetailPage_FromUser/OrganizationCard_loadFromUser.js
  6. +2
    -0
      src/pages/Proof/Create_FromApp/ProofForm.js
  7. +3
    -0
      src/pages/Proof/Reply_Public/ProofForm.js
  8. +2
    -0
      src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js
  9. +2
    -0
      src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js
  10. +5
    -0
      src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js
  11. +0
    -1
      src/pages/PublicNotice/Details_GLD/StatusChangeDialog.js
  12. +15
    -5
      src/pages/PublicNotice/Details_GLD/index.js
  13. +5
    -3
      src/pages/User/DetailPage/index.js
  14. +5
    -0
      src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js
  15. +5
    -0
      src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js
  16. +4
    -4
      src/pages/User/DetailsPage_Organization/index.js
  17. +1
    -1
      src/pages/authentication/auth-forms/AuthLogin.js
  18. +4
    -3
      src/pages/pnspsUserGroupDetailPage/index.js
  19. +92
    -12
      src/utils/CommonFunction.js

+ 182
- 9114
package-lock.json
File diff soppresso perché troppo grande
Vedi File


+ 1
- 0
package.json Vedi File

@@ -48,6 +48,7 @@
"react-scripts": "^5.0.1",
"react-syntax-highlighter": "^15.5.0",
"react-to-print": "^2.14.13",
"react-toastify": "^9.1.3",
"react-window": "^1.8.7",
"redux": "^4.2.0",
"simplebar": "^5.3.8",


+ 3
- 0
src/App.js Vedi File

@@ -2,6 +2,8 @@
import Routes from 'routes';
import ThemeCustomization from 'themes';
import ScrollTop from 'components/ScrollTop';
import {ToastContainer} from "react-toastify";
import 'react-toastify/dist/ReactToastify.css';
//import {isUserLoggedIn} from 'utils/Utils';
//import {DefaultRoute} from 'routes/index'
// ==============================|| APP - THEME, ROUTER, LOCAL ||============================== //
@@ -12,6 +14,7 @@ const App = () => (
<Routes>
</Routes>
</ScrollTop>
<ToastContainer/>
</ThemeCustomization>
);



+ 2
- 0
src/pages/OrganizationDetailPage/OrganizationCard.js Vedi File

@@ -15,6 +15,7 @@ import * as ComboData from "../../utils/ComboData";
const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent')));
import Loadable from 'components/Loadable';
import { lazy } from 'react';
import { notifySaveSuccess } from 'utils/CommonFunction';

// ==============================|| DASHBOARD - DEFAULT ||============================== //

@@ -83,6 +84,7 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => {
creditor: vaule.creditor,
},
onSuccess: function () {
notifySaveSuccess()
loadDataFun();
setEditMode(false);
}


+ 2
- 0
src/pages/OrganizationDetailPage_FromUser/OrganizationCard_loadFromUser.js Vedi File

@@ -15,6 +15,7 @@ import { useFormik } from 'formik';
const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent')));
import Loadable from 'components/Loadable';
import { lazy } from 'react';
import { notifyCreateSuccess } from 'utils/CommonFunction';

// ==============================|| DASHBOARD - DEFAULT ||============================== //

@@ -81,6 +82,7 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => {
},
onSuccess: function (responseData) {
navigate('/org/' + responseData.id);
notifyCreateSuccess()
}
});
}


+ 2
- 0
src/pages/Proof/Create_FromApp/ProofForm.js Vedi File

@@ -18,6 +18,7 @@ import * as React from "react";
import { useFormik } from 'formik';
import { useNavigate } from "react-router-dom";
import Loadable from 'components/Loadable';
import { notifySaveSuccess } from 'utils/CommonFunction';
const UploadFileTable = Loadable(React.lazy(() => import('./UploadFileTable')));
// ==============================|| DASHBOARD - DEFAULT ||============================== //

@@ -118,6 +119,7 @@ const FormPanel = ({ formData }) => {
},
files: attachments,
onSuccess: function () {
notifySaveSuccess()
navigate("/proof/search");
}
});


+ 3
- 0
src/pages/Proof/Reply_Public/ProofForm.js Vedi File

@@ -21,6 +21,7 @@ import { useFormik } from 'formik';
import { useNavigate } from "react-router-dom";
import * as DateUtils from "utils/DateUtils"
import Loadable from 'components/Loadable';
import { notifyActionSuccess } from 'utils/CommonFunction';
const UploadFileTable = Loadable(React.lazy(() => import('./UploadFileTable')));

// ==============================|| DASHBOARD - DEFAULT ||============================== //
@@ -76,8 +77,10 @@ const FormPanel = ({ formData }) => {
files: attachments ? attachments : [],
onSuccess: function () {
if (actionValue) {
notifyActionSuccess("提交成功!")
navigate("/proof/pay/"+params.id);
} else {
notifyActionSuccess("提交成功!")
navigate("/proof/search");
}
},


+ 2
- 0
src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js Vedi File

@@ -17,6 +17,7 @@ import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'


import { useNavigate } from "react-router-dom";
import { notifyActionSuccess } from 'utils/CommonFunction';

// ==============================|| DASHBOARD - DEFAULT ||============================== //

@@ -90,6 +91,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => {
},
files: [attachment],
onSuccess: function () {
notifyActionSuccess('申請成功!')
navigate("/publicNotice");
// location.reload();
}


+ 2
- 0
src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js Vedi File

@@ -27,6 +27,7 @@ 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';

// ==============================|| DASHBOARD - DEFAULT ||============================== //
const ApplicationDetailCard = (
@@ -77,6 +78,7 @@ const ApplicationDetailCard = (
skey: fileDetail.skey,
filename: fileDetail.filename,
});
notifyDownloadSuccess()
setUploadStatus(true)
};



+ 5
- 0
src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js Vedi File

@@ -59,6 +59,7 @@ const GazetteDetailCard = (
+" No. "+applicationDetailData.gazetteIssueDetail.issueNo);
setIssueDate(DateUtils.dateFormat(applicationDetailData.gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)"));
setGazetteCode(applicationDetailData.data.groupNo)
console.log(gazetteCode)
setGroupTitle(applicationDetailData.data.groupTitle)
}
}, [applicationDetailData]);
@@ -153,6 +154,7 @@ const GazetteDetailCard = (
{
value: issueNum,
})}
value={issueNum}
id='issueNum'
sx={{
"& .MuiInputBase-input.Mui-disabled": {
@@ -181,6 +183,7 @@ const GazetteDetailCard = (
{
value: gazetteCode,
})}
value={gazetteCode}
id='gazetteCode'
sx={{
"& .MuiInputBase-input.Mui-disabled": {
@@ -212,6 +215,7 @@ const GazetteDetailCard = (
{
value: issueDate,
})}
value={issueDate}
id='issueDate'
sx={{
"& .MuiInputBase-input.Mui-disabled": {
@@ -240,6 +244,7 @@ const GazetteDetailCard = (
{
value: groupTitle,
})}
value={groupTitle}
id='groupTitle'
sx={{
"& .MuiInputBase-input.Mui-disabled": {


+ 0
- 1
src/pages/PublicNotice/Details_GLD/StatusChangeDialog.js Vedi File

@@ -23,7 +23,6 @@ import * as ComboData from "utils/ComboData";
import { useFormik, FormikProvider } from 'formik';
import * as yup from 'yup';


const StatusChangeDialog = (props) => {
const [content, setContent] = useState();
const [dialogTitle, setDialogTitle] = useState("Confirm");


+ 15
- 5
src/pages/PublicNotice/Details_GLD/index.js Vedi File

@@ -35,6 +35,7 @@ import {
} from "utils/ApiPathConst";
const StatusChangeDialog = Loadable(lazy(() => import('./StatusChangeDialog')));
import * as DateUtils from "utils/DateUtils";
import { notifyActionSuccess, notifySaveSuccess } from "utils/CommonFunction";


// ==============================|| Body - DEFAULT ||============================== //
@@ -193,7 +194,9 @@ const PublicNoticeDetail_GLD = () => {
if (response.status === 204) {
setOpen(false);
handleClose();
location.reload();
// location.reload();
loadApplicationDetail()
notifyActionSuccess("Gen Gazette Code Success!")
}
})
.catch(error => {
@@ -211,7 +214,9 @@ const PublicNoticeDetail_GLD = () => {
onSuccess: function () {
setOpen(false);
handleClose();
location.reload();
// location.reload();
loadApplicationDetail()
notifySaveSuccess()
}
});
}
@@ -223,7 +228,9 @@ const PublicNoticeDetail_GLD = () => {
if (response.status === 204) {
setOpen(false);
handleClose();
location.reload();
// location.reload();
loadApplicationDetail()
notifySaveSuccess()
}
})
.catch(error => {
@@ -240,7 +247,8 @@ const PublicNoticeDetail_GLD = () => {
if (response.status === 204) {
setOpen(false);
handleClose();
location.reload();
loadApplicationDetail()
notifyActionSuccess("Withdrawn Success!")
}
})
.catch(error => {
@@ -257,7 +265,9 @@ const PublicNoticeDetail_GLD = () => {
if (response.status === 204) {
setOpen(false);
handleClose();
location.reload();
// location.reload();
loadApplicationDetail()
notifySaveSuccess()
}
})
.catch(error => {


+ 5
- 3
src/pages/User/DetailPage/index.js Vedi File

@@ -20,6 +20,8 @@ const UserAuthorityCard = Loadable(lazy(() => import('./UserAuthorityCard')));
import {
GeneralConfirmWindow,
getDeletedRecordWithRefList,
notifyDeleteSuccess,
notifySaveSuccess,
} from "../../../utils/CommonFunction";

// ==============================|| DASHBOARD - DEFAULT ||============================== //
@@ -71,7 +73,7 @@ const UserMaintainPage = () => {
)
.then((response) => {
if (response.status === 204) {
// notifyDeleteSuccess();
notifyDeleteSuccess();
setIsWindowOpen(false);
navigate('/userSearchview');
}
@@ -148,7 +150,7 @@ const UserMaintainPage = () => {
},
).then((response) => {
if (response.status === 204) {
// notifySaveSuccess();
notifySaveSuccess();
navigate('/userSearchview');
}
})
@@ -173,7 +175,7 @@ const UserMaintainPage = () => {
},
).then((response) => {
if (response.status === 200) {
// notifySaveSuccess();
notifySaveSuccess();
navigate('/userSearchview');
}
})


+ 5
- 0
src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js Vedi File

@@ -15,6 +15,7 @@ import * as ComboData from "../../../utils/ComboData";
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
import Loadable from 'components/Loadable';
import { lazy } from 'react';
import { notifyActiveSuccess, notifyLockSuccess, notifySaveSuccess, notifyVerifySuccess } from 'utils/CommonFunction';
// ==============================|| DASHBOARD - DEFAULT ||============================== //


@@ -80,6 +81,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => {
},
},
onSuccess: function () {
notifySaveSuccess();
loadDataFun();
}
});
@@ -106,6 +108,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => {
HttpUtils.get({
url: UrlUtils.GET_IND_USER_VERIFY + "/" + formData.id,
onSuccess: function () {
notifyVerifySuccess()
loadDataFun();
}
});
@@ -115,6 +118,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => {
HttpUtils.get({
url: UrlUtils.GET_USER_LOCK + "/" + formData.id,
onSuccess: function () {
notifyLockSuccess()
loadDataFun();
}
});
@@ -124,6 +128,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => {
HttpUtils.get({
url: UrlUtils.GET_USER_UNLOCK + "/" + formData.id,
onSuccess: function () {
notifyActiveSuccess()
loadDataFun();
}
});


+ 5
- 0
src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js Vedi File

@@ -16,6 +16,7 @@ import * as yup from 'yup';
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
import Loadable from 'components/Loadable';
import { lazy } from 'react';
import { notifyActiveSuccess, notifyLockSuccess, notifySaveSuccess, notifyVerifySuccess } from 'utils/CommonFunction';
// ==============================|| DASHBOARD - DEFAULT ||============================== //


@@ -86,6 +87,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) =>

},
onSuccess: function () {
notifySaveSuccess()
loadDataFun();
}
});
@@ -119,6 +121,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) =>
HttpUtils.get({
url: UrlUtils.GET_IND_USER_VERIFY + "/" + userData.id,
onSuccess: function () {
notifyVerifySuccess()
loadDataFun();
}
});
@@ -136,6 +139,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) =>
HttpUtils.get({
url: UrlUtils.GET_USER_LOCK + "/" + userData.id,
onSuccess: function () {
notifyLockSuccess()
loadDataFun();
}
});
@@ -152,6 +156,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) =>
HttpUtils.get({
url: UrlUtils.GET_USER_UNLOCK + "/" + userData.id,
onSuccess: function () {
notifyActiveSuccess()
loadDataFun();
}
});


+ 4
- 4
src/pages/User/DetailsPage_Organization/index.js Vedi File

@@ -31,9 +31,9 @@ const UserMaintainPage_Organization = () => {
loadData();
},[]);

const reloadPage=()=>{
window.location.reload(false);
}
// const reloadPage=()=>{
// window.location.reload(false);
// }

const loadData = ()=>{
setLoding(true);
@@ -107,7 +107,7 @@ const UserMaintainPage_Organization = () => {
<Grid item xs={12} md={12} lg={12}>
<UserInformationCard
userData={userData}
loadDataFun={reloadPage}
loadDataFun={loadData}
orgData={orgData}
/>
</Grid>


+ 1
- 1
src/pages/authentication/auth-forms/AuthLogin.js Vedi File

@@ -34,6 +34,7 @@ import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons';
import axios from "axios";
import {useDispatch} from "react-redux";
import {handleLogin} from "auth/index";
import { notifyActionSuccess } from 'utils/CommonFunction';
// ============================|| FIREBASE - LOGIN ||============================ //

const AuthLogin = () => {
@@ -83,7 +84,6 @@ const AuthLogin = () => {

const data = {...userData, accessToken: response.data.accessToken, refreshToken: response.data.refreshToken}
dispatch(handleLogin(data))

navigate('/dashboard');
//history.push(getHomeRouteForLoggedInUser("user"))



+ 4
- 3
src/pages/pnspsUserGroupDetailPage/index.js Vedi File

@@ -12,8 +12,9 @@ import {
GeneralConfirmWindow,
getDeletedRecordWithRefList,
getIdList,
notifyDeleteSuccess,
// notifyDeleteSuccess,
// notifySaveSuccess
notifySaveSuccess
} from "../../utils/CommonFunction";
import {POST_AND_UPDATE_USER_GROUP,GET_GROUP_LIST_PATH } from "../../utils/ApiPathConst";

@@ -58,7 +59,7 @@ const UserMaintainPage = () => {
)
.then((response) => {
if (response.status === 204) {
// notifyDeleteSuccess();
notifyDeleteSuccess()
setIsWindowOpen(false);
navigate('/usergroupSearchview');
}
@@ -142,8 +143,8 @@ const UserMaintainPage = () => {
)
.then((response) => {
if (response.status === 200) {
// notifySaveSuccess();
navigate('/usergroupSearchview');
notifySaveSuccess()
}
})
.catch(error => {


+ 92
- 12
src/utils/CommonFunction.js Vedi File

@@ -6,6 +6,7 @@ import DialogActions from "@mui/material/DialogActions";
import {Button} from "@mui/material";
import Dialog from "@mui/material/Dialog";
import * as React from "react";
import { toast } from "react-toastify";

export function getDeletedRecordWithRefList(referenceList, updatedList){
return referenceList.filter(x => !updatedList.includes(x)) ;
@@ -48,18 +49,97 @@ export function getDateString(queryDateArray) {
)
}

// export const notifySaveSuccess = () => toast.success('Save success!', {
// position: "bottom-right",
// autoClose: 5000,
// hideProgressBar: false,
// closeOnClick: true,
// pauseOnHover: true,
// draggable: true,
// progress: undefined,
// theme: "light",
// });
export const notifySaveSuccess = () => {
const userType = JSON.parse(localStorage.getItem("userData")).type
toast.success(userType === "GLD" ? 'Save success!' : "儲存成功!", {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
})};

export const notifyDeleteSuccess = () => toast.success('Delete Success!', {
export const notifyCreateSuccess = () => {
const userType = JSON.parse(localStorage.getItem("userData")).type
toast.success(userType === "GLD" ? 'Create success!' : "創建成功!", {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
})};

export const notifyVerifySuccess = () => {
const userType = JSON.parse(localStorage.getItem("userData")).type
toast.success(userType === "GLD" ? 'Verify success!' : "驗證成功!", {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
})};

export const notifyDeleteSuccess = () => {
const userType = JSON.parse(localStorage.getItem("userData")).type
toast.success(userType === "GLD" ? 'Delete success!' : "刪除成功!", {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
})};

export const notifyLockSuccess = () => {
toast.success('Lock success!', {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
})};

export const notifyActiveSuccess = () => {
toast.success('Active success!', {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
})};

export const notifyDownloadSuccess = () => {
const userType = JSON.parse(localStorage.getItem("userData")).type
toast.success(userType === "GLD" ? 'Download success!' : "下載成功!", {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
})};

export const notifyActionSuccess = (actionMsg) => {
toast.success(`${actionMsg}`, {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
@@ -68,7 +148,7 @@ export const notifyDeleteSuccess = () => toast.success('Delete Success!', {
draggable: true,
progress: undefined,
theme: "light",
});
})};

export function prettyJson(json){
console.log(json);


Caricamento…
Annulla
Salva