{% extends "./layout/default" %}

{% block breadcrumbs %}
    {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-lg-12">
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">{{ 'tags'|_ }}</h3>
                </div>
                <div class="box-body">
                    <p>
                        {{ 'tags_introduction'|_ }}
                    </p>

                    <p>
                        {{ 'tags_group'|_ }}
                    </p>

                    <p>
                        {{ 'tags_start'|_ }}
                    </p>
                </div>
                <div class="box-footer">
                    <a href="{{ route('tags.create') }}" title="New tag" class="btn btn-info pull-right">{{ 'new_tag'|_ }}</a>
                </div>
            </div>
        </div>
    </div>
    {% if count == 0 %}
        {% include 'partials.empty' with {what: 'default', type: 'tags',route: route('tags.create')} %}
    {% else %}
        <div class="row">
            {% for type in types %}
                <div class="col-lg-4">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">{{ ('tag_title_'~type)|_ }}</h3>
                        </div>
                        <div class="box-body">
                            {% for year,months in collection[type] %}
                                <h4>{{ year }}</h4>

                                {% for month,tags in months %}
                                    <h5>{{ month }}</h5>
                                    <p style="line-height: 200%;">
                                        {% for tag in tags %}
                                            <span style="display: inline;"><a style="font-size:100%;font-weight:normal;" class="label label-success"
                                                                              href="{{ route('tags.show',tag.id) }}">
                                                {% if tag.tagMode == 'nothing' %}
                                                    <i class="fa fa-fw fa-tag"></i>
                                                {% endif %}
                                                    {% if tag.tagMode == 'balancingAct' %}
                                                        <i class="fa fa-fw fa-refresh"></i>
                                                    {% endif %}
                                                    {% if tag.tagMode == 'advancePayment' %}
                                                        <i class="fa fa-fw fa-sort-numeric-desc"></i>
                                                    {% endif %}
                                                    {{ tag.tag }}</a>
                                </span>
                                        {% endfor %}
                                    </p>
                                {% endfor %}
                            {% endfor %}


                        </div>
                    </div>
                </div>
            {% endfor %}
        </div>
    {% endif %}

{% endblock %}
{% block scripts %}
    <script src="js/ff/tags/index.js"></script>
{% endblock %}
