From ee57cc221ff2edafd3c0f12a181214c602ed257e Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 22 Jul 2025 02:57:00 +0000 Subject: (대표님, 최겸) 이메일 템플릿, 벤더데이터 변경사항 대응, 기술영업 변경요구사항 구현 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ship/enhanced-doc-table-columns.tsx | 42 +-- .../ship/enhanced-documents-table.tsx | 76 +++--- .../ship/import-from-dolce-button.tsx | 86 +++---- .../ship/send-to-shi-button.tsx | 286 +++++++++++---------- 4 files changed, 258 insertions(+), 232 deletions(-) (limited to 'lib/vendor-document-list/ship') diff --git a/lib/vendor-document-list/ship/enhanced-doc-table-columns.tsx b/lib/vendor-document-list/ship/enhanced-doc-table-columns.tsx index 9c13573c..51c104dc 100644 --- a/lib/vendor-document-list/ship/enhanced-doc-table-columns.tsx +++ b/lib/vendor-document-list/ship/enhanced-doc-table-columns.tsx @@ -59,7 +59,7 @@ export function getSimplifiedDocumentColumns({ id: "select", header: ({ table }) => (
- 선택 + Select
), cell: ({ row }) => { @@ -78,7 +78,7 @@ export function getSimplifiedDocumentColumns({ { accessorKey: "docNumber", header: ({ column }) => ( - + ), cell: ({ row }) => { const doc = row.original @@ -90,7 +90,7 @@ export function getSimplifiedDocumentColumns({ size: 120, enableResizing: true, meta: { - excelHeader: "문서번호" + excelHeader: "Document No" }, }, @@ -98,7 +98,7 @@ export function getSimplifiedDocumentColumns({ { accessorKey: "title", header: ({ column }) => ( - + ), cell: ({ row }) => { const doc = row.original @@ -110,7 +110,7 @@ export function getSimplifiedDocumentColumns({ enableResizing: true, maxSize:300, meta: { - excelHeader: "문서명" + excelHeader: "Title" }, }, @@ -118,7 +118,7 @@ export function getSimplifiedDocumentColumns({ { accessorKey: "projectCode", header: ({ column }) => ( - + ), cell: ({ row }) => { const projectCode = row.original.projectCode @@ -131,7 +131,7 @@ export function getSimplifiedDocumentColumns({ maxSize:100, meta: { - excelHeader: "프로젝트" + excelHeader: "Project" }, }, @@ -141,7 +141,7 @@ export function getSimplifiedDocumentColumns({ header: ({ table }) => { // 첫 번째 행의 firstStageName을 그룹 헤더로 사용 const firstRow = table.getRowModel().rows[0]?.original - const stageName = firstRow?.firstStageName || "1차 스테이지" + const stageName = firstRow?.firstStageName || "First Stage" return (
{stageName} @@ -152,27 +152,27 @@ export function getSimplifiedDocumentColumns({ { accessorKey: "firstStagePlanDate", header: ({ column }) => ( - + ), cell: ({ row }) => { return }, enableResizing: true, meta: { - excelHeader: "1차 계획일" + excelHeader: "First Planned Date" }, }, { accessorKey: "firstStageActualDate", header: ({ column }) => ( - + ), cell: ({ row }) => { return }, enableResizing: true, meta: { - excelHeader: "1차 실제일" + excelHeader: "First Actual Date" }, }, ], @@ -184,7 +184,7 @@ export function getSimplifiedDocumentColumns({ header: ({ table }) => { // 첫 번째 행의 secondStageName을 그룹 헤더로 사용 const firstRow = table.getRowModel().rows[0]?.original - const stageName = firstRow?.secondStageName || "2차 스테이지" + const stageName = firstRow?.secondStageName || "Second Stage" return (
{stageName} @@ -195,27 +195,27 @@ export function getSimplifiedDocumentColumns({ { accessorKey: "secondStagePlanDate", header: ({ column }) => ( - + ), cell: ({ row }) => { return }, enableResizing: true, meta: { - excelHeader: "2차 계획일" + excelHeader: "Second Planned Date" }, }, { accessorKey: "secondStageActualDate", header: ({ column }) => ( - + ), cell: ({ row }) => { return }, enableResizing: true, meta: { - excelHeader: "2차 실제일" + excelHeader: "Second Actual Date" }, }, ], @@ -225,7 +225,7 @@ export function getSimplifiedDocumentColumns({ { accessorKey: "attachmentCount", header: ({ column }) => ( - + ), cell: ({ row }) => { const count = row.original.attachmentCount || 0 @@ -237,7 +237,7 @@ export function getSimplifiedDocumentColumns({ size: 60, enableResizing: true, meta: { - excelHeader: "첨부파일" + excelHeader: "Attachments" }, }, @@ -245,7 +245,7 @@ export function getSimplifiedDocumentColumns({ { accessorKey: "updatedAt", header: ({ column }) => ( - + ), cell: ({ cell, row }) => { return ( @@ -254,7 +254,7 @@ export function getSimplifiedDocumentColumns({ }, enableResizing: true, meta: { - excelHeader: "업데이트" + excelHeader: "Updated" }, }, diff --git a/lib/vendor-document-list/ship/enhanced-documents-table.tsx b/lib/vendor-document-list/ship/enhanced-documents-table.tsx index 2354a9be..9885c027 100644 --- a/lib/vendor-document-list/ship/enhanced-documents-table.tsx +++ b/lib/vendor-document-list/ship/enhanced-documents-table.tsx @@ -25,17 +25,17 @@ import { EnhancedDocTableToolbarActions } from "./enhanced-doc-table-toolbar-act const DRAWING_KIND_INFO = { B3: { title: "B3 Vendor", - description: "Approval → Work 단계로 진행되는 승인 중심 도면", + description: "Approval-focused drawings progressing through Approval → Work stages", color: "bg-blue-50 text-blue-700 border-blue-200" }, B4: { title: "B4 GTT", - description: "Pre → Work 단계로 진행되는 DOLCE 연동 도면", + description: "DOLCE-integrated drawings progressing through Pre → Work stages", color: "bg-green-50 text-green-700 border-green-200" }, B5: { title: "B5 FMEA", - description: "First → Second 단계로 진행되는 순차적 도면", + description: "Sequential drawings progressing through First → Second stages", color: "bg-purple-50 text-purple-700 border-purple-200" } } as const @@ -79,22 +79,22 @@ export function SimplifiedDocumentsTable({ const advancedFilterFields: DataTableAdvancedFilterField[] = [ { id: "docNumber", - label: "문서번호", - type: "text", - }, - { - id: "vendorDocNumber", - label: "벤더 문서번호", + label: "Document No", type: "text", }, + // { + // id: "vendorDocNumber", + // label: "Vendor Document No", + // type: "text", + // }, { id: "title", - label: "문서제목", + label: "Document Title", type: "text", }, { id: "drawingKind", - label: "문서종류", + label: "Document Type", type: "select", options: [ { label: "B3", value: "B3" }, @@ -104,78 +104,78 @@ export function SimplifiedDocumentsTable({ }, { id: "projectCode", - label: "프로젝트 코드", + label: "Project Code", type: "text", }, { id: "vendorName", - label: "벤더명", + label: "Vendor Name", type: "text", }, { id: "vendorCode", - label: "벤더 코드", + label: "Vendor Code", type: "text", }, { id: "pic", - label: "담당자", + label: "PIC", type: "text", }, { id: "status", - label: "문서 상태", + label: "Document Status", type: "select", options: [ - { label: "활성", value: "ACTIVE" }, - { label: "비활성", value: "INACTIVE" }, - { label: "보류", value: "PENDING" }, - { label: "완료", value: "COMPLETED" }, + { label: "Active", value: "ACTIVE" }, + { label: "Inactive", value: "INACTIVE" }, + { label: "Pending", value: "PENDING" }, + { label: "Completed", value: "COMPLETED" }, ], }, { id: "firstStageName", - label: "1차 스테이지", + label: "First Stage", type: "text", }, { id: "secondStageName", - label: "2차 스테이지", + label: "Second Stage", type: "text", }, { id: "firstStagePlanDate", - label: "1차 계획일", + label: "First Planned Date", type: "date", }, { id: "firstStageActualDate", - label: "1차 실제일", + label: "First Actual Date", type: "date", }, { id: "secondStagePlanDate", - label: "2차 계획일", + label: "Second Planned Date", type: "date", }, { id: "secondStageActualDate", - label: "2차 실제일", + label: "Second Actual Date", type: "date", }, { id: "issuedDate", - label: "발행일", + label: "Issue Date", type: "date", }, { id: "createdAt", - label: "생성일", + label: "Created Date", type: "date", }, { id: "updatedAt", - label: "수정일", + label: "Updated Date", type: "date", }, ] @@ -184,32 +184,32 @@ export function SimplifiedDocumentsTable({ const b4FilterFields: DataTableAdvancedFilterField[] = [ { id: "cGbn", - label: "C 구분", + label: "C Category", type: "text", }, { id: "dGbn", - label: "D 구분", + label: "D Category", type: "text", }, { id: "degreeGbn", - label: "Degree 구분", + label: "Degree Category", type: "text", }, { id: "deptGbn", - label: "Dept 구분", + label: "Dept Category", type: "text", }, { id: "jGbn", - label: "J 구분", + label: "J Category", type: "text", }, { id: "sGbn", - label: "S 구분", + label: "S Category", type: "text", }, ] @@ -246,17 +246,17 @@ export function SimplifiedDocumentsTable({ {kindInfo && (
- + {/* {kindInfo.title} {kindInfo.description} - + */}
- {total}개 문서 + {total} documents
diff --git a/lib/vendor-document-list/ship/import-from-dolce-button.tsx b/lib/vendor-document-list/ship/import-from-dolce-button.tsx index d4728d22..de9e63bc 100644 --- a/lib/vendor-document-list/ship/import-from-dolce-button.tsx +++ b/lib/vendor-document-list/ship/import-from-dolce-button.tsx @@ -72,7 +72,7 @@ export function ImportFromDOLCEButton({ setVendorContractIds(contractIds) } catch (error) { console.error('Failed to fetch vendor contracts:', error) - toast.error('계약 정보를 가져오는데 실패했습니다.') + toast.error('Failed to fetch contract information.') } finally { setLoadingVendorContracts(false) } @@ -142,7 +142,7 @@ export function ImportFromDOLCEButton({ } catch (error) { console.error('Failed to fetch import statuses:', error) - toast.error('상태를 확인할 수 없습니다. 프로젝트 설정을 확인해주세요.') + toast.error('Unable to check status. Please verify project settings.') } finally { setStatusLoading(false) } @@ -230,16 +230,16 @@ export function ImportFromDOLCEButton({ if (totalResult.success) { toast.success( - `DOLCE 가져오기 완료`, + `DOLCE import completed`, { - description: `신규 ${totalResult.newCount}건, 업데이트 ${totalResult.updatedCount}건, 건너뜀 ${totalResult.skippedCount}건 (${contractIds.length}개 계약)` + description: `New ${totalResult.newCount}, Updated ${totalResult.updatedCount}, Skipped ${totalResult.skippedCount} (${contractIds.length} contracts)` } ) } else { toast.error( - `DOLCE 가져오기 부분 실패`, + `DOLCE import partially failed`, { - description: '일부 계약에서 가져오기에 실패했습니다.' + description: 'Some contracts failed to import.' } ) } @@ -252,34 +252,34 @@ export function ImportFromDOLCEButton({ setImportProgress(0) setIsImporting(false) - toast.error('DOLCE 가져오기 실패', { - description: error instanceof Error ? error.message : '알 수 없는 오류가 발생했습니다.' + toast.error('DOLCE import failed', { + description: error instanceof Error ? error.message : 'An unknown error occurred.' }) } } const getStatusBadge = () => { if (loadingVendorContracts) { - return 계약 정보 로딩 중... + return Loading contract information... } if (statusLoading) { - return DOLCE 연결 확인 중... + return Checking DOLCE connection... } if (importStatusMap.size === 0) { - return DOLCE 연결 오류 + return DOLCE Connection Error } if (!totalStats.importEnabled) { - return DOLCE 가져오기 비활성화 + return DOLCE Import Disabled } if (totalStats.newDocuments > 0 || totalStats.updatedDocuments > 0) { return ( - 업데이트 가능 ({contractIds.length}개 계약) + Updates Available ({contractIds.length} contracts) ) } @@ -287,7 +287,7 @@ export function ImportFromDOLCEButton({ return ( - DOLCE와 동기화됨 + Synchronized with DOLCE ) } @@ -316,7 +316,7 @@ export function ImportFromDOLCEButton({ ) : ( )} - DOLCE에서 가져오기 + Import from DOLCE {totalStats.newDocuments + totalStats.updatedDocuments > 0 && (
-

DOLCE 가져오기 상태

+

DOLCE Import Status

- 현재 상태 + Current Status {getStatusBadge()}
@@ -342,15 +342,15 @@ export function ImportFromDOLCEButton({ {/* 계약 소스 표시 */} {allDocuments.length === 0 && vendorContractIds.length > 0 && (
- 문서가 없어서 전체 계약에서 가져오기를 진행합니다. + No documents found, importing from all contracts.
)} {/* 다중 계약 정보 표시 */} {contractIds.length > 1 && (
-
대상 계약
-
{contractIds.length}개 계약
+
Target Contracts
+
{contractIds.length} contracts
Contract IDs: {contractIds.join(', ')}
@@ -363,25 +363,25 @@ export function ImportFromDOLCEButton({
-
신규 문서
-
{totalStats.newDocuments || 0}건
+
New Documents
+
{totalStats.newDocuments || 0}
-
업데이트
-
{totalStats.updatedDocuments || 0}건
+
Updates
+
{totalStats.updatedDocuments || 0}
-
DOLCE 전체 문서 (B3/B4/B5)
-
{totalStats.availableDocuments || 0}건
+
Total DOLCE Documents (B3/B4/B5)
+
{totalStats.availableDocuments || 0}
{/* 각 계약별 세부 정보 (펼치기/접기 가능) */} {contractIds.length > 1 && (
- 계약별 세부 정보 + Details by Contract
{contractIds.map(contractId => { @@ -391,10 +391,10 @@ export function ImportFromDOLCEButton({
Contract {contractId}
{status ? (
- 신규 {status.newDocuments}건, 업데이트 {status.updatedDocuments}건 + New {status.newDocuments}, Updates {status.updatedDocuments}
) : ( -
상태 확인 실패
+
Status check failed
)}
) @@ -417,12 +417,12 @@ export function ImportFromDOLCEButton({ {isImporting ? ( <> - 가져오는 중... + Importing... ) : ( <> - 지금 가져오기 + Import Now )} @@ -448,10 +448,10 @@ export function ImportFromDOLCEButton({ - DOLCE에서 문서 목록 가져오기 + Import Document List from DOLCE - 삼성중공업 DOLCE 시스템에서 최신 문서 목록을 가져옵니다. - {contractIds.length > 1 && ` (${contractIds.length}개 계약 대상)`} + Import the latest document list from Samsung Heavy Industries DOLCE system. + {contractIds.length > 1 && ` (${contractIds.length} contracts targeted)`} @@ -459,20 +459,20 @@ export function ImportFromDOLCEButton({ {totalStats && (
- 가져올 항목 + Items to Import - {totalStats.newDocuments + totalStats.updatedDocuments}건 + {totalStats.newDocuments + totalStats.updatedDocuments}
- 신규 문서와 업데이트된 문서가 포함됩니다. (B3, B4, B5) + Includes new and updated documents (B3, B4, B5).
- B4 문서의 경우 GTTPreDwg, GTTWorkingDwg 이슈 스테이지가 자동 생성됩니다. + For B4 documents, GTTPreDwg and GTTWorkingDwg issue stages will be auto-generated. {contractIds.length > 1 && ( <>
- {contractIds.length}개 계약에서 순차적으로 가져옵니다. + Will import sequentially from {contractIds.length} contracts. )}
@@ -480,7 +480,7 @@ export function ImportFromDOLCEButton({ {isImporting && (
- 진행률 + Progress {importProgress}%
@@ -495,7 +495,7 @@ export function ImportFromDOLCEButton({ onClick={() => setIsDialogOpen(false)} disabled={isImporting} > - 취소 + Cancel 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 61893da5..4607c994 100644 --- a/lib/vendor-document-list/ship/send-to-shi-button.tsx +++ b/lib/vendor-document-list/ship/send-to-shi-button.tsx @@ -1,8 +1,8 @@ -// components/sync/send-to-shi-button.tsx (다중 계약 버전) +// components/sync/send-to-shi-button.tsx (최종 완성 버전) "use client" import * as React from "react" -import { Send, Loader2, CheckCircle, AlertTriangle, Settings } from "lucide-react" +import { Send, Loader2, CheckCircle, AlertTriangle, Settings, RefreshCw } from "lucide-react" import { toast } from "sonner" import { Button } from "@/components/ui/button" @@ -22,7 +22,9 @@ import { Badge } from "@/components/ui/badge" import { Progress } from "@/components/ui/progress" import { Separator } from "@/components/ui/separator" import { ScrollArea } from "@/components/ui/scroll-area" -import { useSyncStatus, useTriggerSync } from "@/hooks/use-sync-status" +import { Alert, AlertDescription } from "@/components/ui/alert" +// ✅ 업데이트된 Hook import +import { useClientSyncStatus, useTriggerSync, syncUtils } from "@/hooks/use-sync-status" import type { EnhancedDocument } from "@/types/enhanced-documents" interface SendToSHIButtonProps { @@ -31,13 +33,6 @@ interface SendToSHIButtonProps { projectType: "ship" | "plant" } -interface ContractSyncStatus { - contractId: number - syncStatus: any - isLoading: boolean - error: any -} - export function SendToSHIButton({ documents = [], onSyncComplete, @@ -49,75 +44,45 @@ export function SendToSHIButton({ const targetSystem = projectType === 'ship' ? "DOLCE" : "SWP" - // documents에서 contractId 목록 추출 + // 문서에서 유효한 계약 ID 목록 추출 const documentsContractIds = React.useMemo(() => { - const uniqueIds = [...new Set(documents.map(doc => doc.contractId).filter(Boolean))] + const validIds = documents + .map(doc => doc.contractId) + .filter((id): id is number => typeof id === 'number' && id > 0) + + const uniqueIds = [...new Set(validIds)] return uniqueIds.sort() }, [documents]) - // 각 contract별 동기화 상태 조회 - const contractStatuses = React.useMemo(() => { - return documentsContractIds.map(contractId => { - const { - syncStatus, - isLoading, - error, - refetch - } = useSyncStatus(contractId, targetSystem) - - return { - contractId, - syncStatus, - isLoading, - error, - refetch - } - }) - }, [documentsContractIds, targetSystem]) - - const { - triggerSync, - isLoading: isSyncing, - error: syncError - } = useTriggerSync() - - // 전체 통계 계산 - const totalStats = React.useMemo(() => { - let totalPending = 0 - let totalSynced = 0 - let totalFailed = 0 - let hasError = false - let isLoading = false - - contractStatuses.forEach(({ syncStatus, error, isLoading: loading }) => { - if (error) hasError = true - if (loading) isLoading = true - if (syncStatus) { - totalPending += syncStatus.pendingChanges || 0 - totalSynced += syncStatus.syncedChanges || 0 - totalFailed += syncStatus.failedChanges || 0 - } - }) - - return { - totalPending, - totalSynced, - totalFailed, - hasError, - isLoading, - canSync: totalPending > 0 && !hasError - } - }, [contractStatuses]) + // ✅ 클라이언트 전용 Hook 사용 (서버 사이드 렌더링 호환) + const { contractStatuses, totalStats, refetchAll } = useClientSyncStatus( + documentsContractIds, + targetSystem + ) + + const { triggerSync, isLoading: isSyncing, error: syncError } = useTriggerSync() - // 에러 상태 표시 + // 개발 환경에서 디버깅 정보 React.useEffect(() => { - if (totalStats.hasError) { - console.warn('Failed to load sync status for some contracts') + if (process.env.NODE_ENV === 'development') { + console.log('SendToSHIButton Debug Info:', { + documentsContractIds, + totalStats, + contractStatuses: contractStatuses.map(({ contractId, syncStatus, error }) => ({ + contractId, + pendingChanges: syncStatus?.pendingChanges, + hasError: !!error + })) + }) } - }, [totalStats.hasError]) + }, [documentsContractIds, totalStats, contractStatuses]) + // 동기화 실행 함수 const handleSync = async () => { - if (documentsContractIds.length === 0) return + if (documentsContractIds.length === 0) { + toast.info('동기화할 계약이 없습니다.') + return + } setSyncProgress(0) let successfulSyncs = 0 @@ -127,9 +92,17 @@ export function SendToSHIButton({ const errors: string[] = [] try { - const contractsToSync = contractStatuses.filter( - ({ syncStatus, error }) => !error && syncStatus?.syncEnabled && syncStatus?.pendingChanges > 0 - ) + // 동기화 가능한 계약들만 필터링 + const contractsToSync = contractStatuses.filter(({ syncStatus, error }) => { + if (error) { + console.warn(`Contract ${contractStatuses.find(c => c.error === error)?.contractId} has error:`, error) + return false + } + if (!syncStatus) return false + if (!syncStatus.syncEnabled) return false + if (syncStatus.pendingChanges <= 0) return false + return true + }) if (contractsToSync.length === 0) { toast.info('동기화할 변경사항이 없습니다.') @@ -137,12 +110,15 @@ export function SendToSHIButton({ return } + console.log(`Starting sync for ${contractsToSync.length} contracts`) + // 각 contract별로 순차 동기화 for (let i = 0; i < contractsToSync.length; i++) { const { contractId } = contractsToSync[i] setCurrentSyncingContract(contractId) try { + console.log(`Syncing contract ${contractId}...`) const result = await triggerSync({ contractId, targetSystem @@ -151,17 +127,19 @@ export function SendToSHIButton({ if (result?.success) { successfulSyncs++ totalSuccessCount += result.successCount || 0 + console.log(`Contract ${contractId} sync successful:`, result) } else { failedSyncs++ totalFailureCount += result?.failureCount || 0 - if (result?.errors?.[0]) { - errors.push(`Contract ${contractId}: ${result.errors[0]}`) - } + const errorMsg = result?.errors?.[0] || result?.message || 'Unknown sync error' + errors.push(`Contract ${contractId}: ${errorMsg}`) + console.error(`Contract ${contractId} 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) } // 진행률 업데이트 @@ -170,6 +148,7 @@ export function SendToSHIButton({ setCurrentSyncingContract(null) + // 결과 처리 및 토스트 표시 setTimeout(() => { setSyncProgress(0) setIsDialogOpen(false) @@ -185,7 +164,7 @@ export function SendToSHIButton({ toast.warning( `부분 동기화 완료: ${successfulSyncs}개 성공, ${failedSyncs}개 실패`, { - description: errors[0] || '일부 계약 동기화에 실패했습니다.' + description: errors.slice(0, 3).join(', ') + (errors.length > 3 ? ' 외 더보기...' : '') } ) } else { @@ -198,7 +177,7 @@ export function SendToSHIButton({ } // 모든 contract 상태 갱신 - contractStatuses.forEach(({ refetch }) => refetch?.()) + refetchAll() onSyncComplete?.() }, 500) @@ -206,19 +185,32 @@ export function SendToSHIButton({ setSyncProgress(0) setCurrentSyncingContract(null) + const errorMessage = syncUtils.formatError(error as any) toast.error('동기화 실패', { - description: error instanceof Error ? error.message : '알 수 없는 오류가 발생했습니다.' + description: errorMessage }) + console.error('Sync process failed:', error) } } + // 동기화 상태에 따른 뱃지 생성 const getSyncStatusBadge = () => { if (totalStats.isLoading) { - return 확인 중... + return ( + + + 확인 중... + + ) } if (totalStats.hasError) { - return 오류 + return ( + + + 연결 오류 + + ) } if (documentsContractIds.length === 0) { @@ -246,10 +238,6 @@ export function SendToSHIButton({ return 변경사항 없음 } - const refreshAllStatuses = () => { - contractStatuses.forEach(({ refetch }) => refetch?.()) - } - return ( <> @@ -258,7 +246,7 @@ export function SendToSHIButton({
- +
-

SHI 동기화 상태

+
+

SHI 동기화 상태

+ +
+
전체 상태 {getSyncStatusBadge()}
+
- {documentsContractIds.length}개 계약 대상 + {documentsContractIds.length}개 계약 대상 • {targetSystem} 시스템
+ {/* 에러 상태 표시 */} + {totalStats.hasError && ( + + + + 일부 계약의 동기화 상태를 확인할 수 없습니다. 네트워크 연결을 확인해주세요. + {process.env.NODE_ENV === 'development' && ( +
+ Debug: {contractStatuses.filter(({ error }) => error).length}개 계약에서 오류 +
+ )} +
+
+ )} + + {/* 정상 상태일 때 통계 표시 */} {!totalStats.hasError && documentsContractIds.length > 0 && (
-
+
대기 중
-
{totalStats.totalPending}건
+
{totalStats.totalPending}건
-
+
동기화됨
-
{totalStats.totalSynced}건
+
{totalStats.totalSynced}건
-
+
실패
{totalStats.totalFailed}건
@@ -319,17 +340,26 @@ export function SendToSHIButton({
{contractStatuses.map(({ contractId, syncStatus, isLoading, error }) => (
- Contract {contractId} + Contract {contractId} {isLoading ? ( - 로딩... + + + 로딩... + ) : error ? ( - 오류 - ) : syncStatus?.pendingChanges > 0 ? ( + + + 오류 + + ) : syncStatus && syncStatus.pendingChanges > 0 ? ( {syncStatus.pendingChanges}건 대기 ) : ( - 동기화됨 + + + 최신 + )}
))} @@ -340,28 +370,18 @@ export function SendToSHIButton({
)} - {totalStats.hasError && ( -
- -
-
연결 오류
-
일부 계약의 동기화 상태를 확인할 수 없습니다.
-
-
- )} - + {/* 계약 정보가 없는 경우 */} {documentsContractIds.length === 0 && ( -
- -
-
계약 정보 없음
-
동기화할 문서가 없습니다.
-
-
+ + + 동기화할 문서가 없습니다. 문서를 선택해주세요. + + )} + {/* 액션 버튼들 */}
{currentSyncingContract && ( -
+
+ 현재 처리 중: Contract {currentSyncingContract}
)} @@ -444,19 +469,20 @@ export function SendToSHIButton({ )} {totalStats.hasError && ( -
-
- 일부 계약의 동기화 상태를 확인할 수 없습니다. 네트워크 연결을 확인해주세요. -
-
+ + + + 일부 계약의 동기화 상태를 확인할 수 없습니다. 네트워크 연결을 확인하고 다시 시도해주세요. + + )} {documentsContractIds.length === 0 && ( -
-
+ + 동기화할 계약이 없습니다. 문서를 선택해주세요. -
-
+ + )}
-- cgit v1.2.3