From 328778554b033c06a24f9bcb2a95a8b2711042f9 Mon Sep 17 00:00:00 2001 From: "jason.lam" Date: Tue, 23 Jan 2024 14:45:34 +0800 Subject: [PATCH 1/3] force to english for admin login --- src/components/FiDataGrid.js | 31 +++++++------------ .../authentication/auth-forms/AuthLogin.js | 4 ++- .../auth-forms/AuthLoginCustom.js | 9 +++++- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/components/FiDataGrid.js b/src/components/FiDataGrid.js index 761b5ec..f8a89bc 100644 --- a/src/components/FiDataGrid.js +++ b/src/components/FiDataGrid.js @@ -4,7 +4,7 @@ import { DataGrid, GridOverlay, } from "@mui/x-data-grid"; import {FormattedMessage, useIntl} from "react-intl"; -import {Typography} from '@mui/material'; +import {TablePagination, Typography} from '@mui/material'; // ==============================|| EVENT TABLE ||============================== // @@ -124,27 +124,12 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, return ( - + ); } - const CustomPagination = (props) => { - const { pagination } = props; - const { page, pageSize, rowCount } = pagination; - - const startIndex = page * pageSize + 1; - const endIndex = Math.min((page + 1) * pageSize, rowCount); - - return ( -
-
{`${startIndex}-${endIndex} YES ${rowCount}`}
- {/* Render other pagination controls */} -
- ); - }; - return ( ( + { + return '' + from + '-' + to + ' 123 ' + count + } + } + /> + ), }} componentsProps={{ pagination: { - labelRowsPerPage: intl.formatMessage({id: 'rowsPerPage'}), + labelRowsPerPage: intl.formatMessage({id: 'rowsPerPage'}) + ":", } }} /> diff --git a/src/pages/authentication/auth-forms/AuthLogin.js b/src/pages/authentication/auth-forms/AuthLogin.js index 9e962fe..4eb1de5 100644 --- a/src/pages/authentication/auth-forms/AuthLogin.js +++ b/src/pages/authentication/auth-forms/AuthLogin.js @@ -1,4 +1,4 @@ -import React, {useEffect, useState} from 'react'; +import React, {useContext, useEffect, useState} from 'react'; import {useNavigate} from 'react-router-dom'; // material-ui @@ -36,6 +36,7 @@ import {useDispatch} from "react-redux"; import {handleLogin} from "auth/index"; import { notifyActionSuccess } from 'utils/CommonFunction'; import {FormattedMessage} from "react-intl"; +import LocaleContext from "../../../components/I18nProvider"; // ============================|| FIREBASE - LOGIN ||============================ // const AuthLogin = () => { @@ -69,6 +70,7 @@ const AuthLogin = () => { }) .then((response) => { //setPosts("12354") + console.log(response.data); setPosts(response.data); const userData = { id: response.data.id, diff --git a/src/pages/authentication/auth-forms/AuthLoginCustom.js b/src/pages/authentication/auth-forms/AuthLoginCustom.js index 0784c6a..59f85f8 100644 --- a/src/pages/authentication/auth-forms/AuthLoginCustom.js +++ b/src/pages/authentication/auth-forms/AuthLoginCustom.js @@ -1,7 +1,7 @@ import React, { useEffect, useState, - lazy + lazy, useContext } from 'react'; import { Link as RouterLink } from 'react-router-dom'; import { useNavigate } from 'react-router-dom'; @@ -45,12 +45,14 @@ import { handleLogin } from "auth/index"; import useJwt from "../../../auth/jwt/useJwt"; import { handleLogoutFunction } from 'auth/index'; import {FormattedMessage, useIntl} from "react-intl"; +import LocaleContext from "../../../components/I18nProvider"; // ============================|| FIREBASE - LOGIN ||============================ // const AuthLoginCustom = () => { const dispatch = useDispatch() const navigate = useNavigate() const intl = useIntl(); + const { setLocale } = useContext(LocaleContext); const [showPassword, setShowPassword] = useState(false); const handleClickShowPassword = () => { @@ -88,6 +90,11 @@ const AuthLoginCustom = () => { } const data = { ...userData, accessToken: response.data.accessToken, refreshToken: response.data.refreshToken } // setSuccess(true) + console.log(response.data.role); + if(response.data.type === "GLD"){ + setLocale("en"); + localStorage.setItem('locale','en'); + } dispatch(handleLogin(data)) navigate('/dashboard'); location.reload() From 112577e2cb52cd56b2fcf4adef2ba88157c500ed Mon Sep 17 00:00:00 2001 From: "jason.lam" Date: Tue, 23 Jan 2024 14:59:31 +0800 Subject: [PATCH 2/3] update GLD layout --- src/pages/DemandNote/Create/SearchForm.js | 1 + src/pages/DemandNote/Search/SearchForm.js | 12 ++++++------ src/pages/Payment/Search_GLD/SearchForm.js | 1 + src/pages/Proof/Search_GLD/SearchForm.js | 4 ++++ src/pages/PublicNotice/Search_GLD/SearchForm.js | 2 ++ .../UserSearchForm_Individual.js | 1 + .../UserSearchForm_Organization.js | 1 + .../pnspsUserGroupSearchPage/UserGroupSearchForm.js | 8 ++------ src/themes/themeConst.js | 2 +- 9 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/pages/DemandNote/Create/SearchForm.js b/src/pages/DemandNote/Create/SearchForm.js index 339e8c9..740cde8 100644 --- a/src/pages/DemandNote/Create/SearchForm.js +++ b/src/pages/DemandNote/Create/SearchForm.js @@ -144,6 +144,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p - + - + diff --git a/src/themes/themeConst.js b/src/themes/themeConst.js index 7ff2665..ce35db6 100644 --- a/src/themes/themeConst.js +++ b/src/themes/themeConst.js @@ -77,7 +77,7 @@ export const PNSPS_THEME = createTheme({ }, '&.MuiButton-root':{ fontSize: '1.2rem', - alignItems: 'normal', + alignItems: 'center', }, } } From 09edfba097c2829c4a4a438b59c31b4526c9b602 Mon Sep 17 00:00:00 2001 From: "jason.lam" Date: Tue, 23 Jan 2024 15:30:36 +0800 Subject: [PATCH 3/3] update gld user page --- src/components/FiDataGrid.js | 2 +- src/pages/Message/Details/index.js | 4 ++-- src/pages/User/DetailPage/UserAuthTable.js | 14 +++++--------- src/pages/User/DetailPage/UserAuthorityCard.js | 3 ++- src/pages/User/DetailPage/UserGroupCard.js | 3 ++- src/pages/User/DetailPage/UserGroupTable.js | 3 --- src/pages/User/DetailPage/UserInformationCard.js | 7 ++++--- src/pages/User/DetailPage/index.js | 10 +++++----- src/translations/en.json | 4 ++++ src/translations/zh-CN.json | 4 ++++ src/translations/zh-HK.json | 4 ++++ 11 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/components/FiDataGrid.js b/src/components/FiDataGrid.js index f8a89bc..58be5c4 100644 --- a/src/components/FiDataGrid.js +++ b/src/components/FiDataGrid.js @@ -153,7 +153,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, { - return '' + from + '-' + to + ' 123 ' + count + return '' + from + '-' + to + ' ' + count } } /> diff --git a/src/pages/Message/Details/index.js b/src/pages/Message/Details/index.js index bbdab8f..25254fc 100644 --- a/src/pages/Message/Details/index.js +++ b/src/pages/Message/Details/index.js @@ -79,7 +79,7 @@ const Index = () => {
- + {record?.subject} {DateUtils.datetimeStr(record?.sentDate)} @@ -87,7 +87,7 @@ const Index = () => {
- +