ApiLogicServer 15.0.27__py3-none-any.whl → 15.0.28__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 +2 -2
- api_logic_server_cli/cli.py +1 -1
- api_logic_server_cli/genai/genai_admin_app.py +11 -6
- api_logic_server_cli/genai/genai_svcs.py +3 -3
- api_logic_server_cli/logging.yml +16 -1
- api_logic_server_cli/prototypes/nw/ui/.DS_Store +0 -0
- api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/.DS_Store +0 -0
- api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/README.md +0 -2
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/compile-errors.txt +324 -0
- api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/package-lock.json +24 -0
- api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/package.json +3 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/App.js +147 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Category.js +141 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Config.js +527 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Customer.js +193 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/CustomerDemographic.js +119 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Department.js +144 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Employee.js +213 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/EmployeeAudit.js +223 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/EmployeeTerritory.js +94 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Location.js +170 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Order.js +179 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/OrderDetail.js +201 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Product.js +226 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Region.js +104 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Shipper.js +120 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Supplier.js +143 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Territory.js +145 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Union.js +119 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/app_loader.js +24 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/.eslintrc +5 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/.yarnrc.yml +4 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/default-settings.js +25 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/default-settings.ts +25 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/errors.js +116 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/errors.ts +116 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/index.test.tsx +7 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/index.tsx +11 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/ra-jsonapi-client.js +577 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/ra-jsonapi-client.ts +577 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.js +124 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.ts +124 -0
- api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/styles.module.css +9 -0
- {apilogicserver-15.0.27.dist-info → apilogicserver-15.0.28.dist-info}/METADATA +1 -1
- {apilogicserver-15.0.27.dist-info → apilogicserver-15.0.28.dist-info}/RECORD +107 -91
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/App.js +0 -58
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Category.js +0 -82
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Customer.js +0 -211
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/CustomerDemographic.js +0 -57
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Department.js +0 -98
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Employee.js +0 -100
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeAudit.js +0 -106
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeTerritory.js +0 -98
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Location.js +0 -87
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Order.js +0 -98
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/OrderDetail.js +0 -112
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Product.js +0 -103
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Region.js +0 -65
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Shipper.js +0 -67
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Supplier.js +0 -87
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Territory.js +0 -90
- api_logic_server_cli/prototypes/nw/ui/react_admin/src/Union.js +0 -61
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/.DS_Store +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/README.md +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/README_create_react_app.md +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/package-lock.json +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/package.json +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/public/favicon.ico +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/public/index.html +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/public/logo192.png +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/public/logo512.png +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/public/manifest.json +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/public/robots.txt +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/App.css +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/App.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/App.test.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/Config-reference.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/Config.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/Customer-reference.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/Customer.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/Item.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/Order.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/Product.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/SysEmail.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/SysMcp.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/app_loader.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/index.css +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/index.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/logo.svg +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/.eslintrc +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/.yarnrc.yml +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/default-settings.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/default-settings.ts +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/errors.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/errors.ts +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/index.test.tsx +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/index.tsx +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/ra-jsonapi-client.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/ra-jsonapi-client.ts +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/resourceLookup.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/resourceLookup.ts +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/rav4-jsonapi-client/styles.module.css +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/reportWebVitals.js +0 -0
- /api_logic_server_cli/prototypes/basic_demo/customizations/ui/{basic_demo_app → reference_react_app}/src/setupTests.js +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/README_create_react_app.md +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/public/favicon.ico +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/public/index.html +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/public/logo192.png +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/public/logo512.png +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/public/manifest.json +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/public/robots.txt +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/App.css +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/App.test.js +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/SampleDBVersion.js +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/dataProvider.js +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/index.css +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/index.js +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/logo.svg +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/reportWebVitals.js +0 -0
- /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/setupTests.js +0 -0
- {apilogicserver-15.0.27.dist-info → apilogicserver-15.0.28.dist-info}/WHEEL +0 -0
- {apilogicserver-15.0.27.dist-info → apilogicserver-15.0.28.dist-info}/entry_points.txt +0 -0
- {apilogicserver-15.0.27.dist-info → apilogicserver-15.0.28.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-15.0.27.dist-info → apilogicserver-15.0.28.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// begin MANDATORY imports (always generated EXACTLY)
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { List, FunctionField, Datagrid, TextField, EmailField, DateField, NumberField } from 'react-admin';
|
|
4
|
+
import { ReferenceField, ReferenceManyField } from 'react-admin';
|
|
5
|
+
import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
|
|
6
|
+
import { ReferenceInput, SelectInput, SimpleForm, Show, Edit, Create } from 'react-admin';
|
|
7
|
+
import { Filter, Pagination, BooleanField, BooleanInput, Labeled } from 'react-admin';
|
|
8
|
+
import { EditButton, DeleteButton, CreateButton, ShowButton } from 'react-admin';
|
|
9
|
+
import { Grid, Typography, Box, Divider, Button } from '@mui/material';
|
|
10
|
+
import { useRecordContext, useRedirect, Link, required } from 'react-admin';
|
|
11
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
12
|
+
// end mandatory imports
|
|
13
|
+
|
|
14
|
+
const SupplierFilter = (props) => (
|
|
15
|
+
<Filter {...props}>
|
|
16
|
+
<TextInput label="Search by Company Name" source="CompanyName" alwaysOn />
|
|
17
|
+
</Filter>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
// Supplier List
|
|
21
|
+
export const SupplierList = (props) => {
|
|
22
|
+
return (
|
|
23
|
+
<List
|
|
24
|
+
filters={<SupplierFilter />}
|
|
25
|
+
{...props}
|
|
26
|
+
sort={{ field: 'CompanyName', order: 'ASC' }}
|
|
27
|
+
pagination={<Pagination rowsPerPageOptions={[5, 10, 25]} showFirstLastButtons />}>
|
|
28
|
+
<Datagrid rowClick="show">
|
|
29
|
+
<TextField source="CompanyName" label="Company Name" />
|
|
30
|
+
<TextField source="ContactName" label="Contact Name" />
|
|
31
|
+
<TextField source="ContactTitle" label="Contact Title" />
|
|
32
|
+
<TextField source="City" label="City" />
|
|
33
|
+
<TextField source="Country" label="Country" />
|
|
34
|
+
<EditButton />
|
|
35
|
+
<DeleteButton />
|
|
36
|
+
</Datagrid>
|
|
37
|
+
</List>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Supplier Show
|
|
42
|
+
export const SupplierShow = (props) => {
|
|
43
|
+
return (
|
|
44
|
+
<Show {...props}>
|
|
45
|
+
<SimpleShowLayout>
|
|
46
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
47
|
+
Supplier Information
|
|
48
|
+
</Typography>
|
|
49
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
50
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
51
|
+
<Labeled label="Company Name">
|
|
52
|
+
<TextField source="CompanyName" />
|
|
53
|
+
</Labeled>
|
|
54
|
+
</Grid>
|
|
55
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
56
|
+
<Labeled label="Contact Name">
|
|
57
|
+
<TextField source="ContactName" />
|
|
58
|
+
</Labeled>
|
|
59
|
+
</Grid>
|
|
60
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
61
|
+
<Labeled label="Contact Title">
|
|
62
|
+
<TextField source="ContactTitle" />
|
|
63
|
+
</Labeled>
|
|
64
|
+
</Grid>
|
|
65
|
+
</Grid>
|
|
66
|
+
<Divider sx={{ my: 2 }} />
|
|
67
|
+
</SimpleShowLayout>
|
|
68
|
+
</Show>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Supplier Create
|
|
73
|
+
export const SupplierCreate = (props) => {
|
|
74
|
+
return (
|
|
75
|
+
<Create {...props}>
|
|
76
|
+
<SimpleForm>
|
|
77
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
78
|
+
Create New Supplier
|
|
79
|
+
</Typography>
|
|
80
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
81
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
82
|
+
<TextInput source="CompanyName" label="Company Name" fullWidth />
|
|
83
|
+
</Grid>
|
|
84
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
85
|
+
<TextInput source="ContactName" label="Contact Name" fullWidth />
|
|
86
|
+
</Grid>
|
|
87
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
88
|
+
<TextInput source="ContactTitle" label="Contact Title" fullWidth />
|
|
89
|
+
</Grid>
|
|
90
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
91
|
+
<TextInput source="Address" label="Address" fullWidth />
|
|
92
|
+
</Grid>
|
|
93
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
94
|
+
<TextInput source="City" label="City" fullWidth />
|
|
95
|
+
</Grid>
|
|
96
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
97
|
+
<TextInput source="Country" label="Country" fullWidth />
|
|
98
|
+
</Grid>
|
|
99
|
+
</Grid>
|
|
100
|
+
</SimpleForm>
|
|
101
|
+
</Create>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Supplier Edit
|
|
106
|
+
export const SupplierEdit = (props) => {
|
|
107
|
+
return (
|
|
108
|
+
<Edit {...props} redirect={false}>
|
|
109
|
+
<SimpleForm>
|
|
110
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
111
|
+
Edit Supplier
|
|
112
|
+
</Typography>
|
|
113
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
114
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
115
|
+
<TextInput source="CompanyName" label="Company Name" fullWidth />
|
|
116
|
+
</Grid>
|
|
117
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
118
|
+
<TextInput source="ContactName" label="Contact Name" fullWidth />
|
|
119
|
+
</Grid>
|
|
120
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
121
|
+
<TextInput source="ContactTitle" label="Contact Title" fullWidth />
|
|
122
|
+
</Grid>
|
|
123
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
124
|
+
<TextInput source="Address" label="Address" fullWidth />
|
|
125
|
+
</Grid>
|
|
126
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
127
|
+
<TextInput source="City" label="City" fullWidth />
|
|
128
|
+
</Grid>
|
|
129
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
130
|
+
<TextInput source="Country" label="Country" fullWidth />
|
|
131
|
+
</Grid>
|
|
132
|
+
</Grid>
|
|
133
|
+
</SimpleForm>
|
|
134
|
+
</Edit>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default {
|
|
139
|
+
list: SupplierList,
|
|
140
|
+
show: SupplierShow,
|
|
141
|
+
create: SupplierCreate,
|
|
142
|
+
edit: SupplierEdit,
|
|
143
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// begin MANDATORY imports (always generated EXACTLY)
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { List, FunctionField, Datagrid, TextField, EmailField, DateField, NumberField } from 'react-admin';
|
|
4
|
+
import { ReferenceField, ReferenceManyField } from 'react-admin';
|
|
5
|
+
import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
|
|
6
|
+
import { ReferenceInput, SelectInput, SimpleForm, Show, Edit, Create } from 'react-admin';
|
|
7
|
+
import { Filter, Pagination, BooleanField, BooleanInput, Labeled } from 'react-admin';
|
|
8
|
+
import { EditButton, DeleteButton, CreateButton, ShowButton } from 'react-admin';
|
|
9
|
+
import { Grid, Typography, Box, Divider, Button } from '@mui/material';
|
|
10
|
+
import { useRecordContext, useRedirect, Link, required } from 'react-admin';
|
|
11
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
12
|
+
// end mandatory imports
|
|
13
|
+
|
|
14
|
+
// Filter for Territory List
|
|
15
|
+
const TerritoryFilter = props => (
|
|
16
|
+
<Filter {...props}>
|
|
17
|
+
<TextInput label="Search by Description" source="TerritoryDescription" alwaysOn />
|
|
18
|
+
</Filter>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
// Territory List
|
|
22
|
+
export const TerritoryList = props => (
|
|
23
|
+
<List filters={<TerritoryFilter />} {...props} sort={{ field: 'TerritoryDescription', order: 'ASC' }}>
|
|
24
|
+
<Datagrid rowClick="show">
|
|
25
|
+
<TextField source="TerritoryDescription" label="Territory Description" />
|
|
26
|
+
<TextField source="Id" label="ID" />
|
|
27
|
+
<TextField source="RegionId" label="Region ID" />
|
|
28
|
+
</Datagrid>
|
|
29
|
+
</List>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// Territory Show
|
|
33
|
+
export const TerritoryShow = props => (
|
|
34
|
+
<Show {...props}>
|
|
35
|
+
<SimpleShowLayout>
|
|
36
|
+
<Box sx={{ mb: 3 }}>
|
|
37
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
38
|
+
Territory Information
|
|
39
|
+
</Typography>
|
|
40
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
41
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
42
|
+
<TextField source="TerritoryDescription" label="Territory Description" />
|
|
43
|
+
</Grid>
|
|
44
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
45
|
+
<TextField source="Id" label="ID" />
|
|
46
|
+
</Grid>
|
|
47
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
48
|
+
<TextField source="RegionId" label="Region ID" />
|
|
49
|
+
</Grid>
|
|
50
|
+
</Grid>
|
|
51
|
+
<Divider sx={{ my: 2 }} />
|
|
52
|
+
</Box>
|
|
53
|
+
<TabbedShowLayout>
|
|
54
|
+
<Tab label="Employee Territories">
|
|
55
|
+
<ReferenceManyField
|
|
56
|
+
reference="EmployeeTerritory"
|
|
57
|
+
target="TerritoryId"
|
|
58
|
+
addLabel={false}
|
|
59
|
+
pagination={<Pagination rowsPerPageOptions={[5, 10, 25]} showFirstLastButtons />}>
|
|
60
|
+
<Datagrid rowClick="show">
|
|
61
|
+
<TextField source="Id" label="ID" />
|
|
62
|
+
<TextField source="EmployeeId" label="Employee ID" />
|
|
63
|
+
</Datagrid>
|
|
64
|
+
</ReferenceManyField>
|
|
65
|
+
<AddEmployeeTerritoryButton />
|
|
66
|
+
</Tab>
|
|
67
|
+
</TabbedShowLayout>
|
|
68
|
+
</SimpleShowLayout>
|
|
69
|
+
</Show>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
// Custom Add Employee Territory Button
|
|
73
|
+
const AddEmployeeTerritoryButton = () => {
|
|
74
|
+
const record = useRecordContext();
|
|
75
|
+
const redirect = useRedirect();
|
|
76
|
+
|
|
77
|
+
const handleClick = () => {
|
|
78
|
+
redirect(`/EmployeeTerritory/create?source=${encodeURIComponent(JSON.stringify({ TerritoryId: record?.id }))}`);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<Button
|
|
83
|
+
variant="contained"
|
|
84
|
+
color="primary"
|
|
85
|
+
startIcon={<AddIcon />}
|
|
86
|
+
onClick={handleClick}
|
|
87
|
+
sx={{ mt: 2 }}
|
|
88
|
+
>
|
|
89
|
+
Add Employee Territory
|
|
90
|
+
</Button>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Territory Create
|
|
95
|
+
export const TerritoryCreate = props => (
|
|
96
|
+
<Create {...props}>
|
|
97
|
+
<SimpleForm>
|
|
98
|
+
<Box sx={{ mb: 3 }}>
|
|
99
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
100
|
+
Create New Territory
|
|
101
|
+
</Typography>
|
|
102
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
103
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
104
|
+
<TextInput source="TerritoryDescription" label="Territory Description" validate={required()} fullWidth />
|
|
105
|
+
</Grid>
|
|
106
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
107
|
+
<ReferenceInput source="RegionId" reference="Region" fullWidth>
|
|
108
|
+
<SelectInput optionText="RegionDescription" validate={required()} />
|
|
109
|
+
</ReferenceInput>
|
|
110
|
+
</Grid>
|
|
111
|
+
</Grid>
|
|
112
|
+
</Box>
|
|
113
|
+
</SimpleForm>
|
|
114
|
+
</Create>
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
// Territory Edit
|
|
118
|
+
export const TerritoryEdit = props => (
|
|
119
|
+
<Edit {...props} redirect={false}>
|
|
120
|
+
<SimpleForm>
|
|
121
|
+
<Box sx={{ mb: 3 }}>
|
|
122
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
123
|
+
Edit Territory
|
|
124
|
+
</Typography>
|
|
125
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
126
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
127
|
+
<TextInput source="TerritoryDescription" label="Territory Description" validate={required()} fullWidth />
|
|
128
|
+
</Grid>
|
|
129
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
130
|
+
<ReferenceInput source="RegionId" reference="Region" fullWidth>
|
|
131
|
+
<SelectInput optionText="RegionDescription" validate={required()} />
|
|
132
|
+
</ReferenceInput>
|
|
133
|
+
</Grid>
|
|
134
|
+
</Grid>
|
|
135
|
+
</Box>
|
|
136
|
+
</SimpleForm>
|
|
137
|
+
</Edit>
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
export default {
|
|
141
|
+
list: TerritoryList,
|
|
142
|
+
show: TerritoryShow,
|
|
143
|
+
create: TerritoryCreate,
|
|
144
|
+
edit: TerritoryEdit,
|
|
145
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// begin MANDATORY imports (always generated EXACTLY)
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { List, FunctionField, Datagrid, TextField, EmailField, DateField, NumberField } from 'react-admin';
|
|
4
|
+
import { ReferenceField, ReferenceManyField } from 'react-admin';
|
|
5
|
+
import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
|
|
6
|
+
import { ReferenceInput, SelectInput, SimpleForm, Show, Edit, Create } from 'react-admin';
|
|
7
|
+
import { Filter, Pagination, BooleanField, BooleanInput, Labeled } from 'react-admin';
|
|
8
|
+
import { EditButton, DeleteButton, CreateButton, ShowButton } from 'react-admin';
|
|
9
|
+
import { Grid, Typography, Box, Divider, Button } from '@mui/material';
|
|
10
|
+
import { useRecordContext, useRedirect, Link, required } from 'react-admin';
|
|
11
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
12
|
+
// end mandatory imports
|
|
13
|
+
|
|
14
|
+
const UnionFilter = (props) => (
|
|
15
|
+
<Filter {...props}>
|
|
16
|
+
<TextInput label="Search by Name" source="Name" alwaysOn />
|
|
17
|
+
</Filter>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
// Union List
|
|
21
|
+
export const UnionList = (props) => {
|
|
22
|
+
return (
|
|
23
|
+
<List filters={<UnionFilter />} {...props} sort={{ field: 'Name', order: 'ASC' }} pagination={<Pagination rowsPerPageOptions={[5, 10, 25]} showFirstLastButtons />}>
|
|
24
|
+
<Datagrid rowClick="show">
|
|
25
|
+
<TextField source="Name" label="Name" />
|
|
26
|
+
<FunctionField label="Total Employees" render={record => record?.EmployeeList?.length || 0} />
|
|
27
|
+
</Datagrid>
|
|
28
|
+
</List>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Union Show
|
|
33
|
+
export const UnionShow = (props) => {
|
|
34
|
+
return (
|
|
35
|
+
<Show {...props}>
|
|
36
|
+
<SimpleShowLayout>
|
|
37
|
+
<Box sx={{ mb: 3 }}>
|
|
38
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
39
|
+
Union Details
|
|
40
|
+
</Typography>
|
|
41
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
42
|
+
<Grid item xs={12} sm={6} md={3}>
|
|
43
|
+
<Box sx={{ p: 1 }}>
|
|
44
|
+
<Labeled label="Name">
|
|
45
|
+
<TextField source="Name" />
|
|
46
|
+
</Labeled>
|
|
47
|
+
</Box>
|
|
48
|
+
</Grid>
|
|
49
|
+
</Grid>
|
|
50
|
+
<Divider sx={{ my: 2 }} />
|
|
51
|
+
</Box>
|
|
52
|
+
</SimpleShowLayout>
|
|
53
|
+
<TabbedShowLayout>
|
|
54
|
+
<Tab label="Employees">
|
|
55
|
+
<ReferenceManyField reference="Employee" target="UnionId" addLabel={false} pagination={<Pagination />}>
|
|
56
|
+
<Datagrid rowClick="show">
|
|
57
|
+
<TextField source="LastName" label="Last Name" />
|
|
58
|
+
<TextField source="FirstName" label="First Name" />
|
|
59
|
+
<TextField source="Title" label="Title" />
|
|
60
|
+
<EditButton />
|
|
61
|
+
<DeleteButton />
|
|
62
|
+
</Datagrid>
|
|
63
|
+
</ReferenceManyField>
|
|
64
|
+
</Tab>
|
|
65
|
+
</TabbedShowLayout>
|
|
66
|
+
</Show>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Union Create
|
|
71
|
+
export const UnionCreate = (props) => {
|
|
72
|
+
return (
|
|
73
|
+
<Create {...props}>
|
|
74
|
+
<SimpleForm>
|
|
75
|
+
<Box sx={{ mb: 3 }}>
|
|
76
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
77
|
+
Create New Union
|
|
78
|
+
</Typography>
|
|
79
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
80
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
81
|
+
<Box sx={{ p: 1 }}>
|
|
82
|
+
<TextInput source="Name" label="Name" validate={[required()]} fullWidth />
|
|
83
|
+
</Box>
|
|
84
|
+
</Grid>
|
|
85
|
+
</Grid>
|
|
86
|
+
</Box>
|
|
87
|
+
</SimpleForm>
|
|
88
|
+
</Create>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Union Edit
|
|
93
|
+
export const UnionEdit = (props) => {
|
|
94
|
+
return (
|
|
95
|
+
<Edit {...props} redirect={false}>
|
|
96
|
+
<SimpleForm>
|
|
97
|
+
<Box sx={{ mb: 3 }}>
|
|
98
|
+
<Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
|
|
99
|
+
Edit Union
|
|
100
|
+
</Typography>
|
|
101
|
+
<Grid container spacing={3} sx={{ mb: 2 }}>
|
|
102
|
+
<Grid item xs={12} sm={6} md={4}>
|
|
103
|
+
<Box sx={{ p: 1 }}>
|
|
104
|
+
<TextInput source="Name" label="Name" validate={[required()]} fullWidth />
|
|
105
|
+
</Box>
|
|
106
|
+
</Grid>
|
|
107
|
+
</Grid>
|
|
108
|
+
</Box>
|
|
109
|
+
</SimpleForm>
|
|
110
|
+
</Edit>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export default {
|
|
115
|
+
list: UnionList,
|
|
116
|
+
show: UnionShow,
|
|
117
|
+
create: UnionCreate,
|
|
118
|
+
edit: UnionEdit,
|
|
119
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const [loading, setLoading] = React.useState(true);
|
|
2
|
+
const [conf, setConf] = React.useState({});
|
|
3
|
+
|
|
4
|
+
React.useEffect(() => {
|
|
5
|
+
const fetchData = async () => {
|
|
6
|
+
try {
|
|
7
|
+
console.log('loading HomeConf-1')
|
|
8
|
+
const conf = await loadHomeConf()
|
|
9
|
+
setConf(conf)
|
|
10
|
+
setLoading(false);
|
|
11
|
+
console.log('AppConf0: ', conf);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error('Error fetching data:', error);
|
|
14
|
+
sessionStorage.removeItem("raSpa");
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
fetchData();
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
if (loading) {
|
|
21
|
+
return <Loading loadingPrimary="Loading..." loadingSecondary="Please wait" />;
|
|
22
|
+
}
|
|
23
|
+
//conf = useConf();
|
|
24
|
+
const dataProvider = jsonapiClient(conf.api_root, { conf: {} }, null);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { safrsErrorHandler, HttpErrorHandler } from './errors';
|
|
2
|
+
import { includeRelations } from './ra-jsonapi-client';
|
|
3
|
+
|
|
4
|
+
export const defaultSettings: settings = {
|
|
5
|
+
total: 'total',
|
|
6
|
+
headers: {
|
|
7
|
+
Accept: 'application/vnd.api+json; charset=utf-8',
|
|
8
|
+
'Content-Type': 'application/vnd.api+json; charset=utf-8'
|
|
9
|
+
},
|
|
10
|
+
updateMethod: 'PATCH',
|
|
11
|
+
arrayFormat: 'brackets',
|
|
12
|
+
includeRelations: [],
|
|
13
|
+
errorHandler: safrsErrorHandler,
|
|
14
|
+
endpointToTypeStripLastLetters: ['Model', 's'] // update/create type: UserModel -> User, Users -> User
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
interface settings {
|
|
18
|
+
total: string;
|
|
19
|
+
headers: {};
|
|
20
|
+
updateMethod: string;
|
|
21
|
+
arrayFormat: string;
|
|
22
|
+
includeRelations: includeRelations[];
|
|
23
|
+
errorHandler: HttpErrorHandler;
|
|
24
|
+
endpointToTypeStripLastLetters?: string[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { safrsErrorHandler, HttpErrorHandler } from './errors';
|
|
2
|
+
import { includeRelations } from './ra-jsonapi-client';
|
|
3
|
+
|
|
4
|
+
export const defaultSettings: settings = {
|
|
5
|
+
total: 'total',
|
|
6
|
+
headers: {
|
|
7
|
+
Accept: 'application/vnd.api+json; charset=utf-8',
|
|
8
|
+
'Content-Type': 'application/vnd.api+json; charset=utf-8'
|
|
9
|
+
},
|
|
10
|
+
updateMethod: 'PATCH',
|
|
11
|
+
arrayFormat: 'brackets',
|
|
12
|
+
includeRelations: [],
|
|
13
|
+
errorHandler: safrsErrorHandler,
|
|
14
|
+
endpointToTypeStripLastLetters: ['Model', 's'] // update/create type: UserModel -> User, Users -> User
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
interface settings {
|
|
18
|
+
total: string;
|
|
19
|
+
headers: {};
|
|
20
|
+
updateMethod: string;
|
|
21
|
+
arrayFormat: string;
|
|
22
|
+
includeRelations: includeRelations[];
|
|
23
|
+
errorHandler: HttpErrorHandler;
|
|
24
|
+
endpointToTypeStripLastLetters?: string[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { HttpError, useNotify } from "react-admin";
|
|
2
|
+
|
|
3
|
+
export class NotImplementedError extends Error {
|
|
4
|
+
constructor(message: string) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.message = message;
|
|
7
|
+
this.name = "NotImplementedError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class SafrsHttpError extends HttpError {
|
|
12
|
+
constructor(message: string, status: number, body: any) {
|
|
13
|
+
super(message, status, body);
|
|
14
|
+
this.name = "SafrsHttpError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const safrsErrorHandler: HttpErrorHandler = (
|
|
19
|
+
httpError: HttpError
|
|
20
|
+
): HttpError => {
|
|
21
|
+
/* Example Safrs Error message
|
|
22
|
+
{
|
|
23
|
+
"errors": [
|
|
24
|
+
{
|
|
25
|
+
"title": "Request forbidden -- authorization will not help",
|
|
26
|
+
"detail": "",
|
|
27
|
+
"code": "403"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
} */
|
|
31
|
+
interface err {
|
|
32
|
+
title?: string;
|
|
33
|
+
detail?: string;
|
|
34
|
+
code?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
Example Safrs Error message
|
|
39
|
+
{"errors": [
|
|
40
|
+
{
|
|
41
|
+
"title": "Generic Error: Invalid Relationship 'REL'",
|
|
42
|
+
"detail": "Generic Error: Invalid Relationship 'REL'",
|
|
43
|
+
"code": "400"}]
|
|
44
|
+
}
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
const errors: { errors: err[] } = httpError.body || httpError.message?.body; // JSON.parse(httpError.body.stringify);
|
|
48
|
+
console.warn("safrsErrorHandler", httpError)
|
|
49
|
+
console.warn("safrsErrorHandler errors", errors)
|
|
50
|
+
console.warn("safrsErrorHandler body, status", httpError.body, httpError.status);
|
|
51
|
+
console.warn("safrsErrorHandler2", errors);
|
|
52
|
+
if (errors?.errors?.length > 0) {
|
|
53
|
+
console.warn(`Data error ${errors.errors[0].title}`);
|
|
54
|
+
|
|
55
|
+
return new SafrsHttpError(
|
|
56
|
+
errors.errors[0].title || errors.errors[0].detail || "Unknown Error",
|
|
57
|
+
httpError.status,
|
|
58
|
+
errors.errors[0].code
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log("safrsErrorHandler - not a safrs error", errors);
|
|
63
|
+
|
|
64
|
+
if(httpError.status === 403){
|
|
65
|
+
return new SafrsHttpError(
|
|
66
|
+
"Request forbidden -- authorization will not help",
|
|
67
|
+
httpError.status,
|
|
68
|
+
""
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if(httpError.status === 422 || httpError.status === 422){
|
|
73
|
+
// Change 422 to 403 to prevent the make react-admin redirect to the login page
|
|
74
|
+
return new SafrsHttpError(
|
|
75
|
+
"422 - Request forbidden -- auth error " +JSON.stringify(httpError.body),
|
|
76
|
+
403,
|
|
77
|
+
""
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if(httpError.status === 401){
|
|
82
|
+
// Change 422 to 403 to prevent the make react-admin redirect to the login page
|
|
83
|
+
return new SafrsHttpError(
|
|
84
|
+
"401 - Unauthorized " +JSON.stringify(httpError.body),
|
|
85
|
+
401,
|
|
86
|
+
""
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if(httpError.status === 600){
|
|
91
|
+
// Custom WG error message when the backend is starting up but not ready yet
|
|
92
|
+
return new SafrsHttpError(
|
|
93
|
+
httpError.body.message,
|
|
94
|
+
600,
|
|
95
|
+
httpError.body
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if(httpError.body){
|
|
100
|
+
return new SafrsHttpError(
|
|
101
|
+
httpError.body.message,
|
|
102
|
+
httpError.status,
|
|
103
|
+
httpError.body
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return new SafrsHttpError(
|
|
108
|
+
"Unknown Error..",
|
|
109
|
+
httpError.status,
|
|
110
|
+
"")
|
|
111
|
+
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export interface HttpErrorHandler {
|
|
115
|
+
(httpError: HttpError): HttpError;
|
|
116
|
+
}
|