{% extends ajax-suffix ? "@gantry-admin/partials/ajax.html.twig" : "@gantry-admin/partials/base.html.twig" %}

{% block gantry %}
    <div id="assignments">
        {% if assignments %}
            <form method="post">
        <span class="float-right">
            <button type="submit" class="button button-primary button-save" data-save="{{ 'GANTRY5_PLATFORM_ASSIGNMENTS'|trans }}"><i class="fa fa-fw fa-check"></i> <span>{{ 'GANTRY5_PLATFORM_SAVE_ASSIGNMENTS'|trans }}</span></button>
        </span>

                <h2 class="page-title">{{ 'GANTRY5_PLATFORM_ASSIGNMENTS'|trans }}</h2>

                <div class="g-filters-bar">
                    <div class="g-panel-filters" data-g-global-filter>
                        <div class="search settings-block">
                            <input type="text" placeholder="{{ 'GANTRY5_PLATFORM_GLOBAL_FILTER_ELI'|trans }}" aria-label="{{ 'GANTRY5_PLATFORM_GLOBAL_FILTER_ELI'|trans }}" role="search">
                            <i class="fa fa-fw fa-search"></i>
                        </div>
                        <span data-g-assignments-uncheck data-role="button" tabindex="0" aria-label="{{ 'GANTRY5_PLATFORM_UNSELECT_ALL_MENU'|trans }}" data-tip="{{ 'GANTRY5_PLATFORM_UNSELECT_ALL_MENU'|trans }}" data-tip-place="right"><i class="fa fa-fw fa-toggle-off"></i></span>
                        <span data-g-assignments-check data-role="button" tabindex="0" aria-label="{{ 'GANTRY5_PLATFORM_SELECT_ALL_MENU'|trans }}" data-tip="{{ 'GANTRY5_PLATFORM_SELECT_ALL_MENU'|trans }}" data-tip-place="right"><i class="fa fa-fw fa-toggle-on"></i></span>
                    </div>
                    <label>
                        <input type="checkbox" data-assignments-enabledonly /> {{ 'GANTRY5_PLATFORM_HIDE_ASSIGNMENTS'|trans }}
                    </label>

                    {% if options %}
                        <div class="pull-right">
                            {% include '@gantry-admin/forms/fields/select/selectize.html.twig' with {'layout': 'input', 'name': 'assignment', 'field': {'type': 'select.selectize', 'options': options}, 'value': assignment} only %}
                        </div>
                    {% endif %}
                </div>

                <div class="cards-wrapper clearfix">
                    {% for type in assignments %}
                        <div class="card settings-block">
                            <h4>
                                {{ type.label|e }}
                                <div class="g-panel-filters float-right align-right">
                                    <div class="search settings-block">
                                        <input type="text" placeholder="{{ 'GANTRY5_PLATFORM_FILTER_ELI'|trans }}" aria-label="{{ 'GANTRY5_PLATFORM_FILTER_ELI'|trans ~ ' ' ~ type.label }}" role="search">
                                        <i class="fa fa-fw fa-search"></i>
                                    </div>
                                    <span data-g-assignments-uncheck data-role="button" tabindex="0" aria-label="{{ 'GANTRY5_PLATFORM_UNSELECT_ALL_MENU'|trans ~ ' in ' ~ type.label  }}" data-tip="{{ 'GANTRY5_PLATFORM_UNSELECT_ALL_MENU'|trans }}" data-tip-place="right"><i class="fa fa-fw fa-toggle-off"></i></span>
                                    <span data-g-assignments-check data-role="button" tabindex="0" aria-label="{{ 'GANTRY5_PLATFORM_SELECT_ALL_MENU'|trans ~ ' in ' ~ type.label  }}" data-tip="{{ 'GANTRY5_PLATFORM_SELECT_ALL_MENU'|trans }}" data-tip-place="right"><i class="fa fa-fw fa-toggle-on"></i></span>
                                </div>
                            </h4>

                            <div class="settings-param-wrapper">
                                {% for link in type.items %}
                                    <label class="settings-param">
                                        {% include 'forms/fields/enable/enable.html.twig' with {
                                        'default': true,
                                        'name': link.name,
                                        'field': link.field,
                                        'value': link.value,
                                        'disabled': link.disabled,
                                        'title': "'" ~ link.label ~ "' Menu Item"
                                        } %}
                                        <span class="settings-param-title">
                                {{- link.label -}}
                            </span>
                                    </label>
                                {% endfor %}
                            </div>
                        </div>
                    {% endfor %}
                </div>

                <div class="g-footer-actions">
            <span class="float-right">
                <button type="submit" class="button button-primary button-save" data-save="{{ 'GANTRY5_PLATFORM_ASSIGNMENTS'|trans }}"><i class="fa fa-fw fa-check"></i> <span>{{ 'GANTRY5_PLATFORM_SAVE_ASSIGNMENTS'|trans }}</span></button>
            </span>
                </div>
            </form>
        {% else %}
            <h2 class="page-title">{{ 'GANTRY5_PLATFORM_ASSIGNMENTS'|trans }}</h2>
            {% if configuration == 'default' %}
                <p>{{ 'GANTRY5_PLATFORM_ASSIGN_BASE_DESC'|trans }}</p>
            {% else %}
                <p>{{ 'GANTRY5_PLATFORM_NO_ASSIGNMENTS_DESC'|trans }}</p>
            {% endif %}
        {% endif %}
    </div>
{% endblock %}
