"use client" import { use } from "react" import { ResourcePage } from '@/shared/data-view/resource-page' import { ColumnHeader } from '@/shared/data-view/table-view' import FormDialog from '@/shared/components/form-dialog' import { EstimateForm } from '@/modules/estimates/estimate-form' import { ESTIMATE_ROUTES } from '@garage/api' import type { EstimatesClient } from '@garage/api' import { FileTextIcon } from 'lucide-react' import { useVehicle } from '@/modules/vehicles/vehicle-context' export default function VehicleEstimatesPage({ params }: { params: Promise<{ id: string }> }) { const { id: vehicleId } = use(params) const vehicle = useVehicle() return ( <> toolbar={({ invalidateQuery, selectedItem, closeDialog }) => ( {(resourceId) => ( { closeDialog(); invalidateQuery(); }} /> )} ) } pageTitle="Vehicle Estimates" routeKey={ESTIMATE_ROUTES.INDEX} getClient={(api) => api.estimates} extraParams={{ vehicle_id: vehicleId }} header={ null } columns={({ actionsColumn }) => [ { accessorKey: "title", header: ({ column }) => , cell: ({ row }) => { const item = row.original return (
{item.title}
) }, }, { accessorKey: "estimate_number", header: ({ column }) => , }, { accessorKey: "customer_name", header: ({ column }) => , }, { accessorKey: "date", header: ({ column }) => , }, { accessorKey: "has_insurance", header: ({ column }) => , cell: ({ row }) => { const item = row.original return item.has_insurance ? "Yes" : "No" }, }, { accessorKey: "created_at", header: ({ column }) => , cell: ({ row }) => { const item = row.original return item.created_at ? new Date(item.created_at).toLocaleDateString() : "—" }, }, actionsColumn(), ]} /> ) }