ubk.erp.webpack 1.0.7 → 1.0.8

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,122 @@
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 and its peer dependencies:
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
+ - `antd` >= 5
26
+ - `swr` >= 2
27
+ - `axios` >= 1
14
28
 
15
- Ensure you have the following peer dependencies installed in your project:
29
+ ## ⚙️ Configuration
16
30
 
17
- - `react` (>= 18)
18
- - `react-dom` (>= 18)
19
- - `antd` (>= 5)
20
- - `swr` (>= 2)
31
+ The library determines the base URL for API calls and assets using the following priority (highest to lowest):
21
32
 
22
- ## Menu Submenu
33
+ 1. **Manual Configuration**: Using the `setBaseUrl()` function in your code.
34
+ 2. **Environment Variable**: `VITE_ASSET_BASE_URL` in your `.env` file.
35
+ 3. **Default Fallback**: `https://npmapi.ubkerp.com/` (used if no other config is found).
23
36
 
24
- Here is a basic example of how to use the components provided by this library:
37
+ ### 1. Manual Setup (Recommended for NPM Users)
25
38
 
26
39
  ```jsx
27
- import React from 'react';
28
- import { MenuSubmenu } from "ubk.erp.webpack";
40
+ import { setBaseUrl } from "ubk.erp.webpack";
29
41
 
42
+ // Set your base URL once
43
+ setBaseUrl("https://your-api-domain.com/");
44
+ ```
30
45
 
31
- const App = () => {
32
- const token = "123";
33
- return (
34
- <div>
35
- <MenuSubmenu token={token} menu={"FrontOffice"} />
36
- </div>
37
- );
38
- };
46
+ ### Environment Variables (Alternative)
39
47
 
40
- export default App;
41
- ```
48
+ If you prefer using environment variables, the library also supports:
49
+
50
+ ```env
51
+ # Provide a full URL for asset/API base; if omitted the default
52
+ # fallback `https://npmapi.ubkerp.com/` will be used.
53
+ VITE_ASSET_BASE_URL=https://npmapi.ubkerp.com/
54
+ REACT_APP_API_URL=https://npmapi.ubkerp.com/
42
55
 
43
- ## Available Components
56
+ # API Endpoints
57
+ VITE_MENU_URL=api/sdk/Menus
58
+ VITE_ADMISSION_ENQUIRY_URL=api/branchapi/frontoffice/enquirytablelist
59
+ # ... (see .env.example for full list)
60
+ ```
44
61
 
62
+ ## 🛠️ Usage
45
63
 
64
+ ### Basic Component Integration
46
65
 
47
- - `AdmissionEnquiry`
48
66
  ```jsx
49
- import { AdmissionEnquiry } from "ubk.erp.webpack";
67
+ import React from 'react';
68
+ import { MenuSubmenu } from "ubk.erp.webpack";
50
69
 
51
70
  const App = () => {
52
- const token = "123";
71
+ const token = "YOUR_AUTH_TOKEN";
53
72
  return (
54
- <div>
55
- <AdmissionEnquiry token={token} type={'table'} />
56
- </div>
73
+ <MenuSubmenu
74
+ token={token}
75
+ menu="FrontOffice"
76
+ />
57
77
  );
58
78
  };
59
79
 
60
80
  export default App;
61
81
  ```
62
- `
63
- ## Menu Transport
64
- - `Routes`
65
- ```jsx
66
- import { TransportRoutes } from "ubk.erp.webpack";
67
82
 
68
- const App = () => {
69
- const token = "123";
70
- return (
71
- <div>
72
- <TransportRoutes token={token} />
73
- </div>
74
- );
75
- };
83
+ ### Using the Transport Module
76
84
 
77
- export default App;
78
- ```
79
- - `Vehicles`
80
85
  ```jsx
81
- import { TransportVehicles } from "ubk.erp.webpack";
86
+ import { TransportRoutes } from "ubk.erp.webpack";
82
87
 
83
- const App = () => {
84
- const token = "123";
85
- return (
86
- <div>
87
- <TransportVehicles token={token} />
88
- </div>
89
- );
88
+ const TransportPage = () => {
89
+ return <TransportRoutes token="YOUR_TOKEN" />;
90
90
  };
91
-
92
- export default App;
93
91
  ```
94
92
 
93
+ ## 🧩 Available Components
94
+
95
+ | Component | Description |
96
+ | :--- | :--- |
97
+ | `ErpDashboard` | Main dashboard overview. |
98
+ | `MenuSubmenu` | Dynamic menu and navigation component. |
99
+ | `AdmissionEnquiry` | Front office admission enquiry management. |
100
+ | `TransportRoutes` | Manage transport routes and pricing. |
101
+ | `TransportVehicles` | Vehicle fleet management. |
102
+ | `AssignVehicles` | Assign vehicles to specific routes. |
103
+ | `AddDriver` | Driver information and document management. |
104
+ | `RouteTimeTable` | Schedule management for transport routes. |
105
+ | `Stoppage` | Manage route stops and timings. |
106
+
107
+ ## 🛠️ Development
108
+
109
+ ### Setup
110
+ 1. Clone the repository
111
+ 2. Install dependencies: `npm install`
112
+ 3. Copy `.env.example` to `.env` and configure.
113
+
114
+ ### Build
115
+ To build the library for production:
116
+ ```bash
117
+ npm run build
118
+ ```
119
+ This generates the `dist/` folder with ES and CommonJS formats.
95
120
 
96
-
121
+ ## 📄 License
122
+ Internal UBK Project. All rights reserved.