| @@ -26,7 +26,7 @@ export const handleLogin = data => { | |||
| refreshToken: data['refreshToken'] | |||
| }) | |||
| console.log(data) | |||
| // console.log(data) | |||
| // ** Add to user, accessToken & refreshToken to localStorage | |||
| localStorage.setItem('userData', JSON.stringify(data)) | |||
| localStorage.setItem('accessToken', data.accessToken) | |||
| @@ -160,37 +160,41 @@ export const SetupAxiosInterceptors = () => { | |||
| throw refreshError; | |||
| }); | |||
| } else { | |||
| // if (error.response.status === 401) { | |||
| // await dispatch(handleLogoutFunction()); | |||
| // await navigate('/login'); | |||
| // await window.location.reload(); | |||
| // } | |||
| if (error.response.status === 401) { | |||
| if (localStorage.getItem("expiredAlertShown") === null) { | |||
| localStorage.setItem("expiredAlertShown", true) | |||
| alert("登入驗證已過期,請重新登入。") | |||
| if (isUserLoggedIn()){ | |||
| if (error.response.status === 401) { | |||
| if (localStorage.getItem("expiredAlertShown") === null) { | |||
| localStorage.setItem("expiredAlertShown", true) | |||
| alert("登入驗證已過期,請重新登入。") | |||
| } | |||
| } | |||
| } | |||
| // ** if (status === 401) { | |||
| if (response.status === 401) { | |||
| if (localStorage.getItem("expiredAlertShown") === null) { | |||
| localStorage.setItem("expiredAlertShown", true) | |||
| alert("登入驗證已過期,請重新登入。") | |||
| // ** if (status === 401) { | |||
| if (response.status === 401) { | |||
| if (localStorage.getItem("expiredAlertShown") === null) { | |||
| localStorage.setItem("expiredAlertShown", true) | |||
| alert("登入驗證已過期,請重新登入。") | |||
| } | |||
| } | |||
| } | |||
| if (response && response.status === 401) { | |||
| if (localStorage.getItem("expiredAlertShown") === null) { | |||
| localStorage.setItem("expiredAlertShown", true) | |||
| alert("登入驗證已過期,請重新登入。") | |||
| if (response && response.status === 401) { | |||
| if (localStorage.getItem("expiredAlertShown") === null) { | |||
| localStorage.setItem("expiredAlertShown", true) | |||
| alert("登入驗證已過期,請重新登入。") | |||
| } | |||
| } | |||
| if (localStorage.getItem("expiredAlertShown")) { | |||
| await dispatch(handleLogoutFunction()); | |||
| await navigate('/login'); | |||
| await window.location.reload(); | |||
| } | |||
| } else { | |||
| if (error.response.status === 401) { | |||
| await dispatch(handleLogoutFunction()); | |||
| await navigate('/login'); | |||
| // await window.location.reload(); | |||
| } | |||
| } | |||
| if (localStorage.getItem("expiredAlertShown")) { | |||
| dispatch(handleLogoutFunction()); | |||
| navigate('/login'); | |||
| } | |||
| } | |||
| @@ -44,7 +44,7 @@ export const getNonce = () => { | |||
| }; | |||
| export const getBowserType = () => { | |||
| console.log(navigator.userAgent) | |||
| // console.log(navigator.userAgent) | |||
| // const regex = /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Mi|huawei|Opera Mini|SAMSUNG|Samsung|SGH-[I|N|T]|GT-[I|N]|SM-[A|N|P|T|Z]|SHV-E|SCH-[I|J|R|S]|SPH-L/i; | |||
| // if(!regex.test(navigator.userAgent)) | |||
| if (navigator.userAgent.indexOf("Edg") != -1) { | |||
| @@ -1,7 +1,7 @@ | |||
| import React, { createContext, useState, useEffect } from 'react'; | |||
| import {useNavigate} from "react-router-dom"; | |||
| //import axios from "axios"; | |||
| // import {getUserData} from "../auth/utils"; | |||
| // import {getUserData} from "auth/utils"; | |||
| // import {isObjEmpty} from "../utils/Utils"; | |||
| import {useIdleTimer} from "react-idle-timer"; | |||
| import { handleLogoutFunction } from 'auth/index'; | |||
| @@ -51,14 +51,15 @@ const AutoLogoutProvider = ({ children }) => { | |||
| const lastActiveTab = isLastActiveTab() === null ? 'loading' : isLastActiveTab() | |||
| //const tabId = getTabId() === null ? 'loading' : getTabId().toString() | |||
| useEffect(() => { | |||
| // const userData = getUserData(); | |||
| if(isUserLoggedIn()){ | |||
| const getLogoutInterval = () =>{ | |||
| if(isUserLoggedIn()&&logoutInterval===1){ | |||
| //TODO: get auto logout time here | |||
| if(isGLDLoggedIn()){ | |||
| setLogoutInterval(240); | |||
| console.log("Set Logout Interval: 240") | |||
| }else{ | |||
| setLogoutInterval(60); | |||
| console.log("Set Logout Interval: 60") | |||
| } | |||
| // axios.get(`${apiPath}${GET_IDLE_LOGOUT_TIME}`, | |||
| // ) | |||
| @@ -74,11 +75,17 @@ const AutoLogoutProvider = ({ children }) => { | |||
| // }); | |||
| } | |||
| else{ | |||
| if(!isUserLoggedIn()&&logoutInterval>1){ | |||
| setLogoutInterval(1); | |||
| } | |||
| //navigate('/login'); | |||
| } | |||
| }, []); | |||
| } | |||
| useEffect(() => { | |||
| getLogoutInterval() | |||
| // console.log("AutoLogoutProvider Start") | |||
| // console.log(logoutInterval) | |||
| const interval = setInterval(async () => { | |||
| const currentTime = Date.now(); | |||
| getRemainingTime(); | |||
| @@ -91,6 +98,7 @@ const AutoLogoutProvider = ({ children }) => { | |||
| alert("登入驗證已過期,請重新登入。") | |||
| dispatch(handleLogoutFunction()); | |||
| navigate('/login'); | |||
| window.location.reload(); | |||
| } | |||
| } | |||
| } | |||
| @@ -42,7 +42,7 @@ const Index = () => { | |||
| }, [record]); | |||
| React.useEffect(() => { | |||
| console.log(searchCriteria) | |||
| // console.log(searchCriteria) | |||
| loadGrid(); | |||
| }, [searchCriteria]); | |||
| @@ -57,14 +57,14 @@ const Index = () => { | |||
| } | |||
| function downloadXML(input) { | |||
| console.log(input) | |||
| // console.log(input) | |||
| HttpUtils.get({ | |||
| url: UrlUtils.GEN_GFMIS_XML + "/today", | |||
| params:{dateTo: input.dateTo, | |||
| dateFrom: input.dateFrom, | |||
| }, | |||
| onSuccess: (responseData) => { | |||
| console.log(responseData) | |||
| // console.log(responseData) | |||
| const parser = new DOMParser(); | |||
| const xmlDoc = parser.parseFromString(responseData, 'application/xml'); | |||
| const filename = xmlDoc.querySelector('FileHeader').getAttribute('H_Filename'); | |||
| @@ -54,7 +54,7 @@ const OrganizationDetailPage = () => { | |||
| const notCreditor = locale === 'en' ?"No":locale === 'zh-HK' ?"否":"否"; | |||
| React.useEffect(() => { | |||
| console.log(formData); | |||
| // console.log(formData); | |||
| if (isINDLoggedIn()||isORGLoggedIn()&&!isPrimaryLoggedIn()){ | |||
| navigate('/dashboard'); | |||
| }else{ | |||
| @@ -70,7 +70,7 @@ const OrganizationDetailPage = () => { | |||
| HttpUtils.get({ | |||
| url: UrlUtils.GET_ORG_PATH + "/" + params.id, | |||
| onSuccess: function (response) { | |||
| console.log(response) | |||
| // console.log(response) | |||
| response.data["country"] = getObjectByValue(ComboData.country, "key", response.data.addressTemp?.country); | |||
| response.data["district"] = getObjectByValue(ComboData.district, "key", response.data.addressTemp?.district); | |||
| response.data["addressLine1"] = response.data.addressTemp?.addressLine1; | |||
| @@ -94,7 +94,7 @@ const OrganizationDetailPage = () => { | |||
| HttpUtils.get({ | |||
| url: UrlUtils.GET_PUB_ORG_PATH, | |||
| onSuccess: function (response) { | |||
| console.log(response) | |||
| // console.log(response) | |||
| response.data["creditor"] = response.data.creditor!=null?response.data.creditor?isCreditor:notCreditor:notCreditor; | |||
| response.data["country"] = getObjectByValue(ComboData.country, "key", response.data.addressTemp?.country); | |||
| response.data["district"] = getObjectByValue(ComboData.district, "key", response.data.addressTemp?.district); | |||
| @@ -24,7 +24,7 @@ const OrganizationDetailPage_FromUser = () => { | |||
| useEffect(()=>{ | |||
| console.log(formData); | |||
| // console.log(formData); | |||
| loadData(); | |||
| },[]); | |||
| @@ -4,7 +4,7 @@ import { | |||
| Typography, | |||
| Stack, | |||
| Box, | |||
| // Button | |||
| Button | |||
| } from '@mui/material'; | |||
| import * as UrlUtils from "utils/ApiPathConst"; | |||
| import * as React from "react"; | |||
| @@ -17,6 +17,7 @@ import Loadable from 'components/Loadable'; | |||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||
| const PaymentDetails = Loadable(React.lazy(() => import('./PaymentDetails'))); | |||
| const DataGrid = Loadable(React.lazy(() => import('./DataGrid'))); | |||
| import ForwardIcon from '@mui/icons-material/Forward'; | |||
| import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||
| import {FormattedMessage} from "react-intl"; | |||
| const BackgroundHead = { | |||
| @@ -34,6 +35,7 @@ const BackgroundHead = { | |||
| const Index = () => { | |||
| const params = useParams(); | |||
| const navigate = useNavigate() | |||
| const intl = useIntl(); | |||
| const [record, setRecord] = React.useState(); | |||
| const [itemList, setItemList] = React.useState([]); | |||
| @@ -99,6 +101,15 @@ const Index = () => { | |||
| </Stack> | |||
| </div> | |||
| </Grid> | |||
| <Grid item xs={12} width={{xs:"90%", sm:"90%", md:"60%", lg:"60%"}}> | |||
| <Button | |||
| aria-label={intl.formatMessage({id: 'back'})} | |||
| title={intl.formatMessage({id: 'back'})} | |||
| sx={{ ml: 0, mt: 2.5 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate(-1) }} | |||
| > | |||
| <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} /> | |||
| </Button> | |||
| </Grid> | |||
| {/*row 1*/} | |||
| <Grid item xs={12} md={12} spacing={2} sx={{ textAlign: "center" }}> | |||
| <Grid container justifyContent="center" direction="column" spacing={2} sx={{ p: 2 }} alignitems="stretch" > | |||
| @@ -89,7 +89,7 @@ const MultiPaymentWindow = (props) => { | |||
| // }, [availableMethodData]); | |||
| useEffect(() => { | |||
| console.log(paymentMethod) | |||
| // console.log(paymentMethod) | |||
| // const subtype = (paymentMethod === "Visa" || paymentMethod === "MasterCard" || paymentMethod === "JCB" || paymentMethod === "UnionPay") ? "CreditCard" : paymentMethod; | |||
| // const filteredPaymentMethod = availableMethodData.filter(obj => obj.subtype === subtype); | |||
| const filteredPaymentMethod = availableMethodData.filter(obj => { | |||
| @@ -98,7 +98,7 @@ const MultiPaymentWindow = (props) => { | |||
| } | |||
| return obj.subtype === paymentMethod; | |||
| }); | |||
| console.log(filteredPaymentMethod) | |||
| // console.log(filteredPaymentMethod) | |||
| setFilteredPaymentMethod(filteredPaymentMethod); | |||
| setFpsClass(paymentMethod == "FPS" || paymentMethod == "" ? "" : "grayscale") | |||
| @@ -301,7 +301,7 @@ const Index = () => { | |||
| } | |||
| useEffect(() => { | |||
| console.log(availableMethods) | |||
| // console.log(availableMethods) | |||
| if (availableMethods.length > 0) { | |||
| availableMethods.forEach((method) => { | |||
| if (method.subtype === "FPS") { | |||
| @@ -76,7 +76,7 @@ const AuthLoginCustom = () => { | |||
| useJwt | |||
| .login({ username: values.username, password: values.password }) | |||
| .then((response) => { | |||
| console.log(response) | |||
| // console.log(response) | |||
| const userData = { | |||
| id: response.data.id, | |||
| fullenName: response.data.name, | |||
| @@ -86,14 +86,24 @@ const AuthLoginCustom = () => { | |||
| role: response.data.role, | |||
| abilities: response.data.abilities, | |||
| creditor: response.data.creditor, | |||
| locale: response.data.preferLocale, | |||
| //avatar: require('src/assets/images/users/avatar-3.png').default, | |||
| } | |||
| const data = { ...userData, accessToken: response.data.accessToken, refreshToken: response.data.refreshToken } | |||
| // setSuccess(true) | |||
| console.log(response.data.role); | |||
| // console.log(response.data); | |||
| if(response.data.type === "GLD"){ | |||
| setLocale("en"); | |||
| localStorage.setItem('locale','en'); | |||
| }else{ | |||
| if (response.data.preferLocale ==="zh_HK"){ | |||
| setLocale("zh-HK"); | |||
| localStorage.setItem('locale','zh-HK'); | |||
| } | |||
| if (response.data.preferLocale ==="zh-CN"){ | |||
| setLocale("zh-CN"); | |||
| localStorage.setItem('locale','zh-CN'); | |||
| } | |||
| } | |||
| dispatch(handleLogin(data)) | |||
| navigate('/dashboard'); | |||
| @@ -220,7 +220,7 @@ const BusCustomFormWizard = (props) => { | |||
| }; | |||
| const handleCheckBoxChange = (event) => { | |||
| console.log(event.target) | |||
| // console.log(event.target) | |||
| if (event.target.name == 'termsAndConAccept') { | |||
| setTermsAndConAccept(event.target.checked) | |||
| setTermsAndConNotAccept(!event.target.checked) | |||
| @@ -295,8 +295,8 @@ const BusCustomFormWizard = (props) => { | |||
| saveFileList.push(file) | |||
| updateList.items.add(file); | |||
| } | |||
| console.log("currentIndex") | |||
| console.log(currentIndex) | |||
| // console.log("currentIndex") | |||
| // console.log(currentIndex) | |||
| } | |||
| let updatedFileList = updateList.files; | |||
| @@ -391,8 +391,10 @@ const BusCustomFormWizard = (props) => { | |||
| "Content-Type": "multipart/form-data" | |||
| } | |||
| }) | |||
| .then((response) => { | |||
| console.log(response) | |||
| .then(( | |||
| // response | |||
| ) => { | |||
| // console.log(response) | |||
| setCheckUpload(true) | |||
| setLoding(false); | |||
| }) | |||
| @@ -1,26 +1,21 @@ | |||
| import { useEffect, useState, } from 'react'; | |||
| import { useEffect, useState } from 'react'; | |||
| // material-ui | |||
| import { | |||
| Box, | |||
| Button, | |||
| FormControl, | |||
| FormHelperText, | |||
| Button, Checkbox | |||
| // MenuItem | |||
| , FormControl, FormGroup, FormHelperText, | |||
| Grid, IconButton, | |||
| InputAdornment, | |||
| InputLabel, OutlinedInput, | |||
| Stack, | |||
| Typography, | |||
| FormGroup, | |||
| TextField, | |||
| Checkbox | |||
| // MenuItem | |||
| Stack, TextField, Typography | |||
| } from '@mui/material'; | |||
| import { useForm, } from 'react-hook-form' | |||
| import Autocomplete from "@mui/material/Autocomplete"; | |||
| import { useForm } from 'react-hook-form'; | |||
| // third party | |||
| import { useFormik, FormikProvider } from 'formik'; | |||
| import { FormikProvider, useFormik } from 'formik'; | |||
| import * as yup from 'yup'; | |||
| // import axios from "axios"; | |||
| @@ -29,7 +24,7 @@ import * as yup from 'yup'; | |||
| import { strengthColorChi, strengthIndicator } from 'utils/password-strength'; | |||
| // import {apiPath} from "auth/utils"; | |||
| import axios from "axios"; | |||
| import { POST_PUBLIC_USER_REGISTER, POST_CAPTCHA, GET_USERNAME, GET_USER_EMAIL } from "utils/ApiPathConst"; | |||
| import { GET_USERNAME, GET_USER_EMAIL, POST_CAPTCHA, POST_PUBLIC_USER_REGISTER } from "utils/ApiPathConst"; | |||
| // import * as HttpUtils from 'utils/HttpUtils'; | |||
| import * as ComboData from "utils/ComboData"; | |||
| @@ -44,15 +39,15 @@ const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingCo | |||
| // assets | |||
| import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; | |||
| // import { Paper } from '../../../../node_modules/@mui/material/index'; | |||
| import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; | |||
| import { ThemeProvider } from "@emotion/react"; | |||
| import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; | |||
| import { Link } from 'react-router-dom'; | |||
| import * as HttpUtils from "../../../utils/HttpUtils"; | |||
| import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; | |||
| import LoopIcon from '@mui/icons-material/Loop'; | |||
| import { useTheme } from '@mui/material/styles'; | |||
| import {PNSPS_LONG_BUTTON_THEME} from "../../../themes/buttonConst"; | |||
| import {ThemeProvider} from "@emotion/react"; | |||
| import {FormattedMessage, useIntl} from "react-intl"; | |||
| import { FormattedMessage, useIntl } from "react-intl"; | |||
| import { Link } from 'react-router-dom'; | |||
| import { PNSPS_LONG_BUTTON_THEME } from "../../../themes/buttonConst"; | |||
| import * as HttpUtils from "../../../utils/HttpUtils"; | |||
| // ============================|| FIREBASE - REGISTER ||============================ // | |||
| @@ -316,7 +311,7 @@ const CustomFormWizard = (props) => { | |||
| values.idDocType = selectedIdDocType.type | |||
| values.address4 = selectedAddress4==null?"":selectedAddress4.key | |||
| values.address5 = selectedAddress5.key | |||
| console.log(values) | |||
| // console.log(values) | |||
| const userAddress = { | |||
| "addressLine1": "", | |||
| "addressLine2": "", | |||
| @@ -386,8 +381,10 @@ const CustomFormWizard = (props) => { | |||
| "Content-Type": "multipart/form-data" | |||
| } | |||
| }) | |||
| .then((response) => { | |||
| console.log(response) | |||
| .then(( | |||
| // response | |||
| ) => { | |||
| // console.log(response) | |||
| setCheckUpload(true) | |||
| setLoding(false); | |||
| }) | |||
| @@ -1,11 +1,11 @@ | |||
| // material-ui | |||
| import * as React from 'react'; | |||
| import RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline'; | |||
| import { | |||
| DataGrid, | |||
| GridActionsCellItem, | |||
| GridRowModes | |||
| } from "@mui/x-data-grid"; | |||
| import RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline'; | |||
| import * as React from 'react'; | |||
| import { useEffect } from "react"; | |||
| // import {useNavigate} from "react-router-dom"; | |||
| // import { useTheme } from '@mui/material/styles'; | |||
| @@ -14,7 +14,7 @@ import { | |||
| Stack, | |||
| Typography | |||
| } from '@mui/material'; | |||
| import {FormattedMessage} from "react-intl"; | |||
| import { FormattedMessage } from "react-intl"; | |||
| // ==============================|| EVENT TABLE ||============================== // | |||
| export default function UploadFileTable({ recordList, setUpdateRows, }) { | |||
| @@ -46,10 +46,10 @@ export default function UploadFileTable({ recordList, setUpdateRows, }) { | |||
| ...rowModesModel, | |||
| [id]: { mode: GridRowModes.View, ignoreModifications: true }, | |||
| }); | |||
| console.log("Starting Delete") | |||
| const editedRow = rows.find((row) => row.id === id); | |||
| console.log(editedRow) | |||
| console.log(editedRow.isNew) | |||
| // console.log("Starting Delete") | |||
| // const editedRow = rows.find((row) => row.id === id); | |||
| // console.log(editedRow) | |||
| // console.log(editedRow.isNew) | |||
| setUpdateRows(rows.filter((row) => row.id !== id)); | |||
| setRows(rows.filter((row) => row.id !== id)); | |||
| } | |||
| @@ -43,9 +43,23 @@ const Index = () => { | |||
| role: responseData.role, | |||
| abilities: responseData.abilities, | |||
| creditor: responseData.creditor, | |||
| locale: responseData.preferLocale, | |||
| //avatar: require('src/assets/images/users/avatar-3.png').default, | |||
| } | |||
| const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken } | |||
| if(responseData.type === "GLD"){ | |||
| setLocale("en"); | |||
| localStorage.setItem('locale','en'); | |||
| }else{ | |||
| if (responseData.preferLocale ==="zh_HK"){ | |||
| setLocale("zh-HK"); | |||
| localStorage.setItem('locale','zh-HK'); | |||
| } | |||
| if (responseData.preferLocale ==="zh-CN"){ | |||
| setLocale("zh-CN"); | |||
| localStorage.setItem('locale','zh-CN'); | |||
| } | |||
| } | |||
| dispatch(handleLogin(data)) | |||
| navigate('/dashboard'); | |||
| }, | |||