From 4249d57849ee4e9a39fce41a7dd434e7ca0b35e9 Mon Sep 17 00:00:00 2001
From: 0-Zz-ang <s1998319@gmail.com>
Date: Mon, 25 Aug 2025 14:55:52 +0900
Subject: (박서영)compliance수정
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../questions/compliance-question-edit-sheet.tsx     | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

(limited to 'lib/compliance/questions/compliance-question-edit-sheet.tsx')

diff --git a/lib/compliance/questions/compliance-question-edit-sheet.tsx b/lib/compliance/questions/compliance-question-edit-sheet.tsx
index e5fc6242..4b12e775 100644
--- a/lib/compliance/questions/compliance-question-edit-sheet.tsx
+++ b/lib/compliance/questions/compliance-question-edit-sheet.tsx
@@ -176,10 +176,10 @@ export function ComplianceQuestionEditSheet({
       const updateData = {
         ...data,
         parentQuestionId: data.isConditional ? parentQuestionId : null,
-        conditionalValue: data.isConditional ? data.conditionalValue : undefined,
+        conditionalValue: data.isConditional ? data.conditionalValue : null,
       };
       
-      // isConditional과 parentQuestionId는 제거 (스키마에 없음)
+      // isConditional은 제거 (스키마에 없음)
       delete (updateData as any).isConditional;
       
       console.log("Final updateData:", updateData);
@@ -254,7 +254,13 @@ export function ComplianceQuestionEditSheet({
                     <FormControl>
                       <Checkbox
                         checked={field.value}
-                        onCheckedChange={field.onChange}
+                        onCheckedChange={(checked) => {
+                          if (checked) {
+                            // 필수 질문을 선택하면 조건부 질문 해제
+                            form.setValue("isConditional", false);
+                          }
+                          field.onChange(checked);
+                        }}
                       />
                     </FormControl>
                     <div className="space-y-1 leading-none">
@@ -275,7 +281,13 @@ export function ComplianceQuestionEditSheet({
                     <FormControl>
                       <Checkbox
                         checked={field.value}
-                        onCheckedChange={field.onChange}
+                        onCheckedChange={(checked) => {
+                          if (checked) {
+                            // 조건부 질문을 선택하면 필수 질문 해제
+                            form.setValue("isRequired", false);
+                          }
+                          field.onChange(checked);
+                        }}
                       />
                     </FormControl>
                     <div className="space-y-1 leading-none">
-- 
cgit v1.2.3

