<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_extension_permissions_details_modal %}
<sw-modal
    class="sw-extension-permissions-details-modal"
    :title="modalTitle"
    v-on="listeners"
>
    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_extension_permissions_details_modal_content %}
    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_extension_permissions_details_modal_table %}
    <table class="sw-extension-permissions-details-modal__table">
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_extension_permissions_details_modal_table_head %}
        <thead class="sw-extension-permissions-details-modal__operations">
            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_extension_permissions_details_modal_table_head_row %}
            <tr class="sw-extension-permissions-details-modal__grid-columns">
                <td></td>
                <td
                    v-for="operation in operations"
                    :key="operation.label"
                    class="sw-extension-permissions-details-modal__operation-header"
                >
                    {{ operation.label }}
                </td>
            </tr>
            {% endblock %}
        </thead>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_extension_permissions_details_modal_table_body %}
        <tbody>
            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_extension_permissions_details_modal_table_permissions %}
            <template
                v-for="(permissionCategory, category) in permissions"
                :key="`permission-${category}`"
            >
                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_extension_permissions_details_modal_permissions_category %}
                <tr
                    :id="`permission-${category}`"
                    class="sw-extension-permissions-details-modal__category"
                >
                    <td>{{ categoryLabel(category) }}</td>
                </tr>
                {% endblock %}

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_extension_permissions_details_modal_permission_row %}
                <tr
                    v-for="(permissions, entity) in permissionCategory"
                    :key="entity"
                    class="sw-extension-permissions-details-modal__grid-columns"
                >
                    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                    {% block sw_extension_permissions_details_modal_permission_entity %}
                    <td class="sw-extension-permissions-details-modal__entity-label">
                        {{ entityLabel(category, entity) }}
                    </td>
                    {% endblock %}

                    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                    {% block sw_extension_permissions_details_modal_permission_operation %}
                    <td
                        v-for="operation in operations"
                        :key="operation.operation"
                        class="sw-extension-permissions-details-modal__operation"
                    >
                        <sw-icon
                            v-if="permissions.includes(operation.operation)"
                            name="regular-checkmark-xs"
                            size="12px"
                            color="#37D046"
                        />

                        <sw-icon
                            v-else-if="category !== 'additional_privileges'"
                            name="regular-times-s"
                            size="12px"
                            color="#DE294C"
                        />
                    </td>
                    {% endblock %}
                </tr>
                {% endblock %}
            </template>
            {% endblock %}
        </tbody>
        {% endblock %}
    </table>
    {% endblock %}
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_extension_permissions_details_modal_footer %}
    <template #modal-footer>
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_extension_permissions_details_modal_footer_inner %}
        <sw-button
            variant="primary"
            size="small"
            @click="close"
        >
            {{ $tc('global.sw-modal.labelClose') }}
        </sw-button>
        {% endblock %}
    </template>
    {% endblock %}
</sw-modal>
{% endblock %}
