51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
"use client"
|
|
|
|
import { ResourcePage } from "@/shared/data-view/resource-page"
|
|
import { ColumnHeader } from "@/shared/data-view/table-view"
|
|
import { ShopCalendarForm } from "@/modules/shop-calendars/shop-calendar-form"
|
|
import { SHOP_CALENDAR_ROUTES } from "@repo/api"
|
|
import type { ShopCalendarsClient } from "@repo/api"
|
|
import { CheckCircle2Icon } from "lucide-react"
|
|
|
|
export default function ShopCalendarsPage() {
|
|
return (
|
|
<ResourcePage<ShopCalendarsClient>
|
|
pageTitle="Shop Calendars"
|
|
title="Shop Calendar"
|
|
routeKey={SHOP_CALENDAR_ROUTES.INDEX}
|
|
getClient={(api) => api.shopCalendars}
|
|
columns={({ actionsColumn }) => [
|
|
{
|
|
accessorKey: "title",
|
|
header: ({ column }) => <ColumnHeader column={column} title="Title" />,
|
|
},
|
|
{
|
|
accessorKey: "is_default",
|
|
header: ({ column }) => <ColumnHeader column={column} title="Default" />,
|
|
cell: ({ row }) =>
|
|
(row.original as any).is_default ? (
|
|
<CheckCircle2Icon className="text-green-600 h-5 w-5" />
|
|
) : null,
|
|
},
|
|
{
|
|
accessorKey: "shop_calender_days",
|
|
header: () => <span>Days</span>,
|
|
enableSorting: false,
|
|
cell: ({ row }) => {
|
|
const days = (row.original as any).shop_calender_days
|
|
return days?.length ?? 0
|
|
},
|
|
},
|
|
actionsColumn({ onEdit: undefined }),
|
|
]}
|
|
renderForm={({ resourceId, initialData, onSuccess }) => (
|
|
<ShopCalendarForm
|
|
resourceId={resourceId}
|
|
initialData={initialData}
|
|
onSuccess={onSuccess}
|
|
/>
|
|
)}
|
|
/>
|
|
)
|
|
}
|