{% macro filter_item(table, column, operator, value) %}
    {% set unique_id = h.tables_generate_unique_id() %}

    <div class="filter-item d-flex gap-2 mb-3">
        <select name="field-{{ unique_id }}" class="form-select filter-field">
            <option value="">{{ _('Select a field') }}</option>
            {% for col in table.columns %}
                {% if col.filterable %}
                    <option value="{{ col.field }}" {% if col.field == column %}selected{% endif %}>{{ col.title }}</option>
                {% endif %}
            {% endfor %}
        </select>

        <select name="operator-{{ unique_id }}" class="form-select filter-operator w-50">
            {% for label, value in {
                "Equals": "=",
                "Not equals": "!=",
                "Greater than": ">",
                "Greater than or equal to": ">=",
                "Less than": "<",
                "Less than or equal to": "<=",
                "Like": "like"
            }.items() %}
                <option value="{{ value }}" {{ "selected" if value == operator }}>{{ label }}</option>
            {% endfor %}
        </select>

        <input class="form-control filter-value" name="value-{{ unique_id }}" value="{{ value }}" type="text" placeholder="{{ _('Enter value...') }}">

        <button class="btn btn-remove-filter" title="{{ _('Remove filter') }}">
            {% snippet "tables/svg/trash.svg" %}
        </button>
    </div>
{% endmacro %}
