Browse Source

assign pruff

amenpunk 2 years ago
parent
commit
d0b40b3f2d

+ 15 - 1
src/App.css

283
 .card_test{
283
 .card_test{
284
     padding : 15px;
284
     padding : 15px;
285
 }
285
 }
286
-
286
+#start_title{
287
+    padding-bottom:20px;
288
+}
289
+.prueba_body{
290
+  padding: 15px;
291
+  background-color:red;
292
+  width : '100%';
293
+  min-height: 95vh;
294
+  display:flex;
295
+  flex-direction: column;
296
+  flex-wrap: nowrap;
297
+  justify-content: center;
298
+  align-items: center;
299
+  align-content: space-around;
300
+}
287
 
301
 
288
 
302
 

+ 0 - 2
src/Components/Dashboard.js

103
 
103
 
104
     return (
104
     return (
105
         <ThemeProvider theme={mdTheme}>
105
         <ThemeProvider theme={mdTheme}>
106
-
107
             <MenuMovil anchor={anchorElMovil} control={setAnchorElMov} />
106
             <MenuMovil anchor={anchorElMovil} control={setAnchorElMov} />
108
-
109
             <Box sx={{ display: 'flex' }}>
107
             <Box sx={{ display: 'flex' }}>
110
                 <AppBar style={{ backgroundColor: '#fff', boxShadow: 'None' }} position="absolute" open={open}>
108
                 <AppBar style={{ backgroundColor: '#fff', boxShadow: 'None' }} position="absolute" open={open}>
111
                     <Toolbar sx={{ pr: '24px', borderBottom: "1px solid #ec5e69" }} >
109
                     <Toolbar sx={{ pr: '24px', borderBottom: "1px solid #ec5e69" }} >

+ 6 - 2
src/Components/HomeUser/TestCard.jsx

5
 } from '@mui/material'
5
 } from '@mui/material'
6
 
6
 
7
 import QA from '../../Images/puesto.jpg'
7
 import QA from '../../Images/puesto.jpg'
8
+import { Link } from 'react-router-dom'
8
 
9
 
9
 export function TestCard(props) {
10
 export function TestCard(props) {
10
 
11
 
11
     let { test } = props;
12
     let { test } = props;
13
+    console.log('TEST: ', test)
12
     return (
14
     return (
13
         <Card className="card_test" elevation={0} sx={{ maxWidth: 500, maxHeight : 500 }}>
15
         <Card className="card_test" elevation={0} sx={{ maxWidth: 500, maxHeight : 500 }}>
14
             <CardActionArea>
16
             <CardActionArea>
28
                 </CardContent>
30
                 </CardContent>
29
             </CardActionArea>
31
             </CardActionArea>
30
             <CardActions>
32
             <CardActions>
33
+              <Link to={`/user/prueba/${test.id}`}>
31
                 <Button size="small" color="primary">
34
                 <Button size="small" color="primary">
32
-                    Realizar
33
-                </Button>
35
+                      Realizar
36
+                  </Button>
37
+              </Link>
34
             </CardActions>
38
             </CardActions>
35
         </Card>
39
         </Card>
36
     )
40
     )

+ 0 - 2
src/Components/Navigation/listItems.js

2
 import { Nav } from 'react-bootstrap';
2
 import { Nav } from 'react-bootstrap';
3
 
3
 
4
 import { Fingerprint, ExpandLess, ExpandMore } from '@mui/icons-material/'
4
 import { Fingerprint, ExpandLess, ExpandMore } from '@mui/icons-material/'
5
-
6
 import { useNavigate, useResolvedPath, useMatch } from 'react-router-dom'
5
 import { useNavigate, useResolvedPath, useMatch } from 'react-router-dom'
7
 import { Collapse,ListItem, List ,ListItemIcon,ListItemText,ListSubheader } from '@mui/material/'
6
 import { Collapse,ListItem, List ,ListItemIcon,ListItemText,ListSubheader } from '@mui/material/'
8
 
7
 
24
         setOpen(false);
23
         setOpen(false);
25
     }
24
     }
26
 
25
 
