theseus/app/views/shared/_batch_info.html.erb
2025-05-31 23:25:41 -04:00

54 lines
No EOL
1.9 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%# This partial displays information about a batch for a letter or warehouse order %>
<% if record.batch.present? %>
<div class="card mb-4">
<div class="card-header flex items-center justify-between py-2">
<h2 class="text-base font-medium">Part of Batch</h2>
<%= link_to letter_batch_path(record.batch), class: "text-sm text-blue-600 hover:text-blue-800" do %>
View Batch #<%= record.batch.id %>
<% end %>
</div>
<div class="card-body p-3">
<div class="grid md:grid-cols-2 gap-4 text-sm">
<div>
<span class="text-gray-500">Batch Type:</span>
<%= record.batch.type.split('::').first.titleize %>
</div>
<div>
<span class="text-gray-500">Status:</span>
<span class="badge <%= record.batch.aasm.current_state %>">
<%= record.batch.aasm.current_state.to_s.titleize %>
</span>
</div>
<div>
<span class="text-gray-500">Created:</span>
<%= record.batch.created_at.strftime("%B %d, %Y") %>
</div>
<div>
<span class="text-gray-500">Items in Batch:</span>
<%= record.batch.addresses.count %>
</div>
<% if record.batch.is_a?(Letter::Batch) %>
<div>
<span class="text-gray-500">Letter Dimensions:</span>
<%= "#{record.batch.letter_width}\" × #{record.batch.letter_height}\"" %>
</div>
<div>
<span class="text-gray-500">Letter Weight:</span>
<%= record.batch.letter_weight %> oz
</div>
<% end %>
<% if record.batch.is_a?(Warehouse::Batch) %>
<% if record.batch.warehouse_template.present? %>
<div>
<span class="text-gray-500">Template:</span>
<%= record.batch.warehouse_template.name %>
</div>
<% end %>
<% end %>
</div>
</div>
</div>
<% end %>