{{-- Partial: renderiza una sección dinámica del congreso según su tipo. Variables: $seccion (CongresoSeccion), $congreso (Congreso) --}} @php $bgStyle = ''; if ($seccion->imagen_fondo) { $bgStyle = "background-image:url('" . asset('storage/' . $seccion->imagen_fondo) . "');background-size:cover;background-position:center;"; } elseif ($seccion->color_fondo) { $bgStyle = "background-color:{$seccion->color_fondo};"; } $textStyle = $seccion->color_texto ? "color:{$seccion->color_texto};" : ''; @endphp
{{-- Encabezado de la sección --}} @if($seccion->titulo || $seccion->subtitulo)
@if($seccion->titulo)

{{ $seccion->titulo }}

@endif @if($seccion->subtitulo)

{{ $seccion->subtitulo }}

@endif
@endif {{-- ── CONTENIDO SEGÚN TIPO ──────────────────────────────────── --}} @if($seccion->tipo === 'texto')
{!! $seccion->contenido !!}
@elseif($seccion->tipo === 'imagen') @if($seccion->imagen)
{{ $seccion->titulo }}
@endif @if($seccion->contenido)
{!! $seccion->contenido !!}
@endif @elseif($seccion->tipo === 'video') @php $videoUrl = $seccion->video_url ?? ''; // Convertir URL normal de YouTube a embed if (str_contains($videoUrl, 'youtube.com/watch')) { parse_str(parse_url($videoUrl, PHP_URL_QUERY), $params); $videoUrl = 'https://www.youtube.com/embed/' . ($params['v'] ?? ''); } elseif (str_contains($videoUrl, 'youtu.be/')) { $videoUrl = 'https://www.youtube.com/embed/' . substr(parse_url($videoUrl, PHP_URL_PATH), 1); } elseif (str_contains($videoUrl, 'vimeo.com/')) { $videoId = basename(parse_url($videoUrl, PHP_URL_PATH)); $videoUrl = "https://player.vimeo.com/video/{$videoId}"; } @endphp @if($videoUrl)
@endif @elseif($seccion->tipo === 'mapa') @php $embedUrl = $seccion->mapa_embed_generado; @endphp
@if($seccion->layout === 'dos_columnas' && ($seccion->contenido || $seccion->mapa_direccion))
@if($seccion->mapa_direccion)

{{ $seccion->mapa_direccion }}

@endif @if($seccion->contenido) {!! $seccion->contenido !!} @endif @if($embedUrl) Ver en Google Maps @endif
@endif @if($embedUrl)
@else

@if($seccion->mapa_direccion) {{ $seccion->mapa_direccion }} @else Mapa no configurado @endif

@endif @if($seccion->layout === 'dos_columnas' && ($seccion->contenido || $seccion->mapa_direccion))
@endif @if($seccion->layout !== 'dos_columnas' && $seccion->mapa_direccion)

{{ $seccion->mapa_direccion }} @if($seccion->mapa_lat) Ver en Maps @endif

@endif @elseif($seccion->tipo === 'descargables') @php $materiales = $congreso->materiales()->activos()->publicos()->get(); @endphp @if($materiales->isNotEmpty())
@foreach($materiales as $mat)
{{ $mat->titulo }}
@if($mat->descripcion)

{{ $mat->descripcion }}

@endif
{{ $mat->tamanio_formateado }}
@endforeach
@else

No hay material disponible aún.

@endif @elseif($seccion->tipo === 'contador') @if(isset($congreso->fecha_inicio))
@foreach(['dias'=>'Días','horas'=>'Horas','minutos'=>'Minutos','segundos'=>'Segundos'] as $key=>$lbl)
--
{{ $lbl }}
@endforeach
@endif @else {{-- Tipo genérico: simplemente mostrar contenido --}} @if($seccion->contenido)
{!! $seccion->contenido !!}
@endif @endif