Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 12326 Rev 12375
Línea 25... Línea 25...
25
	const [showDeleteModal, setShowDeleteModal] = useState(false)
25
	const [showDeleteModal, setShowDeleteModal] = useState(false)
26
	const [currentVacancy, setCurrentVacancy] = useState(vacancies[0].uuid || '')
26
	const [currentVacancy, setCurrentVacancy] = useState(vacancies[0].uuid || '')
27
	const [deleteLink, setDeleteLink] = useState('')
27
	const [deleteLink, setDeleteLink] = useState('')
28
	const [data, setData] = useState({})
28
	const [data, setData] = useState({})
29
	const [search, setSearch] = useState('')
29
	const [search, setSearch] = useState('')
-
 
30
	const [startItem, setStartItem] = useState(1)
-
 
31
	const [lastItem, setLastItem] = useState(10)
30
	const [dataLength, setDataLength] = useState(10)
32
	const [dataLength, setDataLength] = useState(10)
31
	const points = {
33
	const points = {
32
		0: '0%',
34
		0: '0%',
33
		1: '25%',
35
		1: '25%',
34
		2: '50%',
36
		2: '50%',
Línea 64... Línea 66...
64
		getData({
66
		getData({
65
			url: `${table_link}/${currentVacancy}`,
67
			url: `${table_link}/${currentVacancy}`,
66
			params: {
68
			params: {
67
				search: search,
69
				search: search,
68
				length: dataLength,
70
				length: dataLength,
69
				page: pages.current
71
				start: pages.current
70
			}
72
			}
71
		})
73
		})
72
	}, [search, dataLength, pages.current, currentVacancy])
74
	}, [search, dataLength, pages.current, currentVacancy])
Línea 73... Línea 75...
73
 
75
 
74
	useEffect(() => {
76
	useEffect(() => {
75
		setActionLink(add_link.replace('UUID_PLACEHOLDER', currentVacancy))
77
		setActionLink(add_link.replace('UUID_PLACEHOLDER', currentVacancy))
Línea -... Línea 78...
-
 
78
	}, [currentVacancy])
-
 
79
 
-
 
80
	useEffect(() => {
-
 
81
		if (pages.current > 1) {
-
 
82
			setStartItem((dataLength * (pages.current - 1)) + 1)
-
 
83
		} else {
-
 
84
			setStartItem(1)
-
 
85
		}
-
 
86
	}, [pages.current])
-
 
87
 
-
 
88
	useEffect(() => {
-
 
89
		if (data.items) {
-
 
90
			if (startItem > 1) {
-
 
91
				setLastItem(startItem + (data.items.length - 1))
-
 
92
			} else {
-
 
93
				setLastItem(data.items.length)
-
 
94
			}
-
 
95
		}
76
	}, [currentVacancy])
96
	}, [data])
77
 
97
 
78
	return (
98
	return (
79
		<>
99
		<>
80
			<section className="content">
100
			<section className="content">
Línea 200... Línea 220...
200
											}
220
											}
201
										</Table>
221
										</Table>
202
									</div>
222
									</div>
203
									<div className='row justify-content-between align-items-center'>
223
									<div className='row justify-content-between align-items-center'>
204
										<p className='mb-0'>
224
										<p className='mb-0'>
205
											{`Mostrando registros del ${(dataLength * pages.current) - (dataLength - 1) || 0} al ${(dataLength * pages.current) - (dataLength - data.total) || 0} de un total de ${data.total || 0} registros`}
225
											{`Mostrando registros del ${startItem} al ${lastItem} de un total de ${data.total} registros`}
206
										</p>
226
										</p>
207
										<TablePagination
227
										<TablePagination
208
											onDecrement={() => setPages({ ...pages, current: pages.current - 1 })}
228
											onDecrement={() => setPages({ ...pages, current: pages.current - 1 })}
209
											onIncrement={() => setPages({ ...pages, current: pages.current + 1 })}
229
											onIncrement={() => setPages({ ...pages, current: pages.current + 1 })}
210
											totalPages={pages.last}
230
											totalPages={pages.last}