may mark mailed!

This commit is contained in:
24c02 2026-03-20 16:07:41 -04:00
parent 3dad3f6c96
commit e606cdef08

View file

@ -133,12 +133,13 @@
Mark All Printed
<% end %>
<% end %>
<% if @batch.letters.any? && @batch.letters.any?(&:printed?) %>
<%= button_to mark_mailed_letter_batch_path(@batch), method: :post, class: "btn btn-block btn-info", data: { confirm: "Are you sure you want to mark all letters as mailed?" } do %>
<% mailable_letters = @batch.letters.select(&:may_mark_mailed?) %>
<% if mailable_letters.any? %>
<%= button_to mark_mailed_letter_batch_path(@batch), method: :post, class: "btn btn-block btn-info", data: { confirm: "Are you sure you want to mark #{mailable_letters.size == @batch.letters.size ? 'all' : 'pending'} letters as mailed?" } do %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>
</svg>
Mark All Mailed
<%= mailable_letters.size == @batch.letters.size ? "Mark all mailed" : "Mark #{mailable_letters.size} pending letters mailed" %>
<% end %>
<% end %>
</div>