init
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
"use client"
|
||||
|
||||
import { ResourcePage } from "@/shared/data-view/resource-page"
|
||||
import { ColumnHeader } from "@/shared/data-view/table-view"
|
||||
import { EmployeeForm } from "@/modules/employees/employee-form"
|
||||
import { EMPLOYEE_ROUTES } from "@garage/api"
|
||||
import type { EmployeesClient } from "@garage/api"
|
||||
|
||||
export default function EmployeesPage() {
|
||||
return (
|
||||
<ResourcePage<EmployeesClient>
|
||||
pageTitle="Employees"
|
||||
title="Employee"
|
||||
routeKey={EMPLOYEE_ROUTES.INDEX}
|
||||
getClient={(api) => api.employees}
|
||||
columns={({ actionsColumn }) => [
|
||||
{
|
||||
accessorKey: "first_name",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Name" />,
|
||||
cell: ({ row }) => {
|
||||
const { first_name, last_name } = row.original
|
||||
return `${first_name ?? ""} ${last_name ?? ""}`.trim()
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "email",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Email" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "phone",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Phone" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "position",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Position" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "department",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Department" />,
|
||||
cell: ({ row }) => (row.original as any).department?.name ?? "—",
|
||||
},
|
||||
{
|
||||
accessorKey: "status",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Status" />,
|
||||
cell: ({ row }) => {
|
||||
const status = row.original.status
|
||||
return (
|
||||
<span className={status === "active" ? "text-green-600" : "text-red-600"}>
|
||||
{status}
|
||||
</span>
|
||||
)
|
||||
},
|
||||
},
|
||||
actionsColumn(),
|
||||
]}
|
||||
renderForm={({ resourceId, initialData, onSuccess }) => (
|
||||
<EmployeeForm
|
||||
resourceId={resourceId}
|
||||
initialData={initialData}
|
||||
onSuccess={onSuccess}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
"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 "@garage/api"
|
||||
import type { ShopCalendarsClient } from "@garage/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}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
"use client"
|
||||
|
||||
import { ResourcePage } from "@/shared/data-view/resource-page"
|
||||
import { ColumnHeader } from "@/shared/data-view/table-view"
|
||||
import { ShopTimingForm } from "@/modules/shop-timings/shop-timing-form"
|
||||
import { SHOP_TIMING_ROUTES } from "@garage/api"
|
||||
import type { ShopTimingsClient } from "@garage/api"
|
||||
import { CheckCircle2Icon } from "lucide-react"
|
||||
|
||||
export default function ShopTimingsPage() {
|
||||
return (
|
||||
<ResourcePage<ShopTimingsClient>
|
||||
pageTitle="Shop Timings"
|
||||
title="Shop Timing"
|
||||
routeKey={SHOP_TIMING_ROUTES.INDEX}
|
||||
getClient={(api) => api.shopTimings}
|
||||
columns={({ actionsColumn }) => [
|
||||
{
|
||||
accessorKey: "title",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Title" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "in_time",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="In Time" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "out_time",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Out Time" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "full_day_hours",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Full Day Hours" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "half_day_hours",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Half Day Hours" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "is_default",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Default" />,
|
||||
cell: ({ row }) =>
|
||||
row.original.is_default ? (
|
||||
<CheckCircle2Icon className="text-green-600 h-5 w-5" />
|
||||
) : null,
|
||||
},
|
||||
actionsColumn(),
|
||||
]}
|
||||
renderForm={({ resourceId, initialData, onSuccess }) => (
|
||||
<ShopTimingForm
|
||||
resourceId={resourceId}
|
||||
initialData={initialData}
|
||||
onSuccess={onSuccess}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user