From 990cd49b7fdafe217d6f5c191c60261ec7ee7bd8 Mon Sep 17 00:00:00 2001 From: Hyelim Choi Date: Wed, 24 Jan 2024 15:57:31 +0900 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20admin=20->=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=EC=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 워딩 변경 --- src/api/reserveApi.ts | 2 +- src/auth/guard/role-based-guard.tsx | 2 +- src/layouts/dashboard/dept-button.tsx | 2 +- src/layouts/dashboard/nav-mini.tsx | 2 +- src/layouts/dashboard/nav-vertical.tsx | 4 ++-- src/pages/dashboard/dashboard.tsx | 2 +- src/sections/home/dept-card.tsx | 4 ++-- src/sections/user/user-table-row.tsx | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/api/reserveApi.ts b/src/api/reserveApi.ts index 434fb84..8c0525f 100644 --- a/src/api/reserveApi.ts +++ b/src/api/reserveApi.ts @@ -8,7 +8,7 @@ const palette = themePalette('light'); // dashboard calander (ReserveFindeByDeptId) export const GetReserveListByDept = async (deptId: number) => { - const response = axiosInstance.get(`${endpoints.reserve.list}/${deptId}`); // DeptId 전체 리스트 (admin) + const response = axiosInstance.get(`${endpoints.reserve.list}/${deptId}`); // DeptId 전체 리스트 (관리자) const selectData: ICalendarEvent[] = (await response).data.map((item: any) => ({ id: item.id, diff --git a/src/auth/guard/role-based-guard.tsx b/src/auth/guard/role-based-guard.tsx index 14e3538..9fcd17e 100644 --- a/src/auth/guard/role-based-guard.tsx +++ b/src/auth/guard/role-based-guard.tsx @@ -24,7 +24,7 @@ export default function RoleBasedGuard({ hasContent, roles, children, sx }: Role const { user } = useMockedUser(); // const currentRole = 'user'; - const currentRole = user?.role; // admin; + const currentRole = user?.role; // 관리자; if (typeof roles !== 'undefined' && !roles.includes(currentRole)) { return hasContent ? ( diff --git a/src/layouts/dashboard/dept-button.tsx b/src/layouts/dashboard/dept-button.tsx index 2ea2521..898a270 100644 --- a/src/layouts/dashboard/dept-button.tsx +++ b/src/layouts/dashboard/dept-button.tsx @@ -188,7 +188,7 @@ export default function DeptHeaderButton() { {option.deptName} - {option.deptMemberResponse[0]?.deptRole === 'ADMIN' ? :
} + {option.deptMemberResponse[0]?.deptRole === '관리자' ? :
} diff --git a/src/layouts/dashboard/nav-mini.tsx b/src/layouts/dashboard/nav-mini.tsx index 8b91e0b..c7705f5 100644 --- a/src/layouts/dashboard/nav-mini.tsx +++ b/src/layouts/dashboard/nav-mini.tsx @@ -50,7 +50,7 @@ export default function NavMini() { diff --git a/src/layouts/dashboard/nav-vertical.tsx b/src/layouts/dashboard/nav-vertical.tsx index 250a567..bc632de 100644 --- a/src/layouts/dashboard/nav-vertical.tsx +++ b/src/layouts/dashboard/nav-vertical.tsx @@ -72,11 +72,11 @@ export default function NavVertical({ openNav, onCloseNav }: Props) { {typeof userDeptInfo === 'object' && - userDeptInfo.deptMemberResponse[0]?.deptRole === 'ADMIN' ? ( + userDeptInfo.deptMemberResponse[0]?.deptRole === '관리자' ? ( ) : ( diff --git a/src/pages/dashboard/dashboard.tsx b/src/pages/dashboard/dashboard.tsx index d267c89..e9839ae 100644 --- a/src/pages/dashboard/dashboard.tsx +++ b/src/pages/dashboard/dashboard.tsx @@ -15,7 +15,7 @@ export default function Page() { {typeof userDeptInfo === 'object' && - userDeptInfo.deptMemberResponse[0]?.deptRole === 'ADMIN' ? ( + userDeptInfo.deptMemberResponse[0]?.deptRole === '관리자' ? ( ) : ( diff --git a/src/sections/home/dept-card.tsx b/src/sections/home/dept-card.tsx index 0617ca0..ce0b4b7 100644 --- a/src/sections/home/dept-card.tsx +++ b/src/sections/home/dept-card.tsx @@ -30,9 +30,9 @@ export default function DeptCard({ deptInfo, onAccess, onPending }: Props) { if (deptInfo.deptMemberResponse.length !== 0) { if (firstElement.approve === '승인 대기') { setDeptStatus('승인 대기 중'); - } else if (firstElement.deptRole === 'ADMIN') { + } else if (firstElement.deptRole === '관리자') { setDeptStatus('관리하기'); - } else if (firstElement.deptRole === 'USER') { + } else if (firstElement.deptRole === '사용자') { setDeptStatus('입장하기'); } } else { diff --git a/src/sections/user/user-table-row.tsx b/src/sections/user/user-table-row.tsx index c150643..6930297 100644 --- a/src/sections/user/user-table-row.tsx +++ b/src/sections/user/user-table-row.tsx @@ -76,8 +76,8 @@ export default function UserTableRow({ variant="soft" color={ (approve === '승인 대기' && 'error') || - (deptRole === 'ADMIN' && 'success') || - (deptRole === 'USER' && 'secondary') || + (deptRole === '관리자' && 'success') || + (deptRole === '사용자' && 'secondary') || 'default' } > From aa79c138981ca3fa630e67a45f9b3816c4545a62 Mon Sep 17 00:00:00 2001 From: Hyelim Choi Date: Wed, 24 Jan 2024 15:57:51 +0900 Subject: [PATCH 2/2] feat: add space name filters --- .../reservelist/view/reserve-list-view.tsx | 54 ++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/sections/reservelist/view/reserve-list-view.tsx b/src/sections/reservelist/view/reserve-list-view.tsx index c2890c2..9c00a40 100644 --- a/src/sections/reservelist/view/reserve-list-view.tsx +++ b/src/sections/reservelist/view/reserve-list-view.tsx @@ -38,7 +38,7 @@ import { IReserveTableFilterValue, } from 'src/types/reserveList'; // -import { Typography } from '@mui/material'; +import { Button, Typography } from '@mui/material'; import axiosInstance, { endpoints } from 'src/utils/axios'; import { useRecoilValue } from 'recoil'; import { userDeptState } from 'src/utils/atom'; @@ -125,7 +125,10 @@ export default function ReserveListView() { const denseHeight = table.dense ? 52 : 72; const canReset = - !!filters.name || filters.status !== '전체' || (!!filters.startDate && !!filters.endDate); + !!filters.space || + !!filters.name || + filters.status !== '전체' || + (!!filters.startDate && !!filters.endDate); const notFound = (!dataFiltered.length && canReset) || !dataFiltered.length; @@ -240,11 +243,22 @@ export default function ReserveListView() { ) } action={ - - - - - + <> + + + + + + + + + + + } /> @@ -335,11 +349,23 @@ function applyFilter({ inputData = stabilizedThis.map((el) => el[0]); if (name) { - inputData = inputData.filter( - (order) => - order.id.toLowerCase().indexOf(name.toLowerCase()) !== -1 || - order.createMemberName.toLowerCase().indexOf(name.toLowerCase()) !== -1 - ); + inputData = inputData.filter((order) => { + const orderId = order.id && typeof order.id === 'string' ? order.id.toLowerCase() : ''; + const memberName = + order.createMemberName && typeof order.createMemberName === 'string' + ? order.createMemberName.toLowerCase() + : ''; + const spaceName = + order.space.name && typeof order.space.name === 'string' + ? order.space.name.toLowerCase() + : ''; + + return ( + orderId.indexOf(name.toLowerCase()) !== -1 || + memberName.indexOf(name.toLowerCase()) !== -1 || + spaceName.indexOf(name.toLowerCase()) !== -1 + ); + }); } if (status !== '전체') { @@ -350,8 +376,8 @@ function applyFilter({ if (startDate && endDate) { inputData = inputData.filter( (order) => - fTimestamp(order.modDate) >= fTimestamp(startDate) && - fTimestamp(order.modDate) <= fTimestamp(endDate) + fTimestamp(order.reserveDate) >= fTimestamp(startDate) && + fTimestamp(order.reserveDate) <= fTimestamp(endDate) ); } }