Admin - Maps Management

<.link navigate={~p"/admin"} class="btn btn-ghost btn-sm"> <.icon name="hero-arrow-left-solid" class="w-4 h-4" /> Back to Admin
<.async_result :let={maps} assign={@maps}> <:loading>
<:failed :let={reason}>
{inspect(reason)}
<% filtered_maps = filter_maps(maps, @search_term, @show_deleted) %> <% paginated_maps = paginate(filtered_maps, @page, @per_page) %> <.table id="admin-maps" rows={paginated_maps} class="!max-h-[60vh] !overflow-y-auto"> <:col :let={map} label="Name">
{map.name} Deleted
<:col :let={map} label="Slug"> {map.slug} <:col :let={map} label="Owner"> {owner_name(map.owner)} <:col :let={map} label="Created"> {format_date(map.inserted_at)} <:col :let={map} label="Scope"> {map.scope} <:action :let={map}> <.link patch={~p"/admin/maps/#{map.id}/edit"} class="btn btn-ghost btn-xs hover:text-white" title="Edit" > <.icon name="hero-pencil-solid" class="w-4 h-4" /> <:action :let={map}> <.link patch={~p"/admin/maps/#{map.id}/acls"} class="btn btn-ghost btn-xs hover:text-white" title="View ACLs" > <.icon name="hero-shield-check-solid" class="w-4 h-4" /> <:action :let={map}>
@per_page} class="flex items-center justify-between mt-4" > Page {@page} of {total_pages(filtered_maps, @per_page)} ({length(filtered_maps)} maps)
No maps found
<.modal :if={@live_action == :edit and not is_nil(@selected_map)} title="Edit Map" class="!w-[500px]" id="edit_map_modal" show on_cancel={JS.patch(~p"/admin/maps")} > <.form :let={f} for={@form} phx-change="validate" phx-submit="save"> <.input type="text" field={f[:name]} label="Name" placeholder="Map name" /> <.input type="text" field={f[:slug]} label="Slug" placeholder="map-slug" /> <.input type="textarea" field={f[:description]} label="Description" placeholder="Description" /> <.input type="select" field={f[:scope]} label="Scope" options={[ {"Wormholes", :wormholes}, {"Stargates", :stargates}, {"None", :none}, {"All", :all} ]} /> <.input type="select" field={f[:owner_id]} label="Owner" options={@owner_options} prompt="Select owner..." /> <.modal :if={@live_action == :view_acls and not is_nil(@selected_map)} title={"ACLs for: #{@selected_map.name}"} class="!w-[600px]" id="view_acls_modal" show on_cancel={JS.patch(~p"/admin/maps")} >
No ACLs assigned to this map

{acl.name}

{acl.description || "No description"}

{length(acl.members)} members
Owner: {if acl.owner, do: acl.owner.name, else: "Unknown"}