import { ClipboardCheck, Calendar, Clock, Hash, FileText, User, Car, Building2, FolderOpen, } from "lucide-react" import { Card, CardContent, CardHeader, CardTitle, } from "@/shared/components/ui/card" import { Badge } from "@/shared/components/ui/badge" import { Separator } from "@/shared/components/ui/separator" type InspectionData = { id?: number title?: string customer_id?: number vehicle_id?: number department_id?: number inspection_category_id?: number employee_id?: number order_number?: string date?: string time?: string note?: string status?: string created_at?: string updated_at?: string customer?: { id?: number; first_name?: string; last_name?: string } vehicle?: { id?: number; make?: string; model?: string; license_plate?: string } department?: { id?: number; name?: string } inspection_category?: { id?: number; name?: string } employee?: { id?: number; first_name?: string; last_name?: string } } type InspectionGeneralInfoProps = { inspection: InspectionData } function InfoItem({ icon: Icon, label, value, }: { icon: React.ComponentType<{ className?: string }> label: string value?: string | null }) { return (
{label} {value || }
) } const STATUS_COLORS: Record = { open: "bg-blue-100 text-blue-800", in_progress: "bg-yellow-100 text-yellow-800", completed: "bg-green-100 text-green-800", } function formatStatus(status?: string) { if (!status) return "—" return status.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()) } export function InspectionGeneralInfo({ inspection }: InspectionGeneralInfoProps) { const customerName = inspection.customer ? `${inspection.customer.first_name ?? ""} ${inspection.customer.last_name ?? ""}`.trim() : undefined const vehicleName = inspection.vehicle ? `${inspection.vehicle.make ?? ""} ${inspection.vehicle.model ?? ""}`.trim() : undefined const employeeName = inspection.employee ? `${inspection.employee.first_name ?? ""} ${inspection.employee.last_name ?? ""}`.trim() : undefined return (
{/* Inspection Details */} Inspection Details
{inspection.title && ( {inspection.title} )} {inspection.status && ( {formatStatus(inspection.status)} )}
{/* Assignments */} Assignments {/* Notes & Timestamps */} {(inspection.note || inspection.created_at) && ( Notes & Timestamps
{inspection.note && ( <>
Note

{inspection.note}

)}
)}
) }