1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 03:55:20 +02:00
Maybe/app/views/accounts/_form.html.erb

23 lines
1 KiB
Text
Raw Normal View History

<%# 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">
<%= 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 %>