%# locals: (account:, url:) %>
<% if @error_message.present? %>
<%= render DS::Alert.new(message: @error_message, variant: :error) %>
<% end %>
<%= styled_form_with model: account, url: url, scope: :account, data: { turbo: false }, class: "flex flex-col gap-4 justify-between grow text-primary" do |form| %>
<%= form.hidden_field :accountable_type %>
<%= form.hidden_field :return_to, value: params[:return_to] %>
<%= form.text_field :name, placeholder: t(".name_placeholder"), required: "required", label: t(".name_label") %>
<% unless account.linked? %>
<%= form.money_field :balance, label: t(".balance"), required: true, default_currency: Current.family.currency %>
<% end %>
<%= yield form %>
<%= icon "chevron-right", size: "sm", class: "group-open:rotate-90 transition-transform" %>
<%= t(".additional_details") %>
<%= form.text_field :institution_name,
label: t(".institution_name_label"),
placeholder: account.provider&.institution_name || t(".institution_name_placeholder") %>
<%= form.text_field :institution_domain,
label: t(".institution_domain_label"),
placeholder: account.provider&.institution_domain || t(".institution_domain_placeholder") %>
<%= form.text_area :notes,
label: t(".notes_label"),
placeholder: t(".notes_placeholder"),
rows: 4 %>
<%= form.submit %>
<% end %>