<tr id="<%= dom_id user %>" class="bg-role-<%= user.role %>-light odd:bg-opacity-25 even:bg-opacity-15 text-hsrm-gray whitespace-nowrap hover:bg-opacity-30"">
  <td class="p-2 py-3 text-center">
    <%= link_to admin_user_path(user), target: "_top" do %>
      <span class="badge badge-xl text-role-<%= user.role %> bg-role-<%= user.role %>-light rounded-lg shadow">
        <%= user.id %>
      </span>
    <% end %>
  </td>
  <td class="p-2 py-3">
    <%= highlight(user.firstname, [ params.dig(:q, :firstname_or_lastname_or_email_cont).to_s, params.dig(:q, :firstname_cont).to_s ]) %>
    <%#= user.firstname %>
  </td>
  <td class="p-2 py-3">
    <%= highlight user.lastname, [params.dig(:q, :firstname_or_lastname_or_email_cont).to_s, params.dig(:q, :lastname_cont).to_s] %>
  </td>
  <td class="p-2 py-3">
    <%= icon bool_icon(user.verified), class: "icon #{user.verified ? "text-green-600" : "text-red-600"}", title: "E-Mail-Adresse verifiziert" %>
    <%= highlight user.email, [params.dig(:q, :firstname_or_lastname_or_email_cont).to_s, params.dig(:q, :email_start).to_s] %>
  </td>
  <td class="p-2 py-3 text-right">
    <%= user.customer_jobs.not_canceled.size %>
  </td>
  <td class="p-2 py-3 text-center">
    <%= l user.created_at.localtime.to_date %>
  </td>
  <td class="p-2 py-3 text-nowrap">
    <span class="inline-flex -space-x-px overflow-hidden bg-white divide-x divide-gray-300 rounded-md shadow">
      <% User.roles.keys.each do |role| %>
        <% if allowed_to? :change_role?, user  %>
          <% if user.role == role.to_s %>
            <%= button_to role, admin_user_path(user), method: :patch, params: { user: { role: role }}, form_class: "inline", class: "inline-block px-4 py-2 text-sm uppercase font-medium focus:relative bg-role-#{role}-light text-#{role}" %>
          <% else %>
            <%= button_to role, admin_user_path(user), method: :patch, params: { user: { role: role }}, form_class: "inline", class: "inline-block px-4 py-2 text-sm uppercase font-medium  focus:relative hover:bg-role-#{role}-light text-#{role}" %>
          <% end %>
        <% else %>
          <% if user.role == role.to_s %>
            <span class="inline-block px-4 py-2 text-sm uppercase font-medium text-<%= role %> bg-role-<%= role %>-light focus:relative"><%= role %></span>
          <% else %>
            <span class="inline-block px-4 py-2 text-sm font-medium text-gray-400 uppercase focus:relative"><%= role %></span>
          <% end %>
        <% end %>
      <% end %>
    </span>
  </td>
</tr>
