2025-04-18 11:39:58 -04:00
|
|
|
<header class="flex items-center justify-between">
|
|
|
|
<h1 class="text-primary text-xl font-medium">Rules</h1>
|
|
|
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<% if @rules.any? %>
|
2025-04-30 18:14:22 -04:00
|
|
|
<%= render MenuComponent.new do |menu| %>
|
|
|
|
<% menu.with_item(
|
|
|
|
variant: "button",
|
|
|
|
text: "Delete all rules",
|
|
|
|
href: destroy_all_rules_path,
|
|
|
|
icon: "trash-2",
|
|
|
|
method: :delete,
|
2025-05-05 11:43:46 -05:00
|
|
|
confirm: CustomConfirm.for_resource_deletion("all rules", high_severity: true)) %>
|
2025-04-18 11:39:58 -04:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
2025-04-30 18:14:22 -04:00
|
|
|
<%= render LinkComponent.new(
|
|
|
|
text: "New rule",
|
|
|
|
variant: "primary",
|
|
|
|
href: new_rule_path(resource_type: "transaction"),
|
|
|
|
icon: "plus",
|
|
|
|
frame: :modal
|
|
|
|
) %>
|
2025-04-18 11:39:58 -04:00
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<% if self_hosted? %>
|
|
|
|
<div class="flex items-center gap-2 mb-2 py-4">
|
2025-04-30 18:14:22 -04:00
|
|
|
<%= icon("circle-alert", size: "sm") %>
|
2025-04-18 11:39:58 -04:00
|
|
|
<p class="text-sm text-secondary">
|
|
|
|
AI-enabled rule actions will cost money. Be sure to filter as narrowly as possible to avoid unnecessary costs.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
2025-04-23 10:42:30 -03:00
|
|
|
<div class="bg-container shadow-border-xs rounded-xl p-4">
|
2025-04-18 11:39:58 -04:00
|
|
|
|
|
|
|
<% if @rules.any? %>
|
|
|
|
<div class="rounded-xl bg-gray-25 space-y-1">
|
|
|
|
<div class="flex items-center gap-1.5 px-4 py-2 text-xs font-medium text-secondary uppercase">
|
|
|
|
<p>Rules</p>
|
|
|
|
<span class="text-subdued">·</span>
|
|
|
|
<p><%= @rules.count %></p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="space-y-1 p-1">
|
|
|
|
<%= render @rules %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% else %>
|
|
|
|
<div class="flex justify-center items-center py-20">
|
|
|
|
<div class="text-center flex flex-col items-center max-w-[500px]">
|
|
|
|
<p class="text-sm text-primary font-medium mb-1">No rules yet</p>
|
|
|
|
<p class="text-sm text-secondary mb-4">Set up rules to perform actions to your transactions and other data on every account sync.</p>
|
|
|
|
<div class="flex items-center gap-2">
|
2025-04-30 18:14:22 -04:00
|
|
|
<%= render LinkComponent.new(
|
|
|
|
text: "New rule",
|
|
|
|
variant: "primary",
|
|
|
|
href: new_rule_path(resource_type: "transaction"),
|
|
|
|
icon: "plus",
|
|
|
|
frame: :modal
|
|
|
|
) %>
|
2025-04-18 11:39:58 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|