2024-11-27 16:01:50 -05:00
|
|
|
<%# locals: (category:) %>
|
2024-05-22 12:31:25 +02:00
|
|
|
<% is_selected = category.id === @selected_category&.id %>
|
2024-05-02 07:24:31 -06:00
|
|
|
|
2025-02-25 17:28:40 -05:00
|
|
|
<%= content_tag :div,
|
2025-05-07 09:26:06 -04:00
|
|
|
class: ["filterable-item flex justify-between items-center border-none rounded-lg px-2 py-1 group w-full hover:bg-container-inset-hover",
|
|
|
|
{ "bg-container-inset": is_selected }],
|
2025-02-25 17:28:40 -05:00
|
|
|
data: { filter_name: category.name } do %>
|
2025-04-14 11:40:34 -04:00
|
|
|
<%= button_to transaction_category_path(
|
2024-11-27 16:01:50 -05:00
|
|
|
@transaction.entry,
|
2025-04-14 11:40:34 -04:00
|
|
|
entry: {
|
|
|
|
entryable_type: "Transaction",
|
2024-11-27 16:01:50 -05:00
|
|
|
entryable_attributes: { id: @transaction.id, category_id: category.id }
|
|
|
|
}
|
|
|
|
),
|
|
|
|
method: :patch,
|
2025-02-25 17:28:40 -05:00
|
|
|
class: "flex w-full items-center gap-1.5 cursor-pointer focus:outline-none" do %>
|
2024-11-27 16:01:50 -05:00
|
|
|
|
2025-04-30 18:14:22 -04:00
|
|
|
<%= icon("check") if is_selected %>
|
|
|
|
|
2024-12-20 11:37:26 -05:00
|
|
|
<% if category.subcategory? %>
|
2025-04-30 18:14:22 -04:00
|
|
|
<%= icon("corner-down-right", size: "sm") %>
|
2024-12-20 11:37:26 -05:00
|
|
|
<% end %>
|
2025-04-30 18:14:22 -04:00
|
|
|
|
2024-06-20 08:15:09 -04:00
|
|
|
<%= render partial: "categories/badge", locals: { category: category } %>
|
2024-04-04 17:29:50 -04:00
|
|
|
<% end %>
|
2024-05-02 07:24:31 -06:00
|
|
|
|
2025-04-30 18:14:22 -04:00
|
|
|
<%= render MenuComponent.new do |menu| %>
|
|
|
|
<% menu.with_item(variant: "link", text: t(".edit"), icon: "pencil-line", href: edit_category_path(category), data: { turbo_frame: :modal }) %>
|
|
|
|
<% menu.with_item(variant: "link", text: t(".delete"), icon: "trash-2", href: new_category_deletion_path(category), data: { turbo_frame: :modal }, destructive: true) %>
|
2024-05-02 07:24:31 -06:00
|
|
|
<% end %>
|
2024-04-04 17:29:50 -04:00
|
|
|
<% end %>
|