Allow admins to add and remove invitations per account
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-02-10 11:21:45 +01:00
parent ca238be6f4
commit f3159d30f1
8 changed files with 77 additions and 17 deletions

View File

@@ -42,27 +42,33 @@
</tr>
<tr>
<th>Invitations available</th>
<td>
<td data-controller="modal" data-action="keydown.esc->modal#close">
<div class="flex justify-between">
<span>
<%= @user.invitations.count %>
</span>
<span>
<%= render DropdownComponent.new(size: :small, icon_name: "edit") do %>
<%= render DropdownLinkComponent.new(
href: ""
) do %>
Add more
<% end %>
<%= render DropdownLinkComponent.new(
href: "",
separator: true, add_class: "text-red-700"
) do %>
Remove all
<button data-action="click->modal#open">
<%= render partial: "icons/plus-circle", locals: {
custom_class: "text-green-600 hover:text-green-500 -mt-2 -mb-1 h-6 w-6 inline-block"
} %>
</button>
<% if @user.invitations.unused.count > 0 %>
<%= link_to invitations_admin_user_path(@user.cn), data: {
turbo_method: :delete,
turbo_confirm: "Delete all of #{@user.cn}'s available invitations?"
} do %>
<%= render partial: "icons/x-circle", locals: {
custom_class: "text-red-600 hover:text-red-500 -mt-2 -mb-1 h-6 w-6 inline-block"
} %>
<% end %>
<% end %>
</span>
</div>
<%= render ModalComponent.new(show_close_button: false) do %>
<%= render partial: "admin/users/create_invitations",
locals: { user: @user } %>
<% end %>
</td>
</tr>
<tr>