Reac front end for psicometric app

Home.jsx 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import React, { useState } from 'react'
  2. import { Col, Row } from 'react-bootstrap'
  3. import { PersonOutline, VerifiedUser, ListAlt } from '@mui/icons-material/'
  4. // import Actividades from '../Components/Home/Actividades'
  5. import Candidatos from '../Components/Home/Candidatos'
  6. import { Card } from '../Components/Card';
  7. import { useSelector } from 'react-redux';
  8. import { Service } from '../Utils/HTTP.js'
  9. import { useQuery } from 'react-query';
  10. import { ModalEdit } from '../Components/Password/Operation';
  11. export function Home() {
  12. const auth = useSelector((state) => state.token)
  13. const [password,setPasword]= useState(null)
  14. const [visible,setVisible]= useState(false)
  15. const hideModal = () => setVisible(false)
  16. const getAllPwd = async () => {
  17. let rest = new Service('/contrasenia/getallbyidUsr');
  18. return await rest.getQuery(auth.token)
  19. }
  20. const { data } = useQuery('homepwd', getAllPwd);
  21. return (
  22. <section >
  23. <div className="content-section">
  24. <div className="main">
  25. <div className="panel_options">
  26. <Row>
  27. <Col md="4">
  28. <Card
  29. quantity={data?.data?.length || 0}
  30. to='/dashboard/contrasenas'
  31. title='CONTRASEÑAS'
  32. icon={VerifiedUser}
  33. />
  34. </Col>
  35. <Col md="4">
  36. <Card
  37. quantity={0}
  38. to='/dashboard/expedientes'
  39. title='EXPEDIENTES'
  40. icon={PersonOutline} />
  41. </Col>
  42. <Col md="4">
  43. <Card
  44. quantity={0}
  45. to="/dashboard/puestos"
  46. title='PUESTOS'
  47. icon={ListAlt} />
  48. </Col>
  49. </Row>
  50. </div>
  51. <div className="historial_candidatos">
  52. <Row>
  53. <Col md="12">
  54. <Candidatos
  55. setPassword={setPasword}
  56. setVisible={setVisible}
  57. passwords={data?.data || []}
  58. />
  59. </Col>
  60. {/*
  61. <Col md="4">
  62. <Actividades />
  63. </Col>
  64. */}
  65. </Row>
  66. </div>
  67. </div>
  68. { password ?
  69. <ModalEdit
  70. home={true}
  71. password={password}
  72. open={visible}
  73. handleOpen={hideModal}
  74. />: null
  75. }
  76. </div>
  77. </section>
  78. )
  79. }