diff --git a/src/assets/data/fields.ts b/src/assets/data/fields.ts index 03242e8..da11b03 100644 --- a/src/assets/data/fields.ts +++ b/src/assets/data/fields.ts @@ -70,3 +70,4 @@ export const ORDER_IDX = 'orderIdx'; export const ITEM_MAX_POINTS = 'itemMaxPoints'; export const ISCHECKED = 'isChecked'; export const CATEGORYID = 'categoryId'; +export const MOD_DATE = 'modDate'; diff --git a/src/components/common/CustomTable.tsx b/src/components/common/CustomTable.tsx index c6d74ef..5bee341 100644 --- a/src/components/common/CustomTable.tsx +++ b/src/components/common/CustomTable.tsx @@ -315,9 +315,14 @@ const typeConverter = (type) => { export default function EnhancedTable({ originalRows, headCells, type }) { function sortByOrderIdx(data) { - return data.sort((a, b) => a.orderIdx - b.orderIdx); - } + if (!data) return; + + // Create a shallow copy of the array + const sortedData = [...data]; + // Sort the copied array + return sortedData.sort((a, b) => (a?.orderIdx ?? 0) - (b?.orderIdx ?? 0)); + } /** * @field 필터링을 거치고 보여주는 값들 (rows) */ diff --git a/src/components/modalForm/GlobalItemForm.tsx b/src/components/modalForm/GlobalItemForm.tsx index dbe00ca..5b90d24 100644 --- a/src/components/modalForm/GlobalItemForm.tsx +++ b/src/components/modalForm/GlobalItemForm.tsx @@ -100,7 +100,7 @@ export default function GlobalItemForm() { }; const newData = { - [CATEGORYID]: 1, + [CATEGORYID]: values[CATEGORYID], itemName: values[ITEM], [DESCRIPTION1]: values[DESCRIPTION1], [DESCRIPTION2]: values[DESCRIPTION2], diff --git a/src/pages/manage/student/index.tsx b/src/pages/manage/student/index.tsx index 28400cd..97fd96c 100644 --- a/src/pages/manage/student/index.tsx +++ b/src/pages/manage/student/index.tsx @@ -20,6 +20,7 @@ import { REGDATE, ISCHECKED, MOBILE, + MOD_DATE, } from 'src/assets/data/fields'; import axiosInstance from 'src/utils/axios'; import { GetServerSideProps, InferGetServerSidePropsType } from 'next'; @@ -49,6 +50,7 @@ export enum StudentManageBoard { 'LASTLOGINDATE' = LASTLOGINDATE, 'REGDATE' = REGDATE, 'ISCHECKED' = ISCHECKED, + 'MOD_DATE' = MOD_DATE, 'MANAGE' = MANAGE, } @@ -64,6 +66,7 @@ interface Data { [StudentManageBoard.MAJOR]: string; [StudentManageBoard.LASTLOGINDATE]: string; [StudentManageBoard.ISCHECKED]: string; + [StudentManageBoard.MOD_DATE]: string; [StudentManageBoard.MANAGE]: string; } /** @@ -80,6 +83,7 @@ function createData( MAJOR: string, LASTLOGINDATE: string, ISCHECKED: string, + MOD_DATE: string, MANAGE: ReactNode ): Data { return { @@ -91,6 +95,7 @@ function createData( [StudentManageBoard.MAJOR]: MAJOR, [StudentManageBoard.LASTLOGINDATE]: LASTLOGINDATE, [StudentManageBoard.ISCHECKED]: ISCHECKED, + [StudentManageBoard.MOD_DATE]: MOD_DATE, [StudentManageBoard.MANAGE]: MANAGE, }; } @@ -147,6 +152,12 @@ function createData( disablePadding: false, label: '승인', }, + { + id: [StudentManageBoard.MOD_DATE], + numeric: true, + disablePadding: false, + label: '최근 수정일', + }, { id: [StudentManageBoard.MANAGE], numeric: true, @@ -264,7 +275,6 @@ export default function StudentManage({ [ISCHECKED]: student[ISCHECKED], }; return createData( - student[ID], student[ID], student[NAME], student[SID], @@ -273,6 +283,7 @@ export default function StudentManage({ student[MAJOR1] + ' / ' + student[MAJOR2], student[LASTLOGINDATE]?.split('T')[0], student[ISCHECKED] ? : , + student[MOD_DATE], ); }); diff --git a/src/pages/mileage/category/index.tsx b/src/pages/mileage/category/index.tsx index 673ba11..8ff80d4 100644 --- a/src/pages/mileage/category/index.tsx +++ b/src/pages/mileage/category/index.tsx @@ -8,6 +8,7 @@ import { ID, ORDER_IDX, TITLE, + MOD_DATE, } from 'src/assets/data/fields'; import SWModal from 'src/components/common/modal/SWModal'; import { EDITCATEGORY } from 'src/assets/data/modal/modals'; @@ -26,6 +27,7 @@ export enum MileageCategoryBoard { 'ORDER_IDX' = ORDER_IDX, 'DESCRIPTION1' = DESCRIPTION1, 'DESCRIPTION2' = DESCRIPTION2, + 'MOD_DATE' = MOD_DATE, 'MANAGE' = MANAGE, } @@ -40,6 +42,7 @@ interface Data { [MileageCategoryBoard.ORDER_IDX]: number; [MileageCategoryBoard.DESCRIPTION1]: string; [MileageCategoryBoard.DESCRIPTION2]: string; + [MileageCategoryBoard.MOD_DATE]: string; [MileageCategoryBoard.MANAGE]: ReactNode; } @@ -55,6 +58,7 @@ function createData( ORDER_IDX: number, DESCRIPTION1: string, DESCRIPTION2: string, + MOD_DATE: string, MANAGE: ReactNode ): Data { return { @@ -63,6 +67,7 @@ function createData( [MileageCategoryBoard.ORDER_IDX]: ORDER_IDX, [MileageCategoryBoard.DESCRIPTION1]: DESCRIPTION1, [MileageCategoryBoard.DESCRIPTION2]: DESCRIPTION2, + [MileageCategoryBoard.MOD_DATE]: MOD_DATE, [MileageCategoryBoard.MANAGE]: MANAGE, }; } @@ -104,6 +109,12 @@ const headCells = [ disablePadding: false, label: '설명2', }, + { + id: [MileageCategoryBoard.MOD_DATE], + numeric: true, + disablePadding: false, + label: '최근 수정일', + }, { id: [MileageCategoryBoard.MANAGE], numeric: true, @@ -182,6 +193,7 @@ export default function MileageCategory({ item[ORDER_IDX], item[DESCRIPTION1], item[DESCRIPTION2], + item[MOD_DATE], ); }); diff --git a/src/pages/mileage/item/global/index.tsx b/src/pages/mileage/item/global/index.tsx index c890f75..3b6cd2f 100644 --- a/src/pages/mileage/item/global/index.tsx +++ b/src/pages/mileage/item/global/index.tsx @@ -19,6 +19,7 @@ import { ISEVALUATE_FUSION, MAX_MAILEAGE, NAME, + MOD_DATE, CATEGORYID, } from 'src/assets/data/fields'; import SWModal from 'src/components/common/modal/SWModal'; @@ -45,6 +46,7 @@ export enum MileageGlobalItemBoard { 'DESCRIPTION2' = DESCRIPTION2, 'ISVISIBLE' = ISVISIBLE, + 'MOD_DATE' = MOD_DATE, 'MANAGE' = MANAGE, } @@ -59,6 +61,7 @@ interface Data { [MileageGlobalItemBoard.DESCRIPTION2]: string; [MileageGlobalItemBoard.ISVISIBLE]: boolean; + [MileageGlobalItemBoard.MOD_DATE]: string; [MileageGlobalItemBoard.MANAGE]: string; } @@ -75,6 +78,7 @@ function createData( DESCRIPTION2: string, ISVISIBLE: boolean, + MOD_DATE: string, MANAGE: string ): Data { return { @@ -87,6 +91,7 @@ function createData( [MileageGlobalItemBoard.DESCRIPTION2]: DESCRIPTION2, [MileageGlobalItemBoard.ISVISIBLE]: ISVISIBLE, + [MileageGlobalItemBoard.MOD_DATE]: MOD_DATE, [MileageGlobalItemBoard.MANAGE]: MANAGE, }; } @@ -132,6 +137,12 @@ const headCells = [ disablePadding: false, label: '보이기', }, + { + id: [MileageGlobalItemBoard.MOD_DATE], + numeric: true, + disablePadding: false, + label: '최근 수정일', + }, { id: [MileageGlobalItemBoard.MANAGE], numeric: true, @@ -307,6 +318,7 @@ export default function MileageCategory({ item[DESCRIPTION1], item[DESCRIPTION2], item[ISVISIBLE], + item[MOD_DATE], ); }); diff --git a/src/pages/mileage/item/semester/index.tsx b/src/pages/mileage/item/semester/index.tsx index 88b1f95..34d783d 100644 --- a/src/pages/mileage/item/semester/index.tsx +++ b/src/pages/mileage/item/semester/index.tsx @@ -18,6 +18,7 @@ import { ISEVALUATE_CSEE, ISEVALUATE_PORTFOLIO, ISEVALUATE_FUSION, + MOD_DATE, MAX_MAILEAGE, } from 'src/assets/data/fields'; import SWModal from 'src/components/common/modal/SWModal'; @@ -45,6 +46,7 @@ export enum MileageSemesterItemBoard { 'ITEM' = ITEM, 'POINTS' = POINTS, 'ITEM_MAX_POINTS' = ITEM_MAX_POINTS, + 'MOD_DATE' = MOD_DATE, 'MANAGE' = MANAGE, } @@ -58,6 +60,7 @@ interface Data { [MileageSemesterItemBoard.ITEM]: string; [MileageSemesterItemBoard.POINTS]: number; [MileageSemesterItemBoard.ITEM_MAX_POINTS]: number; + [MileageSemesterItemBoard.MOD_DATE]: string; [MileageSemesterItemBoard.MANAGE]: string; } @@ -73,6 +76,7 @@ function createData( ITEM: string, POINTS: number, ITEM_MAX_POINTS: number, + MOD_DATE: string, MANAGE: string ): Data { return { @@ -82,6 +86,7 @@ function createData( [MileageSemesterItemBoard.ITEM]: ITEM, [MileageSemesterItemBoard.POINTS]: POINTS, [MileageSemesterItemBoard.ITEM_MAX_POINTS]: ITEM_MAX_POINTS, + [MileageSemesterItemBoard.MOD_DATE]: MOD_DATE, [MileageSemesterItemBoard.MANAGE]: MANAGE, }; } @@ -127,6 +132,12 @@ const headCells = [ disablePadding: false, label: '항목 최대 포인트', }, + { + id: [MileageSemesterItemBoard.MOD_DATE], + numeric: true, + disablePadding: false, + label: '최큰 수정일', + }, { id: [MileageSemesterItemBoard.MANAGE], numeric: true, @@ -287,7 +298,7 @@ export default function MileageCategory({ semesterItem.item.name, semesterItem.points, semesterItem.itemMaxPoints, - + semesterItem.modDate, ); }); diff --git a/src/pages/mileage/register/index.tsx b/src/pages/mileage/register/index.tsx index fd410a8..2eb5ac8 100644 --- a/src/pages/mileage/register/index.tsx +++ b/src/pages/mileage/register/index.tsx @@ -21,6 +21,7 @@ import { SEMESTER_NAME, ITEM_NAME, CATEGORY_NAME, + MOD_DATE, } from 'src/assets/data/fields'; import AttachFileIcon from '@mui/icons-material/AttachFile'; import { REGISTER_NUM, STUDENT_NAME, DESCRIPTION1 } from '../../../assets/data/fields'; @@ -54,6 +55,7 @@ export enum MileageRegisterBoard { 'ITEM_NAME' = ITEM_NAME, 'DESCRIPTION1' = DESCRIPTION1, 'POINTS' = POINTS, + 'MOD_DATE' = MOD_DATE, 'STUDENTS' = STUDENTS, } @@ -67,6 +69,7 @@ interface Data { [MileageRegisterBoard.ITEM_NAME]: string; [MileageRegisterBoard.DESCRIPTION1]: string; [MileageRegisterBoard.POINTS]: number; + [MileageRegisterBoard.MOD_DATE]: string; [MileageRegisterBoard.STUDENTS]: ReactNode; } @@ -81,6 +84,7 @@ function createData( ITEM_NAME: string, DESCRIPTION1: string, POINTS: number, + MOD_DATE: string, STUDENTS: ReactNode ): Data { return { @@ -89,6 +93,7 @@ function createData( [MileageRegisterBoard.ITEM_NAME]: ITEM_NAME, [MileageRegisterBoard.DESCRIPTION1]: DESCRIPTION1, [MileageRegisterBoard.POINTS]: POINTS, + [MileageRegisterBoard.MOD_DATE]: MOD_DATE, [MileageRegisterBoard.STUDENTS]: STUDENTS, }; } @@ -151,6 +156,12 @@ const headCells = [ disablePadding: false, label: '포인트', }, + { + id: [MileageRegisterBoard.MOD_DATE], + numeric: true, + disablePadding: false, + label: '최근 수정일', + }, { id: [MileageRegisterBoard.STUDENTS], numeric: true, @@ -266,6 +277,7 @@ export default function MileageRegister({ semesterItem.item.name, semesterItem.item.description1, semesterItem.points, + semesterItem.modDate,