{% import "@ChamiloTheme/Macros/box.html.twig" as macro_box %}
{% import "@ChamiloTheme/Macros/actions.html.twig" as macro_actions %}
{% import "@ChamiloTheme/Macros/buttons.html.twig" as macro_buttons %}
{% import "@ChamiloTheme/Macros/image.html.twig" as macro_image %}
{% import '@ChamiloTheme/Macros/headers.html.twig' as macro_headers %}
<!doctype html>
<!--[if IE 9 ]>
<html lang="{{ app.request.locale }}" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="{{ app.request.locale }}" class="no-js"> <!--<![endif]-->
{# Chamilo theme #}
{% set theme = 'chamilo' %}
{% block chamilo_head %}
<head>
{% include "@ChamiloTheme/Layout/head.html.twig" %}
</head>
{% endblock %}

<body
    class="{{ section_name }} app header-fixed sidebar-fixed aside-menu-fixed sidebar-lg-show"
    {{ sonata_seo_html_attributes() }}
    data-in-course="{{ course ? 'true' : 'false' }}"
    data-course-code="{{ course ? course.code : '' }}"
    data-session-id="{{ session ? session.id : '' }}"
>
<noscript> {{ "NoJavascript" | trans }} </noscript>

<!-- PAGE -->
{% block chamilo_wrap %}
    <!-- HEADER -->
    {% block page_header %}
        {% include '@ChamiloTheme/Layout/header.html.twig' %}
    {% endblock %}
    <!-- END HEADER -->

    <div class="app-body">
        <!-- SIDEBAR -->
        {% block page_sidebar %}
            {% include '@ChamiloTheme/Layout/sidebar.html.twig' %}
        {% endblock %}
        <!-- END SIDEBAR -->
        <main id="app-main" class="main">
            <!-- BREADCRUMB -->
            {% block chamilo_breadcrumb %}
                {% include '@ChamiloTheme/Layout/breadcrumb.html.twig' %}
            {% endblock %}
            <!-- END BREADCRUMB -->
            <!-- CONTENT -->
            {% block page_content %}
            {% endblock %}
            <!-- END CONTENT -->
        </main>
    </div>
{% endblock %}
<!-- END PAGE -->

<!-- FOOTER -->
{% block chamilo_footer %}
    {% include '@ChamiloTheme/Layout/footer.html.twig' %}
{% endblock %}
<!-- END FOOTER -->

<div class="modal fade" id="expand-image-modal" tabindex="-1" role="dialog" aria-labelledby="expand-image-modal-title" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | trans }}">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="expand-image-modal-title">&nbsp;</h4>
            </div>
            <div class="modal-body">
            </div>
        </div>
    </div>
</div>
{# Global modal, load content by AJAX call to href attribute on anchor tag with 'ajax' class #}
<div class="modal fade" id="global-modal" tabindex="-1" role="dialog" aria-labelledby="global-modal-title" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="global-modal-title">Modal title</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
<script>
    // MODAL DELETE CONFIRM
    $('.delete-swal').click(function (e) {
        e.preventDefault(); // Prevent the href from redirecting directly
        var linkURL = $(this).attr("href");
        var title = $(this).attr("title");
        deleteConfirm(linkURL, title);
    });
    function deleteConfirm(linkURL, title) {
        swal({
            //title: '{{ 'Warning'|trans }}',
            text: title,
            icon: "warning",
            buttons: true,
            dangerMode: true,
        }).then((willDelete) => {
            if (willDelete) {
                window.location.href = linkURL;
            }
        });
    }
</script>
</body>
</html>
