Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 9543 | Rev 9618 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 9543 Rev 9575
Línea 1... Línea 1...
1
import React, { useState, useEffect } from 'react'
1
import React, { useState, useEffect } from 'react'
2
import axios from 'axios'
2
import axios from 'axios'
3
import { Card } from 'react-bootstrap'
3
import { Card } from 'react-bootstrap'
4
import { Table, TablePagination } from '../components/TableComponents'
4
import { LengthFilter, SearchInput, Table, TablePagination } from '../components/TableComponents'
Línea 5... Línea 5...
5
 
5
 
6
const headers = [
6
const headers = [
7
  { key: "name", label: "Nombre", isSorteable: true },
7
  { key: "name", label: "Nombre", isSorteable: true },
8
  { key: "job_description", label: "Descripción de cargo", isSorteable: true },
8
  { key: "job_description", label: "Descripción de cargo", isSorteable: true },
9
  { key: "actions", label: "Acciones", isSorteable: false }
9
  { key: "actions", label: "Acciones", isSorteable: false }
Línea 10... Línea 10...
10
]
10
]
Línea 11... Línea 11...
11
 
11
 
-
 
12
const MainView = ({ table_link }) => {
12
const MainView = ({ table_link }) => {
13
 
13
 
14
  const [data, setData] = useState({})
14
  const [data, setData] = useState({})
15
  const [search, setSearch] = useState('')
15
  const [dataLength, setDataLength] = useState(10);
16
  const [dataLength, setDataLength] = useState(10);
16
  const [pages, setPages] = useState({
17
  const [pages, setPages] = useState({
Línea 31... Línea 32...
31
      })
32
      })
32
      .catch((err) => console.log(err))
33
      .catch((err) => console.log(err))
33
  }
34
  }
Línea 34... Línea 35...
34
 
35
 
-
 
36
  useEffect(() => {
35
  useEffect(() => {
37
    getData({
-
 
38
      url: table_link,
-
 
39
      params: {
-
 
40
        search: search,
-
 
41
        length: dataLength,
-
 
42
        page: pages.current
-
 
43
      }
36
    getData({ url: table_link })
44
    })
Línea 37... Línea 45...
37
  }, [dataLength, pages.current])
45
  }, [search, dataLength, pages.current])
38
 
46
 
39
  return (
47
  return (
40
    <section className="content">
48
    <section className="content">
41
      <div className="container-fluid">
49
      <div className="container-fluid">
42
        <div className="row">
50
        <div className="row">
43
          <div className="col-12">
51
          <div className="col-12">
-
 
52
            <Card>
-
 
53
              <Card.Header>
-
 
54
                <div className="row justify-content-between">
-
 
55
                  <div className="col-sm-12 col-md-6">
-
 
56
                    <LengthFilter onChange={(e) => setDataLength(e.target.value)} />
-
 
57
                  </div>
44
            <Card>
-
 
-
 
58
                  <div className="col-sm-12 col-md-6">
-
 
59
                    <SearchInput onChange={(e) => setSearch(e.target.value)} />
45
              <Card.Header>
60
                  </div>
46
 
61
                </div>
47
              </Card.Header>
62
              </Card.Header>
48
              <Card.Body>
63
              <Card.Body>
49
                <Table data={data.items} headers={headers} setData={setData}>
64
                <Table data={data.items} headers={headers} setData={setData}>