|
@@ -1,85 +1,149 @@
|
1
|
1
|
import * as React from 'react';
|
2
|
|
-import Box from '@mui/material/Box';
|
3
|
|
-import FormLabel from '@mui/material/FormLabel';
|
4
|
|
-import FormControl from '@mui/material/FormControl';
|
5
|
|
-import FormGroup from '@mui/material/FormGroup';
|
6
|
|
-import FormControlLabel from '@mui/material/FormControlLabel';
|
7
|
|
-import FormHelperText from '@mui/material/FormHelperText';
|
8
|
|
-import Checkbox from '@mui/material/Checkbox';
|
9
|
|
-
|
10
|
|
-export default function CheckboxesGroup() {
|
11
|
|
- const [state, setState] = React.useState({
|
12
|
|
- gilad: true,
|
13
|
|
- jason: false,
|
14
|
|
- antoine: false,
|
15
|
|
- });
|
16
|
|
-
|
17
|
|
- const handleChange = (event) => {
|
18
|
|
- setState({
|
19
|
|
- ...state,
|
20
|
|
- [event.target.name]: event.target.checked,
|
21
|
|
- });
|
22
|
|
- };
|
23
|
|
-
|
24
|
|
- const { gilad, jason, antoine } = state;
|
25
|
|
- const error = [gilad, jason, antoine].filter((v) => v).length !== 2;
|
|
2
|
+import Table from '@mui/material/Table';
|
|
3
|
+import TableBody from '@mui/material/TableBody';
|
|
4
|
+import TableCell from '@mui/material/TableCell';
|
|
5
|
+import TableContainer from '@mui/material/TableContainer';
|
|
6
|
+import TableHead from '@mui/material/TableHead';
|
|
7
|
+import TableRow from '@mui/material/TableRow';
|
|
8
|
+import Paper from '@mui/material/Paper';
|
|
9
|
+import { } from '@mui/material'
|
|
10
|
+import { useNavigate } from 'react-router-dom'
|
|
11
|
+import { useSelector } from 'react-redux';
|
|
12
|
+import { Service } from './Utils/HTTP';
|
26
|
13
|
|
|
14
|
+import {
|
|
15
|
+ IconButton, Tooltip,
|
|
16
|
+} from '@mui/material';
|
|
17
|
+
|
|
18
|
+import {
|
|
19
|
+ CheckBox as CheckBoxIcon,
|
|
20
|
+ AddTask as AddTaskIcon,
|
|
21
|
+ // NewReleases as NewReleasesIcon,
|
|
22
|
+ Error as ErrorIcon,
|
|
23
|
+ AssignmentTurnedIn as AssignmentTurnedInIcon
|
|
24
|
+} from '@mui/icons-material'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+function IconStatus(props) {
|
|
29
|
+
|
|
30
|
+ let navigate = useNavigate()
|
|
31
|
+ let auth = useSelector((state) => state.token)
|
|
32
|
+
|
|
33
|
+ const calificar = () => {
|
|
34
|
+ let rest = new Service(`/prueba/calificacion/cleaver/report/${props.pwd}`);
|
|
35
|
+
|
|
36
|
+ rest
|
|
37
|
+ .getQuery(auth.token)
|
|
38
|
+ .then(r => {
|
|
39
|
+ navigate('/dashboard/resultados/' + props.pwd)
|
|
40
|
+ })
|
|
41
|
+ .catch(e => {
|
|
42
|
+ // navigate('/dashboard/resultados/' + props.pwd)
|
|
43
|
+ })
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+ return (
|
|
48
|
+ <Tooltip title={props.message}>
|
|
49
|
+ <IconButton
|
|
50
|
+ onClick={() => {
|
|
51
|
+ if (parseInt(props.estado) === 100) {
|
|
52
|
+ calificar()
|
|
53
|
+ // navigate('/dashboard/resultados/' + props.pwd)
|
|
54
|
+ }
|
|
55
|
+ }}
|
|
56
|
+ style={{ color: props.color }}
|
|
57
|
+ components="label">
|
|
58
|
+ {<props.icon />}
|
|
59
|
+ </IconButton>
|
|
60
|
+ </Tooltip>
|
|
61
|
+
|
|
62
|
+ )
|
|
63
|
+}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+function getOperation(estado, SuperPWD) {
|
|
68
|
+ // Patrik: 100 -> Significa que el examen esta completo
|
|
69
|
+ // Patrik: 99 -> Que el candidato lo esta haciendo (como "doing test" del otro servicio)
|
|
70
|
+ // Patrik: 97 -> Que hay un error y que hay mas respuestas de las que deberian
|
|
71
|
+ // Patrik: 1 -> Solo esta asignado.
|
|
72
|
+ switch (estado) {
|
|
73
|
+ case 1: // solo asignado
|
|
74
|
+ return <IconStatus color="#0bd641" icon={AddTaskIcon} message="Candidato Asignado" />
|
|
75
|
+ case 97: //error en las respuestas
|
|
76
|
+ return <IconStatus color="var(--main)" icon={ErrorIcon} message="Hay error en las respuestas" />
|
|
77
|
+ case 99: // el candidato se encuentra realizndolo
|
|
78
|
+ return <IconStatus color="#f5f511" icon={AssignmentTurnedInIcon} message="El candidato se encuentra realizando la prueba" />
|
|
79
|
+ case 100: // finalizado
|
|
80
|
+ return <IconStatus color="#0bd641" estado={100} icon={CheckBoxIcon} message="Calificar el examen" pwd={SuperPWD} />
|
|
81
|
+ default: return null
|
|
82
|
+ }
|
|
83
|
+}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+function Asignaciones(props) {
|
|
87
|
+
|
|
88
|
+ let { estado, cattest, id: SuperPWD } = props.asign;
|
|
89
|
+
|
|
90
|
+ return (
|
|
91
|
+ <tr>
|
|
92
|
+ <td className="asign_status">
|
|
93
|
+ {cattest.decription}
|
|
94
|
+ {/*
|
|
95
|
+ test_result.length > 0 ?
|
|
96
|
+ (
|
|
97
|
+ <Tooltip title="Mostrar resultados">
|
|
98
|
+ <IconButton
|
|
99
|
+ onClick={() => navigate('/dashboard/resultados/' + SuperPWD)}
|
|
100
|
+ style={{ color: '#0bd641' }}
|
|
101
|
+ aria-label="puesto_status"
|
|
102
|
+ components="label">
|
|
103
|
+ <CheckBoxIcon />
|
|
104
|
+ </IconButton>
|
|
105
|
+ </Tooltip>
|
|
106
|
+ ) : null
|
|
107
|
+ */}
|
|
108
|
+ {
|
|
109
|
+ getOperation(estado, SuperPWD)
|
|
110
|
+ }
|
|
111
|
+ </td>
|
|
112
|
+ </tr>
|
|
113
|
+ )
|
|
114
|
+}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+export function DenseTable(props) {
|
|
120
|
+ let { users} = props
|
|
121
|
+ console.log("users", users)
|
27
|
122
|
return (
|
28
|
|
- <Box sx={{ display: 'flex' }}>
|
29
|
|
- <FormControl sx={{ m: 3 }} component="fieldset" variant="standard">
|
30
|
|
- <FormLabel component="legend">Assign responsibility</FormLabel>
|
31
|
|
- <FormGroup>
|
32
|
|
- <FormControlLabel
|
33
|
|
- control={
|
34
|
|
- <Checkbox checked={gilad} onChange={handleChange} name="gilad" />
|
35
|
|
- }
|
36
|
|
- label="Gilad Gray"
|
37
|
|
- />
|
38
|
|
- <FormControlLabel
|
39
|
|
- control={
|
40
|
|
- <Checkbox checked={jason} onChange={handleChange} name="jason" />
|
41
|
|
- }
|
42
|
|
- label="Jason Killian"
|
43
|
|
- />
|
44
|
|
- <FormControlLabel
|
45
|
|
- control={
|
46
|
|
- <Checkbox checked={antoine} onChange={handleChange} name="antoine" />
|
47
|
|
- }
|
48
|
|
- label="Antoine Llorca"
|
49
|
|
- />
|
50
|
|
- </FormGroup>
|
51
|
|
- <FormHelperText>Be careful</FormHelperText>
|
52
|
|
- </FormControl>
|
53
|
|
- <FormControl
|
54
|
|
- required
|
55
|
|
- error={error}
|
56
|
|
- component="fieldset"
|
57
|
|
- sx={{ m: 3 }}
|
58
|
|
- variant="standard"
|
59
|
|
- >
|
60
|
|
- <FormLabel component="legend">Pick two</FormLabel>
|
61
|
|
- <FormGroup>
|
62
|
|
- <FormControlLabel
|
63
|
|
- control={
|
64
|
|
- <Checkbox checked={gilad} onChange={handleChange} name="gilad" />
|
65
|
|
- }
|
66
|
|
- label="Gilad Gray"
|
67
|
|
- />
|
68
|
|
- <FormControlLabel
|
69
|
|
- control={
|
70
|
|
- <Checkbox checked={jason} onChange={handleChange} name="jason" />
|
71
|
|
- }
|
72
|
|
- label="Jason Killian"
|
73
|
|
- />
|
74
|
|
- <FormControlLabel
|
75
|
|
- control={
|
76
|
|
- <Checkbox checked={antoine} onChange={handleChange} name="antoine" />
|
77
|
|
- }
|
78
|
|
- label="Antoine Llorca"
|
79
|
|
- />
|
80
|
|
- </FormGroup>
|
81
|
|
- <FormHelperText>You can display an error</FormHelperText>
|
82
|
|
- </FormControl>
|
83
|
|
- </Box>
|
|
123
|
+ <TableContainer component={Paper}>
|
|
124
|
+ <Table sx={{ minWidth: 650 }} size="small" aria-label="a dense table">
|
|
125
|
+ <TableHead>
|
|
126
|
+ <TableRow>
|
|
127
|
+ <TableCell align="left">Nombre</TableCell>
|
|
128
|
+ <TableCell align="left">Asignaciones</TableCell>
|
|
129
|
+ </TableRow>
|
|
130
|
+ </TableHead>
|
|
131
|
+ <TableBody>
|
|
132
|
+ {users.map((row) => (
|
|
133
|
+ <TableRow
|
|
134
|
+ key={row.name }
|
|
135
|
+ sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
|
|
136
|
+ >
|
|
137
|
+ <TableCell align="left" component="th" scope="row">
|
|
138
|
+ {row.candi.nombre + " " + row.candi.apellidos}
|
|
139
|
+ </TableCell>
|
|
140
|
+ <TableCell align="left">
|
|
141
|
+ {row.asignaciones.map(a => <Asignaciones key={a.id} asign={a}/>)}
|
|
142
|
+ </TableCell>
|
|
143
|
+ </TableRow>
|
|
144
|
+ ))}
|
|
145
|
+ </TableBody>
|
|
146
|
+ </Table>
|
|
147
|
+ </TableContainer>
|
84
|
148
|
);
|
85
|
149
|
}
|