towerops/lib/towerops_web/live/org_live/index.html.heex
2026-02-05 14:57:11 -06:00

43 lines
1.6 KiB
Text

<Layouts.authenticated
flash={@flash}
current_scope={@current_scope}
>
<.header>
{@page_title}
<:actions>
<.button navigate={~p"/orgs/new"} variant="primary">
<.icon name="hero-plus" class="h-5 w-5" /> New Organization
</.button>
</:actions>
</.header>
<div :if={@organizations != []} class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
<button
:for={org <- @organizations}
type="button"
phx-click="select_org"
phx-value-org-id={org.id}
class="relative overflow-hidden rounded-lg border border-gray-200 bg-white p-6 shadow-sm hover:shadow-md transition-shadow dark:border-white/10 dark:bg-gray-800/50 cursor-pointer text-left"
>
<h2 class="text-xl font-semibold text-gray-900 dark:text-white">{org.name}</h2>
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
{Enum.find(org.memberships, &(&1.user_id == @current_scope.user.id)).role
|> to_string()
|> String.capitalize()}
</p>
</button>
</div>
<div :if={@organizations == []} class="text-center py-16">
<.icon name="hero-building-office" class="mx-auto h-12 w-12 text-gray-400 dark:text-gray-600" />
<h3 class="mt-4 text-lg font-semibold text-gray-900 dark:text-white">No organizations</h3>
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
Get started by creating a new organization.
</p>
<div class="mt-6">
<.button navigate={~p"/orgs/new"} variant="primary">
<.icon name="hero-plus" class="h-5 w-5" /> New Organization
</.button>
</div>
</div>
</Layouts.authenticated>