updates
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"use client"
|
||||
|
||||
import { DepartmentForm } from "@/modules/settings/departments/department-form"
|
||||
import { ResourcePage } from "@/shared/data-view/resource-page"
|
||||
import { ColumnHeader } from "@/shared/data-view/table-view"
|
||||
import FormDialog from "@/shared/components/form-dialog"
|
||||
import { DEPARTMENT_ROUTES } from "@garage/api"
|
||||
import type { DepartmentsClient } from "@garage/api"
|
||||
|
||||
export default function DepartmentsPage() {
|
||||
return (
|
||||
<ResourcePage<DepartmentsClient>
|
||||
pageTitle="Departments"
|
||||
routeKey={DEPARTMENT_ROUTES.INDEX}
|
||||
getClient={(api) => api.departments}
|
||||
headerProps={({ selectedItem, invalidateQuery }) => ({
|
||||
actions: (
|
||||
<FormDialog title="Department">
|
||||
{(resourceId) => (
|
||||
<DepartmentForm
|
||||
resourceId={resourceId}
|
||||
initialData={selectedItem}
|
||||
onSuccess={invalidateQuery}
|
||||
/>
|
||||
)}
|
||||
</FormDialog>
|
||||
),
|
||||
})}
|
||||
columns={({ actionsColumn }) => [
|
||||
{
|
||||
accessorKey: "name",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Name" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "assignment_type",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Assignment Type" />,
|
||||
cell: ({ row }) => (row.original as any).assignment_type ?? "none",
|
||||
},
|
||||
actionsColumn(),
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user