ApiLogicServer 15.0.26__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.
Files changed (131) hide show
  1. api_logic_server_cli/api_logic_server.py +2 -2
  2. api_logic_server_cli/api_logic_server_info.yaml +3 -3
  3. api_logic_server_cli/cli.py +1 -1
  4. api_logic_server_cli/genai/genai_admin_app.py +11 -6
  5. api_logic_server_cli/genai/genai_svcs.py +3 -3
  6. api_logic_server_cli/logging.yml +16 -1
  7. api_logic_server_cli/prototypes/.DS_Store +0 -0
  8. api_logic_server_cli/prototypes/basic_demo/.DS_Store +0 -0
  9. api_logic_server_cli/prototypes/basic_demo/customizations/.DS_Store +0 -0
  10. api_logic_server_cli/prototypes/basic_demo/customizations/ui/.DS_Store +0 -0
  11. api_logic_server_cli/prototypes/basic_demo/customizations/ui/admin/.DS_Store +0 -0
  12. api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/.DS_Store +0 -0
  13. api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/README.md +0 -2
  14. api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/package.json +3 -0
  15. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/App.js +61 -0
  16. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/Config-reference.js +527 -0
  17. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/Config.js +527 -0
  18. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/Customer-reference.js +216 -0
  19. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/Customer.js +230 -0
  20. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/Item.js +170 -0
  21. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/Order.js +207 -0
  22. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/Product.js +140 -0
  23. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/SysEmail.js +157 -0
  24. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/SysMcp.js +110 -0
  25. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/app_loader.js +24 -0
  26. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/.eslintrc +5 -0
  27. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/.yarnrc.yml +4 -0
  28. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/default-settings.js +25 -0
  29. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/default-settings.ts +25 -0
  30. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/errors.js +116 -0
  31. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/errors.ts +116 -0
  32. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/index.test.tsx +7 -0
  33. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/index.tsx +11 -0
  34. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/ra-jsonapi-client.js +577 -0
  35. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/ra-jsonapi-client.ts +577 -0
  36. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.js +124 -0
  37. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.ts +124 -0
  38. api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/styles.module.css +9 -0
  39. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md +2 -2
  40. api_logic_server_cli/prototypes/nw/ui/.DS_Store +0 -0
  41. api_logic_server_cli/prototypes/nw/ui/reference_react_app/.DS_Store +0 -0
  42. api_logic_server_cli/prototypes/nw/ui/reference_react_app/README.md +17 -0
  43. api_logic_server_cli/prototypes/nw/ui/reference_react_app/README_create_react_app.md +70 -0
  44. api_logic_server_cli/prototypes/nw/ui/reference_react_app/compile-errors.txt +324 -0
  45. api_logic_server_cli/prototypes/nw/ui/reference_react_app/package-lock.json +18493 -0
  46. api_logic_server_cli/prototypes/nw/ui/reference_react_app/package.json +47 -0
  47. api_logic_server_cli/prototypes/nw/ui/reference_react_app/public/favicon.ico +0 -0
  48. api_logic_server_cli/prototypes/nw/ui/reference_react_app/public/index.html +43 -0
  49. api_logic_server_cli/prototypes/nw/ui/reference_react_app/public/logo192.png +0 -0
  50. api_logic_server_cli/prototypes/nw/ui/reference_react_app/public/logo512.png +0 -0
  51. api_logic_server_cli/prototypes/nw/ui/reference_react_app/public/manifest.json +25 -0
  52. api_logic_server_cli/prototypes/nw/ui/reference_react_app/public/robots.txt +3 -0
  53. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/App.css +38 -0
  54. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/App.js +147 -0
  55. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/App.test.js +8 -0
  56. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Category.js +141 -0
  57. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Config.js +527 -0
  58. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Customer.js +193 -0
  59. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/CustomerDemographic.js +119 -0
  60. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Department.js +144 -0
  61. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Employee.js +213 -0
  62. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/EmployeeAudit.js +223 -0
  63. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/EmployeeTerritory.js +94 -0
  64. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Location.js +170 -0
  65. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Order.js +179 -0
  66. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/OrderDetail.js +201 -0
  67. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Product.js +226 -0
  68. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Region.js +104 -0
  69. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Shipper.js +120 -0
  70. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Supplier.js +143 -0
  71. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Territory.js +145 -0
  72. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/Union.js +119 -0
  73. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/app_loader.js +24 -0
  74. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/index.css +13 -0
  75. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/index.js +17 -0
  76. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/logo.svg +1 -0
  77. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/.eslintrc +5 -0
  78. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/.yarnrc.yml +4 -0
  79. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/default-settings.js +25 -0
  80. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/default-settings.ts +25 -0
  81. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/errors.js +116 -0
  82. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/errors.ts +116 -0
  83. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/index.test.tsx +7 -0
  84. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/index.tsx +11 -0
  85. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/ra-jsonapi-client.js +577 -0
  86. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/ra-jsonapi-client.ts +577 -0
  87. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.js +124 -0
  88. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.ts +124 -0
  89. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/rav4-jsonapi-client/styles.module.css +9 -0
  90. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/reportWebVitals.js +13 -0
  91. api_logic_server_cli/prototypes/nw/ui/reference_react_app/src/setupTests.js +5 -0
  92. {apilogicserver-15.0.26.dist-info → apilogicserver-15.0.28.dist-info}/METADATA +1 -1
  93. {apilogicserver-15.0.26.dist-info → apilogicserver-15.0.28.dist-info}/RECORD +114 -52
  94. api_logic_server_cli/prototypes/nw/ui/react_admin/src/App.js +0 -58
  95. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Category.js +0 -82
  96. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Customer.js +0 -211
  97. api_logic_server_cli/prototypes/nw/ui/react_admin/src/CustomerDemographic.js +0 -57
  98. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Department.js +0 -98
  99. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Employee.js +0 -100
  100. api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeAudit.js +0 -106
  101. api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeTerritory.js +0 -98
  102. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Location.js +0 -87
  103. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Order.js +0 -98
  104. api_logic_server_cli/prototypes/nw/ui/react_admin/src/OrderDetail.js +0 -112
  105. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Product.js +0 -103
  106. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Region.js +0 -65
  107. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Shipper.js +0 -67
  108. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Supplier.js +0 -87
  109. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Territory.js +0 -90
  110. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Union.js +0 -61
  111. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/README_create_react_app.md +0 -0
  112. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/package-lock.json +0 -0
  113. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/public/favicon.ico +0 -0
  114. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/public/index.html +0 -0
  115. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/public/logo192.png +0 -0
  116. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/public/logo512.png +0 -0
  117. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/public/manifest.json +0 -0
  118. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/public/robots.txt +0 -0
  119. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/src/App.css +0 -0
  120. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/src/App.test.js +0 -0
  121. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/src/index.css +0 -0
  122. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/src/index.js +0 -0
  123. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/src/logo.svg +0 -0
  124. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/src/reportWebVitals.js +0 -0
  125. /api_logic_server_cli/prototypes/{nw/ui/react_admin → basic_demo/customizations/ui/reference_react_app}/src/setupTests.js +0 -0
  126. /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/SampleDBVersion.js +0 -0
  127. /api_logic_server_cli/prototypes/nw/ui/{react_admin → reference_react_app}/src/dataProvider.js +0 -0
  128. {apilogicserver-15.0.26.dist-info → apilogicserver-15.0.28.dist-info}/WHEEL +0 -0
  129. {apilogicserver-15.0.26.dist-info → apilogicserver-15.0.28.dist-info}/entry_points.txt +0 -0
  130. {apilogicserver-15.0.26.dist-info → apilogicserver-15.0.28.dist-info}/licenses/LICENSE +0 -0
  131. {apilogicserver-15.0.26.dist-info → apilogicserver-15.0.28.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,216 @@
1
+
2
+ // begin MANDATORY imports (always generated EXACTLY)
3
+ import React from 'react';
4
+ import { List, FunctionField, Datagrid, TextField, DateField, NumberField } from 'react-admin';
5
+ import { ReferenceField, ReferenceManyField } from 'react-admin';
6
+ import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
7
+ import { ReferenceInput, SelectInput, SimpleForm, Show, Edit, Create } from 'react-admin';
8
+ import { Filter, Pagination, BooleanField, BooleanInput, Labeled } from 'react-admin';
9
+ import { EditButton, DeleteButton, CreateButton } from 'react-admin';
10
+ import { Grid, Typography, Box, Divider, Button } from '@mui/material';
11
+ import { useRecordContext, useRedirect, Link, required } from 'react-admin';
12
+ import AddIcon from '@mui/icons-material/Add';
13
+ // end mandatory imports
14
+
15
+ // generate pages and components...
16
+
17
+ const CustomerFilter = (props) => (
18
+ <Filter {...props}>
19
+ <TextInput label="Search" source="name" alwaysOn />
20
+ <BooleanInput label="Email Opt Out" source="email_opt_out" />
21
+ </Filter>
22
+ );
23
+
24
+ // Customer List
25
+ export const CustomerList = (props) => (
26
+ <List filters={<CustomerFilter />} {...props} sort={{ field: 'name', order: 'ASC' }} pagination={<Pagination rowsPerPageOptions={[5, 10, 25]} showFirstLastButtons />}>
27
+ <Datagrid rowClick="show">
28
+ <TextField source="name" label="Name" />
29
+ <NumberField source="balance" label="Balance" options={{ style: 'currency', currency: 'USD' }} />
30
+ <NumberField source="credit_limit" label="Credit Limit" options={{ style: 'currency', currency: 'USD' }} />
31
+ <TextField source="email" label="Email" />
32
+ <BooleanField source="email_opt_out" label="Email Opt Out" />
33
+ </Datagrid>
34
+ </List>
35
+ );
36
+
37
+ // Custom Add Order Button
38
+ const AddOrderButton = () => {
39
+ const record = useRecordContext();
40
+ const redirect = useRedirect();
41
+
42
+ const handleClick = () => {
43
+ redirect(`/Order/create?source=${encodeURIComponent(JSON.stringify({ customer_id: record?.id }))}`);
44
+ };
45
+
46
+ return (
47
+ <Button
48
+ variant="contained"
49
+ color="primary"
50
+ startIcon={<AddIcon />}
51
+ onClick={handleClick}
52
+ sx={{ mt: 2 }}
53
+ >
54
+ Add New Order
55
+ </Button>
56
+ );
57
+ };
58
+
59
+ // Customer Show
60
+ export const CustomerShow = (props) => (
61
+ <Show {...props}>
62
+ <SimpleShowLayout>
63
+ <Box sx={{ mb: 3 }}>
64
+ <Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
65
+ Customer Information
66
+ </Typography>
67
+ <Grid container spacing={3} sx={{ mb: 2 }}>
68
+ <Grid item xs={12} sm={6} md={3}>
69
+ <Box sx={{ p: 1 }}>
70
+ <Labeled label="Name">
71
+ <TextField source="name" />
72
+ </Labeled>
73
+ </Box>
74
+ </Grid>
75
+ <Grid item xs={12} sm={6} md={3}>
76
+ <Box sx={{ p: 1 }}>
77
+ <Labeled label="Balance">
78
+ <NumberField source="balance" options={{ style: 'currency', currency: 'USD' }} />
79
+ </Labeled>
80
+ </Box>
81
+ </Grid>
82
+ <Grid item xs={12} sm={6} md={3}>
83
+ <Box sx={{ p: 1 }}>
84
+ <Labeled label="Credit Limit">
85
+ <NumberField source="credit_limit" options={{ style: 'currency', currency: 'USD' }} />
86
+ </Labeled>
87
+ </Box>
88
+ </Grid>
89
+ <Grid item xs={12} sm={6} md={3}>
90
+ <Box sx={{ p: 1 }}>
91
+ <Labeled label="Email">
92
+ <TextField source="email" />
93
+ </Labeled>
94
+ </Box>
95
+ </Grid>
96
+ </Grid>
97
+ <Divider sx={{ my: 2 }} />
98
+ </Box>
99
+ </SimpleShowLayout>
100
+ <TabbedShowLayout>
101
+ <Tab label="Orders">
102
+ <ReferenceManyField reference="Order" target="customer_id" addLabel={false} pagination={<Pagination />}>
103
+ <Datagrid>
104
+ <TextField source="id" label="Order ID" />
105
+ <TextField source="notes" label="Notes" />
106
+ <DateField source="CreatedOn" label="Created On" />
107
+ <NumberField source="amount_total" label="Amount Total" options={{ style: 'currency', currency: 'USD' }} />
108
+ <DateField source="date_shipped" label="Date Shipped" />
109
+ <EditButton />
110
+ <DeleteButton />
111
+ </Datagrid>
112
+ </ReferenceManyField>
113
+ <AddOrderButton />
114
+ </Tab>
115
+ <Tab label="Emails">
116
+ <ReferenceManyField reference="SysEmail" target="customer_id" addLabel={false} pagination={<Pagination />}>
117
+ <Datagrid>
118
+ <TextField source="id" label="Email ID" />
119
+ <TextField source="subject" label="Subject" />
120
+ <TextField source="message" label="Message" />
121
+ <DateField source="CreatedOn" label="Created On" />
122
+ <EditButton />
123
+ <DeleteButton />
124
+ </Datagrid>
125
+ </ReferenceManyField>
126
+ </Tab>
127
+ </TabbedShowLayout>
128
+ </Show>
129
+ );
130
+
131
+ // Customer Create
132
+ export const CustomerCreate = (props) => (
133
+ <Create {...props}>
134
+ <SimpleForm>
135
+ <Box sx={{ mb: 3 }}>
136
+ <Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
137
+ Create New Customer
138
+ </Typography>
139
+ <Grid container spacing={3} sx={{ mb: 2 }}>
140
+ <Grid item xs={12} sm={6} md={4}>
141
+ <Box sx={{ p: 1 }}>
142
+ <TextInput source="name" label="Name" fullWidth validate={required()} />
143
+ </Box>
144
+ </Grid>
145
+ <Grid item xs={12} sm={6} md={4}>
146
+ <Box sx={{ p: 1 }}>
147
+ <NumberInput source="balance" label="Balance" fullWidth />
148
+ </Box>
149
+ </Grid>
150
+ <Grid item xs={12} sm={6} md={4}>
151
+ <Box sx={{ p: 1 }}>
152
+ <NumberInput source="credit_limit" label="Credit Limit" fullWidth />
153
+ </Box>
154
+ </Grid>
155
+ <Grid item xs={12} sm={6} md={4}>
156
+ <Box sx={{ p: 1 }}>
157
+ <TextInput source="email" label="Email" fullWidth />
158
+ </Box>
159
+ </Grid>
160
+ <Grid item xs={12} sm={6} md={4}>
161
+ <Box sx={{ p: 1 }}>
162
+ <BooleanInput source="email_opt_out" label="Email Opt Out" />
163
+ </Box>
164
+ </Grid>
165
+ </Grid>
166
+ </Box>
167
+ </SimpleForm>
168
+ </Create>
169
+ );
170
+
171
+ // Customer Edit
172
+ export const CustomerEdit = (props) => (
173
+ <Edit {...props} redirect={false}>
174
+ <SimpleForm>
175
+ <Box sx={{ mb: 3 }}>
176
+ <Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
177
+ Edit Customer
178
+ </Typography>
179
+ <Grid container spacing={3} sx={{ mb: 2 }}>
180
+ <Grid item xs={12} sm={6} md={4}>
181
+ <Box sx={{ p: 1 }}>
182
+ <TextInput source="name" label="Name" fullWidth validate={required()} />
183
+ </Box>
184
+ </Grid>
185
+ <Grid item xs={12} sm={6} md={4}>
186
+ <Box sx={{ p: 1 }}>
187
+ <NumberInput source="balance" label="Balance" fullWidth />
188
+ </Box>
189
+ </Grid>
190
+ <Grid item xs={12} sm={6} md={4}>
191
+ <Box sx={{ p: 1 }}>
192
+ <NumberInput source="credit_limit" label="Credit Limit" fullWidth />
193
+ </Box>
194
+ </Grid>
195
+ <Grid item xs={12} sm={6} md={4}>
196
+ <Box sx={{ p: 1 }}>
197
+ <TextInput source="email" label="Email" fullWidth />
198
+ </Box>
199
+ </Grid>
200
+ <Grid item xs={12} sm={6} md={4}>
201
+ <Box sx={{ p: 1 }}>
202
+ <BooleanInput source="email_opt_out" label="Email Opt Out" />
203
+ </Box>
204
+ </Grid>
205
+ </Grid>
206
+ </Box>
207
+ </SimpleForm>
208
+ </Edit>
209
+ );
210
+
211
+ export default {
212
+ list: CustomerList,
213
+ show: CustomerShow,
214
+ create: CustomerCreate,
215
+ edit: CustomerEdit,
216
+ };
@@ -0,0 +1,230 @@
1
+ // begin MANDATORY imports (always generated EXACTLY)
2
+ import React from 'react';
3
+ import { List, FunctionField, Datagrid, TextField, 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 } 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 CustomerFilter = (props) => (
15
+ <Filter {...props}>
16
+ <TextInput label="Search" source="name" alwaysOn />
17
+ <BooleanInput label="Email Opt Out" source="email_opt_out" />
18
+ </Filter>
19
+ );
20
+
21
+ // Customer List
22
+ export const CustomerList = (props) => {
23
+ return (
24
+ <List filters={<CustomerFilter />} {...props} sort={{ field: 'name', order: 'ASC' }} pagination={<Pagination rowsPerPageOptions={[5, 10, 25]} showFirstLastButtons />}>
25
+ <Datagrid rowClick="show">
26
+ <TextField source="name" label="Name" />
27
+ <NumberField source="balance" label="Balance" />
28
+ <NumberField source="credit_limit" label="Credit Limit" />
29
+ <TextField source="email" label="Email" />
30
+ <BooleanField source="email_opt_out" label="Email Opt Out" />
31
+ <EditButton />
32
+ <DeleteButton />
33
+ </Datagrid>
34
+ </List>
35
+ );
36
+ };
37
+
38
+ // Custom Add Order Button
39
+ const AddOrderButton = () => {
40
+ const record = useRecordContext();
41
+ const redirect = useRedirect();
42
+
43
+ const handleClick = () => {
44
+ redirect(`/Order/create?source=${encodeURIComponent(JSON.stringify({ customer_id: record?.id }))}`);
45
+ };
46
+
47
+ return (
48
+ <Button
49
+ variant="contained"
50
+ color="primary"
51
+ startIcon={<AddIcon />}
52
+ onClick={handleClick}
53
+ sx={{ mt: 2 }}
54
+ >
55
+ Add New Order
56
+ </Button>
57
+ );
58
+ };
59
+
60
+ // Customer Show
61
+ export const CustomerShow = (props) => {
62
+ return (
63
+ <Show {...props}>
64
+ <SimpleShowLayout>
65
+ <Box sx={{ mb: 3 }}>
66
+ <Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
67
+ Customer Information
68
+ </Typography>
69
+ <Grid container spacing={3} sx={{ mb: 2 }}>
70
+ <Grid item xs={12} sm={6} md={3}>
71
+ <Box sx={{ p: 1 }}>
72
+ <Labeled label="Name">
73
+ <TextField source="name" />
74
+ </Labeled>
75
+ </Box>
76
+ </Grid>
77
+ <Grid item xs={12} sm={6} md={3}>
78
+ <Box sx={{ p: 1 }}>
79
+ <Labeled label="Balance">
80
+ <NumberField source="balance" options={{ style: 'currency', currency: 'USD' }} />
81
+ </Labeled>
82
+ </Box>
83
+ </Grid>
84
+ <Grid item xs={12} sm={6} md={3}>
85
+ <Box sx={{ p: 1 }}>
86
+ <Labeled label="Credit Limit">
87
+ <NumberField source="credit_limit" options={{ style: 'currency', currency: 'USD' }} />
88
+ </Labeled>
89
+ </Box>
90
+ </Grid>
91
+ <Grid item xs={12} sm={6} md={3}>
92
+ <Box sx={{ p: 1 }}>
93
+ <Labeled label="Email">
94
+ <TextField source="email" />
95
+ </Labeled>
96
+ </Box>
97
+ </Grid>
98
+ <Grid item xs={12} sm={6} md={3}>
99
+ <Box sx={{ p: 1 }}>
100
+ <Labeled label="Email Opt Out">
101
+ <BooleanField source="email_opt_out" />
102
+ </Labeled>
103
+ </Box>
104
+ </Grid>
105
+ </Grid>
106
+ <Divider sx={{ my: 2 }} />
107
+ </Box>
108
+ </SimpleShowLayout>
109
+ <TabbedShowLayout>
110
+ <Tab label="Orders">
111
+ <ReferenceManyField reference="Order" target="customer_id" addLabel={false} pagination={<Pagination />} meta={{ include: ['ItemList'] }}>
112
+ <Datagrid rowClick="show">
113
+ <TextField source="id" label="Order ID" />
114
+ <TextField source="notes" label="Notes" />
115
+ <DateField source="CreatedOn" label="Created On" />
116
+ <NumberField source="amount_total" label="Amount Total" options={{ style: 'currency', currency: 'USD' }} />
117
+ <DateField source="date_shipped" label="Date Shipped" />
118
+ <EditButton />
119
+ <DeleteButton />
120
+ </Datagrid>
121
+ </ReferenceManyField>
122
+ <AddOrderButton />
123
+ </Tab>
124
+ <Tab label="System Emails">
125
+ <ReferenceManyField reference="SysEmail" target="customer_id" addLabel={false} pagination={<Pagination />}>
126
+ <Datagrid rowClick="show">
127
+ <TextField source="id" label="Email ID" />
128
+ <TextField source="subject" label="Subject" />
129
+ <TextField source="message" label="Message" />
130
+ <DateField source="CreatedOn" label="Sent On" />
131
+ <EditButton />
132
+ <DeleteButton />
133
+ </Datagrid>
134
+ </ReferenceManyField>
135
+ </Tab>
136
+ </TabbedShowLayout>
137
+ </Show>
138
+ );
139
+ };
140
+
141
+ // Customer Create
142
+ export const CustomerCreate = (props) => {
143
+ return (
144
+ <Create {...props}>
145
+ <SimpleForm>
146
+ <Box sx={{ mb: 3 }}>
147
+ <Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
148
+ Create New Customer
149
+ </Typography>
150
+ <Grid container spacing={3} sx={{ mb: 2 }}>
151
+ <Grid item xs={12} sm={6} md={4}>
152
+ <Box sx={{ p: 1 }}>
153
+ <TextInput source="name" label="Name" fullWidth validate={required()} />
154
+ </Box>
155
+ </Grid>
156
+ <Grid item xs={12} sm={6} md={4}>
157
+ <Box sx={{ p: 1 }}>
158
+ <NumberInput source="balance" label="Balance" fullWidth />
159
+ </Box>
160
+ </Grid>
161
+ <Grid item xs={12} sm={6} md={4}>
162
+ <Box sx={{ p: 1 }}>
163
+ <NumberInput source="credit_limit" label="Credit Limit" fullWidth />
164
+ </Box>
165
+ </Grid>
166
+ <Grid item xs={12} sm={6} md={4}>
167
+ <Box sx={{ p: 1 }}>
168
+ <TextInput source="email" label="Email" fullWidth />
169
+ </Box>
170
+ </Grid>
171
+ <Grid item xs={12} sm={6} md={4}>
172
+ <Box sx={{ p: 1 }}>
173
+ <BooleanInput source="email_opt_out" label="Email Opt Out" fullWidth />
174
+ </Box>
175
+ </Grid>
176
+ </Grid>
177
+ </Box>
178
+ </SimpleForm>
179
+ </Create>
180
+ );
181
+ };
182
+
183
+ // Customer Edit
184
+ export const CustomerEdit = (props) => {
185
+ return (
186
+ <Edit {...props} redirect={false}>
187
+ <SimpleForm>
188
+ <Box sx={{ mb: 3 }}>
189
+ <Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
190
+ Edit Customer
191
+ </Typography>
192
+ <Grid container spacing={3} sx={{ mb: 2 }}>
193
+ <Grid item xs={12} sm={6} md={4}>
194
+ <Box sx={{ p: 1 }}>
195
+ <TextInput source="name" label="Name" fullWidth validate={required()} />
196
+ </Box>
197
+ </Grid>
198
+ <Grid item xs={12} sm={6} md={4}>
199
+ <Box sx={{ p: 1 }}>
200
+ <NumberInput source="balance" label="Balance" fullWidth />
201
+ </Box>
202
+ </Grid>
203
+ <Grid item xs={12} sm={6} md={4}>
204
+ <Box sx={{ p: 1 }}>
205
+ <NumberInput source="credit_limit" label="Credit Limit" fullWidth />
206
+ </Box>
207
+ </Grid>
208
+ <Grid item xs={12} sm={6} md={4}>
209
+ <Box sx={{ p: 1 }}>
210
+ <TextInput source="email" label="Email" fullWidth />
211
+ </Box>
212
+ </Grid>
213
+ <Grid item xs={12} sm={6} md={4}>
214
+ <Box sx={{ p: 1 }}>
215
+ <BooleanInput source="email_opt_out" label="Email Opt Out" fullWidth />
216
+ </Box>
217
+ </Grid>
218
+ </Grid>
219
+ </Box>
220
+ </SimpleForm>
221
+ </Edit>
222
+ );
223
+ };
224
+
225
+ export default {
226
+ list: CustomerList,
227
+ show: CustomerShow,
228
+ create: CustomerCreate,
229
+ edit: CustomerEdit,
230
+ };
@@ -0,0 +1,170 @@
1
+ // begin MANDATORY imports (always generated EXACTLY)
2
+ import React from 'react';
3
+ import { List, FunctionField, Datagrid, TextField, 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 } 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 ItemFilter = (props) => (
15
+ <Filter {...props}>
16
+ <TextInput label="Search ID" source="id" alwaysOn />
17
+ </Filter>
18
+ );
19
+
20
+ // Item List
21
+ export const ItemList = (props) => {
22
+ return (
23
+ <List filters={<ItemFilter />} {...props} pagination={<Pagination rowsPerPageOptions={[5, 10, 25]} showFirstLastButtons />}>
24
+ <Datagrid rowClick="show">
25
+ <TextField source="id" label="ID" />
26
+ <ReferenceField source="order_id" reference="Order" label="Order">
27
+ <TextField source="id" />
28
+ </ReferenceField>
29
+ <ReferenceField source="product_id" reference="Product" label="Product">
30
+ <TextField source="name" />
31
+ </ReferenceField>
32
+ <NumberField source="quantity" label="Quantity" />
33
+ <NumberField source="amount" label="Amount" options={{ style: 'currency', currency: 'USD' }} />
34
+ <NumberField source="unit_price" label="Unit Price" options={{ style: 'currency', currency: 'USD' }} />
35
+ <EditButton />
36
+ <DeleteButton />
37
+ </Datagrid>
38
+ </List>
39
+ );
40
+ };
41
+
42
+ // Item Create
43
+ export const ItemCreate = (props) => {
44
+ return (
45
+ <Create {...props}>
46
+ <SimpleForm>
47
+ <ReferenceInput source="order_id" reference="Order" fullWidth>
48
+ <SelectInput optionText="id" validate={required()} />
49
+ </ReferenceInput>
50
+ <ReferenceInput source="product_id" reference="Product" fullWidth>
51
+ <SelectInput optionText="name" validate={required()} />
52
+ </ReferenceInput>
53
+ <NumberInput source="quantity" label="Quantity" fullWidth validate={required()} />
54
+ <NumberInput source="amount" label="Amount" fullWidth />
55
+ <NumberInput source="unit_price" label="Unit Price" fullWidth />
56
+ </SimpleForm>
57
+ </Create>
58
+ );
59
+ };
60
+
61
+ // Item Edit
62
+ export const ItemEdit = (props) => {
63
+ return (
64
+ <Edit {...props} redirect={false}>
65
+ <SimpleForm>
66
+ <ReferenceInput source="order_id" reference="Order" fullWidth>
67
+ <SelectInput optionText="id" validate={required()} />
68
+ </ReferenceInput>
69
+ <ReferenceInput source="product_id" reference="Product" fullWidth>
70
+ <SelectInput optionText="name" validate={required()} />
71
+ </ReferenceInput>
72
+ <NumberInput source="quantity" label="Quantity" fullWidth validate={required()} />
73
+ <NumberInput source="amount" label="Amount" fullWidth />
74
+ <NumberInput source="unit_price" label="Unit Price" fullWidth />
75
+ </SimpleForm>
76
+ </Edit>
77
+ );
78
+ };
79
+
80
+ // Item Show
81
+ export const ItemShow = (props) => {
82
+ return (
83
+ <Show {...props}>
84
+ <SimpleShowLayout>
85
+ <Box sx={{ mb: 3 }}>
86
+ <Typography variant="h5" component="h2" sx={{ mb: 2, fontWeight: 'bold' }}>
87
+ Item Details
88
+ </Typography>
89
+ <Grid container spacing={3} sx={{ mb: 2 }}>
90
+ <Grid item xs={12} sm={6} md={4}>
91
+ <Box sx={{ p: 1 }}>
92
+ <Labeled label="ID">
93
+ <TextField source="id" />
94
+ </Labeled>
95
+ </Box>
96
+ </Grid>
97
+ <Grid item xs={12} sm={6} md={4}>
98
+ <Box sx={{ p: 1 }}>
99
+ <Labeled label="Order">
100
+ <ReferenceField source="order_id" reference="Order">
101
+ <TextField source="id" />
102
+ </ReferenceField>
103
+ </Labeled>
104
+ </Box>
105
+ </Grid>
106
+ <Grid item xs={12} sm={6} md={4}>
107
+ <Box sx={{ p: 1 }}>
108
+ <Labeled label="Product">
109
+ <ReferenceField source="product_id" reference="Product">
110
+ <TextField source="name" />
111
+ </ReferenceField>
112
+ </Labeled>
113
+ </Box>
114
+ </Grid>
115
+ <Grid item xs={12} sm={6} md={4}>
116
+ <Box sx={{ p: 1 }}>
117
+ <Labeled label="Quantity">
118
+ <NumberField source="quantity" />
119
+ </Labeled>
120
+ </Box>
121
+ </Grid>
122
+ <Grid item xs={12} sm={6} md={4}>
123
+ <Box sx={{ p: 1 }}>
124
+ <Labeled label="Amount">
125
+ <NumberField source="amount" options={{ style: 'currency', currency: 'USD' }} />
126
+ </Labeled>
127
+ </Box>
128
+ </Grid>
129
+ <Grid item xs={12} sm={6} md={4}>
130
+ <Box sx={{ p: 1 }}>
131
+ <Labeled label="Unit Price">
132
+ <NumberField source="unit_price" options={{ style: 'currency', currency: 'USD' }} />
133
+ </Labeled>
134
+ </Box>
135
+ </Grid>
136
+ </Grid>
137
+ </Box>
138
+ </SimpleShowLayout>
139
+ <TabbedShowLayout>
140
+ <Tab label="Order Details">
141
+ <ReferenceField source="order_id" reference="Order" fullWidth>
142
+ <SimpleShowLayout>
143
+ <TextField source="id" label="Order ID" />
144
+ <TextField source="notes" label="Notes" />
145
+ <DateField source="CreatedOn" label="Created On" />
146
+ <NumberField source="amount_total" label="Amount Total" options={{ style: 'currency', currency: 'USD' }} />
147
+ <DateField source="date_shipped" label="Date Shipped" />
148
+ </SimpleShowLayout>
149
+ </ReferenceField>
150
+ </Tab>
151
+ <Tab label="Product Details">
152
+ <ReferenceField source="product_id" reference="Product" fullWidth>
153
+ <SimpleShowLayout>
154
+ <TextField source="name" label="Product Name" />
155
+ <NumberField source="unit_price" label="Unit Price" options={{ style: 'currency', currency: 'USD' }} />
156
+ </SimpleShowLayout>
157
+ </ReferenceField>
158
+ </Tab>
159
+ </TabbedShowLayout>
160
+ </Show>
161
+ );
162
+ };
163
+
164
+ export default {
165
+ list: ItemList,
166
+ show: ItemShow,
167
+ create: ItemCreate,
168
+ edit: ItemEdit,
169
+ };
170
+