<% batches.each do |batch| %>
  <article class="card mb-4">
    <div class="card-body">
      <div class="flex justify-between items-center mb-2">
        <h3 class="text-base font-medium">
          <%= link_to "Batch ##{batch.id}", letter_batch_path(batch) %>
          <small class="text-gray-500">(<%= pluralize(batch.letters.count, 'letter') %>)</small>
          <%= batch_status_badge(batch.aasm.current_state, 'float-right') %>
        </h3>
      </div>
      <div class="grid md:grid-cols-3 gap-4 text-sm text-gray-600 mb-2">
        <div>
          <span class="text-gray-400">Created:</span>
          <%= time_ago_in_words(batch.created_at) %> ago
        </div>
        <div>Tags: <%= render 'shared/tags', tags: batch.tags %></div>
      </div>
      <div class="mt-4 flex gap-2">
        <%= link_to letter_batch_path(batch), class: "btn btn-sm btn-icon", title: "View batch details" do %>
          <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
          </svg>
          View
        <% end %>
        <%= link_to edit_letter_batch_path(batch), class: "btn btn-sm btn-icon", title: "Edit batch" do %>
          <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
          </svg>
          Edit
        <% end %>
      </div>
    </div>
  </article>
<% end %> 