"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 { ImportDataButton } from "@/shared/components/import-data-button" import { ExportDataButton } from "@/shared/components/export-data-button" import { useAuthApi } from "@/shared/useApi" import { ServiceForm } from "@/modules/services/service-form" import { SERVICE_ROUTES } from "@garage/api" import type { ServicesClient } from "@garage/api" export default function ServicesPage() { const api = useAuthApi() return ( pageTitle="Services" routeKey={SERVICE_ROUTES.INDEX} getClient={(api) => api.services} headerProps={({ selectedItem, invalidateQuery }) => ({ actions: (
api.services.importData(file)} onSuccess={invalidateQuery} /> api.services.exportData(filters)} fileName="services" /> {(resourceId) => ( )}
), })} columns={({ actionsColumn }) => [ { accessorKey: "labor_name", header: ({ column }) => , cell: ({ row }) => { const r = row.original as any return (
{r.labor_name || r.name || "—"} {r.service_code && ( {r.service_code} )}
) }, }, { accessorKey: "description", header: ({ column }) => , cell: ({ row }) => { const val = (row.original as any).description return val ? {val} : "—" }, }, { accessorKey: "selling_price", header: ({ column }) => , cell: ({ row }) => { const val = (row.original as any).selling_price return val != null ? `$${Number(val).toFixed(2)}` : "—" }, }, { accessorKey: "created_at", header: ({ column }) => , cell: ({ row }) => { const val = (row.original as any).created_at return val ? new Date(val).toLocaleDateString() : "—" }, }, actionsColumn(), ]} /> ) }