-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d482ee
commit ba91587
Showing
18 changed files
with
2,617 additions
and
2,834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// GestionSolicitudes.jsx | ||
import React, { useState } from 'react'; | ||
import '../styles/gestionSolicitudes.css'; | ||
import Navbar from '../components/Navbar'; | ||
import Footer from '../components/Footer'; | ||
|
||
const GestionSolicitudes = () => { | ||
const [solicitudes, setSolicitudes] = useState([ | ||
{ id: 1, tipo: 'Evento', descripcion: 'Concierto en el parque', estado: 'Pendiente', comentario: '', fecha: '2024-11-01' }, | ||
{ id: 2, tipo: 'Publicación', descripcion: 'Casa en la playa', estado: 'Pendiente', comentario: '', fecha: '2024-11-02' }, | ||
{ id: 3, tipo: 'Notificación', descripcion: 'Nuevo mensaje', estado: 'Pendiente', comentario: '', fecha: '2024-11-03' }, | ||
// Añadir más solicitudes de diferentes tipos y fechas | ||
]); | ||
|
||
const [filtroFecha, setFiltroFecha] = useState(''); | ||
const [filtroTipo, setFiltroTipo] = useState(''); | ||
|
||
const handleAction = (id, action) => { | ||
setSolicitudes(prevSolicitudes => | ||
prevSolicitudes.map(solicitud => | ||
solicitud.id === id ? { ...solicitud, estado: action } : solicitud | ||
) | ||
); | ||
}; | ||
|
||
const handleComentarioChange = (id, comentario) => { | ||
setSolicitudes(prevSolicitudes => | ||
prevSolicitudes.map(solicitud => | ||
solicitud.id === id ? { ...solicitud, comentario } : solicitud | ||
) | ||
); | ||
}; | ||
|
||
const solicitudesFiltradas = solicitudes.filter(solicitud => { | ||
const coincideFecha = filtroFecha ? solicitud.fecha === filtroFecha : true; | ||
const coincideTipo = filtroTipo ? solicitud.tipo === filtroTipo : true; | ||
return coincideFecha && coincideTipo; | ||
}); | ||
|
||
return ( | ||
<div> | ||
<Navbar /> | ||
<div className="gestion-solicitudes-container"> | ||
<h1>Gestión de Solicitudes</h1> | ||
<div className="GS-content"> | ||
{/* Filtros */} | ||
<div className="filters"> | ||
<h3>Filtros</h3> | ||
<label>Fecha solicitud:</label> | ||
<input | ||
type="date" | ||
value={filtroFecha} | ||
onChange={(e) => setFiltroFecha(e.target.value)} | ||
/> | ||
<label>Tipo:</label> | ||
<select | ||
value={filtroTipo} | ||
onChange={(e) => setFiltroTipo(e.target.value)} | ||
> | ||
<option value="">Todos</option> | ||
<option value="Evento">Eventos</option> | ||
<option value="Publicación">Publicaciones</option> | ||
<option value="Notificación">Notificaciones</option> | ||
</select> | ||
</div> | ||
|
||
{/* Lista de solicitudes */} | ||
<div className="solicitudes-list"> | ||
{solicitudesFiltradas.map(solicitud => ( | ||
<div key={solicitud.id} className="solicitud-item"> | ||
<h2>{solicitud.tipo}</h2> | ||
<p>{solicitud.descripcion}</p> | ||
<p>Fecha solicitud: {solicitud.fecha}</p> | ||
<p>Estado: {solicitud.estado}</p> | ||
<textarea | ||
placeholder="Escribe un comentario (opcional)" | ||
value={solicitud.comentario} | ||
onChange={(e) => handleComentarioChange(solicitud.id, e.target.value)} | ||
className="comentario-input" | ||
/> | ||
<div className="actions"> | ||
<button className="button-aceptar" onClick={() => handleAction(solicitud.id, 'Aceptada')}>Aceptar</button> | ||
<button className="button-rechazar" onClick={() => handleAction(solicitud.id, 'Rechazada')}>Rechazar</button> | ||
<button className="button-objetar" onClick={() => handleAction(solicitud.id, 'Objetada')}>Objetar</button> | ||
</div> | ||
{solicitud.estado === 'Objetada' && solicitud.comentario && ( | ||
<p>Comentario: {solicitud.comentario}</p> | ||
)} | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
<Footer /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GestionSolicitudes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.