Rules

<% if @rules.any? %> <%= render DS::Menu.new do |menu| %> <% menu.with_item( variant: "button", text: "Delete all rules", href: destroy_all_rules_path, icon: "trash-2", method: :delete, confirm: CustomConfirm.for_resource_deletion("all rules", high_severity: true)) %> <% end %> <%= render DS::Link.new( text: t("rules.apply_all.button"), variant: "secondary", href: confirm_all_rules_path, icon: "play", frame: :modal ) %> <% end %> <%= render DS::Link.new( text: "New rule", variant: "primary", href: new_rule_path(resource_type: "transaction"), icon: "plus", frame: :modal ) %>
<% if self_hosted? %>
<%= icon("circle-alert", size: "sm") %>

AI-enabled rule actions will cost money. Be sure to filter as narrowly as possible to avoid unnecessary costs.

<% end %>
<% if @rules.any? %>

Rules

·

<%= @rules.count %>

Sort by: <%= form_with url: rules_path, method: :get, local: true, class: "flex items-center", data: { controller: "auto-submit-form" } do |form| %> <%= form.select :sort_by, options_for_select([["Name", "name"], ["Updated At", "updated_at"]], @sort_by), {}, class: "min-w-[120px] bg-transparent rounded border-none cursor-pointer text-primary uppercase text-xs w-auto", data: { auto_submit_form_target: "auto", autosubmit_trigger_event: "change" } %> <%= form.hidden_field :direction, value: @direction %> <% end %> <%= render DS::Link.new( href: rules_path(direction: @direction == "asc" ? "desc" : "asc", sort_by: @sort_by), variant: "icon", icon: "arrow-up-down", size: :sm, title: "Toggle sort direction" ) %>
<%= render partial: "rule", collection: @rules, spacer_template: "shared/ruler" %>
<% else %>

No rules yet

Set up rules to perform actions to your transactions and other data on every account sync.

<%= render DS::Link.new( text: "New rule", variant: "primary", href: new_rule_path(resource_type: "transaction"), icon: "plus", frame: :modal ) %>
<% end %>
<% if @recent_runs.any? %>

<%= t("rules.recent_runs.title") %>

<%= t("rules.recent_runs.description") %>

<% @recent_runs.each do |run| %> "> <% end %>
<%= t("rules.recent_runs.columns.date_time") %> <%= t("rules.recent_runs.columns.execution_type") %> <%= t("rules.recent_runs.columns.status") %> <%= t("rules.recent_runs.columns.rule_name") %>
<%= t("rules.recent_runs.columns.transactions_counts.queued") %>
<%= t("rules.recent_runs.columns.transactions_counts.processed") %>
<%= t("rules.recent_runs.columns.transactions_counts.modified") %>
<%= run.executed_at.strftime("%b %d, %Y %I:%M %p") %> "> <%= t("rules.recent_runs.execution_types.#{run.execution_type}") %>
<% if run.pending? %> <%= t("rules.recent_runs.statuses.#{run.status}") %> <% elsif run.success? %> <%= t("rules.recent_runs.statuses.#{run.status}") %> <% else %> <%= t("rules.recent_runs.statuses.#{run.status}") %> <% end %> <% if run.failed? && run.error_message.present? %>
<%= icon("info", size: "sm", class: "text-red-500") %>
<% end %>
<%= run.rule_name.presence || run.rule&.name.presence || t("rules.recent_runs.unnamed_rule") %> <%= "#{number_with_delimiter(run.transactions_queued)} / #{number_with_delimiter(run.transactions_processed)} / #{number_with_delimiter(run.transactions_modified)}" %>
<% if @pagy.pages > 1 %>
<%= render "shared/pagination", pagy: @pagy %>
<% end %>
<% end %>