diff --git a/app/models/transaction.rb b/app/models/transaction.rb
index ecdda450..890736f3 100644
--- a/app/models/transaction.rb
+++ b/app/models/transaction.rb
@@ -32,6 +32,10 @@ class Transaction < ApplicationRecord
value.each do |account_id|
filters << { type: "account", value: family.accounts.find(account_id), original: { key: key, value: account_id } }
end
+ when "category_id_in"
+ value.each do |category_id|
+ filters << { type: "category", value: family.transaction_categories.find(category_id), original: { key: key, value: category_id } }
+ end
when "category_name_or_account_name_or_name_cont"
filters << { type: "search", value: value, original: { key: key, value: nil } }
end
diff --git a/app/models/transaction/category.rb b/app/models/transaction/category.rb
index c6c53f2b..a33feb7a 100644
--- a/app/models/transaction/category.rb
+++ b/app/models/transaction/category.rb
@@ -18,7 +18,7 @@ class Transaction::Category < ApplicationRecord
]
def self.ransackable_attributes(auth_object = nil)
- %w[name]
+ %w[name id]
end
def self.ransackable_associations(auth_object = nil)
diff --git a/app/views/transactions/_filter.html.erb b/app/views/transactions/_filter.html.erb
index 538c4de9..6b613bde 100644
--- a/app/views/transactions/_filter.html.erb
+++ b/app/views/transactions/_filter.html.erb
@@ -1,11 +1,17 @@
<%# locals: (filter:) %>
- <% if filter[:type] == "account" %>
+ <% case filter[:type] %>
+ <% when "account" %>
<%= filter[:value].name[0].upcase %>
<%= filter[:value].name %>
- <% elsif filter[:type] == "search" %>
+ <% when "category" %>
+
+
+
<%= filter[:value].name %>
+
+ <% when "search" %>
<%= lucide_icon "text", class: "w-5 h-5 text-gray-500" %>
<%= "\"#{filter[:value]}\"".truncate(20) %>
diff --git a/app/views/transactions/_search_form.html.erb b/app/views/transactions/_search_form.html.erb
index 1622cbf7..ec76c335 100644
--- a/app/views/transactions/_search_form.html.erb
+++ b/app/views/transactions/_search_form.html.erb
@@ -6,7 +6,7 @@
<%= render partial: "transactions/search_form/search_filter", locals: { form: form } %>
-
+