Browse Source

table mok style fix

amenpunk 2 years ago
parent
commit
958ba7983d
5 changed files with 65 additions and 72 deletions
  1. 5 1
      src/App.css
  2. 54 23
      src/Components/Home/Candidato.jsx
  3. 3 34
      src/Components/Home/Candidatos.js
  4. 1 0
      src/Css/all.css
  5. 2 14
      src/Pages/Home.jsx

+ 5 - 1
src/App.css

388
 .table_list_test_user{
388
 .table_list_test_user{
389
   border :none !important;
389
   border :none !important;
390
 }
390
 }
391
-
391
+.pwd_user_name{
392
+  border-bottom:none!important;
393
+  border-right :1px solid #f1f1f1 !important;
394
+  /* background:red; */
395
+}
392
 .home_letter{
396
 .home_letter{
393
   font-family: 'gudea' !important;
397
   font-family: 'gudea' !important;
394
   color: #878787 !important;
398
   color: #878787 !important;

+ 54 - 23
src/Components/Home/Candidato.jsx

3
   Skeleton, Box, IconButton, TableCell, TableContainer,
3
   Skeleton, Box, IconButton, TableCell, TableContainer,
4
   Table, TableRow, Paper, TableBody
4
   Table, TableRow, Paper, TableBody
5
 } from '@mui/material';
5
 } from '@mui/material';
6
+
7
+import { Col, Row } from 'react-bootstrap'
8
+
6
 import React from 'react'
9
 import React from 'react'
7
-import CheckBoxIcon from '@mui/icons-material/CheckBox';
10
+
11
+import {
12
+  CheckBox as CheckBoxIcon,
13
+  FmdBad as FmdBadIcon,
14
+  NewReleases as NewReleasesIcon
15
+} from '@mui/icons-material'
8
 
16
 
9
 
17
 
10
 const big_as = 70
18
 const big_as = 70
27
 function TableUser(props) {
35
 function TableUser(props) {
28
   let { user } = props;
36
   let { user } = props;
29
   let { asignaciones, candi } = user
37
   let { asignaciones, candi } = user
30
-  // console.log(asignaciones)
38
+
39
+  if (asignaciones.lenght <= 0) {
40
+    return <h1>Sin datos</h1>
41
+  }
42
+
31
   return (
43
   return (
32
-    <TableRow style={{}}>
33
-      <TableCell className="table_list_test_user home_letter">{candi.nombre + " " + candi.apellidos}</TableCell>
44
+    <TableRow >
45
+      <TableCell
46
+        style={{ borderRight: '1px solid #f1f1f1 !important' }}
47
+        className="home_letter pwd_user_name ">
48
+        {candi.nombre + " " + candi.apellidos}
49
+      </TableCell>
34
       <TableCell className="table_list_test_user home_letter">
50
       <TableCell className="table_list_test_user home_letter">
35
         <table>
51
         <table>
36
           <tbody >
52
           <tbody >
37
             {
53
             {
38
-              asignaciones.map(a => <Asignaciones key={a.id} asign={a} />)
54
+              asignaciones?.length > 0 ?
55
+                asignaciones.map(a => <Asignaciones key={a.id} asign={a} />)
56
+                : <SinAsignaciones />
39
             }
57
             }
40
           </tbody>
58
           </tbody>
41
         </table>
59
         </table>
44
   )
62
   )
45
 }
63
 }
46
 
64
 
