<%# locals: (form:, show_prefix: true) %> <% condition = form.object %> <% rule = condition.rule %>
  • <%# Conditionally render the prefix %> <%# Condition groups pass in show_prefix: false for subconditions since the ANY/ALL selector makes that clear %> <% if show_prefix %>
    and
    <% end %>
    <%= form.hidden_field :_destroy, value: false, data: { rule__conditions_target: "destroyField" } %>
    <%= form.select :condition_type, rule.condition_filters.map { |filter| [ filter.label, filter.key ] }, {}, data: { action: "rule--conditions#handleConditionTypeChange" } %>
    <%= form.select :operator, condition.operators, { container_class: "w-fit min-w-36" }, data: { rule__conditions_target: "operatorSelect", action: "rule--conditions#handleOperatorChange" } %>
    <% if condition.filter.type == "select" %> <%= form.select :value, condition.options, {} %> <% else %> <% if condition.filter.type == "number" %> <%= form.number_field :value, placeholder: "10", step: 0.01 %> <% else %> <%= form.text_field :value, placeholder: "Enter a value" %> <% end %> <% end %>
    <%= icon( "trash-2", as_button: true, size: "sm", data: { action: "rule--conditions#remove", rule__conditions_destroy_param: condition.persisted? } ) %>