2021-09-10 22:22:18 -04:00
|
|
|
<div class="flex flex-col space-y-8 justify-center items-center">
|
|
|
|
<h1 class="title text-2xl title-primary-500">
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= gettext("Listing Invites") %>
|
2021-09-10 22:22:18 -04:00
|
|
|
</h1>
|
|
|
|
|
|
|
|
<%= if @invites |> Enum.empty?() do %>
|
2022-02-01 00:11:37 -05:00
|
|
|
<h1 class="title text-xl text-primary-500">
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= gettext("No invites") %> 😔
|
2022-02-01 00:11:37 -05:00
|
|
|
</h1>
|
2021-09-10 22:22:18 -04:00
|
|
|
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= live_patch dgettext("actions", "Invite someone new!"),
|
|
|
|
to: Routes.invite_index_path(@socket, :new),
|
|
|
|
class: "btn btn-primary" %>
|
2021-09-10 22:22:18 -04:00
|
|
|
<% else %>
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= live_patch dgettext("actions", "Create Invite"),
|
|
|
|
to: Routes.invite_index_path(@socket, :new),
|
|
|
|
class: "btn btn-primary" %>
|
2021-09-10 22:22:18 -04:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<div class="flex flex-row flex-wrap space-x-4 space-y-4">
|
|
|
|
<%= for invite <- @invites do %>
|
|
|
|
<div class="px-8 py-4 flex flex-col justify-center items-center space-y-4
|
|
|
|
border border-gray-400 rounded-lg shadow-lg hover:shadow-md">
|
2022-01-31 21:42:41 -05:00
|
|
|
<h1 class="title text-xl">
|
2021-09-10 22:22:18 -04:00
|
|
|
<%= invite.name %>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<%= if invite.disabled_at |> is_nil() do %>
|
2022-01-31 21:42:41 -05:00
|
|
|
<h2 class="title text-md">
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= gettext("Uses Left:") %>
|
|
|
|
<%= invite.uses_left || "Unlimited" %>
|
2021-09-10 22:22:18 -04:00
|
|
|
</h2>
|
|
|
|
<% else %>
|
2022-01-31 21:42:41 -05:00
|
|
|
<h2 class="title text-md">
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= gettext("Invite Disabled") %>
|
2021-09-10 22:22:18 -04:00
|
|
|
</h2>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<code class="text-xs px-4 py-2 rounded-lg text-gray-100 bg-primary-800">
|
|
|
|
<%= Routes.user_registration_url(@socket, :new, invite: invite.token) %>
|
|
|
|
</code>
|
|
|
|
|
|
|
|
<div class="flex space-x-4 justify-center items-center">
|
2022-02-05 01:59:40 -05:00
|
|
|
<%= live_patch to: Routes.invite_index_path(@socket, :edit, invite),
|
|
|
|
class: "text-primary-500 link" do %>
|
|
|
|
<i class="fa-fw fa-lg fas fa-edit"></i>
|
|
|
|
<% end %>
|
2021-09-10 22:22:18 -04:00
|
|
|
|
2022-02-05 01:59:40 -05:00
|
|
|
<%= link to: "#",
|
|
|
|
class: "text-primary-500 link",
|
|
|
|
phx_click: "delete",
|
2021-09-10 22:22:18 -04:00
|
|
|
phx_value_id: invite.id,
|
2022-02-09 00:58:53 -05:00
|
|
|
data: [confirm: dgettext("prompts", "Are you sure you want to delete the invite for %{name}?", name: invite.name)] do %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<i class="fa-fw fa-lg fas fa-trash"></i>
|
|
|
|
<% end %>
|
2021-09-10 22:22:18 -04:00
|
|
|
|
|
|
|
<%= if invite.disabled_at |> is_nil() do %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<a href="#" class="btn btn-primary"
|
2021-09-10 22:22:18 -04:00
|
|
|
phx-click="disable" phx-value-id="<%= invite.id %>">
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= gettext("Disable") %>
|
2021-09-10 22:22:18 -04:00
|
|
|
</a>
|
|
|
|
<% else %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<a href="#" class="btn btn-primary"
|
2021-09-10 22:22:18 -04:00
|
|
|
phx-click="enable" phx-value-id="<%= invite.id %>">
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= gettext("Enable") %>
|
2021-09-10 22:22:18 -04:00
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= if invite.disabled_at |> is_nil() and not(invite.uses_left |> is_nil()) do %>
|
2022-02-05 01:59:40 -05:00
|
|
|
<a href="#" class="btn btn-primary"
|
2021-09-10 22:22:18 -04:00
|
|
|
phx-click="set_unlimited" phx-value-id="<%= invite.id %>"
|
2022-02-11 00:34:29 -05:00
|
|
|
data-confirm={dgettext("prompts", "Are you sure you want to make %{name} unlimited?", name: invite.name)}>
|
2022-02-09 00:58:53 -05:00
|
|
|
<%= gettext("Set Unlimited") %>
|
2021-09-10 22:22:18 -04:00
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-09-10 00:23:26 -04:00
|
|
|
|
|
|
|
<%= if @live_action in [:new, :edit] do %>
|
|
|
|
<%= live_modal CanneryWeb.InviteLive.FormComponent,
|
|
|
|
id: @invite.id || :new,
|
|
|
|
title: @page_title,
|
|
|
|
action: @live_action,
|
|
|
|
invite: @invite,
|
2021-09-10 22:22:18 -04:00
|
|
|
return_to: Routes.invite_index_path(@socket, :index),
|
|
|
|
current_user: @current_user %>
|
2021-09-10 00:23:26 -04:00
|
|
|
<% end %>
|