mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.9 KiB
96 lines
3.9 KiB
<div class="flex-wrap space-y-4 md:flex md:flex-nowrap md:space-y-0 md:space-x-10">
|
|
<%= render 'shared/settings_nav' %>
|
|
<div class="md:flex-grow">
|
|
<div class="flex flex-col md:flex-row md:flex-wrap gap-2 md:justify-between md:items-end mb-4 min-h-12">
|
|
<h1 class="text-4xl font-bold">
|
|
<% if params[:status] == 'archived' %>
|
|
<%= t('archived_users') %>
|
|
<% elsif params[:status] == 'integration' %>
|
|
<%= t('embedding_users') %>
|
|
<% else %>
|
|
<%= t('users') %>
|
|
<% end %>
|
|
</h1>
|
|
<div class="flex flex-col md:flex-row gap-y-2 gap-x-4 md:items-center">
|
|
<% if params[:status].blank? && can?(:create, User.new(account: current_account)) %>
|
|
<%= render 'users/extra_buttons' %>
|
|
<% if content_for(:add_user_button) %>
|
|
<%= content_for(:add_user_button) %>
|
|
<% else %>
|
|
<%= link_to new_user_path, class: 'btn btn-primary btn-md gap-2 w-full md:w-fit', data: { turbo_frame: 'modal' } do %>
|
|
<%= svg_icon('plus', class: 'w-6 h-6') %>
|
|
<span><%= t('new_user') %></span>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="table w-full table-lg rounded-b-none overflow-hidden">
|
|
<thead class="bg-base-200">
|
|
<tr class="text-neutral uppercase">
|
|
<th>
|
|
<%= t('name') %>
|
|
</th>
|
|
<th>
|
|
<%= t('email') %>
|
|
</th>
|
|
<th>
|
|
<%= t('role') %>
|
|
</th>
|
|
<th>
|
|
<%= t('last_session') %>
|
|
</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>
|
|
<span class="badge badge-info badge-outline whitespace-nowrap">
|
|
<%= t(user.role) %>
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<%= user.current_sign_in_at ? l(user.current_sign_in_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) : '-' %>
|
|
</td>
|
|
<td class="flex items-center space-x-2 justify-end">
|
|
<% if params[:status].blank? && can?(:update, user) && user.archived_at.blank? %>
|
|
<%= link_to edit_user_path(user), class: 'btn btn-outline btn-xs', title: t('edit'), data: { turbo_frame: 'modal' } do %>
|
|
<%= t('edit') %>
|
|
<% end %>
|
|
<% end %>
|
|
<% if params[:status] != 'archived' && can?(:destroy, user) && user != current_user %>
|
|
<%= 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') %>
|
|
<% end %>
|
|
<% end %>
|
|
<% if params[:status] == 'archived' && can?(:manage, user) && user != current_user && user.archived_at? %>
|
|
<%= 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') %>
|
|
<% end %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% if @pagy.pages > 1 %>
|
|
<%= render 'shared/pagination', pagy: @pagy, items_name: 'users', left_additional_html: render('bottom_links') %>
|
|
<% else %>
|
|
<div class="mt-2">
|
|
<%= render 'bottom_links' %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|