<% # Force the form to be multipart for the file uploads. # Calling Decidim form builder's own `upload` builder method should already do # this but it is not working in our case since we have multiple file fields. form.multipart = true %>

<%= title %>

<% if component_settings.proposal_linking_enabled? %>
<%= attached_proposals_picker_field form, :proposals %>
<%= javascript_include_tag "decidim/plans/proposal_picker" %> <%= stylesheet_link_tag "decidim/plans/proposal_picker" %> <% end %>
<%= remaining_characters("plans_title", component_settings.plan_title_length) do |opts| %> <% if component_settings.multilingual_answers? %> <%= form.translated :text_field, :title, opts.merge(tabs_id: "title-tabs") %> <% else %> <%= form.text_field( "title_#{current_locale}".to_sym, { label: form.label_for(:title) }.merge(opts) ) %> <% end %> <% end %>
<% if component_settings.scopes_enabled? && current_participatory_space.has_subscopes? %>
<%= scopes_picker_field form, :scope_id %>
<% end %> <% if component_settings.categories_enabled? && @form.categories&.any? %>
<%= form.categories_select :category_id, @form.categories, prompt: t(".select_a_category") %>
<% end %> <% @form.contents.each_with_index do |content, idx| %> <%= fields_for "contents[]", content do |content_form| %> <%= render "decidim/plans/shared/section_content_field", form: content_form, id: tabs_id_for_content(idx) %> <% end %> <% end %> <% if component_settings.attachments_allowed? %>
<%= render partial: "decidim/plans/shared/attachments", object: form, locals: { form: form, blank_attachment: blank_attachment, component_settings: component_settings } %>
<% end %>
<%= javascript_include_tag "decidim/plans/plans_form" %>