// components/vendors/VendorHeader.tsx import { Vendor, VendorType, VendorStatus } from '@prisma/client' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import Link from 'next/link' interface VendorHeaderProps { vendor: { id: string name: string type: VendorType status: VendorStatus isBooked: boolean createdAt: Date } onEditClick: () => void } const formatVendorType = (type: VendorType): string => { return type.charAt(0) + type.slice(1).toLowerCase() } const formatStatus = (status: VendorStatus): { label: string, color: string } => { const statusMap: Record = { RESEARCHING: { label: 'Researching', color: 'bg-gray-100 text-gray-800' }, CONTACTING: { label: 'Contacting', color: 'bg-blue-100 text-blue-800' }, RESPONDED: { label: 'Responded', color: 'bg-yellow-100 text-yellow-800' }, PROPOSAL_RECEIVED: { label: 'Proposal Received', color: 'bg-purple-100 text-purple-800' }, NEGOTIATING: { label: 'Negotiating', color: 'bg-orange-100 text-orange-800' }, CONTRACT_SENT: { label: 'Contract Sent', color: 'bg-indigo-100 text-indigo-800' }, CONTRACT_SIGNED: { label: 'Contract Signed', color: 'bg-green-100 text-green-800' }, DECLINED: { label: 'Declined', color: 'bg-red-100 text-red-800' }, BACKUP: { label: 'Backup', color: 'bg-slate-100 text-slate-800' }, } return statusMap[status] } export function VendorHeader({ vendor, onEditClick }: VendorHeaderProps) { const status = formatStatus(vendor.status) return (

{vendor.name}

{status.label} {vendor.isBooked && ( Booked )}

{formatVendorType(vendor.type)} • Added {new Date(vendor.createdAt).toLocaleDateString()}

) }