mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-06 14:05:20 +02: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
27 lines
1.2 KiB
Text
27 lines
1.2 KiB
Text
<%# locals: (form:, money_method:, default_currency:, disable_currency: false, hide_currency: false, label: nil) %>
|
|
|
|
<% fallback_label = t(".money-label") %>
|
|
<% currency = form.object ? (form.object.send(money_method)&.currency || Money::Currency.new(default_currency)) : Money::Currency.new(default_currency) %>
|
|
|
|
<div class="form-field pr-0" data-controller="money-field">
|
|
<%= form.label label || fallback_label, { class: "form-field__label" } %>
|
|
|
|
<div class="flex items-center gap-1">
|
|
<div class="flex items-center grow gap-1">
|
|
<span class="text-gray-500 text-sm" data-money-field-target="symbol"><%= currency.symbol %></span>
|
|
<%= money_field form, money_method, { inline: true, "data-money-field-target" => "amount", default_currency: currency } %>
|
|
</div>
|
|
<% unless hide_currency %>
|
|
<div>
|
|
<%= currency_select form, :currency, { inline: true, selected: currency.iso_code }, {
|
|
class: "form-field__input text-right pr-8 disabled:text-gray-500",
|
|
disabled: disable_currency,
|
|
data: {
|
|
"money-field-target" => "currency",
|
|
action: "money-field#handleCurrencyChange"
|
|
}
|
|
} %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|