import { useState } from 'react' import { X } from 'lucide-react' import { Modal } from '@/components' import type { ListItem } from '../types' export interface RenegotiationPopupProps { target: ListItem onClose: () => void onSubmit: (reason: string, desiredPrice: number | null) => void } // 재협상 요청 팝업. 결렬(낙찰자 미정) 건에만 열리며, 담당자 승인 시 다음 차수가 생성된다. // 사유는 자주 쓰는 것을 프리셋으로 두고, 직접 입력도 허용한다. const PRESETS = ['가격 조건 재검토', '재고·납기 확보', '단가 정정', '수량 조건 변경'] as const export function RenegotiationPopup({ target, onClose, onSubmit }: RenegotiationPopupProps) { const [preset, setPreset] = useState(PRESETS[0]) const [custom, setCustom] = useState('') const [price, setPrice] = useState('') const isDirect = preset === '직접 입력' const reason = isDirect ? custom.trim() : preset const canSubmit = reason.length > 0 const handleSubmit = () => { if (!canSubmit) return const parsed = Number(price.replace(/[^0-9]/g, '')) onSubmit(reason, parsed > 0 ? parsed : null) onClose() } return (

재협상 요청

{target.qt_number} · {target.item_name}

이 건은 낙찰자 없이 마감되었습니다. 요청하면 구매 담당자가 검토 후 승인 시 다시 협상할 기회가 열립니다. 승인·반려 결과는 목록에서 확인할 수 있습니다.

{[...PRESETS, '직접 입력'].map((p) => ( ))}
{isDirect && ( setCustom(e.target.value)} maxLength={255} placeholder="요청 사유를 입력해 주세요" className="mt-1.5 h-11 w-full rounded-xl border border-border bg-white px-3 text-sm outline-none focus:border-brand-600 focus:ring-1 focus:ring-brand-600" /> )}
setPrice(e.target.value)} placeholder="예: 14,500,000" className="h-11 w-full rounded-xl border border-border bg-white px-3 text-sm outline-none focus:border-brand-600 focus:ring-1 focus:ring-brand-600" />

담당자 검토 참고용입니다. 실제 가격은 재협상에서 다시 조율합니다.

) }