diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-08 10:29:19 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-08 10:29:19 +0000 |
| commit | f93493f68c9f368e10f1c3379f1c1384068e3b14 (patch) | |
| tree | a9dada58741750fa7ca6e04b210443ad99a6bccc /lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx | |
| parent | e832a508e1b3c531fb3e1b9761e18e1b55e3d76a (diff) | |
(대표님, 최겸) rfqLast, bidding, prequote
Diffstat (limited to 'lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx')
| -rw-r--r-- | lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx | 102 |
1 files changed, 37 insertions, 65 deletions
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 ca9ffc60..8cdec191 100644 --- a/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx +++ b/lib/bidding/detail/table/bidding-detail-vendor-toolbar-actions.tsx @@ -5,8 +5,8 @@ import { type Table } from "@tanstack/react-table" import { useRouter } from "next/navigation" import { useTransition } from "react" import { Button } from "@/components/ui/button" -import { Plus, Send, RotateCcw, XCircle } from "lucide-react" -import { QuotationVendor, registerBidding, markAsDisposal, createRebidding } from "@/lib/bidding/detail/service" +import { Plus, Send, RotateCcw, XCircle, Trophy } from "lucide-react" +import { QuotationVendor, registerBidding, markAsDisposal, createRebidding, awardBidding } from "@/lib/bidding/detail/service" import { BiddingDetailVendorCreateDialog } from "./bidding-detail-vendor-create-dialog" import { Bidding } from "@/db/schema" import { useToast } from "@/hooks/use-toast" @@ -17,7 +17,7 @@ interface BiddingDetailVendorToolbarActionsProps { bidding: Bidding onOpenItemsDialog: () => void onOpenTargetPriceDialog: () => void - onOpenSelectionReasonDialog: () => void + onOpenAwardDialog: () => void onSuccess: () => void } @@ -27,7 +27,7 @@ export function BiddingDetailVendorToolbarActions({ bidding, onOpenItemsDialog, onOpenTargetPriceDialog, - onOpenSelectionReasonDialog, + onOpenAwardDialog, onSuccess }: BiddingDetailVendorToolbarActionsProps) { const router = useRouter() @@ -40,18 +40,6 @@ export function BiddingDetailVendorToolbarActions({ } const handleRegister = () => { - // 상태 검증 - if (bidding.status !== 'bidding_generated') { - toast({ - title: '실행 불가', - description: '입찰 등록은 입찰 생성 상태에서만 가능합니다.', - variant: 'destructive', - }) - return - } - - if (!confirm('입찰을 등록하시겠습니까?')) return - startTransition(async () => { const result = await registerBidding(bidding.id, 'current-user') // TODO: 실제 사용자 ID @@ -72,18 +60,6 @@ export function BiddingDetailVendorToolbarActions({ } const handleMarkAsDisposal = () => { - // 상태 검증 - if (bidding.status !== 'bidding_closed') { - toast({ - title: '실행 불가', - description: '유찰 처리는 입찰 마감 상태에서만 가능합니다.', - variant: 'destructive', - }) - return - } - - if (!confirm('입찰을 유찰 처리하시겠습니까?')) return - startTransition(async () => { const result = await markAsDisposal(bidding.id, 'current-user') // TODO: 실제 사용자 ID @@ -104,18 +80,6 @@ export function BiddingDetailVendorToolbarActions({ } const handleCreateRebidding = () => { - // 상태 검증 - if (bidding.status !== 'bidding_disposal') { - toast({ - title: '실행 불가', - description: '재입찰은 유찰 상태에서만 가능합니다.', - variant: 'destructive', - }) - return - } - - if (!confirm('재입찰을 생성하시겠습니까?')) return - startTransition(async () => { const result = await createRebidding(bidding.id, 'current-user') // TODO: 실제 사용자 ID @@ -124,11 +88,8 @@ export function BiddingDetailVendorToolbarActions({ title: '성공', description: result.message, }) - if (result.data?.redirectTo) { - router.push(result.data.redirectTo) - } else { - router.refresh() - } + router.refresh() + onSuccess() } else { toast({ title: '오류', @@ -143,7 +104,7 @@ export function BiddingDetailVendorToolbarActions({ <> <div className="flex items-center gap-2"> {/* 상태별 액션 버튼 */} - {/* {bidding.status === 'bidding_generated' && ( + {bidding.status === 'bidding_generated' && ( <Button variant="default" size="sm" @@ -156,15 +117,26 @@ export function BiddingDetailVendorToolbarActions({ )} {bidding.status === 'bidding_closed' && ( - <Button - variant="destructive" - size="sm" - onClick={handleMarkAsDisposal} - disabled={isPending} - > - <XCircle className="mr-2 h-4 w-4" /> - 유찰 처리 - </Button> + <> + <Button + variant="destructive" + size="sm" + onClick={handleMarkAsDisposal} + disabled={isPending} + > + <XCircle className="mr-2 h-4 w-4" /> + 유찰 + </Button> + <Button + variant="default" + size="sm" + onClick={onOpenAwardDialog} + disabled={isPending} + > + <Trophy className="mr-2 h-4 w-4" /> + 낙찰 + </Button> + </> )} {bidding.status === 'bidding_disposal' && ( @@ -175,11 +147,18 @@ export function BiddingDetailVendorToolbarActions({ disabled={isPending} > <RotateCcw className="mr-2 h-4 w-4" /> - 재입찰 생성 + 재입찰 </Button> - )} */} + )} + + {/* 구분선 */} + {(bidding.status === 'bidding_generated' || + bidding.status === 'bidding_closed' || + bidding.status === 'bidding_disposal') && ( + <div className="h-4 w-px bg-border mx-1" /> + )} - {/* 기존 버튼들 */} + {/* 공통 관리 버튼들 */} <Button variant="outline" size="sm" @@ -197,13 +176,6 @@ export function BiddingDetailVendorToolbarActions({ <Button variant="outline" size="sm" - onClick={onOpenSelectionReasonDialog} - > - 선정 사유 - </Button> - <Button - variant="default" - size="sm" onClick={handleCreateVendor} > <Plus className="mr-2 h-4 w-4" /> |
