init
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"use client"
|
||||
|
||||
import { ResourcePage } from "@/shared/data-view/resource-page"
|
||||
import { ColumnHeader } from "@/shared/data-view/table-view"
|
||||
import { ShopTypeForm } from "@/modules/settings/shop-type/shop-type-form"
|
||||
import { SHOP_TYPE_ROUTES } from "@garage/api"
|
||||
import type { ShopTypesClient } from "@garage/api"
|
||||
import { CheckIcon, XIcon } from "lucide-react"
|
||||
|
||||
export default function ShopTypesPage() {
|
||||
return (
|
||||
<ResourcePage<ShopTypesClient>
|
||||
pageTitle="Shop Types"
|
||||
title="Shop Type"
|
||||
routeKey={SHOP_TYPE_ROUTES.INDEX}
|
||||
getClient={(api) => api.shopTypes}
|
||||
columns={({ actionsColumn }) => [
|
||||
{
|
||||
accessorKey: "title",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Title" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "shop_type",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Type" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "note",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Note" />,
|
||||
cell: ({ row }) => (
|
||||
<span className="text-muted-foreground line-clamp-1">
|
||||
{(row.original as any).note ?? "—"}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "is_default",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Default" />,
|
||||
cell: ({ row }) =>
|
||||
(row.original as any).is_default
|
||||
? <CheckIcon className="h-4 w-4 text-green-600" />
|
||||
: <XIcon className="h-4 w-4 text-muted-foreground" />,
|
||||
},
|
||||
actionsColumn(),
|
||||
]}
|
||||
renderForm={({ resourceId, initialData, onSuccess }) => (
|
||||
<ShopTypeForm
|
||||
resourceId={resourceId}
|
||||
initialData={initialData}
|
||||
onSuccess={onSuccess}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user