Update role column in admin/user index
This commit is contained in:
@@ -17,32 +17,22 @@
|
||||
<%= 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">
|
||||
<span class="badge block w-28 bg-role-<%= user.role %>-light">
|
||||
<%= user.jobs_as_costumer.size %>
|
||||
</span>
|
||||
<td class="p-2 py-3 text-right">
|
||||
<%= user.jobs_as_costumer.where.not(status: :canceled).size %>
|
||||
</td>
|
||||
<td class="p-2 py-3">
|
||||
<span class="badge block w-28 bg-role-<%= user.role %>-light">
|
||||
<%= l user.created_at.localtime.to_date %>
|
||||
</span>
|
||||
<td class="p-2 py-3 text-center">
|
||||
<%= l user.created_at.localtime.to_date %>
|
||||
</td>
|
||||
<td class="p-2 py-3">
|
||||
<span class="badge block w-28 bg-role-<%= user.role %>-light">
|
||||
<%= user.role %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="flex justify-center p-2 py-3 space-x-2">
|
||||
<% User::AVAILABLE_ROLES.each do |role| %>
|
||||
<% if allowed_to? :change_role?, user %>
|
||||
<%= button_to admin_user_path(user), method: :patch, params: { user: { role: role }} do %>
|
||||
<span class="block bg-gray-300 badge w-28 hover:bg-role-<%= role %>-light"><%= role %></span>
|
||||
<% end unless user.role == role.to_s %>
|
||||
<% else %>
|
||||
<% unless user.role == role.to_s %>
|
||||
<span class="block bg-gray-100 badge text-gray-300 w-28"><%= role %></span>
|
||||
<td class="p-2 py-3 text-nowrap">
|
||||
<span class="inline-flex -space-x-px overflow-hidden rounded-md bg-white shadow divide-x divide-gray-300">
|
||||
<% User::AVAILABLE_ROLES.each do |role| %>
|
||||
<% bg_color = "bg-role-#{role}-light" if user.role == role.to_s %>
|
||||
<% if allowed_to? :change_role?, user %>
|
||||
<%= button_to role, admin_user_path(user), method: :patch, params: { user: { role: role }}, form_class: "inline", class: "inline-block px-2 py-2 text-sm uppercase font-medium text-gray-700 focus:relative hover:bg-role-#{role}-light #{bg_color} text-#{role}" %>
|
||||
<% else %>
|
||||
<span class="inline-block px-2 py-2 text-sm uppercase font-medium text-gray-700 <%= bg_color %> focus:relative"><%= role %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -35,10 +35,9 @@
|
||||
<th class="min-w-24 p-2 py-3 text-left"><%= sort_link(@q, :firstname, "Vorname") %></th>
|
||||
<th class="min-w-24 p-2 py-3 text-left"><%= sort_link(@q, :lastname, "Nachname") %></th>
|
||||
<th class="p-2 py-3 text-left"><%= sort_link(@q, :email, "E-Mail-Adresse") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center"><%= sort_link(@q, :jobs_as_costumer_count, "# Jobs") %></th>
|
||||
<th class="w-1 p-2 py-3 text-right text-nowrap"><%= sort_link(@q, :jobs_as_costumer_count, "# Jobs") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :created_at, "Registriert am") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center"><%= sort_link(@q, :role, "Rolle") %></th>
|
||||
<th class="w-1 p-2 py-3 text-center">Rolle ändern zu</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id='jobs' class="divide-y divivde-gray-300">
|
||||
|
||||
Reference in New Issue
Block a user