"use client" import * as React from "react" import { Send, CheckCircle, FileText, Truck } from "lucide-react" import { toast } from "sonner" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Label } from "@/components/ui/label" import { BiddingListItem } from "@/db/schema" import { transmitToContract, transmitToPO } from "@/lib/bidding/actions" console.log('=== Module loaded ===') console.log('transmitToContract imported:', typeof transmitToContract) console.log('transmitToPO imported:', typeof transmitToPO) interface TransmissionDialogProps { open: boolean onOpenChange: (open: boolean) => void bidding: BiddingListItem | undefined userId: number } export function TransmissionDialog({ open, onOpenChange, bidding, userId }: TransmissionDialogProps) { const [isLoading, setIsLoading] = React.useState(false) if (!bidding) return null const handleToContract = async () => { try { setIsLoading(true) console.log('=== START handleToContract ===') console.log('bidding.id', bidding.id) console.log('userId', userId) console.log('transmitToContract function:', typeof transmitToContract) console.log('About to call transmitToContract...') const result = await transmitToContract(bidding.id, userId) console.log('transmitToContract result:', result) toast.success('계약서 생성이 완료되었습니다.') onOpenChange(false) } catch (error) { console.error('handleToContract error:', error) toast.error(`계약서 생성에 실패했습니다: ${error}`) } finally { setIsLoading(false) console.log('=== END handleToContract ===') } } const handleToPO = async () => { try { setIsLoading(true) await transmitToPO(bidding.id) toast.success('PO 전송이 완료되었습니다.') onOpenChange(false) } catch (error) { toast.error(`PO 전송에 실패했습니다: ${error}`) } finally { setIsLoading(false) } } return ( 입찰 전송 선택된 입찰을 계약서 또는 PO로 전송합니다.
{/* 입찰 정보 */} 입찰 정보

{bidding.biddingNumber}

{bidding.title}

{bidding.contractType}

{bidding.budget ? `${bidding.budget.toLocaleString()} ${bidding.currency}` : '-'}

{/* 선정된 업체 정보 (임시로 표시) */} 선정된 업체
업체 선정이 완료되었습니다.

자세한 업체 정보는 전송 후 확인할 수 있습니다.

) }