From 2c02afd48a4d9276a4f5c132e088540a578d0972 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 30 Sep 2025 10:08:53 +0000 Subject: (대표님) 폼리스트, spreadjs 관련 변경사항, 벤더문서 뷰 쿼리 수정, 이메일 템플릿 추가 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ship/send-to-shi-button.tsx | 70 +++++++++++----------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'lib/vendor-document-list') 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 532aabf5..52874702 100644 --- a/lib/vendor-document-list/ship/send-to-shi-button.tsx +++ b/lib/vendor-document-list/ship/send-to-shi-button.tsx @@ -36,8 +36,8 @@ interface SendToSHIButtonProps { projectType: "ship" | "plant" } -export function SendToSHIButton({ - documents = [], +export function SendToSHIButton({ + documents = [], onSyncComplete, projectType }: SendToSHIButtonProps) { @@ -51,13 +51,13 @@ export function SendToSHIButton({ const { t } = useTranslation(lng, "engineering") const targetSystem = projectType === 'ship' ? "DOLCE" : "SWP" - + // 문서에서 유효한 계약 ID 목록 추출 (projectId 사용) const documentsContractIds = React.useMemo(() => { const validIds = documents .map(doc => (doc as any).projectId) .filter((id): id is number => typeof id === 'number' && id > 0) - + const uniqueIds = [...new Set(validIds)] return uniqueIds.sort() }, [documents]) @@ -66,7 +66,7 @@ export function SendToSHIButton({ // ✅ 클라이언트 전용 Hook 사용 (서버 사이드 렌더링 호환) const { contractStatuses, totalStats, refetchAll } = useClientSyncStatus( - documentsContractIds, + documentsContractIds, targetSystem ) @@ -79,14 +79,14 @@ export function SendToSHIButton({ toast.info(t('shiSync.messages.noContractsToSync')) return } - + setSyncProgress(0) let successfulSyncs = 0 let failedSyncs = 0 let totalSuccessCount = 0 let totalFailureCount = 0 const errors: string[] = [] - + try { // 동기화 가능한 계약들만 필터링 const contractsToSync = contractStatuses.filter(({ syncStatus, error }) => { @@ -112,14 +112,14 @@ export function SendToSHIButton({ for (let i = 0; i < contractsToSync.length; i++) { const { projectId } = contractsToSync[i] setCurrentSyncingContract(projectId) - + try { console.log(`Syncing contract ${projectId}...`) - const result = await triggerSync({ - projectId, - targetSystem + const result = await triggerSync({ + projectId, + targetSystem }) - + if (result?.success) { successfulSyncs++ totalSuccessCount += result.successCount || 0 @@ -143,12 +143,12 @@ export function SendToSHIButton({ } setCurrentSyncingContract(null) - + // 결과 처리 및 토스트 표시 setTimeout(() => { setSyncProgress(0) setIsDialogOpen(false) - + if (failedSyncs === 0) { toast.success( t('shiSync.messages.allSyncCompleted', { successCount: totalSuccessCount }), @@ -161,12 +161,12 @@ export function SendToSHIButton({ ) } else if (successfulSyncs > 0) { toast.warning( - t('shiSync.messages.partialSyncCompleted', { - successfulCount: successfulSyncs, - failedCount: failedSyncs + t('shiSync.messages.partialSyncCompleted', { + successfulCount: successfulSyncs, + failedCount: failedSyncs }), { - description: errors.slice(0, 3).join(', ') + + description: errors.slice(0, 3).join(', ') + (errors.length > 3 ? t('shiSync.messages.andMore') : '') } ) @@ -178,16 +178,16 @@ export function SendToSHIButton({ } ) } - + // 모든 contract 상태 갱신 refetchAll() onSyncComplete?.() }, 500) - + } catch (error) { setSyncProgress(0) setCurrentSyncingContract(null) - + const errorMessage = syncUtils.formatError(error as Error) toast.error(t('shiSync.messages.syncFailed'), { description: errorMessage @@ -259,8 +259,8 @@ export function SendToSHIButton({ )} {t('shiSync.buttons.sendToSHI')} {totalStats.totalPending > 0 && ( - {totalStats.totalPending} @@ -269,7 +269,7 @@ export function SendToSHIButton({ - +
@@ -289,16 +289,16 @@ export function SendToSHIButton({ )}
- +
{t('shiSync.labels.overallStatus')} {getSyncStatusBadge()}
- +
- {t('shiSync.descriptions.targetInfo', { - contractCount: documentsContractIds.length, - targetSystem + {t('shiSync.descriptions.targetInfo', { + contractCount: documentsContractIds.length, + targetSystem })}
@@ -311,8 +311,8 @@ export function SendToSHIButton({ {t('shiSync.descriptions.statusCheckError')} {process.env.NODE_ENV === 'development' && (
- Debug: {t('shiSync.descriptions.contractsWithError', { - count: contractStatuses.filter(({ error }) => error).length + Debug: {t('shiSync.descriptions.contractsWithError', { + count: contractStatuses.filter(({ error }) => error).length })}
)} @@ -324,7 +324,7 @@ export function SendToSHIButton({ {!totalStats.hasError && documentsContractIds.length > 0 && (
- +
{t('shiSync.labels.pending')}
@@ -409,7 +409,7 @@ export function SendToSHIButton({ )} - +
- +
{t('shiSync.labels.targetContracts')} {t('shiSync.labels.contractCount', { count: documentsContractIds.length })}
- +
{t('shiSync.descriptions.includesChanges')}
-- cgit v1.2.3