"use client" import { ResourcePage } from "@/shared/data-view/resource-page" import { ColumnHeader } from "@/shared/data-view/table-view" import { PartForm } from "@/modules/parts/part-form" import { Badge } from "@/shared/components/ui/badge" import { PARTS_ROUTES } from "@repo/api" import type { PartsClient } from "@repo/api" export default function PartsPage() { return ( pageTitle="Parts" title="Part" routeKey={PARTS_ROUTES.INDEX} getClient={(api) => api.parts} columns={({ actionsColumn }) => [ { accessorKey: "title", header: ({ column }) => , cell: ({ row }) => { const r = row.original as any return (
{r.title || "—"} {r.sku && ( {r.sku} )}
) }, }, { accessorKey: "part_number", header: ({ column }) => , cell: ({ row }) => (row.original as any).part_number || "—", }, { accessorKey: "manufactured_by", header: ({ column }) => , cell: ({ row }) => (row.original as any).manufactured_by || "—", }, { accessorKey: "selling_price", header: ({ column }) => , cell: ({ row }) => { const val = (row.original as any).selling_price return val != null ? `$${Number(val).toFixed(2)}` : "—" }, }, { accessorKey: "purchase_price", header: ({ column }) => , cell: ({ row }) => { const val = (row.original as any).purchase_price return val != null ? `$${Number(val).toFixed(2)}` : "—" }, }, { accessorKey: "is_active", header: ({ column }) => , cell: ({ row }) => { const active = (row.original as any).is_active return ( {active ? "Active" : "Inactive"} ) }, }, { accessorKey: "created_at", header: ({ column }) => , cell: ({ row }) => { const val = (row.original as any).created_at return val ? new Date(val).toLocaleDateString() : "—" }, }, actionsColumn(), ]} renderForm={({ resourceId, initialData, onSuccess }) => ( )} /> ) }