ApiLogicServer 15.0.19__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.
Files changed (32) hide show
  1. api_logic_server_cli/api_logic_server.py +4 -4
  2. api_logic_server_cli/api_logic_server_info.yaml +2 -2
  3. api_logic_server_cli/genai/genai_admin_app.py +12 -5
  4. api_logic_server_cli/prototypes/.DS_Store +0 -0
  5. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Learning-Prompt.md +33 -17
  6. api_logic_server_cli/prototypes/nw/.DS_Store +0 -0
  7. api_logic_server_cli/prototypes/nw/ui/.DS_Store +0 -0
  8. api_logic_server_cli/prototypes/nw/ui/react_admin/.DS_Store +0 -0
  9. api_logic_server_cli/prototypes/nw/ui/react_admin/src/App.js +30 -31
  10. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Category.js +62 -62
  11. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Customer.js +143 -48
  12. api_logic_server_cli/prototypes/nw/ui/react_admin/src/CustomerDemographic.js +20 -37
  13. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Department.js +38 -39
  14. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Employee.js +85 -134
  15. api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeAudit.js +89 -77
  16. api_logic_server_cli/prototypes/nw/ui/react_admin/src/EmployeeTerritory.js +59 -59
  17. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Location.js +45 -49
  18. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Order.js +42 -60
  19. api_logic_server_cli/prototypes/nw/ui/react_admin/src/OrderDetail.js +97 -106
  20. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Product.js +60 -62
  21. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Region.js +36 -41
  22. api_logic_server_cli/prototypes/nw/ui/react_admin/src/SampleDBVersion.js +73 -0
  23. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Shipper.js +57 -54
  24. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Supplier.js +71 -87
  25. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Territory.js +47 -41
  26. api_logic_server_cli/prototypes/nw/ui/react_admin/src/Union.js +18 -34
  27. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.20.dist-info}/METADATA +1 -1
  28. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.20.dist-info}/RECORD +32 -29
  29. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.20.dist-info}/WHEEL +0 -0
  30. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.20.dist-info}/entry_points.txt +0 -0
  31. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.20.dist-info}/licenses/LICENSE +0 -0
  32. {apilogicserver-15.0.19.dist-info → apilogicserver-15.0.20.dist-info}/top_level.txt +0 -0
@@ -12,10 +12,10 @@ ApiLogicServer CLI: given a database url, create [and run] customizable ApiLogic
12
12
  Called from api_logic_server_cli.py, by instantiating the ProjectRun object.
