"use client" import { ResourcePage } from "@/shared/data-view/resource-page" import { ColumnHeader } from "@/shared/data-view/table-view" import FormDialog from "@/shared/components/form-dialog" import { InspectionForm } from "@/modules/inspections/inspection-form" import { INSPECTION_ROUTES, InspectionStatus } from "@garage/api" import type { InspectionsClient } from "@garage/api" import { useRouter } from "next/navigation" import { useJobCard } from "@/modules/job-cards/job-card-context" import { RelationLink } from "@/shared/components/relation-link" import { Car, UserIcon } from "lucide-react" import { getFullName } from "@/shared/utils/getFullName" import { getVehicleLabel } from "@/modules/vehicles/utils/getVehicleLabel" export default function InspectionsPage() { const router = useRouter() const jobCard = useJobCard() return ( pageTitle="Inspections" extraParams={{job_card_id: jobCard?.id}} routeKey={INSPECTION_ROUTES.INDEX} searchable searchPlaceholder="Search inspections..." statusFilter={{ statuses: InspectionStatus }} getClient={(api) => api.inspections} onRowClick={(row) => router.push(`/sales/inspections/${(row as any).id}`)} headerProps={({ selectedItem, invalidateQuery }) => ({ actions: ( {(resourceId) => ( )} ), })} columns={({ actionsColumn }) => [ { accessorKey: "title", header: ({ column }) => , }, { accessorKey: "customer", header: ({ column }) => , cell: ({ row }) => { const c = (row.original as any).customer return ( ) }, }, { accessorKey: "vehicle", header: ({ column }) => , cell: ({ row }) => { const v = (row.original as any).vehicle return ( ) }, }, { accessorKey: "inspection_category", header: ({ column }) => , cell: ({ row }) => (row.original as any).inspection_category?.name ?? "—", }, { accessorKey: "status", header: ({ column }) => , cell: ({ row }) => { const status = (row.original as any).status return ( {status ?? "—"} ) }, }, actionsColumn(), ]} /> ) }