Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15304 Rev 15310
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 { LengthFilter, SearchInput, Table, TablePagination } from '../../components/TableComponents'
4
import { LengthFilter, SearchInput, TablePagination } from '../../components/TableComponents'
5
import { addNotification } from '../../../redux/notification/notification.actions'
5
import { addNotification } from '../../../redux/notification/notification.actions'
6
import { useDispatch } from 'react-redux'
6
import { useDispatch } from 'react-redux'
7
import DeleteModal from '../../../shared/DeleteModal'
7
import DeleteModal from '../../../shared/DeleteModal'
-
 
8
import Table from '../../../shared/content-table/Table'
-
 
9
import TableRow from '../../../shared/content-table/TableRow'
Línea 8... Línea 10...
8
 
10
 
9
const headers = [
11
const headers = [
10
	{ key: 'name', label: 'Nombre', isSorteable: true },
12
	{ key: 'name', label: 'Nombre', isSorteable: true },
11
	{ key: 'job_description', label: 'Descripción de cargo', isSorteable: true },
13
	{ key: 'job_description', label: 'Descripción de cargo', isSorteable: true },
Línea 82... Línea 84...
82
				setLastItem(items.length)
84
				setLastItem(items.length)
83
			}
85
			}
84
		}
86
		}
85
	}, [items])
87
	}, [items])
Línea -... Línea 88...
-
 
88
 
-
 
89
 
-
 
90
	const handleSort = (result) => setItems(result)
-
 
91
 
-
 
92
	const handleEdit = (url) => {
-
 
93
		setActionLink(url)
-
 
94
		setAction('edit')
-
 
95
	}
-
 
96
 
-
 
97
	const handleDelete = (url) => {
-
 
98
		setDeleteLink(url)
-
 
99
		setAction('edit')
-
 
100
	}
86
 
101
 
87
	return (
102
	return (
88
		<>
103
		<>
89
			<section className="content">
104
			<section className="content">
90
				<div className="container-fluid">
105
				<div className="container-fluid">
Línea 127... Línea 142...
127
										<SearchInput onChange={(e) => setSearch(e.target.value)} />
142
										<SearchInput onChange={(e) => setSearch(e.target.value)} />
128
									</div>
143
									</div>
129
								</Card.Header>
144
								</Card.Header>
130
								<Card.Body>
145
								<Card.Body>
131
									<div className="table-responsive">
146
									<div className="table-responsive">
132
										<Table data={items} headers={headers} setData={setItems}>
-
 
133
											{items.map((item, index) => (
147
										<Table
134
												<tr key={index}>
148
											data={items}
135
													<td>{item.name}</td>
149
											headers={headers}
136
													<td>{item.job_description}</td>
150
											setData={handleSort}
137
													<td>
151
										>
138
														{item.status === 'a'
152
											{() => items.map((item, index) =>
139
															? 'Activo'
153
												<TableRow
140
															: 'Inactivo'
154
													key={index}
141
														}
155
													item={item}
142
													</td>
156
													editOptions={{
143
													<td className='d-flex' style={{ gap: '10px' }}>
-
 
144
														{permisions.allowEdit &&
157
														permission: permisions.allowEdit,
145
															<i
-
 
146
																className='fa fa-pencil'
-
 
147
																onClick={() => {
-
 
148
																	setActionLink(item.actions.link_edit)
-
 
149
																	setAction('edit')
-
 
150
																}}
-
 
151
																style={{ cursor: 'pointer' }} />
158
														icon: (value) => <i className='fa fa-pencil cursor-pointer' onClick={handleEdit(value)} />
152
														}
159
													}}
153
														{permisions.allowDelete &&
-
 
154
															<i
-
 
155
																className='fa fa-trash'
-
 
156
																onClick={() => {
160
													deleteOptions={{
157
																	setShowDeleteModal(true)
-
 
158
																	setDeleteLink(item.actions.link_delete)
161
														permission: permisions.allowDelete,
159
																}}
-
 
160
																style={{ cursor: 'pointer' }} />
162
														icon: (value) => <i className='fa fa-trash  cursor-pointer' onClick={handleDelete(value)} />
161
														}
163
													}}
162
													</td>
-
 
163
												</tr>
164
												/>)}
164
											))
-
 
165
											}
-
 
166
										</Table>
165
										</Table>
167
									</div>
166
									</div>
168
									<div className='row justify-content-between align-items-center'>
167
									<div className='row justify-content-between align-items-center'>
169
										<p className='mb-0'>
168
										<p className='mb-0'>
170
											{`Mostrando registros del ${startItem} al ${lastItem} de un total de ${total} registros`}
169
											{`Mostrando registros del ${startItem} al ${lastItem} de un total de ${total} registros`}