{# ── Segment Rules Section ───────────────────────────────────────────────── Rendered inside modal_segment_detail.html and returned by HTMX add/remove rule endpoints. Expects: segment, key, prefix. ─────────────────────────────────────────────────────────────────────────── #}
{# ── Label ──────────────────────────────────────────────────────────── #}

Users matching any rule are included in this segment. Rules are evaluated after the explicit included / excluded lists.

{# ── Existing rules ──────────────────────────────────────────────────── #} {% if segment.rules %}
{% for rule in segment.rules %}
{% if rule.description %}

{{ rule.description }}

{% endif %} {% for clause in rule.clauses %} {% set is_seg_op = clause.operator.value in ['in_segment', 'not_in_segment'] %}
{% if not loop.first %} AND {% endif %} {% if clause.negate %} NOT {% endif %} {% if not is_seg_op %} {{ clause.attribute }} {% endif %} {{ clause.operator.value.replace('_', ' ') }} {{ clause.values | join(', ') }}
{% endfor %}
{% endfor %}
{% else %}

No targeting rules yet.

{% endif %} {# ── Add Rule form ───────────────────────────────────────────────────── #}
Add Rule
{# Description (optional) #}
{# Clause: attribute + operator + values #}
{# Attribute #} {# Operator #} {# Values #}

Separate multiple values with commas.

{# Negate #}