<%# 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| %>
<%= f.hidden_field :accountable_type %> <%= f.text_field :name, placeholder: t(".name_placeholder"), required: "required", label: t(".name_label"), autofocus: true %> <%= f.collection_select :institution_id, Current.family.institutions.alphabetically, :id, :name, { include_blank: t(".ungrouped"), label: t(".institution") } %> <%= f.money_field :balance, :currency, label: t(".balance"), required: true, default_currency: Current.family.currency %> <% if account.new_record? %>
<%= f.date_field :start_date, label: t(".start_date"), max: Date.yesterday, min: Account::Entry.min_supported_date %>
<%= f.number_field :start_balance, label: t(".start_balance"), placeholder: 90 %>
<% end %> <%= render "accounts/accountables/#{permitted_accountable_partial(account.accountable_type)}", f: f %>
<%= f.submit "#{account.new_record? ? "Add" : "Update"} #{account.accountable.model_name.human.downcase}" %> <% end %>