authscape 1.0.572 → 1.0.573
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.
- package/index.js +1035 -3165
- package/package.json +1 -3
- package/src/components/stripe/StripePayment.js +3 -6
- package/src/components/kanban/Action.js +0 -25
- package/src/components/kanban/Container.js +0 -77
- package/src/components/kanban/Handle.js +0 -24
- package/src/components/kanban/Item.js +0 -149
- package/src/components/kanban/Kanban.js +0 -917
- package/src/components/kanban/Remove.js +0 -23
- package/src/components/kanban/createRange.js +0 -5
- package/src/components/kanban/multipleContainersKeyboardCoordinates.js +0 -114
- package/src/components/users/UserEditor.js +0 -590
- package/src/components/users/UserManagement.js +0 -186
|
@@ -1,590 +0,0 @@
|
|
|
1
|
-
import React, {useEffect, useState, useRef} from 'react';
|
|
2
|
-
import { Box } from '@mui/system';
|
|
3
|
-
import TextField from '@mui/material/TextField';
|
|
4
|
-
import { Autocomplete, Button, Grid } from '@mui/material';
|
|
5
|
-
import Typography from '@mui/material/Typography';
|
|
6
|
-
import FormControl from '@mui/material/FormControl';
|
|
7
|
-
import InputLabel from '@mui/material/InputLabel';
|
|
8
|
-
import Select from '@mui/material/Select';
|
|
9
|
-
import Checkbox from '@mui/material/Checkbox';
|
|
10
|
-
import OutlinedInput from '@mui/material/OutlinedInput';
|
|
11
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
12
|
-
import ListItemText from '@mui/material/ListItemText';
|
|
13
|
-
import { useForm, Controller } from 'react-hook-form';
|
|
14
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
15
|
-
import Switch from '@mui/material/Switch';
|
|
16
|
-
import { Tab, Tabs } from '@mui/material';
|
|
17
|
-
import { BusinessRounded, PersonRounded } from '@mui/icons-material';
|
|
18
|
-
|
|
19
|
-
export function UserEditor({userId = null, customFields = null, onSaved = null}) {
|
|
20
|
-
|
|
21
|
-
const {control, register, handleSubmit, formState: { errors }, watch, setValue } = useForm();
|
|
22
|
-
|
|
23
|
-
const [selectedRoles, setSelectedRole] = useState([]);
|
|
24
|
-
const [selectedPermission, setSelectedPermission] = useState([]);
|
|
25
|
-
|
|
26
|
-
const [companies, setCompanies] = useState([]);
|
|
27
|
-
const [company, setCompany] = useState(null);
|
|
28
|
-
const [inputCompanyValue, setInputCompanyValue] = useState('');
|
|
29
|
-
|
|
30
|
-
const [locations, setLocations] = useState([]);
|
|
31
|
-
const [location, setLocation] = useState(null);
|
|
32
|
-
const [inputLocationValue, setInputLocationValue] = useState('');
|
|
33
|
-
|
|
34
|
-
const [roles, setRole] = useState([]);
|
|
35
|
-
const [permissions, setPermissions] = useState([]);
|
|
36
|
-
|
|
37
|
-
const [user, setUser] = useState(null);
|
|
38
|
-
|
|
39
|
-
const ITEM_HEIGHT = 48;
|
|
40
|
-
const ITEM_PADDING_TOP = 8;
|
|
41
|
-
const MenuProps = {
|
|
42
|
-
PaperProps: {
|
|
43
|
-
style: {
|
|
44
|
-
maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP,
|
|
45
|
-
width: 250,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const [tabValue, setTabValue] = useState(0);
|
|
51
|
-
|
|
52
|
-
const handleTabChange = (event, newValue) => {
|
|
53
|
-
setTabValue(newValue);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
|
|
58
|
-
const fetchData = async () => {
|
|
59
|
-
|
|
60
|
-
let responseRoles = await apiService().get("/UserManagement/GetRoles");
|
|
61
|
-
if (responseRoles != null && responseRoles.status == 200)
|
|
62
|
-
{
|
|
63
|
-
setRole(responseRoles.data);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let responsePermissions = await apiService().get("/UserManagement/GetPermissions");
|
|
67
|
-
if (responsePermissions != null && responsePermissions.status == 200)
|
|
68
|
-
{
|
|
69
|
-
setPermissions(responsePermissions.data);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
fetchData();
|
|
74
|
-
|
|
75
|
-
}, []);
|
|
76
|
-
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
|
|
79
|
-
if (userId != null)
|
|
80
|
-
{
|
|
81
|
-
const fetchData = async () => {
|
|
82
|
-
let response = await apiService().get("/UserManagement/GetUser?userId=" + userId);
|
|
83
|
-
if (response != null && response.status == 200)
|
|
84
|
-
{
|
|
85
|
-
setUser(response.data);
|
|
86
|
-
|
|
87
|
-
if (response.data.company != null)
|
|
88
|
-
{
|
|
89
|
-
setCompany(response.data.company);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (response.data.location != null)
|
|
93
|
-
{
|
|
94
|
-
setLocation(response.data.location);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// assign all selected roles
|
|
98
|
-
if (response.data.roles != null)
|
|
99
|
-
{
|
|
100
|
-
let roleNames = [];
|
|
101
|
-
for (let index = 0; index < response.data.roles.length; index++) {
|
|
102
|
-
const role = response.data.roles[index];
|
|
103
|
-
|
|
104
|
-
roleNames.push(role);
|
|
105
|
-
}
|
|
106
|
-
setSelectedRole(roleNames);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// assign all selected permissions
|
|
110
|
-
if (response.data.permissions != null)
|
|
111
|
-
{
|
|
112
|
-
let permissionNames = [];
|
|
113
|
-
for (let index = 0; index < response.data.permissions.length; index++) {
|
|
114
|
-
const permission = response.data.permissions[index];
|
|
115
|
-
|
|
116
|
-
permissionNames.push(permission);
|
|
117
|
-
}
|
|
118
|
-
setSelectedPermission(permissionNames);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (userId != -1)
|
|
125
|
-
{
|
|
126
|
-
fetchData();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
}, [userId])
|
|
132
|
-
|
|
133
|
-
const fields = [
|
|
134
|
-
"FirstName",
|
|
135
|
-
"LastName",
|
|
136
|
-
"IsActive",
|
|
137
|
-
"Email"
|
|
138
|
-
]
|
|
139
|
-
|
|
140
|
-
const findTheValue = (field) => {
|
|
141
|
-
|
|
142
|
-
let result = "";
|
|
143
|
-
if (user != null)
|
|
144
|
-
{
|
|
145
|
-
Object.getOwnPropertyNames(user).forEach(element => {
|
|
146
|
-
|
|
147
|
-
if (field.toLowerCase() == element.toLowerCase())
|
|
148
|
-
{
|
|
149
|
-
result = user[element];
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return result;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const findCustomFieldValue = (field) => {
|
|
159
|
-
|
|
160
|
-
let result = "";
|
|
161
|
-
if (user != null && user.userCustomFields)
|
|
162
|
-
{
|
|
163
|
-
user.userCustomFields.forEach(userCustomField => {
|
|
164
|
-
|
|
165
|
-
if (field.toLowerCase() == userCustomField.name.toLowerCase())
|
|
166
|
-
{
|
|
167
|
-
result = userCustomField.value;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return result;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const renderCustomField = (customFields) => {
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<>
|
|
180
|
-
{(userId != -1 ? user != null : true) && customFields.map((field) => {
|
|
181
|
-
|
|
182
|
-
let result = findCustomFieldValue(field.name);
|
|
183
|
-
|
|
184
|
-
return (
|
|
185
|
-
<Grid item xs={6}>
|
|
186
|
-
<Controller name={field.name}
|
|
187
|
-
control={control}
|
|
188
|
-
rules={{
|
|
189
|
-
required: field.isRequired,
|
|
190
|
-
}}
|
|
191
|
-
render={({renderField}) =>
|
|
192
|
-
<TextField
|
|
193
|
-
label={field.name}
|
|
194
|
-
variant="outlined"
|
|
195
|
-
defaultValue={result}
|
|
196
|
-
margin="normal"
|
|
197
|
-
fullWidth
|
|
198
|
-
{...register(field.name, { required: field.isRequired })}
|
|
199
|
-
{...renderField}
|
|
200
|
-
/>
|
|
201
|
-
}
|
|
202
|
-
/>
|
|
203
|
-
{errors[field.name] && <Typography color={"red"}>{field.name} is required.</Typography>}
|
|
204
|
-
</Grid>
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
})}
|
|
208
|
-
</>
|
|
209
|
-
)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const renderSystemField = (customFields, isSystemField = false) => {
|
|
213
|
-
|
|
214
|
-
return (
|
|
215
|
-
<>
|
|
216
|
-
{(userId != -1 ? user != null : true) && customFields.map((field) => {
|
|
217
|
-
|
|
218
|
-
let result = findTheValue(field);
|
|
219
|
-
|
|
220
|
-
return (
|
|
221
|
-
<Grid item xs={6}>
|
|
222
|
-
|
|
223
|
-
{field == "IsActive" &&
|
|
224
|
-
<Box>
|
|
225
|
-
<Controller name={field}
|
|
226
|
-
control={control}
|
|
227
|
-
rules={{
|
|
228
|
-
required: false,
|
|
229
|
-
}}
|
|
230
|
-
render={({renderField}) =>
|
|
231
|
-
<FormControlLabel control={<Switch defaultChecked={result} />} label={field} {...register(field, { required: false })} {...renderField} />
|
|
232
|
-
}
|
|
233
|
-
/>
|
|
234
|
-
{errors[field] && <Typography color={"red"}>{field} is required.</Typography>}
|
|
235
|
-
|
|
236
|
-
</Box>
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
{field != "IsActive" &&
|
|
240
|
-
<Box>
|
|
241
|
-
<Controller name={field}
|
|
242
|
-
control={control}
|
|
243
|
-
rules={{
|
|
244
|
-
required: true,
|
|
245
|
-
}}
|
|
246
|
-
render={({renderField}) =>
|
|
247
|
-
<TextField
|
|
248
|
-
label={field}
|
|
249
|
-
variant="outlined"
|
|
250
|
-
defaultValue={result}
|
|
251
|
-
margin="normal"
|
|
252
|
-
fullWidth
|
|
253
|
-
{...register(field, { required: true })}
|
|
254
|
-
{...renderField}
|
|
255
|
-
/>
|
|
256
|
-
}
|
|
257
|
-
/>
|
|
258
|
-
{errors[field] && <Typography color={"red"}>{field} is required.</Typography>}
|
|
259
|
-
</Box>
|
|
260
|
-
}
|
|
261
|
-
</Grid>
|
|
262
|
-
)
|
|
263
|
-
|
|
264
|
-
})}
|
|
265
|
-
</>
|
|
266
|
-
)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function a11yProps(index) {
|
|
270
|
-
return {
|
|
271
|
-
id: `simple-tab-${index}`,
|
|
272
|
-
'aria-controls': `simple-tabpanel-${index}`
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
useEffect(() => {
|
|
279
|
-
|
|
280
|
-
const fetchData = async () => {
|
|
281
|
-
|
|
282
|
-
if (inputCompanyValue == null || inputCompanyValue == "")
|
|
283
|
-
{
|
|
284
|
-
let response = await apiService().get("/UserManagement/GetCompanies");
|
|
285
|
-
if (response != null && response.status == 200)
|
|
286
|
-
{
|
|
287
|
-
setCompanies(response.data);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
else
|
|
291
|
-
{
|
|
292
|
-
let response = await apiService().get("/UserManagement/GetCompanies?name=" + inputCompanyValue);
|
|
293
|
-
if (response != null && response.status == 200)
|
|
294
|
-
{
|
|
295
|
-
setCompanies(response.data);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (user != null || userId == -1)
|
|
302
|
-
{
|
|
303
|
-
fetchData();
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
}, [user, userId, inputCompanyValue])
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
useEffect(() => {
|
|
314
|
-
|
|
315
|
-
const fetchData = async () => {
|
|
316
|
-
|
|
317
|
-
if (company != null)
|
|
318
|
-
{
|
|
319
|
-
if (inputLocationValue == null || inputLocationValue == "")
|
|
320
|
-
{
|
|
321
|
-
let response = await apiService().get("/UserManagement/GetLocations?companyId=" + company.id);
|
|
322
|
-
if (response != null && response.status == 200)
|
|
323
|
-
{
|
|
324
|
-
setLocations(response.data);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
else
|
|
328
|
-
{
|
|
329
|
-
let response = await apiService().get("/UserManagement/GetLocations?companyId=" + company.id + "&name=" + inputLocationValue);
|
|
330
|
-
if (response != null && response.status == 200)
|
|
331
|
-
{
|
|
332
|
-
setLocations(response.data);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
if (user != null || userId == -1)
|
|
339
|
-
{
|
|
340
|
-
fetchData();
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
}, [user, userId, inputLocationValue, company])
|
|
344
|
-
|
|
345
|
-
return (
|
|
346
|
-
<Box sx={{paddingTop:0, minWidth: 600}}>
|
|
347
|
-
|
|
348
|
-
<form onSubmit={handleSubmit(async (data) => {
|
|
349
|
-
|
|
350
|
-
let userCustomFields = [];
|
|
351
|
-
|
|
352
|
-
customFields.forEach(customField => {
|
|
353
|
-
|
|
354
|
-
userCustomFields.push({
|
|
355
|
-
name: customField.name,
|
|
356
|
-
value: data[customField.name]
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
let response = await apiService().put("/UserManagement/UpdateUser", {
|
|
361
|
-
id: userId,
|
|
362
|
-
firstName: data.FirstName,
|
|
363
|
-
lastName: data.LastName,
|
|
364
|
-
companyId: company != null ? company.id : null,
|
|
365
|
-
locationId: location != null ? location.id : null,
|
|
366
|
-
email: data.Email,
|
|
367
|
-
isActive: data.IsActive,
|
|
368
|
-
roles: selectedRoles != "" ? selectedRoles : null,
|
|
369
|
-
permissions: selectedPermission != "" ? selectedPermission : null,
|
|
370
|
-
userCustomFields: userCustomFields
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
if (response != null && response.status == 200)
|
|
374
|
-
{
|
|
375
|
-
if (onSaved != null)
|
|
376
|
-
{
|
|
377
|
-
onSaved();
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
})} noValidate autoComplete="off">
|
|
382
|
-
|
|
383
|
-
<Box>
|
|
384
|
-
<Box>
|
|
385
|
-
<Tabs value={tabValue} onChange={handleTabChange} variant="fullWidth" aria-label="basic tabs example" centered>
|
|
386
|
-
<Tab label="Information" {...a11yProps(0)} />
|
|
387
|
-
<Tab label="Company / Locations" {...a11yProps(1)} />
|
|
388
|
-
<Tab label="Roles / Permissions" {...a11yProps(2)} />
|
|
389
|
-
{/* <Tab label="Item Three" {...a11yProps(2)} /> */}
|
|
390
|
-
</Tabs>
|
|
391
|
-
</Box>
|
|
392
|
-
|
|
393
|
-
{tabValue === 0 &&
|
|
394
|
-
<Grid spacing={2} sx={{paddingLeft:2, paddingRight:2, paddingTop:2}}>
|
|
395
|
-
|
|
396
|
-
{renderSystemField(fields)}
|
|
397
|
-
{renderCustomField(customFields)}
|
|
398
|
-
|
|
399
|
-
</Grid>
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
{tabValue === 1 &&
|
|
403
|
-
<Grid spacing={2} sx={{paddingLeft:2, paddingRight:2, paddingTop:2}}>
|
|
404
|
-
|
|
405
|
-
<Autocomplete
|
|
406
|
-
id="companySelect"
|
|
407
|
-
sx={{paddingTop:2}}
|
|
408
|
-
getOptionLabel={
|
|
409
|
-
(option) => option.title
|
|
410
|
-
}
|
|
411
|
-
filterOptions={(x) => x}
|
|
412
|
-
options={companies != null ? companies : []}
|
|
413
|
-
autoComplete
|
|
414
|
-
includeInputInList
|
|
415
|
-
filterSelectedOptions
|
|
416
|
-
value={company}
|
|
417
|
-
noOptionsText="No locations"
|
|
418
|
-
onChange={(event, newValue) => {
|
|
419
|
-
setCompanies(newValue ? [newValue, ...companies] : companies);
|
|
420
|
-
setCompany(newValue);
|
|
421
|
-
setLocation(null);
|
|
422
|
-
}}
|
|
423
|
-
onInputChange={(event, newInputValue) => {
|
|
424
|
-
setInputCompanyValue(newInputValue);
|
|
425
|
-
}}
|
|
426
|
-
renderInput={(params) => (
|
|
427
|
-
<TextField {...params} label="Company" fullWidth />
|
|
428
|
-
)}
|
|
429
|
-
renderOption={(props, option) => {
|
|
430
|
-
// const matches =
|
|
431
|
-
// option.structured_formatting.main_text_matched_substrings || [];
|
|
432
|
-
|
|
433
|
-
// const parts = parse(
|
|
434
|
-
// option.structured_formatting.main_text,
|
|
435
|
-
// matches.map((match) => [match.offset, match.offset + match.length]),
|
|
436
|
-
// );
|
|
437
|
-
|
|
438
|
-
return (
|
|
439
|
-
<li {...props}>
|
|
440
|
-
<Grid container alignItems="center">
|
|
441
|
-
<Grid item sx={{ display: 'flex', width: 44 }}>
|
|
442
|
-
<BusinessRounded sx={{ color: 'text.secondary' }} />
|
|
443
|
-
</Grid>
|
|
444
|
-
<Grid item sx={{ width: 'calc(100% - 44px)', wordWrap: 'break-word' }}>
|
|
445
|
-
{/* {parts.map((part, index) => (
|
|
446
|
-
<Box
|
|
447
|
-
key={index}
|
|
448
|
-
component="span"
|
|
449
|
-
sx={{ fontWeight: part.highlight ? 'bold' : 'regular' }}
|
|
450
|
-
>
|
|
451
|
-
{part.text}
|
|
452
|
-
</Box>
|
|
453
|
-
))} */}
|
|
454
|
-
<Typography variant="body2" color="text.secondary">
|
|
455
|
-
{option.title}
|
|
456
|
-
</Typography>
|
|
457
|
-
</Grid>
|
|
458
|
-
</Grid>
|
|
459
|
-
</li>
|
|
460
|
-
);
|
|
461
|
-
}}
|
|
462
|
-
/>
|
|
463
|
-
|
|
464
|
-
<Autocomplete
|
|
465
|
-
id="LocationSelect"
|
|
466
|
-
sx={{paddingTop:3}}
|
|
467
|
-
getOptionLabel={
|
|
468
|
-
(option) => option.title
|
|
469
|
-
}
|
|
470
|
-
filterOptions={(x) => x}
|
|
471
|
-
options={locations != null ? locations : []}
|
|
472
|
-
autoComplete
|
|
473
|
-
includeInputInList
|
|
474
|
-
filterSelectedOptions
|
|
475
|
-
value={location}
|
|
476
|
-
noOptionsText="No locations"
|
|
477
|
-
onChange={(event, newValue) => {
|
|
478
|
-
setLocations(newValue ? [newValue, ...locations] : locations);
|
|
479
|
-
setLocation(newValue);
|
|
480
|
-
}}
|
|
481
|
-
onInputChange={(event, newInputValue) => {
|
|
482
|
-
setInputCompanyValue(newInputValue);
|
|
483
|
-
}}
|
|
484
|
-
renderInput={(params) => (
|
|
485
|
-
<TextField {...params} label="Location" fullWidth />
|
|
486
|
-
)}
|
|
487
|
-
renderOption={(props, option) => {
|
|
488
|
-
|
|
489
|
-
return (
|
|
490
|
-
<li {...props}>
|
|
491
|
-
<Grid container alignItems="center">
|
|
492
|
-
<Grid item sx={{ display: 'flex', width: 44 }}>
|
|
493
|
-
<BusinessRounded sx={{ color: 'text.secondary' }} />
|
|
494
|
-
</Grid>
|
|
495
|
-
<Grid item sx={{ width: 'calc(100% - 44px)', wordWrap: 'break-word' }}>
|
|
496
|
-
<Typography variant="body2" color="text.secondary">
|
|
497
|
-
{option.title}
|
|
498
|
-
</Typography>
|
|
499
|
-
</Grid>
|
|
500
|
-
</Grid>
|
|
501
|
-
</li>
|
|
502
|
-
);
|
|
503
|
-
}}
|
|
504
|
-
/>
|
|
505
|
-
|
|
506
|
-
</Grid>
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
{tabValue === 2 &&
|
|
510
|
-
<Box sx={{paddingLeft:2, paddingRight:2, paddingTop:2}}>
|
|
511
|
-
|
|
512
|
-
<FormControl sx={{ paddingTop:1, m: 1, width: "100%" }}>
|
|
513
|
-
<InputLabel id="demo-multiple-checkbox-label">Roles</InputLabel>
|
|
514
|
-
<Select
|
|
515
|
-
fullWidth={true}
|
|
516
|
-
labelId="demo-multiple-checkbox-label"
|
|
517
|
-
id="demo-multiple-checkbox"
|
|
518
|
-
{...register("roles", { required: false })}
|
|
519
|
-
multiple
|
|
520
|
-
value={selectedRoles}
|
|
521
|
-
onChange={(event) => {
|
|
522
|
-
|
|
523
|
-
const {
|
|
524
|
-
target: { value },
|
|
525
|
-
} = event;
|
|
526
|
-
setSelectedRole(
|
|
527
|
-
// On autofill we get a stringified value.
|
|
528
|
-
typeof value === 'string' ? value.split(',') : value,
|
|
529
|
-
);
|
|
530
|
-
|
|
531
|
-
}}
|
|
532
|
-
input={<OutlinedInput label="Roles" />}
|
|
533
|
-
renderValue={(selected) => selected.join(', ')}
|
|
534
|
-
MenuProps={MenuProps}>
|
|
535
|
-
{roles.map((role) => (
|
|
536
|
-
<MenuItem key={role.name} value={role.name}>
|
|
537
|
-
<Checkbox checked={selectedRoles.indexOf(role.name) > -1} />
|
|
538
|
-
<ListItemText primary={role.name} />
|
|
539
|
-
</MenuItem>
|
|
540
|
-
))}
|
|
541
|
-
</Select>
|
|
542
|
-
</FormControl>
|
|
543
|
-
{errors.roles && <Typography color={"red"}>{"roles"} is required.</Typography>}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
<FormControl sx={{ m: 1, paddingTop:1, width: "100%" }}>
|
|
547
|
-
<InputLabel id="demo-multiple-checkbox-label">Permissions</InputLabel>
|
|
548
|
-
<Select
|
|
549
|
-
fullWidth={true}
|
|
550
|
-
labelId="demo-multiple-checkbox-label"
|
|
551
|
-
id="demo-multiple-checkbox"
|
|
552
|
-
{...register("permissions", { required: false })}
|
|
553
|
-
multiple
|
|
554
|
-
value={selectedPermission}
|
|
555
|
-
onChange={(event) => {
|
|
556
|
-
|
|
557
|
-
const {
|
|
558
|
-
target: { value },
|
|
559
|
-
} = event;
|
|
560
|
-
setSelectedPermission(
|
|
561
|
-
// On autofill we get a stringified value.
|
|
562
|
-
typeof value === 'string' ? value.split(',') : value,
|
|
563
|
-
);
|
|
564
|
-
|
|
565
|
-
}}
|
|
566
|
-
input={<OutlinedInput label="Roles" />}
|
|
567
|
-
renderValue={(selected) => selected.join(', ')}
|
|
568
|
-
MenuProps={MenuProps}>
|
|
569
|
-
{permissions.map((permission) => (
|
|
570
|
-
<MenuItem key={permission.name} value={permission.name}>
|
|
571
|
-
<Checkbox checked={selectedPermission.indexOf(permission.name) > -1} />
|
|
572
|
-
<ListItemText primary={permission.name} />
|
|
573
|
-
</MenuItem>
|
|
574
|
-
))}
|
|
575
|
-
</Select>
|
|
576
|
-
</FormControl>
|
|
577
|
-
{errors.permissions && <Typography color={"red"}>{"permissions"} is required.</Typography>}
|
|
578
|
-
|
|
579
|
-
</Box>
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
<Box sx={{paddingTop:1, paddingBottom: 4, paddingLeft: 2}}>
|
|
583
|
-
<Button variant="contained" type="submit">{userId == -1 ? "Create Account" : "Update Account"}</Button>
|
|
584
|
-
</Box>
|
|
585
|
-
|
|
586
|
-
</Box>
|
|
587
|
-
</form>
|
|
588
|
-
</Box>
|
|
589
|
-
)
|
|
590
|
-
}
|