From 92eda21e45d902663052575aaa4c4f80bfa2faea Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 4 Aug 2025 09:36:14 +0000
Subject: (대표님) 벤더 문서 변경사항, data-table 변경, sync 변경
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../ship/send-to-shi-button.tsx                    | 32 +++++++++++-----------
 1 file changed, 16 insertions(+), 16 deletions(-)

(limited to 'lib/vendor-document-list/ship/send-to-shi-button.tsx')

diff --git a/lib/vendor-document-list/ship/send-to-shi-button.tsx b/lib/vendor-document-list/ship/send-to-shi-button.tsx
index 4607c994..c67c7b2c 100644
--- a/lib/vendor-document-list/ship/send-to-shi-button.tsx
+++ b/lib/vendor-document-list/ship/send-to-shi-button.tsx
@@ -47,7 +47,7 @@ export function SendToSHIButton({
   // 문서에서 유효한 계약 ID 목록 추출
   const documentsContractIds = React.useMemo(() => {
     const validIds = documents
-      .map(doc => doc.contractId)
+      .map(doc => doc.projectId)
       .filter((id): id is number => typeof id === 'number' && id > 0)
     
     const uniqueIds = [...new Set(validIds)]
@@ -68,8 +68,8 @@ export function SendToSHIButton({
       console.log('SendToSHIButton Debug Info:', {
         documentsContractIds,
         totalStats,
-        contractStatuses: contractStatuses.map(({ contractId, syncStatus, error }) => ({
-          contractId,
+        contractStatuses: contractStatuses.map(({ projectId, syncStatus, error }) => ({
+          projectId,
           pendingChanges: syncStatus?.pendingChanges,
           hasError: !!error
         }))
@@ -95,7 +95,7 @@ export function SendToSHIButton({
       // 동기화 가능한 계약들만 필터링
       const contractsToSync = contractStatuses.filter(({ syncStatus, error }) => {
         if (error) {
-          console.warn(`Contract ${contractStatuses.find(c => c.error === error)?.contractId} has error:`, error)
+          console.warn(`Contract ${contractStatuses.find(c => c.error === error)?.projectId} has error:`, error)
           return false
         }
         if (!syncStatus) return false
@@ -114,32 +114,32 @@ export function SendToSHIButton({
 
       // 각 contract별로 순차 동기화
       for (let i = 0; i < contractsToSync.length; i++) {
-        const { contractId } = contractsToSync[i]
-        setCurrentSyncingContract(contractId)
+        const { projectId } = contractsToSync[i]
+        setCurrentSyncingContract(projectId)
         
         try {
-          console.log(`Syncing contract ${contractId}...`)
+          console.log(`Syncing contract ${projectId}...`)
           const result = await triggerSync({ 
-            contractId, 
+            projectId, 
             targetSystem 
           })
           
           if (result?.success) {
             successfulSyncs++
             totalSuccessCount += result.successCount || 0
-            console.log(`Contract ${contractId} sync successful:`, result)
+            console.log(`Contract ${projectId} sync successful:`, result)
           } else {
             failedSyncs++
             totalFailureCount += result?.failureCount || 0
             const errorMsg = result?.errors?.[0] || result?.message || 'Unknown sync error'
-            errors.push(`Contract ${contractId}: ${errorMsg}`)
-            console.error(`Contract ${contractId} sync failed:`, result)
+            errors.push(`Contract ${projectId}: ${errorMsg}`)
+            console.error(`Contract ${projectId} sync failed:`, result)
           }
         } catch (error) {
           failedSyncs++
           const errorMessage = error instanceof Error ? error.message : '알 수 없는 오류'
-          errors.push(`Contract ${contractId}: ${errorMessage}`)
-          console.error(`Contract ${contractId} sync exception:`, error)
+          errors.push(`Contract ${projectId}: ${errorMessage}`)
+          console.error(`Contract ${projectId} sync exception:`, error)
         }
 
         // 진행률 업데이트
@@ -338,9 +338,9 @@ export function SendToSHIButton({
                     <div className="text-sm font-medium">계약별 상태</div>
                     <ScrollArea className="h-32">
                       <div className="space-y-2">
-                        {contractStatuses.map(({ contractId, syncStatus, isLoading, error }) => (
-                          <div key={contractId} className="flex items-center justify-between text-xs p-2 rounded border">
-                            <span className="font-medium">Contract {contractId}</span>
+                        {contractStatuses.map(({ projectId, syncStatus, isLoading, error }) => (
+                          <div key={projectId} className="flex items-center justify-between text-xs p-2 rounded border">
+                            <span className="font-medium">Contract {projectId}</span>
                             {isLoading ? (
                               <Badge variant="secondary" className="text-xs">
                                 <Loader2 className="w-3 h-3 mr-1 animate-spin" />
-- 
cgit v1.2.3