27
-
28
     return(
26
     return(
29
         <ListItem
27
         <ListItem
30
             sx={{ color : '#25344f'}}
28
             sx={{ color : '#25344f'}}

+ 44 - 45
src/Components/Routes.js

8
 import { Register } from '../Pages/Register'
8
 import { Register } from '../Pages/Register'
9
 import { Home } from '../Pages/Home'
9
 import { Home } from '../Pages/Home'
10
 import { Puestos } from '../Pages/Puestos'
10
 import { Puestos } from '../Pages/Puestos'
11
-// import { Contras  } from '../Pages/Contras'
12
-import { Contrasv2  as Contras } from '../Pages/ContrasV2'
11
+import { Contrasv2 as Contras } from '../Pages/ContrasV2'
13
 import { Expedientes } from '../Pages/Expedientes'
12
 import { Expedientes } from '../Pages/Expedientes'
14
 import { Resultados } from '../Pages/Resultados'
13
 import { Resultados } from '../Pages/Resultados'
15
 import { Configuracion } from '../Pages/Configuracion'
14
 import { Configuracion } from '../Pages/Configuracion'
22
 import { RestorePassword } from '../Pages/RestorePassword'
21
 import { RestorePassword } from '../Pages/RestorePassword'
23
 
22
 
24
 import { HomeUser } from '../Pages/HomeUser'
23
 import { HomeUser } from '../Pages/HomeUser'
24
+import { Prueba } from '../Pages/Prueba.jsx'
25
 
25
 
26
 import RequireAuth from '../Components/PrivateRoute'
26
 import RequireAuth from '../Components/PrivateRoute'
27
 
27
 
28
-export default function MyRoutes () {
28
+export default function MyRoutes() {
29
 
29
 
30
-    return(
31
-        <Routes>
30
+  return (
31
+    <Routes>
32
 
32
 
33
-            <Route path="/" element={<Navigate to='/login'/>} />
34
-            <Route path="login" element={<Login/>} />
35
-            <Route path="logincd" element={<LoginCs/>} />
36
-            <Route path="password/recuperar" element={<RestorePassword/>} />
37
-            <Route path="register" element={<Register/>} />
33
+      <Route path="/" element={<Navigate to='/login' />} />
34
+      <Route path="login" element={<Login />} />
35
+      <Route path="logincd" element={<LoginCs />} />
36
+      <Route path="password/recuperar" element={<RestorePassword />} />
37
+      <Route path="register" element={<Register />} />
38
 
38
 
39
+      <Route
40
+        path="user"
41
+        element={
42
+          <RequireAuth>
43
+            <User />
44
+          </RequireAuth>
45
+        }
46
+      >
47
+        <Route path="home" element={<HomeUser />} />
48
+        <Route path="prueba/:id" element={<Prueba/>} />
49
+      </Route>
39
 
50
 
40
 
51
 
41
-            <Route 
42
-                path="user" 
43
-                element={
44
-                    <RequireAuth>
45
-                        <User/>
46
-                    </RequireAuth>
47
-                }
48
-            >
49
-                <Route path="home" element={<HomeUser/>} />
50
-            </Route>
52
+      <Route
53
+        path="dashboard"
54
+        element={
55
+          <RequireAuth>
56
+            <Dashboard />
57
+          </RequireAuth>
58
+        }
59
+      >
60
+        <Route path="home" element={<Home />} />
61
+        <Route path="puestos" element={<Puestos />} />
62
+        <Route path="perfil" element={<Profile />} />
63
+        <Route path="contrasenas" element={<Contras />} />
64
+        <Route path="expedientes" element={<Expedientes />} />
65
+        <Route path="resultados" element={<Resultados />} />
66
+        <Route path="configuraciones" element={<Configuracion />} />
67
+        <Route path="historial" element={<Historial />} />
68
+        <Route path="pruebas/listar" element={<Pruebas />} />
69
+        <Route path="pruebas/crear" element={<PruebaNueva />} />
70
+        <Route path="pruebas/aplicar" element={<PruebaAsignar />} />
71
+      </Route>
72
+      <Route path="*" element={<NotFound />} />
51
 
73
 
52
-
53
-            <Route 
54
-                path="dashboard" 
55
-                element={
56
-                    <RequireAuth>
57
-                        <Dashboard/>
58
-                    </RequireAuth>
59
-                }
60
-            >
61
-                <Route path="home" element={<Home/>} />
62
-                <Route path="puestos" element={<Puestos/>} />
63
-                <Route path="perfil" element={<Profile/>} />
64
-                <Route path="contrasenas" element={<Contras/>} />
65
-                <Route path="expedientes" element={<Expedientes/>} />
66
-                <Route path="resultados" element={<Resultados/>} />
67
-                <Route path="configuraciones" element={<Configuracion/>} />
68
-                <Route path="historial" element={<Historial/>} />
69
-                <Route path="pruebas/listar" element={<Pruebas/>} />
70
-                <Route path="pruebas/crear" element={<PruebaNueva/>} />
71
-                <Route path="pruebas/aplicar" element={<PruebaAsignar/>} />
72
-            </Route>
73
-            <Route path="*" element={<NotFound/>}/>
74
-
75
-        </Routes>
76
-    )
74
+    </Routes>
75
+  )
77
 }
76
 }
78
 
77
 

+ 3 - 27
src/Components/User.jsx

1
-// import * as React from 'react';
2
-//
3
-// import {
4
-//     Outlet,
5
-// } from "react-router-dom";
6
-//
7
-// import {
8
-//     AppBar, Box, CssBaseline, Divider, Drawer,
9
-//     IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText,
10
-//     Toolbar, Typography, Container, Badge,
11
-//     MenuItem, Avatar,Menu
12
-// } from '@mui/material'
13
-//
14
-// import {
15
-//     Mail as MailIcon, Notifications as NotificationsIcon,
16
-//     Menu as MenuIcon,
17
-// } from '@mui/icons-material'
18
-//
19
-//
20
-// import Footer from "../Components/Footer.js";
21
-// import ProfilePicture from '../Images/man.png';
22
-// import useAuth from '../Auth/useAuth';
23
-
24
 import React from 'react';
1
 import React from 'react';
25
 import { ThemeProvider, styled, createTheme } from '@mui/material/styles';
2
 import { ThemeProvider, styled, createTheme } from '@mui/material/styles';
26
 import '../Css/user.css'
3
 import '../Css/user.css'
108
 
85
 
109
     const CerrarSession = () => {
86
     const CerrarSession = () => {
110
         auth.logout();
87
         auth.logout();
111
-        navigate('/')
88
+        navigate('/logincd')
112
     }
89
     }
113
 
90
 
114
     const [anchorEl, setAnchorEl] = React.useState(null);
91
     const [anchorEl, setAnchorEl] = React.useState(null);
131
 
108
 
132
             <Box sx={{ display: 'flex' }}>
109
             <Box sx={{ display: 'flex' }}>
133
                 <AppBar style={{ backgroundColor: '#fff', boxShadow: 'None' }} position="absolute" open={open}>
110
                 <AppBar style={{ backgroundColor: '#fff', boxShadow: 'None' }} position="absolute" open={open}>
134
-                    <Toolbar sx={{ pr: '24px', borderBottom: "1px solid var(--second)" }} >
111
+                    <Toolbar sx={{ pr: '24px', borderBottom: "1px solid var(--main)" }} >
135
                         <IconButton
112
                         <IconButton
136
                             name="navigation_icon_button"
113
                             name="navigation_icon_button"
137
                             edge="start"
114
                             edge="start"
138
                             color="inherit"
115
                             color="inherit"
139
                             aria-label="open drawer"
116
                             aria-label="open drawer"
140
-                            // onClick={isMovil ? MenuResponsive : toggleDrawer}
141
                             onClick={toggleDrawer}
117
                             onClick={toggleDrawer}
142
                             sx={{ marginRight: '36px', ...( open && { display: 'none' }), }} >
118
                             sx={{ marginRight: '36px', ...( open && { display: 'none' }), }} >
143
                             <MenuIcon style={{
119
                             <MenuIcon style={{
144
-                                background: 'var(--second)',
120
+                                background: 'var(--main)',
145
                                 fontSize: "40",
121
                                 fontSize: "40",
146
                                 color: "#fff"
122
                                 color: "#fff"
147
                             }} />
123
                             }} />

+ 3 - 3
src/Css/user.css

1
 .Mui-selected{
1
 .Mui-selected{
2
     /* se desahilito para la tabla de password */
2
     /* se desahilito para la tabla de password */
3
-    color : #FFF !important;
4
-    background-color : var(--second) !important;
3
+    /* color : #FFF !important; */
4
+    /* background-color : var(--second) !important; */
5
     /* background-color : rgba(253, 75, 75, 0.1) !important; */
5
     /* background-color : rgba(253, 75, 75, 0.1) !important; */
6
 }
6
 }
7
 
7
 
8
 .MuiBadge-badge{
8
 .MuiBadge-badge{
9
-    background-color : var(--second) !important;
9
+    /* background-color : var(--second) !important; */
10
 }
10
 }

+ 5 - 1
src/Pages/Home.jsx

24
         <section >
24
         <section >
25
             <div className="content-section">
25
             <div className="content-section">
26
                 <div className="main">
26
                 <div className="main">
27
-                    <h1>Bienvenido de nuevo {nombre}</h1>
27
+
28
+                    <div id="start_title">
29
+                        <h1>Bienvenido de nuevo {nombre}</h1>
30
+                    </div>
31
+
28
                     <div className="panel_options">
32
                     <div className="panel_options">
29
                         <Row>
33
                         <Row>
30
                             <Col md="4">
34
                             <Col md="4">

+ 1 - 2
src/Pages/HomeUser.jsx

20
         rest
20
         rest
21
         .get(token.current)
21
         .get(token.current)
22
             .then(({ data }) => {
22
             .then(({ data }) => {
23
-                console.log("DATA -> ",data)
24
                 setTests(data.tests)
23
                 setTests(data.tests)
25
                 delete data.tests
24
                 delete data.tests
26
                 setPasword(data);
25
                 setPasword(data);
35
         <div className="content-section">
34
         <div className="content-section">
36
             <div className="main">
35
             <div className="main">
37
                 <Box sx={{ width: '100%' }}>
36
                 <Box sx={{ width: '100%' }}>
38
-                    <Paper elevation={7} sx={{ mb: 2, padding: 2, height: '100%', minHeight: '95vh', boxShadow: 'none !important' }}>
37
+                    <Paper elevation={2} sx={{ mb: 2, padding: 2, height: '100%', minHeight: '95vh'}}>
39
                         <h2>
38
                         <h2>
40
                             Bienvenido al sistemas de pruebas psicometricas.
39
                             Bienvenido al sistemas de pruebas psicometricas.
41
                         </h2>
40
                         </h2>

+ 1 - 0
src/Pages/Logincs.jsx

71
 
71
 
72
                     // let { exp } = jwt_decode(token);
72
                     // let { exp } = jwt_decode(token);
73
                     let body_token = jwt_decode(token);
73
                     let body_token = jwt_decode(token);
74
+                    body_token['pass'] = password;
74
                     console.log("BODY TOKEN: ", body_token)
75
                     console.log("BODY TOKEN: ", body_token)
75
                     // let timestamp = exp * 1000;
76
                     // let timestamp = exp * 1000;
76
                     // let restante = timestamp - Date.now();
77
                     // let restante = timestamp - Date.now();

+ 53 - 0
src/Pages/Prueba.jsx

1
+import React, { useMemo, useState } from 'react';
2
+import { useParams } from 'react-router-dom'
3
+import { Service } from '../Utils/HTTP'
4
+import useAuth from '../Auth/useAuth.js';
5
+import { Box, Paper, Divider, Typography, Button } from '@mui/material'
6
+
7
+export function Prueba() {
8
+
9
+  let { id } = useParams();
10
+  let auth = useAuth();
11
+  let token = useMemo(() => auth.getToken())
12
+  let [data, setData] = useState({});
13
+
14
+  useState(() => {
15
+    let rest = new Service(`/prueba/findid/${id}`)
16
+    rest.get(token)
17
+      .then(resp => setData(resp.data))
18
+      .catch( _e => setData({}))
19
+  }, [id])
20
+
21
+  const CreateAssign = () => {
22
+    let now = new Date().toISOString();
23
+    let user = auth.getProfile();
24
+    let body = {
25
+      "id": -1,
26
+      "fechaasignacio": now,
27
+      "fechafinexamen": now, 
28
+      "estado": "1",
29
+      "score" : "0",
30
+      "mensaje" : "0",
31
+      "mensaje2" : "0",
32
+      "idcontrasenia": user.password,
33
+      "nombre": "assing CLEVAERR"
34
+    }
35
+    console.log(body)
36
+  }
37
+
38
+  return (
39
+    <div className="content-section">
40
+      <div className="main">
41
+        <Box >
42
+          <Paper className="prueba_body" elevation={1}>
43
+            <h1>{data.nombre}</h1>
44
+            <Divider/>
45
+            <Typography style={{marginTop:15, textAlign: 'center'}}>{data.decription}</Typography>
46
+            <Divider style={{marginTop:15}}/>
47
+            <Button onClick={CreateAssign}>Inicar Prueba</Button>
48
+          </Paper>
49
+        </Box>
50
+      </div>
51
+    </div>
52
+  );
53
+}