2 Achegas 7b23a78b8d ... 7cc0737617

Autor SHA1 Mensaxe Data
  amenpunk 7cc0737617 modal report fix hai 1 ano
  amenpunk 7354c36d4e role comment hai 1 ano

+ 2 - 2
src/Components/Modal/PasswordModal.jsx

@@ -128,14 +128,14 @@ export function HelpModal(props) {
128 128
   return (
129 129
     <Dialog 
130 130
       open={visible}
131
-      fullWidth="lg"
131
+      fullWidth
132 132
       maxWidth="md"
133 133
       aria-labelledby="contained-modal-title-vcenter"
134 134
       onHide={handleClose}
135 135
     >
136 136
       <DialogTitle>
137 137
         <button type="button" className="close" onClick={handleClose}>&times;</button>
138
-        <h4 className="modal-title">Crear Contraseña</h4>
138
+         Crear Contraseña
139 139
       </DialogTitle>
140 140
       <DialogContent className="modal-body">
141 141
 

+ 1 - 1
src/Components/Password/Steps/TypePwd.jsx

@@ -256,7 +256,7 @@ export function TypePwd(props) {
256 256
     const assignRecursos = (recursos_api) => {
257 257
       let templete = {
258 258
         1: { "label": 'Puestos', data: [] },
259
-        2: { "label": 'Varios', data: [] },
259
+        // 2: { "label": 'Varios', data: [] },
260 260
         3: { "label": 'General', data: [] },
261 261
         4: { "label": 'Contraseñas', data: [] },
262 262
         5: { "label": 'Reportes', data: [] }

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

@@ -153,12 +153,13 @@ export const TextLabels = {
153 153
   },
154 154
 }
155 155
 
156
-export const BuildColumns = (columns) => {
156
+export const BuildColumns = (columns, setId) => {
157
+  console.log("BUILD:", setId)
157 158
   return columns.map((column) => {
158 159
     return {
159 160
       'id' : column.id,
160 161
       'pwd' : atob( column.pwd ),
161
-      'users' : <DenseTable users={column.candidatospwds}/>,
162
+      'users' : <DenseTable users={column.candidatospwds} setId={(id) => setId(id)} />,
162 163
     }
163 164
   })
164 165
 

+ 8 - 4
src/Components/Resultados/TestDataTable.jsx

@@ -6,8 +6,9 @@ import { useQuery } from 'react-query';
6 6
 import { Service } from '../../Utils/HTTP'
7 7
 import MUIDataTable from "mui-datatables";
8 8
 
9
-export const TestDataTable = () => {
9
+export const TestDataTable = (props) => {
10 10
   
11
+  let { setId } = props; 
11 12
   const auth = useSelector((state) => state.token)
12 13
 
13 14
   const options = {
@@ -16,9 +17,12 @@ export const TestDataTable = () => {
16 17
     // textLabels: TextLabels,
17 18
     onRowClick: (test) => {
18 19
       //TODO: render exam
19
-      console.log(test)
20
+      // console.log(test)
21
+      setId(test[0])
20 22
     },
21
-    elevation: 9
23
+    elevation: 9,
24
+    download : false,
25
+    // count: 2
22 26
   };
23 27
 
24 28
   const getAllPwd = async () => {
@@ -33,7 +37,7 @@ export const TestDataTable = () => {
33 37
       <MUIDataTable
34 38
         sx={{ '& MuiPaper': { elevation: 0, boxShadow: 'none', color: "red" } }}
35 39
         title={"Expedientes"}
36
-        data={BuildColumns( status === 'success' ? data.data : [])}
40
+        data={BuildColumns( status === 'success' ? data.data : [], setId )}
37 41
         columns={Encabezados}
38 42
         options={options}
39 43
       />

+ 4 - 1
src/Pages/ContrasV2.jsx

@@ -44,7 +44,10 @@ export function Contrasv2() {
44 44
       setPassword({pwd,plz:plaza});
45 45
       setVisible(true);
46 46
     },
47
-    elevation:9
47
+    elevation:9,
48
+    rowsPerPage: 5,
49
+    count: 5,
50
+    download:false
48 51
   };
49 52
 
50 53
   return (

+ 53 - 42
src/Pages/Resultados.jsx

@@ -12,9 +12,9 @@ import '../pdf.css'
12 12
 // import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
13 13
 //
14 14
 //
15
-import { 
16
-  Button, Box, Paper,LinearProgress,
17
-  Typography
15
+import {
16
+  Button, Box, Paper, LinearProgress,
17
+  Typography, Dialog, DialogContent, DialogTitle
18 18
 } from '@mui/material'
19 19
 
20 20
 function LinearProgressWithLabel(props) {
@@ -61,42 +61,42 @@ const MyDocument = (props) => {
61 61
   return (
62 62
     <div>
63 63
 
64
-        {
65
-          progress < 100 ?
66
-          <LinearProgressWithLabel value={progress}/>
67
-            : null
68
-        }
64
+      {
65
+        progress < 100 ?
66
+          <LinearProgressWithLabel value={progress} />
67
+          : null
68
+      }
69 69
 
70 70
       <div className="pdf_controls">
71 71
 
72 72
 
73
-      <div className="btn_pdfcontrol">
74
-        <Button 
73
+        <div className="btn_pdfcontrol">
74
+          <Button
75 75
             className="btnmain"
76
-            style={{ margin: 2 }} 
77
-            variant="contained" 
76
+            style={{ margin: 2 }}
77
+            variant="contained"
78 78
             onClick={() => pageNumber > 1 ? setPageNumber(pageNumber - 1) : null} >
79
-          Anterior
80
-        </Button>
81
-        <Button 
79
+            Anterior
80
+          </Button>
81
+          <Button
82 82
             className="btnmain"
83
-            style={{ margin: 2 }} 
84
-            variant="contained" 
85
-            onClick={() => pageNumber + 1 <= numPages   ? setPageNumber(pageNumber + 1) : null} >
86
-          Siguiente
87
-        </Button>
88
-      </div>
83
+            style={{ margin: 2 }}
84
+            variant="contained"
85
+            onClick={() => pageNumber + 1 <= numPages ? setPageNumber(pageNumber + 1) : null} >
86
+            Siguiente
87
+          </Button>
88
+        </div>
89 89
 
90 90
         <div>
91
-          <b style={{marginRight : 15}}>
91
+          <b style={{ marginRight: 15 }}>
92 92
             Página {pageNumber} de {numPages}
93 93
           </b>
94 94
 
95
-          <Button 
95
+          <Button
96 96
             className="btnmain"
97
-            variant="contained" 
97
+            variant="contained"
98 98
             onClick={Download} >
99
-            <DownloadIcon/>
99
+            <DownloadIcon />
100 100
           </Button>
101 101
         </div>
102 102
 
@@ -104,13 +104,13 @@ const MyDocument = (props) => {
104 104
 
105 105
       <div className="Example__container">
106 106
         <div className="Example__container__document">
107
-          { pdf ?
108
-            (<Document 
109
-              renderMode="canvas" 
110
-              file={pdf?.data} 
111
-              onLoadSuccess={onDocumentLoadSuccess} 
107
+          {pdf ?
108
+            (<Document
109
+              renderMode="canvas"
110
+              file={pdf?.data}
111
+              onLoadSuccess={onDocumentLoadSuccess}
112 112
               loading={Loading}
113
-              onLoadProgress={({loaded, total}) => {
113
+              onLoadProgress={({ loaded, total }) => {
114 114
                 setProgress((loaded / total) * 100)
115 115
               }}
116 116
             >
@@ -129,14 +129,16 @@ export function Resultados() {
129 129
   let { id } = useParams();
130 130
   let auth = useSelector((state) => state.token)
131 131
   let [pdf, setPdf] = useState(null);
132
+  let [idResult, setIDResult] = useState(id);
132 133
 
133 134
   useEffect(() => {
135
+    console.log("ID:", idResult)
134 136
 
135
-    if(!id) {
137
+    if (!idResult) {
136 138
       console.log('no hay id')
137 139
       return
138 140
     }
139
-    let url = `/report/cleaverResult/${id}?output=pdf`
141
+    let url = `/report/cleaverResult/${idResult}?output=pdf`
140 142
     let rest = new Service(url);
141 143
 
142 144
     pdfjs.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
@@ -146,24 +148,33 @@ export function Resultados() {
146 148
       .then(blob => setPdf(blob))
147 149
       .catch(error => console.log({ error }))
148 150
 
149
-  }, [auth, id])
151
+  }, [auth, idResult])
150 152
 
151 153
   return (
152 154
     <div className="content-section">
153 155
       <div className="main">
154 156
         <Box sx={{ width: '100%' }}>
155
-          <Paper 
156
-            elevation={2} 
157
+          <Paper
158
+            elevation={2}
157 159
             sx={{ mb: 2, padding: 2, height: '100%', minHeight: '95vh', boxShadow: 'none !important' }}>
158
-            <h1>Reporte de Resultados</h1><hr/>
159
-            <TestDataTable/>
160
-            {
161
-              pdf ? 
162
-                ( <MyDocument token={auth.token} id={id} pdf={pdf} />) : null
163
-            }
160
+            <h1>Reporte de Resultados</h1><hr />
161
+            <TestDataTable setId={setIDResult} />
164 162
           </Paper>
165 163
         </Box>
166 164
       </div>
165
+
166
+      <Dialog open={pdf !== null} fullWidth maxWidth="lg" onHide={() => setPdf(null)}>
167
+        <DialogTitle>Reporte de Resultados
168
+          <button type="button" className="close" onClick={() => setPdf(null)}>&times;</button>
169
+        </DialogTitle>
170
+        <DialogContent>
171
+          {
172
+            pdf ?
173
+              (<MyDocument token={auth.token} id={id} pdf={pdf} />) : null
174
+          }
175
+        </DialogContent>
176
+      </Dialog>
177
+
167 178
     </div>
168 179
   )
169 180
 }

+ 16 - 10
src/temp.js

@@ -7,7 +7,7 @@ import TableHead from '@mui/material/TableHead';
7 7
 import TableRow from '@mui/material/TableRow';
8 8
 import Paper from '@mui/material/Paper';
9 9
 import { } from '@mui/material'
10
-import { useNavigate } from 'react-router-dom'
10
+// import { useNavigate } from 'react-router-dom'
11 11
 import { useSelector } from 'react-redux';
12 12
 import { Service } from './Utils/HTTP';
13 13
 
@@ -27,7 +27,9 @@ import {
27 27
 
28 28
 function IconStatus(props) {
29 29
 
30
-  let navigate = useNavigate()
30
+  let { pwd, setId } = props
31
+  // let navigate = useNavigate()
32
+  // console.log('MPROP',props)
31 33
   let auth = useSelector((state) => state.token)
32 34
 
33 35
   const calificar = () => {
@@ -36,7 +38,10 @@ function IconStatus(props) {
36 38
     rest
37 39
       .getQuery(auth.token)
38 40
       .then(r => {
39
-        navigate('/dashboard/resultados/' + props.pwd)
41
+        console.log("SENDING ID:", pwd)
42
+        setId(pwd)()
43
+        // console.log('RESULTADO:',r)
44
+        // navigate('/dashboard/resultados/' + props.pwd)
40 45
       })
41 46
       .catch(e => {
42 47
         // navigate('/dashboard/resultados/' + props.pwd)
@@ -64,7 +69,7 @@ function IconStatus(props) {
64 69
 
65 70
 
66 71
 
67
-function getOperation(estado, SuperPWD) {
72
+function getOperation(estado, SuperPWD,setId) {
68 73
   // Patrik: 100 -> Significa que el examen esta completo
69 74
   // Patrik: 99 -> Que el candidato lo esta haciendo (como "doing test" del otro servicio)
70 75
   // Patrik: 97 ->  Que hay un error y que hay mas respuestas de las que deberian
@@ -77,7 +82,7 @@ function getOperation(estado, SuperPWD) {
77 82
     case 99: // el candidato se encuentra realizndolo
78 83
       return <IconStatus color="#f5f511" icon={AssignmentTurnedInIcon} message="El candidato se encuentra realizando la prueba" />
79 84
     case 100: // finalizado
80
-      return <IconStatus color="#0bd641" estado={100} icon={CheckBoxIcon} message="Calificar el examen" pwd={SuperPWD} />
85
+      return <IconStatus setId={setId} color="#0bd641" estado={100} icon={CheckBoxIcon} message="Calificar el examen" pwd={SuperPWD} />
81 86
     default: return null
82 87
   }
83 88
 }
@@ -85,7 +90,8 @@ function getOperation(estado, SuperPWD) {
85 90
 
86 91
 function Asignaciones(props) {
87 92
 
88
-  let { estado, cattest, id: SuperPWD } = props.asign;
93
+  let { asign, setId } = props;
94
+  let { estado, cattest, id: SuperPWD } = asign;
89 95
 
90 96
   return (
91 97
     <tr>
@@ -106,7 +112,7 @@ function Asignaciones(props) {
106 112
             ) : null
107 113
       */}
108 114
         {
109
-          getOperation(estado, SuperPWD)
115
+          getOperation(estado, SuperPWD, setId)
110 116
         }
111 117
       </td>
112 118
     </tr>
@@ -117,8 +123,8 @@ function Asignaciones(props) {
117 123
 
118 124
 
119 125
 export function DenseTable(props) {
120
-  let { users} = props
121
-  console.log("users", users)
126
+  let { users,setId } = props
127
+  // console.log("users", users)
122 128
   return (
123 129
     <TableContainer component={Paper}>
124 130
       <Table sx={{ minWidth: 650 }} size="small" aria-label="a dense table">
@@ -138,7 +144,7 @@ export function DenseTable(props) {
138 144
                 {row.candi.nombre  + " " + row.candi.apellidos}
139 145
               </TableCell>
140 146
               <TableCell align="left">
141
-                {row.asignaciones.map(a => <Asignaciones key={a.id} asign={a}/>)}
147
+                {row.asignaciones.map(a => <Asignaciones setId={setId} key={a.id} asign={a}/>)}
142 148
               </TableCell>
143 149
             </TableRow>
144 150
           ))}