<%= form_required_explanation %> <% unless single_initiative_type? %>
<%= form.select :type_id, initiative_type_options, {}, { disabled: !@form.signature_type_updatable?, "data-scope-selector": "initiative_decidim_scope_id", "data-scope-id": form.object.scope_id.to_s, "data-scope-search-url": decidim_initiatives.initiative_type_scopes_search_url, "data-signature-types-selector": "initiative_signature_type", "data-signature-type": current_initiative.signature_type, "data-signature-types-search-url": decidim_initiatives.initiative_type_signature_types_search_url } %>
<% end %>
<%= form.text_field :title, autofocus: true, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative), value: translated_attribute(@form.title) %>
<%= text_editor_for(form, :description, toolbar: :content, lines: 8, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative), value: translated_attribute(@form.description)) %>
<%= form.text_field :hashtag, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
<% signature_type_options = signature_type_options(form.object) %> <% if signature_type_options.length == 1 %> <%= form.hidden_field :signature_type %> <% else %>
<%= form.select :signature_type, signature_type_options, {}, { disabled: !@form.signature_type_updatable? } %>
<% end %> <% if can_edit_custom_signature_end_date?(current_initiative) %>
<%= form.date_field :signature_end_date, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
<% end %>
<%= form.select :scope_id, @form.available_scopes.map { |scope| [translated_attribute(scope.scope_name), scope&.scope&.id] }, { disabled: !@form.state_updatable? } %>
<% if current_initiative.area_enabled? %>
<%= form.areas_select :area_id, areas_for_select(current_organization), { selected: current_initiative.decidim_area_id, include_blank: current_initiative.decidim_area_id.blank? || current_initiative.created? }, disabled: !@form.area_updatable? %>
<% end %>
<%= form.select :state, Decidim::Initiative.states.keys.map { |state| [I18n.t(state, scope: "decidim.initiatives.admin_states"), state] }, {}, { disabled: !@form.state_updatable? } %>
<% if current_initiative.type.attachments_enabled? %>
<%= t("attachment_legend", scope: "decidim.initiatives.form") %> <% if @form.photos.any? %> <% @form.photos.each do |photo| %> <% end %> <% end %> <% if @form.documents.any? %> <% @form.documents.each do |document| %>
<%= link_to translated_attribute(document.title), document.url %> <%= document.file_type %> <%= number_to_human_size(document.file_size) %> <%= form.hidden_field :documents, multiple: true, value: document.id, id: "document-#{document.id}" %>
<% end %> <% end %>
<%= form.file_field :add_documents, multiple: true, label: t("add_attachments", scope: "decidim.initiatives.form") %>
<% end %> <% if current_initiative.type.promoting_committee_enabled? %> <%= render partial: "committee_members" %> <% end %> <% content_for :js_content do %> <%= javascript_pack_tag "decidim_initiatives" %> <% end %>