diff options
Diffstat (limited to 'lib/vendor-document-list/ship/send-to-shi-button.tsx')
| -rw-r--r-- | lib/vendor-document-list/ship/send-to-shi-button.tsx | 32 |
1 files changed, 16 insertions, 16 deletions
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" /> |
