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

85 lines
3.2 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">
2023-06-04 21:30:50 +03:00
<div class="flex justify-between mb-4">
<h1 class="text-4xl font-bold">Team</h1>
2023-12-02 01:50:54 +02:00
<div class="flex items-center space-x-4">
<% if !Docuseal.multitenant? %>
<% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::FORCE_MFA) %>
<% if can?(:manage, account_config) %>
<%= form_for :force_mfa, url: mfa_force_path do |f| %>
<label for="force_mfa_value" class="flex items-center justify-between space-x-2 border py-2.5 px-3 rounded-md">
<span>
Force 2FA
</span>
<%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %>
</label>
<% end %>
<% end %>
<% end %>
<% if can?(:create, User.new(account: current_account)) %>
<%= link_to new_user_path, class: 'btn btn-primary btn-md gap-2', data: { turbo_frame: 'modal' } do %>
<%= svg_icon('plus', class: 'w-6 h-6') %>
<span>New User</span>
<% 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>
Name
</th>
<th>
Email
</th>
<th>
Role
</th>
<th>
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>
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>
2023-06-30 01:26:13 +03:00
<%= user.last_sign_in_at ? l(user.last_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">
2023-09-17 00:45:57 +03:00
<% if can?(:update, user) %>
<%= link_to edit_user_path(user), class: 'btn btn-outline btn-xs', title: 'Edit', data: { turbo_frame: 'modal' } do %>
Edit
<% end %>
2023-06-04 21:30:50 +03:00
<% end %>
2023-09-17 00:45:57 +03:00
<% if can?(:destroy, user) && user != current_user %>
<%= button_to user_path(user), method: :delete, class: 'btn btn-outline btn-error btn-xs', title: 'Delete', data: { turbo_confirm: 'Are you sure?' } do %>
Remove
<% end %>
2023-06-04 21:30:50 +03:00
<% end %>
</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>
2023-06-30 01:26:13 +03:00
<%= render 'shared/pagination', pagy: @pagy, items_name: 'users' %>
2023-05-30 00:55:14 +03:00
</div>
2023-06-04 21:30:50 +03:00
</div>