% unless invoices.empty? %>
<%= render partial: 'qbo_estimates/status_styles' %>
<%= form_with(url: invoice_path, method: :get) do |form| %>
<% if invoices.count > 1 %>
<%= check_box_tag "select-all-invoices", "1", false, id: "select-all-invoices" %>
<%= label_tag "select-all-invoices", t(:label_select_all) %>
<% end %>
<% invoices.sort.reverse.each do |invoice| %>
<%# One cell each (qbo_estimates/_status_styles lines them up in columns, so the icons line up) %>
<%= check_box_tag "invoice_ids[]", invoice.id, false, class: "invoice-checkbox" if invoices.count > 1 %>
<%= link_to "##{invoice.doc_number}", invoice_path(invoice), target: :_blank %>
<%= invoice.txn_date %>
<%# Paid / partially paid / overdue / open / voided, from the cached balance and due date; short so the list
stays narrow: "Paid", or "Paid +3d" when paid in full days after its date (the date on hover) %>
<% if (status = invoice.status) %>
<%= RedmineQboBilling::InvoiceStatus.short_label(status, paid_on: invoice.paid_on, invoice_date: invoice.txn_date) %>
<% end %>
<%= render partial: 'qbo_invoices/invoice_actions', locals: { invoice: invoice } if RedmineQboBilling.invoice_writer? %>
<% end %>
<% if invoices.count > 1 %>
<%= form.submit t(:button_bulk_pdf) %>
<% end %>
<% end %>
<% else %>
<%=t(:label_no_invoices)%>.
<% end %>