diff --git a/src/apis/judge.js b/src/apis/judge.js index db95379..57f16d1 100644 --- a/src/apis/judge.js +++ b/src/apis/judge.js @@ -17,12 +17,22 @@ import { REMOVE_ADMIN_JUDGE_DATA, GET_JUDGE_LIST, SAVE_JUDGE_RESULT, - SAVE_ADMIN_JUDGE_STDS + SAVE_ADMIN_JUDGE_STDS, + GET_DASHBOARD } from 'commons/ApiUrl'; import { setRowId } from './common'; import FileSaver from 'file-saver'; import _ from 'lodash'; +export async function findDashboard() { + const res = await axios.get(GET_DASHBOARD); + if (res.success) { + // res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} + // eslint-disable-next-line no-return-await export async function findJudgeDatas(params) { const res = await axios.get(GET_ADMIN_JUDGE_DATA_LIST, { params }); diff --git a/src/commons/ApiUrl.js b/src/commons/ApiUrl.js index deaeb92..a3dc57b 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -4,9 +4,10 @@ export const LOGIN_URL = '/api/v1/ctgy/account/login'; export const GET_CMM_CODE_LIST = '/api/v1/biz/cmm/combo'; export const GET_FILE_DOWNLOAD = '/api/v1/ctgy/file/download/'; +export const GET_DASHBOARD = '/api/v1/ctgy/dashboard'; + // 공지사항 export const GET_PUBLIC_BOARD_LIST = '/api/v1/ctgy/pboard'; -export const GET_PUBLIC_BOARD = '/api/v1/ctgy/pboard/'; export const SAVE_PUBLIC_BOARD_HIT_CNT = '/api/v1/ctgy/pboard/hit/'; export const SAVE_PUBLIC_BOARD = '/api/v1/ctgy/file/pboard'; export const REMOVE_PUBLIC_BOARD = '/api/v1/ctgy/file/pboard/'; diff --git a/src/config.js b/src/config.js index f1d4425..0e870cc 100755 --- a/src/config.js +++ b/src/config.js @@ -7,7 +7,7 @@ export const JWT_API = { // like '/berry-material-react/react/default' export const BASE_PATH = ''; -export const DASHBOARD_PATH = '/dashboard/default'; +export const DASHBOARD_PATH = '/dashboard'; const config = { fontFamily: `'Roboto', sans-serif`, diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index 79e097d..add6aaa 100755 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -7,7 +7,6 @@ import LogoSection from '../LogoSection'; import ProfileSection from './ProfileSection'; import { useDispatch, useSelector } from 'store'; import { openDrawer } from 'store/slices/menu'; -import useAuth from 'hooks/useAuth'; // assets import { IconMenu2 } from '@tabler/icons'; diff --git a/src/layout/MainLayout/index.js b/src/layout/MainLayout/index.js index 3f02f77..b6cee38 100755 --- a/src/layout/MainLayout/index.js +++ b/src/layout/MainLayout/index.js @@ -70,7 +70,6 @@ const Main = styled('main', { shouldForwardProp: (prop) => prop !== 'open' })(({ const MainLayout = () => { const { accesstype } = useAuth(); - console.log(`###############`, accesstype); const theme = useTheme(); const matchDownMd = useMediaQuery(theme.breakpoints.down('lg')); @@ -119,8 +118,7 @@ const MainLayout = () => { { <> , type: 'item', icon: icons.IconClipboardCheck, - url: '/publicBoard', - breadcrumbs: true + url: '/publicBoard' }, { /* 주정차 의견 진술 */ @@ -160,14 +159,6 @@ const admin = { url: '/user/management', icon: icons.IconUserCheck }, - // { - // /* SMS 관리 */ - // id: 'admin-6', - // title: , - // type: 'item', - // url: '/sms/management', - // icon: icons.IconMessage - // }, { /* 게시판 관리 */ id: 'admin-7', diff --git a/src/menu-items/dashboard.js b/src/menu-items/dashboard.js index e422fcc..77dc2bd 100755 --- a/src/menu-items/dashboard.js +++ b/src/menu-items/dashboard.js @@ -1,39 +1,19 @@ -// // third-party -// import { FormattedMessage } from 'react-intl'; -// -// // assets -// import { IconDashboard, IconDeviceAnalytics } from '@tabler/icons'; -// -// // constant -// const icons = { -// IconDashboard, -// IconDeviceAnalytics -// }; -// -// // ==============================|| DASHBOARD MENU ITEMS ||============================== // -// -// const dashboard = { -// id: 'dashboard', -// title: , -// type: 'group', -// children: [ -// { -// id: 'default', -// title: , -// type: 'item', -// url: '/dashboard/default', -// icon: icons.IconDashboard, -// breadcrumbs: false -// }, -// { -// id: 'analytics', -// title: , -// type: 'item', -// url: '/dashboard/analytics', -// icon: icons.IconDeviceAnalytics, -// breadcrumbs: false -// } -// ] -// }; -// -// export default dashboard; +// ==============================|| DASHBOARD MENU ITEMS ||============================== // + +import { FormattedMessage } from 'react-intl'; + +const dashboard = { + id: 'dashboard', + // title: , + type: 'group', + children: [ + { + id: 'dashboard', + title: , + type: 'item', + url: '/dashboard' + // breadcrumbs: true + } + ] +}; +export default dashboard; diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index 98860ef..62711c4 100755 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -7,8 +7,7 @@ import AuthGuard from 'utils/route-guard/AuthGuard'; // sample page routing const SamplePage = Loadable(lazy(() => import('views/sample-page'))); -const DashboardDefault = Loadable(lazy(() => import('views/dashboard/Default'))); -const DashboardAnalytics = Loadable(lazy(() => import('views/dashboard/Analytics'))); +const Dashboard = Loadable(lazy(() => import('views/dashboard'))); // admin page routing const PublicBoard = Loadable(lazy(() => import('views/biz/pboard/PublicBoard'))); @@ -42,12 +41,8 @@ const MainRoutes = { children: [ /* Dashboard */ { - path: '/dashboard/default', - element: - }, - { - path: '/dashboard/analytics', - element: + path: '/dashboard', + element: }, /* 공지사항 */ { diff --git a/src/utils/route-guard/GuestGuard.js b/src/utils/route-guard/GuestGuard.js index 71cd686..a82cfa2 100755 --- a/src/utils/route-guard/GuestGuard.js +++ b/src/utils/route-guard/GuestGuard.js @@ -19,8 +19,7 @@ const GuestGuard = ({ children }) => { useEffect(() => { if (isLoggedIn) { - navigate('/publicBoard', { replace: true }); - // navigate(DASHBOARD_PATH, { replace: true }); + navigate(DASHBOARD_PATH, { replace: true }); } }, [isLoggedIn, navigate]); diff --git a/src/views/cmm/mui-grid/MuiDataGrid.jsx b/src/views/cmm/mui-grid/MuiDataGrid.jsx index 3da1456..f4e6267 100644 --- a/src/views/cmm/mui-grid/MuiDataGrid.jsx +++ b/src/views/cmm/mui-grid/MuiDataGrid.jsx @@ -109,6 +109,7 @@ EnhancedTableToolbar.propTypes = { // project imports const MuiDataGrid = ({ // apiRef = () => {}, + gridHeight = 645, isToolbar = false, children =
, isCheckbox = false, @@ -137,7 +138,7 @@ const MuiDataGrid = ({ return ( { - const theme = useTheme(); - - const [anchorEl, setAnchorEl] = React.useState(null); - - const handleClick = (event) => { - setAnchorEl(event.currentTarget); - }; - - const handleClose = () => { - setAnchorEl(null); - }; - - return ( - <> - {isLoading ? ( - - ) : ( - - - - - - - Popular Stocks - - - - - Today - This Month - This Year - - - - - - - - - - - - - - Bajaj Finery - - - - - - - $1839.00 - - - - - - - - - - - - - - 10% Profit - - - - - - - - - - TTML - - - - - - - $100.00 - - - - - - - - - - - - - - 10% loss - - - - - - - - - - Reliance - - - - - - - $200.00 - - - - - - - - - - - - - - 10% Profit - - - - - - - - - - TTML - - - - - - - $189.00 - - - - - - - - - - - - - - 10% loss - - - - - - - - - - Stolon - - - - - - - $189.00 - - - - - - - - - - - - - - 10% loss - - - - - - - - - - - )} - - ); -}; - -PopularCard.propTypes = { - isLoading: PropTypes.bool -}; - -export default PopularCard; diff --git a/src/views/dashboard/Default/TotalGrowthBarChart.js b/src/views/dashboard/Default/TotalGrowthBarChart.js deleted file mode 100755 index 03b4248..0000000 --- a/src/views/dashboard/Default/TotalGrowthBarChart.js +++ /dev/null @@ -1,134 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; - -// material-ui -import { useTheme } from '@mui/material/styles'; -import { Grid, MenuItem, TextField, Typography } from '@mui/material'; - -// third-party -import ApexCharts from 'apexcharts'; -import Chart from 'react-apexcharts'; - -// project imports -import useConfig from 'hooks/useConfig'; -import SkeletonTotalGrowthBarChart from 'ui-component/cards/Skeleton/TotalGrowthBarChart'; -import MainCard from 'ui-component/cards/MainCard'; -import { gridSpacing } from 'store/constant'; - -// chart data -import chartData from './chart-data/total-growth-bar-chart'; - -const status = [ - { - value: 'today', - label: 'Today' - }, - { - value: 'month', - label: 'This Month' - }, - { - value: 'year', - label: 'This Year' - } -]; - -// ==============================|| DASHBOARD DEFAULT - TOTAL GROWTH BAR CHART ||============================== // - -const TotalGrowthBarChart = ({ isLoading }) => { - const [value, setValue] = React.useState('today'); - const theme = useTheme(); - const { navType } = useConfig(); - - const { primary } = theme.palette.text; - const darkLight = theme.palette.dark.light; - const grey200 = theme.palette.grey[200]; - const grey500 = theme.palette.grey[500]; - - const primary200 = theme.palette.primary[200]; - const primaryDark = theme.palette.primary.dark; - const secondaryMain = theme.palette.secondary.main; - const secondaryLight = theme.palette.secondary.light; - - React.useEffect(() => { - const newChartData = { - ...chartData.options, - colors: [primary200, primaryDark, secondaryMain, secondaryLight], - xaxis: { - labels: { - style: { - colors: [primary, primary, primary, primary, primary, primary, primary, primary, primary, primary, primary, primary] - } - } - }, - yaxis: { - labels: { - style: { - colors: [primary] - } - } - }, - grid: { - borderColor: navType === 'dark' ? darkLight + 20 : grey200 - }, - tooltip: { - theme: navType === 'dark' ? 'dark' : 'light' - }, - legend: { - labels: { - colors: grey500 - } - } - }; - - // do not load chart when loading - if (!isLoading) { - ApexCharts.exec(`bar-chart`, 'updateOptions', newChartData); - } - }, [navType, primary200, primaryDark, secondaryMain, secondaryLight, primary, darkLight, grey200, isLoading, grey500]); - - return ( - <> - {isLoading ? ( - - ) : ( - - - - - - - - Total Growth - - - $2,324.00 - - - - - setValue(e.target.value)}> - {status.map((option) => ( - - {option.label} - - ))} - - - - - - - - - - )} - - ); -}; - -TotalGrowthBarChart.propTypes = { - isLoading: PropTypes.bool -}; - -export default TotalGrowthBarChart; diff --git a/src/views/dashboard/index.js b/src/views/dashboard/index.js new file mode 100644 index 0000000..e720a46 --- /dev/null +++ b/src/views/dashboard/index.js @@ -0,0 +1,93 @@ +import { useEffect, useState, useCallback } from 'react'; + +// material-ui +import { Grid, Link, Typography } from '@mui/material'; + +// project imports +import { gridSpacing } from 'store/constant'; +import { findDashboard } from 'apis/judge'; +import MuiDataGrid from 'views/cmm/mui-grid/MuiDataGrid'; +import { IconFileText } from '@tabler/icons'; + +// ==============================|| DEFAULT DASHBOARD ||============================== // + +const Dashboard = () => { + const [isLoading, setLoading] = useState(true); + const [totalCount, setTotalCount] = useState(0); + const [rowsState, setRowsState] = useState({ + page: 0, + pageSize: 6, + rows: [] + // loading: false + }); + + const columns = [ + { headerName: 'No.', headerAlign: 'center', field: 'rowId', align: 'center', width: 80 }, + { + headerName: '업무구분', + headerAlign: 'center', + field: 'inDept', + align: 'center', + width: 120 + }, + { + headerName: '제목', + headerAlign: 'center', + field: 'inTitle', + width: 400, + renderCell: (params) => ( + + {params.value} + + ) + }, + { + headerName: '첨부파일', + headerAlign: 'center', + field: 'inFile', + align: 'center', + width: 100, + renderCell: (params) => ( + // console.log(params.row.inFilename); + <>{params.row.inFilename ? : ''} + ) + }, + { headerName: '작성일자', headerAlign: 'center', field: 'inNalja', align: 'center', width: 130 }, + { headerName: '조회수', headerAlign: 'center', field: 'inHit', align: 'right', width: 100 } + ]; + + const search = useCallback(() => { + // const params = { + // page: rowsState.page, + // size: rowsState.pageSize + // }; + + findDashboard().then((res) => { + console.log(res); + if (res && res.data) { + const rows = res.data?.pBoardList.content.map((d, idx) => ({ ...d, rowId: idx + 1 })); + setTotalCount(rows.count); + setRowsState((prevState) => ({ ...prevState, rows })); + } + }); + }, []); + + useEffect(() => { + setLoading(false); + search(); + }, [search]); + + return ( + + + 공지사항 + + + + 심사자현황 + + + ); +}; + +export default Dashboard;