"use client" import { ResourcePage } from '@/shared/data-view/resource-page' import { ColumnHeader } from '@/shared/data-view/table-view' import { CustomerForm } from '@/modules/customers/customer-form' import { CUSTOMER_ROUTES } from '@garage/api' import type { CustomersClient } from '@garage/api' import { Building2Icon, UserIcon } from 'lucide-react' export default function CustomersPage() { return ( pageTitle='Customers' title="Customer" routeKey={CUSTOMER_ROUTES.INDEX} getClient={(api) => api.customers} columns={({ actionsColumn }) => [ { accessorKey: "first_name", header: ({ column }) => , cell: ({ row }) => { const customerName = row.original.first_name const isCompany = row.original.customer_type?.name?.toLocaleLowerCase() === "company"; const companyName = row.original.company_name const name = isCompany && companyName ? `${customerName} (${row.original.last_name})` : customerName return (
{isCompany ? : } {name}
) }, }, { accessorKey: "email", header: ({ column }) => , }, { accessorKey: "phone", header: ({ column }) => , }, actionsColumn(), ]} renderForm={({ resourceId, initialData, onSuccess }) => ( )} /> ) }