From 37f55540833c2d5894513eca9fc8f7c6233fc2d2 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Thu, 29 May 2025 05:17:13 +0000
Subject: (대표님) 0529 14시 16분 변경사항 저장 (Vendor Data, Docu)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/form-data/form-data-table.tsx | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

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

diff --git a/components/form-data/form-data-table.tsx b/components/form-data/form-data-table.tsx
index 0a76e145..6de6dd0b 100644
--- a/components/form-data/form-data-table.tsx
+++ b/components/form-data/form-data-table.tsx
@@ -110,6 +110,7 @@ export interface DynamicTableProps {
   formName?: string;
   objectCode?: string;
   mode: "IM" | "ENG"; // 모드 속성
+  editableFieldsMap?: Map<string, string[]>; // 새로 추가
 }
 
 export default function DynamicTable({
@@ -121,6 +122,7 @@ export default function DynamicTable({
   projectId,  
   mode = "IM", // 기본값 설정
   formName = `${formCode}`, // Default form name based on formCode
+  editableFieldsMap = new Map(), // 새로 추가
 }: DynamicTableProps) {
   const params = useParams();
   const router = useRouter();
@@ -230,7 +232,8 @@ export default function DynamicTable({
       setReportData, 
       tempCount,
       selectedRows,
-      onRowSelectionChange: setSelectedRows
+      onRowSelectionChange: setSelectedRows,
+      editableFieldsMap 
     }),
     [columnsJSON, setRowAction, setReportData, tempCount, selectedRows]
   );
@@ -397,26 +400,30 @@ export default function DynamicTable({
   async function handleImportExcel(e: React.ChangeEvent<HTMLInputElement>) {
     const file = e.target.files?.[0];
     if (!file) return;
-
+  
     try {
       setIsImporting(true);
       
-      // Call the updated importExcelData function with direct save capability
+      // Call the updated importExcelData function with editableFieldsMap
       const result = await importExcelData({
         file,
         tableData,
         columnsJSON,
-        formCode,  // Pass formCode for direct save
-        contractItemId,  // Pass contractItemId for direct save
+        formCode,
+        contractItemId,
+        editableFieldsMap, // 추가: 편집 가능 필드 정보 전달
         onPendingChange: setIsImporting,
         onDataUpdate: (newData) => {
-          // This is called only after successful DB save
           setTableData(Array.isArray(newData) ? newData : newData(tableData));
         }
       });
       
       // If import and save was successful, refresh the page
       if (result.success) {
+        // Show additional info about skipped fields if any
+        if (result.skippedFields && result.skippedFields.length > 0) {
+          console.log("Import completed with some fields skipped:", result.skippedFields);
+        }
         router.refresh();
       }
     } catch (error) {
@@ -428,7 +435,6 @@ export default function DynamicTable({
       setIsImporting(false);
     }
   }
-  
   // SEDP Send handler (with confirmation)
   function handleSEDPSendClick() {
     if (tableData.length === 0) {
-- 
cgit v1.2.3

