app/views/admin/conditions/index.html.erb
<div class="row">
<div class="col-10">
<h1 class="h4">Condições</h1>
</div>
<div class="col-2">
<%= link_to "Criar condição", new_admin_condition_path, class: 'btn btn-primary btn-block' %>
</div>
</div>
<table class="table table-bordered table-hover table-sm mt-3">
<thead class="thead-dark">
<tr>
<th scope="col" rowspan="2">#</th>
<th scope="col" rowspan="2">Nome</th>
<th scope="col" colspan="2">Data de validade</th>
<th scope="col" colspan="3">Condições</th>
<th scope="col" rowspan="2">Unidades</th>
<th scope="col" rowspan="2">Pode cadastrar?</th>
<th scope="col" rowspan="2">Pode agendar?</th>
</tr>
<tr>
<th scope="col">A partir de</th>
<th scope="col">Até</th>
<th scope="col">Idade mín</th>
<th scope="col">Idade máx</th>
<th scope="col">Grupos</th>
</tr>
</thead>
<tbody>
<% @conditions.each do |condition| -%>
<tr data-cy="group"
class="<%= "table-success" if condition.active? %>"
>
<td>
<%= link_to condition.id, admin_condition_path(condition) %>
</td>
<th scope="row">
<%= condition.name %>
</th>
<th>
<%= l condition.start_at, format: :short_date_hour %>
</th>
<th>
<%= l condition.end_at, format: :short_date_hour %>
</th>
<th>
<%= condition.min_age %>
</th>
<th>
<%= condition.max_age %>
</th>
<th>
<%= condition.groups.count %>
</th>
<th>
<%= condition.ubs.count %>
</th>
<th>
<%= condition.can_register ? "✅" : "❌" %>
</th>
<th>
<%= condition.can_schedule ? "✅" : "❌" %>
</th>
</tr>
<% end -%>
</tbody>
</table>
<div>
<%= paginate @conditions %>
</div>