"
data-goal-form-suggested-no-date-value="<%= t("goals.form.suggested_no_date") %>">
<% if goal.errors[:base].any? %>
<%= render "shared/form_errors", model: goal %>
<% end %>
<%= styled_form_with model: goal,
url: goal.persisted? ? goal_path(goal) : goals_path,
method: goal.persisted? ? :patch : :post,
class: "space-y-5" do |f| %>
<%= render "color_picker", form: f, colors: Goal::COLORS, icons: Goal::ICONS %>
<%= f.text_field :name,
placeholder: t("goals.form.fields.name_placeholder"),
autofocus: true,
required: true,
label: t("goals.form.fields.name"),
data: { goal_form_target: "nameInput", action: "input->goal-form#nameChanged" } %>
<%= t("goals.form.errors.name_required") %>
<%= f.money_field :target_amount,
label: t("goals.form.fields.target_amount"),
hide_currency: true,
required: true,
amount_data: { goal_form_target: "amountInput", action: "input->goal-form#suggestedChanged" } %>
<%= t("goals.form.errors.amount_required") %>
<%= f.date_field :target_date,
label: t("goals.form.fields.target_date"),
data: { goal_form_target: "dateInput", action: "input->goal-form#suggestedChanged" } %>
<%= t("goals.form.fields.funding_accounts") %>
<%= t("goals.form.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.subtypes.#{subtype}", default: subtype.titleize) %>
">
<% accts.each_with_index do |account, idx| %>
<% end %>
<% end %>
<%= t("goals.form.errors.accounts_required") %>
<%= f.text_area :notes,
label: t("goals.form.fields.notes"),
rows: 2,
placeholder: t("goals.form.fields.notes_placeholder") %>
<%= f.submit goal.persisted? ? t("goals.form.save") : t("goals.form.create") %>
<% end %>