diff --git a/src/contexts/JWTContext.js b/src/contexts/JWTContext.js
index 2953be7..126d0d6 100755
--- a/src/contexts/JWTContext.js
+++ b/src/contexts/JWTContext.js
@@ -65,11 +65,12 @@ export const JWTProvider = ({ children }) => {
const response = await axios.get('/api/v1/ctgy/user/info');
console.log(response);
// TODO : 적용 필요
- const { userid, email, name } = response.data;
+ const { userid, email, name, accesstype } = response.data;
dispatch({
type: LOGIN,
payload: {
isLoggedIn: true,
+ accesstype,
user: {
id: userid,
email,
@@ -98,6 +99,7 @@ export const JWTProvider = ({ children }) => {
// console.log(response);
if (response && response.data) {
const { accessToken, refreshToken, user } = response.data;
+ console.log(user);
setLocalStorage(ACCESS_TOKEN_NAME, accessToken);
if (refreshToken) setLocalStorage(REFRESH_TOKEN_NAME, refreshToken);
@@ -109,7 +111,12 @@ export const JWTProvider = ({ children }) => {
type: LOGIN,
payload: {
isLoggedIn: true,
- user
+ accesstype: user.accesstype,
+ user: {
+ id: user.userid,
+ email: user.email,
+ name: user.name
+ }
}
});
}
diff --git a/src/layout/MainLayout/Sidebar/MenuList/index.js b/src/layout/MainLayout/Sidebar/MenuList/index.js
index 694586c..46370e4 100755
--- a/src/layout/MainLayout/Sidebar/MenuList/index.js
+++ b/src/layout/MainLayout/Sidebar/MenuList/index.js
@@ -5,11 +5,19 @@ import { Typography } from '@mui/material';
// project imports
import NavGroup from './NavGroup';
-import menuItem from 'menu-items';
+import useAuth from 'hooks/useAuth';
+
+import other from 'menu-items/other';
+import admin from 'menu-items/admin';
+import dashboard from 'menu-items/dashboard';
// ==============================|| SIDEBAR MENU LIST ||============================== //
const MenuList = () => {
+ const { accesstype } = useAuth();
+
+ const menuItem = accesstype === '001' ? { items: [dashboard, admin, other] } : { items: [admin] };
+
const navItems = menuItem.items.map((item) => {
switch (item.type) {
case 'group':
diff --git a/src/layout/MainLayout/index.js b/src/layout/MainLayout/index.js
index 0abd510..20c8821 100755
--- a/src/layout/MainLayout/index.js
+++ b/src/layout/MainLayout/index.js
@@ -9,11 +9,14 @@ import { AppBar, Box, Container, CssBaseline, Toolbar, useMediaQuery } from '@mu
import Breadcrumbs from 'ui-component/extended/Breadcrumbs';
import Header from './Header';
import Sidebar from './Sidebar';
-import navigation from 'menu-items';
+import other from 'menu-items/other';
+import admin from 'menu-items/admin';
+import dashboard from 'menu-items/dashboard';
import useConfig from 'hooks/useConfig';
import { drawerWidth } from 'store/constant';
import { openDrawer } from 'store/slices/menu';
import { useDispatch, useSelector } from 'store';
+import useAuth from 'hooks/useAuth';
// assets
import { IconChevronRight } from '@tabler/icons';
@@ -65,6 +68,8 @@ const Main = styled('main', { shouldForwardProp: (prop) => prop !== 'open' })(({
// ==============================|| MAIN LAYOUT ||============================== //
const MainLayout = () => {
+ const { accesstype } = useAuth();
+ console.log(`###############`, accesstype);
const theme = useTheme();
const matchDownMd = useMediaQuery(theme.breakpoints.down('lg'));
@@ -111,13 +116,25 @@ const MainLayout = () => {
{/* breadcrumb */}
{container && (
-
+
)}
{!container && (
<>
-
+
>
)}
diff --git a/src/menu-items/opst.js b/src/menu-items/admin.js
old mode 100755
new mode 100644
similarity index 70%
rename from src/menu-items/opst.js
rename to src/menu-items/admin.js
index c80e151..3665789
--- a/src/menu-items/opst.js
+++ b/src/menu-items/admin.js
@@ -47,15 +47,15 @@ const icons = {
// ==============================|| OPST MENU ITEMS ||============================== //
-const opst = {
- id: 'opst',
- // title: ,
+const admin = {
+ id: 'admin',
+ // title: ,
type: 'group',
children: [
{
/* 공지 사항 */
- id: 'opst-1',
- title: ,
+ id: 'admin-1',
+ title: ,
type: 'item',
icon: icons.IconClipboardCheck,
url: '/publicBoard',
@@ -63,23 +63,23 @@ const opst = {
},
{
/* 주정차 의견 진술 */
- id: 'opst-2',
- title: ,
+ id: 'admin-2',
+ title: ,
type: 'collapse',
icon: icons.IconParking,
children: [
{
/* 심의 목록 */
- id: 'opst-2-1',
- title: ,
+ id: 'admin-2-1',
+ title: ,
type: 'item',
url: '/parking/review',
icon: icons.IconList
},
{
/* 심의 등록 */
- id: 'opst-2-2',
- title: ,
+ id: 'admin-2-2',
+ title: ,
type: 'item',
url: '/parking/register',
icon: icons.IconDatabaseImport
@@ -88,31 +88,31 @@ const opst = {
},
{
/* 거주자 의견 진술 */
- id: 'opst-3',
- title: ,
+ id: 'admin-3',
+ title: ,
type: 'collapse',
icon: icons.IconUser,
children: [
{
/* 자료 관리 */
- id: 'opst-3-1',
- title: ,
+ id: 'admin-3-1',
+ title: ,
type: 'item',
url: '/resident/data',
icon: icons.IconDatabase
},
{
/* 심의 목록 */
- id: 'opst-3-2',
- title: ,
+ id: 'admin-3-2',
+ title: ,
type: 'item',
url: '/resident/review',
icon: icons.IconList
},
{
/* 심의 등록 */
- id: 'opst-3-3',
- title: ,
+ id: 'admin-3-3',
+ title: ,
type: 'item',
url: '/resident/register',
icon: icons.IconDatabaseImport
@@ -121,31 +121,31 @@ const opst = {
},
{
/* 장애인 의견 진술 */
- id: 'opst-4',
- title: ,
+ id: 'admin-4',
+ title: ,
type: 'collapse',
icon: icons.IconDisabled,
children: [
{
/* 자료 관리 */
- id: 'opst-4-1',
- title: ,
+ id: 'admin-4-1',
+ title: ,
type: 'item',
url: '/disabled/data',
icon: icons.IconDatabase
},
{
/* 심의 목록 */
- id: 'opst-4-2',
- title: ,
+ id: 'admin-4-2',
+ title: ,
type: 'item',
url: '/disabled/review',
icon: icons.IconList
},
{
/* 심의 등록 */
- id: 'opst-4-3',
- title: ,
+ id: 'admin-4-3',
+ title: ,
type: 'item',
url: '/disabled/register',
icon: icons.IconDatabaseImport
@@ -154,24 +154,24 @@ const opst = {
},
{
/* 사용자 관리 */
- id: 'opst-5',
- title: ,
+ id: 'admin-5',
+ title: ,
type: 'item',
url: '/user/management',
icon: icons.IconUserCheck
},
// {
// /* SMS 관리 */
- // id: 'opst-6',
- // title: ,
+ // id: 'admin-6',
+ // title: ,
// type: 'item',
// url: '/sms/management',
// icon: icons.IconMessage
// },
{
/* 게시판 관리 */
- id: 'opst-7',
- title: ,
+ id: 'admin-7',
+ title: ,
type: 'item',
url: '/board',
icon: icons.IconClipboardList
@@ -179,4 +179,4 @@ const opst = {
]
};
-export default opst;
+export default admin;
diff --git a/src/menu-items/index.js b/src/menu-items/index.js
index af56e20..fae84f8 100755
--- a/src/menu-items/index.js
+++ b/src/menu-items/index.js
@@ -1,11 +1,13 @@
import other from './other';
-import opst from './opst';
+import admin from './admin';
import dashboard from './dashboard';
// ==============================|| MENU ITEMS ||============================== //
-const menuItems = {
- items: [dashboard, opst, other]
+export const adminMenuItems = {
+ items: [dashboard, admin, other]
};
-export default menuItems;
+export const judgeMenuItems = {
+ items: [dashboard, admin, other]
+};
diff --git a/src/menu-items/judge.js b/src/menu-items/judge.js
new file mode 100644
index 0000000..4e42faf
--- /dev/null
+++ b/src/menu-items/judge.js
@@ -0,0 +1,108 @@
+// third-party
+import { FormattedMessage } from 'react-intl';
+
+// assets
+import {
+ IconKey,
+ IconReceipt2,
+ IconBug,
+ IconBellRinging,
+ IconPhoneCall,
+ IconQuestionMark,
+ IconShieldLock,
+ IconUserCheck,
+ IconMessage,
+ IconClipboardList,
+ IconClipboardCheck,
+ IconDisabled,
+ IconUser,
+ IconParking,
+ IconDatabase,
+ IconDatabaseImport,
+ IconList,
+ IconFileCertificate
+} from '@tabler/icons';
+
+// constant
+const icons = {
+ IconKey,
+ IconReceipt2,
+ IconBug,
+ IconBellRinging,
+ IconPhoneCall,
+ IconQuestionMark,
+ IconShieldLock,
+ IconUserCheck,
+ IconMessage,
+ IconClipboardList,
+ IconClipboardCheck,
+ IconUser,
+ IconDisabled,
+ IconParking,
+ IconDatabase,
+ IconDatabaseImport,
+ IconList,
+ IconFileCertificate
+};
+
+// ==============================|| OPST MENU ITEMS ||============================== //
+
+const judge = {
+ id: 'judge',
+ // title: ,
+ type: 'group',
+ children: [
+ {
+ /* 공지 사항 */
+ id: 'judge-1',
+ title: ,
+ type: 'item',
+ icon: icons.IconClipboardCheck,
+ url: '/publicBoard',
+ breadcrumbs: true
+ },
+ {
+ /* 심의대상 목록 */
+ id: 'judge-2',
+ title: ,
+ type: 'collapse',
+ icon: icons.IconParking,
+ children: [
+ {
+ /* 주정차 심의대상 목록 */
+ id: 'judge-2-1',
+ title: ,
+ type: 'item',
+ url: '/parking/review',
+ icon: icons.IconList
+ },
+ {
+ /* 거주자 심의대상 목록 */
+ id: 'judge-2-2',
+ title: ,
+ type: 'item',
+ url: '/resident/review',
+ icon: icons.IconList
+ },
+ {
+ /* 장애인 심의대상 목록 */
+ id: 'judge-2-3',
+ title: ,
+ type: 'item',
+ url: '/disabled/review',
+ icon: icons.IconList
+ }
+ ]
+ },
+ {
+ /* 게시판 관리 */
+ id: 'judge-3',
+ title: ,
+ type: 'item',
+ url: '/board',
+ icon: icons.IconClipboardList
+ }
+ ]
+};
+
+export default judge;
diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js
index 30c8c0f..9b3dec4 100755
--- a/src/routes/MainRoutes.js
+++ b/src/routes/MainRoutes.js
@@ -10,7 +10,7 @@ const SamplePage = Loadable(lazy(() => import('views/sample-page')));
const DashboardDefault = Loadable(lazy(() => import('views/dashboard/Default')));
const DashboardAnalytics = Loadable(lazy(() => import('views/dashboard/Analytics')));
-// opst page routing
+// admin page routing
const PublicBoard = Loadable(lazy(() => import('views/biz/board/PublicBoard')));
const Board = Loadable(lazy(() => import('views/biz/board/Board')));
diff --git a/src/store/accountReducer.js b/src/store/accountReducer.js
index a0627b5..d86c101 100755
--- a/src/store/accountReducer.js
+++ b/src/store/accountReducer.js
@@ -5,6 +5,7 @@ import { LOGIN, LOGOUT, REGISTER } from './actions';
const initialState = {
isLoggedIn: false,
+ accesstype: null,
isInitialized: false,
user: null
};
@@ -19,10 +20,11 @@ const accountReducer = (state = initialState, action) => {
};
}
case LOGIN: {
- const { user } = action.payload;
+ const { user, accesstype } = action.payload;
return {
...state,
isLoggedIn: true,
+ accesstype,
isInitialized: true,
user
};
@@ -31,6 +33,7 @@ const accountReducer = (state = initialState, action) => {
return {
...state,
isInitialized: true,
+ accesstype: null,
isLoggedIn: false,
user: null
};
diff --git a/src/utils/locales/en.json b/src/utils/locales/en.json
index 54316b0..d78d859 100755
--- a/src/utils/locales/en.json
+++ b/src/utils/locales/en.json
@@ -1,16 +1,16 @@
{
"opst": "Opst",
- "opst-1": "Public board",
- "opst-2": "주정차 의견 진술",
- "opst-2-1": "심의 목록",
- "opst-2-2": "심의 등록",
- "opst-3": "거주자 의견 진술",
- "opst-3-1": "자료 관리",
- "opst-4": "장애인 의견 진술",
- "opst-5": "사용자 관리",
- "opst-5-2": "심사위원 평가",
- "opst-6": "SMS 관리",
- "opst-7": "Board",
+ "admin-1": "Public board",
+ "admin-2": "주정차 의견 진술",
+ "admin-2-1": "심의 목록",
+ "admin-2-2": "심의 등록",
+ "admin-3": "거주자 의견 진술",
+ "admin-3-1": "자료 관리",
+ "admin-4": "장애인 의견 진술",
+ "admin-5": "사용자 관리",
+ "admin-5-2": "심사위원 평가",
+ "admin-6": "SMS 관리",
+ "admin-7": "Board",
"dashboard": "Dashboard",
"default": "Default",
diff --git a/src/utils/locales/ko.json b/src/utils/locales/ko.json
index 75b5566..418e89d 100755
--- a/src/utils/locales/ko.json
+++ b/src/utils/locales/ko.json
@@ -1,16 +1,24 @@
{
- "opst": "의견 진술 관리",
- "opst-1": "공지 사항",
- "opst-2": "주정차 의견진술",
- "opst-2-1": "심의목록",
- "opst-2-2": "심의 등록",
- "opst-3": "거주자 의견 진술",
- "opst-3-1": "자료 관리",
- "opst-4": "장애인 의견 진술",
- "opst-5": "사용자 관리",
- "opst-5-2": "심사위원 평가",
- "opst-6": "SMS 관리",
- "opst-7": "게시판 관리",
+ "admin": "의견 진술 관리[관리자]",
+ "admin-1": "공지 사항",
+ "admin-2": "주정차 의견진술",
+ "admin-2-1": "심의목록",
+ "admin-2-2": "심의 등록",
+ "admin-3": "거주자 의견 진술",
+ "admin-3-1": "자료 관리",
+ "admin-4": "장애인 의견 진술",
+ "admin-5": "사용자 관리",
+ "admin-5-2": "심사위원 평가",
+ "admin-6": "SMS 관리",
+ "admin-7": "게시판 관리",
+
+ "judge": "의견 진술 관리[심사자]",
+ "judge-1": "공지 사항",
+ "judge-2": "심의대상 목록",
+ "judge-2-1": "주정차 심의대상 목록",
+ "judge-2-2": "거주자 심의대상 목록",
+ "judge-2-3": "장애인 심의대상 목록",
+ "judge-3": "게시판 관리",
"dashboard": "Dashboard",
"default": "Default",