<% content_for :title, "Batches" %>
<div class="container">
  <div class="page-header">
    <div class="flex justify-between align-items-center">
      <h1>Batches</h1>
      <div class="actions">
        <%= create_button new_batch_path, "upload some CSV!" %>
      </div>
    </div>
  </div>
  <div id="batches" class="return-addresses-grid">
    <% @batches.each do |batch| %>
      <article class="card">
        <header>
          <div class="flex justify-between align-items-center">
            <h3>
            <%= batch.type.split('::').first.titleize %> Batch #<%= batch.id %>
              <%= batch_status_badge(batch.aasm.current_state, "float-right") %>
            </h3>
          </div>
        </header>
        <div class="mb-2">
          <span class="text-muted">Tags:</span>
          <%= render 'shared/tags', tags: batch.tags %>
        </div>
        <div class="grid">
          <div>
            <span class="text-muted">Type:</span>
            <%= batch.type.split('::').first.titleize %>
          </div>
          <div>
            <span class="text-muted">Created:</span>
            <%= time_ago_in_words(batch.created_at) %> ago
          </div>
          <div>
            <span class="text-muted">Status:</span>
            <%= batch.aasm.current_state.to_s.humanize(capitalize: false) %>
          </div>
        </div>
        <footer>
          <%= primary_outline_link_to "View Details", batch do %>
            <%= eye_icon %>View Details
          <% end %>
        </footer>
      </article>
    <% end %>
  </div>
</div>
