Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15303 Rev 15304
Línea 33... Línea 33...
33
		current: 1,
33
		current: 1,
34
		last: 1
34
		last: 1
35
	})
35
	})
Línea 36... Línea 36...
36
 
36
 
-
 
37
	const getData = ({ url = '', params = {} }) => {
37
	const getData = ({ url = '', params = {} }) => {
38
 
38
		axios.get(url, { params: { ...params } })
39
		axios.get(url, { params: { ...params } })
39
			.then(({ data }) => {
40
			.then(({ data }) => {
40
				if (!data.success) {
41
				if (!data.success) {
41
					dispatch(addNotification({
42
					dispatch(addNotification({
Línea 52... Línea 53...
52
				style: 'danger',
53
				style: 'danger',
53
				msg: 'Ha ocurrido un error'
54
				msg: 'Ha ocurrido un error'
54
			})))
55
			})))
55
	}
56
	}
Línea 56... Línea -...
56
 
-
 
57
	const setData = (data) => setItems(data)
-
 
58
 
-
 
59
	console.log('Render')
-
 
60
 
-
 
61
	const row = items.map((item, index) =>
-
 
62
		<tr key={index}>
-
 
63
			<td>{item.name}</td>
-
 
64
			<td>{item.job_description}</td>
-
 
65
			<td>
-
 
66
				{item.status === 'a'
-
 
67
					? 'Activo'
-
 
68
					: 'Inactivo'
-
 
69
				}
-
 
70
			</td>
-
 
71
			<td className='d-flex' style={{ gap: '10px' }}>
-
 
72
				{permisions.allowEdit &&
-
 
73
					<i
-
 
74
						className='fa fa-pencil'
-
 
75
						onClick={() => {
-
 
76
							setActionLink(item.actions.link_edit)
-
 
77
							setAction('edit')
-
 
78
						}}
-
 
79
						style={{ cursor: 'pointer' }} />
-
 
80
				}
-
 
81
				{permisions.allowDelete &&
-
 
82
					<i
-
 
83
						className='fa fa-trash'
-
 
84
						onClick={() => {
-
 
85
							setShowDeleteModal(true)
-
 
86
							setDeleteLink(item.actions.link_delete)
-
 
87
						}}
-
 
88
						style={{ cursor: 'pointer' }} />
-
 
89
				}
-
 
90
			</td>
-
 
91
		</tr>
-
 
92
	)
-
 
93
 
57
 
94
	useEffect(() => {
58
	useEffect(() => {
95
		getData({
59
		getData({
96
			url: table_link,
60
			url: table_link,
97
			params: {
61
			params: {
Línea 163... Línea 127...
163
										<SearchInput onChange={(e) => setSearch(e.target.value)} />
127
										<SearchInput onChange={(e) => setSearch(e.target.value)} />
164
									</div>
128
									</div>
165
								</Card.Header>
129
								</Card.Header>
166
								<Card.Body>
130
								<Card.Body>
167
									<div className="table-responsive">
131
									<div className="table-responsive">
-
 
132
										<Table data={items} headers={headers} setData={setItems}>
-
 
133
											{items.map((item, index) => (
-
 
134
												<tr key={index}>
-
 
135
													<td>{item.name}</td>
-
 
136
													<td>{item.job_description}</td>
168
										<Table
137
													<td>
-
 
138
														{item.status === 'a'
169
											data={items}
139
															? 'Activo'
170
											headers={headers}
140
															: 'Inactivo'
-
 
141
														}
-
 
142
													</td>
-
 
143
													<td className='d-flex' style={{ gap: '10px' }}>
-
 
144
														{permisions.allowEdit &&
-
 
145
															<i
-
 
146
																className='fa fa-pencil'
-
 
147
																onClick={() => {
-
 
148
																	setActionLink(item.actions.link_edit)
171
											setData={setData}
149
																	setAction('edit')
-
 
150
																}}
-
 
151
																style={{ cursor: 'pointer' }} />
-
 
152
														}
-
 
153
														{permisions.allowDelete &&
-
 
154
															<i
-
 
155
																className='fa fa-trash'
-
 
156
																onClick={() => {
-
 
157
																	setShowDeleteModal(true)
-
 
158
																	setDeleteLink(item.actions.link_delete)
-
 
159
																}}
-
 
160
																style={{ cursor: 'pointer' }} />
-
 
161
														}
-
 
162
													</td>
-
 
163
												</tr>
172
										>
164
											))
173
											{row}
165
											}
174
										</Table>
166
										</Table>
175
									</div>
167
									</div>
176
									<div className='row justify-content-between align-items-center'>
168
									<div className='row justify-content-between align-items-center'>
177
										<p className='mb-0'>
169
										<p className='mb-0'>
178
											{`Mostrando registros del ${startItem} al ${lastItem} de un total de ${total} registros`}
170
											{`Mostrando registros del ${startItem} al ${lastItem} de un total de ${total} registros`}