Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15310 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15310 Rev 15319
Línea 1... Línea 1...
1
/* eslint-disable no-mixed-spaces-and-tabs */
1
/* eslint-disable no-mixed-spaces-and-tabs */
2
import React, { useState, useEffect } from 'react'
2
import React, { useState, useEffect } from 'react'
3
import axios from 'axios'
3
import axios from 'axios'
4
import { Card } from 'react-bootstrap'
4
import { Card } from 'react-bootstrap'
5
import { LengthFilter, SearchInput, Table, TablePagination } from '../../components/TableComponents'
5
import { LengthFilter, SearchInput, TablePagination } from '../../components/TableComponents'
6
import { addNotification } from '../../../redux/notification/notification.actions'
6
import { addNotification } from '../../../redux/notification/notification.actions'
7
import { useDispatch } from 'react-redux'
7
import { useDispatch } from 'react-redux'
8
import DeleteModal from '../../../shared/DeleteModal'
8
import DeleteModal from '../../../shared/DeleteModal'
9
import ContentTitle from '../../../shared/ContentTitle'
9
import ContentTitle from '../../../shared/ContentTitle'
10
import AddModal from '../components/AddModal'
10
import AddModal from '../components/AddModal'
11
import EditModal from '../components/EditModal'
11
import EditModal from '../components/EditModal'
-
 
12
import Table from '../../../shared/content-table/Table'
-
 
13
import TableRow from '../../../shared/content-table/TableRow'
Línea 12... Línea 14...
12
 
14
 
13
const headers = [
15
const headers = [
14
	{ key: 'first_name', label: 'Nombre', isSorteable: true },
16
	{ key: 'first_name', label: 'Nombre', isSorteable: true },
15
	{ key: 'last_name', label: 'Apellido', isSorteable: true },
17
	{ key: 'last_name', label: 'Apellido', isSorteable: true },
Línea 86... Línea 88...
86
				setLastItem(items.length)
88
				setLastItem(items.length)
87
			}
89
			}
88
		}
90
		}
89
	}, [items])
91
	}, [items])
Línea -... Línea 92...
-
 
92
 
-
 
93
	const handleSort = (result) => setItems(result)
-
 
94
 
-
 
95
	const handleEdit = (url) => {
-
 
96
		setCurrentEditLink(url)
-
 
97
		setIsShowEditModal(true)
-
 
98
	}
-
 
99
 
-
 
100
	const handleDelete = (url) => {
-
 
101
		setShowDeleteModal(true)
-
 
102
		setActionLink(url)
-
 
103
	}
90
 
104
 
91
	return (
105
	return (
92
		<ContentTitle title='Preselección'>
106
		<ContentTitle title='Preselección'>
93
			<section className="content">
107
			<section className="content">
94
				<div className="container-fluid">
108
				<div className="container-fluid">
Línea 145... Línea 159...
145
										<SearchInput onChange={(e) => setSearch(e.target.value)} />
159
										<SearchInput onChange={(e) => setSearch(e.target.value)} />
146
									</div>
160
									</div>
147
								</Card.Header>
161
								</Card.Header>
148
								<Card.Body>
162
								<Card.Body>
149
									<div className="table-responsive">
163
									<div className="table-responsive">
150
										<Table data={items} headers={headers} setData={setItems}>
164
										<Table data={items} headers={headers} setData={handleSort}>
151
											{
-
 
152
												items.map((item, index) => (
165
											{() => items.map((item, index) =>
153
													<tr key={index}>
-
 
154
														<td>{item.first_name}</td>
-
 
155
														<td>{item.last_name}</td>
-
 
156
														<td>{item.email}</td>
-
 
157
														<td>
166
												<TableRow
158
															{
167
													key={index}
159
																item.status === 'a'
-
 
160
																	? <i className='fa fa-check' style={{ color: '#5cb85c' }} />
-
 
161
																	: <i className='fa fa-close' style={{ color: 'red' }} />
-
 
162
															}
168
													item={item}
163
														</td>
169
													editOptions={{
164
														<td className='d-flex' style={{ gap: '10px' }}>
-
 
165
															{permisions.allowEdit &&
170
														permission: permisions.allowEdit,
166
																<i
-
 
167
																	className='fa fa-pencil'
171
														icon: (value) => <i className='fa fa-pencil cursor-pointer' onClick={() => handleEdit(value)} />
168
																	style={{ cursor: 'pointer' }}
-
 
169
																	onClick={() => {
-
 
170
																		setCurrentEditLink(item.actions.link_edit)
-
 
171
																		setIsShowEditModal(true)
-
 
172
																	}}
172
													}}
173
																/>
173
													deleteOptions={{
174
															}
-
 
175
															{permisions.allowDelete &&
174
														permission: permisions.allowDelete,
176
																<i
-
 
177
																	className='fa fa-trash'
-
 
178
																	onClick={() => {
-
 
179
																		setShowDeleteModal(true)
-
 
180
																		setActionLink(item.actions.link_delete)
175
														icon: (value) => <i className='fa fa-trash  cursor-pointer' onClick={() => handleDelete(value)} />
181
																	}}
-
 
182
																	style={{ cursor: 'pointer' }}
-
 
183
																/>
-
 
184
															}
176
													}}
185
														</td>
-
 
186
													</tr>
-
 
187
												))
177
												/>)}
188
											}
178
 
189
										</Table>
179
										</Table>
190
									</div>
180
									</div>
191
									<div className='row justify-content-between align-items-center'>
181
									<div className='row justify-content-between align-items-center'>
192
										<p className='mb-0'>
182
										<p className='mb-0'>
193
											{`Mostrando registros del ${startItem} al ${lastItem} de un total de ${total} registros`}
183
											{`Mostrando registros del ${startItem} al ${lastItem} de un total de ${total} registros`}