From 8b23b471638a155fd1bfa3a8c853b26d9315b272 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 26 Sep 2025 09:57:24 +0000
Subject: (대표님) 권한관리, 문서업로드, rfq첨부, SWP문서룰 등 (최겸) 입찰
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/bidding/list/create-bidding-dialog.tsx | 43 ++++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 5 deletions(-)

(limited to 'lib/bidding/list/create-bidding-dialog.tsx')

diff --git a/lib/bidding/list/create-bidding-dialog.tsx b/lib/bidding/list/create-bidding-dialog.tsx
index cb91a984..e99ac06f 100644
--- a/lib/bidding/list/create-bidding-dialog.tsx
+++ b/lib/bidding/list/create-bidding-dialog.tsx
@@ -137,6 +137,7 @@ export function CreateBiddingDialog() {
     const [activeTab, setActiveTab] = React.useState<TabType>("basic")
     const [showSuccessDialog, setShowSuccessDialog] = React.useState(false) // 추가
     const [createdBiddingId, setCreatedBiddingId] = React.useState<number | null>(null) // 추가
+    const [showCloseConfirmDialog, setShowCloseConfirmDialog] = React.useState(false) // 닫기 확인 다이얼로그 상태
 
     // Procurement 데이터 상태들
     const [paymentTermsOptions, setPaymentTermsOptions] = React.useState<Array<{code: string, description: string}>>([])
@@ -686,9 +687,23 @@ export function CreateBiddingDialog() {
     // 다이얼로그 핸들러
     function handleDialogOpenChange(nextOpen: boolean) {
         if (!nextOpen) {
+            // 닫으려 할 때 확인 창을 먼저 띄움
+            setShowCloseConfirmDialog(true)
+        } else {
+            // 열 때는 바로 적용
+            setOpen(nextOpen)
+        }
+    }
+
+    // 닫기 확인 핸들러
+    const handleCloseConfirm = (confirmed: boolean) => {
+        setShowCloseConfirmDialog(false)
+        if (confirmed) {
+            // 사용자가 "예"를 선택한 경우 실제로 닫기
             resetAllStates()
+            setOpen(false)
         }
-        setOpen(nextOpen)
+        // "아니오"를 선택한 경우는 아무것도 하지 않음 (다이얼로그 유지)
     }
 
     // 입찰 생성 버튼 클릭 핸들러 추가
@@ -2172,10 +2187,7 @@ export function CreateBiddingDialog() {
                                         <Button
                                             type="button"
                                             variant="outline"
-                                            onClick={() => {
-                                                resetAllStates()
-                                                setOpen(false)
-                                            }}
+                                            onClick={() => setShowCloseConfirmDialog(true)}
                                             disabled={isSubmitting}
                                         >
                                             취소
@@ -2227,6 +2239,27 @@ export function CreateBiddingDialog() {
                 </DialogContent>
             </Dialog>
 
+            {/* 닫기 확인 다이얼로그 */}
+            <AlertDialog open={showCloseConfirmDialog} onOpenChange={setShowCloseConfirmDialog}>
+                <AlertDialogContent>
+                    <AlertDialogHeader>
+                        <AlertDialogTitle>입찰 생성을 취소하시겠습니까?</AlertDialogTitle>
+                        <AlertDialogDescription>
+                            현재 입력 중인 내용이 모두 삭제되며, 생성되지 않습니다.
+                            정말로 취소하시겠습니까?
+                        </AlertDialogDescription>
+                    </AlertDialogHeader>
+                    <AlertDialogFooter>
+                        <AlertDialogCancel onClick={() => handleCloseConfirm(false)}>
+                            아니오 (계속 입력)
+                        </AlertDialogCancel>
+                        <AlertDialogAction onClick={() => handleCloseConfirm(true)}>
+                            예 (취소)
+                        </AlertDialogAction>
+                    </AlertDialogFooter>
+                </AlertDialogContent>
+            </AlertDialog>
+
             <AlertDialog open={showSuccessDialog} onOpenChange={setShowSuccessDialog}>
                 <AlertDialogContent>
                     <AlertDialogHeader>
-- 
cgit v1.2.3

