amenpunk před 1 rokem
rodič
revize
99f5ef6b39

+ 1 - 1
src/Components/Navigation/MenuMovil.jsx

@@ -13,7 +13,7 @@ import { useDispatch } from 'react-redux';
13 13
 import { useNavigate } from 'react-router';
14 14
 import { removeToken } from '../../Slices/tokenSlice';
15 15
 
16
-const WITH_OF_PANEL = 50;
16
+const WITH_OF_PANEL = 70;
17 17
 
18 18
 export function MenuMovil(props) {
19 19
   let { anchor, control } = props;

+ 3 - 9
src/Components/Resultados/Config.jsx

@@ -1,4 +1,5 @@
1 1
 import { createTheme } from '@mui/material';
2
+import { DenseTable } from '../../../src/temp';
2 3
 
3 4
 export const TableStyle = () => createTheme({
4 5
   components: {
@@ -112,12 +113,6 @@ export const Encabezados = [
112 113
     name: 'users',
113 114
     numeric: false,
114 115
     disablePadding: true,
115
-    label: 'Usuarios',
116
-  },
117
-  {
118
-    name: 'asings',
119
-    numeric: false,
120
-    disablePadding: true,
121 116
     label: 'Asignaciones',
122 117
   },
123 118
 ]
@@ -161,10 +156,9 @@ export const TextLabels = {
161 156
 export const BuildColumns = (columns) => {
162 157
   return columns.map((column) => {
163 158
     return {
164
-      'id' : 0,
159
+      'id' : column.id,
165 160
       'pwd' : atob( column.pwd ),
166
-      'users' : "",
167
-      'asings' : "",
161
+      'users' : <DenseTable users={column.candidatospwds}/>,
168 162
     }
169 163
   })
170 164
 

+ 1 - 5
src/Components/Resultados/TestDataTable.jsx

@@ -15,10 +15,8 @@ export const TestDataTable = () => {
15 15
     customToolbar: () => { },
16 16
     // textLabels: TextLabels,
17 17
     onRowClick: (test) => {
18
+      //TODO: render exam
18 19
       console.log(test)
19
-      // let [plaza, pwd] = password;
20
-      // setPassword({pwd,plz:plaza});
21
-      // setVisible(true);
22 20
     },
23 21
     elevation: 9
24 22
   };
@@ -29,8 +27,6 @@ export const TestDataTable = () => {
29 27
   }
30 28
 
31 29
   const { data, status } = useQuery('homepwd', getAllPwd);
32
-  console.log('DATA: ', data)
33
-
34 30
 
35 31
   return (
36 32
     <ThemeProvider theme={TableStyle}>

+ 144 - 80
src/temp.js

@@ -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
 }