MakersNetwork/agenda-saude

View on GitHub
app/views/admin/ubs/index.html.erb

Summary

Maintainability
Test Coverage
<div class="row">
  <div class="col-10">
    <h1 class="h4">Unidades</h1>
  </div>

  <div class="col-2">
    <%= link_to "Criar unidade", new_admin_ubs_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">#</th>
    <th scope="col">Nome</th>
    <th scope="col">2<sup>a</sup>-6<sup>a</sup></th>
    <th scope="col">Sábado</th>
    <th scope="col">Domingo</th>
    <th scope="col">Ativa?</th>
    <th scope="col">Hab. p/ Reagendamento dose reforço?</th>
  </tr>
  </thead>
  <tbody>
  <% @ubs.each do |ubs| -%>
    <tr data-cy="patient">
      <td>
        <%= link_to ubs.id, admin_ubs_path(ubs) %>
      </td>
      <th scope="row" class="align-middle">
        <%= link_to ubs.name, admin_ubs_path(ubs) %>
      </th>
      <td>
        <%= human_shifts(ubs) %>
      </td>
      <td>
        <%= human_shifts(ubs, weekday: 6) %>
      </td>
      <td>
        <%= human_shifts(ubs, weekday: 0) %>
      </td>
      <td>
        <%= ubs.active ? "✅" : "❌" %>
      </td>
      <td>
        <%= ubs.enabled_for_reschedule ? "✅" : "❌" %>
      </td>
    </tr>
  <% end -%>
  </tbody>
</table>

<div>
  <%= paginate @ubs %>
</div>