From cb578cab90df025358eb140afafe3531f0e9d9f6 Mon Sep 17 00:00:00 2001 From: publdaze Date: Sun, 15 Oct 2023 00:22:42 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat=20:=20=ED=85=8C=EC=9D=B4=EB=B8=94=20?= =?UTF-8?q?=EC=9A=B0=EC=B8=A1=20column=20=EA=B3=A0=EC=A0=95=20=ED=99=95?= =?UTF-8?q?=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #307 --- .../Table/StandardTable.interface.ts | 2 +- src/components/Table/StandardTable.tsx | 50 ++++++++++++------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/components/Table/StandardTable.interface.ts b/src/components/Table/StandardTable.interface.ts index 5b9673bf..2c56f868 100644 --- a/src/components/Table/StandardTable.interface.ts +++ b/src/components/Table/StandardTable.interface.ts @@ -1,7 +1,7 @@ export interface Column { key: keyof T | 'checkbox'; headerName: string; - width?: string | number; + width?: string | number /* NOTE fixed 있을 때 width number 타입 및 필수 값 */; fixed?: 'left' | 'right'; } diff --git a/src/components/Table/StandardTable.tsx b/src/components/Table/StandardTable.tsx index 394f232e..63d687c0 100644 --- a/src/components/Table/StandardTable.tsx +++ b/src/components/Table/StandardTable.tsx @@ -37,22 +37,28 @@ const StandardTable = >({ - {columns.map((column, index) => ( - - {isCheckboxColumn(column.key) ? : column.headerName} - - ))} + {columns.map((column, index) => { + return ( + + {isCheckboxColumn(column.key) ? : column.headerName} + + ); + })} @@ -89,8 +95,12 @@ const StandardTable = >({ } !border-subBlack bg-mainBlack !text-white`} sx={{ position: column.fixed && 'sticky', - left: column.fixed === 'left' ? index * 100 : undefined, backgroundColor: column.fixed && KEEPER_COLOR.middleBlack, + left: column.fixed === 'left' ? index * ((column.width as number) || 0) : undefined, + right: + column.fixed === 'right' + ? (columns.length - 1 - index) * ((column.width as number) || 0) + : undefined, }} key={column.key as string} > @@ -132,8 +142,12 @@ const StandardTable = >({ } overflow-hidden !border-subBlack bg-mainBlack !text-white`} sx={{ position: column.fixed && 'sticky', - left: column.fixed === 'left' ? index * 100 : undefined, backgroundColor: column.fixed && KEEPER_COLOR.middleBlack, + left: column.fixed === 'left' ? index * ((column.width as number) || 0) : undefined, + right: + column.fixed === 'right' + ? (columns.length - 1 - index) * ((column.width as number) || 0) + : undefined, }} key={column.key as string} > From e860850a09fa7f06b28cbd5cb901857d4c6ff2e4 Mon Sep 17 00:00:00 2001 From: publdaze Date: Sun, 15 Oct 2023 00:25:13 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat=20:=20=EC=84=B8=EB=AF=B8=EB=82=98=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=B4=9D=20?= =?UTF-8?q?=ED=9A=9F=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #786 --- src/api/dto.ts | 5 +++++ src/api/seminarApi.ts | 1 + src/pages/admin/SeminarManage/SeminarManage.tsx | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/api/dto.ts b/src/api/dto.ts index e55f5ff6..06508b18 100644 --- a/src/api/dto.ts +++ b/src/api/dto.ts @@ -280,6 +280,11 @@ export interface AttendSeminarInfo { generation: number; attendances: MemberSeminarAttendance[]; [key: `date${number}`]: MemberSeminarAttendance; + totalCount: string; + totalAttendance: number; + totalLateness: number; + totalAbsence: number; + totalPersonal: number; } export interface AttendSeminarListInfo extends Page { diff --git a/src/api/seminarApi.ts b/src/api/seminarApi.ts index d5d6c0e0..d5ba3ac1 100644 --- a/src/api/seminarApi.ts +++ b/src/api/seminarApi.ts @@ -124,6 +124,7 @@ const useGetAttendSeminarListMutation = ({ page, size }: { page?: number; size?: return { ...membersSeminarAttendInfo, + totalCount: `${membersSeminarAttendInfo.totalAttendance} / ${membersSeminarAttendInfo.totalLateness} / ${membersSeminarAttendInfo.totalAbsence} / ${membersSeminarAttendInfo.totalPersonal}`, ...seminarDateInfo, }; }); diff --git a/src/pages/admin/SeminarManage/SeminarManage.tsx b/src/pages/admin/SeminarManage/SeminarManage.tsx index a0732350..57910b60 100644 --- a/src/pages/admin/SeminarManage/SeminarManage.tsx +++ b/src/pages/admin/SeminarManage/SeminarManage.tsx @@ -17,6 +17,7 @@ import EditSeminarAttendanceModal from './Modal/EditSeminarAttendanceModal'; const seminarManageColumn: Column[] = [ { key: 'generation', headerName: '기수', fixed: 'left', width: 100 }, { key: 'memberName', headerName: '이름', fixed: 'left', width: 100 }, + { key: 'totalCount', headerName: '출석 / 지각 / 결석 / 개인사정', fixed: 'right', width: 100 }, ]; const SeminarManage = () => { @@ -48,6 +49,9 @@ const SeminarManage = () => { if (key.slice(0, 4) === 'date' && value) { return ; } + if (key === 'totalCount') { + return

{value}

; + } return value; }; @@ -68,7 +72,7 @@ const SeminarManage = () => { - columns={[...seminarManageColumn, ...dynamicColumn]} + columns={[...seminarManageColumn.slice(0, 2), ...dynamicColumn, ...seminarManageColumn.slice(2)]} childComponent={childComponent} onCellClick={onCellClick} rows={