@@ -38,7 +38,15 @@ import {
3838 useResourceContext
3939} from "react-admin" ;
4040import { useFormContext , useWatch } from "react-hook-form" ;
41- import { Paper , Grid , Chip , Typography , CardActions } from "@mui/material" ;
41+ import {
42+ Paper ,
43+ Grid ,
44+ Chip ,
45+ Typography ,
46+ CardActions ,
47+ styled ,
48+ Box
49+ } from "@mui/material" ;
4250import { CatchmentSelectInput } from "./components/CatchmentSelectInput" ;
4351import { LineBreak } from "../common/components/utils" ;
4452import {
@@ -88,6 +96,14 @@ const StringToLabelObject = ({ children, ...props }) => {
8896 return cloneElement ( children , { ...props , record : labelRecord } ) ;
8997} ;
9098
99+ const StyledBox = styled ( Box ) ( ( { theme } ) => ( {
100+ marginTop : theme . spacing ( 3.5 ) ,
101+ marginRight : theme . spacing ( 1.5 ) ,
102+ boxShadow : theme . shadows [ 2 ] ,
103+ padding : theme . spacing ( 3 ) ,
104+ backgroundColor : theme . palette . background . paper
105+ } ) ) ;
106+
91107export const UserCreate = ( { user, organisation, userInfo, ...props } ) => (
92108 < Paper >
93109 < DocumentationContainer filename = { "User.md" } >
@@ -115,56 +131,58 @@ export const UserEdit = ({ organisation, ...props }) => (
115131export const UserList = ( { ...props } ) => {
116132 const { organisation } = useContext ( OrgManagerContext ) ;
117133 return (
118- < List
119- { ...props }
120- hasCreate = { false }
121- filter = { { organisationId : organisation . id } }
122- filters = { UserFilter }
123- title = { `${ organisation . name } Users` }
124- >
125- < Datagrid rowClick = "show" >
126- < TextField label = "Login ID" source = "username" />
127- < TextField source = "name" label = "Name of the Person" />
128- < ReferenceField
129- label = "Catchment"
130- source = "catchmentId"
131- reference = "catchment"
132- link = "show"
133- emptyText = ""
134- >
135- < TextField source = "name" />
136- </ ReferenceField >
137- < TextField source = "email" label = "Email Address" />
138- < TextField source = "phoneNumber" label = "Phone Number" />
139- < FunctionField
140- label = "User Groups"
141- render = { record => (
142- < div style = { { maxWidth : "40em" } } >
143- { _ . isArrayLike ( record . userGroups ) &&
144- record . userGroups
145- . filter ( ug => ug && ! ug . voided )
146- . map ( userGroup => (
147- < Chip
148- style = { { margin : "0.2em" } }
149- label = { userGroup . groupName }
150- key = { userGroup . groupName }
151- />
152- ) ) }
153- </ div >
154- ) }
155- />
156- < FunctionField
157- label = "Status"
158- render = { user =>
159- user . voided === true
160- ? "Deleted"
161- : user . disabledInCognito === true
162- ? "Disabled"
163- : "Active"
164- }
165- />
166- </ Datagrid >
167- </ List >
134+ < StyledBox >
135+ < List
136+ { ...props }
137+ hasCreate = { false }
138+ filter = { { organisationId : organisation . id } }
139+ filters = { UserFilter }
140+ title = { `${ organisation . name } Users` }
141+ >
142+ < Datagrid rowClick = "show" >
143+ < TextField label = "Login ID" source = "username" />
144+ < TextField source = "name" label = "Name of the Person" />
145+ < ReferenceField
146+ label = "Catchment"
147+ source = "catchmentId"
148+ reference = "catchment"
149+ link = "show"
150+ emptyText = ""
151+ >
152+ < TextField source = "name" />
153+ </ ReferenceField >
154+ < TextField source = "email" label = "Email Address" />
155+ < TextField source = "phoneNumber" label = "Phone Number" />
156+ < FunctionField
157+ label = "User Groups"
158+ render = { record => (
159+ < div style = { { maxWidth : "40em" } } >
160+ { _ . isArrayLike ( record . userGroups ) &&
161+ record . userGroups
162+ . filter ( ug => ug && ! ug . voided )
163+ . map ( userGroup => (
164+ < Chip
165+ style = { { margin : "0.2em" } }
166+ label = { userGroup . groupName }
167+ key = { userGroup . groupName }
168+ />
169+ ) ) }
170+ </ div >
171+ ) }
172+ />
173+ < FunctionField
174+ label = "Status"
175+ render = { user =>
176+ user . voided === true
177+ ? "Deleted"
178+ : user . disabledInCognito === true
179+ ? "Disabled"
180+ : "Active"
181+ }
182+ />
183+ </ Datagrid >
184+ </ List >
185+ </ StyledBox >
168186 ) ;
169187} ;
170188
0 commit comments