mirror of
https://github.com/we-promise/sure
synced 2026-04-25 17:15:07 +02:00
* Initial account sharing changes * Update schema.rb * Update schema.rb * Change sharing UI to modal * UX fixes and sharing controls * Scope include in finances better * Update totals.rb * Update totals.rb * Scope reports to finance account scope * Update impersonation_sessions_controller_test.rb * Review fixes * Update schema.rb * Update show.html.erb * FIX db validation * Refine edit permissions * Review items * Review * Review * Add application level helper * Critical review * Address remaining review items * Fix modals * more scoping * linter * small UI fix * Fix: Sync broadcasts push unscoped balance sheet to all users * Update sync_complete_event.rb The fix removes the sidebar broadcasts (which rendered unscoped account groups using family.balance_sheet without user context) along with the now-unused sidebar_targets, account_group, and family_balance_sheet private methods. The sidebar will still update correctly — when the sync completes, Family::SyncCompleteEvent#broadcast fires family.broadcast_refresh, which triggers a morph-based page refresh for each user with their own authenticated session, rendering properly scoped sidebar content.
60 lines
2.3 KiB
Plaintext
60 lines
2.3 KiB
Plaintext
<%# locals: (model:, account:) %>
|
|
|
|
<% type = params[:type] || "buy" %>
|
|
|
|
<%= styled_form_with url: trades_path(account_id: account&.id), scope: :model, data: { controller: "trade-form" } do |form| %>
|
|
<div class="space-y-4">
|
|
<% if model.errors.any? %>
|
|
<%= render "shared/form_errors", model: model %>
|
|
<% end %>
|
|
|
|
<div class="space-y-2">
|
|
<%= form.select :type, [
|
|
["Buy", "buy"],
|
|
["Sell", "sell"],
|
|
["Deposit", "deposit"],
|
|
["Withdrawal", "withdrawal"],
|
|
["Interest", "interest"]
|
|
],
|
|
{ label: t(".type"), selected: type },
|
|
{ data: {
|
|
action: "trade-form#changeType",
|
|
trade_form_url_param: new_trade_path(account_id: account&.id),
|
|
trade_form_key_param: "type",
|
|
}} %>
|
|
|
|
<% if %w[buy sell].include?(type) %>
|
|
<% if Security.provider.present? %>
|
|
<div class="form-field combobox">
|
|
<%= form.combobox :ticker,
|
|
securities_path(country_code: Current.family.country),
|
|
name_when_new: "entry[manual_ticker]",
|
|
label: t(".holding"),
|
|
placeholder: t(".ticker_placeholder"),
|
|
required: true %>
|
|
</div>
|
|
<% else %>
|
|
<%= form.text_field :manual_ticker, label: "Ticker symbol", placeholder: "AAPL", required: true %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<%= form.date_field :date, label: true, value: model.date || Date.current, required: true %>
|
|
|
|
<% unless %w[buy sell].include?(type) %>
|
|
<%= form.money_field :amount, label: t(".amount"), value: model.amount, required: true %>
|
|
<% end %>
|
|
|
|
<% if %w[deposit withdrawal].include?(type) %>
|
|
<%= form.collection_select :transfer_account_id, accessible_accounts.visible.alphabetically, :id, :name, { prompt: t(".account_prompt"), label: t(".account") } %>
|
|
<% end %>
|
|
|
|
<% if %w[buy sell].include?(type) %>
|
|
<%= form.number_field :qty, label: t(".qty"), placeholder: "10", min: 0.000000000000000001, step: "any", required: true %>
|
|
<%= form.money_field :price, label: t(".price"), step: "any", precision: 10, required: true %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= form.submit t(".submit") %>
|
|
</div>
|
|
<% end %>
|