<commit_before>{% extends '@DarvinAdmin/content.html.twig' %}

{% trans_default_domain 'admin' %}

{% block breadcrumbs %}{{ admin_breadcrumbs(meta, parent_entity) }}{% endblock %}

{% block heading %}{{ (meta.baseTranslationPrefix ~ 'action.index.title')|trans }}{% endblock %}

{% block header_buttons %}
    <div class="page-header__btns">

        {% if filter_form %}
            <a class="page-header__btn-filter js-filter-toggle" href="#">{% trans %}filter.toggle{% endtrans %}</a>
        {% endif %}

        {% block new_link %}
            {% if not meta.configuration.index_view_new_form %}

                {% set new_url = null %}

                {% if admin_route_exists(meta.entityClass, 'new') and is_granted('admin_create_delete', meta.entityClass) %}

                    {% set new_url = admin_path(
                        null,
                        meta.entityClass,
                        'new',
                        association_param ? {(association_param): parent_entity_id} : {}
                    ) %}

                {% endif %}

                {% if new_url %}
                    <a class="{% if new_link_class is defined %}{{ new_link_class }}{% else %}page-header__btn-add{% endif %}"
                       href="{{ new_url }}">
                        {{ (meta.baseTranslationPrefix ~ 'action.new.link')|trans }}
                    </a>
                {% endif %}
            {% endif %}
        {% endblock %}

        {% block extra_controls %}{% endblock %}

        {% block property_forms_submit %}
            {% if view.body.rows is not empty %}
                <a class="js-property-submit save_edit" style="display: none;">
                    {% trans %}property_forms.submit{% endtrans %}
                </a>
            {% endif %}
        {% endblock %}

    </div>
{% endblock %}

