{% load i18n %}
{# Set value display template #}

<!-- Set display -->
<div class="key-value-display">
    <h3>{% trans 'Set Members' %} ({{ key_data.size }} {% trans 'items' %})</h3>
    
    {% if is_paginated %}
    <!-- Pagination info (without controls) -->
    {% include "admin/dj_redis_panel/key_detail_pagination_info.html" with collection_type="members" %}
    {% endif %}
    
    {% if key_data.value %}
    <table class="key-value-table">
        <thead>
            <tr>
                <th>{% trans 'Member' %}</th>
                {% if allow_key_edit %}
                <th>{% trans 'Delete' %}</th>
                {% endif %}
            </tr>
        </thead>
        <tbody>
            {% for member in key_data.value %}
            <tr>
                <td><code>{{ member }}</code></td>
                {% if allow_key_edit %}
                <td>
                    <form method="post" style="display: inline;" 
                          onsubmit="return confirm('{% trans 'Are you sure you want to delete this member?' %}');">
                        {% csrf_token %}
                        <input type="hidden" name="action" value="delete_set_member">
                        <input type="hidden" name="member" value="{{ member }}">
                        <button type="submit" class="delete-member-btn" title="{% trans 'Delete member' %}" {% if not allow_key_edit %}disabled{% endif %}>
                            🗑️
                        </button>
                    </form>
                </td>
                {% endif %}
            </tr>
            {% endfor %}
        </tbody>
    </table>
    
    {% if is_paginated %}{% if has_more or total_pages > 1 %}
    <!-- Bottom pagination for sets -->
    {% include "admin/dj_redis_panel/key_detail_pagination.html" with collection_type="set" position="controls" %}
    {% endif %}{% endif %}
    
    {% else %}
    <p class="quiet">{% trans 'Set is empty' %}</p>
    {% endif %}
    <div class="help">
        {% trans 'Set editing is not supported in this interface. Use Redis CLI or other tools for complex set operations.' %}
    </div>
</div>
