diff --git a/src/api/reserveApi.ts b/src/api/reserveApi.ts index 623b186..ffad733 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/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) ); } }