diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-11-07 04:43:43 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-11-07 04:43:43 +0000 |
| commit | 7f973de2a814a2040a646161b563c8990b7e2fd2 (patch) | |
| tree | a00faad2246fe03f448de758c7171c63294819c9 /lib/basic-contract/template/basic-contract-template-viewer.tsx | |
| parent | 18ca4ad784aeeab9ab7a13bbc8b3c13b42ca5e49 (diff) | |
(임수민) 기본계약서 서명란 변수 추가
Diffstat (limited to 'lib/basic-contract/template/basic-contract-template-viewer.tsx')
| -rw-r--r-- | lib/basic-contract/template/basic-contract-template-viewer.tsx | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/lib/basic-contract/template/basic-contract-template-viewer.tsx b/lib/basic-contract/template/basic-contract-template-viewer.tsx index 018db3a0..52ea4153 100644 --- a/lib/basic-contract/template/basic-contract-template-viewer.tsx +++ b/lib/basic-contract/template/basic-contract-template-viewer.tsx @@ -17,6 +17,7 @@ interface BasicContractTemplateViewerProps { filePath?: string; instance: WebViewerInstance | null; setInstance: Dispatch<SetStateAction<WebViewerInstance | null>>; + onSignatureFieldFound?: (searchText: string) => void; // 서명란 발견 시 콜백 } // 서명란 위치 정보 인터페이스 @@ -116,6 +117,7 @@ export function BasicContractTemplateViewer({ filePath, instance, setInstance, + onSignatureFieldFound, }: BasicContractTemplateViewerProps) { const [fileLoading, setFileLoading] = useState<boolean>(true); const [signatureLocation, setSignatureLocation] = useState<SignatureFieldLocation | null>(null); @@ -244,6 +246,10 @@ export function BasicContractTemplateViewer({ if (location) { setSignatureLocation(location); console.log("✅ 서명란 위치 발견:", location); + // 서명란 발견 시 부모 컴포넌트에 알림 + if (onSignatureFieldFound) { + onSignatureFieldFound(location.searchText); + } } }, 2000); }; @@ -256,6 +262,10 @@ export function BasicContractTemplateViewer({ const location = await findSignatureFieldLocation(instance); if (location) { setSignatureLocation(location); + // 서명란 발견 시 부모 컴포넌트에 알림 + if (onSignatureFieldFound) { + onSignatureFieldFound(location.searchText); + } } }, 2000); } @@ -326,21 +336,6 @@ export function BasicContractTemplateViewer({ // 기존 SignViewer와 동일한 렌더링 (확대 문제 해결) return ( <div className="relative w-full h-full overflow-hidden flex flex-col"> - {/* 서명란으로 이동 버튼 */} - {signatureLocation && !fileLoading && ( - <div className="absolute top-2 right-2 z-20"> - <Button - variant="outline" - size="sm" - className="h-7 px-2 text-xs bg-blue-50 hover:bg-blue-100 border-blue-200" - onClick={() => navigateToSignatureField(instance, signatureLocation)} - > - <Target className="h-3 w-3 mr-1" /> - 서명란으로 이동 - </Button> - </div> - )} - <div ref={viewer} className="w-full h-full" @@ -350,6 +345,21 @@ export function BasicContractTemplateViewer({ contain: 'layout style paint', // CSS containment로 격리 }} > + {/* 서명란으로 이동 버튼 - 툴바 아래에 배치 (편집 도구와 겹치지 않도록) */} + {signatureLocation && !fileLoading && ( + <div className="absolute right-4 z-30" style={{ top: '70px' }}> + <Button + variant="outline" + size="sm" + className="h-7 px-2 text-xs bg-blue-50 hover:bg-blue-100 border-blue-200 shadow-sm" + onClick={() => navigateToSignatureField(instance, signatureLocation)} + > + <Target className="h-3 w-3 mr-1" /> + 서명란으로 이동 + </Button> + </div> + )} + {fileLoading && ( <div className="absolute inset-0 flex flex-col items-center justify-center bg-white bg-opacity-90 z-10"> <Loader2 className="h-8 w-8 text-blue-500 animate-spin mb-4" /> |
