From 79f35bcd4974d54d548488562a6da57ad70bc2e8 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Fri, 31 Oct 2025 15:37:54 +0900
Subject: (김준회) EDP 태그 삭제시, 삭제 API도 함께 호출하도록 변경 (스마트엑셀
 000154)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/form-data/delete-form-data-dialog.tsx | 28 +++++++++++++++++++-----
 1 file changed, 22 insertions(+), 6 deletions(-)

(limited to 'components/form-data/delete-form-data-dialog.tsx')

diff --git a/components/form-data/delete-form-data-dialog.tsx b/components/form-data/delete-form-data-dialog.tsx
index 9298b43b..045d0291 100644
--- a/components/form-data/delete-form-data-dialog.tsx
+++ b/components/form-data/delete-form-data-dialog.tsx
@@ -41,6 +41,7 @@ interface DeleteFormDataDialogProps
   formData: GenericData[]
   formCode: string
   contractItemId: number
+  projectId?: number
   showTrigger?: boolean
   onSuccess?: () => void
   triggerVariant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link"
@@ -50,6 +51,7 @@ export function DeleteFormDataDialog({
   formData,
   formCode,
   contractItemId,
+  projectId,
   showTrigger = true,
   onSuccess,
   triggerVariant = "outline",
@@ -77,6 +79,7 @@ export function DeleteFormDataDialog({
         formCode,
         contractItemId,
         tagIdxs,
+        projectId,
       })
 
       if (result.error) {
@@ -90,6 +93,14 @@ export function DeleteFormDataDialog({
       const deletedCount = result.deletedCount || 0
       const deletedTagsCount = result.deletedTagsCount || 0
       
+      // SEDP 삭제 결과도 포함
+      if (result.sedpDeleteSuccess) {
+        console.log("SEDP에서도 성공적으로 삭제되었습니다.")
+      } else if (result.sedpDeleteError) {
+        console.warn("SEDP 삭제 실패:", result.sedpDeleteError)
+        toast.warning(`로컬 삭제는 성공했으나 SEDP 삭제 실패: ${result.sedpDeleteError}`)
+      }
+      
       if (deletedCount !== deletedTagsCount) {
         // 데이터 불일치 경고
         console.warn(`Data inconsistency: FormEntries deleted: ${deletedCount}, Tags deleted: ${deletedTagsCount}`)
@@ -98,12 +109,17 @@ export function DeleteFormDataDialog({
         )
       } else {
         // 정상적인 삭제 완료
-        toast.success(
-          t("delete.successMessage", { 
-            count: deletedCount,
-            items: deletedCount === 1 ? t("delete.item") : t("delete.items")
-          })
-        )
+        const successMessage = result.sedpDeleteSuccess 
+          ? t("delete.successMessage", { 
+              count: deletedCount,
+              items: deletedCount === 1 ? t("delete.item") : t("delete.items")
+            }) + " (SEDP 포함)"
+          : t("delete.successMessage", { 
+              count: deletedCount,
+              items: deletedCount === 1 ? t("delete.item") : t("delete.items")
+            })
+        
+        toast.success(successMessage)
       }
       
       onSuccess?.()
-- 
cgit v1.2.3

