<% content_for :head do %>
  <%= javascript_include_tag 'admin/mail_magazine' %>
<% end %>

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

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

<h2>配信履歴</h2>
<%=h flash[:notice] %>
<%=h flash[:error] %>
<table class="data2" cellspacing="1">
  <tr>
    <th>配信開始時刻</th>
    <th rowspan="2">Subject</th>
    <th rowspan="2">プレビュー</th>
    <th rowspan="2">配信条件</th>
    <th>配信予定件数</th>
    <th rowspan="2">削除</th>
  </tr>
  <tr>
    <th>配信終了時刻</th>
    <th>配信件数</th>
  </tr>
  <% for his in (@histories || []) %>
  <tr>
    <td><%=h his.sent_start_at.strftime("%Y/%m/%d %H:%M") if his.sent_start_at %></td>
    <td rowspan="2"><%=h his.subject %></td>
    <td rowspan="2"><%= link_to '確認', {:action => :preview, :id => his},
            :popup => ["プレビュー", "width=760,height=600,resizable=yes,scrollbars=yes"]%></td>
    <td rowspan="2"><%= link_to '確認', {:action => :condition_view, :id => his},
            :popup => ["配信条件", "width=720,height=400,resizable=yes,scrollbars=yes"]%></td>
    <td><%=h his.schedule_case %></td>
    <td rowspan="2"><%= link_to '削除', admin_mail_magazine_path(his.id), :confirm=>"本当に削除しますか？", :method=>"delete" %></td>
  </tr>
  <tr>
    <td><%=h his.sent_end_at.strftime("%Y/%m/%d %H:%M") if his.sent_end_at %></td>
    <td><%=h his.delivered_case %></td>
  </tr>
  <% end %>
</table>
<%= will_paginate @histories %>

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