{% block content %}
    {% block filter_form %}
        {% if filter_form %}

            {% form_theme filter_form '@DarvinAdmin/fields.html.twig' %}

            <div class="filter-block js-filter">
                <div class="filter-block__content">
                    {{ form_start(filter_form, {'attr': {'class': 'js-form'}}) }}
                    <div class="form-filter">

                        {% for field, attr in meta.configuration.form.filter.fields %}
                            {% if filter_form[field] is defined %}
                                {{ form_row(filter_form[field]) }}
                            {% endif %}
                        {% endfor %}

                        <div class="form-btns-container">
                            <button class="form-filter__btn-apply">{% trans %}filter.submit{% endtrans %}</button>
                            <a class="form-filter__btn-reset js-form-reset" href="{{ filter_form.vars.action }}">
                                {% trans %}filter.reset{% endtrans %}
                            </a>
                        </div>
                    </div>
                    {{ form_end(filter_form) }}
                </div>
            </div>
        {% endif %}
    {% endblock %}

    {% block new_form %}
        {% if new_form %}
            <p class="h2">{{ (meta.baseTranslationPrefix ~ 'action.new.title')|trans }}</p>
            {{ new_form|raw }}
        {% endif %}
    {% endblock %}

    <div class="content-block js-property-forms">
        <div class="content-block__header">

            {% if batch_delete_form %}
{#                    <label>#}
{#                        <input type="checkbox" class="js-batch-delete-check-all" autocomplete="off">#}
{#                        {% trans %}crud.action.batch_delete.select_all{% endtrans %}#}
{#                    </label>#}
                {{ form_start(batch_delete_form, {'attr': {
                    'class':            'js-form js-batch-delete',
                    'data-reload-page': 1,
                    'onsubmit':         'return confirm("' ~ 'crud.action.batch_delete.confirm'|trans|e('js') ~ '");',
                    'autocomplete':     'off',
                }}) }}
                {{ form_widget(batch_delete_form) }}
                <button class="content-block__btn-remove" style="display: none;">
                    {% trans %}crud.action.batch_delete.submit{% endtrans %}
                </button>
                {{ form_end(batch_delete_form) }}
            {% endif %}

            <div class="content-block__header-right">

                {% block total_item_count %}
                    {% if view.body.rows is not empty %}
                        <div class="content-block__total">
                            {% trans with {'%count%': entity_count} %}common.total_item_count{% endtrans %}
                        </div>
                    {% endif %}
                {% endblock %}

            </div>
        </div>
        <div class="content-block__content">
            {% if view.body.rows is empty %}
                <p class="h2">{% trans %}common.empty_list{% endtrans %}</p>
            {% else %}
                <div class="table" data-simplebar data-simplebar-auto-hide="false">
                    <table>
                        <thead>
                        <tr>
                            {% for field, item in view.head.items %}
                                {% if item.width %}
                                    <th colspan="{{ item.width }}">
                                        {% if pagination and item.sortable %}
                                            {{ knp_pagination_sortable(pagination, item.content|trans, item.sortablePropertyPath, [], [], '@DarvinAdmin/sortable.html.twig') }}
                                        {% else %}
                                            {{ item.content|trans }}
                                        {% endif %}
                                    </th>
                                {% endif %}
                            {% endfor %}
{#                            <th data-type="actions">#}
{#                                <label class="custom-checkbox"><input type="checkbox"><span></span></label>#}
{#                                Действия#}
{#                            </th>#}
{#                            <th data-type="position">Позиция</th>#}
{#                            <th data-type="checkbox">На главной</th>#}
{#                            <th data-type="checkbox">Активен</th>#}
{#                            <th data-type="checkbox">Скрыт</th>#}
{#                            <th data-type="checkbox">Расширенный фильтр</th>#}
{#                            <th data-type="checkbox">Виджет товаров</th>#}
{#                            <th>Название</th>#}
{#                            <th data-type="with-add">Товары</th>#}
{#                            <th data-type="with-add">Свойства</th>#}
{#                            <th data-type="link">Ссылка</th>#}
                        </tr>
                        </thead>
                        <tbody>
                        {% for row in view.body.rows %}
                            <tr{% for attr_name, attr_value in row.attr %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
                            {% for name, item in row.items %}
                                <td{% for attr_name, attr_value in item.attr %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
                                {% if 'action_widgets' == name %}
                                    <div class="edit_elements">
                                        {{ item.content|raw }}
                                    </div>
                                {% else %}
                                    {{ item.content|trans|raw }}
                                {% endif %}
                                </td>
                            {% endfor %}
                            </tr>
                        {% endfor %}
                        {#
                        <tr class="table-row">
                            <td data-type="actions">
                                <div class="table-row__actions">
                                    <label class="custom-checkbox" title="Выбрать"><input type="checkbox"><span></span></label>
                                    <button class="table-row__btn-show" title="Показать">show</button>
                                    <button class="table-row__btn-edit" title="Редактировать">edit</button>
                                    <button class="table-row__btn-remove" title="Удалить">remove</button>
                                </div>
                            </td>
                            <td data-type="position">
                                <div class="table-row__position" data-level="2">
                                    <form><input type="text"></form>
                                </div>
                            </td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td><commit_msg>Refactor CRUD index template.<commit_after>{% extends '@DarvinAdmin/content.html.twig' %}

{% trans_default_domain 'admin' %}

{% block breadcrumbs %}{{ admin_breadcrumbs(meta, parent_entity) }}{% endblock %}

{% block heading %}{{ (meta.baseTranslationPrefix ~ 'action.index.title')|trans }}{% endblock %}

{% block header_buttons %}
    <div class="page-header__btns">

        {% if filter_form %}
            <a class="page-header__btn-filter js-filter-toggle" href="#">{% trans %}filter.toggle{% endtrans %}</a>
        {% endif %}

        {% block new_link %}
            {% if not meta.configuration.index_view_new_form %}

                {% set new_url = null %}

                {% if admin_route_exists(meta.entityClass, 'new') and is_granted('admin_create_delete', meta.entityClass) %}

                    {% set new_url = admin_path(
                        null,
                        meta.entityClass,
                        'new',
                        association_param ? {(association_param): parent_entity_id} : {}
                    ) %}

                {% endif %}

                {% if new_url %}
                    <a class="{% if new_link_class is defined %}{{ new_link_class }}{% else %}page-header__btn-add{% endif %}"
                       href="{{ new_url }}">
                        {{ (meta.baseTranslationPrefix ~ 'action.new.link')|trans }}
                    </a>
                {% endif %}
            {% endif %}
        {% endblock %}

        {% block extra_controls %}{% endblock %}

        {% block property_forms_submit %}
            {% if view.body.rows is not empty %}
                <a class="js-property-submit save_edit" style="display: none;">
                    {% trans %}property_forms.submit{% endtrans %}
                </a>
            {% endif %}
        {% endblock %}

    </div>
{% endblock %}

{% block content %}
    {% block filter_form %}
        {% if filter_form %}

            {% form_theme filter_form '@DarvinAdmin/fields.html.twig' %}

            <div class="filter-block js-filter">
                <div class="filter-block__content">
                    {{ form_start(filter_form, {'attr': {'class': 'js-form'}}) }}
                    <div class="form-filter">

                        {% for name, attr in meta.configuration.form.filter.fields %}
                            {% if filter_form[name] is defined %}
                                {{ form_row(filter_form[name]) }}
                            {% endif %}
                        {% endfor %}

                        <div class="form-btns-container">
                            <button class="form-filter__btn-apply">{% trans %}filter.submit{% endtrans %}</button>
                            <a class="form-filter__btn-reset js-form-reset" href="{{ filter_form.vars.action }}">
                                {% trans %}filter.reset{% endtrans %}
                            </a>
                        </div>
                    </div>
                    {{ form_end(filter_form) }}
                </div>
            </div>
        {% endif %}
    {% endblock %}

    {% block new_form %}
        {% if new_form %}
            <p class="h2">{{ (meta.baseTranslationPrefix ~ 'action.new.title')|trans }}</p>
            {{ new_form|raw }}
        {% endif %}
    {% endblock %}

    <div class="content-block js-property-forms">
        <div class="content-block__header">

            {% if batch_delete_form %}
{#                    <label>#}
{#                        <input type="checkbox" class="js-batch-delete-check-all" autocomplete="off">#}
{#                        {% trans %}crud.action.batch_delete.select_all{% endtrans %}#}
{#                    </label>#}
                {{ form_start(batch_delete_form, {'attr': {
                    'class':            'js-form js-batch-delete',
                    'data-reload-page': 1,
                    'onsubmit':         'return confirm("' ~ 'crud.action.batch_delete.confirm'|trans|e('js') ~ '");',
                    'autocomplete':     'off',
                }}) }}
                {{ form_widget(batch_delete_form) }}
                <button class="content-block__btn-remove" style="display: none;">
                    {% trans %}crud.action.batch_delete.submit{% endtrans %}
                </button>
                {{ form_end(batch_delete_form) }}
            {% endif %}

            <div class="content-block__header-right">

                {% block total_item_count %}
                    {% if view.body.rows is not empty %}
                        <div class="content-block__total">
                            {% trans with {'%count%': entity_count} %}common.total_item_count{% endtrans %}
                        </div>
                    {% endif %}
                {% endblock %}

            </div>
        </div>
        <div class="content-block__content">
            {% if view.body.rows is empty %}
                <p class="h2">{% trans %}common.empty_list{% endtrans %}</p>
            {% else %}
                <div class="table" data-simplebar data-simplebar-auto-hide="false">
                    <table>
                        <thead>
                            <tr>
                                {% for item in view.head.items %}
                                    {% if item.width %}
                                        <th colspan="{{ item.width }}">
                                            {% if pagination and item.sortable %}
                                                {{ knp_pagination_sortable(pagination, item.content|trans, item.sortablePropertyPath, [], [], '@DarvinAdmin/sortable.html.twig') }}
                                            {% else %}
                                                {{ item.content|trans }}
                                            {% endif %}
                                        </th>
                                    {% endif %}
                                {% endfor %}
    {#                            <th data-type="actions">#}
    {#                                <label class="custom-checkbox"><input type="checkbox"><span></span></label>#}
    {#                                Действия#}
    {#                            </th>#}
    {#                            <th data-type="position">Позиция</th>#}
    {#                            <th data-type="checkbox">На главной</th>#}
    {#                            <th data-type="checkbox">Активен</th>#}
    {#                            <th data-type="checkbox">Скрыт</th>#}
    {#                            <th data-type="checkbox">Расширенный фильтр</th>#}
    {#                            <th data-type="checkbox">Виджет товаров</th>#}
    {#                            <th>Название</th>#}
    {#                            <th data-type="with-add">Товары</th>#}
    {#                            <th data-type="with-add">Свойства</th>#}
    {#                            <th data-type="link">Ссылка</th>#}
                            </tr>
                        </thead>
                        <tbody>
                            {% for row in view.body.rows %}
                                <tr{% for attr_name, attr_value in row.attr %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
                                    {% for item in row.items %}
                                        <td{% for attr_name, attr_value in item.attr %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
                                            {{ item.content|trans|raw }}
                                        </td>
                                    {% endfor %}
                                </tr>
                            {% endfor %}
                        {#
                        <tr class="table-row">
                            <td data-type="actions">
                                <div class="table-row__actions">
                                    <label class="custom-checkbox" title="Выбрать"><input type="checkbox"><span></span></label>
                                    <button class="table-row__btn-show" title="Показать">show</button>
                                    <button class="table-row__btn-edit" title="Редактировать">edit</button>
                                    <button class="table-row__btn-remove" title="Удалить">remove</button>
                                </div>
                            </td>
                            <td data-type="position">
                                <div class="table-row__position" data-level="2">
                                    <form><input type="text"></form>
                                </div>
                            </td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
                            <td data-type="checkbox"><label class="custom-checkbox"><input type="checkbox"><span></span></label></td>
{'fraction_non_alphanumeric': 0.1449527729407419, 'fraction_numerical': 0.0004221413118041264, 'mean_word_length': 1.160264447737376, 'pattern_counts': {'":': 0, '<': 275, '<?xml version=': 0, '>': 275, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 66, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2540092', 'n_tokens_mistral': 5107, 'n_tokens_neox': 4580, 'n_words': 779}