{% import '@ChamiloTheme/Macros/box.html.twig' as macro %}

{% autoescape false %}
{% set content %}
    {% if is_granted('ROLE_ADMIN') %}
        <div class="announcement-edit d-block text-right">
            <a  href="{{ url('legacy_index') }}main/admin/system_announcements.php" class="btn btn-primary btn-sm" >
                <i class="fas fa-pencil-alt"></i> {{ "Edit this section"|trans }}
            </a>
        </div>
    {% endif %}
    {% if announcements %}
    <div id="carousel-announcement" class="carousel slide" data-ride="carousel">
        <ol class="carousel-indicators">
            {% for announcement in announcements %}
                <li data-target="#carousel-announcement"
                    data-slide-to="{{ loop.index0 }}" {% if loop.index0 == 0 %} class="active" {% endif %}></li>
            {% endfor %}
        </ol>
        <div class="carousel-inner">
            {% for announcement in announcements %}
                <div class="carousel-item {% if loop.index0 == 0 %} active {% endif %}">
                    <div class="row">
                        <div class="col-12 col-md-6">
                            <div class="announcement-text">
                                <div class="d-md-block">
                                    <h5>{{ announcement.title }}</h5>
                                    {% if announcement.readMore %}
                                        <div class="block-text">
                                            {{ announcement.content }}
                                            <a href="{{ _p.web }}news_list.php?id={{ announcement.id }}">{{ "More" | trans }}</a>
                                        </div>
                                    {% else %}
                                        {{ announcement.content }}
                                    {% endif %}
                                </div>
                            </div>
                        </div>
                        <div class="col-12 col-md-6">
                            <div class="announcement-image">
                                <img src="{{ announcement.picture }}" class="d-block" alt="...">
                                <div class="dotted-bg-block lines">
                                    <div></div>
                                </div>
                            </div>
                        </div>
                    </div>


                </div>
            {% endfor %}
        </div>
        <a class="carousel-control-prev" href="#carousel-announcement" role="button" data-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="carousel-control-next" href="#carousel-announcement" role="button" data-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div>
    {% else %}

        <div class="row">
            <div class="col-md-6">

                <div class="block-platform d-none d-block">
                    <h1>{{ "Accelerate your future. Learn where you want and when you want"|trans }}</h1>
                    <h5>{{ "Develop your skills with Chamilo 2.0"|trans }}</h5>
                </div>
            </div>
            <div class="col-md-6">
                <img class="d-block w-100" data-src="slide" alt="" src="{{ asset('img/intro_chamilo.svg') }}"
                     data-holder-rendered="true">
            </div>
        </div>
    {% endif %}
{% endset %}

    {{ content }}

{% endautoescape %}