diff --git a/src/assets/data/fields.ts b/src/assets/data/fields.ts
index 51559e5..291cb3b 100644
--- a/src/assets/data/fields.ts
+++ b/src/assets/data/fields.ts
@@ -73,3 +73,4 @@ export const CATEGORYID = 'categoryId';
export const MOD_DATE = 'modDate';
export const RECORD_NAME = 'recordName';
export const LEVEL = 'level';
+export const TYPE = 'type';
diff --git a/src/components/common/Filter/TypeSelect.tsx b/src/components/common/Filter/TypeSelect.tsx
new file mode 100644
index 0000000..f5dd54f
--- /dev/null
+++ b/src/components/common/Filter/TypeSelect.tsx
@@ -0,0 +1,52 @@
+import { FormControl, InputLabel, MenuItem, Select } from '@mui/material';
+import { ErrorMessage, Field } from 'formik';
+import { useSelector } from 'react-redux';
+import { CATEGORYID, SEMESTER, TYPE } from 'src/assets/data/fields';
+
+export default function TypeSelect() {
+ const TYPES = [
+ {
+ id: 0,
+ text: 'A타입',
+ value: 'A',
+ },
+ {
+ id: 1,
+ text: 'B타입',
+ value: 'B',
+ },
+ {
+ id: 2,
+ text: 'C타입',
+ value: 'C',
+ },
+ {
+ id: 3,
+ text: 'D타입',
+ value: 'D',
+ },
+ {
+ id: 4,
+ text: 'E타입',
+ value: 'E',
+ },
+ ];
+
+ const MySelect = ({ field, form, ...props }) => (
+
+ );
+
+ return (
+
+ 타입
+
+
+
+ );
+}
diff --git a/src/components/modalForm/CategoryForm.tsx b/src/components/modalForm/CategoryForm.tsx
index f139f2b..105e80f 100644
--- a/src/components/modalForm/CategoryForm.tsx
+++ b/src/components/modalForm/CategoryForm.tsx
@@ -1,6 +1,14 @@
import { ErrorMessage, Field, Form, Formik } from 'formik';
import { ButtonFlexBox, engToKor } from '../common/modal/SWModal';
-import { TITLE, CATEGORY, DESCRIPTION1, DESCRIPTION2, ORDER_IDX, ID } from 'src/assets/data/fields';
+import {
+ TITLE,
+ CATEGORY,
+ DESCRIPTION1,
+ DESCRIPTION2,
+ ORDER_IDX,
+ ID,
+ TYPE,
+} from 'src/assets/data/fields';
import * as Yup from 'yup';
import Button from '@mui/material/Button';
import { ADDCATEGORY, EDITCATEGORY } from 'src/assets/data/modal/modals';
@@ -12,6 +20,7 @@ import CancelButton from '../common/modal/CancelButton';
import SubmitButton from '../common/modal/SubmitButton';
import axiosInstance from 'src/utils/axios';
import { useRouter } from 'next/router';
+import TypeSelect from '../common/Filter/TypeSelect';
export default function CategoryForm({ handleClose }) {
const beforeData = useSelector((state) => state.modal.beforeData);
@@ -21,6 +30,7 @@ export default function CategoryForm({ handleClose }) {
const CategorySchema = Yup.object().shape({
[TITLE]: Yup.string().required('필수입니다.'),
+ [TYPE]: Yup.string(),
[DESCRIPTION1]: Yup.string(),
[DESCRIPTION2]: Yup.string(),
[ORDER_IDX]: Yup.number().integer().required('필수입니다.'),
@@ -36,6 +46,7 @@ export default function CategoryForm({ handleClose }) {
const newData = {
[TITLE]: values[TITLE],
[ORDER_IDX]: values[ORDER_IDX],
+ [TYPE]: values[TYPE],
[DESCRIPTION1]: values[DESCRIPTION1],
[DESCRIPTION2]: values[DESCRIPTION2],
};
@@ -69,6 +80,7 @@ export default function CategoryForm({ handleClose }) {
initialValues={{
[TITLE]: modalType === EDITCATEGORY ? beforeData?.[TITLE] : '',
[ORDER_IDX]: modalType === EDITCATEGORY ? beforeData?.[ORDER_IDX] : '',
+ [TYPE]: modalType === EDITCATEGORY ? beforeData?.[TYPE] : '',
[DESCRIPTION1]: modalType === EDITCATEGORY ? beforeData?.[DESCRIPTION1] : '',
[DESCRIPTION2]: modalType === EDITCATEGORY ? beforeData?.[DESCRIPTION2] : '',
}}
@@ -87,6 +99,7 @@ export default function CategoryForm({ handleClose }) {
gap: '30px',
}}
>
+
{[TITLE, ORDER_IDX, DESCRIPTION1, DESCRIPTION2].map((field, index) => (
<>
>
))}
-
diff --git a/src/pages/mileage/category/index.tsx b/src/pages/mileage/category/index.tsx
index 8ff80d4..53f8688 100644
--- a/src/pages/mileage/category/index.tsx
+++ b/src/pages/mileage/category/index.tsx
@@ -6,6 +6,7 @@ import {
DESCRIPTION,
NAME,
ID,
+ TYPE,
ORDER_IDX,
TITLE,
MOD_DATE,
@@ -24,6 +25,7 @@ import { setMileageCategoryList } from 'src/redux/slices/data';
export enum MileageCategoryBoard {
'NUM' = NUM,
'CATEGORY' = CATEGORY,
+ 'TYPE' = TYPE,
'ORDER_IDX' = ORDER_IDX,
'DESCRIPTION1' = DESCRIPTION1,
'DESCRIPTION2' = DESCRIPTION2,
@@ -39,6 +41,7 @@ export enum MileageCategoryBoard {
interface Data {
[MileageCategoryBoard.NUM]: number;
[MileageCategoryBoard.CATEGORY]: string;
+ [MileageCategoryBoard.TYPE]: string;
[MileageCategoryBoard.ORDER_IDX]: number;
[MileageCategoryBoard.DESCRIPTION1]: string;
[MileageCategoryBoard.DESCRIPTION2]: string;
@@ -55,6 +58,7 @@ interface Data {
function createData(
NUM: number,
CATEGORY: string,
+ TYPE: string,
ORDER_IDX: number,
DESCRIPTION1: string,
DESCRIPTION2: string,
@@ -64,6 +68,7 @@ function createData(
return {
[MileageCategoryBoard.NUM]: NUM,
[MileageCategoryBoard.CATEGORY]: CATEGORY,
+ [MileageCategoryBoard.TYPE]: TYPE,
[MileageCategoryBoard.ORDER_IDX]: ORDER_IDX,
[MileageCategoryBoard.DESCRIPTION1]: DESCRIPTION1,
[MileageCategoryBoard.DESCRIPTION2]: DESCRIPTION2,
@@ -89,7 +94,12 @@ const headCells = [
disablePadding: false,
label: '카테고리명',
},
-
+ {
+ id: [MileageCategoryBoard.TYPE],
+ numeric: true,
+ disablePadding: false,
+ label: '타입',
+ },
{
id: [MileageCategoryBoard.ORDER_IDX],
numeric: true,
@@ -182,6 +192,7 @@ export default function MileageCategory({
const beforeData = {
[ID]: item[ID],
[TITLE]: item[NAME],
+ [TYPE]: item[TYPE],
[DESCRIPTION1]: item[DESCRIPTION1],
[DESCRIPTION2]: item[DESCRIPTION2],
[ORDER_IDX]: item[ORDER_IDX],
@@ -190,6 +201,7 @@ export default function MileageCategory({
return createData(
item[ID],
item[NAME],
+ item[TYPE],
item[ORDER_IDX],
item[DESCRIPTION1],
item[DESCRIPTION2],