<%# locals: (account:, url:) %> <% if @error_message.present? %>
<%= render AlertComponent.new(message: @error_message, variant: :error) %>
<% end %> <%= styled_form_with model: account, url: url, scope: :account, 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, label_tooltip: "The current balance or value of the account, which is typically the balance reported by your financial institution." %> <% unless account.persisted? %> <%= form.date_field :tracking_start_date, label: "Tracking start date", required: true, value: 2.years.ago.to_date, label_tooltip: "The date we will start tracking the balance for this account. If you're not sure, we recommend using the default of 2 years ago so net worth graphs have adequate historical data." %> <% end %> <% end %> <%= yield form %>
<%= form.submit %> <% end %>