From 3761c1184e549417be8d54dd924699adfca4493b Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 19 Aug 2024 12:29:40 +0800 Subject: [PATCH] iamsmart and fix dn sendDate bug --- src/pages/DemandNote/Search/DataGrid.js | 2 +- .../iAmSmart/PleaseLoginCallback/index.js | 99 +++++++++++++++++++ src/pages/iAmSmart/RegistryCallback/index.js | 6 +- src/routes/LoginRoutes.js | 5 + src/translations/en.json | 4 + src/translations/zh-CN.json | 4 + src/translations/zh-HK.json | 4 + 7 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 src/pages/iAmSmart/PleaseLoginCallback/index.js diff --git a/src/pages/DemandNote/Search/DataGrid.js b/src/pages/DemandNote/Search/DataGrid.js index b8fb94a..3993aed 100644 --- a/src/pages/DemandNote/Search/DataGrid.js +++ b/src/pages/DemandNote/Search/DataGrid.js @@ -269,7 +269,7 @@ export default function SearchDemandNote({ applySearch, searchCriteria }) { Issue:{DateUtils.dateStr(params?.row.issueDate)} Due:{params?.value ? DateUtils.dateStr(params?.value) : "--"} - Sent:{params.row.sentDate ? DateUtils.datetimeStr(params.row.sentDate) - params.row.sentBy : "To be sent"} + Sent:{params.row.sentDate ? DateUtils.datetimeStr(params.row.sentDate) +" - "+ params.row.sentBy : "To be sent"} ); } diff --git a/src/pages/iAmSmart/PleaseLoginCallback/index.js b/src/pages/iAmSmart/PleaseLoginCallback/index.js new file mode 100644 index 0000000..f5e5e26 --- /dev/null +++ b/src/pages/iAmSmart/PleaseLoginCallback/index.js @@ -0,0 +1,99 @@ +// material-ui +import { + Grid, + Typography, + Stack, + Button +} from '@mui/material'; +import * as React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; +import { useLocation } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); +import AccountCircleIcon from '@mui/icons-material/AccountCircle'; + +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + const intl = useIntl(); + const location = useLocation(); + const navigate = useNavigate() + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + if ("iAmSmart" == location?.state?.registryMethod) { + setOnReady(true); + } else { + //setOnReady(true); + navigate('/login'); + } + }, []); + + return ( + !onReady ? + + + + + + : + + +
+ + + + + +
+
+ {/*row 1*/} + + +
+ + + +
+ + +
+
+
+ {/*row 2*/} + + +
+ +
+
+
+
+ + + ); +}; + +export default Index; diff --git a/src/pages/iAmSmart/RegistryCallback/index.js b/src/pages/iAmSmart/RegistryCallback/index.js index c64cb93..0fbecd5 100644 --- a/src/pages/iAmSmart/RegistryCallback/index.js +++ b/src/pages/iAmSmart/RegistryCallback/index.js @@ -38,7 +38,11 @@ const Index = () => { }, onError:(error)=>{ console.log(error); - window.location.assign("/register"); + if(error?.response?.data?.exception == "msg: account created"){ + window.location.assign("/iamsmart/pleaseLogin", { state: {registryMethod:"iAmSmart"}} ); + }else{ + window.location.assign("/register"); + } } }); }else{ diff --git a/src/routes/LoginRoutes.js b/src/routes/LoginRoutes.js index 1c0898a..31b37c1 100644 --- a/src/routes/LoginRoutes.js +++ b/src/routes/LoginRoutes.js @@ -33,6 +33,7 @@ const IAmSmart_FailCallback = Loadable(lazy(() => import('pages/iAmSmart/FailCal const FailCallback_VerifyMail = Loadable(lazy(() => import('pages/iAmSmart/FailCallback_VerifyMail'))); const IAmSmart_AuthCallback = Loadable(lazy(() => import('pages/iAmSmart/AuthCallback'))); const IAmSmart_RegistryCallback = Loadable(lazy(() => import('pages/iAmSmart/RegistryCallback'))); +const IAmSmart_PleaseLoginCallback = Loadable(lazy(() => import('pages/iAmSmart/PleaseLoginCallback'))); //TODO: this page for testing only, please remove at prod const VerifyPage = Loadable(lazy(() => import('pages/authentication/Verify'))); @@ -106,6 +107,10 @@ const LoginRoutes = { path: 'iamsmart/registrycallback', element: }, + { + path: 'iamsmart/pleaseLogin', + element: + }, { path: 'iamsmart/loginFail', element: diff --git a/src/translations/en.json b/src/translations/en.json index 15b8e3b..774cea2 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -164,6 +164,10 @@ "loginErrorMessage5":"Incorrect Username or Password", "loginErrorMessage6":"User account not found", + "pleaseLloginMessage1":"User account already created", + "pleaseLloginMessage2":"You are our existing user, please login to your account.", + "pleaseLloginMessage3":"Go to Login page", + "loginSuccessMessage1":"User account link up success", "loginSuccessMessage2":"You are our existing user and successfully linked your existing account.
From now on, you can log in through \"iAM Smart\".", "loginSuccessMessage3":"Continue to use e-Service", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 08cbd04..90f41ec 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -199,6 +199,10 @@ "loginErrorMessage4":"系统连接失败", "loginErrorMessage5":"用户登入名称或密码错误", "loginErrorMessage6":"找不到用户帐户", + + "pleaseLloginMessage1":"帐户已建立", + "pleaseLloginMessage2":"你是我们的现有用户,请登入你的帐户。", + "pleaseLloginMessage3":"前往登入页面", "loginSuccessMessage1":"成功连结现有帐户", "loginSuccessMessage2":"你是我们的现有客户,已成功连结现有帐户。
以后可以透过「智方便」登入。", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 7a5a711..d65a6d8 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -201,6 +201,10 @@ "loginErrorMessage5":"用戶名或密碼錯誤", "loginErrorMessage6":"找不到用戶帳戶", + "pleaseLloginMessage1":"帳戶已建立", + "pleaseLloginMessage2":"你是我們的現有用戶,請登入你的帳戶。", + "pleaseLloginMessage3":"前往登入頁面", + "loginSuccessMessage1":"成功連結現有帳戶", "loginSuccessMessage2":"你是我們的現有客戶,已成功連結現有帳戶。
以後可以透過「智方便」登入。", "loginSuccessMessage3":"繼續使用e-Service",