65
+function SinAsignaciones() {
66
+  return (
67
+    <tr style={{ padding: 5 }}>
68
+      <center className="home_letter">
69
+        <i> El candidato aun no cuenta con asignaciones... </i>
70
+        <FmdBadIcon style={{ color: 'var(--main)' }} />
71
+      </center>
72
+    </tr>
73
+  )
74
+}
75
+
47
 export function Candidato(props) {
76
 export function Candidato(props) {
48
-  // console.log("USER: ", props.user)
49
   let { password, candidatos } = props.user
77
   let { password, candidatos } = props.user
50
 
78
 
51
   return (
79
   return (
52
     <div className="data_candidato">
80
     <div className="data_candidato">
53
-      <div className="row">
54
-        <div style={{padding:15, borderRight: '1px solid #f1f1f1' }} className="col-3" >
81
+      <Row>
82
+        <Col md="3" sm="12" style={{ padding: 10, borderRight: '1px solid #f1f1f1' }}>
55
           <p><b>{password?.toUpperCase()}</b></p>
83
           <p><b>{password?.toUpperCase()}</b></p>
56
-        </div>
57
-        <div className="col-9">
58
-
84
+        </Col>
85
+        <Col md="9">
59
           <TableContainer style={{ boxShadow: "none" }} component={Paper}>
86
           <TableContainer style={{ boxShadow: "none" }} component={Paper}>
60
             <Table size="small" aria-label="a dense table">
87
             <Table size="small" aria-label="a dense table">
61
-              {/*
62
-              <TableHead>
63
-                <TableRow>
64
-                  <TableCell className="tg-0lax">Nombre</TableCell>
65
-                  <TableCell className="tg-0lax">Asignaciones</TableCell>
66
-                </TableRow>
67
-              </TableHead>
68
-                  */}
69
               <TableBody>
88
               <TableBody>
70
                 {
89
                 {
71
-                  candidatos.map(u => <TableUser key={u.candi.id} user={u} />)
90
+                  candidatos.length > 0 ?
91
+                    candidatos.map(u => <TableUser key={u.candi.id} user={u} />)
92
+                    : <SinAsignRealizadas />
93
+
72
                 }
94
                 }
73
               </TableBody>
95
               </TableBody>
74
             </Table>
96
             </Table>
75
-
76
           </TableContainer>
97
           </TableContainer>
98
+        </Col>
99
+      </Row>
100
+    </div>
101
+  )
102
+}
77
 
103
 
78
-        </div>
79
-      </div>
104
+function SinAsignRealizadas() {
105
+  return (
106
+    <div style={{ padding: 5 }}>
107
+      <center className="home_letter">
108
+        <i> No se ha relizado ninguna asignacion... </i>
109
+        <NewReleasesIcon style={{ color: '#e8eb34' }} />
110
+      </center>
80
     </div>
111
     </div>
81
   )
112
   )
82
 }
113
 }

+ 3 - 34
src/Components/Home/Candidatos.js

6
 
6
 
7
 function Divide(arregloOriginal) {
7
 function Divide(arregloOriginal) {
8
 
8
 
9
-  const LONGITUD_PEDAZOS = 4;
9
+  const LONGITUD_PEDAZOS = 7;
10
   let arregloDeArreglos = [];
10
   let arregloDeArreglos = [];
11
   for (let i = 0; i < arregloOriginal.length; i += LONGITUD_PEDAZOS) {
11
   for (let i = 0; i < arregloOriginal.length; i += LONGITUD_PEDAZOS) {
12
     let pedazo = arregloOriginal.slice(i, i + LONGITUD_PEDAZOS);
12
     let pedazo = arregloOriginal.slice(i, i + LONGITUD_PEDAZOS);
40
 
40
 
41
     let list = passwords.map(pwd => {
41
     let list = passwords.map(pwd => {
42
       let { candidatospwds } = pwd
42
       let { candidatospwds } = pwd
43
-      // console.log(candidatospwds)
44
-      // let candi_info = candidatospwds.map( ({candi}) => candi?.nombre +" "+ candi?.apellidos   )
45
       return {
43
       return {
46
         password: fromBase64(pwd.pwd),
44
         password: fromBase64(pwd.pwd),
47
         candidatos: candidatospwds
45
         candidatos: candidatospwds
48
       }
46
       }
49
     })
47
     })
50
 
48
 
51
-    /*
52
-    let list = [{
53
-      password: 'tester',
54
-      puesto: "Piloto Repartidor",
55
-      DPI: 0,
56
-      // aplicacion : "27/12/2018 12:02 PM",
57
-      aplicacion: new Date().toUTCString(),
58
-      pendientes: "No"
59
-    }]
60
-
61
-    let a = 1;
62
-    for (let _ of new Array(USER_LENGTH)) {
63
-      if (_) break
64
-
65
-      let temp = {
66
-        ...list[0],
67
-        DPI: a * 1000,
68
-        password: Math.random().toString(36).slice(5),
69
-        aplicacion: new Date(10, 12, a).toUTCString(),
70
-      }
71
-
72
-      a = a + 1;
73
-      list.push(temp)
74
-    }
75
-
76
-*/
77
-
78
     let divided = Divide(list);
49
     let divided = Divide(list);
79
-
80
     setUser(divided)
50
     setUser(divided)
81
 
51
 
82
-
83
   }, [passwords])
52
   }, [passwords])
