<h2><%= @copy ? l(:button_copy) : l(:button_move) %></h2>

<ul>
  <% @issues.each do |issue| -%>
    <li><%= link_to_issue issue %></li>
  <% end -%>
</ul>

<%= form_tag({:action => 'create'}, :id => 'move_form') do %>
  <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join %>

  <div class="box tabular">
    <fieldset class="attributes">
      <legend><%= l(:label_change_properties) %></legend>

      <div class="splitcontentleft">
        <p><label for="new_project_id"><%=l(:field_project)%>:</label>
          <%= select_tag "new_project_id",
            project_tree_options_for_select(@allowed_projects, :selected => @target_project),
            :onchange => remote_function(:url => { :action => 'new' },
            :method => :get,
            :update => 'content',
            :with => "Form.serialize('move_form')") %></p>

        <div class="combo-container" style="margin: 0">
          <%= label_tag :parent_issue_id, l(:field_issue)+':' -%><%= "\n" %>
          <%= easy_autocomplete_tag('parent_issue_id', {:name => '', :id => ''}, url_for(params.merge({:action => 'available_issues', :format => 'json'})), {:root_element => 'issues'}) %>
        </div>

        <p><label for="new_tracker_id"><%=l(:field_tracker)%>:</label>
          <%= select_tag "new_tracker_id", "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@trackers, "id", "name") %></p>

        <p>
          <label><%= l(:field_status) %></label>
          <%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %>
        </p>

        <p>
          <label><%= l(:field_priority) %></label>
          <%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.active, :id, :name)) %>
        </p>

        <p>
          <label><%= l(:field_assigned_to) %></label>
          <%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option), :value => '') +
              content_tag('option', l(:label_nobody), :value => 'none') +
              options_from_collection_for_select(@target_project.assignable_users, :id, :name)) %>
        </p>
      </div>

      <div class="splitcontentright">
        <p>
          <label><%= l(:field_start_date) %></label>
          <%= text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %>
        </p>

        <p>
          <label><%= l(:field_due_date) %></label>
          <%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>
        </p>
      </div>

    </fieldset>

    <fieldset><legend><%= l(:field_notes) %></legend>
      <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
      <%= wikitoolbar_for 'notes' %>
    </fieldset>

    <%= call_hook(:view_issues_move_bottom, :issues => @issues, :target_project => @target_project, :copy => !!@copy) %>
  </div>

  <% if @copy %>
    <%= hidden_field_tag("copy_options[copy]", "1") %>
    <%= submit_tag l(:button_copy), :class => 'button-positive' %>
    <%= submit_tag l(:button_copy_and_follow), :name => 'follow' , :class => 'button' %>
  <% else %>
    <%= submit_tag l(:button_move), :class => 'button-positive' %>
    <%= submit_tag l(:button_move_and_follow), :name => 'follow', :class => 'button' %>
  <% end %>
<% end %>

<% ### PAGE CUSTOMS ########################################################## %>

<% content_for :header_tags do %>
  <%= robot_exclusion_tag %>
<% end %>