{% extends '@SyliusUi/Macro/table.html.twig' %}

{% macro row_responsive(grid, definition, row) %}
    <tr class="item" {{ sylius_test_html_attribute('row') }}>
    {% if definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %}
        <td class="center aligned"><input class="bulk-select-checkbox" type="checkbox" value="{{ row.id }}" /></td>
    {% endif %}
    {% for field in definition.enabledFields|sort_by('position') %}
        <td>
            <span class="title-mobile">{{ field.label|trans }}</span>
            {{ sylius_grid_render_field(grid, field, row) }}
        </td>
    {% endfor %}
    {% if definition.actionGroups.item is defined and definition.getEnabledActions('item')|length > 0 %}
        <td {{ sylius_test_html_attribute('actions') }}>
            <div class="ui buttons">
                {% for action in definition.getEnabledActions('item')|sort_by('position') %}
                    {{ sylius_grid_render_action(grid, action, row) }}
                {% endfor %}
            </div>
            {% if definition.actionGroups.subitem is defined and definition.getEnabledActions('subitem')|length > 0 %}
            <div class="ui divider"></div>
            <div class="ui buttons">
                {% for action in definition.getEnabledActions('subitem')|sort_by('position') %}
                    {{ sylius_grid_render_action(grid, action, row) }}
                {% endfor %}
            </div>
            {% endif %}
        </td>
    {% endif %}
    </tr>
{% endmacro %}
