"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 { EstimateForm } from '@/modules/estimates/estimate-form' import { ESTIMATE_ROUTES } from '@garage/api' import type { EstimatesClient } from '@garage/api' import { Car, FileTextIcon, UserIcon } from 'lucide-react' import { Button } from '@/shared/components/ui/button' import Link from 'next/link' import { formatDate } from '@/shared/utils/formatters' import { getVehicleLabel } from '@/modules/vehicles/utils/getVehicleLabel' import { getFullName } from '@/shared/utils/getFullName' export default function EstimatesPage() { return ( pageTitle="Estimates" routeKey={ESTIMATE_ROUTES.INDEX} getClient={(api) => api.estimates} headerProps={({ selectedItem, invalidateQuery }) => ({ actions: ( {(resourceId) => ( )} ), })} 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 }) => , cell: ({ row }) => { const item:any = row.original return (
{getFullName(item.customer) || "—"}
) } }, { accessorKey: "vehicle", header: ({ column }) => , cell: ({ row }) => { const item :any= row.original return } }, { accessorKey: "date", header: ({ column }) => , cell: ({ row }) => { const item = row.original return formatDate(item.date) } }, { 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(), ]} /> ) }