<h1>{{ "Sections"|t('app') }}</h1>
<table class="data fullwidth collapsible">
    <thead>
    <tr>
        <th>
            <div class="field checkboxsection">
                <input type="checkbox" id="allSections" class="checkbox" name="allSections" value="all"><label for="allSections">&zwnj;</label>
                {{ "Name"|t('app') }}
            </div>
        </th>
        <th>{{ "Handle"|t('app') }}</th>
        <th>{{ "Type"|t('app') }}</th>
        <th>{{ "URI Format"|t('app') }}</th>
    </tr>
    </thead>
    <tbody class="sections">
    {% for section in craft.app.sections.getAllSections() %}
        {% set utilizedFields = {} %}
        {% for entryType in section.getEntryTypes() %}
            {% if entryType.fieldLayoutId %}
                {% for fieldId in craft.app.fields.getLayoutById(entryType.fieldLayoutId).getFieldIds() %}
                    {% set utilizedFields = utilizedFields | merge([fieldId]) %}
                {% endfor %}
            {% endif %}
        {% endfor %}
        <tr class="section" data-id="{{ section.id }}" data-name="{{ section }}" data-fields="{% for id in utilizedFields %}{{ id }} {% endfor %}">
            <th scope="row">
                <input type="checkbox" id="section{{ section.id }}" class="checkbox" name="sectionSelection[]" value="{{ section.id }}"> <label for="section{{ section.id }}">{{ section }}</label>
            </th>
            <td>
                <code>{{ section.handle }}</code>
            </td>
            <td>
                {{ section.type }}
            </td>
            <td>
                {# {{ section.uriFormat }} #}
                <ul>
                    {% for siteSetting in section.siteSettings %}
                        <li><i>{{ craft.app.sites.getSiteById(siteSetting.siteId).handle }}</i>: {{ siteSetting.uriFormat }}</li>
                    {% endfor %}
                </ul>
            </td>
        </tr>
    {% endfor %}
    </tbody>
</table>