From 212a3ce7cfae9d92397455fa812e3817b64ee241 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 22 Sep 2023 17:54:12 +0800 Subject: [PATCH] fix bug --- src/layout/MainLayout/Header/index.js | 414 +++++++++---------- src/pages/PublicNoticeSearch_GLD/DataGrid.js | 16 +- src/routes/index.js | 49 +-- 3 files changed, 237 insertions(+), 242 deletions(-) diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index 52b85a6..77bc603 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -1,13 +1,13 @@ import PropTypes from 'prop-types'; import React -,{useState} - from 'react'; -import {useDispatch} from "react-redux"; -import {useNavigate} from "react-router-dom"; +, { useState } + from 'react'; +import { useDispatch } from "react-redux"; +import { useNavigate } from "react-router-dom"; // material-ui // import { useTheme } from '@mui/material/styles'; -import { +import { AppBar, // Container, Typography, @@ -29,7 +29,7 @@ import { IconButton, Drawer, // useMediaQuery - } from '@mui/material'; +} from '@mui/material'; import MenuIcon from '@mui/icons-material/Menu'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; @@ -41,7 +41,7 @@ import AdminLogo from 'components/AdminLogo'; import MobileLogo from 'components/MobileLogo'; import Profile from './HeaderContent/Profile'; import "assets/style/navbarStyles.css"; -import {isUserLoggedIn,isGLDLoggedIn, isPrimaryLoggedIn} from "utils/Utils"; +import { isUserLoggedIn, isGLDLoggedIn, isPrimaryLoggedIn } from "utils/Utils"; import { handleLogoutFunction } from 'auth/index'; // assets @@ -69,77 +69,77 @@ function Header(props) { //await handleLogoutFunction(); navigate('/login'); }; - + const loginContent = ( isGLDLoggedIn() ? -
-
  • - Dashboard -
  • -
  • - Application -
  • -
  • - Proof -
  • -
  • - Payment -
  • -
  • - Client -
      -
    • - Users (GLD) -
    • -
    • - Users (Individual) -
    • -
    • - Users (Organization) -
    • -
    • - Organization -
    • -
    • - User Group -
    • -
    -
  • -
  • - Logout -
  • -
    - : -
    -
  • - 主頁 -
  • -
  • - 我的公共啟事 -
  • -
  • - 校對記錄 -
  • -
  • - 付款記錄 -
  • -
  • - 設定 -
      - { isPrimaryLoggedIn()? -
    • - 公司/機構用戶記錄 -
    • - : - <> - } - -
    -
  • -
  • - 登出 -
  • -
    +
    +
  • + Dashboard +
  • +
  • + Application +
  • +
  • + Proof +
  • +
  • + Payment +
  • +
  • + Client +
      +
    • + Users (GLD) +
    • +
    • + Users (Individual) +
    • +
    • + Users (Organization) +
    • +
    • + Organization +
    • +
    • + User Group +
    • +
    +
  • +
  • + Logout +
  • +
    + : +
    +
  • + 主頁 +
  • +
  • + 我的公共啟事 +
  • +
  • + 校對記錄 +
  • +
  • + 付款記錄 +
  • +
  • + 設定 + {isPrimaryLoggedIn() ? +
      + +
    • + 公司/機構用戶記錄 +
    • +
    + : + <> + } +
  • +
  • + 登出 +
  • +
    ); const logoutContent = ( @@ -154,7 +154,7 @@ function Header(props) { ); const drawer = ( - isUserLoggedIn()? + isUserLoggedIn() ? PNSPS @@ -170,7 +170,7 @@ function Header(props) { - : + : PNSPS @@ -185,165 +185,165 @@ function Header(props) { const container = window !== undefined ? () => window().document.body : undefined; return ( - isUserLoggedIn() ? - // User Login success - - - - {isGLDLoggedIn() - ? - - - - + + + {isGLDLoggedIn() + ? + + + + - - - - - PNSPS - - : - - - - - - 公共啟事提交 - 及繳費系統 + + + + + PNSPS + + : + + + + + + 公共啟事提交 + 及繳費系統 + - - - + - - - - - - 公共啟事提交及繳費系統 - - - - } - - + + + + + + 公共啟事提交及繳費系統 + + + + } + + + + + + + + + + + + {drawer} + + + : + + + - - - - - - - - - {drawer} - - - : - - - - - + - - + + 公共啟事提交及繳費系統 - - - - - - 公共啟事提交及繳費系統 - - - - - - {/* */} + + + + + 公共啟事提交及繳費系統 + - - - - - - {drawer} - + + + + {/* */} + + + + + + + {drawer} + + - ); } Header.propTypes = { diff --git a/src/pages/PublicNoticeSearch_GLD/DataGrid.js b/src/pages/PublicNoticeSearch_GLD/DataGrid.js index 5bf1af1..8c90287 100644 --- a/src/pages/PublicNoticeSearch_GLD/DataGrid.js +++ b/src/pages/PublicNoticeSearch_GLD/DataGrid.js @@ -27,10 +27,13 @@ export default function SearchPublicNoticeTable({ recordList }) { const columns = [ { - id: 'appNo', - field: 'appNo', + field: 'actions', headerName: 'App No.', flex: 1, + cellClassName: 'actions', + renderCell: (params) => { + return ; + }, }, { id: 'created', @@ -85,15 +88,6 @@ export default function SearchPublicNoticeTable({ recordList }) { return [StatusUtils.getStatusEng(params)] }, }, - { - field: 'actions', - headerName: '', - width: 100, - cellClassName: 'actions', - renderCell: (params) => { - return ; - }, - } ]; diff --git a/src/routes/index.js b/src/routes/index.js index 5024fa2..323c0bf 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -4,17 +4,18 @@ import MainRoutes from './MainRoutes' import PublicUserRoutes from './PublicUserRoutes' import GLDUserRoutes from './GLDUserRoutes' import TestRoutes from './_TestRoutes' -import {useRoutes} from 'react-router-dom' -import {isUserLoggedIn, - // isAdminLoggedIn, - isGLDLoggedIn, - isINDLoggedIn, - isORGLoggedIn, - } from "utils/Utils"; -import {Navigate} from "react-router"; -import { +import { useRoutes } from 'react-router-dom' +import { + isUserLoggedIn, + // isAdminLoggedIn, + isGLDLoggedIn, + isINDLoggedIn, + isORGLoggedIn, +} from "utils/Utils"; +import { Navigate } from "react-router"; +import { setupAxiosInterceptors, - } from "../auth"; +} from "../auth"; import SettingRoutes from './SettingRoutes'; // import Loadable from 'components/Loadable'; // import { lazy } from 'react'; @@ -23,39 +24,39 @@ import SettingRoutes from './SettingRoutes'; export default function ThemeRoutes() { - if(isUserLoggedIn()){ + if (isUserLoggedIn()) { //auto logout if token not valid setupAxiosInterceptors(); } -console.log(); + console.log(); return useRoutes([{ path: '', children: [ (isUserLoggedIn() ? { path: '', - element: + element: } : { path: '', - element: + element: }) ] }, - isUserLoggedIn() ? MainRoutes : LoginRoutes, - isUserLoggedIn()&&isINDLoggedIn()||isUserLoggedIn()&&isORGLoggedIn() ? PublicUserRoutes : LoginRoutes, - isUserLoggedIn()&&isGLDLoggedIn() ? SettingRoutes : LoginRoutes, - isUserLoggedIn()&&isGLDLoggedIn() ? GLDUserRoutes : LoginRoutes, - !isUserLoggedIn()?{ - path: '*', - element: - }: + isUserLoggedIn() ? MainRoutes : LoginRoutes, + isUserLoggedIn() && isINDLoggedIn() || isUserLoggedIn() && isORGLoggedIn() ? PublicUserRoutes : LoginRoutes, + isUserLoggedIn() && isGLDLoggedIn() ? SettingRoutes : LoginRoutes, + isUserLoggedIn() && isGLDLoggedIn() ? GLDUserRoutes : LoginRoutes, + !isUserLoggedIn() ? { + path: '*', + element: + } : { path: '*', - element: + element: }, - isUserLoggedIn()&&isGLDLoggedIn()&&JSON.parse(localStorage.getItem('userData')).fullenName=="2fi" ?TestRoutes:{}, + isUserLoggedIn() && isGLDLoggedIn() && JSON.parse(localStorage.getItem('userData')).fullenName == "2fi" ? TestRoutes : {}, ]); }