<.breadcrumb items={[ %{label: "Dashboard", navigate: ~p"/dashboard"}, %{label: "Settings", navigate: ~p"/orgs/#{@organization.slug}/settings"}, %{label: "Integrations", navigate: ~p"/orgs/#{@organization.slug}/settings/integrations"}, %{label: "Preseem"} ]} />

{t("Preseem Devices")}

{t( "For each Preseem access point, find and link the matching TowerOps device. This enables subscriber impact data when access points go down." )}

<%!-- Sub-navigation tabs --%>
<%!-- Filter pills --%>
<.link :for={{f, label} <- [{"all", "All"}, {"unmatched", "Unmatched"}, {"matched", "Matched"}]} id={"filter-#{f}"} patch={~p"/orgs/#{@organization.slug}/settings/integrations/preseem/devices?filter=#{f}"} class={[ "rounded-full px-3 py-1 text-xs font-medium", if(@filter == f, do: "bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300", else: "bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-white/5 dark:text-gray-400 dark:hover:bg-white/10" ) ]} > {label}
<%!-- Access points table --%>
<%= if @access_points == [] do %>
<.icon name="hero-signal" class="mx-auto h-12 w-12 text-gray-400 dark:text-gray-500" />

{t("No access points found")}

<%= case @filter do %> <% "unmatched" -> %> {t("All access points are matched. Nice!")} <% "matched" -> %> {t("No matched access points yet. Sync from Preseem and link devices.")} <% _ -> %> {t( "No Preseem access points have been synced yet. Enable the integration and run a sync." )} <% end %>

<% else %>
<%= for ap <- @access_points do %> <%!-- Inline linking row --%> <%= if ap.id == @linking_ap_id do %> <% end %> <% end %>
{t("Access Point")} {t("Actions")}
{ap.name || "Unnamed"} <%= if Map.has_key?(@suggestions, ap.id) do %> <.icon name="hero-light-bulb-mini" class="mr-0.5 h-3 w-3" /> Match found <% end %>
{ap.preseem_id} {humanize_confidence(ap.match_confidence)}
<%= if ap.device do %> <% else %> <% end %>

Find a TowerOps device to link to {ap.name}

<%!-- Suggestions --%> <%= if suggestions = @suggestions[ap.id] do %>

<.icon name="hero-light-bulb-mini" class="mr-0.5 inline h-3 w-3" /> {t("Suggested match (same IP):")}

<%= for suggestion <- suggestions do %> <% end %>
<% end %> <%!-- Search --%>
<%= if @search_results != [] do %>
<% end %> <%= if @device_search != "" and String.length(@device_search) >= 2 and @search_results == [] do %>

No devices found matching "{@device_search}"

<% end %>
<% end %>