Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 11470 Rev 11471
Línea 16... Línea 16...
16
	{ key: 'cost', label: 'Costo', isSorteable: true },
16
	{ key: 'cost', label: 'Costo', isSorteable: true },
17
	{ key: 'status', label: 'Estatus', isSorteable: true },
17
	{ key: 'status', label: 'Estatus', isSorteable: true },
18
	{ key: 'actions', label: 'Acciones', isSorteable: false }
18
	{ key: 'actions', label: 'Acciones', isSorteable: false }
19
]
19
]
Línea 20... Línea 20...
20
 
20
 
Línea 21... Línea -...
21
const TableView = (props) => {
-
 
22
 
-
 
23
	console.log(props)
21
const TableView = ({ add_link, table_link, permisions }) => {
24
	const { add_link, table_link, permisions } = props
22
 
25
	const dispatch = useDispatch()
23
	const dispatch = useDispatch()
26
	const [modalToShow, setModalToShow] = useState('')
24
	const [modalToShow, setModalToShow] = useState('')
27
	const [actionLink, setActionLink] = useState(add_link)
25
	const [actionLink, setActionLink] = useState(add_link)
Línea 68... Línea 66...
68
		})
66
		})
69
	}, [search, dataLength, pages.current])
67
	}, [search, dataLength, pages.current])
Línea 70... Línea 68...
70
 
68
 
