ubk.erp.webpack 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,96 +1,137 @@
1
- # ubk.erp.webpack
1
+ # UBK ERP Component Library
2
2
 
3
- UBK internal React component library.
3
+ A professional React component library for UBK ERP systems, built with Vite and Ant Design.
4
4
 
5
- ## Installation
5
+ ## 🚀 Key Features
6
6
 
7
- You can install the package using npm:
7
+ - **Modular Components**: Easily integrate ERP modules like Transport, Front Office, and Dashboards.
8
+ - **Configurable Base URLs**: Support for configurable API and asset base URLs.
9
+ - **Modern UI**: Styled with Ant Design for a consistent and professional look.
10
+ - **TypeScript Support**: Full type definitions included.
11
+ - **SWR Integration**: Efficient data fetching and caching out of the box.
12
+
13
+ ## 📦 Installation
14
+
15
+ Install the package:
8
16
 
9
17
  ```bash
10
18
  npm install ubk.erp.webpack
11
19
  ```
12
20
 
13
- ## Peer Dependencies
21
+ ### Peer Dependencies
22
+ Ensure your project has the following installed:
23
+ - `react` >= 18
24
+ - `react-dom` >= 18
25
+ - `@ant-design/icons` >= 5
26
+ - `antd` >= 5
27
+ - `dayjs` >= 1.11
28
+ - `react-hot-toast` >= 2
29
+ - `react-select` >= 5
30
+ - `react-to-print` >= 3
31
+ - `react-barcode` >= 1
32
+ - `swr` >= 2
14
33
 
15
- Ensure you have the following peer dependencies installed in your project:
34
+ ## ⚙️ Configuration
16
35
 
17
- - `react` (>= 18)
18
- - `react-dom` (>= 18)
19
- - `antd` (>= 5)
20
- - `swr` (>= 2)
36
+ The library determines the base URL for API calls and assets using the following priority (highest to lowest):
21
37
 
22
- ## Menu Submenu
38
+ 1. **Manual Configuration**: Using the `setBaseUrl()` function in your code.
39
+ 2. **Environment Variable**: `VITE_ASSET_BASE_URL` in your `.env` file.
40
+ 3. **Default Fallback**: `https://npmapi.ubkerp.com/` (used if no other config is found).
23
41
 
24
- Here is a basic example of how to use the components provided by this library:
42
+ ### 1. Manual Setup (Recommended for NPM Users)
25
43
 
26
44
  ```jsx
27
- import React from 'react';
28
- import { MenuSubmenu } from "ubk.erp.webpack";
45
+ import { setBaseUrl } from "ubk.erp.webpack";
29
46
 
47
+ // Set your base URL once
48
+ setBaseUrl("https://your-api-domain.com/");
49
+ ```
30
50
 
31
- const App = () => {
32
- const token = "123";
33
- return (
34
- <div>
35
- <MenuSubmenu token={token} menu={"FrontOffice"} />
36
- </div>
37
- );
38
- };
51
+ ### Environment Variables (Alternative)
39
52
 
40
- export default App;
41
- ```
53
+ If you prefer using environment variables, the library also supports:
54
+
55
+ ```env
56
+ # Provide a full URL for asset/API base; if omitted the default
57
+ # fallback `https://npmapi.ubkerp.com/` will be used.
58
+ VITE_ASSET_BASE_URL=https://npmapi.ubkerp.com/
59
+ REACT_APP_API_URL=https://npmapi.ubkerp.com/
42
60
 
43
- ## Available Components
61
+ # API Endpoints
62
+ VITE_MENU_URL=api/sdk/Menus
63
+ VITE_ADMISSION_ENQUIRY_URL=api/branchapi/frontoffice/enquirytablelist
64
+ # Library endpoints (examples)
65
+ VITE_LIBRARY_ADD_CATEGORY_URL=api/branchapi/library/addBookCategory
66
+ VITE_LIBRARY_DELETE_CATEGORY_URL=api/branchapi/library/deleteBookCategory
67
+ VITE_LIBRARY_MONTHLY_REPORT_URL=api/branchapi/library/libraryReport
68
+ ```
44
69
 
70
+ ## 🛠️ Usage
45
71
 
72
+ ### Basic Component Integration
46
73
 
47
- - `AdmissionEnquiry`
48
74
  ```jsx
49
- import { AdmissionEnquiry } from "ubk.erp.webpack";
75
+ import React from 'react';
76
+ import { MenuSubmenu } from "ubk.erp.webpack";
50
77
 
51
78
  const App = () => {
52
- const token = "123";
79
+ const token = "YOUR_AUTH_TOKEN";
53
80
  return (
54
- <div>
55
- <AdmissionEnquiry token={token} type={'table'} />
56
- </div>
81
+ <MenuSubmenu
82
+ token={token}
83
+ menu="FrontOffice"
84
+ />
57
85
  );
58
86
  };
59
87
 
60
88
  export default App;
61
89
  ```
62
- `
63
- ## Menu Transport
64
- - `Routes`
65
- ```jsx
66
- import { TransportRoutes } from "ubk.erp.webpack";
67
90
 
68
- const App = () => {
69
- const token = "123";
70
- return (
71
- <div>
72
- <TransportRoutes token={token} />
73
- </div>
74
- );
75
- };
91
+ ### Using the Transport Module
76
92
 
77
- export default App;
78
- ```
79
- - `Vehicles`
80
93
  ```jsx
81
- import { TransportVehicles } from "ubk.erp.webpack";
94
+ import { TransportRoutes } from "ubk.erp.webpack";
82
95
 
83
- const App = () => {
84
- const token = "123";
85
- return (
86
- <div>
87
- <TransportVehicles token={token} />
88
- </div>
89
- );
96
+ const TransportPage = () => {
97
+ return <TransportRoutes token="YOUR_TOKEN" />;
90
98
  };
91
-
92
- export default App;
93
99
  ```
94
100
 
101
+ ## 🧩 Available Components
102
+
103
+ | Component | Description |
104
+ | :--- | :--- |
105
+ | `ErpDashboard` | Main dashboard overview. |
106
+ | `MenuSubmenu` | Dynamic menu and navigation component. |
107
+ | `AdmissionEnquiry` | Front office admission enquiry management. |
108
+ | `TransportRoutes` | Manage transport routes and pricing. |
109
+ | `TransportVehicles` | Vehicle fleet management. |
110
+ | `AssignVehicles` | Assign vehicles to specific routes. |
111
+ | `AddDriver` | Driver information and document management. |
112
+ | `RouteTimeTable` | Schedule management for transport routes. |
113
+ | `Stoppage` | Manage route stops and timings. |
114
+ | `AddBook` | Library: add books. |
115
+ | `BookList` | Library: book list + barcode printing. |
116
+ | `IssueReturn` | Library: issue/return books. |
117
+ | `LibraryAssignStudent` | Library: assign/remove student membership. |
118
+ | `LibraryCategory` | Library: manage book categories. |
119
+ | `LibraryReport` | Library: monthly report. |
120
+
121
+
122
+ ## 🛠️ Development
123
+
124
+ ### Setup
125
+ 1. Clone the repository
126
+ 2. Install dependencies: `npm install`
127
+ 3. Create a `.env` file and configure `VITE_*` variables as needed.
128
+
129
+ ### Build
130
+ To build the library for production:
131
+ ```bash
132
+ npm run build
133
+ ```
134
+ This generates the `dist/` folder with ES and CommonJS formats.
95
135
 
96
-
136
+ ## 📄 License
137
+ Internal UBK Project. All rights reserved.