{% set paths_base = '../..' %}
{% set bodyClasses = 'single single-degree' %}

{% set degree = post_type.degrees.items[currentPost] %}

{% extends "base.twig" %}

{% block breadcrumbs %}

    {% set breadcrumbs_block = 
        {
            "post_type": "degrees",
            "show_terms": true,
            "current_id": currentPost 
        }
    %}
    {% include '../blocks/breadcrumbs.twig' with {'block': breadcrumbs_block } %}

{% endblock %}

{% block banner %}

    {% set banner_block = 
        {
            "key": "page-title-banner",
            "content": {
                "video": degree.degree_banner.video,
                "title": degree.degree_banner.text
            }
        } 
    %}

    {% include '../blocks/page-title-banner.twig' with {'block': banner_block } %}

{% endblock %}
 
{% block content %}

    <span class="secondary-nav-trigger"></span>
    <nav class="secondary-nav">
        <ul>
            {% for item in degree.nav %}
                <li><a href="{{item.url}}">{{item.name}}</a></li>
            {% endfor %}
        </ul>
        <a href="#" class="secondary-nav__btn"><span>Come iscriversi</span></a>
    </nav>

    <section class="degree-cols content-section" id="presentazione">
        <div class="degree-cols__col">
            <div class="block-container block-paragraph block-paragraph--lg">
                {{degree.content}}
                {% for block in degree.content_blocks %}
                    {% include '../blocks/'~block.key~'.twig' with {'block': block } %}
                {% endfor %}                
            </div>
        </div>
        <div class="degree-cols__col degree-cols__col-info">
        
            {% include '../blocks/grid-list.twig' with {'block': degree.degree_info } %}

            <div>
                {% for link in degree.degree_links %}
                    {% set block_link = 
                        {
                            "key": "link",
                            "url": link.url,
                            "content": {
                                "name": link.name,
                                "type": link.type,
                                "external_name": link.external_name
                            }
                        }
                    %}
                    {% include '../blocks/link.twig' with {'block': block_link } %}
                {% endfor %}
            </div>

        </div>
    </section>

    {# Piano di studi #}
    {% if degree.degree_curricula is null %}
        <section class="content-section" id="piano-di-studi">
            {% include './partials/degree/study-plan.twig' with {'year_1': degree.degree_study_plan[0], 'year_2': degree.degree_study_plan[0], 'year_3': degree.degree_study_plan[0], 'year_alt': degree.degree_study_plan[0] } %}
        </section>
    {% else %}
        <section class="content-section degree-curricula" id="curricula">
            {% include './partials/degree/curricula.twig' with {'degree': degree } %}
        </section>
    {% endif %}

    {# Tabs #}
    {% if degree.degree_tabs is not null %}
        <section class="content-section" id="tabs">
            {% include '../blocks/featured-tabs.twig' with {'block': degree.degree_tabs } %}
        </section>
    {% endif %}    

    {# Selezioni, immatricolazioni e ammissioni #}
    <section class="content-section" id="immatricolazioni">

        {# Titolo #}
        {% set enrollment_block_title = 
            {
                "key": "title",
                "tag": "h2",
                "classes": "block-title--sm block-title--divider",
                "content": {
                    "title": "Selezioni, immatricolazioni e ammissioni",
                    "link": {
                        "label": "Vedi il processo di ammissione",
                        "url": "#"
                    }
                }
            }
        %}
        {% include '../blocks/title.twig' with {'block': enrollment_block_title } %}

        {# Testo #}
        {% set enrollment_block_content = 
            {
                "key": "paragraph",
                "classes": "block-paragraph--1col",
                "content": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque quis dolor eu arcu interdum laoreet. Mauris sodales rhoncus tellus, nec placerat ligula elementum ultricies. Integer nec congue quam. Integer lobortis justo dui, eget gravida est vestibulum in quisque quis dolor eu arcu.</p>"
            }
        %}
        {% include '../blocks/paragraph.twig' with {'block': enrollment_block_content } %}

        {# Download #}
        {% set enrollment_block_files = 
            {
                "key": "files-list",
                "classes": "",
                "content": {
                    "items": degree.degree_enrollment.files
                }
            }
        %}
        {% include '../blocks/files-list.twig' with {'block': enrollment_block_files } %}

    </section>

    {# Tasse e contributi #}
    <section class="content-section" id="tasse-contributi">

        {# Titolo #}
        {% set taxes_block_title = 
            {
                "key": "title",
                "tag": "h2",
                "classes": "block-title--sm block-title--divider",
                "content": {
                    "title": "Tasse e contributi",
                    "link": {
                        "label": "Vai alla pagina sulle tasse",
                        "url": "#"
                    }
                }
            }
        %}
        {% include '../blocks/title.twig' with {'block': taxes_block_title } %}

        {# Testo #}
        {% set taxes_block_content = 
            {
                "key": "paragraph",
                "classes": "block-paragraph--1col",
                "content": "<p><strong>Prova titolo</strong><br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque quis dolor eu arcu interdum laoreet. Mauris sodales rhoncus tellus, nec placerat ligula elementum ultricies. Integer nec congue quam. Integer lobortis justo dui, eget gravida est vestibulum in quisque quis dolor eu arcu.</p>"
            }
        %}
        {% include '../blocks/paragraph.twig' with {'block': taxes_block_content } %}

        {# Griglia informativa #}
        {% set taxes_block_list = 
            {
                "key": "grid-list",
                "classes": "",
                "content": {
                    "items": degree.degree_taxes.items
                }
            }
        %}
        {% include '../blocks/grid-list.twig' with {'block': taxes_block_list } %}

    </section>

    <section class="content-section" id="focus">
        {% include '../blocks/featured-content-stacked.twig' with {'block': degree.degree_focus } %}
    </section>

    {# Ultime news #}
    <section class="content-section" id="news">
        {# Titolo #}
        {% set news_block_title = 
            {
                "key": "title",
                "tag": "h2",
                "classes": "block-title--sm block-title--divider",
                "content": {
                    "title": "Ultime news",
                    "link": {
                        "label": "Vedi tutte",
                        "url": "#"
                    }
                }
            }
        %}
        {% include '../blocks/title.twig' with {'block': news_block_title } %}

        {# News posts #}
        {% include '../blocks/tease-row.twig' with {'block': degree.degree_news } %}

    </section>

    {# Avvisi #}
    <section class="content-section" id="avvisi">
        {# Titolo #}
        {% set notices_block_title = 
            {
                "key": "title",
                "tag": "h2",
                "classes": "block-title--sm block-title--divider",
                "content": {
                    "title": "Avvisi",
                    "link": {
                        "label": "Vedi tutti",
                        "url": "#"
                    }
                }
            }
        %}
        {% include '../blocks/title.twig' with {'block': notices_block_title } %}

        {# News posts #}
        {% include '../blocks/tease-row.twig' with {'block': degree.degree_notices } %}

    </section>

    {# Domande frequenti #}
    <section class="content-section" id="faq">
        {# Titolo #}
        {% set faq_block_title = 
            {
                "key": "title",
                "tag": "h2",
                "classes": "block-title--sm block-title--divider",
                "content": {
                    "title": "Domande frequenti"
                }
            }
        %}
        {% include '../blocks/title.twig' with {'block': faq_block_title } %}

        {% include '../blocks/accordion.twig' with {'block': degree.degree_faq } %}

    </section>

    {# Contatti #}
    {% include '../blocks/contacts-section.twig' with {'block': degree.degree_contacts, 'id': 'contatti' } %}

{% endblock %}