{% set current_theme = current_theme() %} {% import "learning/resources/type_macros.html" as r_macros %} {% set
permitir_docente = docente_asignado(id_curso=curso.codigo) %} {% set permitir_moderador =
moderador_asignado(id_curso=curso.codigo) %} {% set permitir_estudiante = estudiante_asignado(id_curso=curso.codigo) %} {% set
permitir_editar = current_user.tipo == "admin" or permitir_docente %}

<!doctype html>
<html lang="{{ current_locale() }}" class="h-100">
    <head>
        {{ current_theme.headertags() }}
        <title>{{ curso.codigo | upper }} - {{ curso.nombre | title }}</title>

        {{ current_theme.local_style() }}
    </head>

    <body>
        {{ current_theme.navbar() }}

        <main>
            {{ current_theme.notify() }}

            <div class="container-fluid px-0 py-3">
                <div class="container">
                    <nav aria-label="breadcrumb" class="mb-4">
                        <ol class="breadcrumb bg-light rounded px-3 py-2">
                            <li class="breadcrumb-item">
                                <a class="text-decoration-none" href="{{ url_for('home.panel') }}">
                                    <i class="bi bi-house-fill me-1"></i>{{ _("Inicio") }}
                                </a>
                            </li>
                            <li class="breadcrumb-item">
                                <a class="text-decoration-none" href="{{ url_for('course.curso', course_code=curso.codigo) }}">
                                    <i class="bi bi-book me-1"></i>{{ curso.nombre }}
                                </a>
                            </li>
                            <li class="breadcrumb-item active" aria-current="page">
                                <i class="bi bi-file-earmark me-1"></i>{{ recurso.nombre }}
                            </li>
                        </ol>
                    </nav>

                    <div class="row g-4">
                        <div class="col-lg-8">
                            <!-- Resource Header -->
                            <div class="card shadow-sm mb-4">
                                <div class="card-header bg-primary text-white">
                                    <h1 class="h4 mb-0"><i class="bi bi-code-slash me-2"></i>{{ recurso.nombre }}</h1>
                                </div>
                                <div class="card-body p-0">
                                    <div id="resource_container" class="d-flex justify-content-center position-relative">
                                        <iframe
                                            title="{{ recurso.nombre }}"
                                            id="Iframe"
                                            src="{{ url_for('course.external_code', recurso_code=recurso.id, course_code=recurso.curso) }}"
                                            class="w-100"
                                            style="min-height: 500px; border: none"
                                        ></iframe>
                                    </div>
                                </div>
                            </div>

                            <!-- Resource Description -->
                            {% if recurso.descripcion %}
                            <div class="card shadow-sm mb-4">
                                <div class="card-header">
                                    <h2 class="h6 mb-0">
                                        <i class="bi bi-info-circle me-2"></i>{{ _("Información") }} del {{ _("Recurso") }}
                                    </h2>
                                </div>
                                <div class="card-body">
                                    {% if recurso.descripcion_html_preformateado %} {{ recurso.descripcion | safe }}} {% else
                                    %} {{ markdown2html(recurso.descripcion) | safe }}} {% endif %}
                                </div>
                            </div>
                            {% endif %}

                            <!-- AdSense Ad after resource description for free courses -->
                            {% if adsense_enabled() and not curso.pagado %} {% set ad_code = ad_large_rectangle() %} {% if
                            ad_code %}
                            <div class="card shadow-sm mb-4">
                                <div class="card-body text-center">
                                    <small class="text-muted d-block mb-2">Publicidad</small>
                                    {{ ad_code | safe }}}
                                </div>
                            </div>
                            {% endif %} {% endif %}
                        </div>

                        <div class="col-lg-4">
                            {{ r_macros.resource_nav(recursos=recursos, secciones=secciones, user_progress=user_progress,
                            evaluaciones=evaluaciones, evaluation_attempts=evaluation_attempts) }}
                        </div>
                    </div>
                </div>
            </div>

            {{ r_macros.nav_footer(indice=indice, curso=recurso.curso, type=recurso.tipo, codigo=recurso.id,
            recurso_completado=recurso_completado) }}
        </main>
    </body>
</html>
