| @@ -35,7 +35,7 @@ const PaymentDetails = ({ formData,doPrint }) => { | |||||
| }, [data]); | }, [data]); | ||||
| const getPaymentMethod=()=>{ | const getPaymentMethod=()=>{ | ||||
| let paymentmethod = data.payload.paymentdetail.paymentmethod; | |||||
| let paymentmethod = data?.payload?.paymentdetail?.paymentmethod; | |||||
| if("01" == paymentmethod) return "PPS"; | if("01" == paymentmethod) return "PPS"; | ||||
| if("02" == paymentmethod || "03" == paymentmethod) return "Credit Card"; | if("02" == paymentmethod || "03" == paymentmethod) return "Credit Card"; | ||||
| if("04" == paymentmethod) return "FPS"; | if("04" == paymentmethod) return "FPS"; | ||||
| @@ -90,7 +90,7 @@ const AckPage = () => { | |||||
| }, | }, | ||||
| onSuccess: function(responseData){ | onSuccess: function(responseData){ | ||||
| setResponeDataData(responseData) | setResponeDataData(responseData) | ||||
| setPaymentId(responseData.paymentdetail.paymentid) | |||||
| if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { | if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { | ||||
| localStorage.removeItem("webtoken"); | localStorage.removeItem("webtoken"); | ||||
| localStorage.removeItem("transactionid"); | localStorage.removeItem("transactionid"); | ||||
| @@ -111,6 +111,7 @@ const AckPage = () => { | |||||
| setItemList(responseData2.paymentItemList) | setItemList(responseData2.paymentItemList) | ||||
| setPaymentData(responseData2.data); | setPaymentData(responseData2.data); | ||||
| localStorage.removeItem("paymentId"); | localStorage.removeItem("paymentId"); | ||||
| setPaymentId(responseData2.id) | |||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -176,6 +176,7 @@ const Index = () => { | |||||
| + encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/fpscallback?TRANSACTION_ID='+paymentData.transactionid+"&WEB_TOKEN="+paymentData.webtoken+"&PAYMENT_ID="+localStorage.getItem("paymentId")); | + encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/fpscallback?TRANSACTION_ID='+paymentData.transactionid+"&WEB_TOKEN="+paymentData.webtoken+"&PAYMENT_ID="+localStorage.getItem("paymentId")); | ||||
| setFpsqrcodeurl(openPASGUrl) | setFpsqrcodeurl(openPASGUrl) | ||||
| setFpsqrcodeurlPrd(openPASGUrlPrd) | setFpsqrcodeurlPrd(openPASGUrlPrd) | ||||
| } | } | ||||
| }); | }); | ||||
| @@ -113,7 +113,6 @@ const Index = () => { | |||||
| }, | }, | ||||
| onSuccess: function (responseData) { | onSuccess: function (responseData) { | ||||
| setResponeDataData(responseData) | setResponeDataData(responseData) | ||||
| setPaymentId(responseData.paymentdetail.paymentid) | |||||
| if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { | if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { | ||||
| localStorage.removeItem("webtoken"); | localStorage.removeItem("webtoken"); | ||||
| localStorage.removeItem("transactionid"); | localStorage.removeItem("transactionid"); | ||||
| @@ -134,6 +133,7 @@ const Index = () => { | |||||
| setItemList(responseData2.paymentItemList) | setItemList(responseData2.paymentItemList) | ||||
| setPaymentData(responseData2.data); | setPaymentData(responseData2.data); | ||||
| localStorage.removeItem("paymentId"); | localStorage.removeItem("paymentId"); | ||||
| setPaymentId(responseData2.id) | |||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -9,7 +9,7 @@ import Typography from '@mui/material/Typography'; | |||||
| import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png'; | import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png'; | ||||
| import banner from 'assets/images/bg_ml.jpg'; | import banner from 'assets/images/bg_ml.jpg'; | ||||
| import { Stack } from '../../../node_modules/@mui/material/index'; | import { Stack } from '../../../node_modules/@mui/material/index'; | ||||
| import { iAmSmartPath, iAmSmartAppPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath} from 'auth/utils' | |||||
| import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath} from 'auth/utils' | |||||
| import * as React from 'react'; | import * as React from 'react'; | ||||
| import {FormattedMessage, useIntl} from "react-intl"; | import {FormattedMessage, useIntl} from "react-intl"; | ||||
| @@ -48,20 +48,17 @@ const RegisterCustom = () => { | |||||
| } | } | ||||
| const openApp = () => { | const openApp = () => { | ||||
| setTimeout(function () { | |||||
| openQR(); | |||||
| }, 1000); | |||||
| let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback"; | |||||
| let url = iAmSmartAppPath + "auth" | |||||
| let callbackUrl = "https://"+iAmSmartCallbackPath()+"/iamsmart/registrycallback"; | |||||
| let url = iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + clientId | + "?clientID=" + clientId | ||||
| + "&responseType=code" | + "&responseType=code" | ||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=zh-HK"//en-US, zh-HK, or zh-CN | |||||
| +"&source=" + getBowserType() | |||||
| +"&redirectURI="+encodeURIComponent(callbackUrl) | |||||
| +"&scope="+encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| +"&lang=zh-HK"//en-US, zh-HK, or zh-CN | |||||
| //+"&state=" | //+"&state=" | ||||
| + "&brokerPage=false" | |||||
| window.location=url; | |||||
| +"&brokerPage=true" | |||||
| window.location.assign(url); | |||||
| } | } | ||||
| return ( | return ( | ||||
| @@ -6,7 +6,8 @@ import React, { | |||||
| import { Link as RouterLink } from 'react-router-dom'; | import { Link as RouterLink } from 'react-router-dom'; | ||||
| import { useNavigate } from 'react-router-dom'; | import { useNavigate } from 'react-router-dom'; | ||||
| import { useForm, } from 'react-hook-form' | import { useForm, } from 'react-hook-form' | ||||
| import { iAmSmartPath, iAmSmartAppPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' | |||||
| import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' | |||||
| //iAmSmartAppPath | |||||
| // material-ui | // material-ui | ||||
| import { | import { | ||||
| @@ -193,11 +194,26 @@ const AuthLoginCustom = () => { | |||||
| } | } | ||||
| const openApp = () => { | const openApp = () => { | ||||
| setTimeout(function () { | |||||
| openQR(); | |||||
| }, 1000); | |||||
| // setTimeout(function () { | |||||
| // openQR(); | |||||
| // }, 1000); | |||||
| // let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; | |||||
| // let source = getBowserType() | |||||
| // console.log(source) | |||||
| // let url = iAmSmartAppPath + "auth" | |||||
| // + "?clientID=" + clientId | |||||
| // + "&responseType=code" | |||||
| // + "&source=" + getBowserType() | |||||
| // + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| // + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| // + "&lang=zh-HK"//en-US, zh-HK, or zh-CN | |||||
| // //+"&state=" | |||||
| // + "&brokerPage=true" | |||||
| // window.location=url; | |||||
| let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; | let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; | ||||
| let url = iAmSmartAppPath + "auth" | |||||
| let url = iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + clientId | + "?clientID=" + clientId | ||||
| + "&responseType=code" | + "&responseType=code" | ||||
| + "&source=" + getBowserType() | + "&source=" + getBowserType() | ||||
| @@ -205,8 +221,9 @@ const AuthLoginCustom = () => { | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | ||||
| + "&lang=zh-HK"//en-US, zh-HK, or zh-CN | + "&lang=zh-HK"//en-US, zh-HK, or zh-CN | ||||
| //+"&state=" | //+"&state=" | ||||
| + "&brokerPage=false" | |||||
| window.location=url; | |||||
| + "&brokerPage=true" | |||||
| window.location=url; | |||||
| } | } | ||||
| @@ -0,0 +1,30 @@ | |||||
| // material-ui | |||||
| import { | |||||
| Stack, | |||||
| Typography | |||||
| } from '@mui/material'; | |||||
| import MainCard from "components/MainCard"; | |||||
| import * as React from "react"; | |||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||||
| const SearchDemandNoteForm = () => { | |||||
| return ( | |||||
| <MainCard xs={12} md={12} lg={12} | |||||
| border={false} | |||||
| content={false} | |||||
| sx={{ backgroundColor: '#fff' }} | |||||
| > | |||||
| <Stack direction="column" spacing={3}> | |||||
| <Stack direction="row" spacing={3}> | |||||
| <Typography></Typography> | |||||
| <Typography align="justify"></Typography> | |||||
| </Stack> | |||||
| </Stack> | |||||
| </MainCard> | |||||
| ); | |||||
| }; | |||||
| export default SearchDemandNoteForm; | |||||
| @@ -0,0 +1,31 @@ | |||||
| // material-ui | |||||
| import { | |||||
| Typography, | |||||
| Stack | |||||
| } from '@mui/material'; | |||||
| import MainCard from "components/MainCard"; | |||||
| import * as React from "react"; | |||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | |||||
| const SearchDemandNoteForm = () => { | |||||
| return ( | |||||
| <MainCard xs={12} md={12} lg={12} | |||||
| border={false} | |||||
| content={false} | |||||
| spacing={2} | |||||
| > | |||||
| <Stack direction="column" spacing={3}> | |||||
| <Stack direction="row" spacing={3}> | |||||
| <Typography></Typography> | |||||
| <Typography align="justify"></Typography> | |||||
| </Stack> | |||||
| </Stack> | |||||
| </MainCard> | |||||
| ); | |||||
| }; | |||||
| export default SearchDemandNoteForm; | |||||
| @@ -4,13 +4,19 @@ | |||||
| import { | import { | ||||
| Grid, | Grid, | ||||
| Typography, | Typography, | ||||
| Stack | |||||
| Stack, | |||||
| Button, | |||||
| Box | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import { | |||||
| isORGLoggedIn, | |||||
| } from "utils/Utils"; | |||||
| import { isORGLoggedIn, } from "utils/Utils"; | |||||
| import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
| import {FormattedMessage} from "react-intl"; | import {FormattedMessage} from "react-intl"; | ||||
| import AdsClickRoundedIcon from '@mui/icons-material/AdsClickRounded'; | |||||
| import * as React from "react"; | |||||
| import Loadable from 'components/Loadable'; | |||||
| const Message = Loadable(React.lazy(() => import('./Message'))); | |||||
| const Notice = Loadable(React.lazy(() => import('./Notice'))); | |||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| const DashboardDefault = () => { | const DashboardDefault = () => { | ||||
| @@ -20,13 +26,13 @@ const DashboardDefault = () => { | |||||
| backgroundImage: `url(${titleBackgroundImg})`, | backgroundImage: `url(${titleBackgroundImg})`, | ||||
| width: '100%', | width: '100%', | ||||
| height: '100%', | height: '100%', | ||||
| backgroundSize:'contain', | |||||
| backgroundSize: 'contain', | |||||
| backgroundRepeat: 'no-repeat', | backgroundRepeat: 'no-repeat', | ||||
| backgroundColor: '#0C489E', | backgroundColor: '#0C489E', | ||||
| backgroundPosition: 'right' | backgroundPosition: 'right' | ||||
| } | } | ||||
| return ( | return ( | ||||
| <Grid container sx={{minHeight: '90vh'}} direction="column"> | |||||
| <Grid container sx={{ minHeight: '90vh' }} direction="column"> | |||||
| <Grid item xs={12} > | <Grid item xs={12} > | ||||
| <div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
| <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
| @@ -37,6 +43,39 @@ const DashboardDefault = () => { | |||||
| </Stack> | </Stack> | ||||
| </div> | </div> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={12} sx={{ textAlign: "center" }}> | |||||
| <Grid container justifyContent="center" spacing={2} sx={{ pt: 2 }} alignitems="stretch" > | |||||
| <Grid item xs={12} lg={5} sx={{ pt: 2 }} style={{ height: '100%' }}> | |||||
| <Box xs={12} md={12} sx={{ p: 4, border: '3px solid #e1edfc', borderRadius: '10px', backgroundColor: "#e1edfc" }} > | |||||
| <Stack direction="row" spacing={2}> | |||||
| <AdsClickRoundedIcon /> | |||||
| <Stack direction="column" alignItems="start"> | |||||
| <Typography variant="h4" >提交公共啟事申請</Typography> | |||||
| <Typography >提供你的啟事內容作排版,校對及計價。</Typography> | |||||
| </Stack> | |||||
| </Stack> | |||||
| </Box> | |||||
| <Stack direction="row" justifyContent="space-between" sx={{ pl: 2, pr: 2, pt: 2 }} > | |||||
| <Typography variant="h4">公告</Typography> | |||||
| <Button color="gray"><u>顯示所有公告</u></Button> | |||||
| </Stack> | |||||
| <Box xs={12} md={12} sx={{ p: 1, border: '3px solid #eee', borderRadius: '10px' }} > | |||||
| <Notice | |||||
| /> | |||||
| </Box> | |||||
| </Grid> | |||||
| <Grid item xs={12} lg={5} sx={{ pt: 2 }} style={{ height: '100%' }}> | |||||
| <Stack direction="row" justifyContent="space-between" sx={{ pl: 2, pr: 2, pt: 2 }} > | |||||
| <Typography variant="h4">系統消息</Typography> | |||||
| <Button color="gray"><u>顯示所有消息</u></Button> | |||||
| </Stack> | |||||
| <Box xs={12} md={12} sx={{ p: 1, border: '3px solid #eee', borderRadius: '10px' }} > | |||||
| <Message | |||||
| /> | |||||
| </Box> | |||||
| </Grid> | |||||
| </Grid> | |||||
| </Grid> | |||||
| </Grid> | </Grid> | ||||
| ); | ); | ||||
| }; | }; | ||||
| @@ -56,9 +56,11 @@ const Index = () => { | |||||
| }, | }, | ||||
| onError:(error)=>{ | onError:(error)=>{ | ||||
| console.log(error); | console.log(error); | ||||
| //window.location.assign("/iamsmart/loginFail"); | |||||
| window.location.assign("/iamsmart/loginFail"); | |||||
| } | } | ||||
| }); | }); | ||||
| }else{ | |||||
| window.location.assign("/iamsmart/loginFail"); | |||||
| } | } | ||||
| } | } | ||||
| @@ -18,24 +18,22 @@ const Index = () => { | |||||
| const navigate = useNavigate() | const navigate = useNavigate() | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| getPrfile(); | |||||
| goLogin(); | |||||
| }, []); | }, []); | ||||
| function getPrfile(){ | |||||
| function goLogin(){ | |||||
| dispatch(handleLogoutFunction()); | dispatch(handleLogoutFunction()); | ||||
| let params = new URLSearchParams(window.location.search) | let params = new URLSearchParams(window.location.search) | ||||
| if(params.get("code")){ | if(params.get("code")){ | ||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: UrlUtils.GET_SMART_LOGIN, | |||||
| url: UrlUtils.GET_SMART_DIRECT_LOGIN, | |||||
| params:{ | params:{ | ||||
| code: params.get("code") | code: params.get("code") | ||||
| }, | }, | ||||
| onSuccess: (responseData) => { | onSuccess: (responseData) => { | ||||
| //navigate('/iAmSmartRegisterFrom', { state: { responseData: responseData } }); | |||||
| console.log(response) | |||||
| console.log("responseData"); | |||||
| console.log(responseData); | |||||
| const userData = { | const userData = { | ||||
| id: responseData.id, | id: responseData.id, | ||||
| fullenName: responseData.name, | fullenName: responseData.name, | ||||
| @@ -48,17 +46,16 @@ const Index = () => { | |||||
| //avatar: require('src/assets/images/users/avatar-3.png').default, | //avatar: require('src/assets/images/users/avatar-3.png').default, | ||||
| } | } | ||||
| const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken } | const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken } | ||||
| // setSuccess(true) | |||||
| dispatch(handleLogin(data)) | dispatch(handleLogin(data)) | ||||
| navigate('/dashboard'); | navigate('/dashboard'); | ||||
| location.reload() | |||||
| }, | }, | ||||
| onFail: ()=>{ | |||||
| window.location.assign("/login"); | |||||
| onFail: (response)=>{ | |||||
| console.log("Fail"); | |||||
| console.log(response); | |||||
| window.location.assign("/iamsmart/loginFail"); | |||||
| }, | }, | ||||
| onError:()=>{ | |||||
| window.location.assign("/login"); | |||||
| onError:(error)=>{ | |||||
| console.log(error); | |||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -27,14 +27,22 @@ const Index = () => { | |||||
| }, | }, | ||||
| onSuccess: (responseData) => { | onSuccess: (responseData) => { | ||||
| navigate('/iAmSmartRegisterFrom', { state: { responseData: responseData } }); | navigate('/iAmSmartRegisterFrom', { state: { responseData: responseData } }); | ||||
| }, | |||||
| onFail: (response)=>{ | |||||
| console.log("Fail"); | |||||
| console.log(response); | |||||
| window.location.assign("/register"); | |||||
| }, | |||||
| onError:(error)=>{ | |||||
| console.log(error); | |||||
| window.location.assign("/register"); | |||||
| } | } | ||||
| }); | }); | ||||
| }else{ | |||||
| window.location.assign("/register"); | |||||
| } | } | ||||
| } | } | ||||
| return ( | return ( | ||||
| <LoadingComponent /> | <LoadingComponent /> | ||||
| ); | ); | ||||
| @@ -12,7 +12,8 @@ const RegisterForm = Loadable(lazy(() => import('pages/authentication/Register') | |||||
| const BusRegisterForm = Loadable(lazy(() => import('pages/authentication/BusRegister'))); | const BusRegisterForm = Loadable(lazy(() => import('pages/authentication/BusRegister'))); | ||||
| const IAmSmartRegister = Loadable(lazy(() => import('pages/authentication/IAmSmartRegister'))); | const IAmSmartRegister = Loadable(lazy(() => import('pages/authentication/IAmSmartRegister'))); | ||||
| const ErrorPage = Loadable(lazy(() => import('pages/extra-pages/ErrorPage'))); | const ErrorPage = Loadable(lazy(() => import('pages/extra-pages/ErrorPage'))); | ||||
| const IAmSmart_FallCallback = Loadable(lazy(() => import('pages/iAmSmart/FallCallback'))); | |||||
| 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 IAmSmart_FailCallback = Loadable(lazy(() => import('pages/iAmSmart/FailCallback'))); | ||||
| const IAmSmart_SuccessCallback = Loadable(lazy(() => import('pages/iAmSmart/SuccessCallback'))); | const IAmSmart_SuccessCallback = Loadable(lazy(() => import('pages/iAmSmart/SuccessCallback'))); | ||||
| const IAmSmart_AuthCallback = Loadable(lazy(() => import('pages/iAmSmart/AuthCallback'))); | const IAmSmart_AuthCallback = Loadable(lazy(() => import('pages/iAmSmart/AuthCallback'))); | ||||
| @@ -60,11 +61,11 @@ const LoginRoutes = { | |||||
| }, | }, | ||||
| { | { | ||||
| path: 'iamsmart/logincallback', | path: 'iamsmart/logincallback', | ||||
| element: <IAmSmart_FallCallback/> | |||||
| element: <IAmSmart_DirectLoginCallback/> | |||||
| }, | }, | ||||
| { | { | ||||
| path: 'iamsmart/loginfallback', | path: 'iamsmart/loginfallback', | ||||
| element: <IAmSmart_FallCallback/> | |||||
| element: <IAmSmart_FailCallback/> | |||||
| }, | }, | ||||
| { | { | ||||
| path: 'iamsmart/authcallback', | path: 'iamsmart/authcallback', | ||||
| @@ -53,6 +53,12 @@ const Palette = (mode) => { | |||||
| paper: paletteColor.grey[0], | paper: paletteColor.grey[0], | ||||
| default: paletteColor.grey.A50 | default: paletteColor.grey.A50 | ||||
| }, | }, | ||||
| gray: { | |||||
| main: '#777', | |||||
| light: '#777', | |||||
| dark: '#777', | |||||
| contrastText: '#FFF', | |||||
| }, | |||||
| white: { | white: { | ||||
| main: '#fff', | main: '#fff', | ||||
| light: '#fff', | light: '#fff', | ||||
| @@ -124,6 +124,7 @@ export const DELETE_EMAIL = apiPath+'/email/delete'; | |||||
| //iAmSmart | //iAmSmart | ||||
| export const GET_SMART_PROFILE = apiPath+'/smart/getProfile'; //POST | export const GET_SMART_PROFILE = apiPath+'/smart/getProfile'; //POST | ||||
| export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST | export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST | ||||
| export const GET_SMART_DIRECT_LOGIN = apiPath+'/smart/directLogin'; //POST | |||||
| //gen report | //gen report | ||||