<% add_decidim_page_title(t("decidim.admin.titles.users")) %>

<%= t "decidim.admin.titles.users" %> <% if allowed_to? :create, :admin_user %> <%= link_to t("actions.user.new", scope: "decidim.admin"), [:new, :user], class: "button button__sm button__secondary" %> <% end %>

<%= admin_filter_selector %>
<% @users.each do |user| %> <% end %>
<%= sort_link(query, :role, t("models.user.fields.role", scope: "decidim.admin"), default_order: :desc) %> <%= sort_link(query, :name, t("models.user.fields.name", scope: "decidim.admin"), default_order: :desc) %> <%= sort_link(query, :email, t("models.user.fields.email", scope: "decidim.admin"), default_order: :desc) %> <%= sort_link(query, :invitation_sent_at, t("models.user.fields.invitation_sent_at", scope: "decidim.admin"), default_order: :desc) %> <%= sort_link(query, :invitation_accepted_at, t("models.user.fields.invitation_accepted_at", scope: "decidim.admin"), default_order: :desc) %> <%= sort_link(query, :last_sign_in_at, t("models.user.fields.last_sign_in_at", scope: "decidim.admin"), default_order: :desc) %> <%= sort_link(query, :created_at, t("models.user.fields.created_at", scope: "decidim.admin"), default_order: :desc) %>
<%= t("models.user.fields.roles.#{user.active_role}", scope: "decidim.admin") %> <%= user.name %> <%= user.email %> <% if user.invitation_sent_at %> <%= l user.invitation_sent_at, format: :short %> <% end %> <% if user.invitation_accepted_at %> <%= l user.invitation_accepted_at, format: :short %> <% end %> <% if user.last_sign_in_at %> <%= l user.last_sign_in_at, format: :short %> <% end %> <%= l user.created_at, format: :short %> <% if allowed_to?(:invite, :admin_user, user: user) && user.invited_to_sign_up? %> <%= icon_link_to "refresh-line", [:resend_invitation, user], t("actions.resend_invitation", scope: "decidim.admin"), class: "resend-invitation", method: :post %> <% end %> <% if allowed_to? :destroy, :admin_user, user: user %> <%= icon_link_to "delete-bin-line", user, t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %> <% end %>
<%= decidim_paginate @users %>