Skip to content

Commit

Permalink
Fix: 글로벌 항목 리스트 항목명 안보이는 버그 itemName -\> name으로 변경하여 해결(#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohinhyuk committed Aug 29, 2023
1 parent 34b188b commit c6992ad
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/components/common/modal/SWModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const engToKor = (eng) => {
case SEMESTER:
return '학기';
case ITEM:
return '항목';
return '항목 이름';
case MILEAGE:
return '마일리지';
case MAX_MAILEAGE:
Expand Down
45 changes: 17 additions & 28 deletions src/components/modalForm/GlobalItemForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ export default function GlobalItemForm({ beforeData }) {
const newData = {
categoryId: 1,
itemName: values[ITEM],
// [SEMESTER]: values[SEMESTER],
// [MILEAGE]: values[MILEAGE],
// [MAX_MAILEAGE]: values[MAX_MAILEAGE],
[DESCRIPTION1]: values[DESCRIPTION1],
[DESCRIPTION2]: values[DESCRIPTION2],
stuType: stuTypeConverter(values),
Expand Down Expand Up @@ -138,10 +135,9 @@ export default function GlobalItemForm({ beforeData }) {
<Formik
initialValues={{
[CATEGORY]: modalType === EDITGLOBALITEM ? beforeData?.[CATEGORY] : '',
[SEMESTER]: modalType === EDITGLOBALITEM ? beforeData?.[SEMESTER] : '',

[ITEM]: modalType === EDITGLOBALITEM ? beforeData?.[ITEM] : '',
[MILEAGE]: modalType === EDITGLOBALITEM ? beforeData?.[MILEAGE] : 0,
[MAX_MAILEAGE]: modalType === EDITGLOBALITEM ? beforeData?.[MAX_MAILEAGE] : 0,

[DESCRIPTION1]: modalType === EDITGLOBALITEM ? beforeData?.[DESCRIPTION1] : '',
[DESCRIPTION2]: modalType === EDITGLOBALITEM ? beforeData?.[DESCRIPTION2] : '',
[FILE_DESCRIPTION]: modalType === EDITGLOBALITEM ? beforeData?.[FILE_DESCRIPTION] : '',
Expand All @@ -162,28 +158,21 @@ export default function GlobalItemForm({ beforeData }) {
<StyleFieldForm>
<Box sx={{ display: 'flex', width: '100%', gap: '30px' }}>
<StyleFieldBox>
{[
CATEGORY,
SEMESTER,
ITEM,
MILEAGE,
MAX_MAILEAGE,
DESCRIPTION1,
DESCRIPTION2,
FILE_DESCRIPTION,
].map((field: string, index: number) => (
<Box key={index}>
<Field
sx={{ width: '300px' }}
name={field}
as={TextField}
type="text"
label={engToKor(field)}
variant="standard"
/>
<ErrorMessage name={field} />
</Box>
))}
{[CATEGORY, ITEM, DESCRIPTION1, DESCRIPTION2, FILE_DESCRIPTION].map(
(field: string, index: number) => (
<Box key={index}>
<Field
sx={{ width: '300px' }}
name={field}
as={TextField}
type="text"
label={engToKor(field)}
variant="standard"
/>
<ErrorMessage name={field} />
</Box>
)
)}
</StyleFieldBox>
<StyleFieldBox>
{[
Expand Down
5 changes: 2 additions & 3 deletions src/pages/mileage/item/global/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ export default function MileageCategory({
const beforeData = {
[NUM]: item.id,
[CATEGORY]: item.category.name,

[ITEM]: item.itemName,
[ITEM]: item.name,
[DESCRIPTION1]: item.description1,
[DESCRIPTION2]: item.description2,
[FILE_DESCRIPTION]: '첨부파일 설명', // 업서야 되는 듯
Expand All @@ -290,7 +289,7 @@ export default function MileageCategory({
item.id,
item.category.name,

item.itemName,
item.name,
true,
'2023-08-21',
<SWModal type={EDITGLOBALITEM} beforeData={beforeData} />
Expand Down

0 comments on commit c6992ad

Please sign in to comment.