Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 14838 Rev 15103
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, Table, TablePagination } from '../../components/TableComponents'
5
import { useHistory } from 'react-router-dom'
-
 
6
import { addNotification } from '../../../redux/notification/notification.actions'
5
import { addNotification } from '../../../redux/notification/notification.actions'
7
import { useDispatch } from 'react-redux'
6
import { useDispatch } from 'react-redux'
8
import DeleteModal from '../../../shared/DeleteModal'
7
import DeleteModal from '../../../shared/DeleteModal'
Línea 9... Línea 8...
9
 
8
 
Línea 12... Línea 11...
12
	{ key: 'job_description', label: 'Descripción de cargo', isSorteable: true },
11
	{ key: 'job_description', label: 'Descripción de cargo', isSorteable: true },
13
	{ key: 'status', label: 'Estatus', isSorteable: true },
12
	{ key: 'status', label: 'Estatus', isSorteable: true },
14
	{ key: 'actions', label: 'Acciones', isSorteable: false }
13
	{ key: 'actions', label: 'Acciones', isSorteable: false }
15
]
14
]
Línea 16... Línea 15...
16
 
15
 
-
 
16
const MainView = ({
-
 
17
	table_link,
-
 
18
	setActionLink,
-
 
19
	permisions,
-
 
20
	add_link,
Línea 17... Línea -...
17
const MainView = ({ table_link, setActionLink, permisions, add_link }) => {
-
 
18
 
21
	setAction }) => {
19
	const history = useHistory()
22
 
20
	const dispatch = useDispatch()
23
	const dispatch = useDispatch()
21
	const [showDeleteModal, setShowDeleteModal] = useState(false)
24
	const [showDeleteModal, setShowDeleteModal] = useState(false)
22
	const [deleteLink, setDeleteLink] = useState('')
25
	const [deleteLink, setDeleteLink] = useState('')
Línea 88... Línea 91...
88
					<div className="row">
91
					<div className="row">
89
						<div className="col-12">
92
						<div className="col-12">
90
							<Card>
93
							<Card>
91
								<Card.Header>
94
								<Card.Header>
92
									<div className="row justify-content-end" style={{ gap: '10px' }}>
95
									<div className="row justify-content-end" style={{ gap: '10px' }}>
93
										{
-
 
94
											permisions.allowAdd
96
										{permisions.allowAdd &&
95
											&&
-
 
96
											<label
97
											<label
97
												className='d-flex align-items-center'
98
												className='d-flex align-items-center'
98
												onClick={() => {
99
												onClick={() => {
99
													setActionLink(add_link)
100
													setActionLink(add_link)
100
													history.push('/recruitment-and-selection/vacancies/add')
101
													setAction('add')
101
												}}
102
												}}
102
												style={{ cursor: 'pointer' }}
103
												style={{ cursor: 'pointer' }}
103
											>
104
											>
104
												<i className="fa fa-plus mr-2" />
105
												<i className="fa fa-plus mr-2" />
105
												Agregar
106
												Agregar
Línea 127... Línea 128...
127
									</div>
128
									</div>
128
								</Card.Header>
129
								</Card.Header>
129
								<Card.Body>
130
								<Card.Body>
130
									<div className="table-responsive">
131
									<div className="table-responsive">
131
										<Table data={items} headers={headers} setData={setItems}>
132
										<Table data={items} headers={headers} setData={setItems}>
132
											{
-
 
133
												items.map((item, index) => (
133
											{items.map((item, index) => (
134
													<tr key={index}>
134
												<tr key={index}>
135
														<td>{item.name}</td>
135
													<td>{item.name}</td>
136
														<td>{item.job_description}</td>
136
													<td>{item.job_description}</td>
137
														<td>
137
													<td>
138
															{
-
 
139
																item.status === 'a'
138
														{item.status === 'a'
140
																	? 'Activo'
139
															? 'Activo'
141
																	: 'Inactivo'
140
															: 'Inactivo'
142
															}
141
														}
143
														</td>
142
													</td>
144
														<td className='d-flex' style={{ gap: '10px' }}>
143
													<td className='d-flex' style={{ gap: '10px' }}>
145
															{
-
 
146
																permisions.allowEdit
144
														{permisions.allowEdit &&
147
																&&
-
 
148
																<i
145
															<i
149
																	className='fa fa-pencil'
146
																className='fa fa-pencil'
150
																	onClick={() => {
147
																onClick={() => {
151
																		setActionLink(item.actions.link_edit)
148
																	setActionLink(item.actions.link_edit)
152
																		history.push('/recruitment-and-selection/vacancies/edit')
149
																	setAction('edit')
153
																	}}
150
																}}
154
																	style={{ cursor: 'pointer' }}
151
																style={{ cursor: 'pointer' }} />
155
																/>
-
 
156
															}
152
														}
157
															{
-
 
158
																permisions.allowDelete
153
														{permisions.allowDelete &&
159
																&&
-
 
160
																<i
154
															<i
161
																	className='fa fa-trash'
155
																className='fa fa-trash'
162
																	onClick={() => {
156
																onClick={() => {
163
																		setShowDeleteModal(true)
157
																	setShowDeleteModal(true)
164
																		setDeleteLink(item.actions.link_delete)
158
																	setDeleteLink(item.actions.link_delete)
165
																	}}
159
																}}
166
																	style={{ cursor: 'pointer' }}
160
																style={{ cursor: 'pointer' }} />
167
																/>
-
 
168
															}
161
														}
169
														</td>
162
													</td>
170
													</tr>
163
												</tr>
171
												))
164
											))
172
											}
165
											}
173
										</Table>
166
										</Table>
174
									</div>
167
									</div>
175
									<div className='row justify-content-between align-items-center'>
168
									<div className='row justify-content-between align-items-center'>
176
										<p className='mb-0'>
169
										<p className='mb-0'>