ApiLogicServer 15.0.14__py3-none-any.whl → 15.0.20__py3-none-any.whl
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.
- api_logic_server_cli/api_logic_server.py +4 -4
- api_logic_server_cli/api_logic_server_info.yaml +2 -2
- api_logic_server_cli/cli.py +44 -1
- api_logic_server_cli/create_from_model/__pycache__/api_logic_server_utils.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/api_logic_server_utils.py +14 -0
- api_logic_server_cli/genai/genai_admin_app copy.py +150 -0
- api_logic_server_cli/genai/genai_admin_app.py +162 -0
- api_logic_server_cli/genai/genai_svcs.py +49 -10
- api_logic_server_cli/logging.yml +5 -0
- api_logic_server_cli/prototypes/.DS_Store +0 -0
- api_logic_server_cli/prototypes/base/config/config.py +4 -3
- api_logic_server_cli/prototypes/base/docs/training/admin_app_1_context.prompt.md +3 -0
- api_logic_server_cli/prototypes/base/docs/training/admin_app_2_functionality.prompt.md +69 -0
- api_logic_server_cli/prototypes/base/docs/training/admin_app_3_architecture.prompt.md +29 -0
- api_logic_server_cli/prototypes/base/docs/training/admin_app_unused.md +156 -0
- api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py +15 -12
- api_logic_server_cli/prototypes/basic_demo/customizations/docs/mcp_learning/mcp_discovery.json +108 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Learning-Prompt.md +170 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/notes.md +7 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/README.md +17 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/README_create_react_app.md +70 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package-lock.json +18469 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json +44 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/favicon.ico +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/index.html +43 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/logo192.png +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/logo512.png +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/manifest.json +25 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/robots.txt +3 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/App.css +38 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/App.js +25 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/App.test.js +8 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/dataProvider.js +110 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/index.css +13 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/index.js +17 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/logo.svg +1 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/reportWebVitals.js +13 -0
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/setupTests.js +5 -0
- api_logic_server_cli/prototypes/nw/.DS_Store +0 -0
- api_logic_server_cli/prototypes/nw/ui/.DS_Store +0 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/.DS_Store +0 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/README.md +19 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/README_create_react_app.md +70 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/package-lock.json +18469 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/package.json +44 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/public/favicon.ico +0 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/public/index.html +43 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/public/logo192.png +0 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/public/logo512.png +0 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/public/manifest.json +25 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/public/robots.txt +3 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/App.css +38 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/App.js +58 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/App.test.js +8 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Category.js +82 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Customer.js +211 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/CustomerDemographic.js +57 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Department.js +98 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Employee.js +100 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeAudit.js +106 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeTerritory.js +98 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Location.js +87 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Order.js +98 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/OrderDetail.js +112 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Product.js +103 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Region.js +65 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/SampleDBVersion.js +73 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Shipper.js +67 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Supplier.js +87 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Territory.js +90 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Union.js +61 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/dataProvider.js +110 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/index.css +13 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/index.js +17 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/logo.svg +1 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/reportWebVitals.js +13 -0
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/setupTests.js +5 -0
- {apilogicserver-15.0.14.dist-info → apilogicserver-15.0.20.dist-info}/METADATA +1 -1
- {apilogicserver-15.0.14.dist-info → apilogicserver-15.0.20.dist-info}/RECORD +84 -16
- {apilogicserver-15.0.14.dist-info → apilogicserver-15.0.20.dist-info}/WHEEL +0 -0
- {apilogicserver-15.0.14.dist-info → apilogicserver-15.0.20.dist-info}/entry_points.txt +0 -0
- {apilogicserver-15.0.14.dist-info → apilogicserver-15.0.20.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-15.0.14.dist-info → apilogicserver-15.0.20.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-admin-template",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@emotion/react": "^11.14.0",
|
|
7
|
+
"@emotion/styled": "^11.14.0",
|
|
8
|
+
"@mui/material": "^7.1.1",
|
|
9
|
+
"@testing-library/dom": "^10.4.0",
|
|
10
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
11
|
+
"@testing-library/react": "^16.3.0",
|
|
12
|
+
"@testing-library/user-event": "^13.5.0",
|
|
13
|
+
"react": "^19.1.0",
|
|
14
|
+
"react-admin": "^5.8.3",
|
|
15
|
+
"react-dom": "^19.1.0",
|
|
16
|
+
"react-router-dom": "^7.6.2",
|
|
17
|
+
"react-scripts": "5.0.1",
|
|
18
|
+
"web-vitals": "^2.1.4"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"start": "react-scripts start",
|
|
22
|
+
"build": "react-scripts build",
|
|
23
|
+
"test": "react-scripts test",
|
|
24
|
+
"eject": "react-scripts eject"
|
|
25
|
+
},
|
|
26
|
+
"eslintConfig": {
|
|
27
|
+
"extends": [
|
|
28
|
+
"react-app",
|
|
29
|
+
"react-app/jest"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"browserslist": {
|
|
33
|
+
"production": [
|
|
34
|
+
">0.2%",
|
|
35
|
+
"not dead",
|
|
36
|
+
"not op_mini all"
|
|
37
|
+
],
|
|
38
|
+
"development": [
|
|
39
|
+
"last 1 chrome version",
|
|
40
|
+
"last 1 firefox version",
|
|
41
|
+
"last 1 safari version"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="theme-color" content="#000000" />
|
|
8
|
+
<meta
|
|
9
|
+
name="description"
|
|
10
|
+
content="Web site created using create-react-app"
|
|
11
|
+
/>
|
|
12
|
+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
13
|
+
<!--
|
|
14
|
+
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
+
-->
|
|
17
|
+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
+
<!--
|
|
19
|
+
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
+
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
+
|
|
23
|
+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
+
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
+
-->
|
|
27
|
+
<title>React App</title>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
+
<div id="root"></div>
|
|
32
|
+
<!--
|
|
33
|
+
This HTML file is a template.
|
|
34
|
+
If you open it directly in the browser, you will see an empty page.
|
|
35
|
+
|
|
36
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
+
|
|
39
|
+
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
+
-->
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"short_name": "React App",
|
|
3
|
+
"name": "Create React App Sample",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"src": "logo192.png",
|
|
12
|
+
"type": "image/png",
|
|
13
|
+
"sizes": "192x192"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"src": "logo512.png",
|
|
17
|
+
"type": "image/png",
|
|
18
|
+
"sizes": "512x512"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"start_url": ".",
|
|
22
|
+
"display": "standalone",
|
|
23
|
+
"theme_color": "#000000",
|
|
24
|
+
"background_color": "#ffffff"
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.App {
|
|
2
|
+
text-align: center;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.App-logo {
|
|
6
|
+
height: 40vmin;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
11
|
+
.App-logo {
|
|
12
|
+
animation: App-logo-spin infinite 20s linear;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.App-header {
|
|
17
|
+
background-color: #282c34;
|
|
18
|
+
min-height: 100vh;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
font-size: calc(10px + 2vmin);
|
|
24
|
+
color: white;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.App-link {
|
|
28
|
+
color: #61dafb;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes App-logo-spin {
|
|
32
|
+
from {
|
|
33
|
+
transform: rotate(0deg);
|
|
34
|
+
}
|
|
35
|
+
to {
|
|
36
|
+
transform: rotate(360deg);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Admin, Resource } from 'react-admin';
|
|
3
|
+
import { createTheme } from '@mui/material/styles';
|
|
4
|
+
// import data provider
|
|
5
|
+
import { dataProvider } from './dataProvider';
|
|
6
|
+
|
|
7
|
+
// Import all resource components
|
|
8
|
+
import { CustomerList, CustomerShow, CustomerCreate, CustomerEdit } from './Customer';
|
|
9
|
+
import { OrderList, OrderShow, OrderCreate, OrderEdit } from './Order';
|
|
10
|
+
import { ProductList, ProductShow, ProductCreate, ProductEdit } from './Product';
|
|
11
|
+
import { CategoryList, CategoryShow, CategoryCreate, CategoryEdit } from './Category';
|
|
12
|
+
import { EmployeeList, EmployeeShow, EmployeeCreate, EmployeeEdit } from './Employee';
|
|
13
|
+
import { DepartmentList, DepartmentShow, DepartmentCreate, DepartmentEdit } from './Department';
|
|
14
|
+
import { SupplierList, SupplierShow, SupplierCreate, SupplierEdit } from './Supplier';
|
|
15
|
+
import { ShipperList, ShipperShow, ShipperCreate, ShipperEdit } from './Shipper';
|
|
16
|
+
import { TerritoryList, TerritoryShow, TerritoryCreate, TerritoryEdit } from './Territory';
|
|
17
|
+
import { CustomerDemographicList, CustomerDemographicShow, CustomerDemographicCreate, CustomerDemographicEdit } from './CustomerDemographic';
|
|
18
|
+
import { EmployeeAuditList, EmployeeAuditShow, EmployeeAuditCreate, EmployeeAuditEdit } from './EmployeeAudit';
|
|
19
|
+
import { EmployeeTerritoryList, EmployeeTerritoryShow, EmployeeTerritoryCreate, EmployeeTerritoryEdit } from './EmployeeTerritory';
|
|
20
|
+
import { LocationList, LocationShow, LocationCreate, LocationEdit } from './Location';
|
|
21
|
+
import { OrderDetailList, OrderDetailShow, OrderDetailCreate, OrderDetailEdit } from './OrderDetail';
|
|
22
|
+
import { RegionList, RegionShow, RegionCreate, RegionEdit } from './Region';
|
|
23
|
+
import { SampleDBVersionList, SampleDBVersionShow, SampleDBVersionCreate, SampleDBVersionEdit } from './SampleDBVersion';
|
|
24
|
+
import { UnionList, UnionShow, UnionCreate, UnionEdit } from './Union';
|
|
25
|
+
|
|
26
|
+
const theme = createTheme({
|
|
27
|
+
palette: {
|
|
28
|
+
primary: { main: '#1976d2' },
|
|
29
|
+
secondary: { main: '#1565c0' },
|
|
30
|
+
},
|
|
31
|
+
typography: { fontSize: 14 },
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const App = () => {
|
|
35
|
+
return (
|
|
36
|
+
<Admin dataProvider={dataProvider} theme={theme}>
|
|
37
|
+
<Resource name="Customer" list={CustomerList} show={CustomerShow} edit={CustomerEdit} create={CustomerCreate} />
|
|
38
|
+
<Resource name="Order" list={OrderList} show={OrderShow} edit={OrderEdit} create={OrderCreate} />
|
|
39
|
+
<Resource name="Product" list={ProductList} show={ProductShow} edit={ProductEdit} create={ProductCreate} />
|
|
40
|
+
<Resource name="Category" list={CategoryList} show={CategoryShow} edit={CategoryEdit} create={CategoryCreate} />
|
|
41
|
+
<Resource name="Employee" list={EmployeeList} show={EmployeeShow} edit={EmployeeEdit} create={EmployeeCreate} />
|
|
42
|
+
<Resource name="Department" list={DepartmentList} show={DepartmentShow} edit={DepartmentEdit} create={DepartmentCreate} />
|
|
43
|
+
<Resource name="Supplier" list={SupplierList} show={SupplierShow} edit={SupplierEdit} create={SupplierCreate} />
|
|
44
|
+
<Resource name="Shipper" list={ShipperList} show={ShipperShow} edit={ShipperEdit} create={ShipperCreate} />
|
|
45
|
+
<Resource name="Territory" list={TerritoryList} show={TerritoryShow} edit={TerritoryEdit} create={TerritoryCreate} />
|
|
46
|
+
<Resource name="CustomerDemographic" list={CustomerDemographicList} show={CustomerDemographicShow} edit={CustomerDemographicEdit} create={CustomerDemographicCreate} />
|
|
47
|
+
<Resource name="EmployeeAudit" list={EmployeeAuditList} show={EmployeeAuditShow} edit={EmployeeAuditEdit} create={EmployeeAuditCreate} />
|
|
48
|
+
<Resource name="EmployeeTerritory" list={EmployeeTerritoryList} show={EmployeeTerritoryShow} edit={EmployeeTerritoryEdit} create={EmployeeTerritoryCreate} />
|
|
49
|
+
<Resource name="Location" list={LocationList} show={LocationShow} edit={LocationEdit} create={LocationCreate} />
|
|
50
|
+
<Resource name="OrderDetail" list={OrderDetailList} show={OrderDetailShow} edit={OrderDetailEdit} create={OrderDetailCreate} />
|
|
51
|
+
<Resource name="Region" list={RegionList} show={RegionShow} edit={RegionEdit} create={RegionCreate} />
|
|
52
|
+
<Resource name="SampleDBVersion" list={SampleDBVersionList} show={SampleDBVersionShow} edit={SampleDBVersionEdit} create={SampleDBVersionCreate} />
|
|
53
|
+
<Resource name="Union" list={UnionList} show={UnionShow} edit={UnionEdit} create={UnionCreate} />
|
|
54
|
+
</Admin>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default App;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
List,
|
|
4
|
+
Datagrid,
|
|
5
|
+
TextField,
|
|
6
|
+
NumberField,
|
|
7
|
+
ReferenceField,
|
|
8
|
+
Show,
|
|
9
|
+
SimpleShowLayout,
|
|
10
|
+
TabbedShowLayout,
|
|
11
|
+
Tab,
|
|
12
|
+
TextInput,
|
|
13
|
+
NumberInput,
|
|
14
|
+
ReferenceManyField,
|
|
15
|
+
ReferenceInput,
|
|
16
|
+
SelectInput,
|
|
17
|
+
Create,
|
|
18
|
+
SimpleForm,
|
|
19
|
+
Edit,
|
|
20
|
+
Filter,
|
|
21
|
+
} from 'react-admin';
|
|
22
|
+
|
|
23
|
+
// Filters for Category List
|
|
24
|
+
//theme color;
|
|
25
|
+
const CategoryFilter = (props) => (
|
|
26
|
+
<Filter {...props}>
|
|
27
|
+
<TextInput label="Search" source="q" alwaysOn />
|
|
28
|
+
<TextInput label="Category Name" source="CategoryName_ColumnName" />
|
|
29
|
+
<TextInput label="Description" source="Description" />
|
|
30
|
+
</Filter>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Category List
|
|
34
|
+
export const CategoryList = (props) => (
|
|
35
|
+
<List filters={<CategoryFilter />} {...props} perPage={7}>
|
|
36
|
+
<Datagrid rowClick="show">
|
|
37
|
+
<TextField source="CategoryName_ColumnName" label="Category Name" />
|
|
38
|
+
<TextField source="Description" />
|
|
39
|
+
</Datagrid>
|
|
40
|
+
</List>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Category Show
|
|
44
|
+
export const CategoryShow = (props) => (
|
|
45
|
+
<Show {...props}>
|
|
46
|
+
<SimpleShowLayout>
|
|
47
|
+
<TextField source="CategoryName_ColumnName" label="Category Name" />
|
|
48
|
+
<TextField source="Description" />
|
|
49
|
+
<NumberField source="Id" label="ID" />
|
|
50
|
+
<ReferenceManyField reference="Product" target="CategoryId" label="Products">
|
|
51
|
+
<TabbedShowLayout>
|
|
52
|
+
<Tab label="Products">
|
|
53
|
+
<Datagrid rowClick="show">
|
|
54
|
+
<TextField source="ProductName" label="Product Name" />
|
|
55
|
+
<NumberField source="UnitPrice" label="Unit Price" />
|
|
56
|
+
</Datagrid>
|
|
57
|
+
</Tab>
|
|
58
|
+
</TabbedShowLayout>
|
|
59
|
+
</ReferenceManyField>
|
|
60
|
+
</SimpleShowLayout>
|
|
61
|
+
</Show>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
// Category Create
|
|
65
|
+
export const CategoryCreate = (props) => (
|
|
66
|
+
<Create {...props}>
|
|
67
|
+
<SimpleForm>
|
|
68
|
+
<TextInput source="CategoryName_ColumnName" label="Category Name" />
|
|
69
|
+
<TextInput multiline source="Description" />
|
|
70
|
+
</SimpleForm>
|
|
71
|
+
</Create>
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// Category Edit
|
|
75
|
+
export const CategoryEdit = (props) => (
|
|
76
|
+
<Edit {...props}>
|
|
77
|
+
<SimpleForm>
|
|
78
|
+
<TextInput source="CategoryName_ColumnName" label="Category Name" />
|
|
79
|
+
<TextInput multiline source="Description" />
|
|
80
|
+
</SimpleForm>
|
|
81
|
+
</Edit>
|
|
82
|
+
);
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { List, FunctionField, Datagrid, TextField, DateField, NumberField, ReferenceField, ReferenceManyField, Show, TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput, ReferenceInput, SelectInput, Create, SimpleForm, Edit, Filter, Pagination, BooleanField, BooleanInput, TopToolbar, Button, useListContext } from 'react-admin'; // mandatory import
|
|
3
|
+
import { ToggleButton, ToggleButtonGroup, Box, Card, CardContent, CardActions, Typography } from '@mui/material';
|
|
4
|
+
import { ViewList, ViewModule } from '@mui/icons-material';
|
|
5
|
+
|
|
6
|
+
// Filters for the list view
|
|
7
|
+
const CustomerFilter = (props) => (
|
|
8
|
+
<Filter {...props}>
|
|
9
|
+
<TextInput label="Search" source="q" alwaysOn />
|
|
10
|
+
<TextInput label="Company Name" source="CompanyName" />
|
|
11
|
+
<TextInput label="Contact Name" source="ContactName" />
|
|
12
|
+
<TextInput label="City" source="City" />
|
|
13
|
+
<TextInput label="Country" source="Country" />
|
|
14
|
+
</Filter>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
// Card view component for customers
|
|
18
|
+
const CustomerCard = ({ record, ...props }) => (
|
|
19
|
+
<Card sx={{ margin: 1, minWidth: 300, maxWidth: 350 }}>
|
|
20
|
+
<CardContent>
|
|
21
|
+
<Typography variant="h6" component="div" gutterBottom>
|
|
22
|
+
{record.CompanyName}
|
|
23
|
+
</Typography>
|
|
24
|
+
<Typography variant="body2" color="text.secondary">
|
|
25
|
+
Contact: {record.ContactName}
|
|
26
|
+
</Typography>
|
|
27
|
+
<Typography variant="body2" color="text.secondary">
|
|
28
|
+
{record.Address && `${record.Address}, `}{record.City}
|
|
29
|
+
{record.Region && `, ${record.Region}`}
|
|
30
|
+
</Typography>
|
|
31
|
+
<Typography variant="body2" color="text.secondary">
|
|
32
|
+
{record.Country}
|
|
33
|
+
</Typography>
|
|
34
|
+
{record.Phone && (
|
|
35
|
+
<Typography variant="body2" color="text.secondary">
|
|
36
|
+
Phone: {record.Phone}
|
|
37
|
+
</Typography>
|
|
38
|
+
)}
|
|
39
|
+
{record.Balance && (
|
|
40
|
+
<Typography variant="body2" color="text.primary" sx={{ mt: 1, fontWeight: 'bold' }}>
|
|
41
|
+
Balance: ${record.Balance.toLocaleString()}
|
|
42
|
+
</Typography>
|
|
43
|
+
)}
|
|
44
|
+
</CardContent>
|
|
45
|
+
<CardActions>
|
|
46
|
+
<Button
|
|
47
|
+
size="small"
|
|
48
|
+
onClick={() => window.location.href = `#/Customer/${record.Id}/show`}
|
|
49
|
+
>
|
|
50
|
+
View Details
|
|
51
|
+
</Button>
|
|
52
|
+
<Button
|
|
53
|
+
size="small"
|
|
54
|
+
onClick={() => window.location.href = `#/Customer/${record.Id}`}
|
|
55
|
+
>
|
|
56
|
+
Edit
|
|
57
|
+
</Button>
|
|
58
|
+
</CardActions>
|
|
59
|
+
</Card>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Custom list actions with view toggle
|
|
63
|
+
const CustomerListActions = ({ viewMode, setViewMode }) => (
|
|
64
|
+
<TopToolbar>
|
|
65
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
|
66
|
+
<ToggleButtonGroup
|
|
67
|
+
value={viewMode}
|
|
68
|
+
exclusive
|
|
69
|
+
onChange={(event, newView) => {
|
|
70
|
+
if (newView !== null) {
|
|
71
|
+
setViewMode(newView);
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
aria-label="view mode"
|
|
75
|
+
size="small"
|
|
76
|
+
>
|
|
77
|
+
<ToggleButton value="list" aria-label="list view">
|
|
78
|
+
<ViewList />
|
|
79
|
+
</ToggleButton>
|
|
80
|
+
<ToggleButton value="cards" aria-label="card view">
|
|
81
|
+
<ViewModule />
|
|
82
|
+
</ToggleButton>
|
|
83
|
+
</ToggleButtonGroup>
|
|
84
|
+
</Box>
|
|
85
|
+
</TopToolbar>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// Custom card grid component that uses react-admin's data context
|
|
89
|
+
const CustomerCardGrid = () => {
|
|
90
|
+
const { data, isLoading } = useListContext();
|
|
91
|
+
|
|
92
|
+
if (isLoading) return <div>Loading...</div>;
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, padding: 2 }}>
|
|
96
|
+
{data && data.map((record) => (
|
|
97
|
+
<CustomerCard key={record.Id} record={record} />
|
|
98
|
+
))}
|
|
99
|
+
</Box>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const CustomerList = (props) => {
|
|
104
|
+
const [viewMode, setViewMode] = useState('list');
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<List
|
|
108
|
+
filters={<CustomerFilter />}
|
|
109
|
+
{...props}
|
|
110
|
+
perPage={viewMode === 'cards' ? 12 : 7}
|
|
111
|
+
pagination={<Pagination />}
|
|
112
|
+
actions={<CustomerListActions viewMode={viewMode} setViewMode={setViewMode} />}
|
|
113
|
+
>
|
|
114
|
+
{viewMode === 'list' ? (
|
|
115
|
+
<Datagrid rowClick="show">
|
|
116
|
+
<TextField source="CompanyName" label="Company Name" />
|
|
117
|
+
<TextField source="ContactName" label="Contact Name" />
|
|
118
|
+
<TextField source="Address" label="Address" />
|
|
119
|
+
<TextField source="City" label="City" />
|
|
120
|
+
<TextField source="Country" label="Country" />
|
|
121
|
+
<TextField source="Phone" label="Phone" />
|
|
122
|
+
<TextField source="Fax" label="Fax" />
|
|
123
|
+
<NumberField source="Id" label="Customer ID"/>
|
|
124
|
+
</Datagrid>
|
|
125
|
+
) : (
|
|
126
|
+
<CustomerCardGrid />
|
|
127
|
+
)}
|
|
128
|
+
</List>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const CustomerShow = (props) => (
|
|
133
|
+
<Show {...props}>
|
|
134
|
+
<SimpleShowLayout>
|
|
135
|
+
<TextField source="CompanyName" label="Company Name" />
|
|
136
|
+
<TextField source="ContactName" label="Contact Name" />
|
|
137
|
+
<TextField source="ContactTitle" label="Contact Title" />
|
|
138
|
+
<TextField source="Address" label="Address" />
|
|
139
|
+
<TextField source="City" label="City" />
|
|
140
|
+
<TextField source="Region" label="Region" />
|
|
141
|
+
<TextField source="PostalCode" label="Postal Code" />
|
|
142
|
+
<TextField source="Country" label="Country" />
|
|
143
|
+
<TextField source="Phone" label="Phone" />
|
|
144
|
+
<TextField source="Fax" label="Fax" />
|
|
145
|
+
<NumberField source="Balance" options={{ style: 'currency', currency: 'USD' }} label="Balance" />
|
|
146
|
+
<NumberField source="CreditLimit" options={{ style: 'currency', currency: 'USD' }} label="Credit Limit" />
|
|
147
|
+
<NumberField source="OrderCount" label="Order Count" />
|
|
148
|
+
<NumberField source="UnpaidOrderCount" label="Unpaid Orders" />
|
|
149
|
+
<NumberField source="Id" label="Customer ID" />
|
|
150
|
+
|
|
151
|
+
<TabbedShowLayout>
|
|
152
|
+
<Tab label="Orders">
|
|
153
|
+
<ReferenceManyField
|
|
154
|
+
label="Orders"
|
|
155
|
+
reference="Order"
|
|
156
|
+
target="CustomerId"
|
|
157
|
+
perPage={7}
|
|
158
|
+
>
|
|
159
|
+
<Datagrid rowClick="show">
|
|
160
|
+
<TextField source="ShipName" label="Ship Name" />
|
|
161
|
+
<DateField source="OrderDate" label="Order Date" />
|
|
162
|
+
<DateField source="ShippedDate" label="Shipped Date" />
|
|
163
|
+
<NumberField source="AmountTotal" label="Total Amount" options={{ style: 'currency', currency: 'USD' }}/>
|
|
164
|
+
<BooleanField source="Ready" label="Ready" />
|
|
165
|
+
<NumberField source="Id" label="Order ID" />
|
|
166
|
+
</Datagrid>
|
|
167
|
+
</ReferenceManyField>
|
|
168
|
+
</Tab>
|
|
169
|
+
</TabbedShowLayout>
|
|
170
|
+
</SimpleShowLayout>
|
|
171
|
+
</Show>
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
export const CustomerCreate = (props) => (
|
|
175
|
+
<Create {...props}>
|
|
176
|
+
<SimpleForm>
|
|
177
|
+
<TextInput source="CompanyName" label="Company Name" />
|
|
178
|
+
<TextInput source="ContactName" label="Contact Name" />
|
|
179
|
+
<TextInput source="ContactTitle" label="Contact Title" />
|
|
180
|
+
<TextInput source="Address" label="Address" />
|
|
181
|
+
<TextInput source="City" label="City" />
|
|
182
|
+
<TextInput source="Region" label="Region" />
|
|
183
|
+
<TextInput source="PostalCode" label="Postal Code" />
|
|
184
|
+
<TextInput source="Country" label="Country" />
|
|
185
|
+
<TextInput source="Phone" label="Phone" />
|
|
186
|
+
<TextInput source="Fax" label="Fax" />
|
|
187
|
+
<NumberInput source="Balance" label="Balance" />
|
|
188
|
+
<NumberInput source="CreditLimit" label="Credit Limit" />
|
|
189
|
+
</SimpleForm>
|
|
190
|
+
</Create>
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
export const CustomerEdit = (props) => (
|
|
194
|
+
<Edit {...props}>
|
|
195
|
+
<SimpleForm>
|
|
196
|
+
<TextInput source="CompanyName" label="Company Name" />
|
|
197
|
+
<TextInput source="ContactName" label="Contact Name" />
|
|
198
|
+
<TextInput source="ContactTitle" label="Contact Title" />
|
|
199
|
+
<TextInput source="Address" label="Address" />
|
|
200
|
+
<TextInput source="City" label="City" />
|
|
201
|
+
<TextInput source="Region" label="Region" />
|
|
202
|
+
<TextInput source="PostalCode" label="Postal Code" />
|
|
203
|
+
<TextInput source="Country" label="Country" />
|
|
204
|
+
<TextInput source="Phone" label="Phone" />
|
|
205
|
+
<TextInput source="Fax" label="Fax" />
|
|
206
|
+
<NumberInput source="Balance" label="Balance" />
|
|
207
|
+
<NumberInput source="CreditLimit" label="Credit Limit" />
|
|
208
|
+
<NumberField source="Id" label="Customer ID" />
|
|
209
|
+
</SimpleForm>
|
|
210
|
+
</Edit>
|
|
211
|
+
);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
List,
|
|
4
|
+
Datagrid,
|
|
5
|
+
TextField,
|
|
6
|
+
Show,
|
|
7
|
+
SimpleShowLayout,
|
|
8
|
+
Edit,
|
|
9
|
+
SimpleForm,
|
|
10
|
+
TextInput,
|
|
11
|
+
Create,
|
|
12
|
+
Filter,
|
|
13
|
+
Pagination,
|
|
14
|
+
} from 'react-admin';
|
|
15
|
+
|
|
16
|
+
const CustomerDemographicFilter = (props) => (
|
|
17
|
+
<Filter {...props}>
|
|
18
|
+
<TextInput label="Search" source="q" alwaysOn />
|
|
19
|
+
<TextInput label="Customer Description" source="CustomerDesc" />
|
|
20
|
+
</Filter>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const CustomerDemographicList = (props) => (
|
|
24
|
+
<List filters={<CustomerDemographicFilter />} pagination={<Pagination perPage={7} />} {...props}>
|
|
25
|
+
<Datagrid rowClick="show">
|
|
26
|
+
<TextField source="Id" label="ID" />
|
|
27
|
+
<TextField source="CustomerDesc" label="Customer Description" />
|
|
28
|
+
</Datagrid>
|
|
29
|
+
</List>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const CustomerDemographicShow = (props) => (
|
|
33
|
+
<Show {...props}>
|
|
34
|
+
<SimpleShowLayout>
|
|
35
|
+
<TextField source="Id" label="ID" />
|
|
36
|
+
<TextField source="CustomerDesc" label="Customer Description" />
|
|
37
|
+
</SimpleShowLayout>
|
|
38
|
+
</Show>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export const CustomerDemographicCreate = (props) => (
|
|
42
|
+
<Create {...props}>
|
|
43
|
+
<SimpleForm>
|
|
44
|
+
<TextInput source="Id" label="ID" />
|
|
45
|
+
<TextInput source="CustomerDesc" label="Customer Description" />
|
|
46
|
+
</SimpleForm>
|
|
47
|
+
</Create>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export const CustomerDemographicEdit = (props) => (
|
|
51
|
+
<Edit {...props}>
|
|
52
|
+
<SimpleForm>
|
|
53
|
+
<TextInput source="Id" label="ID" disabled />
|
|
54
|
+
<TextInput source="CustomerDesc" label="Customer Description" />
|
|
55
|
+
</SimpleForm>
|
|
56
|
+
</Edit>
|
|
57
|
+
);
|