mirror of
https://github.com/we-promise/sure.git
synced 2026-08-05 16:42:18 +00:00
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)
51 lines
2.1 KiB
Plaintext
51 lines
2.1 KiB
Plaintext
<%# locals: (account:) %>
|
|
|
|
<% permission = account.permission_for(Current.user) %>
|
|
<%= render DS::Menu.new(testid: "account-menu") do |menu| %>
|
|
<% if permission.in?([ :owner, :full_control ]) %>
|
|
<% menu.with_item(variant: "link", text: t(".edit"), href: edit_account_path(account), icon: "pencil-line", data: { turbo_frame: :modal }) %>
|
|
<% end %>
|
|
<% menu.with_item(variant: "link", text: t(".sharing"), href: account_sharing_path(account), icon: "users", data: { turbo_frame: :modal }) %>
|
|
<% menu.with_item(variant: "link", text: t(".statements"), href: account_path(account, tab: "statements"), icon: "archive") %>
|
|
|
|
<% if permission.in?([ :owner, :full_control ]) %>
|
|
<% menu.with_item(variant: "divider") %>
|
|
|
|
<% if account.exclude_from_reports? %>
|
|
<% menu.with_item(variant: "button", text: t(".include_in_reports"), href: toggle_exclude_from_reports_account_path(account), method: :patch, icon: "eye", data: { turbo_frame: :_top }) %>
|
|
<% else %>
|
|
<% menu.with_item(variant: "button", text: t(".exclude_from_reports"), href: toggle_exclude_from_reports_account_path(account), method: :patch, icon: "eye-off", data: { turbo_frame: :_top }) %>
|
|
<% end %>
|
|
|
|
<% if account.supports_trades? %>
|
|
<% menu.with_item(
|
|
variant: "link",
|
|
text: t(".import_trades"),
|
|
href: imports_path({ import: { type: "TradeImport", account_id: account.id } }),
|
|
icon: "download",
|
|
data: { turbo_frame: :_top }
|
|
) %>
|
|
<% elsif !account.crypto? %>
|
|
<% menu.with_item(
|
|
variant: "link",
|
|
text: t(".import_transactions"),
|
|
href: imports_path({ import: { type: "TransactionImport", account_id: account.id } }),
|
|
icon: "download",
|
|
data: { turbo_frame: :_top }
|
|
) %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if account.owned_by?(Current.user) && !account.linked? %>
|
|
<% menu.with_item(
|
|
variant: "button",
|
|
text: t(".delete_account"),
|
|
href: account_path(account),
|
|
method: :delete,
|
|
icon: "trash-2",
|
|
confirm: CustomConfirm.for_resource_deletion("account", high_severity: true),
|
|
data: { turbo_frame: :_top }
|
|
) %>
|
|
<% end %>
|
|
<% end %>
|