61 lines
2.1 KiB
TypeScript
61 lines
2.1 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 InvoicesLayout = lazy(() =>
|
|
import("./components").then((m) => ({ default: m.InvoicesLayout }))
|
|
);
|
|
|
|
const InvoiceListPage = lazy(() => import("./pages").then((m) => ({ default: m.InvoiceListPage })));
|
|
|
|
const CustomerInvoiceAdd = lazy(() =>
|
|
import("./pages").then((m) => ({ default: m.CustomerInvoiceCreate }))
|
|
);
|
|
const InvoiceUpdatePage = lazy(() =>
|
|
import("./pages").then((m) => ({ default: m.InvoiceUpdatePage }))
|
|
);
|
|
|
|
export const CustomerInvoiceRoutes = (params: ModuleClientParams): RouteObject[] => {
|
|
return [
|
|
{
|
|
path: "proformas",
|
|
element: (
|
|
<InvoicesLayout>
|
|
<Outlet context={params} />
|
|
</InvoicesLayout>
|
|
),
|
|
children: [
|
|
{ path: "", index: true, element: <ProformasListPage /> }, // index
|
|
{ path: "list", element: <ProformasListPage /> },
|
|
{ path: "create", element: <CustomerInvoiceAdd /> },
|
|
{ path: ":id/edit", element: <InvoiceUpdatePage /> },
|
|
],
|
|
},
|
|
{
|
|
path: "customer-invoices",
|
|
element: (
|
|
<InvoicesLayout>
|
|
<Outlet context={params} />
|
|
</InvoicesLayout>
|
|
),
|
|
children: [
|
|
{ path: "", index: true, element: <InvoiceListPage /> }, // index
|
|
{ path: "list", element: <InvoiceListPage /> },
|
|
|
|
//
|
|
/*{ path: "create", element: <CustomerInvoicesList /> },
|
|
{ path: ":id", element: <CustomerInvoicesList /> },
|
|
{ path: ":id/edit", element: <CustomerInvoicesList /> },
|
|
{ path: ":id/delete", element: <CustomerInvoicesList /> },
|
|
{ path: ":id/view", element: <CustomerInvoicesList /> },
|
|
{ path: ":id/print", element: <CustomerInvoicesList /> },
|
|
{ path: ":id/email", element: <CustomerInvoicesList /> },
|
|
{ path: ":id/download", element: <CustomerInvoicesList /> },
|
|
{ path: ":id/duplicate", element: <CustomerInvoicesList /> },
|
|
{ path: ":id/preview", element: <CustomerInvoicesList /> },*/
|
|
],
|
|
},
|
|
];
|
|
};
|