diff --git a/src/auth/index.js b/src/auth/index.js index 2d7c611..51aa5f6 100644 --- a/src/auth/index.js +++ b/src/auth/index.js @@ -203,3 +203,36 @@ export const SetupAxiosInterceptors = () => { ) } + +export const handleRefreshTokenFunction = () => { + // const token = localStorage.getItem('accessToken'); + let isRefresh = false; + + if (!isRefresh) { + const refreshToken = localStorage.getItem('refreshToken'); + isRefresh = true; + axios.post(`${apiPath}${REFRESH_TOKEN}`, { + refreshToken: refreshToken + }).then((response) => { + if (response.status === 200) { + const newAccessToken = response.data.accessToken; + const newRefreshToken = response.data.refreshToken; + localStorage.setItem('accessToken', newAccessToken); + localStorage.setItem('refreshToken', newRefreshToken); + // token = newAccessToken; + isRefresh = false; + } else { + // token = null; + isRefresh = false; + } + }) + .catch((refreshError) => { + console.log('Failed to refresh token'); + console.log(refreshError) + // token = null + isRefresh = false; + }); + } + + return isRefresh; +} diff --git a/src/components/AutoLogoutProvider.js b/src/components/AutoLogoutProvider.js index 4be8518..166055f 100644 --- a/src/components/AutoLogoutProvider.js +++ b/src/components/AutoLogoutProvider.js @@ -14,6 +14,7 @@ const AutoLogoutProvider = ({ children }) => { const [lastRequestTime, setLastRequestTime] = useState(Date.now()); const navigate = useNavigate(); const [logoutInterval, setLogoutInterval] = useState(1); + // const [remainingInterval] = useState(5); const [state, setState] = useState('Active'); const dispatch = useDispatch() @@ -28,7 +29,7 @@ const AutoLogoutProvider = ({ children }) => { } const { - getRemainingTime, + // getRemainingTime, //getTabId, isLastActiveTab, } = useIdleTimer({ @@ -80,11 +81,13 @@ const AutoLogoutProvider = ({ children }) => { // console.log(logoutInterval) const interval = setInterval(async () => { const currentTime = Date.now(); - getRemainingTime(); + // getRemainingTime(); if(state !== "Active" && lastActiveTab){ const timeElapsed = currentTime - lastRequestTime; // console.log(parseInt(timeElapsed/1000)); // console.log(logoutInterval* 60); + // console.log(remainingInterval * 60); + // console.log(logoutInterval * 60 * 1000 - timeElapsed) if (timeElapsed >= logoutInterval * 60 * 1000) { if(isUserLoggedIn()){ alert("登入驗證已過期,請重新登入。") @@ -94,9 +97,13 @@ const AutoLogoutProvider = ({ children }) => { } } } - else if(state === "Active"){ - //TODO: if is active and remaining time < 5 min then refresh token - } + // else if(state === "Active"){ + // const timeElapsed = currentTime - lastRequestTime; + // if ( (logoutInterval * 60 * 1000 - timeElapsed) <= remainingInterval * 60 * 1000){ + + // } + // //TODO: if is active and remaining time < 5 min then refresh token + // } }, 1000); // Check every second return () => { diff --git a/src/pages/Announcement/Search/SearchForm.js b/src/pages/Announcement/Search/SearchForm.js index dd4b06d..63d5999 100644 --- a/src/pages/Announcement/Search/SearchForm.js +++ b/src/pages/Announcement/Search/SearchForm.js @@ -11,28 +11,109 @@ import * as DateUtils from "utils/DateUtils"; import {ThemeProvider} from "@emotion/react"; import { useNavigate } from "react-router-dom"; import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; +import { makeStyles } from '@mui/styles'; // ==============================|| DASHBOARD - DEFAULT ||============================== // - +const useStyles = makeStyles(() => ({ + root: { + position: "relative" + }, + display: { + position: "absolute", + top: 2, + left: 12, + bottom: 2, + background: "white", + pointerEvents: "none", + right: 50, + display: "flex", + alignItems: "center" + }, + })); const SearchPublicNoticeForm = ({ applySearch, searchCriteria}) => { const navigate = useNavigate() const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); + + const [fromDateValue, setFromDateValue] = React.useState("dd / mm / yyyy"); + const [toDateValue, setToDateValue] = React.useState("dd / mm / yyyy"); + + React.useEffect(() => { + // console.log(minDate) + setFromDateValue(minDate); + }, [minDate]); + + React.useEffect(() => { + setToDateValue(maxDate); + }, [maxDate]); + + function FormDateInputComponent({inputRef, ...props }) { + const classes = useStyles(); + return ( + <> +
+ {DateUtils.dateStr(fromDateValue)=="Invalid Date"? + fromDateValue + : + DateUtils.dateStr(fromDateValue)} +
+ + + ); + } + + function ToDateInputComponent({inputRef, ...props }) { + const classes = useStyles(); + return ( + <> +
+ {DateUtils.dateStr(toDateValue)=="Invalid Date"? + toDateValue + : + DateUtils.dateStr(toDateValue)} +
+ + + ); + } const marginBottom = 2.5; const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { + let sentDateFrom = ""; + let sentDateTo = ""; + if( fromDateValue!="dd / mm / yyyy"&&toDateValue!="dd / mm / yyyy"){ + sentDateFrom = DateUtils.dateValue(fromDateValue) + sentDateTo = DateUtils.dateValue(toDateValue) + } + const temp = { key: data.key, - dateFrom: data.dateFrom, - dateTo: data.dateTo, + dateFrom: sentDateFrom, + dateTo: sentDateTo, }; applySearch(temp); }; function resetForm() { + setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) + setMaxDate(DateUtils.dateValue(new Date())) reset(); } @@ -54,7 +135,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria}) => { {/*row 2*/} - + { /> - + { type="date" label={"Submit Date (From)"} defaultValue={searchCriteria.dateFrom} - InputProps={{ inputProps: { max: maxDate } }} + InputProps={{ + inputComponent: FormDateInputComponent, + }} onChange={(newValue) => { - setMinDate(DateUtils.dateValue(newValue)); + if(newValue.target.value!=""){ + setMinDate(newValue.target.value); + } }} InputLabelProps={{ shrink: true }} - sx={{ "& .MuiInputBase-input": {display:"block"} }} + sx={{ "& .MuiInputBase-input": {display:"block", textIndent: "-9999px"} }} /> @@ -95,15 +180,19 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria}) => { shrink: true }} {...register("dateTo")} - InputProps={{ inputProps: { min: minDate } }} + InputProps={{ + inputComponent: ToDateInputComponent, + }} onChange={(newValue) => { - setMaxDate(DateUtils.dateValue(newValue)); + if(newValue.target.value!=""){ + setMaxDate(newValue.target.value); + } }} id="dateTo" type="date" label={"Submit Date (To)"} defaultValue={searchCriteria.dateTo} - sx={{ "& .MuiInputBase-input": {display:"block"} }} + sx={{ "& .MuiInputBase-input": {display:"block", textIndent: "-9999px"} }} /> diff --git a/src/pages/Announcement/Search_Public/SearchForm.js b/src/pages/Announcement/Search_Public/SearchForm.js index 2ad4fc5..451c745 100644 --- a/src/pages/Announcement/Search_Public/SearchForm.js +++ b/src/pages/Announcement/Search_Public/SearchForm.js @@ -9,33 +9,113 @@ import { useForm } from "react-hook-form"; import * as React from "react"; import * as DateUtils from "utils/DateUtils"; import { ThemeProvider } from "@emotion/react"; -import { useNavigate } from "react-router-dom"; +// import { useNavigate } from "react-router-dom"; import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst"; import { FormattedMessage, useIntl } from "react-intl"; +import { makeStyles } from '@mui/styles'; // ==============================|| DASHBOARD - DEFAULT ||============================== // - +const useStyles = makeStyles(() => ({ + root: { + position: "relative" + }, + display: { + position: "absolute", + top: 2, + left: 12, + bottom: 2, + background: "white", + pointerEvents: "none", + right: 50, + display: "flex", + alignItems: "center" + }, + })); const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { - const navigate = useNavigate() + // const navigate = useNavigate() const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); + + const [fromDateValue, setFromDateValue] = React.useState("dd / mm / yyyy"); + const [toDateValue, setToDateValue] = React.useState("dd / mm / yyyy"); const intl = useIntl(); + React.useEffect(() => { + // console.log(minDate) + setFromDateValue(minDate); + }, [minDate]); + + React.useEffect(() => { + setToDateValue(maxDate); + }, [maxDate]); + + function FormDateInputComponent({inputRef, ...props }) { + const classes = useStyles(); + return ( + <> +
+ {DateUtils.dateStr(fromDateValue)=="Invalid Date"? + fromDateValue + : + DateUtils.dateStr(fromDateValue)} +
+ + + ); + } + + function ToDateInputComponent({inputRef, ...props }) { + const classes = useStyles(); + return ( + <> +
+ {DateUtils.dateStr(toDateValue)=="Invalid Date"? + toDateValue + : + DateUtils.dateStr(toDateValue)} +
+ + + ); + } + const marginBottom = 2.5; const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { + let sentDateFrom = ""; + let sentDateTo = ""; + if( fromDateValue!="dd / mm / yyyy"&&toDateValue!="dd / mm / yyyy"){ + sentDateFrom = DateUtils.dateValue(fromDateValue)!="Invalid Date"?DateUtils.dateValue(fromDateValue):"" + sentDateTo = DateUtils.dateValue(toDateValue)!="Invalid Date"?DateUtils.dateValue(toDateValue):"" + } const temp = { key: data.key, - dateFrom: data.dateFrom, - dateTo: data.dateTo, + dateFrom: sentDateFrom, + dateTo: sentDateTo, }; applySearch(temp); }; function resetForm() { + setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) + setMaxDate(DateUtils.dateValue(new Date())) reset(); } @@ -80,13 +160,18 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { type="date" label={intl.formatMessage({ id: 'dateFrom' }) + ":"} defaultValue={searchCriteria.dateFrom} - InputProps={{ inputProps: { max: maxDate } }} + InputProps={{ + inputComponent: FormDateInputComponent, + }} onChange={(newValue) => { - setMinDate(DateUtils.dateValue(newValue)); + if(newValue.target.value!=""){ + setMinDate(newValue.target.value); + } }} InputLabelProps={{ shrink: true }} + sx={{ "& .MuiInputBase-input": {display:"block", textIndent: "-9999px"} }} />
@@ -101,14 +186,19 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { shrink: true }} {...register("dateTo")} - InputProps={{ inputProps: { min: minDate } }} + InputProps={{ + inputComponent: ToDateInputComponent, + }} onChange={(newValue) => { - setMaxDate(DateUtils.dateValue(newValue)); + if(newValue.target.value!=""){ + setMaxDate(newValue.target.value); + } }} id="dateTo" type="date" //label={"Submit Date(To)"} defaultValue={searchCriteria.dateTo} + sx={{ "& .MuiInputBase-input": {display:"block", textIndent: "-9999px"} }} />
@@ -119,7 +209,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { {/*last row*/} - + {/* - + */} + Reset + + */} - - - - + + + + + {onLoad? + + + + : + + + Reset + - - - + + - - - - {/* - {onDownload? - - : - - } - */} - - } + + + + + + + + + + + + + + {/* + {onDownload? + + : + + } + */} + + } + + diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js index 2442b15..bfb3498 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js @@ -1,7 +1,9 @@ // material-ui import { Grid, Button, Typography, - FormHelperText + FormHelperText, + Stack, + IconButton } from '@mui/material'; import MainCard from "components/MainCard"; import * as React from "react"; @@ -20,6 +22,7 @@ import { notifyActiveSuccess, notifyLockSuccess, notifySaveSuccess, notifyVerify import {useIntl} from "react-intl"; import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; +import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -31,7 +34,16 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { const [locked, setLocked] = useState(false); const [onReady, setOnReady] = useState(false); const [errorMsg, setErrorMsg] = useState(""); + const [showId, setshowId] = useState(false); + const handleClickShowId = () => { + setshowId(!showId); + }; + + const handleMouseDownId = (event) => { + event.preventDefault(); + }; + useEffect(() => { //if state data are ready and assign to different field // console.log(currentApplicationDetailData) @@ -359,39 +371,78 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { {formik.values.idDocType === "HKID" ? - <> - + editMode? + <> + + {FieldUtils.initField({ + valueName: "identification", + disabled: (!editMode), + form: formik, + placeholder: intl.formatMessage({id: 'idDocNumber'}), + inputProps: { + maxLength: 7, + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + } + })} + + + + {FieldUtils.initField({ + valueName: "checkDigit", + disabled: (!editMode), + form: formik, + })} + + + : + + + {formik.values.identification.slice(0, 4)} + + + {showId ?formik.values.identification.slice(4):"****"}{showId ? '(' + formik.values.checkDigit + ')' :null} + + + {showId ? : } + + + : + editMode? + {FieldUtils.initField({ valueName: "identification", disabled: (!editMode), - form: formik, - placeholder: intl.formatMessage({id: 'idDocNumber'}), - inputProps: { - maxLength: 7, - onKeyDown: (e) => { - if (e.key === 'Enter') { - e.preventDefault(); - } - }, - } - })} - - - - {FieldUtils.initField({ - valueName: "checkDigit", - disabled: (!editMode), form: formik })} - : - - {FieldUtils.initField({ - valueName: "identification", - disabled: (!editMode), - form: formik - })} - + : + + + {formik.values.identification.slice(0, 4)} + + + {showId ?formik.values.identification.slice(4):"****"} + + + {showId ? : } + + } diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js index a1b3d7f..24f7acf 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual_Pub.js @@ -1,7 +1,9 @@ // material-ui import { Grid, Button, Typography, - FormHelperText + FormHelperText, + Stack, + IconButton } from '@mui/material'; import MainCard from "components/MainCard"; import * as React from "react"; @@ -20,6 +22,7 @@ import {notifySaveSuccess,} from 'utils/CommonFunction'; import {FormattedMessage, useIntl} from "react-intl"; import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; +import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -30,6 +33,15 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { const [editMode, setEditMode] = useState(false); const [onReady, setOnReady] = useState(false); const [errorMsg, setErrorMsg] = useState(""); + const [showId, setshowId] = useState(false); + + const handleClickShowId = () => { + setshowId(!showId); + }; + + const handleMouseDownId = (event) => { + event.preventDefault(); + }; useEffect(() => { if (Object.keys(formData).length > 0) { @@ -226,39 +238,74 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { {formik.values.idDocType === "HKID" ? - <> - - {FieldUtils.initField({ - valueName: "identification", - disabled: true, - form: formik, - placeholder: intl.formatMessage({id: 'idDocNumber'}), - inputProps: { - maxLength: 7, - onKeyDown: (e) => { - if (e.key === 'Enter') { - e.preventDefault(); - } - }, - } - })} + // <> + // + // {FieldUtils.initField({ + // valueName: "identification", + // disabled: true, + // form: formik, + // placeholder: intl.formatMessage({id: 'idDocNumber'}), + // inputProps: { + // maxLength: 7, + // onKeyDown: (e) => { + // if (e.key === 'Enter') { + // e.preventDefault(); + // } + // }, + // } + // })} - - - {FieldUtils.initField({ - valueName: "checkDigit", - disabled: true, - form: formik, - })} - - : - - {FieldUtils.initField({ - valueName: "identification", - disabled: true, - form: formik - })} - + // + // + // {FieldUtils.initField({ + // valueName: "checkDigit", + // disabled: true, + // form: formik, + // })} + // + // + + + {formik.values.identification.slice(0, 4)} + + + {showId ?formik.values.identification.slice(4):"****"}{showId ? '(' + formik.values.checkDigit + ')' :null} + + + {showId ? : } + + + : + // + // {FieldUtils.initField({ + // valueName: "identification", + // disabled: true, + // form: formik + // })} + // + + + {formik.values.identification.slice(0, 4)} + + + {showId ?formik.values.identification.slice(4):"****"} + + + {showId ? : } + + } diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index 580a982..b1a3855 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -59,6 +59,7 @@ const CustomFormWizard = (props) => { const [level, setLevel] = useState(); const [showPassword, setShowPassword] = useState(false); const [showConfirmPassword, setshowConfirmPassword] = useState(false); + const [showId, setshowId] = useState(false); const [fileList, setFileList] = useState([]); const [fileListData, setFileListData] = useState([]); const [checkUpload, setCheckUpload] = useState(false); @@ -70,6 +71,7 @@ const CustomFormWizard = (props) => { const handleClickShowPassword = () => { setShowPassword(!showPassword); }; + const handleClickShowConfirmPassword = () => { setshowConfirmPassword(!showConfirmPassword); }; @@ -78,6 +80,14 @@ const CustomFormWizard = (props) => { event.preventDefault(); }; + const handleClickShowId = () => { + setshowId(!showId); + }; + + const handleMouseDownId = (event) => { + event.preventDefault(); + }; + const changePassword = (value) => { const temp = strengthIndicator(value); setLevel(strengthColorChi(temp)); @@ -969,7 +979,7 @@ const CustomFormWizard = (props) => { inputProps={{ maxLength: selectedIdDocType.type === 'HKID' ? 8 : 18, onKeyDown: (e) => { - console.log(e) + // console.log(e) if (e.key === 'Enter') { e.preventDefault(); } @@ -1683,7 +1693,7 @@ const CustomFormWizard = (props) => { */} - + : @@ -1694,13 +1704,29 @@ const CustomFormWizard = (props) => { - - + + : - - {formik.values.idNo} {selectedIdDocType.type == "HKID" ? '(' + formik.values.checkDigit + ')' : null} + + {formik.values.idNo.slice(0, 4)} + + + + {showId ?formik.values.idNo.slice(4):"****"}{showId ?selectedIdDocType.type == "HKID" ? '(' + formik.values.checkDigit + ')' : null:null} + + + {showId ? : } + diff --git a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js index 61360d3..ad55cc4 100644 --- a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js +++ b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js @@ -32,6 +32,7 @@ const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingCo import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png'; +import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; import { Link } from 'react-router-dom'; import * as HttpUtils from "../../../utils/HttpUtils"; @@ -67,7 +68,8 @@ const CustomFormWizard = (props) => { const address4ComboList = ComboData.district; const address5ComboList = ComboData.country; - + const [showId, setshowId] = useState(false); + const [showComId, setshowComId] = useState(false); useEffect(() => { location.state?.responseData ?? {} @@ -76,6 +78,22 @@ const CustomFormWizard = (props) => { responseToData(); }, []); + const handleClickShowId = () => { + setshowId(!showId); + }; + + const handleMouseDownId = (event) => { + event.preventDefault(); + }; + + const handleClickShowComId = () => { + setshowComId(!showId); + }; + + const handleMouseDownComId = (event) => { + event.preventDefault(); + }; + useEffect(() => { setDistrictErrStr(""); if (selectedAddress5?.type === "hongKong") { @@ -155,7 +173,7 @@ const CustomFormWizard = (props) => { add += str.trim() ? str.trim() + ", " : ""; }); add = add.trim(); - if (add.slice(- 1) == ",") { + if (add?.slice(- 1) == ",") { add = add.substring(0, add.length - 1); } return add; @@ -424,11 +442,27 @@ const CustomFormWizard = (props) => { - + + + : + {/* {iAmSmartData.idNo + "(" + iAmSmartData.checkDigit + ")"} */} + + + {iAmSmartData?.idNo?.slice(0, 4)} + - : {iAmSmartData.idNo + "(" + iAmSmartData.checkDigit + ")"} + {showId ?iAmSmartData?.idNo?.slice(4):"****"}{showId ? '(' + iAmSmartData.checkDigit + ')' :null} + + {showId ? : } + @@ -933,13 +967,27 @@ const CustomFormWizard = (props) => { - - + + - - {formik.values.idNo + "(" + formik.values.checkDigit + ")"} + + {formik?.values?.idNo?.slice(0, 4)} + {/* {formik.values.idNo + "(" + formik.values.checkDigit + ")"} */} + + + {showComId ?formik?.values?.idNo?.slice(4):"****"}{showComId ? '(' + formik.values.checkDigit + ')' : null} + {/* {formik.values.idNo + "(" + formik.values.checkDigit + ")"} */} + + {showComId ? : } + diff --git a/src/pages/iAmSmart/AuthCallback/index.js b/src/pages/iAmSmart/AuthCallback/index.js index 39772ce..ac6c156 100644 --- a/src/pages/iAmSmart/AuthCallback/index.js +++ b/src/pages/iAmSmart/AuthCallback/index.js @@ -70,16 +70,22 @@ const Index = () => { navigate('/dashboard'); }, onFail: (response)=>{ - console.log("Fail"); + console.log("onFail"); console.log(response); window.location.assign("/iamsmart/loginFail"); }, onError:(error)=>{ + console.log("onError"); console.log(error); - window.location.assign("/iamsmart/loginFail"); + if(error?.response?.data?.exception == "msg: please verify email."){ + window.location.assign("/iamsmart/notverify"); + }else{ + window.location.assign("/iamsmart/loginFail"); + } } }); }else{ + console.log("Fail"); window.location.assign("/iamsmart/loginFail"); } } diff --git a/src/pages/iAmSmart/DirectLoginCallback/index.js b/src/pages/iAmSmart/DirectLoginCallback/index.js index 788d3ff..0ee31d8 100644 --- a/src/pages/iAmSmart/DirectLoginCallback/index.js +++ b/src/pages/iAmSmart/DirectLoginCallback/index.js @@ -57,8 +57,13 @@ const Index = () => { window.location.assign("/iamsmart/loginFail"); }, onError:(error)=>{ + console.log("onError"); console.log(error); - window.location.assign("/iamsmart/loginFail"); + if(error?.response?.data?.exception == "msg: please verify email."){ + window.location.assign("/iamsmart/notverify"); + }else{ + window.location.assign("/iamsmart/loginFail"); + } } }); }else{ diff --git a/src/pages/iAmSmart/FailCallback/index.js b/src/pages/iAmSmart/FailCallback/index.js index 0fe09dc..1d5da8f 100644 --- a/src/pages/iAmSmart/FailCallback/index.js +++ b/src/pages/iAmSmart/FailCallback/index.js @@ -6,7 +6,7 @@ import { } from '@mui/material'; import * as React from "react"; import { useNavigate } from "react-router-dom"; - +import { FormattedMessage } from "react-intl"; import Loadable from 'components/Loadable'; const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); @@ -30,32 +30,42 @@ const Index = () => { : - - - - -
- - - - 登入失敗,請重試。 - - - - -
-
+ + + + +
+ + + + + + + + + + +
- {/*row 2*/} -
+
+ {/*row 2*/} +
); }; diff --git a/src/pages/iAmSmart/FailCallback_VerifyMail/index.js b/src/pages/iAmSmart/FailCallback_VerifyMail/index.js new file mode 100644 index 0000000..5c4f1f5 --- /dev/null +++ b/src/pages/iAmSmart/FailCallback_VerifyMail/index.js @@ -0,0 +1,69 @@ +// material-ui +import { + Grid, + Typography, + Button +} from '@mui/material'; +import * as React from "react"; +import { useNavigate } from "react-router-dom"; +import { FormattedMessage } from "react-intl"; +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); + + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + + const navigate = useNavigate() + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + setOnReady(true); + }, []); + + return ( + !onReady ? + + + + + + : + + + + +
+ + + + + + + + + + + + + + +
+
+
+ {/*row 2*/} +
+ + ); +}; + +export default Index; \ No newline at end of file diff --git a/src/routes/LoginRoutes.js b/src/routes/LoginRoutes.js index 103ae75..cd36718 100644 --- a/src/routes/LoginRoutes.js +++ b/src/routes/LoginRoutes.js @@ -26,6 +26,7 @@ const ForgotUsername_Success = Loadable(lazy(() => import('pages/authentication/ const IAmSmart_DirectLoginCallback = Loadable(lazy(() => import('pages/iAmSmart/DirectLoginCallback'))); //const IAmSmart_FallCallback = Loadable(lazy(() => import('pages/iAmSmart/FallCallback'))); const IAmSmart_FailCallback = Loadable(lazy(() => import('pages/iAmSmart/FailCallback'))); +const FailCallback_VerifyMail = Loadable(lazy(() => import('pages/iAmSmart/FailCallback_VerifyMail'))); const IAmSmart_SuccessCallback = Loadable(lazy(() => import('pages/iAmSmart/SuccessCallback'))); const IAmSmart_AuthCallback = Loadable(lazy(() => import('pages/iAmSmart/AuthCallback'))); const IAmSmart_RegistryCallback = Loadable(lazy(() => import('pages/iAmSmart/RegistryCallback'))); @@ -73,6 +74,10 @@ const LoginRoutes = { path: 'iamsmart/loginfallback', element: }, + { + path: 'iamsmart/notverify', + element: + }, { path: 'iamsmart/authcallback', element: diff --git a/src/translations/en.json b/src/translations/en.json index 56bfcd9..09c8444 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -84,6 +84,7 @@ "continue": "Continue", "submit": "Submit", "backToLogin": "Return to login page", + "goRegister": "Register an account", "registerSubmitted": "Account application submitted successfully.", "registerFail": "Application failed, please try again later", "iAmSmartNoIdNoMsg": "Invalid information, please return to the registration page.", @@ -125,6 +126,7 @@ "loginErrorMessage3":"Account has not been Verified", "loginErrorMessage4":"System Connection Failed", "loginErrorMessage5":"Incorrect Username or Password", + "loginErrorMessage6":"Login fail, please try again", "newPassword": "New Password", "setNewPassword": "Please enter new password", @@ -323,9 +325,11 @@ "payConfirm": "Confirm payment", "payCancel": "Cancel payment", "payTotalDeatail": "Total Payment Amount", + "payDeatail": "Total Amount", "payTotal": "Total", "payDetail": "Payment Details", "payMethod": "Payment method", + "epayMethod": " e-Payment Method", "selectPaymentMethod": "Please select a payment method", "payReceipt": "Payment receipt", "contactPerson": "Contact Person", @@ -393,9 +397,9 @@ "singleCol":"Single Column", "doubleCol":"Double Column", - "transactionNo": "Transaction number", - "transactionDate": "Transaction Date", - "transactionTime": "Transaction Time", + "paymentNo": "Payment No.", + "paymentDate": "Payment Date", + "paymentTime": "Payment Time", "paymentRefCode": "Payment Reference Number", "paymentInfoRecord": "Payment Notice Record", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 389b91c..dca0c9d 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -83,6 +83,7 @@ "continue": "继续", "submit": "提交", "backToLogin": "返回登入页面", + "goRegister": "帐户申请", "registerSubmitted": "帐户申请已成功提交。", "registerFail": "申请失败,请稍后尝试", "iAmSmartNoIdNoMsg": "无效资料,请返回注册页面。", @@ -123,6 +124,7 @@ "loginErrorMessage3":"帐户尚未验证", "loginErrorMessage4":"系统连接失败", "loginErrorMessage5":"用户名或密码错误", + "loginErrorMessage6":"登入失败,请重试", "newPassword": "新密码", "setNewPassword": "请输入新密码", @@ -316,9 +318,11 @@ "payConfirm": "确认付款", "payCancel": "取消付款", "payTotalDeatail": "付款总额", + "payDeatail": "总额", "payTotal": "付款总额", "payDetail": "付款详情", "payMethod": "付款方式", + "epayMethod": "电子付款方法", "selectPaymentMethod": "请选择付款方式", "payReceipt": "付款收据", "contactPerson": "联络人", @@ -386,9 +390,9 @@ "singleCol":"一格位", "doubleCol":"二格位", - "transactionNo": "交易号码", - "transactionDate": "交易日期", - "transactionTime": "交易时间", + "paymentNo": "付款编号", + "paymentDate": "付款日期", + "paymentTime": "付款时间", "paymentRefCode": "付款参考号码", "paymentInfoRecord": "缴款通知记录", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 0a87b55..1d3572e 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -83,6 +83,7 @@ "continue": "繼續", "submit": "提交", "backToLogin": "返回登入頁面", + "goRegister": "帳戶申請", "registerSubmitted": "帳戶申請已成功提交。", "registerFail": "申請失敗,請稍後嘗試", "iAmSmartNoIdNoMsg": "無效資料,請返回注冊頁面。", @@ -123,6 +124,7 @@ "loginErrorMessage3":"帳戶尚未驗證", "loginErrorMessage4":"系統連接失敗", "loginErrorMessage5":"用戶名或密碼錯誤", + "loginErrorMessage6":"登入失敗,請重試", "newPassword": "新密碼", "setNewPassword": "請輸入新密碼", @@ -319,9 +321,11 @@ "payConfirm": "確認付款", "payCancel": "取消付款", "payTotalDeatail": "付款總額", + "payDeatail": "總額", "payTotal": "付款總額", "payDetail": "付款詳情", "payMethod": "付款方式", + "epayMethod": "電子付款方法", "selectPaymentMethod": "請選擇付款方式", "payReceipt": "付款收據", "contactPerson": "聯絡人", @@ -389,9 +393,9 @@ "singleCol":"一格位", "doubleCol":"二格位", - "transactionNo": "交易號碼", - "transactionDate": "交易日期", - "transactionTime": "交易時間", + "paymentNo": "付款編號", + "paymentDate": "付款日期", + "paymentTime": "付款時間", "paymentRefCode": "付款參考號碼", "paymentInfoRecord": "繳款通知記錄", diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 5aeb291..a771bc9 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -161,7 +161,8 @@ export const PAYMENT_STATUS_API = paymentPath+'/api/payment/status/';//GET export const DEMAND_NOTE_PREVIEW = apiPath+'/demandNote/preview';//GET export const DEMAND_NOTE_CREATE = apiPath+'/demandNote/create';//POST -export const DEMAND_NOTE_LIST = apiPath+'/demandNote/list';//GET +export const DEMAND_NOTE_LIST = apiPath+'/demandNote/list';//GET pub +export const DEMAND_NOTE_LIST_ALL = apiPath+'/demandNote/listAll';//GET gld export const DEMAND_NOTE_LOAD = apiPath+'/demandNote/load';//GET export const DEMAND_NOTE_SEND = apiPath+'/demandNote/send-dn';//POST export const DEMAND_NOTE_MARK_PAID = apiPath+'/demandNote/mark-as-paid';//POST