<% content_for :title, "Indicia" %>

<div class="container">
  <header class="page-header mb-6">
    <h1>Indicia</h1>
    <div class="actions">
      <%= link_to new_usps_indicium_path, class: "btn success btn-small" do %>
        + New Indicium
      <% end %>
    </div>
  </header>

  <% if @usps_indicia.any? %>
    <article>
      <div class="p-4">
        <table class="w-full text-sm">
          <thead>
            <tr>
              <th class="text-left py-2">ID</th>
              <th class="text-left py-2">SKU</th>
              <th class="text-left py-2">Postage</th>
              <th class="text-left py-2">Mailing Date</th>
              <th class="text-left py-2">Category</th>
              <th class="text-right py-2"></th>
            </tr>
          </thead>
          <tbody>
            <% @usps_indicia.each do |indicium| %>
              <tr class="border-t hover:bg-gray-50">
                <td class="py-3 font-mono text-xs"><%= indicium.public_id %></td>
                <td class="py-3 font-mono text-xs"><%= indicium.usps_sku %></td>
                <td class="py-3"><%= number_to_currency(indicium.postage) %></td>
                <td class="py-3"><%= indicium.mailing_date %></td>
                <td class="py-3"><%= indicium.processing_category %></td>
                <td class="py-3 text-right">
                  <%= link_to "View", usps_indicium_path(indicium), class: "text-sm" %>
                </td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>
    </article>
  <% else %>
    <article>
      <div class="p-6 text-center text-gray-500">
        No indicia purchased yet.
      </div>
    </article>
  <% end %>
</div>
