<%= render :partial => "submenu" %>

<div id="main"><!-- メイン -->

<h2>在庫切れ管理</h2>
<%=h flash[:notice] %>
<%=h flash[:error] %>
<% form_tag :action => "actual_count_search" do %>
  <%= render :partial => "search" %>
<% end %>
<br />

<% form_tag({:action => 'actual_count_csv_download'}.merge(:search => @search.to_params)) do %>
  <%- params[:product_status_ids] and params[:product_status_ids].each do |value| -%>
    <%= hidden_field_tag 'product_status_ids[]', value %>
  <%- end -%>
  <br />
  <p>&gt;&gt;検索結果一覧&nbsp;<%=@products.total_entries %>件&nbsp;が該当しました</p>
  <div class="btn_box space20_bottom">
    <%= submit_tag 'CSV DOWNLOAD', :class=>"btn" %>
    <%= image_tag("btn_side.gif", :width => "6", :height => "34", :class => "btn_side") %>
  </div>
<% end %>
<table class="data2 clear" cellspacing="1">
  <tr>
    <th>商品名</th>
    <th>商品コード</th>
    <th>更新日</th>
    <th>実在<br />個数</th>
    <th>商品<br />情報</th>
  </tr>
  <% @products && @products.each do | product | %>
    <tr>
      <td><%= h product.product_name %></td>
      <td><%= h product.code %></td>
      <td><%= h (product.updated_at.strftime("%Y-%m-%d")) if product.updated_at %></td>
      <td><%= h product.actual_count.to_i %></td>
      <td>
        <%= link_to "参照/<br />編集" , edit_admin_product_path(product.product_id), {:target => "_blank"} %>
      </td>
    </tr>
  <% end %>
</table>
<%= will_paginate @products, :params => {:search => params[:search], :product_status_ids => params[:product_status_ids] } %>

</div><!-- /メイン -->
