develop #30
@@ -21,6 +21,8 @@ export default function Page() {
|
||||
const params = useParams<Params>();
|
||||
const { evento, loading, error, updateEvento, setEventoData } = useEvento();
|
||||
|
||||
const tipo_usuario = sessionStorage.getItem('axxxd')?.replace(/"/g, '') || '';
|
||||
|
||||
const [loadingStates, setLoadingStates] = useState<Record<number, boolean>>(
|
||||
{}
|
||||
);
|
||||
@@ -86,26 +88,29 @@ export default function Page() {
|
||||
handleOnChange={handleEventoActualizado}
|
||||
/>
|
||||
|
||||
<div className="p-4 border rounded bg-light">
|
||||
<div className="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h2 className="mb-0">Formularios del evento</h2>
|
||||
<p className="mb-0 text-muted">
|
||||
Aquí puedes ver y gestionar los formularios asociados a este
|
||||
evento.
|
||||
</p>
|
||||
{/* Validacion del tipo de usuario */}
|
||||
{ tipo_usuario !== "staff" && (
|
||||
<div className="p-4 border rounded bg-light">
|
||||
<div className="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h2 className="mb-0">Formularios del evento</h2>
|
||||
<p className="mb-0 text-muted">
|
||||
Aquí puedes ver y gestionar los formularios asociados a este
|
||||
evento.
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
icon="plus"
|
||||
variant="primary"
|
||||
onClick={() =>
|
||||
router.push(`/user/evento/${params.id_evento}/formularios/crear`)
|
||||
}
|
||||
>
|
||||
Crear nuevo formulario
|
||||
</Button>
|
||||
</div>
|
||||
<Button
|
||||
icon="plus"
|
||||
variant="primary"
|
||||
onClick={() =>
|
||||
router.push(`/user/evento/${params.id_evento}/formularios/crear`)
|
||||
}
|
||||
>
|
||||
Crear nuevo formulario
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{evento?.cuestionarios && evento.cuestionarios.length > 0 && (
|
||||
<div className="row mt-3">
|
||||
|
||||
@@ -60,7 +60,31 @@ export default function Page() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!loading && data && data.length > 0 && (
|
||||
{/*
|
||||
{!loading && data && data.length > 0 && (
|
||||
<div className="row">
|
||||
{data.flatMap((evento) =>
|
||||
evento.cuestionarios
|
||||
// Filtramos solo los cuestionarios con id_cuestionario >= 148
|
||||
.filter((cuestionario) => !cuestionario.id_cuestionario > 10 && !cuestionario.id_cuestionario < 148)
|
||||
// Luego mapeamos para renderizarlos
|
||||
.map((cuestionario, index) => (
|
||||
<div
|
||||
className={`col-md-6 col-lg-4 my-3 fade-in-up-bounce delay-${(index % 5) + 1}`}
|
||||
key={`${evento.id_evento}-${cuestionario.id_cuestionario}`}
|
||||
>
|
||||
<FormularioCardUser
|
||||
evento={evento}
|
||||
formulario={cuestionario}
|
||||
/>
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
*/}
|
||||
|
||||
{!loading && data && data.length > 0 &&(
|
||||
<div className="row">
|
||||
{data.flatMap((evento) =>
|
||||
evento.cuestionarios.map((cuestionario, index) => {
|
||||
|
||||
+19
-10
@@ -4,14 +4,13 @@ import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
type NavChild = {
|
||||
href: string; // siempre string
|
||||
href: string; // siempre string
|
||||
label: string;
|
||||
};
|
||||
|
||||
type NavItem =
|
||||
| { href: string; label: string } // items normales
|
||||
| { label: string; children: NavChild[] } // items con submenu
|
||||
|
||||
| { href: string; label: string } // items normales
|
||||
| { label: string; children: NavChild[] }; // items con submenu
|
||||
|
||||
const Navbar: React.FC = () => {
|
||||
const pathname = usePathname();
|
||||
@@ -26,7 +25,10 @@ const Navbar: React.FC = () => {
|
||||
label: 'Carga Masiva',
|
||||
children: [
|
||||
{ href: '/user/eventos/carga_masiva', label: 'Carga Masiva Eventos' },
|
||||
{ href: '/user/eventos/carga_masiva_banner', label: 'Carga Masiva Imagenes' },
|
||||
{
|
||||
href: '/user/eventos/carga_masiva_banner',
|
||||
label: 'Carga Masiva Imagenes',
|
||||
},
|
||||
],
|
||||
},
|
||||
{ href: '/user/usuarios', label: 'Usuarios' },
|
||||
@@ -39,7 +41,8 @@ const Navbar: React.FC = () => {
|
||||
{ href: '/login', label: 'Cerrar sesión' },
|
||||
];
|
||||
|
||||
const navItems = tipo_usuario === 'administrador' ? navItemsAdmin : navItemsUser;
|
||||
const navItems =
|
||||
tipo_usuario === 'administrador' ? navItemsAdmin : navItemsUser;
|
||||
|
||||
return (
|
||||
<nav className="navbar navbar-expand-lg navbar-dark bg-azul">
|
||||
@@ -59,7 +62,7 @@ const Navbar: React.FC = () => {
|
||||
id="offcanvasNavbar"
|
||||
aria-labelledby="offcanvasNavbarLabel"
|
||||
>
|
||||
<div className="offcanvas-header">
|
||||
<div className="offcanvas-header bg-azul text-white">
|
||||
<h5 className="offcanvas-title" id="offcanvasNavbarLabel">
|
||||
Menu
|
||||
</h5>
|
||||
@@ -70,11 +73,17 @@ const Navbar: React.FC = () => {
|
||||
aria-label="Close"
|
||||
></button>
|
||||
</div>
|
||||
<div className="offcanvas-body align-items-center justify-content-between">
|
||||
<h2 className="h5 mb-0 text-white">Sistema de Registro de Eventos</h2>
|
||||
<div className="offcanvas-body align-items-center justify-content-between bg-azul">
|
||||
<h2 className="h5 mb-0 text-white">
|
||||
Sistema de Registro de Eventos
|
||||
</h2>
|
||||
<ul className="navbar-nav gap-lg-5">
|
||||
{navItems.map((item, index) => (
|
||||
<li key={index} className="nav-item" data-bs-dismiss="offcanvas">
|
||||
<li
|
||||
key={index}
|
||||
className="nav-item"
|
||||
data-bs-dismiss="offcanvas"
|
||||
>
|
||||
{'href' in item ? (
|
||||
<Link
|
||||
className={`nav-link ${
|
||||
|
||||
Reference in New Issue
Block a user