<%= form_for(@proposal, url: form_url) do |f| %>
  <%= render 'shared/errors', resource: @proposal %>

  <div class="row">
    <div class="small-12 column">
      <%= f.label :title, t("proposals.form.proposal_title") %>
      <%= f.text_field :title, maxlength: Proposal.title_max_length, placeholder: t("proposals.form.proposal_title"), label: false, data: {js_suggest_result: "js_suggest_result", js_suggest: "#js-suggest", js_url: suggest_proposals_path}%>
    </div>
    <div id="js-suggest"></div>

    <%= f.invisible_captcha :subtitle %>

    <div class="small-12 column">
      <%= f.label :question, t("proposals.form.proposal_question") %>
      <span class="note-marked">
        <%= t("proposals.form.proposal_question_example_html") %>
      </span>
      <%= f.text_field :question, maxlength: Proposal.question_max_length, placeholder: t("proposals.form.proposal_question"), label: false %>
    </div>

    <div class="small-12 column">
      <%= f.label :summary, t("proposals.form.proposal_summary") %>
      <p class="note"><%= t("proposals.form.proposal_summary_note") %></p>
      <%= f.text_area :summary, rows: 4, maxlength: 200, label: false,
                      placeholder: t('proposals.form.proposal_summary') %>
    </div>

    <div class="ckeditor small-12 column">
      <%= f.label :description, t("proposals.form.proposal_text") %>
      <%= f.cktext_area :description, maxlength: Proposal.description_max_length, ckeditor: { language: I18n.locale }, label: false %>
    </div>


    <div class="small-12 column">
      <%= f.label :video_url, t("proposals.form.proposal_video_url") %>
      <p class="note"><%= t("proposals.form.proposal_video_url_note") %></p>
      <%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false %>
    </div>

    <div class="small-12 column">
      <%= f.label :external_url, t("proposals.form.proposal_external_url") %>
      <%= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_url"), label: false %>
    </div>

    <div class="small-12 medium-6 column">
      <%= f.label :geozone_id,  t("proposals.form.geozone") %>
      <%= f.select :geozone_id, geozone_select_options, {include_blank: t("geozones.none"), label: false} %>
    </div>

    <div class="small-12 column">
      <%= f.label :tag_list, t("proposals.form.tags_label") %>
      <p class="note"><%= t("proposals.form.tags_instructions") %></p>

      <div id="category_tags" class="tags">
        <%= f.label :category_tag_list, t("proposals.form.tag_category_label") %>
        <% @categories.each do |tag| %>
          <a class="js-add-tag-link"><%= tag.name %></a>
        <% end %>
      </div>

      <br>
      <%= f.text_field :tag_list, value: @proposal.tag_list.to_s,
                        label: false,
                        placeholder: t("proposals.form.tags_placeholder"),
                        class: 'js-tag-list' %>
    </div>

    <% if current_user.unverified? %>
      <div class="small-12 column">
        <%= f.label :responsible_name, t("proposals.form.proposal_responsible_name") %>
        <p class="note"><%= t("proposals.form.proposal_responsible_name_note") %></p>
        <%= f.text_field :responsible_name, placeholder: t("proposals.form.proposal_responsible_name"), label: false %>
      </div>
    <% end %>

    <div class="small-12 column">
      <% if @proposal.new_record? %>
        <%= f.label :terms_of_service do %>
          <%= f.check_box :terms_of_service, title: t('form.accept_terms_title'), label: false %>
          <span class="checkbox">
            <%= t("form.accept_terms",
                policy: link_to(t("form.policy"), "/privacy", target: "blank"),
                conditions: link_to(t("form.conditions"), "/conditions", target: "blank")).html_safe %>
          </span>
        <% end %>
      <% end %>
    </div>

    <div class="actions small-12 column">
      <%= f.submit(class: "button", value: t("proposals.#{action_name}.form.submit_button")) %>
    </div>
  </div>
<% end %>
