Râu Cao c99d8545c1
All checks were successful
continuous-integration/drone/push Build is passing
Add username filter to admin invitations index
2025-05-28 12:34:52 +04:00

57 lines
1.7 KiB
Plaintext

<%= render HeaderComponent.new(title: "Invitations") %>
<%= render MainSimpleComponent.new do %>
<section>
<%= render QuickstatsContainerComponent.new do %>
<%= render QuickstatsItemComponent.new(
type: :number,
title: 'Available',
value: @stats[:available],
) %>
<%= render QuickstatsItemComponent.new(
type: :number,
title: 'Accepted',
value: @stats[:accepted],
) %>
<%= render QuickstatsItemComponent.new(
type: :number,
title: 'Users with referrals',
value: @stats[:users_with_referrals],
meta: "/ #{User.count}"
) %>
<% end %>
</section>
<section>
<%= render partial: "admin/username_search_form",
locals: { path: admin_invitations_path } %>
</section>
<% if @invitations_used.any? %>
<section>
<h3>Accepted</h3>
<table class="divided mb-8">
<thead>
<tr>
<th>Token</th>
<th>Accepted</th>
<th>Inviter</th>
<th>Invited user</th>
</tr>
</thead>
<tbody>
<% @invitations_used.each do |invitation| %>
<tr>
<td class="overflow-ellipsis font-mono"><%= invitation.token %></td>
<td><%= invitation.used_at.strftime("%Y-%m-%d (%H:%M UTC)") %></td>
<td><%= link_to invitation.user.cn, admin_user_path(invitation.user.cn), class: "ks-text-link" %></td>
<td><%= link_to invitation.invitee.cn, admin_user_path(invitation.invitee.cn), class: "ks-text-link" %></td>
</tr>
<% end %>
</tbody>
</table>
<%== pagy_nav @pagy %>
</section>
<% end %>
<% end %>