From 3a1053733e2aa324395fb442441c0cb1fbfb0f55 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 4 Jun 2025 17:31:09 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20qstnTypeCd=20=EA=B0=92=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/model/question-table-columns.tsx | 2 +- .../pages/survey/model/survey-interface.ts | 2 +- apps/cs/src/pages/survey/ui/question-form.tsx | 4 +- .../pages/survey/ui/user-survey-article.tsx | 39 +++++++++---------- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/apps/cs/src/pages/survey/model/question-table-columns.tsx b/apps/cs/src/pages/survey/model/question-table-columns.tsx index 357b25adb..39cf4b902 100644 --- a/apps/cs/src/pages/survey/model/question-table-columns.tsx +++ b/apps/cs/src/pages/survey/model/question-table-columns.tsx @@ -12,7 +12,7 @@ import { ArticleManagementDialog } from "../ui/article-management-dialog"; const QUESTION_TYPE = { RADIO: "객관식", - CHECKBOX: "다중응답", + CHECK: "다중응답", INPUT: "주관식", } as const; diff --git a/apps/cs/src/pages/survey/model/survey-interface.ts b/apps/cs/src/pages/survey/model/survey-interface.ts index 3f0a5dd0f..8a4c0e61a 100644 --- a/apps/cs/src/pages/survey/model/survey-interface.ts +++ b/apps/cs/src/pages/survey/model/survey-interface.ts @@ -3,7 +3,7 @@ import type { PageableList, PageableParams } from "@/shared/model"; export const QUESTION_TYPE_CODE = { RADIO: "RADIO", - CHECKBOX: "CHECKBOX", + CHECK: "CHECK", INPUT: "INPUT", } as const; diff --git a/apps/cs/src/pages/survey/ui/question-form.tsx b/apps/cs/src/pages/survey/ui/question-form.tsx index cb321fbe7..b722a4802 100644 --- a/apps/cs/src/pages/survey/ui/question-form.tsx +++ b/apps/cs/src/pages/survey/ui/question-form.tsx @@ -107,7 +107,7 @@ function QuestionForm({ form, actionSlot, handleSave }: QuestionFormProps) { /> - {qstnTypeCd === "CHECKBOX" && ( + {qstnTypeCd === "CHECK" && ( 최대선택갯수 @@ -134,7 +134,7 @@ function QuestionForm({ form, actionSlot, handleSave }: QuestionFormProps) { )} - {(qstnTypeCd === "RADIO" || qstnTypeCd === "CHECKBOX") && ( + {(qstnTypeCd === "RADIO" || qstnTypeCd === "CHECK") && ( 기타답변여부 diff --git a/apps/cs/src/pages/survey/ui/user-survey-article.tsx b/apps/cs/src/pages/survey/ui/user-survey-article.tsx index 156d01aee..66f84c2cb 100644 --- a/apps/cs/src/pages/survey/ui/user-survey-article.tsx +++ b/apps/cs/src/pages/survey/ui/user-survey-article.tsx @@ -189,8 +189,8 @@ function UserSurveyArticle({ srvySn }: { srvySn: string }) { articles={item.articles} /> )} - {item.qstnTypeCd === "CHECKBOX" && ( - { const selectedValues = field.value?.split(",") || []; - const handleCheckboxChange = - (value: string) => (checked: boolean) => { - const values = [...selectedValues]; + const handleCheckedChange = (value: string) => (checked: boolean) => { + const values = [...selectedValues]; - if (checked) { - if (values.length >= maxChcCnt) { - alert("최대 선택 개수를 초과했습니다."); - return; - } - values.push(value); - } else { - const valueIndex = values.indexOf(value); - if (valueIndex !== -1) { - values.splice(valueIndex, 1); - } + if (checked) { + if (values.length >= maxChcCnt) { + alert("최대 선택 개수를 초과했습니다."); + return; } + values.push(value); + } else { + const valueIndex = values.indexOf(value); + if (valueIndex !== -1) { + values.splice(valueIndex, 1); + } + } - field.onChange(values.filter((v) => v.trim() !== "").join(",")); - }; + field.onChange(values.filter((v) => v.trim() !== "").join(",")); + }; return ( @@ -324,7 +323,7 @@ function CheckboxArticle({