<div class="card mb-4">
  <div class="card-body">
    <div class="row">
      <div class="col-md-6">
        <h3 class="text-sm font-medium mb-2">Batch Details</h3>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Created:</span>
          <%= @batch.created_at.strftime("%B %d, %Y") %>
        </div>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Status:</span>
          <%= batch_status_badge(@batch.aasm.current_state) %>
        </div>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Letters:</span>
          <%= @batch.letters.count %>
        </div>
        <% if @batch.user_facing_title.present? %>
          <div class="text-sm mb-3">
            <span class="text-gray-500">Title:</span>
            <%= @batch.user_facing_title %>
          </div>
        <% end %>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Total postage cost:</span>
          <%= @batch.postage_cost %>
        </div>
      </div>

      <div class="col-md-6">
        <h3 class="text-sm font-medium mb-2">Letter Specifications</h3>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Weight:</span>
          <%= @batch.letter_weight %> oz
        </div>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Mailing Date:</span>
          <%= @batch.letter_mailing_date&.strftime("%B %d, %Y") %>
        </div>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Processing Category:</span>
          <%= @batch.letter_processing_category %>
        </div>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Mailer ID:</span>
          <%= @batch.mailer_id&.display_name %>
        </div>
        <div class="text-sm mb-3">
          <span class="text-gray-500">Return Address:</span>
          <%= @batch.letter_return_address&.display_name %>
        </div>
      </div>
    </div>

    <%= render 'shared/tags', tags: @batch.tags %>
  </div>
</div>

<div class="card mb-4">
  <div class="card-header">
    <h3 class="text-sm font-medium mb-0">Actions</h3>
  </div>
  <div class="card-body">
    <% case @batch.aasm_state %>
    <% when "awaiting_field_mapping" %>
      <%= warning_link_to "Map Fields", map_fields_letter_batch_path(@batch), class: "w-full mb-2" do %>
        <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
        </svg>
        Map Fields
      <% end %>
    <% when "fields_mapped" %>
      <%= success_link_to "Process Batch", process_confirm_letter_batch_path(@batch), class: "w-full" do %>
        <%= check_icon %>Process Batch
      <% end %>
    <% end %>
  </div>
</div> 