authscape 1.0.574 → 1.0.578

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.574",
3
+ "version": "1.0.578",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -47,6 +47,7 @@ export function AutoSaveTextField ({label = "", value = null, variant = "outline
47
47
  <TextField
48
48
  label={label}
49
49
  fullWidth={fullWidth}
50
+ autoComplete='off'
50
51
  variant={variant}
51
52
  multiline={isMultiLine}
52
53
  rows={rows}
@@ -6,7 +6,7 @@ import DialogContent from '@mui/material/DialogContent';
6
6
  import DialogContentText from '@mui/material/DialogContentText';
7
7
  import DialogTitle from '@mui/material/DialogTitle';
8
8
 
9
- export default function YesNoDialog({open, title, message, yesText = "Yes", noText = "No", YesAction, NoAction}) {
9
+ export function YesNoDialog({open, title, message, yesText = "Yes", noText = "No", YesAction, NoAction}) {
10
10
  // Declare a new state variable, which we'll call "count"
11
11
  //const [count, setCount] = useState(0);
12
12
 
@@ -1,392 +0,0 @@
1
- import React, {useEffect, useState} from 'react';
2
- import { Box } from '@mui/system';
3
- import Grid from '@mui/material/Grid';
4
- import Tabs from '@mui/material/Tabs';
5
- import Tab from '@mui/material/Tab';
6
- import Typography from '@mui/material/Typography';
7
- import InputLabel from '@mui/material/InputLabel';
8
- import MenuItem from '@mui/material/MenuItem';
9
- import FormControl from '@mui/material/FormControl';
10
- import Select from '@mui/material/Select';
11
- // import { apiService } from 'authscape';
12
- import TextField from '@mui/material/TextField';
13
- import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
14
- // import Comments from '../comments';
15
- import { Button, Card, CardActions, CardContent, CardMedia, Stack } from "@mui/material";
16
- import InsertDriveFileRoundedIcon from '@mui/icons-material/InsertDriveFileRounded';
17
- import ArrowBackIosRoundedIcon from '@mui/icons-material/ArrowBackIosRounded';
18
-
19
- export const TicketDetail = ({ticketId, setIsLoading, currentUser, GoBackToViewTickets = null, customTabName = null, customTabElement = null}) => {
20
-
21
- const [value, setValue] = useState(0);
22
- const [status, setStatus] = useState(null);
23
- const [ticketType, setTicketType] = useState(null);
24
- const [ticket, setTicket] = useState(null);
25
- const [priorty, setPriority] = useState(0);
26
- const [participants, setParticipants] = useState([]);
27
- const [ticketAttachments, setTicketAttachments] = useState([]);
28
- const [customTabPayload, setCustomTabPayload] = useState(null);
29
-
30
- const [ticketDescription, setTicketDescription] = useState(null);
31
-
32
- const [createdByList, setCreatedByList] = useState([]);
33
- const [selectedCreatedBy, setSelectedCreatedBy] = useState(null);
34
-
35
- useEffect(() => {
36
-
37
- const fetchData = async () => {
38
- setIsLoading(true);
39
- let response = await apiService().get("/Ticket/GetTicket?ticketId=" + ticketId);
40
- if (response != null && response.status == 200)
41
- {
42
- setTicket(response.data);
43
-
44
- setIsLoading(false);
45
- setStatus(response.data.selectedTicketStatusId);
46
- setTicketType(response.data.selectedTicketTypeId);
47
- setPriority(response.data.selectedPriortyId);
48
- setSelectedCreatedBy(response.data.selectedCreatedBy);
49
- setParticipants(response.data.participants);
50
- setTicketAttachments(response.data.attachments);
51
- setCustomTabPayload(response.data.customTabPayload);
52
- setTicketDescription(response.data.description);
53
- }
54
- }
55
-
56
- fetchData();
57
-
58
- }, []);
59
-
60
- function TabPanel(props) {
61
- const { children, value, index, ...other } = props;
62
-
63
- return (
64
- <div
65
- role="tabpanel"
66
- hidden={value !== index}
67
- id={`simple-tabpanel-${index}`}
68
- aria-labelledby={`simple-tab-${index}`}
69
- {...other}
70
- >
71
- {value === index && (
72
- <Box sx={{ p: 3 }}>
73
- <Typography>{children}</Typography>
74
- </Box>
75
- )}
76
- </div>
77
- );
78
- }
79
-
80
- function a11yProps(index) {
81
- return {
82
- id: `simple-tab-${index}`,
83
- 'aria-controls': `simple-tabpanel-${index}`,
84
- };
85
- }
86
-
87
- const handleChange = (event, newValue) => {
88
- setValue(newValue);
89
- };
90
-
91
- const refreshCreatedByList = async (query) => {
92
-
93
- let response = await apiService().get("/ticket/findUser?query=" + query);
94
- if (response != null && response.status == 200)
95
- {
96
- setCreatedByList(response.data);
97
- }
98
- }
99
-
100
- const DownloadFile = ({fileName, uri}) => {
101
-
102
- return (
103
- <Card
104
- sx={{
105
- border: "1px solid black",
106
- padding: "10px",
107
- margin: "10px",
108
- width: "200px",
109
- textAlign:"center",
110
- // display: "flex",
111
- // alignItems: "center",
112
- justifyContent: "space-between",
113
- }}>
114
- <Stack spacing={2}>
115
- <Box sx={{textAlign:"center"}}>
116
- <InsertDriveFileRoundedIcon sx={{fontSize:50}} />
117
- </Box>
118
- <Typography variant="h6" component="div">
119
- {fileName}
120
- </Typography>
121
- <Button variant="contained" color="primary" onClick={() => {
122
- window.open(uri);
123
- }}>
124
- Download
125
- </Button>
126
- </Stack>
127
- </Card>
128
- )
129
- }
130
-
131
- return (
132
- <div>
133
-
134
- <Box sx={{width: '100%' }}>
135
-
136
- <Button variant="contained" startIcon={<ArrowBackIosRoundedIcon />} onClick={() => {
137
-
138
- if (GoBackToViewTickets != null)
139
- {
140
- GoBackToViewTickets();
141
- }
142
-
143
- }}>Go Back</Button>
144
-
145
-
146
- <Box>
147
- <h2>{ticket != null && ticket.name}</h2>
148
- </Box>
149
-
150
- <Grid container spacing={2}>
151
- <Grid item xs={4}>
152
-
153
- <Box sx={{ minWidth: 120 }}>
154
- <Box>
155
- Status:
156
- </Box>
157
- <FormControl fullWidth>
158
- <Select
159
- labelId="demo-simple-select-label"
160
- id="demo-simple-select"
161
- value={status}
162
- displayEmpty
163
- inputProps={{ 'aria-label': 'Without label' }}
164
- InputLabelProps={{ shrink: true }}
165
- onChange={async (val) =>{
166
- setStatus(val.target.value);
167
-
168
- await apiService().put("/ticket/UpdateStatus", {
169
- id: ticket.id,
170
- ticketStatusId: val.target.value
171
- });
172
-
173
- }}>
174
-
175
- {ticket != null && ticket.ticketStatuses.map((status, index) => {
176
- return (
177
- <MenuItem key={index} value={status.id}>{status.name}</MenuItem>
178
- )
179
- })}
180
-
181
- </Select>
182
- </FormControl>
183
- </Box>
184
-
185
- <Box sx={{paddingTop:2}}>
186
- <Box>
187
- Assigned to:
188
- </Box>
189
-
190
- {selectedCreatedBy != null &&
191
- <Autocomplete
192
- disablePortal
193
- options={createdByList}
194
- value={selectedCreatedBy}
195
- onChange={async (event, newValue) => {
196
- setSelectedCreatedBy(newValue.id);
197
- }}
198
- renderInput={(params) => <TextField {...params} label={""} onChange={(val) => {
199
- refreshCreatedByList(val.currentTarget.value);
200
- }} />}
201
- />
202
- }
203
-
204
- {ticket != null &&
205
- <>
206
- <Box sx={{paddingTop:1, fontSize:18}}>
207
- {ticket.assignedFirstName + " " + ticket.assignedLastName} ({ticket.assignedEmail})
208
- </Box>
209
- </>
210
- }
211
-
212
- </Box>
213
-
214
- {/* <Box>
215
- Company
216
- </Box> */}
217
-
218
- <Box sx={{paddingTop:2}}>
219
- <Box sx={{ minWidth: 120 }}>
220
- <Box>
221
- Priority:
222
- </Box>
223
- <FormControl fullWidth>
224
- <InputLabel id="demo-simple-select-label"></InputLabel>
225
- <Select
226
- labelId="demo-simple-select-label"
227
- id="demo-simple-select"
228
- value={priorty}
229
- label=""
230
- onChange={async (val) =>{
231
- setPriority(val.target.value);
232
-
233
- await apiService().put("/ticket/UpdateTicketPriority", {
234
- id: ticket.id,
235
- priorityLevel: val.target.value
236
- });
237
-
238
- }}>
239
- <MenuItem value={0}>None</MenuItem>
240
- <MenuItem value={1}>Low</MenuItem>
241
- <MenuItem value={2}>Medium</MenuItem>
242
- <MenuItem value={3}>High</MenuItem>
243
- <MenuItem value={4}>Urgent</MenuItem>
244
- </Select>
245
- </FormControl>
246
- </Box>
247
- </Box>
248
-
249
-
250
- </Grid>
251
- <Grid item xs={4}>
252
-
253
- <Box sx={{ minWidth: 120 }}>
254
- <Box>
255
- Ticket Type:
256
- </Box>
257
- <FormControl fullWidth>
258
- <InputLabel id="demo-simple-select-label"></InputLabel>
259
- <Select
260
- labelId="demo-simple-select-label"
261
- id="ticketType"
262
- value={ticketType}
263
- label=""
264
- onChange={async (val) =>{
265
- setTicketType(val.target.value);
266
-
267
- await apiService().put("/ticket/UpdateTicketType", {
268
- id: ticket.id,
269
- TicketTypeId: val.target.value
270
- });
271
-
272
- }}>
273
- {ticket != null && ticket.ticketTypes.map((status, index) => {
274
- return (
275
- <MenuItem key={index} value={status.id}>{status.name}</MenuItem>
276
- )
277
- })}
278
-
279
- </Select>
280
- </FormControl>
281
- </Box>
282
-
283
- <Box sx={{paddingTop:2}}>
284
-
285
- <Box>
286
- Participants:
287
- </Box>
288
- <Autocomplete
289
- multiple={true}
290
- disablePortal
291
- value={participants}
292
- options={createdByList}
293
- onChange={async (event, newValue) => {
294
-
295
- // alert(JSON.stringify(newValue));
296
-
297
- await apiService().put("/ticket/UpdateParticipants", {
298
- ticketId: ticketId,
299
- participants: newValue
300
- });
301
-
302
- setParticipants(newValue);
303
- }}
304
- renderInput={(params) => <TextField {...params} label={""} onChange={(val) => {
305
- refreshCreatedByList(val.currentTarget.value);
306
- }} />}
307
- />
308
- {/* <TextField id="lastUpdated" fullWidth={true} InputLabelProps={{ shrink: true }} disabled={true} label="Participants" variant="outlined" autoFocus={true} value={(ticket != null ? ticket.lastUpdated : "")} /> */}
309
- </Box>
310
- </Grid>
311
- <Grid item xs={4}>
312
- <Box>
313
- <Box>
314
- Created:
315
- </Box>
316
- <TextField id="created" fullWidth={true} InputLabelProps={{ shrink: true }} disabled={true} label="" variant="outlined" autoFocus={true} value={(ticket != null ? ticket.created : "")} />
317
- </Box>
318
- <Box sx={{paddingTop:2}}>
319
- <Box>
320
- Last Updated:
321
- </Box>
322
- <TextField id="lastUpdated" fullWidth={true} InputLabelProps={{ shrink: true }} disabled={true} label="" variant="outlined" autoFocus={true} value={(ticket != null ? ticket.lastUpdated : "")} />
323
- </Box>
324
- </Grid>
325
- </Grid>
326
- </Box>
327
-
328
- <Box sx={{ width: '100%', marginTop:2 }}>
329
- <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
330
- <Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
331
- <Tab label="Description" {...a11yProps(0)} />
332
- <Tab label="Chat" {...a11yProps(1)} />
333
- <Tab label="Notes" {...a11yProps(2)} />
334
- <Tab label="Attachments" {...a11yProps(3)} />
335
-
336
- {customTabName != null &&
337
- <Tab label={customTabName} {...a11yProps(4)} />
338
- }
339
-
340
- </Tabs>
341
- </Box>
342
- <TabPanel value={value} index={0}>
343
-
344
- <Box dangerouslySetInnerHTML={{
345
- __html: ticketDescription,
346
- }}>
347
- </Box>
348
-
349
- </TabPanel>
350
-
351
- <TabPanel value={value} index={1}>
352
-
353
- {ticket != null &&
354
- <Comments ticketId={ticket.id} isDisabled={false} isNote={false} currentUser={currentUser} />
355
- }
356
-
357
- </TabPanel>
358
- <TabPanel value={value} index={2}>
359
- {ticket != null &&
360
- <Comments ticketId={ticket.id} isDisabled={false} isNote={true} currentUser={currentUser} />
361
- }
362
- </TabPanel>
363
- <TabPanel value={value} index={3}>
364
- {ticket != null &&
365
- <>
366
- {ticketAttachments.map((attachment) => {
367
- return (
368
- <DownloadFile fileName={attachment.name} uri={attachment.url} />
369
- )
370
- })}
371
-
372
- {ticketAttachments.length == 0 &&
373
- <Box>
374
- There are no attachments
375
- </Box>
376
- }
377
-
378
- </>
379
- }
380
- </TabPanel>
381
-
382
- {customTabName != null &&
383
- <TabPanel value={value} index={4}>
384
- {customTabElement(customTabPayload)}
385
- </TabPanel>
386
- }
387
-
388
- </Box>
389
-
390
- </div>
391
- )
392
- }
@@ -1,247 +0,0 @@
1
- import React, {useEffect, useState} from 'react';
2
- // import {apiService, authService} from 'authscape';
3
- import Button from '@mui/material/Button';
4
- import { Box } from '@mui/system';
5
- import {
6
- DataGrid,
7
- GridActionsCellItem,
8
- } from "@mui/x-data-grid";
9
- import DeleteRoundedIcon from "@mui/icons-material/DeleteRounded";
10
- import Typography from '@mui/material/Typography';
11
- import AppBar from '@mui/material/AppBar';
12
- import Toolbar from '@mui/material/Toolbar';
13
- // import YesNoDialog from '../../components/yesNoDialog';
14
- import VisibilityRoundedIcon from '@mui/icons-material/VisibilityRounded';
15
- import AddRoundedIcon from '@mui/icons-material/AddRounded';
16
- import InputLabel from '@mui/material/InputLabel';
17
- import MenuItem from '@mui/material/MenuItem';
18
- import FormControl from '@mui/material/FormControl';
19
- import Select, { SelectChangeEvent } from '@mui/material/Select';
20
- import Grid from '@mui/material/Grid';
21
- // import TicketDetail from './TicketDetail';
22
- import { useRouter } from 'next/router';
23
-
24
- export function Tickets({loadedUser, setIsLoading, currentUser, customTabName = null, customTabElement = null }) {
25
-
26
- const [tickets, setTickets] = useState([]);
27
-
28
- const [archiveTicketId, setArchiveTicketId] = useState(null);
29
- const [totalTickets, setTotalTickets] = useState(0);
30
- const [pageNumber, setPageNumber] = useState(1);
31
-
32
- const [ticketStatuses, setTicketStatuses] = useState([]);
33
- const [ticketTypes, setTicketTypes] = useState([]);
34
-
35
- const [ticketTypeId, setTicketTypeId] = useState(null);
36
- const [statusId, setStatusId] = useState(null);
37
-
38
- const [selectedTicketId, setSelectedTicketId] = useState(null);
39
-
40
- const router = useRouter();
41
-
42
-
43
- useEffect(() => {
44
-
45
- if (router.query.id != null)
46
- {
47
- setSelectedTicketId(router.query.id);
48
- }
49
-
50
- }, [router.isReady])
51
-
52
- const columns = [
53
- { field: 'id', headerName: 'Id', width: 150 },
54
- { field: 'title', flex: 1, headerName: 'Customer', width: 200 },
55
- { field: 'ticketStatus', headerName: 'Status', width: 150 },
56
- { field: 'ticketType', headerName: 'Ticket Type', width: 150 },
57
- { field: 'created', headerName: 'Created', width: 150 },
58
- { field: 'ticketParticipants', headerName: 'Participants', width: 150 },
59
- { field: 'messages', headerName: 'Messages', width: 150 },
60
- {
61
- field: "actions",
62
- type: "actions",
63
- width: 200,
64
- headerName: "Actions",
65
- cellClassName: "actions",
66
- getActions: ({ id, row }) => {
67
- return [
68
- <GridActionsCellItem key={id}
69
- icon={<VisibilityRoundedIcon />}
70
- label="View"
71
- onClick={() => {
72
- setSelectedTicketId(row.id);
73
- }}
74
- />,
75
- <GridActionsCellItem key={id}
76
- icon={<DeleteRoundedIcon />}
77
- label="Delete"
78
- className="textPrimary"
79
- onClick={() => {
80
- setArchiveTicketId(row.id);
81
- }}
82
- />,
83
- ];
84
- },
85
- }
86
- ];
87
-
88
- const reloadTickets = async () => {
89
- let response = await apiService().get("/ticket/GetTickets?pageNumber=" + pageNumber + "&pageSize=20&ticketStatusId=" + (statusId != null ? statusId: "") + "&ticketTypeId=" + (ticketTypeId != null ? ticketTypeId : ""));
90
- if (response != null && response.status == 200)
91
- {
92
- setTotalTickets(response.data.data.length);
93
- setTickets(response.data.data);
94
- }
95
- }
96
-
97
- useEffect(() => {
98
-
99
- if (loadedUser)
100
- {
101
- let fetchStatusesAndTypes = async () => {
102
- let responseStatus = await apiService().get("/Ticket/GetStatuses");
103
- if (responseStatus != null && responseStatus.status == 200)
104
- {
105
- setTicketStatuses(responseStatus.data);
106
- }
107
-
108
- let responseType = await apiService().get("/Ticket/GetTicketTypes");
109
- if (responseType != null && responseType.status == 200)
110
- {
111
- setTicketTypes(responseType.data);
112
- }
113
- }
114
-
115
- fetchStatusesAndTypes();
116
- setTicketStatuses();
117
- }
118
-
119
- }, [loadedUser]);
120
-
121
-
122
- useEffect(() => {
123
-
124
- if (loadedUser)
125
- {
126
- reloadTickets();
127
- }
128
-
129
- }, [loadedUser, ticketTypeId, statusId]);
130
-
131
- return (
132
- <div>
133
-
134
- {selectedTicketId != null &&
135
- <TicketDetail ticketId={selectedTicketId} setIsLoading={setIsLoading} currentUser={currentUser} customTabName={customTabName} customTabElement={customTabElement} GoBackToViewTickets={() =>
136
- {
137
- setSelectedTicketId(null);
138
- }} />
139
- }
140
- {selectedTicketId == null &&
141
- <>
142
- <Box sx={{ flexGrow: 1 }}>
143
- <AppBar position="static" color='inherit' elevation={0}>
144
- <Toolbar>
145
- <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
146
- Tickets
147
- </Typography>
148
- <Button color="primary" variant="contained" startIcon={<AddRoundedIcon/>} onClick={async () => {
149
-
150
- let response = await apiService().post("/Ticket/CreateTicket", {
151
- ticketTypeId: 1,
152
- ticketStatusId: 1,
153
- description: "about this",
154
- message: "More about this"
155
- });
156
-
157
- window.location.href = "/ticket/" + response.data;
158
-
159
- }}>Create Ticket</Button>
160
- </Toolbar>
161
- </AppBar>
162
- </Box>
163
-
164
- <Grid container spacing={2} sx={{paddingTop:2, paddingBottom:2}}>
165
- <Grid item xs={4}>
166
-
167
- <Box>
168
- <FormControl fullWidth>
169
- <InputLabel id="demo-simple-select-label">Ticket Status</InputLabel>
170
- <Select
171
- labelId="demo-simple-select-label"
172
- id="demo-simple-select"
173
- value={statusId}
174
- label="ticketStatus"
175
- onChange={(event) => {
176
- setStatusId(event.target.value);
177
- }}>
178
-
179
- <MenuItem value={null}>Not Assigned</MenuItem>
180
-
181
- {ticketStatuses != null && ticketStatuses.map((tStatus) => {
182
- return (
183
- <MenuItem value={tStatus.id}>{tStatus.name}</MenuItem>
184
- )
185
- })}
186
-
187
- </Select>
188
- </FormControl>
189
- </Box>
190
-
191
- </Grid>
192
- <Grid item xs={4}>
193
-
194
- <Box>
195
- <FormControl fullWidth>
196
- <InputLabel id="demo-simple-select-label">Ticket Type</InputLabel>
197
- <Select
198
- labelId="demo-simple-select-label"
199
- id="demo-simple-select"
200
- value={ticketTypeId}
201
- label="TicketType"
202
- onChange={(event) => {
203
- setTicketTypeId(event.target.value);
204
- }}>
205
-
206
- <MenuItem value={null}>Not Assigned</MenuItem>
207
-
208
- {ticketTypes != null && ticketTypes.map((tTicketType) => {
209
- return (
210
- <MenuItem value={tTicketType.id}>{tTicketType.name}</MenuItem>
211
- )
212
- })}
213
-
214
- </Select>
215
- </FormControl>
216
- </Box>
217
-
218
- </Grid>
219
- </Grid>
220
-
221
- <Box sx={{height: 600, width: '100%' }}>
222
- <DataGrid
223
- rows={tickets}
224
- columns={columns}
225
- onPageChange={(newPage) => {
226
- setPageNumber(newPage);
227
- }}
228
- pageSize={totalTickets}
229
- rowsPerPageOptions={[20]}
230
- />
231
- </Box>
232
-
233
- <YesNoDialog open={archiveTicketId != null ? true : false} title={"Remove Ticket"} message={"Are you sure you want to archive this ticket?"}
234
- YesAction={async () => {
235
- await apiService().delete("/Ticket/ArchiveTicket?id=" + archiveTicketId);
236
- await reloadTickets();
237
- setArchiveTicketId(null);
238
- }}
239
- NoAction={() => {
240
- setArchiveTicketId(null);
241
- }} />
242
- </>
243
- }
244
- </div>
245
-
246
- )
247
- }