|
@@ -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)}>×</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
|
}
|