towerops/lib/towerops_web/live/site_live/index.html.heex

56 lines
2.2 KiB
Text

<Layouts.authenticated
flash={@flash}
current_scope={@current_scope}
active_page="sites"
>
<.header>
{@page_title}
<:subtitle>Manage your site locations and hierarchy</:subtitle>
<:actions>
<.button navigate={~p"/sites/new"} variant="primary">
<.icon name="hero-plus" class="h-5 w-5" /> New Site
</.button>
</:actions>
</.header>
<%= if @sites == [] do %>
<div class="flex items-center justify-center py-16">
<div class="card bg-base-100 shadow-md border border-base-200 dark:border-white/10 max-w-md w-full">
<div class="card-body items-center text-center">
<div class="rounded-full bg-blue-100 dark:bg-blue-900/40 p-4 mb-2">
<.icon name="hero-map-pin-solid" class="h-12 w-12 text-blue-500 dark:text-blue-400" />
</div>
<h3 class="card-title text-gray-900 dark:text-white">No Sites Yet</h3>
<p class="text-sm text-gray-600 dark:text-gray-400">
Create your first site to organize devices by tower location.
</p>
<div class="card-actions mt-2">
<.button navigate={~p"/sites/new"} variant="primary">
<.icon name="hero-plus" class="h-4 w-4" /> Add Site
</.button>
</div>
</div>
</div>
</div>
<% else %>
<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
<.link
:for={site <- @sites}
navigate={~p"/sites/#{site.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"
>
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">{site.name}</h3>
<%= if site.location do %>
<p class="mt-2 flex items-center gap-1.5 text-sm text-gray-600 dark:text-gray-400">
<.icon name="hero-map-pin" class="h-4 w-4" /> {site.location}
</p>
<% end %>
<%= if site.parent_site do %>
<p class="mt-2 text-xs text-gray-500 dark:text-gray-500">
Parent: {site.parent_site.name}
</p>
<% end %>
</.link>
</div>
<% end %>
</Layouts.authenticated>