From 8238c0c0ed6fd182d33f3437a22da1d80cfa928f Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 24 Nov 2025 10:47:34 +0000
Subject: (임수민) 법무검토 요청 데이터 조회 수정
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../common/legal/sslvw-pur-inq-req-dialog.tsx      | 41 ++++++++++++++++++----
 1 file changed, 35 insertions(+), 6 deletions(-)

(limited to 'components/common/legal/sslvw-pur-inq-req-dialog.tsx')

diff --git a/components/common/legal/sslvw-pur-inq-req-dialog.tsx b/components/common/legal/sslvw-pur-inq-req-dialog.tsx
index 42f987fb..7c2ec349 100644
--- a/components/common/legal/sslvw-pur-inq-req-dialog.tsx
+++ b/components/common/legal/sslvw-pur-inq-req-dialog.tsx
@@ -38,9 +38,17 @@ import { SSLVWPurInqReq } from "@/lib/basic-contract/sslvw-service"
 
 interface SSLVWPurInqReqDialogProps {
   onConfirm?: (selectedRows: SSLVWPurInqReq[]) => void
+  requireSingleSelection?: boolean
+  triggerDisabled?: boolean
+  triggerTitle?: string
 }
 
-export function SSLVWPurInqReqDialog({ onConfirm }: SSLVWPurInqReqDialogProps) {
+export function SSLVWPurInqReqDialog({
+  onConfirm,
+  requireSingleSelection = false,
+  triggerDisabled = false,
+  triggerTitle,
+}: SSLVWPurInqReqDialogProps) {
   const [open, setOpen] = React.useState(false)
   const [isLoading, setIsLoading] = React.useState(false)
   const [data, setData] = React.useState<SSLVWPurInqReq[]>([])
@@ -144,9 +152,18 @@ export function SSLVWPurInqReqDialog({ onConfirm }: SSLVWPurInqReqDialogProps) {
       return
     }
 
+    if (requireSingleSelection && selectedRows.length !== 1) {
+      toast.error("하나의 행만 선택해주세요.")
+      return
+    }
+
     if (onConfirm) {
       onConfirm(selectedRows)
-      toast.success(`${selectedRows.length}개의 행을 선택했습니다.`)
+      toast.success(
+        requireSingleSelection
+          ? "선택한 행으로 법무 상태를 동기화합니다."
+          : `${selectedRows.length}개의 행을 선택했습니다.`
+      )
     } else {
       // 임시로 선택된 데이터 콘솔 출력
       console.log("선택된 행들:", selectedRows)
@@ -159,7 +176,12 @@ export function SSLVWPurInqReqDialog({ onConfirm }: SSLVWPurInqReqDialogProps) {
   return (
     <Dialog open={open} onOpenChange={setOpen}>
       <DialogTrigger asChild>
-        <Button variant="outline" size="sm">
+        <Button
+          variant="outline"
+          size="sm"
+          disabled={triggerDisabled}
+          title={triggerTitle}
+        >
           <Database className="mr-2 size-4" aria-hidden="true" />
           법무검토 요청 데이터 조회
         </Button>
@@ -314,7 +336,7 @@ export function SSLVWPurInqReqDialog({ onConfirm }: SSLVWPurInqReqDialogProps) {
           <Button variant="outline" onClick={() => setOpen(false)}>
             닫기
           </Button>
-          {/* <Button onClick={loadData} disabled={isLoading} variant="outline">
+          <Button onClick={loadData} disabled={isLoading} variant="outline">
             {isLoading ? (
               <>
                 <Loader className="mr-2 size-4 animate-spin" />
@@ -323,8 +345,15 @@ export function SSLVWPurInqReqDialog({ onConfirm }: SSLVWPurInqReqDialogProps) {
             ) : (
               "새로고침"
             )}
-          </Button> */}
-          <Button onClick={handleConfirm} disabled={selectedRows.length === 0}>
+          </Button>
+          <Button
+            onClick={handleConfirm}
+            disabled={
+              requireSingleSelection
+                ? selectedRows.length !== 1
+                : selectedRows.length === 0
+            }
+          >
             <Check className="mr-2 size-4" />
             확인 ({selectedRows.length})
           </Button>
-- 
cgit v1.2.3

