Creating a New Module
( ex Accounting Module ) To create a new module in your ERP system, follow these steps:
1. Set Up Module Folder
- Open your project's directory structure.
- Navigate to the src folder.
- Inside the src folder, locate the modules directory (if it doesn't exist, create it).
- Create a new folder with the name of your module, for example,
accountingModule
. This folder will contain all the components, pages, and configurations for the Accounting Module.
for example:
src
└── core
└── modules
└── accountingModule
2. Create Required Folders
Inside the accountingModule
folder, create the following sub-folders:
- components: This folder will contain all the components related to the Accounting Module.
- overrides: This folder will house any overrides or customizations specific to the Accounting Module.
- Pages: This folder will hold the main pages of the Accounting Module.
3. Define Folder Hierarchy
Your folder hierarchy should look like this:
src
└── modules
└── accountingModule
├── components
│ ├── Forms
│ │ ├── reports
│ │ │ └── accountTrialBalanceReport.tsx
│ │ └── Journal.tsx
│ └── overrides
│ └── MainLayout
│ └── Drawer
│ └── menuItems.tsx
├── Pages
│ └── Journal
│ ├── components
│ │ └── JournalGrid.ts
│ ├── mapper
│ │ └── JournalMapper.ts
│ └── index.tsx
4. Create Files
Inside the
components/overrides/MainLayout/Drawer
folder, create a file namedmenuItems.tsx
. In this file, you will define the sidebar menu items for the Accounting Module using a JSON structure format.- Here's an example of how the
accountingMenuItems
could be defined:
export const accountingMenuItems: IMenuItemOption = {
items: [
{
id: "AccountingPaymentId",
title: "Payment Confgs",
type: "group",
children: [
{
id: "BankId",
title: "Banks",
isAuthorize: true,
entityName: "Bank",
type: "item",
url: "/Banks",
icon: accoutingIcon,
}
],
},
],
};- Here's an example of how the
Inside the
Pages/[PageName]/components
folder, create a file named[PageName]Grid.tsx
. (Note: Replace [PageName] with the actual name of the page for which you're creating the grid, such as "Journal" or another page name.) For example, if you're creating a grid for the "Journal" page, the file name would beJournalGrid.tsx
.Inside the
Pages/[PageName]/mapper
folder, create a file named[PageName]Mapper.ts
for exampleJournalMapper.ts
. This file will define the mapping between the data/form state and the backend API requests/responses for the journal.Inside the
Pages/[PageName]
folder (ex journal), create a file namedindex.tsx
. This file will be the main entry point for the Journal page. You can use this file to register the JournalGrid component, apply the JournalMapper, and display the grid and form.