Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 9917 Rev 9928
Línea 1... Línea 1...
1
import React, { useState, useEffect, useMemo } 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 { 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()
-
 
20
  const [data, setData] = useState({ items: [], total: 0 })
19
  const dispatch = useDispatch()
21
  const memoItems = useMemo(() => data.items, [data])
20
  const [data, setData] = useState({})
22
  const [showDeleteModal, setShowDeleteModal] = useState(false)
21
  const [showDeleteModal, setShowDeleteModal] = useState(false)
23
  const [search, setSearch] = useState('')
22
  const [search, setSearch] = useState('')
24
  const [dataLength, setDataLength] = useState(10);
23
  const [dataLength, setDataLength] = useState(10);
Línea 104... Línea 103...
104
                  </div>
103
                  </div>
105
                </Card.Header>
104
                </Card.Header>
106
                <Card.Body>
105
                <Card.Body>
107
                  <Table data={data.items} headers={headers} setData={setData}>
106
                  <Table data={data.items} headers={headers} setData={setData}>
108
                    {
107
                    {
109
                      memoItems?.map((item, index) => (
108
                      data.items?.map((item, index) => (
110
                        <tr key={index}>
109
                        <tr key={index}>
111
                          <td>{item.name}</td>
110
                          <td>{item.name}</td>
112
                          <td>{item.job_description}</td>
111
                          <td>{item.job_description}</td>
113
                          <td className='d-flex' style={{ gap: '10px' }}>
112
                          <td className='d-flex' style={{ gap: '10px' }}>
114
                            {
113
                            {
Línea 127... Línea 126...
127
                              permisions.allowDelete === '1'
126
                              permisions.allowDelete === '1'
128
                              &&
127
                              &&
129
                              <i
128
                              <i
130
                                className='fa fa-trash'
129
                                className='fa fa-trash'
131
                                onClick={() => {
130
                                onClick={() => {
132
                                  setActionLink(item.actions.link_delete)
-
 
133
                                  setShowDeleteModal(true)
131
                                  setShowDeleteModal(true)
-
 
132
                                  setActionLink(item.actions.link_delete)
134
                                }}
133
                                }}
135
                                style={{ cursor: 'pointer' }}
134
                                style={{ cursor: 'pointer' }}
136
                              />
135
                              />
137
                            }
136
                            }
138
                          </td>
137
                          </td>