amenpunk hace 2 años
padre
commit
d0b40b3f2d

+ 15 - 1
src/App.css

@@ -283,6 +283,20 @@
283 283
 .card_test{
284 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,9 +103,7 @@ function DashboardContent() {
103 103
 
104 104
     return (
105 105
         <ThemeProvider theme={mdTheme}>
106
-
107 106
             <MenuMovil anchor={anchorElMovil} control={setAnchorElMov} />
108
-
109 107
             <Box sx={{ display: 'flex' }}>
110 108
                 <AppBar style={{ backgroundColor: '#fff', boxShadow: 'None' }} position="absolute" open={open}>
111 109
                     <Toolbar sx={{ pr: '24px', borderBottom: "1px solid #ec5e69" }} >

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

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

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

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

+ 44 - 45
src/Components/Routes.js

@@ -8,8 +8,7 @@ import { LoginCs } from '../Pages/Logincs'
8 8
 import { Register } from '../Pages/Register'
9 9
 import { Home } from '../Pages/Home'
10 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 12
 import { Expedientes } from '../Pages/Expedientes'
14 13
 import { Resultados } from '../Pages/Resultados'
15 14
 import { Configuracion } from '../Pages/Configuracion'
@@ -22,57 +21,57 @@ import { Profile } from '../Pages/Profile'
22 21
 import { RestorePassword } from '../Pages/RestorePassword'
23 22
 
24 23
 import { HomeUser } from '../Pages/HomeUser'
24
+import { Prueba } from '../Pages/Prueba.jsx'
25 25
 
26 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,26 +1,3 @@
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 1
 import React from 'react';
25 2
 import { ThemeProvider, styled, createTheme } from '@mui/material/styles';
26 3
 import '../Css/user.css'
@@ -108,7 +85,7 @@ export function User() {
108 85
 
109 86
     const CerrarSession = () => {
110 87
         auth.logout();
111
-        navigate('/')
88
+        navigate('/logincd')
112 89
     }
113 90
 
114 91
     const [anchorEl, setAnchorEl] = React.useState(null);
@@ -131,17 +108,16 @@ export function User() {
131 108
 
132 109
             <Box sx={{ display: 'flex' }}>
133 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 112
                         <IconButton
136 113
                             name="navigation_icon_button"
137 114
                             edge="start"
138 115
                             color="inherit"
139 116
                             aria-label="open drawer"
140
-                            // onClick={isMovil ? MenuResponsive : toggleDrawer}
141 117
                             onClick={toggleDrawer}
142 118
                             sx={{ marginRight: '36px', ...( open && { display: 'none' }), }} >
143 119
                             <MenuIcon style={{
144
-                                background: 'var(--second)',
120
+                                background: 'var(--main)',
145 121
                                 fontSize: "40",
146 122
                                 color: "#fff"
147 123
                             }} />

+ 3 - 3
src/Css/user.css

@@ -1,10 +1,10 @@
1 1
 .Mui-selected{
2 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 5
     /* background-color : rgba(253, 75, 75, 0.1) !important; */
6 6
 }
7 7
 
8 8
 .MuiBadge-badge{
9
-    background-color : var(--second) !important;
9
+    /* background-color : var(--second) !important; */
10 10
 }

+ 5 - 1
src/Pages/Home.jsx

@@ -24,7 +24,11 @@ export function Home() {
24 24
         <section >
25 25
             <div className="content-section">
26 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 32
                     <div className="panel_options">
29 33
                         <Row>
30 34
                             <Col md="4">

+ 1 - 2
src/Pages/HomeUser.jsx

@@ -20,7 +20,6 @@ export function HomeUser(){
20 20
         rest
21 21
         .get(token.current)
22 22
             .then(({ data }) => {
23
-                console.log("DATA -> ",data)
24 23
                 setTests(data.tests)
25 24
                 delete data.tests
26 25
                 setPasword(data);
@@ -35,7 +34,7 @@ export function HomeUser(){
35 34
         <div className="content-section">
36 35
             <div className="main">
37 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 38
                         <h2>
40 39
                             Bienvenido al sistemas de pruebas psicometricas.
41 40
                         </h2>

+ 1 - 0
src/Pages/Logincs.jsx

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

+ 53 - 0
src/Pages/Prueba.jsx

@@ -0,0 +1,53 @@
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
+}