<.header> Sites Map Geographic <:subtitle>Geographic locations of your sites <:actions> <.button phx-click="refresh_map"> <.icon name="hero-arrow-path" class="h-5 w-5" /> Refresh <.button navigate={~p"/sites/new"} variant="primary"> <.icon name="hero-plus" class="h-5 w-5" /> Add Site

Geographic Site Locations

Click markers to view site details

Showing <%= length(@sites) %> sites with coordinates
<.icon name="hero-arrow-path" class="h-8 w-8 text-gray-400 animate-spin mx-auto" />

Loading map...

Statistics

Total Sites
<%= Sites.count_organization_sites(@organization.id) %>
Geocoded Sites
<%= length(@sites) %>
Coverage
<%= if Sites.count_organization_sites(@organization.id) > 0 do %> <%= round(length(@sites) / Sites.count_organization_sites(@organization.id) * 100) %>% <% else %> 0% <% end %>

Sites with Geographic Data

<%= if length(@sites) > 0 do %>
<%= for site <- @sites do %>

<%= site.name %>

<%= if site.device_count > 0 do %> <%= site.device_count %> devices <% end %>
<%= if site.address do %>

<%= site.address %>

<% end %> <%= if site.description do %>

<%= site.description %>

<% end %>

<%= Float.round(site.latitude, 4) %>, <%= Float.round(site.longitude, 4) %>

<.link navigate={~p"/sites/#{site.id}"} class="text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300 text-sm font-medium" > View →
<% end %>
<% else %>
<.icon name="hero-map-pin" class="mx-auto h-12 w-12 text-gray-400" />

No geocoded sites

Add addresses and coordinates to your sites to see them on the map.

<.button navigate={~p"/sites"}> Manage Sites
<% end %>