| Línea 1... |
Línea 1... |
| 1 |
import React, { useState, useEffect } from 'react'
|
1 |
import React, { useState, useEffect, useMemo } 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 { LengthFilter, SearchInput, Table, TablePagination } from '../components/TableComponents'
|
4 |
import { LengthFilter, SearchInput, Table, TablePagination } from '../components/TableComponents'
|
| 5 |
import { useHistory } from 'react-router-dom'
|
5 |
import { useHistory } from 'react-router-dom'
|
| 6 |
import { addNotification } from '../../../redux/notification/notification.actions'
|
6 |
import { addNotification } from '../../../redux/notification/notification.actions'
|
| Línea 15... |
Línea 15... |
| 15 |
|
15 |
|
| Línea 16... |
Línea 16... |
| 16 |
const MainView = ({ table_link, setActionLink, permisions, add_link, actionLink }) => {
|
16 |
const MainView = ({ table_link, setActionLink, permisions, add_link, actionLink }) => {
|
| 17 |
|
17 |
|
| 18 |
const history = useHistory()
|
18 |
const history = useHistory()
|
| - |
|
19 |
const dispatch = useDispatch()
|
| 19 |
const dispatch = useDispatch()
|
20 |
const [data, setData] = useState({ items: [], total: 0 })
|
| 20 |
const [data, setData] = useState({})
|
21 |
const memoItems = useMemo(() => data.items, [data])
|
| 21 |
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
22 |
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
| 22 |
const [search, setSearch] = useState('')
|
23 |
const [search, setSearch] = useState('')
|
| 23 |
const [dataLength, setDataLength] = useState(10);
|
24 |
const [dataLength, setDataLength] = useState(10);
|
| Línea 103... |
Línea 104... |
| 103 |
</div>
|
104 |
</div>
|
| 104 |
</Card.Header>
|
105 |
</Card.Header>
|
| 105 |
<Card.Body>
|
106 |
<Card.Body>
|
| 106 |
<Table data={data.items} headers={headers} setData={setData}>
|
107 |
<Table data={data.items} headers={headers} setData={setData}>
|
| 107 |
{
|
108 |
{
|
| 108 |
data.items?.map((item, index) => (
|
109 |
memoItems?.map((item, index) => (
|
| 109 |
<tr key={index}>
|
110 |
<tr key={index}>
|
| 110 |
<td>{item.name}</td>
|
111 |
<td>{item.name}</td>
|
| 111 |
<td>{item.job_description}</td>
|
112 |
<td>{item.job_description}</td>
|
| 112 |
<td className='d-flex' style={{ gap: '10px' }}>
|
113 |
<td className='d-flex' style={{ gap: '10px' }}>
|
| 113 |
{
|
114 |
{
|