<%= render 'buyers/accounts/menu' %>
<h2>Invoices for <%= h @account.org_name %></h2>

<table class="data">
  <thead>
    <tr>
      <th>ID</th>
      <th>Month</th>
      <th>State</th>
      <th>Amount</th>
      <th colspan='2' class='operations'>
        <%= fancy_link_to('Create invoice', admin_buyers_account_invoices_path(@account),
                          :method => :post, :class => 'new',
                          :disabled => create_invoice_disabled(@account)) -%>
      </th>
    </tr>
  </thead>
  <tbody>
    <% @invoices.each do |invoice| %>
      <%= content_tag_for(:tr, invoice) do %>
        <td><%= invoice.friendly_id %></td>
        <td><%= invoice.name %></td>
        <td><%= h invoice.state %></td>
        <td><%= price_tag(invoice.cost) %></td>
        <td class="operations">
          <%= link_to 'Show', admin_buyers_or_account_invoice_path(invoice) , :title => "Show #{invoice.friendly_id}" %>
        </td>
        <td class="operations">
          <%= invoice_pdf_link(invoice, 'PDF') %>
        </td>
       <% end %>
    <% end %>
  </tbody>
</table>
