app/views/reimbursements/_table.html.erb
<div class="card card-container">
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-bordered" id="reimbursements">
<thead>
<tr>
<th><%= "Volunteer" %></th>
<th><%= "Case Number" %></th>
<th><%= "Contact Types" %></th>
<th><%= "Occurred At" %></th>
<th><%= "Miles Driven" %></th>
<th><%= "Address" %></th>
<th><%= "Reimbursement Complete" %></th>
</tr>
</thead>
<tbody>
<% @grouped_reimbursements.each do |_, reimbursements| %>
<% reimbursement = reimbursements.first %>
<tr>
<td id="volunteer-<%= reimbursement.id %>">
<span class="mobile-label">Volunteer</span>
<%= link_to(reimbursement.creator.display_name, volunteer_path(reimbursement.creator)) %>
</td>
<td id="case-number-<%= reimbursement.id %>">
<span class="mobile-label">Case Number</span>
<% reimbursements.each do |r| %>
<%= link_to(r.casa_case.case_number, casa_case_path(r.casa_case)) %><br>
<% end %>
</td>
<td id="contact-types-<%= reimbursement.id %>">
<%= contact_types_list(reimbursement) %>
</td>
<td id="date-attempted-<%= reimbursement.id %>">
<%= reimbursement.occurred_at.strftime("%B %d %Y") %>
</td>
<td id="amount-<%= reimbursement.id %>">
<%= reimbursement.miles_driven %>
</td>
<td id="volunteer-address-<%= reimbursement.id %>">
<%= reimbursement.creator.address&.content %>
</td>
<td>
<%= form_with(model: reimbursement, url: reimbursement_mark_as_complete_path(reimbursement),
method: "patch") do |form| %>
<%= form.label :reimbursement_complete, "Yes" %>
<%= form.check_box(:reimbursement_complete, value: reimbursement.reimbursement_complete,
onchange: 'this.form.submit();') %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>