  <h1 class="head"><i class="fa fa-book" aria-hidden="true"></i> Benutzerrollen verwalten</h1>
  <div class='user-management '>
    <div class='table-actions'>
        <%= link_to(new_team_path, {}) do%>
          <span><i class="fa fa-plus" aria-hidden="true"></i> Neue Benutzerrolle<span>
        <% end %>
        <%= link_to(users_path, {}) do%>
          <span><i class="fa fa-user" aria-hidden="true"></i> Benutzerverwaltung<span>
        <% end %>
    </div>


      <table id="roletable">
        <thead>
          <tr>
            <th class="zeile0 t_head" >Benutzerrolle</th>
            <th class="zeile0 t_head" >Berechtigungen</th>
            <th class="zeile0 t_head">Aktion</th>
          </tr>
        </thead>

      <tdata>
      <% @teams.each do |team| %>
        <tr>
          <td class="zeile<%= $x %>"><%= team.name %></td>
          <td class="zeile<%= $x %>">
            <% team.permissions_teams.sort { |a,b| b.permission.id <=> a.permission.id } .each do |pt| p=pt.permission %>
              <li style="color: <%= p.color %>">
                <%= p.permission %>
                <span id="global-view<%= p.id %>">
                  <%= render :partial => "global", :locals => {:p => pt, :t => team} %>
                </span>
              </li>
            <% end %>
          </td>
          <td class="zeile<%= $x %>">
              <%= link_to(edit_team_path(team)) do %>
                <span><i class="fa fa-pencil" aria-hidden="true" title='Bearbeiten'></i></span>
              <% end %>
            <% unless session[:nojs] %>
                <%= link_to({ :id => team.id, :method => :delete }, { data: { :confirm => 'Are you sure?' }}) do %>
                  <span><i class="fa fa-times" aria-hidden="true" title='L&ouml;schen'></i></span>
                <% end %>
            <% else %>
              <%= link_to({ :action => :delete, :id => team.id }) do %>
                <span><i class="fa fa-times" aria-hidden="true" title='L&ouml;schen'></i></span>
              <% end %>
              
            <%  end %>
          </td>
        </tr>

      <% end %>
      </tdata>
      </table>

      <br />

    </div>
  </div>
