mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 03:54:08 +00:00
* Consolidate modal form structure into partial + helper * Scaffold out trade transaction form * Normalize translations * Add buy and sell trade form with tests * Move entryable lists to dedicated controllers * Delegate entry group contents rendering * More cleanup * Extract transaction and valuation update logic from entries controller * Delegate edit and show actions to entryables * Trade builder * Update paths for transaction updates
20 lines
971 B
Plaintext
20 lines
971 B
Plaintext
<%# locals: (entry:) %>
|
|
|
|
<%= styled_form_with data: { turbo_frame: "_top" },
|
|
scope: :account_entry,
|
|
url: entry.new_record? ? account_trades_path(entry.account) : account_entry_path(entry.account, entry) do |form| %>
|
|
<div class="space-y-4">
|
|
<div class="space-y-2">
|
|
<%= form.select :type, options_for_select([%w[Buy buy], %w[Sell sell]], "buy"), label: t(".type") %>
|
|
<%= form.text_field :ticker, value: nil, label: t(".holding"), placeholder: t(".ticker_placeholder") %>
|
|
<%= form.date_field :date, label: true %>
|
|
<%= form.hidden_field :currency, value: entry.account.currency %>
|
|
<%= form.number_field :qty, label: t(".qty"), placeholder: "10", min: 0 %>
|
|
<%= money_with_currency_field form, :price_money, label: t(".price"), disable_currency: true %>
|
|
<%= form.hidden_field :currency, value: entry.account.currency %>
|
|
</div>
|
|
|
|
<%= form.submit t(".submit") %>
|
|
</div>
|
|
<% end %>
|