<div id="{{ id }}" class="superTableContainer rowLayout {{ staticField ? 'static-field' }}">
    <div class="rowLayoutContainer">
        {% set totalNewBlocks = 0 %}

        {% for block in blocks %}
            {% set blockId = block.id %}
            {% set blockIsNew = blockId is empty %}
            {% if blockIsNew %}
                {% set totalNewBlocks = totalNewBlocks + 1 %}
                {% set blockId = 'new' ~ totalNewBlocks %}
            {% endif %}
            {% set baseInputName = "#{name}[blocks][#{blockId}]" %}
            {# only register a delta name for this black if it's not new #}
            {% if not blockIsNew %}
                {% do view.registerDeltaName(baseInputName) %}
            {% endif %}

            <div class="superTableRow" data-id="{{ blockId }}" data-type="{{ id }}">
                {{ hiddenInput("#{name}[sortOrder][]", blockId) }}
                {{ hiddenInput("#{baseInputName}[type]", block.getType().id) }}

                <div class="superTable-layout-row-new">
                    <div class="superTable-layout-row-new-body {% if staticField %}static-field{% endif %}">
                        {% include "super-table/row/fields" with {
                            namespace: "#{baseInputName}[fields]",
                            element: block,
                            fields: block.getType().getFieldLayout().getCustomFields(),
                            settings: supertableField,
                            registerDeltas: not blockIsNew,
                        } %}
                    </div>

                    {% if not staticField %}
                        <div class="superTable-layout-row-new-actions tfoot-actions">
                            <div class="floating reorder"><a class="move icon" title="{{ 'Reorder' | t('site') }}"></a></div>
                            <div class="floating delete"><a class="delete icon" title="{{ 'Delete' | t('site') }}"></a></div>
                        </div>
                    {% endif %}
                </div>
            </div>
        {% endfor %}
    </div>

    {% if not staticField %}
        <div class="superTableAddRow btn dashed add icon">
            {{ supertableField.selectionLabel | default("Add a row") | t('site') }}
        </div>
    {% endif %}
</div>
