Skip to content

Commit

Permalink
Merge pull request #117 from HGU-WALAB/main
Browse files Browse the repository at this point in the history
merge #114
  • Loading branch information
LeeHannaa authored Jan 24, 2024
2 parents 564a297 + ea41f09 commit 7ed0082
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/api/reserveApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/auth/guard/role-based-guard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
Expand Down
54 changes: 40 additions & 14 deletions src/sections/reservelist/view/reserve-list-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -240,11 +243,22 @@ export default function ReserveListView() {
)
}
action={
<Tooltip title="Delete">
<IconButton color="primary" onClick={confirm.onTrue}>
<Iconify icon="solar:trash-bin-trash-bold" />
</IconButton>
</Tooltip>
<>
<Tooltip title="Add">
<IconButton color="primary" onClick={confirm.onTrue}>
<Button variant="outlined" color="primary">
전체 승인
</Button>
</IconButton>
</Tooltip>
<Tooltip title="Delete">
<IconButton color="primary" onClick={confirm.onTrue}>
<Button variant="outlined" color="error">
전체 삭제
</Button>
</IconButton>
</Tooltip>
</>
}
/>

Expand Down Expand Up @@ -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 !== '전체') {
Expand All @@ -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)
);
}
}
Expand Down

0 comments on commit 7ed0082

Please sign in to comment.