71
	return (
69
	return (
72
		<ContentTitle title='Planificación - Objetivos y Metas'>
-
 
73
			<div className="col-sm-12 d-flex flex-column  p-2">
-
 
74
				<div className="m-2">
-
 
75
					<strong>Descripción:</strong>
-
 
76
					<br />
-
 
77
					<span className="xd">{objetive.descriptionObjective}</span>
-
 
78
				</div>
-
 
79
				<div className="m-2 d-flex">
-
 
80
					<div>
-
 
81
						<strong>Estatus:</strong>
-
 
82
						<br />
-
 
83
						<span className="xd">{objetive.statusObjective}</span>
-
 
84
					</div>
-
 
85
					<div className="ml-5">
-
 
86
						<strong>Fecha:</strong>
-
 
87
						<br />
-
 
88
						<span className="xd">{objetive.dateObjective}</span>
-
 
89
					</div>
-
 
90
					<div className="ml-5">
-
 
91
						<strong>Costo:</strong>
-
 
92
						<br />
-
 
93
						<span className="xd">{objetive.costObjective}</span>
-
 
94
					</div>
-
 
95
					<div className="ml-5 ">
-
 
96
						<strong>Progreso:</strong>
-
 
97
						<br />
-
 
98
						<div className="d-flex align-items-center">
-
 
99
							<progress value={objetive.indicatorObjective} max={100} />
-
 
100
							<span className="ml-2">{`${objetive.indicatorObjective}%`}</span>
-
 
101
						</div>
-
 
102
					</div>
-
 
103
				</div>
-
 
104
				<div className="col-sm-12 mt-3">
-
 
105
					<Link to="/" className="btn btn-primary">
-
 
106
						<i className="fa fa-arrow-left mr-1" />
-
 
107
                        Ir atras
-
 
108
					</Link>
-
 
109
				</div>
-
 
110
			</div>
-
 
111
			<section className="content">
-
 
112
				<div className="container-fluid">
-
 
113
					<div className="row">
-
 
114
						<div className="col-12">
-
 
115
							<Card>
-
 
116
								<Card.Header>
-
 
117
									<div className="row justify-content-end" style={{ gap: '10px' }}>
-
 
118
										{
-
 
119
											permisions.allowAdd
-
 
120
                                            &&
-
 
121
                                            <label
-
 
122
                                            	className='d-flex align-items-center'
-
 
123
                                            	onClick={() => {
-
 
124
                                            		setActionLink(add_link)
-
 
125
                                            		setModalToShow('add')
-
 
126
                                            	}}
-
 
127
                                            	style={{ cursor: 'pointer' }}
-
 
128
                                            >
-
 
129
                                            	<i className="fa fa-plus mr-2" />
-
 
130
                                                Agregar
-
 
131
                                            </label>
-
 
132
										}
-
 
133
										<label
-
 
134
											className='d-flex align-items-center'
-
 
135
											onClick={() => getData({
-
 
136
												url: table_link,
-
 
137
												params: {
-
 
138
													search: search,
-
 
139
													length: dataLength,
-
 
140
													page: pages.current
-
 
141
												}
-
 
142
											})}
-
 
143
											style={{ cursor: 'pointer' }}
-
 
144
										>
-
 
145
											<i className='fa fa-refresh mr-2' />
-
 
146
                                            Actualizar
-
 
147
										</label>
-
 
148
									</div>
-
 
149
									<div className="row justify-content-between align-items-center">
-
 
150
										<LengthFilter onChange={(e) => setDataLength(e.target.value)} />
-
 
151
										<SearchInput onChange={(e) => setSearch(e.target.value)} />
-
 
152
									</div>
-
 
153
								</Card.Header>
-
 
154
								<Card.Body>
-
 
155
									<div className="table-responsive">
-
 
156
										<Table data={items} headers={headers} setData={setItems}>
-
 
157
											{
-
 
158
												items.length
-
 
159
                                                &&
-
 
160
                                                items.map((item, index) => (
-
 
161
                                                	<tr key={index}>
-
 
162
                                                		<td className='text-vertical-middle'>{item.title}</td>
-
 
163
                                                		<td className='text-vertical-middle'>{item.description}</td>
-
 
164
                                                		<td className='text-vertical-middle'>{item.date}</td>
-
 
165
                                                		<td className='d-flex align-items-center'>
-
 
166
                                                			{
-
 
167
                                                				item.progress > 0
-
 
168
                                                					?
-
 
169
                                                					<>
-
 
170
                                                						<progress value={item.progress} max='100' />
-
 
171
                                                						<span className='ml-2'>{item.progress}</span>
-
 
172
                                                					</>
-
 
173
                                                					:
-
 
174
                                                					'Sin metas'
-
 
175
                                                			}
-
 
176
                                                		</td>
-
 
177
                                                		<td className='text-vertical-middle'>{item.cost}</td>
-
 
178
                                                		<td className='text-vertical-middle'>
-
 
179
                                                			{
-
 
180
                                                				item.status === 'a'
-
 
181
                                                					? 'Activo'
-
 
182
                                                					: 'Inactivo'
-
 
183
                                                			}
-
 
184
                                                		</td>
-
 
185
                                                		<td>
-
 
186
                                                			<div className="d-flex align-items-center" style={{ gap: '5px' }}>
-
 
187
                                                				{
-
 
188
                                                					permisions.allowGoals
-
 
189
                                                                    &&
-
 
190
                                                                    <a href={item.actions.link_goals} style={{ color: '#333' }}>
-
 
191
                                                                    	<i className='fa fa-level-down' />
-
 
192
                                                                    </a>
-
 
193
                                                				}
-
 
194
                                                				{
-
 
195
                                                					permisions.allowEdit
-
 
196
                                                                    &&
-
 
197
                                                                    <i
-
 
198
                                                                    	className='fa fa-pencil'
-
 
199
                                                                    	onClick={() => {
-
 
200
                                                                    		setActionLink(item.actions.link_edit)
-
 
201
                                                                    		setModalToShow('edit')
-
 
202
                                                                    	}}
-
 
203
                                                                    	style={{ cursor: 'pointer' }}
-
 
204
                                                                    />
-
 
205
                                                				}
-
 
206
                                                				{
-
 
207
                                                					permisions.allowDelete
-
 
208
                                                                    &&
-
 
209
                                                                    <i
-
 
210
                                                                    	className='fa fa-trash'
-
 
211
                                                                    	onClick={() => {
-
 
212
                                                                    		setActionLink(item.actions.link_delete)
-
 
213
                                                                    		setModalToShow('delete')
-
 
214
                                                                    	}}
-
 
215
                                                                    	style={{ cursor: 'pointer' }}
-
 
216
                                                                    />
-
 
217
                                                				}
-
 
218
                                                			</div>
-
 
219
                                                		</td>
-
 
220
                                                	</tr>
-
 
221
                                                ))
-
 
222
											}
-
 
223
										</Table>
-
 
224
									</div>
-
 
225
									<div className='row justify-content-between align-items-center'>
-
 
226
										<p className='mb-0'>
-
 
227
											{`Mostrando registros del ${(dataLength * pages.current) - (dataLength - 1) || 0} al ${(dataLength * pages.current) - (dataLength - total) || 0} de un total de ${total || 0} registros`}
-
 
228
										</p>
-
 
229
										<TablePagination
-
 
230
											onDecrement={() => setPages(prev => prev.current -= 1)}
-
 
231
											onIncrement={() => setPages(prev => prev.current += 1)}
-
 
232
											totalPages={pages.last}
-
 
233
											currentPage={pages.current}
-
 
234
										/>
-
 
235
									</div>
-
 
236
								</Card.Body>
-
 
237
							</Card>
-
 
238
						</div>
-
 
239
					</div >
-
 
240
				</div >
-
 
241
			</section >
-
 
242
			<DeleteModal
-
 
243
				url={actionLink}
-
 
244
				isOpen={modalToShow === 'delete'}
-
 
245
				closeModal={() => setModalToShow('')}
-
 
246
				title="Esta seguro de borrar este objetivo?"
-
 
247
				onComplete={() => setItems(items.filter((item) => item.actions.link_delete !== actionLink))}
-
 
248
				message="Registro borrado"
70
		<ContentTitle title='Planificación - Objetivos y Metas'>
249
			/>
71
 
250
		</ContentTitle >
72
		</ContentTitle >
251
	)
73
	)
Línea 252... Línea 74...
252
}
74
}
253
 
75