84
 
53
 
85
   return (
54
   return (
100
         </div>
69
         </div>
101
         {
70
         {
102
           users.length
71
           users.length
103
-            ? users[page - 1].map((user,i) => (<Candidato key={i} user={user} />))
72
+            ? users[page - 1].map((user, i) => (<Candidato key={i} user={user} />))
104
             : <Preview style={{ paddingTop: 10 }} lenght={10} />
73
             : <Preview style={{ paddingTop: 10 }} lenght={10} />
105
         }
74
         }
106
         <Row style={{ padding: 5 }}>
75
         <Row style={{ padding: 5 }}>
107
           <Col>
76
           <Col>
108
-            <Stack style={{ display: 'flex', flexDirection: 'row', alignItems: 'baseline' }} spacing={2}>
77
+            <Stack style={{ display: 'flex', flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-evenly' }} spacing={2}>
109
               <Typography style={{ paddingTop: 15, paddingRight: 10 }}>Página: {page}</Typography>
78
               <Typography style={{ paddingTop: 15, paddingRight: 10 }}>Página: {page}</Typography>
110
               <Pagination
79
               <Pagination
111
                 siblingCount={1}
80
                 siblingCount={1}

+ 1 - 0
src/Css/all.css

1807
     color: #25344f;
1807
     color: #25344f;
1808
 }
1808
 }
1809
 .data_candidato {
1809
 .data_candidato {
1810
+  padding:2px;
1810
   border-bottom: 1px solid #f1f1f1;
1811
   border-bottom: 1px solid #f1f1f1;
1811
 }
1812
 }
1812
 .data_candidato a:hover {
1813
 .data_candidato a:hover {

+ 2 - 14
src/Pages/Home.jsx

1
 import React from 'react'
1
 import React from 'react'
2
-
3
 import { Col, Row } from 'react-bootstrap'
2
 import { Col, Row } from 'react-bootstrap'
4
 import { PersonOutline, VerifiedUser, ListAlt } from '@mui/icons-material/'
3
 import { PersonOutline, VerifiedUser, ListAlt } from '@mui/icons-material/'
5
 import Actividades from '../Components/Home/Actividades'
4
 import Actividades from '../Components/Home/Actividades'
12
 export function Home() {
11
 export function Home() {
13
 
12
 
14
   const auth = useSelector((state) => state.token)
13
   const auth = useSelector((state) => state.token)
15
-  const profile = useSelector((state) => state.user.profile)
14
+  // const profile = useSelector((state) => state.user.profile)
16
 
15
 
17
   const getAllPwd = async () => {
16
   const getAllPwd = async () => {
18
     let rest = new Service('/contrasenia/getallbyidUsr');
17
     let rest = new Service('/contrasenia/getallbyidUsr');
20
   }
19
   }
21
 
20
 
22
   const { data, status } = useQuery('homepwd', getAllPwd);
21
   const { data, status } = useQuery('homepwd', getAllPwd);
23
-
24
   let is_loading = status === "loading";
22
   let is_loading = status === "loading";
25
-  console.log({is_loading, data})
26
-
27
-  //TODO:
28
-  //utilizar el servicio 
29
-  //http://psicoadmin.ditca.org:8081/plaza/getthis/212
30
-  //para renderizar informacion de cada pwd en la home
23
+  console.log({is_loading})
31
 
24
 
32
   return (
25
   return (
33
     <section >
26
     <section >
34
       <div className="content-section">
27
       <div className="content-section">
35
         <div className="main">
28
         <div className="main">
36
-
37
-          <div id="start_title">
38
-            <h1>Bienvenido de nuevo {profile.nombre}</h1>
39
-          </div>
40
-
41
           <div className="panel_options">
29
           <div className="panel_options">
42
             <Row>
30
             <Row>
43
               <Col md="4">
31
               <Col md="4">