1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Add tags selection and notes input to new transaction form (#2008)
Some checks failed
Publish Docker image / ci (push) Has been cancelled
Publish Docker image / Build docker image (push) Has been cancelled

* feat: Add tags selection and notes input to new transaction form

* feat: Add tag selection to transactions bulk update form
This commit is contained in:
Tony Vincent 2025-04-11 18:14:21 +02:00 committed by GitHub
parent 8648f11413
commit 48c8499b70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 30 additions and 2 deletions

View file

@ -27,7 +27,7 @@ class Account::TransactionsController < ApplicationController
end
def bulk_update_params
params.require(:bulk_update).permit(:date, :notes, :category_id, :merchant_id, entry_ids: [])
params.require(:bulk_update).permit(:date, :notes, :category_id, :merchant_id, entry_ids: [], tag_ids: [])
end
def search_params

View file

@ -67,7 +67,8 @@ class Account::Entry < ApplicationRecord
notes: bulk_update_params[:notes],
entryable_attributes: {
category_id: bulk_update_params[:category_id],
merchant_id: bulk_update_params[:merchant_id]
merchant_id: bulk_update_params[:merchant_id],
tag_ids: bulk_update_params[:tag_ids]
}.compact_blank
}.compact_blank

View file

@ -31,6 +31,24 @@
<%= f.date_field :date, label: t(".date"), required: true, min: Account::Entry.min_supported_date, max: Date.current, value: Date.current %>
</section>
<%= disclosure t(".details"), default_open: false do %>
<%= f.fields_for :entryable do |ef| %>
<%= ef.select :tag_ids,
Current.family.tags.alphabetically.pluck(:name, :id),
{
include_blank: t(".none"),
multiple: true,
label: t(".tags_label"),
container_class: "h-40"
}%>
<% end %>
<%= f.text_area :notes,
label: t(".note_label"),
placeholder: t(".note_placeholder"),
rows: 5,
"data-auto-submit-form-target": "auto" %>
<% end %>
<section>
<%= f.submit t(".submit") %>
</section>

View file

@ -40,6 +40,7 @@
<div class="space-y-2">
<%= form.collection_select :category_id, Current.family.categories.alphabetically, :id, :name, { prompt: t(".category_placeholder"), label: t(".category_label"), class: "text-subdued" } %>
<%= form.collection_select :merchant_id, Current.family.merchants.alphabetically, :id, :name, { prompt: t(".merchant_placeholder"), label: t(".merchant_label"), class: "text-subdued" } %>
<%= form.select :tag_ids, Current.family.tags.alphabetically.pluck(:name, :id), { include_blank: t(".none"), multiple: true, label: t(".tag_label"), container_class: "h-40" } %>
<%= form.text_area :notes, label: t(".note_label"), placeholder: t(".note_placeholder"), rows: 5 %>
</div>
</details>