Browse Source

Add success msg

master
cyril.tsui 1 year ago
parent
commit
96d4b3b729
19 changed files with 335 additions and 9143 deletions
  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 suppressed because it is too large
View File


+ 1
- 0
package.json View File

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


+ 3
- 0
src/App.js View File

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




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

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


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


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


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

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


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


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


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

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


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


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

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


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


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

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




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


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


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


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

@@ -27,6 +27,7 @@ import CloseIcon from '@mui/icons-material/Close';
import EditNoteIcon from '@mui/icons-material/EditNote'; import EditNoteIcon from '@mui/icons-material/EditNote';
import DownloadIcon from '@mui/icons-material/Download'; import DownloadIcon from '@mui/icons-material/Download';
import ReplayIcon from '@mui/icons-material/Replay'; import ReplayIcon from '@mui/icons-material/Replay';
import { notifyDownloadSuccess } from 'utils/CommonFunction';


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




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

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


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

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



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


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

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




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


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

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


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


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

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




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


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

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




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


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


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

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


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


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


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

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


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


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

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




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

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


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


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

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


export function getDeletedRecordWithRefList(referenceList, updatedList){ export function getDeletedRecordWithRefList(referenceList, updatedList){
return referenceList.filter(x => !updatedList.includes(x)) ; 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", position: "bottom-right",
autoClose: 5000, autoClose: 5000,
hideProgressBar: false, hideProgressBar: false,
@@ -68,7 +148,7 @@ export const notifyDeleteSuccess = () => toast.success('Delete Success!', {
draggable: true, draggable: true,
progress: undefined, progress: undefined,
theme: "light", theme: "light",
});
})};


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


Loading…
Cancel
Save