Files
docuseal/app/views/users/index.html.erb
T

96 lines
3.8 KiB
Plaintext
Raw Normal View History

2023-09-24 17:49:24 +03:00
<div class="flex-wrap space-y-4 md:flex md:flex-nowrap md:space-y-0 md:space-x-10">
2023-06-04 21:30:50 +03:00
<%= render 'shared/settings_nav' %>
2023-09-24 17:49:24 +03:00
<div class="md:flex-grow">
2024-10-24 20:09:57 +03:00
<div class="flex flex-col md:flex-row gap-2 md:justify-between md:items-end mb-4 min-h-12">
2024-09-18 19:47:47 +03:00
<h1 class="text-4xl font-bold">
2024-10-24 20:09:57 +03:00
<% if params[:status] == 'archived' %>
<%= t('archived_users') %>
<% elsif params[:status] == 'integration' %>
<%= t('embedding_users') %>
<% else %>
<%= t('users') %>
<% end %>
2024-09-18 19:47:47 +03:00
</h1>
2024-09-23 15:22:07 +03:00
<div class="flex flex-col md:flex-row gap-y-2 gap-x-4 md:items-center">
2024-10-24 20:09:57 +03:00
<% if params[:status].blank? && can?(:create, User.new(account: current_account)) %>
2024-05-27 19:49:27 +03:00
<%= render 'users/extra_buttons' %>
2024-05-26 20:51:02 +03:00
<% if content_for(:add_user_button) %>
<%= content_for(:add_user_button) %>
<% else %>
2024-09-23 15:22:07 +03:00
<%= link_to new_user_path, class: 'btn btn-primary btn-md gap-2 w-full md:w-fit', data: { turbo_frame: 'modal' } do %>
2024-05-26 20:51:02 +03:00
<%= svg_icon('plus', class: 'w-6 h-6') %>
2024-09-18 19:47:47 +03:00
<span><%= t('new_user') %></span>
2024-05-26 20:51:02 +03:00
<% end %>
2023-12-02 01:50:54 +02:00
<% end %>
2023-09-17 00:45:57 +03:00
<% end %>
2023-12-02 01:50:54 +02:00
</div>
2023-06-04 21:30:50 +03:00
</div>
<div class="overflow-x-auto">
2023-06-22 22:50:47 +03:00
<table class="table w-full table-lg rounded-b-none overflow-hidden">
2023-06-04 21:30:50 +03:00
<thead class="bg-base-200">
<tr class="text-neutral uppercase">
<th>
2024-09-18 19:47:47 +03:00
<%= t('name') %>
2023-06-04 21:30:50 +03:00
</th>
<th>
2024-09-18 19:47:47 +03:00
<%= t('email') %>
2023-06-04 21:30:50 +03:00
</th>
<th>
2024-09-18 19:47:47 +03:00
<%= t('role') %>
2023-06-04 21:30:50 +03:00
</th>
<th>
2024-09-18 19:47:47 +03:00
<%= t('last_session') %>
2023-06-04 21:30:50 +03:00
</th>
<th class="text-right" width="1px">
</th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr scope="row">
<td>
<%= user.full_name %>
</td>
<td>
<%= user.email %>
</td>
<td>
2023-06-29 02:04:17 +03:00
<span class="badge badge-info badge-outline">
2023-06-04 21:30:50 +03:00
<%= user.role %>
</span>
</td>
<td>
2025-01-27 15:51:47 +02:00
<%= user.current_sign_in_at ? l(user.current_sign_in_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) : '-' %>
2023-06-04 21:30:50 +03:00
</td>
<td class="flex items-center space-x-2 justify-end">
2024-10-24 20:09:57 +03:00
<% if params[:status].blank? && can?(:update, user) && user.archived_at.blank? %>
2024-09-18 19:47:47 +03:00
<%= link_to edit_user_path(user), class: 'btn btn-outline btn-xs', title: t('edit'), data: { turbo_frame: 'modal' } do %>
<%= t('edit') %>
2023-09-17 00:45:57 +03:00
<% end %>
2023-06-04 21:30:50 +03:00
<% end %>
2024-10-24 20:09:57 +03:00
<% if params[:status] != 'archived' && can?(:destroy, user) && user != current_user %>
2024-09-18 19:47:47 +03:00
<%= button_to user_path(user), method: :delete, class: 'btn btn-outline btn-error btn-xs', title: t('remove'), data: { turbo_confirm: t('are_you_sure_') } do %>
<%= t('remove') %>
2023-09-17 00:45:57 +03:00
<% end %>
2023-06-04 21:30:50 +03:00
<% end %>
2024-10-24 20:09:57 +03:00
<% if params[:status] == 'archived' && can?(:manage, user) && user != current_user && user.archived_at? %>
2024-09-18 19:47:47 +03:00
<%= button_to user_path(user), method: :put, params: { user: { archived_at: nil } }, class: 'btn btn-outline btn-xs', title: t('unarchive'), data: { turbo_confirm: t('are_you_sure_') } do %>
<%= t('unarchive') %>
2024-04-19 16:08:12 +03:00
<% end %>
<% end %>
2023-06-04 21:30:50 +03:00
</td>
2023-05-30 01:34:01 +03:00
</tr>
2023-06-04 21:30:50 +03:00
<% end %>
</tbody>
</table>
2023-05-30 00:55:14 +03:00
</div>
2024-04-19 16:08:12 +03:00
<% if @pagy.pages > 1 %>
2024-10-24 20:09:57 +03:00
<%= render 'shared/pagination', pagy: @pagy, items_name: 'users', left_additional_html: render('bottom_links') %>
2024-04-19 16:08:12 +03:00
<% else %>
<div class="mt-2">
2024-10-24 20:09:57 +03:00
<%= render 'bottom_links' %>
2024-04-19 16:08:12 +03:00
</div>
<% end %>
2023-05-30 00:55:14 +03:00
</div>
2023-06-04 21:30:50 +03:00
</div>