authscape 1.0.570 → 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.
@@ -1,186 +0,0 @@
1
- import React, {useEffect, useState, useRef} from 'react';
2
- import { Box } from '@mui/system';
3
- import { Avatar, Button, Drawer, Grid } from '@mui/material';
4
- import IconButton from '@mui/material/IconButton';
5
- import UploadRoundedIcon from '@mui/icons-material/UploadRounded';
6
- import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
7
- import Dialog from '@mui/material/Dialog';
8
- import DialogActions from '@mui/material/DialogActions';
9
- import DialogContent from '@mui/material/DialogContent';
10
- import DialogContentText from '@mui/material/DialogContentText';
11
- import DialogTitle from '@mui/material/DialogTitle';
12
-
13
- export function UserManagement({customFields = null, onUploadCompleted = null}) {
14
-
15
- const [showUserDetails, setShowUserDetails] = useState(null);
16
-
17
- const [dataGridRefreshKey, setDataGridRefreshKey] = useState(0);
18
- const [uploadUsersShowDialog, setUploadUsersShowDialog] = useState(false);
19
-
20
-
21
- const userColumns = [
22
- {
23
- field: 'fullName',
24
- headerName: 'Full name',
25
- flex: 1,
26
- renderCell: (param) => {
27
- return param.row.firstName + " " + param.row.lastName;
28
- }
29
- },
30
- { field: 'userName', flex:1, headerName: 'Email', editable: false, headerClassName: 'invoiceHeaderColumn' },
31
- {
32
- field: 'company',
33
- headerName: 'Company',
34
- flex: 1,
35
- renderCell: (param) => {
36
- return param.row.company != null ? param.row.company.title : "";
37
- }
38
- },
39
- {
40
- field: 'location',
41
- headerName: 'Location',
42
- flex: 1,
43
- renderCell: (param) => {
44
- return param.row.location != null ? param.row.location.title : "";
45
- }
46
- },
47
- {
48
- field: 'isActive',
49
- headerName: 'Status',
50
- flex: 1,
51
- renderCell: (param) => {
52
- return param.row.isActive ? "Active" : "Not Active";
53
- }
54
- },
55
- {
56
- field: 'roles',
57
- headerName: 'Roles',
58
- flex: 1,
59
- renderCell: (param) => {
60
- return param.row.roles;
61
- }
62
- },
63
- {
64
- field: 'permission',
65
- headerName: 'Permission',
66
- flex: 1,
67
- renderCell: (param) => {
68
- return param.row.permissions;
69
- }
70
- },
71
- ];
72
-
73
- return (
74
- <Box>
75
-
76
-
77
- <Box sx={{textAlign:"right"}}>
78
- <Button variant="contained" sx={{width:200}} onClick={async () => {
79
-
80
- setShowUserDetails(-1);
81
-
82
- }}>Add User</Button>
83
-
84
-
85
- <Button startIcon={<UploadRoundedIcon/>} variant="contained" sx={{width:200, marginLeft:2}} onClick={async () => {
86
- setUploadUsersShowDialog(true);
87
- }}>Upload Users</Button>
88
- </Box>
89
-
90
- <Box>
91
- <EditableDatagrid
92
- key={dataGridRefreshKey}
93
- pageSize={25}
94
- // rowsPerPage={[25]}
95
- url={"/UserManagement/GetUsers"}
96
- columns={userColumns}
97
- params={{
98
- // invoiceId: invoiceId
99
- }}
100
- onRowClick={(row) => {
101
-
102
- setShowUserDetails(row.id);
103
- }} />
104
-
105
- <Drawer
106
- anchor={"right"}
107
- fullWidth={true}
108
- width={800}
109
- open={showUserDetails != null ? true : false}
110
- onClose={() => {
111
- setShowUserDetails(null);
112
- }}>
113
-
114
- <IconButton size="large" sx={{position:"absolute", right: 10, top: 6}} onClick={() => {
115
- setShowUserDetails(null);
116
- }}>
117
- <CloseRoundedIcon />
118
- </IconButton>
119
-
120
- <Grid item xs={12}>
121
- <Box sx={{padding:2}}>
122
- User Information
123
- </Box>
124
- <hr />
125
-
126
- <Box sx={{textAlign:"center", display:"flex", justifyContent:"center", padding:2 }}>
127
- <Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" sx={{ width: 100, height: 100 }} />
128
- </Box>
129
-
130
- <Box sx={{ width: '100%' }}>
131
-
132
-
133
- <UserEditor
134
- userId={showUserDetails}
135
- customFields={customFields}
136
- onSaved={() => {
137
-
138
- setDataGridRefreshKey(dataGridRefreshKey + 1);
139
- setShowUserDetails(null);
140
- }}
141
- />
142
-
143
-
144
- </Box>
145
-
146
- </Grid>
147
-
148
- </Drawer>
149
- </Box>
150
-
151
- <Dialog
152
- open={uploadUsersShowDialog}
153
- onClose={() => {
154
- setUploadUsersShowDialog(false);
155
- }}
156
- fullWidth={true}>
157
- <DialogTitle>
158
- {"Upload users"}
159
- </DialogTitle>
160
- <DialogContent>
161
- <DialogContentText>
162
- Upload multiple users using a CSV sheet
163
- </DialogContentText>
164
-
165
- <Box sx={{height:200}}>
166
- <FileUploader url={"/UserManagement/UploadUsers"} onUploadCompleted={(results) => {
167
-
168
- if (onUploadCompleted != null)
169
- {
170
- onUploadCompleted(results);
171
- }
172
-
173
- }} />
174
- </Box>
175
-
176
- </DialogContent>
177
- <DialogActions>
178
- <Button onClick={() => {
179
- setUploadUsersShowDialog(false);
180
- }}>Cancel</Button>
181
- </DialogActions>
182
- </Dialog>
183
-
184
- </Box>
185
- );
186
- }