<%# locals: (goal:, linkable_accounts:, currently_linked_account_ids:) %> <% if goal.errors.any? %> <%= render "shared/form_errors", model: goal %> <% end %> <%= styled_form_with model: goal, url: goal_path(goal), method: :patch, class: "space-y-3" do |f| %> <%= f.text_field :name, label: t("goals.form_stepper.step1.fields.name"), required: true, autofocus: true %> <%= f.money_field :target_amount, label: t("goals.form_stepper.step1.fields.target_amount"), required: true %> <%= f.date_field :target_date, label: t("goals.form_stepper.step1.fields.target_date") %>
<%= t("goals.form_stepper.step1.fields.funding_accounts") %>

<%= t("goals.form_stepper.step1.fields.funding_accounts_hint") %>

<% grouped = linkable_accounts.group_by { |a| a.subtype.to_s.presence || "other" } %> <% grouped.each_with_index do |(subtype, accts), group_idx| %>
<%= t("goals.form_stepper.step1.subtypes.#{subtype}", default: subtype.titleize) %>
"> <% accts.each_with_index do |account, idx| %> <% end %>
<% end %>
<%= render "color_picker", form: f, colors: Goal::COLORS, icons: Goal::ICONS %> <%= f.text_area :notes, label: t("goals.form_stepper.step1.fields.notes"), rows: 2 %>
<%= f.submit t("goals.edit.save") %>
<% end %>