Files
sure/app/views/accounts/_form.html.erb
panther eb0866a678 Add exclude_from_reports option to accounts
Adds a toggle to mark accounts as excluded from all financial reports
while keeping them active and visible individually.

- Migration: add exclude_from_reports boolean column to accounts
- Model: included_in_reports scope
- BalanceSheet: filter excluded from ClassificationGroup and AccountGroup totals,
  HistoricalAccountScope, AccountRow flag
- IncomeStatement: exclude via SQL fragments in Totals, FamilyStats, CategoryStats
- InvestmentStatement/Budget: chain included_in_reports scope
- ReportsController: filter in breakdown view, export queries, trades
- AccountsController: toggle_exclude_from_reports action + route
- UI: DS::Toggle in account form, eye-off indicator in sidebar, menu toggle items
- Locale: all labels in en.yml
- Tests: model scope, controller toggle, income statement/balance sheet filtering
- 5070 tests pass (0 failures, 0 regressions)
2026-06-27 00:57:03 +00:00

57 lines
2.1 KiB
Plaintext

<%# locals: (account:, url:) %>
<% if @error_message.present? %>
<%= render DS::Alert.new(message: @error_message, variant: :error) %>
<% end %>
<%= styled_form_with model: account, url: url, scope: :account, data: { turbo: false }, class: "flex flex-col gap-4 justify-between grow text-primary" do |form| %>
<div class="grow space-y-2">
<%= form.hidden_field :accountable_type %>
<%= form.hidden_field :return_to, value: params[:return_to] %>
<%= form.text_field :name, placeholder: t(".name_placeholder"), required: "required", label: t(".name_label") %>
<% unless account.linked? %>
<%= form.money_field :balance, label: t(".balance"), required: true, default_currency: Current.family.currency %>
<% end %>
<% if account.new_record? && !account.linked? %>
<%= form.date_field :opening_balance_date,
label: t(".opening_balance_date_label"),
value: Time.zone.today - 2.years,
required: true %>
<% end %>
<%= yield form %>
<details class="group">
<summary class="cursor-pointer text-sm text-secondary hover:text-primary flex items-center gap-1 py-2">
<%= icon "chevron-right", size: "sm", class: "group-open:rotate-90 transition-transform" %>
<%= t(".additional_details") %>
</summary>
<div class="space-y-2 mt-2 pl-4 border-l border-primary">
<%= form.text_field :institution_name,
label: t(".institution_name_label"),
placeholder: account.provider&.institution_name || t(".institution_name_placeholder") %>
<%= form.text_field :institution_domain,
label: t(".institution_domain_label"),
placeholder: account.provider&.institution_domain || t(".institution_domain_placeholder") %>
<%= form.text_area :notes,
label: t(".notes_label"),
placeholder: t(".notes_placeholder"),
rows: 4 %>
<div class="flex items-center justify-between gap-2">
<span class="text-sm"><%= t(".exclude_from_reports") %></span>
<%= form.toggle :exclude_from_reports %>
</div>
</div>
</details>
</div>
<%= form.submit %>
<% end %>