13
13
  '''
14
14
 
15
- __version__ = "15.00.19" # last public release: 15.00.19 (15.00.12)
15
+ __version__ = "15.00.20" # last public release: 15.00.19 (15.00.12)
16
16
  recent_changes = \
17
17
  f'\n\nRecent Changes:\n' +\
18
- "\t06/17/2024 - 15.00.19: Tech Preview: als genai-app \n"\
18
+ "\t06/19/2024 - 15.00.20: Tech Preview: als genai-app, import fix, bug [96] \n"\
19
19
  "\t06/10/2024 - 15.00.12: MCP Security, win fixes for readme, graphics quotes \n"\
20
20
  "\t06/08/2024 - 15.00.10: MCP, optional shortening of stacktrace lines, bugfix[92] \n"\
21
21
  "\t05/16/2024 - 14.05.00: safrs 3.1.7, running mcp preview \n"\
@@ -1174,7 +1174,7 @@ from database import <project.bind_key>_models
1174
1174
  @staticmethod
1175
1175
  def set_provider(from_value: str, to_value: str, config_file: str) -> None:
1176
1176
  """ update import statement to set provider type in config.py """
1177
- if from_value == to_value:
1177
+ if from_value == to_value or to_value == "None":
1178
1178
  pass
1179
1179
  # log.debug(f'.. .. (provider type unchanged)')
1180
1180
  else:
@@ -1243,7 +1243,7 @@ from database import <project.bind_key>_models
1243
1243
  provider_note = f"Setting security provider type = {self.auth_provider_type}, @server = {self.auth_db_url} \n"
1244
1244
  # f'(was: {was_provider_type}, {is_enabled_note})\n'
1245
1245
 
1246
- if self.auth_provider_type == 'none': # none means disable
1246
+ if self.auth_provider_type in ['none', 'None']: # none means disable
1247
1247
  if is_enabled:
1248
1248
  log.info(f'\n\n.. ..Disabling security for current provider type: {was_provider_type}\n')
1249
1249
  create_utils.assign_value_to_key_in_file(value=False,
@@ -1,3 +1,3 @@
1
- last_created_date: June 17, 2025 12:36:00
1
+ last_created_date: June 19, 2025 16:11:17
2
2
  last_created_project_name: ../../../servers/basic_demo
3
- last_created_version: 15.00.18
3
+ last_created_version: 15.00.19
@@ -77,7 +77,7 @@ class GenAIAdminApp:
77
77
 
78
78
  log.info(f"✅ Next Steps:\n")
79
79
  log.info('Start the API Logic Project: F5')
80
- log.info('> cd ui/react-admin')
80
+ log.info(f'> cd ui/{app_name}')
81
81
  log.info('> npm install')
82
82
  log.info('> npm start')
83
83
 
@@ -85,10 +85,13 @@ class GenAIAdminApp:
85
85
  def a_generate_resource_files(self):
86
86
 
87
87
  def fix_source(raw_source: str) -> str:
88
- ''' remove code occasional begin/end code markers '''
88
+ ''' Remove code occasional begin/end code markers <br>
89
+ ToDo: lint, and repeat generation if errors detected
90
+ '''
89
91
  source_lines = raw_source.splitlines()
90
- result_lines = []
91
- found_start_marker = False
92
+ result_lines = ["import React from 'react';",
93
+ "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 } from 'react-admin'; // mandatory import"]
94
+ found_from_react_admin = False
92
95
  for each_line in source_lines:
93
96
  if each_line.startswith("```"):
94
97
  if each_line.startswith("```jsx") or each_line.startswith("```javascript"):
@@ -96,7 +99,11 @@ class GenAIAdminApp:
96
99
  continue
97
100
  else:
98
101
  break
99
- result_lines.append(each_line)
102
+ if "from 'react-admin'" in each_line: # sigh: missing imports 20% of the time - override
103
+ found_from_react_admin = True
104
+ continue
105
+ if found_from_react_admin == True:
106
+ result_lines.append(each_line)
100
107
 
101
108
  # return source_lines as a string
102
109
  return "\n".join(result_lines)
Binary file
@@ -8,6 +8,7 @@ The result must be a runnable React app (`npm start`) that connects to the suppl
8
8
  ### Multi-Page
9
9
 
10
10
  For each resource:
11
+
11
12
  - Create a **List page** showing 7 user-friendly columns
12
13
  - Add **pagination**, **sorting**, and **filtering**
13
14
  - Link each row to a **Display (Show) page**
@@ -15,27 +16,33 @@ For each resource:
15
16
  ### Multi-Resource
16
17
 
17
18
  Each **Display Page** should:
19
+
18
20
  - Show all fields in a **multi-column layout**
19
21
  - Include a **tab sheet** (`<TabbedShowLayout>`) for each related resource using `<ReferenceManyField>`
20
22
  - Link child rows to their own display page
21
23
 
22
24
  Example:
25
+
23
26
  - Customer Display has tab for OrderList
27
+
24
28
  - The tab (with OrderList) is shown *below* all the Customer fields.
25
29
  - Each Order in the tab links to Order Display
26
30
 
27
31
  ### Automatic Joins
28
32
 
29
33
  For foreign keys:
34
+
30
35
  - Display joined value (e.g., `product.name` instead of `product_id`)
31
36
  - Use first string field from parent table containing `name`, `title`, or `description`
32
37
 
33
38
  Numeric Primary key fields:
39
+
34
40
  - Display at the end of forms/lists
35
41
 
36
42
  ### Lookups (Foreign Keys)
37
43
 
38
44
  For foreign key fields:
45
+
39
46
  - Provide auto-complete dropdown (`<ReferenceInput>`)
40
47
  - For numeric foreign keys, use the joined string field as lookup text
41
48
 
@@ -46,20 +53,23 @@ default the Foreign Key to the Parent (Master) Primary Key.
46
53
 
47
54
  ## Implementation
48
55
 
49
-
50
56
  ### Architecture
51
57
 
52
58
  - **Framework**: React 18 + react-admin 4.x
53
59
  - **Data Provider**: Custom `dataProvider.js` using `fetchUtils` (no external `ra-jsonapi-client`)
60
+
54
61
  - Must support: `getList`, `getOne`, `getMany`, `getManyReference`, `create`, `update`, `delete`
55
62
  - Must support: filters, joins, sorting, pagination
63
+
56
64
  - **Backend**: JSON:API per `mcp_discovery.json`
57
65
  - **CORS**: Ensure API allows `http://localhost:3000`
58
- ```py
66
+
67
+ ```py
59
68
  from flask_cors import CORS
60
69
  CORS(app, origins='*') # or restrict to localhost:3000
61
- ```
70
+ ```
62
71
  - **Project Setup**:
72
+
63
73
  - Use `create-react-app`
64
74
  - Include: `react-admin`, `@mui/material`, `@emotion/react`, `@emotion/styled`, `react-router-dom`
65
75
  - Do not use any deprecated or unmaintained libraries
@@ -70,31 +80,35 @@ default the Foreign Key to the Parent (Master) Primary Key.
70
80
  ### Per-Resource Files (Required)
71
81
 
72
82
  For each resource (`Customer`, `Order` etc):
73
- - Create a source file under `src/`, e.g., `Customer.js`
74
- - **Each file must fully implement**:
75
- - `CustomerList`
76
- - `CustomerShow`
77
- - `CustomerCreate`
78
- - `CustomerEdit`
83
+
84
+ * Create a source file under `src/`, e.g., `Customer.js`
85
+ * Each file must **fully** implement:
86
+ * `CustomerList`
87
+ * `CustomerShow`
88
+ * `CustomerCreate`
89
+ * `CustomerEdit`
79
90
 
80
91
  Use:
92
+
81
93
  - `<ReferenceField>` for foreign key displays
82
94
  - `<ReferenceInput>` for foreign key input
83
95
  - `<ReferenceManyField>` for tabbed child lists
84
96
  - For show pages
85
- - Always start with <SimpleShowLayout>, followed by a <TabbedShowLayout> for related data
86
- - DO NOT start with <TabbedShowLayout>
87
97
 
88
- Be sure to include all required imports. ALWAYS use the following AS IS, plus whatever else is required:
98
+ * Always start with `<SimpleShowLayout>`, followed by a `<TabbedShowLayout>` for related data
99
+ * DO NOT start with `<TabbedShowLayout>`
100
+
101
+ ALWAYS include these 2 imports at the top of the file, with this EXACT formatting, whether or not they are used:
89
102
 
90
103
  ```jsx
91
- 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 } from 'react-admin';
104
+ import React from 'react';
105
+ 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 } from 'react-admin'; // mandatory import
92
106
  ```
93
107
  You may add other imports, but be sure all those are included.
94
108
 
95
- DO NOT use <EmailInput> - use <TextInput>.
109
+ DO NOT use `<EmailInput>` - use `<TextInput>`.
96
110
 
97
- DO NOT put <ReferenceField> in <Datagrid>.
111
+ DO NOT put `<ReferenceField>` in `<Datagrid>`.
98
112
 
99
113
  Do **not leave any file empty**.
100
114
 
@@ -137,8 +151,10 @@ export default App;
137
151
  ```
138
152
 
139
153
  For dataProvider:
140
- 1 - be sure it includes the braces: import { dataProvider }
141
- 2 - Do Not generate either:
154
+
155
+ 1. be sure it includes the braces: `import { dataProvider }`
156
+ 2. Do Not generate either:
157
+
142
158
  ```jsx
143
159
  import jsonServerProvider from 'ra-data-json-server'
144
160
  const dataProvider = jsonServerProvider('http://api.example.com');
@@ -1,59 +1,58 @@
1
1
  import React from 'react';
2
2
  import { Admin, Resource } from 'react-admin';
3
3
  import { createTheme } from '@mui/material/styles';
4
-
5
- // Import DataProvider
4
+ // import data provider
6
5
  import { dataProvider } from './dataProvider';
7
6
 
8
- // Import resource components
7
+ // Import all resource components
9
8
  import { CustomerList, CustomerShow, CustomerCreate, CustomerEdit } from './Customer';
10
- import { CategoryList, CategoryShow, CategoryCreate, CategoryEdit } from './Category';
11
9
  import { OrderList, OrderShow, OrderCreate, OrderEdit } from './Order';
12
10
  import { ProductList, ProductShow, ProductCreate, ProductEdit } from './Product';
11
+ import { CategoryList, CategoryShow, CategoryCreate, CategoryEdit } from './Category';
13
12
  import { EmployeeList, EmployeeShow, EmployeeCreate, EmployeeEdit } from './Employee';
13
+ import { DepartmentList, DepartmentShow, DepartmentCreate, DepartmentEdit } from './Department';
14
14
  import { SupplierList, SupplierShow, SupplierCreate, SupplierEdit } from './Supplier';
15
15
  import { ShipperList, ShipperShow, ShipperCreate, ShipperEdit } from './Shipper';
16
- import { RegionList, RegionShow, RegionCreate, RegionEdit } from './Region';
17
16
  import { TerritoryList, TerritoryShow, TerritoryCreate, TerritoryEdit } from './Territory';
18
17
  import { CustomerDemographicList, CustomerDemographicShow, CustomerDemographicCreate, CustomerDemographicEdit } from './CustomerDemographic';
19
18
  import { EmployeeAuditList, EmployeeAuditShow, EmployeeAuditCreate, EmployeeAuditEdit } from './EmployeeAudit';
20
19
  import { EmployeeTerritoryList, EmployeeTerritoryShow, EmployeeTerritoryCreate, EmployeeTerritoryEdit } from './EmployeeTerritory';
21
- import { DepartmentList, DepartmentShow, DepartmentCreate, DepartmentEdit } from './Department';
22
- import { UnionList, UnionShow, UnionCreate, UnionEdit } from './Union';
23
20
  import { LocationList, LocationShow, LocationCreate, LocationEdit } from './Location';
24
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
25
 
26
- // Define Material-UI Theme
27
26
  const theme = createTheme({
28
27
  palette: {
29
- primary: { main: '#1976d2' }, // Material-UI default blue
30
- secondary: { main: '#1565c0' }, // A darker blue, or choose another color
28
+ primary: { main: '#1976d2' },
29
+ secondary: { main: '#1565c0' },
31
30
  },
32
31
  typography: { fontSize: 14 },
33
32
  });
34
33
 
35
34
  const App = () => {
36
- return (
37
- <Admin dataProvider={dataProvider} theme={theme}>
38
- {/* Register each resource with their components */}
39
- <Resource name="Customer" list={CustomerList} show={CustomerShow} edit={CustomerEdit} create={CustomerCreate} />
40
- <Resource name="Category" list={CategoryList} show={CategoryShow} edit={CategoryEdit} create={CategoryCreate} />
41
- <Resource name="Order" list={OrderList} show={OrderShow} edit={OrderEdit} create={OrderCreate} />
42
- <Resource name="Product" list={ProductList} show={ProductShow} edit={ProductEdit} create={ProductCreate} />
43
- <Resource name="Employee" list={EmployeeList} show={EmployeeShow} edit={EmployeeEdit} create={EmployeeCreate} />
44
- <Resource name="Supplier" list={SupplierList} show={SupplierShow} edit={SupplierEdit} create={SupplierCreate} />
45
- <Resource name="Shipper" list={ShipperList} show={ShipperShow} edit={ShipperEdit} create={ShipperCreate} />
46
- <Resource name="Region" list={RegionList} show={RegionShow} edit={RegionEdit} create={RegionCreate} />
47
- <Resource name="Territory" list={TerritoryList} show={TerritoryShow} edit={TerritoryEdit} create={TerritoryCreate} />
48
- <Resource name="CustomerDemographic" list={CustomerDemographicList} show={CustomerDemographicShow} edit={CustomerDemographicEdit} create={CustomerDemographicCreate} />
49
- <Resource name="EmployeeAudit" list={EmployeeAuditList} show={EmployeeAuditShow} edit={EmployeeAuditEdit} create={EmployeeAuditCreate} />
50
- <Resource name="EmployeeTerritory" list={EmployeeTerritoryList} show={EmployeeTerritoryShow} edit={EmployeeTerritoryEdit} create={EmployeeTerritoryCreate} />
51
- <Resource name="Department" list={DepartmentList} show={DepartmentShow} edit={DepartmentEdit} create={DepartmentCreate} />
52
- <Resource name="Union" list={UnionList} show={UnionShow} edit={UnionEdit} create={UnionCreate} />
53
- <Resource name="Location" list={LocationList} show={LocationShow} edit={LocationEdit} create={LocationCreate} />
54
- <Resource name="OrderDetail" list={OrderDetailList} show={OrderDetailShow} edit={OrderDetailEdit} create={OrderDetailCreate} />
55
- </Admin>
56
- );
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
+ );
57
56
  };
58
57
 
59
58
  export default App;
@@ -1,82 +1,82 @@
1
- ```jsx
2
1
  import React from 'react';
3
2
  import {
4
- List, Datagrid, TextField, ReferenceField,
5
- Show, TabbedShowLayout, Tab, SimpleShowLayout,
6
- TextInput, ReferenceManyField, Pagination,
7
- Filter, Create, Edit, SimpleForm, SelectInput, ReferenceInput
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,
8
21
  } from 'react-admin';
9
22
 
10
- // Define the filters for the Category List
23
+ // Filters for Category List
24
+ //theme color;
11
25
  const CategoryFilter = (props) => (
12
- <Filter {...props}>
13
- <TextInput label="Search" source="q" alwaysOn />
14
- <TextInput label="Category Name" source="CategoryName" />
15
- <TextInput label="Description" source="Description" />
16
- </Filter>
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>
17
31
  );
18
32
 
19
- // Pagination configuration
20
- const CategoryPagination = props => <Pagination rowsPerPageOptions={[7]} {...props} />;
21
-
22
- // List view for Categories
33
+ // Category List
23
34
  export const CategoryList = (props) => (
24
- <List {...props} filters={<CategoryFilter />} pagination={<CategoryPagination />}>
25
- <Datagrid rowClick="show">
26
- <TextField source="CategoryName" label="Category Name" />
27
- <TextField source="Description" label="Description" />
28
- <TextField source="Client_id" label="Client" />
29
- </Datagrid>
30
- </List>
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>
31
41
  );
32
42
 
33
- // Show view for a single Category
43
+ // Category Show
34
44
  export const CategoryShow = (props) => (
35
- <Show {...props}>
36
- <SimpleShowLayout>
37
- <TextField source="CategoryName" label="Category Name" />
38
- <TextField source="Description" label="Description" />
39
- <TextField source="Client_id" label="Client" />
40
- </SimpleShowLayout>
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">
41
51
  <TabbedShowLayout>
42
- <Tab label="Related Resources">
43
- <ReferenceManyField
44
- label="Products"
45
- reference="Product"
46
- target="CategoryId"
47
- >
48
- <Datagrid rowClick="show">
49
- <TextField source="ProductName" label="Product Name" />
50
- </Datagrid>
51
- </ReferenceManyField>
52
- </Tab>
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>
53
58
  </TabbedShowLayout>
54
- </Show>
59
+ </ReferenceManyField>
60
+ </SimpleShowLayout>
61
+ </Show>
55
62
  );
56
63
 
57
- // Create view for a Category
64
+ // Category Create
58
65
  export const CategoryCreate = (props) => (
59
- <Create {...props}>
60
- <SimpleForm>
61
- <TextInput source="CategoryName" label="Category Name" />
62
- <TextInput source="Description" label="Description" />
63
- <ReferenceInput label="Client" source="Client_id" reference="Client">
64
- <SelectInput optionText="name" />
65
- </ReferenceInput>
66
- </SimpleForm>
67
- </Create>
66
+ <Create {...props}>
67
+ <SimpleForm>
68
+ <TextInput source="CategoryName_ColumnName" label="Category Name" />
69
+ <TextInput multiline source="Description" />
70
+ </SimpleForm>
71
+ </Create>
68
72
  );
69
73
 
70
- // Edit view for a Category
74
+ // Category Edit
71
75
  export const CategoryEdit = (props) => (
72
- <Edit {...props}>
73
- <SimpleForm>
74
- <TextInput source="CategoryName" label="Category Name" />
75
- <TextInput source="Description" label="Description" />
76
- <ReferenceInput label="Client" source="Client_id" reference="Client">
77
- <SelectInput optionText="name" />
78
- </ReferenceInput>
79
- </SimpleForm>
80
- </Edit>
76
+ <Edit {...props}>
77
+ <SimpleForm>
78
+ <TextInput source="CategoryName_ColumnName" label="Category Name" />
79
+ <TextInput multiline source="Description" />
80
+ </SimpleForm>
81
+ </Edit>
81
82
  );
82
- ```