mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
28 lines
1.3 KiB
Text
28 lines
1.3 KiB
Text
<%# locals: (account:, url:) %>
|
|
|
|
<%= styled_form_with model: account, url: url, scope: :account, class: "flex flex-col gap-4 justify-between grow", data: { turbo: false } do |f| %>
|
|
<div class="grow space-y-2">
|
|
<% unless account.new_record? %>
|
|
<% if account.accountable.mode_required? %>
|
|
<%= f.select :mode, Account::VALUE_MODES.map { |mode| [mode.titleize, mode] }, { label: t(".mode"), prompt: t(".mode_prompt") }, required: true %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<%= f.select :accountable_type, Accountable::TYPES.map { |type| [type.titleize, type] }, { label: t(".accountable_type"), prompt: t(".type_prompt") }, required: true, autofocus: true %>
|
|
<%= f.text_field :name, placeholder: t(".name_placeholder"), required: "required", label: t(".name_label") %>
|
|
|
|
<% if account.new_record? %>
|
|
<%= f.hidden_field :institution_id %>
|
|
<% else %>
|
|
<%= f.collection_select :institution_id, Current.family.institutions.alphabetically, :id, :name, { include_blank: t(".ungrouped"), label: t(".institution") } %>
|
|
<% end %>
|
|
|
|
<%= f.money_field :balance, label: t(".balance"), required: true, default_currency: Current.family.currency %>
|
|
|
|
<% if account.accountable %>
|
|
<%= render permitted_accountable_partial(account, "form"), f: f %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= f.submit %>
|
|
<% end %>
|