<script>
    $(document).ready(function(){
        $(".pro_info_p,.proInfoP").mouseover(function(){
            $(this).children(".pic_edit2").css("display","inline-block");
        });
        $(".pro_info_p,.proInfoP").mouseout(function(){
            $(this).children(".pic_edit2").css("display","none");
        });
        $(".pic_edit2").click(function(){
            $(this).parent().hide();
            $(this).parent().next().show();
        });
        $(".issueEdit").blur(function(){
            $(this).hide();
            $(this).prev().show();
            var editValue = $(this).children("option:selected").text();
            $(this).prev().children(":first").text(editValue);
        });
        function stopPropagation(e) {
            if (e.stopPropagation)
                e.stopPropagation();
            else
                e.cancelBubble = true;
        };
        $(document).bind('click',function(){
            $('.issueEdit').css('display','none');
            $('.proInfoP,.pro_info_p').show();
        });
        $('.issueEdit,.pic_edit2').bind('click',function(e){
            stopPropagation(e);
        });
    });
    function remote_function(id) {
        $(id).submit();
    }
</script>
<div class="cl"></div>
<div class="proInfoBox2 mb10 mt10">
  <ul class="fl">
    <%#= labelled_fields_for :issue, @issue do |f| %>
        <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])),
                     {:include_blank => false, :selected => @status_id ? @status_id : 0 },
                     {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %>
    <%# end %>
    <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %>
    <li>
      <p class="label03">&nbsp;状态&nbsp;&nbsp;:&nbsp;</p>
      <p class="proInfoP"><span><%= activity.status.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a></p>
      <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
                  {:include_blank => false, :selected => @status_id ? @status_id : 0 },
                  {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit",:style=>"white-space:nowrap; overflow:hidden;"}
          )
      %>
    </li>
    <% end %>
    <div class="cl"></div>




    <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
    <li>
      <p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p>
      <span class="pro_info_p" style="width:130px;">
        <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:100px; display:inline-block;" %>
        <a href="javascript:void(0)" class="pic_edit2 ml5" style="vertical-align:top;"></a></span>
      <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project),
               { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0},
               {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"undis issueEdit", :style => "width:130px;"}) %>
    </li>
    <% end %>
    <div class="cl"></div>




  </ul>
  <ul class="fl">
    <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %>
    <li>
      <p class="label03">&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p>
      <span class="proInfoP" style="width:70px;"><span><%= activity.priority.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span>
      <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]),
                {:include_blank => false,:selected=>@priority_id ?  @priority_id : 0},
                {:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %>
    </li>
    <% end %>
    <div class="cl"></div>
    <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %>
    <li>
      <p class="label03">&nbsp;完成度&nbsp;&nbsp;:&nbsp;</p>
      <span class="proInfoP" style="width:70px;"><span><%= activity.done_ratio %>%</span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span>
      <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }),
                {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0},
                {:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %>
    <% end %>
    </li>

    <div class="cl"></div>
  </ul>
  <ul class="fl ">
    <li>
      <p class="label03" style="width:50px;">&nbsp;开始&nbsp;&nbsp;:&nbsp;</p>
      <p class="proInfoP" style="width:70px;"><span><%= format_date(activity.start_date) %></span></p>
    </li>
    <div class="cl"></div>
    <li>
      <p class="label03" style="width:50px;">&nbsp;周期&nbsp;&nbsp;:&nbsp;</p>
      <span class="proInfoP" style="width:70px;"><%= l_hours(activity.estimated_hours) %></span> </li>
    <div class="cl"></div>
  </ul>
  <ul class="fl ml20">
    <li>
      <p class="label03">&nbsp;计划完成&nbsp;&nbsp;:&nbsp;</p>
      <span class="proInfoP" style="width:100px;"><span><%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %></span></span> </li>
    <div class="cl"></div>
    <li>
      <p class="label03">&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p>
      <span class="proInfoP" style="width:100px;"><%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %> </span> </li>
    <div class="cl"></div>
  </ul>
  <!--pro_info_box end-->
</div>