From 1eb7cf92d1d7711e5d62a750e7611dc6fd1a241d Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 28 Nov 2025 07:45:32 +0000
Subject: (최겸) 구매 피드백 반영(입찰SAP 취소 개발 잔재)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../bidding-detail-vendor-toolbar-actions.tsx      | 27 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

(limited to 'lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx')

diff --git a/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx b/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx
index 53fe05f9..8df29289 100644
--- a/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx
+++ b/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx
@@ -6,7 +6,7 @@ import { useTransition } from "react"
 import { Button } from "@/components/ui/button"
 import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"
 import { Plus, Send, RotateCcw, XCircle, Trophy, FileText, DollarSign, RotateCw } from "lucide-react"
-import { registerBidding, markAsDisposal, createRebidding, cancelAwardRatio } from "@/lib/bidding/detail/service"
+import { registerBidding, markAsDisposal, cancelAwardRatio } from "@/lib/bidding/detail/service"
 import { sendBiddingBasicContracts, getSelectedVendorsForBidding } from "@/lib/bidding/pre-quote/service"
 import { increaseRoundOrRebid } from "@/lib/bidding/service"
 
@@ -21,8 +21,10 @@ interface BiddingDetailVendorToolbarActionsProps {
   bidding: Bidding
   userId: string
   onOpenAwardDialog: () => void
+  onOpenAwardRatioDialog: () => void
   onSuccess: () => void
   winnerVendor?: QuotationVendor | null // 100% 낙찰된 벤더
+  singleSelectedVendor?: QuotationVendor | null // single select된 벤더
 }
 
 export function BiddingDetailVendorToolbarActions({
@@ -30,8 +32,10 @@ export function BiddingDetailVendorToolbarActions({
   bidding,
   userId,
   onOpenAwardDialog,
+  onOpenAwardRatioDialog,
   onSuccess,
-  winnerVendor
+  winnerVendor,
+  singleSelectedVendor
 }: BiddingDetailVendorToolbarActionsProps) {
   const router = useRouter()
   const { toast } = useToast()
@@ -210,18 +214,16 @@ export function BiddingDetailVendorToolbarActions({
       const result = await increaseRoundOrRebid(bidding.id, userId, 'round_increase')
 
       if (result.success) {
-        const successResult = result as { success: true; message: string; biddingId: number; biddingNumber: string }
         toast({
           title: "성공",
-          description: successResult.message,
+          description: '차수증가가 완료되었습니다.',
         })
         router.push(`/evcp/bid`)
         onSuccess()
       } else {
-        const errorResult = result as { success: false; error: string }
         toast({
           title: "오류",
-          description: errorResult.error || "차수증가 중 오류가 발생했습니다.",
+          description: result.error || "차수증가 중 오류가 발생했습니다.",
           variant: 'destructive',
         })
       }
@@ -245,6 +247,19 @@ export function BiddingDetailVendorToolbarActions({
           </Button>
         )}
 
+        {/* 발주비율 산정: single select 시에만 활성화 */}
+        {(bidding.status === 'evaluation_of_bidding') && (
+          <Button
+            variant="outline"
+            size="sm"
+            onClick={onOpenAwardRatioDialog}
+            disabled={!singleSelectedVendor || isPending || singleSelectedVendor.isBiddingParticipated !== true}
+          >
+            <DollarSign className="mr-2 h-4 w-4" />
+            발주비율 산정
+          </Button>
+        )}
+
         {/* 유찰/낙찰: 입찰공고 또는 입찰평가중 상태에서만 */}
         {(bidding.status === 'bidding_opened' || bidding.status === 'evaluation_of_bidding') && (
           <>
-- 
cgit v1.2.3

