MakersNetwork/agenda-saude

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

Summary

Maintainability
Test Coverage
<h1 class="h4"></h1>

<div class="row">
  <div class="col-10">
    <h1 class="h4">
      Operadores
    </h1>
  </div>

  <div class="col-2">
    <%= link_to "Criar operador", new_admin_user_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">Unidades</th>
    <th scope="col">Admin?</th>
  </tr>
  </thead>
  <tbody>
  <% @users.each do |user| -%>
    <tr data-cy="patient">
      <td>
        <%= link_to user.id, admin_user_path(user) %>
      </td>
      <th scope="row" class="align-middle">
        <%= user.name %>
      </th>
      <td>
        <%= user.ubs.order(:id).pluck(:name).join(", ") %>
      </td>
      <td>
        <%= "✅" if user.administrator %>
      </td>
    </tr>
  <% end -%>
  </tbody>
</table>

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