46 lines
1.8 KiB
TypeScript
46 lines
1.8 KiB
TypeScript
import type { ModuleClientParams } from "@erp/core/client";
|
|
import { lazy } from "react";
|
|
import { Outlet, type RouteObject } from "react-router-dom";
|
|
|
|
// Lazy load components
|
|
const CustomerLayout = lazy(() => import("./ui").then((m) => ({ default: m.CustomerLayout })));
|
|
const CustomersList = lazy(() => import("./list").then((m) => ({ default: m.CustomerListPage })));
|
|
const CustomerView = lazy(() => import("./view").then((m) => ({ default: m.CustomerViewPage })));
|
|
|
|
//const CustomerAdd = lazy(() => import("./pages").then((m) => ({ default: m.CustomerCreatePage })));
|
|
const CustomerUpdate = lazy(() =>
|
|
import("./update").then((m) => ({ default: m.CustomerUpdatePage }))
|
|
);
|
|
|
|
export const CustomerRoutes = (params: ModuleClientParams): RouteObject[] => {
|
|
return [
|
|
{
|
|
path: "customers",
|
|
element: (
|
|
<CustomerLayout>
|
|
<Outlet context={params} />
|
|
</CustomerLayout>
|
|
),
|
|
children: [
|
|
{ path: "", index: true, element: <CustomersList /> }, // index
|
|
{ path: "list", element: <CustomersList /> },
|
|
//{ path: "create", element: <CustomerAdd /> },
|
|
{ path: ":id", element: <CustomerView /> },
|
|
{ path: ":id/edit", element: <CustomerUpdate /> },
|
|
|
|
//
|
|
/*{ path: "create", element: <CustomersList /> },
|
|
{ path: ":id", element: <CustomersList /> },
|
|
{ path: ":id/edit", element: <CustomersList /> },
|
|
{ path: ":id/delete", element: <CustomersList /> },
|
|
{ path: ":id/view", element: <CustomersList /> },
|
|
{ path: ":id/print", element: <CustomersList /> },
|
|
{ path: ":id/email", element: <CustomersList /> },
|
|
{ path: ":id/download", element: <CustomersList /> },
|
|
{ path: ":id/duplicate", element: <CustomersList /> },
|
|
{ path: ":id/preview", element: <CustomersList /> },*/
|
|
],
|
|
},
|
|
];
|
|
};
|