<div class="form__wrapper">
  <% if @form.categories&.any? %>
    <div class="field hashtags__container">
      <%= form.categories_select :category_id, @form.categories, include_blank: t("decidim.proposals.proposals.edit.select_a_category") %>
    </div>
  <% end %>

  <%= render "decidim/reporting_proposals/proposals/camera_button", form: form %>

  <% if @form.geocoding_enabled? %>
    <div id="address_input">
      <div class="address-fill">
        <%= form.geocoding_field :address, placeholder: t("decidim.proposals.proposals.placeholder.address"), required: true %>
      </div>
      <div class="has_no_address">
        <%= form.check_box :has_no_address %>
        <%= form.hidden_field :has_address, value: "1" %>
      </div>
      <div id="address_map" class="proposal__container">
        <p class="help-text">
          <%= t("instructions", scope: "decidim.proposals.proposals.dynamic_map_instructions") %> <%= t("description", scope: "decidim.proposals.proposals.dynamic_map_instructions") %>
        </p>
        <%= dynamic_map_for proposal_preview_data_for_map(@form.to_h) %>
      </div>
    </div>
  <% end %>

  <div class="field hashtags__container">
    <%= form.text_field :title, class: "js-hashtags", value: form_presenter.title %>
  </div>

  <%= text_editor_for_proposal_body(form) %>

  <% if @form.component_automatic_hashtags.any? %>
    <div class="field">
      <%= form.label :automatic_hashtags %>
      <div class="checkboxes hashtags">
        <% @form.component_automatic_hashtags.each do |hashtag| %>
          <label>
            <%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %>
          </label>
        <% end %>
      </div>
    </div>
  <% end %>

  <% if @form.component_suggested_hashtags.any? %>
    <div class="field">
      <%= form.label :suggested_hashtags, nil, for: nil %>
      <div class="checkboxes hashtags">
        <%= form.collection_check_boxes :suggested_hashtags, @form.component_suggested_hashtags.map { |hashtag| [hashtag.downcase, "##{hashtag}"] }, :first, :last do |option|
          option.label { option.check_box(checked: @form.suggested_hashtag_checked?(option.value)) + option.text }
        end %>
      </div>
    </div>
  <% end %>

  <% if current_component.has_subscopes? %>
    <%= scopes_select_field form, :scope_id, root: current_component.scope %>
  <% end %>

  <% if component_settings.attachments_allowed? && !component_settings.only_photo_attachments? %>
    <div class="attachments_container gallery__container documents_container">
      <legend><%= t("attachment_legend", scope: "decidim.proposals.proposals.edit") %></legend>
      <div>
        <%= form.attachment :documents,
                            multiple: true,
                            label: t("decidim.proposals.proposals.edit.add_documents"),
                            button_label: t("decidim.proposals.proposals.edit.add_documents"),
                            button_edit_label: t("decidim.proposals.proposals.edit.edit_documents"),
                            button_class: "button button__lg button__transparent-secondary w-full",
                            help_i18n_scope: "decidim.forms.file_help.file" %>
      </div>
    </div>
  <% end %>
</div>